Merge pull request #29 from habbbe/master

Made define for payload paths (removes repeated parts of file paths t…
This commit is contained in:
Aurora 2016-04-16 18:39:22 +02:00
commit 2323528975

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)();
}
}