Skip to content

Commit

Permalink
Added PS1 multiplayer support for PS Vita
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Jul 24, 2018
1 parent 03c0d8a commit 8ca7da1
Show file tree
Hide file tree
Showing 9 changed files with 15,591 additions and 15,689 deletions.
2 changes: 1 addition & 1 deletion adrenaline_compat.h
Expand Up @@ -20,7 +20,7 @@
#define __ADRENALINE_COMPAT_H__

#define ADRENALINE_VERSION_MAJOR 6
#define ADRENALINE_VERSION_MINOR 6
#define ADRENALINE_VERSION_MINOR 7
#define ADRENALINE_VERSION ((ADRENALINE_VERSION_MAJOR << 16) | ADRENALINE_VERSION_MINOR)

#define xstr(s) #s
Expand Down
Binary file modified bubble/pkg/sce_module/adrenaline_user.suprx
Binary file not shown.
31,207 changes: 15,584 additions & 15,623 deletions cef/updater/adrenaline_user.h

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions cef/updater/main.c
Expand Up @@ -70,16 +70,14 @@ int main(void) {
ErrorExit(5000, "This update can only be applied with v6.4 or higher.\n");
}

if (sctrlSEGetVersion() >= 0x00060006) {
if (sctrlSEGetVersion() >= 0x00060007) {
ErrorExit(5000, "This update or a higher one was already applied.\n");
}

printf("6.61 Adrenaline-6.6 Installer\n");
printf("6.61 Adrenaline-6.7 Installer\n");
printf("Changes:\n\n");

printf("- Fixed bug from previous update that caused black screen in other DJ max games.\n");
printf("- Inferno driver was not included correcty, now it is.\n");
printf("- Tekken 6 can now be played with any CPU speed.\n");
printf("- Added support for PS1 multiplayer on PS Vita using an upcoming DS3/DS4 plugin.\n");
printf("\n");

printf("Press X to install, R to exit.\n\n");
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Expand Up @@ -42,6 +42,9 @@ For 6.61 Adrenaline-6.4 or higher, you can use the `System Update` in the XMB to
Changelog
---------

### Changelog v6.7
- Added support for PS1 multiplayer on PS Vita using an upcoming DS3/DS4 plugin.

### Changelog v6.6
- Fixed bug from previous update that caused black screen in other DJ max games.
- Inferno driver was not included correcty, now it is.
Expand Down
Binary file modified user/flash0/kd/systemctrl.prx
Binary file not shown.
41 changes: 0 additions & 41 deletions user/main.c
Expand Up @@ -81,7 +81,6 @@ tai_hook_ref_t sceIoOpenRef;
tai_hook_ref_t sceIoGetstatRef;
tai_hook_ref_t sceAudioOutOpenPortRef;
tai_hook_ref_t sceAudioOutOutputRef;
tai_hook_ref_t sceCtrlPeekBufferNegative2Ref;
tai_hook_ref_t sceDisplaySetFrameBufForCompatRef;

tai_hook_ref_t ScePspemuInitTitleSpecificInfoRef;
Expand Down Expand Up @@ -568,9 +567,6 @@ int module_start(SceSize args, void *argp) {
hooks[n_hooks++] = taiHookFunctionImport(&sceAudioOutOpenPortRef, "ScePspemu", 0x438BB957, 0x5BC341E4, sceAudioOutOpenPortPatched);
hooks[n_hooks++] = taiHookFunctionImport(&sceAudioOutOutputRef, "ScePspemu", 0x438BB957, 0x02DB3F5F, sceAudioOutOutputPatched);

// SceCtrl
hooks[n_hooks++] = taiHookFunctionImport(&sceCtrlPeekBufferNegative2Ref, "ScePspemu", 0xD197E3C7, 0x81A89660, sceCtrlPeekBufferNegative2Patched);

// SceDisplayUser
hooks[n_hooks++] = taiHookFunctionImport(&sceDisplaySetFrameBufForCompatRef, "ScePspemu", 0x4FAACD11, 0x8C36B628, sceDisplaySetFrameBufForCompatPatched);

Expand Down Expand Up @@ -687,24 +683,6 @@ int module_start(SceSize args, void *argp) {
isPopsPatched[3] = 0xBF004770; // bx lr
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x20384, isPopsPatched, sizeof(isPopsPatched));

if (!sceKernelIsPSVitaTV()) {
// Fake isVitaTV for pops ctrl
uint32_t bl_is_vita_tv_patched_opcode_1 = encode_bl(text_addr + 0x2F5BC, text_addr + 0x20394);
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x2F5BC, &bl_is_vita_tv_patched_opcode_1, sizeof(bl_is_vita_tv_patched_opcode_1));
uint32_t bl_is_vita_tv_patched_opcode_2 = encode_bl(text_addr + 0x2F74E, text_addr + 0x20394);
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x2F74E, &bl_is_vita_tv_patched_opcode_2, sizeof(bl_is_vita_tv_patched_opcode_2));

// Use available code memory at text_addr + 0x20394 (ScePspemuInitTitleSpecificInfo)
// For custom function: isVitaTVPatched
uint32_t isVitaTVPatched[4];
uint32_t use_ds3_ds4_offset = (uint32_t)&config.use_ds3_ds4;
isVitaTVPatched[0] = encode_movw(0, use_ds3_ds4_offset & 0xFFFF);
isVitaTVPatched[1] = encode_movt(0, use_ds3_ds4_offset >> 0x10);
isVitaTVPatched[2] = 0xBF006800; // ldr a1, [a1]
isVitaTVPatched[3] = 0xBF004770; // bx lr
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x20394, isVitaTVPatched, sizeof(isVitaTVPatched));
}

