Initial commit

This commit is contained in:
Gericom
2025-11-09 16:07:01 +01:00
commit 29671d041f
39 changed files with 26346 additions and 0 deletions

2
arm7/source/common.h Normal file
View File

@@ -0,0 +1,2 @@
#pragma once
#include <nds/ndstypes.h>

44
arm7/source/main.cpp Normal file
View File

@@ -0,0 +1,44 @@
#include "common.h"
#include <libtwl/rtos/rtosIrq.h>
#include <libtwl/rtos/rtosThread.h>
#include <libtwl/rtos/rtosEvent.h>
#include <libtwl/ipc/ipcSync.h>
#include <libtwl/ipc/ipcFifoSystem.h>
#include <libtwl/gfx/gfxStatus.h>
#include "picoLoaderBootstrap.h"
static rtos_event_t sVBlankEvent;
static void vblankIrq(u32 irqMask)
{
rtos_signalEvent(&sVBlankEvent);
}
int main()
{
rtos_initIrq();
rtos_startMainThread();
ipc_initFifoSystem();
pload_init();
rtos_createEvent(&sVBlankEvent);
rtos_setIrqFunc(RTOS_IRQ_VBLANK, vblankIrq);
rtos_enableIrqMask(RTOS_IRQ_VBLANK);
gfx_setVBlankIrqEnabled(true);
ipc_setArm7SyncBits(7);
while (true)
{
rtos_waitEvent(&sVBlankEvent, true, true);
if (pload_shouldStart())
{
pload_start();
}
}
return 0;
}

View File

@@ -0,0 +1,39 @@
#include "common.h"
#include <string.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;
((pico_loader_7_func_t)header7->entryPoint)();
}

View File

@@ -0,0 +1,5 @@
#pragma once
void pload_init();
bool pload_shouldStart();
void pload_start();