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,17 +18,41 @@ 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 not io.dirExists("love_decoded") then
os.execute([[apktool d -s -o love_decoded ../loveandroid.apk]])
end
if not io.dirExists("love_decoded/assets") then
io.mkDir("love_decoded/assets")
end
bin.load("../game.love"):tofile("love_decoded/assets/game.love")
function Work()
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): ")
local file = bin.new()
file:addBlock({
o = o,
packageName = packageName,
ver = ver,
verN = verN,
})
file:tofile("dat/"..name..".dat")
end
if bin.fileExist("dat/"..name..".dat") then 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"}) 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 not io.dirExists("love_decoded") then
os.execute([[apktool d -s -o love_decoded ../loveandroid.apk]])
end
if b=="y" then if b=="y" then
local file = bin.load("dat/"..name..".dat") local file = bin.load("dat/"..name..".dat")
local dat = file:getBlock("t") local dat = file:getBlock("t")
@ -37,44 +61,10 @@ if bin.fileExist("dat/"..name..".dat") then
ver=dat.ver ver=dat.ver
verN=dat.verN verN=dat.verN
else else
print("We are going to manage Settings that affect your apk...") Work()
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 end
else else
print("We are going to manage Settings that affect your apk...") Work()
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 end
if bin.fileExist("../game.png") then if bin.fileExist("../game.png") then
print("building icon") print("building icon")
@ -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.