mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-23 18:20:10 +00:00
Added settings for autoloading games, added qt-specific autoplay and map loading settings.
Also changed the comments in the default ini to look more clear and not invoke parsing errors
This commit is contained in:
parent
2432f317e4
commit
fa273cbb15
@ -28,17 +28,21 @@ int __cdecl main(int argc, char **argv) {
|
||||
logging_thread.join();
|
||||
});
|
||||
|
||||
if (argc < 2) {
|
||||
Config config;
|
||||
log_filter.ParseFilterString(Settings::values.log_filter);
|
||||
|
||||
std::string boot_filename;
|
||||
if (argc >= 2) {
|
||||
// TODO: Better argument parsing
|
||||
boot_filename = argv[1];
|
||||
} else if (!Settings::values.autoload_game_path.empty()) {
|
||||
boot_filename = Settings::values.autoload_game_path;
|
||||
} else {
|
||||
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Config config;
|
||||
log_filter.ParseFilterString(Settings::values.log_filter);
|
||||
|
||||
std::string boot_filename = argv[1];
|
||||
EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
|
||||
|
||||
System::Init(emu_window);
|
||||
|
||||
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
|
||||
|
@ -66,6 +66,7 @@ void Config::ReadValues() {
|
||||
|
||||
// Miscellaneous
|
||||
Settings::values.log_filter = glfw_config->Get("Miscellaneous", "log_filter", "*:Info");
|
||||
Settings::values.autoload_game_path = glfw_config->Get("Miscellaneous", "autoload_game_path", "");
|
||||
}
|
||||
|
||||
void Config::Reload() {
|
||||
|
@ -27,15 +27,34 @@ pad_sleft =
|
||||
pad_sright =
|
||||
|
||||
[Core]
|
||||
cpu_core = ## 0: Interpreter (default), 1: OldInterpreter (may work better, soon to be deprecated)
|
||||
gpu_refresh_rate = ## 30 (default)
|
||||
frame_skip = ## 0: No frameskip (default), 1 : 2x frameskip, 2 : 4x frameskip, etc.
|
||||
# The CPU core to be enabled
|
||||
# 0 (default): Interpreter, 1: Old interpreter (soon to be deprecated)
|
||||
cpu_core =
|
||||
|
||||
# The refresh rate for the GPU
|
||||
# Defaults to 30
|
||||
gpu_refresh_rate =
|
||||
|
||||
# The applied frameskip amount. Must be a power of two.
|
||||
# 0 (default): No frameskip, 1: x2 frameskip, 2: x4 frameskip, 3: x8 frameskip, etc.
|
||||
frame_skip =
|
||||
|
||||
|
||||
[Data Storage]
|
||||
# Whether to create a virtual SD card.
|
||||
# 1 (default): Yes, 0: No
|
||||
use_virtual_sd =
|
||||
|
||||
|
||||
[Miscellaneous]
|
||||
log_filter = *:Info ## Examples: *:Debug Kernel.SVC:Trace Service.*:Critical
|
||||
# A filter which removes logs below a certain logging level.
|
||||
# Examples: *:Debug Kernel.SVC:Trace Service.*:Critical
|
||||
log_filter = *:Info
|
||||
|
||||
|
||||
# Path for to a game file to be autoloaded by Citra.
|
||||
# Leave blank for no autoloading. Overridden by path passed as a console argument.
|
||||
autoload_game_path =
|
||||
)";
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ set(SRCS
|
||||
bootmanager.cpp
|
||||
hotkeys.cpp
|
||||
main.cpp
|
||||
settings.cpp
|
||||
citra-qt.rc
|
||||
)
|
||||
|
||||
@ -37,6 +38,7 @@ set(HEADERS
|
||||
bootmanager.h
|
||||
hotkeys.h
|
||||
main.h
|
||||
settings.h
|
||||
version.h
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
#include "core/core.h"
|
||||
#include "common/file_util.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "citra_qt/config.h"
|
||||
#include "citra_qt/settings.h"
|
||||
|
||||
Config::Config() {
|
||||
|
||||
@ -54,6 +55,9 @@ void Config::ReadValues() {
|
||||
|
||||
qt_config->beginGroup("Miscellaneous");
|
||||
Settings::values.log_filter = qt_config->value("log_filter", "*:Info").toString().toStdString();
|
||||
Settings::qt_values.autoplay_game = qt_config->value("autoplay_game", true).toBool();
|
||||
Settings::values.autoload_game_path = qt_config->value("autoload_game_path", "").toString().toStdString();
|
||||
Settings::qt_values.autoload_map_path = qt_config->value("autoload_map_path", "").toString().toStdString();
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
@ -90,6 +94,9 @@ void Config::SaveValues() {
|
||||
|
||||
qt_config->beginGroup("Miscellaneous");
|
||||
qt_config->setValue("log_filter", QString::fromStdString(Settings::values.log_filter));
|
||||
qt_config->setValue("autoplay_game", Settings::qt_values.autoplay_game);
|
||||
qt_config->setValue("autoload_game_path", QString::fromStdString(Settings::values.autoload_game_path));
|
||||
qt_config->setValue("autoload_map_path", QString::fromStdString(Settings::qt_values.autoload_map_path));
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "core/loader/loader.h"
|
||||
#include "core/arm/disassembler/load_symbol_map.h"
|
||||
#include "citra_qt/config.h"
|
||||
#include "citra_qt/settings.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
@ -143,7 +144,14 @@ GMainWindow::GMainWindow()
|
||||
|
||||
QStringList args = QApplication::arguments();
|
||||
if (args.length() >= 2) {
|
||||
// TODO: Better argument parsing
|
||||
BootGame(args[1].toStdString());
|
||||
} else if (!Settings::values.autoload_game_path.empty()) {
|
||||
BootGame(Settings::values.autoload_game_path);
|
||||
}
|
||||
|
||||
if (!Settings::qt_values.autoload_map_path.empty()) {
|
||||
LoadSymbolMap(Settings::qt_values.autoload_map_path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +182,9 @@ void GMainWindow::BootGame(std::string filename)
|
||||
render_window->GetEmuThread().start();
|
||||
|
||||
render_window->show();
|
||||
OnStartGame();
|
||||
|
||||
if (Settings::qt_values.autoplay_game)
|
||||
OnStartGame();
|
||||
}
|
||||
|
||||
void GMainWindow::OnMenuLoadFile()
|
||||
@ -259,7 +269,6 @@ void GMainWindow::closeEvent(QCloseEvent* event)
|
||||
settings.setValue("state", saveState());
|
||||
settings.setValue("geometryRenderWindow", render_window->saveGeometry());
|
||||
settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked());
|
||||
settings.setValue("firstStart", false);
|
||||
SaveHotkeys(settings);
|
||||
|
||||
render_window->close();
|
||||
|
11
src/citra_qt/settings.cpp
Normal file
11
src/citra_qt/settings.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "citra_qt/settings.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
QtValues qt_values;
|
||||
|
||||
}
|
21
src/citra_qt/settings.h
Normal file
21
src/citra_qt/settings.h
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2014 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
// These are settings that apply only to the Qt frontend.
|
||||
// Hence, they shouldn't be put in Core but instead here.
|
||||
namespace Settings {
|
||||
|
||||
struct QtValues {
|
||||
// Whether a loaded game is automatically started on load.
|
||||
bool autoplay_game;
|
||||
|
||||
// A map file path to automatically load on init.
|
||||
std::string autoload_map_path;
|
||||
} extern qt_values;
|
||||
|
||||
}
|
@ -23,7 +23,9 @@ void LoadSymbolMap(std::string filename) {
|
||||
while (std::getline(infile, line)) {
|
||||
std::istringstream iss(line);
|
||||
if (!(iss >> address_str >> size >> function_name)) {
|
||||
break; // Error parsing
|
||||
Symbols::Clear();
|
||||
LOG_ERROR(Frontend, "Could not load symbol map.");
|
||||
break; // Error while parsing
|
||||
}
|
||||
u32 address = std::stoul(address_str, nullptr, 16);
|
||||
|
||||
|
@ -36,6 +36,8 @@ struct Values {
|
||||
// Data Storage
|
||||
bool use_virtual_sd;
|
||||
|
||||
// Misc
|
||||
std::string autoload_game_path;
|
||||
std::string log_filter;
|
||||
} extern values;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user