diff --git a/platforms/flatpak/.gitignore b/platforms/flatpak/.gitignore new file mode 100644 index 00000000..02f99beb --- /dev/null +++ b/platforms/flatpak/.gitignore @@ -0,0 +1,2 @@ +#Ignore any files created during the build of the Flatpak application +.flatpak-builder/ diff --git a/platforms/flatpak/Makefile b/platforms/flatpak/Makefile new file mode 100644 index 00000000..6d8ac0c4 --- /dev/null +++ b/platforms/flatpak/Makefile @@ -0,0 +1,9 @@ +include ../desktop-shared/Makefile.sources + +SOURCES_CXX += $(DESKTOP_SRC_DIR)/nfd/nfd_portal.cpp +CPPFLAGS += `pkg-config --cflags dbus-1` +CPPFLAGS += -DPREVENT_ROM_FOLDER_USAGE +LDFLAGS += `pkg-config --libs dbus-1` + +include ../desktop-shared/Makefile.common +include ../desktop-shared/Makefile.install diff --git a/platforms/flatpak/README.md b/platforms/flatpak/README.md new file mode 100644 index 00000000..8c9b4bb6 --- /dev/null +++ b/platforms/flatpak/README.md @@ -0,0 +1,153 @@ +# Flatpak Platform for Gearsystem + +[Flatpak](https://flatpak.org/) is a method of packaging and distributing +applications independent of the operating system and surrounding dependencies. +These applications also take advantage of sandboxing for security purposes, only +allowing applications access to services and files that they require. + +Gearsystem can be built as a Flatpak application to take advantage of the +packaging format as well as the sandbox features available. + +## Features + +Building and distributing Gearsystem as a Flatpak has the following key +advantages: + +* **Embedded SDL, GLU and GLEW libraries**. Compared to manual installation, + all dependencies are included and sandboxed within the Gearsystem application. + Outside of Flatpak's setup, no prerequisite commands are required! +* **Automatically created Desktop entries**. The Flatpak installation comes with + the appropriate files to define desktop and menu entries for Gearsystem, + allowing for the application to be quickly started from anywhere. These are + also removed entirely when the application is uninstalled. +* **Consistent development environment**. Similar to how the application is + sandboxed, the build environment is also sandboxed, ensuring all developers + have the same experience when enhancing or troubleshooting Gearsystem. + +This unfortunately comes with some trade-offs in functionality: + +* **Adjacent Save files and Savestate files cannot be loaded**. The API used to + load files into Gearsystem only loads specific files or directories. When + this is done, only those file are permitted within the sandbox, resulting in + adjacent files being invisible to the Gearsystem application. Instead, the + application will only save files separate directory. +* **Some file paths may not reflect real paths**. As part of the above + sandboxing, files can appear in Gearsystem to come from another location. + These files are physically the same and use the same file name, but it can be + a jarring first experience. + +## Getting Started + +This section is dedicated to preparing the development environment for +Gearsystem. This allows for building in-development versions and contributing +changes to Gearsystem. These instructions will predominantly use the +command-line and assume that `bash` is the shell being used. + +1. **Install Flatpak and Flatpak builder** + + Flatpak can be installed by following [the quick setup steps for your + distribution][Flatpak Setup]. Once Flatpak is installed, the + `flatpak-builder` application must also be installed. This can be done + either in a similar manner to how Flatpak was installed, or with `flatpak + install flathub org.flatpak.Builder`. Once this is complete, Flatpak + applications are built using one of the following: + + * `flatpak-builder` + * `flatpak run org.flatpak.Builder` + + For the purposes of this tutorial, we will use `flatpak-builder`, but know + that this can be interchanged with any of the above commands. + +2. **Install the Runtime and SDK** + + Each Flatpak application has a base Runtime and SDK that they are built from, + acting as a starting point for packages. These must be installed for builds + to begin. + + For Gearsystem, the Runtime and SDK are `org.freedesktop.Platform` and + `org.freedesktop.Sdk` respectively, running on version `23.08`. These can be + installed via the command line with the following commands: + + ```bash + flatpak install flathub \ + org.freedesktop.Platform//23.08 \ + org.freedesktop.Sdk//23.08 + ``` + +3. **Build the application** + + Builds are completed using `flatpak-builder` as follows (assuming + `platforms/flatpak` is the current working directory): + + ```bash + flatpak-builder \ + --force-clean \ + --user \ + --install \ + build-dir io.github.drhelius.Gearsystem.yml + ``` + + The `--force-clean --user --install` flags specify that the build should + start from the beginning and, once completed, automatically install the + application as a user-specific application. In these cases the application + will be installed as `io.github.drhelius.Gearsystem//master`. + + The `build-dir` option indicates that any build files will be kept in a + subdirectory with the same name. This may be deleted after a build is + complete. + + The final option, `io.github.drhelius.Gearsystem.yml` indicates which + manifest file to use for the application build. This manifest file contains + the core configuration for how the application is built and any metadata + associated with it. Some common modifications include changing the `make` + command to `make DEBUG=1` to include debugging symbols or replacing the `git` + source with a relative path for local development such as: + + ```yaml + - type: dir + path: ../.. + ``` + + More information on this command and the manifest can be found on [the + Flatpak Builder Command Reference][Flatpak Builder Reference]. + +4. **Run the application** + + Once installed, the application can be run with the following command: + + ```bash + flatpak run io.github.drhelius.Gearsystem + ``` + + You may also be able to find the application in as a desktop entry, allowing + you to search for it in your operating system's desktop environment. + + Starting this application in either manner should result in Gearsystem + launching with full functionality. + + There are other options available to this command in [the Flatpak Command + Reference][Flatpak Reference] if further debugging is available. + + One such option is the ability to debug the application with gdb. This can + be done with the following commands: + + ```bash + flatpak install gearsystem-origin io.github.drhelius.Gearsystem.Debug + flatpak run \ + --devel \ + --command=gdb \ + io.github.drhelius.Gearsystem /app/bin/gearsystem + ``` + + The first command installs the `.Debug` extension with the debugging symbols + from the local environment `gearsystem-origin`. This should be defined as you + build the application, but if this does not work, simple run `flatpak list` + and use the value in the `Origin` column corresponding to the `Gearsystem` + application. + + The second command will start the GDB application on the Gearsystem binary. + You may also run other applications such as `sh` for further debugging. + +[Flatpak Builder Reference]: +[Flatpak Reference]: +[Flatpak Setup]: diff --git a/platforms/flatpak/icons/128x128.png b/platforms/flatpak/icons/128x128.png new file mode 100644 index 00000000..f278050c Binary files /dev/null and b/platforms/flatpak/icons/128x128.png differ diff --git a/platforms/flatpak/icons/256x256.png b/platforms/flatpak/icons/256x256.png new file mode 100644 index 00000000..819971f3 Binary files /dev/null and b/platforms/flatpak/icons/256x256.png differ diff --git a/platforms/flatpak/icons/32x32.png b/platforms/flatpak/icons/32x32.png new file mode 100644 index 00000000..1ac60980 Binary files /dev/null and b/platforms/flatpak/icons/32x32.png differ diff --git a/platforms/flatpak/icons/512x512.png b/platforms/flatpak/icons/512x512.png new file mode 100644 index 00000000..e63bb09f Binary files /dev/null and b/platforms/flatpak/icons/512x512.png differ diff --git a/platforms/flatpak/io.github.drhelius.Gearsystem.desktop b/platforms/flatpak/io.github.drhelius.Gearsystem.desktop new file mode 100644 index 00000000..c659e3d1 --- /dev/null +++ b/platforms/flatpak/io.github.drhelius.Gearsystem.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=Gearsystem +Comment=Emulator for SMS/GG/SG-1000 games +Exec=gearsystem +Type=Application +Icon=io.github.drhelius.Gearsystem +Categories=Game;Emulator; diff --git a/platforms/flatpak/io.github.drhelius.Gearsystem.metainfo.xml b/platforms/flatpak/io.github.drhelius.Gearsystem.metainfo.xml new file mode 100644 index 00000000..fde7a598 --- /dev/null +++ b/platforms/flatpak/io.github.drhelius.Gearsystem.metainfo.xml @@ -0,0 +1,178 @@ + + + io.github.drhelius.Gearsystem + + Gearsystem + A very accurate, cross-platform Sega Master System / Game Gear / SG-1000 emulator + + + Ignacio Sanchez Gines + + io.github.drhelius.Gearsystem + + CC0-1.0 + GPL-3.0-only + + + pointing + keyboard + gamepad + + + +

