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>
114 lines
3.3 KiB
C
114 lines
3.3 KiB
C
#include <assert.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "board/config.h"
|
|
|
|
#include "hooklib/config.h"
|
|
#include "hooklib/dvd.h"
|
|
|
|
#include "apm3hook/config.h"
|
|
|
|
#include "platform/config.h"
|
|
|
|
void apm3_dll_config_load(
|
|
struct apm3_dll_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
GetPrivateProfileStringW(
|
|
L"apmio",
|
|
L"path",
|
|
L"",
|
|
cfg->path,
|
|
_countof(cfg->path),
|
|
filename);
|
|
}
|
|
|
|
void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
wchar_t tmpstr[16];
|
|
|
|
memset(cfg->board_number, ' ', sizeof(cfg->board_number));
|
|
memset(cfg->chip_number, ' ', sizeof(cfg->chip_number));
|
|
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
|
|
cfg->port_no[0] = GetPrivateProfileIntW(L"led15093", L"portNo1", 0, filename);
|
|
cfg->port_no[1] = GetPrivateProfileIntW(L"led15093", L"portNo2", 0, filename);
|
|
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaud", 0, filename);
|
|
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename);
|
|
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
|
|
|
|
GetPrivateProfileStringW(
|
|
L"led15093",
|
|
L"boardNumber",
|
|
L"15093-06",
|
|
tmpstr,
|
|
_countof(tmpstr),
|
|
filename);
|
|
|
|
size_t n = wcstombs(cfg->board_number, tmpstr, sizeof(cfg->board_number));
|
|
for (int i = n; i < sizeof(cfg->board_number); i++)
|
|
{
|
|
cfg->board_number[i] = ' ';
|
|
}
|
|
|
|
GetPrivateProfileStringW(
|
|
L"led15093",
|
|
L"chipNumber",
|
|
L"6710A",
|
|
tmpstr,
|
|
_countof(tmpstr),
|
|
filename);
|
|
|
|
n = wcstombs(cfg->chip_number, tmpstr, sizeof(cfg->chip_number));
|
|
for (int i = n; i < sizeof(cfg->chip_number); i++)
|
|
{
|
|
cfg->chip_number[i] = ' ';
|
|
}
|
|
|
|
GetPrivateProfileStringW(
|
|
L"led15093",
|
|
L"bootChipNumber",
|
|
L"6709 ",
|
|
tmpstr,
|
|
_countof(tmpstr),
|
|
filename);
|
|
|
|
n = wcstombs(cfg->boot_chip_number, tmpstr, sizeof(cfg->boot_chip_number));
|
|
for (int i = n; i < sizeof(cfg->boot_chip_number); i++)
|
|
{
|
|
cfg->boot_chip_number[i] = ' ';
|
|
}
|
|
}
|
|
|
|
void mount_config_load(struct mount_config *cfg, const wchar_t *filename) {
|
|
cfg->enable = GetPrivateProfileIntW(L"mount", L"enable", 1, filename);
|
|
cfg->delay = GetPrivateProfileIntW(L"mount", L"delay", 1, filename);
|
|
}
|
|
|
|
void apm3_hook_config_load(
|
|
struct apm3_hook_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
platform_config_load(&cfg->platform, filename);
|
|
aime_config_load(&cfg->aime, filename);
|
|
dvd_config_load(&cfg->dvd, filename);
|
|
io4_config_load(&cfg->io4, filename);
|
|
vfd_config_load(&cfg->vfd, filename);
|
|
touch_screen_config_load(&cfg->touch, filename);
|
|
led15093_config_load(&cfg->led15093, filename);
|
|
apm3_dll_config_load(&cfg->dll, filename);
|
|
unity_config_load(&cfg->unity, filename);
|
|
mount_config_load(&cfg->mount, filename);
|
|
}
|