It's wrong to assume a given file is located in gameDataPath, so do not use that to print out warnings that pretend otherwise

svn-id: r22272
This commit is contained in:
Max Horn 2006-05-01 22:27:56 +00:00
parent dbe1c50bc9
commit 84b2a4f76f
6 changed files with 13 additions and 15 deletions

View File

@ -37,8 +37,7 @@ Disk &Disk::getReference() {
return *int_disk;
}
Disk::Disk(const Common::String &gameDataPath) {
_gameDataPath = gameDataPath;
Disk::Disk() {
_fileNum = 0xff;
_fileHandle = NULL;
int_disk = this;
@ -63,7 +62,7 @@ uint8 Disk::indexOf(uint16 id, bool suppressError) {
}
if (suppressError) return 0xff;
error("Could not find entry Id #%d in file %sdisk%d.vga", id, _gameDataPath.c_str(), _fileNum);
error("Could not find entry Id #%d in file disk%d.vga", id, _fileNum);
}
void Disk::openFile(uint8 fileNum) {
@ -89,7 +88,7 @@ void Disk::openFile(uint8 fileNum) {
_fileHandle->open(sFilename);
if (!_fileHandle->isOpen())
error("Could not open %s%s", _gameDataPath.c_str(), sFilename);
error("Could not open %s", sFilename);
// Validate the header
char buffer[7];
@ -98,16 +97,16 @@ void Disk::openFile(uint8 fileNum) {
bytesRead = _fileHandle->read(buffer, 6);
buffer[6] = '\0';
if (strcmp(buffer, HEADER_IDENT_STRING) != 0)
error("The file %s%s was not a valid VGA file", _gameDataPath.c_str(), sFilename);
error("The file %s was not a valid VGA file", sFilename);
uint16 fileFileNum = _fileHandle->readUint16BE();
if (fileFileNum != _fileNum)
error("The file %s%s was not the correct file number", _gameDataPath.c_str(), sFilename);
error("The file %s was not the correct file number", sFilename);
// Read in the header entries
uint32 headerSize = sizeof(FileEntry) * NUM_ENTRIES_IN_HEADER;
if (_fileHandle->read(_entries, headerSize) != headerSize)
error("The file %s%s had a corrupted header", _gameDataPath.c_str(), sFilename);
error("The file %s had a corrupted header", sFilename);
#ifdef SCUMM_BIG_ENDIAN
// Process the read in header list to convert to big endian

View File

@ -41,14 +41,13 @@ namespace Lure {
class Disk {
private:
Common::String _gameDataPath;
uint8 _fileNum;
Common::File *_fileHandle;
FileEntry _entries[NUM_ENTRIES_IN_HEADER];
uint8 indexOf(uint16 id, bool suppressError = false);
public:
Disk(const Common::String &gameDataPath);
Disk();
~Disk();
static Disk &getReference();

View File

@ -262,7 +262,7 @@ int LureEngine::init() {
detectGame();
_sys = new System(_system);
_disk = new Disk(_gameDataPath);
_disk = new Disk();
_resources = new Resources();
_strings = new StringData();
_screen = new Screen(*_system);

View File

@ -35,13 +35,13 @@ namespace Sky {
static const char *dataFilename = "sky.dsk";
static const char *dinnerFilename = "sky.dnr";
Disk::Disk(const Common::String &gameDataPath) {
Disk::Disk() {
_dataDiskHandle = new Common::File();
_dnrHandle = new Common::File();
_dnrHandle->open(dinnerFilename);
if (!_dnrHandle->isOpen())
error("Could not open %s%s", gameDataPath.c_str(), dinnerFilename);
error("Could not open %s", dinnerFilename);
if (!(_dinnerTableEntries = _dnrHandle->readUint32LE()))
error("Error reading from sky.dnr"); //even though it was opened correctly?!
@ -54,7 +54,7 @@ Disk::Disk(const Common::String &gameDataPath) {
_dataDiskHandle->open(dataFilename);
if (!_dataDiskHandle->isOpen())
error("Error opening %s%s", gameDataPath.c_str(), dataFilename);
error("Error opening %s", dataFilename);
printf("Found BASS version v0.0%d (%d dnr entries)\n", determineGameVersion(), _dinnerTableEntries);

View File

@ -38,7 +38,7 @@ namespace Sky {
class Disk {
public:
Disk(const Common::String &gameDataPath);
Disk();
~Disk(void);
uint8 *loadFile(uint16 fileNr);

View File

@ -323,7 +323,7 @@ int SkyEngine::init() {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_floppyIntro = ConfMan.getBool("alt_intro");
_skyDisk = new Disk(_gameDataPath);
_skyDisk = new Disk();
_skySound = new Sound(_mixer, _skyDisk, ConfMan.getInt("sfx_volume"));
_systemVars.gameVersion = _skyDisk->determineGameVersion();