From 25961ad87e7898a6a1939d4b626190bad8397fb8 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Thu, 12 May 2022 14:26:21 +0200 Subject: [PATCH] Fix B3D & PNG reading on Windows --- models.lua | 4 ++-- textures.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models.lua b/models.lua index a68a628..8b669d1 100644 --- a/models.lua +++ b/models.lua @@ -19,7 +19,7 @@ return setmetatable({}, {__index = function(self, filename) if filename == "character.b3d" and minetest.sha1(modlib.file.read(path)) == bad_character_b3d_hash then path = fixed_character_b3d_path end - local model = io.open(path, "r") + local model = io.open(path, "rb") local character = assert(modlib.b3d.read(model)) assert(not model:read(1)) model:close() @@ -54,4 +54,4 @@ return setmetatable({}, {__index = function(self, filename) frames = (character.node.animation or {}).frames or 1 } return self[filename] -end}) \ No newline at end of file +end}) diff --git a/textures.lua b/textures.lua index 393314b..df7f824 100644 --- a/textures.lua +++ b/textures.lua @@ -1,11 +1,11 @@ local media_paths = modlib.minetest.media.paths return setmetatable({}, {__index = function(self, texture_name) - local file = io.open(media_paths[texture_name], "r") + local file = io.open(media_paths[texture_name], "rb") local png = modlib.minetest.decode_png(file) assert(not file:read(1), "EOF expected") file:close() modlib.minetest.convert_png_to_argb8(png) self[texture_name] = png return self[texture_name] -end}) \ No newline at end of file +end})