From 668ac81c091b85209d69103da73ab1427f4ea354 Mon Sep 17 00:00:00 2001 From: chinseng85 Date: Wed, 25 Mar 2020 21:12:28 +0800 Subject: [PATCH] Fix an app error due to game icon0.png is missing If homebrew does not come with an icon, then BetterTrackPlug will skip copyIcon function, hence folder "Assets/titleId" will not be created. Next, while trying to create title.txt inside the "Assets/titleId" folder an error will occur due to "Assets/titleId" folder is not created in the first place. --- app/index.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/index.lua b/app/index.lua index a7de7c0..72b95bc 100644 --- a/app/index.lua +++ b/app/index.lua @@ -147,19 +147,20 @@ for i, file in pairs(tbl) do else local titleid = string.sub(file.name,1,-5) file.region = getRegion(titleid) - if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png") then file.icon = Graphics.loadImage("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png") - elseif System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then - file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png") + else System.createDirectory("ux0:/data/TrackPlug/Assets/" .. titleid .. "") - copyIcon(titleid) - else - file.icon = unk - end + if System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then + file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png") + copyIcon(titleid) + else + file.icon = unk + end + end - if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/title.txt") then + if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/title.txt") then file.title = recoverTitle(titleid) elseif System.doesFileExist("ux0:/app/" .. titleid .. "/sce_sys/param.sfo") then file.title = extractTitle("ux0:/app/" .. titleid .. "/sce_sys/param.sfo", titleid) @@ -387,4 +388,4 @@ while true do Graphics.termBlend() Screen.flip() Screen.waitVblankStart() -end \ No newline at end of file +end