// Fake vita mode for ctrlEmulation
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x2073C, &movs_a1_0_nop_opcode, sizeof(movs_a1_0_nop_opcode));
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x2084E, &movs_a1_0_nop_opcode, sizeof(movs_a1_0_nop_opcode));
Expand Down Expand Up @@ -821,24 +799,6 @@ int module_start(SceSize args, void *argp) {
isPopsPatched[3] = 0xBF004770; // bx lr
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x20388, isPopsPatched, sizeof(isPopsPatched));

if (!sceKernelIsPSVitaTV()) {
// Fake isVitaTV for pops ctrl
uint32_t bl_is_vita_tv_patched_opcode_1 = encode_bl(text_addr + 0x2F5CC, text_addr + 0x20398);
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x2F5CC, &bl_is_vita_tv_patched_opcode_1, sizeof(bl_is_vita_tv_patched_opcode_1));
uint32_t bl_is_vita_tv_patched_opcode_2 = encode_bl(text_addr + 0x2F762, text_addr + 0x20398);
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x2F762, &bl_is_vita_tv_patched_opcode_2, sizeof(bl_is_vita_tv_patched_opcode_2));

// Use available code memory at text_addr + 0x20398 (ScePspemuInitTitleSpecificInfo)
// For custom function: isVitaTVPatched
uint32_t isVitaTVPatched[4];
uint32_t use_ds3_ds4_offset = (uint32_t)&config.use_ds3_ds4;
isVitaTVPatched[0] = encode_movw(0, use_ds3_ds4_offset & 0xFFFF);
isVitaTVPatched[1] = encode_movt(0, use_ds3_ds4_offset >> 0x10);
isVitaTVPatched[2] = 0xBF006800; // ldr a1, [a1]
isVitaTVPatched[3] = 0xBF004770; // bx lr
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x20398, isVitaTVPatched, sizeof(isVitaTVPatched));
}

// Fake vita mode for ctrlEmulation
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x20740, &movs_a1_0_nop_opcode, sizeof(movs_a1_0_nop_opcode));
uids[n_uids++] = taiInjectData(tai_info.modid, 0, 0x20852, &movs_a1_0_nop_opcode, sizeof(movs_a1_0_nop_opcode));
Expand All @@ -863,7 +823,6 @@ int module_stop(SceSize args, void *argp) {
taiHookRelease(hooks[--n_hooks], ScePspemuInitTitleSpecificInfoRef);

taiHookRelease(hooks[--n_hooks], sceDisplaySetFrameBufForCompatRef);
taiHookRelease(hooks[--n_hooks], sceCtrlPeekBufferNegative2Ref);
taiHookRelease(hooks[--n_hooks], sceAudioOutOutputRef);
taiHookRelease(hooks[--n_hooks], sceAudioOutOpenPortRef);
taiHookRelease(hooks[--n_hooks], sceIoGetstatRef);
Expand Down
1 change: 0 additions & 1 deletion user/main.h
Expand Up @@ -108,7 +108,6 @@ extern tai_hook_ref_t sceIoOpenRef;
extern tai_hook_ref_t sceIoGetstatRef;
extern tai_hook_ref_t sceAudioOutOpenPortRef;
extern tai_hook_ref_t sceAudioOutOutputRef;
extern tai_hook_ref_t sceCtrlPeekBufferNegative2Ref;
extern tai_hook_ref_t sceDisplaySetFrameBufForCompatRef;

extern tai_hook_ref_t ScePspemuInitTitleSpecificInfoRef;
Expand Down
18 changes: 0 additions & 18 deletions user/pops.c
Expand Up @@ -100,24 +100,6 @@ int ScePspemuDecodePopsAudioPatched(int a1, int a2, int a3, int a4) {
return TAI_CONTINUE(int, ScePspemuDecodePopsAudioRef, a1, a2, a3, a4);
}

int sceCtrlPeekBufferNegative2Patched(int port, SceCtrlData *pad_data, int count) {
int res = TAI_CONTINUE(int, sceCtrlPeekBufferNegative2Ref, port, pad_data, count);

if (res == 0x80340001) {
if (!sceKernelIsPSVitaTV()) {
if (config.use_ds3_ds4 && port == 1) {
return TAI_CONTINUE(int, sceCtrlPeekBufferNegative2Ref, 0, pad_data, count);
} else {
uint8_t *val = (uint8_t *)ScePspemuConvertAddress(0xABCD00A7, KERMIT_OUTPUT_MODE, 1);
*val = 0;
ScePspemuWritebackCache(val, 1);
}
}
}

return res;
}

char *ScePspemuGetTitleidPatched() {
SceAdrenaline *adrenaline = (SceAdrenaline *)ScePspemuConvertAddress(ADRENALINE_ADDRESS, KERMIT_INPUT_MODE, ADRENALINE_SIZE);
return adrenaline->titleid;
Expand Down

0 comments on commit 8ca7da1

Please sign in to comment.