Gearsystem is a very accurate, cross-platform Sega Master System / Game Gear / SG-1000 emulator written in C++ that runs on Windows, macOS, Linux, BSD and RetroArch.

+

Features include:

+
    +
  • Accurate Z80 core, including undocumented opcodes and behavior like R and MEMPTR registers.
  • +
  • Supported cartridges: ROM, ROM + RAM, SEGA, Codemasters, Korean, MSX + Nemesis, Janggun, SG-1000.
  • +
  • Automatic region detection: NTSC-JAP, NTSC-USA, PAL-EUR.
  • +
  • Accurate VDP emulation including timing and Master System 2 only 224 video mode support.
  • +
  • Support for YM2413 (OPLL) FM sound chip.
  • +
  • Internal database for rom detection.
  • +
  • Battery powered RAM save support.
  • +
  • Save states.
  • +
  • Compressed rom support (ZIP).
  • +
  • Game Genie and Pro Action Replay cheat support.
  • +
  • Supported platforms (standalone): Windows, Linux, BSD and macOS.
  • +
  • Supported platforms (libretro): Windows, Linux, macOS, Raspberry Pi, Android, iOS, tvOS, PlayStation Vita, PlayStation 3, Nintendo 3DS, Nintendo GameCube, Nintendo Wii, Nintendo WiiU, Nintendo Switch, Emscripten, Classic Mini systems (NES, SNES, C64, ...), OpenDingux, RetroFW and QNX.
  • +
  • Full debugger with just-in-time disassembler, cpu breakpoints, memory access breakpoints, code navigation (goto address, JP JR and CALL double clicking), debug symbols, memory editor, IO inspector and VRAM viewer including tiles, sprites, backgrounds and palettes.
  • +
  • Windows and Linux Portable Mode.
  • +
  • Rom loading from the command line by adding the rom path as an argument.
  • +
  • Support for modern game controllers through gamecontrollerdb.txt file located in the same directory as the application binary.
  • +
