SDL and GTK+ version check patches from Ozkan Sezer

git-svn-id: https://svn.eduke32.com/eduke32@710 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-04-25 01:46:19 +00:00
parent 168573d5aa
commit 2ad666c159
14 changed files with 386 additions and 347 deletions

View file

@ -126,7 +126,10 @@ ifeq ($(RENDERTYPE),SDL)
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o $(OBJ)/dynamicgtk.$o
ENGINEOBJS+= $(OBJ)/gtkbits.$o
ifeq ($(LINKED_GTK),0)
ENGINEOBJS+= $(OBJ)/dynamicgtk.$o
endif
EDITOROBJS+= $(OBJ)/startgtk.editor.$o
endif
endif

View file

@ -3,8 +3,20 @@
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION(2,4,0)
#error You need at least 2.4.0 version of GTK+
#endif
#if !defined(LINKED_GTK)
#ifndef G_GNUC_NULL_TERMINATED
/* this is a glib-2.8.x thing: */
#define G_GNUC_NULL_TERMINATED
#endif
struct _dynamicgtksyms {
// glib.h
@ -229,6 +241,17 @@ void (*gtk_text_buffer_insert) (GtkTextBuffer *buffer,
const gchar *text,
gint len);
// gtktextiter.h
// FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0)
// around these three, or should I not care??
gboolean (*gtk_text_iter_backward_cursor_position) (GtkTextIter *iter);
gboolean (*gtk_text_iter_equal) (const GtkTextIter *lhs,
const GtkTextIter *rhs);
gboolean (*gtk_text_buffer_delete_interactive) (GtkTextBuffer *buffer,
GtkTextIter *start_iter,
GtkTextIter *end_iter,
gboolean default_editable);
// gtktextview.h
GtkTextBuffer *(*gtk_text_view_get_buffer) (GtkTextView *text_view);
GType (*gtk_text_view_get_type) (void) G_GNUC_CONST;
@ -492,6 +515,11 @@ void dynamicgtk_uninit(void);
#define gtk_text_buffer_get_end_iter dynamicgtksyms.gtk_text_buffer_get_end_iter
#define gtk_text_buffer_insert dynamicgtksyms.gtk_text_buffer_insert
// gtktextiter.h
#define gtk_text_iter_backward_cursor_position dynamicgtksyms.gtk_text_iter_backward_cursor_position
#define gtk_text_iter_equal dynamicgtksyms.gtk_text_iter_equal
#define gtk_text_buffer_delete_interactive dynamicgtksyms.gtk_text_buffer_delete_interactive
// gtktextview.h
#define gtk_text_view_get_buffer dynamicgtksyms.gtk_text_view_get_buffer
#define gtk_text_view_get_type dynamicgtksyms.gtk_text_view_get_type
@ -562,6 +590,9 @@ void dynamicgtk_uninit(void);
// gunicode.h
#define g_utf8_collate dynamicgtksyms.g_utf8_collate
#endif
#endif /* __dynamicgtkfoo__ */
#endif /* LINKED_GTK */
#endif /* __dynamicgtk_h__ */
#endif

View file

@ -100,6 +100,12 @@ int dynamicgtk_init(void)
GETDLSYM(gtk_text_buffer_delete_mark)
GETDLSYM(gtk_text_buffer_get_end_iter)
GETDLSYM(gtk_text_buffer_insert)
// FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0)
// around these three, or should I not care??
GETDLSYM(gtk_text_iter_backward_cursor_position)
GETDLSYM(gtk_text_iter_equal)
GETDLSYM(gtk_text_buffer_delete_interactive)
//
GETDLSYM(gtk_text_view_get_buffer)
GETDLSYM(gtk_text_view_get_type)
GETDLSYM(gtk_text_view_new)

View file

@ -8,11 +8,7 @@
#if defined USE_OPENGL
#ifdef RENDERTYPESDL
# ifdef __APPLE__
# include <SDL/SDL.h>
# else
#include "SDL.h"
#endif
#include "sdl_inc.h"
#endif
void (APIENTRY * bglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);

View file

@ -5,18 +5,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "dynamicgtk.h"
#include "baselayer.h"
#include "build.h"
#ifndef LINKED_GTK
# include "dynamicgtk.h"
#endif
int gtkenabled = 0;
static GdkPixbuf *appicon = NULL;

View file

@ -228,6 +228,7 @@ typedef struct { float xadd, yadd, zadd; short angadd, flags; } hudtyp;
hudtyp hudmem[2][MAXTILES]; //~320KB ... ok for now ... could replace with dynamic alloc
static char mdinited=0;
int mdpause=0;
#define MODELALLOCGROUP 256
static int nummodelsalloced = 0, nextmodelid = 0;
@ -1044,14 +1045,13 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
if (ysiz == pow2long[j]) { i |= 2; }
}
cachead.flags = (i!=3) | (hasalpha ? 2 : 0);
initprintf("No cached tex for %s. ",fn);
writexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:hictinting[pal].f, &cachead);
}
return(*texidx);
}
int mdpause;
//Note: even though it says md2model, it works for both md2model&md3model
static void updateanimation(md2model *m, spritetype *tspr)
{

View file

@ -1693,6 +1693,7 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet
if (ysiz == pow2long[j]) { x |= 2; }
}
cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0);
initprintf("No cached tex for tile %d pal %d. ",dapic,dapalnum);
writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
}

View file

@ -6,9 +6,7 @@
#include <stdlib.h>
#include <math.h>
#ifndef __APPLE__
# include "SDL.h"
#endif
#include "sdl_inc.h"
#include "compat.h"
#include "sdlayer.h"
#include "cache1d.h"
@ -22,7 +20,6 @@
#endif
#if defined __APPLE__
# include <SDL/SDL.h>
# include "osxbits.h"
#elif defined HAVE_GTK2
# include "gtkbits.h"
@ -225,9 +222,15 @@ int initsystem(void)
SDL_VERSION(&compiled);
initprintf("Initializing SDL system interface "
"(compiled with SDL version %d.%d.%d, DLL version %d.%d.%d)\n",
linked->major, linked->minor, linked->patch,
compiled.major, compiled.minor, compiled.patch);
"(compiled against SDL version %d.%d.%d, found version %d.%d.%d)\n",
compiled.major, compiled.minor, compiled.patch,
linked->major, linked->minor, linked->patch);
if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < SDL_REQUIREDVERSION)
{ /*reject running under SDL versions older than what is stated in sdl_inc.h */
initprintf("You need at least v%d.%d.%d of SDL to run this game\n",SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
return -1;
}
if (SDL_Init(SDL_INIT_VIDEO //| SDL_INIT_TIMER
#ifdef NOSDLPARACHUTE

View file

@ -10,14 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#ifndef LINKED_GTK
#include "dynamicgtk.h"
#endif
#include "baselayer.h"
#include "compat.h"

View file

@ -25,14 +25,16 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
#include "dsl.h"
#include "compat.h"
#include "SDL.h"
#include "SDL_mixer.h"
#define _NEED_SDLMIXER 1
#include "sdl_inc.h"
extern int MV_MixPage;
int DSL_ErrorCode = DSL_Ok;
static int mixer_initialized;
static int interrupts_disabled = 0;
static void(*_CallBackFunc)(void);
static volatile char *_BufferStart;
@ -90,6 +92,9 @@ static void DSL_SetErrorCode(int ErrorCode)
int DSL_Init(void)
{
/* FIXME: Do I need an SDL_mixer version check
* like that in sdlmusic.h here, too???
*/
DSL_SetErrorCode(DSL_Ok);
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
@ -258,6 +263,9 @@ unsigned DSL_GetPlaybackRate(void)
int DisableInterrupts(void)
{
if (interrupts_disabled)
return 0;
interrupts_disabled = 1;
SDL_LockAudio();
return(0);
}
@ -265,6 +273,9 @@ int DisableInterrupts(void)
int RestoreInterrupts(int flags)
{
UNREFERENCED_PARAMETER(flags);
if (!interrupts_disabled)
return 0;
interrupts_disabled = 0;
SDL_UnlockAudio();
return(0);
}

View file

@ -41,11 +41,8 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
#define cdecl
#endif
// for SDL_mixer.h _RW functions
#define USE_RWOPS
#include <SDL.h>
#include <SDL_mixer.h>
#define _NEED_SDLMIXER 1
#include "sdl_inc.h"
#include "music.h"
#define __FX_TRUE (1 == 1)
@ -178,6 +175,15 @@ int MUSIC_Init(int SoundCard, int Address)
{
// Use an external MIDI player if the user has specified to do so
char *command = getenv("EDUKE32_MUSIC_CMD");
const SDL_version *linked = Mix_Linked_Version();
if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < MIX_REQUIREDVERSION)
{
// reject running with SDL_Mixer versions older than what is stated in sdl_inc.h
initprintf("You need at least v%d.%d.%d of SDL_mixer for music\n",SDL_MIXER_MIN_X,SDL_MIXER_MIN_Y,SDL_MIXER_MIN_Z);
return(MUSIC_Error);
}
external_midi = (command != NULL && command[0] != 0);
if (external_midi)
Mix_SetMusicCMD(command);

View file

@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "sdlout.h"
#include "SDL.h"
#include "sdl_inc.h"
#include <stdio.h>
#include <string.h>

View file

@ -252,9 +252,12 @@ static void cachegoodsprites(void)
for (i = TRANSPORTERBEAM; i < (TRANSPORTERBEAM+6); i++) tloadtile(i,1);
for (i = SMALLSMOKE; i < (SMALLSMOKE+4); i++) tloadtile(i,1);
for (i = SHOTSPARK1; i < (SHOTSPARK1+4); i++) tloadtile(i,1);
for (i = BLOOD; i < (BLOOD+4); i++) tloadtile(i,1);
for (i = JIBS1; i < (JIBS5+5); i++) tloadtile(i,1);
for (i = JIBS6; i < (JIBS6+8); i++) tloadtile(i,1);
for (i = SCRAP1; i < (SCRAP1+29); i++) tloadtile(i,1);
tloadtile(FIRELASER,1);

View file

@ -10,14 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#ifndef LINKED_GTK
#include "dynamicgtk.h"
#endif
#include "duke3d.h"
#include "build.h"