cli: support loading multiple roms at once and surpressing file dialogs

このコミットが含まれているのは:
Luke Usher 2023-07-17 20:26:06 +01:00
コミット dafb57010c
5個のファイルの変更31行の追加8行の削除

ファイルの表示

@ -105,7 +105,7 @@ Command-line options
When started from the command-line, ares accepts a few options.
```
Usage: ./ares [options] game
Usage: ./ares [options] game(s)
--help Displays available options and exit
--fullscreen Start in full screen mode
@ -113,6 +113,7 @@ Usage: ./ares [options] game
--shader shader Specify GLSL shader name to load (requires OpenGL driver)
--setting name=value Specify a value for a setting
--dump-all-settings Show a list of all existing settings and exit
--no-file-prompt Do not prompt to load (optional) additional roms (eg: 64DD)
```
The --system option is useful when the system type cannot be auto-detected.
@ -121,6 +122,17 @@ The --system option is useful when the system type cannot be auto-detected.
Example:
`ares --system MSX examples.rom --fullscreen`
Specifying multiple games allows for multi-cart support. For example, to load
the Super GameBoy BIOS and a game in one command (to avoid a file prompt), you
can do:
`ares "Super GameBoy.sfc" "Super Mario Land.gb"`
The --no-file-prompt option is useful if you wish to launch a game from CLI
without being prompted to load additional roms. For example, some Nintendo 64
games optionally support 64DD expansion disks, so this option can be used to
suppress the "64DD Disk" file dialog, and assume any secondary content is
disconnected.
High-level Components
---------------------

ファイルの表示

@ -68,6 +68,10 @@ auto nall::main(Arguments arguments) -> void {
program.startShader = shader;
}
if(arguments.take("--no-file-prompt")) {
program.noFilePrompt = true;
}
inputManager.create();
Emulator::construct();
settings.load();
@ -93,7 +97,7 @@ auto nall::main(Arguments arguments) -> void {
}
if(arguments.take("--help")) {
print("Usage: ares [OPTIONS]... game\n\n");
print("Usage: ares [OPTIONS]... game(s)\n\n");
print("Options:\n");
print(" --help Displays available options and exit\n");
#if defined(PLATFORM_WINDOWS)
@ -104,6 +108,7 @@ auto nall::main(Arguments arguments) -> void {
print(" --shader name Specify the name of the shader to use\n");
print(" --setting name=value Specify a value for a setting\n");
print(" --dump-all-settings Show a list of all existing settings and exit\n");
print(" --no-file-prompt Do not prompt to load (optional) additional roms (eg: 64DD)\n");
print("\n");
print("Available Systems:\n");
print(" ");
@ -126,8 +131,9 @@ auto nall::main(Arguments arguments) -> void {
return;
}
program.startGameLoad.reset();
for(auto argument : arguments) {
if(file::exists(argument)) program.startGameLoad = argument;
if(file::exists(argument)) program.startGameLoad.append(argument);
}
Instances::presentation.construct();

ファイルの表示

@ -72,7 +72,9 @@ auto Emulator::load(shared_pointer<mia::Pak> pak, string& path) -> string {
string location;
if(locationQueue) {
location = locationQueue.takeFirst(); //pull from the game queue if an entry is available
} else {
} else if(program.startGameLoad) {
location = program.startGameLoad.takeFirst(); //pull from the command line if an entry is available
} else if(!program.noFilePrompt) {
BrowserDialog dialog;
dialog.setTitle({"Load ", pak->name(), " Game"});
dialog.setPath(path ? path : Path::desktop());

ファイルの表示

@ -21,10 +21,11 @@ auto Program::create() -> void {
driverSettings.inputRefresh();
if(startGameLoad) {
auto gameToLoad = startGameLoad.takeFirst();
if(startSystem) {
for(auto &emulator: emulators) {
if(emulator->name == startSystem) {
if(load(emulator, startGameLoad)) {
if(load(emulator, gameToLoad)) {
if(startFullScreen) videoFullScreenToggle();
}
return;
@ -32,8 +33,8 @@ auto Program::create() -> void {
}
}
if(auto emulator = identify(startGameLoad)) {
if(load(emulator, startGameLoad)) {
if(auto emulator = identify(gameToLoad)) {
if(load(emulator, gameToLoad)) {
if(startFullScreen) videoFullScreenToggle();
}
}

ファイルの表示

@ -53,7 +53,9 @@ struct Program : ares::Platform {
auto inputDriverUpdate() -> void;
bool startFullScreen = false;
string startGameLoad;
vector<string> startGameLoad;
bool noFilePrompt = false;
string startSystem;
string startShader;