Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS4 Link support #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion src/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,44 @@ void profile_saveLocal() {
sceIoClose(fd);
}

void profile_savePS4Link() {
SceUID fd;
// Just in case the folder doesn't exist
sceIoMkdir("ux0:/data/remaPSV", 0777);
sprintf(fname, "ux0:/data/remaPSV/NPXS10013");
sceIoMkdir(fname, 0777);

// Opening remap config file and saving it
sprintf(fname, "ux0:/data/remaPSV/NPXS10013/remap.bin");
fd = sceIoOpen(fname, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
sceIoWrite(fd, profile_remap, PROFILE_REMAP_NUM);
sceIoClose(fd);

// Opening analog config file and saving the config
sprintf(fname, "ux0:/data/remaPSV/NPXS10013/analogs.bin");
fd = sceIoOpen(fname, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
sceIoWrite(fd, profile_analog, PROFILE_ANALOG_NUM);
sceIoClose(fd);

// Opening touch config file and saving the config
sprintf(fname, "ux0:/data/remaPSV/NPXS10013/touch.bin");
fd = sceIoOpen(fname, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
sceIoWrite(fd, profile_touch, PROFILE_TOUCH_NUM*2);
sceIoClose(fd);

// Opening gyro config file and saving the config
sprintf(fname, "ux0:/data/remaPSV/NPXS10013/gyro.bin");
fd = sceIoOpen(fname, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
sceIoWrite(fd, profile_gyro, PROFILE_GYRO_NUM);
sceIoClose(fd);

// Opening gyro config file and saving the config
sprintf(fname, "ux0:/data/remaPSV/NPXS10013/controllers.bin");
fd = sceIoOpen(fname, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777);
sceIoWrite(fd, profile_controller, PROFILE_CONTROLLER_NUM);
sceIoClose(fd);
}

void profile_loadGlobal() {
profile_resetRemap();
profile_resetAnalog();
Expand Down Expand Up @@ -272,4 +310,4 @@ void profile_loadLocal() {
sceIoRead(fd, profile_controller, PROFILE_CONTROLLER_NUM);
sceIoClose(fd);
}
}
}
3 changes: 2 additions & 1 deletion src/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ extern void profile_saveSettings();
extern void profile_loadSettings();
extern void profile_saveGlobal();
extern void profile_saveLocal();
extern void profile_savePS4Link();
extern void profile_loadGlobal();
extern void profile_loadLocal();

#endif
#endif
7 changes: 5 additions & 2 deletions src/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ static char* str_settings[] = {
"Save as Game profile",
"Load Game profile",
"Save as Global profile",
"Load Global profile"
"Load Global profile",
"Save as PS4 Link profile"
};

static char* str_funcs[HOOKS_NUM-1] = {
Expand Down Expand Up @@ -843,6 +844,8 @@ void ui_inputHandler(SceCtrlData *ctrl) {
profile_saveGlobal();
} else if (cfg_i == PROFILE_SETTINGS_NUM + 3) {
profile_loadGlobal();
} else if (cfg_i == PROFILE_SETTINGS_NUM + 4) {
profile_savePS4Link();
}
} else if (menu_i == GYRO_MENU) {
if (cfg_i == 10)
Expand Down Expand Up @@ -882,4 +885,4 @@ void ui_draw(const SceDisplayFrameBuf *pParam){
void ui_open(const SceDisplayFrameBuf *pParam){
ui_opened = 1;
cfg_i = 0;
}
}