Skip to content

Commit dd7f1c2

Browse files
committed
Add Loader module
1 parent 549e67f commit dd7f1c2

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

files/W3D.Loader.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Place modified xom or tga files here from the following paths:
2+
- Data
3+
- Data/Themes
4+
- Data/Effects
5+
- Data/Frontend/Levels
6+
- Data/Frontend/Wormapedia
7+
- Data/scripts
8+
- Data/Logos
9+
- Data/Maps
10+
- Data/Language/PC
11+
- Data/Bundles
12+
and they will be loaded by the game instead of original ones.

premake5.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ project "W3D.Unlimiter"
6464
files { "source/unlimiter.cpp" }
6565

6666
defines { "rsc_FileDescription=\"Unlimiter for Worms 3D\"" }
67+
68+
project "W3D.Loader"
69+
files { "source/loader.cpp" }
70+
71+
defines { "rsc_FileDescription=\"Unlimiter for Worms 3D\"" }

source/loader.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include "stdafx.h"
2+
3+
const char* DataPath = "Data2";
4+
5+
DWORD XString__XString = 0x61A545;
6+
DWORD XString__RemoveInstance = 0x62A5CB;
7+
DWORD XString__FreeRep = 0x61A4A5;
8+
9+
void __declspec(naked) InitOptionalPathsCodeCave()
10+
{
11+
__asm {
12+
push DataPath
13+
lea ecx, dword ptr ss : [esp + 0x8]
14+
call XString__XString
15+
mov ecx, dword ptr ds : [esi]
16+
lea edx, dword ptr ss : [esp + 0x4]
17+
push edx
18+
push esi
19+
call dword ptr ds : [ecx + 0xC]
20+
lea ecx, dword ptr ss : [esp + 0x4]
21+
call XString__RemoveInstance
22+
mov ecx, dword ptr ss : [esp + 0x4]
23+
add ecx, 0xFFFFFFFA
24+
dec word ptr ds : [ecx]
25+
cmp word ptr ds : [ecx], 0
26+
jne InitPathsEnd
27+
call XString__FreeRep
28+
InitPathsEnd:
29+
pop esi
30+
pop ecx
31+
ret
32+
}
33+
}
34+
35+
void Init()
36+
{
37+
injector::MakeJMP(0x44A8B9, InitOptionalPathsCodeCave, true);
38+
}
39+
40+
BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
41+
{
42+
if (reason == DLL_PROCESS_ATTACH)
43+
{
44+
Init();
45+
}
46+
return TRUE;
47+
}

0 commit comments

Comments
 (0)