Compare commits

..

No commits in common. "04c6d1f27f4b307060a0a7a06a5d6c37d6992962" and "8d3b6f5ca5d3da6c43138663b1e555f4d5bcefcf" have entirely different histories.

3 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(kgg-dec VERSION 0.5.1 LANGUAGES CXX)
project(kgg-dec VERSION 0.5 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -27,7 +27,7 @@ class KggTask {
void info(const wchar_t* msg) const { fwprintf(stderr, L"[INFO] %s (%s)\n", msg, kgg_path_.filename().c_str()); }
void info(const std::wstring& msg) const { info(msg.c_str()); }
void Execute(const Infra::kgm_ekey_db_t& ekey_db, const std::wstring_view suffix) const {
void Execute(const Infra::kgm_ekey_db_t& ekey_db) const {
constexpr static std::array<uint8_t, 16> kMagicHeader{0x7C, 0xD5, 0x32, 0xEB, 0x86, 0x02, 0x7F, 0x4B,
0xA8, 0xAF, 0xA6, 0x8E, 0x0F, 0xFF, 0x99, 0x14};
@ -70,7 +70,7 @@ class KggTask {
kgg_stream_in.read(magic.data(), 4);
qmc2->Decrypt(std::span(reinterpret_cast<uint8_t*>(magic.data()), 4), 0);
auto real_ext = DetectRealExt(magic);
auto out_path = out_dir_ / std::format(L"{}{}.{}", kgg_path_.stem().wstring(), suffix, real_ext);
auto out_path = out_dir_ / std::format(L"{}_kgg-dec.{}", kgg_path_.stem().wstring(), real_ext);
if (exists(out_path)) {
warning(std::format(L"output file already exists: {}", out_path.filename().wstring()));
@ -117,8 +117,7 @@ class KggTask {
class KggTaskQueue {
public:
explicit KggTaskQueue(Infra::kgm_ekey_db_t ekey_db, const std::wstring_view suffix)
: ekey_db_(std::move(ekey_db)), suffix_(suffix) {}
explicit KggTaskQueue(Infra::kgm_ekey_db_t ekey_db) : ekey_db_(std::move(ekey_db)) {}
void Push(std::unique_ptr<KggTask> task) {
std::lock_guard lock(mutex_);
@ -161,13 +160,12 @@ class KggTaskQueue {
private:
bool thread_end_{false};
Infra::kgm_ekey_db_t ekey_db_;
std::wstring suffix_;
void WorkerThreadBody() {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
std::unique_ptr<KggTask> task{nullptr};
while ((task = Pop())) {
task->Execute(ekey_db_, suffix_);
task->Execute(ekey_db_);
}
}

View File

@ -103,7 +103,7 @@ int main() {
}
#endif
KggTaskQueue queue(ekey_db, file_suffix);
KggTaskQueue queue(ekey_db);
auto thread_count =
#ifndef NDEBUG
1;