Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/Config.h
5693 views
1
// Copyright (c) 2012- 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 <string_view>
22
#include <map>
23
#include <vector>
24
25
#include "ppsspp_config.h"
26
27
#include "Common/CommonTypes.h"
28
#include "Common/File/Path.h"
29
#include "Common/Math/geom2d.h"
30
#include "Core/ConfigValues.h"
31
32
extern const char *PPSSPP_GIT_VERSION;
33
34
namespace http {
35
class Request;
36
class RequestManager;
37
}
38
39
struct UrlEncoder;
40
41
class Section;
42
class IniFile;
43
44
class PlayTimeTracker {
45
public:
46
struct PlayTime {
47
int totalTimePlayed;
48
double startTime; // time_now_d() time
49
uint64_t lastTimePlayed; // UTC Unix time for portability.
50
};
51
52
// It's OK to call these redundantly.
53
void Start(std::string_view gameId);
54
void Stop(std::string_view gameId);
55
void Reset(std::string_view gameId);
56
57
void Load(const Section *section);
58
void Save(Section *section);
59
60
bool GetPlayedTimeString(std::string_view, std::string *str) const;
61
62
private:
63
std::map<std::string, PlayTime, std::less<>> tracker_;
64
};
65
66
struct ConfigSetting;
67
68
struct ConfigSectionMeta {
69
ConfigBlock *configBlock;
70
const ConfigSetting *settings;
71
size_t settingsCount;
72
std::string_view section;
73
std::string_view fallbackSectionName; // used if section is not found (useful when moving settings into a struct from Config).
74
};
75
76
struct DisplayLayoutConfig : public ConfigBlock {
77
int iDisplayFilter = SCALE_LINEAR; // 1 = linear, 2 = nearest
78
bool bDisplayStretch = false; // Automatically matches the aspect ratio of the window.
79
float fDisplayOffsetX = 0.5f;
80
float fDisplayOffsetY = 0.5f;
81
float fDisplayScale = 1.0f; // Relative to the most constraining axis (x or y).
82
bool bDisplayIntegerScale = false; // Snaps scaling to integer scale factors in raw pixels.
83
float fDisplayAspectRatio = 1.0f; // Stored relative to the PSP's native ratio, so 1.0 is the normal pixel aspect ratio.
84
int iInternalScreenRotation = ROTATION_LOCKED_HORIZONTAL; // The internal screen rotation angle. Useful for vertical SHMUPs and similar.
85
bool bRotateControlsWithScreen = true; // Rotate gamepad controls along with the internal screen rotation.
86
bool bIgnoreScreenInsets = true; // Android: Center screen disregarding insets if this is enabled.
87
88
// Deprecated
89
bool bEnableCardboardVR = false; // Cardboard Master Switch
90
int iCardboardScreenSize = 50; // Screen Size (in %)
91
int iCardboardXShift = 0; // X-Shift of Screen (in %)
92
int iCardboardYShift = 0; // Y-Shift of Screen (in %)
93
bool bImmersiveMode = false; // Mode on Android Kitkat 4.4 and later that hides the back button etc.
94
95
bool InternalRotationIsPortrait() const;
96
bool CanResetToDefault() const override { return true; }
97
bool ResetToDefault(std::string_view blockName) override;
98
size_t Size() const override { return sizeof(DisplayLayoutConfig); } // For sanity checks
99
};
100
101
struct TouchControlConfig : public ConfigBlock {
102
constexpr TouchControlConfig() {
103
// Hide all extras and custom buttons by default.
104
touchRightAnalogStick.show = false;
105
for (size_t i = 0; i < CUSTOM_BUTTON_COUNT; i++) {
106
touchCustom[i].show = false;
107
}
108
}
109
// the PSP button's center (triangle, circle, square, cross)
110
ConfigTouchPos touchActionButtonCenter;
111
// space between those PSP buttons
112
float fActionButtonSpacing = 1.0f;
113
// the D-pad (PSP cross) position
114
ConfigTouchPos touchDpad;
115
// And its spacing.
116
float fDpadSpacing = 1.0f;
117
118
ConfigTouchPos touchStartKey;
119
ConfigTouchPos touchSelectKey;
120
ConfigTouchPos touchFastForwardKey;
121
ConfigTouchPos touchLKey;
122
ConfigTouchPos touchRKey;
123
ConfigTouchPos touchAnalogStick;
124
ConfigTouchPos touchRightAnalogStick;
125
ConfigTouchPos touchPauseKey;
126
127
enum { CUSTOM_BUTTON_COUNT = 20 };
128
129
ConfigTouchPos touchCustom[CUSTOM_BUTTON_COUNT];
130
131
float fLeftStickHeadScale = 1.0f;
132
float fRightStickHeadScale = 1.0f;
133
134
bool bHideStickBackground = false;
135
136
bool bShowTouchCircle = true;
137
bool bShowTouchCross = true;
138
bool bShowTouchTriangle = true;
139
bool bShowTouchSquare = true;
140
141
void ResetLayout();
142
143
bool CanResetToDefault() const override { return true; }
144
bool ResetToDefault(std::string_view blockName) override;
145
size_t Size() const override { return sizeof(TouchControlConfig); } // For sanity checks
146
};
147
148
struct GestureControlConfig : public ConfigBlock {
149
// Motion gesture controller
150
bool bGestureControlEnabled = false;
151
int iSwipeUp = 0;
152
int iSwipeDown = 0;
153
int iSwipeLeft = 0;
154
int iSwipeRight = 0;
155
float fSwipeSensitivity = 1.0f;
156
float fSwipeSmoothing = 0.5f;
157
int iDoubleTapGesture = 0;
158
bool bAnalogGesture = false;
159
float fAnalogGestureSensitivity = 1.0f;
160
161
bool CanResetToDefault() const override { return true; }
162
bool ResetToDefault(std::string_view blockName) override;
163
size_t Size() const override { return sizeof(GestureControlConfig); } // For sanity checks
164
};
165
166
struct Config : public ConfigBlock {
167
public:
168
~Config();
169
170
void Init();
171
172
size_t Size() const override { return sizeof(Config); }
173
174
// Whether to save the config on close.
175
bool bSaveSettings;
176
bool bFirstRun;
177
bool bUpdatedInstanceCounter = false;
178
179
int iRunCount; // To be used to for example check for updates every 10 runs and things like that.
180
181
// Debugger
182
bool bAutoRun; // start immediately
183
bool bBreakOnFrameTimeout; // not saved
184
185
// General
186
bool bScreenshotsAsPNG;
187
bool bUseFFV1;
188
bool bDumpFrames;
189
bool bDumpVideoOutput;
190
bool bDumpAudio;
191
bool bSaveLoadResetsAVdumping;
192
bool bEnableLogging;
193
bool bEnableFileLogging;
194
int iLogOutputTypes; // enum class LogOutput
195
int iDumpFileTypes; // DumpFileType bitflag enum
196
bool bFullscreenOnDoubleclick;
197
198
// These four are Win UI only
199
bool bPauseOnLostFocus;
200
bool bTopMost;
201
bool bIgnoreWindowsKey;
202
bool bRestartRequired;
203
204
bool bPauseWhenMinimized;
205
206
bool bPauseExitsEmulator;
207
bool bPauseMenuExitsEmulator;
208
209
bool bRunBehindPauseMenu;
210
211
// Core
212
bool bIgnoreBadMemAccess;
213
214
bool bFastMemory;
215
int iCpuCore;
216
bool bCheckForNewVersion;
217
bool bForceLagSync;
218
bool bFuncReplacements;
219
bool bHideSlowWarnings;
220
bool bHideStateWarnings;
221
uint32_t uJitDisableFlags;
222
223
bool bDisableHTTPS;
224
225
bool bShrinkIfWindowSmall;
226
bool bSeparateSASThread;
227
int iIOTimingMethod;
228
int iLockedCPUSpeed;
229
bool bAutoSaveSymbolMap;
230
bool bCompressSymbols;
231
bool bCacheFullIsoInRam;
232
int iRemoteISOPort; // Also used for serving a local remote debugger.
233
std::string sLastRemoteISOServer;
234
int iLastRemoteISOPort;
235
bool bRemoteISOManual;
236
bool bRemoteShareOnStartup;
237
std::string sRemoteISOSubdir;
238
std::string sRemoteISOSharedDir;
239
int iRemoteISOShareType;
240
bool bRemoteDebuggerOnStartup;
241
bool bRemoteDebuggerLocal;
242
bool bRemoteTab;
243
bool bMemStickInserted;
244
int iMemStickSizeGB;
245
bool bLoadPlugins;
246
int iAskForExitConfirmationAfterSeconds;
247
int iUIScaleFactor; // In 8ths of powers of two.
248
int iDisableHLE;
249
int iForceEnableHLE; // This is the opposite of DisableHLE but can force on HLE even when we've made it permanently off. Only used in tests, not hooked up to the ini file yet.
250
251
int iScreenRotation; // Screen rotation lock. Only supported on Android and possibly other mobile platforms.
252
253
std::string sReportHost;
254
std::vector<std::string> vPinnedPaths;
255
std::string sLanguageIni;
256
257
std::string sIgnoreCompatSettings;
258
259
bool bDiscordRichPresence; // Enables setting the Discord presence to the current game (or menu)
260
261
// GFX
262
int iGPUBackend;
263
std::string sCustomDriver;
264
std::string sFailedGPUBackends; // NOT stored in ppsspp.ini anymore!
265
std::string sDisabledGPUBackends;
266
// We have separate device parameters for each backend so it doesn't get erased if you switch backends.
267
// If not set, will use the "best" device.
268
std::string sVulkanDevice;
269
std::string sD3D11Device; // Windows only
270
std::string sCameraDevice;
271
std::string sMicDevice;
272
bool bCameraMirrorHorizontal;
273
int iDisplayFramerateMode; // enum DisplayFramerateMode. Android-only.
274
int iDisplayRefreshRate = 60;
275
276
// These two combined choose the presentation mode.
277
// vsync = false: Immediate
278
// vsync = true, low latency present = true: Mailbox
279
// vsync = true, low latency present = false: FIFO
280
bool bVSync;
281
bool bLowLatencyPresent;
282
283
bool bSoftwareRendering;
284
bool bSoftwareRenderingJit;
285
bool bHardwareTransform; // only used in the GLES backend
286
bool bSoftwareSkinning;
287
bool bVendorBugChecksEnabled;
288
bool bUseGeometryShader;
289
290
// Speedhacks (more will be moved here):
291
bool bSkipBufferEffects;
292
bool bDisableRangeCulling;
293
int iDepthRasterMode;
294
295
int iTexFiltering; // 1 = auto , 2 = nearest , 3 = linear , 4 = auto max quality
296
bool bSmart2DTexFiltering;
297
298
// We'll carry over the old single layout into landscape for now.
299
DisplayLayoutConfig displayLayoutLandscape;
300
DisplayLayoutConfig displayLayoutPortrait;
301
302
bool bDisplayCropTo16x9; // Crops to 16:9 if the resolution is very close.
303
304
bool bSustainedPerformanceMode; // Android: Slows clocks down to avoid overheating/speed fluctuations.
305
306
bool bShowImDebugger;
307
308
int iFrameSkip;
309
bool bAutoFrameSkip;
310
311
int iWindowX;
312
int iWindowY;
313
int iWindowWidth; // Windows and other windowed environments
314
int iWindowHeight;
315
int iWindowSizeState; // WindowSizeState enum
316
317
bool bShowMenuBar; // Windows-only
318
319
float fUITint;
320
float fUISaturation;
321
322
bool bTextureBackoffCache;
323
bool bVertexDecoderJit;
324
int iAppSwitchMode;
325
bool bFullScreen;
326
bool bFullScreenMulti;
327
int iInternalResolution; // 0 = Auto (native), 1 = 1x (480x272), 2 = 2x, 3 = 3x, 4 = 4x and so on.
328
int iAnisotropyLevel; // 0 - 5, powers of 2: 0 = 1x = no aniso
329
int iMultiSampleLevel;
330
int bHighQualityDepth;
331
bool bReplaceTextures;
332
bool bSaveNewTextures;
333
int iReplacementTextureLoadSpeed;
334
bool bIgnoreTextureFilenames;
335
int iTexScalingLevel; // 0 = auto, 1 = off, 2 = 2x, ..., 5 = 5x
336
int iTexScalingType; // 0 = xBRZ, 1 = Hybrid
337
bool bTexDeposterize;
338
bool bTexHardwareScaling;
339
int iFpsLimit1;
340
int iFpsLimit2;
341
int iAnalogFpsLimit;
342
int iMaxRecent;
343
int iCurrentStateSlot;
344
int iRewindSnapshotInterval;
345
bool bUISound;
346
bool bEnableStateUndo;
347
std::string sStateLoadUndoGame;
348
std::string sStateUndoLastSaveGame;
349
int iStateUndoLastSaveSlot;
350
int iAutoLoadSaveState; // 0 = off, 1 = oldest (deprecated), 2 = newest, 3+ = slot number + 3 (up to 5)
351
int iSaveStateSlotCount;
352
bool bEnableCheats;
353
bool bReloadCheats;
354
bool bEnablePlugins;
355
int iCwCheatRefreshIntervalMs;
356
float fCwCheatScrollPosition;
357
float fGameListScrollPosition;
358
float fHomebrewScrollPosition;
359
float fRemoteScrollPosition;
360
int iBloomHack; //0 = off, 1 = safe, 2 = balanced, 3 = aggressive
361
int iSkipGPUReadbackMode; // 0 = off, 1 = skip, 2 = to texture
362
int iSplineBezierQuality; // 0 = low , 1 = Intermediate , 2 = High
363
bool bHardwareTessellation;
364
bool bShaderCache; // Hidden ini-only setting, useful for debugging shader compile times.
365
bool bUberShaderVertex;
366
bool bUberShaderFragment;
367
int iDefaultTab;
368
int iScreenshotMode;
369
bool bVulkanDisableImplicitLayers;
370
bool bForceFfmpegForAudioDec;
371
372
std::vector<std::string> vPostShaderNames; // Off for chain end (only Off for no shader)
373
std::map<std::string, float> mPostShaderSetting;
374
375
// Note that this is separate from VR stereo, though it'll share some code paths.
376
bool bStereoRendering;
377
// There can only be one, unlike regular post shaders.
378
std::string sStereoToMonoShader;
379
380
bool bShaderChainRequires60FPS;
381
std::string sTextureShaderName;
382
bool bGfxDebugOutput;
383
int iInflightFrames;
384
bool bRenderDuplicateFrames;
385
bool bRenderMultiThreading;
386
387
// HW debug
388
bool bShowGPOLEDs;
389
390
// Sound
391
bool bEnableSound;
392
int iSDLAudioBufferSize;
393
int iAudioBufferSize;
394
bool bFillAudioGaps;
395
int iAudioPlaybackMode;
396
397
// Legacy volume settings, 0-10. These get auto-upgraded and should not be used.
398
int iLegacyGameVolume;
399
int iLegacyReverbVolume;
400
int iLegacyAchievementVolume;
401
402
// Newer volume settings, 0-100
403
int iGameVolume;
404
int iReverbVolume;
405
int iUIVolume;
406
int iGamePreviewVolume; // Volume for the game preview sound in the game grid.
407
int iAchievementVolume;
408
int iAltSpeedVolume;
409
410
bool bExtraAudioBuffering; // For bluetooth
411
std::string sAudioDevice;
412
bool bAutoAudioDevice;
413
bool bUseOldAtrac;
414
415
// iOS only for now
416
bool bAudioMixWithOthers;
417
bool bAudioRespectSilentMode;
418
419
// UI
420
bool bShowDebuggerOnLoad;
421
int iShowStatusFlags;
422
bool bShowRegionOnGameIcon;
423
bool bShowIDOnGameIcon;
424
float fGameGridScale;
425
int iBackgroundAnimation; // enum BackgroundAnimation
426
bool bTransparentBackground;
427
428
std::string sThemeName;
429
430
// These aren't saved, just for instant debugging.
431
bool bLogFrameDrops;
432
433
// Analog stick tilting
434
// This is the held base angle (from the horizon), that we compute the tilt relative from.
435
float fTiltBaseAngleY;
436
// Inverts the direction of the x axes and y axes for the purposes of tilt input.
437
bool bInvertTiltX;
438
bool bInvertTiltY;
439
// The sensitivity of the tilt in the X and Y directions, separately.
440
int iTiltSensitivityX;
441
int iTiltSensitivityY;
442
// The deadzone radius of the tilt. Only used in the analog mapping.
443
float fTiltAnalogDeadzoneRadius;
444
float fTiltInverseDeadzone; // An inverse deadzone for the output, counteracting excessive deadzones applied by games. See #17483.
445
bool bTiltCircularDeadzone;
446
// Type of tilt input currently selected: Defined in TiltEventProcessor.h
447
// 0 - no tilt, 1 - analog stick, 2 - D-Pad, 3 - Action Buttons (Tri, Cross, Square, Circle)
448
int iTiltInputType;
449
bool bTiltInputEnabled;
450
451
// The four tabs (including Remote last)
452
bool bGridView1;
453
bool bGridView2;
454
bool bGridView3;
455
bool bGridView4;
456
457
// Right analog binding
458
int iRightAnalogUp;
459
int iRightAnalogDown;
460
int iRightAnalogLeft;
461
int iRightAnalogRight;
462
int iRightAnalogPress;
463
bool bRightAnalogCustom;
464
bool bRightAnalogDisableDiagonal;
465
466
// 0 for left, 1 for right
467
GestureControlConfig gestureControls[2];
468
469
// Controls Visibility
470
bool bShowTouchControls = false;
471
472
// Disable diagonals
473
bool bDisableDpadDiagonals;
474
bool bGamepadOnlyFocused;
475
476
// Control Style
477
int iTouchButtonStyle;
478
int iTouchButtonOpacity;
479
int iTouchButtonHideSeconds;
480
481
// Snap touch control position
482
bool bTouchSnapToGrid;
483
int iTouchSnapGridSize;
484
485
// Floating analog stick (recenters on thumb on press).
486
bool bAutoCenterTouchAnalog;
487
488
// Sticky D-pad (can't glide off it)
489
bool bStickyTouchDPad;
490
491
// Touch gliding (see #14490)
492
bool bTouchGliding;
493
494
TouchControlConfig touchControlsLandscape;
495
TouchControlConfig touchControlsPortrait;
496
497
// These are shared between portrait and landscape, just the positions aren't.
498
ConfigCustomButton CustomButton[TouchControlConfig::CUSTOM_BUTTON_COUNT];
499
500
// Ignored on iOS and other platforms that lack pause.
501
bool bShowTouchPause;
502
503
bool bHapticFeedback;
504
505
// We also use the XInput settings as analog settings on other platforms like Android.
506
float fAnalogDeadzone;
507
float fAnalogInverseDeadzone;
508
float fAnalogSensitivity;
509
// convert analog stick circle to square
510
bool bAnalogIsCircular;
511
// Auto rotation speed
512
float fAnalogAutoRotSpeed;
513
514
// Sets up how much the analog limiter button restricts digital->analog input.
515
float fAnalogLimiterDeadzone;
516
517
// Trigger configuration
518
float fAnalogTriggerThreshold;
519
520
// Sets whether combo mapping is enabled.
521
bool bAllowMappingCombos;
522
bool bStrictComboOrder;
523
524
bool bMouseControl;
525
bool bMouseConfine; // Trap inside the window.
526
float fMouseSensitivity;
527
float fMouseSmoothing;
528
int iMouseWheelUpDelayMs;
529
530
bool bSystemControls;
531
int iRapidFireInterval;
532
533
// Use the hardware scaler to scale up the image to save fillrate. Similar to Windows' window size, really.
534
int iAndroidHwScale; // 0 = device resolution. 1 = 480x272 (extended to correct aspect), 2 = 960x544 etc.
535
536
// Risky JIT optimizations
537
bool bDiscardRegsOnJRRA;
538
539
// SystemParam
540
std::string sNickName; // AdHoc and system nickname
541
std::string sMACAddress;
542
543
int iLanguage;
544
int iTimeFormat;
545
int iDateFormat;
546
int iTimeZone;
547
bool bDayLightSavings;
548
int iButtonPreference;
549
int iLockParentalLevel;
550
bool bEncryptSave;
551
552
// Networking
553
bool bEnableAdhocServer;
554
std::string sProAdhocServer;
555
bool bUseServerRelay;
556
std::vector<std::string> proAdhocServerList;
557
std::string sInfrastructureDNSServer;
558
std::string sInfrastructureUsername; // Username used for Infrastructure play. Different restrictions.
559
bool bInfrastructureAutoDNS;
560
bool bAllowSavestateWhileConnected; // Developer option, ini-only. No normal users need this, it's always wrong to save/load state when online.
561
bool bAllowSpeedControlWhileConnected; // Useful in some games but not recommended.
562
563
bool bEnableWlan;
564
std::map<std::string, std::string> mHostToAlias; // Local DNS database stored in ini file
565
bool bEnableUPnP;
566
bool bUPnPUseOriginalPort;
567
bool bForcedFirstConnect;
568
int iPortOffset;
569
int iMinTimeout;
570
int iWlanAdhocChannel;
571
bool bWlanPowerSave;
572
bool bEnableNetworkChat;
573
bool bDontDownloadInfraJson;
574
int iChatButtonPosition;
575
int iChatScreenPosition;
576
577
bool bEnableQuickChat;
578
std::string sQuickChat[5];
579
580
int iPSPModel;
581
int iFirmwareVersion;
582
bool bBypassOSKWithKeyboard;
583
584
585
// Virtual reality
586
bool bEnableVR;
587
bool bEnable6DoF;
588
bool bEnableStereo;
589
bool bEnableImmersiveVR;
590
bool bForce72Hz;
591
bool bForceVR;
592
bool bManualForceVR;
593
bool bPassthrough;
594
bool bRescaleHUD;
595
float fCameraDistance;
596
float fCameraHeight;
597
float fCameraSide;
598
float fCameraPitch;
599
float fCanvasDistance;
600
float fCanvas3DDistance;
601
float fFieldOfViewPercentage;
602
float fHeadUpDisplayScale;
603
604
// Debugger
605
int iDisasmWindowX;
606
int iDisasmWindowY;
607
int iDisasmWindowW;
608
int iDisasmWindowH;
609
int iGEWindowX;
610
int iGEWindowY;
611
int iGEWindowW;
612
int iGEWindowH;
613
uint32_t uGETabsLeft;
614
uint32_t uGETabsRight;
615
uint32_t uGETabsTopRight;
616
int iConsoleWindowX;
617
int iConsoleWindowY;
618
int iFontWidth;
619
int iFontHeight;
620
bool bDisplayStatusBar;
621
bool bShowBottomTabTitles;
622
bool bShowDeveloperMenu;
623
624
// Double edged sword: much easier debugging, but not accurate.
625
bool bSkipDeadbeefFilling;
626
627
bool bFuncHashMap;
628
std::string sSkipFuncHashMap;
629
bool bDebugMemInfoDetailed;
630
631
// Volatile development settings
632
// Overlays
633
int iDebugOverlay;
634
635
bool bGpuLogProfiler; // Controls the Vulkan logging profiler (profiles textures uploads etc).
636
637
// Retro Achievement settings
638
// Copied from Duckstation, we might want to remove some.
639
bool bAchievementsEnable;
640
bool bAchievementsHardcoreMode;
641
bool bAchievementsEncoreMode;
642
bool bAchievementsUnofficial;
643
bool bAchievementsSoundEffects;
644
bool bAchievementsLogBadMemReads;
645
bool bAchievementsSaveStateInHardcoreMode;
646
bool bAchievementsEnableRAIntegration;
647
648
// Positioning of the various notifications
649
int iNotificationPos;
650
int iAchievementsLeaderboardTrackerPos;
651
int iAchievementsLeaderboardStartedOrFailedPos;
652
int iAchievementsLeaderboardSubmittedPos;
653
int iAchievementsProgressPos;
654
int iAchievementsChallengePos;
655
int iAchievementsUnlockedPos;
656
657
// Customizations
658
std::string sAchievementsUnlockAudioFile;
659
std::string sAchievementsLeaderboardSubmitAudioFile;
660
661
// Achievements login info. Note that password is NOT stored, only a login token.
662
// Still, we may wanna store it more securely than in PPSSPP.ini, especially on Android.
663
std::string sAchievementsUserName;
664
std::string sAchievementsToken; // Not saved, to be used if you want to manually make your RA login persistent. See Native_SaveSecret for the normal case.
665
std::string sAchievementsHost; // Optional custom host for debugging against alternate RA servers.
666
667
// Various directories. Autoconfigured, not read from ini.
668
Path currentDirectory; // The directory selected in the game browsing window.
669
Path defaultCurrentDirectory; // Platform dependent, initialized at startup.
670
671
Path memStickDirectory;
672
Path flash0Directory;
673
Path internalDataDirectory;
674
Path appCacheDirectory;
675
676
Path mountRoot; // Actually, mount as host0. keeping consistent with headless args.
677
678
void Load(const char *iniFileName = nullptr, const char *controllerIniFilename = nullptr);
679
bool Save(const char *saveReason);
680
void Reload();
681
void RestoreDefaults(RestoreSettingsBits whatToRestore, bool log = false);
682
683
// Note: This doesn't switch to the config, just creates it.
684
bool CreateGameConfig(std::string_view gameId);
685
bool DeleteGameConfig(std::string_view gameId);
686
bool LoadGameConfig(const std::string &gameId);
687
bool SaveGameConfig(const std::string &pGameId, std::string_view titleForComment);
688
void UnloadGameConfig();
689
690
bool HasGameConfig(std::string_view gameId);
691
bool IsGameSpecific() const { return !gameId_.empty(); }
692
693
void SetSearchPath(const Path &path);
694
695
void UpdateIniLocation(const char *iniFileName = nullptr, const char *controllerIniFilename = nullptr);
696
697
void GetReportingInfo(UrlEncoder &data) const;
698
699
int NextValidBackend();
700
bool IsBackendEnabled(GPUBackend backend);
701
702
bool LoadAppendedConfig();
703
void SetAppendedConfigIni(const Path &path) { appendedConfigFileName_ = path; }
704
void UpdateAfterSettingAutoFrameSkip();
705
void NotifyUpdatedCpuCore();
706
707
PlayTimeTracker &TimeTracker() { return playTimeTracker_; }
708
709
const DisplayLayoutConfig &GetDisplayLayoutConfig(DeviceOrientation orientation) const {
710
return orientation == DeviceOrientation::Portrait ? displayLayoutPortrait : displayLayoutLandscape;
711
}
712
DisplayLayoutConfig &GetDisplayLayoutConfig(DeviceOrientation orientation) {
713
return orientation == DeviceOrientation::Portrait ? displayLayoutPortrait : displayLayoutLandscape;
714
}
715
const TouchControlConfig &GetTouchControlsConfig(DeviceOrientation orientation) const {
716
return orientation == DeviceOrientation::Portrait ? touchControlsPortrait : touchControlsLandscape;
717
}
718
TouchControlConfig &GetTouchControlsConfig(DeviceOrientation orientation) {
719
return orientation == DeviceOrientation::Portrait ? touchControlsPortrait : touchControlsLandscape;
720
}
721
722
static int GetDefaultValueInt(int *configSetting);
723
724
void DoNotSaveSetting(void *configSetting) {
725
settingsNotToSave_.push_back(configSetting);
726
}
727
728
private:
729
void LoadStandardControllerIni();
730
731
void PostLoadCleanup();
732
void PreSaveCleanup();
733
void PostSaveCleanup();
734
735
friend struct ConfigSetting;
736
737
static std::map<const void *, std::pair<const ConfigBlock *, const ConfigSetting *>> &getPtrLUT();
738
739
// Applies defaults for missing settings.
740
void ReadAllSettings(const IniFile &iniFile);
741
742
bool inReload_ = false;
743
744
// If not empty, we're using a game-specific config.
745
std::string gameId_;
746
747
PlayTimeTracker playTimeTracker_;
748
749
// Always the paths to the main configs, doesn't change with game-specific overlay.
750
Path iniFilename_;
751
Path controllerIniFilename_;
752
753
Path searchPath_;
754
Path appendedConfigFileName_;
755
// A set make more sense, but won't have many entry, and I dont want to include the whole std::set header here
756
std::vector<std::string> appendedConfigUpdatedGames_;
757
std::vector<void *> settingsNotToSave_;
758
759
bool ShouldSaveSetting(const void *configSetting) const;
760
};
761
762
std::string CreateRandMAC();
763
764
// TODO: Find a better place for this.
765
extern http::RequestManager g_DownloadManager;
766
extern Config g_Config;
767
768
769