Esempio n. 1
0
/****************************************************************************
 * Load SRAM From SD Card
 ****************************************************************************/
void
LoadSRAMFromSD (int slot, bool silent)
{
    char filepath[1024];
    int offset = 0;
    
    ShowAction ((char*) "Loading SRAM from SD...");
    
#ifdef SDUSE_LFN
    sprintf (filepath, "%s/%s/%s.srm", rootSDdir, SNESSAVEDIR, Memory.ROMName);
#else
    sprintf (filepath, "%s/%s/%08x.srm", rootSDdir, SNESSAVEDIR, Memory.ROMCRC32);
#endif
    
    offset = LoadBufferFromSD (filepath, silent);
    
    if (offset > 0)
    {
        decodesavedata (offset);
        if ( !silent )
        {
            sprintf (filepath, "Loaded %d bytes", offset);
            WaitPrompt(filepath);
        }
        S9xSoftReset();
    }
}
Esempio n. 2
0
static void MovieOnReset(void)
{
	Movie.CurrentSample++;
	Movie.CurrentFrame++; // it must be called at frame boundary
	S9xSoftReset();
	movie_reset_processed = true;
}
Esempio n. 3
0
void SNES9X_SoftReset(void)	// Software Reset
{
	if (cartOpen)
	{
		SNES9X_SaveSRAM();		
		S9xSoftReset();
		SNES9X_LoadSRAM();
	}
}
Esempio n. 4
0
void snes_reset()
{
   S9xMovieUpdateOnReset();
   if (S9xMoviePlaying())
   {
      S9xMovieStop(true);
   }
   S9xSoftReset();
}
Esempio n. 5
0
static void read_frame_controller_data(bool addFrame)
{
	int i;

	// one sample of all 1 bits = reset code
	// (the SNES controller doesn't have enough buttons to possibly generate this sequence)
	// (a single bit indicator was not used, to avoid having to special-case peripheral recording here)
	if(Movie.InputBufferPtr[0] == 0xFF)
	{
		bool reset = true;
		for(i=1; i<(int)Movie.BytesPerSample; i++)
		{
			if(Movie.InputBufferPtr[i] != 0xFF)
			{
				reset = false;
				break;
			}
		}
		if(reset)
		{
			Movie.InputBufferPtr += Movie.BytesPerSample;
			S9xSoftReset();
			return;
		}
	}

	for(i=0; i<8; ++i)
	{
		if(Movie.ControllersMask & (1<<i))
		{
			MovieSetJoypad(i, Read16(Movie.InputBufferPtr));
		}
		else
		{
			MovieSetJoypad(i, 0);		// pretend the controller is disconnected
		}
	}
#ifdef PERIPHERAL_SUPPORT
	for(int port=0;port<2;port++)
	{
		if(Movie.PortType[port] == CTL_MOUSE)
		{
			uint8 buf [MOUSE_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, MOUSE_DATA_SIZE); Movie.InputBufferPtr += MOUSE_DATA_SIZE;
			MovieSetMouse(port, buf, !addFrame);
		}
		if(Movie.PortType[port] == CTL_SUPERSCOPE)
		{
			uint8 buf [SCOPE_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, SCOPE_DATA_SIZE); Movie.InputBufferPtr += SCOPE_DATA_SIZE;
			MovieSetScope(port, buf);
		}
		if(Movie.PortType[port] == CTL_JUSTIFIER)
		{
			uint8 buf [JUSTIFIER_DATA_SIZE];
			memcpy(buf, Movie.InputBufferPtr, JUSTIFIER_DATA_SIZE); Movie.InputBufferPtr += JUSTIFIER_DATA_SIZE;
			MovieSetJustifier(port, buf);
		}
	}
#endif
}
Esempio n. 6
0
int
GameMenu ()
{
	int gamemenuCount = 10;
	char gamemenu[][50] = {
	  "Return to Game",
	  "Reset Game",
	  "ROM Information",
	  "Cheats",
	  "Load SRAM", "Save SRAM",
	  "Load Game Snapshot", "Save Game Snapshot",
	  "Reset Zoom",
	  "Back to Main Menu"
	};

	int ret, retval = 0;
	int quit = 0;
	int oldmenu = menu;
	menu = 0;

	while (quit == 0)
	{
		// disable SRAM/SNAPSHOT saving/loading if AUTO is on

		if (GCSettings.AutoLoad == 1) // Auto Load SRAM
			gamemenu[4][0] = '\0';
		else if (GCSettings.AutoLoad == 2) // Auto Load SNAPSHOT
			gamemenu[6][0] = '\0';

		if (GCSettings.AutoSave == 1) // Auto Save SRAM
			gamemenu[5][0] = '\0';
		else if (GCSettings.AutoSave == 2) // Auto Save SNAPSHOT
			gamemenu[7][0] = '\0';
		else if (GCSettings.AutoSave == 3) // Auto Save BOTH
		{
			gamemenu[5][0] = '\0';
			gamemenu[7][0] = '\0';
		}

		// hide cheats menu if cheats file not present
		if(Cheat.num_cheats == 0)
			gamemenu[3][0] = '\0';

		ret = RunMenu (gamemenu, gamemenuCount, (char*)"Game Menu");

		switch (ret)
		{
			case 0: // Return to Game
				quit = retval = 1;
				break;

			case 1: // Reset Game
				zoom_reset ();
				S9xSoftReset ();
				quit = retval = 1;
				break;

			case 2: // ROM Information
				RomInfo();
				WaitButtonA ();
				break;

			case 3: // load cheats
				CheatMenu();
				break;

			case 4: // Load SRAM
				zoom_reset ();
				quit = retval = LoadSRAM(GCSettings.SaveMethod, NOTSILENT);
				break;

			case 5: // Save SRAM
				SaveSRAM(GCSettings.SaveMethod, NOTSILENT);
				break;

			case 6: // Load Freeze
				zoom_reset ();
				quit = retval = NGCUnfreezeGame (GCSettings.SaveMethod, NOTSILENT);
				break;

			case 7: // Save Freeze
				NGCFreezeGame (GCSettings.SaveMethod, NOTSILENT);
				break;

			case 8:	// Reset Zoom
				zoom_reset ();
				quit = retval = 1;
				break;

			case -1: // Button B
			case 9: // Return to previous menu
				retval = 0;
				quit = 1;
				break;
		}
	}

	menu = oldmenu;

	return retval;
}
Esempio n. 7
0
void retro_reset (void)
{
   S9xSoftReset();
}
Esempio n. 8
0
void
mainmenu ()
{
	int quit = 0;
	int ret;
	int *psoid = (int *) 0x80001800;
	void (*PSOReload) () = (void (*)()) 0x80001800;
	
	if ( isWii )
    	sprintf (menuitems[8],"Reset Wii");
	else
    	sprintf (menuitems[8],"Reset Gamecube");
	
	VIDEO_WaitVSync ();
	
	while (quit == 0)
	{
		ret = RunMenu (menuitems, menucount, (char*)"Main Menu");
		
		switch (ret)
		{
			case 0:
				/*** Load ROM Menu ***/
				quit = LoadManager ();
				break;
			
			case 1:
				/*** SRAM Manager Menu ***/
				if ( ARAM_ROMSIZE > 0 )
                    SaveManager ();
                else
                    WaitPrompt((char*) "No ROM is loaded!");
                break;
			
			case 2:
				/*** Do Freeze / Thaw Menu ***/
				if ( ARAM_ROMSIZE > 0 )
                    quit = FreezeManager ();
                else
                    WaitPrompt((char*) "No ROM is loaded!");
                break;
			
			case 3:
				/*** Configure Controllers ***/
				ConfigureControllers ();
				break;
			
			case 4:
				/*** Emulator Options ***/
				EmulatorOptions ();
				break;
			
			case 5:
				/*** Soft reset ***/
				S9xSoftReset ();
				quit = 1;
				break;
			
			case 6:
				/*** Turn off DVD motor ***/
				dvd_motor_off();
				break;
			
			case 7:
				/*** Exit to Loader ***/
				#ifdef __wii__
				exit(0);
				#else	// gamecube
				if (psoid[0] == PSOSDLOADID)
				PSOReload ();
				#endif
				break;
				
		    case 8:
		        /*** Reset the Gamecube/Wii ***/
                Reboot();
                break;
			
			case -1: /*** Button B ***/
			case 9:
				/*** Return to Game ***/
				quit = 1;
				break;
			
		}
		
	}
	
	/*** Remove any still held buttons ***/
#ifdef HW_RVL
	while( PAD_ButtonsHeld(0) || WPAD_ButtonsHeld(0) )
	    VIDEO_WaitVSync();
#else
	while( PAD_ButtonsHeld(0) )
	    VIDEO_WaitVSync();
#endif
	
}
Esempio n. 9
0
int
LoadManager ()
{
    int ret;
    int quit = 0;
    int oldmenu = menu;
    int retval = 1;
    menu = 0;
    
    while (quit == 0)
    {
		if ( isWii )   /* Wii menu */
		{
			ret = RunMenu (loadmanwii, loadmancountwii, (char*)"Load Manager");
			if (ret >= loadmancountwii-1)
				ret = loadmancount-1;
		}
		else           /* Gamecube menu */
			ret = RunMenu (loadman, loadmancount, (char*)"Load Manager");
        
        switch (ret)
        {
		    case 0:
				/*** Load from SD ***/
                quit = OpenSD (0);
                break;
				
            case 1:
                /*** Load from DVD ***/
                quit = OpenDVD ();
                break;
            
            case 2:
				/*** Load from SMB ***/ //(gamecube option)
	            quit = OpenSMB ();
	            break;
            
			case -1: /*** Button B ***/
            case 3:
                retval = 0;
                quit = 1;
                break;
        }
    }
	
	/*** 
	* check for autoloadsram / freeze 
	***/
	if ( retval == 1 ) // if ROM was loaded, load the SRAM & settings
	{
		if ( GCSettings.AutoLoad == 1 )
			quickLoadSRAM ( SILENT );
		else if ( GCSettings.AutoLoad == 2 )
		{
			/*** load SRAM first in order to get joypad config ***/
			quickLoadSRAM ( SILENT );
			quickLoadFreeze ( SILENT );
		}
		S9xSoftReset();	// reset after loading sram
	}
    
    menu = oldmenu;
    return retval;
}
Esempio n. 10
0
void snes_reset()
{
   S9xSoftReset();
}