Esempio n. 1
0
void Panels::GameDatabasePanel::PopulateFields( const wxString& id ) {
	IGameDatabase* GameDB = AppHost_GetGameDatabase();
	if (!pxAssert(GameDB)) return;

	Game_Data game;
	if (GameDB->findGame(game, id.IsEmpty() ? SysGetDiscID() : id))
	{
		serialBox ->SetLabel(game.getString("Serial"));
		nameBox   ->SetLabel(game.getString("Name"));
		regionBox ->SetLabel(game.getString("Region"));
		compatBox ->SetLabel(game.getString("Compat"));
		commentBox->SetLabel(game.getString("[comments]"));
		patchesBox->SetLabel(game.getString("[patches]"));

		for (GamefixId i=GamefixId_FIRST; i < pxEnumEnd; ++i)
		{
			wxString keyName (EnumToString(i)); keyName += L"Hack";
			if( game.keyExists(keyName) )
				gameFixes[i]->SetValue(game.getBool(keyName));
			else
				gameFixes[i]->SetIndeterminate();
		}
	}
	else {
		serialBox ->SetLabel(wxEmptyString);
		nameBox   ->SetLabel(wxEmptyString);
		regionBox ->SetLabel(wxEmptyString);
		compatBox ->SetLabel(wxEmptyString);
		commentBox->SetLabel(wxEmptyString);
		patchesBox->SetLabel(wxEmptyString);
		for (int i = 0; i < GamefixId_COUNT; i++) {
			gameFixes[i]->SetValue(0);
		}
	}
}
Esempio n. 2
0
// This routine loads patches from the game database
// Returns number of patches loaded
int InitPatches(const wxString& crc, const Game_Data& game)
{
	bool patchFound = false;
	wxString patch;
	patchnumber = 0;

	if (game.IsOk())
	{
		if (game.sectionExists(L"patches", crc)) {
			patch = game.getSection(L"patches", crc);
			patchFound = true;
		}
		else if (game.keyExists(L"[patches]")) {
			patch = game.getString(L"[patches]");
			patchFound = true;
		}
	}
	
	if (patchFound) TrimPatches(patch);
	
	return patchnumber;
}
Esempio n. 3
0
// Load Game Settings found in database
// (game fixes, round modes, clamp modes, etc...)
// Returns number of gamefixes set
static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) {
	if( !game.IsOk() ) return 0;

	int  gf  = 0;

	if (game.keyExists("eeRoundMode"))
	{
		SSE_RoundMode eeRM = (SSE_RoundMode)game.getInt("eeRoundMode");
		if (EnumIsValid(eeRM))
		{
			PatchesCon->WriteLn("(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRM, EnumToString(eeRM));
			dest.Cpu.sseMXCSR.SetRoundMode(eeRM);
			++gf;
		}
	}

	if (game.keyExists("vuRoundMode"))
	{
		SSE_RoundMode vuRM = (SSE_RoundMode)game.getInt("vuRoundMode");
		if (EnumIsValid(vuRM))
		{
			PatchesCon->WriteLn("(GameDB) Changing VU0/VU1 roundmode to %d [%s]", vuRM, EnumToString(vuRM));
			dest.Cpu.sseVUMXCSR.SetRoundMode(vuRM);
			++gf;
		}
	}

	if (game.keyExists("eeClampMode")) {
		int clampMode = game.getInt("eeClampMode");
		PatchesCon->WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode);
		dest.Cpu.Recompiler.fpuOverflow			= (clampMode >= 1);
		dest.Cpu.Recompiler.fpuExtraOverflow	= (clampMode >= 2);
		dest.Cpu.Recompiler.fpuFullMode			= (clampMode >= 3);
		gf++;
	}

	if (game.keyExists("vuClampMode")) {
		int clampMode = game.getInt("vuClampMode");
		PatchesCon->WriteLn("(GameDB) Changing VU0/VU1 clamp mode [mode=%d]", clampMode);
		dest.Cpu.Recompiler.vuOverflow			= (clampMode >= 1);
		dest.Cpu.Recompiler.vuExtraOverflow		= (clampMode >= 2);
		dest.Cpu.Recompiler.vuSignOverflow		= (clampMode >= 3);
		gf++;
	}


	if (game.keyExists("mvuFlagSpeedHack")) {
		bool vuFlagHack = game.getInt("mvuFlagSpeedHack") ? 1 : 0;
		PatchesCon->WriteLn("(GameDB) Changing mVU flag speed hack [mode=%d]", vuFlagHack);
		dest.Speedhacks.vuFlagHack = vuFlagHack;
		gf++;
	}

	for( GamefixId id=GamefixId_FIRST; id<pxEnumEnd; ++id )
	{
		wxString key( EnumToString(id) );
		key += L"Hack";

		if (game.keyExists(key))
		{
			bool enableIt = game.getBool(key);
			dest.Gamefixes.Set(id, enableIt);
			PatchesCon->WriteLn(L"(GameDB) %s Gamefix: " + key, enableIt ? L"Enabled" : L"Disabled");
			gf++;

			// The LUT is only used for 1 game so we allocate it only when the gamefix is enabled (save 4MB)
			if (id == Fix_GoemonTlbMiss && enableIt)
				vtlb_Alloc_Ppmap();
		}
	}

	return gf;
}
Esempio n. 4
0
// Load Game Settings found in database
// (game fixes, round modes, clamp modes, etc...)
// Returns number of gamefixes set
static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game, bool verbose = true) {
    if( !game.IsOk() ) return 0;

    int  gf  = 0;

    if (game.keyExists("eeRoundMode"))
    {
        SSE_RoundMode eeRM = (SSE_RoundMode)game.getInt("eeRoundMode");
        if (EnumIsValid(eeRM))
        {
            if(verbose) Console.WriteLn("(GameDB) Changing EE/FPU roundmode to %d [%s]", eeRM, EnumToString(eeRM));
            dest.Cpu.sseMXCSR.SetRoundMode(eeRM);
            ++gf;
        }
    }

    if (game.keyExists("vuRoundMode"))
    {
        SSE_RoundMode vuRM = (SSE_RoundMode)game.getInt("vuRoundMode");
        if (EnumIsValid(vuRM))
        {
            if(verbose) Console.WriteLn("(GameDB) Changing VU0/VU1 roundmode to %d [%s]", vuRM, EnumToString(vuRM));
            dest.Cpu.sseVUMXCSR.SetRoundMode(vuRM);
            ++gf;
        }
    }

    if (game.keyExists("eeClampMode")) {
        int clampMode = game.getInt("eeClampMode");
        if(verbose) Console.WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode);
        dest.Cpu.Recompiler.fpuOverflow			= (clampMode >= 1);
        dest.Cpu.Recompiler.fpuExtraOverflow	= (clampMode >= 2);
        dest.Cpu.Recompiler.fpuFullMode			= (clampMode >= 3);
        gf++;
    }

    if (game.keyExists("vuClampMode")) {
        int clampMode = game.getInt("vuClampMode");
        if(verbose) Console.WriteLn("(GameDB) Changing VU0/VU1 clamp mode [mode=%d]", clampMode);
        dest.Cpu.Recompiler.vuOverflow			= (clampMode >= 1);
        dest.Cpu.Recompiler.vuExtraOverflow		= (clampMode >= 2);
        dest.Cpu.Recompiler.vuSignOverflow		= (clampMode >= 3);
        gf++;
    }


    if (game.keyExists("mvuFlagSpeedHack")) {
        bool vuFlagHack = game.getInt("mvuFlagSpeedHack") ? 1 : 0;
        if(verbose) Console.WriteLn("(GameDB) Changing mVU flag speed hack [mode=%d]", vuFlagHack);
        dest.Speedhacks.vuFlagHack = vuFlagHack;
        gf++;
    }

    for( GamefixId id=GamefixId_FIRST; id<pxEnumEnd; ++id )
    {
        wxString key( EnumToString(id) );
        key += L"Hack";

        if (game.keyExists(key))
        {
            bool enableIt = game.getBool(key);
            dest.Gamefixes.Set(id, enableIt);
            if(verbose) Console.WriteLn(L"(GameDB) %s Gamefix: " + key, enableIt ? L"Enabled" : L"Disabled" );
            gf++;
        }
    }

    return gf;
}