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/.
|
|
|
|
|
|
|
|
#include "file/ini_file.h"
|
|
|
|
#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.
|
|
|
|
std::string path = GetSysDirectory(DIRECTORY_SYSTEM) + "compat.ini";
|
|
|
|
if (compat2.Load(path)) {
|
|
|
|
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);
|
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
|
|
|
}
|