forked from TeamTofuShop/segatools
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
b5cc2524a3 | |||
83ba4ac6e0 | |||
eb174fb8ba |
@ -440,8 +440,8 @@ static HRESULT led15093_req_set_timeout(int board, const struct led15093_req_set
|
|||||||
resp.cmd = LED_15093_CMD_SET_TIMEOUT;
|
resp.cmd = LED_15093_CMD_SET_TIMEOUT;
|
||||||
resp.report = v->report_code;
|
resp.report = v->report_code;
|
||||||
|
|
||||||
resp.count_upper = (req->count >> 8) & 0xff;
|
resp.count_upper = 0;
|
||||||
resp.count_lower = req->count & 0xff;
|
resp.count_lower = req->count;
|
||||||
|
|
||||||
return led15093_frame_encode(&led15093_per_board_vars[board].boarduart.readable, &resp, sizeof(resp.hdr) + resp.hdr.nbytes);
|
return led15093_frame_encode(&led15093_per_board_vars[board].boarduart.readable, &resp, sizeof(resp.hdr) + resp.hdr.nbytes);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ bool shmem_create()
|
|||||||
|
|
||||||
if (g_hMapFile == NULL)
|
if (g_hMapFile == NULL)
|
||||||
{
|
{
|
||||||
dprintf("shmem_create : Could not create file mapping object (%ld).\n",
|
dprintf("shmem_create : Could not create file mapping object (%d).\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ bool shmem_create()
|
|||||||
|
|
||||||
if (g_pBuf == NULL)
|
if (g_pBuf == NULL)
|
||||||
{
|
{
|
||||||
dprintf("shmem_create : Could not map view of file (%ld).\n",
|
dprintf("shmem_create : Could not map view of file (%d).\n",
|
||||||
GetLastError());
|
GetLastError());
|
||||||
|
|
||||||
CloseHandle(g_hMapFile);
|
CloseHandle(g_hMapFile);
|
||||||
@ -112,7 +112,7 @@ bool shmem_load()
|
|||||||
|
|
||||||
if (g_hMapFile == NULL)
|
if (g_hMapFile == NULL)
|
||||||
{
|
{
|
||||||
dprintf("shmem_load : Could not open file mapping object (%ld).\n", GetLastError());
|
dprintf("shmem_load : Could not open file mapping object (%d).\n", GetLastError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ bool shmem_load()
|
|||||||
|
|
||||||
if (g_pBuf == NULL)
|
if (g_pBuf == NULL)
|
||||||
{
|
{
|
||||||
dprintf("shmem_load : Could not map view of file (%ld).\n", GetLastError());
|
dprintf("shmem_load : Could not map view of file (%d).\n", GetLastError());
|
||||||
CloseHandle(g_hMapFile);
|
CloseHandle(g_hMapFile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,6 @@ static unsigned int __stdcall jvs_poll_thread_proc(void *ctx)
|
|||||||
while (1) {
|
while (1) {
|
||||||
_chuni_io_jvs_read_coin_counter(&g_shared_data.coin_counter);
|
_chuni_io_jvs_read_coin_counter(&g_shared_data.coin_counter);
|
||||||
g_shared_data.opbtn = 0;
|
g_shared_data.opbtn = 0;
|
||||||
g_shared_data.beams = 0;
|
|
||||||
_chuni_io_jvs_poll(&g_shared_data.opbtn, &g_shared_data.beams);
|
_chuni_io_jvs_poll(&g_shared_data.opbtn, &g_shared_data.beams);
|
||||||
SHMEM_WRITE(&g_shared_data, sizeof(shared_data_t));
|
SHMEM_WRITE(&g_shared_data, sizeof(shared_data_t));
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
@ -157,7 +156,7 @@ static unsigned int __stdcall jvs_poll_thread_proc(void *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t chu2to3_load_dll(const wchar_t *dllname)
|
uint16_t chu2to3_load_dll(wchar_t *dllname)
|
||||||
{
|
{
|
||||||
#if defined(ENV64BIT)
|
#if defined(ENV64BIT)
|
||||||
/* x64 must just open the shmem and do nothing else */
|
/* x64 must just open the shmem and do nothing else */
|
||||||
@ -176,7 +175,7 @@ uint16_t chu2to3_load_dll(const wchar_t *dllname)
|
|||||||
/* this is the first function called so let's setup the chuniio forwarding */
|
/* this is the first function called so let's setup the chuniio forwarding */
|
||||||
hinstLib = LoadLibraryW(dllname);
|
hinstLib = LoadLibraryW(dllname);
|
||||||
if (hinstLib == NULL) {
|
if (hinstLib == NULL) {
|
||||||
dprintf("ERROR: unable to load %S (error %ld)\n",dllname, GetLastError());
|
dprintf("ERROR: unable to load %S (error %d)\n",dllname, GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,4 +23,4 @@ void chu2to3_io_slider_stop(void);
|
|||||||
void chu2to3_io_slider_set_leds(const uint8_t *rgb);
|
void chu2to3_io_slider_set_leds(const uint8_t *rgb);
|
||||||
HRESULT chu2to3_io_led_init(void);
|
HRESULT chu2to3_io_led_init(void);
|
||||||
void chu2to3_io_led_set_colors(uint8_t board, uint8_t *rgb);
|
void chu2to3_io_led_set_colors(uint8_t board, uint8_t *rgb);
|
||||||
uint16_t chu2to3_load_dll(const wchar_t *dllname);
|
uint16_t chu2to3_load_dll(wchar_t *dllname);
|
@ -22,7 +22,7 @@ static struct chuni_io_config chuni_io_cfg;
|
|||||||
|
|
||||||
uint16_t chuni_io_get_api_version(void)
|
uint16_t chuni_io_get_api_version(void)
|
||||||
{
|
{
|
||||||
return 0x0102;
|
return 0x0101;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT chuni_io_jvs_init(void)
|
HRESULT chuni_io_jvs_init(void)
|
||||||
@ -91,12 +91,12 @@ void chuni_io_jvs_poll(uint8_t *opbtn, uint8_t *beams)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use actual AIR
|
// Use actual AIR
|
||||||
for (i = 0; i < 6; i++) {
|
// IR format is beams[5:0] = {b5,b6,b3,b4,b1,b2};
|
||||||
if(GetAsyncKeyState(chuni_io_cfg.vk_ir[i]) & 0x8000) {
|
for (i = 0 ; i < 3 ; i++) {
|
||||||
*beams |= (1 << i);
|
if (GetAsyncKeyState(chuni_io_cfg.vk_ir[i*2]) & 0x8000)
|
||||||
} else {
|
*beams |= (1 << (i*2+1));
|
||||||
*beams &= ~(1 << i);
|
if (GetAsyncKeyState(chuni_io_cfg.vk_ir[i*2+1]) & 0x8000)
|
||||||
}
|
*beams |= (1 << (i*2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "chuniio/chu2to3.h"
|
|
||||||
#include "chusanhook/chuni-dll.h"
|
#include "chusanhook/chuni-dll.h"
|
||||||
|
|
||||||
#include "util/dll-bind.h"
|
#include "util/dll-bind.h"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <libgen.h>
|
|
||||||
|
|
||||||
#include "hooklib/procaddr.h"
|
#include "hooklib/procaddr.h"
|
||||||
|
|
||||||
@ -83,6 +82,13 @@ static void proc_addr_hook_init(void)
|
|||||||
_countof(win32_hooks));
|
_countof(win32_hooks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PATH_MAX 1024
|
||||||
|
char *gnu_basename(char *path)
|
||||||
|
{
|
||||||
|
char *base = strrchr(path, '/');
|
||||||
|
return base ? base+1 : path;
|
||||||
|
}
|
||||||
|
|
||||||
FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
|
FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
|
||||||
{
|
{
|
||||||
uintptr_t ordinal = (uintptr_t) name;
|
uintptr_t ordinal = (uintptr_t) name;
|
||||||
@ -92,7 +98,7 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
|
|||||||
FARPROC result = next_GetProcAddress(hModule, name);
|
FARPROC result = next_GetProcAddress(hModule, name);
|
||||||
|
|
||||||
GetModuleFileNameA(hModule, mod_path, PATH_MAX);
|
GetModuleFileNameA(hModule, mod_path, PATH_MAX);
|
||||||
mod_name = basename(mod_path);
|
mod_name = gnu_basename(mod_path);
|
||||||
|
|
||||||
for (int i = 0; i < proc_addr_hook_count; i++) {
|
for (int i = 0; i < proc_addr_hook_count; i++) {
|
||||||
|
|
||||||
|
32
meson.build
32
meson.build
@ -13,17 +13,14 @@ add_project_arguments(
|
|||||||
'-DWIN32_LEAN_AND_MEAN',
|
'-DWIN32_LEAN_AND_MEAN',
|
||||||
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
|
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
|
||||||
'-DMINGW_HAS_SECURE_API=1',
|
'-DMINGW_HAS_SECURE_API=1',
|
||||||
'-Wno-unused',
|
|
||||||
language: 'c',
|
language: 'c',
|
||||||
)
|
)
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
# Use get_argument_syntax() instead once Meson 0.49.0 releases
|
||||||
|
if meson.get_compiler('c').get_id() != 'msvc'
|
||||||
if cc.get_id() != 'msvc'
|
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
'-ffunction-sections',
|
'-ffunction-sections',
|
||||||
'-fdata-sections',
|
'-fdata-sections',
|
||||||
'-flto', # Enable Link-Time Optimization
|
|
||||||
language: 'c',
|
language: 'c',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,12 +29,11 @@ if cc.get_id() != 'msvc'
|
|||||||
'-Wl,--exclude-all-symbols',
|
'-Wl,--exclude-all-symbols',
|
||||||
'-Wl,--gc-sections',
|
'-Wl,--gc-sections',
|
||||||
'-static-libgcc',
|
'-static-libgcc',
|
||||||
'-flto', # Enable Link-Time Optimization
|
|
||||||
'-Wl,-s', # Strip debug symbols
|
|
||||||
language: 'c',
|
language: 'c',
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
cc = meson.get_compiler('c')
|
||||||
shlwapi_lib = cc.find_library('shlwapi')
|
shlwapi_lib = cc.find_library('shlwapi')
|
||||||
dinput8_lib = cc.find_library('dinput8')
|
dinput8_lib = cc.find_library('dinput8')
|
||||||
dxguid_lib = cc.find_library('dxguid')
|
dxguid_lib = cc.find_library('dxguid')
|
||||||
@ -59,28 +55,8 @@ subdir('gfxhook')
|
|||||||
subdir('aimeio')
|
subdir('aimeio')
|
||||||
subdir('chuniio')
|
subdir('chuniio')
|
||||||
subdir('divaio')
|
subdir('divaio')
|
||||||
subdir('carolio')
|
|
||||||
subdir('idzio')
|
|
||||||
subdir('idacio')
|
|
||||||
subdir('swdcio')
|
|
||||||
subdir('mu3io')
|
|
||||||
subdir('mai2io')
|
|
||||||
subdir('cmio')
|
|
||||||
subdir('mercuryio')
|
|
||||||
subdir('cxbio')
|
|
||||||
subdir('fgoio')
|
|
||||||
|
|
||||||
subdir('chunihook')
|
subdir('chunihook')
|
||||||
subdir('divahook')
|
subdir('divahook')
|
||||||
subdir('carolhook')
|
|
||||||
subdir('idzhook')
|
|
||||||
subdir('idachook')
|
|
||||||
subdir('swdchook')
|
|
||||||
subdir('minihook')
|
|
||||||
subdir('chusanhook')
|
subdir('chusanhook')
|
||||||
subdir('mu3hook')
|
|
||||||
subdir('mai2hook')
|
|
||||||
subdir('cmhook')
|
|
||||||
subdir('mercuryhook')
|
|
||||||
subdir('cxbhook')
|
|
||||||
subdir('fgohook')
|
|
||||||
|
Reference in New Issue
Block a user