2012-11-01 15:19:01 +00:00
|
|
|
// Copyright (c) 2012- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
2012-11-04 22:01:49 +00:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-05-23 20:21:45 +00:00
|
|
|
#include <list>
|
2012-11-01 15:19:01 +00:00
|
|
|
#include <string>
|
2013-11-15 12:11:44 +00:00
|
|
|
#include <vector>
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2021-05-05 23:31:38 +00:00
|
|
|
#include "Common/File/Path.h"
|
2020-10-01 07:36:43 +00:00
|
|
|
#include "Common/Input/KeyCodes.h"
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/UI/Screen.h"
|
|
|
|
#include "Common/UI/UIScreen.h"
|
|
|
|
#include "Common/UI/Tween.h"
|
2020-10-03 22:25:21 +00:00
|
|
|
#include "Core/KeyMap.h"
|
2021-07-08 19:30:23 +00:00
|
|
|
#include "Core/ControlMapper.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2013-07-31 16:07:45 +00:00
|
|
|
struct AxisInput;
|
|
|
|
|
2015-02-01 17:04:06 +00:00
|
|
|
class AsyncImageFileView;
|
2021-09-13 02:44:44 +00:00
|
|
|
class ChatMenu;
|
2015-02-01 17:04:06 +00:00
|
|
|
|
2013-10-27 09:04:38 +00:00
|
|
|
class EmuScreen : public UIScreen {
|
2012-11-01 15:19:01 +00:00
|
|
|
public:
|
2021-05-05 23:31:38 +00:00
|
|
|
EmuScreen(const Path &filename);
|
2012-11-01 15:19:01 +00:00
|
|
|
~EmuScreen();
|
|
|
|
|
2022-09-16 08:14:00 +00:00
|
|
|
const char *tag() const override { return "Emu"; }
|
|
|
|
|
2017-03-15 05:01:18 +00:00
|
|
|
void update() override;
|
2015-11-13 00:14:56 +00:00
|
|
|
void render() override;
|
2017-05-16 12:24:40 +00:00
|
|
|
void preRender() override;
|
|
|
|
void postRender() override;
|
2015-11-13 00:14:56 +00:00
|
|
|
void dialogFinished(const Screen *dialog, DialogResult result) override;
|
2023-09-30 09:21:22 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2017-02-23 08:25:33 +00:00
|
|
|
void resized() override;
|
2014-06-15 11:04:59 +00:00
|
|
|
|
2023-05-26 09:49:50 +00:00
|
|
|
// Note: Unlike your average boring UIScreen, here we override the Unsync* functions
|
|
|
|
// to get minimal latency and full control. We forward to UIScreen when needed.
|
2023-09-04 08:58:11 +00:00
|
|
|
bool UnsyncTouch(const TouchInput &touch) override;
|
2023-05-26 09:49:50 +00:00
|
|
|
bool UnsyncKey(const KeyInput &key) override;
|
2023-09-27 15:34:34 +00:00
|
|
|
void UnsyncAxis(const AxisInput *axes, size_t count) override;
|
2015-11-13 00:14:56 +00:00
|
|
|
|
2023-09-12 08:25:04 +00:00
|
|
|
// We also need to do some special handling of queued UI events to handle closing the chat window.
|
|
|
|
bool key(const KeyInput &key) override;
|
|
|
|
|
2020-12-19 19:26:02 +00:00
|
|
|
private:
|
2015-11-13 00:14:56 +00:00
|
|
|
void CreateViews() override;
|
2013-09-07 18:54:11 +00:00
|
|
|
UI::EventReturn OnDevTools(UI::EventParams ¶ms);
|
2019-10-25 08:56:01 +00:00
|
|
|
UI::EventReturn OnDisableCardboard(UI::EventParams ¶ms);
|
2016-10-21 10:35:54 +00:00
|
|
|
UI::EventReturn OnChat(UI::EventParams ¶ms);
|
2020-12-19 19:26:02 +00:00
|
|
|
UI::EventReturn OnResume(UI::EventParams ¶ms);
|
2021-08-09 06:03:19 +00:00
|
|
|
UI::EventReturn OnReset(UI::EventParams ¶ms);
|
2013-07-20 10:06:06 +00:00
|
|
|
|
2021-05-05 23:31:38 +00:00
|
|
|
void bootGame(const Path &filename);
|
|
|
|
bool bootAllowStorage(const Path &filename);
|
2014-01-19 22:17:34 +00:00
|
|
|
void bootComplete();
|
2018-06-02 04:07:09 +00:00
|
|
|
bool hasVisibleUI();
|
2017-12-03 18:39:25 +00:00
|
|
|
void renderUI();
|
2013-07-17 05:33:26 +00:00
|
|
|
|
2023-03-30 08:47:28 +00:00
|
|
|
void onVKey(int virtualKeyCode, bool down);
|
2023-03-30 13:03:41 +00:00
|
|
|
void onVKeyAnalog(int virtualKeyCode, float value);
|
2013-07-07 08:42:39 +00:00
|
|
|
|
2013-10-30 17:16:27 +00:00
|
|
|
void autoLoad();
|
2014-05-21 08:13:40 +00:00
|
|
|
void checkPowerDown();
|
2013-11-15 12:11:44 +00:00
|
|
|
|
2017-04-18 03:33:22 +00:00
|
|
|
UI::Event OnDevMenu;
|
2017-07-08 10:08:33 +00:00
|
|
|
UI::Event OnChatMenu;
|
2021-07-08 19:30:23 +00:00
|
|
|
bool bootPending_ = true;
|
2021-05-05 23:31:38 +00:00
|
|
|
Path gamePath_;
|
2013-10-27 09:04:38 +00:00
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
// Something invalid was loaded, don't try to emulate
|
2021-07-08 19:30:23 +00:00
|
|
|
bool invalid_ = true;
|
|
|
|
bool quit_ = false;
|
2017-11-13 14:45:31 +00:00
|
|
|
bool stopRender_ = false;
|
2012-11-01 15:19:01 +00:00
|
|
|
std::string errorMessage_;
|
2013-07-06 17:08:59 +00:00
|
|
|
|
2013-10-27 09:04:38 +00:00
|
|
|
// If set, pauses at the end of the frame.
|
2021-07-08 19:30:23 +00:00
|
|
|
bool pauseTrigger_ = false;
|
2013-11-15 12:11:44 +00:00
|
|
|
|
2021-09-15 00:59:46 +00:00
|
|
|
// The last read chat message count, and how many new ones there are.
|
|
|
|
int chatMessages_ = 0;
|
|
|
|
int newChatMessages_ = 0;
|
|
|
|
|
2013-11-15 12:11:44 +00:00
|
|
|
// In-memory save state used for freezeFrame, which is useful for debugging.
|
|
|
|
std::vector<u8> freezeState_;
|
2014-06-22 07:38:46 +00:00
|
|
|
|
|
|
|
std::string tag_;
|
2014-07-20 10:52:11 +00:00
|
|
|
|
2021-07-08 19:30:23 +00:00
|
|
|
double saveStatePreviewShownTime_ = 0.0;
|
|
|
|
AsyncImageFileView *saveStatePreview_ = nullptr;
|
2016-05-28 03:41:37 +00:00
|
|
|
int saveStateSlot_;
|
2017-12-03 19:56:42 +00:00
|
|
|
|
2018-01-02 05:51:09 +00:00
|
|
|
UI::CallbackColorTween *loadingViewColor_ = nullptr;
|
2017-12-03 19:56:42 +00:00
|
|
|
UI::VisibilityTween *loadingViewVisible_ = nullptr;
|
2018-02-08 11:02:44 +00:00
|
|
|
UI::Spinner *loadingSpinner_ = nullptr;
|
2018-03-13 10:25:00 +00:00
|
|
|
UI::TextView *loadingTextView_ = nullptr;
|
2020-12-19 19:26:02 +00:00
|
|
|
UI::Button *resumeButton_ = nullptr;
|
2021-08-09 06:03:19 +00:00
|
|
|
UI::Button *resetButton_ = nullptr;
|
2021-02-16 04:37:24 +00:00
|
|
|
UI::View *chatButton_ = nullptr;
|
2021-09-13 02:44:44 +00:00
|
|
|
ChatMenu *chatMenu_ = nullptr;
|
2019-10-25 08:56:01 +00:00
|
|
|
|
|
|
|
UI::Button *cardboardDisableButton_ = nullptr;
|
2020-11-22 18:08:14 +00:00
|
|
|
|
2021-07-08 19:30:23 +00:00
|
|
|
ControlMapper controlMapper_;
|
2013-07-04 17:59:19 +00:00
|
|
|
};
|