sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.03k stars 69 forks source link

MO2 Silent mode only loads game executable #1130

Closed cawilliamson closed 1 week ago

cawilliamson commented 2 weeks ago

System Information

Issue Description

When I launch Skyrim Special Edition with MO2 (via steam tinker launch) with GUI selected, then tap "play" it works flawlessly - loads SKSE64 as it should, all good! However, when I set the MO2 launch to "Silent" it doesn't appear to load SKSE64 and instead launches the game directly or possibly uses some unknown profile? Regardless - no mods are loaded at all.

Anyone have any ideas?

sonic2kk commented 1 week ago

Are you definitely using SteamTinkerLaunch-git? Can you provide a log? Auto-updating has been broken for a long time iirc, so if you didn't download recently from master (v14.0.20240330-1 (18fd5f3c230a5ede9fa90aa5d999ee89cd250d21) or later) then it's probably expected that Silent Mode does nothing (it probably just loads the game without MO2 at all, so no VFS to load mods).

This worked for me in testing, let me try again. This could be a bug specific to SteamOS, as modding games should not be done on SteamOS.

sonic2kk commented 1 week ago

Just tested with Oblivion, Silent Mode worked without issue.

If you do not see this dialog popping up, then it is likely that you are not using an up-to-date SteamTinkerLaunch with Silent Mode implemented.

image

This should appear on your Desktop shortly before the game opens (or as a window in Game Mode that you should be able to see from the windows list after pressing the "Steam" button).

sonic2kk commented 1 week ago

It would also be interesting to know if you're using ModOrganizer 2 v2.4.4, or if you used SteamTinkerLaunch before the version was pinned and ended up with v2.5.0.

If you are using v2.5.0, it would be interesting to know if updating SteamTinkerLaunch fixes this issue, even with v2.5.0 (as that has not been officially tested).

If you are using an up-to-date SteamTinkerLaunch (at least v14.0.20240330-1 or newer) and using ModOrganizer 2 v2.5.0, then perhaps Silent Mode doesn't work with v2.5.0.

cawilliamson commented 1 week ago

Let me answer these questions:

sonic2kk commented 1 week ago

Thanks. I don't believe this is a SteamTinkerLaunch issue but a ModOrganizer 2 usage question.

I DO see the MO2 dialog box which states it's starting SkyrimSE.exe and then it does

ModOrganizer 2 Silent Mode I believe will just use whatever executable is last launched.

What executable do you have selected for that game prefix in ModOrganizer 2 Game Mode? Run MO2 with the mode selected as "gui" for the game and open it the GUI with the game so that it runs in the game prefix (not with steamtinkerlaunch mo2 start which starts MO2 in Standalone Mode which uses its own prefix). The default selected executable by ModOrganizer 2 may not be carried over between prefixes, or perhaps if you have never started it in Game Mode before, the executable needs changed.

Try running with SKSE64.exe in Game Mode, and then try running with mo2mode set as "silent".

It may be possible that ModOrganizer 2 is not set to use SKSE as the default executable, and that resolving this could work.

I have only tested with Oblivion and Fallout New Vegas, and in both cases, from memory at least, Silent Mode will just use the last launched executable was on the ModOrganizer 2 UI.


Double-check what executable is selected and try launching with SKSE at least once on the UI, and then try Silent Mode again.

sonic2kk commented 1 week ago

From messing around, I have a feeling the way MO2 chooses the executable to launch is based on some priority of executables configured in MO2. You can move them up and down the list.

I am testing with Oblivion to see if I can get MO2 to launch the Oblivion Launcher for example, as this is the same principle; get MO2 to launch something that isn't just the game EXE.

So far I have not found a way to get MO2 to launch anything but Oblivion.exe in my case. When launching in Silent Mode and then re-running in GUI Game Mode, I can see the default executable will get set back to Oblivion.exe. This seems like a ModOrganizer 2 bug.

sonic2kk commented 1 week ago

Okay, I figured it out after some trial and error.

