This commit is contained in:
HolographicHat
2023-04-12 12:28:03 +08:00
parent 58dcd5b228
commit c60d3a3b82
7 changed files with 35 additions and 35 deletions

View File

@@ -5,11 +5,11 @@
using Genshin::ByteArray, Genshin::ClientKcpEvent, Genshin::KcpPacket, Genshin::KcpEventType; using Genshin::ByteArray, Genshin::ClientKcpEvent, Genshin::KcpPacket, Genshin::KcpEventType;
using std::to_string; using std::to_string;
HWND unityWnd = 0; HWND unityWnd = nullptr;
HANDLE hPipe = 0; HANDLE hPipe = nullptr;
// Allow Protocol: GetPlayerToken, PlayerLogin, AchievementAllDataNotify, Ping // Allow Protocol: GetPlayerToken, PlayerLogin, AchievementAllDataNotify, Ping
std::set<UINT16> PacketWhitelist = { 167, 175, 154, 164, 2698, 14, 34, 106 }; std::set<UINT16> PacketWhitelist = { 190, 196, 189, 176, 2659, 16, 56, 152 };
bool OnPacket(KcpPacket* pkt) { bool OnPacket(KcpPacket* pkt) {
if (pkt->data == nullptr) return true; if (pkt->data == nullptr) return true;
@@ -30,7 +30,7 @@ bool OnPacket(KcpPacket* pkt) {
return false; return false;
} }
printf("Passed cmdid: %d\n", ReadMapped<UINT16>(data->vector, 2)); printf("Passed cmdid: %d\n", ReadMapped<UINT16>(data->vector, 2));
if (ReadMapped<UINT16>(data->vector, 2) == 2698) { if (ReadMapped<UINT16>(data->vector, 2) == 2659) {
auto headLength = ReadMapped<UINT16>(data->vector, 4); auto headLength = ReadMapped<UINT16>(data->vector, 4);
auto dataLength = ReadMapped<UINT32>(data->vector, 6); auto dataLength = ReadMapped<UINT32>(data->vector, 6);
auto iStr = Genshin::ToBase64String(data, 10 + headLength, dataLength, nullptr); auto iStr = Genshin::ToBase64String(data, 10 + headLength, dataLength, nullptr);
@@ -86,7 +86,7 @@ void Run(HMODULE* phModule) {
//freopen_s((FILE**)stdout, "CONOUT$", "w", stdout); //freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
while ( while (
GetModuleHandle("UserAssembly.dll") == nullptr || GetModuleHandle("UserAssembly.dll") == nullptr ||
(unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == 0 (unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == nullptr
) { ) {
Sleep(1000); Sleep(1000);
} }

View File

@@ -1 +1 @@
DO_API(0x991b10, 0x99ad10, Il2CppString*, il2cpp_string_new, (const char* str)); DO_API(0x897c10, 0x8951f0, Il2CppString*, il2cpp_string_new, (const char* str));

View File

@@ -2,30 +2,30 @@ 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(0x728c160, 0x71cc2e0, Il2CppString*, ToBase64String, (ByteArray* value, int offset, int length, void* method)); DO_APP_FUNC(0x6790b00, 0x6839fa0, Il2CppString*, ToBase64String, (ByteArray* value, int offset, int length, void* method));
DO_APP_FUNC(0x2e2c930, 0x2dc4b90, void, SetVersion, (void* obj, Il2CppString* value, void* method)); DO_APP_FUNC(0x379bb90, 0x3821a40, void, SetVersion, (void* obj, Il2CppString* value, void* method));
DO_APP_FUNC(0x7c318d0, 0x7b69060, ByteArray*, RecordUserData, (int32_t nType)); DO_APP_FUNC(0x7040220, 0x70f3890, ByteArray*, RecordUserData, (int32_t nType));
DO_APP_FUNC(0x1ba7d30, 0x1b7b9f0, void, XorEncrypt, (ByteArray** data, int length, void* method)); DO_APP_FUNC(0xf85bf0, 0xf90450, void, XorEncrypt, (ByteArray** data, int length, void* method));
DO_APP_FUNC(0xc3fe80, 0xc47280, int, KcpSend, (void* client, KcpPacket* pkt, void* method)); DO_APP_FUNC(0x156e740, 0x158a1e0, int, KcpSend, (void* client, KcpPacket* pkt, void* method));
DO_APP_FUNC(0xf1ec70, 0xf1bca0, bool, KcpRecv, (void* client, ClientKcpEvent* evt, void* method)); DO_APP_FUNC(0x2ce2040, 0x2d44790, bool, KcpRecv, (void* client, ClientKcpEvent* evt, void* method));
DO_APP_FUNC(0x75a6880, 0x74e4b80, LPVOID, GetDefaultEncoding, ()); DO_APP_FUNC(0x6a4e700, 0x6afb5e0, LPVOID, GetDefaultEncoding, ());
DO_APP_FUNC(0x75a6130, 0x74e4420, Il2CppString*, GetString, (LPVOID encoding, LPVOID bytes)); DO_APP_FUNC(0x6a4dfb0, 0x6afae80, Il2CppString*, GetString, (LPVOID encoding, LPVOID bytes));
DO_APP_FUNC(0x75a4fc0, 0x74e32b0, ByteArray*, GetBytes, (LPVOID encoding, LPVOID str)); DO_APP_FUNC(0x6a4ce50, 0x6af9d50, ByteArray*, GetBytes, (LPVOID encoding, LPVOID str));
DO_APP_FUNC(0x1bf31f0, 0x1bc5f60, VOID, RequestLogin, (LPVOID obj, LPVOID token, UINT uid)); DO_APP_FUNC(0x36a1260, 0x3723bc0, VOID, RequestLogin, (LPVOID obj, LPVOID token, UINT uid));
DO_APP_FUNC(0x4922d40, 0x4879590, VOID, SetChecksum, (LPVOID obj, Il2CppString* value)); DO_APP_FUNC(0x26506b0, 0x1b0c690, VOID, SetChecksum, (LPVOID obj, Il2CppString* value));
DO_APP_FUNC(0x34780d0, 0x3401460, VOID, ForceQuit, (LPVOID obj)); DO_APP_FUNC(0xf25990, 0xf2f110, VOID, ForceQuit, (LPVOID obj));
DO_APP_FUNC(0x57df820, 0x5727410, LPVOID, GetSingletonManager, ()); DO_APP_FUNC(0x4aac4c0, 0x4b57410, LPVOID, GetSingletonManager, ());
DO_APP_FUNC(0x57df550, 0x5727140, LPVOID, GetSingletonInstance, (LPVOID obj, Il2CppString* value)); DO_APP_FUNC(0x4aac1f0, 0x4b57140, LPVOID, GetSingletonInstance, (LPVOID obj, Il2CppString* value));

View File

@@ -1,3 +1,3 @@
using namespace Genshin; using namespace Genshin;
DO_UNI_FUNC(0x00100570, 0x00100570, ByteArray*, UnityEngine_RecordUserData, (int32_t nType)); DO_UNI_FUNC(0x100640, 0x100640, ByteArray*, UnityEngine_RecordUserData, (int32_t nType));

View File

@@ -4,12 +4,12 @@
VOID DisableVMProtect() { VOID DisableVMProtect() {
DWORD oldProtect = 0; DWORD oldProtect = 0;
auto ntdll = GetModuleHandleA("ntdll.dll"); auto ntdll = GetModuleHandleA("ntdll.dll");
BYTE callcode = ((BYTE*)GetProcAddress(ntdll, "NtQuerySection"))[4] - 1; auto pNtProtectVirtualMemory = GetProcAddress(ntdll, "NtProtectVirtualMemory");
BYTE restore[] = { 0x4C, 0x8B, 0xD1, 0xB8, callcode }; auto pNtQuerySection = GetProcAddress(ntdll, "NtQuerySection");
auto nt_vp = (BYTE*)GetProcAddress(ntdll, "NtProtectVirtualMemory"); DWORD old;
VirtualProtect(nt_vp, sizeof(restore), PAGE_EXECUTE_READWRITE, &oldProtect); VirtualProtect(pNtProtectVirtualMemory, 1, PAGE_EXECUTE_READWRITE, &old);
memcpy(nt_vp, restore, sizeof(restore)); *(uintptr_t*)pNtProtectVirtualMemory = *(uintptr_t*)pNtQuerySection & ~(0xFFui64 << 32) | (uintptr_t)(*(uint32_t*)((uintptr_t)pNtQuerySection + 4) - 1) << 32;
VirtualProtect(nt_vp, sizeof(restore), oldProtect, &oldProtect); VirtualProtect(pNtProtectVirtualMemory, 1, old, &old);
} }
#pragma region StringConvert #pragma region StringConvert

View File

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

View File

@@ -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 = 36; public const uint AppVersionCode = 37;
public const string AppVersionName = "2.6"; public const string AppVersionName = "2.7";
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";