[Scummvm-git-logs] scummvm master -> 39f1b97fb99bef589126aa21ae168c55a1bd9f08

sev- noreply at scummvm.org
Fri Feb 10 22:51:32 UTC 2023


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1039667a08 JANIRORIAL: Reduce header dependency
4d244d431f COMMON: Added helper method for dumping Common::Archive contents
84806157d1 DIRECTOR: Added font loading quirk for mcluhan-mac
39f1b97fb9 GRAPHICS: MACGUI: Clean up "-Regular" prefix from the loaded MacFonts


Commit: 1039667a081394b5136a67343ab3691d9db0b1f2
    https://github.com/scummvm/scummvm/commit/1039667a081394b5136a67343ab3691d9db0b1f2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-10T23:51:13+01:00

Commit Message:
JANIRORIAL: Reduce header dependency

Changed paths:
    common/compression/vise.h


diff --git a/common/compression/vise.h b/common/compression/vise.h
index 8838382d61b..355f32abe95 100644
--- a/common/compression/vise.h
+++ b/common/compression/vise.h
@@ -25,8 +25,6 @@
  * - mtropolis
  */
 
-#include "common/array.h"
-#include "common/str.h"
 #include "common/archive.h"
 
 namespace Common {


Commit: 4d244d431fbe85f47a9167088f69cb7294988007
    https://github.com/scummvm/scummvm/commit/4d244d431fbe85f47a9167088f69cb7294988007
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-10T23:51:13+01:00

Commit Message:
COMMON: Added helper method for dumping Common::Archive contents

Changed paths:
    common/archive.cpp
    common/archive.h


diff --git a/common/archive.cpp b/common/archive.cpp
index 8875c80c298..07400e4d1d0 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -20,10 +20,12 @@
  */
 
 #include "common/archive.h"
+#include "common/file.h"
 #include "common/fs.h"
 #include "common/system.h"
 #include "common/textconsole.h"
 #include "common/memstream.h"
+#include "common/punycode.h"
 
 namespace Common {
 
@@ -62,6 +64,45 @@ int Archive::listMatchingMembers(ArchiveMemberList &list, const Path &pattern, b
 	return matches;
 }
 
+void Archive::dumpArchive(String destPath) {
+	Common::ArchiveMemberList files;
+
+	listMembers(files);
+
+	byte *data = nullptr;
+	uint dataSize = 0;
+
+	for (auto &f : files) {
+		Common::String filename = Common::punycode_encodefilename(f->getName());
+		warning("File: %s", filename.c_str());
+
+		Common::SeekableReadStream *stream = f->createReadStream();
+
+		uint32 len = stream->size();
+		if (dataSize < len) {
+			free(data);
+			data = (byte *)malloc(stream->size());
+			dataSize = stream->size();
+		}
+
+		stream->read(data, len);
+
+		Common::DumpFile out;
+		Common::String outname = destPath + filename;
+		if (!out.open(outname, true)) {
+			warning("Archive::dumpArchive(): Can not open dump file %s", outname.c_str());
+		} else {
+			out.write(data, len);
+			out.flush();
+			out.close();
+		}
+
+		delete stream;
+	}
+
+	free(data);
+}
+
 SeekableReadStream *MemcachingCaseInsensitiveArchive::createReadStreamForMember(const Path &path) const {
 	String translated = translatePath(path);
 	bool isNew = false;
diff --git a/common/archive.h b/common/archive.h
index 855c4162998..1ed647353d8 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -142,6 +142,11 @@ public:
 	 * @return The newly created input stream.
 	 */
 	virtual SeekableReadStream *createReadStreamForMember(const Path &path) const = 0;
+
+	/**
+	 * Dump all files from the archive to the given directory
+	 */
+	void dumpArchive(String destPath);
 };
 
 class MemcachingCaseInsensitiveArchive;


Commit: 84806157d136f498be1280158925974832573501
    https://github.com/scummvm/scummvm/commit/84806157d136f498be1280158925974832573501
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-10T23:51:14+01:00

Commit Message:
DIRECTOR: Added font loading quirk for mcluhan-mac

Changed paths:
    engines/director/game-quirks.cpp


diff --git a/engines/director/game-quirks.cpp b/engines/director/game-quirks.cpp
index 812909f18c0..01dd439e63c 100644
--- a/engines/director/game-quirks.cpp
+++ b/engines/director/game-quirks.cpp
@@ -19,6 +19,8 @@
  *
  */
 
+#include "common/compression/vise.h"
+#include "common/macresman.h"
 #include "common/memstream.h"
 #include "director/director.h"
 #include "graphics/macgui/macfontmanager.h"
@@ -85,8 +87,7 @@ static void quirkLzone() {
 	SearchMan.addSubDirectoryMatching(g_director->_gameDataDir, "win_data", 0, 2);
 }
 
-static void quirkMcLuhan() {
-	// TODO. Read fonts from MCLUHAN/SYSTEM directory
+static void quirkMcLuhanWin() {
 	g_director->_extraSearchPath.push_back("mcluhan\\");
 	Graphics::MacFontManager *fontMan = g_director->_wm->_fontMan;
 	fontMan->loadWindowsFont("MCLUHAN/SYSTEM/MCBOLD13.FON");
@@ -94,6 +95,35 @@ static void quirkMcLuhan() {
 	fontMan->loadWindowsFont("MCLUHAN/SYSTEM/MCL1N___.FON");
 }
 
+static void quirkMcLuhanMac() {
+	Common::SeekableReadStream *installer = Common::MacResManager::openFileOrDataFork("Understanding McLuhan Installer");
+
+	if (!installer) {
+		warning("quirkMcLuhanMac(): Cannot open installer file");
+		return;
+	}
+
+	Common::Archive *archive = Common::createMacVISEArchive(installer);
+
+	if (!archive) {
+		warning("quirkMcLuhanMac(): Failed to open installer");
+		return;
+	}
+
+	Common::MacResManager font;
+
+	if (!font.open("McLuhan-Regular", *archive)) {
+		warning("quirkMcLuhanMac(): Failed to load font file \"McLuhan-Regular\"");
+		return;
+	}
+
+	Graphics::MacFontManager *fontMan = g_director->_wm->_fontMan;
+	fontMan->loadFonts(&font);
+
+	delete archive;
+	delete installer;
+}
+
 struct Quirk {
 	const char *target;
 	Common::Platform platform;
@@ -114,7 +144,8 @@ struct Quirk {
 	{ "lzone", Common::kPlatformWindows, &quirkLzone },
 	{ "mamauta1", Common::kPlatformMacintosh, &quirk640x480Desktop },
 	{ "mamauta1", Common::kPlatformWindows, &quirk640x480Desktop },
-	{ "mcluhan", Common::kPlatformWindows, &quirkMcLuhan },
+	{ "mcluhan", Common::kPlatformWindows, &quirkMcLuhanWin },
+	{ "mcluhan", Common::kPlatformMacintosh, &quirkMcLuhanMac },
 	{ nullptr, Common::kPlatformUnknown, nullptr }
 };
 


Commit: 39f1b97fb99bef589126aa21ae168c55a1bd9f08
    https://github.com/scummvm/scummvm/commit/39f1b97fb99bef589126aa21ae168c55a1bd9f08
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-10T23:51:14+01:00

Commit Message:
GRAPHICS: MACGUI: Clean up "-Regular" prefix from the loaded MacFonts

Usage is in mcluhan quirk where we load font named "McLuhan-Regular"

Changed paths:
    graphics/macgui/macfontmanager.cpp


diff --git a/graphics/macgui/macfontmanager.cpp b/graphics/macgui/macfontmanager.cpp
index 1892720eef0..b1e9770dbc5 100644
--- a/graphics/macgui/macfontmanager.cpp
+++ b/graphics/macgui/macfontmanager.cpp
@@ -108,7 +108,7 @@ static AliasProto japaneseModeAliases[] = {
 };
 
 static const char *const fontStyleSuffixes[] = {
-	"",
+	"Regular",
 	"Bold",
 	"Italic",
 	"Underline",
@@ -131,9 +131,13 @@ int parseSlant(const Common::String fontname) {
 Common::String cleanFontName(const Common::String fontname) {
 	const char *pos;
 	Common::String f = fontname;
-	for (int i = 1; i < 7; i++) {
-		if ((pos = strstr(f.c_str(), fontStyleSuffixes[i])))
+	for (int i = 0; i < 7; i++) {
+		if ((pos = strstr(f.c_str(), fontStyleSuffixes[i]))) {
+			while (pos > f.c_str() && *(pos - 1) == '-')
+				pos--;
+
 			f = Common::String(f.c_str(), pos);
+		}
 	}
 	f.trim();
 
@@ -363,9 +367,7 @@ void MacFontManager::loadFonts(Common::MacResManager *fontFile) {
 			Common::String familyName = fontFile->getResName(MKTAG('F', 'O', 'N', 'D'), *iterator);
 			int familySlant = parseSlant(familyName);
 
-			if (familySlant) {
-				familyName = cleanFontName(familyName);
-			}
+			familyName = cleanFontName(familyName);
 
 			Graphics::MacFontFamily *fontFamily = new MacFontFamily(familyName);
 			fontFamily->load(*fond);




More information about the Scummvm-git-logs mailing list