buildenv, deepl, dac
This commit is contained in:
Chenx221 2024-12-17 10:34:13 -08:00
parent df5b830d17
commit 3b22857d12
5 changed files with 140 additions and 57 deletions

View File

@ -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)

View File

@ -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<std::wstring, std::wstring> 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;

View File

@ -27,6 +27,7 @@
//#include <boost/foreach.hpp>
#include <cstdio>
#include <string>
#include <sstream>
// 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<LPSTR>(data);
auto len = reinterpret_cast<size_t*>(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 <EFBFBD>
*

View File

@ -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

View File

@ -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");