summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReiko Asakura2021-03-01 12:00:28 -0500
committerReiko Asakura2021-03-01 12:00:28 -0500
commite6ab5c7c592fa56a003c47004480ff5f3535e620 (patch)
treedd2f1b2a15cee71ef68253ac5af13b8434da891f
parentFix compiler warnings (diff)
downloadmusicpremium-e6ab5c7c592fa56a003c47004480ff5f3535e620.tar.gz
Fix unsafe macro
RLZ double evaluates its argument.
-rw-r--r--musicpremium.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/musicpremium.c b/musicpremium.c
index e1178d1..dd5088c 100644
--- a/musicpremium.c
+++ b/musicpremium.c
@@ -20,10 +20,6 @@
if ((x) < 0) { goto fail; }\
} while (0)
-#define RLZ(x) do {\
- if ((x) < 0) { return (x); }\
-} while(0)
-
#define STREQ(s1, s2) (strncmp(s1, s2, sizeof(s1)) == 0)
SceUID bgm_port_priority_patch_id = -1;
@@ -38,13 +34,17 @@ static int (*sceAppMgrReleaseBgmPort)(void);
static int get_addr(uint16_t **inject_addr, uint16_t **hook_addr) {
// get sceAppMgrAcquireBgmPort addr
uint16_t *sceAppMgrAcquireBgmPort;
- RLZ(GET_EXPORT("SceAppMgr", 0x8AF17416, 0xAFCEAB96, (void *)&sceAppMgrAcquireBgmPort));
+ if (GET_EXPORT("SceAppMgr", 0x8AF17416, 0xAFCEAB96, (void *)&sceAppMgrAcquireBgmPort) < 0) {
+ return -1;
+ }
// clear Thumb bit
sceAppMgrAcquireBgmPort = (uint16_t *)((uintptr_t)sceAppMgrAcquireBgmPort & ~0x1);
// get sceAppMgrAcquireBgmPort impl func addr
- RLZ(get_addr_bl(sceAppMgrAcquireBgmPort + 1, hook_addr));
+ if (get_addr_bl(sceAppMgrAcquireBgmPort + 1, hook_addr) < 0) {
+ return -1;
+ }
// get inject addr
*inject_addr = *hook_addr + 0xE2/2;