The icons will stay when you remove the games now, thanks to chinseng85
This commit is contained in:
commit
fe8b99c6c3
@ -1,13 +1,13 @@
|
|||||||
-- Creating dirs in case they do not exist
|
-- Creating dirs in case they do not exist
|
||||||
|
System.createDirectory("ux0:/data/TrackPlug/")
|
||||||
System.createDirectory("ux0:/data/TrackPlug/Records")
|
System.createDirectory("ux0:/data/TrackPlug/Records")
|
||||||
System.createDirectory("ux0:/data/TrackPlug/Names")
|
|
||||||
System.createDirectory("ux0:/data/TrackPlug/Config")
|
System.createDirectory("ux0:/data/TrackPlug/Config")
|
||||||
System.createDirectory("ux0:/data/TrackPlug/Assets")
|
System.createDirectory("ux0:/data/TrackPlug/Assets")
|
||||||
-- Scanning TrackPlug folder
|
-- Scanning TrackPlug folder
|
||||||
local tbl = System.listDirectory("ux0:/data/TrackPlug/Records")
|
local tbl = System.listDirectory("ux0:/data/TrackPlug/Records")
|
||||||
local blacklist = {}
|
local blacklist = {}
|
||||||
-- Removing blacklisted games
|
-- Removing blacklisted games
|
||||||
for i, file in pairs(tbl) do
|
--[[for i, file in pairs(tbl) do
|
||||||
local titleid = string.sub(file.name,1,-5)
|
local titleid = string.sub(file.name,1,-5)
|
||||||
for k, toberemoved in pairs(blacklist) do
|
for k, toberemoved in pairs(blacklist) do
|
||||||
if titleid == blacklist[k] then
|
if titleid == blacklist[k] then
|
||||||
@ -16,7 +16,7 @@ for i, file in pairs(tbl) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Reset the table
|
-- Reset the table
|
||||||
tbl = System.listDirectory("ux0:/data/TrackPlug/Records")
|
tbl = System.listDirectory("ux0:/data/TrackPlug/Records")]]--
|
||||||
|
|
||||||
if tbl == nil then
|
if tbl == nil then
|
||||||
tbl = {}
|
tbl = {}
|
||||||
@ -47,7 +47,7 @@ end
|
|||||||
|
|
||||||
-- Recover title from homebrew database
|
-- Recover title from homebrew database
|
||||||
function recoverTitle(tid)
|
function recoverTitle(tid)
|
||||||
local file = System.openFile("ux0:/data/TrackPlug/Names/" .. tid .. ".txt", FREAD)
|
local file = System.openFile("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt", FREAD)
|
||||||
fsize = System.sizeFile(file)
|
fsize = System.sizeFile(file)
|
||||||
local title = System.readFile(file, fsize)
|
local title = System.readFile(file, fsize)
|
||||||
System.closeFile(file)
|
System.closeFile(file)
|
||||||
@ -57,25 +57,22 @@ end
|
|||||||
-- Extracts title name from an SFO file
|
-- Extracts title name from an SFO file
|
||||||
function extractTitle(file, tid)
|
function extractTitle(file, tid)
|
||||||
local data = System.extractSfo(file)
|
local data = System.extractSfo(file)
|
||||||
if System.doesFileExist("ux0:/data/TrackPlug/Names/" .. tid .. ".txt") then
|
if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt") then
|
||||||
System.deleteFile("ux0:/data/TrackPlug/Names/" .. tid .. ".txt")
|
System.deleteFile("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt")
|
||||||
end
|
end
|
||||||
local file = System.openFile("ux0:/data/TrackPlug/Names/" .. tid .. ".txt", FCREATE)
|
local file = System.openFile("ux0:/data/TrackPlug/Assets/" .. tid .. "/title.txt", FCREATE)
|
||||||
System.writeFile(file, data.title, string.len(data.title))
|
System.writeFile(file, data.title, string.len(data.title))
|
||||||
System.closeFile(file)
|
System.closeFile(file)
|
||||||
return data.title
|
return data.title
|
||||||
end
|
end
|
||||||
--[[
|
|
||||||
function extractIcon(tid)
|
function copyIcon(titleid)
|
||||||
local icon = System.openFile("ur0:/appmeta/" .. tid .. "/icon0.png", FREAD)
|
newFile = System.openFile("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png", FCREATE)
|
||||||
local fsize = System.sizeFile(icon)
|
oldFile = System.openFile("ur0:/appmeta/" .. titleid .. "/icon0.png", FREAD)
|
||||||
local extractedIcon = System.readFile(icon, fsize)
|
fileSize = System.sizeFile(oldFile)
|
||||||
System.closeFile(icon)
|
icon = System.readFile(oldFile, fileSize)
|
||||||
local file = System.openFile("ux0:/data/TrackPlug/Assets/" .. tid .. ".png", FCREATE)
|
System.writeFile(newFile, icon, fileSize)
|
||||||
System.writeFile(file, extractedIcon, string.len(extractedIcon))
|
end
|
||||||
System.closeFile(icon)
|
|
||||||
return 0
|
|
||||||
end]]--
|
|
||||||
|
|
||||||
function getRegion(titleid)
|
function getRegion(titleid)
|
||||||
local regioncode = string.sub(titleid,1,4)
|
local regioncode = string.sub(titleid,1,4)
|
||||||
@ -151,15 +148,18 @@ for i, file in pairs(tbl) do
|
|||||||
local titleid = string.sub(file.name,1,-5)
|
local titleid = string.sub(file.name,1,-5)
|
||||||
file.region = getRegion(titleid)
|
file.region = getRegion(titleid)
|
||||||
|
|
||||||
--if System.doesFileExist("ux0:/TrackPlug/Assets/" .. titleid .. "/icon0.png") then
|
if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png") then
|
||||||
-- file.icon = Graphics.loadImage("ux0:/TrackPlug/Assets/" .. titleid .. "/icon0.png")
|
file.icon = Graphics.loadImage("ux0:/data/TrackPlug/Assets/" .. titleid .. "/icon0.png")
|
||||||
if System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then
|
elseif System.doesFileExist("ur0:/appmeta/" .. titleid .. "/icon0.png") then
|
||||||
file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png")
|
file.icon = Graphics.loadImage("ur0:/appmeta/" .. titleid .. "/icon0.png")
|
||||||
-- extractIcon(titleid)
|
System.createDirectory("ux0:/data/TrackPlug/Assets/" .. titleid .. "")
|
||||||
|
copyIcon(titleid)
|
||||||
else
|
else
|
||||||
file.icon = unk
|
file.icon = unk
|
||||||
end
|
end
|
||||||
if System.doesFileExist("ux0:/data/TrackPlugArchive/" .. titleid .. ".txt") then
|
|
||||||
|
|
||||||
|
if System.doesFileExist("ux0:/data/TrackPlug/Assets/" .. titleid .. "/title.txt") then
|
||||||
file.title = recoverTitle(titleid)
|
file.title = recoverTitle(titleid)
|
||||||
elseif System.doesFileExist("ux0:/app/" .. titleid .. "/sce_sys/param.sfo") then
|
elseif System.doesFileExist("ux0:/app/" .. titleid .. "/sce_sys/param.sfo") then
|
||||||
file.title = extractTitle("ux0:/app/" .. titleid .. "/sce_sys/param.sfo", titleid)
|
file.title = extractTitle("ux0:/app/" .. titleid .. "/sce_sys/param.sfo", titleid)
|
||||||
|
@ -94,7 +94,10 @@ static void adrenaline_titlewriter(char *dummy_id,char *dummy_title){
|
|||||||
//We don't want XMB's title to be written.
|
//We don't want XMB's title to be written.
|
||||||
if (dummy_title[0] == 0 || !strncmp(dummy_title, "XMB", 3)) return;
|
if (dummy_title[0] == 0 || !strncmp(dummy_title, "XMB", 3)) return;
|
||||||
char path[128];
|
char path[128];
|
||||||
snprintf(path, 128, "ux0:/data/TrackPlug/Names/%s.txt", dummy_id);
|
char pathfolder[128];
|
||||||
|
snprintf(path, 128, "ux0:/data/TrackPlug/Assets/%s/title.txt", dummy_id);
|
||||||
|
snprintf(pathfolder, 128, "ux0:/data/TrackPlug/Assets/%s/", dummy_id);
|
||||||
|
int dfd = ksceIoMkdir(pathfolder,6);
|
||||||
SceUID fd = ksceIoOpen(path,
|
SceUID fd = ksceIoOpen(path,
|
||||||
SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
|
SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
|
||||||
if (fd < 0) return;
|
if (fd < 0) return;
|
||||||
|
Reference in New Issue
Block a user