+
+ + + Emulator + Game + + + io.github.drhelius.Gearsystem.desktop + https://github.com/drhelius/Gearsystem + https://github.com/drhelius/Gearsystem/issues + https://github.com/drhelius/Gearsystem + + + gearsystem + io.github.drhelius.Gearsystem.desktop + + io.github.drhelius.Gearsystem + + + + +

What's Changed

+
    +
  • Support for YM2413
  • +
  • Native file dialogs
  • +
  • Drag and drop rom files to open
  • +
  • Overscan options
  • +
  • Improved Game Gear timings
  • +
  • Improved PAL detection
  • +
  • Debugger improvements
  • +
  • Custom folders for saves and savestates
  • +
  • Scaling improvements like fit to window size or fit to window height
  • +
  • Hide cursor when hovering output window or when main menu is disabled
  • +
  • Load symbol files from command line
  • +
  • Support for WLA symbol files
  • +
  • Improve input response time
  • +
  • Save screenshots
  • +
  • Support for WSL
  • +
  • Automatic builds in GitHub Actions
  • +
  • Several bug fixes
  • +
  • Add support for zoomed sprites in SMS/GG modes
  • +
  • Pixel perfect rendering even with non integer HDPI values on Windows
  • +
  • Fixed bug where when resetting, the first opcode would not be disassembled. by @samizzo in #50
  • +
  • Added a generalised shortcut system so any gui events can have a shortcut key defined in the config.ini by @samizzo in #52
  • +
  • add retrofw target
  • +
  • Fix window title flicker
  • +
  • Define install and uninstall targets
  • +
  • Update NFDe implementation to v1.1.1
  • +
+
+ https://github.com/drhelius/Gearsystem/releases/tag/3.5.0 + + + https://github.com/drhelius/Gearsystem/archive/refs/tags/3.5.0.tar.gz + fb284c2c71ab78f5127c5c9b1039dcf18ac518259649ef79900299ac2ea4151f + 6359063 + Gearsystem-3.5.0.tar.gz + + +
+ + +

This patch contains the following bugfixes:

+
    +
  • Fixed a crash in RetroArch (libretro) when loading ROMs.
  • +
