Commit Graph
374 Commits
Author SHA1 Message Date
icex2 9a6763ee0e feat(launcher): Abstract old and new style mounttables
Required to support reading the legacy and new style
mounttables in avs configuration files.
2024-02-19 23:27:11 +01:00
icex2 d84c46f213 refactor(launcher/avs): Support new style mounttables
A custom node merge strategy to support the new style
mounttables in avs configurations.
2024-02-19 23:27:11 +01:00
icex2 5c6904cd13 refactor(launcher): Tweak usage of property-util accordingly 2024-02-19 23:27:11 +01:00
icex2 a003c21f03 fix(launcher/property): Fix property merging
Iterated implementation after the initial refactoring
of launcher. It turns out, this a bit more complicated
as I expected. Once you are dealing with any kind of
mutation operation on property (node) data, the property
API expects you to have allocated enough memory for your
modifications to fit into the owning property structure.

This was not considered in the old merging code and caused
odd errors of data not being written at all or just partially.

Improving the error handling and output, the property API
communicates these errors within an error code state in the
property structure that can be retrieved using
property_get_error.

The fixed merging and cloning functions ensure that the
property structure should have enough space to house
a worst case merger of adding everything from the source
to the parent.

Furthermore, the merging now supports custom "merging
strategies". As some konmai developers decided to not
stick to the actually well defined property structure
format, use-cases like the new style mounttables in the
avs config exist which uses xml attributes to store
actual data. This requires allowing to plug in
arbitrary visitor-style functions that execute
a different node visiting, evaluation and merging
strategy.
2024-02-19 23:27:11 +01:00
icex2 8a71f92c91 feat(launcher): Improve error output when missing vcredist deps
Apply a simple heuristic to provide the user with more
specific information regarding which vcredist package
might not have been found on their system.

This is a common problem as different games require
different versions and different versions of windows
and installations might already come with some versions
already pre-installed.

Also improve the readme regarding that and provide links
to all versions that are required by one game or another
today.
2024-02-19 23:27:11 +01:00
icex2 1a9a2f7858 refactor(launcher): Use new core thread and log modules
Keep this a separate commit because this also removes
launcher's own logging engine (which was a copy-paste
from inject's) and replaces it with the
streamlined core API. The core API provides all the
features of launcher's own logging engine which also
performed horribly. The entire logging operation
was locked which included expensive operations
that formatted the log messages and required
memory allocations and copying around data.
This also resulted in switching to AVS's
logging engine to perform badly which likely
is the/one root cause for reports of game's
stuttering and even de-syncing.
2024-02-19 23:27:11 +01:00
icex2 e7c8cfef26 refactor(inject): Use new core thread and log modules
Keep this a separate commit because this also removes
inject's own logging engine and replaces it with the
streamlined core API. The core API provides all the
features of inject's own logging engine which also
performed horribly. The entire logging operation
was locked which included expensive operations
that formatted the log messages and required
memory allocations and copying around data.

The core API's implementation at least only
synchronizes the actual IO operations
(though this can be improved further with an
actual async logging sink, TBD)
2024-02-19 23:27:11 +01:00
icex2 2da5bcca00 chore: Delete old log and thread modules in util 2024-02-19 23:27:11 +01:00
icex2 b8439ba60b chore: Apply code formatting 2024-02-19 23:27:11 +01:00
icex2 60b2c23333 refactor: Entire code base, thread and log usage
Boils down to:
- Include headers
- Reduce boiler plate with helpers
- Swap out explicit usages with core API layer
  and ensure the right API is configured beforehand
2024-02-19 23:27:11 +01:00
icex2 d33f476c30 refactor(api): Thread and log API
Split files and add name spacing.
2024-02-19 23:27:11 +01:00
icex2 97e27352b9 feat(avs-util): Add helper to translate property errors 2024-02-19 23:27:11 +01:00
icex2 431cda8290 feat(avs): Add property get and clear error functions
Use these to improve error handling by allowing
one to provide additional error information on
property related operations.
2024-02-19 23:27:04 +01:00
icex2 a80c34f10a feat: Add helper to set avs implementations
Doesn't really reduce boiler plate but adds
clarity with a more meaningful function name
what the operation does.
2024-02-19 23:25:59 +01:00
icex2 68488e0b97 feat: Add core module
This module contains the "core" (API) of
bemanitools which includes an abstraction
layer for threads and logging at this time.

