mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:57:47 +00:00
Ports: Add VVVVVV port
Co-Authored-By: Tim Schumacher <timschumi@gmx.de> (thanks for the line ending and assert() troubleshooting)
This commit is contained in:
parent
2a45d30302
commit
51315c0b1d
6 changed files with 204 additions and 0 deletions
25
Ports/VVVVVV/patches/0001-Change-C-standard-to-C99.patch
Normal file
25
Ports/VVVVVV/patches/0001-Change-C-standard-to-C99.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
|
||||
Date: Thu, 9 Jun 2022 00:19:08 +0300
|
||||
Subject: [PATCH] Change C standard to C99
|
||||
|
||||
The originally-set C90 doesn't support the `inline` keyword, causing
|
||||
weird compile errors because isalnum() and other functions under
|
||||
ctype.h are actually #define'd as inline.
|
||||
---
|
||||
desktop_version/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt
|
||||
index 7405c12..49d44bb 100644
|
||||
--- a/desktop_version/CMakeLists.txt
|
||||
+++ b/desktop_version/CMakeLists.txt
|
||||
@@ -27,7 +27,7 @@ endif()
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.1.3")
|
||||
message(WARNING "Your CMake version is too old; set -std=c90 -std=c++98 yourself!")
|
||||
else()
|
||||
- set(CMAKE_C_STANDARD 90)
|
||||
+ set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 98)
|
|
@ -0,0 +1,54 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
|
||||
Date: Fri, 17 Jun 2022 19:26:30 +0300
|
||||
Subject: [PATCH] Add SerenityOS in platform-specific defines
|
||||
|
||||
---
|
||||
desktop_version/src/FileSystemUtils.cpp | 6 +++---
|
||||
third_party/tinyxml2/tinyxml2.cpp | 2 +-
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp
|
||||
index 833a3de..22372f2 100644
|
||||
--- a/desktop_version/src/FileSystemUtils.cpp
|
||||
+++ b/desktop_version/src/FileSystemUtils.cpp
|
||||
@@ -26,7 +26,7 @@ int mkdir(char* path, int mode)
|
||||
return CreateDirectoryW(utf16_path, NULL);
|
||||
}
|
||||
#define VNEEDS_MIGRATION (mkdirResult != 0)
|
||||
-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
|
||||
+#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__) || defined (__serenity__)
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
@@ -1005,7 +1005,7 @@ static void PLATFORM_migrateSaveData(char* output)
|
||||
char oldLocation[MAX_PATH];
|
||||
char newLocation[MAX_PATH];
|
||||
char oldDirectory[MAX_PATH];
|
||||
-#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
|
||||
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__) || defined (__serenity__)
|
||||
DIR *dir = NULL;
|
||||
struct dirent *de = NULL;
|
||||
DIR *subDir = NULL;
|
||||
@@ -1018,7 +1018,7 @@ static void PLATFORM_migrateSaveData(char* output)
|
||||
return;
|
||||
}
|
||||
const char oldPath[] =
|
||||
- #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
|
||||
+ #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__) || defined (__serenity__)
|
||||
"/.vvvvvv/";
|
||||
#elif defined(__APPLE__)
|
||||
"/Documents/VVVVVV/";
|
||||
diff --git a/third_party/tinyxml2/tinyxml2.cpp b/third_party/tinyxml2/tinyxml2.cpp
|
||||
index 1606ce0..d78c6ba 100644
|
||||
--- a/third_party/tinyxml2/tinyxml2.cpp
|
||||
+++ b/third_party/tinyxml2/tinyxml2.cpp
|
||||
@@ -103,7 +103,7 @@ distribution.
|
||||
#if defined(_WIN64)
|
||||
#define TIXML_FSEEK _fseeki64
|
||||
#define TIXML_FTELL _ftelli64
|
||||
-#elif defined(__APPLE__) || (__FreeBSD__) || (__OpenBSD__)
|
||||
+#elif defined(__APPLE__) || (__FreeBSD__) || (__OpenBSD__) || (__serenity__)
|
||||
#define TIXML_FSEEK fseeko
|
||||
#define TIXML_FTELL ftello
|
||||
#elif defined(__unix__) && defined(__x86_64__)
|
|
@ -0,0 +1,62 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
|
||||
Date: Fri, 17 Jun 2022 19:29:00 +0300
|
||||
Subject: [PATCH] Defer sound system initialization until main()
|
||||
|
||||
The original VVVVVV source code initializes the sound subsystem
|
||||
during global variable initialization. Technically speaking, the
|
||||
order of initialization of global variables is unspecified. This
|
||||
results in SerenityOS's dynamic linker to call Mix_OpenAudio()
|
||||
(which uses EventLoop under the hood) before all global variable
|
||||
initializers finish executing, resulting in an inconsistent state
|
||||
that causes assertion failure.
|
||||
|
||||
This patch moves initialization of the culprit sound system to
|
||||
a separate method, which is called first thing inside main(), thus
|
||||
preventing the setup from happening during musicclass's initialization
|
||||
in the global scope, which causes the aforementioned crash.
|
||||
---
|
||||
desktop_version/src/SoundSystem.cpp | 4 ++++
|
||||
desktop_version/src/SoundSystem.h | 1 +
|
||||
desktop_version/src/main.cpp | 1 +
|
||||
3 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/desktop_version/src/SoundSystem.cpp b/desktop_version/src/SoundSystem.cpp
|
||||
index 8c5f962..056d946 100644
|
||||
--- a/desktop_version/src/SoundSystem.cpp
|
||||
+++ b/desktop_version/src/SoundSystem.cpp
|
||||
@@ -52,6 +52,10 @@ SoundTrack::SoundTrack(const char* fileName)
|
||||
}
|
||||
|
||||
SoundSystem::SoundSystem(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void SoundSystem::initialize(void)
|
||||
{
|
||||
int audio_rate = 44100;
|
||||
Uint16 audio_format = AUDIO_S16SYS;
|
||||
diff --git a/desktop_version/src/SoundSystem.h b/desktop_version/src/SoundSystem.h
|
||||
index 0cf3b84..f88e15b 100644
|
||||
--- a/desktop_version/src/SoundSystem.h
|
||||
+++ b/desktop_version/src/SoundSystem.h
|
||||
@@ -23,6 +23,7 @@ class SoundSystem
|
||||
{
|
||||
public:
|
||||
SoundSystem(void);
|
||||
+ void initialize(void);
|
||||
};
|
||||
|
||||
#endif /* SOUNDSYSTEM_H */
|
||||
diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp
|
||||
index b97270f..49bd853 100644
|
||||
--- a/desktop_version/src/main.cpp
|
||||
+++ b/desktop_version/src/main.cpp
|
||||
@@ -341,6 +341,7 @@ static void cleanup(void);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
+ music.soundSystem.initialize();
|
||||
char* baseDir = NULL;
|
||||
char* assetsPath = NULL;
|
||||
|
32
Ports/VVVVVV/patches/ReadMe.md
Normal file
32
Ports/VVVVVV/patches/ReadMe.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Patches for VVVVVV on SerenityOS
|
||||
|
||||
## `0001-Change-C-standard-to-C99.patch`
|
||||
|
||||
Change C standard to C99
|
||||
|
||||
The originally-set C90 doesn't support the `inline` keyword, causing
|
||||
weird compile errors because isalnum() and other functions under
|
||||
ctype.h are actually #define'd as inline.
|
||||
|
||||
## `0002-Add-SerenityOS-in-platform-specific-defines.patch`
|
||||
|
||||
Add SerenityOS in platform-specific defines
|
||||
|
||||
|
||||
## `0003-Defer-sound-system-initialization-until-main.patch`
|
||||
|
||||
Defer sound system initialization until main()
|
||||
|
||||
The original VVVVVV source code initializes the sound subsystem
|
||||
during global variable initialization. Technically speaking, the
|
||||
order of initialization of global variables is unspecified. This
|
||||
results in SerenityOS's dynamic linker to call Mix_OpenAudio()
|
||||
(which uses EventLoop under the hood) before all global variable
|
||||
initializers finish executing, resulting in an inconsistent state
|
||||
that causes assertion failure.
|
||||
|
||||
This patch moves initialization of the culprit sound system to
|
||||
a separate method, which is called first thing inside main(), thus
|
||||
preventing the setup from happening during musicclass's initialization
|
||||
in the global scope, which causes the aforementioned crash.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue