1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-27 22:40:48 +01:00

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 mu3io mu3io
COPY pki pki COPY pki pki
COPY platform platform COPY platform platform
COPY gfxhook gfxhook
COPY reg reg COPY reg reg
COPY spike spike COPY spike spike
COPY subprojects subprojects COPY subprojects subprojects

View File

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

View File

@ -1,10 +1,15 @@
@echo off @echo off
pushd %~dp0 pushd %~dp0
taskkill /f /im amdaemon.exe > nul 2>&1 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 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 inject -d -k mercuryhook.dll ../WindowsNoEditor/Mercury/Binaries/Win64/Mercury-Win64-Shipping.exe
taskkill /f /im amdaemon.exe > nul 2>&1 taskkill /f /im amdaemon.exe > nul 2>&1
echo.
echo Game processes have terminated echo Game processes have terminated
pause

View File

@ -312,7 +312,7 @@ static HRESULT STDMETHODCALLTYPE my_IDXGIFactory_CreateSwapChain(
ShowWindow(hwnd, SW_RESTORE); ShowWindow(hwnd, SW_RESTORE);
if (!gfx_config.framed && width > 0 && height > 0) { 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_STYLE, WS_POPUP);
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, WS_EX_TOPMOST); 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; BOOL ok;
HRESULT hr; 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_STYLE, WS_POPUP);
SetWindowLongPtrW(hwnd, GWL_EXSTYLE, WS_EX_TOPMOST); SetWindowLongPtrW(hwnd, GWL_EXSTYLE, WS_EX_TOPMOST);

View File

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

View File

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

View File

@ -9,6 +9,9 @@
#include "hooklib/serial.h" #include "hooklib/serial.h"
#include "hooklib/spike.h" #include "hooklib/spike.h"
#include "gfxhook/gfx.h"
#include "gfxhook/d3d11.h"
#include "mercuryhook/config.h" #include "mercuryhook/config.h"
#include "mercuryhook/io4.h" #include "mercuryhook/io4.h"
#include "mercuryhook/mercury-dll.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); dvd_hook_init(&mercury_hook_cfg.dvd, mercury_hook_mod);
serial_hook_init(); serial_hook_init();
gfx_hook_init(&mercury_hook_cfg.gfx);
gfx_d3d11_hook_init(&mercury_hook_cfg.gfx, mercury_hook_mod);
/* Initialize emulation hooks */ /* Initialize emulation hooks */
hr = platform_hook_init( hr = platform_hook_init(

View File

@ -11,6 +11,7 @@ shared_library(
], ],
link_with : [ link_with : [
aimeio_lib, aimeio_lib,
gfxhook_lib,
board_lib, board_lib,
hooklib_lib, hooklib_lib,
mercuryio_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 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_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_get_unit_board_ver(const struct touch_req *req);
static HRESULT touch_handle_mystery1(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); 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) { switch (req->cmd) {
case CMD_GET_SYNC_BOARD_VER: case CMD_GET_SYNC_BOARD_VER:
return touch_handle_get_sync_board_ver(req); return touch_handle_get_sync_board_ver(req);
case CMD_STARTUP: case CMD_NEXT_READ:
return touch_handle_startup(req); return touch_handle_next_read(req);
case CMD_GET_UNIT_BOARD_VER: case CMD_GET_UNIT_BOARD_VER:
return touch_handle_get_unit_board_ver(req); return touch_handle_get_unit_board_ver(req);
case CMD_MYSTERY1: 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 */ /* 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; struct touch_resp_startup resp;
HRESULT hr; HRESULT hr;
uint8_t *rev; 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]) { switch (req->data[2]) {
@ -290,7 +290,7 @@ static HRESULT touch_handle_startup(const struct touch_req *req)
0x20, 0x20, 0x20, 0x34 }; 0x20, 0x20, 0x20, 0x34 };
break; break;
default: 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; return 1;
} }
@ -342,7 +342,7 @@ static HRESULT touch_handle_mystery1(const struct touch_req *req)
struct touch_resp_mystery1 resp; struct touch_resp_mystery1 resp;
HRESULT hr; 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.cmd = 0xa2;
resp.data = 0x3f; resp.data = 0x3f;
@ -363,7 +363,7 @@ static HRESULT touch_handle_mystery2(const struct touch_req *req)
struct touch_resp_mystery2 resp; struct touch_resp_mystery2 resp;
HRESULT hr; 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.cmd = 0x94;
resp.data = 0; resp.data = 0;

View File

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