mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
add temporary game patches for testing
This commit is contained in:
parent
b4b3e95832
commit
453d266d76
@ -9,6 +9,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
|
#include "patch.h"
|
||||||
|
|
||||||
|
|
||||||
/* export for cncnet cnc games */
|
/* export for cncnet cnc games */
|
||||||
@ -38,6 +39,56 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
#endif
|
#endif
|
||||||
g_ddraw_module = hDll;
|
g_ddraw_module = hDll;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Claw DVD Movie experiments */
|
||||||
|
|
||||||
|
/* change file extension .vob to .avi */
|
||||||
|
HMODULE game_exe = GetModuleHandleA(NULL);
|
||||||
|
|
||||||
|
PIMAGE_DOS_HEADER dos_hdr = (void*)game_exe;
|
||||||
|
PIMAGE_NT_HEADERS nt_hdr = (void*)((char*)game_exe + dos_hdr->e_lfanew);
|
||||||
|
|
||||||
|
for (int i = 0; i < nt_hdr->FileHeader.NumberOfSections; i++)
|
||||||
|
{
|
||||||
|
PIMAGE_SECTION_HEADER sct_hdr = IMAGE_FIRST_SECTION(nt_hdr) + i;
|
||||||
|
|
||||||
|
if (strcmp(".data", (char*)sct_hdr->Name) == 0)
|
||||||
|
{
|
||||||
|
char* s = (char*)((char*)game_exe + sct_hdr->VirtualAddress);
|
||||||
|
int s_len = sct_hdr->Misc.VirtualSize;
|
||||||
|
|
||||||
|
for (int i = 0; i < s_len; i++, s++)
|
||||||
|
{
|
||||||
|
if (*s == '.' && memcmp(s, "\x2E\x76\x6F\x62\x00", 5) == 0) /* .vob */
|
||||||
|
{
|
||||||
|
memcpy(s, "\x2E\x61\x76\x69", 4); /* .avi */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sct_hdr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add registry key for x264vfw */
|
||||||
|
|
||||||
|
HKEY hkey;
|
||||||
|
LONG status =
|
||||||
|
RegOpenKeyExA(
|
||||||
|
HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32", 0L, KEY_WRITE, &hkey);
|
||||||
|
|
||||||
|
if (status == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
LPCTSTR data = "x264vfw.dll";
|
||||||
|
RegSetValueExA(hkey,"vidc.x264", 0, REG_SZ, data, strlen(data)+1);
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if (GetEnvironmentVariable("__COMPAT_LAYER", buf, sizeof(buf)))
|
if (GetEnvironmentVariable("__COMPAT_LAYER", buf, sizeof(buf)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user