Example #1
0
void FCEU_ResetVidSys(void) {
	int w;

	if (FCEUGameInfo->vidsys == GIV_NTSC)
		w = 0;
	else if (FCEUGameInfo->vidsys == GIV_PAL)
		w = 1;
	else
		w = FSettings.PAL;

	PAL = w ? 1 : 0;
	FCEUPPU_SetVideoSystem(w);
	SetSoundVariables();
}
Example #2
0
int GCMemROM(int method, int size)
{
    ResetGameLoaded();

    /*** Allocate and clear GameInfo ***/

    FCEUGameInfo = malloc(sizeof(FCEUGI));
    memset(FCEUGameInfo, 0, sizeof(FCEUGI));

    /*** Set some default values ***/
    FCEUGameInfo->soundchan = 1;
    FCEUGameInfo->soundrate = SAMPLERATE;
    FCEUGameInfo->name=0;
    FCEUGameInfo->type=GIT_CART;
    FCEUGameInfo->vidsys=GIV_USER;
    FCEUGameInfo->input[0]=FCEUGameInfo->input[1]=-1;
    FCEUGameInfo->inputfc=-1;
    FCEUGameInfo->cspecial=0;

    /*** Set internal sound information ***/
    FCEUI_Sound(SAMPLERATE);
    FCEUI_SetSoundVolume(100); // 0-100
    FCEUI_SetSoundQuality(0); // 0 - low, 1 - high
    FCEUI_SetLowPass(0);

    InitialisePads();

    MakeFCEUFile((char *)nesrom, size);

    nesGameType = 0;

    if(iNESLoad(NULL, fceufp))
		nesGameType = 1;
	else if(UNIFLoad(NULL,fceufp))
		nesGameType = 2;
	else if(NSFLoad(fceufp))
		nesGameType = 3;
	else
	{
		// read FDS BIOS into FDSBIOS - should be 8192 bytes
		if(FDSBIOS[1] == 0)
		{
			int biosSize = 0;
			char * tmpbuffer = (char *)malloc(64 * 1024);

			char filepath[1024];

			switch (method)
			{
				case METHOD_SD:
				case METHOD_USB:
					sprintf(filepath, "%s/%s/disksys.rom", ROOTFATDIR, GCSettings.LoadFolder);
					biosSize = LoadBufferFromFAT(tmpbuffer, filepath, NOTSILENT);
					break;
				case METHOD_SMB:
					sprintf(filepath, "%s/disksys.rom", GCSettings.LoadFolder);
					biosSize = LoadBufferFromSMB(tmpbuffer, filepath, NOTSILENT);
					break;
			}

			if(biosSize == 8192)
			{
				memcpy(FDSBIOS, tmpbuffer, 8192);
			}
			else
			{
				if(biosSize > 0)
					WaitPrompt("FDS BIOS file is invalid!");

				return 0; // BIOS not loaded, do not load game
			}
			free(tmpbuffer);
		}
		// load game
		if(FDSLoad(NULL,fceufp))
			nesGameType = 4;
	}

    if (nesGameType > 0)
    {
        FCEU_ResetVidSys();
        PowerNES();
        FCEU_ResetPalette();
        FCEU_ResetMessages();	// Save state, status messages, etc.
        SetSoundVariables();
        romLoaded = true;
        return 1;
    }
    else
    {
        WaitPrompt("Invalid game file!");
        romLoaded = false;
        return 0;
    }
}