The Silent launch command uses: "${RUNCMD[@]}" "$MO2EXE" "moshortcut://:$MO2GAMINI". This works because $MO2GAMINI reflects an auto-generated exectuable created by ModOrganizer 2 for that instance (i.e. it would be Oblivion for Oblivion). The way we get this name is based on the INI name that would be created for that instance.

However, this prevents launching other profiles. To launch SKSE for example it would have to use whatever that EXE is, for example, moshortcut://SKSE64.exe. I am not sure the best way to get around this. Perhaps we need a ModOrganizer 2 option for the Silent Mode shortcut to use, where the user can enter a custom value. We can't easily expose a dropdown with these options on the UI because we don't know the MO2GAMINI at that point.


I think the fix for this is to allow an option to enter the custom executable name for Silent Mode, and to document on the wiki that the EXE name matching the INI in mo2games.txt will be used. After this is implemented, it should also document on the wiki why you might want to change this, using SKSE as a good example.

I will take a look at implementing this tomorrow.

sonic2kk commented 1 week ago

As a temporary workaround, you can rename your existing Skyrim Special Edition executable to something else, and rename your SKSE executable to Skyrim Special Edition (not the actual executable files, but MO2 calls them "Exectuables", the launch configuration things).

This way when MO2 tries to run "moshortcut://:Skyrim Special Edition" it'll actually launch the configuration pointed to SKSE. Doing this also means you won't lose your original executable that points to Skyrim Special Edition that MO2 created, so you won't lose anything.


I am looking into an option to expose overriding the silent mode configuration on the Game Menu, defaulting to none which means it'll use the default, and using a combobox entry field that will have a dropdown populated with the executables from the instance's MO2 INI (if it exists) and which you can enter custom values in as well if you ever needed to for some reason.

I am not sure what ModOrganizer 2 does if you give it a name that doesn't exist, such as moshortcut://:this does not exist, but I will test that out too so that I can document this behaviour thoroughly on the wiki.

sonic2kk commented 1 week ago

The ability to overide the executable used by ModOrganizer 2 in Silent Mode has been implemented with #1131. You should be able to select this on the Game Menu, the dropdown should list SKSE64 or whatever the name is on the ModOrganizer 2 side.

cawilliamson commented 1 week ago

@sonic2kk This is fantastic!

Only 2 problems:

  1. The dropdown does not list SKSE64 but instead only lists "none" and "none" (same item twice)
  2. The text field appears to not be editable so I can't manually type in SKSE64.

Is there anything you need from my end to verify why this may be the case?

sonic2kk commented 1 week ago

A log file when trying to load the game menu would be nice. The two options being none suggests the INI cannot be found.

I'm also not sure why the text field isn't editable? I'm not sure how that would be possible... It's a Yad control so it should be editable.

cawilliamson commented 1 week ago

Oh wait a second - I've just had a dig through the filesystem and look what I found!

(deck@chrisaw-deck title)$ ls -l ~/.config/steamtinkerlaunch/mo2/compatdata/pfx/drive_c/users/steamuser/AppData/Local/ModOrganizer/ total 20 drwxr-xr-x 4 deck deck 4096 Jun 23 21:20 'Skyrim Special Editionebcache' drwxr-xr-x 2 deck deck 4096 Jun 20 21:00 'Skyrim Special Editionods' drwxr-xr-x 2 deck deck 4096 Jun 20 21:00 'Skyrim Special Editionownloads' drwxr-xr-x 3 deck deck 4096 Jun 20 21:00 'Skyrim Special Editionrofiles' drwxr-xr-x 2 deck deck 4096 Jun 20 21:00 'Skyrim Special Editionverwrite'

Err... that does NOT look right - instead of creating unique subdirectories within Skyrim Special Edition it's created this mangled mess... fun! :(

sonic2kk commented 1 week ago

The text field is definitely editable...

image

As for why your INI can't be parsed properly, I have a suspicion that /path/to/config/steamtinkerlaunch/mo2/compatdata/pfx doesn't exist or isn't populated. This has happened to some people on SteamOS who somehow cannot get ModOrganizer 2 to install properly and it ends up installed in the Game Prefix and not in the config folder. Even users who installed properly with steamtinkerlaunch mo2 start as instructed on the wiki end up with this issue on SteamOS. I don't understand why it happens, but I guess we'll see.

