Added d3d11 hook, better touch naming

This commit is contained in:
Hay1tsme 2022-02-10 12:17:10 -05:00 committed by Hay1tsme
parent 50884d5b19
commit 1964fa766f
11 changed files with 34 additions and 15 deletions

View File

@ -35,6 +35,7 @@ COPY mu3hook mu3hook
COPY mu3io mu3io
COPY pki pki
COPY platform platform
COPY gfxhook gfxhook
COPY reg reg
COPY spike spike
COPY subprojects subprojects

View File

@ -32,6 +32,8 @@ enable=1
; that subnet must start with 192.168.
subnet=192.168.250.0
[gfx]
enable=1
[io4]
; Input API selection for JVS input emulator.

View File

@ -1,10 +1,15 @@
@echo off
pushd %~dp0
taskkill /f /im amdaemon.exe > nul 2>&1
:LOOP
REM USA
REM start inject -d -k mercuryhook.dll amdaemon.exe -f -c config.json config_lan_install_client.json config_lan_install_server.json config_video_clone.json config_video_dual.json config_video_clone_flip.json config_video_dual_flip.json config_region_exp.json config_region_chn.json config_region_usa.json
REM JP
start inject -d -k mercuryhook.dll amdaemon.exe -f -c config.json config_lan_install_client.json config_lan_install_server.json config_video_clone.json config_video_dual.json config_video_clone_flip.json config_video_dual_flip.json config_region_exp.json config_region_chn.json config_region_jpn.json
inject -d -k mercuryhook.dll ../WindowsNoEditor/Mercury/Binaries/Win64/Mercury-Win64-Shipping.exe
taskkill /f /im amdaemon.exe > nul 2>&1
echo.
echo Game processes have terminated
pause

View File

@ -312,7 +312,7 @@ static HRESULT STDMETHODCALLTYPE my_IDXGIFactory_CreateSwapChain(
ShowWindow(hwnd, SW_RESTORE);
if (!gfx_config.framed && width > 0 && height > 0) {
dprintf("DXGI: Resizing window to %ldx%ld\n", width, height);
dprintf("DXGI: Resizing window to %ux%u\n", width, height);
SetWindowLongPtrW(hwnd, GWL_STYLE, WS_POPUP);
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, WS_EX_TOPMOST);

View File

@ -19,7 +19,7 @@ void gfx_util_borderless_fullscreen_windowed(HWND hwnd, UINT width, UINT height)
BOOL ok;
HRESULT hr;
dprintf("Gfx: Resizing window to %ldx%ld\n", width, height);
dprintf("Gfx: Resizing window to %ux%u\n", width, height);
SetWindowLongPtrW(hwnd, GWL_STYLE, WS_POPUP);
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, WS_EX_TOPMOST);

View File

@ -5,6 +5,7 @@
#include "hooklib/config.h"
#include "hooklib/dvd.h"
#include "gfxhook/config.h"
#include "mercuryhook/config.h"
@ -51,6 +52,7 @@ void mercury_hook_config_load(
aime_config_load(&cfg->aime, filename);
dvd_config_load(&cfg->dvd, filename);
io4_config_load(&cfg->io4, filename);
gfx_config_load(&cfg->gfx, filename);
mercury_dll_config_load(&cfg->dll, filename);
touch_config_load(&cfg->touch, filename);
}

View File

@ -5,6 +5,7 @@
#include "board/config.h"
#include "hooklib/dvd.h"
#include "gfxhook/gfx.h"
#include "mercuryhook/mercury-dll.h"
#include "mercuryhook/touch.h"
@ -16,6 +17,7 @@ struct mercury_hook_config {
struct aime_config aime;
struct dvd_config dvd;
struct io4_config io4;
struct gfx_config gfx;
struct mercury_dll_config dll;
struct touch_config touch;
};

View File

