mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-12 01:18:15 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
793ad075fe |
@@ -32,7 +32,7 @@ namespace Hook {
|
|||||||
|
|
||||||
uint16_t BitConverter_ToUInt16(ByteArray* val, const int startIndex) {
|
uint16_t BitConverter_ToUInt16(ByteArray* val, const int startIndex) {
|
||||||
const auto ret = CALL_ORIGIN(BitConverter_ToUInt16, val, 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 headLength = ReadMapped<UINT16>(val->vector, 4);
|
||||||
const auto dataLength = ReadMapped<UINT32>(val->vector, 6);
|
const auto dataLength = ReadMapped<UINT32>(val->vector, 6);
|
||||||
const auto cStr = base64_encode(val->vector + 10 + headLength, dataLength) + "\n";
|
const auto cStr = base64_encode(val->vector + 10 + headLength, dataLength) + "\n";
|
||||||
@@ -45,27 +45,21 @@ namespace Hook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Run(HMODULE* phModule) {
|
void Run(HMODULE* phModule) {
|
||||||
AllocConsole();
|
//AllocConsole();
|
||||||
freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
|
//freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
|
||||||
while ((unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == nullptr) {
|
while ((unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == nullptr) {
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
}
|
}
|
||||||
Sleep(5000);
|
Sleep(5000);
|
||||||
DisableVMProtect();
|
DisableVMProtect();
|
||||||
void* ppRecordUserData = nullptr;
|
InitIL2CPP();
|
||||||
InitIL2CPP(ppRecordUserData);
|
|
||||||
if (!ppRecordUserData) {
|
|
||||||
ErrorDialog("ppRecordUserData == nullptr\n");
|
|
||||||
ExitProcess(-1);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
const auto result = Genshin::RecordUserData(i);
|
const auto result = Genshin::RecordUserData(i);
|
||||||
checksum += string(reinterpret_cast<char*>(&result->vector[0]), result->max_length);
|
checksum += string(reinterpret_cast<char*>(&result->vector[0]), result->max_length);
|
||||||
baClass = result->klass;
|
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);
|
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);
|
hPipe = CreateFile(R"(\\.\pipe\YaeAchievementPipe)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
if (hPipe == INVALID_HANDLE_VALUE) {
|
if (hPipe == INVALID_HANDLE_VALUE) {
|
||||||
Win32ErrorDialog(1001);
|
Win32ErrorDialog(1001);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ using namespace Genshin;
|
|||||||
|
|
||||||
// DO_APP_FUNC(CN_OFFSET, OS_OFFSET, RETURN, FUNC_NAME, (ARGS...));
|
// DO_APP_FUNC(CN_OFFSET, OS_OFFSET, RETURN, FUNC_NAME, (ARGS...));
|
||||||
|
|
||||||
DO_APP_FUNC(0x005DDC40, 0x006A2A90, ByteArray*, il2cpp_array_new_specific, (void* arrayTypeInfo, uint64_t length));
|
DO_APP_FUNC(0x0052A510, 0x0052ED10, ByteArray*, il2cpp_array_new_specific, (void* arrayTypeInfo, uint64_t length));
|
||||||
|
|
||||||
DO_APP_FUNC(0x06F7D5B0, 0x06C68BE0, ByteArray*, RecordUserData, (int32_t nType));
|
DO_APP_FUNC(0x01688250, 0x0168CB50, ByteArray*, RecordUserData, (int32_t nType));
|
||||||
|
|
||||||
DO_APP_FUNC(0x0D1C10F0, 0x0D1BA490, uint16_t, BitConverter_ToUInt16, (ByteArray* val, int startIndex));
|
DO_APP_FUNC(0x0FC7D610, 0x0FCA7240, uint16_t, BitConverter_ToUInt16, (ByteArray* val, int startIndex));
|
||||||
|
|||||||
@@ -15,20 +15,12 @@ namespace Genshin {
|
|||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
void InitIL2CPP(void* &ppRecordUserData) {
|
void InitIL2CPP() {
|
||||||
TCHAR szFileName[MAX_PATH];
|
TCHAR szFileName[MAX_PATH];
|
||||||
GetModuleFileName(nullptr, szFileName, MAX_PATH);
|
GetModuleFileName(nullptr, szFileName, MAX_PATH);
|
||||||
const auto isCN = strstr(szFileName, "YuanShen.exe");
|
const auto isCN = strstr(szFileName, "YuanShen.exe");
|
||||||
const auto uBase = reinterpret_cast<uint64_t>(GetModuleHandle("UserAssembly.dll"));
|
const auto uBase = reinterpret_cast<uint64_t>(GetModuleHandle(isCN ? "YuanShen.exe" : "GenshinImpact.exe"));
|
||||||
#define DO_APP_FUNC(ca, oa, r, n, p) n = (r (*) p)(uBase + (isCN ? ca : oa))
|
#define DO_APP_FUNC(ca, oa, r, n, p) n = (r (*) p)(uBase + (isCN ? ca : oa))
|
||||||
#include "il2cpp-functions.h"
|
#include "il2cpp-functions.h"
|
||||||
#undef DO_APP_FUNC
|
#undef DO_APP_FUNC
|
||||||
auto sPtr = reinterpret_cast<uint8_t*>(RecordUserData);
|
|
||||||
for (int i = 0; i < 0x64; ++i) {
|
|
||||||
if ((*(uint32_t*) sPtr & 0xFFFFFF) == 0x25FF48) { // 48 FF 25 ??
|
|
||||||
ppRecordUserData = sPtr + 7 + *(int*) (sPtr + 3);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sPtr += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// IL2CPP application initializer
|
// IL2CPP application initializer
|
||||||
void InitIL2CPP(void* &ppRecordUserData);
|
void InitIL2CPP();
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ message Achievement {
|
|||||||
FINISHED = 2;
|
FINISHED = 2;
|
||||||
REWARD_TAKEN = 3;
|
REWARD_TAKEN = 3;
|
||||||
}
|
}
|
||||||
uint32 timestamp = 13;
|
uint32 timestamp = 7;
|
||||||
uint32 current = 15;
|
uint32 current = 12;
|
||||||
uint32 total = 9;
|
uint32 total = 5;
|
||||||
uint32 id = 14;
|
uint32 id = 15;
|
||||||
Status status = 8;
|
Status status = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AchievementAllDataNotify {
|
message AchievementAllDataNotify {
|
||||||
repeated Achievement list = 8;
|
repeated Achievement list = 11;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public static class GlobalVars {
|
|||||||
public static readonly string CachePath = Path.Combine(DataPath, "cache");
|
public static readonly string CachePath = Path.Combine(DataPath, "cache");
|
||||||
public static readonly string LibFilePath = Path.Combine(DataPath, "YaeAchievement.dll");
|
public static readonly string LibFilePath = Path.Combine(DataPath, "YaeAchievement.dll");
|
||||||
|
|
||||||
public const uint AppVersionCode = 47;
|
public const uint AppVersionCode = 48;
|
||||||
public const string AppVersionName = "3.7";
|
public const string AppVersionName = "3.8";
|
||||||
|
|
||||||
public const string PipeName = "YaeAchievementPipe";
|
public const string PipeName = "YaeAchievementPipe";
|
||||||
public const string BucketHost = "https://cn-cd-1259389942.file.myqcloud.com";
|
public const string BucketHost = "https://cn-cd-1259389942.file.myqcloud.com";
|
||||||
|
|||||||
Reference in New Issue
Block a user