Skip to content

Commit

Permalink
WFP v4.1.1
Browse files Browse the repository at this point in the history
- minor improvements
  • Loading branch information
ThirteenAG committed Nov 1, 2015
1 parent 35f75ad commit ef5ae08
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 93 deletions.
Binary file modified .vs/WidescreenFixesPack/v14/.suo
Binary file not shown.
20 changes: 20 additions & 0 deletions NFSCarbon.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void Init()
float fPiPPos2 = iniReader.ReadFloat("HUD", "PiPPos2", 0.001953f);
float fRearviewMirrorPos1 = iniReader.ReadFloat("HUD", "RearviewMirrorPos1", -0.308594f);
float fRearviewMirrorPos2 = iniReader.ReadFloat("HUD", "RearviewMirrorPos2", 0.654053f);
bool bLightingFix = iniReader.ReadInteger("MISC", "LightingFix", 0) == 1;
bool bCarShadowFix = iniReader.ReadInteger("MISC", "CarShadowFix", 0) == 1;

if (!ResX || !ResY) {
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
Expand Down Expand Up @@ -148,6 +150,24 @@ void Init()
injector::WriteMemory<float>((DWORD)dword_598EB9 + 10, -(0.5f / ((4.0f / 3.0f) / (16.0f / 9.0f))), true);
injector::WriteMemory<float>((DWORD)dword_598EB9 + 15, -(0.5f / ((4.0f / 3.0f) / (16.0f / 9.0f))), true);
}

if (bLightingFix)
{
DWORD* dword_7497BF = hook::pattern("83 F8 06 89 0D ? ? ? ? C7 05 ? ? ? ? CD CC CC 3E").get(1).get<DWORD>(2);
injector::WriteMemory<uchar>(dword_7497BF, 0, true);
//static float f115 = 1.15f;
//injector::WriteMemory((DWORD)dword_7497BF + 25, &f115, true);
static float f15 = 1.5f;
DWORD* dword_748A70 = hook::pattern("A1 ? ? ? ? A3 ? ? ? ? 83 3D ? ? ? ? 06 C7 05 ? ? ? ? CD CC CC 3E").get(1).get<DWORD>(1);
injector::WriteMemory(dword_748A70, &f15, true);
}

if (bCarShadowFix)
{
DWORD* dword_7BEA3A = hook::pattern("D8 05 ? ? ? ? DC C0 E8 ? ? ? ? 85 C0 7F 04 33 C0").get(0).get<DWORD>(2);
static float f60 = 60.0f;
injector::WriteMemory(dword_7BEA3A, &f60, true);
}
}

BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
Expand Down
45 changes: 42 additions & 3 deletions NFSUnderground.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,21 @@ void Init()

for (size_t i = 0; i < 4; i++)
{
DWORD* dword_4F20A3 = hook::pattern("C7 ? ? ? ? 00 00 00 00 A0 43 C7 ? ? ? ? 00 00 00 00 70 43").get(0).get<DWORD>(7);
injector::WriteMemory<float>(dword_4F20A3, fHudPosX, true);
auto pattern = hook::pattern("C7 ? ? ? ? 00 00 00 00 A0 43 C7 ? ? ? ? 00 00 00 00 70 43");
if (pattern.size() > 0)
{
DWORD* dword_4F20A3 = pattern.get(0).get<DWORD>(7);
injector::WriteMemory<float>(dword_4F20A3, fHudPosX, true);
}
else
{
pattern = hook::pattern("C7 ? ? ? 00 00 A0 43 C7 ? ? ? ? 00 00 00 00 70 43");
if (pattern.size() > 0)
{
DWORD* dword_4F2287 = pattern.get(0).get<DWORD>(4);
injector::WriteMemory<float>(dword_4F2287, fHudPosX, true);
}
}
}

DWORD* dword_4F1E2D = hook::pattern("C7 ? ? ? 00 00 A0 43 C7 ? ? ? 00 00 70 43").get(0).get<DWORD>(4);
Expand All @@ -259,7 +272,33 @@ void Init()
DWORD* dword_6CC910 = *hook::pattern("D8 1D ? ? ? ? DF E0 F6 C4 41 75 0F D9 45 FC").get(0).get<DWORD*>(2);
injector::WriteMemory<float>(dword_6CC910, fHudPosX, true);

///injector::WriteMemory<float>(0x400000 + 0x14646B, fHudPosX, true);
DWORD* dword_5CC109;
DWORD dword_5CC119;
DWORD dword_5CC0F9;
DWORD dword_5CC129;
auto pattern = hook::pattern("C7 44 24 7C 00 00 48 43 C7 84 24 80 00 00 00 00 00 70 41 C7 84 24 8C 00 00 00 00 00 48 43 C7 84 24 90 00 00 00 00 00 BE 42");
if (pattern.size() > 0)
{
dword_5CC109 = pattern.get(0).get<DWORD>(4); //rearview mirror (nfsu2 addresses)
dword_5CC119 = (DWORD)dword_5CC109 + 16 + 6;
dword_5CC0F9 = (DWORD)dword_5CC109 - 16;
dword_5CC129 = (DWORD)dword_5CC109 + 32 + 12;
}
else
{
pattern = hook::pattern("C7 84 24 8C 00 00 00 00 00 48 43 C7 84 24 90 00 00 00 00 00 70 41 C7 84 24 9C 00 00 00 00 00 48 43 C7 84 24 A0 00 00 00 00 00 BE 42");
if (pattern.size() > 0)
{
dword_5CC109 = pattern.get(0).get<DWORD>(7);
dword_5CC119 = (DWORD)dword_5CC109 + 16 + 6;
dword_5CC0F9 = (DWORD)dword_5CC109 - 16 - 6;
dword_5CC129 = (DWORD)dword_5CC109 + 44;
}
}
injector::WriteMemory<float>(dword_5CC109, (fHudPosX - 320.0f) + 200.0f, true);
injector::WriteMemory<float>(dword_5CC119, (fHudPosX - 320.0f) + 200.0f, true);
injector::WriteMemory<float>(dword_5CC0F9, (fHudPosX - 320.0f) + 440.0f, true);
injector::WriteMemory<float>(dword_5CC129, (fHudPosX - 320.0f) + 440.0f, true);
}

if (verFovCorrectionFactor)
Expand Down
26 changes: 0 additions & 26 deletions NFSUnderground2.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,32 +206,6 @@ void Init()
DWORD dword_5BF6A8 = (DWORD)dword_5BF6A2 + 6;
injector::WriteMemory(dword_5BF6A8, ResY, true);


/*DWORD* dword_7FF77C = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_7FF77C, ResX, true);
DWORD* dword_86E77C = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_86E77C, ResX, true);
DWORD* dword_86E7B4 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_86E7B4, ResX, true);
DWORD* dword_86F870 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_86F870, ResX, true);
DWORD* dword_870980 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_870980, ResX, true);
DWORD* dword_7FF780 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_7FF780, ResY, true);
DWORD* dword_86E780 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_86E780, ResY, true);
DWORD* dword_86E7B8 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_86E7B8, ResY, true);
DWORD* dword_86F874 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_86F874, ResY, true);
DWORD* dword_870984 = hook::pattern("").get(0).get<DWORD>(2);
injector::WriteMemory(dword_870984, ResY, true);*/