@ -9,6 +9,9 @@
#include "hooklib/serial.h"
#include "hooklib/spike.h"
#include "gfxhook/gfx.h"
#include "gfxhook/d3d11.h"
#include "mercuryhook/config.h"
#include "mercuryhook/io4.h"
#include "mercuryhook/mercury-dll.h"
@ -40,6 +43,9 @@ static DWORD CALLBACK mercury_pre_startup(void)
dvd_hook_init(&mercury_hook_cfg.dvd, mercury_hook_mod);
serial_hook_init();
gfx_hook_init(&mercury_hook_cfg.gfx);
gfx_d3d11_hook_init(&mercury_hook_cfg.gfx, mercury_hook_mod);
/* Initialize emulation hooks */
hr = platform_hook_init(

View File

@ -11,6 +11,7 @@ shared_library(
],
link_with : [
aimeio_lib,
gfxhook_lib,
board_lib,
hooklib_lib,
mercuryio_lib,

View File

@ -31,7 +31,7 @@ static HRESULT touch_frame_decode(struct touch_req *dest, struct iobuf *iobuf, i
static uint8_t calc_checksum(const void *ptr, size_t nbytes);
static HRESULT touch_handle_get_sync_board_ver(const struct touch_req *req);
static HRESULT touch_handle_startup(const struct touch_req *req);
static HRESULT touch_handle_next_read(const struct touch_req *req);
static HRESULT touch_handle_get_unit_board_ver(const struct touch_req *req);
static HRESULT touch_handle_mystery1(const struct touch_req *req);
static HRESULT touch_handle_mystery2(const struct touch_req *req);
@ -204,8 +204,8 @@ static HRESULT touch_req_dispatch(const struct touch_req *req)
switch (req->cmd) {
case CMD_GET_SYNC_BOARD_VER:
return touch_handle_get_sync_board_ver(req);
case CMD_STARTUP:
return touch_handle_startup(req);
case CMD_NEXT_READ:
return touch_handle_next_read(req);
case CMD_GET_UNIT_BOARD_VER:
return touch_handle_get_unit_board_ver(req);
case CMD_MYSTERY1:
@ -252,13 +252,13 @@ static HRESULT touch_handle_get_sync_board_ver(const struct touch_req *req)
}
/* TODO: Very ugly please make better before upstreaming */
static HRESULT touch_handle_startup(const struct touch_req *req)
static HRESULT touch_handle_next_read(const struct touch_req *req)
{
struct touch_resp_startup resp;
HRESULT hr;
uint8_t *rev;
dprintf("Wacca Touch%d: Startup %2hx\n", req->side, req->data[2]);
dprintf("Wacca Touch%d: Read section %2hx\n", req->side, req->data[2]);
switch (req->data[2]) {
@ -290,7 +290,7 @@ static HRESULT touch_handle_startup(const struct touch_req *req)
0x20, 0x20, 0x20, 0x34 };
break;
default:
dprintf("Wacca touch: BAD STARTUP REQUEST %2hx\n", req->data[2]);
dprintf("Wacca touch: BAD READ REQUEST %2hx\n", req->data[2]);
return 1;
}
@ -342,7 +342,7 @@ static HRESULT touch_handle_mystery1(const struct touch_req *req)
struct touch_resp_mystery1 resp;
HRESULT hr;
dprintf("Wacca Touch%d: mystery command 1\n", req->side);
dprintf("Wacca Touch%d: Command A2\n", req->side);
resp.cmd = 0xa2;
resp.data = 0x3f;
@ -363,7 +363,7 @@ static HRESULT touch_handle_mystery2(const struct touch_req *req)
struct touch_resp_mystery2 resp;
HRESULT hr;
dprintf("Wacca Touch%d: mystery command 2\n", req->side);
dprintf("Wacca Touch%d: Command 94\n", req->side);
resp.cmd = 0x94;
resp.data = 0;

View File

@ -10,7 +10,7 @@ struct touch_config {
enum touch_cmd {
CMD_GET_SYNC_BOARD_VER = 0xa0,
CMD_STARTUP = 0x72,
CMD_NEXT_READ = 0x72,
CMD_GET_UNIT_BOARD_VER = 0xa8,
CMD_MYSTERY1 = 0xa2,
CMD_MYSTERY2 = 0x94,