This commit is contained in:
HolographicHat
2024-03-14 23:55:36 +08:00
parent cc346915e3
commit 1f311ed987
5 changed files with 24 additions and 32 deletions

View File

@@ -30,17 +30,17 @@ namespace Hook {
return new ByteArray {};
}
void OnAchievementAllDataNotify(LPVOID obj, const LPVOID ntf) {
const auto cos = Genshin::il2cpp_object_new(*Genshin::CodedOutputStream__TypeInfo);
const auto len = Genshin::CalculateSize(ntf);
const auto buf = (ByteArray*) new uint8_t[0x20 + len] {};
buf->max_length = len;
Genshin::CodedOutputStreamInit(cos, buf, 0, len);
Genshin::ProtoWriteTo(ntf, cos);
const auto str = base64_encode(buf->vector, len) + "\n";
WriteFile(hPipe, str.c_str(), (DWORD) str.length(), nullptr, nullptr);
CloseHandle(hPipe);
ExitProcess(0);
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) == 20248) {
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";
WriteFile(hPipe, cStr.c_str(), (DWORD) cStr.length(), nullptr, nullptr);
CloseHandle(hPipe);
ExitProcess(0);
}
return ret;
}
}
@@ -57,7 +57,7 @@ void Run(HMODULE* phModule) {
const auto result = Genshin::RecordUserData(i);
checksum += string(reinterpret_cast<char*>(&result->vector[0]), result->max_length);
}
HookManager::install(Genshin::OnAchievementAllDataNotify, Hook::OnAchievementAllDataNotify);
HookManager::install(Genshin::BitConverter_ToUInt16, Hook::BitConverter_ToUInt16);
HookManager::install(Genshin::UnityEngine_RecordUserData, Hook::UnityEngine_RecordUserData);
hPipe = CreateFile(R"(\\.\pipe\YaeAchievementPipe)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
if (hPipe == INVALID_HANDLE_VALUE) {

View File

@@ -2,16 +2,10 @@ using namespace Genshin;
// DO_APP_FUNC(CN_OFFSET, OS_OFFSET, RETURN, FUNC_NAME, (ARGS...));
DO_APP_FUNC(0x504620, 0x5C3140, LPVOID, il2cpp_object_new, (LPVOID t));
DO_APP_FUNC(0x569170, 0x568470, LPVOID, il2cpp_object_new, (LPVOID t));
DO_APP_FUNC(0x05167E00, 0x05166410, ByteArray*, RecordUserData, (int32_t nType));
DO_APP_FUNC(0x06C43A80, 0x06775280, ByteArray*, RecordUserData, (int32_t nType));
DO_APP_FUNC(0x04450D40, 0x0444F3B0, void, OnAchievementAllDataNotify, (LPVOID obj, LPVOID ntf));
DO_APP_FUNC(0x0C87B240, 0x0C89EFB0, uint16_t, BitConverter_ToUInt16, (ByteArray* val, int startIndex));
DO_APP_FUNC(0x07A3EC40, 0x07A3DD10, int, CalculateSize, (LPVOID obj));
DO_APP_FUNC(0x07A3EB80, 0x07A3DC50, void, ProtoWriteTo, (LPVOID obj, LPVOID output));
DO_APP_FUNC(0x05BFDA50, 0x05BFCCD0, void, CodedOutputStreamInit, (LPVOID obj, LPVOID buffer, int offset, int length));
DO_UNI_FUNC(0x1051E0, 0x1051E0, ByteArray*, UnityEngine_RecordUserData, (int32_t nType));
DO_UNI_FUNC(0x105560, 0x105560, ByteArray*, UnityEngine_RecordUserData, (int32_t nType));

View File

@@ -1,2 +0,0 @@
// NOLFKCJKECE
DO_TYPEDEF(0x2A35D58, 0x2A34D58, CodedOutputStream);

View File

@@ -9,13 +9,13 @@ message Achievement {
FINISHED = 2;
REWARD_TAKEN = 3;
}
uint32 timestamp = 6;
uint32 current = 12;
uint32 total = 3;
uint32 id = 9;
Status status = 11;
uint32 timestamp = 14;
uint32 current = 13;
uint32 total = 9;
uint32 id = 7;
Status status = 10;
}
message AchievementAllDataNotify {
repeated Achievement list = 5;
repeated Achievement list = 15;
}

View File

@@ -20,8 +20,8 @@ public static class GlobalVars {
public static readonly string CachePath = Path.Combine(DataPath, "cache");
public static readonly string LibFilePath = Path.Combine(DataPath, "YaeAchievement.dll");
public const uint AppVersionCode = 44;
public const string AppVersionName = "3.4";
public const uint AppVersionCode = 45;
public const string AppVersionName = "3.5";
public const string PipeName = "YaeAchievementPipe";
public const string BucketHost = "https://cn-cd-1259389942.file.myqcloud.com";