TEENAGENT: Migrate engine to Path

This commit is contained in:
Le Philousophe 2023-09-17 18:23:46 +02:00 committed by Eugene Sandulenko
parent 3f9512c7cb
commit ed0b59973a
3 changed files with 12 additions and 12 deletions

View File

@ -41,12 +41,12 @@ void FilePack::close() {
file.close();
}
bool FilePack::open(const Common::String &filename) {
bool FilePack::open(const Common::Path &filename) {
if (!file.exists(filename) || !file.open(filename))
return false;
_fileCount = file.readUint32LE();
debugC(0, kDebugPack, "opened %s, found %u entries", filename.c_str(), _fileCount);
debugC(0, kDebugPack, "opened %s, found %u entries", filename.toString().c_str(), _fileCount);
offsets = new uint32[_fileCount + 1];
for (uint32 i = 0; i <= _fileCount; ++i) {
offsets[i] = file.readUint32LE();
@ -90,7 +90,7 @@ void TransientFilePack::close() {
_filename.clear();
}
bool TransientFilePack::open(const Common::String &filename) {
bool TransientFilePack::open(const Common::Path &filename) {
_filename = filename;
Common::File file;
@ -98,7 +98,7 @@ bool TransientFilePack::open(const Common::String &filename) {
return false;
_fileCount = file.readUint32LE();
debugC(0, kDebugPack, "opened %s, found %u entries", filename.c_str(), _fileCount);
debugC(0, kDebugPack, "opened %s, found %u entries", filename.toString().c_str(), _fileCount);
offsets = new uint32[_fileCount + 1];
for (uint32 i = 0; i <= _fileCount; ++i) {
offsets[i] = file.readUint32LE();
@ -151,13 +151,13 @@ void MemoryPack::close() {
chunks.clear();
}
bool MemoryPack::open(const Common::String &filename) {
bool MemoryPack::open(const Common::Path &filename) {
Common::File file;
if (!file.exists(filename) || !file.open(filename))
return false;
uint32 count = file.readUint32LE();
debugC(0, kDebugPack, "opened %s, found %u entries [memory]", filename.c_str(), count);
debugC(0, kDebugPack, "opened %s, found %u entries [memory]", filename.toString().c_str(), count);
for (uint32 i = 0; i < count; ++i) {
uint32 offset = file.readUint32LE();
int32 pos = file.pos();

View File

@ -34,7 +34,7 @@ protected:
public:
Pack(): _fileCount(0) {}
virtual ~Pack() {}
virtual bool open(const Common::String &filename) = 0;
virtual bool open(const Common::Path &filename) = 0;
virtual void close() = 0;
virtual uint32 fileCount() const { return _fileCount; }
@ -52,7 +52,7 @@ public:
FilePack();
~FilePack() override;
bool open(const Common::String &filename) override;
bool open(const Common::Path &filename) override;
void close() override;
uint32 getSize(uint32 id) const override;
@ -65,13 +65,13 @@ public:
**/
class TransientFilePack : public Pack {
uint32 *offsets;
Common::String _filename;
Common::Path _filename;
public:
TransientFilePack();
~TransientFilePack() override;
bool open(const Common::String &filename) override;
bool open(const Common::Path &filename) override;
void close() override;
uint32 getSize(uint32 id) const override;
@ -102,7 +102,7 @@ class MemoryPack : public Pack {
Common::Array<Chunk> chunks;
public:
bool open(const Common::String &filename) override;
bool open(const Common::Path &filename) override;
void close() override;
uint32 getSize(uint32 id) const override;

View File

@ -525,7 +525,7 @@ bool TeenAgentEngine::showMetropolis() {
}
Common::Error TeenAgentEngine::run() {
const Common::FSNode gameDataDir(ConfMan.get("path"));
const Common::FSNode gameDataDir(ConfMan.getPath("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "music");
if (!res->loadArchives(_gameDescription))