[Scummvm-git-logs] scummvm master -> 18a6ad4c993e8a701e6dcd2379b23e99cbb96dc5

Quote58 noreply at scummvm.org
Wed Feb 15 22:03:08 UTC 2023


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

Summary:
a845f0bb61 COMMON: Move ProDos disk parser from Immortal engine to Common
8d2bd83365 JANITORIAL: Remove excess debug statements and inconsistent indentation in prodos.cpp/h
18a6ad4c99 IMMORTAL: Clarify Tile enum value duplicate as intentional


Commit: a845f0bb61f96701f16b717003c21f42b9e32996
    https://github.com/scummvm/scummvm/commit/a845f0bb61f96701f16b717003c21f42b9e32996
Author: Michael Hayman (michael at Michaels-iMac.local)
Date: 2023-02-15T17:02:41-05:00

Commit Message:
COMMON: Move ProDos disk parser from Immortal engine to Common

Changed paths:
  A common/formats/prodos.cpp
  A common/formats/prodos.h
  R engines/immortal/disk.cpp
  R engines/immortal/disk.h
    common/formats/module.mk
    engines/immortal/immortal.cpp
    engines/immortal/immortal.h
    engines/immortal/module.mk


diff --git a/common/formats/module.mk b/common/formats/module.mk
index e68397c5b5c..566fffbebcc 100644
--- a/common/formats/module.mk
+++ b/common/formats/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
 	iff_container.o \
 	ini-file.o \
 	json.o \
+	prodos.o \
 	quicktime.o \
 	winexe.o \
 	winexe_ne.o \
diff --git a/engines/immortal/disk.cpp b/common/formats/prodos.cpp
similarity index 99%
rename from engines/immortal/disk.cpp
rename to common/formats/prodos.cpp
index 1a757e0392b..04770a0c029 100644
--- a/engines/immortal/disk.cpp
+++ b/common/formats/prodos.cpp
@@ -19,9 +19,9 @@
  *
  */
 
-#include "immortal/disk.h"
+#include "common/formats/prodos.h"
 
-namespace Immortal {
+namespace Common {
 
 // --- ProDOSFile methods ---
 
@@ -427,4 +427,4 @@ Common::SeekableReadStream *ProDOSDisk::createReadStreamForMember(const Common::
 	return f->createReadStream();
 }
 
-} // namespace Immortal
+} // Namespace Common
diff --git a/engines/immortal/disk.h b/common/formats/prodos.h
similarity index 98%
rename from engines/immortal/disk.h
rename to common/formats/prodos.h
index 284e0f794a0..58068910ba4 100644
--- a/engines/immortal/disk.h
+++ b/common/formats/prodos.h
@@ -19,8 +19,8 @@
  *
  */
 
-#ifndef IMMORTAL_DISK_H
-#define IMMORTAL_DISK_H
+#ifndef COMMON_PRODOS_H
+#define COMMON_PRODOS_H
 
 #include "common/memstream.h"
 #include "common/file.h"
@@ -34,7 +34,7 @@
  * matter for game engines anyway.
  */
 
-namespace Immortal {
+namespace Common {
 
 // These values define for ProDOS how to read the file entry, and also whether it's a keyblock (if it is a directory header, it's the keyblock of that directory)
 enum FileType : char {
@@ -210,6 +210,6 @@ private:
 };
 
 
-} // namespace Immortal
+} // Namespace Common
 
 #endif
diff --git a/engines/immortal/immortal.cpp b/engines/immortal/immortal.cpp
index 90b19ca8d3a..d46bc86ff61 100644
--- a/engines/immortal/immortal.cpp
+++ b/engines/immortal/immortal.cpp
@@ -108,7 +108,7 @@ Common::ErrorCode ImmortalEngine::initDisks() {
 	if (SearchMan.hasFile("IMMORTAL.dsk")) {
 
 		// Instantiate the disk as an object. The disk will then open and parse itself
-		ProDOSDisk *diskBoot = new ProDOSDisk("IMMORTAL.dsk");
+		Common::ProDOSDisk *diskBoot = new Common::ProDOSDisk("IMMORTAL.dsk");
 		if (diskBoot) {
 
 			// With the disk successfully parsed, it can be added to the search manager
@@ -122,7 +122,7 @@ Common::ErrorCode ImmortalEngine::initDisks() {
 
 	// Check for the gfx disk
 	if (SearchMan.hasFile("IMMORTAL_GFX.dsk")) {
-		ProDOSDisk *diskGFX = new ProDOSDisk("IMMORTAL_GFX.dsk");
+		Common::ProDOSDisk *diskGFX = new Common::ProDOSDisk("IMMORTAL_GFX.dsk");
 		if (diskGFX) {
 			debug("Gfx disk found");
 			SearchMan.add("IMMORTAL_GFX.dsk", diskGFX, 0, true);
diff --git a/engines/immortal/immortal.h b/engines/immortal/immortal.h
index d56dfe8875b..7205d66a56c 100644
--- a/engines/immortal/immortal.h
+++ b/engines/immortal/immortal.h
@@ -37,9 +37,7 @@
 // Detection is only needed by the main engine
 #include "immortal/detection.h"
 
-// Disk is only used by immortal.cpp
-#include "immortal/disk.h"
-
+#include "common/formats/prodos.h"
 #include "common/debug-channels.h"
 #include "common/events.h"
 #include "common/scummsys.h"
diff --git a/engines/immortal/module.mk b/engines/immortal/module.mk
index 54038fbe0a0..142bc745e93 100644
--- a/engines/immortal/module.mk
+++ b/engines/immortal/module.mk
@@ -5,7 +5,6 @@ MODULE_OBJS = \
 	compression.o \
 	cycle.o \
 	door.o \
-	disk.o \
 	drawChr.o \
 	flameSet.o \
 	immortal.o \


Commit: 8d2bd8336521252332cd3a40d5bbab1bd3d52b90
    https://github.com/scummvm/scummvm/commit/8d2bd8336521252332cd3a40d5bbab1bd3d52b90
Author: Michael Hayman (michael at Michaels-iMac.local)
Date: 2023-02-15T17:02:41-05:00

Commit Message:
JANITORIAL: Remove excess debug statements and inconsistent indentation in prodos.cpp/h

Changed paths:
    common/formats/prodos.cpp
    common/formats/prodos.h


diff --git a/common/formats/prodos.cpp b/common/formats/prodos.cpp
index 04770a0c029..7e3192c5f3d 100644
--- a/common/formats/prodos.cpp
+++ b/common/formats/prodos.cpp
@@ -85,7 +85,7 @@ int ProDOSFile::parseIndexBlock(byte *memOffset, int blockNum, int rem) const {
 		 */
 		diskPos = _disk->pos();
 
-		_disk->skip(255);                       // The high bytes are stored at the end of the block instead because reasons???
+		_disk->skip(255);                       // The high bytes are stored at the end of the block
 		dataOffset = (dataOffset + (_disk->readByte() << 8)) * ProDOSDisk::kBlockSize;    // High byte is second
 
 		getDataBlock(memOffset + readSize, dataOffset, dataSize);
@@ -287,14 +287,12 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
 
 		FileEntry fileEntry;
 		getFileEntry(&fileEntry);
-		//debug("%s", fileEntry._name);
 		parsedFiles++;
 		currPos = _disk.pos();
 
 		// It is a regular file if (dead < file type < pascal) and the file has a size
 		if ((kFileTypeDead < fileEntry._type) && (fileEntry._type < kFileTypePascal) && (fileEntry._eof > 0)) {
 			Common::String fileName = path + fileEntry._name;
-			//debug("%s", fileName.c_str());
 			ProDOSFile *currFile = new ProDOSFile(fileEntry._name, fileEntry._type, fileEntry._totalBlocks, fileEntry._eof, fileEntry._blockPtr, &_disk);
 
 			_files.setVal(fileName, Common::SharedPtr<ProDOSFile>(currFile));
@@ -302,9 +300,7 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
 
 			// Otherwise, if it is a subdirectory, we want to explore that subdirectory
 		} else if (fileEntry._type == kFileTypeSubDir) {
-
 			_disk.seek(fileEntry._blockPtr * kBlockSize);
-			//debug("--- diving into a subdirectory ---");
 
 			uint16 subP = _disk.readUint16LE();
 			uint16 subN = _disk.readUint16LE();
@@ -315,7 +311,6 @@ void ProDOSDisk::searchDirectory(DirHeader *h, uint16 p, uint16 n, Common::Strin
 			Common::String subPath = Common::String(path + subHead._name + '/');
 			searchDirectory(&subHead, subP, subN, path);
 
-			//debug("--- surfacing to parent directory ---");
 			_disk.seek(currPos);
 		}
 	}
@@ -345,8 +340,6 @@ void ProDOSDisk::getVolumeBitmap(VolHeader *h) {
 /* Gets the volume information and parses the filesystem, adding file objects to a map as it goes */
 
 bool ProDOSDisk::open(const Common::String filename) {
-	debug("opening %s", filename.c_str());
-
 	_disk.open(filename);
 	_disk.read(_loader1, kBlockSize);
 	_disk.read(_loader2, kBlockSize);
@@ -356,8 +349,6 @@ bool ProDOSDisk::open(const Common::String filename) {
 
 	VolHeader header;
 	getVolumeHeader(&header);
-	debug("volume name: %s", header._name);
-
 	getVolumeBitmap(&header);
 
 	Common::String pathName;                        // This is so that the path name starts blank, and then for every directory searched it adds the directory name to the path
@@ -370,7 +361,7 @@ bool ProDOSDisk::open(const Common::String filename) {
 
 ProDOSDisk::ProDOSDisk(const Common::String filename) {
 	if (open(filename)) {
-		debug("%s has been loaded", filename.c_str());
+		//debug("%s has been loaded", filename.c_str());
 	}
 }
 
diff --git a/common/formats/prodos.h b/common/formats/prodos.h
index 58068910ba4..1dd6784b724 100644
--- a/common/formats/prodos.h
+++ b/common/formats/prodos.h
@@ -111,10 +111,10 @@ private:
 
 class ProDOSDisk : public Common::Archive {
 public:
-	static const int kBlockSize = 512;       // A ProDOS block is always 512 bytes (should this be an enum?)
+	static const int kBlockSize = 512;		// A ProDOS block is always 512 bytes (should this be an enum?)
 
 	ProDOSDisk(const Common::String filename);
-	~ProDOSDisk();                           // Frees the memory used in the dictionary and the volume bitmap
+	~ProDOSDisk();							// Frees the memory used in the dictionary and the volume bitmap
 
 	// Called from the constructor, it parses the volume and fills the hashmap with files
 	bool open(const Common::String filename);
@@ -126,12 +126,12 @@ public:
 	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
 
 private:
-	byte  _loader1[kBlockSize];        // There's not much reason for these to be needed, but I included them just in case
-	byte  _loader2[kBlockSize];
-	Common::String _name;                       // Name of volume
-	Common::File _disk;                       // The volume file itself
-	int  _volBlocks;                  // Total blocks in volume
-	byte *_volBitmap;                  // This can determine if the volume is corrupt as it contains a bit for every block, where 0 = unused, 1 = used
+	byte _loader1[kBlockSize];				// There's not much reason for these to be needed, but I included them just in case
+	byte _loader2[kBlockSize];
+	Common::String _name;					// Name of volume
+	Common::File _disk;						// The volume file itself
+	int _volBlocks;							// Total blocks in volume
+	byte *_volBitmap;						// This can determine if the volume is corrupt as it contains a bit for every block, where 0 = unused, 1 = used
 	Common::HashMap<Common::String, Common::SharedPtr<ProDOSFile>> _files; // Hashmap of files in the volume, where key=Path, Value=ProDOSFile
 
 	struct Date {
@@ -146,17 +146,17 @@ private:
 	};
 
 	struct VolHeader {
-		uint8 _type;                       // Not really important for a volume header, as this will always be F
+		uint8 _type;						// Not really important for a volume header, as this will always be F
 		uint8 _nameLen;
 		char _name[16];
-		byte _reserved[8];                // Extra space reserved for possible future uses, not important
+		byte _reserved[8];					// Extra space reserved for possible future uses, not important
 		Date _date;
 		Time _time;
 		uint8 _ver;
-		uint8 _minVer;                     // Should pretty much always be 0 as far as I know
-		uint8 _access;                     // If this ends up useful, there should be an enum for the access values
-		uint8 _entryLen;                   // Always 27 in ProDOS 1.0
-		uint8 _entriesPerBlock;            // Always 0D in ProDOS 1.0
+		uint8 _minVer;						// Should pretty much always be 0 as far as I know
+		uint8 _access;						// If this ends up useful, there should be an enum for the access values
+		uint8 _entryLen;					// Always 27 in ProDOS 1.0
+		uint8 _entriesPerBlock;				// Always 0D in ProDOS 1.0
 		uint16 _fileCount;                  // Number of files across all data blocks in this directory
 		uint16 _bitmapPtr;                  // Block pointer to the keyblock of the bitmap for the entire volume
 		uint16 _volBlocks;                  // Blocks in entire volume
@@ -176,15 +176,15 @@ private:
 		uint8 _entriesPerBlock;
 		uint16 _fileCount;
 		uint16 _parentBlockPtr;             // These values allow ProDOS to navigate back out of a directory, but they aren't really needed by the class to navigate
-		uint8 _parentEntryIndex;           // Index in the current directory
-		uint8 _parentEntryLen;             // This is always 27 in ProDOS 1.0
+		uint8 _parentEntryIndex;			// Index in the current directory
+		uint8 _parentEntryLen;				// This is always 27 in ProDOS 1.0
 	};
 
 	struct FileEntry {
-		uint8 _type;                       // 0 = inactive, 1-3 = file, 4 = pascal area, 14 = subdirectory, 15 = volume directory
+		uint8 _type;						// 0 = inactive, 1-3 = file, 4 = pascal area, 14 = subdirectory, 15 = volume directory
 		uint8 _nameLen;
 		char _name[16];
-		uint8 _ext;                        // File extension, uses the enum FileExt
+		uint8 _ext;							// File extension, uses the enum FileExt
 		uint16 _blockPtr;                   // Block pointer to data for seedling, index block for sapling, or master block for tree
 		uint16 _totalBlocks;                // Really important to remember this is the total *including* the index block
 		uint32 _eof;                        // This is a long (3 bytes, read low to high) value representing the total readable data in a file (unless it's a sparse file, be careful!)


Commit: 18a6ad4c993e8a701e6dcd2379b23e99cbb96dc5
    https://github.com/scummvm/scummvm/commit/18a6ad4c993e8a701e6dcd2379b23e99cbb96dc5
Author: Michael Hayman (michael at Michaels-iMac.local)
Date: 2023-02-15T17:02:41-05:00

Commit Message:
IMMORTAL: Clarify Tile enum value duplicate as intentional

Changed paths:
    engines/immortal/room.h


diff --git a/engines/immortal/room.h b/engines/immortal/room.h
index 4a055259824..89950412e28 100644
--- a/engines/immortal/room.h
+++ b/engines/immortal/room.h
@@ -50,7 +50,7 @@ enum Tile : uint8 {
 	kTileTopLower75,
 	kTileLower3,
 	kTileLower5,
-	kTileCeilingTile = 2
+	kTileCeilingTile = 2 // This duplicate is intentional
 };
 
 /* Quick note:




More information about the Scummvm-git-logs mailing list