The threads API is very close to what
util/thread already was with some structural
enhancements which make it easier to understand
and work with the API, I hope. Some additional
helpers (*-ext module) support in doing common
tasks, e.g. setting up the thread API with other
modules.

The log(ging) part receives a major overhaul to
address known limitations and issues with the
util/log module:
- Cleaner API layer
- Separate sinks from actual logging engine
- Sinks are composable
- Improved and cleaner compatibility layer
  with AVS logging API

Additional "extensions" (*-ext modules) add
various helper functions for common tasks like
setting up the logging engine with a file and stdout
sink.

The sinks also improved significantly with the file
sink now supporting proper appending and log rotation.
Logging to stdout/stderr supports coloring of log
messages which works across logging engines.

Overall, this refactored foundation is expected to
support future developments and removes known
limitations at the current scale of bemanitools such as:
- Reducing boiler plate code across hooks
- Interop of bemanitools and AVS (and setting the foundation
  for addressing currently missing interop, e.g. for
  dealing with property structures without AVS)
- Addressing performance issues in the logging engine
  due to incorrect interop with AVS
2024-02-19 21:38:27 +01:00
icex2 017caabebb feat(launcher): Integrate procmon as optional dependency
Integrate this as an optional dependency into launcher and
load it dynamically. Thus, these can be easily loaded/enabled
by developers and end-users.
2024-02-03 15:26:53 +01:00
icex2 d42b426291 feat(procmon): Library to hook and monitor selected system calls
A general debugging tool. 3rd party applications such as
"procmon" (same name) provide these capabilites and even
more. But, they are more difficult to run with bemanitools
and don't provide a unified look at the output in combination
with the log output by bemanitools.

Provide an initial set of system call hooks that have already
supported debugging efforts. More can be added when needed
later.
2024-02-03 15:26:50 +01:00
icex2 d95633c451 fix(hook): Add missing hook_table_revert impl 2024-02-03 15:21:21 +01:00
icex2andShiz 24e7dd508a refactor(launcher): Major re-work of launcher
Kudos to Shiz for providing the groundwork for this.

Fundamentally re-think how launcher operates and
bootstrapping the games is managed and configured.

This brings it significantly closer to how the original
bootstrap is doing the job: launcher now utilizes the
data (structures) provided by the bootstrap.xml configuration
file. This creates compatibility with vanilla data dumps
and original stock images. Note that bemanitools does not
include any code or means to run DRM'd data, only decrypted.

But, this allows users to keep decrypted dumps as stock as
possible which means:

* No copying around of property files anymore
* Keep the modules/ folder with the binaries
* Have bemanitools binaries separate in the data
* No need to edit/customize the original configuration files

A list of key features of the "new" launcher:

* Boostrap games by following the configuration provided by
  stock game's bootstrap.xml files
* Custom launcher.xml configuration file that adds further
  launcher configurable features, composability of
  bootstrap.xml configuration(s) as well as configuration
  overriding/stacking of selected types of configurations,
  e.g. eamuse config, avs-config. The latter eliminates
  the need for modifying stock config files in the prop/
  folder
* Unified logging system: launcher and AVS logging uses
  the same logger, all output can now be in a single file
* Original features such as various hook types still
  available

Due to the significant architectural changes, this also
breaks with any backwards compatibility to existing
launcher setups. Thus, users need to migrate by re-applying
the new configuration format and migrating their config
parameters accordingly.

Further migration instructions and updated documentation
will be provided upon release.

Co-authored-by: Shiz <hi@shiz.me>
2024-02-03 15:19:20 +01:00
icex2 fe058171f4 feat/fix(avs/ddr): Support AVS 2.13.06
This one was missing and is the actual correct
version used for ddr-13. 2.13.04 was compatible,
thus far, but there isn't any guarantee that they
are actually 100% compatible (only konmai knows...).
2024-01-29 22:02:14 +01:00
icex2 e2b411378f feat(avs imports): Add lib export definitions of new AVS API functions
Add all functions and their respective ordinals (and mangled names for
documentation purpose) to all currently used AVS version.
2024-01-29 22:02:14 +01:00
icex2 bc743dfeb5 fix(avs-api): Variable type and naming 2024-01-29 22:02:14 +01:00
icex2 9f5bb8186e feat(avs-api): Add more property node related functions
Again, required for the launcher rework when dealing
with property node trees.
2024-01-29 22:02:14 +01:00
icex2 ffaeb79a2a feat(avs-api): Add more AVS file system related functions
These were previously missing and are required for
various file system related tasks such as iterating
directory trees, reading and writing files through
the AVS file system for the upcoming launcher
rework.

Note that the AVS API broke with some mode flags
after version 2.13.06.
2024-01-29 22:02:14 +01:00
icex2 ed21aa20ef feat(avs-api): Introduce AVS error type
Supports improving expressiveness of the API interface
2024-01-29 22:02:14 +01:00
icex2 4ac0ac50ca chore(avs-api): Move psmap terminator to enum 2024-01-29 22:02:14 +01:00
icex2 201d3d26d8 feat(avs-api): Improve property_type enum
Taken from a private eamuse server backend which
had more complete mappings.
2024-01-29 22:02:14 +01:00
icex2 c20fbbd423 feat: Add new module to scope avs related "utility" stuff
Use this to share helpers or other extensions to the
original avs API across modules.

Start with including error codes to readable strings
to improve velocity on AVS API error analysis.
2024-01-29 22:02:14 +01:00
icex2 0eda352f96 feat(util): Add func to check if running as admin user
This has been a source of common error in the past.
It is known that most, or even all, games run into
various issues when not run with elevated privileges.
2024-01-29 22:02:14 +01:00
icex2 e1bccc4654 feat(inject): Use new exception handler with stacktraces
Adjust inject to utilize the new feature. This also
requires including the dwarfstack.dll in all distribution
packages.
2024-01-29 22:02:12 +01:00
icex2 a70f7c625a feat(util): Separate debug module with proper stacktrace printing
Because we are using mingw, we can't just use window's
dbghelp library as the symbols created are in dwarf format.

Fortunately, the dwarfstack library already provides all the
facilities to easily print very descriptive stacktraces,
including function names, file names and line numbers,
when dwarf symbols are available.

This moves the incomplete exception handling portion from
signal to a separate module as well to improve scoping.
2024-01-28 21:53:08 +01:00
icex2 4c9ed32997 feat(util): Add log function for logging in exception handlers
We want this to always be visible, so the log level must be
the highest possible. Unfortunately, that's quite the hack
around the existing API and how fatal behaves.

The log API stopped scaling already a while ago and needs
considerable refactoring to consider the various use-cases
that emerged since it was first created on alpha versions
of bemanitools.
2024-01-28 21:49:08 +01:00
icex2 431a7b87d7 chore: Apply code formatting 2024-01-28 21:44:30 +01:00
icex2 bec007d52a fix(p3ioemu): Incorrect dispatching of unknown p3io commands
Using ddrhook1, this caused DDR X to crash on startup when the
P3io client sends the currently unknown command 2B. Handling it
with the incorrect p3io command struct, any following reading
attempts from the P3IO by the game fail.

Handle the 2B case explicitly with a generic response that worked
previously before the restructuring of the code. Apply the same
to any further unknown commands with improved logging warning
about this.
2023-11-30 20:33:36 +01:00
icex2 a177913bd6 fix(p3io): Off-by-one error on assert
Buffers are allowed to have the exact size as the max defined
P3IO buffer size. Cutting it short by one byte causes this
to fail incorrectly when using the pure raw buffer structure
2023-11-30 20:33:36 +01:00
ahnada 0fdde8b32d Allow generic HID devices with broken(?) outputs to still work as inputs.
Fixes Sony DualShock 4 not working
2023-11-13 21:35:28 +01:00
ahnada 09b3a6c24a Fix incorrect SetupDiGetClassDevs error checking 2023-11-13 19:37:29 +01:00
icex2 9b2ed6910e feat: ddrio-async wrapper/shim driver for async IO
Wrapper/shim library to drive another ddrio in a dedicated
IO thread. Depending on the other ddrio backend used, this
can significantly improve performance while staying
compatible to the existing ddrio API interface

