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
|
|
|
|
|
|
|
|
#include <string>
|
2013-11-15 13:11:44 +01:00
|
|
|
#include <vector>
|
2013-05-22 18:00:06 +02:00
|
|
|
#include <list>
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2014-07-20 12:52:11 +02:00
|
|
|
#include "input/keycodes.h"
|
2012-11-01 16:19:01 +01:00
|
|
|
#include "ui/screen.h"
|
2013-07-20 12:06:06 +02:00
|
|
|
#include "ui/ui_screen.h"
|
2013-07-06 20:44:34 +02:00
|
|
|
#include "Common/KeyMap.h"
|
2012-11-01 16:19:01 +01:00
|
|
|
|
2013-07-31 18:07:45 +02:00
|
|
|
struct AxisInput;
|
|
|
|
|
2013-10-27 10:04:38 +01:00
|
|
|
class EmuScreen : public UIScreen {
|
2012-11-01 16:19:01 +01:00
|
|
|
public:
|
|
|
|
EmuScreen(const std::string &filename);
|
|
|
|
~EmuScreen();
|
|
|
|
|
2014-06-15 13:04:59 +02:00
|
|
|
virtual void update(InputState &input) override;
|
|
|
|
virtual void render() override;
|
|
|
|
virtual void deviceLost() override;
|
|
|
|
virtual void dialogFinished(const Screen *dialog, DialogResult result) override;
|
|
|
|
virtual void sendMessage(const char *msg, const char *value) override;
|
|
|
|
|
|
|
|
virtual bool touch(const TouchInput &touch) override;
|
|
|
|
virtual bool key(const KeyInput &key) override;
|
|
|
|
virtual bool axis(const AxisInput &axis) override;
|
2013-07-06 19:08:59 +02:00
|
|
|
|
2013-07-20 12:06:06 +02:00
|
|
|
protected:
|
|
|
|
virtual void CreateViews();
|
2013-09-07 20:54:11 +02:00
|
|
|
UI::EventReturn OnDevTools(UI::EventParams ¶ms);
|
2013-07-20 12:06:06 +02:00
|
|
|
|
2012-11-01 16:19:01 +01:00
|
|
|
private:
|
2013-07-17 02:33:26 -03:00
|
|
|
void bootGame(const std::string &filename);
|
2014-01-19 14:17:34 -08:00
|
|
|
void bootComplete();
|
2013-07-31 18:07:45 +02:00
|
|
|
void processAxis(const AxisInput &axis, int direction);
|
2013-07-17 02:33:26 -03:00
|
|
|
|
2013-07-07 15:21:40 -07:00
|
|
|
void pspKey(int pspKeyCode, int flags);
|
2013-07-07 10:42:39 +02:00
|
|
|
void onVKeyDown(int virtualKeyCode);
|
|
|
|
void onVKeyUp(int virtualKeyCode);
|
2013-07-20 12:11:35 -07:00
|
|
|
void setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax);
|
|
|
|
void setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax);
|
2013-07-07 10:42:39 +02:00
|
|
|
|
2013-10-30 22:46:27 +05:30
|
|
|
void autoLoad();
|
2014-05-21 01:13:40 -07:00
|
|
|
void checkPowerDown();
|
2013-11-15 13:11:44 +01:00
|
|
|
|
2014-05-15 22:17:19 -07:00
|
|
|
bool bootPending_;
|
2013-07-21 13:31:46 +02:00
|
|
|
std::string 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
|
|
|
|
bool invalid_;
|
2014-01-25 00:40:14 -08:00
|
|
|
bool quit_;
|
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.
|
2013-07-20 20:48:21 +02:00
|
|
|
bool pauseTrigger_;
|
|
|
|
|
2013-07-06 20:44:34 +02:00
|
|
|
// To track mappable virtual keys. We can have as many as we want.
|
|
|
|
bool virtKeys[VIRTKEY_COUNT];
|
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
|
|
|
|
|
|
|
// De-noise mapped axis updates
|
|
|
|
int axisState_[JOYSTICK_AXIS_MAX];
|
2013-07-04 10:59:19 -07:00
|
|
|
};
|