lah7 / sims2-4k-ui-patch

Work in progress patch program to upscale The Sims 2's UI for 4K displays
GNU General Public License v3.0
30 stars 2 forks source link

Support for Clean UI mod / Sims 2 hangs on initial load #46

Open walkawayy opened 4 weeks ago

walkawayy commented 4 weeks ago

Operating System

Windows 11

Patcher Program Version

Built on latest nightly of 0.1.0

Installation Type

Repack or other automated installation

Describe the problem

I am using the Sims 2 Starter Pack (basically Sims 2 Ultimate Collection from Origin). Now, this may be totally a me problem in which case feel free to close the issue. But I figure I will report it just in case. So, I ran the tool in Ubuntu within WSL. I had to grant admin read/write to the folder but it worked. However, the game hangs during the initial loading screen while the music just plays. I am using the Clean UI Startship UI which is most likely not compatible with your mod. I am also launching using Sims 2 RPC. But since I don't know the code, I figure I would report it. See the pic below to see where it hangs:

image

Traceback

N/A
lah7 commented 4 weeks ago

It looks like Simstate's Starship UI mod introduces additional files and has them stored in the Downloads folder. As I sort of suspected, any package files in the Downloads folder won't be patched.

I'm pretty sure custom content "overrides" or "extends" the game's original files. With each 'file' in a package having a type, group & instance ID to identify them, in theory, things should had been left with inconsistent scaling. It doesn't fully explain the crash though.

The patcher is focused on the game's original files at the moment. A future goal should be to be compatible with other UI mods, although if it was a UI mod that patches each game file (e.g. ui.package) directly, then the patcher would work transparently.

Thanks for raising the report, I wouldn't really know since I like the original UI. There's a lot of differences (non-retail, third party launcher, custom UI, patched via WSL, etc) which makes it more fun to troubleshoot :)


So, I ran the tool in Ubuntu within WSL.

By the way, you could grab an 'artifact' from the latest build from the Actions tab if you wanted the latest EXE to run under Windows. That said, the performance difference within WSL would be trivial. I don't think running under WSL had any implications.

walkawayy commented 4 weeks ago
  • Does anything different happen if you start the game directly (e.g. Sims2EP9.exe) bypassing the Sims2RPC launcher?

Still hangs on initial load.

  • I'd expect a "Application crashed" dialog to appear, since it's not clear if the game is still running but it couldn't load/interact with the menu. Are there any crash dumps in My Documents/EA Games/The Sims 2/Logs/?

No interesting logs files are made. I attached one below for a crash if I remove the Downloads folder.

  • Did any of the scrolling text appear along the bottom while loading?

No scrolling text or loading bar ever started filling. It just hangs on that first loading screen indefinitely while the music plays.

  • Did you patch with the compression option checked?

Yes, I had compression checked.

  • Without compression, the game would have huge ui.package files. Not sure if this has an impact on the 32-bit executable 2 GB limit. It can be patched to 4 GB. Not sure if your repack or launcher already patches that already. Sims 2 RPC applied the 4GB patch.
  • Does it work with stock UI if you move the "Downloads" folder out and start the game?

If I take the Downloads folder out, I get a crash The application has crashed. The application will now terminate. Text dump here:

Sims2Exception 2024.08.13 18.59.31.txt

The patcher is focused on the game's original files at the moment. A future goal should be to be compatible with other UI mods, although if it was a UI mod that patches each game file (e.g. ui.package) directly, then the patcher would work transparently.

Thanks for raising the report, I wouldn't really know since I like the original UI. There's a lot of differences (non-retail, third party launcher, custom UI, patched via WSL, etc) which makes it more fun to troubleshoot :)

Ya I figure supporting a modded UI is a whole new can of worms, but I wanted to bring it up since a lot of Sims 2 guides recommended the Clean UI nowadays in their Windows 10/11 setup guides.

So, I ran the tool in Ubuntu within WSL.

By the way, you could grab an 'artifact' from the latest build from the Actions tab if you wanted the latest EXE to run under Windows. That said, the performance difference within WSL would be trivial. I don't think running under WSL had any implications.

Oh nice. It seems like the tool took a similar amount of time running in Windows and in WSL with the Linux version. Probably a good 30+ minutes even on my Ryzen 7700x.

lah7 commented 4 weeks ago

For the "Downloads" test, I forgot there is another file - it adds a package in the game files for the loading screen itself. Try taking that out from the game directory (TSData\Res\UI) and see if it works. Just want to check that you can get to the game without the "clean UI" mod, or if something else is causing the crash.

As a sanity check, I tested my retail copy with the latest patcher code (without compression, I got impatient) and the game starts and runs fine, minus the already known glitches. I discovered a new one (#47).

Once you confirm it can start without that mod, we could try patching Clean UI. As a test, you can hack the code to find and patch their files too.

    def _get_file_list(self) -> list:
        """
        Return a list of files that will be patched by this program.
        """
        files = []
        for filename in ["ui.package", "FontStyle.ini", "CaSIEUI.data"]:
            files += glob.glob(self.game_install_dir + f"/**/{filename}", recursive=True)
+       files += glob.glob(self.game_install_dir + f"/**/simstate*.package", recursive=True)
+       files += glob.glob(self.game_install_dir + f"/**/*clean-ui*.package", recursive=True)
+       files += glob.glob("/path/to/sims2/downloads/simstate*.package", recursive=True)
        return sorted(list(set(files)))

If that works, we could add an 'experimental' checkbox that asks for the downloads folder, to patch any known UI packages - but preferably it could patch any package that contains .uiScript data. I'd imagine "CAS HD fix" mod will be no good if the rest of the UI is 2x the size.

Probably a good 30+ minutes even on my Ryzen 7700x.

I've been slowly working on some parallel processing to get all those cores busy! 🔥

lah7 commented 3 weeks ago

I tried the clean UI mod myself, no crashes here. I run the game under Wine on Linux.

Using the 'hack' above, the patcher didn't modify any uiScript or graphics data. It needs to be told explicitly too:

-                elif file.filename in ["ui.package", "CaSIEUI.data"]:
+                elif file.filename in ["ui.package", "CaSIEUI.data"] or file.filename.find("starship") != -1 or file.filename.find("clean-ui") != -1:

If compression is enabled, patching fails with array too small. Needs digging deeper if it's a specific file format causing that. With compression disabled, it succeeded, and it works... well.... with the usual visual bugs. I did notice the splash screen seemed static (lifeless) as it was loading.

Screenshot_20240814_220127 Screenshot_20240814_220158 Screenshot_20240814_220229

walkawayy commented 3 weeks ago

Very cool! I added in your hacks and got 333 files patched instead of 331 and the game loads. It's obviously not perfect but a welcome start! I would say you'd be smart to continue as you were with base game support before even thinking about supporting custom UIs. But it's nice to know it could be possible in the future. (cropped pic because 4k pic wouldn't upload for some reason)

image

lah7 commented 3 weeks ago

I encountered that glitch in your screenshot too at first. Make sure that path is right for your system: /path/to/sims2/downloads/simstate*.package, there should be about 5+ more from the Downloads folder.

Yep, it's quite nice to see too. Will track this issue as a https://github.com/lah7/sims2-4k-ui-patch/labels/feature%20request. Glad it's not crashing now!

walkawayy commented 3 weeks ago

Amazing thanks! Looks great! I am pretty busy on another project and irl work, but maybe in the future I will try to spin up on some Sims 2 knowledge and contribute if possible.

image