Page 5 of 6

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 1:22 am
by MyLegGuy
Hello.

Can you tell me why my game crashes after doing nothing for a while?

Here's the only code that's being run:

Code: Select all

function showtitle()
menu=0
a,b = Network.initFTP()

while true do


	Screen.initBlend()
	Screen.clear()
	System.powerTick()

Screen.fillRect(0, 1000, 0, 600, Color.new(255,255,255))
Screen.debugPrint(400, 20, "Title", Color.new(0,0,0))
Screen.debugPrint(50, 200, "Play", Color.new(0,0,0))
Screen.debugPrint(50, 216, "Options", Color.new(0,0,0))
Screen.debugPrint(30, 200+(menu*16), ">", Color.new(0,0,0))


	if Controls.check(Controls.read(), PSP2_CTRL_SELECT) then
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	Screen.flip()
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	System.wait(3000)	
	dofile("cache0:/lpp/index.lua")
	end

Screen.termBlend()	
Screen.flip()
System.wait(1)
end
end

showtitle()

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 12:37 pm
by Ervilha
MyLegGuy wrote:Hello.

Can you tell me why my game crashes after doing nothing for a while?

Here's the only code that's being run:

Code: Select all

function showtitle()
menu=0
a,b = Network.initFTP()

while true do


	Screen.initBlend()
	Screen.clear()
	System.powerTick()

Screen.fillRect(0, 1000, 0, 600, Color.new(255,255,255))
Screen.debugPrint(400, 20, "Title", Color.new(0,0,0))
Screen.debugPrint(50, 200, "Play", Color.new(0,0,0))
Screen.debugPrint(50, 216, "Options", Color.new(0,0,0))
Screen.debugPrint(30, 200+(menu*16), ">", Color.new(0,0,0))


	if Controls.check(Controls.read(), PSP2_CTRL_SELECT) then
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	Screen.flip()
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	System.wait(3000)	
	dofile("cache0:/lpp/index.lua")
	end

Screen.termBlend()	
Screen.flip()
System.wait(1)
end
end

showtitle()
Remove this line, the FTP module is very unstable

Code: Select all

a,b = Network.initFTP()

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 6:02 pm
by Rinnegatamante
Ervilha wrote:
MyLegGuy wrote:Hello.

Can you tell me why my game crashes after doing nothing for a while?

Here's the only code that's being run:

Code: Select all

function showtitle()
menu=0
a,b = Network.initFTP()

while true do


	Screen.initBlend()
	Screen.clear()
	System.powerTick()

Screen.fillRect(0, 1000, 0, 600, Color.new(255,255,255))
Screen.debugPrint(400, 20, "Title", Color.new(0,0,0))
Screen.debugPrint(50, 200, "Play", Color.new(0,0,0))
Screen.debugPrint(50, 216, "Options", Color.new(0,0,0))
Screen.debugPrint(30, 200+(menu*16), ">", Color.new(0,0,0))


	if Controls.check(Controls.read(), PSP2_CTRL_SELECT) then
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	Screen.flip()
	Screen.initBlend()
	Screen.clear()
	Screen.termBlend()
	System.wait(3000)	
	dofile("cache0:/lpp/index.lua")
	end

Screen.termBlend()	
Screen.flip()
System.wait(1)
end
end

showtitle()
Remove this line, the FTP module is very unstable

Code: Select all

a,b = Network.initFTP()
Agree, for now socketing is unstable.
Virus wrote:My image is correctly located in "cache0:/splashscreen.jpg", not in the root... :/
When you connect your VITA with ftpVITA, cache0:/ folder is the root.

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 6:07 pm
by Virus
Oh my God, I'm soo stupid, it is located in "cache0:/lpp/splashscreen.jpg". x___x Thank you for the answer Rinnegatamante ! ^^

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 8:03 pm
by MyLegGuy
Ervilha wrote:
Remove this line, the FTP module is very unstable

Code: Select all

a,b = Network.initFTP()
Thanks a lot!

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 10:32 pm
by MyLegGuy
What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Mon Sep 21, 2015 11:47 pm
by qwikrazor87
MyLegGuy wrote:What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
Try this.

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
  fileStream = io.open("cache0:/lpp/a.txt", "wb")
  fileStream:write("a")
  fileStream:close()
end
Lua doesn't expect an extra argument for the length of writing, it calculates it from the string you pass it in the first argument.

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Tue Sep 22, 2015 1:22 pm
by Rinnegatamante
qwikrazor87 wrote:
MyLegGuy wrote:What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
Try this.

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
  fileStream = io.open("cache0:/lpp/a.txt", "wb")
  fileStream:write("a")
  fileStream:close()
end
Lua doesn't expect an extra argument for the length of writing, it calculates it from the string you pass it in the first argument.
lpp-vita uses a different io module who uses sceIo library instead of standard C io (cause when i asked to xerpi if standard C io where available on PSVITA he said me they won't work on it).
For length, i added it cause i noticed there were problems with string containing 0x00 characters (they were interpreted as end string from lua_checkstring so it make impossible to work for some applications like Hex Writers).

@MyLegGuy: what's the problem? File is not created? (If so, try to do the same think with an already existent file with FWRITE or FRDWR and tell me if it works, maybe there are attributes problem in the src of the interpreter).

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Tue Sep 22, 2015 1:46 pm
by qwikrazor87
Rinnegatamante wrote:lpp-vita uses a different io module who uses sceIo library instead of standard C io (cause when i asked to xerpi if standard C io where available on PSVITA he said me they won't work on it).
For length, i added it cause i noticed there were problems with string containing 0x00 characters (they were interpreted as end string from lua_checkstring so it make impossible to work for some applications like Hex Writers).

@MyLegGuy: what's the problem? File is not created? (If so, try to do the same think with an already existent file with FWRITE or FRDWR and tell me if it works, maybe there are attributes problem in the src of the interpreter).
Ok, my bad, I haven't tested this out (and can't).

Re: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PS

Posted: Tue Sep 22, 2015 10:27 pm
by MyLegGuy
Subject: Lua Player Plus VITA (lpp-vita) - Lua interpreter for PSVITA
Rinnegatamante wrote:
qwikrazor87 wrote:
MyLegGuy wrote:What's wrong with my code for writing to a file?

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
 fileStream = io.open("cache0:/lpp/a.txt",FCREATE)
io.write(fileStream,"a", 1)
io.close(fileStream)
end
Try this.

Code: Select all

if Controls.check(pad, PSP2_CTRL_SELECT) then
  fileStream = io.open("cache0:/lpp/a.txt", "wb")
  fileStream:write("a")
  fileStream:close()
end
Lua doesn't expect an extra argument for the length of writing, it calculates it from the string you pass it in the first argument.
lpp-vita uses a different io module who uses sceIo library instead of standard C io (cause when i asked to xerpi if standard C io where available on PSVITA he said me they won't work on it).
For length, i added it cause i noticed there were problems with string containing 0x00 characters (they were interpreted as end string from lua_checkstring so it make impossible to work for some applications like Hex Writers).

@MyLegGuy: what's the problem? File is not created? (If so, try to do the same think with an already existent file with FWRITE or FRDWR and tell me if it works, maybe there are attributes problem in the src of the interpreter).
Alright, it seems that if the file ALREADY exists, and FWRITE or FRDWR is used, it'll work.

I can't use table.maxn, right?

I have another question.
When I use

Code: Select all

sometable={}
sometable = System.listDirectory("cache0:/somefolder")
the table gets a whole ton of other table values. How do I get the name of the file from the table?

Also, sorry I sent this as a pm to you. The quote button and the pm button look the same.