summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReiko Asakura2020-01-07 15:51:57 -0500
committerReiko Asakura2020-01-07 15:51:57 -0500
commit61b7c7737929d5d304b285768582c095ab33b473 (patch)
treef7d341d03c158ee953079c965c0944375f42d239
parentRestore game audio in pspemu (diff)
downloadmusicpremium-release/1.0.3.tar.gz
Improve Adrenaline detectionrelease/1.0.3
-rw-r--r--CMakeLists.txt1
-rw-r--r--musicpremium.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfc2980..f9a5bc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,6 @@ add_executable(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
SceSblACMgrForDriver_stub
- SceSysrootForKernel_stub
taihenForKernel_stub
taihenModuleUtils_stub
)
diff --git a/musicpremium.c b/musicpremium.c
index c097b6d..4d20d57 100644
--- a/musicpremium.c
+++ b/musicpremium.c
@@ -4,9 +4,7 @@
Music Premium
*/
-#include <string.h>
#include <psp2kern/kernel/modulemgr.h>
-#include <psp2kern/kernel/sysmem.h>
#include <taihen.h>
#define PROCESS_ID_SELF 0
@@ -31,6 +29,10 @@ extern int module_get_export_func(SceUID pid, const char *modname, uint32_t libn
#define GET_EXPORT(mod, lib, func, fptr)\
module_get_export_func(KERNEL_PID, mod, lib, func, (uintptr_t*)fptr)
+extern int module_get_by_name_nid(SceUID pid, const char *name, uint32_t nid, tai_module_info_t *info);
+#define GET_MODULE(pid, name, info)\
+ module_get_by_name_nid(pid, name, TAI_IGNORE_MODULE_NID, info)
+
#define HOOK_EXPORT(ref, mod, lib, func, hook)\
taiHookFunctionExportForKernel(KERNEL_PID, ref, mod, lib, func, hook)
@@ -90,11 +92,11 @@ static int sceAudioOutOpenPort_hook(int portType, int len, int freq, int param)
int port;
if (portType == PORT_TYPE_BGM && ksceSblACMgrIsPspEmu(PROCESS_ID_SELF)) {
- char tid[0x20];
- ksceKernelGetProcessTitleId(PROCESS_ID_SELF, tid, sizeof(tid));
+ tai_module_info_t minfo;
+ minfo.size = sizeof(minfo);
// redirect to voice port if not Adrenaline
- if (strncmp(tid, "PSPEMUCFW", sizeof(tid)) != 0) {
+ if (GET_MODULE(PROCESS_ID_SELF, "AdrenalineUser", &minfo) < 0) {
port = TAI_CONTINUE(int, hook_ref[0], PORT_TYPE_VOICE, len, freq, param);
goto done;
}