//HUD
if (HudFix)
{
Expand Down
39 changes: 15 additions & 24 deletions SplinterCell.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

HWND hWnd;
HINSTANCE hExecutableInstance;
BYTE originalCode[5];
BYTE* originalEP;

#define _USE_MATH_DEFINES
#include "math.h"
Expand Down Expand Up @@ -81,7 +83,7 @@ void CenterHud()
offset2 = *(float*)(__esp + 4 + 8);
Color = *(DWORD*)(__esp + 0x2C);

/*if (offset1 >= 780.0f && offset1 <= 925.0f) //898.50 912.00 916.50 910.50 906.0 904.5 780.00 792.00 787.50 915.0//925 - everything cept interaction menu
/*if (offset1 >= 780.0f && offset1 <= 925.0f) //898.50 912.00 916.50 910.50 906.0 904.5 780.00 792.00 787.50 915.0//925 - everything except interaction menu
{
offset2 += 150.0f;
offset1 += 150.0f;
Expand Down Expand Up @@ -150,27 +152,18 @@ void Init()
char szRes[50];
sprintf(szRes, "%dx%d", Screen.Width, Screen.Height);
iniWriter.WriteString("Engine.EPCGameOptions", "Resolution", szRes);

// return to the original EP
*(DWORD*)originalEP = *(DWORD*)&originalCode;
*(BYTE*)(originalEP + 4) = originalCode[4];
_asm
{
push ebp
mov ebp, esp
push 0xFF
jmp epJump
jmp originalEP
}
}

DWORD WINAPI Thread(LPVOID)
{
if (bIsSteam == true)
{
while (*(BYTE*)0x10918F1A != 0x55)
{
Sleep(0);
}
injector::MakeJMP(0x10918F1A, Init, true);
epJump = (DWORD)0x10918F1A + 5;
}

while (true)
{
Sleep(0);
Expand Down Expand Up @@ -243,15 +236,13 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hExecutableInstance + ((IMAGE_DOS_HEADER*)hExecutableInstance)->e_lfanew);
BYTE* ep = (BYTE*)((DWORD)hExecutableInstance + ntHeader->OptionalHeader.AddressOfEntryPoint);

if (*(BYTE*)ep == 0x53)
{
bIsSteam = true;
}
else
{
injector::MakeJMP(ep, Init, true);
epJump = (DWORD)ep + 5;
}
// back up original code
*(DWORD*)&originalCode = *(DWORD*)ep;
originalCode[4] = *(ep + 4);
originalEP = ep;

injector::MakeJMP(ep, Init, true);

CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&Thread, NULL, 0, NULL);
}
return TRUE;
Expand Down
26 changes: 13 additions & 13 deletions SplinterCellChaosTheory.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

HWND hWnd;
HINSTANCE hExecutableInstance;
BYTE originalCode[5];
BYTE* originalEP;

#define _USE_MATH_DEFINES
#include "math.h"
Expand Down Expand Up @@ -110,11 +112,12 @@ void Init()
injector::MakeJMP(0x10CD09AF, SetRes_Hook, true);
hookJmpAddr = 0x10CD09B6;

// return to the original EP
*(DWORD*)originalEP = *(DWORD*)&originalCode;
*(BYTE*)(originalEP + 4) = originalCode[4];
_asm
{
PUSH 60h
PUSH 0x11155180
jmp epJump
jmp originalEP
}
}

Expand Down Expand Up @@ -171,16 +174,13 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
hExecutableInstance = GetModuleHandle(NULL);
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hExecutableInstance + ((IMAGE_DOS_HEADER*)hExecutableInstance)->e_lfanew);
BYTE* ep = (BYTE*)((DWORD)hExecutableInstance + ntHeader->OptionalHeader.AddressOfEntryPoint);
if (*(BYTE*)ep == 0x53)
{
injector::MakeJMP(0x10F3185A, Init, true);
epJump = 0x10F3185A + 7;
}
else
{
injector::MakeJMP(ep, Init, true);
epJump = (DWORD)ep + 7;
}
// back up original code
*(DWORD*)&originalCode = *(DWORD*)ep;
originalCode[4] = *(ep + 4);
originalEP = ep;

injector::MakeJMP(ep, Init, true);

CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&Thread, NULL, 0, NULL);
}
return TRUE;
Expand Down
35 changes: 13 additions & 22 deletions SplinterCellDoubleAgent.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

HWND hWnd;
HINSTANCE hExecutableInstance;
BYTE originalCode[5];
BYTE* originalEP;

#define _USE_MATH_DEFINES
#include "math.h"
Expand Down Expand Up @@ -72,11 +74,12 @@ void Init()
iniWriter.WriteString("WinDrv.WindowsClient", "FullscreenViewportX", ResX);
iniWriter.WriteString("WinDrv.WindowsClient", "FullscreenViewportY", ResY);

// return to the original EP
*(DWORD*)originalEP = *(DWORD*)&originalCode;
*(BYTE*)(originalEP + 4) = originalCode[4];
_asm
{
PUSH 60h
PUSH 0x1093E4D0
jmp epJump
jmp originalEP
}
}

Expand Down Expand Up @@ -201,16 +204,6 @@ DWORD WINAPI Thread(LPVOID)
return 0;
}

DWORD WINAPI SteamHandler(LPVOID)
{
while (*(unsigned char*)0x10926D65 != 0x6A)
Sleep(0);

injector::MakeJMP(0x10926D65, Init, true);
epJump = 0x10926D65 + 7;
return 0;
}

BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
{
if (reason == DLL_PROCESS_ATTACH)
Expand All @@ -228,15 +221,13 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
hExecutableInstance = GetModuleHandle(NULL);
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hExecutableInstance + ((IMAGE_DOS_HEADER*)hExecutableInstance)->e_lfanew);
BYTE* ep = (BYTE*)((DWORD)hExecutableInstance + ntHeader->OptionalHeader.AddressOfEntryPoint);
if (*(BYTE*)ep == 0x53)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&SteamHandler, NULL, 0, NULL);
}
else
{
injector::MakeJMP(ep, Init, true);
epJump = (DWORD)ep + 7;
}
// back up original code
*(DWORD*)&originalCode = *(DWORD*)ep;
originalCode[4] = *(ep + 4);
originalEP = ep;

injector::MakeJMP(ep, Init, true);

CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&Thread, NULL, 0, NULL);
}
return TRUE;
Expand Down
18 changes: 13 additions & 5 deletions SplinterCellPandoraTomorrow.WidescreenFix/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

HWND hWnd;
HINSTANCE hExecutableInstance;
BYTE originalCode[5];
BYTE* originalEP;

#define _USE_MATH_DEFINES
#include "math.h"
Expand Down Expand Up @@ -181,11 +183,12 @@ void Init()
injector::WriteMemory(pfappInit + 0x67E + 0x1, Screen.Width, true);
injector::WriteMemory(pfappInit + 0x69F + 0x1, Screen.Height, true);

// return to the original EP
*(DWORD*)originalEP = *(DWORD*)&originalCode;
*(BYTE*)(originalEP + 4) = originalCode[4];
_asm
{
xor ebx, ebx
mov [ebp - 20h], ebx
jmp epJump
jmp originalEP
}
}

Expand Down Expand Up @@ -276,8 +279,13 @@ BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
hExecutableInstance = GetModuleHandle(NULL);
IMAGE_NT_HEADERS* ntHeader = (IMAGE_NT_HEADERS*)((DWORD)hExecutableInstance + ((IMAGE_DOS_HEADER*)hExecutableInstance)->e_lfanew);
BYTE* ep = (BYTE*)((DWORD)hExecutableInstance + ntHeader->OptionalHeader.AddressOfEntryPoint);
injector::MakeJMP(ep + 12, Init, true);
epJump = (DWORD)ep + 12 + 5;
// back up original code
*(DWORD*)&originalCode = *(DWORD*)ep;
originalCode[4] = *(ep + 4);
originalEP = ep;

injector::MakeJMP(ep, Init, true);

CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&Thread, NULL, 0, NULL);
}
return TRUE;
Expand Down

0 comments on commit ef5ae08

Please sign in to comment.