forked from Dniel97/segatools
platform/amvideo.c: Add virtual amvideo.dll hook
This commit is contained in:
parent
96b1981e01
commit
3e91ac2393
75
platform/amvideo.c
Normal file
75
platform/amvideo.c
Normal 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
5
platform/amvideo.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
HRESULT amvideo_hook_init(HMODULE redir_mod);
|
@ -7,6 +7,8 @@ platform_lib = static_library(
|
||||
capnhook.get_variable('hook_dep'),
|
||||
],
|
||||
sources : [
|
||||
'amvideo.c',
|
||||
'amvideo.h',
|
||||
'hwmon.c',
|
||||
'hwmon.h',
|
||||
'pcbid.c',
|
||||
|
Loading…
Reference in New Issue
Block a user