[Scummvm-git-logs] scummvm master -> a1ff802c67dcd5c6f451d08d1d64c76c658793cc
elasota
noreply at scummvm.org
Wed Aug 28 04:31:26 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a1ff802c67 MTROPOLIS: Added printVFS boot script function
Commit: a1ff802c67dcd5c6f451d08d1d64c76c658793cc
https://github.com/scummvm/scummvm/commit/a1ff802c67dcd5c6f451d08d1d64c76c658793cc
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-08-28T00:31:05-04:00
Commit Message:
MTROPOLIS: Added printVFS boot script function
Changed paths:
engines/mtropolis/boot.cpp
diff --git a/engines/mtropolis/boot.cpp b/engines/mtropolis/boot.cpp
index b35ffa417d2..e9a415a7515 100644
--- a/engines/mtropolis/boot.cpp
+++ b/engines/mtropolis/boot.cpp
@@ -1126,6 +1126,7 @@ public:
BitDepth getEnhancedBitDepth() const;
RuntimeVersion getRuntimeVersion() const;
const Common::Point &getResolution() const;
+ bool getWantPrintVFS() const;
private:
enum ArchiveType {
@@ -1150,6 +1151,7 @@ private:
void setEnhancedBitDepth(BitDepth bitDepth);
void setRuntimeVersion(RuntimeVersion version);
void setMainSegmentFile(const Common::String &mainSegmentFilePath);
+ void printVFS();
void executeFunction(const Common::String &functionName, const Common::Array<Common::String> ¶mTokens);
@@ -1171,13 +1173,17 @@ private:
Common::Array<Common::SharedPtr<Common::Archive> > _persistentArchives;
Common::String _mainSegmentFileOverride;
bool _isMac;
+ bool _wantPrintVFS;
Common::Point _preferredResolution;
BitDepth _bitDepth;
BitDepth _enhancedBitDepth;
RuntimeVersion _runtimeVersion;
};
-BootScriptContext::BootScriptContext(bool isMac) : _isMac(isMac), _preferredResolution(0, 0), _bitDepth(kBitDepthAuto), _enhancedBitDepth(kBitDepthAuto), _runtimeVersion(kRuntimeVersionAuto) {
+BootScriptContext::BootScriptContext(bool isMac)
+ : _isMac(isMac), _preferredResolution(0, 0)
+ , _bitDepth(kBitDepthAuto), _enhancedBitDepth(kBitDepthAuto), _runtimeVersion(kRuntimeVersionAuto)
+ , _wantPrintVFS(false) {
_vfsLayout._pathSeparator = isMac ? ':' : '/';
VirtualFileSystemLayout::ArchiveJunction fsJunction;
@@ -1295,6 +1301,9 @@ void BootScriptContext::setMainSegmentFile(const Common::String &mainSegmentFile
_mainSegmentFileOverride = mainSegmentFilePath;
}
+void BootScriptContext::printVFS() {
+ _wantPrintVFS = true;
+}
void BootScriptContext::bootObsidianRetailMacEn() {
addPlugIn(kPlugInObsidian);
@@ -1537,6 +1546,10 @@ void BootScriptContext::executeFunction(const Common::String &functionName, cons
parseString(functionName, paramTokens, 0, str1);
setMainSegmentFile(str1);
+ } else if (functionName == "printVFS") {
+ checkParams(functionName, paramTokens, 0);
+
+ printVFS();
} else {
error("Unknown function '%s'", functionName.c_str());
}
@@ -1631,6 +1644,10 @@ const Common::Point &BootScriptContext::getResolution() const {
return _preferredResolution;
}
+bool BootScriptContext::getWantPrintVFS() const {
+ return _wantPrintVFS;
+}
+
namespace Games {
@@ -2308,7 +2325,7 @@ void findWindowsMainSegment(Common::Archive &fs, const BootScriptContext &bootSc
for (const char *suffix : mainSegmentSuffixes) {
if (fileName.hasSuffixIgnoreCase(suffix)) {
filteredFiles.push_back(archiveMember);
- debug(4, "Identified possible main segment file %s", fileName.c_str());
+ debug(4, "Identified possible main segment file %s", archiveMember->getPathInArchive().toString(fs.getPathSeparator()).c_str());
break;
}
}
@@ -2682,6 +2699,57 @@ void resolveBitDepthAndResolutionFromPresentationSettings(Common::SeekableReadSt
BootConfiguration::BootConfiguration() : _bitDepth(0), _enhancedBitDepth(0), _width(0), _height(0) {
}
+bool stableSortCaseInsensitive(const Common::String &a, const Common::String &b) {
+ uint shorterPath = a.size();
+ if (b.size() < shorterPath)
+ shorterPath = b.size();
+
+ bool aLessSensitive = false;
+ bool bLessSensitive = false;
+ for (uint i = 0; i < shorterPath; i++) {
+ char ca = a[i];
+ char cb = b[i];
+
+ char ccia = invariantToLower(ca);
+ char ccib = invariantToLower(cb);
+
+ if (ccia < ccib)
+ return true;
+ if (ccib < ccia)
+ return false;
+
+ if (ca < cb)
+ aLessSensitive = true;
+ if (cb < ca)
+ bLessSensitive = true;
+ }
+
+ if (aLessSensitive)
+ return true;
+ if (bLessSensitive)
+ return false;
+
+ return a.size() < b.size();
+}
+
+struct StablePathInArchiveSorter {
+ explicit StablePathInArchiveSorter(char pathSeparator);
+
+ bool operator()(const Common::ArchiveMember *a, const Common::ArchiveMember *b) const {
+ Common::String aPathStr = a->getPathInArchive().toString(_pathSeparator);
+ Common::String bPathStr = b->getPathInArchive().toString(_pathSeparator);
+
+ return stableSortCaseInsensitive(aPathStr, bPathStr);
+ }
+
+private:
+ char _pathSeparator;
+};
+
+StablePathInArchiveSorter::StablePathInArchiveSorter(char pathSeparator) : _pathSeparator(pathSeparator) {
+}
+
+
BootConfiguration bootProject(const MTropolisGameDescription &gameDesc) {
BootConfiguration bootConfig;
@@ -2724,8 +2792,73 @@ BootConfiguration bootProject(const MTropolisGameDescription &gameDesc) {
bootScriptContext.finalize();
+ if (bootScriptContext.getWantPrintVFS()) {
+ const VirtualFileSystemLayout &vfsLayout = bootScriptContext.getVFSLayout();
+
+ char pathSeparator = vfsLayout._pathSeparator;
+
+ debug("VFS layout:");
+
+ debug("Workspace root: %s", vfsLayout._workspaceRoot.toString(pathSeparator).c_str());
+
+ debug("Archive junctions:");
+
+ for (const VirtualFileSystemLayout::ArchiveJunction &arcJunction : vfsLayout._archiveJunctions) {
+ debug("Physical paths from archive '%s':", arcJunction._archiveName.c_str());
+
+ Common::ArchiveMemberList memberList;
+ arcJunction._archive->listMembers(memberList);
+
+ Common::Array<Common::ArchiveMember *> sortedArchiveMembers;
+
+ for (const Common::ArchiveMemberPtr &archiveMember : memberList)
+ sortedArchiveMembers.push_back(archiveMember.get());
+
+ Common::sort(sortedArchiveMembers.begin(), sortedArchiveMembers.end(), StablePathInArchiveSorter(pathSeparator));
+
+ for (const Common::ArchiveMember *archiveMember : sortedArchiveMembers) {
+ debug(" %s%c%s", arcJunction._archiveName.c_str(), pathSeparator, archiveMember->getPathInArchive().toString(pathSeparator).c_str());
+ }
+
+ debug("");
+ }
+
+ debug("Virtual-to-physical path mappings:");
+ for (const VirtualFileSystemLayout::PathJunction &pathJunction : vfsLayout._pathJunctions) {
+ debug(" %s -> %s", pathJunction._srcPath.c_str(), pathJunction._destPath.c_str());
+ }
+ debug("");
+
+ debug("Exclusions:");
+
+ Common::StringArray exclusions = vfsLayout._exclusions;
+ Common::sort(exclusions.begin(), exclusions.end(), stableSortCaseInsensitive);
+
+ for (const Common::String &str : vfsLayout._exclusions)
+ debug(" %s", str.c_str());
+
+ debug("");
+ }
+
Common::SharedPtr<VirtualFileSystem> vfs(new VirtualFileSystem(bootScriptContext.getVFSLayout()));
+ if (bootScriptContext.getWantPrintVFS()) {
+ debug("Files in VFS:");
+ Common::ArchiveMemberList memberList;
+ vfs->listMembers(memberList);
+
+ Common::Array<Common::ArchiveMember *> sortedArchiveMembers;
+
+ for (const Common::ArchiveMemberPtr &archiveMember : memberList)
+ sortedArchiveMembers.push_back(archiveMember.get());
+
+ Common::sort(sortedArchiveMembers.begin(), sortedArchiveMembers.end(), StablePathInArchiveSorter(vfs->getPathSeparator()));
+
+ for (const Common::ArchiveMember *archiveMember : sortedArchiveMembers) {
+ debug(" %s", archiveMember->getPathInArchive().toString(vfs->getPathSeparator()).c_str());
+ }
+ }
+
Common::Path playerLocation;
Common::Path mainSegmentLocation;
Common::Path mainSegmentDirectory;
@@ -2800,6 +2933,8 @@ BootConfiguration bootProject(const MTropolisGameDescription &gameDesc) {
vfs->listMatchingMembers(pluginFiles, pluginsLocation.appendComponent("*"));
+
+ debug(4, "Looking for plug-in files in %s", pluginsLocation.toString(vfs->getPathSeparator()).c_str());
for (const Common::ArchiveMemberPtr &pluginFile : pluginFiles) {
Common::String fileName = pluginFile->getFileName();
uint fnameLen = fileName.size();
@@ -2813,6 +2948,10 @@ BootConfiguration bootProject(const MTropolisGameDescription &gameDesc) {
// want to rely on the filenames having the correct case on the user machine.
Common::sort(pluginPathsSorted.begin(), pluginPathsSorted.end(), Boot::sortPathFileName);
+ for (const Common::Path &plugInPath : pluginPathsSorted) {
+ debug(4, "Found plug-in %s", plugInPath.toString(vfs->getPathSeparator()).c_str());
+ }
+
if (gameDesc.desc.platform == Common::kPlatformMacintosh) {
Boot::loadCursorsMac(*vfs, playerLocation, *cursorGraphics);
More information about the Scummvm-git-logs
mailing list