[apm3] fix led hook, fix blocked reboot

This commit is contained in:
2025-07-21 21:09:24 +02:00
parent ae168cdaf9
commit 0006731536
3 changed files with 40 additions and 20 deletions

18
dist/apm3/launch.bat vendored
View File

@ -1,14 +1,24 @@
@echo off
cd /d %~dp0
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
)
:BEGIN
cd /d %~dp0
pushd %~dp0
qprocess amdaemon.exe > NUL
IF %ERRORLEVEL% NEQ 0 start /min cmd /C "inject -d -k apm3hook.dll amdaemon.exe -f -c daemon_config\common.json daemon_config\server.json config_hook.json"
IF %ERRORLEVEL% NEQ 0 start /min "AM Daemon" inject -d -k apm3hook.dll amdaemon.exe -c daemon_config\common.json daemon_config\server.json config_hook.json
inject -d -k apm3hook.dll APMV3System -screen-fullscreen 0 -screen-width 1920 -screen-height 1080 -popupWindow -logFile output_log.txt
@ -48,4 +58,4 @@ rundll32 apm3hook.dll,UnmountApmDrives
echo.
echo Game processes have terminated
pause
pause

View File

@ -72,6 +72,13 @@ id=A69E-01A88888888
; that subnet must start with 192.168.
subnet=192.168.168.0
; Override the game's four-character platform code (e.g. `AAV2` for Nu 2). This
; is actually supposed to be a separate three-character `platformId` and
; integer `modelType` setting, but they are combined here for convenience.
; Use `ACA1` for the Server/Client, depending on the dipsw1
; Use `ACA5` for the Standalone mode
platformId=ACA1
[pcbid]
; Set the Windows host name. This should be an ALLS MAIN ID, without the
; hyphen (which is not a valid character in a Windows host name).
@ -86,6 +93,10 @@ enable=1
; allow you to start a game in freeplay mode.
freeplay=0
; LAN Install: If multiple machines are present on the same LAN then set
; this to 1 on exactly one machine and set this to 0 on all others.
dipsw1=1
; -----------------------------------------------------------------------------
; Misc. hook settings
; -----------------------------------------------------------------------------
@ -112,7 +123,8 @@ delay=1
[epay]
; Enables the Thinca emulation. This will allow you to enable E-Money on compatible servers.
enable=0
enable=1
; -----------------------------------------------------------------------------
; Custom IO settings

View File

@ -17,6 +17,7 @@
#include "io4.h"
#include "mount.h"
#include "hook/iohook.h"
#include "hook/process.h"
#include "hooklib/serial.h"
@ -36,26 +37,26 @@ static HMODULE apm3_hook_mod;
static process_entry_t apm3_startup;
static struct apm3_hook_config apm3_hook_cfg;
static const wchar_t *target_modules[] = {
L"apmled.dll",
};
static const size_t target_modules_len = _countof(target_modules);
void unity_hook_callback(HMODULE hmodule, const wchar_t* p) {
dprintf("Unity: Hook callback: %ls\n", p);
serial_hook_apply_hooks(hmodule);
for (size_t i = 0; i < target_modules_len; i++) {
if (_wcsicmp(p, target_modules[i]) == 0) {
serial_hook_apply_hooks(hmodule);
iohook_apply_hooks(hmodule);
}
}
security_hook_insert_hooks(hmodule);
touch_hook_insert_hooks(hmodule);
// mount_hook_apply_hooks(&apm3_hook_cfg.mount, hmodule);
}
void apm3_extra_hooks_init(void) {
HMODULE module = LoadLibraryA("Apmv3System_Data/Plugins/x86_64/apmmount.dll"); // HACK??
if (module != NULL){
dprintf("APM: Successfully pre-loaded apmmount\n");
}
module = LoadLibraryA("Apmv3System_Data/Plugins/x86_64/apmled.dll"); // HACK??
if (module != NULL){
dprintf("APM: Successfully pre-loaded apmled\n");
}
}
static DWORD CALLBACK apm3_pre_startup(void)
{
HRESULT hr;
@ -66,9 +67,6 @@ static DWORD CALLBACK apm3_pre_startup(void)
apm3_hook_config_load(&apm3_hook_cfg, get_config_path());
/* Pin stuff */
apm3_extra_hooks_init();
/* Hook Win32 APIs */
dvd_hook_init(&apm3_hook_cfg.dvd, apm3_hook_mod);