djhackersdev / bemanitools

Runs recent Konami arcade games and emulates various arcade hardware.
The Unlicense
79 stars 15 forks source link

Bemanitools controls not injecting #251

Open TheNewClassics opened 1 year ago

TheNewClassics commented 1 year ago

Hey everyone,

I'm trying to load BM IIDX 17 Sirius, using bemanitools. I set the controls within config, and then I use the game-start17.bat file. I'm using bemanitools 5.44.

The game does not recognize the controls I've set, though it appears to be injecting the hook per the bat file. Is there a log somewhere that could help me figure out where the issue might be?

Untitled This is the inject logger screen I'm seeing before launch:

icex2 commented 1 year ago

Hey, unfortunately, the information you provided isn't detailed enough to reason about your environment.

I just noticed that the old templates don't show up anymore because github changed some stuff that needs updating on our end.

Can you take the following template and fill it in to the best of your knowledge and understanding?

Additionally on your OP, can you also provide the following:

# Bug report

## Summary

<!--- Provide a general summary of the issue in the Title above -->

## Expected behavior

<!--- Tell us what should happen -->

## Current behavior

<!--- Tell us what happens instead of the expected behavior -->

## Detailed Description

<!--- Provide a detailed description of the issue. Include links to screenshots or videos if
necessary -->

## Steps to reproduce

<!-- Try running the game with a default configuration as well. If that also causes issues, please point that out here in the report. This might speed up the debugging process.-->

<!--- Provide a detailed step by step description how to reproduce this issue -->
1.
2.
3.
4.

## Possible solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->

## Context (Environment)

### Bemanitools version(s) affected

* <!--- Add one or multiple versions as a bullet list -->

### Game(s) and version(s) affected

* <!--- Add one or multiple game versions as a bullet list -->

### Log output

See attachment.

<!---
Provide FULL log output, e.g. inject.log or launcher.log. Please do not guess which things
are relevant or not. Without knowing, you might leave out things that are relevant for the developers. You have to enable log output explicitly if not done already. 

For inject.exe and launcher.exe, add `-Y logfile.log` to the command line args to output to a file, e.g. `gamestart.bat -Y logfile.log`.

!!!!!!
REMOVE ANY SENSITIVE DATA LIKE PCBIDS OR DEVICE NAMES BY REPLACING IT THEM WITH

[REDACTED]

BEFORE UPLOADING/POSTING ANY LOG DATA!!!

Use the search and replace feature of any kind of text editor.
!!!!!!
-->

### Configuration files

See attachment.

<!--- Provide any configuration files that you used, e.g. iidxhook-XX.conf. This file is located in
the same directory as launcher.exe or inject.exe. 

!!!!!!
REMOVE ANY SENSITIVE DATA LIKE PCBIDS OR DEVICE NAMES BY REPLACING IT THEM WITH

[REDACTED]

BEFORE UPLOADING/POSTING ANY LOG DATA!!!

Use the search and replace feature of any kind of text editor.
!!!!!!
-->

### Command line arguments

<!--- Provide how you run the game from the command line, e.g. which gamestart.bat you used and any
additional arguments that you provided to it. Also provide the contents of the gamestart.bat you
used if you altered it. -->

### APIs used

* <!--- List all APIs you used as a bullet list, e.g. iidxio-keyboard, eamio-keyboard -->

### OS version

<!--- Provide the version of Windows you used with whatever update/build identifier -->

### Hardware specs

* CPU: <!--- Insert, e.g. Core i7 2600k 3.20ghz -->
* RAM: <!--- Insert, e.g. 16 GB -->
* GPU: <!--- Insert, e.g. Nvidia GeForce GTX 970, 4GB -->
* Controllers/IO: <!--- Insert, e.g. DJ Dao RE over USB -->
TheNewClassics commented 1 year ago

Thanks a lot for the direction ice. Filling in the template below:

Bug report

Summary

I'm trying to load BM IIDX 17 Sirius, using bemanitools. I set the controls within config, and then I use the game-start17.bat file. I'm using bemanitools 5.44.

