07th-mod / python-patcher

Mod Installer for the Higurashi and Umineko Games
150 stars 12 forks source link

Rei | MacOS 11 | Steam | Installer doesn't detect a game directory #184

Closed ondatric closed 1 year ago

ondatric commented 1 year ago

I am getting "Couldn't detect game at the above path!" error message when manually choose a path to HigurashiEp09.app.

Screenshot 2022-09-11 at 07 13 04

Seems like getPossibleIdentifiersFromFolder from gameScanner.py is creating unexpected identifier as CFBundleExecutable from Info.plist is "Higurashi When They Cry Rei" so we get "Higurashi When They Cry Rei_Data" instead of "HigurashiEp09_Data" (or "HigurashiEp09.x86_64" "HigurashiEp09.exe")

When I manually change CFBundleExecutable in Info.plist to HigurashiEp09 (just for the test) installer starts to detect installation folder.

Thanks

drojf commented 1 year ago

After you manually change CFBundleExecutable in Info.plist, can you complete the installation succesfully?

I was just wondering if the other stuff in the installer also breaks due to this, or if it is only the path detection.

drojf commented 1 year ago

@tellowkrinkle the relevant section is here as ondatric has pointed out (see below)

Since I don't really know MacOS stuff, I'm not sure why parsing the plist is necessary, so not sure the best way to fix this

https://github.com/07th-mod/python-patcher/blob/a03eb70a31f9062c01be0f957e6ba6aed1403eeb/gameScanner.py#L212-L240

drojf commented 1 year ago

oh I guess the simple solution is to just add an idenifier to the installData.json matching what appears, but not sure if that would break other things

like add "Higurashi When They Cry Rei_Data" to the current identifiers list of "identifiers" : ["HigurashiEp09_Data", "HigurashiEp09.x86_64", "HigurashiEp09.exe"],

drojf commented 1 year ago

Here is the plist file for future reference

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>Higurashi When They Cry Rei</string>
    <key>CFBundleGetInfoString</key>
    <string>Unity Player version 2019.4.40f1 (ffc62b691db5). (c) 2022 Unity Technologies ApS. All rights reserved.</string>
    <key>CFBundleIconFile</key>
    <string>PlayerIcon.icns</string>
    <key>CFBundleIdentifier</key>
    <string>Higurashi When They Cry Rei</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Higurashi When They Cry Rei</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1</string>
    <key>CFBundleSupportedPlatforms</key>
    <array>
      <string>MacOSX</string>
    </array>
    <key>CFBundleVersion</key>
    <string>0</string>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.games</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.9.0</string>
    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true />
    </dict>
    <key>NSMainNibFile</key>
    <string>MainMenu</string>
    <key>NSPrincipalClass</key>
    <string>PlayerApplication</string>
    <key>UnityBuildNumber</key>
    <string>ffc62b691db5</string>
  </dict>
</plist>
drojf commented 1 year ago

@ondatric - ok, I pushed a fix just now, could you re-test? You don't need to re-download the installer, as it should grab the latest installData.json file on startup which, contains the update.

TellowKrinkle commented 1 year ago

Since we use a list of identifiers in the json now, maybe we should remove the + "_Data" that gets appended to CFBundleExecutables, previously there in an attempt to fully unify all names (and add the appropriate executable names to the identifier lists)

TellowKrinkle commented 1 year ago

I'm not sure why parsing the plist is necessary

You can rename an .app to anything you want, and since the .app file is generally considered user facing (e.g. in Windows, you would consider the application install in program files to be not user-facing, but the shortcut to it in the start menu / desktop to be user-facing), we should not make assumptions relating its name to anything specific. Steam installs applications in a windows style (where it hides the real application in steamapps and makes "shortcut" applications for you to stick on the desktop or whatever), but GOG does it the proper macOS way and stuffs everything in the app bundle for you to do whatever you want with. Therefore, we must decide what game an .app is by something inside of the app bundle.

I chose the Info.plist's CFBundleExecutable, which is the name of the executable file (in Contents/MacOS) that is to be executed to launch the app. This is nice because there's exactly one per application, which gives a nice one-to-one mapping of .app file → name. Since we're doing a fairly fuzzy search anyways, you could also list the contents of Contents/MacOS, which would give you the real executable plus some random other garbage folders that unity uses, but since we have the Info.plist there with the exact specification of which thing is the actual name, why not use it?

drojf commented 1 year ago

Since we use a list of identifiers in the json now, maybe we should remove the + "_Data" that gets appended to CFBundleExecutables, previously there in an attempt to fully unify all names (and add the appropriate executable names to the identifier lists)

hmmm, I'll think about it for next time I release the installer, but I probably won't change it in case I break something (and I can't easily test it since I don't have a Mac, besides emulating it by changing the code slightly), But it's good to know why that code was in there and how the identifier is extracted from the .app file.

Next time we release a chapter, I gotta actually get the CFBundleExecutable from the Info.plist file and use that for the identifier for the chapter. Previously I've just been adjusting it from the previous chapter without understanding how it was used or where it came from.

ondatric commented 1 year ago

@drojf Now it's properly detecting the app directory. I have also managed to install the mod. Thank you

ondatric commented 1 year ago

Not sure if it's know issue, but all buttons and letters are purple rectangles for me :)

Screenshotes Screenshot 2022-09-11 at 13 33 14 Screenshot 2022-09-11 at 13 33 34
drojf commented 1 year ago

Thanks for investigating (both looking into the code and doing some testing) the issue for us, and providing a detailed issue report

I've copied parts of the discussion here / tried to document how the identifier field is meant to be filled in for future chapters on our wiki:

drojf commented 1 year ago

oh I didn't see your new message...could you send your sharedassets0.assets.original file? It should be inside the .app bundle at HigurashiEp09.app\Contents\Resources\Data\sharedassets0.assets.original

drojf commented 1 year ago

ahh sorry it's sharedassets0.assets.backup not sharedassets0.assets.original. Actuall;y, I'll open a new issue in the other repo, I think this is unrelated

drojf commented 1 year ago

Hi, please use this new issue when responding about the purple boxes issue from now on: https://github.com/07th-mod/higurashi-rei/issues/11