Compare commits

..

9 Commits

Author SHA1 Message Date
Lioncash
8dd9cb98ce am: Utilize std::array within PopLaunchParameter()
Gets rid of the potential for C array-to-pointer decay, and also makes
pointer arithmetic to get the end of the copy range unnecessary. We can
just use std::array's begin() and end() member functions.
2018-08-21 11:03:14 -04:00
bunnei
c95c4442e9 Merge pull request #1143 from lioncash/inc
sdmc_factory: Remove unnecessary core include
2018-08-21 10:22:29 -04:00
bunnei
37f2ec6fc2 Merge pull request #1139 from lioncash/bitfield
bit_field: Convert ToBool() into explicit operator bool
2018-08-21 10:21:19 -04:00
bunnei
624239ed6b Merge pull request #1140 from FearlessTobi/port-4056
Port #4056 from Citra: "Add Clear Recent Files menu action"
2018-08-21 10:20:56 -04:00
Mat M
5678ec0dd0 Merge pull request #1144 from MerryMage/MAX_LAG_TIME_US
perf_stats: Change MAX_LAG_TIME_US to an appropriate value
2018-08-21 09:51:46 -04:00
MerryMage
3f4fb4b037 perf_stats: Change MAX_LAG_TIME_US to an appropriate value
25us is far too small, and would result in std::this_thread::sleep_for
being called with this as a maximum value. This means that a guest
application that produces frames instantly would only be limited to
40 kHz.

25ms is a more appropriate value, as it allows for a 60 Hz refresh
rate while providing enough slack in the negative region.
2018-08-21 14:50:50 +01:00
Lioncash
bfb28c5b3f sdmc_factory: Remove unnecessary core include
This doesn't require the central core header to be included, it just
needs the vfs headers.
2018-08-21 07:54:29 -04:00
fearlessTobi
6923ecee3a Port #4056 from Citra: "Add Clear Recent Files menu action" 2018-08-21 13:12:45 +02:00
Lioncash
36090521ce bit_field: Convert ToBool() into explicit operator bool
Gets rid of a TODO that is long overdue.
2018-08-21 06:39:45 -04:00
11 changed files with 32 additions and 52 deletions

View File

@@ -178,8 +178,7 @@ public:
return ExtractValue(storage);
}
// TODO: we may want to change this to explicit operator bool() if it's bug-free in VS2015
constexpr FORCE_INLINE bool ToBool() const {
constexpr explicit operator bool() const {
return Value() != 0;
}

View File

@@ -73,7 +73,7 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, SaveDataDescr
}
std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType type, u64 title_id,
u128 user_id, u64 save_id) {
u128 user_id, u64 save_id) const {
// According to switchbrew, if a save is of type SaveData and the title id field is 0, it should
// be interpreted as the title id of the current process.
if (type == SaveDataType::SaveData && title_id == 0)

View File

@@ -49,11 +49,11 @@ public:
ResultVal<VirtualDir> Open(SaveDataSpaceId space, SaveDataDescriptor meta);
static std::string GetFullPath(SaveDataSpaceId space, SaveDataType type, u64 title_id,
u128 user_id, u64 save_id);
private:
VirtualDir dir;
std::string GetFullPath(SaveDataSpaceId space, SaveDataType type, u64 title_id, u128 user_id,
u64 save_id) const;
};
} // namespace FileSys

View File

