mirror of https://git.suyu.dev/suyu/suyu
commit
23bb870046
|
@ -75,7 +75,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||||
|
|
||||||
QStringList args = QApplication::arguments();
|
QStringList args = QApplication::arguments();
|
||||||
if (args.length() >= 2) {
|
if (args.length() >= 2) {
|
||||||
BootGame(args[1].toStdString());
|
BootGame(args[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GMainWindow::LoadROM(const std::string& filename) {
|
bool GMainWindow::LoadROM(const QString& filename) {
|
||||||
// Shutdown previous session if the emu thread is still active...
|
// Shutdown previous session if the emu thread is still active...
|
||||||
if (emu_thread != nullptr)
|
if (emu_thread != nullptr)
|
||||||
ShutdownGame();
|
ShutdownGame();
|
||||||
|
@ -290,12 +290,13 @@ bool GMainWindow::LoadROM(const std::string& filename) {
|
||||||
|
|
||||||
Core::System& system{Core::System::GetInstance()};
|
Core::System& system{Core::System::GetInstance()};
|
||||||
|
|
||||||
const Core::System::ResultStatus result{system.Load(render_window, filename)};
|
const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())};
|
||||||
|
|
||||||
if (result != Core::System::ResultStatus::Success) {
|
if (result != Core::System::ResultStatus::Success) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Core::System::ResultStatus::ErrorGetLoader:
|
case Core::System::ResultStatus::ErrorGetLoader:
|
||||||
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str());
|
LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!",
|
||||||
|
filename.toStdString().c_str());
|
||||||
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
QMessageBox::critical(this, tr("Error while loading ROM!"),
|
||||||
tr("The ROM format is not supported."));
|
tr("The ROM format is not supported."));
|
||||||
break;
|
break;
|
||||||
|
@ -335,7 +336,7 @@ bool GMainWindow::LoadROM(const std::string& filename) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::BootGame(const std::string& filename) {
|
void GMainWindow::BootGame(const QString& filename) {
|
||||||
LOG_INFO(Frontend, "Citra starting...");
|
LOG_INFO(Frontend, "Citra starting...");
|
||||||
StoreRecentFile(filename); // Put the filename on top of the list
|
StoreRecentFile(filename); // Put the filename on top of the list
|
||||||
|
|
||||||
|
@ -411,8 +412,8 @@ void GMainWindow::ShutdownGame() {
|
||||||
emulation_running = false;
|
emulation_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::StoreRecentFile(const std::string& filename) {
|
void GMainWindow::StoreRecentFile(const QString& filename) {
|
||||||
UISettings::values.recent_files.prepend(QString::fromStdString(filename));
|
UISettings::values.recent_files.prepend(filename);
|
||||||
UISettings::values.recent_files.removeDuplicates();
|
UISettings::values.recent_files.removeDuplicates();
|
||||||
while (UISettings::values.recent_files.size() > max_recent_files_item) {
|
while (UISettings::values.recent_files.size() > max_recent_files_item) {
|
||||||
UISettings::values.recent_files.removeLast();
|
UISettings::values.recent_files.removeLast();
|
||||||
|
@ -447,7 +448,7 @@ void GMainWindow::UpdateRecentFiles() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnGameListLoadFile(QString game_path) {
|
void GMainWindow::OnGameListLoadFile(QString game_path) {
|
||||||
BootGame(game_path.toStdString());
|
BootGame(game_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
|
void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
|
||||||
|
@ -470,20 +471,21 @@ void GMainWindow::OnMenuLoadFile() {
|
||||||
for (const auto& piece : game_list->supported_file_extensions)
|
for (const auto& piece : game_list->supported_file_extensions)
|
||||||
extensions += "*." + piece + " ";
|
extensions += "*." + piece + " ";
|
||||||
|
|
||||||
QString file_filter = tr("3DS executable") + " (" + extensions + ")";
|
QString file_filter = tr("3DS Executable") + " (" + extensions + ")";
|
||||||
|
file_filter += ";;" + tr("All Files (*.*)");
|
||||||
|
|
||||||
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"),
|
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"),
|
||||||
UISettings::values.roms_path, file_filter);
|
UISettings::values.roms_path, file_filter);
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
UISettings::values.roms_path = QFileInfo(filename).path();
|
UISettings::values.roms_path = QFileInfo(filename).path();
|
||||||
|
|
||||||
BootGame(filename.toStdString());
|
BootGame(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadSymbolMap() {
|
void GMainWindow::OnMenuLoadSymbolMap() {
|
||||||
QString filename = QFileDialog::getOpenFileName(
|
QString filename = QFileDialog::getOpenFileName(
|
||||||
this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol map (*)"));
|
this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol Map (*.*)"));
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
UISettings::values.symbols_path = QFileInfo(filename).path();
|
UISettings::values.symbols_path = QFileInfo(filename).path();
|
||||||
|
|
||||||
|
@ -506,7 +508,7 @@ void GMainWindow::OnMenuRecentFile() {
|
||||||
QString filename = action->data().toString();
|
QString filename = action->data().toString();
|
||||||
QFileInfo file_info(filename);
|
QFileInfo file_info(filename);
|
||||||
if (file_info.exists()) {
|
if (file_info.exists()) {
|
||||||
BootGame(filename.toStdString());
|
BootGame(filename);
|
||||||
} else {
|
} else {
|
||||||
// Display an error message and remove the file from the list.
|
// Display an error message and remove the file from the list.
|
||||||
QMessageBox::information(this, tr("File not found"),
|
QMessageBox::information(this, tr("File not found"),
|
||||||
|
@ -625,7 +627,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
|
||||||
QWidget::closeEvent(event);
|
QWidget::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSingleFileDropEvent(QDropEvent* event) {
|
static bool IsSingleFileDropEvent(QDropEvent* event) {
|
||||||
const QMimeData* mimeData = event->mimeData();
|
const QMimeData* mimeData = event->mimeData();
|
||||||
return mimeData->hasUrls() && mimeData->urls().length() == 1;
|
return mimeData->hasUrls() && mimeData->urls().length() == 1;
|
||||||
}
|
}
|
||||||
|
@ -634,7 +636,7 @@ void GMainWindow::dropEvent(QDropEvent* event) {
|
||||||
if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) {
|
if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) {
|
||||||
const QMimeData* mimeData = event->mimeData();
|
const QMimeData* mimeData = event->mimeData();
|
||||||
QString filename = mimeData->urls().at(0).toLocalFile();
|
QString filename = mimeData->urls().at(0).toLocalFile();
|
||||||
BootGame(filename.toStdString());
|
BootGame(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,14 +73,8 @@ private:
|
||||||
|
|
||||||
void ConnectWidgetEvents();
|
void ConnectWidgetEvents();
|
||||||
|
|
||||||
/**
|
bool LoadROM(const QString& filename);
|
||||||
* Initializes the emulation system.
|
void BootGame(const QString& filename);
|
||||||
* @param system_mode The system mode with which to intialize the kernel.
|
|
||||||
* @returns Whether the system was properly initialized.
|
|
||||||
*/
|
|
||||||
bool InitializeSystem(u32 system_mode);
|
|
||||||
bool LoadROM(const std::string& filename);
|
|
||||||
void BootGame(const std::string& filename);
|
|
||||||
void ShutdownGame();
|
void ShutdownGame();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +88,7 @@ private:
|
||||||
*
|
*
|
||||||
* @param filename the filename to store
|
* @param filename the filename to store
|
||||||
*/
|
*/
|
||||||
void StoreRecentFile(const std::string& filename);
|
void StoreRecentFile(const QString& filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the recent files menu.
|
* Updates the recent files menu.
|
||||||
|
|
Loading…
Reference in New Issue