0xf4b1 / unify

Automatically port Unity games for macOS or Windows to Linux
MIT License
25 stars 1 forks source link

Modifying globalgamemanagers? #5

Open Randomno opened 5 months ago

Randomno commented 5 months ago

Hi, thanks for the tool, it's very handy.

As I understand it any porting is going to be limited by the shaders. But if a game uses few or no shaders (e.g. 2D games) I'm wondering if it can be made playable with some more work. I tried this with Deepest Sword. I decompiled the game with AssetRipper and exported the project to Linux. Since the decompilation process is imperfect and I'm unfamiliar with Unity errors, the game launched but was fairly broken.

So I tried taking the version ported with unify, and seeing what I could replace with the exported Linux version to get it to launch. Initially it will fail to launch with this message:

Unknown renderer 2

No supported renderers found, exiting

Replacing globalgamemanagers with the Linux version allows it to launch, but the screen is pink (typical broken shader sign).

Replacing unity_builtin_extra as well fixed the graphics. The only issue is the text not loading. I think this is an issue from when I recompiled the game. It's probably fixable but I couldn't figure it out.

So the question for the purpose of this tool is if there's a generalised way to modify globalgamemanagers to allow games to launch. I haven't looked into the format of the file at all so I have no idea (AssetRipper will open it and show the contents). I also don't know what unity_builtin_extra contains and if anything is possible there.

0xf4b1 commented 5 months ago

Hey, this tool sounds very interesting :)

I did a quick check with an empty unity project and did the following: 1) unify: windows (opengl) -> linux (opengl) works 2) unify: windows (directx) -> linux (opengl) Unknown renderer 2 3) assetripper: windows (directx) -> linux (opengl) works

I had to copy globalgamemanagers, unity_builtin_extra and sharedassets0.assets from the working port 3 with assetripper into the non working port 2 with unify and it lets me start the game as expected.

But with a quick look into a binary diff of there files, I don't think there is a way to patch some bytes or something to get it to work as the files are quite different. For unify, the script checks the file unity_builtin_extra to contain symbols starting with GL_ which I found as best indicator if a game has opengl support, so I think it will need all this stuff properly build in.