mirror of
https://gitea.tendokyu.moe/Hay1tsme/segatools.git
synced 2026-05-20 18:48:06 -05:00
Loaders and hardware emulators for SEGA games that run on the Nu and ALLS platforms https://github.com/djhackersdev/segatools
## Overview This PR addresses the severe memory leak and performance issues observed in `mai2`, while also introducing improvements to the touch emulation logic. ## Root Cause Analysis As discussed previously, the root cause of the `mai2` memory leak is not a global `segatools` buffer bug. Instead, the game aggressively spams overlapped empty reads specifically on the `LED 15070` UART. On real hardware, the serial driver naturally throttles this. Under emulation, without a throttle, it hits approximately **260kHz of empty async reads**, which causes the memory usage to explode. ## The Fix Instead of introducing complex locking mechanisms and condition variables globally in `uart.c`, this PR applies a targeted fix: * Added a local `Sleep(1)` directly in `common/board/led15070.c` to rate-limit empty reads on the LED path. * Because this is isolated to LED communications, it completely resolves the memory leak without introducing any lag, livelocks, or overhead to other critical inputs. ## Additional Changes in this PR Alongside the memory leak fix, this PR includes a few touch-related improvements (as touch emulation was reviewed during the debugging process): * Enhanced touch input handling and improved auto-scan state management. * Implemented IOCTL handling for touch input to properly manage communication status. ## Testing * **mai2:** Tested successfully on multiple machines. The memory leak is completely gone, and the game runs smoothly. * **chusan:** Tested to ensure no regressions. Sliders and inputs work flawlessly without the lag. Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/101 Co-authored-by: Gl0w1amp <gl0w1amp@noreply.gitea.tendokyu.moe> Co-committed-by: Gl0w1amp <gl0w1amp@noreply.gitea.tendokyu.moe> |
||
|---|---|---|
| .gitlab | ||
| .vscode | ||
| common | ||
| dist | ||
| doc | ||
| emoney | ||
| games | ||
| pki | ||
| spike | ||
| subprojects | ||
| .clang-format | ||
| .dockerignore | ||
| .editorconfig | ||
| .gitignore | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| cross-mingw-32.txt | ||
| cross-mingw-64.txt | ||
| docker-build.bat | ||
| Dockerfile | ||
| initpki | ||
| LICENSE | ||
| Makefile | ||
| meson_options.txt | ||
| meson.build | ||
| msvc-build.bat | ||
| Package.mk | ||
| package.ps1 | ||
| README.md | ||
Segatools
Version: 2026-02-26
Loaders and hardware emulators for SEGA games that run on the Nu and ALLS platforms.
List of supported games
- ALL.Net P-ras MULTI Version 3
- starting from ALL.Net P-ras MULTI Version 3 1.01
- Card Maker
- starting from Card Maker
- CHUNITHM
- up to CHUNITHM PARADISE LOST
- starting from CHUNITHM NEW!!
- crossbeats REV.
- up to crossbeats REV. SUNRISE
- Eiketsu Taisen (英傑大戦)
- starting from Sanzensekai no Hadou (三千世界の波動)
- Fate/Grand Order
- Fate/Grand Order Arcade
- Hatsune Miku: Project DIVA Arcade
- up to Future Tone
- Initial D
- Initial D Arcade Stage Zero
- Initial D THE ARCADE
- Kemono Friends
- Kemono Friends 3: Planet Tours
- maimai DX
- starting from maimai DX
- Mario & Sonic
- Mario & Sonic at the Tokyo 2020 Olympics Arcade
- O.N.G.E.K.I.
- starting from O.N.G.E.K.I.
- Sangokushi Taisen (三国志大戦)
- starting from 1.01
- SEGA World Drivers Championship
- SEGA World Drivers Championship 2019
- WACCA
- starting from WACCA
End-users
For setup and configuration guides, refer to the dedicated documents available for each game, see the links in the previous section.
Contributors
If you are/want to be a contributor of any kind, e.g. new features, bug fixes, documentation improvements, ..., please read the contributing documentation, first.
Developers
For development setup and instructions how to build the project, refer to the dedicated development documentation.