spice2x / spice2x.github.io

🌶️ spice2x is a spicier fork of SpiceTools with hundreds of bug fixes and new features 🌶️
https://spice2x.github.io/
GNU General Public License v3.0
116 stars 2 forks source link

[IIDX] Crash when beginning play recording #126

Closed Radioo closed 9 months ago

Radioo commented 9 months ago

Game and version

IIDX 30-31

Version of spice2x

2024-01-20

Laptop

No

Attached log.txt file, if available

log.txt

Describe the issue

After implementing necessary network-side logic to enable play recording, when entering a song, the game crashes. I can elaborate what exactly needs to be sent from the server to enable this if needed. I am using an NVIDIA GPU (RTX 2060) which should work for this and I'm also using a 010 DLL.

LupinThidr commented 9 months ago

2024011600 isn't public, the call stack in your log is useless

LupinThidr commented 9 months ago

Is this also LDJ-010? I think the only public LDJ-010 DLL is 2023120600, so you should get a log with that one crashing.

Radioo commented 9 months ago

Apologies, updated the log in issue description. This one is from LDJ-010-2023120600

sp2xdev commented 9 months ago

Can you try disabling spice overlay and see if it helps? I guess you would need a touch screen to card in.

Does it work in btools?

gar6a9e commented 9 months ago

I have done some research on this issue in the past.

I'm not sure if this is entirely correct, but I have compiled it from my old notes. I think there might be some issues with DirectX hooks. I hope this information is helpful.

sp2xdev commented 9 months ago

If it isn't the overlay, I would strongly suspect subscreen swap chain logic (SUB_SWAP_CHAIN) is related, as it runs unconditionally. Might be worth checking if removing logic around it (start with graphics_d3d9_ldj_init_sub_screen) resolves this issue. If not that, perhaps the screenshot logic (which is also always-on).

Also worth checking what status code is returned by NvEncoder::RegisterResource, might give us a hint as to why the game is unhappy.

Is it simple to add enable recordings; e.g., to an asphyxia plugin? Would be super useful for testing purposes.

Radioo commented 9 months ago

I'm afraid it won't be simple to add it to asphyxia as the game requires a separate API server which functions nothing like the base XRPC server (It's just a simple JSON API). But I've just pushed an experimental toggle you can enable on the dev server I develop for. If you'd like to join, feel free to shoot me a PM on discord (my username: services.get).

sp2xdev commented 9 months ago

Okay, we have someone who knows more about iidx who can help out with this & will be contacting you shortly for server access

sp2xdev commented 9 months ago

Resolved in 24-01-27 with the new "disable all d3d9 hook" option. Not the most ideal way to resolve this, but at least brings it to parity with btools. Not fully tested as server support is still being worked on.

gar6a9e commented 9 months ago

Also worth checking what status code is returned by NvEncoder::RegisterResource, might give us a hint as to why the game is unhappy.

According to my old notes, it returned 9.

maybe NV_ENC_ERR_INVALID_CALL https://github.com/NVIDIA/video-sdk-samples/blob/aa3544dcea2fe63122e4feb83bf805ea40e58dbe/Samples/NvCodec/NvEncoder/nvEncodeAPI.h#L472

llm96 commented 9 months ago

I was running into another crash despite having hooks disabled on 2023120600.

The game closed shortly before the song started with no logs, but I managed to get something by attaching a debugger.

stacktrace

Didn't happen on IIDX 30 with the same settings, so I guess something changed between the two games.

Switching to a different ASIO driver (FlexASIO to ASIO4ALL) worked for me.

LupinThidr commented 9 months ago

seems to be related to audio format conversion for writing to the video file (guessing from RTTI and log messages), documenting your flexasio and asio4all settings might be useful for future troubleshooting (known bad and good configurations)

sp2xdev commented 9 months ago

User on Radioo's server had similar issues with FlexASIO, but was able to resolve it by changing the configuration.

Bad config:

backend = "Windows WASAPI"
bufferSizeSamples = 386
channels = 2
wasapiExclusiveMode = false

[output]
suggestedLatencySeconds = 0.0

Good (fixed) config:

backend = "Windows WASAPI"
bufferSizeSamples = 128

[output]
device = "Speakers (Removed to protect privacy)"
sampleType = "Int32"
suggestedLatencySeconds = 0.0
wasapiExclusiveMode = false
wasapiAutoConvert = true
channels = 2

Can't tell you for sure what really matters, but if I had to guess, wasapiAutoConvert is needed to allow for resampling. YMMV since some aspects of FlexASIO depends on your actual audio card being output to.

Anyway, the crash seems unrelated to spice.

llm96 commented 9 months ago

Thank you for taking a closer look at it. Strangely enough the known good FlexASIO config doesn't work for me either, so I'll just have to chalk it up to my audio hardware. As for my working ASIO4ALL settings, everything is set to default.

I hope documenting it here may help anyone encountering a similar crash in the future. Seems like most common issues with IIDX end up being audio related in one way or another! 😆