Fixed -wqhd behaviour for 7.10 and restored old behaviour for 6.00 #16
@@ -135,8 +135,8 @@ __int64 hookedParseParameters(int a1, __int64* a2)
|
||||
case 600:
|
||||
*resolutionType_600 = 15;
|
||||
break;
|
||||
default:
|
||||
*resolutionType_710 = 15;
|
||||
//default:
|
||||
// *resolutionType_710 = 15;
|
||||
}
|
||||
// Return to the original function
|
||||
switch (game_version)
|
||||
@@ -144,8 +144,8 @@ __int64 hookedParseParameters(int a1, __int64* a2)
|
||||
case 600:
|
||||
return divaParseParameters_600(a1, a2);
|
||||
break;
|
||||
default:
|
||||
return divaParseParameters_710(a1, a2);
|
||||
//default:
|
||||
// return divaParseParameters_710(a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,40 @@ __int64 __fastcall limiterFuncLight(__int64 a1)
|
||||
}
|
||||
}
|
||||
|
||||
#define WRITE_MEMORY_INT(address, data) \
|
||||
{ \
|
||||
DWORD oldProtect, bck; \
|
||||
VirtualProtect((BYTE*)(address), 4, PAGE_EXECUTE_READWRITE, &oldProtect); \
|
||||
*((int*)(address)) = (data); \
|
||||
VirtualProtect((BYTE*)(address), 4, oldProtect, &bck); \
|
||||
}
|
||||
|
||||
void __fastcall hookedInitRender(int ssaa, int hd_res, int ss_alpha_mask, __int8 npr) {
|
||||
if (nIntRes)
|
||||
{
|
||||
const __int64 widthAddress = 0x0000000140EDA8B0 + 0x0C;
|
||||
const __int64 heightAddress = 0x0000000140EDA8B0 + 0x10;
|
||||
const __int64 intWidthAddress = 0x0000000140EDA8D8 + 0x0C;
|
||||
const __int64 intHeightAddress = 0x0000000140EDA8D8 + 0x10;
|
||||
|
||||
int originalWidth = *(int*)widthAddress;
|
||||
int originalHeight = *(int*)heightAddress;
|
||||
int originalIntWidth = *(int*)intWidthAddress;
|
||||
int originalIntHeight = *(int*)intHeightAddress;
|
||||
WRITE_MEMORY_INT(widthAddress, nIntResWidth);
|
||||
WRITE_MEMORY_INT(heightAddress, nIntResHeight);
|
||||
WRITE_MEMORY_INT(intWidthAddress, nIntResWidth);
|
||||
WRITE_MEMORY_INT(intHeightAddress, nIntResHeight);
|
||||
divaInitRender_710(ssaa, hd_res, ss_alpha_mask, npr);
|
||||
WRITE_MEMORY_INT(widthAddress, originalWidth);
|
||||
WRITE_MEMORY_INT(heightAddress, originalHeight);
|
||||
WRITE_MEMORY_INT(intWidthAddress, originalIntWidth);
|
||||
WRITE_MEMORY_INT(intHeightAddress, originalIntHeight);
|
||||
}
|
||||
else
|
||||
divaInitRender_710(ssaa, hd_res, ss_alpha_mask, npr);
|
||||
}
|
||||
|
||||
__int64 __fastcall hookedEngineUpdate(__int64 a1)
|
||||
{
|
||||
if (nFpsLimit < 1)
|
||||
@@ -284,17 +318,17 @@ BOOL APIENTRY DllMain(HMODULE hModule,
|
||||
}
|
||||
DetourTransactionCommit();
|
||||
|
||||
//DetourTransactionBegin();
|
||||
//DetourUpdateThread(GetCurrentThread());
|
||||
//switch (game_version)
|
||||
//{
|
||||
//case 600:
|
||||
// DetourAttach(&(PVOID&)divaParseParameters_600, hookedParseParameters);
|
||||
// break;
|
||||
switch (game_version)
|
||||
{
|
||||
case 600:
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
DetourAttach(&(PVOID&)divaParseParameters_600, hookedParseParameters);
|
||||
DetourTransactionCommit();
|
||||
break;
|
||||
//default:
|
||||
// DetourAttach(&(PVOID&)divaParseParameters_710, hookedParseParameters);
|
||||
//}
|
||||
//DetourTransactionCommit();
|
||||
}
|
||||
|
||||
|
||||
// set sleep time resolution to 2ms or device minimum (whichever's lower)
|
||||
@@ -340,39 +374,14 @@ BOOL APIENTRY DllMain(HMODULE hModule,
|
||||
switch (game_version)
|
||||
{
|
||||
case 600:
|
||||
{
|
||||
DWORD oldProtect, bck;
|
||||
VirtualProtect((BYTE*)0x0000000140980954, 4, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
*((int*)0x0000000140980954) = nIntResWidth;
|
||||
VirtualProtect((BYTE*)0x0000000140980954, 6, oldProtect, &bck);
|
||||
}
|
||||
{
|
||||
DWORD oldProtect, bck;
|
||||
VirtualProtect((BYTE*)0x0000000140980958, 4, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
*((int*)0x0000000140980958) = nIntResHeight;
|
||||
VirtualProtect((BYTE*)0x0000000140980958, 6, oldProtect, &bck);
|
||||
}
|
||||
break;
|
||||
WRITE_MEMORY_INT(0x0000000140980954, nIntResWidth);
|
||||
WRITE_MEMORY_INT(0x0000000140980958, nIntResWidth);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DWORD oldProtect, bck;
|
||||
VirtualProtect((BYTE*)0x00000001409B8B68, 4, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
*((int*)0x00000001409B8B68) = nIntResWidth;
|
||||
VirtualProtect((BYTE*)0x00000001409B8B68, 6, oldProtect, &bck);
|
||||
}
|
||||
{
|
||||
DWORD oldProtect, bck;
|
||||
VirtualProtect((BYTE*)0x00000001409B8B6C, 4, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
*((int*)0x00000001409B8B6C) = nIntResHeight;
|
||||
VirtualProtect((BYTE*)0x00000001409B8B6C, 6, oldProtect, &bck);
|
||||
}
|
||||
|
||||
//*((int*)0x00000001409B8B6C) = maxHeight;
|
||||
//*((int*)0x00000001409B8B14) = maxWidth;
|
||||
//*((int*)0x00000001409B8B18) = maxHeight;
|
||||
|
||||
//*((int*)0x00000001409B8B1C) = maxWidth; // No parameters width?
|
||||
//*((int*)0x00000001409B8B20) = maxHeight; // No parameters height?
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
DetourAttach(&(PVOID&)divaInitRender_710, hookedInitRender);
|
||||
DetourTransactionCommit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
#include <string>
|
||||
|
||||
static int(__cdecl* divaCreateWindow_710)(const char* title, void(__cdecl* exitfunc)(int)) = (int(__cdecl*)(const char* title, void(__cdecl * exitfunc)(int)))0x140194D00;
|
||||
__int64 (__fastcall* divaParseParameters_710)(int a1, __int64* a2) = (__int64(__fastcall*)(int a1, __int64* a2))0x140193630;
|
||||
void(__fastcall* divaInitRender_710)(int ssaa, int hd_res, int ss_alpha_mask, __int8 npr) = (void(__fastcall *)(int ssaa, int hd_res, int ss_alpha_mask, __int8 npr))0x0000000140502A10;
|
||||
//__int64 (__fastcall* divaParseParameters_710)(int a1, __int64* a2) = (__int64(__fastcall*)(int a1, __int64* a2))0x140193630;
|
||||
__int64(__fastcall* divaEngineUpdate_710)(__int64 a1) = (__int64(__fastcall*)(__int64 a1))0x140194CD0;
|
||||
|
||||
uint8_t* fullScreenFlag_710 = (uint8_t*)0x140EDA5D1;
|
||||
DWORD* resolutionType_710 = (DWORD*)0x140EDA5D4;
|
||||
//DWORD* resolutionType_710 = (DWORD*)0x140EDA5D4;
|
||||
|
||||
|
||||
static int(__cdecl* divaCreateWindow_600)(const char* title, void(__cdecl* exitfunc)(int)) = (int(__cdecl*)(const char* title, void(__cdecl * exitfunc)(int)))0x14018CD00;
|
||||
|
||||
Reference in New Issue
Block a user