Skip to content

Commit a6256e1

Browse files
committed
DoomGeneric NTNative port
1 parent 2d9b24f commit a6256e1

Some content is hidden

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

98 files changed

+37484
-108
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
################################################################################
2+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3+
################################################################################
4+
5+
/.vs/doomgeneric/v16
6+
/Debug
7+
/doomgeneric/Debug
8+
/doomgeneric/buildfre_wxp_x86.err
9+
/doomgeneric/buildfre_wxp_x86.log
10+
/doomgeneric/buildfre_wxp_x86.wrn
11+
/doomgeneric/ntdll.lib
12+
/doomgeneric/SOURCES
13+
/doomgeneric/SOURCES.txt
14+
/doomgeneric/x64/Debug
15+
/doomgeneric/nmakefile
16+
/doomgeneric/doomgeneric_nt

README.md

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,61 @@
1-
# doomgeneric
2-
The purpose of doomgeneric is to make porting Doom easier.
3-
Of course Doom is already portable but with doomgeneric it is possible with just a few functions.
4-
The limitation is there is no sound!
1+
# DoomGeneric NTNative
2+
This is a fork of ozkl's DoomGeneric which adds port to the BootExecute environment of Windows XP and later.
53

6-
To try it you will need a WAD file (game data). If you don't own the game, shareware version is freely available (doom1.wad).
4+
# Requirements for building DoomGeneric NTNative
5+
1. Visual Studio 2017 Windows XP toolset.
6+
2. InbvShim (https://github.com/Cacodemon345/inbvbootdrv).
7+
3. Windows 7 DDK (for building InbvShim and ntdll.lib).
78

8-
# porting
9-
Create a file named doomgeneric_yourplatform.c and just implement these functions to suit your platform.
10-
* DG_Init
11-
* DG_DrawFrame
12-
* DG_SleepMs
13-
* DG_GetTicksMs
14-
* DG_GetKey
9+
# Building
10+
Note: Only 32-bit Debug builds are supported, anything else is broken.
11+
Copy over the ntdll.lib file from \path\to\WinDDK\7600.16385.1\lib\wxp\i386\ to the doomgeneric directory inside the project. Open the solution, right click "doomgeneric_nt" and select "Build".
1512

16-
|Functions |Description|
17-
|---------------------|-----------|
18-
|DG_Init |Initialize your platfrom (create window, framebuffer, etc...).
19-
|DG_DrawFrame |Frame is ready in DG_ScreenBuffer. Copy it to your platform's screen.
20-
|DG_SleepMs |Sleep in milliseconds.
21-
|DG_GetTicksMs |The ticks passed since launch in milliseconds.
22-
|DG_GetKey |Provide keyboard events.
23-
|DG_SetWindowTitle |Not required. This is for setting the window title as Doom sets this from WAD file.
13+
# Building InbvShim
14+
From the x86/x64 Free Build Environment, cd to the directory where you have cloned InbvShim repository, and type 'build' to build the driver. You will find the inbvbootdrv.sys file in the objfre_wxp_x86 (objfre_win7_x64 if building for x64) folder.
2415

25-
# platforms
26-
I have ported to Windows, X11, and Soso. Just look at (doomgeneric_win.c or doomgeneric_xlib.c).
16+
# Installing InbvShim
17+
Copy it to your system32\Drivers directory of your Windows installation. And then grab the inbvbootdrvinst.reg from one of the releases and double-click it to install.
2718

28-
Note that X11 port is not efficient since it generates pixmap by XDrawPoint. It can be further improved by using X11 extensions.
19+
# Installing DoomGeneric NTNative
20+
Copy doomgeneric_nt.exe to C:\Windows\system32\ directory.
21+
There are two ways of launching it:
22+
1. Registry modification:
23+
**WARNING:** Backing up the registry is very important before going down this path.
24+
Open Registry Editor (regedit), go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\. Double-click BootExecute.
2925

30-
## SDL
26+
Replace this:
27+
```
28+
autocheck autochk *
29+
```
3130

32-
![SDL](screenshots/sdl.png)
31+
with:
32+
```
33+
autocheck autochk *
34+
doomgeneric_nt -iwad \??\C:\Windows\doom2.wad -cdrom
35+
```
3336

34-
## Windows
35-
![Windows](screenshots/windows.png)
37+
Replace \??\C:\Windows\doom2.wad with the location where the IWAD is installed (remember to prefix it with \??\ before the full path).
3638

37-
## X11 - Ubuntu
38-
![Ubuntu](screenshots/ubuntu.png)
39+
Note that I don't recommend this way because it can make input non-functional, making it impossible to quit the program and requiring a hard reset.
3940

40-
## X11 - FreeBSD
41-
![FreeBSD](screenshots/freebsd.png)
41+
2. Native Shell (assuming you installed it beforehand):
42+
cd to the directory where DoomGeneric NTNative is installed and type:
43+
```
44+
doomgeneric_nt.exe -iwad \??\path\to\iwad.wad -cdrom
45+
```
46+
47+
Replace \path\to\ with the location where the IWAD is installed.
48+
49+
# Extra bonuses:
50+
1. 16-color mode for Windows GDI port activated with -4bit option.
51+
52+
# Bugs:
53+
1. Savegames are broken.
54+
2. Picking a weapon crashes the program (bug inherited from original DoomGeneric).
55+
56+
# License:
57+
Same as original DoomGeneric, except for some files:
58+
59+
i_main_nt.c: ReactOS project license.
60+
doomgeneric_nt.c: Uses code both from ZenWINX and Native Shell (LGPL).
61+
Bundled NDK: Used under the terms of GPLv2.

doomgeneric.sln

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,48 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27130.2003
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31424.327
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doomgeneric", "doomgeneric\doomgeneric.vcxproj", "{95A126D2-CC94-4840-BF05-80305041B5FB}"
77
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doomgeneric_nt", "doomgeneric\doomgeneric_nt.vcxproj", "{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|ARM = Debug|ARM
13+
Debug|ARM64 = Debug|ARM64
1014
Debug|x64 = Debug|x64
1115
Debug|x86 = Debug|x86
16+
Release|ARM = Release|ARM
17+
Release|ARM64 = Release|ARM64
1218
Release|x64 = Release|x64
1319
Release|x86 = Release|x86
1420
EndGlobalSection
1521
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{95A126D2-CC94-4840-BF05-80305041B5FB}.Debug|ARM.ActiveCfg = Debug|Win32
23+
{95A126D2-CC94-4840-BF05-80305041B5FB}.Debug|ARM64.ActiveCfg = Debug|Win32
1624
{95A126D2-CC94-4840-BF05-80305041B5FB}.Debug|x64.ActiveCfg = Debug|x64
1725
{95A126D2-CC94-4840-BF05-80305041B5FB}.Debug|x64.Build.0 = Debug|x64
1826
{95A126D2-CC94-4840-BF05-80305041B5FB}.Debug|x86.ActiveCfg = Debug|Win32
1927
{95A126D2-CC94-4840-BF05-80305041B5FB}.Debug|x86.Build.0 = Debug|Win32
28+
{95A126D2-CC94-4840-BF05-80305041B5FB}.Release|ARM.ActiveCfg = Release|Win32
29+
{95A126D2-CC94-4840-BF05-80305041B5FB}.Release|ARM64.ActiveCfg = Release|Win32
2030
{95A126D2-CC94-4840-BF05-80305041B5FB}.Release|x64.ActiveCfg = Release|x64
2131
{95A126D2-CC94-4840-BF05-80305041B5FB}.Release|x64.Build.0 = Release|x64
2232
{95A126D2-CC94-4840-BF05-80305041B5FB}.Release|x86.ActiveCfg = Release|Win32
2333
{95A126D2-CC94-4840-BF05-80305041B5FB}.Release|x86.Build.0 = Release|Win32
34+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Debug|ARM.ActiveCfg = Debug|Win32
35+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Debug|ARM64.ActiveCfg = Debug|Win32
36+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Debug|x64.ActiveCfg = Debug|x64
37+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Debug|x64.Build.0 = Debug|x64
38+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Debug|x86.ActiveCfg = Debug|Win32
39+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Debug|x86.Build.0 = Debug|Win32
40+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Release|ARM.ActiveCfg = Release|Win32
41+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Release|ARM64.ActiveCfg = Release|Win32
42+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Release|x64.ActiveCfg = Release|x64
43+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Release|x64.Build.0 = Release|x64
44+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Release|x86.ActiveCfg = Release|Win32
45+
{622D3F6E-5ECE-44FF-8302-283EC8BC2FE1}.Release|x86.Build.0 = Release|Win32
2446
EndGlobalSection
2547
GlobalSection(SolutionProperties) = preSolution
2648
HideSolutionNode = FALSE
File renamed without changes.

doomgeneric/d_iwad.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "config.h"
2525
#include "deh_str.h"
2626
#include "doomkeys.h"
27+
#include "doomtype.h"
2728
#include "d_iwad.h"
2829
#include "i_system.h"
2930
#include "m_argv.h"
@@ -198,7 +199,7 @@ static char *GetRegistryString(registry_value_t *reg_val)
198199

199200
// Open the key (directory where the value is stored)
200201

201-
if (RegOpenKeyEx(reg_val->root, reg_val->path,
202+
if (RegOpenKeyExA(reg_val->root, reg_val->path,
202203
0, KEY_READ, &key) != ERROR_SUCCESS)
203204
{
204205
return NULL;
@@ -208,15 +209,15 @@ static char *GetRegistryString(registry_value_t *reg_val)
208209

209210
// Find the type and length of the string, and only accept strings.
210211

211-
if (RegQueryValueEx(key, reg_val->value,
212+
if (RegQueryValueExA(key, reg_val->value,
212213
NULL, &valtype, NULL, &len) == ERROR_SUCCESS
213214
&& valtype == REG_SZ)
214215
{
215216
// Allocate a buffer for the value and read the value
216217

217218
result = malloc(len);
218219

219-
if (RegQueryValueEx(key, reg_val->value, NULL, &valtype,
220+
if (RegQueryValueExA(key, reg_val->value, NULL, &valtype,
220221
(unsigned char *) result, &len) != ERROR_SUCCESS)
221222
{
222223
free(result);

doomgeneric/d_loop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <stdlib.h>
2020
#include <string.h>
21+
#include <stdio.h>
2122

2223
#include "doomfeatures.h"
2324

@@ -456,7 +457,7 @@ boolean D_InitNetGame(net_connect_data_t *connect_data)
456457
net_addr_t *addr = NULL;
457458
int i;
458459
#endif
459-
460+
printf("%s enter\n", __func__);
460461
// Call D_QuitNetGame on exit:
461462

462463
I_AtExit(D_QuitNetGame, true);

doomgeneric/d_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,8 +1309,11 @@ void D_DoomMain (void)
13091309
if (M_ParmExists("-cdrom"))
13101310
{
13111311
printf(D_CDROM);
1312-
1312+
#ifdef _WINNT_NATIVE_MODE
1313+
M_SetConfigDir("\\??\\c:\\doomdata\\");
1314+
#else
13131315
M_SetConfigDir("c:\\doomdata\\");
1316+
#endif
13141317
}
13151318
else
13161319
#endif
@@ -1618,6 +1621,7 @@ void D_DoomMain (void)
16181621
#endif
16191622

16201623
// Initial netgame startup. Connect to server etc.
1624+
printf ("D_ConnectNetGame: Init game subsystem.\n");
16211625
D_ConnectNetGame();
16221626

16231627
// get skill / episode / map from parms

doomgeneric/d_net.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static void InitConnectData(net_connect_data_t *connect_data)
166166
//
167167
// Run as the left screen in three screen mode.
168168
//
169-
169+
printf("%s enter\n", __func__);
170170
if (M_CheckParm("-left") > 0)
171171
{
172172
viewangleoffset = ANG90;
@@ -216,6 +216,7 @@ void D_ConnectNetGame(void)
216216
{
217217
net_connect_data_t connect_data;
218218

219+
printf("%s enter\n", __func__);
219220
InitConnectData(&connect_data);
220221
netgame = D_InitNetGame(&connect_data);
221222

doomgeneric/doomgeneric.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ uint32_t* DG_ScreenBuffer = 0;
55

66
void dg_Create()
77
{
8+
89
DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
910

1011
DG_Init();

doomgeneric/doomgeneric.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define DOOM_GENERIC
33

44
#include <stdlib.h>
5-
#include <stdint.h>
5+
#include "doomtype.h"
66

77
#define DOOMGENERIC_RESX 640
88
#define DOOMGENERIC_RESY 400

0 commit comments

Comments
 (0)