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 "dynamicgtk.h"
#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,8 +175,17 @@ 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)
if (external_midi)
Mix_SetMusicCMD(command);
init_debugging();
@ -204,7 +210,7 @@ int MUSIC_Shutdown(void)
musdebug("shutting down sound subsystem.");
// TODO - make sure this is being called from the menu -- SA
if(external_midi)
if (external_midi)
Mix_SetMusicCMD(NULL);
MUSIC_StopSong();
@ -289,7 +295,7 @@ int MUSIC_StopSong(void)
if (music_musicchunk)
Mix_FreeMusic(music_musicchunk);
if (music_songdata)
Bfree (music_songdata);
Bfree(music_songdata);
music_musicchunk = NULL;
music_songdata = NULL;

View file

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