Advertising (This ad goes away for registered users. You can Login or Register)

[WIP+RELEASE] lpp.prx - Create PSP/PSVITA plugins in LUA

Most of the homebrews discussed in this forum can be downloaded here
User avatar
Rinnegatamante
VIP
Posts: 841
Joined: Sat Mar 26, 2011 10:02 am
Contact:

[WIP+RELEASE] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Rinnegatamante » Fri May 23, 2014 8:44 pm

lpp.prx is the first LUA interpreter in order to create PSP/PSVITA plugins in LUA!
Current public release: R204 BETA

Video
Sourcecode:
https://code.google.com/p/lua-player-plus/

Download:
http://rinnegatamante.netsons.org/lpp_204.rar

This is the list of current functions implemented:
[spoiler]----------------
Kernel Class
----------------
Kernel.memcpy(u32 addr,u32 source,int size) - Copy block of memory
Kernel.memset(u32 addr,int value,int size) - Fill block of memory
Kernel.memcmp(u32 addr,u32 addr2,int size) - Compare block of memory
Kernel.storeWord(u32 addr,u32 val) - Store Word (Equivalent of _sw C function)
Kernel.loadWord(u32 addr) - Load Word (Equivalent of _lw C function)
----------------
Screen Class
----------------
Screen.debugPrint(int x,int y,string text,u32 color) - Write a text with Debug font
Screen.debugPrintGradient(int x,int y,string text,u32 color1, u32 color2) - Write a gradient text with Debug font
Screen.waitVblankStart(int millisecond) - Wait Display Screen
Screen.clear() - Clear Debug Screen
----------------
Color Class
----------------
Color.new(int R,int G,int B) - Create a new BGR color
Color.getR(int color) - Get R value of a color
Color.getG(int color) - Get G value of a color
Color.getB(int color) - Get B value of a color
----------------
System Class
----------------
System.restart() - Restart interpreter
System.getFileSize(string filename) - Get size in bytes of a file
System.closeFile(int id) - Close a file
System.writeFile(int id, string string,int size) - Write a text in a file
System.readFile(int id,int size) - Read a text from file
System.seekFile(int id,int offset,int position) - Change pointer position in a file (position must be INIT_FILE, END_FILE, CUR_FILE)
System.openFile(string filename,int mode) - Open a file (mode must be PSP_READ, PSP_WRITE, PSP_APPEND, PSP_CREATE)
System.protodofile(string filename) - Temporary dofile/loadmodule replacing - Load a new LUA script restarting interpreter
System.loadModule(string file) - Load and start a PRX module
System.assign(string dev1,string dev2,string dev3) - Assign Device
System.unassign(string dev) - Unassign Device
System.md5sum(string string) - Get crypted MD5 string
System.sha1sum(string string) - Get crypted SHA1 string
System.isPSP() - Check if user is on PSP (1 = PSP, 0 = PSVITA)
System.getModel() - Get PSP Model
System.getTime(int mode) - Get time (mode: 1= hours,2= minutes,3= seconds)
System.getDate(int mode) - Get date (mode: 1= days,2= months,3= years)
System.getFreeSize(string device) - Get free size of selected device
System.getTotalSize(string device) - Get total size of selected device
System.startPBP(string filename) - Start a PBP
System.startPSX(string filename) - Start a PBP with POPS
System.getVersion() - Get firmware version
System.listDirectory() - List a Directory
System.doesFileExist(string file) - Check if file exist
System.renameFile(string file1,string file2) - Rename a File
System.renameDir(string file1,string file2) - Rename a Directory
System.removeFile(string file1,string file2) - Remove a File
System.removeDir(string file1,string file2) - Remove a Directory
System.copyFile(string file1,string file2) - Copy a File
System.copyDir(string file1,string file2) - Copy a Directory
System.createDirectory(string path) - Create a Directory
System.resumeThread() - Resume paused main thread
System.powerIsPowerOnline() - Get Battery status
System.powerIsBatteryExist() - Check if battery exist
System.powerIsBatteryCharging() - Check if battery is in charging
System.powerGetBatteryChargingStatus() - Get charging status
System.powerIsLowBattery() - Check if battery charging status is low
System.powerGetBatteryLifePercent() - Get battery life percent
System.powerGetBatteryLifeTime() - Get battery life time
System.powerGetBatteryTemp() - Get battery temperature
System.powerGetBatteryVolt() - Get battery voltage
----------------
Controls Class
----------------
Controls.read() - Read Controls Buffer
Controls.readPeek() - Peek Controls Buffer
----------------
Controls Methods - Interfacing with PSP buttons
----------------
controls:select
controls:start
controls:up
controls:right
controls:down
controls:left
controls:l
controls:r
controls:triangle
controls:circle
controls:square
controls:home
controls:hold
controls:note
controls:analogX
controls:analogY
controls:buttons[/spoiler]

Any bug report, critic or advise is welcome and sorry for my really bad english :roll:
Advertising
Last edited by Rinnegatamante on Sun Jul 06, 2014 5:18 pm, edited 5 times in total.
If you want, visit my website: http://rinnegatamante.it :D

