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)) ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) 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 EDITOROBJS+= $(OBJ)/startgtk.editor.$o
endif endif
endif endif

View file

@ -3,8 +3,20 @@
#include <gdk-pixbuf/gdk-pixdata.h> #include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.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 { struct _dynamicgtksyms {
// glib.h // glib.h
@ -229,6 +241,17 @@ void (*gtk_text_buffer_insert) (GtkTextBuffer *buffer,
const gchar *text, const gchar *text,
gint len); 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 // gtktextview.h
GtkTextBuffer *(*gtk_text_view_get_buffer) (GtkTextView *text_view); GtkTextBuffer *(*gtk_text_view_get_buffer) (GtkTextView *text_view);
GType (*gtk_text_view_get_type) (void) G_GNUC_CONST; 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_get_end_iter dynamicgtksyms.gtk_text_buffer_get_end_iter
#define gtk_text_buffer_insert dynamicgtksyms.gtk_text_buffer_insert #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 // gtktextview.h
#define gtk_text_view_get_buffer dynamicgtksyms.gtk_text_view_get_buffer #define gtk_text_view_get_buffer dynamicgtksyms.gtk_text_view_get_buffer
#define gtk_text_view_get_type dynamicgtksyms.gtk_text_view_get_type #define gtk_text_view_get_type dynamicgtksyms.gtk_text_view_get_type
@ -562,6 +590,9 @@ void dynamicgtk_uninit(void);
// gunicode.h // gunicode.h
#define g_utf8_collate dynamicgtksyms.g_utf8_collate #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_delete_mark)
GETDLSYM(gtk_text_buffer_get_end_iter) GETDLSYM(gtk_text_buffer_get_end_iter)
GETDLSYM(gtk_text_buffer_insert) 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_buffer)
GETDLSYM(gtk_text_view_get_type) GETDLSYM(gtk_text_view_get_type)
GETDLSYM(gtk_text_view_new) GETDLSYM(gtk_text_view_new)

View file

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

View file

@ -5,18 +5,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h> #include "dynamicgtk.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "baselayer.h" #include "baselayer.h"
#include "build.h" #include "build.h"
#ifndef LINKED_GTK
# include "dynamicgtk.h"
#endif
int gtkenabled = 0; int gtkenabled = 0;
static GdkPixbuf *appicon = NULL; 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 hudtyp hudmem[2][MAXTILES]; //~320KB ... ok for now ... could replace with dynamic alloc
static char mdinited=0; static char mdinited=0;
int mdpause=0;
#define MODELALLOCGROUP 256 #define MODELALLOCGROUP 256
static int nummodelsalloced = 0, nextmodelid = 0; 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; } if (ysiz == pow2long[j]) { i |= 2; }
} }
cachead.flags = (i!=3) | (hasalpha ? 2 : 0); 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); writexcache(fn, picfillen, pal<<8, (globalnoeffect)?0:hictinting[pal].f, &cachead);
} }
return(*texidx); return(*texidx);
} }
int mdpause;
//Note: even though it says md2model, it works for both md2model&md3model //Note: even though it says md2model, it works for both md2model&md3model
static void updateanimation(md2model *m, spritetype *tspr) 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; } if (ysiz == pow2long[j]) { x |= 2; }
} }
cachead.flags = (x!=3) | (hasalpha != 255 ? 2 : 0); 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); writexcache(fn, picfillen+(dapalnum<<8), dameth, effect, &cachead);
} }

View file

