fix: Create Pro machine profile directories

This commit is contained in:
voidderef
2026-09-13 19:53:44 +02:00
parent 06a2eebfc5
commit 7db85f1f8e
3 changed files with 36 additions and 4 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ You need two main folders:
* `game` folder with the following contents
* All data zip files (e.g. `data0.zip`, `data1.zip`, ..., `encore.zip`)
* An empty file `FX` (if you run this on a FX or other cabinet with a widescreen monitor)
* `save` folder and `MachineProfile` inside of it . You must create these folders manually, rest of the files will populate themselves. **Without doing so the game will not save settings or high scores between boots.**
* `save` folder. The hook creates it and the required `MachineProfile` folder automatically; the game populates the remaining files.
## USB thumb drive/profile support
Without any patches, the game's way of handling USB thumb drives is incompatible to the kernels of the last years.
@@ -113,4 +113,4 @@ without requiring the piuio emulation layer, e.g. using `ptapi-io-piuio-real`.
## The game is crashing very early
The log might show something about "ptrace failing" and not being able to "load libformat". However, the actual problem
is probably not having all the necessary IO hardware connected (or emulation enabled). The game doesn't have any proper
error handling if either the PIUIO or the button IO is missing/not connected (or not emulated).
error handling if either the PIUIO or the button IO is missing/not connected (or not emulated).
+17 -1
View File
@@ -27,6 +27,7 @@
#include "util/fs.h"
#include "util/glibc.h"
#include "util/log.h"
#include "util/str.h"
#include "util/sys-info.h"
#include "options.h"
@@ -81,6 +82,21 @@ static void prohook_fs_redir_settings(struct prohook_options *options)
}
}
char *machine_profile_path =
util_str_merge(options->game.settings, "/MachineProfile");
if (!util_fs_path_exists(machine_profile_path)) {
log_info(
"Machine profile path %s does not exist, creating",
machine_profile_path);
if (!util_fs_mkdir(machine_profile_path)) {
log_error("Creating directory %s failed", machine_profile_path);
}
}
free(machine_profile_path);
char *abs_path = util_fs_get_abs_path(options->game.settings);
cnh_redir_add("/data", abs_path);
@@ -239,4 +255,4 @@ void prohook_trap_after_main(void)
LIB_MAIN_CONSTRUCTOR(prohook_constructor);
LIB_MAIN_DESTRUCTOR(prohook_destructor);
LIB_MAIN_TRAP_MAIN(prohook_trap_before_main, prohook_trap_after_main);
LIB_MAIN_TRAP_MAIN(prohook_trap_before_main, prohook_trap_after_main);
+17 -1
View File
@@ -26,6 +26,7 @@
#include "util/glibc.h"
#include "util/log.h"
#include "util/patch.h"
#include "util/str.h"
#include "util/sys-info.h"
#include "options.h"
@@ -110,6 +111,21 @@ static void pro2hook_fs_redir_data(struct pro2hook_options *options)
log_assert(options);
if (options->game.data) {
char *machine_profile_path =
util_str_merge(options->game.data, "/Save/MachineProfile");
if (!util_fs_path_exists(machine_profile_path)) {
log_info(
"Machine profile path %s does not exist, creating",
machine_profile_path);
if (!util_fs_mkdir(machine_profile_path)) {
log_error("Creating directory %s failed", machine_profile_path);
}
}
free(machine_profile_path);
char *abs_path = util_fs_get_abs_path(options->game.data);
cnh_redir_add("/pro2", abs_path);
@@ -251,4 +267,4 @@ void pro2hook_trap_after_main(void)
LIB_MAIN_CONSTRUCTOR(pro2hook_constructor);
LIB_MAIN_DESTRUCTOR(pro2hook_destructor);
LIB_MAIN_TRAP_MAIN(pro2hook_trap_before_main, pro2hook_trap_after_main);
LIB_MAIN_TRAP_MAIN(pro2hook_trap_before_main, pro2hook_trap_after_main);