LUA support now available for firmware v2.0

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

LUA support now available for firmware v2.0

Post by Fanjita »

Hi all.

Just a quick mention that, with Shine's help, I've built a user-mode version of LUAPlayer, and bundled it with the v2.0 EBOOT loader.

So now, you should be able to run LUA scripts on v2.0 firmware.

The support is a little flaky at the moment - quite a few scripts seem to crash or bomb out with a "script could not be found" error (which usually, in this case, means that an unsupported function was called).

The user mode player doesn't support USB functions, but apart from that should be fairly complete.

I'd really appreciate any feedback on which scripts work / don't work, and also ideally anything that those scripts have in common, so that I can fix it.

Thanks,

x
Fanj.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

nice work
i do not own a 2.0 psp otherwise i would test for you
greets
lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

I have a PSP with firmware 2.0 as well. Will test the eboot after I finish with my current project. It will be a few days to finish, hopefully.
Geo Massar
Retired Engineer
Arwin
Posts: 426
Joined: Tue Jul 12, 2005 7:00 pm

Re: LUA support now available for firmware v2.0

Post by Arwin »

Fanjita wrote:The support is a little flaky at the moment - quite a few scripts seem to crash or bomb out with a "script could not be found" error (which usually, in this case, means that an unsupported function was called).
Wasn't Lua (re)written so that it can run in User mode completely?

I read that many problems with running eboots and such on 2.0 is handling the file locations. When debugging this I would recommend looking at how the offending lua script reads its data-files.
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Re: LUA support now available for firmware v2.0

Post by Fanjita »

Arwin wrote: Wasn't Lua (re)written so that it can run in User mode completely?
Pretty much. USB support was removed (needs kernel-mode), and stdio handlers aren't set (again, kernel-mode) so printfs don't appear in the user-mode player.

This is the main reason why scripts fail with a cryptic "couldn't find script" error, because they're not displaying the root cause for script failure.

The LUA build I'm working with in development now shows the script errors more clearly, so I have a pretty good idea of what's going wrong.
Arwin wrote: I read that many problems with running eboots and such on 2.0 is handling the file locations. When debugging this I would recommend looking at how the offending lua script reads its data-files.
No, that's pretty much all fixed up now, and isn't a problem for LUA - the getcwd() and relative-path file functions all work fine.

What seems to be causing the most common script errors is failure during Image.load() after a few images have been loaded successfully. There's nothing unusual about the file locations or names in these cases.

My current theory is that the malloc heap is much much smaller in the 2.0 TIF exploit environment - at the point at which the loader starts up, the heap seems to be only around 2MB, which can easily be exhausted.

I think I either need to find a way to free up some heap memory, or else develop my own emulation of the kernel's memory management.
Fanjita
Posts: 217
Joined: Wed Sep 28, 2005 9:31 am

Post by Fanjita »

Well, I implemented a new memory manager in the v0.7 loader, and I know of only one LUA script (PBJ wars) that fails to run now in the user-mode player.

You can pick up the update from my website if you need it.
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

I have tested some of homebrew programs on 2.0. Not so bad, so far. Tried my LED Timer which came with 0.11 version of LuaPlayer, the dial went wild. Isn't Timer class included in your current version? Maybe, it was due to kernel issue?

Thanks for your good work.
Geo Massar
Retired Engineer
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

KawaGeo wrote:I have tested some of homebrew programs on 2.0. Not so bad, so far. Tried my LED Timer which came with 0.11 version of LuaPlayer, the dial went wild. Isn't Timer class included in your current version? Maybe, it was due to kernel issue?

Thanks for your good work.
From my mail:

Ok, I've found a bug in LuaPlayer for PSP 2.00.

The timer goes 1000 times faster then it should.

---CODE---
myTimer=Timer.new()
myTimer:start()

while true do
screen:clear()
screen:print(0,0,myTimer:time()/1000,Color.new(255,255,255))
screen.waitVblankStart()
screen.flip()
end
---CODE---

That code should display time in seconds, but it does milliseconds instead (notice that I've already divided by 1000, so it counts in seconds in the "normal" luaplayer 0.11)

Hope you can fix it. I really need a fixed version.



Fanjita reply:
Here's a response from Shine (author of LUAPlayer), seems that it's a known bug in the PSPSDK at the moment. He should be releasing a fix within the next week or so.

Shine reply:
in some version of the PSPSDK were the clock bug introduced again. Updating the PSPSDK would solve this, but at the moment this doesn't help, because there is another bug which caused a linker error, but I've wrote to ps2dev.org and mrbrown answered he fix this at weekend. Maybe then I'll release a user mode Lua Player 0.12, (with 3D support) too.
Post Reply