From 8d25777582aa2e0a012497f966dfa288b20d672d Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 5 May 2009 06:15:02 +0000 Subject: [PATCH] force more predictable video mode, use standard libfat init --- src/gui/sdlmain.cpp | 10 ++- src/platform/wii/wiihardware.cpp | 118 +------------------------------ 2 files changed, 10 insertions(+), 118 deletions(-) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index dacfa89..5153f5f 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -1055,6 +1055,8 @@ static void GUI_StartUp(Section * sec) { if (!sdl.desktop.full.width) { #ifdef WIN32 sdl.desktop.full.width=(Bit16u)GetSystemMetrics(SM_CXSCREEN); +#elif defined(HW_RVL) + sdl.desktop.full.width=640; #else sdl.desktop.full.width=1024; #endif @@ -1062,6 +1064,8 @@ static void GUI_StartUp(Section * sec) { if (!sdl.desktop.full.height) { #ifdef WIN32 sdl.desktop.full.height=(Bit16u)GetSystemMetrics(SM_CYSCREEN); +#elif defined(HW_RVL) + sdl.desktop.full.height=480; #else sdl.desktop.full.height=768; #endif @@ -1130,7 +1134,11 @@ static void GUI_StartUp(Section * sec) { #endif //OPENGL /* Initialize screen for first time */ + #ifdef HW_RVL + sdl.surface=SDL_SetVideoMode(640,480,16,0); + #else sdl.surface=SDL_SetVideoMode(640,400,0,0); + #endif if (sdl.surface == NULL) E_Exit("Could not initialize video: %s",SDL_GetError()); sdl.desktop.bpp=sdl.surface->format->BitsPerPixel; if (sdl.desktop.bpp==24) { @@ -1639,7 +1647,7 @@ int main(int argc, char* argv[]) { if (control->cmdline->FindExist("-startmapper")) MAPPER_Run(false); #ifdef HW_RVL MountDOSBoxDir('C', "sd:/DOSBox"); -#endif +#endif /* Start up main machine */ control->StartUp(); /* Shutdown everything */ diff --git a/src/platform/wii/wiihardware.cpp b/src/platform/wii/wiihardware.cpp index 16ca57d..a54cc1e 100644 --- a/src/platform/wii/wiihardware.cpp +++ b/src/platform/wii/wiihardware.cpp @@ -7,126 +7,11 @@ #include #include #include -#include -#include -#include #include #include "wiihardware.h" -char rootdir[10]; - -enum { - METHOD_AUTO, - METHOD_SD, - METHOD_USB, - METHOD_DVD, - METHOD_SMB, - METHOD_MC_SLOTA, - METHOD_MC_SLOTB, - METHOD_SD_SLOTA, - METHOD_SD_SLOTB -}; - -bool unmountRequired[9] = { false, false, false, false, false, false, false, false, false }; -bool isMounted[9] = { false, false, false, false, false, false, false, false, false }; - -#ifdef HW_RVL - const DISC_INTERFACE* sd = &__io_wiisd; - const DISC_INTERFACE* usb = &__io_usbstorage; -#else - const DISC_INTERFACE* carda = &__io_gcsda; - const DISC_INTERFACE* cardb = &__io_gcsdb; -#endif - -/**************************************************************************** - * UnmountAllFAT - * Unmounts all FAT devices - ***************************************************************************/ -void UnmountAllFAT() -{ -#ifdef HW_RVL - fatUnmount("sd:/"); - fatUnmount("usb:/"); -#else - fatUnmount("carda:/"); - fatUnmount("cardb:/"); -#endif -} - -/**************************************************************************** - * MountFAT - * Checks if the device needs to be (re)mounted - * If so, unmounts the device - * Attempts to mount the device specified - * Sets libfat to use the device by default - ***************************************************************************/ - -bool MountFAT(int method) -{ - bool mounted = true; // assume our disc is already mounted - char name[10]; - const DISC_INTERFACE* disc = NULL; - - switch(method) - { -#ifdef HW_RVL - case METHOD_SD: - sprintf(name, "sd"); - disc = sd; - break; - case METHOD_USB: - sprintf(name, "usb"); - disc = usb; - break; -#else - case METHOD_SD_SLOTA: - sprintf(name, "carda"); - disc = carda; - break; - - case METHOD_SD_SLOTB: - sprintf(name, "cardb"); - disc = cardb; - break; -#endif - default: - return false; // unknown device - } - - sprintf(rootdir, "%s:/", name); - - if(unmountRequired[method]) - { - unmountRequired[method] = false; - fatUnmount(rootdir); - disc->shutdown(); - isMounted[method] = false; - } - if(!isMounted[method]) - { - if(!disc->startup()) - mounted = false; - else if(!fatMountSimple(name, disc)) - mounted = false; - } - - isMounted[method] = mounted; - return mounted; -} - -void MountAllFAT() -{ -#ifdef HW_RVL - MountFAT(METHOD_SD); - MountFAT(METHOD_USB); -#else - MountFAT(METHOD_SD_SLOTA); - MountFAT(METHOD_SD_SLOTB); -#endif -} - void WiiInit() { - MountAllFAT(); + fatInitDefault(); } bool WiiMessagePause(const char *s) { @@ -144,7 +29,6 @@ bool WiiMessagePause(const char *s) { } void WiiFinished() { - UnmountAllFAT(); #ifdef HW_RVL if (WiiMessagePause("Press A to return to homebrew channel.\n")) exit(0); #endif