athena/Example/main.cpp

56 lines
995 B
C++
Raw Normal View History

#include <iostream>
#if GEKKO
#include <gccore.h>
#if HW_RVL
#include <wiiuse/wpad.h>
#endif
2018-12-08 05:18:17 +00:00
static void* xfb = nullptr;
static GXRModeObj* rmode = nullptr;
#endif
2016-03-04 23:00:12 +00:00
#include <athena/MemoryReader.hpp>
2018-12-08 05:18:17 +00:00
int main() {
#if GEKKO
2018-12-08 05:18:17 +00:00
VIDEO_Init();
#if HW_RVL
2018-12-08 05:18:17 +00:00
WPAD_Init();
#endif
2018-12-08 05:18:17 +00:00
PAD_Init();
2018-12-08 05:18:17 +00:00
rmode = VIDEO_GetPreferredMode(nullptr);
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
2018-12-08 05:18:17 +00:00
CON_Init(xfb, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
CON_EnableGecko(CARD_SLOTB, true);
2018-12-08 05:18:17 +00:00
VIDEO_Configure(rmode);
VIDEO_SetBlack(false);
2018-12-08 05:18:17 +00:00
VIDEO_Flush();
2018-12-08 05:18:17 +00:00
VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
2018-12-08 05:18:17 +00:00
athena::io::MemoryCopyReader test("sd:/test.dat");
while (true) {
#if HW_RVL
2018-12-08 05:18:17 +00:00
WPAD_ScanPads();
#endif
2018-12-08 05:18:17 +00:00
PAD_ScanPads();
if (PAD_ButtonsDown(0) & PAD_BUTTON_START)
break;
#if HW_RVL
2018-12-08 05:18:17 +00:00
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)
break;
#endif
2018-12-08 05:18:17 +00:00
VIDEO_WaitVSync();
}
#endif
2018-12-08 05:18:17 +00:00
return 0;
}