User avatar
Applelo
Posts: 39
Joined: Wed Mar 28, 2012 12:36 pm

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Applelo » Sat May 24, 2014 8:07 am

Good Job :D It's a great idea for create new plugin :D
GO FOR MORE FUNCTION :D

(my english is very bad, sorry :cry: )
Advertising
Image

User avatar
qwikrazor87
Guru
Posts: 2869
Joined: Sat Apr 21, 2012 1:23 pm
Location: The North Pole

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by qwikrazor87 » Sat May 24, 2014 8:26 am

Wow, great job, Rinnegatamante. :)
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Maxwest Nitro 4 phone - Android 5.1
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS

User avatar
toBsucht
VIP
Posts: 1936
Joined: Wed Dec 29, 2010 8:15 am
Contact:

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by toBsucht » Sat May 24, 2014 10:17 am

Wow.. waiting for some new apps & games for xmb.
your video:
HomeBrews working with Psp 6.xx fw viewtopic.php?f=2&t=2624
ofw (shrunk) HomeBrews viewtopic.php?f=2&t=1879

All Psp homebrews at mfi.re/toBsucht
http://pspinstaller.co.uk

User avatar
Rinnegatamante
VIP
Posts: 841
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Rinnegatamante » Sat May 24, 2014 12:23 pm

Thanks for the support, guys ;)

Today i added a lot of new functions to the interpreter (Battery functions, System.startPBP, Screen.clear and other System functions).

Newest sourcecodes are available on the repository.

The new list of functions is this:
[spoiler]----------------
Screen Class
----------------
Screen.debugPrint(int x,int y,string text,u32 color) - Write a text with Debug font
Screen.waitVblankStart(int millisecond) - Wait Display Screen
Screen.clear() - Clear Debug Screen
----------------
System Class
----------------
System.getTime(int mode) - Get time (mode: 1= hours,2= minutes,3= seconds)
System.getDate(int mode) - Get date (mode: 1= days,2= months,3= years)
System.getFreeSize(string device) - Get free size of selected device
System.getTotalSize(string device) - Get total size of selected device
System.startPBP(string filename) - Start a PBP
System.getVersion() - Get firmware version
System.renameFile(string file1,string file2) - Rename a File
System.renameDir(string file1,string file2) - Rename a Directory
System.removeFile(string file1,string file2) - Remove a File
System.removeDir(string file1,string file2) - Remove a Directory
System.copyFile(string file1,string file2) - Copy a File
System.copyDir(string file1,string file2) - Copy a Directory
System.createDirectory(string path) - Create a Directory
System.resumeThread() - Resume paused main thread
System.powerIsPowerOnline() - Get Battery status
System.powerIsBatteryCharging() - Check if battery is in charging
System.powerGetBatteryChargingStatus() - Get charging status
System.powerIsLowBattery() - Check if battery charging status is low
System.powerGetBatteryLifePercent() - Get battery life percent
System.powerGetBatteryLifeTime() - Get battery life time
System.powerGetBatteryTemp() - Get battery temperature
System.powerGetBatteryVolt() - Get battery voltage
----------------
Controls Class
----------------
Controls.read() - Read Controls Buffer
Controls.readPeek() - Peek Controls Buffer
----------------
Controls Methods - Interfacing with PSP buttons
----------------
controls:select
controls:start
controls:up
controls:right
controls:down
controls:left
controls:l
controls:r
controls:triangle
controls:circle
controls:square
controls:home
controls:hold
controls:note
controls:analogX
controls:analogY
controls:buttons[/spoiler]
If you want, visit my website: http://rinnegatamante.it :D

User avatar
Joel16
Posts: 912
Joined: Wed Oct 12, 2011 8:47 pm

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Joel16 » Sat May 24, 2014 1:47 pm

Hey, this is a pretty cool project :) you should also add USB functions.
"Forever in darkness, a guardian devil."

User avatar
Omega2058
Developer
Posts: 246
Joined: Tue Sep 28, 2010 4:27 am
Contact:

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Omega2058 » Sat May 24, 2014 3:42 pm

This is a pretty interesting project. Keep it up mate :)

User avatar
Rinnegatamante
VIP
Posts: 841
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: [WIP] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Rinnegatamante » Wed May 28, 2014 6:28 pm

We made quite progress:

dofile/loadfile functions are buggy (on PSVITA, i've not a PSP to test) so i'm working to build a prototype of a new function (System.protodofile) which works like loadbuffer/loadstring which are fully working (The difference between them and System.protodofile is only that my function will accept filename of LUA script).
Actually System.protodofile is instable (few times it crash PSPemu) and it has a limitation: every time it's called, LUA interpreter is restarted (so actually, it's impossible to load module with this function).

Added few functions in order to manage memory of PSP/PSVITA (Kernel.memcmp, Kernel.memset, Kernel.memcpy, Kernel.storeWord) and also new functions on System class (System.doesFileExist, System.isPSP, System.loadModule, System.unassign, System.assign, System.getModel, System.md5sum, System.sha1sum).

New functions list:
[spoiler]----------------
Kernel Class
----------------
Kernel.memcpy(u32 addr,u32 source,int size) - Copy block of memory
Kernel.memset(u32 addr,int value,int size) - Fill block of memory
Kernel.memcmp(u32 addr,u32 addr2,int size) - Compare block of memory
Kernel.storeWord(u32 addr,u32 val) - Store Word (Equivalent of _sw C function)
----------------
Screen Class
----------------
Screen.debugPrint(int x,int y,string text,u32 color) - Write a text with Debug font
Screen.waitVblankStart(int millisecond) - Wait Display Screen
Screen.clear() - Clear Debug Screen
----------------
System Class
----------------
System.protodofile(string filename) - Temporary dofile/loadmodule replacing - Load a new LUA script restarting interpreter
System.loadModule(string file) - Load and start a PRX module
System.assign(string dev1,string dev2,string dev3) - Assign Device
System.unassign(string dev) - Unassign Device
System.md5sum(string string) - Get crypted MD5 string
System.sha1sum(string string) - Get crypted SHA1 string
System.isPSP() - Check if user is on PSP (1 = PSP, 0 = PSVITA)
System.getModel() - Get PSP Model
System.getTime(int mode) - Get time (mode: 1= hours,2= minutes,3= seconds)
System.getDate(int mode) - Get date (mode: 1= days,2= months,3= years)
System.getFreeSize(string device) - Get free size of selected device
System.getTotalSize(string device) - Get total size of selected device
System.startPBP(string filename) - Start a PBP
System.getVersion() - Get firmware version
System.doesFileExist(string file) - Check if file exist
System.renameFile(string file1,string file2) - Rename a File
System.renameDir(string file1,string file2) - Rename a Directory
System.removeFile(string file1,string file2) - Remove a File
System.removeDir(string file1,string file2) - Remove a Directory
System.copyFile(string file1,string file2) - Copy a File
System.copyDir(string file1,string file2) - Copy a Directory
System.createDirectory(string path) - Create a Directory
System.resumeThread() - Resume paused main thread
System.powerIsPowerOnline() - Get Battery status
System.powerIsBatteryExist() - Check if battery exist
System.powerIsBatteryCharging() - Check if battery is in charging
System.powerGetBatteryChargingStatus() - Get charging status
System.powerIsLowBattery() - Check if battery charging status is low
System.powerGetBatteryLifePercent() - Get battery life percent
System.powerGetBatteryLifeTime() - Get battery life time
System.powerGetBatteryTemp() - Get battery temperature
System.powerGetBatteryVolt() - Get battery voltage
----------------
Controls Class
----------------
Controls.read() - Read Controls Buffer
Controls.readPeek() - Peek Controls Buffer
----------------
Controls Methods - Interfacing with PSP buttons
----------------
controls:select
controls:start
controls:up
controls:right
controls:down
controls:left
controls:l
controls:r
controls:triangle
controls:circle
controls:square
controls:home
controls:hold
controls:note
controls:analogX
controls:analogY
controls:buttons[/spoiler]

Also, i added a check on number of scripts in lpp.prx folder. In order to improve compatibility between future plugins, if there are more then one script on lpp.prx folder, lpp.prx wil load a simple menu where user can select which one to load.

I planned to release a first official alpha when System.protodofile will be fully working.
If you want, visit my website: http://rinnegatamante.it :D

User avatar
Rinnegatamante
VIP
Posts: 841
Joined: Sat Mar 26, 2011 10:02 am
Contact:

Re: [WIP+RELEASE] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Rinnegatamante » Fri May 30, 2014 6:45 pm

Finally, i fixxed System.protodofile which now works very good!

I also added Color class in order to simplify print functions (Color.new, Color.getR, Color.getB, Color.getG) and i added System.debugPrintGradient.

As i promised, i release the first public beta of the project (R196 Beta).
Download: http://rinnegatamante.netsons.org/lpp.rar

New video:
If you want, visit my website: http://rinnegatamante.it :D

User avatar
Joel16
Posts: 912
Joined: Wed Oct 12, 2011 8:47 pm

Re: [WIP+RELEASE] lpp.prx - Create PSP/PSVITA plugins in LUA

Post by Joel16 » Fri May 30, 2014 11:09 pm

Hey Rinnegatamante, when I press R to launch the plugin, it gives me an error.

Code: Select all

Error: [string "?"]:3: bad argument number #1 to 'getn' (table expected, got nil)
I'm using a PSP Go, so I load the plugins from the internal storage. (ef0) Also I'm on fw 6.20, don't know if that'll make a difference.

Anyways I had a look, at your sample scripts. I improved your 'pspident' sample, with a few extra functions and making the code more user friendly(That is adding indentation and such). If you wanna use it, I uploaded it on here: https://www.mediafire.com/?qua6b2xk60bagir

Thanks for your work ;)
"Forever in darkness, a guardian devil."

Post Reply

Return to “Homebrews”