The game does not recognize the controls I've set, though it appears to be injecting the hook per the bat file.

Expected behavior

Controls should carry over from bemanitools config.

Current behavior

Controls do not work.

Detailed Description

Game loads appropriately, but no controls work, whether set with a gamepad or keyboard.

Steps to reproduce

  1. Config.bat run, controls set with bemanitools.
  2. Game-Start 17.bat run
  3. Game loads. Cannot press start

Bemanitools version(s) affected

5.44

Game(s) and version(s) affected

Beatmania IIDX 17 Sirius

Log output

Attached to this post.

Configuration files

iidxhook-17.conf. Unchanged

Command line arguments

None

APIs used

None (I think?)

OS version

Windows 11

Hardware specs

Screenshot of your configuration in config.exe that you set up

Attached to this post. config

Directory listing/screenshot of the directory that contains inject.exe, iidxhook.dll etc. directory

(I have the extra game-start bat there as a shortcut for the log)

icex2 commented 1 year ago

I think your problem might be that you unpacked bemanitools to the data folder. There should be revision folders with datestamps, e.g. 2010071200, which also contains the bm2dx.exe. The iidxhook3 readme should point out the dir/file setup. Please fix that and let me know how it looks then.

TheNewClassics commented 1 year ago

Hey ice, so I unpacked bemanitools to the revision folder, and still am having the same issue. A related question: I've tried starting from scratch and deleting bemanitools and reinstalling it, and I've noticed that bemanitools remembers the previous config even tho I've deleted the files. Is the config saved somewhere else on the PC by default?

Also another side note. I've found that in the gamestart-17. bat, I've had to remove the "-D" line of the following to not get it to error out:

inject iidxhook3.dll bm2dx.exe -D --config iidxhook-17.conf %*

Is that directing the script to the D folder?

willxinc commented 1 year ago

Configs are stored in %appdata%\DJHACKERS\

TheNewClassics commented 1 year ago

Trying to take it back to the beginning, when I run the standard gamestart-17.bat, this is the log I get. Could it be a permissions issue? Same outcome when I run it as admin logfile.log

icex2 commented 1 year ago
[2023/04/16 20:19:47] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 16460, tid 30320): name F:\LaunchBox\Games\ArcadePC\Beatmania IIDX 17 SIRIUS\2009102300\iidxhook3.dll, base 0x6B080000

the hook dll loads at 0x6B080000

[2023/04/16 20:19:47] M:inject-debugger: EXCEPTION_DEBUG_EVENT(pid 16460, tid 30320): xEXCEPTION_ACCESS_VIOLATION 0x6B0A4F66
[2023/04/16 20:19:47] M:inject-debugger: EXCEPTION_DEBUG_EVENT(pid 16460, tid 30320): xEXCEPTION_ACCESS_VIOLATION 0x6B0A4F66

