Ejemplo n.º 1
0
/****************************************************************************
 * SetupCheats
 *
 * Erases any prexisting cheats, loads cheats from a cheat file
 * Called when a ROM is first loaded
 ***************************************************************************/
void
SetupCheats()
{
	char filepath[1024];
	int offset = 0;

	S9xInitCheatData ();
	S9xDeleteCheats ();

	int method = GCSettings.SaveMethod;

	if(method == METHOD_AUTO)
		method = autoSaveMethod(SILENT);

	if(!MakeFilePath(filepath, FILE_CHEAT, method))
		return;

	AllocSaveBuffer();

	offset = LoadFile(filepath, method, SILENT);

	// load cheat file if present
	if(offset > 0)
	{
		if(NGCLoadCheatFile (offset))
		{
			// disable all cheats loaded from the file
			for (uint16 i = 0; i < Cheat.num_cheats; i++)
				S9xDisableCheat(i);
		}
	}

	FreeSaveBuffer ();
}
Ejemplo n.º 2
0
static void DetachCheatItems (void)
{
	S9xDeleteCheats(); // Cheat.num_cheats = 0

	for (unsigned int i = 0; i < MAX_CHEATS; i++)
	{
		if (citem[i].valid)
		{
			strcpy(Cheat.c[Cheat.num_cheats].name, citem[i].description);
			S9xAddCheat(citem[i].enabled, false, citem[i].address, citem[i].value); // Cheat.num_cheats++
		}
	}

	S9xApplyCheats();
}
Ejemplo n.º 3
0
static void DetachCheatItems (void)
{
	S9xDeleteCheats();

	for (unsigned int i = 0; i < MAC_MAX_CHEATS; i++)
	{
		if (citem[i].valid)
		{
			char code[10];
			snprintf(code, 10, "%x=%x", citem[i].address, citem[i].value);
			int index = S9xAddCheatGroup(citem[i].description, code);
			if(citem[i].enabled && index >= 0)
				S9xEnableCheatGroup(index);
		}
	}
}
Ejemplo n.º 4
0
/****************************************************************************
 * BrowserLoadFile
 *
 * Loads the selected ROM
 ***************************************************************************/
int BrowserLoadFile()
{
	int loaded = 0;
	int device;

	if(!FindDevice(browser.dir, &device))
		return 0;

	// check that this is a valid ROM
	if(!IsValidROM())
		goto done;

	// store the filename (w/o ext) - used for sram/freeze naming
	StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename);
	snprintf(GCSettings.LastFileLoaded, MAXPATHLEN, "%s", browserList[browser.selIndex].filename);
	strncpy(Memory.ROMFilePath, browser.dir, PATH_MAX);

	SNESROMSize = 0;
	S9xDeleteCheats();
	Memory.LoadROM("ROM");

	if (SNESROMSize == 0)
	{
		ErrorPrompt("Error loading game!");
	}
	else if(bsxBiosLoadFailed) {
		ErrorPrompt("BS-X BIOS file not found!");
	}
	else
	{
		// load SRAM or snapshot
		if (GCSettings.AutoLoad == 1)
			LoadSRAMAuto(SILENT);
		else if (GCSettings.AutoLoad == 2)
			LoadSnapshotAuto(SILENT);

		ResetBrowser();
		loaded = 1;
	}
done:
	CancelAction();
	return loaded;
}
Ejemplo n.º 5
0
/****************************************************************************
 * BrowserLoadFile
 *
 * Loads the selected ROM
 ***************************************************************************/
int BrowserLoadFile()
{
	int loaded = 0;
	int device;

	if(!FindDevice(browser.dir, &device))
		return 0;

	GetFileSize(browser.selIndex);

	// check that this is a valid ROM
	if(!IsValidROM())
		goto done;

	// store the filename (w/o ext) - used for sram/freeze naming
	StripExt(Memory.ROMFilename, browserList[browser.selIndex].filename);
	strcpy(loadedFile, browserList[browser.selIndex].filename);

	SNESROMSize = 0;
	S9xDeleteCheats();
	Memory.LoadROM("ROM");

	if (SNESROMSize <= 0)
	{
		ErrorPrompt("Error loading game!");
	}
	else
	{
		// load SRAM or snapshot
		if (GCSettings.AutoLoad == 1)
			LoadSRAMAuto(SILENT);
		else if (GCSettings.AutoLoad == 2)
			LoadSnapshotAuto(SILENT);

		ResetBrowser();
		loaded = 1;
	}
done:
	CancelAction();
	return loaded;
}
Ejemplo n.º 6
0
void retro_cheat_reset(void)
{
   S9xDeleteCheats();
   S9xApplyCheats();
}