Skip to content

feat: add game launch tracking and crash detection#92

Open
seventhback777 wants to merge 2 commits into
thoth-tech:mainfrom
seventhback777:feat/game-launch-tracking
Open

feat: add game launch tracking and crash detection#92
seventhback777 wants to merge 2 commits into
thoth-tech:mainfrom
seventhback777:feat/game-launch-tracking

Conversation

@seventhback777
Copy link
Copy Markdown

Summary

  • Process.h/cpp: overload processRunning() to return exit code; add killProcess() to terminate the full game process group via SIGTERM; improve error reporting
  • Menu.h/cpp: add m_launching, m_launchTime, m_launchError, m_lastExitCode to track game launch state and detect crashes; fix memory leak in destructor (ButtonNode linked list was never freed)
  • Process.cpp: use waitpid(WNOHANG) instead of getpgid for non-blocking exit-code capture; setpgid(0,0) in child so kill(-pid) covers the full game tree
  • Option.h/cpp: add destructor declaration; fix include order
  • AboutScreen.h/cpp: add m_gitContributions field for contributor stats
  • ArcadeMachine.cpp, Button.cpp, program.cpp: corresponding updates

Test plan

  • Game launches and launch state transitions correctly
  • Crash is detected and error message shown
  • No memory leak on menu destruction

seventhback777 and others added 2 commits May 23, 2026 18:18
- Process.h/cpp: overload processRunning() to return exit code; add
  killProcess() to terminate the full game process group via SIGTERM;
  improve error reporting and forward game stdout to stderr for debugging
- Menu.h/cpp: add m_launching, m_launchTime, m_launchError, m_lastExitCode
  to track game launch state and detect crashes; fix memory leak in
  destructor by freeing all ButtonNode/Button objects in the linked list;
  improve image load error reporting
- Process.cpp: use waitpid(WNOHANG) instead of getpgid for non-blocking
  exit-code capture; set new process group with setpgid so kill() covers
  the full game tree
- Option.h/cpp: add destructor declaration; fix include order
- AboutScreen.h/cpp: add m_gitContributions field for contributor stats
- ArcadeMachine.cpp, Button.cpp, program.cpp: corresponding updates
Copy link
Copy Markdown

@RealH4D35 RealH4D35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Tested on: Arch Linux

Compilation fixes needed (add these upstream):

  1. src/ConfigData.cpp: add #include <cstring> and #include <sys/stat.h>.
  2. src/Option.cpp: add const int ROWS = 2; const int COLS = 2; before createOptionsButtons().

Features work as expected:

  • spawnProcess sets process group; waitpid(WNOHANG) captures exit codes.
  • “Starting...” animation and on‑screen crash/launch errors appear.
  • ESC kills the entire game process group cleanly.
  • Memory leaks fixed: Menu and Option destructors free button lists.
  • Improved logging for image loading and resource bundles.

Pre‑existing issues (not caused by this PR):

  • Database stubs from PR #91 (or missing SplashKit DB API) still cause “Table creation failed”. This PR does not touch the database layer.
  • Some games lack Linux binaries or have symbol mismatches – unrelated to launch tracking.

Relationship to PR #91:

  • PR #91 (fix/cross-platform-fixes) is a separate branch that also modifies database stubs and Button.cpp. The two PRs are independent but may conflict. I recommend merging PR #91 first (after fixing its Button.cpp compilation error) and then rebasing this PR on top.

Ready to merge after adding the three missing declarations/includes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants