Fix sound channel saving/restoring for x86_64

Let's not store pointers as int to file. The code already allocs
channels on invalid pointers - well, afer fixing it ;)
This commit is contained in:
dhewg 2011-12-02 17:51:56 +01:00
parent ce976c4701
commit 962c0e6032

View file

@ -1197,10 +1197,10 @@ void idSoundWorldLocal::WriteToSaveGameSoundChannel( idFile *saveGame, idSoundCh
saveGame->WriteInt( ch->trigger44kHzTime ); saveGame->WriteInt( ch->trigger44kHzTime );
saveGame->WriteInt( ch->triggerGame44kHzTime ); saveGame->WriteInt( ch->triggerGame44kHzTime );
WriteToSaveGameSoundShaderParams( saveGame, &ch->parms ); WriteToSaveGameSoundShaderParams( saveGame, &ch->parms );
saveGame->WriteInt( (int)ch->leadinSample ); saveGame->WriteInt( 0 /* ch->leadinSample */ );
saveGame->WriteInt( ch->triggerChannel ); saveGame->WriteInt( ch->triggerChannel );
saveGame->WriteInt( (int)ch->soundShader ); saveGame->WriteInt( 0 /* ch->soundShader */ );
saveGame->WriteInt( (int)ch->decoder ); saveGame->WriteInt( 0 /* ch->decoder */ );
saveGame->WriteFloat(ch->diversity ); saveGame->WriteFloat(ch->diversity );
saveGame->WriteFloat(ch->lastVolume ); saveGame->WriteFloat(ch->lastVolume );
for (int m = 0; m < 6; m++) for (int m = 0; m < 6; m++)
@ -1295,7 +1295,7 @@ void idSoundWorldLocal::ReadFromSaveGame( idFile *savefile ) {
idSoundChannel *chan = &def->channels[channel]; idSoundChannel *chan = &def->channels[channel];
if ( chan->decoder != NULL ) { if ( !chan->decoder ) {
// The pointer in the save file is not valid, so we grab a new one // The pointer in the save file is not valid, so we grab a new one
chan->decoder = idSampleDecoder::Alloc(); chan->decoder = idSampleDecoder::Alloc();
} }
@ -1362,16 +1362,20 @@ void idSoundWorldLocal::ReadFromSaveGameSoundShaderParams( idFile *saveGame, sou
void idSoundWorldLocal::ReadFromSaveGameSoundChannel( idFile *saveGame, idSoundChannel *ch ) { void idSoundWorldLocal::ReadFromSaveGameSoundChannel( idFile *saveGame, idSoundChannel *ch ) {
saveGame->ReadBool( ch->triggerState ); saveGame->ReadBool( ch->triggerState );
char tmp; char tmp;
int i;
saveGame->ReadChar( tmp ); saveGame->ReadChar( tmp );
saveGame->ReadChar( tmp ); saveGame->ReadChar( tmp );
saveGame->ReadChar( tmp ); saveGame->ReadChar( tmp );
saveGame->ReadInt( ch->trigger44kHzTime ); saveGame->ReadInt( ch->trigger44kHzTime );
saveGame->ReadInt( ch->triggerGame44kHzTime ); saveGame->ReadInt( ch->triggerGame44kHzTime );
ReadFromSaveGameSoundShaderParams( saveGame, &ch->parms ); ReadFromSaveGameSoundShaderParams( saveGame, &ch->parms );
saveGame->ReadInt( (int&)ch->leadinSample ); saveGame->ReadInt( i );
ch->leadinSample = NULL;
saveGame->ReadInt( ch->triggerChannel ); saveGame->ReadInt( ch->triggerChannel );
saveGame->ReadInt( (int&)ch->soundShader ); saveGame->ReadInt( i );
saveGame->ReadInt( (int&)ch->decoder ); ch->soundShader = NULL;
saveGame->ReadInt( i );
ch->decoder = NULL;
saveGame->ReadFloat(ch->diversity ); saveGame->ReadFloat(ch->diversity );
saveGame->ReadFloat(ch->lastVolume ); saveGame->ReadFloat(ch->lastVolume );
for (int m = 0; m < 6; m++) for (int m = 0; m < 6; m++)