Fix B3D & PNG reading on Windows
parent
b7cd469284
commit
25961ad87e
|
@ -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})
|
||||
end})
|
||||
|
|
|
@ -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})
|
||||
end})
|
||||
|
|
Loading…
Reference in New Issue