Skip to content

Commit

Permalink
Fixed compatibility with h-encore 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOfficialFloW committed Feb 23, 2019
1 parent 098fda5 commit f46d51f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ target_link_libraries(kernel
taihenForKernel_stub
taihenModuleUtils_stub
SceSysmemForDriver_stub
SceSysrootForDriver_stub
SceProcessmgrForDriver_stub
)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This plugin fakes your device as a PS TV and allows you to connect up to 4 DS3/D
Note that this plugin is still in beta stage and the known issues will be fixed when I find time.
**Only official DS3/DS4 controllers are currently supported!**

## Changelog beta 3
- Fixed compatibility with h-encore 2.0.

## Changelog beta 2
- Added support for L2/R2 buttons and rumble.

Expand Down
36 changes: 2 additions & 34 deletions kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ typedef struct {
SceUID ctrlext_eventid;
} ctrl_events_t;

int ksceKernelSysrootGetShellPid(void);
int module_get_export_func(SceUID pid, const char *modname, uint32_t libnid, uint32_t funcnid, uintptr_t *func);
int module_get_offset(SceUID pid, SceUID modid, int segidx, size_t offset, uintptr_t *addr);

Expand Down Expand Up @@ -82,39 +83,6 @@ static int patch_bt() {
return 0;
}

static SceUID get_shell_pid() {
SceUID shell_pid = -1;
int res;

int (* _sceAppMgrGetIdByName)(SceUID *pid, const char *name) = NULL;

tai_module_info_t tai_info;
tai_info.size = sizeof(tai_module_info_t);
res = taiGetModuleInfoForKernel(KERNEL_PID, "SceAppMgr", &tai_info);
if (res < 0)
return shell_pid;

switch (tai_info.module_nid) {
case 0xDBB29DB7: // 3.60 retail
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x32325, (uintptr_t *)&_sceAppMgrGetIdByName);
break;

case 0x1C9879D6: // 3.65 retail
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x3230D, (uintptr_t *)&_sceAppMgrGetIdByName);
break;

case 0x54E2E984: // 3.67 retail
case 0xC3C538DE: // 3.68 retail
module_get_offset(KERNEL_PID, tai_info.modid, 0, 0x3231D, (uintptr_t *)&_sceAppMgrGetIdByName);
break;
}

if (_sceAppMgrGetIdByName)
_sceAppMgrGetIdByName(&shell_pid, "NPXS19999");

return shell_pid;
}

static int patch_ctrl(SceUID shell_pid) {
int res;

Expand Down Expand Up @@ -201,7 +169,7 @@ int module_start(SceSize args, void *argp) {
if (res < 0)
return SCE_KERNEL_START_FAILED;

res = patch_ctrl(get_shell_pid());
res = patch_ctrl(ksceKernelSysrootGetShellPid());
if (res < 0)
return SCE_KERNEL_START_FAILED;

Expand Down

0 comments on commit f46d51f

Please sign in to comment.