diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..6c19ba0 --- /dev/null +++ b/Info.plist @@ -0,0 +1,22 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + OneShot + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + NOTE + This file was generated by Qt/QMake. + + diff --git a/make-oneshot-mac.sh b/make-oneshot-mac.sh index 5bd62f5..13ff2ce 100755 --- a/make-oneshot-mac.sh +++ b/make-oneshot-mac.sh @@ -4,7 +4,7 @@ set -e # User-configurable variables mac_version="0.3.4" steam_game_dir=~/Library/Application\ Support/Steam/SteamApps/common/OneShot -make_threads=4 +make_threads=8 # Colors white="\033[0;37m" # White - Regular @@ -25,9 +25,29 @@ pyinstaller journal/mac/journal.spec --onefile --windowed # Create app bundles echo "-> ${cyan}Create app bundles...${color_reset}" -mv OneShot.app OneShot_new.app -cp -r patches/mac/OneShot_template.app ./OneShot.app -cp OneShot_new.app/Contents/MacOS/OneShot OneShot.app/Contents/Resources/OneShot +OSX_App="OneShot.app" +ContentsDir="$OSX_App/Contents" +LibrariesDir="$OSX_App/Contents/Libraries" +ResourcesDir="$OSX_App/Contents/Resources" + +# create directories in the @target@.app bundle +if [ ! -e $LibrariesDir ] + then + mkdir -p "$LibrariesDir" +fi + +if [ ! -e $ResourcesDir ] + then + mkdir -p "$ResourcesDir" +fi + +cp patches/mac/steamshim ./OneShot.app/Contents/Resources/steamshim +cp patches/mac/libsteam_api.dylib ./OneShot.app/Contents/Libraries/libsteam_api.dylib +cmake -P patches/mac/CompleteBundle.cmake +cp assets/icon.icns ./OneShot.app/Contents/Resources/icon.icns +cp steam_appid.txt ./OneShot.app/Contents/Resources/steam_appid.txt +cp patches/mac/oneshot.sh ./OneShot.app/Contents/MacOS/oneshot.sh +mv OneShot.app/Contents/MacOS/OneShot OneShot.app/Contents/Resources/OneShot cp -r dist/_______.app _______.app # Set version number @@ -52,7 +72,6 @@ cp -r _______.app "${steam_game_dir}/_______.app" # Cleanup echo "-> ${cyan}Cleanup files...${color_reset}" # make clean -rm -rf OneShot_new.app rm -rf journal/mac/__pycache__ rm -rf build rm -rf dist diff --git a/mkxp.pro b/mkxp.pro index 0cc0266..8939618 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -33,10 +33,11 @@ contains(BINDING, NULL) { CONFIG += BINDING_NULL } +PKGCONFIG = sigc++-2.0 pixman-1 zlib sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile + unix { CONFIG += c++11 - PKGCONFIG += sigc++-2.0 pixman-1 vorbisfile \ - sdl2 SDL2_image SDL2_ttf SDL_sound physfs + PKGCONFIG += physfs LIBS += -ldl macx: { INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers @@ -44,7 +45,7 @@ unix { QMAKE_LFLAGS += -L/usr/local/opt/ruby@2.3/lib -L/usr/local/opt/openal-soft/lib } !macx: { - PKGCONFIG += openal zlib + # PKGCONFIG += openal zlib INCLUDEPATH += /usr/include/AL /usr/local/include/AL SOURCES += src/xdg-user-dir-lookup.c LIBS += -lX11 @@ -55,8 +56,7 @@ win32 { QMAKE_CXXFLAGS += -std=gnu++11 QMAKE_LFLAGS += -std=gnu++11 - PKGCONFIG += sigc++-2.0 pixman-1 zlib \ - sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile freetype2 + PKGCONFIG += freetype2 LIBS += -lphysfs -lsecur32 -lwinmm release { diff --git a/patches/mac/CreateBundle.sh b/patches/mac/CreateBundle.sh new file mode 100755 index 0000000..7236f9c --- /dev/null +++ b/patches/mac/CreateBundle.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +OSX_App="synglechance.app" +ContentsDir="$OSX_App/Contents" +LibrariesDir="$OSX_App/Contents/Libraries" +ResourcesDir="$OSX_App/Contents/Resources" + +# create directories in the @target@.app bundle +if [ ! -e $LibrariesDir ] + then + mkdir -p "$LibrariesDir" +fi + +if [ ! -e $ResourcesDir ] + then + mkdir -p "$ResourcesDir" +fi diff --git a/patches/mac/OneShot_template.app/Contents/Info.plist b/patches/mac/OneShot_template.app/Contents/Info.plist deleted file mode 100644 index c244a5a..0000000 --- a/patches/mac/OneShot_template.app/Contents/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleName - OneShot - CFBundleDisplayName - OneShot - CFBundleGetInfoString - You only have one shot. - CFBundleIdentifier - queengooborg.oneshot-game.osx - CFBundleExecutable - oneshot.sh - CFBundleIconFile - icon.icns - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleVersion - macOS Port v.0.3.1 (OneShot Solstice Update) - CFBundleShortVersionString - 0.3.1 - LSApplicationCategoryType - public.app-category.games - LSMinimumSystemVersion - 10.7 - LSBackgroundOnly - 0 - NSHumanReadableCopyright - Copyright © 2017, OneShot team, all rights reserved. View CREDITS.txt for more. Ported for macOS by Vinyl Darkscratch. - NSHighResolutionCapable - False - - diff --git a/patches/mac/OneShot_template.app/Contents/Resources/icon.icns b/patches/mac/OneShot_template.app/Contents/Resources/icon.icns deleted file mode 100644 index a41899b..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/icon.icns and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libSDL2-2.0.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libSDL2-2.0.0.dylib deleted file mode 100755 index d2336c1..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libSDL2-2.0.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libSDL2_image-2.0.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libSDL2_image-2.0.0.dylib deleted file mode 100755 index ea28b5b..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libSDL2_image-2.0.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libSDL2_ttf-2.0.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libSDL2_ttf-2.0.0.dylib deleted file mode 100755 index 23e8d59..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libSDL2_ttf-2.0.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libSDL_sound-1.0.1.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libSDL_sound-1.0.1.dylib deleted file mode 100755 index fdac979..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libSDL_sound-1.0.1.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libboost_program_options-mt.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libboost_program_options-mt.dylib deleted file mode 100755 index 92a0e63..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libboost_program_options-mt.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libfreetype.6.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libfreetype.6.dylib deleted file mode 100755 index 43fe827..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libfreetype.6.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libogg.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libogg.0.dylib deleted file mode 100755 index 1ebd92e..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libogg.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libphysfs.1.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libphysfs.1.dylib deleted file mode 100755 index 9e42def..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libphysfs.1.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libpixman-1.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libpixman-1.0.dylib deleted file mode 100755 index b8e45f5..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libpixman-1.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libpng.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libpng.dylib deleted file mode 100755 index be28cfa..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libpng.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libruby.2.2.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libruby.2.2.0.dylib deleted file mode 100755 index da25e58..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libruby.2.2.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libsigc-2.0.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libsigc-2.0.0.dylib deleted file mode 100755 index a4c77ee..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libsigc-2.0.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libvorbis.0.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libvorbis.0.dylib deleted file mode 100755 index c81b3ce..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libvorbis.0.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libvorbisfile.3.dylib b/patches/mac/OneShot_template.app/Contents/Resources/libvorbisfile.3.dylib deleted file mode 100755 index 5d12c84..0000000 Binary files a/patches/mac/OneShot_template.app/Contents/Resources/libvorbisfile.3.dylib and /dev/null differ diff --git a/patches/mac/OneShot_template.app/Contents/Resources/steam_appid.txt b/patches/mac/OneShot_template.app/Contents/Resources/steam_appid.txt deleted file mode 100644 index 6e91fb8..0000000 --- a/patches/mac/OneShot_template.app/Contents/Resources/steam_appid.txt +++ /dev/null @@ -1 +0,0 @@ -420530 diff --git a/patches/mac/OneShot_template.app/Contents/Resources/libsteam_api.dylib b/patches/mac/libsteam_api.dylib similarity index 100% rename from patches/mac/OneShot_template.app/Contents/Resources/libsteam_api.dylib rename to patches/mac/libsteam_api.dylib diff --git a/patches/mac/OneShot_template.app/Contents/MacOS/oneshot.sh b/patches/mac/oneshot.sh similarity index 100% rename from patches/mac/OneShot_template.app/Contents/MacOS/oneshot.sh rename to patches/mac/oneshot.sh diff --git a/patches/mac/OneShot_template.app/Contents/Resources/steamshim b/patches/mac/steamshim similarity index 100% rename from patches/mac/OneShot_template.app/Contents/Resources/steamshim rename to patches/mac/steamshim diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 5afbdf2..add0d62 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -402,8 +402,8 @@ struct CacheEnumData } }; -static void cacheEnumCB(void *d, const char *origdir, - const char *fname) +static PHYSFS_EnumerateCallbackResult +cacheEnumCB(void *d, const char *origdir, const char *fname) { CacheEnumData &data = *static_cast(d); char fullPath[512]; @@ -430,7 +430,7 @@ static void cacheEnumCB(void *d, const char *origdir, /* Iterate over its contents */ data.fileLists.push(&list); - PHYSFS_enumerateFilesCallback(fullPath, cacheEnumCB, d); + PHYSFS_enumerate(fullPath, cacheEnumCB, d); data.fileLists.pop(); } else @@ -445,13 +445,15 @@ static void cacheEnumCB(void *d, const char *origdir, /* Add the lower -> mixed mapping of the file's full path */ data.p->pathCache.insert(lowerCase, mixedCase); } + + return PHYSFS_ENUM_OK; } void FileSystem::createPathCache() { CacheEnumData data(p); data.fileLists.push(&p->fileLists[""]); - PHYSFS_enumerateFilesCallback("", cacheEnumCB, &data); + PHYSFS_enumerate("", cacheEnumCB, &data); p->havePathCache = true; } @@ -462,8 +464,8 @@ struct FontSetsCBData SharedFontState *sfs; }; -static void fontSetEnumCB(void *data, const char *, - const char *fname) +static PHYSFS_EnumerateCallbackResult +fontSetEnumCB(void *data, const char *, const char *fname) { FontSetsCBData *d = static_cast(data); @@ -471,7 +473,7 @@ static void fontSetEnumCB(void *data, const char *, const char *ext = findExt(fname); if (!ext) - return; + return PHYSFS_ENUM_STOP; char lowExt[8]; size_t i; @@ -481,7 +483,7 @@ static void fontSetEnumCB(void *data, const char *, lowExt[i] = '\0'; if (strcmp(lowExt, "ttf") && strcmp(lowExt, "otf") && strcmp(lowExt, "ttc")) - return; + return PHYSFS_ENUM_STOP; char filename[512]; snprintf(filename, sizeof(filename), "Fonts/%s", fname); @@ -489,7 +491,7 @@ static void fontSetEnumCB(void *data, const char *, PHYSFS_File *handle = PHYSFS_openRead(filename); if (!handle) - return; + return PHYSFS_ENUM_ERROR; SDL_RWops ops; initReadOps(handle, ops, false); @@ -497,13 +499,15 @@ static void fontSetEnumCB(void *data, const char *, d->sfs->initFontSetCB(ops, filename); SDL_RWclose(&ops); + + return PHYSFS_ENUM_OK; } void FileSystem::initFontSets(SharedFontState &sfs) { FontSetsCBData d = { p, &sfs }; - PHYSFS_enumerateFilesCallback("Fonts", fontSetEnumCB, &d); + PHYSFS_enumerate("Fonts", fontSetEnumCB, &d); } struct OpenReadEnumData @@ -536,19 +540,19 @@ struct OpenReadEnumData {} }; -static void openReadEnumCB(void *d, const char *dirpath, - const char *filename) +static PHYSFS_EnumerateCallbackResult +openReadEnumCB(void *d, const char *dirpath, const char *filename) { OpenReadEnumData &data = *static_cast(d); char buffer[512]; const char *fullPath; if (data.stopSearching) - return; + return PHYSFS_ENUM_STOP; /* If there's not even a partial match, continue searching */ if (strncmp(filename, data.filename, data.filenameN) != 0) - return; + return PHYSFS_ENUM_OK; if (!*dirpath) { @@ -566,7 +570,7 @@ static void openReadEnumCB(void *d, const char *dirpath, * of the extension), or up to a following '\0' (full match), we've * found our file */ if (last != '.' && last != '\0') - return; + return PHYSFS_ENUM_STOP; /* If the path cache is active, translate from lower case * to mixed case path */ @@ -581,9 +585,9 @@ static void openReadEnumCB(void *d, const char *dirpath, * be a deeper rooted problem somewhere within PhysFS. * Just abort alltogether. */ data.stopSearching = true; - data.physfsError = PHYSFS_getLastError(); + data.physfsError = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); - return; + return PHYSFS_ENUM_ERROR; } initReadOps(phys, data.ops, false); @@ -594,6 +598,7 @@ static void openReadEnumCB(void *d, const char *dirpath, data.stopSearching = true; ++data.matchCount; + return PHYSFS_ENUM_OK; } void FileSystem::openRead(OpenHandler &handler, const char *filename) @@ -639,7 +644,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename) } else { - PHYSFS_enumerateFilesCallback(dir, openReadEnumCB, &data); + PHYSFS_enumerate(dir, openReadEnumCB, &data); } if (data.physfsError) diff --git a/src/rgssad.cpp b/src/rgssad.cpp index 17e8417..4b51472 100644 --- a/src/rgssad.cpp +++ b/src/rgssad.cpp @@ -331,14 +331,16 @@ verifyHeader(PHYSFS_Io *io, char version) } static void* -RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite) +RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed) { if (forWrite) - return 0; + return NULL; /* Version 1 */ if (!verifyHeader(io, 1)) - return 0; + return NULL; + else + *claimed = 1; RGSS_archiveData *data = new RGSS_archiveData; data->archiveIo = io; @@ -389,9 +391,9 @@ RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite) return data; } -static void +static PHYSFS_EnumerateCallbackResult RGSS_enumerateFiles(void *opaque, const char *dirname, - PHYSFS_EnumFilesCallback cb, + PHYSFS_EnumerateCallback cb, const char *origdir, void *callbackdata) { RGSS_archiveData *data = static_cast(opaque); @@ -399,13 +401,15 @@ RGSS_enumerateFiles(void *opaque, const char *dirname, std::string _dirname(dirname); if (!data->dirHash.contains(_dirname)) - return; + return PHYSFS_ENUM_STOP; const BoostSet &entries = data->dirHash[_dirname]; BoostSet::const_iterator iter; for (iter = entries.cbegin(); iter != entries.cend(); ++iter) cb(callbackdata, origdir, iter->c_str()); + + return PHYSFS_ENUM_OK; } static PHYSFS_Io* @@ -536,19 +540,21 @@ readUint32AndXor(PHYSFS_Io *io, uint32_t &result, uint32_t key) } static void* -RGSS3_openArchive(PHYSFS_Io *io, const char *, int forWrite) +RGSS3_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed) { if (forWrite) - return 0; + return NULL; /* Version 3 */ if (!verifyHeader(io, 3)) - return 0; + return NULL; + else + *claimed = 1; uint32_t baseMagic; if (!readUint32(io, baseMagic)) - return 0; + return NULL; baseMagic = (baseMagic * 9) + 3; @@ -605,7 +611,7 @@ RGSS3_openArchive(PHYSFS_Io *io, const char *, int forWrite) error: delete data; - return 0; + return NULL; } return data;