better wii init source organization, add video init for console display
This commit is contained in:
parent
605f5635e1
commit
5e6dd84736
54
src/dol_init.c
Normal file
54
src/dol_init.c
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#ifdef GEKKO
|
||||||
|
|
||||||
|
#include "dol_init.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <gccore.h>
|
||||||
|
#include <fat.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
static void *xfb = NULL;
|
||||||
|
static GXRModeObj *rmode = NULL;
|
||||||
|
|
||||||
|
void DOL_Init()
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_GDB
|
||||||
|
DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
|
||||||
|
_break();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VIDEO_Init();
|
||||||
|
rmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||||
|
|
||||||
|
console_init(xfb, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
|
||||||
|
|
||||||
|
VIDEO_Configure(rmode);
|
||||||
|
VIDEO_SetNextFramebuffer(xfb);
|
||||||
|
VIDEO_SetBlack(FALSE);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
if(rmode->viTVMode & VI_NON_INTERLACE)
|
||||||
|
{
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// helps ensure TV overscan won't cut off initial console output
|
||||||
|
printf("\x1b[2;0H");
|
||||||
|
|
||||||
|
printf("DOL_Init: Console video init finished.\n");
|
||||||
|
|
||||||
|
if (!fatInitDefault())
|
||||||
|
{
|
||||||
|
printf("DOL_Init: *** FATAL: fatInitDefault failed.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("DOL_Init: fatInitDefault success.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
11
src/dol_init.h
Normal file
11
src/dol_init.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef __DOL_INIT__
|
||||||
|
#define __DOL_INIT__
|
||||||
|
|
||||||
|
#ifdef GEKKO
|
||||||
|
|
||||||
|
void DOL_Init();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
17
src/i_main.c
17
src/i_main.c
|
@ -27,9 +27,7 @@
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
#include <gccore.h>
|
#include "dol_init.h"
|
||||||
#include <fat.h>
|
|
||||||
#include <debug.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -42,20 +40,15 @@ void D_DoomMain (void);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef GEKKO
|
|
||||||
#ifdef DEBUG_GDB
|
|
||||||
DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
|
|
||||||
_break();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fatInitDefault();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// save arguments
|
// save arguments
|
||||||
|
|
||||||
myargc = argc;
|
myargc = argc;
|
||||||
myargv = argv;
|
myargv = argv;
|
||||||
|
|
||||||
|
#ifdef GEKKO
|
||||||
|
DOL_Init();
|
||||||
|
#endif
|
||||||
|
|
||||||
M_FindResponseFile();
|
M_FindResponseFile();
|
||||||
|
|
||||||
// start doom
|
// start doom
|
||||||
|
|
Reference in a new issue