+
+ https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.4.1 + + #48 + + + + https://github.com/drhelius/Gearsystem/archive/refs/tags/gearsystem-3.4.1.tar.gz + c71c8415d18afee104aece2b04de0b6736dd2783b0c87b9a6a2bee9530d2d798 + 14570974 + gearsystem-3.4.1.tar.gz + + +
+ + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.4.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.3.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.2.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.1.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.0.3 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.0.2 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.0.1 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-3.0.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.6.1 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.6.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.5.1 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.5.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.2 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.1 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-2.0 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-1.2 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-1.1 + + + https://github.com/drhelius/Gearsystem/releases/tag/gearsystem-1.0 + +
+
\ No newline at end of file diff --git a/platforms/flatpak/io.github.drhelius.Gearsystem.yml b/platforms/flatpak/io.github.drhelius.Gearsystem.yml new file mode 100644 index 00000000..b4ec0a2e --- /dev/null +++ b/platforms/flatpak/io.github.drhelius.Gearsystem.yml @@ -0,0 +1,91 @@ +id: io.github.drhelius.Gearsystem +runtime: org.freedesktop.Platform +runtime-version: '23.08' +sdk: org.freedesktop.Sdk +command: gearsystem +finish-args: + - --share=ipc + - --socket=x11 + - --device=dri + - --socket=pulseaudio + - --device=all # Allows for controller input +modules: + - name: glu + buildsystem: meson + sources: + - type: archive + url: https://archive.mesa3d.org/glu/glu-9.0.3.tar.xz + sha256: bd43fe12f374b1192eb15fe20e45ff456b9bc26ab57f0eee919f96ca0f8a330f + - name: glew + no-autogen: true + make-args: + - GLEW_PREFIX=${FLATPAK_DEST} + - GLEW_DEST=${FLATPAK_DEST} + - LIBDIR=${FLATPAK_DEST}/lib + - CFLAGS.EXTRA:=${CFLAGS} -fPIC + - LDFLAGS.EXTRA=${LDFLAGS} + make-install-args: + - GLEW_PREFIX=${FLATPAK_DEST} + - GLEW_DEST=${FLATPAK_DEST} + - LIBDIR=${FLATPAK_DEST}/lib + - CFLAGS.EXTRA:=${CFLAGS} -fPIC + - LDFLAGS.EXTRA=${LDFLAGS} + sources: + - type: archive + url: https://downloads.sourceforge.net/project/glew/glew/2.2.0/glew-2.2.0.tgz + sha256: d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1 + cleanup: + - /include + - /lib/pkgconfig + - /lib/*.a + - name: SDL2 + buildsystem: autotools + config-opts: + - --disable-static + sources: + - type: archive + url: https://github.com/libsdl-org/SDL/releases/download/release-2.30.0/SDL2-2.30.0.tar.gz + sha256: 36e2e41557e0fa4a1519315c0f5958a87ccb27e25c51776beb6f1239526447b0 + cleanup: + - /bin/sdl2-config + - /include + - /lib/libSDL2.la + - /lib/libSDL2main.a + - /lib/libSDL2main.la + - /lib/libSDL2_test.a + - /lib/libSDL2_test.la + - /lib/cmake + - /share/aclocal + - /lib/pkgconfig + - name: gearsystem + buildsystem: simple + build-commands: + - make + - make install prefix="$FLATPAK_DEST" + - install -Dm644 io.github.drhelius.Gearsystem.desktop -t /app/share/applications + - install -Dm644 icons/32x32.png /app/share/icons/hicolor/32x32/apps/io.github.drhelius.Gearsystem.png + - install -Dm644 icons/128x128.png /app/share/icons/hicolor/128x128/apps/io.github.drhelius.Gearsystem.png + - install -Dm644 icons/256x256.png /app/share/icons/hicolor/256x256/apps/io.github.drhelius.Gearsystem.png + - install -Dm644 icons/512x512.png /app/share/icons/hicolor/512x512/apps/io.github.drhelius.Gearsystem.png + - install -Dm644 io.github.drhelius.Gearsystem.metainfo.xml -t /app/share/metainfo + subdir: platforms/flatpak + sources: + # This source allows for that Flatpak to be built from the current commit. + # This is not suitable for releases, but is useful for development builds. + # Ideally a tag/commit or archive would be preferred, but a stable + # instance does not exist until this is merged into a main branch and + # released. An example of what this would look like is shown below and is + # expected to be altered after a release of Gearsystem. + - type: dir + path: ../.. + # - type: git + # url: https://github.com/drhelius/Gearsystem + # tag: 3.5.0 # WARNING: Does not not contain `platforms/flatpak`! + # commit: 8f817df87a46938c9da9aa9a15441b897a9d5726 + - type: file + path: io.github.drhelius.Gearsystem.desktop + - type: file + path: io.github.drhelius.Gearsystem.metainfo.xml + - type: dir + path: icons + dest: icons