Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 96407 | Differences between
and this patch

Collapse All | Expand All

(-)freecraft-030311-old/src/clone/clone.c (+29 lines)
Lines 191-196 Link Here
191
191
192
#ifdef USE_SDL
192
#ifdef USE_SDL
193
#include "SDL.h"
193
#include "SDL.h"
194
#include "SDL_thread.h"
194
#endif
195
#endif
195
196
196
#ifdef __MINGW32__
197
#ifdef __MINGW32__
Lines 225-230 Link Here
225
extern SCM CclUnits(void);
226
extern SCM CclUnits(void);
226
#endif
227
#endif
227
228
229
#ifdef USE_SDLCD
230
extern global SDL_mutex *cdromcheck_mutex;
231
extern global SDL_cond *cdromcheck_cond;
232
extern global int cdromcheck_done;
233
#endif
234
228
/*----------------------------------------------------------------------------
235
/*----------------------------------------------------------------------------
229
--	Variables
236
--	Variables
230
----------------------------------------------------------------------------*/
237
----------------------------------------------------------------------------*/
Lines 1393-1398 Link Here
1393
*/
1400
*/
1394
global int main(int argc,char** argv)
1401
global int main(int argc,char** argv)
1395
{
1402
{
1403
#ifdef USE_SDLCD
1404
    SDL_Thread *SDLCD_Sound_Thread;
1405
#endif
1406
    
1396
#ifdef USE_BEOS
1407
#ifdef USE_BEOS
1397
    //
1408
    //
1398
    //	Parse arguments for BeOS
1409
    //	Parse arguments for BeOS
Lines 1537-1544 Link Here
1537
    InitCcl();				// init CCL and load configurations!
1548
    InitCcl();				// init CCL and load configurations!
1538
    LoadCcl();
1549
    LoadCcl();
1539
1550
1551
#ifdef USE_SDLCD
1552
    cdromcheck_mutex = SDL_CreateMutex();
1553
    cdromcheck_cond = SDL_CreateCond();
1554
    cdromcheck_done = 0;
1555
    SDLCD_Sound_Thread = SDL_CreateThread(CDRomCheck, NULL);
1556
#endif
1557
1540
    main1(argc,argv);
1558
    main1(argc,argv);
1541
1559
1560
#ifdef USE_SDLCD
1561
    // Signal SDLCD_Sound_Thread to exit, then clean up.
1562
    SDL_mutexP(cdromcheck_mutex);
1563
    cdromcheck_done = 1;
1564
    SDL_CondSignal(cdromcheck_cond);
1565
    SDL_mutexV(cdromcheck_mutex);
1566
    SDL_WaitThread(SDLCD_Sound_Thread, NULL);
1567
    SDL_DestroyCond(cdromcheck_cond);
1568
    SDL_DestroyMutex(cdromcheck_mutex);
1569
#endif
1570
    
1542
    return 0;
1571
    return 0;
1543
}
1572
}
1544
1573
(-)freecraft-030311-old/src/clone/mainloop.c (-2 / +10 lines)
Lines 69-74 Link Here
69
#include "SDL_thread.h"
69
#include "SDL_thread.h"
70
#endif
70
#endif
71
71
72
#ifdef USE_SDLCD
73
extern global SDL_mutex *cdromcheck_mutex;
74
extern global SDL_cond *cdromcheck_cond;
75
extern global int cdromcheck_done;
76
#endif
77
72
//----------------------------------------------------------------------------
78
//----------------------------------------------------------------------------
73
//	Variables
79
//	Variables
74
//----------------------------------------------------------------------------
80
//----------------------------------------------------------------------------
Lines 726-732 Link Here
726
		case 0:				// Check cd-rom
732
		case 0:				// Check cd-rom
727
#if defined(USE_SDLCD)
733
#if defined(USE_SDLCD)
728
		    if ( !(GameCycle%4) ) {	// every 2nd second
734
		    if ( !(GameCycle%4) ) {	// every 2nd second
729
			SDL_CreateThread(CDRomCheck, NULL);
735
    			SDL_mutexP(cdromcheck_mutex);
736
			SDL_CondSignal(cdromcheck_cond);
737
			SDL_mutexV(cdromcheck_mutex);
730
		    }
738
		    }
731
#elif defined(USE_LIBCDA) || defined(USE_CDDA)
739
#elif defined(USE_LIBCDA) || defined(USE_CDDA)
732
		    CDRomCheck(NULL);
740
		    CDRomCheck(NULL);
Lines 735-741 Link Here
735
	    }
743
	    }
736
#endif
744
#endif
737
	}
745
	}
738
739
	UpdateMessages();		// update messages
746
	UpdateMessages();		// update messages
740
747
741
	//
748
	//
Lines 822-827 Link Here
822
	}
829
	}
823
    }
830
    }
824
831
832
    
825
    //
833
    //
826
    //	Game over
834
    //	Game over
827
    //
835
    //
(-)freecraft-030311-old/src/sound/sound_server.c (-31 / +46 lines)
Lines 81-86 Link Here
81
81
82
#if defined(USE_SDLCD)
82
#if defined(USE_SDLCD)
83
#include "SDL.h"
83
#include "SDL.h"
84
#include "SDL_thread.h"
84
#elif defined(USE_LIBCDA)
85
#elif defined(USE_LIBCDA)
85
#include "libcda.h"
86
#include "libcda.h"
86
#elif defined(USE_CDDA)
87
#elif defined(USE_CDDA)
Lines 108-113 Link Here
108
--	Variables
109
--	Variables
109
----------------------------------------------------------------------------*/
110
----------------------------------------------------------------------------*/
110
111
112
#ifdef USE_SDLCD
113
global SDL_mutex *cdromcheck_mutex;	// Make the CDRomCheck thread once
114
global SDL_cond *cdromcheck_cond;       // and use these three variables to
115
global int cdromcheck_done = 0;		// interact with it.
116
#endif
117
111
global int SoundFildes = -1;		/// audio file descriptor
118
global int SoundFildes = -1;		/// audio file descriptor
112
global int PlayingMusic;		/// flag true if playing music
119
global int PlayingMusic;		/// flag true if playing music
113
global int CallbackMusic;		/// flag true callback ccl if stops
120
global int CallbackMusic;		/// flag true callback ccl if stops
Lines 230-269 Link Here
230
global int CDRomCheck(void *unused __attribute__ ((unused)))
237
global int CDRomCheck(void *unused __attribute__ ((unused)))
231
{
238
{
232
#if defined(USE_SDLCD)
239
#if defined(USE_SDLCD)
233
    if (CDMode != CDModeOff && CDMode != CDModeStopped
240
    SDL_mutexP(cdromcheck_mutex);
234
	    && SDL_CDStatus(CDRom) == 1) {
241
    while (!cdromcheck_done)
235
	DebugLevel0Fn("Playing new track\n");
242
    {
236
	if (CDMode == CDModeAll) {
243
      SDL_CondWait(cdromcheck_cond, cdromcheck_mutex);
237
	    PlayCDRom(CDModeAll);
244
      if (CDMode != CDModeOff && CDMode != CDModeStopped
238
	} else if (CDMode == CDModeRandom) {
245
	      && SDL_CDStatus(CDRom) == 1) {
239
	    PlayCDRom(CDModeRandom);
246
	  DebugLevel0Fn("Playing new track\n");
240
	}
247
	  if (CDMode == CDModeAll) {
241
    }
248
	      PlayCDRom(CDModeAll);
249
	  } else if (CDMode == CDModeRandom) {
250
	      PlayCDRom(CDModeRandom);
251
	  }
252
      }
242
#elif defined(USE_LIBCDA)
253
#elif defined(USE_LIBCDA)
243
    if (CDMode != CDModeOff && CDMode != CDModeStopped
254
      if (CDMode != CDModeOff && CDMode != CDModeStopped
244
	    && !cd_current_track() && CDMode != CDModeDefined) {
255
	      && !cd_current_track() && CDMode != CDModeDefined) {
245
	DebugLevel0Fn("Playing new track\n");
256
	  DebugLevel0Fn("Playing new track\n");
246
	PlayCDRom(CDMode);
257
	  PlayCDRom(CDMode);
247
    } else if (CDMode != CDModeOff && CDMode != CDModeStopped) {
258
      } else if (CDMode != CDModeOff && CDMode != CDModeStopped) {
248
	if (CDMode == CDModeDefined) {
259
	  if (CDMode == CDModeDefined) {
249
	    PlayCDRom(CDMode);
260
	      PlayCDRom(CDMode);
250
	}
261
	  }
251
	DebugLevel0Fn("get track\n");
262
	  DebugLevel0Fn("get track\n");
252
	CDTrack = cd_current_track() + 1;
263
	  CDTrack = cd_current_track() + 1;
253
	if (CDTrack > NumCDTracks) {
264
	  if (CDTrack > NumCDTracks) {
254
	    CDTrack = 1;
265
	      CDTrack = 1;
255
	}
266
	  }
256
    }
267
      }
257
#elif defined(USE_CDDA)
268
#elif defined(USE_CDDA)
258
    if (CDMode != CDModeOff && CDMode != CDModeStopped
269
      if (CDMode != CDModeOff && CDMode != CDModeStopped
259
	    && !PlayingMusic) {
270
	      && !PlayingMusic) {
260
	DebugLevel0Fn("Playing new track\n");
271
	  DebugLevel0Fn("Playing new track\n");
261
	if (CDMode == CDModeAll) {
272
	  if (CDMode == CDModeAll) {
262
	    PlayCDRom(CDModeAll);
273
	      PlayCDRom(CDModeAll);
263
	} else if (CDMode == CDModeRandom) {
274
	  } else if (CDMode == CDModeRandom) {
264
	    PlayCDRom(CDModeRandom);
275
	      PlayCDRom(CDModeRandom);
265
	}
276
	  }
277
      }
278
#endif
279
#if defined(USE_SDLCD)
266
    }
280
    }
281
    SDL_mutexV(cdromcheck_mutex);
267
#endif
282
#endif
268
    return 0;
283
    return 0;
269
}
284
}

Return to bug 96407