From 720e6ea0246b1709f1d629191be47cab436fc99a Mon Sep 17 00:00:00 2001 From: Eric Idogun Date: Sat, 28 Jun 2025 06:50:20 -0700 Subject: [PATCH 1/3] fix MacOS launch issue and also crash message upon application close --- .gitignore | 4 ++++ README.md | 6 ++++++ src/desktop/noo_canvas.cpp | 8 ++++++++ src/desktop/noo_frame.cpp | 23 +++++++++++++++++++++-- src/desktop/noo_frame.h | 1 + 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 49eda8d3..3c49b0d4 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,7 @@ bios9.bin firmware.bin gba_bios.bin sd.img +src/.DS_Store +.gitignore +.DS_Store +.gitignore diff --git a/README.md b/README.md index 233138ee..f7fc8081 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ project root directory and run `make -j$(nproc)` to start building. [PortAudio](https://www.portaudio.com). This can be done with the [Homebrew](https://brew.sh) package manager on macOS, or a built-in package manager on Linux. Run `make -j$(nproc)` in the project root directory to start building. +**macOS Applications Folder Fix:** If the app won't launch after copying to Applications, run these commands: +``` +xattr -rd com.apple.quarantine /Applications/NooDS.app +codesign --force --deep --sign - /Applications/NooDS.app +``` + **Android:** Install [Android Studio](https://developer.android.com/studio) or the command line tools. Run `./gradlew assembleDebug` in the project root directory to start building; dependencies will be installed as needed. diff --git a/src/desktop/noo_canvas.cpp b/src/desktop/noo_canvas.cpp index ddb38eb9..6f9d7db4 100644 --- a/src/desktop/noo_canvas.cpp +++ b/src/desktop/noo_canvas.cpp @@ -70,6 +70,14 @@ NooCanvas::NooCanvas(NooFrame *frame): CANVAS_CLASS(frame, wxID_ANY, CANVAS_PARA } NooCanvas::~NooCanvas() { +#ifdef USE_GL_CANVAS + // Clean up OpenGL context to prevent crashes + if (context) { + SetCurrent(*context); + glFinish(); + delete context; + } +#endif // Free the framebuffer if it was allocated if (frame->mainFrame) delete[] framebuffer; diff --git a/src/desktop/noo_frame.cpp b/src/desktop/noo_frame.cpp index 4445123b..6ef7f04e 100644 --- a/src/desktop/noo_frame.cpp +++ b/src/desktop/noo_frame.cpp @@ -271,6 +271,19 @@ NooFrame::NooFrame(NooApp *app, int id, std::string path, NooFrame *partner): loadRomPath(path); } +NooFrame::~NooFrame() { + // Clean up joystick and timer if they exist + if (timer) { + timer->Stop(); + delete timer; + timer = nullptr; + } + if (joystick) { + delete joystick; + joystick = nullptr; + } +} + void NooFrame::Refresh() { // Override the refresh function to also update the FPS counter wxFrame::Refresh(); @@ -800,10 +813,16 @@ void NooFrame::dropFiles(wxDropFilesEvent &event) { } void NooFrame::close(wxCloseEvent &event) { - // Properly shut down the emulator + // Properly shut down the emulator and cleanup (mainFrame ? this : partner)->stopCore(true); app->removeFrame(id); canvas->finish(); - if (partner) delete partner; + + // Clean up partner frame if it exists + if (partner) { + delete partner; + partner = nullptr; + } + event.Skip(true); } diff --git a/src/desktop/noo_frame.h b/src/desktop/noo_frame.h index 956042dc..39a7ed16 100644 --- a/src/desktop/noo_frame.h +++ b/src/desktop/noo_frame.h @@ -37,6 +37,7 @@ class NooFrame: public wxFrame { bool running = false; NooFrame(NooApp *app, int id = 0, std::string path = "", NooFrame *partner = nullptr); + ~NooFrame(); void Refresh(); void startCore(bool full); From 48cb37f1d7ad6f5d8634d689bc481161ff7c898f Mon Sep 17 00:00:00 2001 From: Tega Idogun Date: Fri, 6 Feb 2026 16:14:03 +0000 Subject: [PATCH 2/3] Remove redundant entries from .gitignore --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3c49b0d4..49eda8d3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,3 @@ bios9.bin firmware.bin gba_bios.bin sd.img -src/.DS_Store -.gitignore -.DS_Store -.gitignore From c3a6a29f4c3a7eb72853720e1ad234eef1c41628 Mon Sep 17 00:00:00 2001 From: Tega Idogun Date: Fri, 6 Feb 2026 16:15:10 +0000 Subject: [PATCH 3/3] Remove macOS launch fix instructions --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 6e0dbf53..443f881a 100644 --- a/README.md +++ b/README.md @@ -33,12 +33,6 @@ project root directory and run `make -j$(nproc)` to start building. [PortAudio](https://www.portaudio.com). This can be done with the [Homebrew](https://brew.sh) package manager on macOS, or a built-in package manager on Linux. Run `make -j$(nproc)` in the project root directory to start building. -**macOS Applications Folder Fix:** If the app won't launch after copying to Applications, run these commands: -``` -xattr -rd com.apple.quarantine /Applications/NooDS.app -codesign --force --deep --sign - /Applications/NooDS.app -``` - **Android:** Install [Android Studio](https://developer.android.com/studio) or the command line tools. Run `./gradlew assembleDebug` in the project root directory to start building; dependencies will be installed as needed.