mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2025-12-05 13:16:06 +01:00
39 lines
818 B
C++
39 lines
818 B
C++
#include "common.h"
|
|
#include <libtwl/rtos/rtosIrq.h>
|
|
#include <libtwl/ipc/ipcFifoSystem.h>
|
|
#include <libtwl/sound/sound.h>
|
|
#include "ipcChannels.h"
|
|
#include "picoLoader7.h"
|
|
#include "picoLoaderBootstrap.h"
|
|
|
|
typedef void (*pico_loader_7_func_t)(void);
|
|
|
|
static volatile bool sShouldStart = false;
|
|
|
|
static void ipcMessageHandler(u32 channel, u32 data, void* arg)
|
|
{
|
|
if (data == 1)
|
|
{
|
|
sShouldStart = true;
|
|
}
|
|
}
|
|
|
|
void pload_init()
|
|
{
|
|
ipc_setChannelHandler(IPC_CHANNEL_LOADER, ipcMessageHandler, nullptr);
|
|
}
|
|
|
|
bool pload_shouldStart()
|
|
{
|
|
return sShouldStart;
|
|
}
|
|
|
|
void pload_start()
|
|
{
|
|
snd_setMasterEnable(false);
|
|
rtos_disableIrqs();
|
|
REG_IME = 0;
|
|
auto header7 = (pload_header7_t*)0x06000000;
|
|
header7->dldiDriver = (void*)0x037F8000;
|
|
((pico_loader_7_func_t)header7->entryPoint)();
|
|
} |