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
|
|
|
|
|
|
|
|
#include <string>
|
2013-11-15 12:11:44 +00:00
|
|
|
#include <vector>
|
2013-05-22 16:00:06 +00:00
|
|
|
#include <list>
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2014-07-20 10:52:11 +00:00
|
|
|
#include "input/keycodes.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
#include "ui/screen.h"
|
2013-07-20 10:06:06 +00:00
|
|
|
#include "ui/ui_screen.h"
|
2017-12-03 19:56:42 +00:00
|
|
|
#include "ui/ui_tween.h"
|
2013-07-06 18:44:34 +00:00
|
|
|
#include "Common/KeyMap.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;
|
|
|
|
|
2013-10-27 09:04:38 +00:00
|
|
|
class EmuScreen : public UIScreen {
|
2012-11-01 15:19:01 +00:00
|
|
|
public:
|
|
|
|
EmuScreen(const std::string &filename);
|
|
|
|
~EmuScreen();
|
|
|
|
|
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;
|
|
|
|
void sendMessage(const char *msg, const char *value) override;
|
2017-02-23 08:25:33 +00:00
|
|
|
void resized() override;
|
2014-06-15 11:04:59 +00:00
|
|
|
|
2015-11-13 00:14:56 +00:00
|
|
|
bool touch(const TouchInput &touch) override;
|
|
|
|
bool key(const KeyInput &key) override;
|
|
|
|
bool axis(const AxisInput &axis) override;
|
|
|
|
|
2013-07-20 10:06:06 +00:00
|
|
|
protected:
|
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);
|
2013-07-20 10:06:06 +00:00
|
|
|
|
2012-11-01 15:19:01 +00:00
|
|
|
private:
|
2013-07-17 05:33:26 +00:00
|
|
|
void bootGame(const std::string &filename);
|
2018-04-02 06:28:36 +00:00
|
|
|
bool bootAllowStorage(const std::string &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-31 16:07:45 +00:00
|
|
|
void processAxis(const AxisInput &axis, int direction);
|
2013-07-17 05:33:26 +00:00
|
|
|
|
2013-07-07 22:21:40 +00:00
|
|
|
void pspKey(int pspKeyCode, int flags);
|
2013-07-07 08:42:39 +00:00
|
|
|
void onVKeyDown(int virtualKeyCode);
|
|
|
|
void onVKeyUp(int virtualKeyCode);
|
2013-07-20 19:11:35 +00:00
|
|
|
void setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax);
|
|
|
|
void setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax);
|
2013-07-07 08:42:39 +00:00
|
|
|
|
2015-05-21 08:49:47 +00:00
|
|
|
void releaseButtons();
|
|
|
|
|
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;
|
|
|
|
|
2014-05-16 05:17:19 +00:00
|
|
|
bool bootPending_;
|
2013-07-21 11:31:46 +00:00
|
|
|
std::string 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
|
|
|
|
bool invalid_;
|
2014-01-25 08:40:14 +00:00
|
|
|
bool quit_;
|
2017-11-13 14:45:31 +00:00
|
|
|
bool stopRender_ = false;
|
2018-06-02 04:07:09 +00:00
|
|
|
bool hasVisibleUI_ = true;
|
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.
|
2013-07-20 18:48:21 +00:00
|
|
|
bool pauseTrigger_;
|
|
|
|
|
2013-07-06 18:44:34 +00:00
|
|
|
// To track mappable virtual keys. We can have as many as we want.
|
|
|
|
bool virtKeys[VIRTKEY_COUNT];
|
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
|
|
|
|
|
|
|
// De-noise mapped axis updates
|
|
|
|
int axisState_[JOYSTICK_AXIS_MAX];
|
2015-02-01 17:04:06 +00:00
|
|
|
|
|
|
|
double saveStatePreviewShownTime_;
|
|
|
|
AsyncImageFileView *saveStatePreview_;
|
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;
|
2013-07-04 17:59:19 +00:00
|
|
|
};
|