├── .ci ├── ci-build-bin.sh ├── ci-build-deb.sh ├── ci-build-tar.sh └── gitlab-ci.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── README.md ├── bin └── Makefile.am ├── configure.ac ├── debian ├── changelog ├── control ├── copyright ├── rules └── source │ └── format ├── doc ├── EXECUTE.md ├── FEATURES.md ├── INSTALL.md ├── LICENSES.md └── Makefile.am ├── etc └── Makefile.am ├── lib ├── Makefile.am ├── lib765 │ ├── 765.h │ ├── 765drive.c │ ├── 765dsk.c │ ├── 765fdc.c │ ├── 765i.h │ ├── 765ldsk.c │ ├── Makefile.am │ └── error.c ├── libdsk │ ├── Makefile.am │ ├── comp.h │ ├── compbz2.c │ ├── compbz2.h │ ├── compdskf.c │ ├── compdskf.h │ ├── compgz.c │ ├── compgz.h │ ├── compi.h │ ├── compress.c │ ├── compress.h │ ├── compress.inc │ ├── compsq.c │ ├── compsq.h │ ├── comptlzh.c │ ├── comptlzh.h │ ├── crc16.c │ ├── crc16.h │ ├── crctable.c │ ├── crctable.h │ ├── drivers.h │ ├── drivers.inc │ ├── drv.h │ ├── drvadisk.c │ ├── drvadisk.h │ ├── drvcfi.c │ ├── drvcfi.h │ ├── drvcpcem.c │ ├── drvcpcem.h │ ├── drvdos16.c │ ├── drvdos16.h │ ├── drvdos32.c │ ├── drvdos32.h │ ├── drvdskf.c │ ├── drvdskf.h │ ├── drvi.h │ ├── drvimd.c │ ├── drvimd.h │ ├── drvint25.c │ ├── drvint25.h │ ├── drvjv3.c │ ├── drvjv3.h │ ├── drvlinux.c │ ├── drvlinux.h │ ├── drvlogi.c │ ├── drvlogi.h │ ├── drvmyz80.c │ ├── drvmyz80.h │ ├── drvntwdm.c │ ├── drvntwdm.h │ ├── drvnwasp.c │ ├── drvnwasp.h │ ├── drvposix.c │ ├── drvposix.h │ ├── drvqm.c │ ├── drvqm.h │ ├── drvrcpm.c │ ├── drvrcpm.h │ ├── drvsimh.c │ ├── drvsimh.h │ ├── drvtele.c │ ├── drvtele.h │ ├── drvwin16.c │ ├── drvwin16.h │ ├── drvwin32.c │ ├── drvwin32.h │ ├── drvydsk.c │ ├── drvydsk.h │ ├── dskcheck.c │ ├── dskcmt.c │ ├── dskdirty.c │ ├── dskerror.c │ ├── dskfmt.c │ ├── dskgeom.c │ ├── dskjni.c │ ├── dsklphys.c │ ├── dskopen.c │ ├── dskpars.c │ ├── dskread.c │ ├── dskreprt.c │ ├── dskretry.c │ ├── dskrtrd.c │ ├── dsksecid.c │ ├── dskseek.c │ ├── dsksgeom.c │ ├── dskstat.c │ ├── dsktread.c │ ├── dsktrkid.c │ ├── dskwrite.c │ ├── libdsk.h │ ├── remall.h │ ├── remote.c │ ├── remote.h │ ├── remote.inc │ ├── rpccli.c │ ├── rpcfork.c │ ├── rpcfork.h │ ├── rpcfossl.c │ ├── rpcfossl.h │ ├── rpcfuncs.h │ ├── rpcmap.c │ ├── rpcpack.c │ ├── rpcserv.c │ ├── rpctios.c │ ├── rpctios.h │ ├── rpcwin32.c │ ├── rpcwin32.h │ ├── w16defs.h │ └── w95defs.h ├── miniaudio │ ├── Makefile.am │ ├── miniaudio.c │ └── miniaudio.h └── xcpc │ ├── Makefile.am │ ├── amstrad │ ├── cpc │ │ ├── cpc-machine.cc │ │ ├── cpc-machine.h │ │ ├── cpc-mainboard.cc │ │ ├── cpc-mainboard.h │ │ ├── cpc-settings.cc │ │ └── cpc-settings.h │ ├── cpu │ │ ├── cpu-core.cc │ │ ├── cpu-core.h │ │ ├── cpu-microcode.inc │ │ ├── cpu-opcodes-cb.inc │ │ ├── cpu-opcodes-dd.inc │ │ ├── cpu-opcodes-ddcb.inc │ │ ├── cpu-opcodes-ed.inc │ │ ├── cpu-opcodes-fd.inc │ │ ├── cpu-opcodes-fdcb.inc │ │ └── cpu-opcodes.inc │ ├── dpy │ │ ├── dpy-core.cc │ │ └── dpy-core.h │ ├── fdc │ │ ├── fdc-core.cc │ │ └── fdc-core.h │ ├── kbd │ │ ├── kbd-core.cc │ │ └── kbd-core.h │ ├── mem │ │ ├── mem-core.cc │ │ └── mem-core.h │ ├── ppi │ │ ├── ppi-core.cc │ │ └── ppi-core.h │ ├── psg │ │ ├── psg-core.cc │ │ └── psg-core.h │ ├── vdc │ │ ├── vdc-core.cc │ │ └── vdc-core.h │ └── vga │ │ ├── vga-core.cc │ │ └── vga-core.h │ ├── formats │ ├── cdt │ │ ├── cdt-format.cc │ │ └── cdt-format.h │ ├── dsk │ │ ├── dsk-format.cc │ │ └── dsk-format.h │ └── sna │ │ ├── sna-format.cc │ │ └── sna-format.h │ ├── libxcpc-cxx.h │ ├── libxcpc-events.h │ ├── libxcpc-keysyms.h │ ├── libxcpc-priv.h │ ├── libxcpc.cc │ ├── libxcpc.h │ └── xlib │ ├── xlib.cc │ └── xlib.h ├── m4 ├── acinclude.m4 ├── ax_check_byte_order.m4 ├── ax_check_gtk3.m4 ├── ax_check_gtk4.m4 ├── ax_check_gui_toolkit.m4 ├── ax_check_lib765.m4 ├── ax_check_libdsk.m4 ├── ax_check_miniaudio.m4 └── ax_check_x11.m4 ├── share ├── Makefile.am ├── applications │ ├── Makefile.am │ └── xcpc.desktop.in ├── mime │ ├── Makefile.am │ └── packages │ │ ├── Makefile.am │ │ ├── x-amstrad-cpc-disk-image.xml │ │ └── x-amstrad-cpc-snapshot.xml ├── pixmaps │ ├── Makefile.am │ └── xcpc.png └── xcpc │ ├── Makefile.am │ ├── disks │ ├── Makefile.am │ └── README.md │ ├── roms │ ├── Makefile.am │ ├── README.md │ ├── amsdos.rom │ ├── cpc464en.rom │ ├── cpc6128en.rom │ ├── cpc6128fr.rom │ └── cpc664en.rom │ └── snapshots │ ├── Makefile.am │ └── README.md └── src ├── Makefile.am ├── gtk3ui ├── Makefile.am ├── all.cc ├── all.h ├── gdk3-pixbuf.cc ├── gdk3-pixbuf.h ├── gtk3-about-dialog.cc ├── gtk3-about-dialog.h ├── gtk3-application-window.cc ├── gtk3-application-window.h ├── gtk3-application.cc ├── gtk3-application.h ├── gtk3-base.cc ├── gtk3-base.h ├── gtk3-bin.cc ├── gtk3-bin.h ├── gtk3-box.cc ├── gtk3-box.h ├── gtk3-button.cc ├── gtk3-button.h ├── gtk3-container.cc ├── gtk3-container.h ├── gtk3-dialog.cc ├── gtk3-dialog.h ├── gtk3-emulator.cc ├── gtk3-emulator.h ├── gtk3-file-chooser-dialog.cc ├── gtk3-file-chooser-dialog.h ├── gtk3-frame.cc ├── gtk3-frame.h ├── gtk3-gl-area.cc ├── gtk3-gl-area.h ├── gtk3-label.cc ├── gtk3-label.h ├── gtk3-menu-bar.cc ├── gtk3-menu-bar.h ├── gtk3-menu-item.cc ├── gtk3-menu-item.h ├── gtk3-menu-shell.cc ├── gtk3-menu-shell.h ├── gtk3-menu.cc ├── gtk3-menu.h ├── gtk3-message-dialog.cc ├── gtk3-message-dialog.h ├── gtk3-tool-item.cc ├── gtk3-tool-item.h ├── gtk3-toolbar.cc ├── gtk3-toolbar.h ├── gtk3-widget.cc ├── gtk3-widget.h ├── gtk3-window.cc ├── gtk3-window.h ├── gtkemulator.c ├── gtkemulator.h ├── gtkemulatorprivate.h ├── gtkemulatortypes.h ├── xcpc-about-dialog.cc ├── xcpc-about-dialog.h ├── xcpc-application.cc ├── xcpc-application.h ├── xcpc-disk-dialog.cc ├── xcpc-disk-dialog.h ├── xcpc-help-dialog.cc ├── xcpc-help-dialog.h ├── xcpc-snapshot-dialog.cc └── xcpc-snapshot-dialog.h ├── gtk4ui ├── Makefile.am ├── xcpc-main.cc └── xcpc-main.h ├── utils ├── Makefile.am ├── arglist.cc ├── arglist.h ├── console.cc ├── console.h ├── program.cc ├── program.h ├── xcpc-dsk.cc └── xcpc-dsk.h ├── xcpc.cc └── xcpc.h /.ci/ci-build-deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # ci-build-deb.sh - Copyright (c) 2001-2025 - Olivier Poncet 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | # ---------------------------------------------------------------------------- 20 | # settings 21 | # ---------------------------------------------------------------------------- 22 | 23 | arg_topdir="$(pwd)" 24 | arg_prefix="/usr/local" 25 | arg_jobs="$(cat /proc/cpuinfo | grep '^processor' | wc -l)" 26 | arg_builddir="_build" 27 | arg_distdir="_dist" 28 | arg_tarball="$(ls xcpc-*.tar.gz 2>/dev/null | grep '^xcpc-[0-9]\+.[0-9]\+.[0-9]\+.tar.gz')" 29 | arg_pkgname="$(echo "${arg_tarball:-not-set}" | sed -e 's/\.tar\.gz//g')" 30 | arg_system="unknown" 31 | 32 | # ---------------------------------------------------------------------------- 33 | # sanity checks 34 | # ---------------------------------------------------------------------------- 35 | 36 | if [ ! -f "${arg_tarball}" ] 37 | then 38 | echo "*** tarball not found ***" 39 | exit 1 40 | fi 41 | 42 | # ---------------------------------------------------------------------------- 43 | # debug 44 | # ---------------------------------------------------------------------------- 45 | 46 | set -x 47 | 48 | # ---------------------------------------------------------------------------- 49 | # build the debian package 50 | # ---------------------------------------------------------------------------- 51 | 52 | rm -rf "${arg_builddir}" || exit 1 53 | mkdir "${arg_builddir}" || exit 1 54 | cd "${arg_builddir}" || exit 1 55 | tar xf "../${arg_tarball}" || exit 1 56 | cd "${arg_pkgname}" || exit 1 57 | dh_make --yes --single --file "../../${arg_tarball}" || exit 1 58 | rm -rf "debian" || exit 1 59 | cp -rf "../../debian" "./debian" || exit 1 60 | dpkg-buildpackage --build=full --no-sign || exit 1 61 | cd "${arg_topdir}" || exit 1 62 | 63 | # ---------------------------------------------------------------------------- 64 | # End-Of-File 65 | # ---------------------------------------------------------------------------- 66 | -------------------------------------------------------------------------------- /.ci/ci-build-tar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # ci-build-tar.sh - Copyright (c) 2001-2025 - Olivier Poncet 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | # ---------------------------------------------------------------------------- 20 | # settings 21 | # ---------------------------------------------------------------------------- 22 | 23 | arg_prefix="/usr/local" 24 | 25 | # ---------------------------------------------------------------------------- 26 | # debug 27 | # ---------------------------------------------------------------------------- 28 | 29 | set -x 30 | 31 | # ---------------------------------------------------------------------------- 32 | # autoreconf 33 | # ---------------------------------------------------------------------------- 34 | 35 | autoreconf -v -i -f || exit 1 36 | 37 | # ---------------------------------------------------------------------------- 38 | # configure the build system 39 | # ---------------------------------------------------------------------------- 40 | 41 | ./configure --prefix="${arg_prefix}" || exit 1 42 | 43 | # ---------------------------------------------------------------------------- 44 | # create the tarball 45 | # ---------------------------------------------------------------------------- 46 | 47 | make dist || exit 1 48 | 49 | # ---------------------------------------------------------------------------- 50 | # End-Of-File 51 | # ---------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.la 3 | *.o 4 | *.lo 5 | *.Plo 6 | *.log 7 | *.trs 8 | Makefile 9 | Makefile.in 10 | autom4te.cache/ 11 | .deps/ 12 | .libs/ 13 | .dirstamp 14 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Olivier Poncet 2 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # SUBDIRS 20 | # ---------------------------------------------------------------------------- 21 | 22 | SUBDIRS = \ 23 | bin \ 24 | etc \ 25 | doc \ 26 | lib \ 27 | src \ 28 | share \ 29 | $(NULL) 30 | 31 | # ---------------------------------------------------------------------------- 32 | # EXTRA_DIST 33 | # ---------------------------------------------------------------------------- 34 | 35 | EXTRA_DIST = \ 36 | README.md \ 37 | $(NULL) 38 | 39 | # ---------------------------------------------------------------------------- 40 | # End-Of-File 41 | # ---------------------------------------------------------------------------- 42 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | See `README.md` 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## README 2 | 3 | Xcpc is a portable Amstrad CPC 464/664/6128 emulator written in C and C++. It is designed to run on any POSIX compliant system having an X11 server, including Linux, BSD and Unix. 4 | 5 | Note there is absolutely no support for Microsoft Windows operating systems and there never will be. Please do not ask me to add such functionality. 6 | 7 | Xcpc is designed to emulate classic range of the Amstrad CPC systems : 8 | 9 | - Amstrad CPC 464 (v1). 10 | - Amstrad CPC 664 (v2). 11 | - Amstrad CPC 6128 (v3). 12 | 13 | The Amstrad CPC+ range and the GX4000 console are not currently emulated and likely will not be. 14 | 15 | ### FEATURES 16 | 17 | Please read the file [doc/FEATURES.md](doc/FEATURES.md). 18 | 19 | ### LICENSES 20 | 21 | Please read the file [doc/LICENSES.md](doc/LICENSES.md). 22 | 23 | ### HOW TO INSTALL 24 | 25 | Please read the file [doc/INSTALL.md](doc/INSTALL.md). 26 | 27 | ### HOW TO EXECUTE 28 | 29 | Please read the file [doc/EXECUTE.md](doc/EXECUTE.md). 30 | -------------------------------------------------------------------------------- /bin/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # EXTRA_DIST 20 | # ---------------------------------------------------------------------------- 21 | 22 | EXTRA_DIST = \ 23 | $(NULL) 24 | 25 | # ---------------------------------------------------------------------------- 26 | # End-Of-File 27 | # ---------------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | xcpc (0.0.0-1) unstable; urgency=medium 2 | 3 | * Initial release 4 | 5 | -- Olivier Poncet Mon, 02 Apr 2001 00:00:00 +0200 6 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: xcpc 2 | Section: games 3 | Priority: optional 4 | Maintainer: Olivier Poncet 5 | Build-Depends: debhelper-compat (= 13), autotools-dev, autoconf-archive, build-essential, autoconf, automake, libtool, xorg-dev, libgtk-3-dev, zlib1g-dev, libbz2-dev 6 | Standards-Version: 4.6.0 7 | Homepage: https://www.xcpc-emulator.net/ 8 | Rules-Requires-Root: no 9 | 10 | Package: xcpc 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Description: Amstrad CPC emulator 14 | Xcpc is a portable Amstrad CPC 464/664/6128 emulator written in C and C++. 15 | . 16 | It is designed to run on any POSIX compliant system having an X11 server, 17 | including Linux, BSD and Unix. 18 | . 19 | Xcpc is designed to emulate classic range of the Amstrad CPC systems: 20 | Amstrad CPC 464 (v1), Amstrad CPC 664 (v2), Amstrad CPC 6128 (v3). 21 | . 22 | The Amstrad CPC+ range and the GX4000 console are not currently emulated 23 | and likely will not be. 24 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | #export DH_VERBOSE = 1 5 | 6 | 7 | # see FEATURE AREAS in dpkg-buildflags(1) 8 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all 9 | 10 | # see ENVIRONMENT in dpkg-buildflags(1) 11 | # package maintainers to append CFLAGS 12 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 13 | # package maintainers to append LDFLAGS 14 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 15 | 16 | 17 | %: 18 | dh $@ 19 | 20 | override_dh_auto_configure: 21 | dh_auto_configure -- --bindir=\$${prefix}/games 22 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /doc/FEATURES.md: -------------------------------------------------------------------------------- 1 | ## FEATURES 2 | 3 | ### IMPLEMENTED FEATURES 4 | 5 | Here is a non-exhaustive list of supported features: 6 | 7 | - A complete Gtk+-3.x user interface. 8 | - Full X11 with XShm extension. 9 | - No Wayland support but runs well under XWayland. 10 | - Adaptative frame-rate. 11 | - Full Floppy disk images support (.dsk). 12 | - Full snapshot support (.sna). 13 | - Drag and Drop support (.dsk, .sna). 14 | - Keyboard emulation (qwerty, azerty). 15 | - Joystick emulation with the numeric keypad when numlock is disabled. 16 | - Joystick emulation by pressing the « Home » or « End » key (then use arrows + left-ctrl + left-alt). 17 | - Joystick support (up to two hardware joysticks). 18 | - CPU: full support of the Z80 with documented and undocumented instructions. 19 | - VGA: full support of the Video Gate Array 40007/40008/40010. 20 | - VDC: full support of the CRTC 6845. 21 | - PPI: full support of the PPI 8255. 22 | - PSG: full support of the AY-3-8912. 23 | - FDC: full support of the FDC 765A. 24 | 25 | -------------------------------------------------------------------------------- /doc/INSTALL.md: -------------------------------------------------------------------------------- 1 | ## HOW TO INSTALL 2 | 3 | The Xcpc emulator is fully autotoolized, so you can build it with the well-known workflow `configure && make && make install`. 4 | 5 | ### DEPENDENCIES 6 | 7 | Under Debian or derivatives (Ubuntu, Mint, ...), please install first these dependencies. On other systems, please install the equivalent packages. 8 | 9 | Mandatory dependencies : 10 | 11 | ``` 12 | build-essential 13 | xorg-dev 14 | libgtk-3-dev 15 | ``` 16 | 17 | Optional dependencies : 18 | 19 | ``` 20 | zlib1g-dev 21 | libbz2-dev 22 | ``` 23 | 24 | ### GENERATE THE CONFIGURE SCRIPT 25 | 26 | Generate the `configure` script if it does not exists. This step is mandatory in case you just have cloned the git repository. 27 | 28 | First, please ensure you have the following packages installed on your system: 29 | 30 | ``` 31 | autoconf 32 | automake 33 | libtool 34 | autoconf-archive 35 | ``` 36 | 37 | Then you just have to run this command: 38 | 39 | ``` 40 | autoreconf -v -i -f 41 | ``` 42 | 43 | ### CONFIGURE THE SOURCES 44 | 45 | Run the `configure` script 46 | 47 | ``` 48 | ./configure --prefix={destination-path} 49 | ``` 50 | 51 | ### BUILD THE EMULATOR 52 | 53 | Build the emulator: 54 | 55 | ``` 56 | make -j$(nproc) 57 | ``` 58 | 59 | ### INSTALL THE EMULATOR 60 | 61 | Install the emulator: 62 | 63 | ``` 64 | make install 65 | ``` 66 | 67 | ### RUN THE EMULATOR 68 | 69 | Run the emulator 70 | 71 | ``` 72 | {destination-path}/bin/xcpc 73 | ``` 74 | 75 | ### DESKTOP INTEGRATION 76 | 77 | A desktop and mime type files are provided, so you can copy or symlink these files into the relevant directories. 78 | 79 | For example, in the system directory: 80 | 81 | ``` 82 | ln -sf ${destination-path}/share/applications/xcpc.desktop /usr/share/applications/xcpc.desktop 83 | ln -sf ${destination-path}/share/mime/packages/xcpc.xml /usr/share/mime/packages/xcpc.xml 84 | ``` 85 | 86 | For example, or the user directory: 87 | 88 | ``` 89 | ln -sf ${destination-path}/share/applications/xcpc.desktop ${HOME}/.local/share/applications/xcpc.desktop 90 | ln -sf ${destination-path}/share/mime/packages/xcpc.xml ${HOME}/.local/share/mime/packages/xcpc.xml 91 | ``` 92 | 93 | ## HOW TO INSTALL INTO YOUR HOME DIRECTORY 94 | 95 | Quick installation instructions: 96 | 97 | ``` 98 | autoreconf -v -i -f 99 | ./configure --prefix=${HOME}/Apps/xcpc 100 | make -j$(nproc) 101 | make install 102 | ln -sf ${HOME}/Apps/xcpc/share/applications/xcpc.desktop ${HOME}/.local/share/applications/xcpc.desktop 103 | ln -sf ${HOME}/Apps/xcpc/share/mime/packages/xcpc.xml ${HOME}/.local/share/mime/packages/xcpc.xml 104 | update-desktop-database ${HOME}/.local/share/applications/ 105 | update-mime-database ${HOME}/.local/share/mime/ 106 | ``` 107 | 108 | You can now run the emulator from your desktop menu `Games > Xcpc` 109 | 110 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # EXTRA_DIST 20 | # ---------------------------------------------------------------------------- 21 | 22 | EXTRA_DIST = \ 23 | FEATURES.md \ 24 | LICENSES.md \ 25 | INSTALL.md \ 26 | EXECUTE.md \ 27 | $(NULL) 28 | 29 | # ---------------------------------------------------------------------------- 30 | # End-Of-File 31 | # ---------------------------------------------------------------------------- 32 | -------------------------------------------------------------------------------- /etc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # EXTRA_DIST 20 | # ---------------------------------------------------------------------------- 21 | 22 | EXTRA_DIST = \ 23 | $(NULL) 24 | 25 | # ---------------------------------------------------------------------------- 26 | # End-Of-File 27 | # ---------------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # SUBDIRS 20 | # ---------------------------------------------------------------------------- 21 | 22 | SUBDIRS = \ 23 | $(NULL) 24 | 25 | # ---------------------------------------------------------------------------- 26 | # miniaudio 27 | # ---------------------------------------------------------------------------- 28 | 29 | if USE_MINIAUDIO 30 | if HAVE_MINIAUDIO 31 | SUBDIRS += miniaudio 32 | endif 33 | endif 34 | 35 | # ---------------------------------------------------------------------------- 36 | # libdsk 37 | # ---------------------------------------------------------------------------- 38 | 39 | if USE_LIBDSK 40 | if HAVE_LIBDSK 41 | SUBDIRS += libdsk 42 | endif 43 | endif 44 | 45 | # ---------------------------------------------------------------------------- 46 | # lib765 47 | # ---------------------------------------------------------------------------- 48 | 49 | if USE_LIB765 50 | if HAVE_LIB765 51 | SUBDIRS += lib765 52 | endif 53 | endif 54 | 55 | # ---------------------------------------------------------------------------- 56 | # xcpc 57 | # ---------------------------------------------------------------------------- 58 | 59 | if TRUE 60 | SUBDIRS += xcpc 61 | endif 62 | 63 | # ---------------------------------------------------------------------------- 64 | # End-Of-File 65 | # ---------------------------------------------------------------------------- 66 | -------------------------------------------------------------------------------- /lib/lib765/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # noinst_LTLIBRARIES 20 | # ---------------------------------------------------------------------------- 21 | 22 | noinst_LTLIBRARIES = \ 23 | lib765.la \ 24 | $(NULL) 25 | 26 | # ---------------------------------------------------------------------------- 27 | # lib765 28 | # ---------------------------------------------------------------------------- 29 | 30 | lib765_la_SOURCES = \ 31 | 765.h \ 32 | 765i.h \ 33 | error.c \ 34 | 765fdc.c \ 35 | 765dsk.c \ 36 | 765drive.c \ 37 | 765ldsk.c \ 38 | $(NULL) 39 | 40 | lib765_la_CPPFLAGS = \ 41 | -I$(top_srcdir)/lib \ 42 | $(NULL) 43 | 44 | lib765_la_LDFLAGS = \ 45 | -L$(top_builddir)/lib \ 46 | $(NULL) 47 | 48 | lib765_la_LIBADD = \ 49 | $(top_builddir)/lib/libdsk/libdsk.la \ 50 | $(NULL) 51 | 52 | # ---------------------------------------------------------------------------- 53 | # End-Of-File 54 | # ---------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /lib/lib765/error.c: -------------------------------------------------------------------------------- 1 | /* 765: Library to emulate the uPD765a floppy controller (aka Intel 8272) 2 | 3 | Copyright (C) 2002 John Elliott 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License as published by the Free Software Foundation; either 8 | version 2 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public 16 | License along with this library; if not, write to the Free 17 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | 19 | */ 20 | 21 | #include 22 | #include 23 | #include "765.h" 24 | 25 | /* The function to call on errors */ 26 | lib765_error_function_t lib765_error_function = 27 | lib765_default_error_function; 28 | 29 | void fdc_dprintf(int debuglevel, char *fmt, ...) 30 | { 31 | va_list ap; 32 | 33 | /* If we don't have an error function, do nothing */ 34 | if( !lib765_error_function ) return; 35 | 36 | /* Otherwise, call that error function */ 37 | va_start( ap, fmt ); 38 | lib765_error_function( debuglevel, fmt, ap ); 39 | va_end( ap ); 40 | } 41 | 42 | /* Default error action is just to print a message to stderr */ 43 | void 44 | lib765_default_error_function(int debuglevel, char *fmt, va_list ap) 45 | { 46 | /* Let's say default action is level 1; showing all messages 47 | * would be just too horribly disturbing. */ 48 | 49 | if (debuglevel > 1) return; 50 | fprintf( stderr, "lib765 level:%d error: ", debuglevel ); 51 | vfprintf( stderr, fmt, ap ); 52 | fprintf( stderr, "\n" ); 53 | } 54 | 55 | void lib765_register_error_function(lib765_error_function_t ef) 56 | { 57 | lib765_error_function = ef; 58 | } 59 | -------------------------------------------------------------------------------- /lib/libdsk/comp.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | /* Supported compression engines */ 24 | #include "compsq.h" 25 | #include "compgz.h" 26 | #include "compbz2.h" 27 | #include "compdskf.h" 28 | #include "comptlzh.h" 29 | 30 | -------------------------------------------------------------------------------- /lib/libdsk/compbz2.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | extern COMPRESS_CLASS cc_bz2; 24 | 25 | 26 | dsk_err_t bz2_open(COMPRESS_DATA *self); 27 | dsk_err_t bz2_creat(COMPRESS_DATA *self); 28 | dsk_err_t bz2_commit(COMPRESS_DATA *self); 29 | dsk_err_t bz2_abort(COMPRESS_DATA *self); 30 | 31 | 32 | -------------------------------------------------------------------------------- /lib/libdsk/compgz.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | extern COMPRESS_CLASS cc_gz; 24 | 25 | 26 | dsk_err_t gz_open(COMPRESS_DATA *self); 27 | dsk_err_t gz_creat(COMPRESS_DATA *self); 28 | dsk_err_t gz_commit(COMPRESS_DATA *self); 29 | dsk_err_t gz_abort(COMPRESS_DATA *self); 30 | 31 | 32 | -------------------------------------------------------------------------------- /lib/libdsk/compi.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "config.h" 29 | #ifdef HAVE_UNISTD_H 30 | #include 31 | #endif 32 | 33 | #include "libdsk.h" 34 | #include "compress.h" 35 | 36 | -------------------------------------------------------------------------------- /lib/libdsk/compress.inc: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2002 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | /* Compression engines supported by LibDsk */ 24 | 25 | &cc_sq, /* SQueeze */ 26 | /* &cc_dskf, * IBM LoadDskF */ 27 | 28 | #ifdef HAVE_LIBZ 29 | &cc_gz, /* GZip */ 30 | #endif 31 | #ifdef HAVE_LIBBZ2 32 | &cc_bz2, /* BZip2 */ 33 | #endif 34 | &cc_tlzh, /* TeleDisk LZH */ 35 | -------------------------------------------------------------------------------- /lib/libdsk/crc16.h: -------------------------------------------------------------------------------- 1 | 2 | /* The following types must have exact sizes: */ 3 | 4 | typedef unsigned char byte; /* MUST be 8 bits */ 5 | typedef unsigned short word16; /* MUST be 16 bits */ 6 | 7 | void CRC_Init(byte *table); /* Initialise. Passed the address of */ 8 | /* a 512-byte buffer used for workspace */ 9 | void CRC_Clear(void); /* Reset the CRC */ 10 | void CRC_Update(byte a); /* Add a byte to the CRC */ 11 | word16 CRC_Done(void); /* Get the completed CRC */ 12 | byte *CRC_Table(void); /* Return the workspace address */ 13 | 14 | -------------------------------------------------------------------------------- /lib/libdsk/crctable.h: -------------------------------------------------------------------------------- 1 | 2 | /* CRC table for 0x104C11DB7, bit reverse algorithm */ 3 | extern const unsigned long crc32r_table[256]; 4 | -------------------------------------------------------------------------------- /lib/libdsk/drvlogi.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001, 2007 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | /* Declarations for the logically-sectored POSIX driver */ 24 | 25 | typedef struct 26 | { 27 | DSK_DRIVER lpx_super; 28 | FILE *lpx_fp; 29 | int lpx_readonly; 30 | unsigned long lpx_filesize; 31 | } LOGICAL_DSK_DRIVER; 32 | 33 | dsk_err_t logical_open(DSK_DRIVER *self, const char *filename); 34 | dsk_err_t logical_creat(DSK_DRIVER *self, const char *filename); 35 | dsk_err_t logical_close(DSK_DRIVER *self); 36 | dsk_err_t logical_read(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 37 | void *buf, dsk_pcyl_t cylinder, 38 | dsk_phead_t head, dsk_psect_t sector); 39 | dsk_err_t logical_write(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 40 | const void *buf, dsk_pcyl_t cylinder, 41 | dsk_phead_t head, dsk_psect_t sector); 42 | dsk_err_t logical_format(DSK_DRIVER *self, DSK_GEOMETRY *geom, 43 | dsk_pcyl_t cylinder, dsk_phead_t head, 44 | const DSK_FORMAT *format, unsigned char filler); 45 | dsk_err_t logical_xseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 46 | dsk_pcyl_t cylinder, dsk_phead_t head); 47 | dsk_err_t logical_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 48 | dsk_phead_t head, unsigned char *result); 49 | 50 | -------------------------------------------------------------------------------- /lib/libdsk/drvposix.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | /* Declarations for the POSIX driver */ 24 | 25 | typedef struct 26 | { 27 | DSK_DRIVER px_super; 28 | FILE *px_fp; 29 | int px_readonly; 30 | unsigned long px_filesize; 31 | } POSIX_DSK_DRIVER; 32 | 33 | dsk_err_t posix_open(DSK_DRIVER *self, const char *filename); 34 | dsk_err_t posix_creat(DSK_DRIVER *self, const char *filename); 35 | dsk_err_t posix_close(DSK_DRIVER *self); 36 | dsk_err_t posix_read(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 37 | void *buf, dsk_pcyl_t cylinder, 38 | dsk_phead_t head, dsk_psect_t sector); 39 | dsk_err_t posix_write(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 40 | const void *buf, dsk_pcyl_t cylinder, 41 | dsk_phead_t head, dsk_psect_t sector); 42 | dsk_err_t posix_format(DSK_DRIVER *self, DSK_GEOMETRY *geom, 43 | dsk_pcyl_t cylinder, dsk_phead_t head, 44 | const DSK_FORMAT *format, unsigned char filler); 45 | dsk_err_t posix_xseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 46 | dsk_pcyl_t cylinder, dsk_phead_t head); 47 | dsk_err_t posix_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 48 | dsk_phead_t head, unsigned char *result); 49 | 50 | -------------------------------------------------------------------------------- /lib/libdsk/dskcmt.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2003 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | 25 | 26 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_set_comment(DSK_PDRIVER self, const char *comment) 27 | { 28 | if (!self || !comment) return DSK_ERR_BADPTR; 29 | 30 | if (self->dr_comment) dsk_free(self->dr_comment); 31 | self->dr_comment = dsk_malloc(1 + strlen(comment)); 32 | if (!self->dr_comment) return DSK_ERR_NOMEM; 33 | strcpy(self->dr_comment, comment); 34 | self->dr_dirty = 1; /* Comment will want writing back */ 35 | return DSK_ERR_OK; 36 | 37 | } 38 | 39 | 40 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_get_comment(DSK_PDRIVER self, char **comment) 41 | { 42 | if (!self || !comment) return DSK_ERR_BADPTR; 43 | *comment = self->dr_comment; 44 | return DSK_ERR_OK; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /lib/libdsk/dskdirty.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * Modifications to add dsk_dirty() * 7 | * (c) 2005 Philip Kendall * 8 | * * 9 | * This library is free software; you can redistribute it and/or * 10 | * modify it under the terms of the GNU Library General Public * 11 | * License as published by the Free Software Foundation; either * 12 | * version 2 of the License, or (at your option) any later version. * 13 | * * 14 | * This library is distributed in the hope that it will be useful, * 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 17 | * Library General Public License for more details. * 18 | * * 19 | * You should have received a copy of the GNU Library General Public * 20 | * License along with this library; if not, write to the Free * 21 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 22 | * MA 02111-1307, USA * 23 | * * 24 | ***************************************************************************/ 25 | 26 | #include "drvi.h" 27 | 28 | LDPUBLIC32 int LDPUBLIC16 dsk_dirty(DSK_DRIVER *self) 29 | { 30 | return self->dr_dirty; 31 | } 32 | -------------------------------------------------------------------------------- /lib/libdsk/dskreprt.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2003 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | 25 | 26 | static DSK_REPORTFUNC st_repfunc; 27 | static DSK_REPORTEND st_repend; 28 | 29 | /* Register callbacks for LibDsk functions to display information on the 30 | * * screen. */ 31 | LDPUBLIC32 void LDPUBLIC16 dsk_reportfunc_set(DSK_REPORTFUNC report, 32 | DSK_REPORTEND repend) 33 | { 34 | st_repfunc = report; 35 | st_repend = repend; 36 | } 37 | 38 | 39 | /* Retrieve the values of the callbacks */ 40 | LDPUBLIC32 void LDPUBLIC16 dsk_reportfunc_get(DSK_REPORTFUNC *report, 41 | DSK_REPORTEND *repend) 42 | { 43 | if (report) *report = st_repfunc; 44 | if (repend) *repend = st_repend; 45 | } 46 | 47 | 48 | LDPUBLIC32 void LDPUBLIC16 dsk_report(const char *s) 49 | { 50 | if (st_repfunc) (*st_repfunc)(s); 51 | } 52 | 53 | 54 | LDPUBLIC32 void LDPUBLIC16 dsk_report_end() 55 | { 56 | if (st_repend) (*st_repend)(); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /lib/libdsk/dskretry.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2003 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | 25 | 26 | 27 | /* Set / get the retry count. */ 28 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_set_retry(DSK_PDRIVER self, unsigned int count) 29 | { 30 | if (!self) return DSK_ERR_BADPTR; 31 | if (count == 0) return DSK_ERR_BADVAL; 32 | self->dr_retry_count = count; 33 | return DSK_ERR_OK; 34 | } 35 | 36 | 37 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_get_retry(DSK_PDRIVER self, unsigned int *count) 38 | { 39 | if (!count || !self) return DSK_ERR_BADPTR; 40 | *count = self->dr_retry_count; 41 | return DSK_ERR_OK; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /lib/libdsk/dskrtrd.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | 25 | 26 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_rtread(DSK_PDRIVER self, 27 | const DSK_GEOMETRY *geom, void *buf, 28 | dsk_pcyl_t cylinder, dsk_phead_t head, int reserved) 29 | { 30 | DRV_CLASS *dc; 31 | size_t bufsiz; 32 | 33 | if (!self || !geom || !buf || !self->dr_class) return DSK_ERR_BADPTR; 34 | 35 | dc = self->dr_class; 36 | 37 | if (!dc->dc_rtread) return DSK_ERR_NOTIMPL; 38 | return (dc->dc_rtread)(self,geom,buf,cylinder,head,reserved, &bufsiz); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /lib/libdsk/dsksecid.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | 25 | 26 | /* Read a random sector header from current track */ 27 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_psecid(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 28 | dsk_pcyl_t cylinder, dsk_phead_t head, 29 | DSK_FORMAT *result) 30 | { 31 | DRV_CLASS *dc; 32 | if (!self || !geom || !result || !self->dr_class) return DSK_ERR_BADPTR; 33 | 34 | dc = self->dr_class; 35 | 36 | if (!dc->dc_secid) return DSK_ERR_NOTIMPL; 37 | return (dc->dc_secid)(self,geom,cylinder,head,result); 38 | 39 | } 40 | 41 | 42 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_lsecid(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 43 | dsk_ltrack_t track, DSK_FORMAT *result) 44 | { 45 | dsk_err_t e; 46 | dsk_pcyl_t cyl; 47 | dsk_psect_t sec; 48 | 49 | e = dg_lt2pt(geom, track, &cyl, &sec); 50 | if (e) return e; 51 | return dsk_psecid(self, geom, cyl, sec, result); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /lib/libdsk/dskseek.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | 25 | 26 | /* Seek to a track */ 27 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_pseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 28 | dsk_pcyl_t cylinder, dsk_phead_t head) 29 | { 30 | DRV_CLASS *dc; 31 | if (!self || !geom || !self->dr_class) return DSK_ERR_BADPTR; 32 | 33 | dc = self->dr_class; 34 | 35 | if (!dc->dc_xseek) return DSK_ERR_NOTIMPL; 36 | return (dc->dc_xseek)(self,geom,cylinder,head); 37 | 38 | } 39 | 40 | 41 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_lseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 42 | dsk_ltrack_t track) 43 | { 44 | dsk_err_t e; 45 | dsk_pcyl_t cyl; 46 | dsk_phead_t head; 47 | 48 | e = dg_lt2pt(geom, track, &cyl, &head); 49 | if (e) return e; 50 | return dsk_pseek(self, geom, cyl, head); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /lib/libdsk/dskstat.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #include "drvi.h" 24 | #include "compi.h" 25 | 26 | /* Get the status (ST3) of a drive. */ 27 | LDPUBLIC32 dsk_err_t LDPUBLIC16 dsk_drive_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom, 28 | dsk_phead_t head, unsigned char *status) 29 | { 30 | DRV_CLASS *dc; 31 | dsk_err_t err; 32 | unsigned char ro = 0; 33 | 34 | if (!self || !geom || !status || !self->dr_class) return DSK_ERR_BADPTR; 35 | 36 | if (self && self->dr_compress && self->dr_compress->cd_readonly) 37 | ro = DSK_ST3_RO; 38 | 39 | /* Generate a default status. If the driver doesn't provide this 40 | * function, the default status will be used. */ 41 | 42 | *status = DSK_ST3_READY | ro; 43 | if (geom->dg_heads > 1) *status |= DSK_ST3_DSDRIVE; 44 | if (head) *status |= DSK_ST3_HEAD1; 45 | 46 | dc = self->dr_class; 47 | if (!dc->dc_status) return DSK_ERR_OK; 48 | err = (dc->dc_status)(self,geom,head,status); 49 | 50 | *status |= ro; 51 | return err; 52 | } 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /lib/libdsk/remall.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | /* Supported RPC systems */ 24 | #include "rpctios.h" /* TERMIOS */ 25 | #include "rpcwin32.h" /* Win32 Serial API */ 26 | #include "rpcfossl.h" /* MSDOS FOSSIL */ 27 | #include "rpcfork.h" /* FORK/PIPE */ 28 | 29 | 30 | -------------------------------------------------------------------------------- /lib/libdsk/remote.inc: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | /* RPC engines supported by LibDsk */ 24 | 25 | #if defined(HAVE_WINDOWS_H) && defined(_WIN32) 26 | &rpc_w32serial, /* Win32 serial */ 27 | #endif 28 | #ifdef HAVE_TERMIOS_H 29 | &rpc_termios, /* TERMIOS serial */ 30 | #endif 31 | #ifdef HAVE_FORK 32 | &rpc_fork, /* Fork */ 33 | #endif 34 | #ifdef HAVE_DOS_H 35 | &rpc_fossil, /* MS-DOS FOSSIL */ 36 | #endif 37 | /* XXX Let's have some others here, like rpc_tcp, rpc_laplink etc. */ 38 | 39 | -------------------------------------------------------------------------------- /lib/libdsk/rpcfork.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001,2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #ifdef HAVE_FORK 24 | 25 | #ifdef HAVE_FCNTL_H 26 | #include 27 | #endif 28 | 29 | typedef struct fork_remote_data 30 | { 31 | REMOTE_DATA super; 32 | int infd; 33 | int outfd; 34 | pid_t pidchild; 35 | char *filename; 36 | } FORK_REMOTE_DATA; 37 | 38 | extern REMOTE_CLASS rpc_fork; 39 | 40 | dsk_err_t fork_open(DSK_PDRIVER pDriver, const char *name, char *nameout); 41 | dsk_err_t fork_close(DSK_PDRIVER pDriver); 42 | dsk_err_t fork_call(DSK_PDRIVER pDriver, unsigned char *input, 43 | int inp_len, unsigned char *output, int *out_len); 44 | 45 | #endif /* def HAVE_FORK */ 46 | -------------------------------------------------------------------------------- /lib/libdsk/rpcfossl.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001,2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #ifdef HAVE_DOS_H 24 | 25 | typedef struct fossil_remote_data 26 | { 27 | REMOTE_DATA super; 28 | char *filename; 29 | int portno; /* FOSSIL port number */ 30 | long baud; /* Baud rate */ 31 | int crtscts; 32 | /* We won't allow changes in framing. LibDsk needs an 8-bit 33 | * channel so force 8, N, 1 */ 34 | } FOSSIL_REMOTE_DATA; 35 | 36 | extern REMOTE_CLASS rpc_fossil; 37 | 38 | dsk_err_t fossil_open(DSK_PDRIVER pDriver, const char *name, char *nameout); 39 | dsk_err_t fossil_close(DSK_PDRIVER pDriver); 40 | dsk_err_t fossil_call(DSK_PDRIVER pDriver, unsigned char *input, 41 | int inp_len, unsigned char *output, int *out_len); 42 | 43 | #endif /* def HAVE_TERMIOS_H */ 44 | -------------------------------------------------------------------------------- /lib/libdsk/rpctios.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001,2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #ifdef HAVE_TERMIOS_H 24 | 25 | typedef struct termios_remote_data 26 | { 27 | REMOTE_DATA super; 28 | int infd; 29 | int outfd; 30 | char *filename; 31 | int baud; 32 | int crtscts; 33 | /* We won't allow changes in framing. LibDsk needs an 8-bit 34 | * channel so force 8, N, 1 */ 35 | } TERMIOS_REMOTE_DATA; 36 | 37 | extern REMOTE_CLASS rpc_termios; 38 | 39 | dsk_err_t tios_open(DSK_PDRIVER pDriver, const char *name, char *nameout); 40 | dsk_err_t tios_close(DSK_PDRIVER pDriver); 41 | dsk_err_t tios_call(DSK_PDRIVER pDriver, unsigned char *input, 42 | int inp_len, unsigned char *output, int *out_len); 43 | 44 | #endif /* def HAVE_TERMIOS_H */ 45 | -------------------------------------------------------------------------------- /lib/libdsk/rpcwin32.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * * 3 | * LIBDSK: General floppy and diskimage access library * 4 | * Copyright (C) 2001,2005 John Elliott * 5 | * * 6 | * This library is free software; you can redistribute it and/or * 7 | * modify it under the terms of the GNU Library General Public * 8 | * License as published by the Free Software Foundation; either * 9 | * version 2 of the License, or (at your option) any later version. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, * 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Library General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Library General Public * 17 | * License along with this library; if not, write to the Free * 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 19 | * MA 02111-1307, USA * 20 | * * 21 | ***************************************************************************/ 22 | 23 | #if defined(HAVE_WINDOWS_H) && defined (_WIN32) 24 | 25 | typedef struct w32serial_remote_data 26 | { 27 | REMOTE_DATA super; 28 | HANDLE hComm; 29 | DCB dcb; 30 | char *filename; 31 | int baud; 32 | int crtscts; 33 | /* We won't allow changes in framing. LibDsk needs an 8-bit 34 | * channel so force 8, N, 1 */ 35 | } W32SERIAL_REMOTE_DATA; 36 | 37 | extern REMOTE_CLASS rpc_w32serial; 38 | 39 | dsk_err_t w32serial_open(DSK_PDRIVER pDriver, const char *name, char *nameout); 40 | dsk_err_t w32serial_close(DSK_PDRIVER pDriver); 41 | dsk_err_t w32serial_call(DSK_PDRIVER pDriver, unsigned char *input, 42 | int inp_len, unsigned char *output, int *out_len); 43 | 44 | #endif /* def HAVE_TERMIOS_H */ 45 | -------------------------------------------------------------------------------- /lib/libdsk/w16defs.h: -------------------------------------------------------------------------------- 1 | /* Windows 95 disk I/O functions - based on Stan Mitchell's DISKDUMP.C */ 2 | 3 | #define LEVEL0_LOCK 0 4 | #define LEVEL1_LOCK 1 5 | #define LEVEL2_LOCK 2 6 | #define LEVEL3_LOCK 3 7 | #define LEVEL1_LOCK_MAX_PERMISSION 0x0001 8 | 9 | #define DRIVE_IS_REMOTE 0x1000 10 | #define DRIVE_IS_SUBST 0x8000 11 | 12 | #pragma pack(1) 13 | typedef struct MID { 14 | WORD midInfoLevel; // information level, must be 0 15 | DWORD midSerialNum; // serial number for the medium 16 | char midVolLabel[11]; // volume label for the medium 17 | char midFileSysType[8]; // type of file system as 8-byte ASCII 18 | } 19 | MID, *PMID; 20 | 21 | typedef struct driveparams { /* Disk geometry */ 22 | BYTE special; 23 | BYTE devicetype; 24 | WORD deviceattrs; 25 | WORD cylinders; 26 | BYTE mediatype; 27 | /* BPB starts here */ 28 | WORD bytespersector; 29 | BYTE sectorspercluster; 30 | WORD reservedsectors; 31 | BYTE numberofFATs; 32 | WORD rootdirsize; 33 | WORD totalsectors; 34 | BYTE mediaid; 35 | WORD sectorsperfat; 36 | WORD sectorspertrack; 37 | WORD heads; 38 | DWORD hiddensectors; 39 | DWORD bigtotalsectors; 40 | BYTE reserved[6]; 41 | /* BPB ends here */ 42 | WORD sectorcount; 43 | WORD sectortable[80]; 44 | } DRIVEPARAMS, *PDRIVEPARAMS; 45 | /*}}}*/ 46 | 47 | #pragma pack() 48 | -------------------------------------------------------------------------------- /lib/libdsk/w95defs.h: -------------------------------------------------------------------------------- 1 | /* Windows 95 disk I/O functions - based on Stan Mitchell's DISKDUMP.C */ 2 | #define VWIN32_DIOC_DOS_IOCTL 1 // DOS ioctl calls 4400h-4411h 3 | #define VWIN32_DIOC_DOS_INT25 2 // absolute disk read, DOS int 25h 4 | #define VWIN32_DIOC_DOS_INT26 3 // absolute disk write, DOS int 26h 5 | #define VWIN32_DIOC_DOS_INT13 4 // BIOS INT13 functions 6 | 7 | typedef struct _DIOC_REGISTERS { 8 | DWORD reg_EBX; 9 | DWORD reg_EDX; 10 | DWORD reg_ECX; 11 | DWORD reg_EAX; 12 | DWORD reg_EDI; 13 | DWORD reg_ESI; 14 | DWORD reg_Flags; 15 | } 16 | DIOC_REGISTERS, *PDIOC_REGISTERS; 17 | 18 | #define LEVEL0_LOCK 0 19 | #define LEVEL1_LOCK 1 20 | #define LEVEL2_LOCK 2 21 | #define LEVEL3_LOCK 3 22 | #define LEVEL1_LOCK_MAX_PERMISSION 0x0001 23 | 24 | #define DRIVE_IS_REMOTE 0x1000 25 | #define DRIVE_IS_SUBST 0x8000 26 | 27 | /********************************************************* 28 | **** Note: all MS-DOS data structures must be packed **** 29 | **** on a one-byte boundary. **** 30 | *********************************************************/ 31 | #pragma pack(1) 32 | 33 | typedef struct _DISKIO { 34 | DWORD diStartSector; // sector number to start at 35 | WORD diSectors; // number of sectors 36 | DWORD diBuffer; // address of buffer 37 | } 38 | DISKIO, *PDISKIO; 39 | 40 | typedef struct MID { 41 | WORD midInfoLevel; // information level, must be 0 42 | DWORD midSerialNum; // serial number for the medium 43 | char midVolLabel[11]; // volume label for the medium 44 | char midFileSysType[8]; // type of file system as 8-byte ASCII 45 | } 46 | MID, *PMID; 47 | 48 | typedef struct driveparams { /* Disk geometry */ 49 | BYTE special; 50 | BYTE devicetype; 51 | WORD deviceattrs; 52 | WORD cylinders; 53 | BYTE mediatype; 54 | /* BPB starts here */ 55 | WORD bytespersector; 56 | BYTE sectorspercluster; 57 | WORD reservedsectors; 58 | BYTE numberofFATs; 59 | WORD rootdirsize; 60 | WORD totalsectors; 61 | BYTE mediaid; 62 | WORD sectorsperfat; 63 | WORD sectorspertrack; 64 | WORD heads; 65 | DWORD hiddensectors; 66 | DWORD bigtotalsectors; 67 | BYTE reserved[6]; 68 | /* BPB ends here */ 69 | WORD sectorcount; 70 | WORD sectortable[80]; 71 | } DRIVEPARAMS, *PDRIVEPARAMS; 72 | /*}}}*/ 73 | 74 | -------------------------------------------------------------------------------- /lib/miniaudio/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # noinst_LTLIBRARIES 20 | # ---------------------------------------------------------------------------- 21 | 22 | noinst_LTLIBRARIES = \ 23 | libminiaudio.la \ 24 | $(NULL) 25 | 26 | # ---------------------------------------------------------------------------- 27 | # libminiaudio 28 | # ---------------------------------------------------------------------------- 29 | 30 | libminiaudio_la_SOURCES = \ 31 | miniaudio.c \ 32 | miniaudio.h \ 33 | $(NULL) 34 | 35 | libminiaudio_la_CPPFLAGS = \ 36 | -I$(top_srcdir)/lib \ 37 | $(NULL) 38 | 39 | libminiaudio_la_LDFLAGS = \ 40 | -L$(top_builddir)/lib \ 41 | $(NULL) 42 | 43 | libminiaudio_la_LIBADD = \ 44 | -lm \ 45 | $(NULL) 46 | 47 | # ---------------------------------------------------------------------------- 48 | # End-Of-File 49 | # ---------------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /lib/xcpc/formats/cdt/cdt-format.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * cdt-format.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #ifdef HAVE_SYS_TYPES_H 28 | #include 29 | #endif 30 | #ifdef HAVE_SYS_STAT_H 31 | #include 32 | #endif 33 | #ifdef HAVE_FCNTL_H 34 | #include 35 | #endif 36 | #ifdef HAVE_UNISTD_H 37 | #include 38 | #endif 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include "cdt-format.h" 45 | 46 | // --------------------------------------------------------------------------- 47 | // cdt::Tape 48 | // --------------------------------------------------------------------------- 49 | 50 | namespace cdt { 51 | 52 | Tape::Tape(const std::string& filename) 53 | { 54 | } 55 | 56 | } 57 | 58 | // --------------------------------------------------------------------------- 59 | // End-Of-File 60 | // --------------------------------------------------------------------------- 61 | -------------------------------------------------------------------------------- /lib/xcpc/formats/cdt/cdt-format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cdt-format.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_CDT_FORMAT_H__ 18 | #define __XCPC_CDT_FORMAT_H__ 19 | 20 | // --------------------------------------------------------------------------- 21 | // cdt::Tape 22 | // --------------------------------------------------------------------------- 23 | 24 | namespace cdt { 25 | 26 | class Tape 27 | { 28 | public: // public interface 29 | Tape(const std::string& filename); 30 | 31 | Tape(const Tape&) = delete; 32 | 33 | Tape& operator=(const Tape&) = delete; 34 | 35 | virtual ~Tape() = default; 36 | }; 37 | 38 | } 39 | 40 | // --------------------------------------------------------------------------- 41 | // End-Of-File 42 | // --------------------------------------------------------------------------- 43 | 44 | #endif /* __XCPC_CDT_FORMAT_H__ */ 45 | -------------------------------------------------------------------------------- /lib/xcpc/libxcpc-priv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libxcpc-priv.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_LIBXCPC_PRIV_H__ 18 | #define __XCPC_LIBXCPC_PRIV_H__ 19 | 20 | // --------------------------------------------------------------------------- 21 | // common includes 22 | // --------------------------------------------------------------------------- 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #ifdef HAVE_SYS_TYPES_H 35 | #include 36 | #endif 37 | #ifdef HAVE_SYS_STAT_H 38 | #include 39 | #endif 40 | #ifdef HAVE_SYS_TIME_H 41 | #include 42 | #endif 43 | #ifdef HAVE_SYS_IPC_H 44 | #include 45 | #endif 46 | #ifdef HAVE_SYS_SHM_H 47 | #include 48 | #endif 49 | #ifdef HAVE_FCNTL_H 50 | #include 51 | #endif 52 | #ifdef HAVE_UNISTD_H 53 | #include 54 | #endif 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | 70 | // --------------------------------------------------------------------------- 71 | // some useful macros 72 | // --------------------------------------------------------------------------- 73 | 74 | #ifndef countof 75 | #define countof(array) (sizeof(array) / sizeof(array[0])) 76 | #endif 77 | 78 | // --------------------------------------------------------------------------- 79 | // End-Of-File 80 | // --------------------------------------------------------------------------- 81 | 82 | #endif /* __XCPC_LIBXCPC_PRIV_H__ */ 83 | -------------------------------------------------------------------------------- /m4/ax_check_byte_order.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_byte_order.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_BYTE_ORDER 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_BYTE_ORDER], [ 23 | AC_C_BIGENDIAN([ 24 | AC_DEFINE([MSB_FIRST], [1], [Define to 1 if the host byte-ordering is MSB first.]) 25 | ], [ 26 | AC_DEFINE([LSB_FIRST], [1], [Define to 1 if the host byte-ordering is LSB first.]) 27 | ], [ 28 | AC_MSG_ERROR([unable to determine the target byte-order]) 29 | ]) 30 | ]) 31 | 32 | # ---------------------------------------------------------------------------- 33 | # End-Of-File 34 | # ---------------------------------------------------------------------------- 35 | -------------------------------------------------------------------------------- /m4/ax_check_gtk3.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_gtk3.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_GTK3 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_GTK3], [ 23 | AC_ARG_ENABLE([gtk3], [AS_HELP_STRING([--enable-gtk3], [add the support of gtk3 (if available) [default=yes]])], [], [enable_gtk3='yes']) 24 | if test "x${enable_gtk3}" = 'xyes'; then 25 | PKG_CHECK_MODULES([gtk3], [gtk+-3.0 epoxy], [have_gtk3='yes'], [have_gtk3='no']) 26 | else 27 | have_gtk3='no' 28 | fi 29 | if test "x${have_gtk3}" = 'xyes'; then 30 | AC_DEFINE([HAVE_GTK3], [1], [Define to 1 if you have the gtk3 library.]) 31 | AM_CONDITIONAL([HAVE_GTK3], true) 32 | else 33 | AM_CONDITIONAL([HAVE_GTK3], false) 34 | fi 35 | ]) 36 | 37 | # ---------------------------------------------------------------------------- 38 | # End-Of-File 39 | # ---------------------------------------------------------------------------- 40 | -------------------------------------------------------------------------------- /m4/ax_check_gtk4.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_gtk4.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_GTK4 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_GTK4], [ 23 | AC_ARG_ENABLE([gtk4], [AS_HELP_STRING([--enable-gtk4], [add the support of gtk4 (if available) [default=yes]])], [], [enable_gtk4='yes']) 24 | if test "x${enable_gtk4}" = 'xyes'; then 25 | PKG_CHECK_MODULES([gtk4], [gtk4 epoxy], [have_gtk4='unsupported'], [have_gtk4='no']) 26 | else 27 | have_gtk4='no' 28 | fi 29 | if test "x${have_gtk4}" = 'xyes'; then 30 | AC_DEFINE([HAVE_GTK4], [1], [Define to 1 if you have the gtk4 library.]) 31 | AM_CONDITIONAL([HAVE_GTK4], true) 32 | else 33 | AM_CONDITIONAL([HAVE_GTK4], false) 34 | fi 35 | ]) 36 | 37 | # ---------------------------------------------------------------------------- 38 | # End-Of-File 39 | # ---------------------------------------------------------------------------- 40 | -------------------------------------------------------------------------------- /m4/ax_check_gui_toolkit.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_gui_toolkit.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_TOOLKITS 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_TOOLKITS], [ 23 | AX_CHECK_X11 24 | AX_CHECK_XSHM 25 | AX_CHECK_GTK3 26 | AX_CHECK_GTK4 27 | ]) 28 | 29 | # ---------------------------------------------------------------------------- 30 | # AX_CHECK_GUI_TOOLKIT 31 | # ---------------------------------------------------------------------------- 32 | 33 | AC_DEFUN([AX_CHECK_GUI_TOOLKIT], [ 34 | AX_CHECK_TOOLKITS 35 | AC_ARG_WITH([gui-toolkit], [AS_HELP_STRING([--with-gui-toolkit], [select the graphical user interface toolkit (gtk4, gtk3)])]) 36 | if test "x${with_gui_toolkit}${have_gtk4}" = 'xyes'; then 37 | with_gui_toolkit='gtk4' 38 | fi 39 | if test "x${with_gui_toolkit}${have_gtk3}" = 'xyes'; then 40 | with_gui_toolkit='gtk3' 41 | fi 42 | if test "x${with_gui_toolkit}" = 'xgtk4'; then 43 | if test "x${have_gtk4}" != 'xyes'; then 44 | AC_MSG_ERROR([gtk4 toolkit was not found]) 45 | fi 46 | fi 47 | if test "x${with_gui_toolkit}" = 'xgtk3'; then 48 | if test "x${have_gtk3}" != 'xyes'; then 49 | AC_MSG_ERROR([gtk3 toolkit was not found]) 50 | fi 51 | fi 52 | case "${with_gui_toolkit}" in 53 | gtk4) 54 | AC_DEFINE([USE_GTK4], [1], [Define to 1 if you want the gtk4 interface.]) 55 | AM_CONDITIONAL([USE_GTK4], true ) 56 | AM_CONDITIONAL([USE_GTK3], false) 57 | ;; 58 | gtk3) 59 | AC_DEFINE([USE_GTK3], [1], [Define to 1 if you want the gtk3 interface.]) 60 | AM_CONDITIONAL([USE_GTK4], false) 61 | AM_CONDITIONAL([USE_GTK3], true ) 62 | ;; 63 | *) 64 | AC_MSG_ERROR([no usable GUI toolkit was found]) 65 | ;; 66 | esac 67 | ]) 68 | 69 | # ---------------------------------------------------------------------------- 70 | # End-Of-File 71 | # ---------------------------------------------------------------------------- 72 | -------------------------------------------------------------------------------- /m4/ax_check_lib765.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_lib765.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_LIB765 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_LIB765], [ 23 | AC_ARG_ENABLE([lib765], [AS_HELP_STRING([--enable-lib765], [add the support of lib765 (builtin) [default=yes]])], [], [enable_lib765='yes']) 24 | if test "x${enable_lib765}" = 'xyes'; then 25 | have_lib765='yes' 26 | else 27 | have_lib765='no' 28 | fi 29 | if test "x${have_lib765}" = 'xyes'; then 30 | AC_DEFINE([HAVE_LIB765], [1], [Define to 1 if you have the lib765 library.]) 31 | AC_DEFINE([USE_LIB765], [1], [Define to 1 if you want the lib765 library.]) 32 | AM_CONDITIONAL([HAVE_LIB765], true) 33 | AM_CONDITIONAL([USE_LIB765], true) 34 | else 35 | AM_CONDITIONAL([HAVE_LIB765], false) 36 | AM_CONDITIONAL([USE_LIB765], false) 37 | fi 38 | ]) 39 | 40 | # ---------------------------------------------------------------------------- 41 | # End-Of-File 42 | # ---------------------------------------------------------------------------- 43 | -------------------------------------------------------------------------------- /m4/ax_check_libdsk.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_libdsk.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_LIBDSK 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_LIBDSK], [ 23 | AC_ARG_ENABLE([libdsk], [AS_HELP_STRING([--enable-libdsk], [add the support of libdsk (builtin) [default=yes]])], [], [enable_libdsk='yes']) 24 | if test "x${enable_libdsk}" = 'xyes'; then 25 | have_libdsk='yes' 26 | else 27 | have_libdsk='no' 28 | fi 29 | if test "x${have_libdsk}" = 'xyes'; then 30 | AC_DEFINE([HAVE_LIBDSK], [1], [Define to 1 if you have the libdsk library.]) 31 | AC_DEFINE([USE_LIBDSK], [1], [Define to 1 if you want the libdsk library.]) 32 | AM_CONDITIONAL([HAVE_LIBDSK], true) 33 | AM_CONDITIONAL([USE_LIBDSK], true) 34 | else 35 | AM_CONDITIONAL([HAVE_LIBDSK], false) 36 | AM_CONDITIONAL([USE_LIBDSK], false) 37 | fi 38 | ]) 39 | 40 | # ---------------------------------------------------------------------------- 41 | # End-Of-File 42 | # ---------------------------------------------------------------------------- 43 | -------------------------------------------------------------------------------- /m4/ax_check_miniaudio.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_miniaudio.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_MINIAUDIO 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_MINIAUDIO], [ 23 | AC_ARG_ENABLE([miniaudio], [AS_HELP_STRING([--enable-miniaudio], [add the support of miniaudio (builtin) [default=yes]])], [], [enable_miniaudio='yes']) 24 | if test "x${enable_miniaudio}" = 'xyes'; then 25 | have_miniaudio='yes' 26 | else 27 | have_miniaudio='no' 28 | fi 29 | if test "x${have_miniaudio}" = 'xyes'; then 30 | AC_DEFINE([HAVE_MINIAUDIO], [1], [Define to 1 if you have the miniaudio library.]) 31 | AC_DEFINE([USE_MINIAUDIO], [1], [Define to 1 if you want the miniaudio library.]) 32 | AM_CONDITIONAL([HAVE_MINIAUDIO], true) 33 | AM_CONDITIONAL([USE_MINIAUDIO], true) 34 | else 35 | AM_CONDITIONAL([HAVE_MINIAUDIO], false) 36 | AM_CONDITIONAL([USE_MINIAUDIO], false) 37 | fi 38 | ]) 39 | 40 | # ---------------------------------------------------------------------------- 41 | # End-Of-File 42 | # ---------------------------------------------------------------------------- 43 | -------------------------------------------------------------------------------- /m4/ax_check_x11.m4: -------------------------------------------------------------------------------- 1 | # 2 | # ax_check_x11.m4 - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AX_CHECK_X11 20 | # ---------------------------------------------------------------------------- 21 | 22 | AC_DEFUN([AX_CHECK_X11], [ 23 | AC_PATH_X 24 | AC_PATH_XTRA 25 | AC_DEFINE([HAVE_X11], [1], [Define to 1 if you have the X11 library.]) 26 | AC_DEFINE([USE_X11], [1], [Define to 1 if you want the X11 library.]) 27 | AM_CONDITIONAL([HAVE_X11], true) 28 | AM_CONDITIONAL([USE_X11], true) 29 | ]) 30 | 31 | # ---------------------------------------------------------------------------- 32 | # AX_CHECK_XSHM 33 | # ---------------------------------------------------------------------------- 34 | 35 | AC_DEFUN([AX_CHECK_XSHM], [ 36 | AC_ARG_ENABLE([xshm], [AS_HELP_STRING([--enable-xshm], [add the support of XShm (if available) [default=yes]])], [], [enable_xshm='yes']) 37 | if test "x${enable_xshm}" = 'xyes'; then 38 | AC_CHECK_HEADERS([X11/extensions/XShm.h], [have_xshm='yes'], [have_xshm='no'], [ 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | ]) 47 | fi 48 | if test "x${have_xshm}" = 'xyes'; then 49 | AC_DEFINE([HAVE_XSHM], [1], [Define to 1 if you have the X11-SHM extension.]) 50 | else 51 | have_xshm='no' 52 | fi 53 | ]) 54 | 55 | # ---------------------------------------------------------------------------- 56 | # End-Of-File 57 | # ---------------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /share/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # SUBDIRS 20 | # ---------------------------------------------------------------------------- 21 | 22 | SUBDIRS = \ 23 | applications \ 24 | mime \ 25 | pixmaps \ 26 | xcpc \ 27 | $(NULL) 28 | 29 | # ---------------------------------------------------------------------------- 30 | # End-Of-File 31 | # ---------------------------------------------------------------------------- 32 | -------------------------------------------------------------------------------- /share/applications/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # applications resources 20 | # ---------------------------------------------------------------------------- 21 | 22 | applicationsdir = $(datadir)/applications 23 | 24 | dist_applications_DATA = \ 25 | xcpc.desktop \ 26 | $(NULL) 27 | 28 | # ---------------------------------------------------------------------------- 29 | # EXTRA_DIST 30 | # ---------------------------------------------------------------------------- 31 | 32 | EXTRA_DIST = \ 33 | xcpc.desktop.in \ 34 | $(NULL) 35 | 36 | # ---------------------------------------------------------------------------- 37 | # End-Of-File 38 | # ---------------------------------------------------------------------------- 39 | -------------------------------------------------------------------------------- /share/applications/xcpc.desktop.in: -------------------------------------------------------------------------------- 1 | # 2 | # xcpc.desktop - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | [Desktop Entry] 18 | Version=1.0 19 | Encoding=UTF-8 20 | Name=Xcpc - Amstrad CPC emulator 21 | Comment=Amstrad CPC emulator 22 | Categories=Game; 23 | Exec=@XCPC_BINDIR@/xcpc 24 | Icon=@XCPC_DATDIR@/pixmaps/xcpc.png 25 | Terminal=false 26 | Type=Application 27 | MimeType=application/x-amstrad-cpc-snapshot;application/x-amstrad-cpc-disk-image;application/x-amstrad-cpc-gz-disk-image;application/x-amstrad-cpc-bz2-disk-image 28 | -------------------------------------------------------------------------------- /share/mime/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # SUBDIRS 20 | # ---------------------------------------------------------------------------- 21 | 22 | SUBDIRS = \ 23 | packages \ 24 | $(NULL) 25 | 26 | # ---------------------------------------------------------------------------- 27 | # End-Of-File 28 | # ---------------------------------------------------------------------------- 29 | -------------------------------------------------------------------------------- /share/mime/packages/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # mimepackages resources 20 | # ---------------------------------------------------------------------------- 21 | 22 | mimepackagesdir = $(datadir)/mime/packages 23 | 24 | dist_mimepackages_DATA = \ 25 | x-amstrad-cpc-disk-image.xml \ 26 | x-amstrad-cpc-snapshot.xml \ 27 | $(NULL) 28 | 29 | # ---------------------------------------------------------------------------- 30 | # EXTRA_DIST 31 | # ---------------------------------------------------------------------------- 32 | 33 | EXTRA_DIST = \ 34 | $(NULL) 35 | 36 | # ---------------------------------------------------------------------------- 37 | # End-Of-File 38 | # ---------------------------------------------------------------------------- 39 | -------------------------------------------------------------------------------- /share/mime/packages/x-amstrad-cpc-disk-image.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Amstrad CPC disk 5 | 6 | 7 | 8 | Amstrad CPC disk (gzipped) 9 | 10 | 11 | 12 | 13 | Amstrad CPC disk (bzipped) 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /share/mime/packages/x-amstrad-cpc-snapshot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Amstrad CPC snapshot 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /share/pixmaps/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # pixmaps resources 20 | # ---------------------------------------------------------------------------- 21 | 22 | pixmapsdir = $(datadir)/pixmaps 23 | 24 | dist_pixmaps_DATA = \ 25 | xcpc.png \ 26 | $(NULL) 27 | 28 | # ---------------------------------------------------------------------------- 29 | # End-Of-File 30 | # ---------------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /share/pixmaps/xcpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/share/pixmaps/xcpc.png -------------------------------------------------------------------------------- /share/xcpc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # SUBDIRS 20 | # ---------------------------------------------------------------------------- 21 | 22 | SUBDIRS = \ 23 | roms \ 24 | disks \ 25 | snapshots \ 26 | $(NULL) 27 | 28 | # ---------------------------------------------------------------------------- 29 | # End-Of-File 30 | # ---------------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /share/xcpc/disks/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # disks resources 20 | # ---------------------------------------------------------------------------- 21 | 22 | disksdir = $(datadir)/@PACKAGE@/disks 23 | 24 | dist_disks_DATA = \ 25 | README.md \ 26 | $(NULL) 27 | 28 | # ---------------------------------------------------------------------------- 29 | # End-Of-File 30 | # ---------------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /share/xcpc/disks/README.md: -------------------------------------------------------------------------------- 1 | # DISKS 2 | 3 | This directory contains disks. 4 | -------------------------------------------------------------------------------- /share/xcpc/roms/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # roms resources 20 | # ---------------------------------------------------------------------------- 21 | 22 | romsdir = $(datadir)/@PACKAGE@/roms 23 | 24 | dist_roms_DATA = \ 25 | README.md \ 26 | cpc464en.rom \ 27 | cpc664en.rom \ 28 | cpc6128en.rom \ 29 | cpc6128fr.rom \ 30 | amsdos.rom \ 31 | $(NULL) 32 | 33 | # ---------------------------------------------------------------------------- 34 | # End-Of-File 35 | # ---------------------------------------------------------------------------- 36 | -------------------------------------------------------------------------------- /share/xcpc/roms/README.md: -------------------------------------------------------------------------------- 1 | # ROMS 2 | 3 | This directory contains roms. 4 | -------------------------------------------------------------------------------- /share/xcpc/roms/amsdos.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/share/xcpc/roms/amsdos.rom -------------------------------------------------------------------------------- /share/xcpc/roms/cpc464en.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/share/xcpc/roms/cpc464en.rom -------------------------------------------------------------------------------- /share/xcpc/roms/cpc6128en.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/share/xcpc/roms/cpc6128en.rom -------------------------------------------------------------------------------- /share/xcpc/roms/cpc6128fr.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/share/xcpc/roms/cpc6128fr.rom -------------------------------------------------------------------------------- /share/xcpc/roms/cpc664en.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ponceto/xcpc-emulator/09cd5f49a4b40c8fb914b8bb9aa6191a6d25b5ed/share/xcpc/roms/cpc664en.rom -------------------------------------------------------------------------------- /share/xcpc/snapshots/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # snapshots resources 20 | # ---------------------------------------------------------------------------- 21 | 22 | snapshotsdir = $(datadir)/@PACKAGE@/snapshots 23 | 24 | dist_snapshots_DATA = \ 25 | README.md \ 26 | $(NULL) 27 | 28 | # ---------------------------------------------------------------------------- 29 | # End-Of-File 30 | # ---------------------------------------------------------------------------- 31 | -------------------------------------------------------------------------------- /share/xcpc/snapshots/README.md: -------------------------------------------------------------------------------- 1 | # SNAPSHOTS 2 | 3 | This directory contains snapshots. 4 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # SUBDIRS 20 | # ---------------------------------------------------------------------------- 21 | 22 | SUBDIRS = \ 23 | utils \ 24 | $(NULL) 25 | 26 | # ---------------------------------------------------------------------------- 27 | # Gtk+-3.0 28 | # ---------------------------------------------------------------------------- 29 | 30 | if USE_GTK3 31 | if HAVE_GTK3 32 | SUBDIRS += gtk3ui 33 | endif 34 | endif 35 | 36 | # ---------------------------------------------------------------------------- 37 | # Gtk+-4.0 38 | # ---------------------------------------------------------------------------- 39 | 40 | if USE_GTK4 41 | if HAVE_GTK4 42 | SUBDIRS += gtk4ui 43 | endif 44 | endif 45 | 46 | # ---------------------------------------------------------------------------- 47 | # bin_PROGRAMS 48 | # ---------------------------------------------------------------------------- 49 | 50 | bin_PROGRAMS = \ 51 | xcpc \ 52 | $(NULL) 53 | 54 | # ---------------------------------------------------------------------------- 55 | # xcpc 56 | # ---------------------------------------------------------------------------- 57 | 58 | xcpc_SOURCES = \ 59 | xcpc.cc \ 60 | xcpc.h \ 61 | $(NULL) 62 | 63 | xcpc_CPPFLAGS = \ 64 | -I$(top_srcdir)/lib \ 65 | -I$(top_srcdir)/src \ 66 | $(NULL) 67 | 68 | xcpc_LDFLAGS = \ 69 | -L$(top_builddir)/lib \ 70 | -L$(top_builddir)/src \ 71 | $(NULL) 72 | 73 | xcpc_LDADD = \ 74 | $(NULL) 75 | 76 | if USE_GTK3 77 | if HAVE_GTK3 78 | xcpc_LDADD += $(top_builddir)/src/gtk3ui/libxcpcgtk3ui.la 79 | endif 80 | endif 81 | 82 | if USE_GTK4 83 | if HAVE_GTK4 84 | xcpc_LDADD += $(top_builddir)/src/gtk4ui/libxcpcgtk4ui.la 85 | endif 86 | endif 87 | 88 | # ---------------------------------------------------------------------------- 89 | # End-Of-File 90 | # ---------------------------------------------------------------------------- 91 | -------------------------------------------------------------------------------- /src/gtk3ui/all.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * all.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "all.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // xxx 36 | // --------------------------------------------------------------------------- 37 | 38 | // --------------------------------------------------------------------------- 39 | // End-Of-File 40 | // --------------------------------------------------------------------------- 41 | -------------------------------------------------------------------------------- /src/gtk3ui/all.h: -------------------------------------------------------------------------------- 1 | /* 2 | * all.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_ALL_H__ 18 | #define __GTK3_CXX_ALL_H__ 19 | 20 | // --------------------------------------------------------------------------- 21 | // includes 22 | // --------------------------------------------------------------------------- 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | // --------------------------------------------------------------------------- 49 | // End-Of-File 50 | // --------------------------------------------------------------------------- 51 | 52 | #endif /* __GTK3_CXX_ALL_H__ */ 53 | -------------------------------------------------------------------------------- /src/gtk3ui/gdk3-pixbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdk3-pixbuf.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GDK3_CXX_PIXBUF_H__ 18 | #define __GDK3_CXX_PIXBUF_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gdk3::Pixbuf 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gdk3 { 27 | 28 | class Pixbuf 29 | { 30 | public: // public interface 31 | Pixbuf(); 32 | 33 | Pixbuf(GdkPixbuf*); 34 | 35 | virtual ~Pixbuf(); 36 | 37 | operator GdkPixbuf*() const 38 | { 39 | return _instance; 40 | } 41 | 42 | GdkPixbuf* operator*() const 43 | { 44 | return _instance; 45 | } 46 | 47 | void create_from_file(const std::string& filename); 48 | 49 | void create_from_resource(const std::string& resource); 50 | 51 | void unref(); 52 | 53 | protected: // protected data 54 | GdkPixbuf* _instance; 55 | }; 56 | 57 | } 58 | 59 | // --------------------------------------------------------------------------- 60 | // End-Of-File 61 | // --------------------------------------------------------------------------- 62 | 63 | #endif /* __GDK3_CXX_PIXBUF_H__ */ 64 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-about-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-about-dialog.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_ABOUT_DIALOG_H__ 18 | #define __GTK3_CXX_ABOUT_DIALOG_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::AboutDialog 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class AboutDialog 29 | : public Dialog 30 | { 31 | public: // public interface 32 | AboutDialog(); 33 | 34 | AboutDialog(GtkWidget*); 35 | 36 | AboutDialog(const AboutDialog&) = delete; 37 | 38 | AboutDialog& operator=(const AboutDialog&) = delete; 39 | 40 | virtual ~AboutDialog() = default; 41 | 42 | operator GtkAboutDialog*() const 43 | { 44 | return GTK_ABOUT_DIALOG(_instance); 45 | } 46 | 47 | void create_about_dialog(); 48 | 49 | void set_logo(GdkPixbuf* logo); 50 | 51 | void set_logo_icon_name(const std::string& icon_name); 52 | 53 | void set_program_name(const std::string& program_name); 54 | 55 | void set_version(const std::string& version); 56 | 57 | void set_copyright(const std::string& copyright); 58 | 59 | void set_comments(const std::string& comments); 60 | 61 | void set_website(const std::string& website); 62 | 63 | void set_license(const std::string& license); 64 | }; 65 | 66 | } 67 | 68 | // --------------------------------------------------------------------------- 69 | // End-Of-File 70 | // --------------------------------------------------------------------------- 71 | 72 | #endif /* __GTK3_CXX_ABOUT_DIALOG_H__ */ 73 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-application-window.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-application-window.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-application-window.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::ApplicationWindowTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct ApplicationWindowTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_application_window(Application& application) 44 | { 45 | return ::gtk_application_window_new(application); 46 | } 47 | }; 48 | 49 | } 50 | 51 | // --------------------------------------------------------------------------- 52 | // ::traits 53 | // --------------------------------------------------------------------------- 54 | 55 | namespace { 56 | 57 | using traits = gtk3::ApplicationWindowTraits; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // gtk3::ApplicationWindow 63 | // --------------------------------------------------------------------------- 64 | 65 | namespace gtk3 { 66 | 67 | ApplicationWindow::ApplicationWindow(Application& application) 68 | : ApplicationWindow(traits::create_application_window(application)) 69 | { 70 | } 71 | 72 | ApplicationWindow::ApplicationWindow(GtkWidget* instance) 73 | : Window(instance) 74 | { 75 | } 76 | 77 | void ApplicationWindow::create_application_window(Application& application) 78 | { 79 | if(_instance == nullptr) { 80 | _instance = traits::create_application_window(application); 81 | traits::register_widget_instance(_instance); 82 | } 83 | } 84 | 85 | } 86 | 87 | // --------------------------------------------------------------------------- 88 | // End-Of-File 89 | // --------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-application-window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-application-window.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_APPLICATION_WINDOW_H__ 18 | #define __GTK3_CXX_APPLICATION_WINDOW_H__ 19 | 20 | #include 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // gtk3::ApplicationWindow 25 | // --------------------------------------------------------------------------- 26 | 27 | namespace gtk3 { 28 | 29 | class ApplicationWindow 30 | : public Window 31 | { 32 | public: // public interface 33 | ApplicationWindow(Application&); 34 | 35 | ApplicationWindow(GtkWidget*); 36 | 37 | ApplicationWindow(const ApplicationWindow&) = delete; 38 | 39 | ApplicationWindow& operator=(const ApplicationWindow&) = delete; 40 | 41 | virtual ~ApplicationWindow() = default; 42 | 43 | operator GtkApplicationWindow*() const 44 | { 45 | return GTK_APPLICATION_WINDOW(_instance); 46 | } 47 | 48 | void create_application_window(Application&); 49 | }; 50 | 51 | } 52 | 53 | // --------------------------------------------------------------------------- 54 | // End-Of-File 55 | // --------------------------------------------------------------------------- 56 | 57 | #endif /* __GTK3_CXX_APPLICATION_WINDOW_H__ */ 58 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-base.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_BASE_H__ 18 | #define __GTK3_CXX_BASE_H__ 19 | 20 | #include 21 | #include 22 | 23 | // --------------------------------------------------------------------------- 24 | // gtk3::signals 25 | // --------------------------------------------------------------------------- 26 | 27 | namespace gtk3 { 28 | 29 | extern const char sig_destroy[]; 30 | extern const char sig_open[]; 31 | extern const char sig_startup[]; 32 | extern const char sig_shutdown[]; 33 | extern const char sig_activate[]; 34 | extern const char sig_clicked[]; 35 | extern const char sig_enter[]; 36 | extern const char sig_leave[]; 37 | extern const char sig_pressed[]; 38 | extern const char sig_released[]; 39 | extern const char sig_select[]; 40 | extern const char sig_deselect[]; 41 | extern const char sig_drag_data_received[]; 42 | extern const char sig_hotkey[]; 43 | extern const char sig_render[]; 44 | extern const char sig_resize[]; 45 | extern const char sig_realize[]; 46 | extern const char sig_unrealize[]; 47 | extern const char sig_key_press_event[]; 48 | extern const char sig_key_release_event[]; 49 | extern const char sig_button_press_event[]; 50 | extern const char sig_button_release_event[]; 51 | extern const char sig_motion_notify_event[]; 52 | 53 | } 54 | 55 | // --------------------------------------------------------------------------- 56 | // gtk3::BasicTraits 57 | // --------------------------------------------------------------------------- 58 | 59 | namespace gtk3 { 60 | 61 | struct BasicTraits 62 | { 63 | template 64 | static void signal_connect(T* instance, const char* signal, GCallback callback, void* data) 65 | { 66 | if(instance != nullptr) { 67 | static_cast(::g_signal_connect(G_OBJECT(instance), signal, callback, data)); 68 | } 69 | } 70 | 71 | static void register_widget_instance(GtkWidget*& instance); 72 | }; 73 | 74 | } 75 | 76 | // --------------------------------------------------------------------------- 77 | // End-Of-File 78 | // --------------------------------------------------------------------------- 79 | 80 | #endif /* __GTK3_CXX_BASE_H__ */ 81 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-bin.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-bin.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-bin.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::BinTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct BinTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_bin() 44 | { 45 | return nullptr; 46 | } 47 | }; 48 | 49 | } 50 | 51 | // --------------------------------------------------------------------------- 52 | // ::traits 53 | // --------------------------------------------------------------------------- 54 | 55 | namespace { 56 | 57 | using traits = gtk3::BinTraits; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // gtk3::Bin 63 | // --------------------------------------------------------------------------- 64 | 65 | namespace gtk3 { 66 | 67 | Bin::Bin() 68 | : Bin(traits::create_bin()) 69 | { 70 | } 71 | 72 | Bin::Bin(GtkWidget* instance) 73 | : Container(instance) 74 | { 75 | } 76 | 77 | } 78 | 79 | // --------------------------------------------------------------------------- 80 | // End-Of-File 81 | // --------------------------------------------------------------------------- 82 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-bin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-bin.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_BIN_H__ 18 | #define __GTK3_CXX_BIN_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Bin 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Bin 29 | : public Container 30 | { 31 | public: // public interface 32 | Bin(); 33 | 34 | Bin(GtkWidget*); 35 | 36 | Bin(const Bin&) = delete; 37 | 38 | Bin& operator=(const Bin&) = delete; 39 | 40 | virtual ~Bin() = default; 41 | 42 | operator GtkBin*() const 43 | { 44 | return GTK_BIN(_instance); 45 | } 46 | }; 47 | 48 | } 49 | 50 | // --------------------------------------------------------------------------- 51 | // End-Of-File 52 | // --------------------------------------------------------------------------- 53 | 54 | #endif /* __GTK3_CXX_BIN_H__ */ 55 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-box.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_BOX_H__ 18 | #define __GTK3_CXX_BOX_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Box 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Box 29 | : public Container 30 | { 31 | public: // public interface 32 | Box(); 33 | 34 | Box(GtkWidget*); 35 | 36 | Box(const Box&) = delete; 37 | 38 | Box& operator=(const Box&) = delete; 39 | 40 | virtual ~Box() = default; 41 | 42 | operator GtkBox*() const 43 | { 44 | return GTK_BOX(_instance); 45 | } 46 | 47 | void set_spacing(int spacing); 48 | 49 | void set_homogeneous(bool homogeneous); 50 | 51 | void pack_start(Widget& child, bool expand, bool fill, unsigned int padding); 52 | 53 | void pack_end(Widget& child, bool expand, bool fill, unsigned int padding); 54 | 55 | void set_center_widget(Widget& child); 56 | }; 57 | 58 | } 59 | 60 | // --------------------------------------------------------------------------- 61 | // gtk3::HBox 62 | // --------------------------------------------------------------------------- 63 | 64 | namespace gtk3 { 65 | 66 | class HBox 67 | : public Box 68 | { 69 | public: // public interface 70 | HBox(); 71 | 72 | HBox(GtkWidget*); 73 | 74 | virtual ~HBox() = default; 75 | 76 | void create_hbox(); 77 | }; 78 | 79 | } 80 | 81 | // --------------------------------------------------------------------------- 82 | // gtk3::VBox 83 | // --------------------------------------------------------------------------- 84 | 85 | namespace gtk3 { 86 | 87 | class VBox 88 | : public Box 89 | { 90 | public: // public interface 91 | VBox(); 92 | 93 | VBox(GtkWidget*); 94 | 95 | virtual ~VBox() = default; 96 | 97 | void create_vbox(); 98 | }; 99 | 100 | } 101 | 102 | // --------------------------------------------------------------------------- 103 | // End-Of-File 104 | // --------------------------------------------------------------------------- 105 | 106 | #endif /* __GTK3_CXX_BOX_H__ */ 107 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-button.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-button.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_BUTTON_H__ 18 | #define __GTK3_CXX_BUTTON_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Button 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Button 29 | : public Bin 30 | { 31 | public: // public interface 32 | Button(); 33 | 34 | Button(GtkWidget*); 35 | 36 | Button(const Button&) = delete; 37 | 38 | Button& operator=(const Button&) = delete; 39 | 40 | virtual ~Button() = default; 41 | 42 | operator GtkButton*() const 43 | { 44 | return GTK_BUTTON(_instance); 45 | } 46 | 47 | void create_button(); 48 | 49 | void create_button_with_label(const std::string& string); 50 | 51 | void add_activate_callback(GCallback callback, void* data); 52 | 53 | void add_clicked_callback(GCallback callback, void* data); 54 | 55 | void add_enter_callback(GCallback callback, void* data); 56 | 57 | void add_leave_callback(GCallback callback, void* data); 58 | 59 | void add_pressed_callback(GCallback callback, void* data); 60 | 61 | void add_released_callback(GCallback callback, void* data); 62 | }; 63 | 64 | } 65 | 66 | // --------------------------------------------------------------------------- 67 | // End-Of-File 68 | // --------------------------------------------------------------------------- 69 | 70 | #endif /* __GTK3_CXX_BUTTON_H__ */ 71 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-container.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-container.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_CONTAINER_H__ 18 | #define __GTK3_CXX_CONTAINER_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Container 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Container 29 | : public Widget 30 | { 31 | public: // public interface 32 | Container(); 33 | 34 | Container(GtkWidget*); 35 | 36 | Container(const Container&) = delete; 37 | 38 | Container& operator=(const Container&) = delete; 39 | 40 | virtual ~Container() = default; 41 | 42 | operator GtkContainer*() const 43 | { 44 | return GTK_CONTAINER(_instance); 45 | } 46 | 47 | void add(Widget&); 48 | 49 | void remove(Widget&); 50 | }; 51 | 52 | } 53 | 54 | // --------------------------------------------------------------------------- 55 | // End-Of-File 56 | // --------------------------------------------------------------------------- 57 | 58 | #endif /* __GTK3_CXX_CONTAINER_H__ */ 59 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-dialog.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_DIALOG_H__ 18 | #define __GTK3_CXX_DIALOG_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::DialogListener 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class DialogListener 29 | { 30 | public: // public interface 31 | DialogListener() = default; 32 | 33 | DialogListener(const DialogListener&) = delete; 34 | 35 | DialogListener& operator=(const DialogListener&) = delete; 36 | 37 | virtual ~DialogListener() = default; 38 | 39 | virtual void on_response(const int response); 40 | 41 | virtual void on_response_none(); 42 | 43 | virtual void on_response_reject(); 44 | 45 | virtual void on_response_accept(); 46 | 47 | virtual void on_response_delete_event(); 48 | 49 | virtual void on_response_ok(); 50 | 51 | virtual void on_response_cancel(); 52 | 53 | virtual void on_response_close(); 54 | 55 | virtual void on_response_yes(); 56 | 57 | virtual void on_response_no(); 58 | 59 | virtual void on_response_apply(); 60 | 61 | virtual void on_response_help(); 62 | }; 63 | 64 | } 65 | 66 | // --------------------------------------------------------------------------- 67 | // gtk3::Dialog 68 | // --------------------------------------------------------------------------- 69 | 70 | namespace gtk3 { 71 | 72 | class Dialog 73 | : public Window 74 | , public DialogListener 75 | { 76 | public: // public interface 77 | Dialog(); 78 | 79 | Dialog(GtkWidget*); 80 | 81 | virtual ~Dialog() = default; 82 | 83 | operator GtkDialog*() const 84 | { 85 | return GTK_DIALOG(_instance); 86 | } 87 | 88 | DialogListener& dialog_listener() const 89 | { 90 | return _dialog_listener; 91 | } 92 | 93 | virtual int run(); 94 | 95 | protected: // protected data 96 | DialogListener& _dialog_listener; 97 | }; 98 | 99 | } 100 | 101 | // --------------------------------------------------------------------------- 102 | // End-Of-File 103 | // --------------------------------------------------------------------------- 104 | 105 | #endif /* __GTK3_CXX_DIALOG_H__ */ 106 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-emulator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-emulator.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_EMULATOR_H__ 18 | #define __GTK3_CXX_EMULATOR_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Emulator 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Emulator 29 | : public Widget 30 | { 31 | public: // public interface 32 | Emulator(); 33 | 34 | Emulator(GtkWidget*); 35 | 36 | Emulator(const Emulator&) = delete; 37 | 38 | Emulator& operator=(const Emulator&) = delete; 39 | 40 | virtual ~Emulator() = default; 41 | 42 | operator GtkEmulator*() const 43 | { 44 | return GTK_EMULATOR(_instance); 45 | } 46 | 47 | void create_emulator(); 48 | 49 | void set_backend(const GemBackend* backend); 50 | 51 | void set_joystick(int id, const std::string& device); 52 | 53 | void add_hotkey_callback(GCallback callback, void* data); 54 | }; 55 | 56 | } 57 | 58 | // --------------------------------------------------------------------------- 59 | // End-Of-File 60 | // --------------------------------------------------------------------------- 61 | 62 | #endif /* __GTK3_CXX_EMULATOR_H__ */ 63 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-frame.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-frame.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-frame.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::FrameTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct FrameTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_frame(const std::string& string = "label") 44 | { 45 | return ::gtk_frame_new(string.c_str()); 46 | } 47 | }; 48 | 49 | } 50 | 51 | // --------------------------------------------------------------------------- 52 | // ::traits 53 | // --------------------------------------------------------------------------- 54 | 55 | namespace { 56 | 57 | using traits = gtk3::FrameTraits; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // gtk3::Frame 63 | // --------------------------------------------------------------------------- 64 | 65 | namespace gtk3 { 66 | 67 | Frame::Frame() 68 | : Frame(traits::create_frame()) 69 | { 70 | } 71 | 72 | Frame::Frame(GtkWidget* instance) 73 | : Bin(instance) 74 | { 75 | } 76 | 77 | void Frame::create_frame(const std::string& string) 78 | { 79 | if(_instance == nullptr) { 80 | _instance = traits::create_frame(string); 81 | traits::register_widget_instance(_instance); 82 | } 83 | } 84 | 85 | } 86 | 87 | // --------------------------------------------------------------------------- 88 | // End-Of-File 89 | // --------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-frame.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_FRAME_H__ 18 | #define __GTK3_CXX_FRAME_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Frame 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Frame 29 | : public Bin 30 | { 31 | public: // public interface 32 | Frame(); 33 | 34 | Frame(GtkWidget*); 35 | 36 | Frame(const Frame&) = delete; 37 | 38 | Frame& operator=(const Frame&) = delete; 39 | 40 | virtual ~Frame() = default; 41 | 42 | operator GtkFrame*() const 43 | { 44 | return GTK_FRAME(_instance); 45 | } 46 | 47 | void create_frame(const std::string& string); 48 | }; 49 | 50 | } 51 | 52 | // --------------------------------------------------------------------------- 53 | // End-Of-File 54 | // --------------------------------------------------------------------------- 55 | 56 | #endif /* __GTK3_CXX_FRAME_H__ */ 57 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-gl-area.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-gl-area.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-gl-area.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::GLAreaTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct GLAreaTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_gl_area() 44 | { 45 | return ::gtk_gl_area_new(); 46 | } 47 | }; 48 | 49 | } 50 | 51 | // --------------------------------------------------------------------------- 52 | // ::traits 53 | // --------------------------------------------------------------------------- 54 | 55 | namespace { 56 | 57 | using traits = gtk3::GLAreaTraits; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // gtk3::GLArea 63 | // --------------------------------------------------------------------------- 64 | 65 | namespace gtk3 { 66 | 67 | GLArea::GLArea() 68 | : GLArea(traits::create_gl_area()) 69 | { 70 | } 71 | 72 | GLArea::GLArea(GtkWidget* instance) 73 | : Widget(instance) 74 | { 75 | } 76 | 77 | void GLArea::create_gl_area() 78 | { 79 | if(_instance == nullptr) { 80 | _instance = traits::create_gl_area(); 81 | traits::register_widget_instance(_instance); 82 | } 83 | } 84 | 85 | void GLArea::add_render_callback(GCallback callback, void* data) 86 | { 87 | return signal_connect(sig_render, callback, data); 88 | } 89 | 90 | void GLArea::add_resize_callback(GCallback callback, void* data) 91 | { 92 | return signal_connect(sig_resize, callback, data); 93 | } 94 | 95 | } 96 | 97 | // --------------------------------------------------------------------------- 98 | // End-Of-File 99 | // --------------------------------------------------------------------------- 100 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-gl-area.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-gl-area.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_GL_AREA_H__ 18 | #define __GTK3_CXX_GL_AREA_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::GLArea 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class GLArea 29 | : public Widget 30 | { 31 | public: // public interface 32 | GLArea(); 33 | 34 | GLArea(GtkWidget*); 35 | 36 | GLArea(const GLArea&) = delete; 37 | 38 | GLArea& operator=(const GLArea&) = delete; 39 | 40 | virtual ~GLArea() = default; 41 | 42 | operator GtkGLArea*() const 43 | { 44 | return GTK_GL_AREA(_instance); 45 | } 46 | 47 | void create_gl_area(); 48 | 49 | void add_render_callback(GCallback callback, void* data); 50 | 51 | void add_resize_callback(GCallback callback, void* data); 52 | }; 53 | 54 | } 55 | 56 | // --------------------------------------------------------------------------- 57 | // End-Of-File 58 | // --------------------------------------------------------------------------- 59 | 60 | #endif /* __GTK3_CXX_GL_AREA_H__ */ 61 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-label.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-label.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_LABEL_H__ 18 | #define __GTK3_CXX_LABEL_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Label 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Label 29 | : public Widget 30 | { 31 | public: // public interface 32 | Label(); 33 | 34 | Label(GtkWidget*); 35 | 36 | Label(const Label&) = delete; 37 | 38 | Label& operator=(const Label&) = delete; 39 | 40 | virtual ~Label() = default; 41 | 42 | operator GtkLabel*() const 43 | { 44 | return GTK_LABEL(_instance); 45 | } 46 | 47 | void create_label(const std::string& string); 48 | 49 | void set_text(const std::string& string); 50 | 51 | void set_markup(const std::string& string); 52 | 53 | void set_ellipsize(PangoEllipsizeMode mode); 54 | }; 55 | 56 | } 57 | 58 | // --------------------------------------------------------------------------- 59 | // End-Of-File 60 | // --------------------------------------------------------------------------- 61 | 62 | #endif /* __GTK3_CXX_LABEL_H__ */ 63 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu-bar.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu-bar.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-menu-bar.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::MenuBarTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct MenuBarTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_menu_bar() 44 | { 45 | return ::gtk_menu_bar_new(); 46 | } 47 | }; 48 | 49 | } 50 | 51 | // --------------------------------------------------------------------------- 52 | // ::traits 53 | // --------------------------------------------------------------------------- 54 | 55 | namespace { 56 | 57 | using traits = gtk3::MenuBarTraits; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // gtk3::MenuBar 63 | // --------------------------------------------------------------------------- 64 | 65 | namespace gtk3 { 66 | 67 | MenuBar::MenuBar() 68 | : MenuBar(traits::create_menu_bar()) 69 | { 70 | } 71 | 72 | MenuBar::MenuBar(GtkWidget* instance) 73 | : MenuShell(instance) 74 | { 75 | } 76 | 77 | void MenuBar::create_menu_bar() 78 | { 79 | if(_instance == nullptr) { 80 | _instance = traits::create_menu_bar(); 81 | traits::register_widget_instance(_instance); 82 | } 83 | } 84 | 85 | } 86 | 87 | // --------------------------------------------------------------------------- 88 | // End-Of-File 89 | // --------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu-bar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu-bar.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_MENU_BAR_H__ 18 | #define __GTK3_CXX_MENU_BAR_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::MenuBar 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class MenuBar 29 | : public MenuShell 30 | { 31 | public: // public interface 32 | MenuBar(); 33 | 34 | MenuBar(GtkWidget*); 35 | 36 | MenuBar(const MenuBar&) = delete; 37 | 38 | MenuBar& operator=(const MenuBar&) = delete; 39 | 40 | virtual ~MenuBar() = default; 41 | 42 | operator GtkMenuBar*() const 43 | { 44 | return GTK_MENU_BAR(_instance); 45 | } 46 | 47 | void create_menu_bar(); 48 | }; 49 | 50 | } 51 | 52 | // --------------------------------------------------------------------------- 53 | // End-Of-File 54 | // --------------------------------------------------------------------------- 55 | 56 | #endif /* __GTK3_CXX_MENU_BAR_H__ */ 57 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu-item.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_MENU_ITEM_H__ 18 | #define __GTK3_CXX_MENU_ITEM_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::MenuItem 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class MenuItem 29 | : public Bin 30 | { 31 | public: // public interface 32 | MenuItem(); 33 | 34 | MenuItem(GtkWidget*); 35 | 36 | MenuItem(const MenuItem&) = delete; 37 | 38 | MenuItem& operator=(const MenuItem&) = delete; 39 | 40 | virtual ~MenuItem() = default; 41 | 42 | operator GtkMenuItem*() const 43 | { 44 | return GTK_MENU_ITEM(_instance); 45 | } 46 | 47 | void create_menu_item(); 48 | 49 | void create_menu_item_with_label(const std::string& label); 50 | 51 | void create_menu_item_with_mnemonic(const std::string& label); 52 | 53 | void set_submenu(Widget&); 54 | 55 | void set_accel(unsigned int accelerator_key, GdkModifierType accelerator_mods); 56 | 57 | void add_activate_callback(GCallback callback, void* data); 58 | 59 | void add_select_callback(GCallback callback, void* data); 60 | 61 | void add_deselect_callback(GCallback callback, void* data); 62 | }; 63 | 64 | } 65 | 66 | // --------------------------------------------------------------------------- 67 | // gtk3::SeparatorMenuItem 68 | // --------------------------------------------------------------------------- 69 | 70 | namespace gtk3 { 71 | 72 | class SeparatorMenuItem 73 | : public MenuItem 74 | { 75 | public: // public interface 76 | SeparatorMenuItem(); 77 | 78 | SeparatorMenuItem(GtkWidget*); 79 | 80 | virtual ~SeparatorMenuItem() = default; 81 | 82 | operator GtkSeparatorMenuItem*() const 83 | { 84 | return GTK_SEPARATOR_MENU_ITEM(_instance); 85 | } 86 | 87 | void create_separator_menu_item(); 88 | }; 89 | 90 | } 91 | 92 | // --------------------------------------------------------------------------- 93 | // End-Of-File 94 | // --------------------------------------------------------------------------- 95 | 96 | #endif /* __GTK3_CXX_MENU_ITEM_H__ */ 97 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu-shell.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu-shell.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-menu-shell.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::MenuShellTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct MenuShellTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_menu_shell() 44 | { 45 | return nullptr; 46 | } 47 | 48 | static void append(MenuShell& menu_shell, Widget& widget) 49 | { 50 | if(menu_shell && widget) { 51 | ::gtk_menu_shell_append(menu_shell, widget); 52 | } 53 | } 54 | }; 55 | 56 | } 57 | 58 | // --------------------------------------------------------------------------- 59 | // ::traits 60 | // --------------------------------------------------------------------------- 61 | 62 | namespace { 63 | 64 | using traits = gtk3::MenuShellTraits; 65 | 66 | } 67 | 68 | // --------------------------------------------------------------------------- 69 | // gtk3::MenuShell 70 | // --------------------------------------------------------------------------- 71 | 72 | namespace gtk3 { 73 | 74 | MenuShell::MenuShell() 75 | : MenuShell(traits::create_menu_shell()) 76 | { 77 | } 78 | 79 | MenuShell::MenuShell(GtkWidget* instance) 80 | : Container(instance) 81 | { 82 | } 83 | 84 | void MenuShell::append(Widget& widget) 85 | { 86 | return traits::append(*this, widget); 87 | } 88 | 89 | } 90 | 91 | // --------------------------------------------------------------------------- 92 | // End-Of-File 93 | // --------------------------------------------------------------------------- 94 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu-shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu-shell.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_MENU_SHELL_H__ 18 | #define __GTK3_CXX_MENU_SHELL_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::MenuShell 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class MenuShell 29 | : public Container 30 | { 31 | public: // public interface 32 | MenuShell(); 33 | 34 | MenuShell(GtkWidget*); 35 | 36 | MenuShell(const MenuShell&) = delete; 37 | 38 | MenuShell& operator=(const MenuShell&) = delete; 39 | 40 | virtual ~MenuShell() = default; 41 | 42 | operator GtkMenuShell*() const 43 | { 44 | return GTK_MENU_SHELL(_instance); 45 | } 46 | 47 | void append(Widget&); 48 | }; 49 | 50 | } 51 | 52 | // --------------------------------------------------------------------------- 53 | // End-Of-File 54 | // --------------------------------------------------------------------------- 55 | 56 | #endif /* __GTK3_CXX_MENU_SHELL_H__ */ 57 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "gtk3-menu.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // gtk3::MenuTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace gtk3 { 39 | 40 | struct MenuTraits 41 | : BasicTraits 42 | { 43 | static GtkWidget* create_menu() 44 | { 45 | return ::gtk_menu_new(); 46 | } 47 | }; 48 | 49 | } 50 | 51 | // --------------------------------------------------------------------------- 52 | // ::traits 53 | // --------------------------------------------------------------------------- 54 | 55 | namespace { 56 | 57 | using traits = gtk3::MenuTraits; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // gtk3::Menu 63 | // --------------------------------------------------------------------------- 64 | 65 | namespace gtk3 { 66 | 67 | Menu::Menu() 68 | : Menu(traits::create_menu()) 69 | { 70 | } 71 | 72 | Menu::Menu(GtkWidget* instance) 73 | : MenuShell(instance) 74 | { 75 | } 76 | 77 | void Menu::create_menu() 78 | { 79 | if(_instance == nullptr) { 80 | _instance = traits::create_menu(); 81 | traits::register_widget_instance(_instance); 82 | } 83 | } 84 | 85 | } 86 | 87 | // --------------------------------------------------------------------------- 88 | // End-Of-File 89 | // --------------------------------------------------------------------------- 90 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-menu.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_MENU_H__ 18 | #define __GTK3_CXX_MENU_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Menu 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Menu 29 | : public MenuShell 30 | { 31 | public: // public interface 32 | Menu(); 33 | 34 | Menu(GtkWidget*); 35 | 36 | Menu(const Menu&) = delete; 37 | 38 | Menu& operator=(const Menu&) = delete; 39 | 40 | virtual ~Menu() = default; 41 | 42 | operator GtkMenu*() const 43 | { 44 | return GTK_MENU(_instance); 45 | } 46 | 47 | void create_menu(); 48 | }; 49 | 50 | } 51 | 52 | // --------------------------------------------------------------------------- 53 | // End-Of-File 54 | // --------------------------------------------------------------------------- 55 | 56 | #endif /* __GTK3_CXX_MENU_H__ */ 57 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-toolbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-toolbar.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_TOOLBAR_H__ 18 | #define __GTK3_CXX_TOOLBAR_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Toolbar 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Toolbar 29 | : public Container 30 | { 31 | public: // public interface 32 | Toolbar(); 33 | 34 | Toolbar(GtkWidget*); 35 | 36 | Toolbar(const Toolbar&) = delete; 37 | 38 | Toolbar& operator=(const Toolbar&) = delete; 39 | 40 | virtual ~Toolbar() = default; 41 | 42 | operator GtkToolbar*() const 43 | { 44 | return GTK_TOOLBAR(_instance); 45 | } 46 | 47 | void create_toolbar(); 48 | 49 | void insert(Widget&, int position); 50 | }; 51 | 52 | } 53 | 54 | // --------------------------------------------------------------------------- 55 | // End-Of-File 56 | // --------------------------------------------------------------------------- 57 | 58 | #endif /* __GTK3_CXX_TOOLBAR_H__ */ 59 | -------------------------------------------------------------------------------- /src/gtk3ui/gtk3-window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtk3-window.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK3_CXX_WINDOW_H__ 18 | #define __GTK3_CXX_WINDOW_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // gtk3::Window 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace gtk3 { 27 | 28 | class Window 29 | : public Bin 30 | { 31 | public: // public interface 32 | Window(); 33 | 34 | Window(GtkWidget*); 35 | 36 | Window(const Window&) = delete; 37 | 38 | Window& operator=(const Window&) = delete; 39 | 40 | virtual ~Window() = default; 41 | 42 | operator GtkWindow*() const 43 | { 44 | return GTK_WINDOW(_instance); 45 | } 46 | 47 | void set_title(const std::string& title); 48 | 49 | void set_icon(GdkPixbuf* icon); 50 | 51 | void set_skip_taskbar_hint(bool taskbar_hint); 52 | }; 53 | 54 | } 55 | 56 | // --------------------------------------------------------------------------- 57 | // gtk3::ToplevelWindow 58 | // --------------------------------------------------------------------------- 59 | 60 | namespace gtk3 { 61 | 62 | class ToplevelWindow 63 | : public Window 64 | { 65 | public: // public interface 66 | ToplevelWindow(); 67 | 68 | ToplevelWindow(GtkWidget*); 69 | 70 | virtual ~ToplevelWindow() = default; 71 | 72 | void create_toplevel_window(); 73 | }; 74 | 75 | } 76 | 77 | // --------------------------------------------------------------------------- 78 | // gtk3::PopupWindow 79 | // --------------------------------------------------------------------------- 80 | 81 | namespace gtk3 { 82 | 83 | class PopupWindow 84 | : public Window 85 | { 86 | public: // public interface 87 | PopupWindow(); 88 | 89 | PopupWindow(GtkWidget*); 90 | 91 | virtual ~PopupWindow() = default; 92 | 93 | void create_popup_window(); 94 | }; 95 | 96 | } 97 | 98 | // --------------------------------------------------------------------------- 99 | // End-Of-File 100 | // --------------------------------------------------------------------------- 101 | 102 | #endif /* __GTK3_CXX_WINDOW_H__ */ 103 | -------------------------------------------------------------------------------- /src/gtk3ui/gtkemulator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtkemulator.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK_EMULATOR_H__ 18 | #define __GTK_EMULATOR_H__ 19 | 20 | #include 21 | 22 | G_BEGIN_DECLS 23 | 24 | #define GTK_TYPE_EMULATOR (gtk_emulator_get_type ()) 25 | #define GTK_EMULATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EMULATOR, GtkEmulator)) 26 | #define GTK_EMULATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_EMULATOR, GtkEmulatorClass)) 27 | #define GTK_IS_EMULATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EMULATOR)) 28 | #define GTK_IS_EMULATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EMULATOR)) 29 | #define GTK_EMULATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_EMULATOR, GtkEmulatorClass)) 30 | 31 | typedef struct _GtkEmulator GtkEmulator; 32 | typedef struct _GtkEmulatorClass GtkEmulatorClass; 33 | 34 | struct _GtkEmulator 35 | { 36 | GtkWidget widget; 37 | GemVideo video; 38 | GemEvents events; 39 | GemKeyboard keyboard; 40 | GemJoystick joystick0; 41 | GemJoystick joystick1; 42 | GemBackend backend; 43 | guint minimum_width; 44 | guint minimum_height; 45 | guint natural_width; 46 | guint natural_height; 47 | guint timer; 48 | }; 49 | 50 | struct _GtkEmulatorClass 51 | { 52 | GtkWidgetClass parent_class; 53 | void (*sig_hotkey)(GtkEmulator*, KeySym keysym); 54 | }; 55 | 56 | extern GType gtk_emulator_get_type (void) G_GNUC_CONST; 57 | extern GtkWidget* gtk_emulator_new (void); 58 | extern void gtk_emulator_set_backend (GtkWidget* widget, const GemBackend* backend); 59 | extern void gtk_emulator_set_joystick (GtkWidget* widget, int id, const char* device); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __GTK_EMULATOR_H__ */ 64 | -------------------------------------------------------------------------------- /src/gtk3ui/gtkemulatorprivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gtkemulatorprivate.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __GTK_EMULATOR_PRIVATE_H__ 18 | #define __GTK_EMULATOR_PRIVATE_H__ 19 | 20 | #include 21 | 22 | G_BEGIN_DECLS 23 | 24 | #ifndef countof 25 | #define countof(array) (sizeof(array) / sizeof(array[0])) 26 | #endif 27 | 28 | #ifndef CAST_WIDGET 29 | #define CAST_WIDGET(widget) ((GtkWidget*)(widget)) 30 | #endif 31 | 32 | #ifndef CAST_EMULATOR 33 | #define CAST_EMULATOR(widget) ((GtkEmulator*)(widget)) 34 | #endif 35 | 36 | #ifndef CAST_XEVENT 37 | #define CAST_XEVENT(event) ((XEvent*)(event)) 38 | #endif 39 | 40 | #ifndef EMULATOR_DEFAULT_TIMEOUT 41 | #define EMULATOR_DEFAULT_TIMEOUT 100UL 42 | #endif 43 | 44 | #ifndef EMULATOR_DEFAULT_WIDTH 45 | #define EMULATOR_DEFAULT_WIDTH 768 46 | #endif 47 | 48 | #ifndef EMULATOR_DEFAULT_HEIGHT 49 | #define EMULATOR_DEFAULT_HEIGHT 576 50 | #endif 51 | 52 | #ifndef EMULATOR_MIN_WIDTH 53 | #define EMULATOR_MIN_WIDTH 320 54 | #endif 55 | 56 | #ifndef EMULATOR_MIN_HEIGHT 57 | #define EMULATOR_MIN_HEIGHT 200 58 | #endif 59 | 60 | #ifndef KEY_DELAY_THRESHOLD 61 | #define KEY_DELAY_THRESHOLD 20 62 | #endif 63 | 64 | #ifndef KEY_REPEAT_THRESHOLD 65 | #define KEY_REPEAT_THRESHOLD 100 66 | #endif 67 | 68 | #ifndef JS_EVENT_BUTTON 69 | #define JS_EVENT_BUTTON 0x01 70 | #endif 71 | 72 | #ifndef JS_EVENT_AXIS 73 | #define JS_EVENT_AXIS 0x02 74 | #endif 75 | 76 | #ifndef JS_EVENT_INIT 77 | #define JS_EVENT_INIT 0x80 78 | #endif 79 | 80 | G_END_DECLS 81 | 82 | #endif /* __GTK_EMULATOR_PRIVATE_H__ */ 83 | -------------------------------------------------------------------------------- /src/gtk3ui/xcpc-about-dialog.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-about-dialog.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include "xcpc-about-dialog.h" 36 | 37 | // --------------------------------------------------------------------------- 38 | // ::traits 39 | // --------------------------------------------------------------------------- 40 | 41 | namespace { 42 | 43 | struct traits 44 | { 45 | static void run_dialog(gtk3::Dialog& dialog) 46 | { 47 | switch(dialog.run()) { 48 | default: 49 | break; 50 | } 51 | } 52 | }; 53 | 54 | } 55 | 56 | // --------------------------------------------------------------------------- 57 | // xcpc::AboutDialog 58 | // --------------------------------------------------------------------------- 59 | 60 | namespace xcpc { 61 | 62 | AboutDialog::AboutDialog(Application& application) 63 | : base::AboutDialog(application) 64 | { 65 | } 66 | 67 | void AboutDialog::run() 68 | { 69 | auto run_dialog = [&](gtk3::AboutDialog& dialog) -> void 70 | { 71 | dialog.set_logo(dynamic_cast(_application).app_icon()); 72 | dialog.set_program_name(_("Xcpc")); 73 | dialog.set_version(xcpc::Utils::get_version()); 74 | dialog.set_copyright(xcpc::Utils::get_copyright()); 75 | dialog.set_comments(xcpc::Utils::get_comments()); 76 | dialog.set_website(xcpc::Utils::get_website()); 77 | dialog.set_license(xcpc::Utils::get_license()); 78 | dialog.set_title(_title); 79 | dialog.set_skip_taskbar_hint(true); 80 | 81 | return traits::run_dialog(dialog); 82 | }; 83 | 84 | auto execute = [&]() -> void 85 | { 86 | gtk3::AboutDialog dialog; 87 | 88 | return run_dialog(dialog); 89 | }; 90 | 91 | return execute(); 92 | } 93 | 94 | } 95 | 96 | // --------------------------------------------------------------------------- 97 | // End-Of-File 98 | // --------------------------------------------------------------------------- 99 | -------------------------------------------------------------------------------- /src/gtk3ui/xcpc-about-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-about-dialog.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_GTK3UI_ABOUT_DIALOG_H__ 18 | #define __XCPC_GTK3UI_ABOUT_DIALOG_H__ 19 | 20 | #include "xcpc-application.h" 21 | 22 | // --------------------------------------------------------------------------- 23 | // xcpc::AboutDialog 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace xcpc { 27 | 28 | class AboutDialog final 29 | : public base::AboutDialog 30 | { 31 | public: // public interface 32 | AboutDialog(Application&); 33 | 34 | virtual ~AboutDialog() = default; 35 | 36 | virtual void run() override; 37 | }; 38 | 39 | } 40 | 41 | // --------------------------------------------------------------------------- 42 | // End-Of-File 43 | // --------------------------------------------------------------------------- 44 | 45 | #endif /* __XCPC_GTK3UI_ABOUT_DIALOG_H__ */ 46 | -------------------------------------------------------------------------------- /src/gtk3ui/xcpc-disk-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-disk-dialog.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_GTK3UI_DISK_DIALOG_H__ 18 | #define __XCPC_GTK3UI_DISK_DIALOG_H__ 19 | 20 | #include "xcpc-application.h" 21 | 22 | // --------------------------------------------------------------------------- 23 | // xcpc::CreateDiskDialog 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace xcpc { 27 | 28 | class CreateDiskDialog final 29 | : public base::CreateDiskDialog 30 | { 31 | public: // public interface 32 | CreateDiskDialog(Application&, const char drive); 33 | 34 | virtual ~CreateDiskDialog() = default; 35 | 36 | virtual void run() override; 37 | }; 38 | 39 | } 40 | 41 | // --------------------------------------------------------------------------- 42 | // xcpc::InsertDiskDialog 43 | // --------------------------------------------------------------------------- 44 | 45 | namespace xcpc { 46 | 47 | class InsertDiskDialog final 48 | : public base::InsertDiskDialog 49 | { 50 | public: // public interface 51 | InsertDiskDialog(Application&, const char drive); 52 | 53 | virtual ~InsertDiskDialog() = default; 54 | 55 | virtual void run() override; 56 | }; 57 | 58 | } 59 | 60 | // --------------------------------------------------------------------------- 61 | // xcpc::RemoveDiskDialog 62 | // --------------------------------------------------------------------------- 63 | 64 | namespace xcpc { 65 | 66 | class RemoveDiskDialog final 67 | : public base::RemoveDiskDialog 68 | { 69 | public: // public interface 70 | RemoveDiskDialog(Application&, const char drive); 71 | 72 | virtual ~RemoveDiskDialog() = default; 73 | 74 | virtual void run() override; 75 | }; 76 | 77 | } 78 | 79 | // --------------------------------------------------------------------------- 80 | // End-Of-File 81 | // --------------------------------------------------------------------------- 82 | 83 | #endif /* __XCPC_GTK3UI_DISK_DIALOG_H__ */ 84 | -------------------------------------------------------------------------------- /src/gtk3ui/xcpc-help-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-help-dialog.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_GTK3UI_HELP_DIALOG_H__ 18 | #define __XCPC_GTK3UI_HELP_DIALOG_H__ 19 | 20 | #include "xcpc-application.h" 21 | 22 | // --------------------------------------------------------------------------- 23 | // xcpc::HelpDialog 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace xcpc { 27 | 28 | class HelpDialog final 29 | : public base::HelpDialog 30 | { 31 | public: // public interface 32 | HelpDialog(Application&); 33 | 34 | virtual ~HelpDialog() = default; 35 | 36 | virtual void run() override; 37 | }; 38 | 39 | } 40 | 41 | // --------------------------------------------------------------------------- 42 | // End-Of-File 43 | // --------------------------------------------------------------------------- 44 | 45 | #endif /* __XCPC_GTK3UI_HELP_DIALOG_H__ */ 46 | -------------------------------------------------------------------------------- /src/gtk3ui/xcpc-snapshot-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-snapshot-dialog.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_GTK3UI_SNAPSHOT_DIALOG_H__ 18 | #define __XCPC_GTK3UI_SNAPSHOT_DIALOG_H__ 19 | 20 | #include "xcpc-application.h" 21 | 22 | // --------------------------------------------------------------------------- 23 | // xcpc::LoadSnapshotDialog 24 | // --------------------------------------------------------------------------- 25 | 26 | namespace xcpc { 27 | 28 | class LoadSnapshotDialog final 29 | : public base::LoadSnapshotDialog 30 | { 31 | public: // public interface 32 | LoadSnapshotDialog(Application&); 33 | 34 | virtual ~LoadSnapshotDialog() = default; 35 | 36 | virtual void run() override; 37 | }; 38 | 39 | } 40 | 41 | // --------------------------------------------------------------------------- 42 | // xcpc::SaveSnapshotDialog 43 | // --------------------------------------------------------------------------- 44 | 45 | namespace xcpc { 46 | 47 | class SaveSnapshotDialog final 48 | : public base::SaveSnapshotDialog 49 | { 50 | public: // public interface 51 | SaveSnapshotDialog(Application&); 52 | 53 | virtual ~SaveSnapshotDialog() = default; 54 | 55 | virtual void run() override; 56 | }; 57 | 58 | } 59 | 60 | // --------------------------------------------------------------------------- 61 | // End-Of-File 62 | // --------------------------------------------------------------------------- 63 | 64 | #endif /* __XCPC_GTK3UI_SNAPSHOT_DIALOG_H__ */ 65 | -------------------------------------------------------------------------------- /src/gtk4ui/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | # ---------------------------------------------------------------------------- 19 | # AUTOMAKE_OPTIONS 20 | # ---------------------------------------------------------------------------- 21 | 22 | AUTOMAKE_OPTIONS = \ 23 | subdir-objects \ 24 | $(NULL) 25 | 26 | # ---------------------------------------------------------------------------- 27 | # noinst_LTLIBRARIES 28 | # ---------------------------------------------------------------------------- 29 | 30 | noinst_LTLIBRARIES = \ 31 | libxcpcgtk4ui.la \ 32 | $(NULL) 33 | 34 | # ---------------------------------------------------------------------------- 35 | # libxcpcgtk4ui 36 | # ---------------------------------------------------------------------------- 37 | 38 | libxcpcgtk4ui_la_SOURCES = \ 39 | xcpc-main.cc \ 40 | xcpc-main.h \ 41 | $(NULL) 42 | 43 | libxcpcgtk4ui_la_CPPFLAGS = \ 44 | -I$(top_srcdir)/lib \ 45 | -I$(top_srcdir)/src \ 46 | $(NULL) 47 | 48 | libxcpcgtk4ui_la_LDFLAGS = \ 49 | -L$(top_builddir)/lib \ 50 | -L$(top_builddir)/src \ 51 | $(NULL) 52 | 53 | libxcpcgtk4ui_la_LIBADD = \ 54 | $(NULL) 55 | 56 | # ---------------------------------------------------------------------------- 57 | # xcpc flags/libraries 58 | # ---------------------------------------------------------------------------- 59 | 60 | if TRUE 61 | libxcpcgtk4ui_la_LIBADD += $(top_builddir)/lib/xcpc/libxcpc.la 62 | endif 63 | 64 | # ---------------------------------------------------------------------------- 65 | # gtk4 flags/libraries 66 | # ---------------------------------------------------------------------------- 67 | 68 | if TRUE 69 | libxcpcgtk4ui_la_CPPFLAGS += $(gtk4_CFLAGS) 70 | libxcpcgtk4ui_la_LDFLAGS += $(gtk4_LDFLAGS) 71 | libxcpcgtk4ui_la_LIBADD += $(gtk4_LIBS) 72 | endif 73 | 74 | # ---------------------------------------------------------------------------- 75 | # End-Of-File 76 | # ---------------------------------------------------------------------------- 77 | -------------------------------------------------------------------------------- /src/gtk4ui/xcpc-main.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-main.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "xcpc-main.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // xcpc_main 36 | // --------------------------------------------------------------------------- 37 | 38 | int xcpc_main(int* argc, char*** argv) 39 | { 40 | return EXIT_SUCCESS; 41 | } 42 | 43 | // --------------------------------------------------------------------------- 44 | // End-Of-File 45 | // --------------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /src/gtk4ui/xcpc-main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xcpc-main.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __XCPC_GTK4UI_MAIN_H__ 18 | #define __XCPC_GTK4UI_MAIN_H__ 19 | 20 | #include 21 | 22 | // --------------------------------------------------------------------------- 23 | // xcpc_main 24 | // --------------------------------------------------------------------------- 25 | 26 | // --------------------------------------------------------------------------- 27 | // End-Of-File 28 | // --------------------------------------------------------------------------- 29 | 30 | #endif /* __XCPC_GTK4UI_MAIN_H__ */ 31 | -------------------------------------------------------------------------------- /src/utils/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am - Copyright (c) 2001-2025 - Olivier Poncet 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see 16 | # 17 | 18 | noinst_PROGRAMS = \ 19 | xcpc-dsk \ 20 | $(NULL) 21 | 22 | # ---------------------------------------------------------------------------- 23 | # xcpc-dsk 24 | # ---------------------------------------------------------------------------- 25 | 26 | xcpc_dsk_SOURCES = \ 27 | arglist.cc \ 28 | arglist.h \ 29 | console.cc \ 30 | console.h \ 31 | program.cc \ 32 | program.h \ 33 | xcpc-dsk.cc \ 34 | xcpc-dsk.h \ 35 | $(NULL) 36 | 37 | xcpc_dsk_CPPFLAGS = \ 38 | -I$(top_srcdir)/lib \ 39 | $(NULL) 40 | 41 | xcpc_dsk_LDFLAGS = \ 42 | -L$(top_builddir)/lib \ 43 | $(NULL) 44 | 45 | xcpc_dsk_LDADD = \ 46 | $(top_builddir)/lib/xcpc/libxcpc.la \ 47 | $(NULL) 48 | 49 | # ---------------------------------------------------------------------------- 50 | # End-Of-File 51 | # ---------------------------------------------------------------------------- 52 | -------------------------------------------------------------------------------- /src/utils/arglist.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * arglist.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "arglist.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // base::ArgList 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace base { 39 | 40 | ArgList::ArgList() 41 | : _arglist() 42 | { 43 | } 44 | 45 | ArgList::ArgList(int argc, char* argv[]) 46 | : _arglist(argv, argv + argc) 47 | { 48 | } 49 | 50 | } 51 | 52 | // --------------------------------------------------------------------------- 53 | // End-Of-File 54 | // --------------------------------------------------------------------------- 55 | -------------------------------------------------------------------------------- /src/utils/arglist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * arglist.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __BASE_ARGLIST_H__ 18 | #define __BASE_ARGLIST_H__ 19 | 20 | // --------------------------------------------------------------------------- 21 | // base::ArgList 22 | // --------------------------------------------------------------------------- 23 | 24 | namespace base { 25 | 26 | class ArgList 27 | { 28 | public: // public interface 29 | ArgList(); 30 | 31 | ArgList(int argc, char* argv[]); 32 | 33 | virtual ~ArgList() = default; 34 | 35 | auto args() const -> const std::vector& 36 | { 37 | return _arglist; 38 | } 39 | 40 | auto add(const std::string& arg) -> void 41 | { 42 | return _arglist.push_back(arg); 43 | } 44 | 45 | auto begin() const -> auto 46 | { 47 | return _arglist.begin(); 48 | } 49 | 50 | auto end() const -> auto 51 | { 52 | return _arglist.end(); 53 | } 54 | 55 | protected: // protected data 56 | std::vector _arglist; 57 | }; 58 | 59 | } 60 | 61 | // --------------------------------------------------------------------------- 62 | // End-Of-File 63 | // --------------------------------------------------------------------------- 64 | 65 | #endif /* __BASE_ARGLIST_H__ */ 66 | -------------------------------------------------------------------------------- /src/utils/console.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * console.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "console.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // ::ConsoleTraits 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace { 39 | 40 | struct ConsoleTraits 41 | { 42 | static void println(std::ostream& stream, const char* format, va_list arguments) 43 | { 44 | if(stream.good()) { 45 | char* message = nullptr; 46 | const int rc = ::vasprintf(&message, format, arguments); 47 | if((rc != -1) && (message != nullptr)) { 48 | stream << message << std::endl; 49 | message = (::free(message), nullptr); 50 | } 51 | } 52 | } 53 | }; 54 | 55 | } 56 | 57 | // --------------------------------------------------------------------------- 58 | // base::Console 59 | // --------------------------------------------------------------------------- 60 | 61 | namespace base { 62 | 63 | Console::Console ( std::istream& istream 64 | , std::ostream& ostream 65 | , std::ostream& estream ) 66 | : _istream(istream) 67 | , _ostream(ostream) 68 | , _estream(estream) 69 | { 70 | } 71 | 72 | void Console::println(const char* format, ...) 73 | { 74 | va_list arguments; 75 | va_start(arguments, format); 76 | ConsoleTraits::println(_ostream, format, arguments); 77 | va_end(arguments); 78 | } 79 | 80 | void Console::errorln(const char* format, ...) 81 | { 82 | va_list arguments; 83 | va_start(arguments, format); 84 | ConsoleTraits::println(_estream, format, arguments); 85 | va_end(arguments); 86 | } 87 | 88 | } 89 | 90 | // --------------------------------------------------------------------------- 91 | // End-Of-File 92 | // --------------------------------------------------------------------------- 93 | -------------------------------------------------------------------------------- /src/utils/console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * console.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __BASE_CONSOLE_H__ 18 | #define __BASE_CONSOLE_H__ 19 | 20 | // --------------------------------------------------------------------------- 21 | // base::Console 22 | // --------------------------------------------------------------------------- 23 | 24 | namespace base { 25 | 26 | class Console 27 | { 28 | public: // public interface 29 | Console ( std::istream& istream 30 | , std::ostream& ostream 31 | , std::ostream& estream ); 32 | 33 | virtual ~Console() = default; 34 | 35 | virtual void println(const char*, ...); 36 | 37 | virtual void errorln(const char*, ...); 38 | 39 | protected: // protected data 40 | std::istream& _istream; 41 | std::ostream& _ostream; 42 | std::ostream& _estream; 43 | }; 44 | 45 | } 46 | 47 | // --------------------------------------------------------------------------- 48 | // End-Of-File 49 | // --------------------------------------------------------------------------- 50 | 51 | #endif /* __BASE_CONSOLE_H__ */ 52 | -------------------------------------------------------------------------------- /src/utils/program.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * program.cc - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifdef HAVE_CONFIG_H 18 | #include "config.h" 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include "program.h" 33 | 34 | // --------------------------------------------------------------------------- 35 | // base::Program 36 | // --------------------------------------------------------------------------- 37 | 38 | namespace base { 39 | 40 | Program::Program(ArgList& arglist, Console& console) 41 | : _arglist(arglist) 42 | , _console(console) 43 | { 44 | } 45 | 46 | } 47 | 48 | // --------------------------------------------------------------------------- 49 | // End-Of-File 50 | // --------------------------------------------------------------------------- 51 | -------------------------------------------------------------------------------- /src/utils/program.h: -------------------------------------------------------------------------------- 1 | /* 2 | * program.h - Copyright (c) 2001-2025 - Olivier Poncet 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __BASE_PROGRAM_H__ 18 | #define __BASE_PROGRAM_H__ 19 | 20 | #include "arglist.h" 21 | #include "console.h" 22 | 23 | // --------------------------------------------------------------------------- 24 | // base::Program 25 | // --------------------------------------------------------------------------- 26 | 27 | namespace base { 28 | 29 | class Program 30 | { 31 | public: // public interface 32 | Program(ArgList& arglist, Console& console); 33 | 34 | virtual ~Program() = default; 35 | 36 | virtual void main() = 0; 37 | 38 | protected: // protected data 39 | ArgList& _arglist; 40 | Console& _console; 41 | }; 42 | 43 | } 44 | 45 | // --------------------------------------------------------------------------- 46 | // End-Of-File 47 | // --------------------------------------------------------------------------- 48 | 49 | #endif /* __BASE_PROGRAM_H__ */ 50 | --------------------------------------------------------------------------------