Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New UE4SS working directory location #506

Merged
merged 1 commit into from
May 29, 2024

Conversation

Buckminsterfullerene02
Copy link
Member

@Buckminsterfullerene02 Buckminsterfullerene02 commented May 15, 2024

Description

As according to the discussions in #476. Install location of all files will be in /ue4ss except proxy. Legacy locations all supported, but if files are in new locations, those take priority.

Proxy tries to load UE4SS.dll from new location, but the location of the UE4SS.dll (and thus the root directory) can be overriden by placing a file called override.txt next to the proxy and can contain either an absolute or relative path to the UE4SS.dll. Still supports legacy UE4SS.dll location.

Also changes the build script as all files need to be zipped inside of a ue4ss/ folder that will still be unzipped inside of the game exe directory due to the proxy also being there.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Requires documentation update

How Has This Been Tested?

Tested files in legacy, new, and overriden file locations, seperately and in a mix of two or three at once.

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have added the necessary description of this PR to the changelog, and I have followed the same format as other entries.
  • Fix issue with console/dll not initialising game correctly
  • Fix release assets not going into the right places

@Buckminsterfullerene02
Copy link
Member Author

If running the game directly from the shipping exe, there is an issue where DRG doesn't load properly as shown:

image

If running the game from steam, it doesn't load up at all.

I'm sure both of these issues are related to the proxy dll, but I wouldn't even know where to begin with debugging as there is nothing obvious when breakingpoint debugging the proxy code.

@UE4SS
Copy link
Collaborator

UE4SS commented May 16, 2024

If running the game directly from the shipping exe, there is an issue where DRG doesn't load properly as shown:

If running the game from steam, it doesn't load up at all.

I'm sure both of these issues are related to the proxy dll, but I wouldn't even know where to begin with debugging as there is nothing obvious when breakingpoint debugging the proxy code.

As far as Steam not working, that's because you're using std::filesystem::current_path() which gives you the working directory.
Steam actually uses the location of the non-shipping exe as the working directory.
I've implemented the solution to this by using GetModuleFileNameW instead.

As far as DRG not loading properly when using the shipping exe, what do you mean ?
I don't see anything odd other than the regular Windows console not rendering properly for whatever reason.
I was unable to reproduce that problem.

@UE4SS
Copy link
Collaborator

UE4SS commented May 16, 2024

I'm sure both of these issues are related to the proxy dll, but I wouldn't even know where to begin with debugging as there is nothing obvious when breakingpoint debugging the proxy code.

To debug the proxy, open Intermediates/.gens/proxy_files/windows/x64/Game__Debug__Win64/dllmain.cpp in your IDE, put a breakpoint, and then set your IDE up to launch the game and attach when you hit the debug button, and then your breakpoint should be hit immediately.
Replace Game__Debug__Win64 in the path with whatever target you built.
I figured this problem out by putting a breakpoint in that file in the load_ue4ss_dll function and inspecting the value of ue4ssPath.

UE4SS/src/GUI/LiveView.cpp Outdated Show resolved Hide resolved
@UE4SS
Copy link
Collaborator

UE4SS commented May 16, 2024

@Buckminsterfullerene02
Copy link
Member Author

I'm sure both of these issues are related to the proxy dll, but I wouldn't even know where to begin with debugging as there is nothing obvious when breakingpoint debugging the proxy code.

To debug the proxy, open Intermediates/.gens/proxy_files/windows/x64/Game__Debug__Win64/dllmain.cpp in your IDE, put a breakpoint, and then set your IDE up to launch the game and attach when you hit the debug button, and then your breakpoint should be hit immediately. Replace Game__Debug__Win64 in the path with whatever target you built. I figured this problem out by putting a breakpoint in that file in the load_ue4ss_dll function and inspecting the value of ue4ssPath.

That's what I was doing, I just didn't see anything wrong, so I thought it was some weird thing I didn't understand.

@Buckminsterfullerene02
Copy link
Member Author

If running the game directly from the shipping exe, there is an issue where DRG doesn't load properly as shown:
If running the game from steam, it doesn't load up at all.
I'm sure both of these issues are related to the proxy dll, but I wouldn't even know where to begin with debugging as there is nothing obvious when breakingpoint debugging the proxy code.

As far as Steam not working, that's because you're using std::filesystem::current_path() which gives you the working directory. Steam actually uses the location of the non-shipping exe as the working directory. I've implemented the solution to this by using GetModuleFileNameW instead.

As far as DRG not loading properly when using the shipping exe, what do you mean ? I don't see anything odd other than the regular Windows console not rendering properly for whatever reason. I was unable to reproduce that problem.

