Skip to content

Instantly share code, notes, and snippets.

@exelotl
Created September 7, 2015 16:43
Show Gist options
  • Save exelotl/b0d1721fe58493fe429c to your computer and use it in GitHub Desktop.
Save exelotl/b0d1721fe58493fe429c to your computer and use it in GitHub Desktop.
Simple script to fix the GBA tile data output by Pro Motion 6.5
-- example usage:
-- lua fix_cel_tiles.lua old_tiles.cel new_tiles.cel
local inpath, outpath = ...
local infile = assert(io.open(inpath, "rb"))
local outfile = assert(io.open(outpath,"wb"))
local bytes_per_tile = 8 * 8
while true do
local tile = infile:read(bytes_per_tile)
if tile == nil then
break
end
outfile:write(tile) -- write 1 tile
infile:read(3 * bytes_per_tile) -- discard 3 tiles
end
infile:close()
outfile:close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment