Files
TeamTofuShop_segatools/dist/apm3/launch.bat
T
kyoubate-haruka d29a3926ab apm: Fix distribution server handling, abaas log symlinks, add extra buttons for dinput (#123)
Requires https://gitea.tendokyu.moe/TeamTofuShop/capnhook/pulls/8

This adds the following:

1. Fixes `am::abaas::FileSearchSuite::isAvailableAbsolutePath: Line259  ERROR: folder is unavailable (Y:\SDEM\log\\SDFU)` by hooking `DeviceIoControl` with `FSCTL_SET_REPARSE_POINT`.

Sega decided to use the most bizzare way possible of creating symbolic links. These are created in the AbaaS log directory inside SDEM and point to the appdata directories for the sub-games.

Magic numbers have been taken from amdaemon decompilation. That whole API is very sparsely documented on the Microsoft side.

2. Fixes distribution server settings not applying.

Unlike most other games, the daemon config files do not have dipswitch filters in them. Instead the distribution setting is determined by running `hwvalue.exe` twice and checking it's exit code. This has been added to `launch.bat` and requires the linked addition for inject.

3. Implemented `get_opbtns` and added extra buttons for dinput.

* `get_opbtns` existed but was never implemented. Added the ability to bind dinput buttons for test/service.
* DirectInput is weird. The controller I'm using is sending directional keys as buttons rather than a D-Pad, so I was unable to bind it. These extra directional buttons can be bound in addition to the bindings that exist for a D-Pad.

4. Fixes audio in Rolling Gunner by setting the CWD to the root of the C:\ drive before starting a game.

lol. lmao even.

5. Add a `DefineDosDevice` for Y:\ to fix Blazblue crashing

They hardcoded the damn path to appdata instead of retrieving it from the apm.dll...

Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/123
Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
2026-07-19 08:25:54 +00:00

82 lines
1.4 KiB
Batchfile

@echo off
pushd %~dp0
set PATH=%~dp0lib;%~dp0;X:\;%PATH%
rem remove the reboot flag and show the copyright screen
if exist %tmp%\APMv3SystemReboot (
del %tmp%\APMv3SystemReboot
)
if exist %tmp%\SequenceSetting.json (
del %tmp%\SequenceSetting.json
)
rem detect model and dipswitch for server/client
set AMDAEMON_CONFIG=standalone.json
inject -w -k apm3hook.dll hwvalue.exe modeltype
if %ERRORLEVEL% == 5 goto BEGIN
inject -w -k apm3hook.dll hwvalue.exe dipsw
set AMDAEMON_CONFIG=server.json
if %ERRORLEVEL% == 1 set AMDAEMON_CONFIG=client.json
:BEGIN
pushd %~dp0
set DOORSTOP_DISABLE=TRUE
qprocess amdaemon.exe > NUL
IF %ERRORLEVEL% NEQ 0 start /min "AM Daemon" inject -d -k apm3hook.dll amdaemon.exe -c daemon_config\common.json daemon_config\%AMDAEMON_CONFIG% config_hook.json
set DOORSTOP_DISABLE=
REM Add "-screen-fullscreen 0 -popupWindow" if you want to run in windowed mode
inject -d -k apm3hook.dll APMV3System -logFile output_log.txt
if exist %tmp%\segaboot (
del %tmp%\segaboot
goto END
)
if exist %tmp%\app (
del %tmp%\app
goto APP
)
if exist %tmp%\apptest (
del %tmp%\apptest
goto APPTEST
)
goto END
:APP
pushd C:\
call W:\game.bat
popd
taskkill /f /im emoneyUI.exe > nul 2>&1
goto BEGIN
:APPTEST
pushd C:\
call W:\gametest.bat
popd
goto BEGIN
:END
taskkill /f /im emoneyUI.exe > nul 2>&1
taskkill /f /im amdaemon.exe > nul 2>&1
rundll32 apm3hook.dll,UnmountApmDrives
echo.
echo Game processes have terminated
pause