Skip to content

Commit cb59db3

Browse files
authored
Merge pull request #10 from moth1995/update-to-new-vs
Update to new vs
2 parents dc03079 + 8366550 commit cb59db3

207 files changed

Lines changed: 254971 additions & 718 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ src/*.lib
55
src/*.res
66
src/*.exp
77
src/output/*
8-
src/setenv.cmd
98
.DS_Store
9+
.vs
10+
.vscode

BUILD.txt

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,37 @@ Kitserver 5 is a companion program for Pro Evolution Soccer 5, Winning Eleven 9,
44

55
# How to build
66

7-
You must use the old Microsoft Visual C++ 6.0 32-bit compiler.
8-
Check WinWorld site: https://winworldpc.com/product/visual-c/6x
7+
The Makefile (in the src folder) is intended to be used by Microsoft NMAKE
8+
tool, which comes with Visual Studio 2017+ Community Edition.
99

10-
You also need DirectX SDK 8.1. You can get it here:
11-
https://archive.org/details/dx81sdk_full
10+
All dependencies are included, so you do not need to install any other
11+
software to build this program
1212

13-
Build is done from command-line.
14-
Start cmd.exe, then switch to "src" directory, then:
13+
Execute the setenv.cmd so that it points to correct location
14+
of your Visual Studio. You can also use setenv_legacy.cmd
15+
for older releases of Visual Studio
1516

16-
setenv.cmd
17-
nmake release
17+
Two types of build are supported:
1818

19+
RELEASE:
20+
21+
nmake
22+
23+
BUILD SPECIFIC DLL:
24+
nmake kload.dll mydll.dll
25+
26+
DEBUG:
27+
28+
nmake debug=1
29+
30+
To delete all object files in preparation for clean re-build:
31+
32+
nmake clean-all
33+
34+
Currently, the difference between "debug" and "release" builds is in the
35+
way the debug configuration parameter is treated. The "release" build
36+
ignores debug values > 1, while "debug" build provides more detailed
37+
logging for debug > 1. This behaviour, however, may change in the future.
38+
39+
(NOTE: You can also build the EXE and DLL files separately, using
40+
appropriate targets, specified in the Makefile.)

src/Makefile

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ CC=cl
22
LINK=link
33
RC=rc
44

5-
CFLAGS=/nologo /GX $(EXTRA_CFLAGS) /DUSE_HASHMAPS /D_WIN32
6-
LFLAGS=/NOLOGO /NODEFAULTLIB:libcmt.lib
5+
CFLAGS=/nologo /MT /EHsc /wd4731 /wd4477 /D_WINNT_WIN32=0x501 /DKS_JMP_SHIFT=4 $(EXTRA_CFLAGS) /DUSE_HASHMAPS /D_WIN32
6+
LFLAGS=/NOLOGO /NODEFAULTLIB:libci.lib /LIBPATH:soft\dxsdk81\lib
77
LIBS=gdi32.lib user32.lib advapi32.lib
88
LIBSDLL=pngdib.obj libpng.lib zdll.lib $(LIBS)
99

10+
INCLUDE=$(INCLUDE);soft\dxsdk81\include
11+
LIB=$(LIB);soft\dxsdk81\lib
12+
1013
INCPNGDIB=soft\pngdib
1114
INCCURL=soft\curl\include
1215
INCARCHIVE=soft\libarchive-2.4.12-1\include
13-
LPPNGDIB=soft\pngdib
16+
LPPNGDIB=soft\pngdib
1417
LPLIBPNG=soft\libpng-1.2.8-lib\lib
1518
LPZLIB=soft\zlib123-dll\lib
1619
LPARCHIVE=soft\libarchive-2.4.12-1\lib
@@ -21,7 +24,7 @@ all: dlls apps
2124
mkdir output
2225
copy *.exe output
2326
copy *.dll output
24-
27+
2528
all_apps: apps
2629
if exist output (rd /S /Q output)
2730
mkdir output
@@ -33,8 +36,11 @@ $(LPPNGDIB)\pngdib.obj:
3336
dlls: kload.dll kserv.dll bserv.dll fserv.dll bootserv.dll stadium.dll lodmixer.dll dxtools.dll clock.dll network.dll speeder.dll #afs2fs.dll #kserv-shpal.dll
3437
apps: setup.exe lodcfg.exe filedec.exe diag.exe afsexport.exe afswalk.exe afstest.exe zlibtool.exe
3538

36-
release:
37-
$(MAKE) EXTRA_CFLAGS=/DMYDLL_RELEASE_BUILD
39+
!if "$(debug)"=="1"
40+
EXTRA_CFLAGS=/DDEBUG
41+
!else
42+
EXTRA_CFLAGS=/DMYDLL_RELEASE_BUILD
43+
!endif
3844

3945
setup: setup.exe
4046

@@ -52,86 +58,85 @@ kload.dll: kload.lib kload.res
5258
$(LINK) $(LFLAGS) /out:kload.dll /DLL kload.obj d3dfont.obj dxutil.obj detect.obj imageutil.obj log.obj kload_config.obj hook.obj hooklib.obj afsreplace.obj apihijack.obj kload.res $(LIBS) d3dx8.lib winmm.lib
5359
kload.obj: kload.cpp kload.h kload_config.h hook.h manage.h
5460
detect.obj: detect.cpp detect.h
55-
kload.res:
61+
kload.res:
5662
$(RC) -r -fo kload.res kload.rc
5763

5864
kserv.lib: kserv.obj gdb.obj kserv_config.obj dxutil.obj crc32.obj afsreader.obj $(LPPNGDIB)\pngdib.obj
5965
kserv.dll: kserv.lib kserv.res
6066
$(LINK) $(LFLAGS) /out:kserv.dll /DLL kserv.obj gdb.obj kserv_config.obj crc32.obj afsreader.obj dxutil.obj kserv.res $(LIBSDLL) d3dx8.lib winmm.lib /LIBPATH:$(LPPNGDIB) /LIBPATH:$(LPLIBPNG) /LIBPATH:$(LPZLIB) kload.lib
6167
kserv.obj: kserv.cpp kserv.h shared.h kserv_config.h gdb.h lodcfg.h
62-
kserv.res:
68+
kserv.res:
6369
$(RC) -r -fo kserv.res kserv.rc
6470

6571
kserv-shpal.lib: kserv-shpal.obj gdb.obj kserv_config.obj dxutil.obj crc32.obj afsreader.obj $(LPPNGDIB)\pngdib.obj
6672
kserv-shpal.dll: kserv-shpal.lib kserv-shpal.res
6773
$(LINK) $(LFLAGS) /out:kserv-shpal.dll /DLL kserv-shpal.obj gdb.obj kserv_config.obj crc32.obj afsreader.obj dxutil.obj kserv-shpal.res $(LIBSDLL) d3dx8.lib winmm.lib /LIBPATH:$(LPPNGDIB) /LIBPATH:$(LPLIBPNG) /LIBPATH:$(LPZLIB) kload.lib
6874
kserv-shpal.obj: kserv-shpal.cpp kserv-shpal.h shared.h kserv_config.h gdb.h lodcfg.h
69-
kserv-shpal.res:
75+
kserv-shpal.res:
7076
$(RC) -r -fo kserv-shpal.res kserv-shpal.rc
7177

7278
bserv.lib: bserv.obj d3dfont.obj $(LPPNGDIB)\pngdib.obj crc32.obj
7379
bserv.dll: bserv.lib bserv.res
7480
$(LINK) $(LFLAGS) /out:bserv.dll /DLL bserv.obj d3dfont.obj crc32.obj kload.lib bserv.res $(LIBSDLL) d3dx8.lib winmm.lib /LIBPATH:$(LPPNGDIB) /LIBPATH:$(LPLIBPNG) /LIBPATH:$(LPZLIB) zdll.lib
7581
bserv.obj: bserv.cpp bserv.h
76-
bserv.res:
82+
bserv.res:
7783
$(RC) -r -fo bserv.res bserv.rc
78-
84+
7985
fserv.lib: fserv.obj fserv_config.obj
8086
fserv.dll: fserv.lib fserv.res crc32.obj
8187
$(LINK) $(LFLAGS) /out:fserv.dll /DLL fserv.obj fserv_config.obj crc32.obj kload.lib fserv.res d3dx8.lib $(LIBS)
8288
fserv.obj: fserv.cpp fserv.h
8389
fserv_config.obj: fserv_config.cpp fserv_config.h
8490

85-
fserv.res:
91+
fserv.res:
8692
$(RC) -r -fo fserv.res fserv.rc
8793

8894
bootserv.lib: bootserv.obj
8995
bootserv.dll: bootserv.lib bootserv.res
9096
$(LINK) $(LFLAGS) /out:bootserv.dll /DLL bootserv.obj kload.lib d3dx8.lib bootserv.res $(LIBS)
9197
bootserv.obj: bootserv.cpp bootserv.h
9298

93-
bootserv.res:
99+
bootserv.res:
94100
$(RC) -r -fo bootserv.res bootserv.rc
95-
96-
101+
97102
stadium.lib: stadium.obj crc32.obj afsreader.obj hooklib.obj
98103
stadium.dll: stadium.lib stadium.res
99104
$(LINK) $(LFLAGS) /out:stadium.dll /DLL stadium.obj crc32.obj afsreader.obj kload.lib hooklib.obj stadium.res $(LIBSDLL) d3dx8.lib /LIBPATH:$(LPPNGDIB) /LIBPATH:$(LPLIBPNG) /LIBPATH:$(LPZLIB)
100105
stadium.obj: stadium.cpp stadium.h
101106

102-
stadium.res:
107+
stadium.res:
103108
$(RC) -r -fo stadium.res stadium.rc
104109

105110
afs2fs.lib: afs2fs.obj crc32.obj afsreader.obj hooklib.obj log.obj
106111
afs2fs.dll: afs2fs.lib afs2fs.res
107112
$(LINK) $(LFLAGS) /out:afs2fs.dll /DLL afs2fs.obj crc32.obj afsreader.obj kload.lib hooklib.obj afs2fs.res $(LIBSDLL) d3dx8.lib /LIBPATH:$(LPPNGDIB) /LIBPATH:$(LPLIBPNG) /LIBPATH:$(LPZLIB)
108113
afs2fs.obj: afs2fs.cpp afs2fs.h afs2fs_addr.h
109114

110-
afs2fs.res:
115+
afs2fs.res:
111116
$(RC) -r -fo afs2fs.res afs2fs.rc
112117

113118
lodmixer.lib: lodmixer.obj
114119
lodmixer.dll: lodmixer.lib lodmixer.res
115120
$(LINK) $(LFLAGS) /out:lodmixer.dll /DLL lodmixer.obj kload.lib lodmixer.res $(LIBS)
116121
lodmixer.obj: lodmixer.cpp lodmixer.h
117122

118-
lodmixer.res:
123+
lodmixer.res:
119124
$(RC) -r -fo lodmixer.res lodmixer.rc
120-
125+
121126
dxtools.lib: dxtools.obj
122127
dxtools.dll: dxtools.lib dxtools.res
123128
$(LINK) $(LFLAGS) /out:dxtools.dll /DLL dxtools.obj kload.lib dxtools.res $(LIBS)
124129
dxtools.obj: dxtools.cpp dxtools.h
125130

126-
dxtools.res:
131+
dxtools.res:
127132
$(RC) -r -fo dxtools.res dxtools.rc
128-
133+
129134
savegames.lib: savegames.obj
130135
savegames.dll: savegames.lib savegames.res
131136
$(LINK) $(LFLAGS) /out:savegames.dll /DLL savegames.obj kload.lib savegames.res $(LIBS)
132137
savegames.obj: savegames.cpp savegames.h SGF.h
133138

134-
savegames.res:
139+
savegames.res:
135140
rc -r -fo savegames.res savegames.rc
136141

137142
clock.lib: clock.obj
@@ -147,7 +152,7 @@ md5.obj: md5.c md5.h
147152

148153
speeder.lib: speeder.obj apihijack.obj
149154
speeder.dll: speeder.lib speeder.res
150-
$(LINK) $(LFLAGS) /out:speeder.dll /DLL speeder.obj kload.lib apihijack.obj speeder.res $(LIBS)
155+
$(LINK) $(LFLAGS) /out:speeder.dll /DLL speeder.obj kload.lib apihijack.obj speeder.res $(LIBS)
151156
speeder.obj: speeder.cpp speeder.h apihijack.h
152157

153158
setupgui.obj: setupgui.cpp setupgui.h
@@ -173,21 +178,21 @@ afswalk.exe: afswalk.obj afsreader.obj crc32.obj alog.obj aconfig.obj
173178
afsexport.obj: afsexport.cpp afsreader.h
174179
afsexport.exe: afsexport.obj afsreader.obj crc32.obj alog.obj aconfig.obj
175180
$(LINK) $(LFLAGS) /out:afsexport.exe afsexport.obj afsreader.obj crc32.obj alog.obj aconfig.obj $(LIBS)
176-
181+
177182
stadimp.obj: stadimp.cpp
178183
stadimp.exe: stadimp.obj
179184
$(LINK) $(LFLAGS) /out:stadimp.exe stadimp.obj $(LIBS)
180185

181186
filedec.obj: filedec.cpp
182187
filedec.exe: filedec.obj
183188
$(LINK) $(LFLAGS) /out:filedec.exe filedec.obj $(LIBS)
184-
189+
185190
diaggui.obj: diaggui.cpp diaggui.h
186191
diag.exe: diag.obj diaggui.obj
187192
$(LINK) $(LFLAGS) /out:diag.exe diag.obj diaggui.obj $(LIBS)
188193
diag.obj: diag.cpp diag.h diaggui.h
189194

190-
195+
191196
.cpp.obj:
192197
$(CC) $(CFLAGS) -c $(INC) /I $(INCPNGDIB) /I $(INCCURL) /I $(INCARCHIVE) $<
193198

@@ -200,4 +205,4 @@ clean-all:
200205
del /Q /F *.exp *.lib *.obj *.res *.dll *.exe *.log *~
201206
(cd soft\pngdib && $(MAKE) clean-all)
202207
if exist output (rd /S /Q output)
203-
208+

src/afsreplace.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum {
1515
AFS_PAGELEN_TABLE
1616
};
1717

18-
static DWORD dataArray[][DATALEN] = {
18+
static DWORD dtaArray[][DATALEN] = {
1919
// PES5 DEMO 2
2020
{
2121
0,
@@ -34,7 +34,7 @@ static DWORD dataArray[][DATALEN] = {
3434
},
3535
};
3636

37-
static DWORD data[DATALEN];
37+
static DWORD dta[DATALEN];
3838

3939
CALLLINE l_GetNumPages={0,NULL};
4040

@@ -54,7 +54,7 @@ KEXPORT DWORD GetAfsIdByBase(DWORD base)
5454
{
5555
//LogWithNumber(&k_kload, "GetAfsIdByBase:: AFS_PAGELEN_TABLE = %d",
5656
// AFS_PAGELEN_TABLE);
57-
DWORD* pageLenTable = (DWORD*)data[AFS_PAGELEN_TABLE];
57+
DWORD* pageLenTable = (DWORD*)dta[AFS_PAGELEN_TABLE];
5858
//LogWithNumber(&k_kload, "GetAfsIdByBase:: pageLenTable = %08x",
5959
// (DWORD)pageLenTable);
6060
for (DWORD i=0; i<8; i++)
@@ -65,7 +65,7 @@ KEXPORT DWORD GetAfsIdByBase(DWORD base)
6565

6666
KEXPORT DWORD GetFileIdByOffset(DWORD afsId, DWORD offset)
6767
{
68-
DWORD* pageLenTable = (DWORD*)data[AFS_PAGELEN_TABLE];
68+
DWORD* pageLenTable = (DWORD*)dta[AFS_PAGELEN_TABLE];
6969
AFS_INFO* afsInfo = (AFS_INFO*)pageLenTable[afsId];
7070
DWORD prevFileId = 0, fileId = 0;
7171
DWORD offsetSoFar = 0x800 * afsInfo->pages[0];
@@ -123,7 +123,7 @@ KEXPORT void ClearProbableReadForHandle(HANDLE hFile, DWORD wasOffset)
123123

124124
KEXPORT DWORD GetOffsetByFileId(DWORD afsId, DWORD fileId)
125125
{
126-
DWORD* pageLenTable = (DWORD*)data[AFS_PAGELEN_TABLE];
126+
DWORD* pageLenTable = (DWORD*)dta[AFS_PAGELEN_TABLE];
127127
AFS_INFO* afsInfo = (AFS_INFO*)pageLenTable[afsId];
128128
DWORD offset = 0;
129129
for (DWORD i=0; i<=fileId; i++) {
@@ -163,7 +163,7 @@ DWORD newReadNumPages(DWORD base, DWORD fileId, DWORD orgNumPages)
163163
{
164164
//Log(&k_kload, "newReadNumPages called");
165165
//for (int j=0; j<DATALEN; j++) {
166-
// LogWithTwoNumbers(&k_kload, "data[%d]=%08x", j, data[j]);
166+
// LogWithTwoNumbers(&k_kload, "dta[%d]=%08x", j, dta[j]);
167167
//}
168168
DWORD afsId = GetAfsIdByBase(base);
169169
//LogWithNumber(&k_kload, "afsId=%d", afsId);
@@ -185,5 +185,5 @@ DWORD newReadNumPages(DWORD base, DWORD fileId, DWORD orgNumPages)
185185
void afsreplace_init(int v)
186186
{
187187
//LogWithNumber(&k_kload, "afsreplace_init:: v=%d", v);
188-
memcpy(data, dataArray[v], sizeof(data));
188+
memcpy(dta, dtaArray[v], sizeof(dta));
189189
}

src/apihijack.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ bool RedirectIAT( SDLLHook* DLLHook, PIMAGE_IMPORT_DESCRIPTOR pImportDesc, PVOID
196196
// If it's code, we shouldn't be able to write to it
197197
if ( IsBadWritePtr( (PVOID)pIteratingIAT->u1.Function, 1 ) )
198198
{
199-
pIteratingIAT->u1.Function = (DWORD_PTR)HookFn;
199+
pIteratingIAT->u1.Function = (DWORD)HookFn;
200200
}
201201
else if ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
202202
{
203203
// Special hack for Win9X, which builds stubs for imported
204204
// functions in system DLLs (Loaded above 2GB). These stubs are
205205
// writeable, so we have to explicitly check for this case
206-
if ( pIteratingIAT->u1.Function > (DWORD_PTR)0x80000000 )
207-
pIteratingIAT->u1.Function = (DWORD_PTR)HookFn;
206+
if ( pIteratingIAT->u1.Function > (DWORD)0x80000000 )
207+
pIteratingIAT->u1.Function = (DWORD)HookFn;
208208
}
209209
}
210210

src/bootserv.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)