This turned out to be a good solution to solve performance
problems when running MAME with ddrio-p3io that is
(currently) implemented with synchronous IO calls that are
very costly: ~12 ms for a write over the ACIO protocol, ~4 ms
for a read using an IOCTL. As this already adds up to nearly
a full frame (60 fps) regarding latency, there isn't a lot
of time left to do other stuff in a synchronous update loop.
MAME's performance was unstable and dropped all the time below
100%. The result was a choppy gameplay experience.

Combining ddrio-async with ddrio-p3io, the combined backend
is able to drive inputs/outputs at a rate of ~250hz = ~4
updates per frame. This results in an average input latency
of ~4 ms which is as good as it can get with the p3io
hardware's performance limitations that I measured (see
the 4 ms for the IOCTL mentioned above).

This is more than good enough as as update frequency of
the 573 hardware is slightly less than that (I got told
something ~180 hz?).

tl;dr: Gameplay on MAME is great, smooth frame rate, IO feels
amazing and responsive.
2023-11-03 15:46:11 +01:00
Will Toohey 820036087d Revert "Make roundplug PCBID/EAMID verification fail a hard error"
This reverts commit 67de6639ef.
2023-10-18 23:29:19 +02:00
Will Toohey ebd80d3749 Make roundplug PCBID/EAMID verification fail a hard error
This was previously a soft error, and also said "reverting to default"
without actually doing so. We should be forcing correct format.
2023-10-18 23:29:19 +02:00
Will Toohey 3bff7f8a5e jbhook1: If gfx.vertical is set, rotate error messages too
By hooking CreateProcessA, we can adjust the commandline to
disable any rotation, which displays the error box at the correct
place on screen (no additional x/y adjustment is needed)
2023-10-18 23:29:19 +02:00
Will Toohey 9ce47e7050 jbhook1: More effectively setup avs boot config
The NVRAM redirection was silently failing because the prop
delete/recreate pair didn't work. This just recreates the entire
config from scratch instead, which guarantees success every time.
By making the NVRAM type "fs", we also make it easier to debug
any issues that people may have.
2023-10-18 23:29:19 +02:00
MatryoshkaLJY 13c87eaf8d feat: Add bi2a-iidx support for aciotest (#263) 2023-10-18 23:06:10 +02:00
Will Toohey 9afb28a759 acio: Add BIOB and BI2B identifiers 2023-10-09 19:11:37 +02:00
Will Toohey 2920e2b2cf Update BIO2 IIDX emulation to support watchdog poll 2023-10-09 19:11:37 +02:00
icex2 20c6e46a71 feat(ddriotest): Add driotest tool to test ddrio API implementations 2023-06-25 13:24:07 +02:00
icex2 0961bae99f feat(ddrio-p3io): Add ddrio API implementation for DDR P3IO
Also includes EXTIO. Run a SD style cabinet with bemanitools
ddrio API.
2023-06-25 13:24:07 +02:00
icex2 3a89502498 feat(p3io-ddr-tool): CLI tool to test and debug a real DDR P3IO
Extensive tool with subcommands to trigger the various
P3IO commands and run the P3IO + EXTIO DDR hardware
combo with a hardware test menu.
2023-06-25 13:24:07 +02:00
icex2 ec374ec291 feat(extiotest): Add testing tool for real EXTIO devices
A small but helpful tool to run a quick functional test
of a real EXTIO device connected to the target machine.
2023-06-25 13:24:07 +02:00
icex2 db2d71e13c feat(extiodrv): Add (DDR) EXTIO driver
Initial version that supports the most important
features to operate a DDR SD cabinet with all
inputs and outputs working.

Note that the individual sensor cycling modes are
currently broken. The driver will always set the
sensor read mode to all for now.
2023-06-25 13:24:07 +02:00