Skip to content

Commit

Permalink
Add SD2VITA support
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYoti committed Jan 12, 2023
1 parent c008daa commit 834b2c1
Show file tree
Hide file tree
Showing 4 changed files with 12,665 additions and 6,110 deletions.
125 changes: 101 additions & 24 deletions payload/bootstrap.diff
@@ -1,8 +1,10 @@
https://github.com/RealYoti/h-encore
https://github.com/RealYoti/gamecard-microsd
diff --git a/bootstrap/bootstrap.c b/bootstrap/bootstrap.c
index eb62117..b5c789b 100644
index eb62117..430f3db 100644
--- a/bootstrap/bootstrap.c
+++ b/bootstrap/bootstrap.c
@@ -10,11 +10,11 @@
@@ -10,14 +10,15 @@
#include "pspdebug.h"

#define WHITE 0xFFFFFFFF
Expand All @@ -16,43 +18,117 @@ index eb62117..b5c789b 100644

#define INCLUDE_EXTERN_RESOURCE(name) extern unsigned char _binary_res_##name##_start; extern unsigned char _binary_res_##name##_size; \

@@ -47,7 +47,7 @@ enum Items {
+INCLUDE_EXTERN_RESOURCE(gamesd_skprx);
INCLUDE_EXTERN_RESOURCE(taihen_skprx);
INCLUDE_EXTERN_RESOURCE(henkaku_skprx);
INCLUDE_EXTERN_RESOURCE(henkaku_suprx);
@@ -43,11 +44,25 @@ const char taihen_config[] =
"# this is for modifying the version string in settings widget\n"
"ur0:tai/henkaku.suprx\n";

+const char taihen_config_gamesd[] =
+ "*KERNEL\n"
+ "# henkaku.skprx is hard-coded to load and is not listed here\n"
+ "ur0:tai/gamesd.skprx\n"
+ "*main\n"
+ "# main is a special titleid for SceShell\n"
+ "ur0:tai/henkaku.suprx\n"
+ "*NPXS10015\n"
+ "# this is for modifying the version string\n"
+ "ur0:tai/henkaku.suprx\n"
+ "*NPXS10016\n"
+ "# this is for modifying the version string in settings widget\n"
+ "ur0:tai/henkaku.suprx\n";
+
enum Items {
EXIT,
INSTALL_HENKAKU,
DOWNLOAD_VITASHELL,
- PERSONALIZE_SAVEDATA,
+//PERSONALIZE_SAVEDATA,
+ INSTALL_SD2VITA_PRX,
RESET_TAIHEN_CONFIG
};

@@ -55,7 +55,7 @@ const char *items[] = {
@@ -55,7 +70,7 @@ const char *items[] = {
"Exit",
"Install HENkaku",
"Download VitaShell",
- "Personalize savedata",
+//"Personalize savedata",
+ "Install SD2VITA as ux0",
"Reset taiHEN config.txt"
};

@@ -378,7 +378,7 @@ int reset_taihen_config() {

@@ -353,7 +368,7 @@ int install_henkaku() {
return 0;
}
-
+/*
int personalize_savedata(int syscall_id) {
int res;

-int write_taihen_config(const char *path, int recovery) {
+int write_taihen_config(const char *path, int recovery, int gamesd) {
int fd;
@@ -402,7 +402,7 @@ int personalize_savedata(int syscall_id) {

// write default config
@@ -363,42 +378,36 @@ int write_taihen_config(const char *path, int recovery) {
sceIoWrite(fd, taihen_config_recovery_header, sizeof(taihen_config_recovery_header) - 1);
}
sceIoWrite(fd, taihen_config_header, sizeof(taihen_config_header) - 1);
- sceIoWrite(fd, taihen_config, sizeof(taihen_config) - 1);
+ if (gamesd) {
+ sceIoWrite(fd, taihen_config_gamesd, sizeof(taihen_config_gamesd) - 1);
+ } else {
+ sceIoWrite(fd, taihen_config, sizeof(taihen_config) - 1);
+ }
sceIoClose(fd);

return 0;
}

-int reset_taihen_config() {
- sceIoMkdir("ux0:tai", 6);
- sceIoMkdir("ur0:tai", 6);
-
- write_taihen_config("ux0:tai/config.txt", 0);
- write_taihen_config("ur0:tai/config.txt", 1);
-
- return 0;
-}
-
+*/
int enter_cross = 0;
uint32_t old_buttons = 0, current_buttons = 0, pressed_buttons = 0;
-int personalize_savedata(int syscall_id) {
+int install_gamesd() {
int res;
- int fd;
- uint64_t aid;

- res = call_syscall(sceKernelGetProcessId(), 0, 0, syscall_id + 4);
- if (res < 0 && res != 0x80800003)
- return res;
+ sceIoMkdir("ur0:tai", 6);

- res = sceRegMgrGetKeyBin("/CONFIG/NP", "account_id", &aid, sizeof(uint64_t));
+ write_taihen_config("ur0:tai/config.txt", 1, 1);
+
+ res = write_file("ur0:tai/gamesd.skprx", (void *)&_binary_res_gamesd_skprx_start, (int)&_binary_res_gamesd_skprx_size);
if (res < 0)
return res;

- fd = sceIoOpen("savedata0:sce_sys/param.sfo", SCE_O_RDWR, 0777);
- if (fd < 0)
- return fd;
+ return 0;
+}

- sceIoLseek(fd, 0xe4, SCE_SEEK_SET);
- sceIoWrite(fd, &aid, sizeof(uint64_t));
- sceIoClose(fd);
+int reset_taihen_config() {
+ sceIoMkdir("ux0:tai", 6);
+ sceIoMkdir("ur0:tai", 6);
+
+ write_taihen_config("ux0:tai/config.txt", 0, 0);
+ write_taihen_config("ur0:tai/config.txt", 1, 0);

@@ -450,17 +450,17 @@ int print_menu(int sel) {
return 0;
}
@@ -450,17 +459,17 @@ int print_menu(int sel) {
int i;

psvDebugScreenSetXY(0, 0);
Expand All @@ -74,7 +150,7 @@ index eb62117..b5c789b 100644
printf("----------------------------\n\n");

return 0;
@@ -518,7 +518,7 @@ int module_start(SceSize args, void *argp) {
@@ -518,7 +527,7 @@ int module_start(SceSize args, void *argp) {

if ((enter_cross && pressed_buttons & SCE_CTRL_CROSS) ||
(!enter_cross && pressed_buttons & SCE_CTRL_CIRCLE)) {
Expand All @@ -83,16 +159,17 @@ index eb62117..b5c789b 100644

if (sel == EXIT) {
printf(" > Exiting...\n");
@@ -532,10 +532,12 @@ int module_start(SceSize args, void *argp) {
@@ -532,10 +541,10 @@ int module_start(SceSize args, void *argp) {
printf(" > Downloading VitaShell...\n");
sceKernelDelayThread(500 * 1000);
res = download_vitashell();
+/*
} else if (sel == PERSONALIZE_SAVEDATA) {
printf(" > Personalizing savedata...\n");
- } else if (sel == PERSONALIZE_SAVEDATA) {
- printf(" > Personalizing savedata...\n");
+ } else if (sel == INSTALL_SD2VITA_PRX) {
+ printf(" > Installing SD2VITA...\n");
sceKernelDelayThread(500 * 1000);
res = personalize_savedata(syscall_id);
+*/
- res = personalize_savedata(syscall_id);
+ res = install_gamesd(syscall_id);
} else if (sel == RESET_TAIHEN_CONFIG) {
if (wait_confirm(" > Are you sure you want to reset taiHEN config.txt?\n")) {
printf(" > Resetting taiHEN config.txt...\n");

0 comments on commit 834b2c1

Please sign in to comment.