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:

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

Post by Rinnegatamante » Sat May 31, 2014 9:48 am

To get PSP Go support, you need to modify extralibs on sourcecode (due to my mistake :oops: ), on next release, i'll fix it.
Advertising
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 » Sat May 31, 2014 2:47 pm

Rinnegatamante wrote:To get PSP Go support, you need to modify extralibs on sourcecode (due to my mistake :oops: ), on next release, i'll fix it.
Oh, alright :)
Advertising
"Forever in darkness, a guardian devil."

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 » Sun Jun 01, 2014 11:39 am

New sourcecodes available on repository!

Fixxed PSP Go issues, now ef0 is correctly recognized.
Rewrote io Library (due to issues which can give like dofile issues) using sceIo library, new functions are:

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)

A textreader sample will be released on next public release of lpp.prx
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 » Sun Jun 01, 2014 5:08 pm

Hi, for the sake of everyone, please let svn die already and use git. I'm unable to download the source, apart from that, nice work :)

Edit: after downloading each file one by one, I couldn't compile it. There seems to be errors in the source. Do you check to see if it compiles before pushing it?
Here's the errors.

Code: Select all

In file included from luaSystem.c:58:
include/systemctrl.h:205: error: expected ')' before '*' token
include/systemctrl.h:246: error: expected '=', ',', ';', 'asm' or '__attribute__
' before 'sctrlHENSetStartModuleHandler'
luaSystem.c: In function 'lua_copyDir':
luaSystem.c:349: warning: passing argument 1 of 'sceIoCpdir' discards qualifiers
 from pointer target type
luaSystem.c:349: warning: passing argument 2 of 'sceIoCpdir' discards qualifiers
 from pointer target type
luaSystem.c: In function 'lua_moveDir':
luaSystem.c:359: warning: passing argument 1 of 'sceIoMvdir' discards qualifiers
 from pointer target type
luaSystem.c:359: warning: passing argument 2 of 'sceIoMvdir' discards qualifiers
 from pointer target type
luaSystem.c: In function 'lua_rename':
luaSystem.c:423: warning: passing argument 1 of 'sceIoMove' discards qualifiers
from pointer target type
luaSystem.c:423: warning: passing argument 2 of 'sceIoMove' discards qualifiers
from pointer target type
luaSystem.c: In function 'lua_memcpy':
luaSystem.c:751: warning: passing argument 2 of 'memcpy' makes pointer from inte
ger without a cast
make: *** [luaSystem.o] Error 1
"Forever in darkness, a guardian devil."

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 » Mon Jun 02, 2014 9:16 am

Try to add this to the systemctrl.h:

Code: Select all

typedef struct SceModule2
{
   struct SceModule   *next; // 0
   u16               attribute; // 4
   u8               version[2]; // 6
   char            modname[27]; // 8
   char            terminal; // 0x23
   char            mod_state;   // 0x24
    char            unk1;    // 0x25
   char            unk2[2]; // 0x26
   u32               unk3;   // 0x28
   SceUID            modid; // 0x2C
   u32               unk4; // 0x30
   SceUID            mem_id; // 0x34
   u32               mpid_text;   // 0x38
   u32               mpid_data; // 0x3C
   void *            ent_top; // 0x40
   unsigned int      ent_size; // 0x44
   void *            stub_top; // 0x48
   u32               stub_size; // 0x4C
   u32               entry_addr_; // 0x50
   u32               unk5[4]; // 0x54
   u32               entry_addr; // 0x64
   u32               gp_value; // 0x68
   u32               text_addr; // 0x6C
   u32               text_size; // 0x70
   u32               data_size;   // 0x74
   u32               bss_size; // 0x78
   u32               nsegment; // 0x7C
   u32               segmentaddr[4]; // 0x80
   u32               segmentsize[4]; // 0x90
} SceModule2; 
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 » Mon Jun 02, 2014 5:30 pm

Rinnegatamante wrote:Try to add this to the systemctrl.h:

Code: Select all

typedef struct SceModule2
{
   struct SceModule   *next; // 0
   u16               attribute; // 4
   u8               version[2]; // 6
   char            modname[27]; // 8
   char            terminal; // 0x23
   char            mod_state;   // 0x24
    char            unk1;    // 0x25
   char            unk2[2]; // 0x26
   u32               unk3;   // 0x28
   SceUID            modid; // 0x2C
   u32               unk4; // 0x30
   SceUID            mem_id; // 0x34
   u32               mpid_text;   // 0x38
   u32               mpid_data; // 0x3C
   void *            ent_top; // 0x40
   unsigned int      ent_size; // 0x44
   void *            stub_top; // 0x48
   u32               stub_size; // 0x4C
   u32               entry_addr_; // 0x50
   u32               unk5[4]; // 0x54
   u32               entry_addr; // 0x64
   u32               gp_value; // 0x68
   u32               text_addr; // 0x6C
   u32               text_size; // 0x70
   u32               data_size;   // 0x74
   u32               bss_size; // 0x78
   u32               nsegment; // 0x7C
   u32               segmentaddr[4]; // 0x80
   u32               segmentsize[4]; // 0x90
} SceModule2; 
It works now, thankyou.