You should check of the MO2 global prefix exists. If it doesn't, install ModOrganizer 2 with steamtinkerlaunch mo2 start. Back up any mods as usual.

sonic2kk commented 1 week ago

Err... that does NOT look right - instead of creating unique subdirectories within Skyrim Special Edition it's created this mangled mess... fun! :(

If you mean MO2, then yeah, that is very weird. If you mean SteamTinkerLaunch, I don't think it creates these files.

I have subdirectires like this in my MO2 folder, but they are for Fallout New Vegas, and also there is still a New Vegas instance folder.

These subdirectories are supposed to be in the instance folder and named with the first letter not missing. These folders for New Vegas are very old though. I wonder if they come back if I remove them...


Anyway, good find. The missing "Skyrim Special Edition" folder from here is definitely suspect and why it's not working. Try removing these (backing up any mod files that might be in here, although for me, they were mostly empty or had useless webcache files) and launching your Skyrim instance with steamtinkerlaunch mo2 start.

cawilliamson commented 1 week ago

Sorry, I meant MO2. I've just carefully moved all of them to how they should be and am testing now...

cawilliamson commented 1 week ago

Nope, it created the mess again. Eugh, MO2 WTF are you doing? :/

sonic2kk commented 1 week ago

Hm, I'm also having this problem with New Vegas where it's creating this mess of files.

Anyway, you should be able to enter the executable manually. It is fine if it isn't in the INI. I am not sure what you meant when you said you couldn't edit it, because it is editable for me on my laptop and PC. There is no reason why you can't edit it.

Can you edit any combobox entry fields?

cawilliamson commented 1 week ago

Hm, I'm also having this problem with New Vegas where it's creating this mess of files.

Anyway, you should be able to enter the executable manually. It is fine if it isn't in the INI. I am not sure what you meant when you said you couldn't edit it, because it is editable for me on my laptop and PC. There is no reason why you can't edit it.

Can you edit any combobox entry fields?

Weird - I'll hack in the skse stuff over SSH by modifying the STL config file for the game directly. No though, I can't edit any textbox - I can delete characters but not type new ones. Must be a SteamOS issue + yak issue.

sonic2kk commented 1 week ago

Are you absolutely sure you cannot edit the fields? That seems really strange. I don't use SteamTinkerLaunch on my Steam Deck but it's very strange that it doesn't work.

Does this happen in Desktop Mode and Game Mode? Does the virtual keyboard just not work? Does it work if you connect a physical keyboard? This is really strange...

sonic2kk commented 1 week ago

Okay, the issue seems to be that the ModOrganizer.ini file for my New Vegas instance has the following paths:

[Settings]
download_directory=Z:\\home\\emma\\.config\\steamtinkerlaunch\\mo2\\compatdata\\pfx\\drive_c\\users\\steamuser\\AppData\\Local\\ModOrganizer\\New Vegasownloads
cache_directory=Z:\\home\\emma\\.config\\steamtinkerlaunch\\mo2\\compatdata\\pfx\\drive_c\\users\\steamuser\\AppData\\Local\\ModOrganizer\\New Vegasebcache
mod_directory=Z:\\home\\emma\\.config\\steamtinkerlaunch\\mo2\\compatdata\\pfx\\drive_c\\users\\steamuser\\AppData\\Local\\ModOrganizer\\New Vegasods
overwrite_directory=Z:\\home\\emma\\.config\\steamtinkerlaunch\\mo2\\compatdata\\pfx\\drive_c\\users\\steamuser\\AppData\\Local\\ModOrganizer\\New Vegasverwrite
profiles_directory=Z:\\home\\emma\\.config\\steamtinkerlaunch\\mo2\\compatdata\\pfx\\drive_c\\users\\steamuser\\AppData\\Local\\ModOrganizer\\New Vegasrofiles

