mirror of
https://github.com/RGBCube/serenity
synced 2025-06-10 21:02:07 +00:00
Ports: Fix tuxracer port to use sdl12-compat instead of SDL2
This commit is contained in:
parent
d10071ce42
commit
f578247cdf
7 changed files with 131 additions and 459 deletions
|
@ -5,7 +5,7 @@ version="0.61"
|
||||||
files="http://ftp.e.kth.se/pub/mpkg/distfiles/tuxracer/${version}/tuxracer-${version}.tar.gz tuxracer-${version}.tar.gz a311d09080598fe556134d4b9faed7dc0c2ed956ebb10d062e5d4df022f91eff
|
files="http://ftp.e.kth.se/pub/mpkg/distfiles/tuxracer/${version}/tuxracer-${version}.tar.gz tuxracer-${version}.tar.gz a311d09080598fe556134d4b9faed7dc0c2ed956ebb10d062e5d4df022f91eff
|
||||||
http://ftp.e.kth.se/pub/mpkg/distfiles/tuxracer/${version}/tuxracer-data-${version}.tar.gz tuxracer-data-${version}.tar.gz 3783d204b7bb1ed16aa5e5a1d5944de10fbee05bc7cebb8f616fce84301f3651"
|
http://ftp.e.kth.se/pub/mpkg/distfiles/tuxracer/${version}/tuxracer-data-${version}.tar.gz tuxracer-data-${version}.tar.gz 3783d204b7bb1ed16aa5e5a1d5944de10fbee05bc7cebb8f616fce84301f3651"
|
||||||
auth_type=sha256
|
auth_type=sha256
|
||||||
depends=("glu" "SDL2" "SDL2_mixer" "tcl")
|
depends=("glu" "SDL_mixer" "sdl12-compat" "tcl")
|
||||||
configopts=(
|
configopts=(
|
||||||
"--with-gl-inc=${SERENITY_INSTALL_ROOT}/usr/include/LibGL"
|
"--with-gl-inc=${SERENITY_INSTALL_ROOT}/usr/include/LibGL"
|
||||||
"--with-gl-lib-name=gl"
|
"--with-gl-lib-name=gl"
|
||||||
|
@ -17,17 +17,8 @@ launcher_name="Tux Racer"
|
||||||
launcher_category="Games"
|
launcher_category="Games"
|
||||||
launcher_command="/usr/local/bin/tuxracer"
|
launcher_command="/usr/local/bin/tuxracer"
|
||||||
|
|
||||||
pre_configure() {
|
# isnan() is a macro -> not linkable
|
||||||
export CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
|
export ac_cv_func_isnan=yes
|
||||||
export CXXFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
|
|
||||||
export LIBS="-lSDL2"
|
|
||||||
}
|
|
||||||
|
|
||||||
post_configure() {
|
|
||||||
unset LIBS
|
|
||||||
unset CXXFLAGS
|
|
||||||
unset CFLAGS
|
|
||||||
}
|
|
||||||
|
|
||||||
post_install() {
|
post_install() {
|
||||||
resourcePath="${SERENITY_INSTALL_ROOT}/usr/local/share/tuxracer"
|
resourcePath="${SERENITY_INSTALL_ROOT}/usr/local/share/tuxracer"
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
From b00365ebd72508d88bc31da63b56230ed23a5c1d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jelle Raaijmakers <jelle@gmta.nl>
|
|
||||||
Date: Fri, 24 Dec 2021 15:24:16 +0100
|
|
||||||
Subject: [PATCH 1/2] Explicitly link in SDL2
|
|
||||||
|
|
||||||
Also pretend that isnan() works correctly.
|
|
||||||
---
|
|
||||||
configure | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/configure b/configure
|
|
||||||
index 20d409b..e4de165 100755
|
|
||||||
--- a/configure
|
|
||||||
+++ b/configure
|
|
||||||
@@ -1674,7 +1674,7 @@ $ac_func();
|
|
||||||
|
|
||||||
; return 0; }
|
|
||||||
EOF
|
|
||||||
-if { (eval echo configure:1678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
|
||||||
+if [ "$ac_func" = "isnan" ]; then
|
|
||||||
rm -rf conftest*
|
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
|
||||||
else
|
|
||||||
@@ -3417,7 +3417,7 @@ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
|
||||||
else
|
|
||||||
ac_save_LIBS="$LIBS"
|
|
||||||
-LIBS="-lSDL_mixer $LIBS"
|
|
||||||
+LIBS="-lSDL2_mixer $LIBS"
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
|
||||||
#line 3423 "configure"
|
|
||||||
#include "confdefs.h"
|
|
||||||
@@ -3454,7 +3454,7 @@ fi
|
|
||||||
|
|
||||||
if test "x$have_SDL_mixer" = "xyes" ; then
|
|
||||||
TR_CPPFLAGS="$TR_CPPFLAGS -DHAVE_SDL_MIXER=1"
|
|
||||||
- TR_LIBS="$TR_LIBS -lSDL_mixer"
|
|
||||||
+ TR_LIBS="$TR_LIBS -lSDL2_mixer"
|
|
||||||
else
|
|
||||||
echo "*** SDL_mixer not found. Configuring without audio support."
|
|
||||||
fi
|
|
||||||
--
|
|
||||||
2.36.1
|
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
From 347946c86f0816ca4a76cfad176db3f7814f53e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jelle Raaijmakers <jelle@gmta.nl>
|
||||||
|
Date: Fri, 24 Dec 2021 15:24:16 +0100
|
||||||
|
Subject: [PATCH 1/3] Fix config macro reference syntax
|
||||||
|
|
||||||
|
---
|
||||||
|
src/game_config.c | 24 ++++++++++++------------
|
||||||
|
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/game_config.c b/src/game_config.c
|
||||||
|
index f12bb2d..6d1e979 100644
|
||||||
|
--- a/src/game_config.c
|
||||||
|
+++ b/src/game_config.c
|
||||||
|
@@ -114,26 +114,26 @@ struct param {
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define INIT_PARAM( nam, val, typename, commnt ) \
|
||||||
|
- Params. ## nam ## .loaded = False; \
|
||||||
|
- Params. ## nam ## .name = #nam; \
|
||||||
|
- Params. ## nam ## .deflt. ## typename ## _val = val; \
|
||||||
|
- Params. ## nam ## .comment = commnt;
|
||||||
|
+ Params.nam.loaded = False; \
|
||||||
|
+ Params.nam.name = #nam; \
|
||||||
|
+ Params.nam.deflt.typename ## _val = val; \
|
||||||
|
+ Params.nam.comment = commnt;
|
||||||
|
|
||||||
|
#define INIT_PARAM_STRING( nam, val, commnt ) \
|
||||||
|
INIT_PARAM( nam, val, string, commnt ); \
|
||||||
|
- Params. ## nam ## .type = PARAM_STRING;
|
||||||
|
+ Params.nam.type = PARAM_STRING;
|
||||||
|
|
||||||
|
#define INIT_PARAM_CHAR( nam, val, commnt ) \
|
||||||
|
INIT_PARAM( nam, val, char, commnt ); \
|
||||||
|
- Params. ## nam ## .type = PARAM_CHAR;
|
||||||
|
+ Params.nam.type = PARAM_CHAR;
|
||||||
|
|
||||||
|
#define INIT_PARAM_INT( nam, val, commnt ) \
|
||||||
|
INIT_PARAM( nam, val, int, commnt ); \
|
||||||
|
- Params. ## nam ## .type = PARAM_INT;
|
||||||
|
+ Params.nam.type = PARAM_INT;
|
||||||
|
|
||||||
|
#define INIT_PARAM_BOOL( nam, val, commnt ) \
|
||||||
|
INIT_PARAM( nam, val, bool, commnt ); \
|
||||||
|
- Params. ## nam ## .type = PARAM_BOOL;
|
||||||
|
+ Params.nam.type = PARAM_BOOL;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -310,13 +310,13 @@ void set_param_bool( struct param *p, bool_t new_val )
|
||||||
|
*/
|
||||||
|
#define FN_PARAM( name, typename, type ) \
|
||||||
|
type getparam_ ## name() { \
|
||||||
|
- if ( !Params. ## name ## .loaded ) { \
|
||||||
|
- fetch_param_ ## typename( &( Params. ## name ) ); \
|
||||||
|
+ if ( !Params.name.loaded ) { \
|
||||||
|
+ fetch_param_ ## typename( &( Params.name ) ); \
|
||||||
|
} \
|
||||||
|
- return Params. ## name ## .val. ## typename ## _val; \
|
||||||
|
+ return Params.name.val.typename ## _val; \
|
||||||
|
} \
|
||||||
|
void setparam_ ## name( type val) { \
|
||||||
|
- set_param_ ## typename( &( Params. ## name ), val ); }
|
||||||
|
+ set_param_ ## typename( &( Params.name ), val ); }
|
||||||
|
|
||||||
|
#define FN_PARAM_STRING( name ) \
|
||||||
|
FN_PARAM( name, string, char* )
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
|
@ -1,396 +0,0 @@
|
||||||
From 04c10bd91f64e3cbbcd827fc439ef8018473bcc9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jelle Raaijmakers <jelle@gmta.nl>
|
|
||||||
Date: Tue, 28 Dec 2021 00:15:59 +0100
|
|
||||||
Subject: [PATCH 2/2] Big bag of random changes to the source
|
|
||||||
|
|
||||||
FIXME: Split this up sensibly
|
|
||||||
---
|
|
||||||
src/game_config.c | 26 +++++++++----------
|
|
||||||
src/keyboard.c | 66 ++++++++++++++++++++++++++---------------------
|
|
||||||
src/winsys.c | 45 +++++++++++++++-----------------
|
|
||||||
src/winsys.h | 28 ++++++++++----------
|
|
||||||
4 files changed, 85 insertions(+), 80 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/game_config.c b/src/game_config.c
|
|
||||||
index f12bb2d..35b6036 100644
|
|
||||||
--- a/src/game_config.c
|
|
||||||
+++ b/src/game_config.c
|
|
||||||
@@ -114,26 +114,26 @@ struct param {
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define INIT_PARAM( nam, val, typename, commnt ) \
|
|
||||||
- Params. ## nam ## .loaded = False; \
|
|
||||||
- Params. ## nam ## .name = #nam; \
|
|
||||||
- Params. ## nam ## .deflt. ## typename ## _val = val; \
|
|
||||||
- Params. ## nam ## .comment = commnt;
|
|
||||||
+ Params.nam.loaded = False; \
|
|
||||||
+ Params.nam.name = #nam; \
|
|
||||||
+ Params.nam.deflt.typename ## _val = val; \
|
|
||||||
+ Params.nam.comment = commnt;
|
|
||||||
|
|
||||||
#define INIT_PARAM_STRING( nam, val, commnt ) \
|
|
||||||
INIT_PARAM( nam, val, string, commnt ); \
|
|
||||||
- Params. ## nam ## .type = PARAM_STRING;
|
|
||||||
+ Params.nam.type = PARAM_STRING;
|
|
||||||
|
|
||||||
#define INIT_PARAM_CHAR( nam, val, commnt ) \
|
|
||||||
INIT_PARAM( nam, val, char, commnt ); \
|
|
||||||
- Params. ## nam ## .type = PARAM_CHAR;
|
|
||||||
+ Params.nam.type = PARAM_CHAR;
|
|
||||||
|
|
||||||
#define INIT_PARAM_INT( nam, val, commnt ) \
|
|
||||||
INIT_PARAM( nam, val, int, commnt ); \
|
|
||||||
- Params. ## nam ## .type = PARAM_INT;
|
|
||||||
+ Params.nam.type = PARAM_INT;
|
|
||||||
|
|
||||||
#define INIT_PARAM_BOOL( nam, val, commnt ) \
|
|
||||||
INIT_PARAM( nam, val, bool, commnt ); \
|
|
||||||
- Params. ## nam ## .type = PARAM_BOOL;
|
|
||||||
+ Params.nam.type = PARAM_BOOL;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -310,13 +310,13 @@ void set_param_bool( struct param *p, bool_t new_val )
|
|
||||||
*/
|
|
||||||
#define FN_PARAM( name, typename, type ) \
|
|
||||||
type getparam_ ## name() { \
|
|
||||||
- if ( !Params. ## name ## .loaded ) { \
|
|
||||||
- fetch_param_ ## typename( &( Params. ## name ) ); \
|
|
||||||
+ if ( !Params.name.loaded ) { \
|
|
||||||
+ fetch_param_ ## typename( &( Params.name ) ); \
|
|
||||||
} \
|
|
||||||
- return Params. ## name ## .val. ## typename ## _val; \
|
|
||||||
+ return Params.name.val.typename ## _val; \
|
|
||||||
} \
|
|
||||||
void setparam_ ## name( type val) { \
|
|
||||||
- set_param_ ## typename( &( Params. ## name ), val ); }
|
|
||||||
+ set_param_ ## typename( &( Params.name ), val ); }
|
|
||||||
|
|
||||||
#define FN_PARAM_STRING( name ) \
|
|
||||||
FN_PARAM( name, string, char* )
|
|
||||||
@@ -505,7 +505,7 @@ void init_game_configuration()
|
|
||||||
"# decreasing this number, at the cost of lower image quality." );
|
|
||||||
|
|
||||||
INIT_PARAM_BOOL(
|
|
||||||
- fullscreen, True,
|
|
||||||
+ fullscreen, False,
|
|
||||||
"# If true then the game will run in full-screen mode." );
|
|
||||||
|
|
||||||
INIT_PARAM_INT(
|
|
||||||
diff --git a/src/keyboard.c b/src/keyboard.c
|
|
||||||
index d2b01ed..b0d38f5 100644
|
|
||||||
--- a/src/keyboard.c
|
|
||||||
+++ b/src/keyboard.c
|
|
||||||
@@ -23,11 +23,17 @@
|
|
||||||
#include "loop.h"
|
|
||||||
|
|
||||||
#define KEYMAP_SIZE 1000
|
|
||||||
-#define KEYTABLE_SIZE WSK_LAST
|
|
||||||
-#define SPECIAL_KEYTABLE_SIZE WSK_LAST
|
|
||||||
+#define KEYTABLE_SIZE 100
|
|
||||||
|
|
||||||
-static key_cb_t keytable[KEYTABLE_SIZE];
|
|
||||||
-static key_cb_t special_keytable[SPECIAL_KEYTABLE_SIZE];
|
|
||||||
+static key_cb_t keytable_callback[KEYTABLE_SIZE];
|
|
||||||
+static int keytable_key[KEYTABLE_SIZE];
|
|
||||||
+static int num_keytable_entries = 0;
|
|
||||||
+
|
|
||||||
+static key_cb_t special_keytable_callback[KEYTABLE_SIZE];
|
|
||||||
+static int special_keytable_key[KEYTABLE_SIZE];
|
|
||||||
+static int num_special_keytable_entries = 0;
|
|
||||||
+
|
|
||||||
+static key_cb_t default_keytable_callback = NULL;
|
|
||||||
|
|
||||||
static keymap_t keymap[KEYMAP_SIZE];
|
|
||||||
static int num_keymap_entries = 0;
|
|
||||||
@@ -50,19 +56,6 @@ int add_keymap_entry( game_mode_t mode, keymap_class_t keymap_class,
|
|
||||||
return 0; /* success */
|
|
||||||
}
|
|
||||||
|
|
||||||
-static void fill_keytable( key_cb_t value )
|
|
||||||
-{
|
|
||||||
- int i;
|
|
||||||
-
|
|
||||||
- for (i=0; i<KEYTABLE_SIZE; i++) {
|
|
||||||
- keytable[i] = value;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- for (i=0; i<SPECIAL_KEYTABLE_SIZE; i++) {
|
|
||||||
- special_keytable[i] = value;
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static int insert_keytable_entries( char *keys, key_cb_t callback )
|
|
||||||
{
|
|
||||||
key_desc_t *key_list;
|
|
||||||
@@ -74,9 +67,13 @@ static int insert_keytable_entries( char *keys, key_cb_t callback )
|
|
||||||
if ( num_keys > 0 ) {
|
|
||||||
for ( i=0; i<num_keys; i++ ) {
|
|
||||||
if ( key_list[i].special ) {
|
|
||||||
- special_keytable[ key_list[i].key ] = callback;
|
|
||||||
+ special_keytable_callback[num_special_keytable_entries] = callback;
|
|
||||||
+ special_keytable_key[num_special_keytable_entries] = key_list[i].key;
|
|
||||||
+ ++num_special_keytable_entries;
|
|
||||||
} else {
|
|
||||||
- keytable[ key_list[i].key ] = callback;
|
|
||||||
+ keytable_callback[num_keytable_entries] = callback;
|
|
||||||
+ keytable_key[num_keytable_entries] = key_list[i].key;
|
|
||||||
+ ++num_keytable_entries;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -92,15 +89,14 @@ static void init_keytable( game_mode_t mode )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char *keys;
|
|
||||||
- fill_keytable( NULL );
|
|
||||||
|
|
||||||
/* Handle default callbacks first */
|
|
||||||
for (i=0; i<num_keymap_entries; i++) {
|
|
||||||
if ( ( keymap[i].mode == mode || keymap[i].mode == ALL_MODES ) &&
|
|
||||||
keymap[i].keymap_class == DEFAULT_CALLBACK )
|
|
||||||
{
|
|
||||||
- fill_keytable( keymap[i].key_cb );
|
|
||||||
- }
|
|
||||||
+ default_keytable_callback = keymap[i].key_cb;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle other classes */
|
|
||||||
@@ -155,7 +151,9 @@ static void keyboard_handler( unsigned int key, bool_t special,
|
|
||||||
bool_t release, int x, int y )
|
|
||||||
{
|
|
||||||
static game_mode_t last_mode = NO_MODE;
|
|
||||||
- key_cb_t *table;
|
|
||||||
+ int* table_key;
|
|
||||||
+ key_cb_t* table_callback;
|
|
||||||
+ int num_entries;
|
|
||||||
|
|
||||||
if ( is_mode_change_pending() ) {
|
|
||||||
/* Don't process keyboard events until the mode change happens */
|
|
||||||
@@ -168,18 +166,28 @@ static void keyboard_handler( unsigned int key, bool_t special,
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( special ) {
|
|
||||||
- table = special_keytable;
|
|
||||||
+ table_callback = special_keytable_callback;
|
|
||||||
+ table_key = special_keytable_key;
|
|
||||||
+ num_entries = num_special_keytable_entries;
|
|
||||||
} else {
|
|
||||||
- table = keytable;
|
|
||||||
+ table_callback = keytable_callback;
|
|
||||||
+ table_key = keytable_key;
|
|
||||||
+ num_entries = num_keytable_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isalpha( key ) ) {
|
|
||||||
- key = tolower( key );
|
|
||||||
+ key = tolower( key );
|
|
||||||
}
|
|
||||||
|
|
||||||
- if ( table[key] != NULL ) {
|
|
||||||
- (table[key])( key, special, release, x, y );
|
|
||||||
- }
|
|
||||||
+ // Find index
|
|
||||||
+ int callback_index = 0;
|
|
||||||
+ for (; callback_index < num_entries; ++callback_index) {
|
|
||||||
+ if (table_key[callback_index] == key)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ if (callback_index < num_entries) {
|
|
||||||
+ (table_callback[callback_index])(key, special, release, x, y);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_keyboard()
|
|
||||||
diff --git a/src/winsys.c b/src/winsys.c
|
|
||||||
index d932a1d..636d8f2 100644
|
|
||||||
--- a/src/winsys.c
|
|
||||||
+++ b/src/winsys.c
|
|
||||||
@@ -36,7 +36,8 @@
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
-static SDL_Surface *screen = NULL;
|
|
||||||
+static SDL_Window *screen = NULL;
|
|
||||||
+static SDL_GLContext context = NULL;
|
|
||||||
|
|
||||||
static winsys_display_func_t display_func = NULL;
|
|
||||||
static winsys_idle_func_t idle_func = NULL;
|
|
||||||
@@ -164,7 +165,7 @@ void winsys_set_passive_motion_func( winsys_motion_func_t func )
|
|
||||||
*/
|
|
||||||
void winsys_swap_buffers()
|
|
||||||
{
|
|
||||||
- SDL_GL_SwapBuffers();
|
|
||||||
+ SDL_GL_SwapWindow(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -177,7 +178,7 @@ void winsys_swap_buffers()
|
|
||||||
*/
|
|
||||||
void winsys_warp_pointer( int x, int y )
|
|
||||||
{
|
|
||||||
- SDL_WarpMouse( x, y );
|
|
||||||
+ SDL_WarpMouseInWindow( screen, x, y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -190,14 +191,14 @@ void winsys_warp_pointer( int x, int y )
|
|
||||||
*/
|
|
||||||
static void setup_sdl_video_mode()
|
|
||||||
{
|
|
||||||
- Uint32 video_flags = SDL_OPENGL;
|
|
||||||
+ Uint32 video_flags = SDL_WINDOW_OPENGL;
|
|
||||||
int bpp = 0;
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
if ( getparam_fullscreen() ) {
|
|
||||||
- video_flags |= SDL_FULLSCREEN;
|
|
||||||
+ video_flags |= SDL_WINDOW_FULLSCREEN;
|
|
||||||
} else {
|
|
||||||
- video_flags |= SDL_RESIZABLE;
|
|
||||||
+ video_flags |= SDL_WINDOW_RESIZABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( getparam_bpp_mode() ) {
|
|
||||||
@@ -224,12 +225,16 @@ static void setup_sdl_video_mode()
|
|
||||||
width = getparam_x_resolution();
|
|
||||||
height = getparam_y_resolution();
|
|
||||||
|
|
||||||
- if ( ( screen = SDL_SetVideoMode( width, height, bpp, video_flags ) ) ==
|
|
||||||
+ if ( ( screen = SDL_CreateWindow("Tuxracer", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, video_flags ) ) ==
|
|
||||||
NULL )
|
|
||||||
{
|
|
||||||
handle_system_error( 1, "Couldn't initialize video: %s",
|
|
||||||
SDL_GetError() );
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ context = SDL_GL_CreateContext(screen);
|
|
||||||
+ if (context == NULL)
|
|
||||||
+ handle_system_error( 1, "Couldn't initialize video: %s", SDL_GetError() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -266,8 +271,7 @@ void winsys_init( int *argc, char **argv, char *window_title,
|
|
||||||
|
|
||||||
setup_sdl_video_mode();
|
|
||||||
|
|
||||||
- SDL_WM_SetCaption( window_title, icon_title );
|
|
||||||
-
|
|
||||||
+ SDL_SetWindowTitle(screen, window_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -280,6 +284,7 @@ void winsys_init( int *argc, char **argv, char *window_title,
|
|
||||||
*/
|
|
||||||
void winsys_shutdown()
|
|
||||||
{
|
|
||||||
+ SDL_GL_DeleteContext(context);
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -293,12 +298,6 @@ void winsys_shutdown()
|
|
||||||
*/
|
|
||||||
void winsys_enable_key_repeat( bool_t enabled )
|
|
||||||
{
|
|
||||||
- if ( enabled ) {
|
|
||||||
- SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY,
|
|
||||||
- SDL_DEFAULT_REPEAT_INTERVAL );
|
|
||||||
- } else {
|
|
||||||
- SDL_EnableKeyRepeat( 0, 0 );
|
|
||||||
- }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -330,9 +329,6 @@ void winsys_process_events()
|
|
||||||
|
|
||||||
while (True) {
|
|
||||||
|
|
||||||
- SDL_LockAudio();
|
|
||||||
- SDL_UnlockAudio();
|
|
||||||
-
|
|
||||||
while ( SDL_PollEvent( &event ) ) {
|
|
||||||
|
|
||||||
switch ( event.type ) {
|
|
||||||
@@ -384,18 +380,19 @@ void winsys_process_events()
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
- case SDL_VIDEORESIZE:
|
|
||||||
+ case SDL_WINDOWEVENT_RESIZED:
|
|
||||||
setup_sdl_video_mode();
|
|
||||||
if ( reshape_func ) {
|
|
||||||
- (*reshape_func)( event.resize.w,
|
|
||||||
- event.resize.h );
|
|
||||||
+ (*reshape_func)( event.window.data1,
|
|
||||||
+ event.window.data2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
- }
|
|
||||||
|
|
||||||
- SDL_LockAudio();
|
|
||||||
- SDL_UnlockAudio();
|
|
||||||
+ case SDL_QUIT:
|
|
||||||
+ winsys_exit(0);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( redisplay && display_func ) {
|
|
||||||
diff --git a/src/winsys.h b/src/winsys.h
|
|
||||||
index 4a51f8d..1cf7ca9 100644
|
|
||||||
--- a/src/winsys.h
|
|
||||||
+++ b/src/winsys.h
|
|
||||||
@@ -48,16 +48,16 @@ typedef enum {
|
|
||||||
WSK_NOT_AVAIL = SDLK_UNKNOWN,
|
|
||||||
|
|
||||||
/* Numeric keypad */
|
|
||||||
- WSK_KP0 = SDLK_KP0,
|
|
||||||
- WSK_KP1 = SDLK_KP1,
|
|
||||||
- WSK_KP2 = SDLK_KP2,
|
|
||||||
- WSK_KP3 = SDLK_KP3,
|
|
||||||
- WSK_KP4 = SDLK_KP4,
|
|
||||||
- WSK_KP5 = SDLK_KP5,
|
|
||||||
- WSK_KP6 = SDLK_KP6,
|
|
||||||
- WSK_KP7 = SDLK_KP7,
|
|
||||||
- WSK_KP8 = SDLK_KP8,
|
|
||||||
- WSK_KP9 = SDLK_KP9,
|
|
||||||
+ WSK_KP0 = SDLK_KP_0,
|
|
||||||
+ WSK_KP1 = SDLK_KP_1,
|
|
||||||
+ WSK_KP2 = SDLK_KP_2,
|
|
||||||
+ WSK_KP3 = SDLK_KP_3,
|
|
||||||
+ WSK_KP4 = SDLK_KP_4,
|
|
||||||
+ WSK_KP5 = SDLK_KP_5,
|
|
||||||
+ WSK_KP6 = SDLK_KP_6,
|
|
||||||
+ WSK_KP7 = SDLK_KP_7,
|
|
||||||
+ WSK_KP8 = SDLK_KP_8,
|
|
||||||
+ WSK_KP9 = SDLK_KP_9,
|
|
||||||
WSK_KP_PERIOD = SDLK_KP_PERIOD,
|
|
||||||
WSK_KP_DIVIDE = SDLK_KP_DIVIDE,
|
|
||||||
WSK_KP_MULTIPLY = SDLK_KP_MULTIPLY,
|
|
||||||
@@ -95,17 +95,17 @@ typedef enum {
|
|
||||||
WSK_F15 = SDLK_F15,
|
|
||||||
|
|
||||||
/* Key state modifier keys */
|
|
||||||
- WSK_NUMLOCK = SDLK_NUMLOCK,
|
|
||||||
+ WSK_NUMLOCK = SDLK_NUMLOCKCLEAR,
|
|
||||||
WSK_CAPSLOCK = SDLK_CAPSLOCK,
|
|
||||||
- WSK_SCROLLOCK = SDLK_SCROLLOCK,
|
|
||||||
+ WSK_SCROLLOCK = SDLK_SCROLLLOCK,
|
|
||||||
WSK_RSHIFT = SDLK_RSHIFT,
|
|
||||||
WSK_LSHIFT = SDLK_LSHIFT,
|
|
||||||
WSK_RCTRL = SDLK_RCTRL,
|
|
||||||
WSK_LCTRL = SDLK_LCTRL,
|
|
||||||
WSK_RALT = SDLK_RALT,
|
|
||||||
WSK_LALT = SDLK_LALT,
|
|
||||||
- WSK_RMETA = SDLK_RMETA,
|
|
||||||
- WSK_LMETA = SDLK_LMETA,
|
|
||||||
+ WSK_RMETA = SDLK_RALT,
|
|
||||||
+ WSK_LMETA = SDLK_LALT,
|
|
||||||
|
|
||||||
WSK_LAST
|
|
||||||
|
|
||||||
--
|
|
||||||
2.36.1
|
|
||||||
|
|
25
Ports/tuxracer/patches/0002-Disable-full-screen.patch
Normal file
25
Ports/tuxracer/patches/0002-Disable-full-screen.patch
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
From 8b1b102cd2dce045caf8603aa903bc9265c32cc4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jelle Raaijmakers <jelle@gmta.nl>
|
||||||
|
Date: Fri, 24 Dec 2021 15:24:16 +0100
|
||||||
|
Subject: [PATCH 2/3] Disable full screen
|
||||||
|
|
||||||
|
---
|
||||||
|
src/game_config.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/game_config.c b/src/game_config.c
|
||||||
|
index 6d1e979..f4c1c0c 100644
|
||||||
|
--- a/src/game_config.c
|
||||||
|
+++ b/src/game_config.c
|
||||||
|
@@ -505,7 +505,7 @@ void init_game_configuration()
|
||||||
|
"# decreasing this number, at the cost of lower image quality." );
|
||||||
|
|
||||||
|
INIT_PARAM_BOOL(
|
||||||
|
- fullscreen, True,
|
||||||
|
+ fullscreen, False,
|
||||||
|
"# If true then the game will run in full-screen mode." );
|
||||||
|
|
||||||
|
INIT_PARAM_INT(
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
From 99e0390e8974a0f0438fb95665edc910ef176883 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
|
||||||
|
Date: Mon, 30 May 2022 01:54:22 +0300
|
||||||
|
Subject: [PATCH 3/3] Exit event loop on SDL_QUIT event
|
||||||
|
|
||||||
|
---
|
||||||
|
src/winsys.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/winsys.c b/src/winsys.c
|
||||||
|
index d932a1d..95eeefa 100644
|
||||||
|
--- a/src/winsys.c
|
||||||
|
+++ b/src/winsys.c
|
||||||
|
@@ -392,6 +392,10 @@ void winsys_process_events()
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
+
|
||||||
|
+ case SDL_QUIT:
|
||||||
|
+ winsys_exit( 0 );
|
||||||
|
+ break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_LockAudio();
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# Patches for tuxracer on SerenityOS
|
# Patches for tuxracer on SerenityOS
|
||||||
|
|
||||||
## `0001-Explicitly-link-in-SDL2.patch`
|
## `0001-Fix-config-macro-reference-syntax.patch`
|
||||||
|
|
||||||
Explicitly link in SDL2
|
Fix macro definitions using old syntax for referring to struct fields
|
||||||
|
|
||||||
Also pretend that isnan() works correctly.
|
## `0002-Disable-full-screen.patch`
|
||||||
|
|
||||||
## `0002-Big-bag-of-random-changes-to-the-source.patch`
|
Disable full screen by default (start in windowed mode)
|
||||||
|
|
||||||
Big bag of random changes to the source
|
## `0003-Exit-event-loop-on-SDL_QUIT-event.patch`
|
||||||
|
|
||||||
FIXME: Split this up sensibly
|
|
||||||
|
|
||||||
|
Check for SDL_QUIT event and exit on its reception
|
||||||
|
Allows the game to close from the window button instead from the menu only
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue