make sure it knows whether an audio CD just inserted is the official one

This commit is contained in:
kreatordxx 2008-06-17 13:41:29 +00:00
parent 16cfedcccd
commit 566efbd634
2 changed files with 58 additions and 3 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20080617
--------
main/songs.c: start at track 1 and continue playing audio CD if it's not the original Mac one (this is how it worked before)
20080615
--------
main/gameseq.c, main/mission.c, main/newdemo.c, main/scores.c: Fixed scores write (wasn't PhysFS); Fixed PLAYING_BUILTING_MISSION in D1X; Better call for DoJasonInterpolate in demo code (hopefully)

View file

@ -218,10 +218,58 @@ int play_redbook_track(int tracknum,int keep_playing)
return (Redbook_playing != 0);
}
#define REDBOOK_FIRST_LEVEL_TRACK 6
/*
* This list may not be exhaustive!!
*/
#define D1_MAC_OEM_DISCID 0xde0feb0e // Descent CD that came with the Mac Performa 6400, hope mine isn't scratched [too much]
#define REDBOOK_FIRST_LEVEL_TRACK (songs_haved1_cd()?6:1)
#define REDBOOK_ENDLEVEL_TRACK 4
#define REDBOOK_ENDGAME_TRACK 14
// songs_haved1_cd returns 1 if the descent 1 Mac CD is in the drive and
// 0 otherwise
#if 1
int songs_haved1_cd()
{
int discid;
if (!GameCfg.SndEnableRedbook)
return 0;
discid = RBAGetDiscID();
switch (discid) {
case D1_MAC_OEM_DISCID: // Doesn't work with your Mac Descent CD? Please tell!
return 1;
default:
return 0;
}
}
#else
int songs_haved1_cd()
{
char temp[128],cwd[128];
getcwd(cwd, 128);
strcpy(temp,CDROM_dir);
#ifndef MACINTOSH //for PC, strip of trailing slash
if (temp[strlen(temp)-1] == '\\')
temp[strlen(temp)-1] = 0;
#endif
if ( !chdir(temp) ) {
chdir(cwd);
return 1;
}
return 0;
}
#endif
void songs_play_song( int songnum, int repeat )
{
if ( !Songs_initialized ) songs_init();
@ -265,11 +313,14 @@ void songs_play_level_song( int levelnum )
else
songnum = (levelnum-1) % cGameSongsAvailable;
if (GameCfg.SndEnableRedbook) {
if (!RBAEnabled() && GameCfg.SndEnableRedbook) // need this to determine if we currently have the official CD
reinit_redbook();
if (RBAEnabled() && GameCfg.SndEnableRedbook) {
//try to play redbook
play_redbook_track(REDBOOK_FIRST_LEVEL_TRACK + (songnum % (n_tracks-REDBOOK_FIRST_LEVEL_TRACK+1)),0);
play_redbook_track(REDBOOK_FIRST_LEVEL_TRACK + (songnum % (n_tracks-REDBOOK_FIRST_LEVEL_TRACK+1)),!songs_haved1_cd());
}
if (! Redbook_playing) { //not playing redbook, so play midi