mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
Added an additional debuglevel "archiver" to facilitate displaying debug info from the BAR archiver. Also adjusted numeric debug levels.
svn-id: r41436
This commit is contained in:
parent
13dca9a176
commit
2c00d65501
@ -65,14 +65,14 @@ void BArchive::openArchive(const Common::String &path) {
|
||||
// Close previously opened archive (if any)
|
||||
closeArchive();
|
||||
|
||||
debugC(5, kDraciGeneralDebugLevel, "Loading BAR archive %s:",
|
||||
debugCN(2, kDraciArchiverDebugLevel, "Loading BAR archive %s: ",
|
||||
path.c_str());
|
||||
|
||||
f.open(path);
|
||||
if (f.isOpen()) {
|
||||
debugC(5, kDraciGeneralDebugLevel, "Success");
|
||||
debugC(2, kDraciArchiverDebugLevel, "Success");
|
||||
} else {
|
||||
debugC(5, kDraciGeneralDebugLevel, "Error");
|
||||
debugC(2, kDraciArchiverDebugLevel, "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,13 +80,13 @@ void BArchive::openArchive(const Common::String &path) {
|
||||
_path = path;
|
||||
|
||||
// Read archive header
|
||||
debugC(5, kDraciGeneralDebugLevel, "Checking magic number:");
|
||||
debugCN(2, kDraciArchiverDebugLevel, "Checking magic number: ");
|
||||
|
||||
f.read(buf, 4);
|
||||
if (memcmp(buf, _magicNumber, 4) == 0) {
|
||||
debugC(5, kDraciGeneralDebugLevel, "Success");
|
||||
debugC(2, kDraciArchiverDebugLevel, "Success");
|
||||
} else {
|
||||
debugC(5, kDraciGeneralDebugLevel, "Error");
|
||||
debugC(2, kDraciArchiverDebugLevel, "Error");
|
||||
f.close();
|
||||
return;
|
||||
}
|
||||
@ -95,7 +95,7 @@ void BArchive::openArchive(const Common::String &path) {
|
||||
footerOffset = f.readUint32LE();
|
||||
footerSize = f.size() - footerOffset;
|
||||
|
||||
debugC(5, kDraciGeneralDebugLevel, "Archive info: %d files, %d data bytes",
|
||||
debugC(2, kDraciArchiverDebugLevel, "Archive info: %d files, %d data bytes",
|
||||
_fileCount, footerOffset - _archiveHeaderSize);
|
||||
|
||||
// Read in footer
|
||||
@ -161,20 +161,21 @@ BAFile *BArchive::operator[](unsigned int i) const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
debugC(5, kDraciGeneralDebugLevel, "Accessing file %d from archive %s",
|
||||
debugCN(2, kDraciArchiverDebugLevel, "Accessing file %d from archive %s... ",
|
||||
i, _path.c_str());
|
||||
|
||||
// Check if file has already been opened and return that
|
||||
if (_files[i]._data) {
|
||||
debugC(2, kDraciArchiverDebugLevel, "Success");
|
||||
return _files + i;
|
||||
}
|
||||
|
||||
// Else open archive and read in requested file
|
||||
f.open(_path);
|
||||
if (f.isOpen()) {
|
||||
debugC(5, kDraciGeneralDebugLevel, "Success");
|
||||
debugC(2, kDraciArchiverDebugLevel, "Success");
|
||||
} else {
|
||||
debugC(5, kDraciGeneralDebugLevel, "Error");
|
||||
debugC(2, kDraciArchiverDebugLevel, "Error");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -189,7 +190,8 @@ BAFile *BArchive::operator[](unsigned int i) const {
|
||||
tmp ^= _files[i]._data[j];
|
||||
}
|
||||
|
||||
debugC(5, kDraciGeneralDebugLevel, "Read in file %d", i);
|
||||
debugC(3, kDraciArchiverDebugLevel, "Cached file %d from archive %s",
|
||||
i, _path.c_str());
|
||||
assert(tmp == _files[i]._crc && "CRC checksum mismatch");
|
||||
|
||||
return _files + i;
|
||||
|
@ -23,7 +23,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
@ -52,6 +51,7 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc)
|
||||
// Here is the right place to set up the engine specific debug levels
|
||||
Common::addDebugChannel(kDraciGeneralDebugLevel, "general", "Draci general debug level");
|
||||
Common::addDebugChannel(kDraciBytecodeDebugLevel, "bytecode", "GPL bytecode instructions");
|
||||
Common::addDebugChannel(kDraciArchiverDebugLevel, "archiver", "BAR archiver debug info");
|
||||
|
||||
// Don't forget to register your random source
|
||||
syst->getEventManager()->registerRandomSource(_rnd, "draci");
|
||||
@ -73,10 +73,11 @@ int DraciEngine::init() {
|
||||
initGraphics(320, 200, false);
|
||||
|
||||
// Basic archive test
|
||||
debugC(2, kDraciGeneralDebugLevel, "Running archive tests...");
|
||||
Common::String path("INIT.DFW");
|
||||
BArchive ar(path);
|
||||
BAFile *f;
|
||||
debugC(3, kDraciGeneralDebugLevel, "Number of file streams in archive: %d\n", ar.size());
|
||||
debugC(3, kDraciGeneralDebugLevel, "Number of file streams in archive: %d", ar.size());
|
||||
f = ar[0];
|
||||
debugC(3, kDraciGeneralDebugLevel, "First 10 bytes of file %d: ", 0);
|
||||
for (unsigned int i = 0; i < 10; ++i) {
|
||||
@ -103,6 +104,8 @@ int DraciEngine::go() {
|
||||
// Read in a sample palette
|
||||
byte *palette = new byte[4 * 256];
|
||||
|
||||
debugC(2, kDraciGeneralDebugLevel, "Running graphics/animation test...");
|
||||
|
||||
Common::String path("PALETY.DFW");
|
||||
BArchive ar(path);
|
||||
BAFile *f;
|
||||
@ -140,7 +143,7 @@ int DraciEngine::go() {
|
||||
ar.openArchive(path);
|
||||
|
||||
for (unsigned int t = 0; t < 25; ++t) {
|
||||
debugC(4, kDraciGeneralDebugLevel, "Drawing frame %d...", t);
|
||||
debugC(5, kDraciGeneralDebugLevel, "Drawing frame %d...", t);
|
||||
|
||||
// Load frame to memory
|
||||
f = ar[t];
|
||||
@ -163,7 +166,7 @@ int DraciEngine::go() {
|
||||
_system->updateScreen();
|
||||
_system->delayMillis(100);
|
||||
|
||||
debugC(4, kDraciGeneralDebugLevel, "Finished frame %d", t);
|
||||
debugC(5, kDraciGeneralDebugLevel, "Finished frame %d", t);
|
||||
|
||||
// Free frame memory
|
||||
delete [] scr;
|
||||
|
@ -49,7 +49,8 @@ private:
|
||||
|
||||
enum {
|
||||
kDraciGeneralDebugLevel = 1 << 0,
|
||||
kDraciBytecodeDebugLevel = 1 << 1
|
||||
kDraciBytecodeDebugLevel = 1 << 1,
|
||||
kDraciArchiverDebugLevel = 1 << 2
|
||||
};
|
||||
|
||||
} // End of namespace Draci
|
||||
|
Loading…
Reference in New Issue
Block a user