@ -6,9 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#ifndef __APPLE__ #include "sdl_inc.h"
# include "SDL.h"
#endif
#include "compat.h" #include "compat.h"
#include "sdlayer.h" #include "sdlayer.h"
#include "cache1d.h" #include "cache1d.h"
@ -22,7 +20,6 @@
#endif #endif
#if defined __APPLE__ #if defined __APPLE__
# include <SDL/SDL.h>
# include "osxbits.h" # include "osxbits.h"
#elif defined HAVE_GTK2 #elif defined HAVE_GTK2
# include "gtkbits.h" # include "gtkbits.h"
@ -225,9 +222,15 @@ int initsystem(void)
SDL_VERSION(&compiled); SDL_VERSION(&compiled);
initprintf("Initializing SDL system interface " initprintf("Initializing SDL system interface "
"(compiled with SDL version %d.%d.%d, DLL version %d.%d.%d)\n", "(compiled against SDL version %d.%d.%d, found version %d.%d.%d)\n",
linked->major, linked->minor, linked->patch, compiled.major, compiled.minor, compiled.patch,
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 if (SDL_Init(SDL_INIT_VIDEO //| SDL_INIT_TIMER
#ifdef NOSDLPARACHUTE #ifdef NOSDLPARACHUTE

View file

@ -10,14 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h> #include "dynamicgtk.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 "baselayer.h"
#include "compat.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 "dsl.h"
#include "compat.h" #include "compat.h"
#include "SDL.h"
#include "SDL_mixer.h" #define _NEED_SDLMIXER 1
#include "sdl_inc.h"
extern int MV_MixPage; extern int MV_MixPage;
int DSL_ErrorCode = DSL_Ok; int DSL_ErrorCode = DSL_Ok;
static int mixer_initialized; static int mixer_initialized;
static int interrupts_disabled = 0;
static void(*_CallBackFunc)(void); static void(*_CallBackFunc)(void);
static volatile char *_BufferStart; static volatile char *_BufferStart;
@ -90,6 +92,9 @@ static void DSL_SetErrorCode(int ErrorCode)
int DSL_Init(void) int DSL_Init(void)
{ {
/* FIXME: Do I need an SDL_mixer version check
* like that in sdlmusic.h here, too???
*/
DSL_SetErrorCode(DSL_Ok); DSL_SetErrorCode(DSL_Ok);
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
@ -258,6 +263,9 @@ unsigned DSL_GetPlaybackRate(void)
int DisableInterrupts(void) int DisableInterrupts(void)
{ {
if (interrupts_disabled)
return 0;
interrupts_disabled = 1;
SDL_LockAudio(); SDL_LockAudio();
return(0); return(0);
} }
@ -265,6 +273,9 @@ int DisableInterrupts(void)
int RestoreInterrupts(int flags) int RestoreInterrupts(int flags)
{ {
UNREFERENCED_PARAMETER(flags); UNREFERENCED_PARAMETER(flags);
if (!interrupts_disabled)
return 0;
interrupts_disabled = 0;
SDL_UnlockAudio(); SDL_UnlockAudio();
return(0); return(0);
} }

View file

@ -41,11 +41,8 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu)
#define cdecl #define cdecl
#endif #endif
// for SDL_mixer.h _RW functions #define _NEED_SDLMIXER 1
#define USE_RWOPS #include "sdl_inc.h"
#include <SDL.h>
#include <SDL_mixer.h>
#include "music.h" #include "music.h"
#define __FX_TRUE (1 == 1) #define __FX_TRUE (1 == 1)
@ -178,8 +175,17 @@ int MUSIC_Init(int SoundCard, int Address)
{ {
// Use an external MIDI player if the user has specified to do so // Use an external MIDI player if the user has specified to do so
char *command = getenv("EDUKE32_MUSIC_CMD"); 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); external_midi = (command != NULL && command[0] != 0);
if(external_midi) if (external_midi)
Mix_SetMusicCMD(command); Mix_SetMusicCMD(command);
init_debugging(); init_debugging();
@ -204,7 +210,7 @@ int MUSIC_Shutdown(void)
musdebug("shutting down sound subsystem."); musdebug("shutting down sound subsystem.");
// TODO - make sure this is being called from the menu -- SA // TODO - make sure this is being called from the menu -- SA
if(external_midi) if (external_midi)
Mix_SetMusicCMD(NULL); Mix_SetMusicCMD(NULL);
MUSIC_StopSong(); MUSIC_StopSong();
@ -289,7 +295,7 @@ int MUSIC_StopSong(void)
if (music_musicchunk) if (music_musicchunk)
Mix_FreeMusic(music_musicchunk); Mix_FreeMusic(music_musicchunk);
if (music_songdata) if (music_songdata)
Bfree (music_songdata); Bfree(music_songdata);
music_musicchunk = NULL; music_musicchunk = NULL;
music_songdata = NULL; music_songdata = NULL;

View file

@ -1,275 +1,275 @@
/* /*
* DirectSound output code for MultiVoc * DirectSound output code for MultiVoc
* by Jonathon Fowler (jonof@edgenetwk.com) * by Jonathon Fowler (jonof@edgenetwk.com)
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "sdlout.h" #include "sdlout.h"
#include "SDL.h" #include "sdl_inc.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "sdlayer.h" #include "sdlayer.h"
#if defined(__WATCOMC__) || defined(_MSC_VER) #if defined(__WATCOMC__) || defined(_MSC_VER)
#include <malloc.h> #include <malloc.h>
#endif #endif
#ifndef RENDERTYPESDL #ifndef RENDERTYPESDL
#error The SDL output module for AudioLib only works with the SDL interface. #error The SDL output module for AudioLib only works with the SDL interface.
#endif #endif
static int(*_SDLSOUND_CallBack)(int) = NULL; static int(*_SDLSOUND_CallBack)(int) = NULL;
static int _SDLSOUND_BufferLength = 0; static int _SDLSOUND_BufferLength = 0;
static int _SDLSOUND_NumBuffers = 0; static int _SDLSOUND_NumBuffers = 0;
static char *_SDLSOUND_MixBuffer = NULL; static char *_SDLSOUND_MixBuffer = NULL;
static int SDLSOUND_Installed = FALSE; static int SDLSOUND_Installed = FALSE;
int SDLSOUND_ErrorCode = SDLSOUND_Ok; int SDLSOUND_ErrorCode = SDLSOUND_Ok;
#define SDLSOUND_SetErrorCode( status ) \ #define SDLSOUND_SetErrorCode( status ) \
SDLSOUND_ErrorCode = ( status ); SDLSOUND_ErrorCode = ( status );
static void isr(void *userdata, unsigned char *stream, int len); static void isr(void *userdata, unsigned char *stream, int len);
/* /*
* DisableInterrupts * DisableInterrupts
* Enter the critical section. * Enter the critical section.
*/ */
int DisableInterrupts(void) int DisableInterrupts(void)
{ {
SDL_LockAudio(); SDL_LockAudio();
return 0; return 0;
} }
/* /*
* RestoreInterrupts * RestoreInterrupts
* Leave the critical section. * Leave the critical section.
*/ */
int RestoreInterrupts(int a) int RestoreInterrupts(int a)
{ {
SDL_UnlockAudio(); SDL_UnlockAudio();
return 0; return 0;
a=a; a=a;
} }
/* /*
* SDLSOUND_ErrorString * SDLSOUND_ErrorString
* Returns a description of an error code. * Returns a description of an error code.
*/ */
char *SDLSOUND_ErrorString(int errorcode) char *SDLSOUND_ErrorString(int errorcode)
{ {
switch (errorcode) switch (errorcode)
{ {
case SDLSOUND_Warning: case SDLSOUND_Warning:
case SDLSOUND_Error: case SDLSOUND_Error:
return SDLSOUND_ErrorString(SDLSOUND_ErrorCode); return SDLSOUND_ErrorString(SDLSOUND_ErrorCode);
case SDLSOUND_Ok: case SDLSOUND_Ok:
return "SDL Sound ok."; return "SDL Sound ok.";
default: default:
return "Unknown SDL sound error code."; return "Unknown SDL sound error code.";
} }
} }
/* /*
* SDLSOUND_Init * SDLSOUND_Init
* Initializes the SDL sound objects. * Initializes the SDL sound objects.
*/ */
int SDLSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int buffersize) int SDLSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int buffersize)
{ {
SDL_AudioSpec spec,got; SDL_AudioSpec spec,got;
if (SDLSOUND_Installed) if (SDLSOUND_Installed)
{ {
SDLSOUND_Shutdown(); SDLSOUND_Shutdown();
} }
initprintf("Initializing SDL sound...\n"); initprintf("Initializing SDL sound...\n");
initprintf(" - Requested sound format\n" initprintf(" - Requested sound format\n"
" Channels: %d\n" " Channels: %d\n"
" Sample rate: %dHz\n" " Sample rate: %dHz\n"
" Sample size: %d bits\n", " Sample size: %d bits\n",
numchannels, mixrate, samplebits); numchannels, mixrate, samplebits);
spec.freq = mixrate; spec.freq = mixrate;
spec.format = (samplebits == 8 ? AUDIO_U8 : AUDIO_S16LSB); spec.format = (samplebits == 8 ? AUDIO_U8 : AUDIO_S16LSB);
spec.channels = (numchannels == 1 ? 1:2); spec.channels = (numchannels == 1 ? 1:2);
spec.samples = (buffersize >> (spec.channels-1)) >> (samplebits==16); spec.samples = (buffersize >> (spec.channels-1)) >> (samplebits==16);
spec.callback = isr; spec.callback = isr;
spec.userdata = NULL; spec.userdata = NULL;
SDLSOUND_Installed = TRUE; SDLSOUND_Installed = TRUE;
SDLSOUND_SetErrorCode(SDLSOUND_Ok); SDLSOUND_SetErrorCode(SDLSOUND_Ok);
return SDLSOUND_Ok; return SDLSOUND_Ok;
} }
/* /*
* SDLSOUND_Shutdown * SDLSOUND_Shutdown
* Shuts down SDL sound and it's associates. * Shuts down SDL sound and it's associates.
*/ */
int SDLSOUND_Shutdown(void) int SDLSOUND_Shutdown(void)
{ {
int i; int i;
if (SDLSOUND_Installed) initprintf("Uninitializing SDL sound...\n"); if (SDLSOUND_Installed) initprintf("Uninitializing SDL sound...\n");
SDLSOUND_Installed = FALSE; SDLSOUND_Installed = FALSE;
SDLSOUND_StopPlayback(); SDLSOUND_StopPlayback();
SDLSOUND_SetErrorCode(SDLSOUND_Ok); SDLSOUND_SetErrorCode(SDLSOUND_Ok);
return SDLSOUND_Ok; return SDLSOUND_Ok;
} }
/* /*
* SDLSOUND_SetMixMode * SDLSOUND_SetMixMode
* Bit of filler for the future. * Bit of filler for the future.
*/ */
int SDLSOUND_SetMixMode(int mode) int SDLSOUND_SetMixMode(int mode)
{ {
return mode; return mode;
} }
static void isr(void *userdata, unsigned char *stream, int len) static void isr(void *userdata, unsigned char *stream, int len)
{ {
// otherwise we just service the interrupt // otherwise we just service the interrupt
if (_DSOUND_CallBack) if (_DSOUND_CallBack)
{ {
p = _DSOUND_CallBack(rv-WAIT_OBJECT_0-1); p = _DSOUND_CallBack(rv-WAIT_OBJECT_0-1);
hr = IDirectSoundBuffer_Lock(lpDSBSecondary, p*_DSOUND_BufferLength, _DSOUND_BufferLength, hr = IDirectSoundBuffer_Lock(lpDSBSecondary, p*_DSOUND_BufferLength, _DSOUND_BufferLength,
&lockptr, &lockbytes, &lockptr2, &lockbytes2, 0); &lockptr, &lockbytes, &lockptr2, &lockbytes2, 0);
if (hr == DSERR_BUFFERLOST) if (hr == DSERR_BUFFERLOST)
{ {
hr = IDirectSoundBuffer_Restore(lpDSBSecondary); hr = IDirectSoundBuffer_Restore(lpDSBSecondary);
} }
if (hr == DS_OK) if (hr == DS_OK)
{ {
/* /*
#define copybuf(S,D,c) \ #define copybuf(S,D,c) \
({ void *__S=(S), *__D=(D); int __c=(c); \ ({ void *__S=(S), *__D=(D); int __c=(c); \
__asm__ __volatile__ ("rep; movsl" \ __asm__ __volatile__ ("rep; movsl" \
: "+S" (__S), "+D" (__D), "+c" (__c) : : "memory", "cc"); \ : "+S" (__S), "+D" (__D), "+c" (__c) : : "memory", "cc"); \
0; }) 0; })
*/ */
//copybuf(_DSOUND_MixBuffer + p * _DSOUND_BufferLength, lockptr, _DSOUND_BufferLength >> 2); //copybuf(_DSOUND_MixBuffer + p * _DSOUND_BufferLength, lockptr, _DSOUND_BufferLength >> 2);
memcpy(lockptr, _DSOUND_MixBuffer + p * _DSOUND_BufferLength, _DSOUND_BufferLength); memcpy(lockptr, _DSOUND_MixBuffer + p * _DSOUND_BufferLength, _DSOUND_BufferLength);
IDirectSoundBuffer_Unlock(lpDSBSecondary, lockptr, lockbytes, lockptr2, lockbytes2); IDirectSoundBuffer_Unlock(lpDSBSecondary, lockptr, lockbytes, lockptr2, lockbytes2);
} }
} }
} }
} }
/* /*
* SDLSOUND_BeginBufferedPlayback * SDLSOUND_BeginBufferedPlayback
* Unpause SDL sound playback. * Unpause SDL sound playback.
*/ */
int DSOUND_BeginBufferedPlayback(char *BufferStart, int(*CallBackFunc)(int), int buffersize, int numdivisions) int DSOUND_BeginBufferedPlayback(char *BufferStart, int(*CallBackFunc)(int), int buffersize, int numdivisions)
{ {
_SDLSOUND_CallBack = CallBackFunc; _SDLSOUND_CallBack = CallBackFunc;
_SDLSOUND_MixBuffer = BufferStart; _SDLSOUND_MixBuffer = BufferStart;
_SDLSOUND_BufferLength = buffersize/numdivisions; _SDLSOUND_BufferLength = buffersize/numdivisions;
_SDLSOUND_NumBuffers = numdivisions; _SDLSOUND_NumBuffers = numdivisions;
return SDLSOUND_Ok; return SDLSOUND_Ok;
} }
/* /*
* DSOUND_StopPlayback * DSOUND_StopPlayback
* Halts the playback thread. * Halts the playback thread.
*/ */
int DSOUND_StopPlayback(void) int DSOUND_StopPlayback(void)
{ {
// DWORD exitcode; // DWORD exitcode;
BOOL t; BOOL t;
int i; int i;
if (isrthread) if (isrthread)
{ {
SetEvent(isrfinish); SetEvent(isrfinish);
initprintf("DirectSound: Waiting for sound thread to exit\n"); initprintf("DirectSound: Waiting for sound thread to exit\n");
if (WaitForSingleObject(isrthread, 300) == WAIT_OBJECT_0) if (WaitForSingleObject(isrthread, 300) == WAIT_OBJECT_0)
initprintf("DirectSound: Sound thread has exited\n"); initprintf("DirectSound: Sound thread has exited\n");
else else
initprintf("DirectSound: Sound thread failed to exit!\n"); initprintf("DirectSound: Sound thread failed to exit!\n");
/* /*
while (1) { while (1) {
if (!GetExitCodeThread(isrthread, &exitcode)) { if (!GetExitCodeThread(isrthread, &exitcode)) {
DSOUND_SetErrorCode(DSOUND_FailedGetExitCode); DSOUND_SetErrorCode(DSOUND_FailedGetExitCode);
return DSOUND_Warning; return DSOUND_Warning;
} }
if (exitcode != STILL_ACTIVE) break; if (exitcode != STILL_ACTIVE) break;
}*/ }*/
CloseHandle(isrthread); CloseHandle(isrthread);
isrthread = NULL; isrthread = NULL;
} }
if (isrfinish) if (isrfinish)
{ {
CloseHandle(isrfinish); CloseHandle(isrfinish);
isrfinish = NULL; isrfinish = NULL;
} }
if (lpDSBSecondary) if (lpDSBSecondary)
{ {
IDirectSoundBuffer_Stop(lpDSBSecondary); IDirectSoundBuffer_Stop(lpDSBSecondary);
} }
if (hPosNotify) if (hPosNotify)
{ {
for (i=0; i<_DSOUND_NumBuffers; i++) for (i=0; i<_DSOUND_NumBuffers; i++)
{ {
if (hPosNotify[i]) CloseHandle(hPosNotify[i]); if (hPosNotify[i]) CloseHandle(hPosNotify[i]);
} }
free(hPosNotify); free(hPosNotify);
hPosNotify = NULL; hPosNotify = NULL;
} }
return DSOUND_Ok; return DSOUND_Ok;
} }

View file

@ -252,9 +252,12 @@ static void cachegoodsprites(void)
for (i = TRANSPORTERBEAM; i < (TRANSPORTERBEAM+6); i++) tloadtile(i,1); for (i = TRANSPORTERBEAM; i < (TRANSPORTERBEAM+6); i++) tloadtile(i,1);
for (i = SMALLSMOKE; i < (SMALLSMOKE+4); 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 = BLOOD; i < (BLOOD+4); i++) tloadtile(i,1);
for (i = JIBS1; i < (JIBS5+5); 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); for (i = SCRAP1; i < (SCRAP1+29); i++) tloadtile(i,1);
tloadtile(FIRELASER,1); tloadtile(FIRELASER,1);

View file

@ -10,14 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h> #include "dynamicgtk.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 "duke3d.h"
#include "build.h" #include "build.h"
@ -273,8 +266,8 @@ static GtkWidget *create_window(void)
GtkWidget *fullscreencheck; GtkWidget *fullscreencheck;
GtkWidget *vmode3dlabel; GtkWidget *vmode3dlabel;
GtkWidget *inputdevlabel; GtkWidget *inputdevlabel;
/* GtkWidget *sounddrvlabel; /* GtkWidget *sounddrvlabel;
GtkWidget *sounddrvcombo; */ GtkWidget *sounddrvcombo; */
GtkWidget *inputmousecheck; GtkWidget *inputmousecheck;
GtkWidget *inputjoycheck; GtkWidget *inputjoycheck;
GtkWidget *vmode3dcombo; GtkWidget *vmode3dcombo;
@ -368,21 +361,21 @@ static GtkWidget *create_window(void)
gtk_fixed_put(GTK_FIXED(configlayout), inputdevlabel, 0, 120); gtk_fixed_put(GTK_FIXED(configlayout), inputdevlabel, 0, 120);
gtk_widget_set_size_request(inputdevlabel, 88, 20); gtk_widget_set_size_request(inputdevlabel, 88, 20);
gtk_misc_set_alignment(GTK_MISC(inputdevlabel), 0, 0.5); gtk_misc_set_alignment(GTK_MISC(inputdevlabel), 0, 0.5);
/* /*
sounddrvlabel = gtk_label_new_with_mnemonic("S_ound driver:"); sounddrvlabel = gtk_label_new_with_mnemonic("S_ound driver:");
gtk_widget_show(sounddrvlabel); gtk_widget_show(sounddrvlabel);
gtk_fixed_put(GTK_FIXED(configlayout), sounddrvlabel, 0, 40); gtk_fixed_put(GTK_FIXED(configlayout), sounddrvlabel, 0, 40);
gtk_widget_set_size_request(sounddrvlabel, 88, 29); gtk_widget_set_size_request(sounddrvlabel, 88, 29);
gtk_misc_set_alignment(GTK_MISC(sounddrvlabel), 0, 0.5); gtk_misc_set_alignment(GTK_MISC(sounddrvlabel), 0, 0.5);
sounddrvcombo = gtk_combo_box_new_text(); sounddrvcombo = gtk_combo_box_new_text();
gtk_widget_show(sounddrvcombo); gtk_widget_show(sounddrvcombo);
gtk_fixed_put(GTK_FIXED(configlayout), sounddrvcombo, 88, 40); gtk_fixed_put(GTK_FIXED(configlayout), sounddrvcombo, 88, 40);
gtk_widget_set_size_request(sounddrvcombo, 31, 30); gtk_widget_set_size_request(sounddrvcombo, 31, 30);
gtk_widget_add_accelerator(sounddrvcombo, "grab_focus", accel_group, gtk_widget_add_accelerator(sounddrvcombo, "grab_focus", accel_group,
GDK_O, GDK_MOD1_MASK, GDK_O, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
*/ */
inputmousecheck = gtk_check_button_new_with_mnemonic("Mo_use"); inputmousecheck = gtk_check_button_new_with_mnemonic("Mo_use");
gtk_widget_show(inputmousecheck); gtk_widget_show(inputmousecheck);
gtk_fixed_put(GTK_FIXED(configlayout), inputmousecheck, 88, 120); gtk_fixed_put(GTK_FIXED(configlayout), inputmousecheck, 88, 120);
@ -574,9 +567,9 @@ static GtkWidget *create_window(void)
g_signal_connect((gpointer) fullscreencheck, "toggled", g_signal_connect((gpointer) fullscreencheck, "toggled",
G_CALLBACK(on_fullscreencheck_toggled), G_CALLBACK(on_fullscreencheck_toggled),
NULL); NULL);
/* g_signal_connect((gpointer) sounddrvcombo, "changed", /* g_signal_connect((gpointer) sounddrvcombo, "changed",
G_CALLBACK(on_sounddrvcombo_changed), G_CALLBACK(on_sounddrvcombo_changed),
NULL);*/ NULL);*/
g_signal_connect((gpointer) inputmousecheck, "toggled", g_signal_connect((gpointer) inputmousecheck, "toggled",
G_CALLBACK(on_inputmousecheck_toggled), G_CALLBACK(on_inputmousecheck_toggled),
NULL); NULL);
@ -619,8 +612,8 @@ static GtkWidget *create_window(void)
GLADE_HOOKUP_OBJECT(startwin, fullscreencheck, "fullscreencheck"); GLADE_HOOKUP_OBJECT(startwin, fullscreencheck, "fullscreencheck");
GLADE_HOOKUP_OBJECT(startwin, vmode3dlabel, "vmode3dlabel"); GLADE_HOOKUP_OBJECT(startwin, vmode3dlabel, "vmode3dlabel");
GLADE_HOOKUP_OBJECT(startwin, inputdevlabel, "inputdevlabel"); GLADE_HOOKUP_OBJECT(startwin, inputdevlabel, "inputdevlabel");
/* GLADE_HOOKUP_OBJECT(startwin, sounddrvlabel, "sounddrvlabel"); /* GLADE_HOOKUP_OBJECT(startwin, sounddrvlabel, "sounddrvlabel");
GLADE_HOOKUP_OBJECT(startwin, sounddrvcombo, "sounddrvcombo"); */ GLADE_HOOKUP_OBJECT(startwin, sounddrvcombo, "sounddrvcombo"); */
GLADE_HOOKUP_OBJECT(startwin, inputmousecheck, "inputmousecheck"); GLADE_HOOKUP_OBJECT(startwin, inputmousecheck, "inputmousecheck");
GLADE_HOOKUP_OBJECT(startwin, inputjoycheck, "inputjoycheck"); GLADE_HOOKUP_OBJECT(startwin, inputjoycheck, "inputjoycheck");
GLADE_HOOKUP_OBJECT(startwin, vmode3dcombo, "vmode3dcombo"); GLADE_HOOKUP_OBJECT(startwin, vmode3dcombo, "vmode3dcombo");