This PR adds a feature that lets the segatools reacquire dinput device if it disconnects during gameplay. Before this if dinput device disconnects for any reason then it would require user to restart the game since segatools doesn't attempt to reacquire the same dinput device it launched with.
Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/134
Co-authored-by: puniru <puniru@posteo.jp>
User can debug their Unity game with dnspy and other debugger, it needn't patch mono.dll.
most code is copied&modified from [UnityDoorstop](https://github.com/NeighTools/UnityDoorstop/blob/master/src/bootstrap.c#L328)
currently it work on SDEZ/SDDT
<details>
<summary>How to debug and breakpoint Unity game (For example SDDT)</summary>
1. Modify segatools.ini and set `enableDebug` and `debugAddress`

2. Inject mu3 with hook dll

3. dnspy connect unity

4. open Modules tab and double click Assembly-CSharp.dll, yeah, now you can add breakpoints now.

</details>
and make unity_config.target_assembly is optional if we just want to debug unity.
Now PR is ready to code review and merge into upstream.
Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/99
Co-authored-by: MikiraSora <mikirasora0409@126.com>
Co-committed-by: MikiraSora <mikirasora0409@126.com>
* Rewrote the input handler
Added support for dinput and xinput, full keyboard slider cell binding (#127), hold-takeovers, button alternation and auto-sliding (PS4 behaviour). See segatools.ini for a detailed description about everything.
* Split touch handling into backends and added Wintouch touch emulation
Now you can use actual touchscreens as well as mouse emulation was not the greatest when trying to use an actual touchscreen.
* Fixed input issues
gamebtns was always uninitialized, so good luck trying to do anything. How did nobody ever complain about this? lol
* Fixed resolution issues caused by chaining both gfx hooks
The diva-specific hook is the only one we need. Stacking both has strange effects.
* Added support for the MITSUBISHI CP9550DS printer
Q: Why?
A: /shrug

I am not particularly good at this game (or the pass requirements are insane, 23+12 misses out of ~550 is a fail!?), so if someone could test how this feels as opposed to the PS4 version, that would help a lot!

Also something that happens but that I can't reliably reproduce is that my aime card reader randomly becomes NG after a dozen game starts until I delete eeprom.bin.
If that is the case, the only packet sent is SEND_HEX_DATA.
Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/129
Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
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>
## Summary
Adds a unified mechanism for locating third-party IO DLLs through environment
variables, on top of the existing per-game `[xxxio] path=` INI setting.
## Changes
For each IO DLL, the path is resolved in this order:
1. The section-specific INI value, e.g. `[mai2io] path=`.
2. The section-specific environment variable, e.g. `SEGATOOLS_MAI2IO_PATH`.
3. `SEGATOOLS_IO_ROOT` joined with the default IO DLL filename, e.g.
`%SEGATOOLS_IO_ROOT%\mai2io.dll`.
4. Empty path, which keeps the built-in IO implementation (unchanged default).
INI and environment-variable paths are run through Windows environment-variable
expansion, so values such as `%SEGATOOLS_IO_ROOT%\mai2io.dll` are valid in the
INI directly.
Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/119
Co-authored-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>
Co-committed-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>