2016-02-25 16:57:01 +01:00
|
|
|
#include "godmode.h"
|
2017-06-09 01:45:00 +02:00
|
|
|
#include "power.h"
|
2017-08-22 23:23:17 -03:00
|
|
|
#include "pxi.h"
|
2016-02-13 17:29:56 +01:00
|
|
|
|
2019-04-17 11:58:54 -03:00
|
|
|
#include "arm.h"
|
2019-04-18 16:39:45 -03:00
|
|
|
#include "shmem.h"
|
2019-04-08 17:38:38 -03:00
|
|
|
|
2019-04-19 12:15:43 -03:00
|
|
|
#include "hid.h"
|
|
|
|
|
2020-08-25 10:49:52 -03:00
|
|
|
SystemSHMEM *shmemBasePtr;
|
2019-04-19 12:15:43 -03:00
|
|
|
|
2017-10-26 20:27:02 -03:00
|
|
|
void main(int argc, char** argv, int entrypoint)
|
2016-02-13 17:29:56 +01:00
|
|
|
{
|
2017-10-27 19:25:26 +02:00
|
|
|
(void) argc;
|
|
|
|
(void) argv;
|
2017-08-08 09:40:09 -03:00
|
|
|
|
2017-11-26 03:15:20 +01:00
|
|
|
PXI_Reset();
|
2017-09-26 19:56:19 -03:00
|
|
|
|
2019-04-11 18:16:20 -03:00
|
|
|
// Don't even try to send any messages until the
|
|
|
|
// ARM11 says it's ready
|
2020-08-19 23:11:45 -03:00
|
|
|
PXI_Barrier(PXI_BOOT_BARRIER);
|
2019-04-11 18:16:20 -03:00
|
|
|
|
2019-04-17 11:58:54 -03:00
|
|
|
// A pointer to the shared memory region is
|
|
|
|
// stored in the thread ID register in the ARM9
|
2019-04-18 16:39:45 -03:00
|
|
|
ARM_InitSHMEM();
|
2017-09-26 19:56:19 -03:00
|
|
|
|
2017-12-07 02:01:15 +01:00
|
|
|
#ifdef SCRIPT_RUNNER
|
2017-09-08 15:39:06 +02:00
|
|
|
// Run the script runner
|
2017-10-27 19:25:26 +02:00
|
|
|
if (ScriptRunner(entrypoint) == GODMODE_EXIT_REBOOT)
|
2017-09-08 15:39:06 +02:00
|
|
|
#else
|
2017-07-26 21:39:30 +02:00
|
|
|
// Run the main program
|
2017-10-27 19:25:26 +02:00
|
|
|
if (GodMode(entrypoint) == GODMODE_EXIT_REBOOT)
|
2017-09-08 15:39:06 +02:00
|
|
|
#endif
|
2017-09-26 19:56:19 -03:00
|
|
|
Reboot();
|
|
|
|
|
|
|
|
PowerOff();
|
2016-02-13 17:29:56 +01:00
|
|
|
}
|