Cleaned up some files and fixed another bug

This commit is contained in:
Ryan Ward 2018-09-21 13:00:49 -04:00
parent 79cdac68e8
commit 7e51931b71
3 changed files with 31 additions and 42 deletions

View File

@ -18,55 +18,30 @@ function getInput(msg,list)
return dat return dat
end end
end end
if not bin.fileExist("../game.love") or not bin.fileExist("../loveandroid.apk") then
print("game.love and loveandroid.apk must be in the root directory!\nPress Enter to continue...")
io.read()
os.exit()
end
print("AutoLoveMaker V1.0.0\nEnsure that all your files are in the same directory as the program! game.love, and loveandroid.apk must be present with these filenames for the program to work!") print("AutoLoveMaker V1.0.0\nEnsure that all your files are in the same directory as the program! game.love, and loveandroid.apk must be present with these filenames for the program to work!")
name = getInput("Game Name: ") name = getInput("Game Name: ")
if not io.dirExists("dat") then if not io.dirExists("dat") then
io.mkDir("dat") io.mkDir("dat")
end end
_o={l = "sensorLandscape",p = "portrait"} _o={l = "sensorLandscape",p = "portrait"}
if bin.fileExist("dat/"..name..".dat") then if not io.dirExists("love_decoded") then
b = getInput("You have compiled a game by this name before! Do you want to use the last build settings? (y/n): ",{"y","n"}) os.execute([[apktool d -s -o love_decoded ../loveandroid.apk]])
if not io.dirExists("love_decoded") then end
os.execute([[apktool d -s -o love_decoded ../loveandroid.apk]]) if not io.dirExists("love_decoded/assets") then
end io.mkDir("love_decoded/assets")
if b=="y" then end
local file = bin.load("dat/"..name..".dat") bin.load("../game.love"):tofile("love_decoded/assets/game.love")
local dat = file:getBlock("t") function Work()
o=dat.o
packageName=dat.packageName
ver=dat.ver
verN=dat.verN
else
print("We are going to manage Settings that affect your apk...")
o = getInput("Svreep Orientation(p - portrait | l - landscape): ",{"o","p"})
packageName = "game."..name..".org"
ver = getInput("Version Code(number): ")
verN = getInput("Version Name(number.number): ")
if not io.dirExists("love_decoded") then
os.execute([[apktool d -s -o love_decoded ../loveandroid.apk]])
end
io.mkDir("love_decoded/assets")
bin.load("game.love"):tofile("love_decoded/assets/game.love")
local file = bin.new()
file:addBlock({
o = o,
packageName = packageName,
ver = ver,
verN = verN,
})
file:tofile("dat/"..name..".dat")
end
else
print("We are going to manage Settings that affect your apk...") print("We are going to manage Settings that affect your apk...")
o = getInput("Svreep Orientation(p - portrait | l - landscape): ",{"o","p"}) o = getInput("Svreep Orientation(p - portrait | l - landscape): ",{"o","p"})
packageName = "game."..name..".org" packageName = "game."..name..".org"
ver = getInput("Version Code(number): ") ver = getInput("Version Code(number): ")
verN = getInput("Version Name(number.number): ") verN = getInput("Version Name(number.number): ")
if not io.dirExists("love_decoded") then
os.execute([[apktool d -s -o love_decoded ../loveandroid.apk]])
end
io.mkDir("love_decoded/assets")
bin.load("game.love"):tofile("love_decoded/assets/game.love")
local file = bin.new() local file = bin.new()
file:addBlock({ file:addBlock({
o = o, o = o,
@ -76,6 +51,21 @@ else
}) })
file:tofile("dat/"..name..".dat") file:tofile("dat/"..name..".dat")
end end
if bin.fileExist("dat/"..name..".dat") then
b = getInput("You have compiled a game by this name before! Do you want to use the last build settings? (y/n): ",{"y","n"})
if b=="y" then
local file = bin.load("dat/"..name..".dat")
local dat = file:getBlock("t")
o=dat.o
packageName=dat.packageName
ver=dat.ver
verN=dat.verN
else
Work()
end
else
Work()
end
if bin.fileExist("../game.png") then if bin.fileExist("../game.png") then
print("building icon") print("building icon")
local icon = gd.createFromPng("../game.png") local icon = gd.createFromPng("../game.png")
@ -135,7 +125,6 @@ f1 = bin.load(name.."-aligned-debugSigned.apk"):tofile("../"..name.."-Signed.apk
f2 = bin.load(name..".apk"):tofile("../"..name.."-Unsigned.apk") f2 = bin.load(name..".apk"):tofile("../"..name.."-Unsigned.apk")
os.remove(name.."-aligned-debugSigned.apk") os.remove(name.."-aligned-debugSigned.apk")
os.remove(name..".apk") os.remove(name..".apk")
--minSdkVersion: '16' io.write("Cleanup folder ")
--targetSdkVersion: '16' os.execute([[rmdir love_decoded /s]])
getInput("Press Enter to continue...")
--portrait,sensorLandscape

Binary file not shown.

Binary file not shown.