mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Print error if reverse() fails to open a file
This commit is contained in:
@@ -28,7 +28,9 @@
|
|||||||
|
|
||||||
static DefaultInitVec<uint8_t> readInto(std::string path) {
|
static DefaultInitVec<uint8_t> readInto(std::string path) {
|
||||||
std::filebuf file;
|
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
|
DefaultInitVec<uint8_t> data(128 * 16); // Begin with some room pre-allocated
|
||||||
|
|
||||||
size_t curSize = 0;
|
size_t curSize = 0;
|
||||||
@@ -117,6 +119,7 @@ void reverse() {
|
|||||||
if (!options.tilemap.empty()) {
|
if (!options.tilemap.empty()) {
|
||||||
tilemap = readInto(options.tilemap);
|
tilemap = readInto(options.tilemap);
|
||||||
nbTileInstances = tilemap->size();
|
nbTileInstances = tilemap->size();
|
||||||
|
options.verbosePrint(Options::VERB_INTERM, "Read %zu tilemap entries.\n", nbTileInstances);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbTileInstances > options.maxNbTiles[0] + options.maxNbTiles[1]) {
|
if (nbTileInstances > options.maxNbTiles[0] + options.maxNbTiles[1]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user