Esempio n. 1
0
void reset_cb(void) {
#ifdef DEBUG_WII_GDB
	printf("attach gdb now\n");
	_break();
#else
	reset_btn_pressed = true;
#endif
}
Esempio n. 2
0
/**
  Generates a breakpoint on the CPU.

  Generates a breakpoint on the CPU. The breakpoint must be implemented such
  that code can resume normal execution after the breakpoint.

**/
VOID
EFIAPI
CpuBreakpoint (
  VOID
  )
{
  _break (3);
}
Esempio n. 3
0
static void show_console(int code) {
	u32 i, b;

	printf("ScummVM exited abnormally (%d).\n", code);

	gfx_frame_abort();
	gfx_init();

	if (!gfx_frame_start())
		return;

	gfx_con_draw();
	gfx_frame_end();

	for (i = 0; i < 60 * 3; ++i)
		VIDEO_WaitVSync();

#ifdef DEBUG_WII_GDB
	printf("attach gdb now\n");
	_break();
#endif

	printf("Press any key to continue.\n");

	if (!gfx_frame_start())
		return;

	gfx_con_draw();
	gfx_frame_end();
	VIDEO_WaitVSync();

	while (true) {
		b = 0;

		if (PAD_ScanPads() & 1)
			b = PAD_ButtonsDown(0);

#ifndef GAMECUBE
		WPAD_ScanPads();
		if (WPAD_Probe(0, NULL) == WPAD_ERR_NONE)
			b |= WPAD_ButtonsDown(0);
#endif

		if (b)
			break;

		VIDEO_WaitVSync();
	}

	printf("\n\nExiting...\n");

	if (!gfx_frame_start())
		return;

	gfx_con_draw();
	gfx_frame_end();
	VIDEO_WaitVSync();
}
Esempio n. 4
0
//---------------------------------------------------------------------------------
// main!
//---------------------------------------------------------------------------------
int main(int argc, char **argv) 
{
#ifdef PLATFORM_IS_WII
	try
	{
		// Setup the remote debugger if possible...
		DEBUG_Init(GDBSTUB_DEVICE_USB, 1);

		// Initialize filesystem to load from SD Card - This should change to NAND for official releases ...
		fatInitDefault();

		for(int i = 0; i < 100; i++)
		{
			usleep(100);
		}	

		//setupTrace("//Map.csv");
		
		srand ( time(NULL) );

		AUDIO_Init(NULL);
        ASND_Init();
        ASND_Pause(0);

		//setupUnitTesting();
		
		RunGameMain();
		
		ASND_Pause(1);
        ASND_End();

		//MemTrack::TrackListMemoryUsage();

		//shutDownTrace();

	}
	catch(int ex)
	{
		printf("\x1b[2;0H");printf("Exception Triggered, Executing Breakpoint!\n");
		ASSERT(false);

		_break();
	}
#endif

#ifdef PLATFORM_IS_WIN
	runUnitTests();
#endif

	return 0;
}
Esempio n. 5
0
int main(int argc, char *argv[]) 
{
	/* INITIALIZE */
#ifdef HW_RVL
	DI_UseCache(false);
	if (!__di_check_ahbprot()) {
		s32 preferred = IOS_GetPreferredVersion();
		if (preferred == 58 || preferred == 61)
			IOS_ReloadIOS(preferred);
		else DI_LoadDVDX(true);
	}
	
	DI_Init();    // first
#endif
	
	loadSettings(argc, argv);
	MenuContext *menu = new MenuContext(vmode);
	VIDEO_SetPostRetraceCallback (ScanPADSandReset);

#ifndef WII
	DVD_Init();
#endif

#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	control_info_init(); //Perform controller auto assignment at least once at startup.

	// Start up AESND (inited here because its used in SPU and CD)
	AESND_Init();

#ifdef HW_RVL
	// Initialize the network if the user has specified something in their SMB settings
	if(strlen(&smbShareName[0]) && strlen(&smbIpAddr[0])) {
	  init_network_thread();
  }
#endif
	
	while (menu->isRunning()) {}
	
	// Shut down AESND
	AESND_Reset();

	delete menu;

	return 0;
}
Esempio n. 6
0
int main(int argc, char *argv[])
{
	__exception_setreload(20);
	
#ifdef GDB_DEBUG
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif
	
	InitVideo();
	
	if(StartUpProcess::Run(argc, argv))
	{
		Application::Instance()->init();
		Application::Instance()->show();
		Application::Instance()->exec();
	}
	
	//! Return to the Wii system menu if not from HBC
	if(!IsFromHBC())
		SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);

	return 0;
}
Esempio n. 7
0
static void frontend_gx_init(void *data)
{
   (void)data;
#ifdef HW_RVL
   IOS_ReloadIOS(IOS_GetVersion());
   L2Enhance();
#ifndef IS_SALAMANDER
   gx_init_mem2();
#endif
#endif

#ifdef USBGECKO
   DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
   _break();
#endif

#if defined(DEBUG) && defined(IS_SALAMANDER)
   VIInit();
   GXRModeObj *rmode = VIDEO_GetPreferredMode(NULL);
   void *xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
   console_init(xfb, 20, 20, rmode->fbWidth,
         rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
   VIConfigure(rmode);
   VISetNextFramebuffer(xfb);
   VISetBlack(FALSE);
   VIFlush();
   VIWaitForRetrace();
   VIWaitForRetrace();
#endif

#ifndef DEBUG
   __exception_setreload(8);
#endif

   fatInitDefault();

#ifdef HAVE_LOGGER
   devoptab_list[STD_OUT] = &dotab_stdout;
   devoptab_list[STD_ERR] = &dotab_stdout;
   dotab_stdout.write_r = gx_logger_net;
#elif defined(HAVE_FILE_LOGGER) && !defined(IS_SALAMANDER)
   devoptab_list[STD_OUT] = &dotab_stdout;
   devoptab_list[STD_ERR] = &dotab_stdout;
   dotab_stdout.write_r = gx_logger_file;
#endif

#if defined(HW_RVL) && !defined(IS_SALAMANDER)
   gx_devices[GX_DEVICE_SD].interface = &__io_wiisd;
   gx_devices[GX_DEVICE_SD].name = "sd";
   gx_devices[GX_DEVICE_SD].mounted = fatMountSimple(
         gx_devices[GX_DEVICE_SD].name,
         gx_devices[GX_DEVICE_SD].interface);
   gx_devices[GX_DEVICE_USB].interface = &__io_usbstorage;
   gx_devices[GX_DEVICE_USB].name = "usb";
   gx_devices[GX_DEVICE_USB].mounted = fatMountSimple(
            gx_devices[GX_DEVICE_USB].name,
            gx_devices[GX_DEVICE_USB].interface);

   gx_device_cond_mutex = slock_new();
   gx_device_cond       = scond_new();
   gx_device_mutex      = slock_new();
   gx_device_thread     = sthread_create(gx_devthread, NULL);
#endif
}
int main(int argc, char* argv[]){
	/* INITIALIZE */
#ifdef HW_RVL
  DI_Init();    // first
#endif

#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	Initialise(); // Stock OGC initialization
//	vmode = VIDEO_GetPreferredMode(NULL);
	MenuContext *menu = new MenuContext(vmode);
	VIDEO_SetPostRetraceCallback (ScanPADSandReset);
#ifndef WII
	DVD_Init();
#endif
//	menuInit();
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
//	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
//	_break();
#endif

	// Default Settings
	audioEnabled     = 1; // Audio
#ifdef RELEASE
	showFPSonScreen  = 0; // Show FPS on Screen
#else
	showFPSonScreen  = 1; // Show FPS on Screen
#endif
	printToScreen    = 1; // Show DEBUG text on screen
	printToSD        = 0; // Disable SD logging
	Timers.limitVIs  = 0; // Sync to Audio
	saveEnabled      = 0; // Don't save game
	nativeSaveDevice = 0; // SD
	saveStateDevice	 = 0; // SD
	autoSave         = 1; // Auto Save Game
	creditsScrolling = 0; // Normal menu for now
	dynacore         = 1; // Dynarec
	screenMode		 = 0; // Stretch FB horizontally
	padAutoAssign	 = PADAUTOASSIGN_AUTOMATIC;
	padType[0]		 = PADTYPE_NONE;
	padType[1]		 = PADTYPE_NONE;
	padType[2]		 = PADTYPE_NONE;
	padType[3]		 = PADTYPE_NONE;
	padAssign[0]	 = PADASSIGN_INPUT0;
	padAssign[1]	 = PADASSIGN_INPUT1;
	padAssign[2]	 = PADASSIGN_INPUT2;
	padAssign[3]	 = PADASSIGN_INPUT3;
	pakMode[0]		 = PAKMODE_MEMPAK; // memPak plugged into controller 1
	pakMode[1]		 = PAKMODE_MEMPAK;
	pakMode[2]		 = PAKMODE_MEMPAK;
	pakMode[3]		 = PAKMODE_MEMPAK;
	loadButtonSlot	 = LOADBUTTON_DEFAULT;
#ifdef GLN64_GX
// glN64 specific  settings
 	glN64_useFrameBufferTextures = 0; // Disable FrameBuffer textures
	glN64_use2xSaiTextures = 0;	// Disable 2xSai textures
	renderCpuFramebuffer = 0; // Disable CPU Framebuffer Rendering
#endif //GLN64_GX
	menuActive = 1;

	//config stuff
	fileBrowser_file* configFile_file;
	int (*configFile_init)(fileBrowser_file*) = fileBrowser_libfat_init;
#ifdef HW_RVL
	if(argv[0][0] == 'u') {  //assume USB
		configFile_file = &saveDir_libfat_USB;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "usb:/wii64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "usb:/wii64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "usb:/wii64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "usb:/wii64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "usb:/wii64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	else /*if((argv[0][0]=='s') || (argv[0][0]=='/'))*/
#endif
	{ //assume SD
		configFile_file = &saveDir_libfat_Default;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "sd:/wii64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "sd:/wii64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "sd:/wii64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "sd:/wii64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "sd:/wii64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
#ifdef HW_RVL
	// Handle options passed in through arguments
	int i;
	for(i=1; i<argc; ++i){
		handleConfigPair(argv[i]);
	}
#endif
	while (menu->isRunning()) {}

	delete menu;

	return 0;
}
Esempio n. 9
0
void Func_PlayGame()
{
	if(!hasLoadedROM)
	{
		menu::MessageBox::getInstance().setMessage("Please load a ROM first");
		return;
	}
	
	//Wait until 'A' button released before play/resume game
	menu::Cursor::getInstance().setFreezeAction(true);
	menu::Focus::getInstance().setFreezeAction(true);
	int buttonHeld = 1;
	while(buttonHeld)
	{
		buttonHeld = 0;
		menu::Gui::getInstance().draw();
		for (int i=0; i<4; i++)
		{
			if(PAD_ButtonsHeld(i) & PAD_BUTTON_A) buttonHeld++;
#ifdef HW_RVL
			WPADData* wiiPad = WPAD_Data(i);
			if(wiiPad->err == WPAD_ERR_NONE && wiiPad->btns_h & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) buttonHeld++;
#endif
		}
	}
	menu::Cursor::getInstance().setFreezeAction(false);
	menu::Focus::getInstance().setFreezeAction(false);

	menu::Gui::getInstance().gfx->clearEFB((GXColor){0, 0, 0, 0xFF}, 0x000000);
	pause_netinit_thread();
	pauseRemovalThread();
	resumeAudio();
	resumeInput();
	menuActive = 0;
#ifdef DEBUGON
	_break();
#endif
	new_frame();
	new_vi();
	go();
#ifdef DEBUGON
	_break();
#endif
	menuActive = 1;
	pauseInput();
	pauseAudio();

  if(autoSave==AUTOSAVE_ENABLE) {
    if(flashramWritten || sramWritten || eepromWritten || mempakWritten) {  //something needs saving
      switch (nativeSaveDevice)
    	{
    		case NATIVESAVEDEVICE_SD:
    		case NATIVESAVEDEVICE_USB:
    			// Adjust saveFile pointers
    			saveFile_dir = (nativeSaveDevice==NATIVESAVEDEVICE_SD) ? &saveDir_libfat_Default:&saveDir_libfat_USB;
    			saveFile_readFile  = fileBrowser_libfat_readFile;
    			saveFile_writeFile = fileBrowser_libfat_writeFile;
    			saveFile_init      = fileBrowser_libfat_init;
    			saveFile_deinit    = fileBrowser_libfat_deinit;
    			break;
    		case NATIVESAVEDEVICE_CARDA:
    		case NATIVESAVEDEVICE_CARDB:
    			// Adjust saveFile pointers
    			saveFile_dir       = (nativeSaveDevice==NATIVESAVEDEVICE_CARDA) ? &saveDir_CARD_SlotA:&saveDir_CARD_SlotB;
    			saveFile_readFile  = fileBrowser_CARD_readFile;
    			saveFile_writeFile = fileBrowser_CARD_writeFile;
    			saveFile_init      = fileBrowser_CARD_init;
    			saveFile_deinit    = fileBrowser_CARD_deinit;
    			break;
    	}
    	// Try saving everything
    	int amountSaves = flashramWritten + sramWritten + eepromWritten + mempakWritten;
    	int result = 0;
    	saveFile_init(saveFile_dir);
    	result += saveEeprom(saveFile_dir);
    	result += saveSram(saveFile_dir);
    	result += saveMempak(saveFile_dir);
    	result += saveFlashram(saveFile_dir);
    	saveFile_deinit(saveFile_dir);
    	if (result==amountSaves) {  //saved all of them ok	
    		switch (nativeSaveDevice)
    		{
    			case NATIVESAVEDEVICE_SD:
    				menu::MessageBox::getInstance().fadeMessage("Automatically saved to SD card");
    				break;
    			case NATIVESAVEDEVICE_USB:
    				menu::MessageBox::getInstance().fadeMessage("Automatically saved to USB device");
    				break;
    			case NATIVESAVEDEVICE_CARDA:
    				menu::MessageBox::getInstance().fadeMessage("Automatically saved to memcard in Slot A");
    				break;
    			case NATIVESAVEDEVICE_CARDB:
    				menu::MessageBox::getInstance().fadeMessage("Automatically saved to memcard in Slot B");
    				break;
    		}
    		flashramWritten = sramWritten = eepromWritten = mempakWritten = 0;  //nothing new written since save
  		}
  	  else		
  	    menu::MessageBox::getInstance().setMessage("Failed to save game"); //one or more failed to save
      
    }
  }

	continueRemovalThread();
	resume_netinit_thread();
	FRAME_BUTTONS[5].buttonString = FRAME_STRINGS[6];
	menu::Cursor::getInstance().clearCursorFocus();
}
uint8_t NeXTMatrix::scan()
{
    //_delay_ms(20);
    
    //next_kbd_set_leds(false, false);
    NEXT_KBD_LED1_OFF;
    
    _is_modified = false;
    
    if (!NEXT_KBD_PWR_READ) {
        _make(NEXT_KBD_PWR_KEYCODE);
        _power_state = 1;
        if (_is_modified)
        {
            dprintf("Power state 1\n");
            
        }
    } else {
        _break(NEXT_KBD_PWR_KEYCODE);
        _power_state = 0;
        if (_is_modified)
        {
            dprintf("Power state 0\n");
            
        }
    }
    
    uint32_t resp = (next_kbd_recv());
    
    if (resp == NEXT_KBD_KMBUS_IDLE)
    {
        return 0;
    }
    
    NEXT_KBD_LED1_ON;
    
    next_kbd_set_leds(
        NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false, 
        NEXT_KBD_PRESSED_SHIFT_RGHT(resp) ? true : false
    );
    
    dprintf("[ r=%04lX keycode=%02X pressed=%X CTRL=%X SHIFT_LEFT=%X SHIFT_RGHT=%X CMD_LEFT=%X CMD_RGHT=%X ALT_LEFT=%X ALT_RGHT=%X ]\n", \
        resp, \
        NEXT_KBD_KEYCODE(resp), \
        NEXT_KBD_PRESSED_KEYCODE(resp), \
        NEXT_KBD_PRESSED_CONTROL(resp), \
        NEXT_KBD_PRESSED_SHIFT_LEFT(resp), \
        NEXT_KBD_PRESSED_SHIFT_RGHT(resp), \
        NEXT_KBD_PRESSED_CMD_LEFT(resp), \
        NEXT_KBD_PRESSED_CMD_RGHT(resp), \
        NEXT_KBD_PRESSED_ALT_LEFT(resp), \
        NEXT_KBD_PRESSED_ALT_RGHT(resp) \
    );
    
    // Modifier keys don't return keycode; have to check the upper bits    
    NEXT_KBD_MAKE_OR_BREAK(ALT_RGHT,   0x51);
    NEXT_KBD_MAKE_OR_BREAK(ALT_LEFT,   0x52);
    NEXT_KBD_MAKE_OR_BREAK(CMD_RGHT,   0x53);
    NEXT_KBD_MAKE_OR_BREAK(CMD_LEFT,   0x54);
    NEXT_KBD_MAKE_OR_BREAK(SHIFT_RGHT, 0x55);
    NEXT_KBD_MAKE_OR_BREAK(SHIFT_LEFT, 0x56);
    NEXT_KBD_MAKE_OR_BREAK(CONTROL,    0x57);
    NEXT_KBD_MAKE_OR_BREAK(KEYCODE,    NEXT_KBD_KEYCODE(resp));
    
    return 1;
}
Esempio n. 11
0
///<summary>
/// Runs a menu, and makes changes to the LevelInfo struct based on the menu selection...
///</summary>
void  EndOfWaveMenu::executeMenu(LevelInfo *levelInfo)
{
    bool doneLooping = false;
    CONTROLLER_STATUS status;

    while(doneLooping == false)
    {
        // This is our input code, and should always be run
        levelInfo->Controllers->updateControllerStates();
        status = levelInfo->Controllers->checkControllerStatus(0);
        if(status == CONTROLLER_READY)
        {

            if(levelInfo->Controllers->checkButtonPress(0, WII_BUTTON_PLUS) == true)
            {
#ifdef PLATFORM_IS_WII
                _break();
#endif
            }


            bool menuButtonPressed = levelInfo->Controllers->checkButtonPress(0, WII_BUTTON_A);

            if(levelInfo->Controllers->checkButtonPress(0, WII_BUTTON_B) == true)
            {
                // if A and B are pressed at the same time, they want to exit cest menu...
                levelInfo->Sounds[MENU_YES]->playOnce();
                doneLooping = true;
            }

            // Check for the A button to be pressed
            if(myGameMenu.CurrentButtonState == BUTTON_RELEASED)
            {
                myGameMenu.CurrentButtonState = BUTTON_FREE;
            }
            else if(myGameMenu.CurrentButtonState == BUTTON_FREE)
            {
                myGameMenu.ClickedButtonID = NO_BUTTON_CLICKED;
                if(menuButtonPressed == true)
                {
                    myGameMenu.CurrentButtonState = BUTTON_PRESSED;
                    GameMenuMethodsUpdateClickedButtonID(0, &myGameMenu, levelInfo);
                }
            }
            // Once A is pressed, check for it to be released, then once it's released check to see if we were inside
            // a set of button coordinates...
            else if((myGameMenu.CurrentButtonState == BUTTON_PRESSED) && (menuButtonPressed == false))
            {
                GameMenuMethodsUpdateClickedButtonID(0, &myGameMenu, levelInfo);
                switch(myGameMenu.ClickedButtonID)
                {
                case FINISHED_BUTTON:
                    levelInfo->Sounds[MENU_YES]->playOnce();
                    doneLooping = true;
                    break;
                case PROJECTILE_BUTTON:
                    if(levelInfo->CurrentUpgradePoints >= gProjectileCost)
                    {
                        levelInfo->Sounds[MENU_YES]->playOnce();
                        levelInfo->CurrentUpgradePoints -= gProjectileCost;
                        levelInfo->CurrentPlayerBulletDamage += 1.0f;
                        gProjectileCost += PROJECTILE_COST_MODIFIER;
                        setupUpgradeWeaponButton(myGameMenu, levelInfo);
                    }
                    else
                    {
                        levelInfo->Sounds[MENU_NO]->playOnce();
                    }
                    break;
                case ATTACK_BUTTON:
                    if(levelInfo->CurrentUpgradePoints >= gAttackCost)
                    {
                        levelInfo->Sounds[MENU_YES]->playOnce();
                        levelInfo->CurrentUpgradePoints -= gAttackCost;
                        levelInfo->CurrentPlayerRepelDamage += 1.0f;
                        gAttackCost += ATTACK_COST_MODIFIER;
                        setupUpgradeAttackButton(myGameMenu, levelInfo);
                    }
                    else
                    {
                        levelInfo->Sounds[MENU_NO]->playOnce();
                    }
                    break;
                default:
                    break;
                }

                myGameMenu.CurrentButtonState = BUTTON_RELEASED;
            }

            GameMenuMethodsRenderMenu(0, &myGameMenu, levelInfo);
        }
        //TODO: We need a dialog that informs the user that the controller is not responding...
    }
}
Esempio n. 12
0
int main(int argc, char* argv[]){
	/* INITIALIZE */
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	Initialise(); // Stock OGC initialization
//	vmode = VIDEO_GetPreferredMode(NULL);
#ifndef WII
	DVD_Init();
#endif
//	menuInit();
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
//	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
//	_break();
#endif

	// Default Settings
	audioEnabled     = 1; // Audio
	scalePitch       = 1;
#ifdef RELEASE
	showFPSonScreen  = 0; // Show FPS on Screen
#else
	showFPSonScreen  = 1; // Show FPS on Screen
#endif
	printToScreen    = 1; // Show DEBUG text on screen
	printToSD        = 0; // Disable SD logging
	Timers.limitVIs  = 1;
	autoSave         = 1; // Auto Save Game
	dynacore         = 1; // Dynarec
#ifndef HW_RVL
	screenMode		 = 0; // Stretch FB horizontally
#else
	screenMode		 = CONF_GetAspectRatio() == CONF_ASPECT_16_9 ? SCREENMODE_16x9_PILLARBOX : SCREENMODE_4x3;
#endif
	videoMode		 = VIDEOMODE_AUTO;
	trapFilter		 = TRAPFILTER_DISABLE;
	padAutoAssign	 = PADAUTOASSIGN_AUTOMATIC;
	padType[0]		 = PADTYPE_NONE;
	padType[1]		 = PADTYPE_NONE;
	padType[2]		 = PADTYPE_NONE;
	padType[3]		 = PADTYPE_NONE;
	padAssign[0]	 = PADASSIGN_INPUT0;
	padAssign[1]	 = PADASSIGN_INPUT1;
	padAssign[2]	 = PADASSIGN_INPUT2;
	padAssign[3]	 = PADASSIGN_INPUT3;
	pakMode[0]		 = PAKMODE_MEMPAK; // memPak plugged into controller 1
	pakMode[1]		 = PAKMODE_MEMPAK;
	pakMode[2]		 = PAKMODE_MEMPAK;
	pakMode[3]		 = PAKMODE_MEMPAK;
	loadButtonSlot	 = LOADBUTTON_DEFAULT;
#ifdef GLN64_GX
// glN64 specific  settings
 	glN64_useFrameBufferTextures = 0; // Disable FrameBuffer textures
	glN64_use2xSaiTextures = 0;	// Disable 2xSai textures
	renderCpuFramebuffer = 0; // Disable CPU Framebuffer Rendering
#endif //GLN64_GX
	menuActive = 1;

	//config stuff
	fileBrowser_file* configFile_file;
	int (*configFile_init)(fileBrowser_file*) = fileBrowser_libfat_init;
#ifdef HW_RVL
	if(argc > 0 && argv[0][0] == 'u') {  //assume USB
		nativeSaveDevice = NATIVESAVEDEVICE_USB;
		saveStateDevice = SAVESTATEDEVICE_USB;
		configFile_file = &saveDir_libfat_USB;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "usb:/not64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "usb:/not64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "usb:/not64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "usb:/not64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "usb:/not64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	else /*if((argv[0][0]=='s') || (argv[0][0]=='/'))*/
#endif
	{ //assume SD
		nativeSaveDevice = NATIVESAVEDEVICE_SD;
		saveStateDevice = SAVESTATEDEVICE_SD;
		configFile_file = &saveDir_libfat_Default;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "sd:/not64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "sd:/not64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "sd:/not64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "sd:/not64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "sd:/not64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	// Handle options passed in through arguments
	int i;
	for(i=1; i<argc; ++i){
		handleConfigPair(argv[i]);
	}

	MenuContext *menu = new MenuContext(vmode);

	// Initialize the network if the user has specified something in their SMB settings
	if(strlen(&smbShareName[0]) && strlen(&smbIpAddr[0])) {
		init_network_thread();
	}

	while (menu->isRunning()) {}

	delete menu;

	return 0;
}
Esempio n. 13
0
int main(int argc,char **argv)
{
	int i;
	HW_VGA(FRAMEBUFFERPTR)=0x00000;

	puts("Initializing SD card\n");
	if(spi_init())
	{
		puts("Hunting for partition\n");
		FindDrive();
		if(LoadFile("MANIFESTMST",Manifest))
		{
			unsigned char *buffer=Manifest;
			int ptr;
			puts("Parsing manifest\n");
			while(1)
			{
				unsigned char c=0;
				ptr=0;
				// Parse address
				while((c=*buffer++)!=' ')
				{
					HW_UART(REG_UART)=c;
					if(c=='#') // Comment line?
						break;
					if(c=='G')
						_boot();

					if(c=='\n')
						_break(); // Halt CPU

					if(c=='L')
						buffer=Manifest;

					c=(c&~32)-('0'-32); // Convert to upper case
					if(c>='9')
						c-='A'-'0';
					ptr<<=4;
					ptr|=c;
				}
				// Parse filename
				if(c!='#')
				{
					int i;
					while((c=*buffer++)==' ')
						;
					--buffer;
					// c-1 is now the filename pointer

//					printf("Loading file %s to %d\n",fn,(long)ptr);
//					buffer[11]=0;
					LoadFile(buffer,(unsigned char *)ptr);
					HW_VGA(FRAMEBUFFERPTR)=ptr;
				}

				// Hunt for newline character
				while((c=*buffer++)!='\n')
					;
			}
		}
		else
		{
			puts("Loading manifest failed\n");
		}
	}
	puts("Returning\n");

	return(0);
}