From 85a1b2af455157e38a40faa427909f950e9d41d2 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Mon, 29 Mar 2010 09:26:19 +0000 Subject: This should largely go unnoticed git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5251 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/TestSuite/ASM/source/Init.cpp | 80 ++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Source/TestSuite/ASM/source/Init.cpp (limited to 'Source/TestSuite/ASM/source/Init.cpp') diff --git a/Source/TestSuite/ASM/source/Init.cpp b/Source/TestSuite/ASM/source/Init.cpp new file mode 100644 index 0000000000..cd2ab852b1 --- /dev/null +++ b/Source/TestSuite/ASM/source/Init.cpp @@ -0,0 +1,80 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Init.h" + +static void *xfb = NULL; +static GXRModeObj *rmode = NULL; +void die(char *msg) { + if (f!=NULL) fclose(f); + printf(msg); + sleep(5); + fatUnmount("sd"); + __io_wiisd.shutdown(); + exit(0); +} + +void initialise_fat() { + __io_wiisd.startup(); + if (!fatInitDefault()) + die("Unable to initialise FAT subsystem, exiting.\n"); + fatMountSimple("sd", &__io_wiisd); + DIR_ITER *root = diropen("/"); + if (!root) + die("Cannot open root dir, exiting.\n"); + dirclose(root); + if (chdir("/")) + die("Could not change to root directory, exiting.\n"); +} + +void init_crap() { + VIDEO_Init(); + WPAD_Init(); + PAD_Init(); + + // Obtain the preferred video mode from the system + // This will correspond to the settings in the Wii menu + rmode = VIDEO_GetPreferredMode(NULL); + + // Allocate memory for the display in the uncached region + xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); + + // Initialise the console, required for printf + console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ); + + // Set up the video registers with the chosen mode + VIDEO_Configure(rmode); + + // Tell the video hardware where our display memory is + VIDEO_SetNextFramebuffer(xfb); + + // Make the display visible + VIDEO_SetBlack(FALSE); + + // Flush the video register changes to the hardware + VIDEO_Flush(); + + // Wait for Video setup to complete + VIDEO_WaitVSync(); + if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); +} + +void end() { + int columns = 0, rows = 0; + CON_GetMetrics(&columns, &rows); + printf("\x1b[%i;0H",rows); + printf("File written... press Home/Start to exit."); + while(1) { + WPAD_ScanPads(); PAD_ScanPads(); + if ((WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) || (PAD_ButtonsDown(0) & PAD_BUTTON_START)) + exit(0); + VIDEO_WaitVSync(); + } +} -- cgit v1.2.3