shadeMe / Fuz-Ro-D-oh-64

Fuz Ro D'oh for Skyrim Special Edition
GNU General Public License v3.0
14 stars 15 forks source link

VR version crash #2

Closed mjducharme closed 2 years ago

mjducharme commented 4 years ago

I compiled the VR version of this and it seems to crash the game when entering dialogue. I imagine this is the same crash that caused you to pull this VR version from Nexus.

Although I haven't really dug through your code, I am guessing the issue is most likely with one or more of the VR memory addresses under the hookedAddresses namespace in Hooks.cpp. I have done some assembly language programming many years ago, as well as Windows development in C++ also many years ago. I was trying to see if I could find the problem.

Can you tell me what program you use to determine those offsets? I figure it must be a disassembler of some kind, but I haven't used those before, so I don't know where to start.

shadeMe commented 4 years ago

I use IDA Pro to do my static analysis/reversing, but there are also other tools such as x64dbg, Ghidra and OllyDbg. The issue is probably in the UIUtilsQueueDialogSubs_Code hook, since that's the only hooked function whose code differs from the SSE codebase's. I accounted for the most ostensible changes in register allocations, but it's possible that I missed something.

If you manage to fix it, feel free to open a PR.

EDIT: You might also need to update the VR offsets if the VR version was updated recently. Those in the code target RUNTIME_VR_VERSION_1_4_15.

drfuzzyness commented 4 years ago

I've got a weekend, C++ experience (but not that much Visual Studio), a cheapo Windows VR headset, and I'd love to help port this to VR. If you're willing, I'd love your help porting this! I've used Fuz-Ro-D-oh in nearly every Bethesda game I've played so far and I'd love to help you out.

Here's what I've done so far:

Here's what I've learned so far:

What I have questions about:

1) Are SME_Prefix.h, INIManager.h, and the missing source files (see gist above) from some other dependency I need? 2) Do I need to retarget from the skse64 solution dependency to the sksevr solution dependency? 3) Is (project_root)/BuildIncrement.jse a file I need to worry about? 4) How did you originally find these memory addresses for Skyrim64? I assume you hooked a debugger up to SkyrimSE.exe and triggered dialog several times and looked for specific addresses that triggered every time. 5) Are there are other tools or mods besides the ones I've listed that you use to help? 6) What is the [Depends] folder? I'm not finding any reference to it. 7) In your debugger setup, you reference $(Skyrim64Path). Is this a Macro you set up? If so, how might I customize this to point to my SkyrimVR install?

Thank you for your work on Fuz-Ro-D-oh all these years!!

EDIT: I reread your comment and it sounds I'll need to do some static analysis of the binary. I found an old reddit thread that mentioned unpacking the executable so I'm working through that and IDA 7 Freeware.

EDIT 2: I found a bunch of guides for setting up a SKSE project. I'm going to follow those first. You can ignore my bits about setting up the VS Solution. I'd still like to know about your static analysis methodology for SkyrimSE so that I can try to extrapolate it to SkyrimVR.

shadeMe commented 4 years ago

You can just use the VC++ project for the VR version to build the plugin for VR. SME_Prefix.h, etc are part of my SME-Sundries repo. BuildIncrement.jse is just a script file used to increment the build number based on the date; you'll find it in the SME-Sundries repo. Modify the EnsVars.prop file to set the paths to the necessary libraries. [Depends] contains the FUZ silent sound files required by the plugin - They are placeholders that get played by the game when a voicefile-less line of dialog is detected. And yes, you can modify the Sryrim64Path to point to the VR build of the game.

drfuzzyness commented 4 years ago

Alright! I was able to track down the differences in the kUIUtils_QueueDialogSubtitles function and I created new offsets specifically for the VR variant. I've only tested for about 1 hour now but it looks pretty good so far. I'll give you a report on Sunday whether or not I've had any issues.

mjducharme commented 4 years ago

@drfuzzyness mind sharing your compiled dll temporarily? I can test as well, and I also have a friend who can.

Actually, nevermind, I see your code changes so I can just build on my environment.

drfuzzyness commented 4 years ago

For anyone else lurking, here's my build that incorporates the changes to the hook addresses.

Fuz Ro D'oh VR - Alpha 2.zip (Compiled as Release)

Place the plugin at (YourSkyrimVRGameDir)\Data\SKSE\Plugins\Fuz Ro D'oh.dll or use a mod manager. Once I'm done testing and an official version is out, use the official version.

mjducharme commented 4 years ago

It works here too! Going to get my friend to try it out as well. He is playing VR tonight for several hours.

mjducharme commented 4 years ago

@drfuzzyness OK, so I found what appears to be a minor bug.

It does work - it displays the subtitles and doesn't crash. But - it displays all subtitles, including subtitles for dialog that it shouldn't appear for, dialog that is clearly audible that normally would not display on screen. The regular Fuz Ro D'oh LE/SE does not display this dialog.

It seems it is forcing all subtitles to be displayed instead of just displaying the subtitles for the dialogue that is missing .fuz files.

drfuzzyness commented 4 years ago

The trace for forcing subtitles might ~start~ end at this line:

https://github.com/shadeMe/Fuz-Ro-D-oh-64/blob/072406f2214c55a8512c54451452ba5cefc8ac40/Hooks.cpp#L224

I'll see what I can do tomorrow.

It also seems to not properly get a duration on certain short lines of text, but that might just be my imagination.

shadeMe commented 4 years ago

@drfuzzyness OK, so I found what appears to be a minor bug.

It does work - it displays the subtitles and doesn't crash. But - it displays all subtitles, including subtitles for dialog that it shouldn't appear for, dialog that is clearly audible that normally would not display on screen. The regular Fuz Ro D'oh LE/SE does not display this dialog.

It seems it is forcing all subtitles to be displayed instead of just displaying the subtitles for the dialogue that is missing .fuz files.

Are you using the Debug build? It has a flag that inverts the selection condition for testing purposes, i.e., dialogue that has valid sound files will be replaced with the silent voice file. Compiling in the Release config should "fix" that.

mjducharme commented 4 years ago

@shadeMe I was using the one he posted above, not sure if it is the debug or release. I was going to compile it myself but he gave the link just before I did. Although the name of the .zip file in that post has suddenly changed to Alpha 2 I see? It wasn't that last night. I'm not sure if anything has changed inside.

drfuzzyness commented 4 years ago

The version I linked is compiled as Release. I updated the link so I could move the directories around in the .zip file so it would be recognized by Vortex for my own sake.

drfuzzyness commented 4 years ago

I feel like an idiot but I think I figured out what I did wrong. I didn't include the actual silent audio files (.fuz)!

Fuz Ro D oh VR - Alpha 3.zip

This still leaves the bug where dialog subtitles are forced on all the time.

shadeMe commented 2 years ago

Closing this as VR support has been removed from the codebase.