and the exception happens at 0x6B0A4F66 which looks like it's in scope of the hook library. so relative to base that's 0xA4F66 which is in src/main/hook/pe.c around here[https://github.com/djhackersdev/bemanitools/blob/e40709ddf70b4fa7282e9181f160809d4ad0389b/src/main/hook/pe.c#L107].

Not sure why it failed here but it tries to do some function patching that goes wrong for some reason.

Noticing you are using Windows 11, I have to point out that, to my knowledge, this has not been tested extensively and might require additional in-depth compatibility work in bemanitools that was not done explicitly thus far.

Do you have an older version of Windows to test, e.g. 7 or 10? How about any other versions of IIDX, either older than 17 or newer/very recent?

TheNewClassics commented 1 year ago

Thanks for taking a look into it. I've got Empress. It looks to use a different version of Bemanitools from what I can see, could you confirm this? For whatever reason tho, it does work for me without issue. Untitled

Unfortunately I only have one PC with Windows 11, so I'm unable to check on any other OS's.

I was able to try it with IIDX 10. I got the following logfile, looks pretty similar to me. logfile.log

thtrandomlurker commented 1 year ago

I've been running into this exact same problem trying to run Sirius myself, where it crashes if the -D flag is passed, and the controls don't work. I decided to test running it in a windows 7 VM, and while it does run (albeit slowly due to VM) with -D set, unless there's something strange going on due to virtualization, or due to it being on the root of the drive, even on windows 7 the controls don't seem to be working. Something worth noting is that the exception at 0x6B0A4F66 happens in both Win 11 and Win7, but seems to occur twice and completely crashes on Win 11, whereas on Win7 it happens once before it continues. Again this could be entirely due to quirks of virtualization, I'm not entirely sure. Attached is a copy of the log from W7 and W11, both were run as administrator.

w7log.log w11log.log

icex2 commented 1 year ago

I've been running into this exact same problem trying to run Sirius myself, where it crashes if the -D flag is passed, and the controls don't work. I decided to test running it in a windows 7 VM, and while it does run (albeit slowly due to VM) with -D set, unless there's something strange going on due to virtualization, or due to it being on the root of the drive, even on windows 7 the controls don't seem to be working. Something worth noting is that the exception at 0x6B0A4F66 happens in both Win 11 and Win7, but seems to occur twice and completely crashes on Win 11, whereas on Win7 it happens once before it continues. Again this could be entirely due to quirks of virtualization, I'm not entirely sure. Attached is a copy of the log from W7 and W11, both were run as administrator.

w7log.log w11log.log

Thanks for the logs. I skimmed them and noticed that it is missing a lot of debug output from the actual iidxhook3.dll that I would expect after the following part:

[2023/06/13 01:01:50] I:inject-debugger: Resuming remote process...

But, only inject writes to the log at this point.

I do see that iidxhook3.dll and dependencies are being loaded:

[2023/06/13 01:01:49] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 448, tid 2680): name C:\IIDX 17 SIRIUS\2009102300\iidxhook3.dll, base 0x6B080000
[2023/06/13 01:01:50] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 448, tid 2680): name C:\IIDX 17 SIRIUS\2009102300\eamio.dll, base 0x6BD80000
[2023/06/13 01:01:50] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 448, tid 2680): name C:\IIDX 17 SIRIUS\2009102300\geninput.dll, base 0x6B100000
[2023/06/13 01:01:50] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 448, tid 2680): name C:\Windows\SysWOW64\hid.dll, base 0x74880000
[2023/06/13 01:01:50] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 448, tid 2680): name C:\IIDX 17 SIRIUS\2009102300\iidxio.dll, base 0x69440000
[2023/06/13 01:01:50] M:inject-debugger: LOAD_DLL_DEBUG_EVENT(pid 448, tid 2680): name C:\IIDX 17 SIRIUS\2009102300\vefxio.dll, base 0x6A140000

Also inject reports that it detected and loaded the iidxhook3.dll as an inject dll:

[2023/06/13 01:01:47] M:inject-debugger: Injecting: iidxhook3.dll

So all that looks fine thus far. But, it appears that the injected iidxhook3.dll is not being called actually.

The paths where the data and files are set up look ok to me as well, so I don't think (at least right now) that's an issue.

5leeper commented 7 months ago

I seem to have the same issue but with lincle, pendual, and copula (possibly more but haven't tested). I'm currently on Windows 10 and I have tried versions 5.46, 5.45, and 5.44. They all have the same problem: the controls are correctly set but they're unresponsive. Unfortunately I do not know how to provide logs regarding this issue. Could someone advise?

icex2 commented 6 months ago

I seem to have the same issue but with lincle, pendual, and copula (possibly more but haven't tested). I'm currently on Windows 10 and I have tried versions 5.46, 5.45, and 5.44. They all have the same problem: the controls are correctly set but they're unresponsive. Unfortunately I do not know how to provide logs regarding this issue. Could someone advise?

Run inject.exe or your .bat file, e.g. gamestart-17.bat with additional parameters such as:

Assuming you run the game with the gamestart-17.bat file, try: gamestart-17.bat -D -Y log.txt

Note: Make sure to not use any kind of sensitive credentials when posting the log, e.g. PCBID. Either remove it from the log manually or use a dummy PCBID such as 0101020304050607083F