summaryrefslogtreecommitdiff
path: root/Ports
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2023-04-25 19:05:39 +0200
committerSam Atkins <atkinssj@gmail.com>2023-04-26 09:37:16 +0100
commitbff5137cb4c69b1217dab26defda7cd4ff8655c0 (patch)
tree0fc0b75b04dfce12e4b17610dd06a177b4682c0b /Ports
parent7465362fe792a14066ff6558a2bf72d9194f6375 (diff)
downloadserenity-bff5137cb4c69b1217dab26defda7cd4ff8655c0.zip
Ports/gltron: Exit the game when SDL_QUIT is received
Diffstat (limited to 'Ports')
-rw-r--r--Ports/gltron/patches/0004-System-Make-sure-to-exit-the-loop-on-receiving-SDL_Q.patch28
-rw-r--r--Ports/gltron/patches/ReadMe.md11
2 files changed, 39 insertions, 0 deletions
diff --git a/Ports/gltron/patches/0004-System-Make-sure-to-exit-the-loop-on-receiving-SDL_Q.patch b/Ports/gltron/patches/0004-System-Make-sure-to-exit-the-loop-on-receiving-SDL_Q.patch
new file mode 100644
index 0000000000..825c949b1c
--- /dev/null
+++ b/Ports/gltron/patches/0004-System-Make-sure-to-exit-the-loop-on-receiving-SDL_Q.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jelle Raaijmakers <jelle@gmta.nl>
+Date: Tue, 25 Apr 2023 17:53:50 +0200
+Subject: [PATCH] System: Make sure to exit the loop on receiving SDL_QUIT
+
+This is fixed in more modern adaptations, as can be seen here:
+
+https://github.com/laanwj/gltron/blob/336dbbb75afe0aed1d9faaa5bbaa867b2b13d10b/nebu/base/system.c#L135
+
+Since we work with the original source material, we better patch this
+ourselves.
+---
+ nebu/base/system.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/nebu/base/system.c b/nebu/base/system.c
+index 07a75e7b069a73a203950a4f0d0a8a345f76518a..794848e91cb22d1099d5a61e2e01974dde69861e 100644
+--- a/nebu/base/system.c
++++ b/nebu/base/system.c
+@@ -37,6 +37,8 @@ int SystemMainLoop() {
+ break;
+ case SDL_QUIT:
+ SystemExit();
++ // status 10 is the only way to break free from main.lua
++ SystemExitLoop(10);
+ break;
+ default:
+ /* ignore event */
diff --git a/Ports/gltron/patches/ReadMe.md b/Ports/gltron/patches/ReadMe.md
index 0581378ad3..edbc3f2eea 100644
--- a/Ports/gltron/patches/ReadMe.md
+++ b/Ports/gltron/patches/ReadMe.md
@@ -17,3 +17,14 @@ Build: Fix `char*` vs. `const char*` arguments
These arguments are of the wrong constness, which will trip our
compiler.
+## `0004-System-Make-sure-to-exit-the-loop-on-receiving-SDL_Q.patch`
+
+System: Make sure to exit the loop on receiving SDL_QUIT
+
+This is fixed in more modern adaptations, as can be seen here:
+
+https://github.com/laanwj/gltron/blob/336dbbb75afe0aed1d9faaa5bbaa867b2b13d10b/nebu/base/system.c#L135
+
+Since we work with the original source material, we better patch this
+ourselves.
+