1
0
mirror of https://gitea.tendokyu.moe/Hay1tsme/segatools.git synced 2024-11-24 17:30:11 +01:00

platform/amvideo.c: Add virtual amvideo.dll hook

This commit is contained in:
Tau 2019-05-14 18:03:25 -04:00
parent 96b1981e01
commit 3e91ac2393
3 changed files with 82 additions and 0 deletions

75
platform/amvideo.c Normal file
View File

@ -0,0 +1,75 @@
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include "hook/table.h"
#include "hooklib/dll.h"
#include "util/dprintf.h"
/* Hook functions */
static int amDllVideoOpen(void *ctx);
static int amDllVideoClose(void *ctx);
static int amDllVideoSetResolution(void *ctx, void *param);
static int amDllVideoGetVBiosVersion(void *ctx, char *dest, size_t nchars);
static const struct hook_symbol amvideo_syms[] = {
{
.ordinal = 1,
.name = "amDllVideoOpen",
.patch = amDllVideoOpen,
}, {
.ordinal = 2,
.name = "amDllVideoClose",
.patch = amDllVideoClose,
}, {
.ordinal = 3,
.name = "amDllVideoSetResolution",
.patch = amDllVideoSetResolution,
}, {
.ordinal = 4,
.name = "amDllVideoGetVBiosVersion",
.patch = amDllVideoGetVBiosVersion,
}
};
HRESULT amvideo_hook_init(HMODULE redir_mod)
{
return dll_hook_push(
redir_mod,
L"$amvideo",
amvideo_syms,
_countof(amvideo_syms));
}
static int amDllVideoOpen(void *ctx)
{
dprintf("AmVideo: %s(%p)\n", __func__, ctx);
return 0;
}
static int amDllVideoClose(void *ctx)
{
dprintf("AmVideo: %s(%p)\n", __func__, ctx);
return 0;
}
static int amDllVideoSetResolution(void *ctx, void *param)
{
dprintf("AmVideo: %s(%p, %p)\n", __func__, ctx, param);
return 0;
}
static int amDllVideoGetVBiosVersion(void *ctx, char *dest, size_t nchars)
{
dprintf("AmVideo: %s(%p, %p, %i)\n", __func__, ctx, dest, (int) nchars);
strcpy(dest, "01.02.03.04.05");
return 0;
}

5
platform/amvideo.h Normal file
View File

@ -0,0 +1,5 @@
#pragma once
#include <windows.h>
HRESULT amvideo_hook_init(HMODULE redir_mod);

View File

@ -7,6 +7,8 @@ platform_lib = static_library(
capnhook.get_variable('hook_dep'),
],
sources : [
'amvideo.c',
'amvideo.h',
'hwmon.c',
'hwmon.h',
'pcbid.c',