Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions SerialPrograms/Source/CommonFramework/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@ int run_program(int argc, char *argv[]){



ScopeExit cleanup([]{
#ifdef PA_SDL
global_gamepad_tracker().stop();
#endif
SerialPortPoller::instance().stop();
GlobalMediaServices::instance().stop();
});

// Several novice developers struggled to build and run the program due to missing Resources folder.
// Add this check to pop a message box when Resources folder is missing.
if (!check_resource_folder(logger)){
Expand All @@ -208,13 +200,6 @@ int run_program(int argc, char *argv[]){
logger.log(error.message(), COLOR_RED);
}

// Load the Switch framework settings now, not only when their panel is opened.
OptionsPanelWrapper<NintendoSwitch::ConsoleSettingsPanel>().make_panel()->load_json_from_global();

// Preload a bunch of stuff now so they are ready later.
SerialPortPoller::instance().ports();
get_all_cameras();

// Force all the Qt thread pools to be constructed now on the main thread.
GlobalThreadPools::qt_worker_threadpool();
GlobalThreadPools::qt_event_threadpool();
Expand Down Expand Up @@ -246,10 +231,27 @@ int run_program(int argc, char *argv[]){
return 1;
}

// Tests need no console, serial port or camera. Return before touching
// them, so tests can run while another instance holds the devices.
if (GlobalSettings::instance().COMMAND_LINE_TEST_MODE){
return run_command_line_tests(augment_test_color_distortions, test_substring);
}

ScopeExit cleanup([]{
#ifdef PA_SDL
global_gamepad_tracker().stop();
#endif
SerialPortPoller::instance().stop();
GlobalMediaServices::instance().stop();
});

// Load the Switch framework settings now, not only when their panel is opened.
OptionsPanelWrapper<NintendoSwitch::ConsoleSettingsPanel>().make_panel()->load_json_from_global();

// Preload a bunch of stuff now so they are ready later.
SerialPortPoller::instance().ports();
get_all_cameras();

// Check whether the hardware is powerful enough to run this program.
if (!check_hardware()){
return 1;
Expand Down
Loading