@@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include <memory>
#include "core/core.h"
#include "core/file_sys/sdmc_factory.h"
namespace FileSys {

View File

@@ -4,6 +4,7 @@
#pragma once
#include "core/file_sys/vfs.h"
#include "core/hle/result.h"
namespace FileSys {

View File

@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <array>
#include <cinttypes>
#include <stack>
#include "core/core.h"
@@ -625,16 +626,16 @@ IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationF
}
void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
constexpr u8 data[0x88] = {
constexpr std::array<u8, 0x88> data{{
0xca, 0x97, 0x94, 0xc7, // Magic
1, 0, 0, 0, // IsAccountSelected (bool)
1, 0, 0, 0, // User Id (word 0)
0, 0, 0, 0, // User Id (word 1)
0, 0, 0, 0, // User Id (word 2)
0, 0, 0, 0 // User Id (word 3)
};
}};
std::vector<u8> buffer(data, data + sizeof(data));
std::vector<u8> buffer(data.begin(), data.end());
IPC::ResponseBuilder rb{ctx, 2, 0, 1};

View File

@@ -76,7 +76,7 @@ double PerfStats::GetLastFrameTimeScale() {
void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) {
// Max lag caused by slow frames. Can be adjusted to compensate for too many slow frames. Higher
// values increase the time needed to recover and limit framerate again after spikes.
constexpr microseconds MAX_LAG_TIME_US = 25us;
constexpr microseconds MAX_LAG_TIME_US = 25000us;
if (!Settings::values.toggle_framelimit) {
return;

View File

@@ -327,7 +327,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
QAction* open_save_location = context_menu.addAction(tr("Open Save Data Location"));
open_save_location->setEnabled(program_id != 0);
connect(open_save_location, &QAction::triggered,
[&]() { emit OpenFolderRequested(program_id, GameListOpenTarget::SaveData); });
[&]() { emit OpenSaveFolderRequested(program_id); });
context_menu.exec(tree_view->viewport()->mapToGlobal(menu_location));
}

View File

@@ -21,8 +21,6 @@
class GameListWorker;
enum class GameListOpenTarget { SaveData };
class GameList : public QWidget {
Q_OBJECT
@@ -78,7 +76,7 @@ public:
signals:
void GameChosen(QString game_path);
void ShouldCancelWorker();
void OpenFolderRequested(u64 program_id, GameListOpenTarget target);
void OpenSaveFolderRequested(u64 program_id);
private slots:
void onTextChanged(const QString& newText);
@@ -101,5 +99,3 @@ private:
GameListWorker* current_worker = nullptr;
QFileSystemWatcher* watcher = nullptr;
};
Q_DECLARE_METATYPE(GameListOpenTarget);

View File

@@ -30,7 +30,6 @@
#include "core/file_sys/bis_factory.h"
#include "core/file_sys/card_image.h"
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/savedata_factory.h"
#include "core/file_sys/vfs_real.h"
#include "core/gdbstub/gdbstub.h"
#include "core/loader/loader.h"
@@ -216,6 +215,14 @@ void GMainWindow::InitializeRecentFileMenuActions() {
ui.menu_recent_files->addAction(actions_recent_files[i]);
}
ui.menu_recent_files->addSeparator();
QAction* action_clear_recent_files = new QAction(this);
action_clear_recent_files->setText(tr("Clear Recent Files"));
connect(action_clear_recent_files, &QAction::triggered, this, [this] {
UISettings::values.recent_files.clear();
UpdateRecentFiles();
});
ui.menu_recent_files->addAction(action_clear_recent_files);
UpdateRecentFiles();
}
@@ -304,7 +311,8 @@ void GMainWindow::RestoreUIState() {
void GMainWindow::ConnectWidgetEvents() {
connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
connect(game_list, &GameList::OpenFolderRequested, this, &GMainWindow::OnGameListOpenFolder);
connect(game_list, &GameList::OpenSaveFolderRequested, this,
&GMainWindow::OnGameListOpenSaveFolder);
connect(this, &GMainWindow::EmulationStarting, render_window,
&GRenderWindow::OnEmulationStarting);
@@ -477,6 +485,8 @@ bool GMainWindow::LoadROM(const QString& filename) {
}
return false;
}
game_path = filename;
Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt");
return true;
}
@@ -547,6 +557,8 @@ void GMainWindow::ShutdownGame() {
emu_frametime_label->setVisible(false);
emulation_running = false;
game_path.clear();
}
void GMainWindow::StoreRecentFile(const QString& filename) {
@@ -584,37 +596,8 @@ void GMainWindow::OnGameListLoadFile(QString game_path) {
BootGame(game_path);
}
void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target) {
std::string path;
std::string open_target;
switch (target) {
case GameListOpenTarget::SaveData: {
open_target = "Save Data";
const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
ASSERT(program_id != 0);
// TODO(tech4me): Update this to work with arbitrary user profile
// Refer to core/hle/service/acc/profile_manager.cpp ProfileManager constructor
constexpr u128 user_id = {1, 0};
path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
FileSys::SaveDataType::SaveData,
program_id, user_id, 0);
break;
}
default:
UNIMPLEMENTED();
}
const QString qpath = QString::fromStdString(path);
const QDir dir(qpath);
if (!dir.exists()) {
QMessageBox::warning(this,
tr("Error Opening %1 Folder").arg(QString::fromStdString(open_target)),
tr("Folder does not exist!"));
return;
}
LOG_INFO(Frontend, "Opening {} path for program_id={:016x}", open_target, program_id);
QDesktopServices::openUrl(QUrl::fromLocalFile(qpath));
void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
UNIMPLEMENTED();
}
void GMainWindow::OnMenuLoadFile() {

View File

@@ -21,7 +21,6 @@ class GRenderWindow;
class MicroProfileDialog;
class ProfilerWidget;
class WaitTreeWidget;
enum class GameListOpenTarget;
namespace Tegra {
class DebugContext;
@@ -123,7 +122,7 @@ private slots:
void OnStopGame();
/// Called whenever a user selects a game in the game list widget.
void OnGameListLoadFile(QString game_path);
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
void OnGameListOpenSaveFolder(u64 program_id);
void OnMenuLoadFile();
void OnMenuLoadFolder();
void OnMenuInstallToNAND();
@@ -162,6 +161,8 @@ private:
// Whether emulation is currently running in yuzu.
bool emulation_running = false;
std::unique_ptr<EmuThread> emu_thread;
// The path to the game currently running
QString game_path;
// FS
FileSys::VirtualFilesystem vfs;