mirror of
https://github.com/HolographicHat/Yae.git
synced 2026-03-16 00:53:17 +08:00
simple test
This commit is contained in:
@@ -1,10 +1,31 @@
|
||||
#include "pch.h"
|
||||
#include "util.h"
|
||||
#include "il2cpp-init.h"
|
||||
#include "HookManager.h"
|
||||
|
||||
HWND unityWnd = 0;
|
||||
|
||||
std::string il2cppi_to_string(Il2CppString* str, UINT codePage) {
|
||||
auto chars = reinterpret_cast<const wchar_t *>(str->chars);
|
||||
auto len = WideCharToMultiByte(codePage, 0, chars, -1, nullptr, 0, nullptr, nullptr);
|
||||
auto buffer = new CHAR[len];
|
||||
WideCharToMultiByte(codePage, 0, chars, -1, buffer, len, nullptr, nullptr);
|
||||
std::string strTemp(buffer);
|
||||
delete[] buffer;
|
||||
return strTemp;
|
||||
}
|
||||
|
||||
void SetDispstchData(Genshin::ByteArray* data, MethodInfo* m) {
|
||||
CALL_ORIGIN(SetDispstchData, data, m);
|
||||
auto ilStr = Genshin::Convert_ToBase64String(data, nullptr);
|
||||
auto cStr = il2cppi_to_string(reinterpret_cast<Il2CppString*>(ilStr), CP_ACP);
|
||||
ErrorDialog(cStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
void Run(HMODULE* phModule) {
|
||||
AllocConsole();
|
||||
freopen_s((FILE**)stdout, "CONOUT$", "w", stdout);
|
||||
HWND unityWnd = 0;
|
||||
while (
|
||||
GetModuleHandle("UserAssembly.dll") == nullptr ||
|
||||
(unityWnd = FindMainWindowByPID(GetCurrentProcessId())) == 0
|
||||
@@ -12,24 +33,21 @@ void Run(HMODULE* phModule) {
|
||||
printf("Wait game initialize...\n");
|
||||
Sleep(1000);
|
||||
}
|
||||
MessageBox(unityWnd, "YaeAchievementLib injection test on 原神 Beta (CNCBWIN2.7.53)", "", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
|
||||
//init_il2cpp();
|
||||
//HookManager::install(app::Unity_RecordUserData, OnRecordUserData);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
//app::Application_RecordUserData(i, nullptr);
|
||||
}
|
||||
HANDLE hPipe = CreateFile(R"(\\.\pipe\genshin-checksum)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
InitIL2CPP();
|
||||
HookManager::install(Genshin::Packet_SetDispstchData, SetDispstchData);
|
||||
/*HANDLE hPipe = CreateFile(R"(\\.\pipe\YaeAchievementPipe)", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||
if (hPipe == INVALID_HANDLE_VALUE) {
|
||||
printf("Failed to open pipe: %d\n", GetLastError());
|
||||
ExitProcess(0);
|
||||
return;
|
||||
}
|
||||
ConnectNamedPipe(hPipe, nullptr);
|
||||
DWORD written;
|
||||
}*/
|
||||
//ErrorDialog("Press ok to continue.");
|
||||
//ConnectNamedPipe(hPipe, nullptr);
|
||||
//DWORD written;
|
||||
//WriteFile(hPipe, (checksum + "\n").c_str(), checksum.length() + 1, &written, nullptr);
|
||||
DisconnectNamedPipe(hPipe);
|
||||
CloseHandle(hPipe);
|
||||
ExitProcess(0);
|
||||
//DisconnectNamedPipe(hPipe);
|
||||
//CloseHandle(hPipe);
|
||||
//ExitProcess(0);
|
||||
}
|
||||
|
||||
// DLL entry point
|
||||
|
||||
Reference in New Issue
Block a user