Your fix works, thanks.

For debugging my exe path is the shipping exe. When it loads, it:

  1. Loads steamVR for some reason, despite DRG not using it
  2. Gets this error: ←[0mFSDLog_Gameflow: Error: UFSDGameInstance:: Init - Steam not initialized!
  3. Ends up on that screen about steam not initialising correctly

Actually, without ue4ss installed, the exact same thing happens when loading directly from shipping exe. So steam must be initialised from the bootstrapper one. But if I load from the bootstrapper one by debugger isn't attached to the right process...

@narknon
Copy link
Collaborator

narknon commented May 16, 2024

There shouldn't be a message box when ue4ss loads should there? That's just kinda annoying if you have to close out of it

@UE4SS
Copy link
Collaborator

UE4SS commented May 16, 2024

There shouldn't be a message box when ue4ss loads should there? That's just kinda annoying if you have to close out of it

It's only if it fails to load.
Otherwise the game just immediately shuts down without an error, which means the user has no idea what happened.

@narknon
Copy link
Collaborator

narknon commented May 16, 2024

"I put in two; one for when proxy fails to load for whatever reason, and one for when UE4SS.dll loads."

@UE4SS
Copy link
Collaborator

UE4SS commented May 16, 2024

"I put in two; one for when proxy fails to load for whatever reason, and one for when UE4SS.dll loads."

That's a typo, they meant if UE4SS.dll fails to load.

@narknon
Copy link
Collaborator

narknon commented May 16, 2024

The second half of the sentence

@UE4SS
Copy link
Collaborator

UE4SS commented May 16, 2024

The second half of the sentence

Yes, and one for when UE4SS.dll loads is a typo.
I literally checked the code as well.

@Buckminsterfullerene02 Buckminsterfullerene02 marked this pull request as ready for review May 16, 2024 20:25
@Buckminsterfullerene02 Buckminsterfullerene02 force-pushed the file-location-changes branch 2 times, most recently from 5c0990f to d2fe3fe Compare May 16, 2024 20:32
@Buckminsterfullerene02
Copy link
Member Author

Just realised deleting API.txt broke build script. Will get on that shortly.

@Buckminsterfullerene02
Copy link
Member Author

Releases build as expected now.

@UE4SS
Copy link
Collaborator

UE4SS commented May 17, 2024

Does this PR also affect the location of imgui.ini ? Not sure if the creation of that file is based on the location of UE4SS.dll or the exe.

@Buckminsterfullerene02
Copy link
Member Author

Buckminsterfullerene02 commented May 17, 2024

Does this PR also affect the location of imgui.ini ? Not sure if the creation of that file is based on the location of UE4SS.dll or the exe.

Forgot about that. It seems to still be put into the exe dir. Should it be kept that way?

@UE4SS
Copy link
Collaborator

UE4SS commented May 17, 2024

Does this PR also affect the location of imgui.ini ? Not sure if the creation of that file is based on the location of UE4SS.dll or the exe.

Forgot about that. It seems to still be put into the exe dir. Should it be kept that way?

If possible, it should go in the ue4ss directory, but I don't know if imgui provides a way to do that and I don't think we should bend over backwards to get that to work.

@UE4SS
Copy link
Collaborator

UE4SS commented May 27, 2024

Revert moving imgui.ini location
Don't ask me why, I have literally no idea.

What ? Was there something that didn't work properly ?

@UE4SS
Copy link
Collaborator

UE4SS commented May 29, 2024

The object dumper directory doesn't use the new path:

[15:19:47] mods directory: Y:\test_games\5.4\UE4SS_Main54\Windows\UE4SS_Main54\Binaries\Win64\ue4ss\Mods
[15:19:47] log directory: Y:\test_games\5.4\UE4SS_Main54\Windows\UE4SS_Main54\Binaries\Win64\ue4ss
[15:19:47] object dumper directory: Y:\test_games\5.4\UE4SS_Main54\Windows\UE4SS_Main54\Binaries\Win64

Copy link
Collaborator

@UE4SS UE4SS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Tested and it's working.

proxy override target

maintain legacy location

update build script with ue4ss path

fix bp mod loader

loading of legacy watches

fix wrong filters location

use dll directory instead of working directory

fixes

fix release zips

Error message boxes on proxy loading

test script

docs, changelog

fix buildscript

Remove outdated API.txt

add doc link to error message box

UE4SS title on error pane

fix oopsie

remove ref to deleted API.txt in build script

Change imgui.ini location

Fix paths in docs

Revert moving imgui.ini location

Don't ask me why, I have literally no idea.

Fix object dumper directory pointing to wrong place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants