Skip to content

Commit

Permalink
Add option to call raise(SIGINT) from libtas::main
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrs committed Jul 19, 2021
1 parent 5bafb46 commit 7f30086
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/library/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ void __attribute__((constructor)) init(void)
message = receiveMessage();
}

if (shared_config.sigint_upon_launch) {
raise(SIGINT);
}

/* Set the frame count to the initial frame count */
framecount = shared_config.initial_framecount;

Expand Down
7 changes: 7 additions & 0 deletions src/program/ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ void MainWindow::createMenus()

debugMenu->addSeparator();

sigintAction = debugMenu->addAction(tr("Raise SIGINT upon game launch (if debugging)"));
sigintAction->setCheckable(true);

debugMenu->addSeparator();

debugMenu->addActions(loggingOutputGroup->actions());
disabledActionsOnStart.append(loggingOutputGroup->actions());

Expand Down Expand Up @@ -1353,6 +1358,8 @@ void MainWindow::slotLaunch(bool attach_gdb)

setListFromRadio(loggingOutputGroup, context->config.sc.logging_status);

context->config.sc.sigint_upon_launch = context->attach_gdb && sigintAction->isChecked();

context->config.sc.mouse_support = mouseAction->isChecked();
setListFromRadio(joystickGroup, context->config.sc.nb_controllers);

Expand Down
1 change: 1 addition & 0 deletions src/program/ui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class MainWindow : public QMainWindow
QActionGroup *asyncGroup;

QActionGroup *debugStateGroup;
QAction *sigintAction;
QActionGroup *loggingOutputGroup;
QActionGroup *loggingPrintGroup;
QActionGroup *loggingExcludeGroup;
Expand Down
3 changes: 3 additions & 0 deletions src/shared/SharedConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ struct __attribute__((packed, aligned(8))) SharedConfig {

/* Send stack traces of all time calls to libTAS program */
bool time_trace = false;

/* Call raise(SIGINT) in libtas::init */
bool sigint_upon_launch = false;
};

#endif

0 comments on commit 7f30086

Please sign in to comment.