; ;------------[LUA functions]------------; includelua 'Shared_Includes/LUA/Functions.lua' ;---------------------------------------; LUA PASS1 -- Проверяем BMP, достаём из него параметры, режем на куски bmp_width, bmp_height, bmp_image_size, bmp_image_offset, bmp_colors = Get_bmp8bit_values (sj.get_define("PICTURE_FILE")) if bmp_width ~= 128 then sj.error("Invalid BMP width", bmp_width) end if bmp_height ~= 72 then sj.error("Invalid BMP height", bmp_height) end if bmp_colors ~= 256 then sj.error("Invalid BMP number of colors", bmp_colors) end if not File_save(sj.get_define("PICTURE_FILE"), "./Build/Bin/LOGO_PAL.BIN", bmp_image_offset-1024, 1024) then sj.error("Palete save error!") end if not File_save(sj.get_define("PICTURE_FILE"), "./Build/Bin/LOGO_DAT.BIN", bmp_image_offset, bmp_image_size) then sj.error("Image data save error!") end ENDLUA LUA ALLPASS function make_pic_files (fileName, needPal, needPic) local fileNameBMP = "'" .. fileName .. ".bmp" .. "'" local fileNamePAL = fileName .. "_PAL.BIN" local fileNameDAT = fileName .. "_DAT.BIN" local bmp_width, bmp_height, bmp_image_size, bmp_image_offset, bmp_colors = Get_bmp8bit_values (fileNameBMP) if needPal == 1 then if bmp_width ~= 128 then sj.error(fileNameBMP .. "Invalid BMP width", bmp_width) end if bmp_height ~= 72 then sj.error(fileNameBMP .. "Invalid BMP height", bmp_height) end if bmp_colors ~= 256 then sj.error(fileNameBMP .. "Invalid BMP number of colors", bmp_colors) end if not File_save(fileNameBMP, fileNamePAL, bmp_image_offset-1024, 1024) then sj.error(fileNameBMP .. "Palete save error!") end end if needPic == 1 then local correctWidth = ((bmp_width*3)%4)+bmp_width if correctWidth > bmp_width then File_save(fileNameBMP, fileNameDAT, bmp_image_offset, bmp_image_size, bmp_width, correctWidth-bmp_width) else File_save(fileNameBMP, fileNameDAT, bmp_image_offset, bmp_image_size) end end print("Resolution: " .. bmp_width .. "x" .. bmp_height, fileNameDAT) end ENDLUA MODULE MAIN_LOGO Pallete: INCBIN 'Build/Bin/LOGO_PAL.BIN' .length EQU $-Pallete Raster: INCBIN 'Build/Bin/LOGO_DAT.BIN' .length EQU $-Raster ENDMODULE