Skip to content

Commit

Permalink
Add -j option, to control the number of hardware threads used by FX
Browse files Browse the repository at this point in the history
  • Loading branch information
SolraBizna committed Oct 6, 2017
1 parent 34ba457 commit 32bd04e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Data/Lang/en.utxt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion src/ars-emu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ std::unique_ptr<Display> 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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 32bd04e

Please sign in to comment.