build: go with our own .exe

This commit is contained in:
rr- 2021-11-19 14:19:15 +01:00
parent 15597e810d
commit fe7e59b4f0
No known key found for this signature in database
GPG key ID: CC65E6FD28CAE42A
14 changed files with 10 additions and 111 deletions

View file

@ -25,7 +25,7 @@ jobs:
make clean release
- name: Package release
run: |
7z a release.zip ./bin/tombati.exe ./bin/cfg/ ./build/Tomb1Main.dll
7z a release.zip ./bin/* ./build/*.dll ./build/*.exe
- name: Create release
id: create_release
uses: actions/create-release@v1

View file

@ -12,10 +12,9 @@ This project is inspired by Arsunt's
## Installing
1. Install the [TombATI v1.7 patch](http://www.glidos.net/tombati.html).
2. Get a copy of the latest Tomb1Main release from
1. Get a copy of the latest Tomb1Main release from
[here](https://github.com/rr-/Tomb1Main/releases).
3. Unpack the contents to your game directory. Make sure you overwrite existing
2. Unpack the contents to your game directory. Make sure you overwrite existing
files (Tomb1Main_config.json5 can be left alone).
To play the Unfinished Business expansion pack, launch the game with `-gold`

View file

@ -1,4 +0,0 @@
## Tomb1Main binaries
- `tombati.exe` - a patched version of TombATI executable that loads the `Tomb1Main.dll` library.
- `tombati.orig.exe` - the original TombATI version.

Binary file not shown.

Binary file not shown.

View file

@ -249,10 +249,8 @@ sources = [
'src/global/vars.c',
'src/global/vars_platform.c',
'src/init.c',
'src/inject_util.c',
'src/json.c',
'src/log.c',
'src/main.c',
'src/memory.c',
'src/specific/s_ati.c',
'src/specific/s_clock.c',
@ -270,17 +268,20 @@ sources = [
version_res,
]
library(
executable(
'Tomb1Main',
sources,
name_prefix: '',
link_with: [
glrage,
],
include_directories: ['src/'],
dependencies: [
dep_ddraw,
dep_dinput8,
dep_dsound,
dep_dxguid,
dep_shlwapi,
dep_winmm,
],
gui_app: true,
)

View file

@ -1,8 +0,0 @@
#include "inject.h"
#include "specific/s_shell.h"
void T1MInject()
{
S_Shell_Inject();
}

View file

@ -1,6 +0,0 @@
#ifndef T1M_INJECT_H
#define T1M_INJECT_H
void T1MInject();
#endif

View file

@ -1,24 +0,0 @@
#include "inject_util.h"
#include "log.h"
#include <windows.h>
void T1MInjectFunc(void (*from)(void), void (*to)(void))
{
if (from == to) {
return;
}
DWORD tmp;
LOG_DEBUG("Patching %p to %p", from, to);
VirtualProtect(from, sizeof(JMP), PAGE_EXECUTE_READWRITE, &tmp);
HANDLE hCurrentProcess = GetCurrentProcess();
JMP buf;
buf.opcode = 0xE9;
buf.offset = (DWORD)(to) - ((DWORD)(from) + sizeof(JMP));
WriteProcessMemory(hCurrentProcess, from, &buf, sizeof(JMP), &tmp);
CloseHandle(hCurrentProcess);
// arsunt style - doesn't work because of GLRage calling VirtualProtect
//((JMP*)(from))->opcode = 0xE9;
//((JMP*)(from))->offset = (DWORD)(to) - ((DWORD)(from) + sizeof(JMP));
}

View file

@ -1,20 +0,0 @@
#ifndef T1M_INJECT_UTIL_H
#define T1M_INJECT_UTIL_H
#include <stdint.h>
#pragma pack(push, 1)
typedef struct {
uint8_t opcode; // must be 0xE9
uint32_t offset;
} JMP;
#pragma pack(pop)
void T1MInjectFunc(void (*from)(void), void (*to)(void));
#define INJECT(from, to) \
{ \
T1MInjectFunc((void (*)(void))from, (void (*)(void))to); \
}
#endif

View file

@ -1,29 +0,0 @@
#include "inject.h"
#include "log.h"
#include <windows.h>
HINSTANCE hInstance = NULL;
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
LOG_INFO("attached");
hInstance = hinstDLL;
T1MInject();
break;
case DLL_PROCESS_DETACH:
LOG_INFO("detached");
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}

View file

@ -1,7 +1,6 @@
#include "specific/s_ati.h"
#include "global/vars_platform.h"
#include "inject_util.h"
#include "log.h"
#include <windows.h>
@ -31,9 +30,9 @@ C3D_EC(__stdcall **m_ATI3DCIF_RenderPrimList_lib)
C3D_EC S_ATI_Init()
{
m_ATIModule = LoadLibraryA("ati3dcif");
m_ATIModule = LoadLibraryA("glrage");
if (!m_ATIModule) {
LOG_ERROR("Cannot find ati3dcif.dll");
LOG_ERROR("Cannot find glrage.dll");
return C3D_EC_GENFAIL;
}

View file

@ -9,7 +9,6 @@
#include "game/shell.h"
#include "global/vars.h"
#include "global/vars_platform.h"
#include "inject_util.h"
#include "log.h"
#include "specific/s_hwr.h"
#include "specific/s_input.h"
@ -233,9 +232,3 @@ void S_Shell_ExitSystemFmt(const char *fmt, ...)
va_end(va);
S_Shell_ExitSystem(message);
}
void S_Shell_Inject()
{
INJECT(0x0043DA80, WinMain);
INJECT(0x0043DE00, WndProc);
}

View file

@ -8,6 +8,4 @@ void S_Shell_ExitSystem(const char *message);
void S_Shell_ExitSystemFmt(const char *fmt, ...);
void S_Shell_SpinMessageLoop();
void S_Shell_Inject();
#endif