1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

Ports: Update Super-Mario's patches to use git patches

This commit is contained in:
Ali Mohammad Pur 2022-05-16 19:21:28 +04:30 committed by Ali Mohammad Pur
parent 6eb071cd0d
commit cbd76e0531
7 changed files with 117 additions and 41 deletions

View file

@ -0,0 +1,37 @@
From c7869092a313c1550a34675d1c9faebc1468ef1e Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gbeutner@serenityos.org>
Date: Fri, 4 Jun 2021 00:29:36 +0200
Subject: [PATCH 1/5] chdir() to the installed directory before execution
The game expects its assets in the current directory, but we install
those to /opt/Super_Mario, so chdir() there at program startup to avoid
crashing.
---
src/main.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 040eb56..ca14d6f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,10 +1,15 @@
#include "header.h"
#include "Core.h"
+#include <unistd.h>
int main(int argc, const char* argv[]) {
- CCore oCore;
+ chdir("/opt/Super_Mario");
- oCore.mainLoop();
+ {
+ CCore oCore;
+
+ oCore.mainLoop();
+ }
return 0;
}
--
2.36.1

View file

@ -1,3 +1,13 @@
From 4a8e24e824e0de7557ae15414d30a1b49d14ce0d Mon Sep 17 00:00:00 2001
From: Manuel Palenzuela <manuelpalenzuelamerino@gmail.com>
Date: Sun, 4 Apr 2021 00:41:48 +0200
Subject: [PATCH 2/5] Disable graphics acceleration
Disables SDL2 hardware acceleration as we don't support that.
---
src/Core.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Core.cpp b/src/Core.cpp
index c04581b..f0c0308 100644
--- a/src/Core.cpp
@ -18,3 +28,6 @@ index c04581b..f0c0308 100644
-}
\ No newline at end of file
+}
--
2.36.1

View file

@ -1,3 +1,13 @@
From a780c6ee085103b0d3ffa39e0162ddd1848068bb Mon Sep 17 00:00:00 2001
From: Manuel Palenzuela <manuelpalenzuelamerino@gmail.com>
Date: Sun, 4 Apr 2021 00:41:48 +0200
Subject: [PATCH 3/5] Use pkgconfig instead of find_package() to look for
dependencies
---
CMakeLists.txt | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 616d876..d1aa020 100644
--- a/CMakeLists.txt
@ -28,3 +38,6 @@ index 616d876..d1aa020 100644
+target_link_libraries(uMario ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${SDL2_MIXER_LIBRARIES}-lSDL2_mixer -lpthread -lm -lgfx -lgui -lipc -lcore)
install(TARGETS uMario RUNTIME DESTINATION ${BIN_DIR})
--
2.36.1

View file

@ -1,3 +1,13 @@
From 452f2ace4ba87e7d2e07a46adf4abdfb8970317d Mon Sep 17 00:00:00 2001
From: Manuel Palenzuela <manuelpalenzuelamerino@gmail.com>
Date: Sun, 4 Apr 2021 00:41:48 +0200
Subject: [PATCH 4/5] Fix a header include path
---
src/FireBall.cpp | 4 ++--
src/Map.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/FireBall.cpp b/src/FireBall.cpp
index 6f3eacc..6f5eade 100644
--- a/src/FireBall.cpp
@ -35,3 +45,6 @@ index b812b49..f6abbb9 100644
-#endif
\ No newline at end of file
+#endif
--
2.36.1

View file

@ -1,7 +1,17 @@
diff -Naur Super-Mario-Clone-Cpp-master/src/CFG.cpp Super-Mario-Clone-Cpp-master.serenity/src/CFG.cpp
--- Super-Mario-Clone-Cpp-master/src/CFG.cpp 2021-04-29 07:39:18.688987494 +0200
+++ Super-Mario-Clone-Cpp-master.serenity/src/CFG.cpp 2021-04-29 07:41:19.464330908 +0200
@@ -14,11 +13,11 @@
From e9d588e7519a15003ded6b68ed7fa10dbe0f8f11 Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gbeutner@serenityos.org>
Date: Thu, 29 Apr 2021 07:36:37 +0200
Subject: [PATCH 5/5] Remove global static initializers
---
src/CFG.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/CFG.cpp b/src/CFG.cpp
index 90595a5..20dd6ea 100644
--- a/src/CFG.cpp
+++ b/src/CFG.cpp
@@ -13,11 +13,11 @@ CCFG::~CCFG(void) {
int CCFG::GAME_HEIGHT = 448;
int CCFG::GAME_WIDTH = 800;
@ -17,7 +27,7 @@ diff -Naur Super-Mario-Clone-Cpp-master/src/CFG.cpp Super-Mario-Clone-Cpp-master
bool CCFG::keySpace = false;
int CCFG::keyIDA = 0;
@@ -30,18 +29,26 @@
@@ -29,18 +29,26 @@ int CCFG::keyIDShift = 0;
bool CCFG::canMoveBackward = true;
Text* CCFG::getText() {
@ -44,3 +54,6 @@ diff -Naur Super-Mario-Clone-Cpp-master/src/CFG.cpp Super-Mario-Clone-Cpp-master
return tSMBLOGO;
}
--
2.36.1

View file

@ -1,23 +1,31 @@
# Patches for Super-Mario
# Patches for Super-Mario on SerenityOS
## `cwd.patch`
## `0001-chdir-to-the-installed-directory-before-execution.patch`
`chdir()`s to the installed directory before execution.
chdir() to the installed directory before execution
## `gcc-11-static-initializers.patch`
The game expects its assets in the current directory, but we install
those to /opt/Super_Mario, so chdir() there at program startup to avoid
crashing.
Removes global static initializers.
Presumably not needed anymore.
## `0002-Disable-graphics-acceleration.patch`
## `fix_cmakelists.patch`
Use `FindPkgConfig` instead of `find_package()` to locate SDL2.
## `fix_fireball_header.patch`
Fixes a header include name.
## `disable_graphic_acceleration.patch`
Disable graphics acceleration
Disables SDL2 hardware acceleration as we don't support that.
## `0003-Use-pkgconfig-instead-of-find_package-to-look-for-de.patch`
Use pkgconfig instead of find_package() to look for dependencies
## `0004-Fix-a-header-include-path.patch`
Fix a header include path
## `0005-Remove-global-static-initializers.patch`
Remove global static initializers

View file

@ -1,21 +0,0 @@
diff -Naur Super-Mario-Clone-Cpp-master/src/main.cpp Super-Mario-Clone-Cpp-master.serenity/src/main.cpp
--- Super-Mario-Clone-Cpp-master/src/main.cpp 2019-08-01 15:39:15.000000000 +0200
+++ Super-Mario-Clone-Cpp-master.serenity/src/main.cpp 2021-06-03 23:54:26.881221759 +0200
@@ -1,10 +1,15 @@
#include "header.h"
#include "Core.h"
+#include <unistd.h>
int main(int argc, const char* argv[]) {
- CCore oCore;
+ chdir("/opt/Super_Mario");
- oCore.mainLoop();
+ {
+ CCore oCore;
+
+ oCore.mainLoop();
+ }
return 0;
}