This repository has been archived on 2022-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Luma3DS-3GX/loader/source/main.c

41 lines
1.2 KiB
C
Raw Normal View History

#include "types.h"
#include "buttons.h"
#include "fatfs/ff.h"
#define PAYLOAD_ADDRESS 0x23F00000
static u32 loadPayload(const char *path)
{
FIL payload;
unsigned int br;
if(f_open(&payload, path, FA_READ) == FR_OK)
{
2016-03-24 16:02:00 +01:00
f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &br);
f_close(&payload);
return 1;
}
return 0;
}
void main(void)
{
FATFS fs;
f_mount(&fs, "0:", 1);
//Get pressed buttons
2016-04-02 22:02:08 +02:00
u32 pressed = HID_PAD;
if(((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_START) && loadPayload("/aurei/payloads/start.bin")) ||
((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")) ||
loadPayload("/aurei/payloads/default.bin"))
((void (*)())PAYLOAD_ADDRESS)();
}