diff --git a/Data/Lang/en.utxt b/Data/Lang/en.utxt index cf7c8ae..59dc92b 100644 --- a/Data/Lang/en.utxt +++ b/Data/Lang/en.utxt @@ -29,6 +29,10 @@ Known options: fast_debug: Scanline-based renderer, built-in (English only) debugger. fast_intprof: Scanline-based renderer. Does some simple performance profiling of the emulated code and outputs it on stdout. +-j: Specify the number of hardware threads to use for graphical effects. A + value of 1 disables multithreaded effects processing, and a value of 0 (the + default) tries to automatically detect the number of hardware threads + available. -C: Always allow access to emulator configuration features (implies -q) -z: Never allow access to emulator configuration features, even for embedded copies of SimpleConfig diff --git a/src/ars-emu.cc b/src/ars-emu.cc index ee462e4..fd8ed71 100644 --- a/src/ars-emu.cc +++ b/src/ars-emu.cc @@ -40,6 +40,7 @@ std::unique_ptr ARS::display; uint16_t ARS::last_known_pc; namespace { + unsigned int thread_count = 0; uint8_t bankMap[8]; std::string rom_path; bool rom_path_specified = false; @@ -193,6 +194,18 @@ namespace { } } break; + case 'j': + if(n >= argc) { + sn.Out(std::cout, "MISSING_COMMAND_LINE_ARGUMENT"_Key, {"-j"}); + valid = false; + } + else { + std::string nextarg = argv[n++]; + unsigned long l = std::stoul(nextarg); + if(l > 128) l = 128; // we can't make much use of more cores + thread_count = l; + } + break; case 'd': allow_debug_port = true; break; @@ -374,7 +387,7 @@ extern "C" int teg_main(int argc, char** argv) { PrefsLogic::DefaultsAll(); PrefsLogic::LoadAll(); ARS::init_apu(); - FX::init(); + FX::init(thread_count); window_title = sn.Get("WINDOW_TITLE"_Key, {rom_path}); display = safe_mode ? Display::makeSafeModeDisplay() : Display::makeConfiguredDisplay();