mirror of
https://github.com/TangentFoxy/love-pe.git
synced 2025-07-28 10:12:16 +00:00
Start the work on the icon changer
This commit is contained in:
49
conf.lua
Normal file
49
conf.lua
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
function love.conf(t)
|
||||||
|
t.identity = "love-exe-icon-changer"-- The name of the save directory (string)
|
||||||
|
t.appendidentity = false -- Search files in source directory before save directory (boolean)
|
||||||
|
t.version = "11.1" -- The LÖVE version this game was made for (string)
|
||||||
|
t.console = false -- Attach a console (boolean, Windows only)
|
||||||
|
t.accelerometerjoystick = false -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
||||||
|
t.externalstorage = true -- True to save files (and read from the save directory) in external storage on Android (boolean)
|
||||||
|
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
|
||||||
|
|
||||||
|
t.audio.mixwithsystem = true -- Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||||
|
|
||||||
|
t.window.title = "LÖVE-Icon-Changer" -- The window title (string)
|
||||||
|
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
|
||||||
|
t.window.width = 300 -- The window width (number)
|
||||||
|
t.window.height = 200 -- The window height (number)
|
||||||
|
t.window.borderless = false -- Remove all border visuals from the window (boolean)
|
||||||
|
t.window.resizable = false -- Let the window be user-resizable (boolean)
|
||||||
|
t.window.minwidth = 1 -- Minimum window width if the window is resizable (number)
|
||||||
|
t.window.minheight = 1 -- Minimum window height if the window is resizable (number)
|
||||||
|
t.window.fullscreen = false -- Enable fullscreen (boolean)
|
||||||
|
t.window.fullscreentype = "desktop" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
|
||||||
|
t.window.vsync = 1 -- Vertical sync mode (number)
|
||||||
|
t.window.msaa = 0 -- The number of samples to use with multi-sampled antialiasing (number)
|
||||||
|
t.window.display = 1 -- Index of the monitor to show the window in (number)
|
||||||
|
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean)
|
||||||
|
t.window.x = nil -- The x-coordinate of the window's position in the specified display (number)
|
||||||
|
t.window.y = nil -- The y-coordinate of the window's position in the specified display (number)
|
||||||
|
|
||||||
|
t.window = nil
|
||||||
|
|
||||||
|
t.modules.audio = false -- Enable the audio module (boolean)
|
||||||
|
t.modules.data = true -- Enable the data module (boolean)
|
||||||
|
t.modules.event = true -- Enable the event module (boolean)
|
||||||
|
t.modules.font = true -- Enable the font module (boolean)
|
||||||
|
t.modules.graphics = true -- Enable the graphics module (boolean)
|
||||||
|
t.modules.image = true -- Enable the image module (boolean)
|
||||||
|
t.modules.joystick = false -- Enable the joystick module (boolean)
|
||||||
|
t.modules.keyboard = true -- Enable the keyboard module (boolean)
|
||||||
|
t.modules.math = true -- Enable the math module (boolean)
|
||||||
|
t.modules.mouse = true -- Enable the mouse module (boolean)
|
||||||
|
t.modules.physics = false -- Enable the physics module (boolean)
|
||||||
|
t.modules.sound = false -- Enable the sound module (boolean)
|
||||||
|
t.modules.system = true -- Enable the system module (boolean)
|
||||||
|
t.modules.thread = true -- Enable the thread module (boolean)
|
||||||
|
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
|
||||||
|
t.modules.touch = true -- Enable the touch module (boolean)
|
||||||
|
t.modules.video = false -- Enable the video module (boolean)
|
||||||
|
t.modules.window = true -- Enable the window module (boolean)
|
||||||
|
end
|
42
icon-changer.lua
Normal file
42
icon-changer.lua
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
--love-icon-changer library by RamiLego4Game (Rami Sabbagh)
|
||||||
|
--[[
|
||||||
|
- Usage:
|
||||||
|
local iconChanger = require("icon-changer")
|
||||||
|
|
||||||
|
local icodata = iconChanger.extractIcon(exeFile)
|
||||||
|
]]
|
||||||
|
|
||||||
|
local bit = require("bit")
|
||||||
|
|
||||||
|
local bor,band,lshift,rshift = bit.bor,bit.band,bit.lshift,bit.rshift
|
||||||
|
|
||||||
|
--==Internal Functions==--
|
||||||
|
|
||||||
|
local function readNumber(str,bigEndian)
|
||||||
|
local num = 0
|
||||||
|
|
||||||
|
if bigEndian then str = str:reverse() end
|
||||||
|
|
||||||
|
for char in string.gmatch(str,".") do
|
||||||
|
local byte = string.byte(char)
|
||||||
|
|
||||||
|
num = lshift(num,8)
|
||||||
|
num = bor(num, byte)
|
||||||
|
end
|
||||||
|
|
||||||
|
return num
|
||||||
|
end
|
||||||
|
|
||||||
|
--==User API==--
|
||||||
|
|
||||||
|
local icapi = {}
|
||||||
|
|
||||||
|
function icapi.extractIcon(exeFile)
|
||||||
|
|
||||||
|
--DOS Header
|
||||||
|
if exeFile:read(2) ~= "MZ" then return error("This is not an executable file !") end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return icapi
|
26
main.lua
Normal file
26
main.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
local iconChanger = require("icon-changer")
|
||||||
|
|
||||||
|
function love.load(args)
|
||||||
|
love.graphics.setBackgroundColor(1,1,1,1)
|
||||||
|
|
||||||
|
local exeFile = assert(love.filesystem.newFile("love.exe","r"))
|
||||||
|
|
||||||
|
local iconData = iconChanger.extractIcon(exeFile)
|
||||||
|
|
||||||
|
if iconData then
|
||||||
|
love.filesystem.write("Extracted Icon.ico",iconData)
|
||||||
|
love.system.openURL("file://"..love.filesystem.getSaveDirectory())
|
||||||
|
end
|
||||||
|
|
||||||
|
love.event.quit(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function love.draw()
|
||||||
|
love.graphics.setColor(0,0,0,1)
|
||||||
|
love.graphics.printf("Icon extracted",0,200/2-5,300,"center")
|
||||||
|
end
|
||||||
|
|
||||||
|
function love.update(dt)
|
||||||
|
|
||||||
|
end
|
Reference in New Issue
Block a user