mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
Implement cmake's BundleUtilities
This commit is contained in:
parent
379718f5ff
commit
dba5f7cee4
26 changed files with 108 additions and 76 deletions
22
Info.plist
Normal file
22
Info.plist
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?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>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>OneShot</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>NOTE</key>
|
||||
<string>This file was generated by Qt/QMake.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
10
mkxp.pro
10
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 {
|
||||
|
|
|
|||
17
patches/mac/CreateBundle.sh
Executable file
17
patches/mac/CreateBundle.sh
Executable file
|
|
@ -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
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?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>CFBundleName</key>
|
||||
<string>OneShot</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>OneShot</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>You only have one shot.</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>queengooborg.oneshot-game.osx</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>oneshot.sh</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>macOS Port v.0.3.1 (OneShot Solstice Update)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.7</string>
|
||||
<key>LSBackgroundOnly</key>
|
||||
<string>0</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2017, OneShot team, all rights reserved. View CREDITS.txt for more. Ported for macOS by Vinyl Darkscratch.</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>False</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +0,0 @@
|
|||
420530
|
||||
|
|
@ -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<CacheEnumData*>(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<FontSetsCBData*>(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<OpenReadEnumData*>(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)
|
||||
|
|
|
|||
|
|
@ -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<RGSS_archiveData*>(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<std::string> &entries = data->dirHash[_dirname];
|
||||
|
||||
BoostSet<std::string>::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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue