1
0
mirror of https://gitea.tendokyu.moe/Hay1tsme/segatools.git synced 2024-11-14 21:47:38 +01:00
segatools-hay1tsme/platform/amvideo.c

76 lines
1.6 KiB
C
Raw Normal View History

#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;
}