mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
DIRECTOR: Fix mac name
This commit is contained in:
parent
2622a4628f
commit
854300607c
@ -27,6 +27,7 @@
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/archive.h"
|
||||
#include "director/util.h"
|
||||
|
||||
namespace Director {
|
||||
|
||||
@ -41,6 +42,8 @@ Archive::~Archive() {
|
||||
close();
|
||||
}
|
||||
|
||||
Common::String Archive::getFileName() const { return Director::getFileName(_pathName); }
|
||||
|
||||
bool Archive::openFile(const Common::String &fileName) {
|
||||
Common::File *file = new Common::File();
|
||||
|
||||
@ -50,7 +53,7 @@ bool Archive::openFile(const Common::String &fileName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_fileName = fileName;
|
||||
_pathName = fileName;
|
||||
|
||||
if (!openStream(file)) {
|
||||
warning("Archive::openFile(): Error loading stream from file %s", fileName.c_str());
|
||||
@ -225,10 +228,10 @@ bool MacArchive::openFile(const Common::String &fileName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_fileName = _resFork->getBaseFileName();
|
||||
if (_fileName.hasSuffix(".bin")) {
|
||||
_pathName = _resFork->getBaseFileName();
|
||||
if (_pathName.hasSuffix(".bin")) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
_fileName.deleteLastChar();
|
||||
_pathName.deleteLastChar();
|
||||
}
|
||||
|
||||
readTags();
|
||||
@ -251,8 +254,8 @@ bool MacArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffs
|
||||
return false;
|
||||
}
|
||||
|
||||
_fileName = "<stream>";
|
||||
_resFork->setBaseFileName(_fileName);
|
||||
_pathName = "<stream>";
|
||||
_resFork->setBaseFileName(_pathName);
|
||||
|
||||
readTags();
|
||||
|
||||
@ -534,8 +537,8 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
|
||||
dataSize = resources[i]->size;
|
||||
}
|
||||
Common::String prepend;
|
||||
if (_fileName.size() != 0)
|
||||
prepend = _fileName;
|
||||
if (_pathName.size() != 0)
|
||||
prepend = _pathName;
|
||||
else
|
||||
prepend = "stream";
|
||||
|
||||
|
@ -52,8 +52,9 @@ public:
|
||||
virtual bool openStream(Common::SeekableReadStream *stream, uint32 offset = 0) = 0;
|
||||
virtual void close();
|
||||
|
||||
Common::String getFileName() const { return _fileName; }
|
||||
void setFileName(const Common::String &name) { _fileName = name; }
|
||||
Common::String getPathName() const { return _pathName; }
|
||||
Common::String getFileName() const;
|
||||
void setPathName(const Common::String &name) { _pathName = name; }
|
||||
int getFileSize();
|
||||
|
||||
bool isOpen() const { return _stream != 0; }
|
||||
@ -78,7 +79,7 @@ protected:
|
||||
typedef Common::HashMap<uint32, ResourceMap> TypeMap;
|
||||
TypeMap _types;
|
||||
|
||||
Common::String _fileName;
|
||||
Common::String _pathName;
|
||||
};
|
||||
|
||||
class MacArchive : public Archive {
|
||||
|
@ -224,7 +224,7 @@ bool Cast::loadArchive() {
|
||||
if (_castArchive->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) {
|
||||
debug("Cast::loadArchive(): Movie has fonts. Loading....");
|
||||
|
||||
_vm->_wm->_fontMan->loadFonts(_castArchive->getFileName());
|
||||
_vm->_wm->_fontMan->loadFonts(_castArchive->getPathName());
|
||||
}
|
||||
|
||||
// CastMember Information Array
|
||||
|
@ -40,15 +40,15 @@ struct ScriptPatch {
|
||||
const char *replace;
|
||||
} const scriptPatches[] = {
|
||||
// Garbage at end of script
|
||||
{"warlock", kPlatformMacintosh, "WARLOCKSHIP/WARLOCKSHIP/UpForeECall", kScoreScript, 12,
|
||||
{"warlock", kPlatformMacintosh, "WARLOCKSHIP/UpForeECall", kScoreScript, 12,
|
||||
2, "SS Warlock:DATA:WARLOCKSHIP:Up.GCGunner", ""},
|
||||
{"warlock", kPlatformMacintosh, "WARLOCKSHIP/WARLOCKSHIP/UpForeECall", kScoreScript, 12,
|
||||
{"warlock", kPlatformMacintosh, "WARLOCKSHIP/UpForeECall", kScoreScript, 12,
|
||||
3, "Channels 17 to 18", ""},
|
||||
{"warlock", kPlatformMacintosh, "WARLOCKSHIP/WARLOCKSHIP/UpForeECall", kScoreScript, 12,
|
||||
{"warlock", kPlatformMacintosh, "WARLOCKSHIP/UpForeECall", kScoreScript, 12,
|
||||
4, "Frames 150 to 160", ""},
|
||||
|
||||
// Unbalanced 'end if' at the end of the script
|
||||
{"warlock", kPlatformMacintosh, "STAMBUL/STAMBUL/DRUNK", kMovieScript, 5,
|
||||
{"warlock", kPlatformMacintosh, "STAMBUL/DRUNK", kMovieScript, 5,
|
||||
5, "end if", ""},
|
||||
|
||||
// Garbage at end of script
|
||||
|
@ -254,7 +254,7 @@ void Movie::loadSharedCastsFrom(Common::String filename) {
|
||||
|
||||
return;
|
||||
}
|
||||
sharedCast->setFileName(filename);
|
||||
sharedCast->setPathName(filename);
|
||||
|
||||
debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||
debug(0, "@@@@ Loading shared cast '%s'", filename.c_str());
|
||||
|
@ -214,7 +214,7 @@ void Stage::loadEXE(const Common::String movie) {
|
||||
}
|
||||
|
||||
if (_mainArchive)
|
||||
_mainArchive->setFileName(movie);
|
||||
_mainArchive->setPathName(movie);
|
||||
}
|
||||
|
||||
void Stage::loadEXEv3(Common::SeekableReadStream *stream) {
|
||||
@ -344,7 +344,7 @@ void Stage::loadMac(const Common::String movie) {
|
||||
|
||||
Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
|
||||
_mainArchive = new RIFXArchive();
|
||||
_mainArchive->setFileName(movie);
|
||||
_mainArchive->setPathName(movie);
|
||||
|
||||
// First we need to detect PPC vs. 68k
|
||||
|
||||
|
@ -428,7 +428,7 @@ bool Stage::step() {
|
||||
|
||||
g_lingo->resetLingo();
|
||||
if (sharedCast && sharedCast->_castArchive
|
||||
&& sharedCast->_castArchive->getFileName().equalsIgnoreCase(_currentPath + _vm->_sharedCastFile)) {
|
||||
&& sharedCast->_castArchive->getPathName().equalsIgnoreCase(_currentPath + _vm->_sharedCastFile)) {
|
||||
_currentMovie->_sharedCast = sharedCast;
|
||||
} else {
|
||||
delete sharedCast;
|
||||
|
@ -402,6 +402,14 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
|
||||
return initialPath;
|
||||
}
|
||||
|
||||
Common::String getFileName(Common::String path) {
|
||||
while (path.contains('/')) {
|
||||
int pos = path.find('/');
|
||||
path = Common::String(&path.c_str()[pos + 1]);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
////// Mac --> Windows filename conversion
|
||||
//////////////////
|
||||
|
@ -40,6 +40,8 @@ Common::String getPath(Common::String path, Common::String cwd);
|
||||
|
||||
Common::String pathMakeRelative(Common::String path, bool recursive = true, bool addexts = true);
|
||||
|
||||
Common::String getFileName(Common::String path);
|
||||
|
||||
Common::String stripMacPath(const char *name);
|
||||
|
||||
Common::String convertMacFilename(const char *name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user