summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReiko Asakura2021-03-01 15:17:50 -0500
committerReiko Asakura2021-03-01 15:17:50 -0500
commitfcef299d0f3caa117233523a07dcaebcaefbb615 (patch)
tree42dd17506bc9c5b6a04be2aee60437aa3c9a251a
parentEnable linker dead stripping (diff)
downloadmusicpremium-fcef299d0f3caa117233523a07dcaebcaefbb615.tar.gz
Refactor control flowrelease/1.0.6
-rw-r--r--musicpremium.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/musicpremium.c b/musicpremium.c
index dd5088c..0675c2b 100644
--- a/musicpremium.c
+++ b/musicpremium.c
@@ -9,6 +9,7 @@
#include <kernel/modulemgr.h>
#include <kernel/constant.h>
#include <kernel/sysmem.h>
+#include <libdbg.h>
#include <sblacmgr.h>
#include <taihen.h>
@@ -59,43 +60,35 @@ static int get_addr(uint16_t **inject_addr, uint16_t **hook_addr) {
}
static int sceAudioOutOpenPort_hook(int portType, int len, int freq, int param) {
- int port;
-
if (portType == SCE_AUDIO_OUT_PORT_TYPE_BGM && sceSblACMgrIsPspEmu(SCE_KERNEL_PROCESS_ID_SELF)) {
tai_module_info_t minfo;
minfo.size = sizeof(minfo);
// redirect to voice port if not Adrenaline
if (GET_MODULE(SCE_KERNEL_PROCESS_ID_SELF, "AdrenalineUser", &minfo) < 0) {
- port = HOOK_NEXT(sceAudioOutOpenPort, SCE_AUDIO_OUT_PORT_TYPE_VOICE, len, freq, param);
- goto done;
+ portType = SCE_AUDIO_OUT_PORT_TYPE_VOICE;
}
}
- port = HOOK_NEXT(sceAudioOutOpenPort, portType, len, freq, param);
-
-done:
- return port;
+ return HOOK_NEXT(sceAudioOutOpenPort, portType, len, freq, param);
}
static int sceAppMgrAcquireBgmPort_impl_hook(void) {
- int ret;
+ int ret = HOOK_NEXT(sceAppMgrAcquireBgmPort_impl);
if (sceSblACMgrIsShell(SCE_KERNEL_PROCESS_ID_SELF)) {
- char tid[0x20];
+ char tid[0x10];
sceKernelGetProcessTitleId(SCE_KERNEL_PROCESS_ID_SELF, tid, sizeof(tid));
if (STREQ(tid, "VITASHELL") || STREQ(tid, "ELEVENMPV")) {
- ret = HOOK_NEXT(sceAppMgrAcquireBgmPort_impl);
- if (ret == 0) { sceAppMgrReleaseBgmPort(); }
+ if (ret == SCE_OK) {
+ sceAppMgrReleaseBgmPort();
+ }
ret = sceAppMgrAcquireBgmPortWithPriority(0x82);
- goto done;
+ SCE_DBG_LOG_INFO("BGM port acquired for music player %s", tid);
}
}
- ret = HOOK_NEXT(sceAppMgrAcquireBgmPort_impl);
-
-done:
return ret;
}