Skip to content

Commit

Permalink
PSP Go cleanup stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
krazynez committed May 30, 2024
1 parent 3ed5dcb commit 8a57a7e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
12 changes: 7 additions & 5 deletions src/Makefile.signed
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
UNAME := $(shell uname)
release: all
ifeq ($(UNAME), Linux)
WINEPREFIX=$(shell pwd)/prefix wine bin/prxEncrypter $(TARGET).prx
WINEPREFIX=$(shell pwd)/prefix wine bin/prxEncrypter.exe $(TARGET).prx
else
bin\prxEncrypter $(TARGET).prx
bin\prxEncrypter.exe $(TARGET).prx
endif
pack-pbp $(EXTRA_TARGETS) PARAM.SFO icon0.png NULL NULL NULL NULL data.psp NULL
rm -f data.psp
rm -f downgrade_ctrl.h
rm -f downgrade660_ctrl.h
@mkdir -p PSP/GAME/ChronoSwitch
@cp EBOOT.PBP PSP/GAME/ChronoSwitch/

TARGET = downgrader
OBJS = main.o kernel_exploit.o kernel_land.o rebootex.o utils.o extras.o extra_stubs.o libasm/libinfinityUser.o
Expand All @@ -18,13 +20,13 @@ CFLAGS = -Os -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c

LIBDIR = ../lib
LIBS = -lpsppower
LIBDIR = lib
LIBS = -lpsppower -lpspkubridge

PSP_FW_VERSION = 271

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Chronoswitch Downgrader v7.3
PSP_EBOOT_TITLE = Chronoswitch Downgrader v7.4

BUILD_PRX = 1

Expand Down
5 changes: 3 additions & 2 deletions src/downgrade660_ctrl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@ int ApplyFirmware(SceModule2 *mod)
eboot_path[0] = 'm';
eboot_path[1] = 's';
status = sceIoGetstat(eboot_path, &stats);

}

/* set k1 */
u32 k1 = pspSdkSetK1(0);

/* lets open the file */
SceUID fd = sceIoOpen(eboot_path, PSP_O_RDONLY, 0777);
SceUID fd;

/* check for failure */
if (fd < 0)
if ((fd = sceIoOpen(eboot_path, PSP_O_RDONLY, 0777)) < 0)
{
/* rage */
pspSdkSetK1(k1);
Expand Down
4 changes: 2 additions & 2 deletions src/downgrade_ctrl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ int ApplyFirmware(void)
u32 k1 = pspSdkSetK1(0);

/* lets open the file */
SceUID fd = sceIoOpen(eboot_path, PSP_O_RDONLY, 0777);
SceUID fd;

/* check for failure */
if (fd < 0)
if ((fd = sceIoOpen(eboot_path, PSP_O_RDONLY, 0777)) < 0)
{
/* rage */
pspSdkSetK1(k1);
Expand Down
2 changes: 1 addition & 1 deletion src/include/common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef _COMMON_H_
#define _COMMON_H_
#endif
char eboot_path[] = "ef0:/PSP/GAME/UPDATE/EBOOT.PBP";
#endif
3 changes: 3 additions & 0 deletions src/kernel_exploit.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ int pre_kernel(int (* kfunc)(void))
/* find our functions */
if((g_devkit_version == FIRMWARE_VERSION_660) || (g_devkit_version == FIRMWARE_VERSION_661))
{
pspKernelGetModel = (void *)FindProc("sceSystemMemoryManager", "SysMemForKernel", 0x07C586A1); //6.60
pspKernelGetModel = (void *)FindProc("sceSystemMemoryManager", "SysMemForKernel", 0x07C586A1); //6.60
pspKernelLoadExecVSHEf1 = (void *)FindProc("sceLoadExec", "LoadExecForKernel", 0x16A68007); //6.60
pspKernelLoadExecVSHMs1 = (void *)FindProc("sceLoadExec", "LoadExecForKernel", 0x4FB44D27); //6.60
Expand All @@ -73,6 +74,8 @@ int pre_kernel(int (* kfunc)(void))
pspIoOpen = (void *)FindProc("sceIOFileManager", "IoFileMgrForKernel", 0x109F50BC);
pspIoWrite = (void *)FindProc("sceIOFileManager", "IoFileMgrForKernel", 0x42EC03AC);
pspIoClose = (void *)FindProc("sceIOFileManager", "IoFileMgrForKernel", 0x810C4BC3);
pspIoRead = (void *)FindProc("sceIOFileManager", "IoFileMgrForKernel", 0x6A638D83);
pspIoLseek32 = (void *)FindProc("sceIOFileManager", "IoFileMgrForKernel", 0x68963324);
}
else
{
Expand Down
8 changes: 7 additions & 1 deletion src/kernel_land.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SceUID (* pspIoOpen)(char *file, int flags, SceMode mode) = NULL;
int (* pspIoWrite)(SceUID fd, void *data, u32 len) = NULL;
int (* pspIoClose)(SceUID fd) = NULL;


/* globals */
struct SceKernelLoadExecVSHParam g_exec_param;

Expand Down Expand Up @@ -221,7 +222,12 @@ int patch_loadexec_pspgo(void)

/* clear the caches */
KClearCaches();

SceIoStat stats;
int status = sceIoGetstat(eboot_path, &stats);
if(status < 0) {
eboot_path[0] = 'm';
eboot_path[1] = 's';
}
if(strcasecmp(eboot_path, "ms0")>=0) {
return pspKernelLoadExecVSHMs1(eboot_path, &g_exec_param);
}
Expand Down
2 changes: 2 additions & 0 deletions src/kernel_land.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ extern int (* pspKernelLoadExecVSHMs1)(const char *path, struct SceKernelLoadExe
extern SceUID (* pspIoOpen)(char *file, int flags, SceMode mode);
extern int (* pspIoWrite)(SceUID fd, void *data, u32 len);
extern int (* pspIoClose)(SceUID fd);
extern int (* pspIoRead)(int fd, void* data, int size);
extern int (* pspIoLseek32)(int fd, int offset, int whence);

#endif /* __KERNEL_LAND_H__ */

0 comments on commit 8a57a7e

Please sign in to comment.