Ejemplo n.º 1
0
int MDFNSS_Load(const char *fname, const char *suffix)
{
	gzFile st;

	if(!MDFNGameInfo->StateAction)
	{
		MDFN_DispMessage("Module \"%s\" doesn't support save states.", MDFNGameInfo->shortname);
		return(0);
	}

	if(fname)
		st=gzopen(fname, "rb");
	else
	{
		st=gzopen(MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str(),"rb");
	}

	if(st == NULL)
	{
		if(!fname && !suffix)
		{
			MDFN_DispMessage("State %d load error.",CurrentState);
			SaveStateStatus[CurrentState]=0;
		}
		return(0);
	}

	if(MDFNSS_LoadFP(st))
	{
		MDFNI_DisplayState();

		if(!fname && !suffix)
		{
			LoadStateMovie((char*)MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str());
			SaveStateStatus[CurrentState]=1;
			MDFN_DispMessage("State %d loaded.",CurrentState);
			SaveStateStatus[CurrentState]=1;
		}
		gzclose(st);
		return(1);
	}
	else
	{
		SaveStateStatus[CurrentState]=1;
		MDFN_DispMessage("State %d read error!",CurrentState);
		gzclose(st);
		return(0);
	}
}
Ejemplo n.º 2
0
int MDFNSS_Load(const char *fname, const char *suffix)
{
	gzFile st;

	if(fname)
		st=gzopen(fname, "rb");
	else
	{
		st=gzopen(MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str(),"rb");
	}

	if(st == NULL)
	{
		if(!fname && !suffix)
		{
			MDFN_DispMessage(_("State %d load error."),CurrentState);
			SaveStateStatus[CurrentState]=0;
		}
		return(0);
	}

	

	if(MDFNSS_LoadFP(st))
	{
		MDFNI_DisplayState();
		LoadStateMovie((char*)MDFN_MakeFName(MDFNMKF_STATE,CurrentState,suffix).c_str());
		
		if(!fname && !suffix)
		{
			SaveStateStatus[CurrentState]=1;
			MDFN_DispMessage(_("State %d loaded."),CurrentState);
			SaveStateStatus[CurrentState]=1;
		}
		gzclose(st);
		return(1);
	}
	else
	{
		SaveStateStatus[CurrentState]=1;
		MDFN_DispMessage(_("State %d read error!"),CurrentState);
		gzclose(st);
		return(0);
	}
}
Ejemplo n.º 3
0
void MDFNI_LoadMovie(char *fname)
{
    gzFile fp;
//puts("KAO");

    if(current > 0)        /* Can't interrupt recording.*/
        return;
#ifdef NETWORK
    if(MDFNnetplay)	/* Playback is UNPOSSIBLE during netplay. */
    {
        MDFN_DispMessage(_("Can't play movies during netplay."));
        return;
    }
#endif

    if(current < 0)        /* Stop playback. */
    {
        StopPlayback();
        return;
    }

    if(fname)
        fp = gzopen(fname, "rb");
    else
    {
        fp=gzopen(MDFN_MakeFName(MDFNMKF_MOVIE,CurrentMovie,0).c_str(),"rb");
    }

    if(!fp) return;

    if(!MDFNSS_LoadFP(fp))
    {
        MDFN_DispMessage(_("Error loading state portion of the movie."));
        return;
    }
    current = CurrentMovie;
    slots[current] = fp;

    current = -1 - current;
    MovieStatus[CurrentMovie] = 1;
    MDFN_DispMessage(_("Movie playback started."));
}