CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/Compatibility.h
Views: 1401
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. Though I think it still fits in a cacheline...
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 AllowDelayedReadbacks;
109
bool KernelGetSystemTimeLowEatMoreCycles;
110
bool TacticsOgreEliminateDebugReadback;
111
bool FramebufferAllowLargeVerticalOffset;
112
bool DisableMemcpySlicing;
113
bool ForceEnableGPUReadback;
114
bool UseFFMPEGFindStreamInfo;
115
};
116
117
struct VRCompat {
118
bool ForceMono;
119
bool ForceFlatScreen;
120
bool IdentityViewHack;
121
int MirroringVariant;
122
bool ProjectionHack;
123
bool Skyplane;
124
float UnitsPerMeter;
125
};
126
127
class IniFile;
128
129
class Compatibility {
130
public:
131
Compatibility() {
132
Clear();
133
}
134
135
// Flags enforced read-only through const. Only way to change them is to load assets/compat.ini.
136
const CompatFlags &flags() const { return flags_; }
137
138
const VRCompat &vrCompat() const { return vrCompat_; }
139
140
void Load(const std::string &gameID);
141
142
private:
143
void Clear();
144
void CheckSettings(IniFile &iniFile, const std::string &gameID);
145
void CheckVRSettings(IniFile &iniFile, const std::string &gameID);
146
void CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag);
147
void CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, float *value);
148
void CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, int *value);
149
150
CompatFlags flags_{};
151
VRCompat vrCompat_{};
152
std::set<std::string> ignored_;
153
};
154
155