mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
Don't crash if sound effect file doesn't exist
svn-id: r6327
This commit is contained in:
parent
3a4782f166
commit
5111eede5e
@ -94,7 +94,7 @@ static const char *const opcode_arg_table_simon2dos[256] = {
|
||||
" ", " ", "BT ", " ", "B "
|
||||
};
|
||||
|
||||
bool SimonState::loadGamePcFile(const char *filename)
|
||||
void SimonState::loadGamePcFile(const char *filename)
|
||||
{
|
||||
File * in = new File();
|
||||
int num_inited_objects;
|
||||
@ -159,8 +159,6 @@ bool SimonState::loadGamePcFile(const char *filename)
|
||||
error("Out of memory for strip text list");
|
||||
in->read(_stripped_txt_mem, file_size);
|
||||
in->close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimonState::readGamePcText(File *in)
|
||||
|
@ -828,7 +828,7 @@ void SimonState::loadTablesIntoMem(uint subr_id)
|
||||
warning("loadTablesIntoMem: didn't find %d", subr_id);
|
||||
}
|
||||
|
||||
void SimonState::readSting(uint a)
|
||||
bool SimonState::readSting(uint a)
|
||||
{
|
||||
char filename[11];
|
||||
uint16 size;
|
||||
@ -839,8 +839,10 @@ void SimonState::readSting(uint a)
|
||||
|
||||
_mus_file->open(filename, _gameDataPath);
|
||||
|
||||
if (!_mus_file->isOpen())
|
||||
return;
|
||||
if (!_mus_file->isOpen()) {
|
||||
warning("Can't load sound effect from '%s'", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
size = _mus_file->readUint16LE();
|
||||
|
||||
@ -850,6 +852,8 @@ void SimonState::readSting(uint a)
|
||||
|
||||
if (_mus_file->read(_mus_offsets, size) != size)
|
||||
error("Cannot read offsets");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimonState::playSting(uint a)
|
||||
@ -857,7 +861,8 @@ void SimonState::playSting(uint a)
|
||||
if (!midi._midi_sfx_toggle)
|
||||
return;
|
||||
|
||||
readSting(_midi_sfx);
|
||||
if (!readSting(_midi_sfx))
|
||||
return;
|
||||
|
||||
midi.shutdown();
|
||||
_mus_file->seek(_mus_offsets[a], SEEK_SET);
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
File *_mus_file;
|
||||
uint16 *_mus_offsets;
|
||||
|
||||
void SimonState::readSting(uint a);
|
||||
bool SimonState::readSting(uint a);
|
||||
void SimonState::playSting(uint a);
|
||||
|
||||
byte *_vc_ptr; /* video code ptr */
|
||||
@ -363,7 +363,7 @@ public:
|
||||
void readGamePcText(File *in);
|
||||
void readItemChildren(File *in, Item *item, uint tmp);
|
||||
void readItemFromGamePc(File *in, Item *item);
|
||||
bool loadGamePcFile(const char *filename);
|
||||
void loadGamePcFile(const char *filename);
|
||||
|
||||
byte *allocateItem(uint size);
|
||||
byte *allocateTable(uint size);
|
||||
|
Loading…
Reference in New Issue
Block a user