Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/Compatibility.h
5659 views
1
// Copyright (c) 2015- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include <string>
21
#include <cstdint>
22
#include <set>
23
24
// Compatibility flags are controlled by assets/compat.ini.
25
// Alternatively, if PSP/System/compat.ini exists, it is merged on top, to enable editing
26
// the file on Android for tests.
27
//
28
// This file is not meant to be user-editable, although is kept as a separate ini
29
// file instead of compiled into the code for debugging purposes.
30
//
31
// The uses cases are strict:
32
// * Enable fixes for things we can't reasonably emulate without completely ruining
33
// performance for other games, such as the screen copies in Dangan Ronpa
34
// * Disabling accuracy features like 16-bit depth rounding, when we can't seem to
35
// implement them at all in a 100% compatible way
36
// * Emergency game-specific compatibility fixes before releases, such as the GTA
37
// music problem where every attempted fix has reduced compatibility with other games
38
// * Enable "unsafe" performance optimizations that some games can tolerate and
39
// others cannot. We do not currently have any of those.
40
//
41
// This functionality should NOT be used for any of the following:
42
// * Cheats
43
// * Fun hacks, like enlarged heads or whatever
44
// * Fixing general compatibility issues. First try to find a general solution. Try hard.
45
//
46
// We already have the Action Replay-based cheat system for such use cases.
47
48
// TODO: Turn into bitfield for smaller mem footprint.
49
struct CompatFlags {
50
bool VertexDepthRounding;
51
bool PixelDepthRounding;
52
bool DepthRangeHack;
53
bool ClearToRAM;
54
bool Force04154000Download;
55
bool DrawSyncEatCycles;
56
bool DrawSyncInstant;
57
bool FakeMipmapChange;
58
bool RequireBufferedRendering;
59
bool RequireBlockTransfer;
60
bool RequireDefaultCPUClock;
61
bool DisableAccurateDepth;
62
bool MGS2AcidHack;
63
bool SonicRivalsHack;
64
bool BlockTransferAllowCreateFB;
65
bool IntraVRAMBlockTransferAllowCreateFB;
66
bool YugiohSaveFix;
67
bool ForceUMDDelay;
68
bool ForceMax60FPS;
69
bool GoWFramerateHack60;
70
bool FramerateHack30;
71
bool JitInvalidationHack;
72
bool HideISOFiles;
73
bool MoreAccurateVMMUL;
74
bool ForceSoftwareRenderer;
75
bool DarkStalkersPresentHack;
76
bool ReportSmallMemstick;
77
bool MemstickFixedFree;
78
bool DateLimited;
79
bool ShaderColorBitmask;
80
bool DisableFirstFrameReadback;
81
bool MpegAvcWarmUp;
82
bool BlueToAlpha;
83
bool CenteredLines;
84
bool MaliDepthStencilBugWorkaround;
85
bool ZZT3SelectHack;
86
bool AllowLargeFBTextureOffsets;
87
bool AtracLoopHack;
88
bool DeswizzleDepth;
89
bool SplitFramebufferMargin;
90
bool ForceLowerResolutionForEffectsOn;
91
bool ForceLowerResolutionForEffectsOff;
92
bool AllowDownloadCLUT;
93
bool NearestFilteringOnFramebufferCreate;
94
bool SecondaryTextureCache;
95
bool EnglishOrJapaneseOnly;
96
bool OldAdrenoPixelDepthRoundingGL;
97
bool ForceCircleButtonConfirm;
98
bool DisallowFramebufferAtOffset;
99
bool RockmanDash2SoundFix;
100
bool ReadbackDepth;
101
bool BlockTransferDepth;
102
bool DaxterRotatedAnalogStick;
103
bool ForceMaxDepthResolution;
104
bool SOCOMClut8Replacement;
105
bool Fontltn12Hack;
106
bool LoadCLUTFromCurrentFrameOnly;
107
bool ForceUMDReadSpeed;
108
bool KernelGetSystemTimeLowEatMoreCycles;
109
bool TacticsOgreEliminateDebugReadback;
110
bool FramebufferAllowLargeVerticalOffset;
111
bool DisableMemcpySlicing;
112
bool ForceEnableGPUReadback;
113
bool UseFFMPEGFindStreamInfo;
114
bool SoftwareRasterDepth;
115
bool DisableHLESceFont;
116
bool ForceHLEPsmf;
117
bool SaveStatesNotRecommended;
118
bool IgnoreEnqueue;
119
bool MsgDialogAutoStatus;
120
bool NullPageValid;
121
bool DetectDestBlendSquared;
122
bool BoostExactFramebufferMatch;
123
};
124
125
struct VRCompat {
126
bool ForceMono;
127
bool ForceFlatScreen;
128
bool IdentityViewHack;
129
int MirroringVariant;
130
bool ProjectionHack;
131
bool Skyplane;
132
float UnitsPerMeter;
133
};
134
135
class IniFile;
136
137
class Compatibility {
138
public:
139
Compatibility() {
140
Clear();
141
}
142
143
// Flags enforced read-only through const. Only way to change them is to load assets/compat.ini.
144
const CompatFlags &flags() const { return flags_; }
145
146
const VRCompat &vrCompat() const { return vrCompat_; }
147
148
void Load(const std::string &gameID);
149
150
const std::string &GetActiveFlagsString() const {
151
return activeList_;
152
}
153
154
private:
155
void Clear();
156
void CheckSettings(IniFile &iniFile, const std::string &gameID);
157
void CheckVRSettings(IniFile &iniFile, const std::string &gameID);
158
void CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag);
159
void CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, float *value);
160
void CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, int *value);
161
162
CompatFlags flags_{};
163
VRCompat vrCompat_{};
164
std::set<std::string> ignored_;
165
std::string activeList_;
166
};
167
168