corytheidiot
New Member
I need to find out why I can't copy to the flash0. I can view files/directories that are in it, but I cannot copy a file to it. I am using LPHMv2.
I assign the flash and everything, and I get no errors.
The code is messy, please forgive me for that.
Here is my code.
I assign the flash and everything, and I get no errors.
The code is messy, please forgive me for that.
Here is my code.
Code:
appversion = "0.0.0"
appfw = "5.00"
--Wave Changer 5.00
--corytheidiot
System.loadPrx("App/prx/iop.prx")
debug = 0
pad = Controls.read()
if pad:r() and pad:square() then
debug = 1
end
vis = Font.load("App/font/visitor.ttf",9)
white = Color.new(255,255,255,255)
black = Color.new(0,0,0,255)
green = Color.new(0,255,0,255)
red = Color.new(255,0,0,255)
greytrans = Color.new(70,70,70,200)
topbar = Image.createEmpty(480,45)
topbar:clear(greytrans)
background = Image.createEmpty(480,272)
background:clear(black)
no_preview = Image.load("App/Default/no_preview.png")
Wave = {}
i = 3
ii = 1
iii = 1
BackExist = "False"
loopcount = 0
function Write_Wave()
loop2count = 0
while true do
loop2count = loop2count + 1
--if loop2count < 1 then
System.removeFile("flash0:/vsh/resource/system_plugin_bg.rco")
--System.copyFile(Cur_Dir .."/App/Waves/" ..dirList[i].name .."/icon.png","flash0:/vsh/resource/icon.png",0)
--end
--System.removeFile("flash0:/vsh/resource/system_plugin_bg.rco")
--[[
]]
--end
screen.clear(0)
if loop2count > 200 then
System.message("Looped",0)
break
end
end
end
oldpad = pad
function Change_Wave()
FromWave = io.open(Cur_Dir .."/App/Waves/" ..dirList[i].name .."/system_plugin_bg.rco","r")
changeto = FromWave:read("*a")
FromWave:close()
end
function Change_Wave2()
ToWave = io.open("flash0:/vsh/resource/system_plugin_bg.rco","w")
ToWave:write(changeto)
ToWave:close()
end
function New_Change_Wave()
System.copyFile(Cur_Dir .."/App/Waves/" ..dirList[i].name .."/system_plugin_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
end
while true do
Cur_Dir = System.currentDirectory()
dirList = System.listDirectory(Cur_Dir .."/App/Waves/")
if System.powerGetBatteryLifePercent() > 10 then
ready = "Safe"
else
ready = "Dangerous!"
end
loopcount = loopcount + 1
if loopcount > 10 then loopcount = 0 end
Cur_Dir = System.currentDirectory()
dirList = System.listDirectory(Cur_Dir .."/App/Waves/")
--waveList = System.listDirectory(Cur_File ..dirList[i].name .."/" ..fileList[i].name .."/")
pad = Controls.read()
thewave =
screen.startDraw()
Image.blit(0,0,background)
if loopcount > 9 then
if System.doesFileExist("App/Waves/" ..dirList[i].name .."/icon.png") == 1 then
icon = Image.load("App/Waves/" ..dirList[i].name .."/icon.png")
end
if System.doesFileExist("App/Waves/" ..dirList[i].name .."/icon.png") ~= 1 then
if System.doesFileExist("App/Waves/" ..dirList[i].name .."/icon.JPG") == 1 then
icon = Image.load("App/Waves/" ..dirList[i].name .."/icon.JPG")
else
icon = nil
end end
end
if icon ~= nil then Image.blit(0,0,icon) end
if icon == nil then Image.blit(0,0,no_preview) end
Image.blit(0,0,topbar)
Font.print(vis,0,10,"PSP Wave Changer v." ..appversion .." FW " ..appfw .." Edition",white)
Font.print(vis,0,20,"Theme- " ..dirList[i].name,white)
Font.print(vis,200,20,(i - 2) .." of " ..(table.getn(dirList) - 2),white)
Font.print(vis,0,30,"Battery Status: " ..System.powerGetBatteryLifePercent() .."%",white)
if ready == "Safe" then
Font.print(vis,140,30,ready,green)
else
Font.print(vis,140,30,ready,red)
end
--Debugging
if debug == 1 then
Font.print(vis,200,110,"Dir- " ..dirList[i].name,white)
string.lower(Font.print(vis,200,100,"Exist PNG?- " ..System.doesFileExist(Cur_Dir .."/" ..dirList[i].name .."/icon.PNG"),white))
Font.print(vis,200,90,"Exist JPG?- " ..System.doesFileExist(Cur_Dir .."/icon.jpg"),white)
Font.print(vis,200,120,"dir- " ..Cur_Dir .."/" ..dirList[i].name,white)
Font.print(vis,200,130,"Back There?- " ..BackExist,white)
Font.print(vis,200,140,"Ram- " ..System.getFreeMemory(),white)
Font.print(vis,200,150,"Direct Cur- " ..System.currentDirectory(),red)
Font.print(vis,200,160,"Wave Size- " ..System.getFileSize("flash0:/vsh/resource/system_plugin_bg.rco"),red)
end
if System.doesFileExist("App/Waves/" ..dirList[i].name .."/" .."system_plugin_bg.rco") == 1 then
BackExist = "True"
else
BackExist = "False"
end
if BackExist == "True" and pad:cross() then
System.unassign("flash0:")
System.assign("flash0:","lflash0:0,0","flashfat0:")
System.copyFile(Cur_Dir .."/App/Waves/" ..dirList[i].name .."/system_plugin_bg.rco","flash0:/system_plugin_bg.rco",0)
end
if pad:right() and not oldpad:right() and i < table.getn(dirList) then i = i + 1 iii = 1 end
if pad:left() and not oldpad:left() and i > 3 then i = i - 1 iii = 1 end
flashtable = System.listDirectory("flash0:/")
for a=1,table.getn(flashtable) do
Font.print(vis,0,30 + (a * 9), flashtable[a].name,red)
end
if pad:start() then break end
if pad:select() then System.Quit() end
screen.endDraw()
screen.waitVblankStart()
screen.flipscreen()
oldpad = pad
end