Made define for payload paths (removes repeated parts of file paths to payloads)

This commit is contained in:
habbbe 2016-04-16 18:21:42 +02:00
parent 034c0f8d7c
commit 22b38a0f88

View File

@ -4,6 +4,9 @@
#define PAYLOAD_ADDRESS 0x23F00000
#define BASE_PATH "/aurei/payloads/"
#define PAYLOAD_PATH(x) BASE_PATH x ".bin"
static u32 loadPayload(const char *path)
{
FIL payload;
@ -29,14 +32,14 @@ void main(void)
//Get pressed buttons
u32 pressed = HID_PAD;
if(((pressed & BUTTON_RIGHT) && loadPayload("/aurei/payloads/right.bin")) ||
((pressed & BUTTON_LEFT) && loadPayload("/aurei/payloads/left.bin")) ||
((pressed & BUTTON_UP) && loadPayload("/aurei/payloads/up.bin")) ||
((pressed & BUTTON_DOWN) && loadPayload("/aurei/payloads/down.bin")) ||
((pressed & BUTTON_X) && loadPayload("/aurei/payloads/x.bin")) ||
((pressed & BUTTON_Y) && loadPayload("/aurei/payloads/y.bin")) ||
((pressed & BUTTON_SELECT) && loadPayload("/aurei/payloads/select.bin")) ||
((pressed & BUTTON_R1) && loadPayload("/aurei/payloads/r.bin")) ||
loadPayload("/aurei/payloads/default.bin"))
if(((pressed & BUTTON_RIGHT) && loadPayload(PAYLOAD_PATH("right"))) ||
((pressed & BUTTON_LEFT) && loadPayload(PAYLOAD_PATH("left"))) ||
((pressed & BUTTON_UP) && loadPayload(PAYLOAD_PATH("up"))) ||
((pressed & BUTTON_DOWN) && loadPayload(PAYLOAD_PATH("down"))) ||
((pressed & BUTTON_X) && loadPayload(PAYLOAD_PATH("x"))) ||
((pressed & BUTTON_Y) && loadPayload(PAYLOAD_PATH("y"))) ||
((pressed & BUTTON_SELECT) && loadPayload(PAYLOAD_PATH("select"))) ||
((pressed & BUTTON_R1) && loadPayload(PAYLOAD_PATH("r"))) ||
loadPayload(PAYLOAD_PATH("default")))
((void (*)())PAYLOAD_ADDRESS)();
}
}