This commit is contained in:
HolographicHat
2024-07-17 18:12:24 +08:00
parent f737122247
commit 793ad075fe
6 changed files with 18 additions and 32 deletions

View File

@@ -32,7 +32,7 @@ namespace Hook {
uint16_t BitConverter_ToUInt16(ByteArray* val, const int startIndex) {
const auto ret = CALL_ORIGIN(BitConverter_ToUInt16, val, startIndex);
if (ret == 0xAB89 && ReadMapped<UINT16>(val->vector, 2) == 7450) {
if (ret == 0xAB89 && ReadMapped<UINT16>(val->vector, 2) == 3199) {
const auto headLength = ReadMapped<UINT16>(val->vector, 4);
const auto dataLength = ReadMapped<UINT32>(val->vector, 6);
const auto cStr = base64_encode(val->vector + 10 + headLength, dataLength) + "\n";
@@ -45,27 +45,21 @@ namespace Hook {
}
void Run(HMODULE* phModule) {
AllocConsole();
freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
//AllocConsole();
//freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
while ((unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == nullptr) {
Sleep(1000);
}
Sleep(5000);
DisableVMProtect();
void* ppRecordUserData = nullptr;
InitIL2CPP(ppRecordUserData);
if (!ppRecordUserData) {
ErrorDialog("ppRecordUserData == nullptr\n");
ExitProcess(-1);
}
InitIL2CPP();
for (int i = 0; i < 3; i++) {
const auto result = Genshin::RecordUserData(i);
checksum += string(reinterpret_cast<char*>(&result->vector[0]), result->max_length);
baClass = result->klass;
}
printf("Checksum=%s\n", checksum.c_str());
HookManager::install(Genshin::RecordUserData, Hook::UnityEngine_RecordUserData);
HookManager::install(Genshin::BitConverter_ToUInt16, Hook::BitConverter_ToUInt16);
*(void**) ppRecordUserData = (void*) &Hook::UnityEngine_RecordUserData;
hPipe = CreateFile(R"(\\.\pipe\YaeAchievementPipe)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hPipe == INVALID_HANDLE_VALUE) {
Win32ErrorDialog(1001);