Edit:
My psp go, gives me the same error but at a different string from last time.

Code: Select all

Error: [string "?"]:7: bad argument number #1 to 'getn' (table expected, got nil)
Edit 2: I think it's referring to this bit, I'm not sure.

Code: Select all

if (System.getModel == "N1000") then
scripts=System.listDirectory("ef0:/seplugins/script")
else
scripts=System.listDirectory("ms0:/seplugins/script")
end
tot=table.getn(scripts)
"Forever in darkness, a guardian devil."

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 » Mon Jun 02, 2014 6:13 pm

Try to compile with this extralibs.c and tell me if you get the same error:

http://rinnegatamante.netsons.org/extralibs.c

(I think problem is on System.getModel, if lpp.prx starts correctly, try to write a script just to get your psp model with System.getModel and tell me the result)
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 » Mon Jun 02, 2014 7:04 pm

Rinnegatamante wrote:Try to compile with this extralibs.c and tell me if you get the same error:

http://rinnegatamante.netsons.org/extralibs.c

(I think problem is on System.getModel, if lpp.prx starts correctly, try to write a script just to get your psp model with System.getModel and tell me the result)
Thanks It works now and it displays my psp go as a PS vita lol.

Code: Select all

if (System.isPSP() == 1) then
	model = "Model: " .. System.getModel()
else
	model = "Model: PS Vita"
end
I don't think that's a correct way to use that function.
Doesn't System.getModel(4) or System.getModel() == 4, mean its a PSP Go?
"Forever in darkness, a guardian devil."

User avatar
Casavult
Moderator
Posts: 2340
Joined: Wed Jun 08, 2011 4:22 pm
Location: UK and Middle East

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

Post by Casavult » Tue Jun 03, 2014 7:14 am

Interesting project you have here... ;)
• PS4 1K 2TB OFW • PS3 3K 1TB OFW • PS3 Slim (2103-B) 500GB 4.82 Rebug • PS3 Slim (2003-B) 250GB 4.84 Habib •
• PSV 1K 32GB 3.60 HENkaku • 3x PSP 2K (TA-085v1) 128GB 6.60 ME-2.3 • 1x PSP 2K (TA-085v2) 32GB 6.60 ME-2.3 •

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 » Tue Jun 03, 2014 12:52 pm

Strange, it seems that you have any homebrew/psx game on PSP/GAME (Actually, System.isPSP works in this way).

System.getModel() gets you the psp model (PSVITA is recognized by this function as a PSP FAT (1000) so isPSP is to avoid this thing.
Try to delete the isPSP check so use only this:

Code: Select all

model = "Model: " .. System.getModel()
and tell me the result. :D

P.S. getModel gets you directly the code of your model. Sourcecode:

Code: Select all

static int lua_getModel(lua_State *L)
{
    char stringa[256];
    int argc = lua_gettop(L);
    if (argc > 0)
    {
        return luaL_error(L, "System.getModel() takes no argument");
    }
    int model;
    model = ((kuKernelGetModel() + 1) * 1000);
    if (model == 4000){
    sprintf(stringa, "N1000");
    }else if(model == 10000){
	sprintf(stringa, "E1000");
	}else{
    sprintf(stringa, "%i", model);
    }
    lua_pushstring(L, stringa);
    return 1;
}

EDIT: In order to fix System.isPSP() try to edit function in luaSystem.c with this:

Code: Select all

static int lua_ispsp(lua_State *L)
{
    int argc = lua_gettop(L);
    if (argc != 0) return luaL_error(L, "wrong number of arguments");
	SceUID id = sceIoDopen("ms0:/PSP/GAME");
	SceIoDirent entry;
	memset(&entry, 0, sizeof(SceIoDirent)); 
	int found = 0;
	while (sceIoDread(id, &entry) > 0)
			{
				if ((strcmp(entry.d_name, ".") == 0) || (strcmp(entry.d_name, "..") == 0)){}else{			
				char subdir[256];
				strcpy(subdir,"ms0:/PSP/GAME/");
				strcat(subdir,entry.d_name);
				strcat(subdir,"/FBOOT.PBP");
				if(File_Exist(subdir)){
				found = 1;
					lua_pushnumber(L,0);
					break;			
				}				
				}
				
			}
	sceIoDclose(id);
if (found==0){
lua_pushnumber(L,1);
}		
	return 1;
}
If you want, visit my website: http://rinnegatamante.it :D

Post Reply

Return to “Homebrews”