Vfs: Add ability to redirect arbitary paths (= serial ports) #62

Open
Haruka wants to merge 6 commits from Haruka/segatools:file_redirection into develop
Owner

As someone running several games on the same cabinet that share most of the hardware (like KCA and FGO), it's a bit of a hassle switching the COM ports of the hardware around all the time.

This commit adds the ability to place arbitary path redirections in segatools.ini, which is mostly useful for hardcoded serial ports.
Technically this would also allow you to redirect arbitary paths, but I haven't tested that yet.

An example that I personally use is:

[vfs]
amfs=amfs
appdata=.
option=option

; aime reader
redirection0from=\\.\COM10
redirection0to=\\.\COM3
; rfid reader
redirection1from=\\.\COM12
redirection1to=\\.\COM2
; POP led begone
redirection2from=\\.\COM9
redirection2to=\\.\COM90
; partition to pop
redirection3from=\\.\COM11
redirection3to=\\.\COM9
As someone running several games on the same cabinet that share most of the hardware (like KCA and FGO), it's a bit of a hassle switching the COM ports of the hardware around all the time. This commit adds the ability to place arbitary path redirections in segatools.ini, which is mostly useful for hardcoded serial ports. Technically this would also allow you to redirect arbitary paths, but I haven't tested that yet. An example that I personally use is: ``` [vfs] amfs=amfs appdata=. option=option ; aime reader redirection0from=\\.\COM10 redirection0to=\\.\COM3 ; rfid reader redirection1from=\\.\COM12 redirection1to=\\.\COM2 ; POP led begone redirection2from=\\.\COM9 redirection2to=\\.\COM90 ; partition to pop redirection3from=\\.\COM11 redirection3to=\\.\COM9 ```
Haruka added 5 commits 2025-03-09 11:42:16 +00:00
Contributor

is this work for chusan about

[vfs]
amfs=amfs
appdata=.
option=option

; slider
redirection0from=\\.\COM1
redirection0to=\\.\COM4
; aime reader
redirection1from=\\.\COM4
redirection1to=\\.\COM1

make COM1 is aime reader and COM4 is slider

is this work for chusan about ``` [vfs] amfs=amfs appdata=. option=option ; slider redirection0from=\\.\COM1 redirection0to=\\.\COM4 ; aime reader redirection1from=\\.\COM4 redirection1to=\\.\COM1 ``` make COM1 is aime reader and COM4 is slider
akanyan reviewed 2025-03-10 10:20:15 +00:00
platform/vfs.c Outdated
@ -544,0 +571,4 @@
return S_FALSE;
}
if (path_compare_w(src, from, wcslen(from)) != 0) {
First-time contributor

You're calling strlen for each path access, multiplied by the number of redirections

You're calling strlen for each path access, multiplied by the number of redirections
Author
Owner

corrected, thanks

corrected, thanks
Haruka marked this conversation as resolved
Haruka added 1 commit 2025-03-10 11:51:28 +00:00
Author
Owner

@zaphkito IF chusan opens ports like that, it will work, but games can also open ports in different ways.

@zaphkito IF chusan opens ports like that, it will work, but games can also open ports in different ways.
Owner

Thanks for the PR, I will try to review it and test it (or maybe @Hay1tsme?) but looks good so far :)

Thanks for the PR, I will try to review it and test it (or maybe @Hay1tsme?) but looks good so far :)
Owner

So I tried the changes on FGO AC and I connected the VFD on COM7 (just for testing) and added the following redirect:

; vfd
redirection0from=\\.\COM1
redirection0to=\\.\COM7

but that didn't work.

So I tried the changes on FGO AC and I connected the VFD on COM7 (just for testing) and added the following redirect: ``` ; vfd redirection0from=\\.\COM1 redirection0to=\\.\COM7 ``` but that didn't work.
This pull request has changes conflicting with the target branch.
  • doc/config/common.md
  • meson.build
  • meson_options.txt
  • platform/config.c
  • platform/vfs.c
  • platform/vfs.h
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u file_redirection:Haruka-file_redirection
git checkout Haruka-file_redirection
Sign in to join this conversation.
No Reviewers
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TeamTofuShop/segatools#62
No description provided.