2015-09-26 14:01:16 +00:00
|
|
|
// Copyright (c) 2013- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
2020-08-10 02:20:07 +00:00
|
|
|
#include <cstring>
|
2020-10-03 22:25:21 +00:00
|
|
|
|
|
|
|
#include "Common/Data/Format/IniFile.h"
|
2015-09-26 14:01:16 +00:00
|
|
|
#include "Core/Compatibility.h"
|
|
|
|
#include "Core/System.h"
|
|
|
|
|
|
|
|
void Compatibility::Load(const std::string &gameID) {
|
|
|
|
Clear();
|
|
|
|
|
2016-01-16 10:24:04 +00:00
|
|
|
{
|
|
|
|
IniFile compat;
|
|
|
|
// This loads from assets.
|
|
|
|
if (compat.LoadFromVFS("compat.ini")) {
|
|
|
|
CheckSettings(compat, gameID);
|
|
|
|
}
|
2015-09-26 14:01:16 +00:00
|
|
|
}
|
|
|
|
|
2016-01-16 10:24:04 +00:00
|
|
|
{
|
|
|
|
IniFile compat2;
|
|
|
|
// This one is user-editable. Need to load it after the system one.
|
2021-05-05 23:31:38 +00:00
|
|
|
Path path = GetSysDirectory(DIRECTORY_SYSTEM) / "compat.ini";
|
|
|
|
if (compat2.Load(path.ToString())) {
|
2016-01-16 10:24:04 +00:00
|
|
|
CheckSettings(compat2, gameID);
|
|
|
|
}
|
2015-09-26 14:01:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Compatibility::Clear() {
|
|
|
|
memset(&flags_, 0, sizeof(flags_));
|
|
|
|
}
|
|
|
|
|
2016-01-16 10:24:04 +00:00
|
|
|
void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
|
2017-01-28 09:04:50 +00:00
|
|
|
CheckSetting(iniFile, gameID, "VertexDepthRounding", &flags_.VertexDepthRounding);
|
|
|
|
CheckSetting(iniFile, gameID, "PixelDepthRounding", &flags_.PixelDepthRounding);
|
|
|
|
CheckSetting(iniFile, gameID, "DepthRangeHack", &flags_.DepthRangeHack);
|
|
|
|
CheckSetting(iniFile, gameID, "ClearToRAM", &flags_.ClearToRAM);
|
2017-01-28 23:10:50 +00:00
|
|
|
CheckSetting(iniFile, gameID, "Force04154000Download", &flags_.Force04154000Download);
|
2017-02-03 14:30:22 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DrawSyncEatCycles", &flags_.DrawSyncEatCycles);
|
2017-02-14 15:56:53 +00:00
|
|
|
CheckSetting(iniFile, gameID, "FakeMipmapChange", &flags_.FakeMipmapChange);
|
2017-03-14 09:36:51 +00:00
|
|
|
CheckSetting(iniFile, gameID, "RequireBufferedRendering", &flags_.RequireBufferedRendering);
|
2017-03-21 07:23:31 +00:00
|
|
|
CheckSetting(iniFile, gameID, "RequireBlockTransfer", &flags_.RequireBlockTransfer);
|
2017-12-17 12:14:06 +00:00
|
|
|
CheckSetting(iniFile, gameID, "RequireDefaultCPUClock", &flags_.RequireDefaultCPUClock);
|
2017-11-10 15:32:56 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DisableReadbacks", &flags_.DisableReadbacks);
|
2017-11-21 10:56:42 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DisableAccurateDepth", &flags_.DisableAccurateDepth);
|
2018-04-13 15:32:36 +00:00
|
|
|
CheckSetting(iniFile, gameID, "MGS2AcidHack", &flags_.MGS2AcidHack);
|
2018-04-13 16:05:04 +00:00
|
|
|
CheckSetting(iniFile, gameID, "SonicRivalsHack", &flags_.SonicRivalsHack);
|
2018-11-04 23:28:01 +00:00
|
|
|
CheckSetting(iniFile, gameID, "BlockTransferAllowCreateFB", &flags_.BlockTransferAllowCreateFB);
|
2020-10-10 21:48:37 +00:00
|
|
|
CheckSetting(iniFile, gameID, "IntraVRAMBlockTransferAllowCreateFB", &flags_.IntraVRAMBlockTransferAllowCreateFB);
|
2018-11-27 14:45:51 +00:00
|
|
|
CheckSetting(iniFile, gameID, "YugiohSaveFix", &flags_.YugiohSaveFix);
|
2019-02-06 09:45:12 +00:00
|
|
|
CheckSetting(iniFile, gameID, "ForceUMDDelay", &flags_.ForceUMDDelay);
|
2019-02-06 09:54:03 +00:00
|
|
|
CheckSetting(iniFile, gameID, "ForceMax60FPS", &flags_.ForceMax60FPS);
|
2022-07-02 17:14:05 +00:00
|
|
|
CheckSetting(iniFile, gameID, "Fixed60FPShack", &flags_.Fixed60FPShack);
|
2022-07-02 17:47:51 +00:00
|
|
|
CheckSetting(iniFile, gameID, "Fixed30FPShack", &flags_.Fixed30FPShack);
|
2019-03-01 09:55:43 +00:00
|
|
|
CheckSetting(iniFile, gameID, "JitInvalidationHack", &flags_.JitInvalidationHack);
|
2019-08-01 16:38:40 +00:00
|
|
|
CheckSetting(iniFile, gameID, "HideISOFiles", &flags_.HideISOFiles);
|
2019-08-05 04:37:33 +00:00
|
|
|
CheckSetting(iniFile, gameID, "MoreAccurateVMMUL", &flags_.MoreAccurateVMMUL);
|
2019-10-22 19:38:14 +00:00
|
|
|
CheckSetting(iniFile, gameID, "ForceSoftwareRenderer", &flags_.ForceSoftwareRenderer);
|
2019-10-23 22:10:39 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DarkStalkersPresentHack", &flags_.DarkStalkersPresentHack);
|
2020-10-05 18:26:04 +00:00
|
|
|
CheckSetting(iniFile, gameID, "ReportSmallMemstick", &flags_.ReportSmallMemstick);
|
2020-10-20 05:42:49 +00:00
|
|
|
CheckSetting(iniFile, gameID, "MemstickFixedFree", &flags_.MemstickFixedFree);
|
2020-10-11 08:19:06 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DateLimited", &flags_.DateLimited);
|
2020-11-07 22:20:34 +00:00
|
|
|
CheckSetting(iniFile, gameID, "ReinterpretFramebuffers", &flags_.ReinterpretFramebuffers);
|
2020-11-27 22:34:02 +00:00
|
|
|
CheckSetting(iniFile, gameID, "ShaderColorBitmask", &flags_.ShaderColorBitmask);
|
2020-12-20 11:59:44 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DisableFirstFrameReadback", &flags_.DisableFirstFrameReadback);
|
2020-12-26 18:56:49 +00:00
|
|
|
CheckSetting(iniFile, gameID, "DisableRangeCulling", &flags_.DisableRangeCulling);
|
2021-02-09 15:11:59 +00:00
|
|
|
CheckSetting(iniFile, gameID, "MpegAvcWarmUp", &flags_.MpegAvcWarmUp);
|
2022-04-24 18:53:09 +00:00
|
|
|
CheckSetting(iniFile, gameID, "BlueToAlpha", &flags_.BlueToAlpha);
|
2022-06-10 22:20:35 +00:00
|
|
|
CheckSetting(iniFile, gameID, "CenteredLines", &flags_.CenteredLines);
|
2022-04-16 21:47:05 +00:00
|
|
|
CheckSetting(iniFile, gameID, "MaliDepthStencilBugWorkaround", &flags_.MaliDepthStencilBugWorkaround);
|
2016-01-16 10:24:04 +00:00
|
|
|
}
|
|
|
|
|
2017-01-28 09:04:50 +00:00
|
|
|
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {
|
|
|
|
iniFile.Get(option, gameID.c_str(), flag, *flag);
|
2015-09-26 14:01:16 +00:00
|
|
|
}
|