[Scummvm-git-logs] scummvm master -> 5cc4d4d255adc1ca981b9008830ada37b711f813

dreammaster dreammaster at scummvm.org
Tue Dec 29 01:14:52 UTC 2020


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:
be105aae83 ULTIMA4: Remove wrappers around Common::File
dbfb54255a ULTIMA4: Remove unused FileSystem classes
5cc4d4d255 ULTIMA4: Remove use of MemoryReadStream


Commit: be105aae83c0ede8a8200cc75725491593177d0e
    https://github.com/scummvm/scummvm/commit/be105aae83c0ede8a8200cc75725491593177d0e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-12-28T15:14:47-10:00

Commit Message:
ULTIMA4: Remove wrappers around Common::File

Changed paths:
    engines/ultima/ultima4/conversation/dialogueloader.cpp
    engines/ultima/ultima4/conversation/dialogueloader_tlk.cpp
    engines/ultima/ultima4/core/config.cpp
    engines/ultima/ultima4/filesys/u4file.cpp
    engines/ultima/ultima4/filesys/u4file.h
    engines/ultima/ultima4/game/person.cpp
    engines/ultima/ultima4/game/script.cpp
    engines/ultima/ultima4/gfx/image.h
    engines/ultima/ultima4/gfx/imageloader.h
    engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
    engines/ultima/ultima4/gfx/imageloader_fmtowns.h
    engines/ultima/ultima4/gfx/imageloader_png.cpp
    engines/ultima/ultima4/gfx/imageloader_png.h
    engines/ultima/ultima4/gfx/imageloader_u4.cpp
    engines/ultima/ultima4/gfx/imageloader_u4.h
    engines/ultima/ultima4/gfx/imagemgr.cpp
    engines/ultima/ultima4/gfx/imagemgr.h
    engines/ultima/ultima4/gfx/screen.h
    engines/ultima/ultima4/map/map.h
    engines/ultima/ultima4/map/maploader.cpp
    engines/ultima/ultima4/map/maploader.h
    engines/ultima/ultima4/map/mapmgr.cpp
    engines/ultima/ultima4/map/shrine.cpp
    engines/ultima/ultima4/sound/music.cpp
    engines/ultima/ultima4/sound/sound.cpp


diff --git a/engines/ultima/ultima4/conversation/dialogueloader.cpp b/engines/ultima/ultima4/conversation/dialogueloader.cpp
index dffcb48382..9b2e13f0be 100644
--- a/engines/ultima/ultima4/conversation/dialogueloader.cpp
+++ b/engines/ultima/ultima4/conversation/dialogueloader.cpp
@@ -25,7 +25,6 @@
 #include "ultima/ultima4/conversation/dialogueloader_hw.h"
 #include "ultima/ultima4/conversation/dialogueloader_lb.h"
 #include "ultima/ultima4/conversation/dialogueloader_tlk.h"
-#include "ultima/ultima4/filesys/u4file.h"
 
 namespace Ultima {
 namespace Ultima4 {
diff --git a/engines/ultima/ultima4/conversation/dialogueloader_tlk.cpp b/engines/ultima/ultima4/conversation/dialogueloader_tlk.cpp
index 392fa80c02..1247924ed2 100644
--- a/engines/ultima/ultima4/conversation/dialogueloader_tlk.cpp
+++ b/engines/ultima/ultima4/conversation/dialogueloader_tlk.cpp
@@ -22,8 +22,8 @@
 
 #include "ultima/ultima4/conversation/conversation.h"
 #include "ultima/ultima4/conversation/dialogueloader_tlk.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/shared/std/containers.h"
+#include "common/stream.h"
 
 namespace Ultima {
 namespace Ultima4 {
@@ -32,7 +32,7 @@ namespace Ultima4 {
  * A dialogue loader for standard u4dos .tlk files.
  */
 Dialogue *U4TlkDialogueLoader::load(void *source) {
-	Common::File *file = static_cast<Common::File *>(source);
+	Common::ReadStream *file = static_cast<Common::ReadStream *>(source);
 
 	enum QTrigger {
 		NONE = 0,
@@ -44,7 +44,7 @@ Dialogue *U4TlkDialogueLoader::load(void *source) {
 
 	/* there's no dialogues left in the file */
 	char tlk_buffer[288];
-	if (u4fread(tlk_buffer, 1, sizeof(tlk_buffer), file) != sizeof(tlk_buffer))
+	if (file->read(tlk_buffer, sizeof(tlk_buffer)) != sizeof(tlk_buffer))
 		return nullptr;
 
 	char *ptr = &tlk_buffer[3];
diff --git a/engines/ultima/ultima4/core/config.cpp b/engines/ultima/ultima4/core/config.cpp
index e21c37ba15..92ee469374 100644
--- a/engines/ultima/ultima4/core/config.cpp
+++ b/engines/ultima/ultima4/core/config.cpp
@@ -22,7 +22,6 @@
 
 #include "ultima/ultima4/core/config.h"
 #include "ultima/ultima4/core/settings.h"
-#include "ultima/ultima4/filesys/u4file.h"
 
 namespace Ultima {
 namespace Ultima4 {
diff --git a/engines/ultima/ultima4/filesys/u4file.cpp b/engines/ultima/ultima4/filesys/u4file.cpp
index 33640ba95b..fdf71638b1 100644
--- a/engines/ultima/ultima4/filesys/u4file.cpp
+++ b/engines/ultima/ultima4/filesys/u4file.cpp
@@ -21,64 +21,11 @@
  */
 
 #include "ultima/ultima4/filesys/u4file.h"
-#include "ultima/ultima4/core/utils.h"
 #include "ultima/shared/core/file.h"
-#include "common/debug.h"
-#include "common/file.h"
-#include "common/savefile.h"
-#include "common/system.h"
-#include "common/unzip.h"
 
 namespace Ultima {
 namespace Ultima4 {
 
-Common::File *u4fopen(const Common::String &fname) {
-	Common::File *u4f = nullptr;
-
-	if (!fname.empty()) {
-		u4f = new Common::File();
-		if (u4f->open(fname)) {
-			debug(1, "%s successfully opened\n", fname.c_str());
-		} else {
-			delete u4f;
-			u4f = nullptr;
-		}
-	}
-
-	return u4f;
-}
-
-void u4fclose(Common::File *&f) {
-	f->close();
-	delete f;
-	f = nullptr;
-}
-
-int u4fseek(Common::File *f, long offset, int whence) {
-	return f->seek(offset, whence);
-}
-
-long u4ftell(Common::File *f) {
-	return f->pos();
-}
-
-size_t u4fread(void *ptr, size_t size, size_t nmemb, Common::File *f) {
-	int count = f->read(ptr, size * nmemb);
-	return count / size;
-}
-
-int u4fgetc(Common::File *f) {
-	return f->readByte();
-}
-
-int u4fgetshort(Common::File *f) {
-	return f->readUint16LE();
-}
-
-long u4flength(Common::File *f) {
-	return f->size();
-}
-
 Std::vector<Common::String> u4read_stringtable(const Common::String &filename) {
 	Shared::File f(Common::String::format("data/text/%s.dat", filename.c_str()));
 	Std::vector<Common::String> strs;
@@ -90,25 +37,5 @@ Std::vector<Common::String> u4read_stringtable(const Common::String &filename) {
 	return strs;
 }
 
-Common::String u4find_path(const Common::String &fname, Common::List<Common::String> specificSubPaths) {
-	return fname;
-}
-
-Common::String u4find_music(const Common::String &fname) {
-	return "data/mid/" + fname;
-}
-
-Common::String u4find_sound(const Common::String &fname) {
-	return "data/sound/" + fname;
-}
-
-Common::String u4find_conf(const Common::String &fname) {
-	return "data/conf/" + fname;
-}
-
-Common::String u4find_graphics(const Common::String &fname) {
-	return "data/graphics/" + fname;
-}
-
 } // End of namespace Ultima4
 } // End of namespace Ultima
diff --git a/engines/ultima/ultima4/filesys/u4file.h b/engines/ultima/ultima4/filesys/u4file.h
index 4069766294..8661d70801 100644
--- a/engines/ultima/ultima4/filesys/u4file.h
+++ b/engines/ultima/ultima4/filesys/u4file.h
@@ -23,30 +23,12 @@
 #ifndef ULTIMA4_FILE_H
 #define ULTIMA4_FILE_H
 
-#include "common/file.h"
-#include "common/hash-str.h"
+#include "common/str.h"
 #include "ultima/shared/std/containers.h"
 
 namespace Ultima {
 namespace Ultima4 {
 
-/**
- * Open a data file
- */
-extern Common::File *u4fopen(const Common::String &fname);
-
-/**
- * Closes a data file from the Ultima 4 for DOS installation.
- */
-extern void u4fclose(Common::File *&f);
-
-extern int u4fseek(Common::File *f, long offset, int whence);
-extern long u4ftell(Common::File *f);
-extern size_t u4fread(void *ptr, size_t size, size_t nmemb, Common::File *f);
-extern int u4fgetc(Common::File *f);
-extern int u4fgetshort(Common::File *f);
-extern long u4flength(Common::File *f);
-
 /**
  * Read a series of zero terminated strings from a file.  The strings
  * are read from the given offset, or the current file position if
@@ -54,11 +36,6 @@ extern long u4flength(Common::File *f);
  */
 extern Std::vector<Common::String> u4read_stringtable(const Common::String &filename);
 
-extern Common::String u4find_music(const Common::String &fname);
-extern Common::String u4find_sound(const Common::String &fname);
-extern Common::String u4find_conf(const Common::String &fname);
-extern Common::String u4find_graphics(const Common::String &fname);
-
 } // End of namespace Ultima4
 } // End of namespace Ultima
 
diff --git a/engines/ultima/ultima4/game/person.cpp b/engines/ultima/ultima4/game/person.cpp
index d17bb25262..0df27c3e09 100644
--- a/engines/ultima/ultima4/game/person.cpp
+++ b/engines/ultima/ultima4/game/person.cpp
@@ -36,7 +36,6 @@
 #include "ultima/ultima4/core/utils.h"
 #include "ultima/ultima4/events/event_handler.h"
 #include "ultima/ultima4/filesys/savegame.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/map/city.h"
 #include "ultima/ultima4/map/location.h"
 #include "ultima/ultima4/sound/music.h"
diff --git a/engines/ultima/ultima4/game/script.cpp b/engines/ultima/ultima4/game/script.cpp
index f573f7098e..a11e6d6d5f 100644
--- a/engines/ultima/ultima4/game/script.cpp
+++ b/engines/ultima/ultima4/game/script.cpp
@@ -30,7 +30,6 @@
 #include "ultima/ultima4/events/event_handler.h"
 #include "ultima/ultima4/filesys/filesystem.h"
 #include "ultima/ultima4/filesys/savegame.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/game/game.h"
 #include "ultima/ultima4/game/player.h"
 #include "ultima/ultima4/game/weapon.h"
diff --git a/engines/ultima/ultima4/gfx/image.h b/engines/ultima/ultima4/gfx/image.h
index 790c801b1c..147d16d579 100644
--- a/engines/ultima/ultima4/gfx/image.h
+++ b/engines/ultima/ultima4/gfx/image.h
@@ -24,7 +24,6 @@
 #define ULTIMA4_GFX_IMAGE_H
 
 #include "ultima/ultima4/core/types.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/gfx/textcolor.h"
 #include "graphics/managed_surface.h"
 
diff --git a/engines/ultima/ultima4/gfx/imageloader.h b/engines/ultima/ultima4/gfx/imageloader.h
index 1c87510848..e28a601900 100644
--- a/engines/ultima/ultima4/gfx/imageloader.h
+++ b/engines/ultima/ultima4/gfx/imageloader.h
@@ -26,6 +26,10 @@
 #include "ultima/shared/std/containers.h"
 #include "common/str.h"
 
+namespace Common {
+class SeekableReadStream;
+}
+
 namespace Ultima {
 namespace Ultima4 {
 
@@ -69,7 +73,7 @@ protected:
 public:
 	ImageLoader() {}
 	virtual ~ImageLoader() {}
-	virtual Image *load(Common::File *file, int width, int height, int bpp) = 0;
+	virtual Image *load(Common::SeekableReadStream &stream, int width, int height, int bpp) = 0;
 };
 
 } // End of namespace Ultima4
diff --git a/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp b/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
index 18b040dc5c..9416497264 100644
--- a/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_fmtowns.cpp
@@ -26,21 +26,22 @@
 #include "ultima/ultima4/gfx/imageloader.h"
 #include "ultima/ultima4/gfx/imageloader_fmtowns.h"
 #include "ultima/ultima4/gfx/imageloader_u4.h"
+#include "common/stream.h"
 
 namespace Ultima {
 namespace Ultima4 {
 
-Image *FMTOWNSImageLoader::load(Common::File *file, int width, int height, int bpp) {
+Image *FMTOWNSImageLoader::load(Common::SeekableReadStream &stream, int width, int height, int bpp) {
 	if (width == -1 || height == -1 || bpp == -1) {
 		error("dimensions not set for fmtowns image");
 	}
 
 	assertMsg((bpp == 16) | (bpp == 4), "invalid bpp: %d", bpp);
 
-	int rawLen = file->size() - _offset;
-	file->seek(_offset, 0);
+	int rawLen = stream.size() - _offset;
+	stream.seek(_offset, 0);
 	byte *raw = (byte *) malloc(rawLen);
-	file->read(raw, rawLen);
+	stream.read(raw, rawLen);
 
 	int requiredLength = (width * height * bpp / 8);
 	if (rawLen < requiredLength) {
diff --git a/engines/ultima/ultima4/gfx/imageloader_fmtowns.h b/engines/ultima/ultima4/gfx/imageloader_fmtowns.h
index d1aea8a53a..6c83177bdc 100644
--- a/engines/ultima/ultima4/gfx/imageloader_fmtowns.h
+++ b/engines/ultima/ultima4/gfx/imageloader_fmtowns.h
@@ -38,7 +38,7 @@ public:
 	/**
 	 * Loads in an FM TOWNS files, which we assume is 16 bits.
 	 */
-	Image *load(Common::File *file, int width, int height, int bpp) override;
+	Image *load(Common::SeekableReadStream &stream, int width, int height, int bpp) override;
 };
 
 } // End of namespace Ultima4
diff --git a/engines/ultima/ultima4/gfx/imageloader_png.cpp b/engines/ultima/ultima4/gfx/imageloader_png.cpp
index ec745c5c25..00b6c3d9fe 100644
--- a/engines/ultima/ultima4/gfx/imageloader_png.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_png.cpp
@@ -23,20 +23,21 @@
 #include "ultima/ultima4/gfx/image.h"
 #include "ultima/ultima4/gfx/imageloader.h"
 #include "ultima/ultima4/gfx/imageloader_png.h"
+#include "common/stream.h"
 #include "common/memstream.h"
 #include "image/png.h"
 
 namespace Ultima {
 namespace Ultima4 {
 
-Image *PngImageLoader::load(Common::File *file, int width, int height, int bpp) {
+Image *PngImageLoader::load(Common::SeekableReadStream &stream, int width, int height, int bpp) {
 	if (width != -1 || height != -1 || bpp != -1) {
 		warning("dimensions set for PNG image, will be ignored");
 	}
 
-	size_t fileSize = file->size();
+	size_t fileSize = stream.size();
 	byte *buffer = (byte *)malloc(fileSize);
-	file->read(buffer, fileSize);
+	stream.read(buffer, fileSize);
 	Common::MemoryReadStream src(buffer, fileSize, DisposeAfterUse::YES);
 
 	::Image::PNGDecoder decoder;
diff --git a/engines/ultima/ultima4/gfx/imageloader_png.h b/engines/ultima/ultima4/gfx/imageloader_png.h
index a840f9a150..08e218f39c 100644
--- a/engines/ultima/ultima4/gfx/imageloader_png.h
+++ b/engines/ultima/ultima4/gfx/imageloader_png.h
@@ -40,7 +40,7 @@ public:
 	/**
 	 * Loads in the PNG with the libpng library.
 	 */
-	Image *load(Common::File *file, int width, int height, int bpp) override;
+	Image *load(Common::SeekableReadStream &stream, int width, int height, int bpp) override;
 };
 
 } // End of namespace Ultima4
diff --git a/engines/ultima/ultima4/gfx/imageloader_u4.cpp b/engines/ultima/ultima4/gfx/imageloader_u4.cpp
index b47311c1b4..b4760ef4f3 100644
--- a/engines/ultima/ultima4/gfx/imageloader_u4.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_u4.cpp
@@ -27,6 +27,7 @@
 #include "ultima/ultima4/gfx/imageloader.h"
 #include "ultima/ultima4/gfx/imageloader_u4.h"
 #include "ultima/ultima4/filesys/rle.h"
+#include "common/file.h"
 
 namespace Ultima {
 namespace Ultima4 {
@@ -35,16 +36,16 @@ RGBA *U4PaletteLoader::_bwPalette = nullptr;
 RGBA *U4PaletteLoader::_egaPalette = nullptr;
 RGBA *U4PaletteLoader::_vgaPalette = nullptr;
 
-Image *U4RawImageLoader::load(Common::File *file, int width, int height, int bpp) {
+Image *U4RawImageLoader::load(Common::SeekableReadStream &stream, int width, int height, int bpp) {
 	if (width == -1 || height == -1 || bpp == -1) {
 		error("dimensions not set for u4raw image");
 	}
 
 	assertMsg(bpp == 1 || bpp == 4 || bpp == 8 || bpp == 24 || bpp == 32, "invalid bpp: %d", bpp);
 
-	long rawLen = file->size();
+	long rawLen = stream.size();
 	byte *raw = (byte *)malloc(rawLen);
-	file->read(raw, rawLen);
+	stream.read(raw, rawLen);
 
 	long requiredLength = (width * height * bpp / 8);
 	if (rawLen < requiredLength) {
@@ -80,16 +81,16 @@ Image *U4RawImageLoader::load(Common::File *file, int width, int height, int bpp
  * Loads in the rle-compressed image and apply the standard U4 16 or
  * 256 color palette.
  */
-Image *U4RleImageLoader::load(Common::File *file, int width, int height, int bpp) {
+Image *U4RleImageLoader::load(Common::SeekableReadStream &stream, int width, int height, int bpp) {
 	if (width == -1 || height == -1 || bpp == -1) {
 		error("dimensions not set for u4rle image");
 	}
 
 	assertMsg(bpp == 1 || bpp == 4 || bpp == 8 || bpp == 24 || bpp == 32, "invalid bpp: %d", bpp);
 
-	long compressedLen = file->size();
+	long compressedLen = stream.size();
 	byte *compressed = (byte *) malloc(compressedLen);
-	file->read(compressed, compressedLen);
+	stream.read(compressed, compressedLen);
 
 	byte *raw = nullptr;
 	long rawLen = rleDecompressMemory(compressed, compressedLen, (void **) &raw);
@@ -127,16 +128,16 @@ Image *U4RleImageLoader::load(Common::File *file, int width, int height, int bpp
  * Loads in the lzw-compressed image and apply the standard U4 16 or
  * 256 color palette.
  */
-Image *U4LzwImageLoader::load(Common::File *file, int width, int height, int bpp) {
+Image *U4LzwImageLoader::load(Common::SeekableReadStream &stream, int width, int height, int bpp) {
 	if (width == -1 || height == -1 || bpp == -1) {
 		error("dimensions not set for u4lzw image");
 	}
 
 	assertMsg(bpp == 1 || bpp == 4 || bpp == 8 || bpp == 24 || bpp == 32, "invalid bpp: %d", bpp);
 
-	long compressedLen = file->size();
+	long compressedLen = stream.size();
 	byte *compressed = (byte *) malloc(compressedLen);
-	file->read(compressed, compressedLen);
+	stream.read(compressed, compressedLen);
 
 	byte *raw = nullptr;
 	long rawLen = LZW::decompress_u4_memory(compressed, compressedLen, (void **) &raw);
@@ -220,19 +221,17 @@ RGBA *U4PaletteLoader::loadEgaPalette() {
  */
 RGBA *U4PaletteLoader::loadVgaPalette() {
 	if (_vgaPalette == nullptr) {
-		Common::File *pal = u4fopen("u4vga.pal");
-		if (!pal)
+		Common::File pal;
+		if (!pal.open("u4vga.pal"))
 			return nullptr;
 
 		_vgaPalette = new RGBA[256];
 
 		for (int i = 0; i < 256; i++) {
-			_vgaPalette[i].r = u4fgetc(pal) * 255 / 63;
-			_vgaPalette[i].g = u4fgetc(pal) * 255 / 63;
-			_vgaPalette[i].b = u4fgetc(pal) * 255 / 63;
+			_vgaPalette[i].r = pal.readByte() * 255 / 63;
+			_vgaPalette[i].g = pal.readByte() * 255 / 63;
+			_vgaPalette[i].b = pal.readByte() * 255 / 63;
 		}
-		u4fclose(pal);
-
 	}
 
 	return _vgaPalette;
diff --git a/engines/ultima/ultima4/gfx/imageloader_u4.h b/engines/ultima/ultima4/gfx/imageloader_u4.h
index 7a7044639d..5e75a4e22a 100644
--- a/engines/ultima/ultima4/gfx/imageloader_u4.h
+++ b/engines/ultima/ultima4/gfx/imageloader_u4.h
@@ -41,7 +41,7 @@ public:
 	/**
 	 * Loads in the raw image and apply the standard U4 16 or 256 color palette.
 	 */
-	Image *load(Common::File *file, int width, int height, int bpp) override;
+	Image *load(Common::SeekableReadStream &stream, int width, int height, int bpp) override;
 };
 
 /**
@@ -52,7 +52,7 @@ public:
  */
 class U4RleImageLoader : public ImageLoader {
 public:
-	Image *load(Common::File *file, int width, int height, int bpp) override;
+	Image *load(Common::SeekableReadStream &stream, int width, int height, int bpp) override;
 };
 
 /**
@@ -63,7 +63,7 @@ public:
  */
 class U4LzwImageLoader : public ImageLoader {
 public:
-	Image *load(Common::File *file, int width, int height, int bpp) override;
+	Image *load(Common::SeekableReadStream &stream, int width, int height, int bpp) override;
 };
 
 class U4PaletteLoader {
diff --git a/engines/ultima/ultima4/gfx/imagemgr.cpp b/engines/ultima/ultima4/gfx/imagemgr.cpp
index 24c2396063..efbe3c1c80 100644
--- a/engines/ultima/ultima4/gfx/imagemgr.cpp
+++ b/engines/ultima/ultima4/gfx/imagemgr.cpp
@@ -26,7 +26,6 @@
 #include "ultima/ultima4/controllers/intro_controller.h"
 #include "ultima/ultima4/core/config.h"
 #include "ultima/ultima4/core/settings.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/ultima4.h"
 
 namespace Ultima {
@@ -511,7 +510,7 @@ bool ImageMgr::imageExists(ImageInfo *info) {
 		return true;
 	Common::File *file = getImageFile(info);
 	if (file) {
-		u4fclose(file);
+		delete file;
 		return true;
 	}
 	return false;
@@ -524,18 +523,18 @@ Common::File *ImageMgr::getImageFile(ImageInfo *info) {
 	if (filename.empty())
 		return nullptr;
 
-	Common::File *file = nullptr;
+	Common::File *file = new Common::File();
 	if (!info->_xu4Graphic) {
 		// It's a file in the game folder
-		file = u4fopen(filename);
-		if (file)
+		if (file->open(filename))
 			return file;
 	}
 
-	Common::String pathname = u4find_graphics(filename);
-	file = u4fopen(pathname);
+	if (file->open("data/graphics/" + filename))
+		return file;
 
-	return file;
+	delete file;
+	return nullptr;
 }
 
 ImageInfo *ImageMgr::get(const Common::String &name, bool returnUnscaled) {
@@ -557,7 +556,7 @@ ImageInfo *ImageMgr::get(const Common::String &name, bool returnUnscaled) {
 		if (loader == nullptr) {
 			warning("can't find loader to load image \"%s\" with type \"%s\"", info->_filename.c_str(), filetype.c_str());
 		} else {
-			unscaled = loader->load(file, info->_width, info->_height, info->_depth);
+			unscaled = loader->load(*file, info->_width, info->_height, info->_depth);
 			if (info->_width == -1) {
 				// Write in the values for later use.
 				info->_width = unscaled->width();
@@ -566,7 +565,7 @@ ImageInfo *ImageMgr::get(const Common::String &name, bool returnUnscaled) {
 			}
 		}
 
-		u4fclose(file);
+		delete file;
 	} else {
 		warning("Failed to open file %s for reading.", info->_filename.c_str());
 		return nullptr;
diff --git a/engines/ultima/ultima4/gfx/imagemgr.h b/engines/ultima/ultima4/gfx/imagemgr.h
index d7b489ef8e..f01ab11268 100644
--- a/engines/ultima/ultima4/gfx/imagemgr.h
+++ b/engines/ultima/ultima4/gfx/imagemgr.h
@@ -25,6 +25,11 @@
 
 #include "ultima/ultima4/gfx/image.h"
 #include "ultima/ultima4/core/observer.h"
+#include "ultima/shared/std/containers.h"
+
+namespace Common {
+class File;
+}
 
 namespace Ultima {
 namespace Ultima4 {
diff --git a/engines/ultima/ultima4/gfx/screen.h b/engines/ultima/ultima4/gfx/screen.h
index 3ff5d1ccdc..8bffb9d28a 100644
--- a/engines/ultima/ultima4/gfx/screen.h
+++ b/engines/ultima/ultima4/gfx/screen.h
@@ -26,7 +26,6 @@
 #include "graphics/screen.h"
 #include "ultima/ultima4/core/config.h"
 #include "ultima/ultima4/core/types.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/gfx/scale.h"
 #include "ultima/ultima4/map/direction.h"
 #include "ultima/ultima4/map/map_tile.h"
diff --git a/engines/ultima/ultima4/map/map.h b/engines/ultima/ultima4/map/map.h
index 95d8886ffc..a7c4be889c 100644
--- a/engines/ultima/ultima4/map/map.h
+++ b/engines/ultima/ultima4/map/map.h
@@ -29,7 +29,6 @@
 #include "ultima/ultima4/game/object.h"
 #include "ultima/ultima4/filesys/savegame.h"
 #include "ultima/ultima4/core/types.h"
-#include "ultima/ultima4/filesys/u4file.h"
 
 namespace Ultima {
 namespace Ultima4 {
diff --git a/engines/ultima/ultima4/map/maploader.cpp b/engines/ultima/ultima4/map/maploader.cpp
index 51c6a31644..651fe84390 100644
--- a/engines/ultima/ultima4/map/maploader.cpp
+++ b/engines/ultima/ultima4/map/maploader.cpp
@@ -38,10 +38,10 @@
 #include "ultima/ultima4/map/tilemap.h"
 #include "ultima/ultima4/map/tileset.h"
 #include "ultima/ultima4/map/xml_map.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/core/utils.h"
 #include "ultima/ultima4/gfx/image.h"
 #include "ultima/ultima4/gfx/imagemgr.h"
+#include "common/file.h"
 #include "common/system.h"
 
 namespace Ultima {
@@ -77,7 +77,7 @@ MapLoader *MapLoaders::getLoader(Map::Type type) {
 
 /*-------------------------------------------------------------------*/
 
-bool MapLoader::loadData(Map *map, Common::File *f) {
+bool MapLoader::loadData(Map *map, Common::SeekableReadStream &f) {
 	uint x, xch, y, ych;
 
 	// Allocate the space we need for the map data
@@ -90,7 +90,7 @@ bool MapLoader::loadData(Map *map, Common::File *f) {
 		map->_chunkWidth = map->_width;
 
 	uint32 total = 0;
-	u4fseek(f, map->_offset, SEEK_CUR);
+	f.seek(map->_offset, SEEK_CUR);
 
 	for (ych = 0; ych < (map->_height / map->_chunkHeight); ++ych) {
 		for (xch = 0; xch < (map->_width / map->_chunkWidth); ++xch) {
@@ -104,7 +104,7 @@ bool MapLoader::loadData(Map *map, Common::File *f) {
 			} else {
 				for (y = 0; y < map->_chunkHeight; ++y) {
 					for (x = 0; x < map->_chunkWidth; ++x) {
-						int c = u4fgetc(f);
+						int c = f.readByte();
 						if (c == EOF)
 							return false;
 
@@ -143,9 +143,8 @@ bool CityMapLoader::load(Map *map) {
 	Dialogue *dialogues[CITY_MAX_PERSONS];
 	DialogueLoader *dlgLoader = DialogueLoaders::getLoader("application/x-u4tlk");
 
-	Common::File *ult = u4fopen(city->_fname);
-	Common::File *tlk = u4fopen(city->_tlkFname);
-	if (!ult || !tlk)
+	Common::File ult, tlk;
+	if (!ult.open(city->_fname) || !tlk.open(city->_tlkFname))
 		error("unable to load map data");
 
 	// The map must be 32x32 to be read from an .ULT file
@@ -157,22 +156,22 @@ bool CityMapLoader::load(Map *map) {
 
 	// Properly construct people for the city
 	for (i = 0; i < CITY_MAX_PERSONS; i++)
-		people[i] = new Person(map->translateFromRawTileIndex(u4fgetc(ult)));
+		people[i] = new Person(map->translateFromRawTileIndex(ult.readByte()));
 
 	for (i = 0; i < CITY_MAX_PERSONS; i++)
-		people[i]->getStart().x = u4fgetc(ult);
+		people[i]->getStart().x = ult.readByte();
 
 	for (i = 0; i < CITY_MAX_PERSONS; i++)
-		people[i]->getStart().y = u4fgetc(ult);
+		people[i]->getStart().y = ult.readByte();
 
 	for (i = 0; i < CITY_MAX_PERSONS; i++)
-		people[i]->setPrevTile(map->translateFromRawTileIndex(u4fgetc(ult)));
+		people[i]->setPrevTile(map->translateFromRawTileIndex(ult.readByte()));
 
 	for (i = 0; i < CITY_MAX_PERSONS * 2; i++)
-		u4fgetc(ult);           // Read redundant startx/starty
+		ult.readByte();           // Read redundant startx/starty
 
 	for (i = 0; i < CITY_MAX_PERSONS; i++) {
-		byte c = u4fgetc(ult);
+		byte c = ult.readByte();
 		if (c == 0)
 			people[i]->setMovementBehavior(MOVEMENT_FIXED);
 		else if (c == 1)
@@ -187,7 +186,7 @@ bool CityMapLoader::load(Map *map) {
 
 	byte conv_idx[CITY_MAX_PERSONS];
 	for (i = 0; i < CITY_MAX_PERSONS; i++) {
-		conv_idx[i] = u4fgetc(ult);
+		conv_idx[i] = ult.readByte();
 	}
 
 	for (i = 0; i < CITY_MAX_PERSONS; i++) {
@@ -195,7 +194,7 @@ bool CityMapLoader::load(Map *map) {
 	}
 
 	for (i = 0; i < CITY_MAX_PERSONS; i++) {
-		dialogues[i] = dlgLoader->load(tlk);
+		dialogues[i] = dlgLoader->load(&tlk);
 
 		if (!dialogues[i])
 			break;
@@ -247,9 +246,6 @@ bool CityMapLoader::load(Map *map) {
 			delete people[i];
 	}
 
-	u4fclose(ult);
-	u4fclose(tlk);
-
 	return true;
 }
 
@@ -258,8 +254,8 @@ bool CityMapLoader::load(Map *map) {
 bool ConMapLoader::load(Map *map) {
 	int i;
 
-	Common::File *con = u4fopen(map->_fname);
-	if (!con)
+	Common::File con;
+	if (!con.open(map->_fname))
 		error("unable to load map data");
 
 	// The map must be 11x11 to be read from an .CON file
@@ -270,25 +266,23 @@ bool ConMapLoader::load(Map *map) {
 		CombatMap *cm = getCombatMap(map);
 
 		for (i = 0; i < AREA_CREATURES; i++)
-			cm->creature_start[i] = MapCoords(u4fgetc(con));
+			cm->creature_start[i] = MapCoords(con.readByte());
 
 		for (i = 0; i < AREA_CREATURES; i++)
-			cm->creature_start[i].y = u4fgetc(con);
+			cm->creature_start[i].y = con.readByte();
 
 		for (i = 0; i < AREA_PLAYERS; i++)
-			cm->player_start[i] = MapCoords(u4fgetc(con));
+			cm->player_start[i] = MapCoords(con.readByte());
 
 		for (i = 0; i < AREA_PLAYERS; i++)
-			cm->player_start[i].y = u4fgetc(con);
+			cm->player_start[i].y = con.readByte();
 
-		u4fseek(con, 16L, SEEK_CUR);
+		con.seek(16L, SEEK_CUR);
 	}
 
 	if (!loadData(map, con))
 		return false;
 
-	u4fclose(con);
-
 	return true;
 }
 
@@ -298,8 +292,8 @@ bool DngMapLoader::load(Map *map) {
 	Dungeon *dungeon = dynamic_cast<Dungeon *>(map);
 	assert(dungeon);
 
-	Common::File *dng = u4fopen(dungeon->_fname);
-	if (!dng)
+	Common::File dng;
+	if (!dng.open(dungeon->_fname))
 		error("unable to load map data");
 
 	// The map must be 11x11 to be read from an .CON file
@@ -309,7 +303,7 @@ bool DngMapLoader::load(Map *map) {
 	// Load the dungeon map
 	uint i, j;
 	for (i = 0; i < (DNG_HEIGHT * DNG_WIDTH * dungeon->_levels); i++) {
-		byte mapData = u4fgetc(dng);
+		byte mapData = dng.readByte();
 		MapTile tile = map->translateFromRawTileIndex(mapData);
 
 		// Determine what type of tile it is
@@ -327,30 +321,30 @@ bool DngMapLoader::load(Map *map) {
 		for (j = 0; j < DNGROOM_NTRIGGERS; j++) {
 			int tmp;
 
-			dungeon->_rooms[i]._triggers[j]._tile = g_tileMaps->get("base")->translate(u4fgetc(dng))._id;
+			dungeon->_rooms[i]._triggers[j]._tile = g_tileMaps->get("base")->translate(dng.readByte())._id;
 
-			tmp = u4fgetc(dng);
+			tmp = dng.readByte();
 			if (tmp == EOF)
 				return false;
 			dungeon->_rooms[i]._triggers[j].x = (tmp >> 4) & 0x0F;
 			dungeon->_rooms[i]._triggers[j].y = tmp & 0x0F;
 
-			tmp = u4fgetc(dng);
+			tmp = dng.readByte();
 			if (tmp == EOF)
 				return false;
 			dungeon->_rooms[i]._triggers[j]._changeX1 = (tmp >> 4) & 0x0F;
 			dungeon->_rooms[i]._triggers[j]._changeY1 = tmp & 0x0F;
 
-			tmp = u4fgetc(dng);
+			tmp = dng.readByte();
 			if (tmp == EOF)
 				return false;
 			dungeon->_rooms[i]._triggers[j].changeX2 = (tmp >> 4) & 0x0F;
 			dungeon->_rooms[i]._triggers[j].changeY2 = tmp & 0x0F;
 		}
 
-		dungeon->_rooms[i].load(*dng);
-		u4fread(room_tiles, sizeof(room_tiles), 1, dng);
-		u4fread(dungeon->_rooms[i]._buffer, sizeof(dungeon->_rooms[i]._buffer), 1, dng);
+		dungeon->_rooms[i].load(dng);
+		dng.read(room_tiles, sizeof(room_tiles));
+		dng.read(dungeon->_rooms[i]._buffer, sizeof(dungeon->_rooms[i]._buffer));
 
 		// Translate each creature tile to a tile id
 		for (j = 0; j < sizeof(dungeon->_rooms[i]._creatureTiles); j++)
@@ -371,7 +365,6 @@ bool DngMapLoader::load(Map *map) {
 			}
 		}
 	}
-	u4fclose(dng);
 
 	dungeon->_roomMaps = new CombatMap *[dungeon->_nRooms];
 	for (i = 0; i < dungeon->_nRooms; i++)
@@ -398,15 +391,13 @@ void DngMapLoader::initDungeonRoom(Dungeon *dng, int room) {
 /*-------------------------------------------------------------------*/
 
 bool WorldMapLoader::load(Map *map) {
-	Common::File *world = u4fopen(map->_fname);
-	if (!world)
+	Common::File world;
+	if (!world.open(map->_fname))
 		error("unable to load map data");
 
 	if (!loadData(map, world))
 		return false;
 
-	u4fclose(world);
-
 	// Check for any tile overrides for the portals
 	for (uint idx = 0; idx < map->_portals.size(); ++idx) {
 		const Portal *p = map->_portals[idx];
diff --git a/engines/ultima/ultima4/map/maploader.h b/engines/ultima/ultima4/map/maploader.h
index 3adc2182fc..42f0f38b26 100644
--- a/engines/ultima/ultima4/map/maploader.h
+++ b/engines/ultima/ultima4/map/maploader.h
@@ -26,6 +26,10 @@
 #include "ultima/ultima4/map/map.h"
 #include "ultima/shared/std/containers.h"
 
+namespace Common {
+class SeekableReadStream;
+}
+
 namespace Ultima {
 namespace Ultima4 {
 
@@ -68,7 +72,7 @@ protected:
 	/**
 	 * Loads raw data from the given file.
 	 */
-	static bool loadData(Map *map, Common::File *f);
+	static bool loadData(Map *map, Common::SeekableReadStream &f);
 	static bool isChunkCompressed(Map *map, int chunk);
 
 private:
diff --git a/engines/ultima/ultima4/map/mapmgr.cpp b/engines/ultima/ultima4/map/mapmgr.cpp
index 6008f4a23c..4dbb614547 100644
--- a/engines/ultima/ultima4/map/mapmgr.cpp
+++ b/engines/ultima/ultima4/map/mapmgr.cpp
@@ -37,7 +37,6 @@
 #include "ultima/ultima4/map/tileset.h"
 #include "ultima/ultima4/map/xml_map.h"
 #include "ultima/ultima4/core/types.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/core/config.h"
 
 namespace Ultima {
diff --git a/engines/ultima/ultima4/map/shrine.cpp b/engines/ultima/ultima4/map/shrine.cpp
index 456916b827..e88b67de60 100644
--- a/engines/ultima/ultima4/map/shrine.cpp
+++ b/engines/ultima/ultima4/map/shrine.cpp
@@ -31,6 +31,7 @@
 #include "ultima/ultima4/core/settings.h"
 #include "ultima/ultima4/core/types.h"
 #include "ultima/ultima4/events/event_handler.h"
+#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/game/context.h"
 #include "ultima/ultima4/game/game.h"
 #include "ultima/ultima4/game/creature.h"
diff --git a/engines/ultima/ultima4/sound/music.cpp b/engines/ultima/ultima4/sound/music.cpp
index 0012cc4ab7..8c69ab984d 100644
--- a/engines/ultima/ultima4/sound/music.cpp
+++ b/engines/ultima/ultima4/sound/music.cpp
@@ -26,7 +26,6 @@
 #include "ultima/ultima4/core/settings.h"
 #include "ultima/ultima4/core/utils.h"
 #include "ultima/ultima4/events/event_handler.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/game/context.h"
 #include "ultima/ultima4/map/location.h"
 #include "ultima/ultima4/ultima4.h"
diff --git a/engines/ultima/ultima4/sound/sound.cpp b/engines/ultima/ultima4/sound/sound.cpp
index fbdf8e5fb6..82a33d77c8 100644
--- a/engines/ultima/ultima4/sound/sound.cpp
+++ b/engines/ultima/ultima4/sound/sound.cpp
@@ -24,7 +24,6 @@
 #include "ultima/ultima4/core/config.h"
 #include "ultima/ultima4/sound/music.h"
 #include "ultima/ultima4/core/settings.h"
-#include "ultima/ultima4/filesys/u4file.h"
 #include "ultima/ultima4/core/utils.h"
 #include "audio/audiostream.h"
 #include "audio/decoders/flac.h"
@@ -80,7 +79,7 @@ bool SoundManager::load(Sound sound) {
 	assertMsg(sound < SOUND_MAX, "Attempted to load an invalid sound");
 
 	if (_sounds[sound] == nullptr) {
-		Common::String pathname(u4find_sound(_soundFilenames[sound]));
+		Common::String pathname("data/sound/" + _soundFilenames[sound]);
 		Common::String basename = pathname.substr(pathname.findLastOf("/") + 1);
 		if (!basename.empty())
 			return load_sys(sound, pathname);


Commit: dbfb54255a74a60e65f75abcf4eab6b15760c64c
    https://github.com/scummvm/scummvm/commit/dbfb54255a74a60e65f75abcf4eab6b15760c64c
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-12-28T15:14:47-10:00

Commit Message:
ULTIMA4: Remove unused FileSystem classes

Changed paths:
  R engines/ultima/ultima4/filesys/filesystem.cpp
  R engines/ultima/ultima4/filesys/filesystem.h
    engines/ultima/module.mk
    engines/ultima/ultima4/core/settings.cpp
    engines/ultima/ultima4/core/utils.h
    engines/ultima/ultima4/game/script.cpp
    engines/ultima/ultima4/map/maploader.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 8d3b0c7737..d50dcd90e4 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -166,7 +166,6 @@ MODULE_OBJS := \
 	ultima4/core/utils.o \
 	ultima4/events/event_handler.o \
 	ultima4/events/timed_event_mgr.o \
-	ultima4/filesys/filesystem.o \
 	ultima4/filesys/rle.o \
 	ultima4/filesys/savegame.o \
 	ultima4/filesys/u4file.o \
diff --git a/engines/ultima/ultima4/core/settings.cpp b/engines/ultima/ultima4/core/settings.cpp
index fe4f097f2f..51f489f8f8 100644
--- a/engines/ultima/ultima4/core/settings.cpp
+++ b/engines/ultima/ultima4/core/settings.cpp
@@ -22,7 +22,6 @@
 
 #include "ultima/ultima4/core/settings.h"
 #include "ultima/ultima4/events/event_handler.h"
-#include "ultima/ultima4/filesys/filesystem.h"
 #include "ultima/ultima4/core/utils.h"
 #include "common/file.h"
 
diff --git a/engines/ultima/ultima4/core/utils.h b/engines/ultima/ultima4/core/utils.h
index 44b3b2fe8f..3f33dbdb73 100644
--- a/engines/ultima/ultima4/core/utils.h
+++ b/engines/ultima/ultima4/core/utils.h
@@ -23,7 +23,6 @@
 #ifndef ULTIMA4_CORE_UTILS_H
 #define ULTIMA4_CORE_UTILS_H
 
-#include "ultima/ultima4/filesys/filesystem.h"
 #include "ultima/ultima4/ultima4.h"
 #include "ultima/shared/std/containers.h"
 #include "common/savefile.h"
diff --git a/engines/ultima/ultima4/filesys/filesystem.cpp b/engines/ultima/ultima4/filesys/filesystem.cpp
deleted file mode 100644
index fae3b96a58..0000000000
--- a/engines/ultima/ultima4/filesys/filesystem.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ultima/ultima4/filesys/filesystem.h"
-#include "common/file.h"
-#include "common/fs.h"
-#include "common/savefile.h"
-#include "common/system.h"
-
-namespace Ultima {
-namespace Ultima4 {
-
-const char Path::delim = '/';
-
-Path::Path(const Common::String &p) : path(p) {
-	uint pos;
-	bool _exists = false, isDir = false;
-
-	/* determine if the path really exists */
-	Common::FSNode node(path);
-	_exists = node.exists();
-
-	/* if so, let's glean more information */
-	if (_exists)
-		isDir = node.isDirectory();
-
-	/* If it's for sure a file, get file information! */
-	if (_exists && !isDir) {
-		file = node.getName();
-
-		if ((pos = file.findLastOf(".")) < file.size()) {
-			ext = file.substr(pos + 1);
-			file = file.substr(0, pos);
-		}
-	}
-}
-
-bool Path::exists() const {
-	return Common::FSNode(path).exists();
-}
-
-bool Path::isFile() const {
-	Common::FSNode node(path);
-	return node.exists() && !node.isDirectory();
-}
-
-bool Path::isDir() const {
-	Common::FSNode node(path);
-	return node.exists() && node.isDirectory();
-}
-
-Common::String Path::getDir() const {
-	Common::FSNode node(path);
-	return !node.exists() || node.isDirectory() ? node.getPath() : node.getParent().getPath();
-}
-
-Common::String Path::getFilename() const {
-	return (ext.empty()) ? file : file + Common::String(".") + ext;
-}
-
-Common::String Path::getBaseFilename() const {
-	return file;
-}
-
-Common::String Path::getExt() const {
-	return ext;
-}
-
-bool Path::exists(const Common::String &path) {
-	return Common::FSNode(path).exists();
-}
-
-Common::SeekableReadStream *FileSystem::openForReading(const Common::String &filepath) {
-	Common::File *f = new Common::File();
-	if (f->open(filepath)) {
-		return f;
-	} else {
-		delete f;
-		return nullptr;
-	}
-}
-
-Common::WriteStream *FileSystem::openForWriting(const Common::String &filepath) {
-	return g_system->getSavefileManager()->openForSaving(filepath);
-}
-
-void FileSystem::createDirectory(Path &path) {
-	Common::FSNode node(path.getPath());
-	node.createDirectory();
-}
-
-void FileSystem::createDirectory(const Common::String &filepath) {
-	Path path(filepath);
-	createDirectory(path);
-}
-
-} // End of namespace Ultima4
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima4/filesys/filesystem.h b/engines/ultima/ultima4/filesys/filesystem.h
deleted file mode 100644
index 6a9b14f0f2..0000000000
--- a/engines/ultima/ultima4/filesys/filesystem.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA4_FILESYS_FILESYSTEM_H
-#define ULTIMA4_FILESYS_FILESYSTEM_H
-
-#include "common/list.h"
-#include "common/str.h"
-#include "common/stream.h"
-
-namespace Ultima {
-namespace Ultima4 {
-
-#define FS_POSIX
-
-/**
- * Provides cross-platform functionality for representing and validating paths.
- */
-class Path {
-public:
-	/**
-	 * Creates a path to a directory or file
-	 */
-	Path(const Common::String &p);
-
-	/**
-	 * Returns true if the path exists in the filesystem
-	 */
-	bool exists() const;
-
-	/**
-	 * Returns true if the path points to a file
-	 */
-	bool isFile() const;
-
-	/**
-	 * Returns true if the path points to a directory
-	 */
-	bool isDir() const;
-
-	/**
-	 * Returns the full translated path
-	 */
-	Common::String getPath() const {
-		return path;
-	}
-
-	/**
-	 * Returns the list of directories for the path
-	 */
-	Common::List<Common::String> *getDirTree() {
-		return &dirs;
-	}
-
-	/**
-	 * Returns the directory indicated in the path.
-	 */
-	Common::String getDir() const;
-
-	/**
-	 * Returns the full filename of the file designated in the path
-	 */
-	Common::String getFilename() const;
-
-	/**
-	 * Returns the base filename of the file
-	 */
-	Common::String getBaseFilename() const;
-
-	/**
-	 * Returns the extension of the file (if it exists)
-	 */
-	Common::String getExt() const;
-
-	/**
-	 * Returns true if the given path exists in the filesystem
-	 */
-	static bool exists(const Common::String &path);
-
-	// Properties
-	static const char delim;
-
-private:
-	Common::String path;
-	Common::List<Common::String> dirs;
-	Common::String file, ext;
-};
-
-/**
- * Provides cross-platform functionality for file and directory operations.
- * It currently only supports directory creation, but other operations
- * will be added as support is needed.
- */
-class FileSystem {
-public:
-	/**
-	 * Opens a file for reading
-	 */
-	static Common::SeekableReadStream *openForReading(const Common::String &filepath);
-
-	/**
-	 * Opens a file for writing in the save folder
-	 */
-	static Common::WriteStream *openForWriting(const Common::String &filepath);
-
-	/**
-	 * Create the directory that composes the path.
-	 * If any directories that make up the path do not exist,
-	 * they are created.
-	 */
-	static void createDirectory(Path &path);
-
-	/**
-	 * Create a directory that composes the path
-	 */
-	static void createDirectory(const Common::String &filepath);
-};
-
-} // End of namespace Ultima4
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima4/game/script.cpp b/engines/ultima/ultima4/game/script.cpp
index a11e6d6d5f..028baf3068 100644
--- a/engines/ultima/ultima4/game/script.cpp
+++ b/engines/ultima/ultima4/game/script.cpp
@@ -28,7 +28,6 @@
 #include "ultima/ultima4/core/settings.h"
 #include "ultima/ultima4/core/utils.h"
 #include "ultima/ultima4/events/event_handler.h"
-#include "ultima/ultima4/filesys/filesystem.h"
 #include "ultima/ultima4/filesys/savegame.h"
 #include "ultima/ultima4/game/game.h"
 #include "ultima/ultima4/game/player.h"
diff --git a/engines/ultima/ultima4/map/maploader.cpp b/engines/ultima/ultima4/map/maploader.cpp
index 651fe84390..e32305610f 100644
--- a/engines/ultima/ultima4/map/maploader.cpp
+++ b/engines/ultima/ultima4/map/maploader.cpp
@@ -28,7 +28,6 @@
 #include "ultima/ultima4/conversation/conversation.h"
 #include "ultima/ultima4/conversation/dialogueloader.h"
 #include "ultima/ultima4/map/dungeon.h"
-#include "ultima/ultima4/filesys/filesystem.h"
 #include "ultima/ultima4/map/map.h"
 #include "ultima/ultima4/map/maploader.h"
 #include "ultima/ultima4/map/mapmgr.h"


Commit: 5cc4d4d255adc1ca981b9008830ada37b711f813
    https://github.com/scummvm/scummvm/commit/5cc4d4d255adc1ca981b9008830ada37b711f813
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-12-28T15:14:47-10:00

Commit Message:
ULTIMA4: Remove use of MemoryReadStream

Changed paths:
    engines/ultima/ultima4/gfx/imageloader_png.cpp


diff --git a/engines/ultima/ultima4/gfx/imageloader_png.cpp b/engines/ultima/ultima4/gfx/imageloader_png.cpp
index 00b6c3d9fe..f8965d77e2 100644
--- a/engines/ultima/ultima4/gfx/imageloader_png.cpp
+++ b/engines/ultima/ultima4/gfx/imageloader_png.cpp
@@ -24,7 +24,6 @@
 #include "ultima/ultima4/gfx/imageloader.h"
 #include "ultima/ultima4/gfx/imageloader_png.h"
 #include "common/stream.h"
-#include "common/memstream.h"
 #include "image/png.h"
 
 namespace Ultima {
@@ -35,13 +34,8 @@ Image *PngImageLoader::load(Common::SeekableReadStream &stream, int width, int h
 		warning("dimensions set for PNG image, will be ignored");
 	}
 
-	size_t fileSize = stream.size();
-	byte *buffer = (byte *)malloc(fileSize);
-	stream.read(buffer, fileSize);
-	Common::MemoryReadStream src(buffer, fileSize, DisposeAfterUse::YES);
-
 	::Image::PNGDecoder decoder;
-	if (!decoder.loadStream(src))
+	if (!decoder.loadStream(stream))
 		return nullptr;
 
 	const Graphics::Surface *img = decoder.getSurface();




More information about the Scummvm-git-logs mailing list