WIP: Create GUI program #1

Draft
luca0N wants to merge 7 commits from dev_gui into dev
Owner

Create GUI for Capsule in C++11 using libcapsule and wxWidgets.

  • Generate/create Makefile for CI
  • Fix segfault on close
  • Make CI actions
    • Linux (musl, dynamically linked, amd64)
    • Linux (glibc, dynamically linked, amd64)
    • Windows XP and later (MSVCRT, statically linked, i686) (see related comment)
Create GUI for Capsule in C++11 using libcapsule and wxWidgets. - [ ] Generate/create Makefile for CI - [x] Fix segfault on close - [ ] Make CI actions - [x] Linux (musl, dynamically linked, amd64) - [ ] Linux (glibc, dynamically linked, amd64) - [ ] Windows XP and later (MSVCRT, statically linked, i686) ([see related comment](https://git.luca0n.com/luca0N/Capsule/pulls/1#issuecomment-1766))
luca0N self-assigned this 2026-07-06 23:53:30 +00:00
Add initial source files for the Capsule GUI program, which uses
`libcapsule'.
gui/Capsule.cbp Outdated
@ -0,0 +33,4 @@
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-g" />
<Add directory="../libcapsule/src" />
Author
Owner

This won't work as libcapsule is written in C, and not C++, resulting in a compilation error.

This project should link with the library instead.

This won't work as libcapsule is written in C, and not C++, resulting in a compilation error. This project should link with the library instead.
Author
Owner

Recently, I've been trying to get the GUI program to run under Windows XP. Although that OS is extremely outdated, to me it makes sense to target it, seeing as this is an utility for a 2007 video game.

Using the MinGW GCC cross-compiler (from Alpine Linux to i686 Windows) introduced an issue: MinGW uses UCRT by default, and thus attempts to dynamically load a bunch of Windows API sets (api-ms-win-*.dll) on startup. These are supposedly available on Windows XP if the corresponding Visual C++ redistributable is installed, but I cannot confirm that at this time. I would also prefer for this program to be very lightweight and standalone. -static-libgcc shouldn't be a problem as this project is GPL licensed.

I've also tried using the MinGW32 toolchain with MSYS2 natively on Windows to build the GUI program, and it did work. This way, I was able to produce a statically linked, standalone program that ran on XP, so I believe it is possible to get the cross-compiler to work. There's also documentation on how to use MSVCRT (instead of UCRT) in the MinGW building documentation, but that would mean that I'd have to build MinGW manually. It would also mean that I'd have to create my own Docker image with this custom build of MinGW for CI workflows.

At this time I'm considering whether I want to continue with this wxWidgets C++ program. Creating an XP-compatible program with this codebase is possible, but I'm not sure I want to spend too much time on this very small side project. Last case scenario, I will just rewrite the GUI program in Lazarus (which I can already confirm works in XP 🙂).

CapsuleGUI-winxp

Recently, I've been trying to get the GUI program to run under Windows XP. Although that OS is extremely outdated, to me it makes sense to target it, seeing as this is an utility for a 2007 video game. Using the MinGW GCC cross-compiler (from Alpine Linux to i686 Windows) introduced an issue: MinGW uses UCRT by default, and thus attempts to dynamically load a bunch of Windows API sets (`api-ms-win-*.dll`) on startup. These are supposedly available on Windows XP if the corresponding Visual C++ redistributable is installed, but I cannot confirm that at this time. I would also prefer for this program to be very lightweight and standalone. `-static-libgcc` shouldn't be a problem as this project is GPL licensed. I've also tried using the MinGW32 toolchain with MSYS2 natively on Windows to build the GUI program, and it did work. This way, I was able to produce a statically linked, standalone program that ran on XP, so I believe it is possible to get the cross-compiler to work. There's also documentation on how to use MSVCRT (instead of UCRT) in the MinGW building documentation, but that would mean that I'd have to build MinGW manually. It would also mean that I'd have to create my own Docker image with this custom build of MinGW for CI workflows. At this time I'm considering whether I want to continue with this wxWidgets C++ program. Creating an XP-compatible program with this codebase is possible, but I'm not sure I want to spend too much time on this very small side project. Last case scenario, I will just rewrite the GUI program in Lazarus (which I can already confirm works in XP 🙂). ![CapsuleGUI-winxp](/attachments/ef411b6c-db78-4de4-ac10-a14f3ce0c99f)
luca0N force-pushed dev_gui from 29182d8b33 to d02ff9fbb4
All checks were successful
/ Test Capsule (CLI) (push) Successful in 23s
/ Test libcapsule (push) Successful in 21s
2026-07-10 11:28:14 +00:00
Compare
Author
Owner

Rebased with dev so that the CI workflow files use updated libcapsule instructions.

Rebased with `dev` so that the CI workflow files use updated `libcapsule` instructions.
Allow the user to drag and drop game save files to the Capsule GUI
program.
Author
Owner

There's a segmentation fault that's happening when closing the GUI program, so that needs to be sorted out before this PR gets merged.

There's a segmentation fault that's happening when closing the GUI program, so that needs to be sorted out before this PR gets merged.
Fix a segmentation fault crash that occurred when closing the Capsule
GUI by creating a new class that inherits wxDropTarget.
Author
Owner

Commit 09b2c2bf08 fixed the issue (see commit message). According to a user1, wxWidgets will free the drop target, resulting in a double free.

Commit 09b2c2bf08 fixed the issue (see commit message). According to a user[^1], wxWidgets will free the drop target, resulting in a double free. [^1]: https://stackoverflow.com/a/7096992
Author
Owner

@luca0N wrote in #1 (comment):

Recently, I've been trying to get the GUI program to run under Windows XP. Although that OS is extremely outdated, to me it makes sense to target it, seeing as this is an utility for a 2007 video game.

Using the MinGW GCC cross-compiler (from Alpine Linux to i686 Windows) introduced an issue: MinGW uses UCRT by default, and thus attempts to dynamically load a bunch of Windows API sets (api-ms-win-*.dll) on startup. These are supposedly available on Windows XP if the corresponding Visual C++ redistributable is installed, but I cannot confirm that at this time. I would also prefer for this program to be very lightweight and standalone. -static-libgcc shouldn't be a problem as this project is GPL licensed.

I've also tried using the MinGW32 toolchain with MSYS2 natively on Windows to build the GUI program, and it did work. This way, I was able to produce a statically linked, standalone program that ran on XP, so I believe it is possible to get the cross-compiler to work. There's also documentation on how to use MSVCRT (instead of UCRT) in the MinGW building documentation, but that would mean that I'd have to build MinGW manually. It would also mean that I'd have to create my own Docker image with this custom build of MinGW for CI workflows.

At this time I'm considering whether I want to continue with this wxWidgets C++ program. Creating an XP-compatible program with this codebase is possible, but I'm not sure I want to spend too much time on this very small side project. Last case scenario, I will just rewrite the GUI program in Lazarus (which I can already confirm works in XP 🙂).

CapsuleGUI-winxp

I was able to build both Mingw-w64 and wxWidgets statically under Alpine Linux. This problem will be solved with alpine-mingw-msvcrt.

@luca0N wrote in https://git.luca0n.com/luca0N/Capsule/pulls/1#issuecomment-1766: > Recently, I've been trying to get the GUI program to run under Windows XP. Although that OS is extremely outdated, to me it makes sense to target it, seeing as this is an utility for a 2007 video game. > > Using the MinGW GCC cross-compiler (from Alpine Linux to i686 Windows) introduced an issue: MinGW uses UCRT by default, and thus attempts to dynamically load a bunch of Windows API sets (`api-ms-win-*.dll`) on startup. These are supposedly available on Windows XP if the corresponding Visual C++ redistributable is installed, but I cannot confirm that at this time. I would also prefer for this program to be very lightweight and standalone. `-static-libgcc` shouldn't be a problem as this project is GPL licensed. > > I've also tried using the MinGW32 toolchain with MSYS2 natively on Windows to build the GUI program, and it did work. This way, I was able to produce a statically linked, standalone program that ran on XP, so I believe it is possible to get the cross-compiler to work. There's also documentation on how to use MSVCRT (instead of UCRT) in the MinGW building documentation, but that would mean that I'd have to build MinGW manually. It would also mean that I'd have to create my own Docker image with this custom build of MinGW for CI workflows. > > At this time I'm considering whether I want to continue with this wxWidgets C++ program. Creating an XP-compatible program with this codebase is possible, but I'm not sure I want to spend too much time on this very small side project. Last case scenario, I will just rewrite the GUI program in Lazarus (which I can already confirm works in XP :slightly_smiling_face:). > > [![CapsuleGUI-winxp](/attachments/ef411b6c-db78-4de4-ac10-a14f3ce0c99f)](/luca0N/Capsule/attachments/ef411b6c-db78-4de4-ac10-a14f3ce0c99f) I was able to build both Mingw-w64 and wxWidgets statically under Alpine Linux. This problem will be solved with [alpine-mingw-msvcrt](https://git.luca0n.com/luca0N/alpine-mingw-msvcrt).
When a game save file is opened, display its name in the frame title,
along with an asterisk prefix to indicate that the file has changed.
Fix the project end-of-line mode to Unix line endings (LF).
Add GUI test workflow
Some checks failed
/ Test Capsule (GUI) (push) Failing after 4s
5ef26062b5
Create new CI workflow for testing whether the GUI source code builds
without errors and warnings.
luca0N force-pushed dev_gui from 5ef26062b5
Some checks failed
/ Test Capsule (GUI) (push) Failing after 4s
to df7a6e1d72
Some checks failed
/ Test Capsule (GUI) (push) Failing after 33s
2026-07-18 23:13:03 +00:00
Compare
luca0N force-pushed dev_gui from df7a6e1d72
Some checks failed
/ Test Capsule (GUI) (push) Failing after 33s
to 23646d8323
Some checks failed
/ Test Capsule (GUI) (push) Failing after 39s
2026-07-18 23:15:25 +00:00
Compare
luca0N force-pushed dev_gui from 23646d8323
Some checks failed
/ Test Capsule (GUI) (push) Failing after 39s
to 5baca32e69
Some checks failed
/ Test Capsule (GUI) (push) Failing after 45s
2026-07-18 23:16:28 +00:00
Compare
Add missing libcapsule include
All checks were successful
/ Test Capsule (GUI) (push) Successful in 45s
557b113919
Include missing libcapsule header file to solve build errors.
Author
Owner

Some force-push operations were made to solve issues with the newly created CI workflow:

  • Force-push from 5ef26062b5 to df7a6e1d72: fixes invalid Alpine package name during dependency installation
  • Force-push from df7a6e1d72 to 23646d8323: replaces old libcapsule build instructions with the updated GNU Autotools instructions
  • Force-push from 23646d8323 to 5baca32e69: fixes incorrect GCC build option to treat all warnings as errors
Some force-push operations were made to solve issues with the newly created CI workflow: - Force-push from 5ef26062b5 to df7a6e1d72: fixes invalid Alpine package name during dependency installation - Force-push from df7a6e1d72 to 23646d8323: replaces old libcapsule build instructions with the updated GNU Autotools instructions - Force-push from 23646d8323 to 5baca32e69: fixes incorrect GCC build option to treat all warnings as errors
All checks were successful
/ Test Capsule (GUI) (push) Successful in 45s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin dev_gui:dev_gui
git switch dev_gui

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch dev
git merge --no-ff dev_gui
git switch dev_gui
git rebase dev
git switch dev
git merge --ff-only dev_gui
git switch dev_gui
git rebase dev
git switch dev
git merge --no-ff dev_gui
git switch dev
git merge --squash dev_gui
git switch dev
git merge --ff-only dev_gui
git switch dev
git merge dev_gui
git push origin dev
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
luca0N/Capsule!1
No description provided.