2012-11-01 16:19:01 +01: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 23:01:49 +01:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 16:19:01 +01: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 13:21:45 -07:00
|
|
|
#include <list>
|
2012-11-01 16:19:01 +01:00
|
|
|
#include <string>
|
2013-11-15 13:11:44 +01:00
|
|
|
#include <vector>
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
#include "Common/File/Path.h"
|
2020-10-01 09:36:43 +02:00
|
|
|
#include "Common/Input/KeyCodes.h"
|
2020-10-04 20:48:47 +02:00
|
|
|
#include "Common/UI/Screen.h"
|
|
|
|
#include "Common/UI/UIScreen.h"
|
|
|
|
#include "Common/UI/Tween.h"
|
2020-10-04 00:25:21 +02:00
|
|
|
#include "Core/KeyMap.h"
|
2021-07-08 21:30:23 +02:00
|
|
|
#include "Core/ControlMapper.h"
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2013-07-31 18:07:45 +02:00
|
|
|
struct AxisInput;
|
|
|
|
|
2015-02-01 18:04:06 +01:00
|
|
|
class AsyncImageFileView;
|
2021-09-12 19:44:44 -07:00
|
|
|
class ChatMenu;
|
2015-02-01 18:04:06 +01:00
|
|
|
|
2013-10-27 10:04:38 +01:00
|
|
|
class EmuScreen : public UIScreen {
|
2012-11-01 16:19:01 +01:00
|
|
|
public:
|
2021-05-06 01:31:38 +02:00
|
|
|
EmuScreen(const Path &filename);
|
2012-11-01 16:19:01 +01:00
|
|
|
~EmuScreen();
|
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "Emu"; }
|
|
|
|
|
2017-03-14 22:01:18 -07:00
|
|
|
void update() override;
|
2015-11-13 01:14:56 +01:00
|
|
|
void render() override;
|
2017-05-16 14:24:40 +02:00
|
|
|
void preRender() override;
|
|
|
|
void postRender() override;
|
2015-11-13 01:14:56 +01:00
|
|
|
void dialogFinished(const Screen *dialog, DialogResult result) override;
|
2023-09-30 11:21:22 +02:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2017-02-23 09:25:33 +01:00
|
|
|
void resized() override;
|
2014-06-15 13:04:59 +02:00
|
|
|
|
2023-05-26 11:49:50 +02: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 10:58:11 +02:00
|
|
|
bool UnsyncTouch(const TouchInput &touch) override;
|
2023-05-26 11:49:50 +02:00
|
|
|
bool UnsyncKey(const KeyInput &key) override;
|
2023-09-27 17:34:34 +02:00
|
|
|
void UnsyncAxis(const AxisInput *axes, size_t count) override;
|
2015-11-13 01:14:56 +01:00
|
|
|
|
2023-09-12 10:25:04 +02: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;
|
|
|
|
|
2023-11-26 19:49:02 +01:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void focusChanged(ScreenFocusChange focusChange) override;
|
|
|
|
|
2020-12-19 20:26:02 +01:00
|
|
|
private:
|
2015-11-13 01:14:56 +01:00
|
|
|
void CreateViews() override;
|
2013-09-07 20:54:11 +02:00
|
|
|
UI::EventReturn OnDevTools(UI::EventParams ¶ms);
|
2019-10-25 10:56:01 +02:00
|
|
|
UI::EventReturn OnDisableCardboard(UI::EventParams ¶ms);
|
2016-10-21 18:35:54 +08:00
|
|
|
UI::EventReturn OnChat(UI::EventParams ¶ms);
|
2020-12-19 20:26:02 +01:00
|
|
|
UI::EventReturn OnResume(UI::EventParams ¶ms);
|
2021-08-08 23:03:19 -07:00
|
|
|
UI::EventReturn OnReset(UI::EventParams ¶ms);
|
2013-07-20 12:06:06 +02:00
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
void bootGame(const Path &filename);
|
|
|
|
bool bootAllowStorage(const Path &filename);
|
2014-01-19 14:17:34 -08:00
|
|
|
void bootComplete();
|
2018-06-01 21:07:09 -07:00
|
|
|
bool hasVisibleUI();
|
2017-12-03 10:39:25 -08:00
|
|
|
void renderUI();
|
2013-07-17 02:33:26 -03:00
|
|
|
|
2023-03-30 10:47:28 +02:00
|
|
|
void onVKey(int virtualKeyCode, bool down);
|
2023-03-30 15:03:41 +02:00
|
|
|
void onVKeyAnalog(int virtualKeyCode, float value);
|
2013-07-07 10:42:39 +02:00
|
|
|
|
2013-10-30 22:46:27 +05:30
|
|
|
void autoLoad();
|
2023-10-11 09:04:28 +02:00
|
|
|
bool checkPowerDown();
|
2013-11-15 13:11:44 +01:00
|
|
|
|
2017-04-17 20:33:22 -07:00
|
|
|
UI::Event OnDevMenu;
|
2017-07-08 18:08:33 +08:00
|
|
|
UI::Event OnChatMenu;
|
2021-07-08 21:30:23 +02:00
|
|
|
bool bootPending_ = true;
|
2021-05-06 01:31:38 +02:00
|
|
|
Path gamePath_;
|
2013-10-27 10:04:38 +01:00
|
|
|
|
2012-11-01 16:19:01 +01:00
|
|
|
// Something invalid was loaded, don't try to emulate
|
2021-07-08 21:30:23 +02:00
|
|
|
bool invalid_ = true;
|
|
|
|
bool quit_ = false;
|
2017-11-13 15:45:31 +01:00
|
|
|
bool stopRender_ = false;
|
2012-11-01 16:19:01 +01:00
|
|
|
std::string errorMessage_;
|
2013-07-06 19:08:59 +02:00
|
|
|
|
2013-10-27 10:04:38 +01:00
|
|
|
// If set, pauses at the end of the frame.
|
2021-07-08 21:30:23 +02:00
|
|
|
bool pauseTrigger_ = false;
|
2013-11-15 13:11:44 +01:00
|
|
|
|
2021-09-14 17:59:46 -07:00
|
|
|
// The last read chat message count, and how many new ones there are.
|
|
|
|
int chatMessages_ = 0;
|
|
|
|
int newChatMessages_ = 0;
|
|
|
|
|
2013-11-15 13:11:44 +01:00
|
|
|
// In-memory save state used for freezeFrame, which is useful for debugging.
|
|
|
|
std::vector<u8> freezeState_;
|
2014-06-22 09:38:46 +02:00
|
|
|
|
|
|
|
std::string tag_;
|
2014-07-20 12:52:11 +02:00
|
|
|
|
2021-07-08 21:30:23 +02:00
|
|
|
double saveStatePreviewShownTime_ = 0.0;
|
|
|
|
AsyncImageFileView *saveStatePreview_ = nullptr;
|
2016-05-27 20:41:37 -07:00
|
|
|
int saveStateSlot_;
|
2017-12-03 11:56:42 -08:00
|
|
|
|
2018-01-01 21:51:09 -08:00
|
|
|
UI::CallbackColorTween *loadingViewColor_ = nullptr;
|
2017-12-03 11:56:42 -08:00
|
|
|
UI::VisibilityTween *loadingViewVisible_ = nullptr;
|
2018-02-08 12:02:44 +01:00
|
|
|
UI::Spinner *loadingSpinner_ = nullptr;
|
2018-03-13 11:25:00 +01:00
|
|
|
UI::TextView *loadingTextView_ = nullptr;
|
2020-12-19 20:26:02 +01:00
|
|
|
UI::Button *resumeButton_ = nullptr;
|
2021-08-08 23:03:19 -07:00
|
|
|
UI::Button *resetButton_ = nullptr;
|
2021-02-15 20:37:24 -08:00
|
|
|
UI::View *chatButton_ = nullptr;
|
2021-09-12 19:44:44 -07:00
|
|
|
ChatMenu *chatMenu_ = nullptr;
|
2019-10-25 10:56:01 +02:00
|
|
|
|
|
|
|
UI::Button *cardboardDisableButton_ = nullptr;
|
2020-11-22 19:08:14 +01:00
|
|
|
|
2021-07-08 21:30:23 +02:00
|
|
|
ControlMapper controlMapper_;
|
2013-07-04 10:59:19 -07:00
|
|
|
};
|