Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/SWRSokuRoll/SWRSokuRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
const BYTE TARGET_HASH[16] = {0xdf, 0x35, 0xd1, 0xfb, 0xc7, 0xb5, 0x83, 0x31, 0x7a, 0xda, 0xbe, 0x8c, 0xd9, 0xf5, 0x3b, 0x2e};

static char s_profilePath[1024 + MAX_PATH];
static HMEMORYMODULE handle = nullptr;

#pragma pack(push, 1)
struct SokuRollParams {
Expand All @@ -26,7 +27,7 @@ unsigned __stdcall loadDelay(void *) {
// but wasting 1 second here is fine and mimicks the current manual behaviour anyways.
Sleep(1000);

HMEMORYMODULE handle = MemoryLoadLibrary(&sokuroll_data, sokuroll_size);
handle = MemoryLoadLibrary(&sokuroll_data, sokuroll_size);
if (handle == NULL) {
return 0;
}
Expand All @@ -36,6 +37,10 @@ unsigned __stdcall loadDelay(void *) {
}

extern "C" {
__declspec(dllexport) HMODULE GetModuleBaseAddress() {
return (HMODULE)(static_cast<PMEMORYMODULE>(handle)->codeBase);
}

__declspec(dllexport) bool CheckVersion(const BYTE hash[16]) {
return ::memcmp(TARGET_HASH, hash, sizeof TARGET_HASH) == 0;
}
Expand Down