mirror of
https://gitea.tendokyu.moe/Hay1tsme/segatools.git
synced 2026-05-06 05:15:42 -05:00
idz: bypass size check
This commit is contained in:
parent
e387f582a9
commit
ba6ec91cce
72
games/idzhook/crt.c
Normal file
72
games/idzhook/crt.c
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "crt.h"
|
||||
|
||||
#include "util/dprintf.h"
|
||||
|
||||
/* API hooks */
|
||||
|
||||
static int WINAPIV hook__stat64i32(
|
||||
const char *path,
|
||||
struct _stat64i32 *buffer
|
||||
);
|
||||
|
||||
/* Link pointers */
|
||||
|
||||
static int (WINAPIV *next__stat64i32)(
|
||||
const char *path,
|
||||
struct _stat64i32 *buffer
|
||||
);
|
||||
|
||||
static const char *target_executables[] = {
|
||||
"InitialD0_DX11_Nu.exe",
|
||||
"amdaemon.exe",
|
||||
};
|
||||
|
||||
static const size_t target_executables_len = _countof(target_executables);
|
||||
|
||||
|
||||
static const struct hook_symbol msvcr110_hooks[] = {
|
||||
{
|
||||
.name = "_stat64i32",
|
||||
.patch = hook__stat64i32,
|
||||
.link = (void**) &next__stat64i32
|
||||
}
|
||||
};
|
||||
|
||||
void crt_hook_init(void)
|
||||
{
|
||||
dprintf("CRT: Hooks init.\n");
|
||||
|
||||
hook_table_apply(
|
||||
NULL,
|
||||
"msvcr110.dll",
|
||||
msvcr110_hooks,
|
||||
_countof(msvcr110_hooks));
|
||||
}
|
||||
|
||||
static int __cdecl hook__stat64i32(
|
||||
const char *path,
|
||||
struct _stat64i32 *buffer
|
||||
)
|
||||
{
|
||||
const char *target_executable;
|
||||
|
||||
if (path != NULL) {
|
||||
for (size_t i = 0; i < target_executables_len; i++) {
|
||||
target_executable = target_executables[i];
|
||||
|
||||
if (strstr(path, target_executable)) {
|
||||
dprintf("CRT: Bypassing size check for %s\n", path);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return next__stat64i32(path, buffer);
|
||||
}
|
||||
3
games/idzhook/crt.h
Normal file
3
games/idzhook/crt.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include <windows.h>
|
||||
|
||||
void crt_hook_init(void);
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
#include "idzhook/jvs.h"
|
||||
#include "idzhook/ffb.h"
|
||||
#include "idzhook/zinput.h"
|
||||
#include "idzhook/crt.h"
|
||||
|
||||
#include "platform/platform.h"
|
||||
|
||||
|
|
@ -86,6 +87,7 @@ static DWORD CALLBACK idz_pre_startup(void)
|
|||
gfx_dxgi_hook_init(&idz_hook_cfg.gfx, idz_hook_mod);
|
||||
zinput_hook_init(&idz_hook_cfg.zinput);
|
||||
dvd_hook_init(&idz_hook_cfg.dvd, idz_hook_mod);
|
||||
crt_hook_init();
|
||||
|
||||
/* Initialize emulation hooks */
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ shared_library(
|
|||
sources : [
|
||||
'config.c',
|
||||
'config.h',
|
||||
'crt.c',
|
||||
'crt.h',
|
||||
'dllmain.c',
|
||||
'idz-dll.c',
|
||||
'idz-dll.h',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user