alinebee / Boxer

The DOS game emulator that's fit for your Mac.
http://boxerapp.com/
774 stars 139 forks source link

mount in Resources folder instead of Library/Application Support? #75

Open thrino opened 6 years ago

thrino commented 6 years ago

As the title says, is it possible to mount the "drive" in the Resources folder instead of Boxer creating a folder under Library/App support.... I need this to make the game, more portable with saves, etc.

almeath commented 6 years ago

I am interested in this too. Even using Boxer Bundler to make apps out of game boxes does not get around this. Each "standalone" app still creates a folder in Library/Application Support/Boxer/Gamebox States as if it is a normal game box.

I realize this is because of Apple's excessive rules regarding the enforcing of sandboxing and not allowing apps to modify themselves etc., but I would love to know if there is a way around this. Maybe editing the info.plist file?

alinebee commented 6 years ago

Writing game state to AppSupport is a necessity for standalone game apps, because apps cannot rely on being able to self-modify. This isn't about Apple sandbox rules per se, which Boxer doesn't use and only App Store apps need to abide by; but the idea of never self-modifying is built into the concept of a MacOS app for strong practical reasons.

When an app is stored in a location that the user is not able to write to - e.g. because of access permissions (like the Applications folder) or because of filesystem limitations (like a DMG file), then writes to that location will fail and the user's data cannot be saved.

All apps on MacOS have to cope with this restriction, and games are no exception (though cross-platform games will often dump stuff into your Documents folder instead). There may one day be UI for choosing a custom location for storing game state - e.g. a dropbox folder or documents folder - but modifying the standalone app bundle itself will remain a no-no.


That said: this behaviour is not meant to be the case for regular gameboxes run under the regular Boxer app. Boxer 1.4 and below will perform all writes directly to the gamebox, and if you want this behaviour I would recommend just using that version for now (it's more feature-complete anyway).

Currently, the Boxer 2.0alpha built from source will always write game state to AppSupport, but this was a leftover from implementing standalone game apps, and it will not ship with this behaviour enabled by default. There will be UI in the inspector to let you toggle this behaviour, and it will likely default to off.

For now, if you're building your own copy from source then you can override this behaviour by modifying _shouldShadowDrive: in BXSession+BXFileManagement.m to always return NO. This will cause all Boxer builds - regular and standalone - to write directly to the gamebox.

almeath commented 6 years ago

Thank you for the detailed and definitive answer.