[Scummvm-git-logs] scummvm master -> 25496c5a84eadce5fe3ed4a6df88f7685216774a

aquadran noreply at scummvm.org
Fri Jul 29 18:48:46 UTC 2022


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:
25496c5a84 ICB: Do not load game data into memory.


Commit: 25496c5a84eadce5fe3ed4a6df88f7685216774a
    https://github.com/scummvm/scummvm/commit/25496c5a84eadce5fe3ed4a6df88f7685216774a
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2022-07-29T20:48:42+02:00

Commit Message:
ICB: Do not load game data into memory.

Changed paths:
    engines/icb/res_man_pc.cpp


diff --git a/engines/icb/res_man_pc.cpp b/engines/icb/res_man_pc.cpp
index 5051fcece21..645eef7a38b 100644
--- a/engines/icb/res_man_pc.cpp
+++ b/engines/icb/res_man_pc.cpp
@@ -44,31 +44,15 @@ namespace ICB {
 
 uint32 MAX_MEM_BLOCKS = 0;
 
-Common::File *openDiskFileForBinaryRead(const char *filename) {
-	pxString path = filename;
+Common::SeekableReadStream *openDiskFileForBinaryStreamRead(const Common::String &filename) {
+	pxString path = filename.c_str();
 	path.ConvertPath();
-	Common::File *result = new Common::File();
-	if (result->open(path.c_str())) {
-		return result;
-	} else {
-		delete result;
-		warning("openDiskFileForBinaryRead(%s) - FAILED", path.c_str());
-		return nullptr;
-	}
-}
+	Common::SeekableReadStream *stream = nullptr;
+	if (SearchMan.hasFile(path.c_str()))
+		stream = SearchMan.createReadStreamForMember(path.c_str());
+	else
+		error("File not found: %s", path.c_str());
 
-Common::SeekableReadStream *openDiskFileForBinaryStreamRead(const Common::String &filename) {
-	// Quick-fix to start replacing FILE with Stream.
-	Common::File *f = openDiskFileForBinaryRead(filename.c_str());
-	if (!f) {
-		return nullptr;
-	}
-	int32 size = f->size();
-	byte *data = (byte *)malloc(size);
-	f->read(data, size);
-	f->close();
-	delete f;
-	Common::MemoryReadStream *stream = new Common::MemoryReadStream(data, size, DisposeAfterUse::YES);
 	return stream;
 }
 




More information about the Scummvm-git-logs mailing list