mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Ports/gltron: Use sdl12-compat instead of SDL2
This commit is contained in:
parent
c98a275931
commit
2fa907b31a
10 changed files with 50 additions and 251 deletions
|
@ -1,28 +1,18 @@
|
||||||
#!/usr/bin/env -S bash ../.port_include.sh
|
#!/usr/bin/env -S bash ../.port_include.sh
|
||||||
port=gltron
|
port='gltron'
|
||||||
useconfigure="true"
|
useconfigure='true'
|
||||||
use_fresh_config_sub=true
|
use_fresh_config_sub='true'
|
||||||
version="0.70"
|
version='0.70'
|
||||||
files="http://mirror.sobukus.de/files/grimoire/games-arcade-2d/gltron-${version}-source.tar.gz gltron-${version}-source.tar.gz e0c8ebb41a18a1f8d7302a9c2cb466f5b1dd63e9a9966c769075e6b6bdad8bb0"
|
files="http://mirror.sobukus.de/files/grimoire/games-arcade-2d/gltron-${version}-source.tar.gz gltron-${version}.tar.gz e0c8ebb41a18a1f8d7302a9c2cb466f5b1dd63e9a9966c769075e6b6bdad8bb0"
|
||||||
auth_type=sha256
|
auth_type='sha256'
|
||||||
depends=("libpng" "SDL2_sound" "SDL2" "zlib")
|
depends=("libpng" "glu" "SDL_sound" "sdl12-compat" "zlib")
|
||||||
configopts=(
|
configopts=(
|
||||||
"--disable-warn"
|
"--disable-warn"
|
||||||
|
"--with-sdl-prefix=${SERENITY_INSTALL_ROOT}/usr/local"
|
||||||
|
"CPPFLAGS=-I${SERENITY_INSTALL_ROOT}/usr/include/LibGL"
|
||||||
|
"LIBS=-lm -lSDL_sound"
|
||||||
)
|
)
|
||||||
|
launcher_name='GLTron'
|
||||||
launcher_name="GLTron"
|
launcher_category='Games'
|
||||||
launcher_category="Games"
|
launcher_command='/usr/local/bin/gltron'
|
||||||
launcher_command="/usr/local/bin/gltron"
|
icon_file='art/default/gltron.png'
|
||||||
icon_file="art/default/gltron.png"
|
|
||||||
|
|
||||||
pre_configure() {
|
|
||||||
export CPPFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/include/LibGL -I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
|
|
||||||
export LIBS="-lSDL2_sound"
|
|
||||||
export SDL_CONFIG="${SERENITY_INSTALL_ROOT}/usr/local/bin/sdl2-config"
|
|
||||||
}
|
|
||||||
|
|
||||||
post_configure() {
|
|
||||||
unset CPPFLAGS
|
|
||||||
unset LIBS
|
|
||||||
unset SDL_CONFIG
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jelle Raaijmakers <jelle@gmta.nl>
|
|
||||||
Date: Mon, 9 May 2022 00:29:43 +0200
|
|
||||||
Subject: [PATCH] Build: Allow `CFLAGS` env var to be set
|
|
||||||
|
|
||||||
---
|
|
||||||
configure | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index 226d00e..05ebf5d 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -2805,7 +2805,7 @@ else
|
|
||||||
RANLIB="$ac_cv_prog_RANLIB"
|
|
||||||
fi
|
|
||||||
|
|
||||||
-CFLAGS="-DSEPARATOR=\"'/'\""
|
|
||||||
+CFLAGS="$CFLAGS -DSEPARATOR=\"'/'\""
|
|
||||||
|
|
||||||
# Check whether --enable-warn or --disable-warn was given.
|
|
||||||
if test "${enable_warn+set}" = set; then
|
|
|
@ -8,7 +8,7 @@ Subject: [PATCH] Build: Replace `-lGL` with `-lgl` to reference our LibGL
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
diff --git a/configure b/configure
|
||||||
index 05ebf5d..10f771f 100755
|
index 226d00e..086139a 100755
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -3130,7 +3130,7 @@ if test "${ac_cv_lib_GL_main+set}" = set; then
|
@@ -3130,7 +3130,7 @@ if test "${ac_cv_lib_GL_main+set}" = set; then
|
|
@ -0,0 +1,26 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
|
||||||
|
Date: Mon, 13 Jun 2022 16:04:43 +0300
|
||||||
|
Subject: [PATCH] Build: Disable nebu using SDL's glext.h constants
|
||||||
|
|
||||||
|
SerenityOS provides glext.h definitions inside GL/gl.h, but the
|
||||||
|
build process thinks that glext.h doesn't exist, therefore it attempts
|
||||||
|
to use SDL's definitions, which leads to a conflict. Therefore, disable
|
||||||
|
use of said definitions.
|
||||||
|
---
|
||||||
|
nebu/include/video/nebu_renderer_gl.h | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/nebu/include/video/nebu_renderer_gl.h b/nebu/include/video/nebu_renderer_gl.h
|
||||||
|
index 64bf0a4..b74e3db 100644
|
||||||
|
--- a/nebu/include/video/nebu_renderer_gl.h
|
||||||
|
+++ b/nebu/include/video/nebu_renderer_gl.h
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
#ifndef NEBU_RENDERER_GL_H
|
||||||
|
#define NEBU_RENDERER_GL_H
|
||||||
|
|
||||||
|
+#define NO_SDL_GLEXT
|
||||||
|
+
|
||||||
|
#include "SDL_opengl.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "video/nebu_quad.h"
|
|
@ -1,43 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jelle Raaijmakers <jelle@gmta.nl>
|
|
||||||
Date: Mon, 9 May 2022 00:36:08 +0200
|
|
||||||
Subject: [PATCH] Scripting: Fix default keybindings
|
|
||||||
|
|
||||||
These constants referred to the wrong keys.
|
|
||||||
---
|
|
||||||
scripts/config.lua | 20 ++++++++++----------
|
|
||||||
1 file changed, 10 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/scripts/config.lua b/scripts/config.lua
|
|
||||||
index 3c9e6d2..4755678 100644
|
|
||||||
--- a/scripts/config.lua
|
|
||||||
+++ b/scripts/config.lua
|
|
||||||
@@ -90,18 +90,18 @@ settings.musicVolume = 0.5
|
|
||||||
|
|
||||||
settings.keys = {
|
|
||||||
{ -- player 1
|
|
||||||
- left = 97, -- lower case 'a'
|
|
||||||
- right = 115, -- lower case 's'
|
|
||||||
- glance_left = 113, -- lower case 'q'
|
|
||||||
- glance_right = 119, -- lower case 'w'
|
|
||||||
- boost = 101, -- lower case 'd'
|
|
||||||
+ left = 65, -- lower case 'a'
|
|
||||||
+ right = 83, -- lower case 's'
|
|
||||||
+ glance_left = 81, -- lower case 'q'
|
|
||||||
+ glance_right = 87, -- lower case 'w'
|
|
||||||
+ boost = 68, -- lower case 'd'
|
|
||||||
},
|
|
||||||
{ -- player 2
|
|
||||||
- left = 106, -- lower case 'j'
|
|
||||||
- right = 107, -- lower case 'k'
|
|
||||||
- glance_left = 117, -- lower case 'u'
|
|
||||||
- glance_right = 105, -- lower case 'i'
|
|
||||||
- boost = 108, -- lower case 'l'
|
|
||||||
+ left = 74, -- lower case 'j'
|
|
||||||
+ right = 75, -- lower case 'k'
|
|
||||||
+ glance_left = 85, -- lower case 'u'
|
|
||||||
+ glance_right = 73, -- lower case 'i'
|
|
||||||
+ boost = 76, -- lower case 'l'
|
|
||||||
},
|
|
||||||
{ -- player 3
|
|
||||||
left = 276, -- cursor left
|
|
|
@ -1,110 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jelle Raaijmakers <jelle@gmta.nl>
|
|
||||||
Date: Mon, 9 May 2022 00:53:48 +0200
|
|
||||||
Subject: [PATCH] SDL: Convert SDL1 to SDL2
|
|
||||||
|
|
||||||
---
|
|
||||||
nebu/input/input_system.c | 7 ++++---
|
|
||||||
nebu/video/video_system.c | 20 +++++++++++---------
|
|
||||||
src/game/init_sdl.c | 1 -
|
|
||||||
3 files changed, 15 insertions(+), 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/nebu/input/input_system.c b/nebu/input/input_system.c
|
|
||||||
index 5b934e2..802540a 100644
|
|
||||||
--- a/nebu/input/input_system.c
|
|
||||||
+++ b/nebu/input/input_system.c
|
|
||||||
@@ -6,18 +6,19 @@
|
|
||||||
#include "SDL.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
+extern SDL_Window* window;
|
|
||||||
static float joystick_threshold = 0;
|
|
||||||
|
|
||||||
void SystemGrabInput() {
|
|
||||||
- SDL_WM_GrabInput(SDL_GRAB_ON);
|
|
||||||
+ SDL_SetWindowGrab(window, SDL_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemUngrabInput() {
|
|
||||||
- SDL_WM_GrabInput(SDL_GRAB_OFF);
|
|
||||||
+ SDL_SetWindowGrab(window, SDL_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemWarpPointer(int x, int y) {
|
|
||||||
- SDL_WarpMouse(x, y);
|
|
||||||
+ SDL_WarpMouseInWindow(window, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemHidePointer() {
|
|
||||||
diff --git a/nebu/video/video_system.c b/nebu/video/video_system.c
|
|
||||||
index fdfcc56..9c985f8 100644
|
|
||||||
--- a/nebu/video/video_system.c
|
|
||||||
+++ b/nebu/video/video_system.c
|
|
||||||
@@ -3,14 +3,15 @@
|
|
||||||
#include "SDL.h"
|
|
||||||
#include "SDL_opengl.h"
|
|
||||||
|
|
||||||
-static SDL_Surface *screen;
|
|
||||||
+SDL_Window* window;
|
|
||||||
+static SDL_GLContext glcontext;
|
|
||||||
static int width, height;
|
|
||||||
static int flags;
|
|
||||||
static int fullscreen;
|
|
||||||
extern int video_initialized;
|
|
||||||
|
|
||||||
void SystemSwapBuffers() {
|
|
||||||
- SDL_GL_SwapBuffers();
|
|
||||||
+ SDL_GL_SwapWindow(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemInitWindow(int x, int y, int w, int h) {
|
|
||||||
@@ -50,21 +51,22 @@ void SystemInitDisplayMode(int f, unsigned char full) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemSetGamma(float red, float green, float blue) {
|
|
||||||
- SDL_SetGamma(red, green, blue);
|
|
||||||
+ SDL_SetWindowBrightness(window, (red + green + blue) / 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
int SystemCreateWindow(char *name) {
|
|
||||||
- int f = SDL_OPENGL;
|
|
||||||
+ int f = SDL_WINDOW_OPENGL;
|
|
||||||
if(fullscreen & SYSTEM_FULLSCREEN)
|
|
||||||
- f |= SDL_FULLSCREEN;
|
|
||||||
- if( (screen = SDL_SetVideoMode( width, height, 0, f )) == NULL ) {
|
|
||||||
+ f |= SDL_WINDOW_FULLSCREEN;
|
|
||||||
+ if( (window = SDL_CreateWindow("GLTron", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, f )) == NULL ) {
|
|
||||||
fprintf(stderr, "[system] Couldn't set GL mode: %s\n", SDL_GetError());
|
|
||||||
exit(1); /* OK: critical, no visual */
|
|
||||||
}
|
|
||||||
- SDL_WM_SetCaption("GLtron", "");
|
|
||||||
+ glcontext = SDL_GL_CreateContext(window);
|
|
||||||
+ SDL_SetWindowTitle(window, "GLtron");
|
|
||||||
glClearColor(0,0,0,0);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
- SDL_GL_SwapBuffers();
|
|
||||||
+ SDL_GL_SwapWindow(window);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ void SystemDestroyWindow(int id) {
|
|
||||||
/* there used to be some problems (memory leaks, unprober driver unloading)
|
|
||||||
* caused by this, but I can't remember what they where
|
|
||||||
*/
|
|
||||||
-
|
|
||||||
+ SDL_GL_DeleteContext(glcontext);
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
video_initialized = 0;
|
|
||||||
}
|
|
||||||
diff --git a/src/game/init_sdl.c b/src/game/init_sdl.c
|
|
||||||
index bb787e5..c35eeca 100644
|
|
||||||
--- a/src/game/init_sdl.c
|
|
||||||
+++ b/src/game/init_sdl.c
|
|
||||||
@@ -22,7 +22,6 @@ void videoInit(void) {
|
|
||||||
|
|
||||||
void inputInit(void) {
|
|
||||||
/* keyboard */
|
|
||||||
- SDL_EnableKeyRepeat(0, 0); /* turn keyrepeat off */
|
|
||||||
|
|
||||||
/* joystick */
|
|
||||||
if(SDL_Init(SDL_INIT_JOYSTICK) >= 0) {
|
|
|
@ -1,26 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jelle Raaijmakers <jelle@gmta.nl>
|
|
||||||
Date: Mon, 9 May 2022 01:01:47 +0200
|
|
||||||
Subject: [PATCH] SDL: Fix 2x audio rate issue
|
|
||||||
|
|
||||||
By not passing in an `obtained` struct into `SDL_OpenAudio`, we ask SDL
|
|
||||||
to perform any sample rate and/or format conversion for us. Previously
|
|
||||||
GLTron would simply ignore the result in `obtained`, causing the audio
|
|
||||||
to be played back at 2x speed.
|
|
||||||
---
|
|
||||||
src/audio/sound_glue.cpp | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/audio/sound_glue.cpp b/src/audio/sound_glue.cpp
|
|
||||||
index 9753f09..e08b1b3 100644
|
|
||||||
--- a/src/audio/sound_glue.cpp
|
|
||||||
+++ b/src/audio/sound_glue.cpp
|
|
||||||
@@ -170,7 +170,7 @@ extern "C" {
|
|
||||||
|
|
||||||
SDL_AudioSpec obtained;
|
|
||||||
|
|
||||||
- if(SDL_OpenAudio( spec, &obtained ) != 0) {
|
|
||||||
+ if(SDL_OpenAudio( spec, nullptr ) != 0) {
|
|
||||||
fprintf(stderr, "[error] %s\n", SDL_GetError());
|
|
||||||
sound->SetStatus(Sound::eUninitialized);
|
|
||||||
} else {
|
|
|
@ -1,44 +1,28 @@
|
||||||
# Patches for gltron on SerenityOS
|
# Patches for gltron on SerenityOS
|
||||||
|
|
||||||
## `0001-Build-Allow-CFLAGS-env-var-to-be-set.patch`
|
## `0001-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch`
|
||||||
|
|
||||||
Build: Allow `CFLAGS` env var to be set
|
|
||||||
|
|
||||||
|
|
||||||
## `0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch`
|
|
||||||
|
|
||||||
Build: Replace `-lGL` with `-lgl` to reference our LibGL
|
Build: Replace `-lGL` with `-lgl` to reference our LibGL
|
||||||
|
|
||||||
|
|
||||||
## `0003-Build-Remove-ansi-build-argument.patch`
|
## `0002-Build-Remove-ansi-build-argument.patch`
|
||||||
|
|
||||||
Build: Remove `-ansi` build argument
|
Build: Remove `-ansi` build argument
|
||||||
|
|
||||||
|
|
||||||
## `0004-Build-Fix-char-vs.-const-char-arguments.patch`
|
## `0003-Build-Fix-char-vs.-const-char-arguments.patch`
|
||||||
|
|
||||||
Build: Fix `char*` vs. `const char*` arguments
|
Build: Fix `char*` vs. `const char*` arguments
|
||||||
|
|
||||||
These arguments are of the wrong constness, which will trip our
|
These arguments are of the wrong constness, which will trip our
|
||||||
compiler.
|
compiler.
|
||||||
|
|
||||||
## `0005-Scripting-Fix-default-keybindings.patch`
|
## `0004-Build-Disable-nebu-using-SDL-s-glext.h-constants.patch`
|
||||||
|
|
||||||
Scripting: Fix default keybindings
|
Build: Disable nebu using SDL's glext.h constants
|
||||||
|
|
||||||
These constants referred to the wrong keys.
|
SerenityOS provides glext.h definitions inside GL/gl.h, but the
|
||||||
|
build process thinks that glext.h doesn't exist, therefore it attempts
|
||||||
## `0006-SDL-Convert-SDL1-to-SDL2.patch`
|
to use SDL's definitions, which leads to a conflict. Therefore, disable
|
||||||
|
use of said definitions.
|
||||||
SDL: Convert SDL1 to SDL2
|
|
||||||
|
|
||||||
|
|
||||||
## `0007-SDL-Fix-2x-audio-rate-issue.patch`
|
|
||||||
|
|
||||||
SDL: Fix 2x audio rate issue
|
|
||||||
|
|
||||||
By not passing in an `obtained` struct into `SDL_OpenAudio`, we ask SDL
|
|
||||||
to perform any sample rate and/or format conversion for us. Previously
|
|
||||||
GLTron would simply ignore the result in `obtained`, causing the audio
|
|
||||||
to be played back at 2x speed.
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue