diff --git a/cmake/QtUtils.cmake b/cmake/QtUtils.cmake index fc164a8..d32c825 100644 --- a/cmake/QtUtils.cmake +++ b/cmake/QtUtils.cmake @@ -8,26 +8,9 @@ macro(msvc_registry_search) string(REPLACE "/Tools" ";" QT_ROOT "${QT_ROOT}") list(GET QT_ROOT 0 QT_ROOT) endif() - file(GLOB QT_VERSIONS "${QT_ROOT}/5.13*") - list(SORT QT_VERSIONS) - # assume the latest version will be last alphabetically - list(REVERSE QT_VERSIONS) - - list(GET QT_VERSIONS 0 QT_VERSION) - - # fix any double slashes which seem to be common - string(REPLACE "//" "/" QT_VERSION "${QT_VERSION}") - - if(MSVC_VERSION GREATER_EQUAL 1920) - set(QT_MSVC 2019) - elseif(MSVC_VERSION GREATER_EQUAL 1910) - set(QT_MSVC 2017) - elseif(MSVC_VERSION GREATER_EQUAL 1900) - set(QT_MSVC 2015) - else() - message(WARNING "Unsupported MSVC toolchain version") - endif() + set(QT_VERSION 5.13.2) + set(QT_MSVC 2019) if(QT_MSVC) if(CMAKE_CL_64) @@ -35,17 +18,7 @@ macro(msvc_registry_search) else() set(QT_SUFFIX "") endif() - - # MSVC 2015+ is only backwards compatible - if(EXISTS "${QT_VERSION}/msvc${QT_MSVC}${QT_SUFFIX}") - set(Qt5_DIR "${QT_VERSION}/msvc${QT_MSVC}${QT_SUFFIX}/lib/cmake/Qt5") - elseif(QT_MSVC GREATER_EQUAL 2019 AND EXISTS "${QT_VERSION}/msvc2017${QT_SUFFIX}") - set(Qt5_DIR "${QT_VERSION}/msvc2017${QT_SUFFIX}/lib/cmake/Qt5") - elseif(QT_MSVC GREATER_EQUAL 2017 AND EXISTS "${QT_VERSION}/msvc2015${QT_SUFFIX}") - set(Qt5_DIR "${QT_VERSION}/msvc2015${QT_SUFFIX}/lib/cmake/Qt5") - else() - message(WARNING "Required QT5 toolchain is not installed") - endif() + set(Qt5_DIR "${QT_VERSION}/msvc2017${QT_SUFFIX}/lib/cmake/Qt5") endif() endif() endmacro() @@ -55,6 +28,11 @@ macro(find_qt5) #set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) #add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(Qt5_DIR "C:/Qt/Qt5.13.2/5.13.2/msvc2017_64/lib/cmake/Qt5") + else() + set(Qt5_DIR "C:/Qt/Qt5.13.2/5.13.2/msvc2017/lib/cmake/Qt5") + endif() find_package(Qt5 COMPONENTS ${ARGN}) if(Qt5_FOUND) diff --git a/extensions/deepltranslate.cpp b/extensions/deepltranslate.cpp index a20fd88..a973d79 100644 --- a/extensions/deepltranslate.cpp +++ b/extensions/deepltranslate.cpp @@ -9,43 +9,52 @@ const char* TRANSLATION_PROVIDER = "DeepL Translate"; const char* GET_API_KEY_FROM = "https://www.deepl.com/pro.html#developer"; extern const QStringList languagesTo { + "Arabic", "Bulgarian", - "Chinese (Simplified)", "Czech", "Danish", - "Dutch", - "English (American)", + "German", + "Greek", + "English (backward compatibility)", "English (British)", + "English (American)", + "Spanish", "Estonian", "Finnish", "French", - "German", - "Greek", "Hungarian", "Indonesian", "Italian", "Japanese", - "Latvian", + "Korean", "Lithuanian", + "Latvian", + "Norwegian Bokmål", + "Dutch", "Polish", - "Portuguese (Brazil)", - "Portuguese (Portugal)", + "Portuguese (backward compatibility)", + "Portuguese (Brazilian)", + "Portuguese (all Portuguese variants excluding Brazilian Portuguese)", "Romanian", "Russian", "Slovak", "Slovenian", - "Spanish", "Swedish", - "Turkish" + "Turkish", + "Ukrainian", + "Chinese (backward compatibility)", + "Chinese (simplified)", + "Chinese (traditional)" }, languagesFrom { + "Arabic", "Bulgarian", - "Chinese", + "Chinese (all Chinese variants)", "Czech", "Danish", "Dutch", - "English", + "English (all English variants)", "Estonian", "Finnish", "French", @@ -55,52 +64,64 @@ languagesFrom "Indonesian", "Italian", "Japanese", + "Korean", "Latvian", "Lithuanian", + "Norwegian Bokmål", "Polish", - "Portuguese", + "Portuguese (all Portuguese variants)", "Romanian", "Russian", "Slovak", "Slovenian", "Spanish", "Swedish", - "Turkish" + "Turkish", + "Ukrainian" }; extern const std::unordered_map codes { + { { L"Arabic" }, { L"AR" } }, { { L"Bulgarian" }, { L"BG" } }, - { { L"Chinese" }, { L"ZH" } }, - { { L"Chinese (Simplified)" }, { L"ZH" } }, { { L"Czech" }, { L"CS" } }, { { L"Danish" }, { L"DA" } }, - { { L"Dutch" }, { L"NL" } }, - { { L"English" }, { L"EN" } }, - { { L"English (American)" }, { L"EN-US" } }, + { { L"German" }, { L"DE" } }, + { { L"Greek" }, { L"EL" } }, + { { L"English (all English variants)" }, { L"EN" } }, + { { L"English (backward compatibility)" }, { L"EN" } }, { { L"English (British)" }, { L"EN-GB" } }, + { { L"English (American)" }, { L"EN-US" } }, + { { L"Spanish" }, { L"ES" } }, { { L"Estonian" }, { L"ET" } }, { { L"Finnish" }, { L"FI" } }, { { L"French" }, { L"FR" } }, - { { L"German" }, { L"DE" } }, - { { L"Greek" }, { L"EL" } }, { { L"Hungarian" }, { L"HU" } }, { { L"Indonesian" }, { L"ID" } }, { { L"Italian" }, { L"IT" } }, { { L"Japanese" }, { L"JA" } }, - { { L"Latvian" }, { L"LV" } }, + { { L"Korean" }, { L"KO" } }, { { L"Lithuanian" }, { L"LT" } }, + { { L"Latvian" }, { L"LV" } }, + { { L"Norwegian Bokmål" }, { L"NB" } }, + { { L"Dutch" }, { L"NL" } }, { { L"Polish" }, { L"PL" } }, - { { L"Portuguese" }, { L"PT" } }, - { { L"Portuguese (Brazil)" }, { L"PT-BR" } }, - { { L"Portuguese (Portugal)" }, { L"PT-PT" } }, + { { L"Portuguese (all Portuguese variants)" }, { L"PT" } }, + { { L"Portuguese (backward compatibility)" }, { L"PT" } }, + { { L"Portuguese (Brazilian)" }, { L"PT-BR" } }, + { { L"Portuguese (all Portuguese variants excluding Brazilian Portuguese)" }, { L"PT-PT" } }, { { L"Romanian" }, { L"RO" } }, { { L"Russian" }, { L"RU" } }, { { L"Slovak" }, { L"SK" } }, { { L"Slovenian" }, { L"SL" } }, - { { L"Spanish" }, { L"ES" } }, { { L"Swedish" }, { L"SV" } }, { { L"Turkish" }, { L"TR" } }, + { { L"Ukrainian" }, { L"UK" } }, + { { L"Chinese (all Chinese variants)" }, { L"ZH" } }, + { { L"Chinese (backward compatibility)" }, { L"ZH" } }, + { { L"Chinese (simplified)" }, { L"ZH-HANS" } }, + { { L"Chinese (traditional)" }, { L"ZH-HANT" } }, { { L"?" }, { L"auto" } } + }; bool translateSelectedOnly = true, useRateLimiter = true, rateLimitSelected = true, useCache = true, useFilter = true; diff --git a/texthook/engine/engine.cc b/texthook/engine/engine.cc index c2c7abc..fcbe13c 100644 --- a/texthook/engine/engine.cc +++ b/texthook/engine/engine.cc @@ -27,6 +27,7 @@ //#include #include #include +#include // jichi 375/2014: Add offset of pusha/pushad // http://faydoc.tripod.com/cpu/pushad.htm @@ -21026,6 +21027,84 @@ bool InsertTecmoPSPHook() } #endif // 0 + +//for debug +void StringBlockProcessor(char* str, size_t* size, size_t fixlength) +{ + size_t original_len = *size; + size_t new_len = 0; + char* new_str = new char[original_len + 1]; + + size_t i = 0; + while (i < original_len) { + size_t block_end = i + fixlength; + if (block_end > original_len) { + block_end = original_len; + } + + size_t block_len = block_end - i; + char* block = str + i; + + for (size_t j = 0; j < block_len; ++j) { + if (block[j] != 0) { + new_str[new_len++] = block[j]; + } + else { + break; + } + } + + i = block_end; + } + + new_str[new_len] = '\0'; + + std::memcpy(str, new_str, new_len + 1); + *size = new_len; + delete[] new_str; +} + +bool DACFilter(LPVOID data, DWORD* size, HookParam*, BYTE) +{ + auto text = reinterpret_cast(data); + auto len = reinterpret_cast(size); + + StringBlockProcessor(text, len, 0x3f); + return true; +} + +bool InsertDACHook() +{ + const BYTE bytecodes[] = { + 0x0F, 0xBF, 0x56, 0x34, // movsx edx, word ptr ds:[esi+34] + 0x83, 0xC2, 0x05, // add edx, 5 + 0x8B, 0x8E, 0x00, 0x01, 0x00, 0x00, // mov ecx, dword ptr ds:[esi+100] + 0x0F, 0xAF, 0xD3 // imul edx, ebx <-- + }; + + ULONG addr = MemDbg::findBytes(bytecodes, sizeof(bytecodes), processStartAddress, processStopAddress); + if (addr == 0) { + ConsoleOutput("vnreng:DAC: pattern not found"); + return false; + } + enum { addr_offset = 13 }; + + HookParam hp = {}; + hp.type = USING_STRING; //S + hp.address = addr + addr_offset; + hp.offset = pusha_ecx_off - 4; //-C + hp.index = 0x00; + hp.filter_fun = DACFilter; + hp.length_fun = [](uintptr_t, uintptr_t data) + { + int len = 0x3f; + return len * 4; + }; + NewHook(hp, "DAC"); + ConsoleOutput("vnreng: INSERT DAC"); + return true; +} + /** jichi 7/19/2014 PCSX2 * Tested wit pcsx2-v1.2.1-328-gef0e3fe-windows-x86, built at http://buildbot.orphis.net/pcsx2 */ @@ -21261,7 +21340,6 @@ bool InsertTypeMoonPS2Hook() ConsoleOutput("vnreng: TypeMoon PS2: leave"); return addr; } - /** 8/3/2014 jichi * Tested game: School Rumble ã­ã‚‹å¨˜ï¿½è‚²ã¤ * diff --git a/texthook/engine/engine.h b/texthook/engine/engine.h index 5e167b2..026cd8f 100644 --- a/texthook/engine/engine.h +++ b/texthook/engine/engine.h @@ -96,6 +96,7 @@ bool InsertCandyHook(); // SystemC@CandySoft: *.fpk bool InsertCatSystemHook(); // CatSystem2: *.int bool InsertCMVSHook(); // CMVS: data/pack/*.cpz; do not support the latest cmvs32.exe and cmvs64.exe bool InsertCotophaHook(); // Cotopha: *.noa +bool InsertDACHook(); // DAC bool InsertDebonosuHook(); // Debonosu: bmp.bak and dsetup.dll bool InsertEaglsHook(); // E.A.G.L.S: EAGLES.dll bool InsertEMEHook(); // EmonEngine: emecfg.ecf diff --git a/texthook/engine/match32.cc b/texthook/engine/match32.cc index fffc4c7..edcde6a 100644 --- a/texthook/engine/match32.cc +++ b/texthook/engine/match32.cc @@ -54,6 +54,11 @@ bool DeterminePCEngine() return true; } + if (Util::CheckFile(L"script.dpk")) { + InsertDACHook(); + return true; + } + // jichi 5/14/2015: Skip hijacking BALDRSKY ZEROs //if (Util::CheckFile(L"bsz_Data\\Mono\\mono.dll") || Util::CheckFile(L"bsz2_Data\\Mono\\mono.dll")) { // ConsoleOutput("vnreng: IGNORE BALDRSKY ZEROs");