forked from TeamTofuShop/segatools
This adds support for APMv3 I/O, menus and the launcher. * Added a apm3hook dll and I/O based on the usual layout. * Added C:\Mount\Apm to vfs. * Added the relevant .dlls to unityhook. * Added a hook for apmmount.dll that uses `CreateDosDevice` to mount decrypted data to the locations the launcher and games expect files to be. This will conflict with anything that is already at W:\ and X:\, but I do not have better solutions for this. * `launch.bat` is a bit more involved as it simulates the launcher loop. It can be broken by alt+f4ing or closing the launcher with "X". * An extra export was added, so rundll32 can be used to get rid of the dosdevices after the launcher was killed. * Since all the games do everything via `X:\lib\apm.dll`, no game hooks were needed in testing, therefore, `game.bat` files can be used as is. * Path hooks are applied correctly, so you can go correctly between games, launcher, sub system test mode and game test modes. A setup guide (some stuff specific to my server) can be found here: https://gmg.hopto.org:82/gmg/wiki/index.php/All.Net_P-ras_Multi_Menu Tested with the 2 APM sample apps, Blazblue, Puyo, Guilty Gear and some weird unity puzzle game whose name I forgot.   Reviewed-on: TeamTofuShop/segatools#73 Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
129 lines
2.9 KiB
C
129 lines
2.9 KiB
C
#include <windows.h>
|
|
#include <xinput.h>
|
|
#include <math.h>
|
|
|
|
#include <limits.h>
|
|
#include <stdint.h>
|
|
|
|
#include "apm3io/apm3io.h"
|
|
#include "apm3io/config.h"
|
|
#include "util/dprintf.h"
|
|
#include "util/env.h"
|
|
|
|
static uint8_t apm3_opbtn;
|
|
static uint32_t apm3_gamebtn;
|
|
static int16_t apm3_stick_x;
|
|
static int16_t apm3_stick_y;
|
|
static struct apm3_io_config apm3_io_cfg;
|
|
static bool apm3_io_coin;
|
|
|
|
uint16_t apm3_io_get_api_version(void) {
|
|
return 0x0100;
|
|
}
|
|
|
|
HRESULT apm3_io_init(void) {
|
|
apm3_io_config_load(&apm3_io_cfg, get_config_path());
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT apm3_io_poll(void) {
|
|
apm3_opbtn = 0;
|
|
apm3_gamebtn = 0;
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_test) & 0x8000) {
|
|
apm3_opbtn |= APM3_IO_OPBTN_TEST;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_service) & 0x8000) {
|
|
apm3_opbtn |= APM3_IO_OPBTN_SERVICE;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_coin) & 0x8000) {
|
|
if (!apm3_io_coin) {
|
|
apm3_io_coin = true;
|
|
apm3_opbtn |= APM3_IO_OPBTN_COIN;
|
|
}
|
|
} else {
|
|
apm3_io_coin = false;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_home) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_HOME;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_start) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_START;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_up) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_UP;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_right) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_RIGHT;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_down) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_DOWN;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_left) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_LEFT;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[0]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B1;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[1]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B2;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[2]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B3;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[3]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B4;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[4]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B5;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[5]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B6;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[6]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B7;
|
|
}
|
|
|
|
if (GetAsyncKeyState(apm3_io_cfg.vk_buttons[7]) & 0x8000) {
|
|
apm3_gamebtn |= APM3_IO_GAMEBTN_B8;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
void apm3_io_get_opbtns(uint8_t* opbtn) {
|
|
if (opbtn != NULL) {
|
|
*opbtn = apm3_opbtn;
|
|
}
|
|
}
|
|
|
|
void apm3_io_get_gamebtns(uint32_t* btn) {
|
|
if (btn != NULL) {
|
|
*btn = apm3_gamebtn;
|
|
}
|
|
}
|
|
|
|
HRESULT apm3_io_led_init(void) {
|
|
return S_OK;
|
|
}
|
|
|
|
void apm3_io_led_set_colors(uint8_t board, uint8_t* rgb) {
|
|
return;
|
|
}
|