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/EmuScreen.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 <list>20#include <string>21#include <vector>2223#include "Common/File/Path.h"24#include "Common/Input/KeyCodes.h"25#include "Common/UI/Screen.h"26#include "Common/UI/UIScreen.h"27#include "Common/UI/Tween.h"28#include "Core/KeyMap.h"29#include "Core/ControlMapper.h"3031struct AxisInput;3233class AsyncImageFileView;34class ChatMenu;3536class EmuScreen : public UIScreen {37public:38EmuScreen(const Path &filename);39~EmuScreen();4041const char *tag() const override { return "Emu"; }4243void update() override;44ScreenRenderFlags render(ScreenRenderMode mode) override;45void dialogFinished(const Screen *dialog, DialogResult result) override;46void sendMessage(UIMessage message, const char *value) override;47void resized() override;48ScreenRenderRole renderRole(bool isTop) const override;4950// Note: Unlike your average boring UIScreen, here we override the Unsync* functions51// to get minimal latency and full control. We forward to UIScreen when needed.52bool UnsyncTouch(const TouchInput &touch) override;53bool UnsyncKey(const KeyInput &key) override;54void UnsyncAxis(const AxisInput *axes, size_t count) override;5556// We also need to do some special handling of queued UI events to handle closing the chat window.57bool key(const KeyInput &key) override;5859protected:60void darken();61void focusChanged(ScreenFocusChange focusChange) override;6263private:64void CreateViews() override;65UI::EventReturn OnDevTools(UI::EventParams ¶ms);66UI::EventReturn OnDisableCardboard(UI::EventParams ¶ms);67UI::EventReturn OnChat(UI::EventParams ¶ms);68UI::EventReturn OnResume(UI::EventParams ¶ms);6970void bootGame(const Path &filename);71bool bootAllowStorage(const Path &filename);72void bootComplete();73bool hasVisibleUI();74void renderUI();7576void onVKey(int virtualKeyCode, bool down);77void onVKeyAnalog(int virtualKeyCode, float value);7879void autoLoad();80bool checkPowerDown();8182UI::Event OnDevMenu;83UI::Event OnChatMenu;84bool bootPending_ = true;85Path gamePath_;8687// Something invalid was loaded, don't try to emulate88bool invalid_ = true;89bool quit_ = false;90bool stopRender_ = false;91std::string errorMessage_;9293// If set, pauses at the end of the frame.94bool pauseTrigger_ = false;9596// The last read chat message count, and how many new ones there are.97int chatMessages_ = 0;98int newChatMessages_ = 0;99100// In-memory save state used for freezeFrame, which is useful for debugging.101std::vector<u8> freezeState_;102103std::string tag_;104105double saveStatePreviewShownTime_ = 0.0;106AsyncImageFileView *saveStatePreview_ = nullptr;107int saveStateSlot_;108109UI::CallbackColorTween *loadingViewColor_ = nullptr;110UI::VisibilityTween *loadingViewVisible_ = nullptr;111UI::Spinner *loadingSpinner_ = nullptr;112UI::TextView *loadingTextView_ = nullptr;113UI::Button *resumeButton_ = nullptr;114UI::Button *resetButton_ = nullptr;115UI::Button *backButton_ = nullptr;116UI::View *chatButton_ = nullptr;117ChatMenu *chatMenu_ = nullptr;118119UI::Button *cardboardDisableButton_ = nullptr;120121std::string extraAssertInfoStr_;122123std::atomic<bool> doFrameAdvance_{};124125ControlMapper controlMapper_;126};127128129