mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
Fix access to .he3/.he4 files
svn-id: r22118
This commit is contained in:
parent
1a7b4a7d7c
commit
e0a5a2b89e
@ -159,7 +159,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
|
||||
fi.file = new Common::File;
|
||||
|
||||
if (_fileName.empty()) { // We are running for the first time
|
||||
_fileName = _vm->generateFilename(3);
|
||||
_fileName = _vm->generateFilename(-3);
|
||||
}
|
||||
|
||||
|
||||
@ -1282,7 +1282,7 @@ int MacResExtractor::extractResource(int id, byte **buf) {
|
||||
int size;
|
||||
|
||||
if (_fileName.empty()) { // We are running for the first time
|
||||
_fileName = _vm->generateFilename(3);
|
||||
_fileName = _vm->generateFilename(-3);
|
||||
|
||||
// Some programs write it as .bin. Try that too
|
||||
if (!in.exists(_fileName)) {
|
||||
@ -1637,6 +1637,8 @@ void ScummEngine_v70he::readRoomsOffsets() {
|
||||
void ScummEngine_v70he::readGlobalObjects() {
|
||||
int num = _fileHandle->readUint16LE();
|
||||
assert(num == _numGlobalObjects);
|
||||
assert(_objectStateTable);
|
||||
assert(_objectOwnerTable);
|
||||
|
||||
_fileHandle->read(_objectStateTable, num);
|
||||
_fileHandle->read(_objectOwnerTable, num);
|
||||
|
@ -282,7 +282,7 @@ void SoundHE::setOverrideFreq(int freq) {
|
||||
void SoundHE::setupHEMusicFile() {
|
||||
int i, total_size;
|
||||
Common::File musicFile;
|
||||
Common::String buf(_vm->generateFilename(4));
|
||||
Common::String buf(_vm->generateFilename(-4));
|
||||
|
||||
if (musicFile.open(buf) == true) {
|
||||
musicFile.seek(4, SEEK_SET);
|
||||
@ -475,7 +475,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
||||
if (soundID > _vm->_numSounds) {
|
||||
int music_offs;
|
||||
Common::File musicFile;
|
||||
Common::String buf(_vm->generateFilename(4));
|
||||
Common::String buf(_vm->generateFilename(-4));
|
||||
|
||||
if (musicFile.open(buf) == false) {
|
||||
warning("playHESound: Can't open music file %s", buf.c_str());
|
||||
@ -634,6 +634,7 @@ void SoundHE::startHETalkSound(uint32 offset) {
|
||||
if (ConfMan.getBool("speech_mute"))
|
||||
return;
|
||||
|
||||
assert(_sfxFile);
|
||||
if (!_sfxFile->isOpen()) {
|
||||
error("startHETalkSound: Speech file is not open");
|
||||
return;
|
||||
|
@ -760,7 +760,7 @@ const MD5Table *findInMD5Table(const char *md5) {
|
||||
}
|
||||
|
||||
Common::String ScummEngine::generateFilename(const int room) const {
|
||||
const int diskNumber = room ? res.roomno[rtRoom][room] : 0;
|
||||
const int diskNumber = (room > 0) ? res.roomno[rtRoom][room] : 0;
|
||||
char buf[128];
|
||||
|
||||
if (_game.version == 4) {
|
||||
@ -784,8 +784,9 @@ Common::String ScummEngine::generateFilename(const int room) const {
|
||||
case kGenHEMac:
|
||||
case kGenHEMacNoParens:
|
||||
case kGenHEPC:
|
||||
// FIXME: Not sure if the following HE section is quite correct...
|
||||
if (_game.heversion >= 98) {
|
||||
if (room < 0) {
|
||||
id = '0' - room;
|
||||
} else if (_game.heversion >= 98) {
|
||||
int disk = 0;
|
||||
if (_heV7DiskOffsets)
|
||||
disk = _heV7DiskOffsets[room];
|
||||
|
Loading…
x
Reference in New Issue
Block a user