CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Core/Config.h
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include <string>20#include <map>21#include <vector>2223#include "ppsspp_config.h"2425#include "Common/CommonTypes.h"26#include "Common/File/Path.h"27#include "Core/ConfigValues.h"2829extern const char *PPSSPP_GIT_VERSION;3031namespace http {32class Request;33class RequestManager;34}3536struct UrlEncoder;37struct ConfigPrivate;3839class Section;4041class PlayTimeTracker {42public:43struct PlayTime {44int totalTimePlayed;45double startTime; // time_now_d() time46uint64_t lastTimePlayed; // UTC Unix time for portability.47};4849// It's OK to call these redundantly.50void Start(const std::string &gameId);51void Stop(const std::string &gameId);5253void Load(const Section *section);54void Save(Section *section);5556bool GetPlayedTimeString(const std::string &gameId, std::string *str) const;5758private:59std::map<std::string, PlayTime> tracker_;60};6162struct Config {63public:64Config();65~Config();6667// Whether to save the config on close.68bool bSaveSettings;69bool bFirstRun;70bool bGameSpecific = false;71bool bUpdatedInstanceCounter = false;7273int iRunCount; // To be used to for example check for updates every 10 runs and things like that.7475bool bAutoRun; // start immediately76bool bBrowse; // when opening the emulator, immediately show a file browser7778// General79bool bScreenshotsAsPNG;80bool bUseFFV1;81bool bDumpFrames;82bool bDumpVideoOutput;83bool bDumpAudio;84bool bSaveLoadResetsAVdumping;85bool bEnableLogging;86bool bDumpDecryptedEboot;87bool bFullscreenOnDoubleclick;8889// These four are Win UI only90bool bPauseOnLostFocus;91bool bTopMost;92bool bIgnoreWindowsKey;93bool bRestartRequired;9495std::string sFont;9697bool bPauseWhenMinimized;9899bool bPauseExitsEmulator;100bool bPauseMenuExitsEmulator;101102bool bRunBehindPauseMenu;103104// Core105bool bIgnoreBadMemAccess;106107bool bFastMemory;108int iCpuCore;109bool bCheckForNewVersion;110bool bForceLagSync;111bool bFuncReplacements;112bool bHideSlowWarnings;113bool bHideStateWarnings;114bool bPreloadFunctions;115uint32_t uJitDisableFlags;116117bool bDisableHTTPS;118119bool bSeparateSASThread;120int iIOTimingMethod;121int iLockedCPUSpeed;122bool bAutoSaveSymbolMap;123bool bCacheFullIsoInRam;124int iRemoteISOPort;125std::string sLastRemoteISOServer;126int iLastRemoteISOPort;127bool bRemoteISOManual;128bool bRemoteShareOnStartup;129std::string sRemoteISOSubdir;130std::string sRemoteISOSharedDir;131int iRemoteISOShareType;132bool bRemoteDebuggerOnStartup;133bool bRemoteTab;134bool bMemStickInserted;135int iMemStickSizeGB;136bool bLoadPlugins;137138int iScreenRotation; // The rotation angle of the PPSSPP UI. Only supported on Android and possibly other mobile platforms.139int iInternalScreenRotation; // The internal screen rotation angle. Useful for vertical SHMUPs and similar.140141std::string sReportHost;142std::vector<std::string> vPinnedPaths;143std::string sLanguageIni;144145std::string sIgnoreCompatSettings;146147bool bDiscordPresence; // Enables setting the Discord presence to the current game (or menu)148149// GFX150int iGPUBackend;151std::string sCustomDriver;152std::string sFailedGPUBackends;153std::string sDisabledGPUBackends;154// We have separate device parameters for each backend so it doesn't get erased if you switch backends.155// If not set, will use the "best" device.156std::string sVulkanDevice;157std::string sD3D11Device; // Windows only158std::string sCameraDevice;159std::string sMicDevice;160bool bCameraMirrorHorizontal;161int iDisplayFramerateMode; // enum DisplayFramerateMode. Android-only.162int iDisplayRefreshRate = 60;163164bool bSoftwareRendering;165bool bSoftwareRenderingJit;166bool bHardwareTransform; // only used in the GLES backend167bool bSoftwareSkinning;168bool bVendorBugChecksEnabled;169bool bUseGeometryShader;170171// Speedhacks (more will be moved here):172bool bSkipBufferEffects;173bool bDisableRangeCulling;174175int iTexFiltering; // 1 = auto , 2 = nearest , 3 = linear , 4 = auto max quality176bool bSmart2DTexFiltering;177178bool bDisplayStretch; // Automatically matches the aspect ratio of the window.179int iDisplayFilter; // 1 = linear, 2 = nearest180float fDisplayOffsetX;181float fDisplayOffsetY;182float fDisplayScale; // Relative to the most constraining axis (x or y).183bool bDisplayIntegerScale; // Snaps scaling to integer scale factors in raw pixels.184bool bDisplayCropTo16x9; // Crops to 16:9 if the resolution is very close.185float fDisplayAspectRatio; // Stored relative to the PSP's native ratio, so 1.0 is the normal pixel aspect ratio.186187bool bImmersiveMode; // Mode on Android Kitkat 4.4 and later that hides the back button etc.188bool bSustainedPerformanceMode; // Android: Slows clocks down to avoid overheating/speed fluctuations.189bool bIgnoreScreenInsets; // Android: Center screen disregarding insets if this is enabled.190bool bVSync;191192int iFrameSkip;193int iFrameSkipType;194int iFastForwardMode; // See FastForwardMode in ConfigValues.h.195bool bAutoFrameSkip;196197bool bEnableCardboardVR; // Cardboard Master Switch198int iCardboardScreenSize; // Screen Size (in %)199int iCardboardXShift; // X-Shift of Screen (in %)200int iCardboardYShift; // Y-Shift of Screen (in %)201202int iWindowX;203int iWindowY;204int iWindowWidth; // Windows and other windowed environments205int iWindowHeight;206bool bShowMenuBar; // Windows-only207208float fUITint;209float fUISaturation;210211bool bTextureBackoffCache;212bool bVertexDecoderJit;213int iAppSwitchMode;214bool bFullScreen;215bool bFullScreenMulti;216int iForceFullScreen = -1; // -1 = nope, 0 = force off, 1 = force on (not saved.)217int iInternalResolution; // 0 = Auto (native), 1 = 1x (480x272), 2 = 2x, 3 = 3x, 4 = 4x and so on.218int iAnisotropyLevel; // 0 - 5, powers of 2: 0 = 1x = no aniso219int iMultiSampleLevel;220int bHighQualityDepth;221bool bReplaceTextures;222bool bSaveNewTextures;223bool bIgnoreTextureFilenames;224int iTexScalingLevel; // 0 = auto, 1 = off, 2 = 2x, ..., 5 = 5x225int iTexScalingType; // 0 = xBRZ, 1 = Hybrid226bool bTexDeposterize;227bool bTexHardwareScaling;228int iFpsLimit1;229int iFpsLimit2;230int iAnalogFpsLimit;231int iMaxRecent;232int iCurrentStateSlot;233int iRewindSnapshotInterval;234bool bUISound;235bool bEnableStateUndo;236std::string sStateLoadUndoGame;237std::string sStateUndoLastSaveGame;238int iStateUndoLastSaveSlot;239int iAutoLoadSaveState; // 0 = off, 1 = oldest, 2 = newest, >2 = slot number + 3240bool bEnableCheats;241bool bReloadCheats;242bool bEnablePlugins;243int iCwCheatRefreshIntervalMs;244float fCwCheatScrollPosition;245float fGameListScrollPosition;246int iBloomHack; //0 = off, 1 = safe, 2 = balanced, 3 = aggressive247int iSkipGPUReadbackMode; // 0 = off, 1 = skip, 2 = to texture248int iSplineBezierQuality; // 0 = low , 1 = Intermediate , 2 = High249bool bHardwareTessellation;250bool bShaderCache; // Hidden ini-only setting, useful for debugging shader compile times.251bool bUberShaderVertex;252bool bUberShaderFragment;253254std::vector<std::string> vPostShaderNames; // Off for chain end (only Off for no shader)255std::map<std::string, float> mPostShaderSetting;256257// Note that this is separate from VR stereo, though it'll share some code paths.258bool bStereoRendering;259// There can only be one, unlike regular post shaders.260std::string sStereoToMonoShader;261262bool bShaderChainRequires60FPS;263std::string sTextureShaderName;264bool bGfxDebugOutput;265int iInflightFrames;266bool bRenderDuplicateFrames;267bool bRenderMultiThreading;268269// HW debug270bool bShowGPOLEDs;271272// Sound273bool bEnableSound;274int iAudioBackend;275int iGlobalVolume;276int iReverbVolume;277int iAltSpeedVolume;278int iAchievementSoundVolume;279bool bExtraAudioBuffering; // For bluetooth280std::string sAudioDevice;281bool bAutoAudioDevice;282bool bUseNewAtrac;283284// iOS only for now285bool bAudioMixWithOthers;286bool bAudioRespectSilentMode;287288// UI289bool bShowDebuggerOnLoad;290int iShowStatusFlags;291bool bShowRegionOnGameIcon;292bool bShowIDOnGameIcon;293float fGameGridScale;294bool bShowOnScreenMessages;295int iBackgroundAnimation; // enum BackgroundAnimation296bool bTransparentBackground;297298std::string sThemeName;299300// These aren't saved, just for instant debugging.301bool bLogFrameDrops;302303// Analog stick tilting304// This is the held base angle (from the horizon), that we compute the tilt relative from.305float fTiltBaseAngleY;306// Inverts the direction of the x axes and y axes for the purposes of tilt input.307bool bInvertTiltX;308bool bInvertTiltY;309// The sensitivity of the tilt in the X and Y directions, separately.310int iTiltSensitivityX;311int iTiltSensitivityY;312// The deadzone radius of the tilt. Only used in the analog mapping.313float fTiltAnalogDeadzoneRadius;314float fTiltInverseDeadzone; // An inverse deadzone for the output, counteracting excessive deadzones applied by games. See #17483.315bool bTiltCircularDeadzone;316// Type of tilt input currently selected: Defined in TiltEventProcessor.h317// 0 - no tilt, 1 - analog stick, 2 - D-Pad, 3 - Action Buttons (Tri, Cross, Square, Circle)318int iTiltInputType;319320// The three tabs.321bool bGridView1;322bool bGridView2;323bool bGridView3;324325// Right analog binding326int iRightAnalogUp;327int iRightAnalogDown;328int iRightAnalogLeft;329int iRightAnalogRight;330int iRightAnalogPress;331bool bRightAnalogCustom;332bool bRightAnalogDisableDiagonal;333334// Motion gesture controller335bool bGestureControlEnabled;336int iSwipeUp;337int iSwipeDown;338int iSwipeLeft;339int iSwipeRight;340float fSwipeSensitivity;341float fSwipeSmoothing;342int iDoubleTapGesture;343bool bAnalogGesture;344float fAnalogGestureSensibility;345346// Disable diagonals347bool bDisableDpadDiagonals;348bool bGamepadOnlyFocused;349// Control Style350int iTouchButtonStyle;351int iTouchButtonOpacity;352int iTouchButtonHideSeconds;353354// Snap touch control position355bool bTouchSnapToGrid;356int iTouchSnapGridSize;357358// Floating analog stick (recenters on thumb on press).359bool bAutoCenterTouchAnalog;360361// Sticky D-pad (can't glide off it)362bool bStickyTouchDPad;363364//space between PSP buttons365//the PSP button's center (triangle, circle, square, cross)366ConfigTouchPos touchActionButtonCenter;367float fActionButtonSpacing;368//radius of the D-pad (PSP cross)369// int iDpadRadius;370//the D-pad (PSP cross) position371ConfigTouchPos touchDpad;372float fDpadSpacing;373ConfigTouchPos touchStartKey;374ConfigTouchPos touchSelectKey;375ConfigTouchPos touchFastForwardKey;376ConfigTouchPos touchLKey;377ConfigTouchPos touchRKey;378ConfigTouchPos touchAnalogStick;379ConfigTouchPos touchRightAnalogStick;380381enum { CUSTOM_BUTTON_COUNT = 20 };382383ConfigTouchPos touchCustom[CUSTOM_BUTTON_COUNT];384385float fLeftStickHeadScale;386float fRightStickHeadScale;387bool bHideStickBackground;388389// Controls Visibility390bool bShowTouchControls;391392bool bShowTouchCircle;393bool bShowTouchCross;394bool bShowTouchTriangle;395bool bShowTouchSquare;396397ConfigCustomButton CustomButton[CUSTOM_BUTTON_COUNT];398399// Ignored on iOS and other platforms that lack pause.400bool bShowTouchPause;401402bool bHapticFeedback;403404// We also use the XInput settings as analog settings on other platforms like Android.405float fAnalogDeadzone;406float fAnalogInverseDeadzone;407float fAnalogSensitivity;408// convert analog stick circle to square409bool bAnalogIsCircular;410// Auto rotation speed411float fAnalogAutoRotSpeed;412413// Sets up how much the analog limiter button restricts digital->analog input.414float fAnalogLimiterDeadzone;415416// Trigger configuration417float fAnalogTriggerThreshold;418419// Sets whether combo mapping is enabled.420bool bAllowMappingCombos;421bool bStrictComboOrder;422423bool bMouseControl;424bool bMapMouse; // Workaround for mapping screen:|425bool bMouseConfine; // Trap inside the window.426float fMouseSensitivity;427float fMouseSmoothing;428int iMouseWheelUpDelayMs;429430bool bSystemControls;431int iRapidFireInterval;432433// Use the hardware scaler to scale up the image to save fillrate. Similar to Windows' window size, really.434int iAndroidHwScale; // 0 = device resolution. 1 = 480x272 (extended to correct aspect), 2 = 960x544 etc.435436// Risky JIT optimizations437bool bDiscardRegsOnJRRA;438439// SystemParam440std::string sNickName;441std::string sMACAddress;442int iLanguage;443int iTimeFormat;444int iDateFormat;445int iTimeZone;446bool bDayLightSavings;447int iButtonPreference;448int iLockParentalLevel;449bool bEncryptSave;450bool bSavedataUpgrade;451452// Networking453std::string proAdhocServer;454bool bEnableWlan;455bool bEnableAdhocServer;456bool bEnableUPnP;457bool bUPnPUseOriginalPort;458bool bForcedFirstConnect;459int iPortOffset;460int iMinTimeout;461int iWlanAdhocChannel;462bool bWlanPowerSave;463bool bEnableNetworkChat;464//for chat position , moveable buttons is better than this465int iChatButtonPosition;466int iChatScreenPosition;467468bool bEnableQuickChat;469std::string sQuickChat0;470std::string sQuickChat1;471std::string sQuickChat2;472std::string sQuickChat3;473std::string sQuickChat4;474475int iPSPModel;476int iFirmwareVersion;477bool bBypassOSKWithKeyboard;478479// Virtual reality480bool bEnableVR;481bool bEnable6DoF;482bool bEnableStereo;483bool bEnableImmersiveVR;484bool bForce72Hz;485bool bForceVR;486bool bManualForceVR;487bool bPassthrough;488bool bRescaleHUD;489float fCameraDistance;490float fCameraHeight;491float fCameraSide;492float fCameraPitch;493float fCanvasDistance;494float fCanvas3DDistance;495float fFieldOfViewPercentage;496float fHeadUpDisplayScale;497498// Debugger499int iDisasmWindowX;500int iDisasmWindowY;501int iDisasmWindowW;502int iDisasmWindowH;503int iGEWindowX;504int iGEWindowY;505int iGEWindowW;506int iGEWindowH;507uint32_t uGETabsLeft;508uint32_t uGETabsRight;509uint32_t uGETabsTopRight;510int iConsoleWindowX;511int iConsoleWindowY;512int iFontWidth;513int iFontHeight;514bool bDisplayStatusBar;515bool bShowBottomTabTitles;516bool bShowDeveloperMenu;517518// Double edged sword: much easier debugging, but not accurate.519bool bSkipDeadbeefFilling;520521bool bFuncHashMap;522std::string sSkipFuncHashMap;523bool bDebugMemInfoDetailed;524525// Volatile development settings526// Overlays527int iDebugOverlay;528529bool bGpuLogProfiler; // Controls the Vulkan logging profiler (profiles textures uploads etc).530531// Retro Achievement settings532// Copied from Duckstation, we might want to remove some.533bool bAchievementsEnable;534bool bAchievementsHardcoreMode;535bool bAchievementsEncoreMode;536bool bAchievementsUnofficial;537bool bAchievementsSoundEffects;538bool bAchievementsLogBadMemReads;539bool bAchievementsSaveStateInHardcoreMode;540bool bAchievementsEnableRAIntegration;541542// Positioning of the various notifications543int iAchievementsLeaderboardTrackerPos;544int iAchievementsLeaderboardStartedOrFailedPos;545int iAchievementsLeaderboardSubmittedPos;546int iAchievementsProgressPos;547int iAchievementsChallengePos;548int iAchievementsUnlockedPos;549550// Customizations551std::string sAchievementsUnlockAudioFile;552std::string sAchievementsLeaderboardSubmitAudioFile;553554// Achivements login info. Note that password is NOT stored, only a login token.555// Still, we may wanna store it more securely than in PPSSPP.ini, especially on Android.556std::string sAchievementsUserName;557std::string sAchievementsToken; // Not saved, to be used if you want to manually make your RA login persistent. See Native_SaveSecret for the normal case.558559// Various directories. Autoconfigured, not read from ini.560Path currentDirectory; // The directory selected in the game browsing window.561Path defaultCurrentDirectory; // Platform dependent, initialized at startup.562563Path memStickDirectory;564Path flash0Directory;565Path internalDataDirectory;566Path appCacheDirectory;567568// Data for upgrade prompt569std::string upgradeMessage; // The actual message from the server is currently not used, need a translation mechanism. So this just acts as a flag.570std::string upgradeVersion;571std::string dismissedVersion;572573void Load(const char *iniFileName = nullptr, const char *controllerIniFilename = nullptr);574bool Save(const char *saveReason);575void Reload();576void RestoreDefaults(RestoreSettingsBits whatToRestore);577578//per game config managment, should maybe be in it's own class579void changeGameSpecific(const std::string &gameId = "", const std::string &title = "");580bool createGameConfig(const std::string &game_id);581bool deleteGameConfig(const std::string& pGameId);582bool loadGameConfig(const std::string &game_id, const std::string &title);583bool saveGameConfig(const std::string &pGameId, const std::string &title);584void unloadGameConfig();585Path getGameConfigFile(const std::string &gameId);586bool hasGameConfig(const std::string &game_id);587588void SetSearchPath(const Path &path);589const Path FindConfigFile(const std::string &baseFilename);590591void UpdateIniLocation(const char *iniFileName = nullptr, const char *controllerIniFilename = nullptr);592593// Utility functions for "recent" management594void AddRecent(const std::string &file);595void RemoveRecent(const std::string &file);596void CleanRecent();597598static void DownloadCompletedCallback(http::Request &download);599void DismissUpgrade();600601void ResetControlLayout();602603void GetReportingInfo(UrlEncoder &data);604605bool IsPortrait() const;606int NextValidBackend();607bool IsBackendEnabled(GPUBackend backend);608609bool UseFullScreen() const {610if (iForceFullScreen != -1)611return iForceFullScreen == 1;612return bFullScreen;613}614615std::vector<std::string> RecentIsos() const;616bool HasRecentIsos() const;617void ClearRecentIsos();618619const std::map<std::string, std::pair<std::string, int>, std::less<>> &GetLangValuesMapping();620bool LoadAppendedConfig();621void SetAppendedConfigIni(const Path &path);622void UpdateAfterSettingAutoFrameSkip();623void NotifyUpdatedCpuCore();624625// Applies the Auto setting if set. Returns an enum value from PSP_SYSTEMPARAM_LANGUAGE_*.626int GetPSPLanguage();627628PlayTimeTracker &TimeTracker() { return playTimeTracker_; }629630protected:631void LoadStandardControllerIni();632void LoadLangValuesMapping();633634void PostLoadCleanup(bool gameSpecific);635void PreSaveCleanup(bool gameSpecific);636void PostSaveCleanup(bool gameSpecific);637638private:639bool reload_ = false;640std::string gameId_;641std::string gameIdTitle_;642std::vector<std::string> recentIsos;643std::map<std::string, std::pair<std::string, int>, std::less<>> langValuesMapping_;644PlayTimeTracker playTimeTracker_;645Path iniFilename_;646Path controllerIniFilename_;647Path searchPath_;648Path appendedConfigFileName_;649// A set make more sense, but won't have many entry, and I dont want to include the whole std::set header here650std::vector<std::string> appendedConfigUpdatedGames_;651ConfigPrivate *private_ = nullptr;652};653654std::string CreateRandMAC();655656// TODO: Find a better place for this.657extern http::RequestManager g_DownloadManager;658extern Config g_Config;659660661662