51 lines
1.1 KiB
C
Raw Normal View History

#include "godmode.h"
2017-06-09 01:45:00 +02:00
#include "power.h"
#include "timer.h"
2017-08-22 23:23:17 -03:00
#include "pxi.h"
#include "i2c.h"
#include "arm.h"
#include "shmem.h"
#include "hid.h"
static const HID_CalibrationData default_calib = {
.screen_x = 0,
.screen_y = 0,
.ts_raw = 0
// ^ wrong: in my console it's 0x780086
// but this is very much console dependent
// so it's better to go with a sane default
};
2017-10-26 20:27:02 -03:00
void main(int argc, char** argv, int entrypoint)
{
(void) argc;
(void) argv;
2017-11-26 03:15:20 +01:00
PXI_Reset();
// Don't even try to send any messages until the
// ARM11 says it's ready
PXI_Barrier(ARM11_READY_BARRIER);
// A pointer to the shared memory region is
// stored in the thread ID register in the ARM9
ARM_InitSHMEM();
// Hardcoding this isn't ideal but it's better than
// leaving the system without any state to work with
HID_SetCalibrationData(&default_calib, 1, 320, 240);
#ifdef SCRIPT_RUNNER
// Run the script runner
if (ScriptRunner(entrypoint) == GODMODE_EXIT_REBOOT)
#else
2017-07-26 21:39:30 +02:00
// Run the main program
if (GodMode(entrypoint) == GODMODE_EXIT_REBOOT)
#endif
Reboot();
PowerOff();
}