2014-12-22 09:48:17 +00:00
|
|
|
// Copyright (c) 2014- 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
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// 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/.
|
|
|
|
|
|
|
|
#include "i18n/i18n.h"
|
|
|
|
#include "ui/view.h"
|
|
|
|
#include "ui/viewgroup.h"
|
2014-12-31 19:42:28 +00:00
|
|
|
#include "ui/ui_screen.h"
|
2014-12-31 14:33:43 +00:00
|
|
|
#include "thin3d/thin3d.h"
|
2014-12-22 09:48:17 +00:00
|
|
|
|
|
|
|
#include "Core/Reporting.h"
|
|
|
|
#include "Core/SaveState.h"
|
|
|
|
#include "Core/System.h"
|
|
|
|
#include "Core/Config.h"
|
|
|
|
#include "Core/ELF/ParamSFO.h"
|
|
|
|
|
|
|
|
#include "GPU/GPUCommon.h"
|
2015-07-29 09:48:20 +00:00
|
|
|
#include "GPU/GPUState.h"
|
2014-12-22 09:48:17 +00:00
|
|
|
|
|
|
|
#include "Core/HLE/sceDisplay.h"
|
|
|
|
#include "Core/HLE/sceUmd.h"
|
|
|
|
|
|
|
|
#include "UI/PauseScreen.h"
|
|
|
|
#include "UI/GameSettingsScreen.h"
|
|
|
|
#include "UI/ReportScreen.h"
|
|
|
|
#include "UI/CwCheatScreen.h"
|
|
|
|
#include "UI/MainScreen.h"
|
|
|
|
#include "UI/GameInfoCache.h"
|
|
|
|
|
2014-12-31 14:33:43 +00:00
|
|
|
#include "gfx_es2/draw_buffer.h"
|
|
|
|
#include "ui/ui_context.h"
|
|
|
|
|
|
|
|
void AsyncImageFileView::GetContentDimensions(const UIContext &dc, float &w, float &h) const {
|
|
|
|
if (texture_) {
|
2014-12-31 19:42:28 +00:00
|
|
|
float texw = (float)texture_->Width();
|
|
|
|
float texh = (float)texture_->Height();
|
|
|
|
switch (sizeMode_) {
|
2015-02-01 17:04:06 +00:00
|
|
|
case UI::IS_FIXED:
|
|
|
|
w = fixedSizeW_;
|
|
|
|
h = fixedSizeH_;
|
|
|
|
break;
|
2014-12-31 19:42:28 +00:00
|
|
|
case UI::IS_DEFAULT:
|
|
|
|
default:
|
|
|
|
w = texw;
|
|
|
|
h = texh;
|
|
|
|
break;
|
|
|
|
}
|
2014-12-31 14:33:43 +00:00
|
|
|
} else {
|
|
|
|
w = 16;
|
|
|
|
h = 16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-01 17:04:06 +00:00
|
|
|
void AsyncImageFileView::SetFilename(std::string filename) {
|
|
|
|
if (filename_ != filename) {
|
|
|
|
textureFailed_ = false;
|
|
|
|
filename_ = filename;
|
|
|
|
if (texture_) {
|
|
|
|
texture_->Release();
|
|
|
|
texture_ = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-31 14:33:43 +00:00
|
|
|
void AsyncImageFileView::Draw(UIContext &dc) {
|
2015-02-01 17:04:06 +00:00
|
|
|
if (!texture_ && !textureFailed_ && !filename_.empty()) {
|
2014-12-31 14:33:43 +00:00
|
|
|
texture_ = dc.GetThin3DContext()->CreateTextureFromFile(filename_.c_str(), DETECT);
|
|
|
|
if (!texture_)
|
|
|
|
textureFailed_ = true;
|
|
|
|
}
|
|
|
|
|
2015-02-02 09:05:23 +00:00
|
|
|
if (HasFocus()) {
|
|
|
|
dc.FillRect(dc.theme->itemFocusedStyle.background, bounds_.Expand(3));
|
|
|
|
}
|
|
|
|
|
2014-12-31 14:33:43 +00:00
|
|
|
// TODO: involve sizemode
|
|
|
|
if (texture_) {
|
|
|
|
dc.Flush();
|
|
|
|
dc.GetThin3DContext()->SetTexture(0, texture_);
|
|
|
|
dc.Draw()->Rect(bounds_.x, bounds_.y, bounds_.w, bounds_.h, color_);
|
2015-02-02 08:46:02 +00:00
|
|
|
dc.Flush();
|
|
|
|
dc.RebindTexture();
|
2015-02-01 17:04:06 +00:00
|
|
|
if (!text_.empty()) {
|
2015-02-02 08:46:02 +00:00
|
|
|
dc.DrawText(text_.c_str(), bounds_.centerX()+1, bounds_.centerY()+1, 0x80000000, ALIGN_CENTER | FLAG_DYNAMIC_ASCII);
|
2015-02-01 17:04:06 +00:00
|
|
|
dc.DrawText(text_.c_str(), bounds_.centerX(), bounds_.centerY(), 0xFFFFFFFF, ALIGN_CENTER | FLAG_DYNAMIC_ASCII);
|
|
|
|
}
|
2014-12-31 14:33:43 +00:00
|
|
|
} else {
|
2015-02-01 17:04:06 +00:00
|
|
|
if (!filename_.empty()) {
|
|
|
|
// draw a black rectangle to represent the missing screenshot.
|
|
|
|
dc.FillRect(UI::Drawable(0xFF000000), GetBounds());
|
|
|
|
} else {
|
|
|
|
// draw a dark gray rectangle to represent no save state.
|
|
|
|
dc.FillRect(UI::Drawable(0x50202020), GetBounds());
|
|
|
|
}
|
|
|
|
if (!text_.empty()) {
|
|
|
|
dc.DrawText(text_.c_str(), bounds_.centerX(), bounds_.centerY(), 0xFFFFFFFF, ALIGN_CENTER | FLAG_DYNAMIC_ASCII);
|
|
|
|
}
|
2014-12-31 14:33:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-31 19:42:28 +00:00
|
|
|
class ScreenshotViewScreen : public PopupScreen {
|
|
|
|
public:
|
2015-01-29 14:13:53 +00:00
|
|
|
ScreenshotViewScreen(std::string filename, std::string title, int slot, I18NCategory *i18n)
|
2015-02-01 17:04:06 +00:00
|
|
|
: PopupScreen(title, i18n->T("Load State"), "Back"), filename_(filename), slot_(slot) {} // PopupScreen will translate Back on its own
|
2014-12-31 19:42:28 +00:00
|
|
|
|
|
|
|
int GetSlot() const {
|
|
|
|
return slot_;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string tag() const override {
|
|
|
|
return "screenshot";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool FillVertical() const override { return false; }
|
|
|
|
bool ShowButtons() const override { return true; }
|
|
|
|
|
2015-09-17 18:29:37 +00:00
|
|
|
virtual void CreatePopupContents(UI::ViewGroup *parent) override {
|
2015-01-01 12:35:31 +00:00
|
|
|
// TODO: Find an appropriate size for the image view
|
2015-02-02 09:05:23 +00:00
|
|
|
parent->Add(new AsyncImageFileView(filename_, UI::IS_DEFAULT, NULL, new UI::LayoutParams(480, 272)))->SetCanBeFocused(false);
|
2014-12-31 19:42:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string filename_;
|
|
|
|
int slot_;
|
|
|
|
};
|
|
|
|
|
2014-12-31 14:33:43 +00:00
|
|
|
class SaveSlotView : public UI::LinearLayout {
|
|
|
|
public:
|
2015-09-23 17:29:39 +00:00
|
|
|
SaveSlotView(const std::string &gamePath, int slot, UI::LayoutParams *layoutParams = nullptr);
|
2014-12-31 14:33:43 +00:00
|
|
|
|
|
|
|
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override {
|
|
|
|
w = 500; h = 90;
|
|
|
|
}
|
|
|
|
|
2015-06-11 18:22:16 +00:00
|
|
|
void Draw(UIContext &dc) override;
|
2014-12-31 14:33:43 +00:00
|
|
|
|
2014-12-31 19:42:28 +00:00
|
|
|
int GetSlot() const {
|
|
|
|
return slot_;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetScreenshotFilename() const {
|
|
|
|
return screenshotFilename_;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetScreenshotTitle() const {
|
2015-09-23 17:29:39 +00:00
|
|
|
return SaveState::GetSlotDateAsString(gamePath_, slot_);
|
2014-12-31 19:42:28 +00:00
|
|
|
}
|
|
|
|
|
2014-12-31 14:33:43 +00:00
|
|
|
UI::Event OnStateLoaded;
|
|
|
|
UI::Event OnStateSaved;
|
2014-12-31 19:42:28 +00:00
|
|
|
UI::Event OnScreenshotClicked;
|
2014-12-31 14:33:43 +00:00
|
|
|
|
|
|
|
private:
|
2014-12-31 19:42:28 +00:00
|
|
|
UI::EventReturn OnScreenshotClick(UI::EventParams &e);
|
2014-12-31 14:33:43 +00:00
|
|
|
UI::EventReturn OnSaveState(UI::EventParams &e);
|
|
|
|
UI::EventReturn OnLoadState(UI::EventParams &e);
|
|
|
|
|
|
|
|
UI::Button *saveStateButton_;
|
|
|
|
UI::Button *loadStateButton_;
|
|
|
|
|
|
|
|
int slot_;
|
2015-09-23 17:29:39 +00:00
|
|
|
std::string gamePath_;
|
2014-12-31 19:42:28 +00:00
|
|
|
std::string screenshotFilename_;
|
2014-12-31 14:33:43 +00:00
|
|
|
};
|
|
|
|
|
2015-09-23 17:29:39 +00:00
|
|
|
SaveSlotView::SaveSlotView(const std::string &gameFilename, int slot, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), gamePath_(gameFilename), slot_(slot) {
|
2015-06-11 18:22:16 +00:00
|
|
|
using namespace UI;
|
|
|
|
|
2015-09-23 17:29:39 +00:00
|
|
|
screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, "jpg");
|
2016-02-14 21:07:10 +00:00
|
|
|
PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue();
|
2015-06-11 18:22:16 +00:00
|
|
|
Add(new Spacer(5));
|
|
|
|
|
|
|
|
AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, wq, new UI::LayoutParams(82 * 2, 47 * 2)));
|
|
|
|
fv->SetOverlayText(StringFromFormat("%i", slot_ + 1));
|
|
|
|
|
2015-07-01 22:13:35 +00:00
|
|
|
I18NCategory *pa = GetI18NCategory("Pause");
|
2015-06-11 18:22:16 +00:00
|
|
|
|
|
|
|
LinearLayout *buttons = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT));
|
|
|
|
buttons->SetSpacing(2.0);
|
|
|
|
Add(buttons);
|
|
|
|
|
2015-07-01 22:13:35 +00:00
|
|
|
saveStateButton_ = buttons->Add(new Button(pa->T("Save State"), new LinearLayoutParams(0.0, G_VCENTER)));
|
2015-06-11 18:22:16 +00:00
|
|
|
saveStateButton_->OnClick.Handle(this, &SaveSlotView::OnSaveState);
|
|
|
|
|
|
|
|
fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick);
|
|
|
|
|
2015-09-23 17:29:39 +00:00
|
|
|
if (SaveState::HasSaveInSlot(gamePath_, slot)) {
|
2015-07-01 22:13:35 +00:00
|
|
|
loadStateButton_ = buttons->Add(new Button(pa->T("Load State"), new LinearLayoutParams(0.0, G_VCENTER)));
|
2015-06-11 18:22:16 +00:00
|
|
|
loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState);
|
|
|
|
|
2015-09-23 17:29:39 +00:00
|
|
|
std::string dateStr = SaveState::GetSlotDateAsString(gamePath_, slot_);
|
2015-06-11 18:22:16 +00:00
|
|
|
std::vector<std::string> dateStrs;
|
|
|
|
SplitString(dateStr, ' ', dateStrs);
|
|
|
|
if (!dateStrs.empty() && !dateStrs[0].empty()) {
|
|
|
|
LinearLayout *strs = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT));
|
|
|
|
Add(strs);
|
|
|
|
for (size_t i = 0; i < dateStrs.size(); i++) {
|
|
|
|
strs->Add(new TextView(dateStrs[i], new LinearLayoutParams(0.0, G_VCENTER)))->SetShadow(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fv->SetFilename("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SaveSlotView::Draw(UIContext &dc) {
|
|
|
|
if (g_Config.iCurrentStateSlot == slot_) {
|
|
|
|
dc.FillRect(UI::Drawable(0x70000000), GetBounds().Expand(3));
|
|
|
|
dc.FillRect(UI::Drawable(0x70FFFFFF), GetBounds().Expand(3));
|
|
|
|
}
|
|
|
|
UI::LinearLayout::Draw(dc);
|
|
|
|
}
|
2014-12-31 14:33:43 +00:00
|
|
|
|
|
|
|
UI::EventReturn SaveSlotView::OnLoadState(UI::EventParams &e) {
|
|
|
|
g_Config.iCurrentStateSlot = slot_;
|
2015-09-23 17:29:39 +00:00
|
|
|
SaveState::LoadSlot(gamePath_, slot_, SaveState::Callback(), 0);
|
2014-12-31 14:33:43 +00:00
|
|
|
UI::EventParams e2;
|
2014-12-31 19:42:28 +00:00
|
|
|
e2.v = this;
|
2014-12-31 14:33:43 +00:00
|
|
|
OnStateLoaded.Trigger(e2);
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn SaveSlotView::OnSaveState(UI::EventParams &e) {
|
|
|
|
g_Config.iCurrentStateSlot = slot_;
|
2015-09-23 17:29:39 +00:00
|
|
|
SaveState::SaveSlot(gamePath_, slot_, SaveState::Callback(), 0);
|
2014-12-31 14:33:43 +00:00
|
|
|
UI::EventParams e2;
|
2014-12-31 19:42:28 +00:00
|
|
|
e2.v = this;
|
2014-12-31 14:33:43 +00:00
|
|
|
OnStateSaved.Trigger(e2);
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2014-12-31 19:42:28 +00:00
|
|
|
UI::EventReturn SaveSlotView::OnScreenshotClick(UI::EventParams &e) {
|
|
|
|
UI::EventParams e2;
|
|
|
|
e2.v = this;
|
|
|
|
OnScreenshotClicked.Trigger(e2);
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2014-12-22 09:48:17 +00:00
|
|
|
void GamePauseScreen::update(InputState &input) {
|
|
|
|
UpdateUIState(UISTATE_PAUSEMENU);
|
|
|
|
UIScreen::update(input);
|
2014-12-31 19:42:28 +00:00
|
|
|
|
|
|
|
if (finishNextFrame_) {
|
|
|
|
screenManager()->finishDialog(this, DR_CANCEL);
|
|
|
|
finishNextFrame_ = false;
|
|
|
|
}
|
2014-12-22 09:48:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GamePauseScreen::~GamePauseScreen() {
|
|
|
|
__DisplaySetWasPaused();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GamePauseScreen::CreateViews() {
|
|
|
|
static const int NUM_SAVESLOTS = 5;
|
|
|
|
|
|
|
|
using namespace UI;
|
2015-02-02 08:12:56 +00:00
|
|
|
Margins scrollMargins(0, 20, 0, 0);
|
|
|
|
Margins actionMenuMargins(0, 20, 15, 0);
|
2015-07-01 21:50:16 +00:00
|
|
|
I18NCategory *gr = GetI18NCategory("Graphics");
|
2015-07-01 22:13:35 +00:00
|
|
|
I18NCategory *pa = GetI18NCategory("Pause");
|
2014-12-22 09:48:17 +00:00
|
|
|
|
|
|
|
root_ = new LinearLayout(ORIENT_HORIZONTAL);
|
|
|
|
|
2015-02-02 08:12:56 +00:00
|
|
|
ViewGroup *leftColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0, scrollMargins));
|
2014-12-22 09:48:17 +00:00
|
|
|
root_->Add(leftColumn);
|
|
|
|
|
2015-02-16 21:41:01 +00:00
|
|
|
LinearLayout *leftColumnItems = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
|
2014-12-22 09:48:17 +00:00
|
|
|
leftColumn->Add(leftColumnItems);
|
|
|
|
|
2015-02-15 10:21:17 +00:00
|
|
|
leftColumnItems->Add(new Spacer(0.0));
|
2015-02-16 21:41:01 +00:00
|
|
|
leftColumnItems->SetSpacing(10.0);
|
2014-12-22 09:48:17 +00:00
|
|
|
for (int i = 0; i < NUM_SAVESLOTS; i++) {
|
2015-09-23 17:29:39 +00:00
|
|
|
SaveSlotView *slot = leftColumnItems->Add(new SaveSlotView(gamePath_, i, new LayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
2014-12-31 14:33:43 +00:00
|
|
|
slot->OnStateLoaded.Handle(this, &GamePauseScreen::OnState);
|
|
|
|
slot->OnStateSaved.Handle(this, &GamePauseScreen::OnState);
|
2014-12-31 19:42:28 +00:00
|
|
|
slot->OnScreenshotClicked.Handle(this, &GamePauseScreen::OnScreenshotClicked);
|
2014-12-22 09:48:17 +00:00
|
|
|
}
|
2015-02-15 10:21:17 +00:00
|
|
|
leftColumnItems->Add(new Spacer(0.0));
|
2014-12-22 09:48:17 +00:00
|
|
|
|
|
|
|
if (g_Config.iRewindFlipFrequency > 0) {
|
2015-07-01 22:13:35 +00:00
|
|
|
UI::Choice *rewindButton = leftColumnItems->Add(new Choice(pa->T("Rewind")));
|
2014-12-22 09:48:17 +00:00
|
|
|
rewindButton->SetEnabled(SaveState::CanRewind());
|
|
|
|
rewindButton->OnClick.Handle(this, &GamePauseScreen::OnRewind);
|
|
|
|
}
|
|
|
|
|
|
|
|
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
|
|
|
|
root_->Add(rightColumn);
|
|
|
|
|
|
|
|
LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
|
|
|
|
rightColumn->Add(rightColumnItems);
|
|
|
|
|
|
|
|
rightColumnItems->SetSpacing(0.0f);
|
|
|
|
if (getUMDReplacePermit()) {
|
2015-07-01 22:13:35 +00:00
|
|
|
rightColumnItems->Add(new Choice(pa->T("Switch UMD")))->OnClick.Handle(this, &GamePauseScreen::OnSwitchUMD);
|
2014-12-22 09:48:17 +00:00
|
|
|
}
|
2015-07-01 22:13:35 +00:00
|
|
|
Choice *continueChoice = rightColumnItems->Add(new Choice(pa->T("Continue")));
|
2014-12-22 09:48:17 +00:00
|
|
|
root_->SetDefaultFocusView(continueChoice);
|
|
|
|
continueChoice->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
|
|
|
|
|
|
|
std::string gameId = g_paramSFO.GetValueString("DISC_ID");
|
|
|
|
if (g_Config.hasGameConfig(gameId)) {
|
2015-07-01 22:13:35 +00:00
|
|
|
rightColumnItems->Add(new Choice(pa->T("Game Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings);
|
|
|
|
rightColumnItems->Add(new Choice(pa->T("Delete Game Config")))->OnClick.Handle(this, &GamePauseScreen::OnDeleteConfig);
|
2014-12-22 09:48:17 +00:00
|
|
|
} else {
|
2015-07-01 22:13:35 +00:00
|
|
|
rightColumnItems->Add(new Choice(pa->T("Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings);
|
|
|
|
rightColumnItems->Add(new Choice(pa->T("Create Game Config")))->OnClick.Handle(this, &GamePauseScreen::OnCreateConfig);
|
2014-12-22 09:48:17 +00:00
|
|
|
}
|
|
|
|
if (g_Config.bEnableCheats) {
|
2015-07-01 22:13:35 +00:00
|
|
|
rightColumnItems->Add(new Choice(pa->T("Cheats")))->OnClick.Handle(this, &GamePauseScreen::OnCwCheat);
|
2014-12-22 09:48:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO, also might be nice to show overall compat rating here?
|
|
|
|
// Based on their platform or even cpu/gpu/config. Would add an API for it.
|
|
|
|
if (Reporting::IsEnabled()) {
|
|
|
|
I18NCategory *rp = GetI18NCategory("Reporting");
|
|
|
|
rightColumnItems->Add(new Choice(rp->T("ReportButton", "Report Feedback")))->OnClick.Handle(this, &GamePauseScreen::OnReportFeedback);
|
|
|
|
}
|
|
|
|
rightColumnItems->Add(new Spacer(25.0));
|
2015-07-01 22:13:35 +00:00
|
|
|
rightColumnItems->Add(new Choice(pa->T("Exit to menu")))->OnClick.Handle(this, &GamePauseScreen::OnExitToMenu);
|
2014-12-22 09:48:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
|
|
|
|
screenManager()->push(new GameSettingsScreen(gamePath_));
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GamePauseScreen::onFinish(DialogResult result) {
|
|
|
|
// Do we really always need to "gpu->Resized" here?
|
|
|
|
if (gpu)
|
|
|
|
gpu->Resized();
|
|
|
|
Reporting::UpdateConfig();
|
|
|
|
}
|
|
|
|
|
2014-12-31 14:33:43 +00:00
|
|
|
UI::EventReturn GamePauseScreen::OnState(UI::EventParams &e) {
|
|
|
|
screenManager()->finishDialog(this, DR_CANCEL);
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2014-12-31 19:42:28 +00:00
|
|
|
void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
|
|
|
|
std::string tag = dialog->tag();
|
|
|
|
if (tag == "screenshot" && dr == DR_OK) {
|
|
|
|
ScreenshotViewScreen *s = (ScreenshotViewScreen *)dialog;
|
|
|
|
int slot = s->GetSlot();
|
|
|
|
g_Config.iCurrentStateSlot = slot;
|
2015-09-23 17:29:39 +00:00
|
|
|
SaveState::LoadSlot(gamePath_, slot, SaveState::Callback(), 0);
|
2014-12-31 19:42:28 +00:00
|
|
|
|
|
|
|
finishNextFrame_ = true;
|
2016-01-24 07:53:31 +00:00
|
|
|
} else {
|
|
|
|
// There may have been changes to our savestates, so let's recreate.
|
|
|
|
RecreateViews();
|
2014-12-31 19:42:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) {
|
2015-02-16 21:41:01 +00:00
|
|
|
SaveSlotView *v = static_cast<SaveSlotView *>(e.v);
|
|
|
|
int slot = v->GetSlot();
|
2015-02-15 10:21:17 +00:00
|
|
|
g_Config.iCurrentStateSlot = v->GetSlot();
|
2015-09-23 17:29:39 +00:00
|
|
|
if (SaveState::HasSaveInSlot(gamePath_, slot)) {
|
2015-02-16 21:41:01 +00:00
|
|
|
std::string fn = v->GetScreenshotFilename();
|
|
|
|
std::string title = v->GetScreenshotTitle();
|
2015-07-01 22:13:35 +00:00
|
|
|
I18NCategory *pa = GetI18NCategory("Pause");
|
2015-07-01 23:13:05 +00:00
|
|
|
Screen *screen = new ScreenshotViewScreen(fn, title, v->GetSlot(), pa);
|
2015-02-16 21:41:01 +00:00
|
|
|
screenManager()->push(screen);
|
|
|
|
}
|
2014-12-31 19:42:28 +00:00
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2014-12-22 09:48:17 +00:00
|
|
|
UI::EventReturn GamePauseScreen::OnExitToMenu(UI::EventParams &e) {
|
|
|
|
screenManager()->finishDialog(this, DR_OK);
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnReportFeedback(UI::EventParams &e) {
|
|
|
|
screenManager()->push(new ReportScreen(gamePath_));
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnRewind(UI::EventParams &e) {
|
|
|
|
SaveState::Rewind(SaveState::Callback(), 0);
|
|
|
|
|
|
|
|
screenManager()->finishDialog(this, DR_CANCEL);
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnCwCheat(UI::EventParams &e) {
|
|
|
|
screenManager()->push(new CwCheatScreen());
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnSwitchUMD(UI::EventParams &e) {
|
|
|
|
screenManager()->push(new UmdReplaceScreen());
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GamePauseScreen::CallbackDeleteConfig(bool yes)
|
|
|
|
{
|
|
|
|
if (yes) {
|
2016-02-14 21:07:10 +00:00
|
|
|
GameInfo *info = g_gameInfoCache->GetInfo(NULL, gamePath_, 0);
|
2014-12-22 09:48:17 +00:00
|
|
|
g_Config.unloadGameConfig();
|
2015-02-14 18:21:26 +00:00
|
|
|
g_Config.deleteGameConfig(info->id);
|
2015-09-10 15:17:26 +00:00
|
|
|
info->hasConfig = false;
|
2014-12-22 09:48:17 +00:00
|
|
|
screenManager()->RecreateAllViews();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn GamePauseScreen::OnCreateConfig(UI::EventParams &e)
|
|
|
|
{
|
|
|
|
std::string gameId = g_paramSFO.GetValueString("DISC_ID");
|
|
|
|
g_Config.createGameConfig(gameId);
|
|
|
|
g_Config.changeGameSpecific(gameId);
|
|
|
|
g_Config.saveGameConfig(gameId);
|
2016-02-14 21:07:10 +00:00
|
|
|
GameInfo *info = g_gameInfoCache->GetInfo(NULL, gamePath_, 0);
|
2015-09-10 15:17:26 +00:00
|
|
|
if (info) {
|
|
|
|
info->hasConfig = true;
|
|
|
|
}
|
2014-12-22 09:48:17 +00:00
|
|
|
|
|
|
|
screenManager()->topScreen()->RecreateViews();
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
UI::EventReturn GamePauseScreen::OnDeleteConfig(UI::EventParams &e)
|
|
|
|
{
|
2015-07-01 21:26:55 +00:00
|
|
|
I18NCategory *di = GetI18NCategory("Dialog");
|
2014-12-22 09:48:17 +00:00
|
|
|
I18NCategory *ga = GetI18NCategory("Game");
|
|
|
|
screenManager()->push(
|
2015-07-01 21:26:55 +00:00
|
|
|
new PromptScreen(di->T("DeleteConfirmGameConfig", "Do you really want to delete the settings for this game?"), ga->T("ConfirmDelete"), di->T("Cancel"),
|
2014-12-22 09:48:17 +00:00
|
|
|
std::bind(&GamePauseScreen::CallbackDeleteConfig, this, placeholder::_1)));
|
|
|
|
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GamePauseScreen::sendMessage(const char *message, const char *value) {
|
|
|
|
// Since the language message isn't allowed to be in native, we have to have add this
|
|
|
|
// to every screen which directly inherits from UIScreen(which are few right now, luckily).
|
|
|
|
if (!strcmp(message, "language")) {
|
|
|
|
screenManager()->RecreateAllViews();
|
|
|
|
}
|
|
|
|
}
|