If you have a ModOrganizer.ini for your Skyrim instance, you could check that and see if you have similar issues (you could Ctrl+F for ebcache). If so, that's why ModOrganizer 2 is making the wrong paths.

The question becomes how my and possibly your INI got into this state...

cawilliamson commented 1 week ago

Ah, disregard - turns out I can edit but ONLY in desktop mode.

On-screen keyboard was up both ways but it was just ignoring all keystrokes.

sonic2kk commented 1 week ago

Ah, there were some changes made back in #1064 and may have broken this. The way we escape the strings is probably broken, causing the paths to be incorrect. I'll mess around and try to fix it.

Actually, it might need some kind of carriage return character or something. I had similar issues with text looking wrong.

cawilliamson commented 1 week ago

Oh hah, here's something.

"Executable moshortcut://:skse" doesnot exist in instance "Portable" - I thought it used Default... perhaps not. Hmm.

sonic2kk commented 1 week ago

Executable moshortcut://:skse" doesnot exist in instance "Portable

Remember that these commands are case-sensitive. If your executable is named SKSE you have to capitalise it. Make sure it matches the name exactly.

If you can find your ModOrganizer.ini you can get the exact name from there, or the ModOrganizer INI.

cawilliamson commented 1 week ago

I think I'm using the wrong "Instance" of MO2 - I can fix that at my end. :)

Thanks for all of your help with this - odd about the ini path mix up though - does sound like an escaping issue - probably on spaces I'd imagine!

sonic2kk commented 1 week ago

Actually, the SteamTinkerLaunch code that generates the INI doesn't get ran in my tests, it is for a different purpose. So this is ModOrganizer 2 creating the INI wrong I think. I tried inserting some garbage data where the INI was being generated, and it did not change the output.

Anyway, it is always creating a correct root instance folder. That is, AppData/Local/ModOrganizer/New Vegas with an INI. This INI has the executable list too,, and SteamTinkerLaunch is populating the dropdown correctly.

I think I'm using the wrong "Instance" of MO2 - I can fix that at my end. :)

Perhaps there is some instance mismatching here? SteamTinkerLaunch is going to pull from the instance named Skyrim Special Edition, so make sure your instance is named accordingly! You may not have renamed it but this is just a patch to troubleshoot on; if you don't have this instance folder or have somehow never managed the MO2 instance with steamtinkerlaunch mo2 start then that might be why STL can't pull it.

If you still have issues, you can check the log and see what it outputs for createMO2SilentModeExeProfilesList.

sonic2kk commented 1 week ago

Actually, no, I was running STL from /usr/bin/steamtinkerlaunch and not my branch. So yeah, adding further escaping fixed it. It was partially around spacing, basically instead of using \\\\ we have to use \\\\\\\\. Ex: printf "profiles_directory=%s\\\\\\\\profiles\r\n" "${GLOBZMOIN}".

This was introduced with #1064. I will push a fix now. That will fix the issue you saw with ModOrganizer 2 creating that directory mess!

sonic2kk commented 1 week ago

Pushed with 144347b1c1b322bda8d3cdc5559ad284a9f8578c, you'll need to remove your INI for this to take effect I think. As you did earlier as you said do be careful when tinkering with these folders :-)

So the three problems we found so far and their status:

  1. The instance cannot be found -- Seems like you have some theories on how to fix it, keep me posted! The instance folder might not exist with the INI to read from at AppData/Local/ModOrganizer/Skyrim Special Edition/ModOrganizer.ini.
  2. Cannot edit the instance name -- Happens to all text fields, seems specific to Steam Deck Game Mode and may be a GameScope bug. Nothing that can be done from my side about this I don't think.
  3. Messy instance directory -- Introduced as a bug by me in #1064, which is my bad. Using printf needed some extra escaping. Should be fixed with 144347b.

Good progress at least, we're down to being unable to find the instance to launch. Double-check that the INI exists at the instance path, and if the INI does exist, check that it contains a [customExecutables] section. See what SKSE is named there and put that exact name into the SteamTinkerLaunch dropdown.

Good luck!