Skip to content

Commit

Permalink
Merge pull request #3 from Sappharad/foreve
Browse files Browse the repository at this point in the history
Mac autobuild
  • Loading branch information
ElspethThePict authored Nov 19, 2023
2 parents 531e469 + 45ad7cc commit 8b6e668
Show file tree
Hide file tree
Showing 21 changed files with 1,867 additions and 1,031 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,40 @@ jobs:
with:
name: v4-linux
path: bin

v4-macOS:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: recursive
- name: Download libogg and libvorbis for easier includes
run: |
curl "https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.5.zip" --output "libogg.zip"
unzip libogg.zip -d ./dependencies/mac/
mv ./dependencies/mac/libogg-1.3.5 ./dependencies/mac/libogg
curl "https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.zip" --output "libvorbis.zip"
unzip libvorbis.zip -d ./dependencies/mac/
mv ./dependencies/mac/libvorbis-1.3.7 ./dependencies/mac/libvorbis
- name: Download SDL2
run: |
curl "https://libsdl.org/release/SDL2-2.0.14.zip" --output "SDL2.zip"
unzip SDL2.zip -d ./dependencies/mac/
mv ./dependencies/mac/SDL2-2.0.14 ./dependencies/mac/SDL2
- name: Generate Vorbis headers
working-directory: ./dependencies/mac/libogg/
run: |
./configure
- name: Build RSDKv4
run: |
xcodebuild -project RSDKv4.xcodeproj -scheme RSDKv4 DSTROOT="./build" archive
- name: Zip the app ourselves (Important step to retain symlinks)
run: |
cd ./build/Applications/
zip -r RSDKv4.zip ./RSDKv4.app/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: v4-mac
path: build/Applications/RSDKv4.zip
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,6 @@ android/local.properties
# Linux
.flatpak-builder
flatpak/*.apk
build-dir
build-dir
dependencies/mac/OggAndVorbis.xcodeproj/project.xcworkspace/xcuserdata
dependencies/mac/SDL2
782 changes: 508 additions & 274 deletions RSDKv4.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 1 addition & 21 deletions RSDKv4.xcodeproj/xcshareddata/xcschemes/RSDKv4.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C962191825898A9300B47AB3"
BlueprintIdentifier = "9E1BEFBA29FCABB100A1C6D8"
BuildableName = "RSDKv4.app"
BlueprintName = "RSDKv4"
ReferencedContainer = "container:RSDKv4.xcodeproj">
Expand All @@ -40,33 +40,13 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C962191825898A9300B47AB3"
BuildableName = "RSDKv4.app"
BlueprintName = "RSDKv4"
ReferencedContainer = "container:RSDKv4.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C962191825898A9300B47AB3"
BuildableName = "RSDKv4.app"
BlueprintName = "RSDKv4"
ReferencedContainer = "container:RSDKv4.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
2 changes: 0 additions & 2 deletions RSDKv4/Ini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ void IniParser::Write(const char *filename, bool addPath)
sprintf(pathBuffer, "%s/%s", getResourcesPath(), filename);
else
sprintf(pathBuffer, "%s", filename);
#elif RETRO_PLATFORM == RETRO_OSX
sprintf(pathBuffer, "%s/%s", gamePath, filename);
#else
sprintf(pathBuffer, "%s", filename);
#endif
Expand Down
6 changes: 3 additions & 3 deletions RSDKv4/ModAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void ScanModFolder(ModInfo *info)
};
int tokenPos = -1;
for (int i = 0; i < 4; ++i) {
tokenPos = FindStringToken(modBuf, folderTest[i], 1);
tokenPos = FindLastStringToken(modBuf, folderTest[i]);
if (tokenPos >= 0)
break;
}
Expand Down Expand Up @@ -314,7 +314,7 @@ void ScanModFolder(ModInfo *info)
};
int tokenPos = -1;
for (int i = 0; i < 4; ++i) {
tokenPos = FindStringToken(modBuf, folderTest[i], 1);
tokenPos = FindLastStringToken(modBuf, folderTest[i]);
if (tokenPos >= 0)
break;
}
Expand Down Expand Up @@ -362,7 +362,7 @@ void ScanModFolder(ModInfo *info)
};
int tokenPos = -1;
for (int i = 0; i < 4; ++i) {
tokenPos = FindStringToken(modBuf, folderTest[i], 1);
tokenPos = FindLastStringToken(modBuf, folderTest[i]);
if (tokenPos >= 0)
break;
}
Expand Down
4 changes: 1 addition & 3 deletions RSDKv4/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ bool CheckRSDKFile(const char *filePath)

char filePathBuffer[0x100];
#if RETRO_PLATFORM == RETRO_OSX
char pathBuf[0x100];
sprintf(pathBuf, "%s/%s", gamePath, filePathBuffer);
sprintf(filePathBuffer, "%s", pathBuf);
sprintf(filePathBuffer, "%s/%s", gamePath, filePath);
#else
sprintf(filePathBuffer, "%s", filePath);
#endif
Expand Down
28 changes: 28 additions & 0 deletions RSDKv4/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,34 @@ int FindStringToken(const char *string, const char *token, char stopID)
return -1;
}

int FindLastStringToken(const char *string, const char *token)
{
int tokenCharID = 0;
bool tokenMatch = true;
int stringCharID = 0;
int foundTokenID = 0;
int lastResult = -1;

while (string[stringCharID]) {
tokenCharID = 0;
tokenMatch = true;
while (token[tokenCharID]) {
if (!string[tokenCharID + stringCharID])
return lastResult;

if (string[tokenCharID + stringCharID] != token[tokenCharID])
tokenMatch = false;

++tokenCharID;
}
if (tokenMatch)
lastResult = stringCharID;

++stringCharID;
}
return lastResult;
}

int FindStringTokenUnicode(const ushort *string, const ushort *token, char stopID)
{
int tokenCharID = 0;
Expand Down
1 change: 1 addition & 0 deletions RSDKv4/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ inline int StrLength(const char *string)
#endif
}
int FindStringToken(const char *string, const char *token, char stopID);
int FindLastStringToken(const char *string, const char *token);

inline void StrCopyW(ushort *dest, const ushort *src)
{
Expand Down
12 changes: 7 additions & 5 deletions RSDKv4/Userdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ void InitUserdata()
#endif

#if RETRO_PLATFORM == RETRO_OSX
sprintf(gamePath, "%s/RSDKv4", getResourcesPath());
sprintf(modsPath, "%s/RSDKv4/", getResourcesPath());
char macBuffer[0x100];
getResourcesPath(macBuffer, sizeof(macBuffer));
snprintf(gamePath, sizeof(macBuffer), "%s/", macBuffer);
snprintf(modsPath, sizeof(macBuffer), "%s/", macBuffer);

mkdir(gamePath, 0777);
#elif RETRO_PLATFORM == RETRO_ANDROID
Expand Down Expand Up @@ -258,7 +260,7 @@ void InitUserdata()
ini.SetBool("Dev", "UseHQModes", Engine.useHQModes = true);
//ini.SetString("Dev", "DataFile", (char *)"ForceData.rsdk");

#if RETRO_PLATFORM == RETRO_ANDROID
#if RETRO_PLATFORM == RETRO_ANDROID || RETRO_PLATFORM == RETRO_OSX
StrCopy(Engine.dataFile[0], "Data.rsdk");
#else
StrCopy(Engine.dataFile[0], "ForceData.rsdk");
Expand Down Expand Up @@ -406,7 +408,7 @@ void InitUserdata()
Engine.startStage_Game = Engine.startStage;

//if (!ini.GetString("Dev", "DataFile", Engine.dataFile[0]))
#if RETRO_PLATFORM == RETRO_ANDROID
#if RETRO_PLATFORM == RETRO_ANDROID || RETRO_PLATFORM == RETRO_OSX
StrCopy(Engine.dataFile[0], "Data.rsdk");
#else
StrCopy(Engine.dataFile[0], "ForceData.rsdk");
Expand Down Expand Up @@ -1324,4 +1326,4 @@ void ApplyWindowChanges()
}


#endif
#endif
Loading

0 comments on commit 8b6e668

Please sign in to comment.