-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 15fac48
Showing
34 changed files
with
5,802 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Here goes the new pspsloader for PRO CFW. | ||
|
||
popsloader has 4 functions: | ||
1. it can redirect the pops related modules on flash0 to ms0 | ||
2. it has a minimal NID resolver table to resolve the missing NID | ||
3. it can act as a generic popcorn. (Well, it's ideal) | ||
4. it can change configure on the bootstrap and be easy to use | ||
|
||
First prototype will port 6.3X Pops to FW 6.20, which has pretty bad pops support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
EXTRA_OPTIONS = -j4 | ||
|
||
ifeq ($(DEBUG), 1) | ||
EXTRA_OPTIONS += DEBUG=1 | ||
endif | ||
|
||
all: | ||
make $(EXTRA_OPTIONS) -C loader | ||
make $(EXTRA_OPTIONS) -C core | ||
@mkdir dist || true | ||
@cp -f loader/popsloader.prx dist | ||
@cp -f core/popscore.prx dist | ||
@cp -rf modules dist | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_400=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/400/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_500=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/500/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_501=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/501/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_503=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/503/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_550=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/550/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_551=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/551/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_600=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/600/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_610=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/610/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_620=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/620/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_635=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/635/ | ||
make $(EXTRA_OPTIONS) clean -C popcorn | ||
make $(EXTRA_OPTIONS) CONFIG_639=1 -C popcorn | ||
@cp -f popcorn/popcorn.prx dist/modules/639/ | ||
|
||
clean: | ||
make clean -C popcorn | ||
make clean -C loader | ||
make clean -C core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* This file is part of PRO CFW. | ||
* PRO CFW is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* PRO CFW is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ . | ||
*/ | ||
|
||
#include <pspkernel.h> | ||
#include <pspreg.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <pspsysmem_kernel.h> | ||
#include <pspthreadman_kernel.h> | ||
#include <pspctrl.h> | ||
#include <pspiofilemgr_kernel.h> | ||
#include <psprtc.h> | ||
#include "popsloader.h" | ||
#include "utils.h" | ||
#include "libs.h" | ||
#include "strsafe.h" | ||
#include "systemctrl.h" | ||
#include "main.h" | ||
|
||
struct popsloader_config g_conf; | ||
|
||
static inline int is_ef0(void) | ||
{ | ||
return psp_model == PSP_GO && sctrlKernelBootFrom() == 0x50 ? 1 : 0; | ||
} | ||
|
||
int save_config(void) | ||
{ | ||
SceUID fd; | ||
char path[256]; | ||
|
||
sprintf(path, "%s%s", is_ef0() ? "ef" : "ms", CFG_PATH); | ||
fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); | ||
|
||
if(fd < 0) { | ||
return fd; | ||
} | ||
|
||
sceIoWrite(fd, &g_conf, sizeof(g_conf)); | ||
sceIoClose(fd); | ||
|
||
return 0; | ||
} | ||
|
||
static int _load_config(void) | ||
{ | ||
SceUID fd; | ||
char path[256]; | ||
|
||
sprintf(path, "%s%s", is_ef0() ? "ef" : "ms", CFG_PATH); | ||
fd = sceIoOpen(path, PSP_O_RDONLY, 0777); | ||
|
||
if(fd < 0) { | ||
return fd; | ||
} | ||
|
||
sceIoRead(fd, &g_conf, sizeof(g_conf)); | ||
sceIoClose(fd); | ||
|
||
return 0; | ||
} | ||
|
||
int load_config(void) | ||
{ | ||
int ret; | ||
|
||
ret = _load_config(); | ||
|
||
if(ret < 0) { | ||
def_config(&g_conf); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
void def_config(struct popsloader_config *conf) | ||
{ | ||
conf->pops_fw_version = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* This file is part of PRO CFW. | ||
* PRO CFW is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* PRO CFW is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ . | ||
*/ | ||
|
||
/* | ||
* PSPLINK | ||
* ----------------------------------------------------------------------- | ||
* Licensed under the BSD license, see LICENSE in PSPLINK root for details. | ||
* | ||
* libs.c - Module library code for psplink. | ||
* | ||
* Copyright (c) 2005 James F <[email protected]> | ||
* | ||
* $HeadURL: svn://svn.pspdev.org/psp/trunk/psplinkusb/psplink/libs.c $ | ||
* $Id: libs.c 2301 2007-08-26 13:48:05Z tyranid $ | ||
*/ | ||
|
||
#include <pspkernel.h> | ||
#include <pspdebug.h> | ||
#include <pspsysmem_kernel.h> | ||
#include <psputilsforkernel.h> | ||
#include <pspmoduleexport.h> | ||
#include <psploadcore.h> | ||
#include <pspsdk.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "utils.h" | ||
#include "libs.h" | ||
#include "main.h" | ||
#include "systemctrl.h" | ||
|
||
PspModuleImport *find_import_lib(SceModule *pMod, char *library) | ||
{ | ||
PspModuleImport *pImp; | ||
void *stubTab; | ||
int stubLen; | ||
int i = 0; | ||
|
||
if(pMod == NULL) | ||
return NULL; | ||
|
||
stubTab = pMod->stub_top; | ||
stubLen = pMod->stub_size; | ||
while(i<stubLen) { | ||
pImp = (PspModuleImport*)(stubTab+i); | ||
if((pImp->name) && (strcmp(pImp->name, library) == 0)) | ||
return pImp; | ||
i += (pImp->entLen * 4); | ||
} | ||
|
||
return NULL; | ||
} | ||
|
||
|
||
unsigned int find_import_bynid(SceModule *pMod, char *library, unsigned int nid) | ||
{ | ||
PspModuleImport *pImp; | ||
int i; | ||
|
||
pImp = find_import_lib(pMod, library); | ||
if(pImp) { | ||
for(i=0; i<pImp->funcCount; i++) { | ||
if(pImp->fnids[i] == nid) | ||
return (unsigned int) &pImp->funcs[i*2]; | ||
} | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/** | ||
* Remember you have to export the hooker function if using syscall hook | ||
*/ | ||
int hook_import_bynid(SceModule *pMod, char *library, unsigned int nid, void *func, int syscall) | ||
{ | ||
PspModuleImport *pImp; | ||
void *stubTab; | ||
int stubLen; | ||
int i = 0; | ||
|
||
if(pMod == NULL) | ||
return -1; | ||
|
||
stubTab = pMod->stub_top; | ||
stubLen = pMod->stub_size; | ||
|
||
while(i<stubLen) { | ||
pImp = (PspModuleImport*)(stubTab+i); | ||
|
||
if((pImp->name) && (strcmp(pImp->name, library) == 0)) { | ||
int j; | ||
|
||
for(j=0; j<pImp->funcCount; j++) { | ||
if(pImp->fnids[j] == nid) { | ||
void *addr = (void*)(&pImp->funcs[j*2]); | ||
|
||
if(syscall) { | ||
u32 syscall_num; | ||
|
||
syscall_num = sctrlKernelQuerySystemCall(func); | ||
|
||
if(syscall_num == (u32)-1) { | ||
printk("%s: cannot find syscall in %s_%08X\n", __func__, library, nid); | ||
|
||
return -1; | ||
} | ||
|
||
_sw(0x03E00008, (u32)addr); | ||
_sw(MAKE_SYSCALL(syscall_num), (u32)(addr + 4)); | ||
} else { | ||
_sw(MAKE_JUMP(func), (u32)addr); | ||
_sw(NOP, (u32)(addr + 4)); | ||
} | ||
|
||
sceKernelDcacheWritebackInvalidateRange(addr, 8); | ||
sceKernelIcacheInvalidateRange(addr, 8); | ||
} | ||
} | ||
} | ||
|
||
i += (pImp->entLen * 4); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* This file is part of PRO CFW. | ||
* PRO CFW is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* PRO CFW is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PRO CFW. If not, see <http://www.gnu.org/licenses/ . | ||
*/ | ||
|
||
#ifndef LIBS_H | ||
#define LIBS_H | ||
|
||
typedef struct | ||
{ | ||
const char *name; | ||
unsigned short version; | ||
unsigned short attribute; | ||
unsigned char entLen; | ||
unsigned char varCount; | ||
unsigned short funcCount; | ||
unsigned int *fnids; | ||
unsigned int *funcs; | ||
unsigned int *vnids; | ||
unsigned int *vars; | ||
}PspModuleImport; | ||
|
||
PspModuleImport *find_import_lib(SceModule *pMod, char *library); | ||
|
||
unsigned int find_import_bynid(SceModule *pMod, char *library, unsigned int nid); | ||
|
||
void api_hook_addr(int addr, void *func); | ||
void api_hook_import(int addr, void *func); | ||
|
||
int hook_import_bynid(SceModule *pMod, char *library, unsigned int nid, void *func, int syscall); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef POPSLOADER_H | ||
#define POPSLOADER_H | ||
|
||
struct popsloader_config { | ||
u32 pops_fw_version; | ||
}; | ||
|
||
extern struct popsloader_config g_conf; | ||
|
||
int save_config(void); | ||
int load_config(void); | ||
void def_config(struct popsloader_config *conf); | ||
|
||
#define BASE_PATH "0:/seplugins/popsloader/" | ||
#define MODULE_PATH BASE_PATH "modules/" | ||
#define CFG_PATH BASE_PATH "pops.cfg" | ||
|
||
#endif |
Oops, something went wrong.