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/UI/GameSettingsScreen.h
Views: 1401
// Copyright (c) 2013- 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 "ppsspp_config.h"20#include <condition_variable>21#include <mutex>22#include <thread>2324#include "Common/UI/UIScreen.h"25#include "Core/ConfigValues.h"26#include "UI/MiscScreens.h"27#include "UI/TabbedDialogScreen.h"2829class Path;3031// Per-game settings screen - enables you to configure graphic options, control options, etc32// per game.33class GameSettingsScreen : public TabbedUIDialogScreenWithGameBackground {34public:35GameSettingsScreen(const Path &gamePath, std::string gameID = "", bool editThenRestore = false);3637void onFinish(DialogResult result) override;38const char *tag() const override { return "GameSettings"; }3940protected:41void CallbackRestoreDefaults(bool yes);42void CallbackMemstickFolder(bool yes);43void dialogFinished(const Screen *dialog, DialogResult result) override;4445void CreateTabs() override;46bool ShowSearchControls() const override { return true; }4748private:49void PreCreateViews() override;5051void CreateGraphicsSettings(UI::ViewGroup *graphicsSettings);52void CreateControlsSettings(UI::ViewGroup *tools);53void CreateAudioSettings(UI::ViewGroup *audioSettings);54void CreateNetworkingSettings(UI::ViewGroup *networkingSettings);55void CreateToolsSettings(UI::ViewGroup *tools);56void CreateSystemSettings(UI::ViewGroup *systemSettings);57void CreateVRSettings(UI::ViewGroup *vrSettings);5859std::string gameID_;60UI::CheckBox *enableReportsCheckbox_ = nullptr;61UI::Choice *layoutEditorChoice_ = nullptr;62UI::Choice *displayEditor_ = nullptr;63UI::Choice *backgroundChoice_ = nullptr;64UI::PopupMultiChoice *resolutionChoice_ = nullptr;65UI::CheckBox *frameSkipAuto_ = nullptr;66#ifdef _WIN3267UI::CheckBox *SavePathInMyDocumentChoice = nullptr;68UI::CheckBox *SavePathInOtherChoice = nullptr;69// Used to enable/disable the above two options.70bool installed_ = false;71bool otherinstalled_ = false;72#endif7374std::string memstickDisplay_;7576// Event handlers77UI::EventReturn OnControlMapping(UI::EventParams &e);78UI::EventReturn OnCalibrateAnalogs(UI::EventParams &e);79UI::EventReturn OnTouchControlLayout(UI::EventParams &e);80UI::EventReturn OnTiltCustomize(UI::EventParams &e);8182// Global settings handlers83UI::EventReturn OnAutoFrameskip(UI::EventParams &e);84UI::EventReturn OnTextureShader(UI::EventParams &e);85UI::EventReturn OnTextureShaderChange(UI::EventParams &e);86UI::EventReturn OnChangeQuickChat0(UI::EventParams &e);87UI::EventReturn OnChangeQuickChat1(UI::EventParams &e);88UI::EventReturn OnChangeQuickChat2(UI::EventParams &e);89UI::EventReturn OnChangeQuickChat3(UI::EventParams &e);90UI::EventReturn OnChangeQuickChat4(UI::EventParams &e);91UI::EventReturn OnChangeNickname(UI::EventParams &e);92UI::EventReturn OnChangeproAdhocServerAddress(UI::EventParams &e);93UI::EventReturn OnChangeBackground(UI::EventParams &e);94UI::EventReturn OnFullscreenChange(UI::EventParams &e);95UI::EventReturn OnFullscreenMultiChange(UI::EventParams &e);96UI::EventReturn OnResolutionChange(UI::EventParams &e);97UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e);98UI::EventReturn OnRenderingBackend(UI::EventParams &e);99UI::EventReturn OnRenderingDevice(UI::EventParams &e);100UI::EventReturn OnInflightFramesChoice(UI::EventParams &e);101UI::EventReturn OnCameraDeviceChange(UI::EventParams& e);102UI::EventReturn OnMicDeviceChange(UI::EventParams& e);103UI::EventReturn OnAudioDevice(UI::EventParams &e);104UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);105UI::EventReturn OnShowMemstickScreen(UI::EventParams &e);106#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)107UI::EventReturn OnSavePathMydoc(UI::EventParams &e);108UI::EventReturn OnSavePathOther(UI::EventParams &e);109#endif110UI::EventReturn OnScreenRotation(UI::EventParams &e);111UI::EventReturn OnImmersiveModeChange(UI::EventParams &e);112UI::EventReturn OnSustainedPerformanceModeChange(UI::EventParams &e);113114UI::EventReturn OnAdhocGuides(UI::EventParams &e);115116// Temporaries to convert setting types, cache enabled, etc.117int iAlternateSpeedPercent1_ = 0;118int iAlternateSpeedPercent2_ = 0;119int iAlternateSpeedPercentAnalog_ = 0;120int prevInflightFrames_ = -1;121bool enableReports_ = false;122bool enableReportsSet_ = false;123bool analogSpeedMapped_ = false;124125// edit the game-specific settings and restore the global settings after exiting126bool editThenRestore_ = false;127128// Android-only129std::string pendingMemstickFolder_;130};131132class DeveloperToolsScreen : public UIDialogScreenWithGameBackground {133public:134DeveloperToolsScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}135136void update() override;137void onFinish(DialogResult result) override;138139const char *tag() const override { return "DeveloperTools"; }140141protected:142void CreateViews() override;143144private:145UI::EventReturn OnRunCPUTests(UI::EventParams &e);146UI::EventReturn OnLoggingChanged(UI::EventParams &e);147UI::EventReturn OnOpenTexturesIniFile(UI::EventParams &e);148UI::EventReturn OnLogConfig(UI::EventParams &e);149UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);150UI::EventReturn OnJitDebugTools(UI::EventParams &e);151UI::EventReturn OnRemoteDebugger(UI::EventParams &e);152UI::EventReturn OnMIPSTracerEnabled(UI::EventParams &e);153UI::EventReturn OnMIPSTracerPathChanged(UI::EventParams &e);154UI::EventReturn OnMIPSTracerFlushTrace(UI::EventParams &e);155UI::EventReturn OnMIPSTracerClearJitCache(UI::EventParams &e);156UI::EventReturn OnMIPSTracerClearTracer(UI::EventParams &e);157UI::EventReturn OnGPUDriverTest(UI::EventParams &e);158UI::EventReturn OnFramedumpTest(UI::EventParams &e);159UI::EventReturn OnMemstickTest(UI::EventParams &e);160UI::EventReturn OnTouchscreenTest(UI::EventParams &e);161UI::EventReturn OnCopyStatesToRoot(UI::EventParams &e);162163bool allowDebugger_ = false;164bool canAllowDebugger_ = true;165enum class HasIni {166NO,167YES,168MAYBE,169};170HasIni hasTexturesIni_ = HasIni::MAYBE;171172bool MIPSTracerEnabled_ = false;173std::string MIPSTracerPath_ = "";174UI::InfoItem* MIPSTracerPath = nullptr;175};176177class HostnameSelectScreen : public PopupScreen {178public:179HostnameSelectScreen(std::string *value, std::string_view title)180: PopupScreen(title, "OK", "Cancel"), value_(value) {181resolver_ = std::thread([](HostnameSelectScreen *thiz) {182thiz->ResolverThread();183}, this);184}185~HostnameSelectScreen() {186{187std::unique_lock<std::mutex> guard(resolverLock_);188resolverState_ = ResolverState::QUIT;189resolverCond_.notify_one();190}191resolver_.join();192}193194void CreatePopupContents(UI::ViewGroup *parent) override;195196const char *tag() const override { return "HostnameSelect"; }197198protected:199void OnCompleted(DialogResult result) override;200bool CanComplete(DialogResult result) override;201202private:203void ResolverThread();204void SendEditKey(InputKeyCode keyCode, int flags = 0);205206UI::EventReturn OnNumberClick(UI::EventParams &e);207UI::EventReturn OnPointClick(UI::EventParams &e);208UI::EventReturn OnDeleteClick(UI::EventParams &e);209UI::EventReturn OnDeleteAllClick(UI::EventParams &e);210UI::EventReturn OnEditClick(UI::EventParams& e);211UI::EventReturn OnShowIPListClick(UI::EventParams& e);212UI::EventReturn OnIPClick(UI::EventParams& e);213214enum class ResolverState {215WAITING,216QUEUED,217PROGRESS,218READY,219QUIT,220};221222std::string *value_;223UI::TextEdit *addrView_ = nullptr;224UI::TextView *progressView_ = nullptr;225UI::LinearLayout *ipRows_ = nullptr;226227std::thread resolver_;228ResolverState resolverState_ = ResolverState::WAITING;229std::mutex resolverLock_;230std::condition_variable resolverCond_;231std::string toResolve_ = "";232bool toResolveResult_ = false;233std::string lastResolved_ = "";234bool lastResolvedResult_ = false;235};236237238class GestureMappingScreen : public UIDialogScreenWithGameBackground {239public:240GestureMappingScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {}241void CreateViews() override;242243const char *tag() const override { return "GestureMapping"; }244};245246class RestoreSettingsScreen : public PopupScreen {247public:248RestoreSettingsScreen(std::string_view title);249void CreatePopupContents(UI::ViewGroup *parent) override;250251const char *tag() const override { return "RestoreSettingsScreen"; }252private:253void OnCompleted(DialogResult result) override;254int restoreFlags_ = (int)(RestoreSettingsBits::SETTINGS); // RestoreSettingsBits enum255};256257void TriggerRestart(const char *why, bool editThenRestore, const Path &gamePath);258259260