ModOrganizer2 / modorganizer

Mod manager for various PC games. Discord Server: https://discord.gg/ewUVAqyrQX if you would like to be more involved
http://www.nexusmods.com/skyrimspecialedition/mods/6194
GNU General Public License v3.0
2.19k stars 163 forks source link

Add support for game [Fallout New Vegas - Epic Games Release] #1885

Closed WilliamImm closed 11 months ago

WilliamImm commented 1 year ago

Additional Details

Game data version for English is [Epic Games]/FalloutNewVegas/Fallout New Vegas English. FalloutNewVegas contains Launcher.exe and supporting files, including a configuration. Seemingly what's run to launch the game, configuration file can be altered to point at FalloutNV.exe proper to skip this launcher.

Game version is 1.4.0.1338 on Epic at time of this writing, compared to Steam 1.4.0.525. (CRC: 5E871578)

EOSSDK-Win32-Shipping.dll is present. Main differences in files appear to be DLLs in root folder besides this (no GDFFalloutNV.dll by default in Epic release, msvcp140 and vcruntime140 are present)

Does not modify registry by default.

Epic Games Patcher is an effective requirement for modded setups, as it allows for xNVSE to be used. Can check for presence by reading version number (should be 1.4.0.525 after patcher). Potentially suggest users run it if they haven't.

1828 shows potential launcher interference w/ this title.

Silarn commented 1 year ago

Can you validate that ANY of those manifests would contain the proper game directory or is it safe to just use the base game manifest?

Silarn commented 1 year ago

See https://github.com/ModOrganizer2/modorganizer-game_falloutnv/pull/22

WilliamImm commented 1 year ago

Can you validate that ANY of those manifests would contain the proper game directory or is it safe to just use the base game manifest?

All of these manifests contain a reference to the directory [Epic Games]/FalloutNewVegas within "InstallLocation". Therefore, it's safe to use any of these manifests to get a reference to this location.

The extra complication is that this isn't the basegame directory, for the English language install, the subdirectory "Fallout New Vegas English" is the basegame equalivant. Not the same if someone were to install a multilingual verison, eg: "Fallout New Vegas Spanish" is the Spanish version. Whole extra copies of the game - it seems what launches is determined by the EGS language settings and not by the executable that's run.

(Yes, the Epic Games patcher works with these versions too. Whether you want to support them right now is up to you!)

But yeah, thanks for the quick PR!

Silarn commented 1 year ago

Is it possible to pull that language from an Epic manifest file?

Silarn commented 1 year ago

Are there any other directories within FalloutNewVegas that aren't a valid game directory? I may just opt to select the first directory.

WilliamImm commented 1 year ago

Are there any other directories within FalloutNewVegas that aren't a valid game directory? I may just opt to select the first directory.

No, all the subdirectories are game installs.

The manifest files do write a tag corresponding to each version. Eg, with both English and Spanish installed:

    "InstallTags": [
        "",
        "spanish"
    ],

"" appears to correspond to the English version.

Mind, the installation of multiple versions at once is a bit of a contrivance, in practice I'm sure one would be installed at a time, especially as mod installation files would effectively need to be copied over between each and every language if someone really wanted to play multilingual. I think trying to support that is out of scope, first directory should be good enough for 99% of these installs.

Silarn commented 1 year ago

This does make use of some additional changes in gamebryo so I won't be able to just drop in a NV plugin dll, but I'll add it to the next beta build so you can test.

Silarn commented 1 year ago

Just to be sure, AppData\Local uses the same FalloutNV_Epic directory, right?

WilliamImm commented 1 year ago

Just to be sure, AppData\Local uses the same FalloutNV_Epic directory, right?

Yeah, it uses the same directory, just checked.

Silarn commented 1 year ago

@WilliamImm Can you please test with the beta 11 release and let me know how it works? There's some evidence that there might be issues with USVFS hooking the application but it's not clear to me why that is.

WilliamImm commented 1 year ago

@WilliamImm Can you please test with the beta 11 release and let me know how it works? There's some evidence that there might be issues with USVFS hooking the application but it's not clear to me why that is.

This mostly works, with the critical exception of plugin files not loading. Texture/loose file mods and NVSE plugins do work though. However, this only happens once -EpicPortal to the arguments of both New Vegas and Fallout Launcher. Add these to both executables if this is the Epic variant by default.

Without it, mods do not load at all, and weird issues with starting the game up are present, including EGS launching the launcher after the game was closed.

That being said, mod plugin files not loading is critical to fix before this is ready for primetime, for obvious reasons. The VFS behavior seems to be working fine, so I'm guessing it's a disconnect in hooking to point to the correct plugin loadorder w/in the game itself. This seems to line up what RJ is reporting in the Discord.

Tested with JIP LN NVSE Plugin, YUP, Ultimate Edition Title Screen Replacer, JSawyer Ultimate Edition, and Mod Configuration Menu - stuff that for the most part would be immediately obvious if not present.

Some other observations:

I've tested on both patched and non-patched versions, and can confirm this mostly working behavior if and only if -EpicPortal is enabled.

mo_interface.log Failed attempts, without -EpicPortal usvfs-2023-09-30_19-10-09.log usvfs-2023-09-30_19-19-19.log

Semi-successful versions usvfs-2023-09-30_19-35-16.log usvfs-2023-09-30_20-15-59.log

WilliamImm commented 1 year ago

mo_interface.log

Also, deux mo_interface.log, in case that helps.

Silarn commented 1 year ago

Noted, and I can make those changes, but it does appear to be finding and loading those plugins: 15:16:05.357 <18992:22316> [D] ntdll_mess_NtCreateFile [inPathW=\??\D:\Epic Games\FalloutNewVegas\Fallout New Vegas English\DATA\YUP - Base Game + All DLC.esm] [rerouter.fileName()=D:\MO2_FNVEpicTest\mods\Yukichigai Unofficial Patch - YUP\YUP - Base Game + All DLC.esm] [DesiredAccess=80100080] [originalDisposition=1] [CreateDisposition=1] [FileAttributes=80] [res=0] [*FileHandle=00001148] [rerouter.originalError()=0] [rerouter.error()=0]

Silarn commented 1 year ago

One thing I'm not seeing is an open of plugins.txt.

This is what I get in my Steam log and I don't see an equivalent one in your log: 20:18:45.266 <17796:21008> [D] hook_GetFileAttributesW [lpFileName=\??\C:\Users\USERNAME\AppData\Local\FalloutNV\Plugins.txt] [reroute.fileName()=C:\Games\ModOrganizer\Fallout NV\profiles\Blah\plugins.txt] [res=20] [originalError=0] [fixedError=0] 20:18:45.266 <17796:21008> [D] ntdll_mess_NtCreateFile [inPathW=\??\C:\Users\USERNAME\AppData\Local\FalloutNV\Plugins.txt] [rerouter.fileName()=C:\Games\ModOrganizer\Fallout NV\profiles\Blah\plugins.txt] [DesiredAccess=80100080] [originalDisposition=1] [CreateDisposition=1] [FileAttributes=80] [res=0] [*FileHandle=000017FC] [rerouter.originalError()=0] [rerouter.error()=0]

Can you super double check the plugins.txt file location path?

Maybe manually install one and enable it in the launcher and see what file is created. (You can revert it after checking the files.)

Silarn commented 1 year ago

Another relevant difference: Yours: 15:16:02.341 <18992:22316> [D] hook_GetFileAttributesW [lpFileName=C:\Users\USERNAME\AppData\Local] [reroute.fileName()=C:\Users\USERNAME\AppData\Local] [res=10] [originalError=1008] [fixedError=1008]

Mine: 20:18:41.544 <17796:21008> [D] hook_GetFileAttributesW [lpFileName=C:\Users\USERNAME\AppData\Local] [reroute.fileName()=C:\Users\USERNAME\AppData\Local] [res=10] [originalError=0] [fixedError=0] 20:18:41.544 <17796:21008> [D] hook_GetFileAttributesW [lpFileName=\??\C:\Users\USERNAME\AppData\Local\FalloutNV] [reroute.fileName()=C:\Users\USERNAME\AppData\Local\FalloutNV] [res=10] [originalError=0] [fixedError=0] 20:18:41.544 <17796:21008> [D] hook_CreateDirectoryW [lpPathName=C:\Users\USERNAME\AppData\Local\FalloutNV\] [reroute.fileName()=C:\Users\USERNAME\AppData\Local\FalloutNV] [res=0] [callContext.lastError()=183]

There's some kind of error when it tries to access AppData\Local.

WilliamImm commented 1 year ago

That might explain why the plugins aren't loading. The location should be C:\Users\USERNAME\AppData\Local\FalloutNV_Epic\plugins.txt. I've tested with the same version of Mod Organizer 2 on my Steam install to confirm that, yeah, it does load plugins. Log file from there uploaded below for cross referencing.

usvfs-2023-09-30_22-45-33.log

Accoding to MS system error codes, 1008 corresponds to "ERROR_NO_TOKEN". That help any?

WilliamImm commented 1 year ago

Quick screenshot of the FNV Epic appdata with plugins.txt, for extra proof.

Quick screenshot of the FNV Epic appdata with plugins.txt

WilliamImm commented 1 year ago

And to double check, manually running it through the launcher and adding mods there, C:\Users\USERNAME\AppData\Local\FalloutNV_Epic\plugins.txt is indeed where the game loads enabled plugins from.

Silarn commented 1 year ago

Can you try running as admin to see if it makes a difference? It seems to be failing to load the file and I'm not sure why.

WilliamImm commented 1 year ago

That made no difference. Here's my log for that attempt.

usvfs-2023-09-30_23-06-51.log

Silarn commented 1 year ago

Does the launcher show the plugins? image

WilliamImm commented 1 year ago

Yeah, it does. This behavior happens without admin.

Launcher plugin window

Silarn commented 1 year ago

It shows them enabled as well. Assuming those aren't present in the default plugins.txt, that means the launcher is reading and updating the plugins.txt as expected. So, bizarrely, the game is not. Can you try dropping the profile plugins.txt into AppData before running the game just to see if the plugins will load with that?

Silarn commented 1 year ago

I'd also recommend temporarily disabling any antivirus while testing this just to rule out any interference from that.

WilliamImm commented 1 year ago

...wait. I tested a hypothesis from RJ over on Discord. He was theorizing that the patched version checks FalloutNV in AppData\Local, not FalloutNV_Epic.

By copying over the MO plugins.txt over to FalloutNV in AppData, it works. I'm gonna test with the unpatched version, my hypothesis is that both unpatched and patched versions do this.

Silarn commented 1 year ago

By patched, I'm assuming you mean a patched version of the EXE? But the launcher doesn't, so that feels like a patcher bug to me.

WilliamImm commented 1 year ago

It's not a patcher bug, the unpatched version does this too. I checked with the 1.4.0.1338 (Vanilla epic) exe.

The actual plugin.txt path is C:\Users\USERNAME\AppData\Local\FalloutNV\plugins.txt, same as Steam/GOG. It's only the My Games profile that is different.

Whyyyyyyyyy. Why the inconsistency. At least plugins are working.

WilliamImm commented 1 year ago

Turns out we discovered a pretty major Bethesda-introduced bug with the EGS version, since the vanilla launcher is affected by this too. Yeesh.

Virtualizing both directories works for now, but barring an unlikely Bethesda fix, gonna talk with lStewieAl to see if the patcher can resolve this inconsistency.

Silarn commented 1 year ago

https://github.com/ModOrganizer2/modorganizer-game_falloutnv/pull/23

WilliamImm commented 1 year ago

It occus to me that the TTW plugin needs matching updates too, so.. made #1891 for tracking that.