shithub: rgbds

Download patch

ref: 6a51e39a5c57ef94b108f6c562c2503b9e88668c
parent: e348f7086648353b9804f74a68063762dbab796d
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Jul 10 07:55:56 EDT 2022

Print error if reverse() fails to open a file

--- a/src/gfx/reverse.cpp
+++ b/src/gfx/reverse.cpp
@@ -28,7 +28,9 @@
 
 static DefaultInitVec<uint8_t> readInto(std::string path) {
 	std::filebuf file;
-	file.open(path, std::ios::in | std::ios::binary);
+	if (!file.open(path, std::ios::in | std::ios::binary)) {
+		fatal("Failed to open \"%s\": %s", path.c_str(), strerror(errno));
+	}
 	DefaultInitVec<uint8_t> data(128 * 16); // Begin with some room pre-allocated
 
 	size_t curSize = 0;
@@ -117,6 +119,7 @@
 	if (!options.tilemap.empty()) {
 		tilemap = readInto(options.tilemap);
 		nbTileInstances = tilemap->size();
+		options.verbosePrint(Options::VERB_INTERM, "Read %zu tilemap entries.\n", nbTileInstances);
 	}
 
 	if (nbTileInstances > options.maxNbTiles[0] + options.maxNbTiles[1]) {