Compare commits

..

491 Commits

Author SHA1 Message Date
Rafael Kitover bd20c79013
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-07 10:00:21 +00:00
Andy Vandijck 203be42665 Fix typo 2025-08-07 11:45:40 +02:00
Andy Vandijck d75072009b Set params when no image is loaded 2025-08-07 11:39:59 +02:00
Andy Vandijck 0e32b90002 Fix LCD color filter 2025-08-07 10:45:11 +02:00
Rafael Kitover 2640716496
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-07 07:00:20 +00:00
Rafael Kitover b065db66d9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-06 10:00:20 +00:00
Rafael Kitover 4d837fd739
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-05 21:00:19 +00:00
Rafael Kitover 1ef356c6f0
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-05 08:00:23 +00:00
Rafael Kitover a8c82bb4a1
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-05 08:00:07 +00:00
Rafael Kitover 1778d605f4
Add config for color correction
Add display config dialog and config file options for GBA and GBC color
correction.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-05 07:29:50 +00:00
Rafael Kitover d6d2a83e7e
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-04 15:00:19 +00:00
Rafael Kitover 881667a5f8
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-04 13:00:24 +00:00
Rafael Kitover b332aa693d
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-04 13:00:07 +00:00
Rafael Kitover 7f7035a07b
translations: finish removing German
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-04 12:01:47 +00:00
Rafael Kitover 3e355509e9
build: restore FindFFmpeg.cmake
Restore `FindFFmpeg.cmake`, because FFmpeg does not come with CMake
import modules.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-04 11:56:18 +00:00
Rafael Kitover e68681ffda
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-03 15:00:19 +00:00
Andy Vandijck f83aa940d7 Fix GB reset
Fix GB reset
2025-08-03 13:27:26 +02:00
Andy Vandijck a18559678c Fix MS compile
Fix MS compile
2025-08-03 13:09:59 +02:00
Andy Vandijck d927594af2 Fix MS compile
Fix MS compile
2025-08-03 13:06:32 +02:00
Andy Vandijck 06507775e8 Replace nullptr with NULL
Replace nullptr with NULL
2025-08-03 11:52:14 +02:00
Andy Vandijck b08ecd123d Fix libretro 24 bit color
Fix libretro 24 bit color
2025-08-03 10:44:43 +02:00
Andy Vandijck d154a6abc8 Add games app category for macOS (optimisations)
Add games app category for macOS (optimisations)
2025-08-03 10:33:47 +02:00
Andy Vandijck b134bacc45 Fix SDL audio on Windows
Fix SDL audio on Windows
2025-08-03 10:08:27 +02:00
Andy Vandijck 9ae1473f36 Fix 8 bit PNG recording
Fix 8 bit PNG recording
2025-08-02 11:27:21 +02:00
Andy Vandijck 9cd0c5c04c Fix 8 bit video recording
Fix 8 bit video recording
2025-08-02 11:10:00 +02:00
Andy Vandijck 9e41c5476a Fix 8 bit color
Fix 8 bit color
2025-08-02 10:20:05 +02:00
Andy Vandijck e91171459d Fix policy in newer CMake 2025-08-02 09:49:22 +02:00
Andy Vandijck 16f008b448 Fix macOS build
Fix macOS build
2025-08-02 09:38:42 +02:00
Rafael Kitover bad10342bd
build: use pkg-config on UNIX for SDL3
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-02 06:20:37 +00:00
Squall Leonhart 06b3cb094e
Merge pull request #1484 from Squall-Leonhart/Correct24bit
24bit was prone to corrupting g_pix on all renderers
2025-08-02 07:50:07 +10:00
Squall-Leonhart 82617ea75d correct memory alignment 2025-08-02 07:48:03 +10:00
Andy Vandijck 0561ef91a4 Fix CoreAudio stall
Fix CoreAudio stall
2025-08-01 09:48:58 +02:00
Rafael Kitover afc6a1cc3a
build: fix build, de translation removed
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-01 04:40:38 +00:00
Rafael Kitover 35df9d7647
translations: remove German, not German
Remove the `de` translation as it does not contain a German translation.
Also deleted from Transifex.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-01 03:10:01 +00:00
Rafael Kitover 031ae2ebf6 build: fix CMake slowness
Optimize the `find_wx_util` function to try the major and minor version
parsed from the lib file first, avoiding a very slow exhaustive search
of possible version numbers.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-08-01 03:05:55 +00:00
Squall Leonhart 6242679e23
initialise stereo_buffer to 0 to prevent a race condition 2025-08-01 12:12:44 +10:00
Rafael Kitover 537393a0ab
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-31 16:00:20 +00:00
Rafael Kitover 616f7abc4e
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-31 13:00:21 +00:00
Rafael Kitover f1414000e6
doc: fix release commit instructions
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 11:49:27 +00:00
Rafael Kitover e2a235768e
release v2.2.2
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 11:46:32 +00:00
Rafael Kitover 1d54ee2135
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 07:00:21 +00:00
Rafael Kitover 013a9b87ac
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 03:00:20 +00:00
Rafael Kitover a06d3ed1b4
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 01:00:22 +00:00
Rafael Kitover b1bad9d53d
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 01:00:06 +00:00
Rafael Kitover d2eed85c28 Move Languages menu to the top level
Move the new Languages menu to the top level after Help to make it
easier to find.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-30 00:09:05 +00:00
Rafael Kitover d5a37e06aa
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-29 10:00:20 +00:00
Rafael Kitover cea049161d
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-29 05:00:20 +00:00
Rafael Kitover 3eadc6e78f
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 16:00:19 +00:00
Rafael Kitover 4f3ed0dc8b
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 15:00:23 +00:00
Rafael Kitover d38e1d0f89
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 15:00:06 +00:00
Andy Vandijck f870bf252d Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-28 16:46:15 +02:00
Andy Vandijck 536ea705ab Add option for external translations (windows) and fix retain of language selection
Add option for external translations (windows) and fix retain of language selection
2025-07-28 16:46:12 +02:00
Rafael Kitover 802162ad97
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 14:00:26 +00:00
Rafael Kitover 25895e8636
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 12:00:24 +00:00
Rafael Kitover 27e7aa6864
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 12:00:07 +00:00
Andy Vandijck dd7461103b Fix resource load for catalogs for Windows
Fix resource load for catalogs for Windows
2025-07-28 13:54:30 +02:00
Andy Vandijck c892c269fa Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-28 13:14:10 +02:00
Andy Vandijck dcf87c0a71 Implement refresh of GUI on language load
Implement refresh of GUI on language load
2025-07-28 13:13:57 +02:00
Rafael Kitover 6d1e7e8069
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 09:00:20 +00:00
Rafael Kitover b8868fce37
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-28 08:00:18 +00:00
Rafael Kitover d92c4e465f
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-27 16:00:20 +00:00
Andy Vandijck bceb138961 Fix SDL crash on Windows
Fix SDL crash on Windows
2025-07-27 14:48:38 +02:00
Rafael Kitover 83aa80440e
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-27 12:00:25 +00:00
Rafael Kitover 4bd54ba128
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-27 12:00:07 +00:00
Andy Vandijck 27acf80b80 Make language configurable (requires restart)
Make language configurable (requires restart)
2025-07-27 13:27:09 +02:00
Andy Vandijck ae09ab7189 Embed translations for Windows
Embed translations for Windows
2025-07-26 15:19:45 +02:00
Andy Vandijck ce8de563e3 Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-26 12:28:50 +02:00
Andy Vandijck 47a8e7e8ed Update wxWidgets for Mac builder to 3.3.1
Update wxWidgets for Mac builder to 3.3.1
2025-07-26 12:28:47 +02:00
Rafael Kitover adbaeacf20
build: use OpenSSL for FFmpeg for Mac builder
Link FFmpeg to OpenSSL for the Mac builder for the TLS functionality it
needs.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-25 11:53:22 -07:00
Rafael Kitover 8d8ecd8dfa
build: remove glib from Mac builder
Remove glib from the Mac builder, it is not a dependency of anything on
Mac.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-25 01:55:50 -07:00
Andy Vandijck cfbfc9ecb0 Fix glib build
Fix glib build
2025-07-25 10:35:42 +02:00
Andy Vandijck 4445a20d9c Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-25 10:06:24 +02:00
Andy Vandijck b83a7c8aa2 Add Wii U ARM instruction to the instruction table
Add Wii U ARM instruction to the instruction table
2025-07-25 10:06:21 +02:00
Rafael Kitover 66aabab61f
build: yet another Mac builder fix
Remove header paths from flags, keep frameworks path.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-24 20:46:37 -07:00
Rafael Kitover a5e6b57fd8
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-24 16:00:21 +00:00
Rafael Kitover b9061ddafd
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-24 15:00:22 +00:00
Rafael Kitover 3c291ef3ac
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-24 14:00:21 +00:00
Andy Vandijck e44c83e1d0 log Wii U VC opcodes and address
log Wii U VC opcodes and address
2025-07-24 13:09:42 +02:00
Andy Vandijck 8ce4848dd6 Fix Wii U VC opcodes
Fix Wii U VC opcodes
2025-07-24 13:06:09 +02:00
Andy Vandijck 34cba3bb2c Fix build for macOS
Fix build for macOS
2025-07-24 12:00:45 +02:00
Andy Vandijck 9b78b26010 Fix dependency build
Fix dependency build
2025-07-24 11:26:46 +02:00
Andy Vandijck 94f9df4baa Fix build for macOS
Fix build for macOS
2025-07-24 11:12:56 +02:00
Rafael Kitover c726989d67
build: improve Metal toolchain detection on Mac
Use `xcrun -f metal` to set the path to the Metal compiler, falling back
to the `CheckLanguage` CMake module if that fails.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-23 17:29:58 -07:00
Rafael Kitover 3344e7cf71
build: add path to Metal compiler for Mac
Try to add the path to the Metal compiler on Mac to `CMAKE_PROGRAM_PATH`
to help it find the Metal compiler.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-23 13:12:51 -07:00
Rafael Kitover 3d69bde8cb
build: fix adding/removing Mac SDK paths in flags
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-23 13:04:48 -07:00
Andy Vandijck 09984eed2f Fix path for metal
Fix path for metal
2025-07-23 21:42:25 +02:00
Andy Vandijck 69809ff556 Fix compile of flac
Fix compile of flac
2025-07-23 21:05:10 +02:00
Andy Vandijck 80dec6a38d Fix glib macOS frameworks
Fix glib macOS frameworks
2025-07-23 20:39:54 +02:00
Andy Vandijck ea7b9e5049 Fix glib build
Fix glib build
2025-07-23 20:29:56 +02:00
Andy Vandijck 18701fc0a4 Fix glib patch
Fix glib patch
2025-07-23 20:10:54 +02:00
Andy Vandijck 6b596c7ad7 Fix patch for glib 2025-07-23 20:06:36 +02:00
Andy Vandijck 3c01643112 Fix glib build
Fix glib build
2025-07-23 20:00:54 +02:00
Rafael Kitover 0895c7a52e
build: fix Intel zip name building on Mac ARM64
Try to set the architecture correctly when compiling for Intel on ARM64
Macs, this also sets the zip name correctly for our releases.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-23 09:21:53 -07:00
Andy Vandijck 1e52787078 Fix build on macOS
Fix build on macOS
2025-07-23 18:05:07 +02:00
Andy Vandijck fc0e63d554 Fix libicu build
Fix libicu build
2025-07-23 17:32:35 +02:00
Andy Vandijck 9b573f4465 Update 7z to 2500 and fix 7zip build
Update 7z to 2500 and fix 7zip build
2025-07-23 16:14:51 +02:00
Rafael Kitover 51ae605850
build: fix -intel build for Mac builder
Make some adjustments to the Mac builder for the Intel build to build
with `-intel`.

Remove unzip and zip and replace with 7zip.

Remove `-mtune=generic` from the base flags.

Remove flex and swig and use them from brew.

Add giflib, needed by libwebp.

Add the `no_autotools_cross_options` and
`remove_arch_flags_from_build_ninja` dist flags.

Set intel macOS target to 10.10 when on an ARM64 host.

Add a patch for glib to build with an older macOS.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-23 06:31:36 -07:00
Andy Vandijck ac4b39b6d8 Fix save/load state for matrixed ROMs
Fix save/load state for matrixed ROMs
2025-07-23 10:40:39 +02:00
Andy Vandijck 97ca69d050 Fix build
Fix build
2025-07-23 10:09:28 +02:00
Andy Vandijck b1bcaed3a2 Remap matrix on load
Remap matrix on load
2025-07-23 10:07:32 +02:00
Andy Vandijck 2a1b41040d Fix matrix save state data and fix libretro 64MB ROM
Fix matrix save state data and fix libretro 64MB ROM
2025-07-23 09:57:46 +02:00
Andy Vandijck 930d0e282c A few extra fixes 2025-07-22 19:09:10 +02:00
Andy Vandijck df23826721 Fix g_rom2 free
Fix g_rom2 free
2025-07-22 19:01:23 +02:00
Andy Vandijck de46284747 Implement 64MB ROM files and fix ROM load
Implement 64MB ROM files and fix ROM load
2025-07-22 18:57:17 +02:00
Andy Vandijck 715f685447 Fix multi cart
Fix multi cart
2025-07-21 13:21:23 +02:00
Andy Vandijck eabf319c9a Fix ROM load
Fix ROM load
2025-07-21 12:51:08 +02:00
Rafael Kitover c98263603d
build: fix Mac build
Followup on 9d46f8e6 (build: fix Mac builder regression, 2025-07-20) to
add this `DIST_FLAGS` flag for bison as well, because it also uses this
header file.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-20 18:41:14 +00:00
Rafael Kitover 9d46f8e6d1
build: fix Mac builder regression
Fix the Mac build, broken by 8c3d0f09 (build: fix regression in Mac
builder, 2025-07-19) due to the SDK paths conflicting with a gettext
header.

Fix this regression by introducing the `DIST_FLAGS` feature with a
`no_sdk_paths_in_flags` flag that `build_dist()` treats specially to
remove the include and lib SDK paths from `CPPFLAGS` and `LDFLAGS`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-20 16:14:00 +00:00
Andy Vandijck dab91fc8ca Fix bigger than 32MB ROM files
Fix bigger than 32MB ROM files
2025-07-20 15:44:39 +02:00
Andy Vandijck d672d425be Get BZ2 uncompressed size
Get BZ2 uncompressed size
2025-07-20 14:45:01 +02:00
Andy Vandijck 53d60b726d Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-20 12:58:27 +02:00
Andy Vandijck b6ce89bff8 Fix BZ2 max cart size
Fix BZ2 max cart size
2025-07-20 12:58:24 +02:00
Rafael Kitover 8c3d0f0984
build: fix regression in Mac builder
Fix the Mac builder, broken by 3d4c03d0 (build: fix Mac M1 build on my
Mini, 2025-07-19). Remove `-lintl -liconv` from `LDFLAGS` because they
are not available before they are built.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-19 17:23:18 +00:00
Rafael Kitover 3d4c03d0e6
build: fix Mac M1 build on my Mini
Fix the Mac builder on my M1 Mini.

Update glib and get it building.

Add command line tools include and lib directories to flags.

Add a necessary clang flag to fix vbam build with CoreAudio.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-19 17:16:20 +00:00
Rafael Kitover 92230e0003
release v2.2.1
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-19 10:23:56 +00:00
Rafael Kitover 88d58db0e9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-19 02:00:23 +00:00
Rafael Kitover 4d4c06b26b
build: fix bundled SFML includes for Win32
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-18 18:32:42 +00:00
Rafael Kitover 23a3d0b20f
build: fix include paths for bundled SFML
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-18 01:30:16 +00:00
Rafael Kitover 53f5ec7b7d
build: fix building with OpenAL enabled
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-16 16:26:38 +00:00
Rafael Kitover 61f93348ca
build: make bundled SFML includes SYSTEM BEFORE
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-16 16:14:34 +00:00
Andy Vandijck 9a78ecbab3
src/wx/widgets/wxmisc.cpp from Squall-Leonhart/TaskbarFixWin
Several fixes for windows
2025-07-16 11:15:23 +02:00
Rafael Kitover 3ffbe7816a
translations: remove ja_JP, 0% and ja exists
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-16 01:53:34 +00:00
Squall Leonhart 2064af05b4
comment for BindAppIcon change 2025-07-16 09:07:03 +10:00
Squall-Leonhart ae8bfb4ab3 Several fixes for windows
improve on the fex type check, so it works on windows x86/64
move BindAppIcon from BindControls in guiinit.cpp to wxvbam to avoid a timing issue that see's the icon not populated on windows till late.
adds 3 more icon sizes to the icon on windows.
2025-07-16 07:56:24 +10:00
Rafael Kitover 1f3a1cb9dc
build: fix re-downloading vcpkg binary packages
Fix re-installing binary packages on next cached run by clearing the
cache entries for `vcpkg list`. Also remove the binary packages
directory after installing.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-15 21:05:07 +00:00
Rafael Kitover bbaf70c083
build: fix slow CMake vcpkg startup time
Set the CMake cache variables for `vcpkg list` in `CACHE` instead of
`PARENT_SCOPE`, because the parent scope is now a transient function and
nothing was being cached, causing very slow run speed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-15 16:46:17 +00:00
Rafael Kitover b96e0ad35c build: remove `vcpkg update`, it does nothing
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-15 15:25:39 +00:00
Andy Vandijck 96324ddb92 Fix load
Fix load
2025-07-15 10:47:07 +02:00
Andy Vandijck dca119905a Fix GBA sound
Fix GBA sound
2025-07-15 10:11:51 +02:00
Andy Vandijck 6a702ad09b Fix type detection for file extractor
Fix type detection for file extractor
2025-07-14 13:58:00 +02:00
Andy Vandijck 796ecee8cf Fix type detection for file extractor
Fix type detection for file extractor
2025-07-14 13:57:40 +02:00
Rafael Kitover c1d3d19d6b
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 21:00:19 +00:00
Rafael Kitover f7a79bfe2e
build: fix binpkg deps resolution yet again
Keep a list of already installed dependencies and use the count to
determine if any are not installed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 18:12:37 +00:00
Rafael Kitover f8c52377a3
build: fix binpkg hostdeps again
Followup on 357eccc6 (build: fix checking if bin pkg host deps
installed, 2025-07-13) keep a count of already installed host deps, and
when the host deps count is equal to it rather than zero, break out of
the loop. This fixes the infinite loop and hang caused by host deps
being required but already being installed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 16:17:48 +00:00
Rafael Kitover 357eccc6eb
build: fix checking if bin pkg host deps installed
Fix the check for host dependency packages being downloaded to not run
if the package is already installed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 16:03:31 +00:00
Andy Vandijck 80f595c0b0 Fix debug build
Fix debug build
2025-07-13 15:18:00 +02:00
Andy Vandijck 1c73f0c7d3 Fix configure
Fix configure
2025-07-13 15:06:21 +02:00
Andy Vandijck 3aff3784cf Update BZ2 library for windows debug
Update BZ2 library for windows debug
2025-07-13 14:58:33 +02:00
Andy Vandijck 59fa419820 Reduce allocated memory after read for BZ2
Reduce allocated memory after read for BZ2
2025-07-13 14:13:46 +02:00
Rafael Kitover b0820a28b6
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 10:00:19 +00:00
Andy Vandijck a782c1c5fe Fix CI
Fix CI
2025-07-13 11:12:57 +02:00
Andy Vandijck 16a73fcbcf Fix LZMA MSVC build
Fix LZMA MSVC build
2025-07-13 10:24:00 +02:00
Andy Vandijck 9ff3b9e3b7 Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-13 10:11:06 +02:00
Andy Vandijck 379be68f69 Tar recognition
Tar recognition
2025-07-13 10:11:02 +02:00
Rafael Kitover 8bfb39b3ad
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 08:00:26 +00:00
Rafael Kitover d97c8eabf5
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-13 08:00:07 +00:00
Andy Vandijck e42e6323e8 Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-13 09:39:50 +02:00
Andy Vandijck d0463ddb5e Initial tar support
Initial tar support
2025-07-13 09:39:38 +02:00
Rafael Kitover 1da359ba22
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-12 16:00:19 +00:00
Andy Vandijck 15612c2bcc Add BZ2 and LZMA support options
Add BZ2 and LZMA support options
2025-07-12 17:32:28 +02:00
Andy Vandijck 11a941f33d Set max rom size (32MB) to BZ2 and fix block size
Set max rom size (32MB) to BZ2 and fix block size
2025-07-12 14:25:02 +02:00
Andy Vandijck a808cfb6f5 Update macOS plist
Update macOS plist
2025-07-12 13:44:52 +02:00
Andy Vandijck 0266b9e4d1 Optimize LZ size detection
Optimize LZ size detection
2025-07-12 13:27:47 +02:00
Andy Vandijck ef01f4c491 Fix bz2
Fix bz2
2025-07-12 13:14:37 +02:00
Andy Vandijck d784b60aaa Fix BZ2 size
Fix BZ2 size
2025-07-12 13:11:59 +02:00
Rafael Kitover 67b17f50ec
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-12 09:00:22 +00:00
Rafael Kitover be6addf034
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-12 09:00:06 +00:00
Andy Vandijck d9b58d683e Add .lz extension
Add .lz extension
2025-07-12 10:54:22 +02:00
Andy Vandijck 604f5412a6 Add LZIP support
Add LZIP support
2025-07-12 10:52:17 +02:00
Rafael Kitover de64dfd9e9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-12 07:00:23 +00:00
Rafael Kitover 024ae098e6
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-12 07:00:06 +00:00
Andy Vandijck 3d7cce05aa Fix Linux build 2025-07-12 08:18:51 +02:00
Rafael Kitover 205459f7ae
build: add bzip2 and liblzma[tools] to vcpkg ports
Add `bzip2` and `liblzma[tools]` to the vcpkg ports dependencies list
for the new `.bz2` and `.xz` support.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-11 19:31:20 +00:00
Andy Vandijck 3ac5aa4f27 Add .xz extension
Add .xz extension
2025-07-11 19:57:32 +02:00
Andy Vandijck 6fedbdc512 Add .xz support
Add .xz support
2025-07-11 19:55:09 +02:00
Andy Vandijck 996a827d8e Merge branch 'master' of github.com:visualboyadvance-m/visualboyadvance-m 2025-07-11 16:38:50 +02:00
Andy Vandijck 0c91d45627 Add .bz2 file support
Add .bz2 file support
2025-07-11 16:38:46 +02:00
Andy Vandijck 3cf6ac5a80 Optimize unrar for MinGW
Optimize unrar for MinGW
2025-07-11 15:56:47 +02:00
Rafael Kitover c5d1862e4e
build: fix x86-mingw build
Amend the cpp macro checks in the unrar code to fix the build for MinGW.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-11 06:33:10 +00:00
Andy Vandijck c63469ac63 Fix warnings 2025-07-10 13:54:40 +02:00
Andy Vandijck 3e0541c639 Update unrar to V7.1.8
Update unrar to V7.1.8
2025-07-10 11:14:41 +02:00
Andy Vandijck 00e48e11e6 Fix RAR support
Fix RAR support
2025-07-10 11:03:05 +02:00
Rafael Kitover 07c6e3119e build: remove vcpkg pkgconf dep
Remove pkgconf from the list of vcpkg dependency packages, because it is
automatically installed as a host build dependency and an explicit
dependency on the target triplet package is not required.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-09 14:42:37 +00:00
Andy Vandijck 3d8ed512cf Use macOS 10.10 Sparkle 2025-07-09 16:14:06 +02:00
Andy Vandijck e49cce5b9e Update win32-deps submodule to latest version
Update win32-deps submodule to latest version
2025-07-09 14:29:11 +02:00
Rafael Kitover 1dfd7ec121
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-09 07:00:24 +00:00
Rafael Kitover f1beea9214 release v2.2.0
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-08 22:40:16 +00:00
Rafael Kitover 865add067d
Adjust throttle limit 450 -> 1000
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-08 16:45:42 +00:00
Andy Vandijck 22c620967d Fix fullscreen window for SDL only 2025-07-08 14:51:43 +02:00
Rafael Kitover 8dfc9fa14b
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-08 11:00:19 +00:00
Andy Vandijck 20db98897d Add dark mode support
Add dark mode support
2025-07-07 20:44:54 +02:00
Rafael Kitover 8a2cec5790
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-07 14:00:20 +00:00
Andy Vandijck 78a1c42162 Fix crash when closing D3D9 window
Fix crash when closing D3D9 window
2025-07-07 15:13:19 +02:00
Andy Vandijck 469c8713b8 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2025-07-07 13:19:15 +02:00
Andy Vandijck ec3e46abc8 Fix indent
Fix indent
2025-07-07 13:19:10 +02:00
Andy Vandijck f69ce0de0f Fix macOS FAudio linking
Fix macOS FAudio linking
2025-07-07 12:52:14 +02:00
Andy Vandijck 08027f0f38 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2025-07-07 12:44:58 +02:00
Andy Vandijck e018c1c41a Fix D3D window close
Fix D3D window close
2025-07-07 12:44:50 +02:00
Rafael Kitover 4b6454bac5
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-07 10:00:28 +00:00
Rafael Kitover e36d436174
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-07 10:00:06 +00:00
Andy Vandijck d49e6a31e2 Fix fullscreen for DX9 and fix input for DX9 window
Fix fullscreen for DX9 and fix input for DX9 window
2025-07-07 11:50:57 +02:00
Andy Vandijck 08ffe49414 Find AVFormat first
Find AVFormat first
2025-07-07 10:41:50 +02:00
Andy Vandijck c76edf74c6 Fix MinGW build
Fix MinGW build
2025-07-07 10:07:13 +02:00
Rafael Kitover fac5d565aa
build: use vcpkg host pkgconf when cross compiling
For vcpkg, set `PKG_CONFIG_EXECUTABLE` to the host `pkgconf.exe` when
the host is x64.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-06 21:05:56 +00:00
Rafael Kitover 5702bc5102 build: fix x64-mingw-static for MSYS2 CLANG64
Don't set the compilers to `gcc` for MinGW vcpkg triplets, because it
may be CLANG64 with MinGW.

Link FAudio using the `-static` target or the normal target only.

Use `ghc::filesystem::path::c_str()` to pass paths to `std::fstream` as
there is a conversion problem with this toolchain.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-06 19:11:41 +00:00
Andy Vandijck 99f2530d37 Include FAudio in macOS
Include FAudio in macOS
2025-07-06 15:06:24 +02:00
Andy Vandijck adedc507cf Fix macOS link
Fix macOS link
2025-07-06 14:48:53 +02:00
Andy Vandijck 5745ed3d8d Use external libwebp and use built pcre2
Use external libwebp and use built pcre2
2025-07-06 14:46:12 +02:00
Andy Vandijck 5f866f8567 Revert beeping fix and fix again the previous way
Revert beeping fix and fix again the previous way
2025-07-06 14:20:13 +02:00
Andy Vandijck 7ce5b4940d wxFC_SAVE fix for wxWidgets
wxFC_SAVE fix for wxWidgets
2025-07-06 14:06:36 +02:00
Andy Vandijck 27dc60f2d1 Try to fix generic file dialog save
Try to fix generic file dialog save
2025-07-06 10:44:15 +02:00
Andy Vandijck 8002f91c1c Fix save dialog
Fix save dialog
2025-07-06 08:55:31 +02:00
Rafael Kitover cc2bda6991
build: inst host deps for bins only if not
Before installing calculated host dependencies for binary packages,
check if they are already installed.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-05 17:14:49 +00:00
Andy Vandijck e8eada5658 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2025-07-05 14:35:16 +02:00
Andy Vandijck 1de7b60e5b Find AVFormat first
Find AVFormat first
2025-07-05 14:35:06 +02:00
Rafael Kitover cdac9d445c
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-05 10:00:20 +00:00
Andy Vandijck 2a4697c04f Fix warning
Fix warning
2025-07-05 10:21:58 +02:00
Andy Vandijck d7c6eb81cd Fix MinGW FFMpeg
Fix MinGW FFMpeg
2025-07-05 10:16:56 +02:00
Andy Vandijck 43a6a90a8c Fix FFMPEG for macOS 2025-07-04 15:59:30 +02:00
Andy Vandijck 54f56fc984 Fix libx265 build for macOS 2025-07-04 15:31:32 +02:00
Andy Vandijck 4bde911531 Set title as const char *
Set title as const char *
2025-07-04 11:29:24 +02:00
Andy Vandijck 31cfe30468 Fix MinGW compile with title of DX9 window
Fix MinGW compile with title of DX9 window
2025-07-04 10:28:42 +02:00
Andy Vandijck 2f8369c3c7 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2025-07-04 10:10:12 +02:00
Andy Vandijck 2c17201cdd Separate window for SDL direct3d9 with background input
Separate window for SDL direct3d9 with background input
2025-07-04 10:10:06 +02:00
Rafael Kitover 6f5c785a35
build: add x264+x265 for ffmpeg for macOS
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-03 20:08:37 +00:00
Rafael Kitover 05d181849a
build: rm FindFFmpeg for distro ver, fix x264/x265
Remove our copy of FindFFmpeg.cmake, as this module is included in
distributions now.

This also fixes the problem with finding x264 and x265 components and
libraries for FFmpeg.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-03 19:45:04 +00:00
Andy Vandijck 6505ca17df Add normal types for direct3d9
Add normal types for direct3d9
2025-07-03 13:35:45 +02:00
Rafael Kitover 856abf8067
build: add option VCPKG_BINARY_PACKAGES
Add CMake option VCPKG_BINARY_PACKAGES, defaulting to TRUE to download
and use binary packages for vcpkg dependencies.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-02 20:27:43 +00:00
Rafael Kitover e8d4adaf12 build: always use pwsh vcpkg-list
Use the `vcpkg-binpkg-prototype` `vcpkg-list` implementation and never
`vcpkg list`, because the letter sometimes shortens package names and
may be breaking the package installed check.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-02 17:16:42 +00:00
Andy Vandijck 3a9124fecf Revert HWND pointer
Revert HWND pointer
2025-07-02 18:06:22 +02:00
Andy Vandijck a3ebf1af41 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2025-07-02 16:34:48 +02:00
Andy Vandijck 15619e9e43 Use HWND for Windows
Use HWND for Windows
2025-07-02 16:34:36 +02:00
Rafael Kitover 50aa85d909 build: update vcpkg ports list, drop gettext
Update the vcpkg ports list with the currently used ports and their
features.

Drop `gettext` for `gettext-libintl`, with the binary catalog creation
tools coming from a NuGet package.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-07-01 20:31:46 +00:00
Rafael Kitover 9c36ed6550
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-30 19:00:20 +00:00
Andy Vandijck 9b7dba5931 Get SDL error for renderer creation
Get SDL error for renderer creation
2025-06-30 19:26:58 +02:00
Andy Vandijck db8e2279a5 Don't use D3D9Ex
Don't use D3D9Ex
2025-06-30 19:09:27 +02:00
Andy Vandijck ce7aa3fae3 Fix FAudio crash on WIndows debug
Fix FAudio crash on WIndows debug
2025-06-30 19:08:07 +02:00
Andy Vandijck 4ba7796d46 Fix FAudio crash on MSVC 2025-06-30 11:54:13 +02:00
Rafael Kitover 179bec9d2b
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-30 06:00:20 +00:00
Andy Vandijck d3a05166fd Fix crash
Fix crash
2025-06-29 17:07:14 +02:00
Andy Vandijck e0cdf74b90 Fix XP auto updates
Fix XP auto updates
2025-06-29 15:50:24 +02:00
Andy Vandijck 0f863e45a3 Fix XP auto updates 2025-06-29 15:45:49 +02:00
Andy Vandijck 3e0ba6d5c1 Fix issue with conversion
Fix issue with conversion
2025-06-29 15:24:02 +02:00
Andy Vandijck c7abd4e74e Fix double )) 2025-06-29 14:05:30 +02:00
Andy Vandijck 65e2706473 Fix issue
Fix issue
2025-06-29 14:04:06 +02:00
Andy Vandijck 9ea2360514 Fix double ) 2025-06-29 13:31:13 +02:00
Andy Vandijck a5676b4b8b Fix indent 2025-06-29 13:08:22 +02:00
Andy Vandijck 4fa72ce721 Fix indent 2025-06-29 13:08:06 +02:00
Andy Vandijck d91d7fd5e3 Fix else 2025-06-29 13:07:43 +02:00
Andy Vandijck d1d2cd7ba7 Use SDL_GetRendererName for Direct3D9 check 2025-06-29 13:02:37 +02:00
Andy Vandijck e36fc38eba Fix 16 bit for Direct3d9 2025-06-29 12:58:58 +02:00
Andy Vandijck 83707cf56c Fix Direct3D9 2025-06-29 12:27:50 +02:00
Andy Vandijck 00be6c96a2 Delete winsparkle dll
Delete winsparkle dll
2025-06-29 11:12:48 +02:00
Andy Vandijck 30d671f2f8 Fix warning
Fix warning
2025-06-29 09:54:51 +02:00
Andy Vandijck c8205825ac Fix architecture for online updates 2025-06-29 09:48:09 +02:00
Andy Vandijck 8688e2351b Fix arch for online updates
Fix arch for online updates
2025-06-29 09:47:19 +02:00
Andy Vandijck e352eb93b3 Fix online updates header 2025-06-29 09:43:53 +02:00
Andy Vandijck 5d1c84613c Update win32-deps 2025-06-28 22:20:44 +02:00
Andy Vandijck 90980741e2 Fix winsparkle
Fix winsparkle
2025-06-28 21:12:32 +02:00
Andy Vandijck b82e7a3b66 Update wxvbam.rc 2025-06-28 20:47:21 +02:00
Andy Vandijck 72c4adae79 Merge branch 'master' of https://github.com/visualboyadvance-m/visualboyadvance-m 2025-06-28 20:21:32 +02:00
Andy Vandijck e8fb9b7622 Add winsparkle includes for MSVC
Add winsparkle includes for MSVC
2025-06-28 20:19:09 +02:00
Rafael Kitover 89fd875b3c
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-28 14:00:21 +00:00
Andy Vandijck bd9a7e45fc Revert vulkan props 2025-06-28 15:31:55 +02:00
Andy Vandijck 309fe49ed1 Fix window props 2025-06-28 15:29:02 +02:00
Andy Vandijck f091a656ff Fix window props for Vulkan and OpenGL 2025-06-28 15:26:27 +02:00
Andy Vandijck fa40f41866 Remove unused variable 2025-06-28 15:19:22 +02:00
Andy Vandijck 47b2785b74 Revert vulkan flags 2025-06-28 15:15:57 +02:00
Andy Vandijck 50bb818034 Vulkan props 2025-06-28 15:07:25 +02:00
Andy Vandijck 01991889d7 Revert pixel masks 2025-06-28 15:05:45 +02:00
Rafael Kitover a570d21f35
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-28 13:00:24 +00:00
Rafael Kitover 8f66c79eea
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-28 13:00:07 +00:00
Andy Vandijck 647c007193 Use ARGB8888 with SDL renderer 2025-06-28 14:52:57 +02:00
Rafael Kitover f0a30d45a1 build: fix installing host build dep bin pkgs
Calculate and install only build dependencies for a binary package set
instead of everything from the host triplet. This way we can support
binary packages for dynamic builds as well.

Also check that the vcpkg Git clone is writable if it does not exist.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-27 23:10:33 +00:00
Andy Vandijck 38c5267adb Alter comment 2025-06-27 11:47:56 +02:00
Andy Vandijck 70d6a1ac39 Make Sparkle framework optional 2025-06-27 11:45:49 +02:00
Andy Vandijck 77f49ac671 Clean up WinSparkle code
Clean up WinSparkle code
2025-06-27 09:57:59 +02:00
Andy Vandijck e40c1e7140 Update macOS Sparkle 2025-06-27 09:30:57 +02:00
Andy Vandijck afef36820c Set Sparkle to latest build 2025-06-27 09:18:19 +02:00
Andy Vandijck a97a6879d9 Add 7z windows header 2025-06-26 13:44:55 +02:00
Andy Vandijck 8579e192af Check for kInputBufSize 2025-06-26 13:36:19 +02:00
Andy Vandijck 910ec06e47 Indent 2025-06-26 13:11:46 +02:00
Andy Vandijck e795e9522c Fix 7z extractor 2025-06-26 13:11:00 +02:00
Andy Vandijck e64a8b695a Update 7z_C to 2409 and update extractor 2025-06-26 11:55:18 +02:00
Rafael Kitover 3cd82d1f24
Merge remote-tracking branch 'libretro/master'
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-25 23:35:48 +00:00
Andy Vandijck de426adf02 Switch to new win32-deps
Switch to new win32-deps
2025-06-25 13:51:03 +02:00
Andy Vandijck 0c8e09a029 No HTTPS for Windows XP
No HTTPS for Windows XP
2025-06-25 13:10:44 +02:00
Andy Vandijck 4b080c2e4e Fix winsparkle module load
Fix winsparkle module load
2025-06-25 12:32:35 +02:00
Andy Vandijck 917ed4014f Don't unpack WinSparkle DLL on Windows XP 2025-06-24 09:13:23 +02:00
Andy Vandijck 5d65a5b6e8 Don't use auto updates on Windows XP
Don't use auto updates on Windows XP
This requires Windows Vista or newer.
2025-06-23 17:28:32 +02:00
Andy Vandijck e7de32ee18 Fix symbol import
Fix symbol import
2025-06-23 17:08:00 +02:00
Andy Vandijck 34218c25bf Update deps to latest push
Update deps to latest push
2025-06-23 15:22:14 +02:00
Andy Vandijck 8a1f4db62f Fix running of updates on Windows XP 2025-06-23 14:46:42 +02:00
Andy Vandijck c31499ca10 Fix winsparkle dependency and update win32-deps to latest push 2025-06-23 13:03:46 +02:00
Andy Vandijck 41895eea36 Add option not to update vcpkg builds
Add option not to update vcpkg builds
2025-06-23 11:46:01 +02:00
Andy Vandijck 05f2cb7dea Fix auto updates 2025-06-23 10:58:10 +02:00
Rafael Kitover 61be54d3d9
build: avoid using VS vcpkg with elevation
Always use a parallel vcpkg directory instead of the Visual Studio
default vcpkg, because installing there requires elevation and doesn't
always work.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-22 17:26:15 +00:00
Andy Vandijck 48fc076cc2 Set WinSparkle to 0.9.1 2025-06-18 20:10:22 +02:00
Andy Vandijck 5e2e2ab4a9 Add MinGW WinSparkle support 2025-06-18 18:23:44 +02:00
Andy Vandijck 74528ccb30 Switch to SDL3 3.2.16 2025-06-11 12:47:01 +02:00
Andy Vandijck 3f5a89e5c4 Use wxWidgets 3.3.0 release 2025-06-11 09:46:11 +02:00
Rafael Kitover 2c2ee70109
build: minor improvements to the Mac builder
Remove explicit include and framework paths which were only there to
work around hidden code inserted by the NSA to break our build.

Adjust CMake dist builds to support flags in the `CC` and `CXX`
environment variables, which CMake does not like.

Fix the error in the build environment block caused by using a glob by
using `find` with a shell expansion instead.

Set the build root include path with `-isystem` as the first element of
`CPPFLAGS`.

Remove the doxygen dist, as it should not be needed anymore.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-10 09:58:19 +00:00
Rafael Kitover 6ddfdd615f
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-04 03:00:22 +00:00
Rafael Kitover c3ad631f3a
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-02 21:00:22 +00:00
Rafael Kitover 21752425da
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-06-02 20:00:21 +00:00
Andy Vandijck 3a68f08bcf Fix macOS glib build 2025-06-02 13:19:18 +02:00
Rafael Kitover 90e17d86ad
build: remove outdated wx patch for macOS
Remove the outdated patch to fix the alert sound in the override in
`macOS/builder`, the working patch is in `core.sh`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-30 12:52:27 +00:00
Andy Vandijck e4b2b5afb8 Fix wxwidgets beep 2025-05-30 13:41:33 +02:00
Andy Vandijck f8626cf363 Fix wxwidgets beep 2025-05-30 13:34:22 +02:00
Andy Vandijck d7135b782d Build fix for wxWidgets 3.3.0 RC1 2025-05-30 10:52:18 +02:00
Andy Vandijck f6dacc887d Use wxWidgets 3.3.0-RC1 for macOS build 2025-05-30 10:35:35 +02:00
Andy Vandijck 3c048f178c Add alert fix 2025-05-30 09:25:28 +02:00
Andy Vandijck 1468caa494 Fix target build 2025-05-30 09:03:22 +02:00
Rafael Kitover 5972e73e37
build: patch wxWidgets on macOS for alert bug
Add a patch to our build of wxWidgets for macOS to fix the alert sound
bug, as described here:

https://github.com/wxWidgets/wxWidgets/issues/25262#issuecomment-2745905462

. Add a macro to disable our workaround for this bug when a CMake option
indicating that this patch was applied is `TRUE`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-29 15:45:12 +00:00
Andy Vandijck 88302602ca Fix ffmpeg linkage
Fix ffmpeg linkage
2025-05-28 15:03:41 +02:00
Andy Vandijck 830c8ccd4d Add x264 and x265 to ffmpeg
Add x264 and x265 to ffmpeg
2025-05-28 13:17:49 +02:00
Andy Vandijck c048f0c713 Fix find ffmpeg
Fix find ffmpeg
2025-05-28 13:08:57 +02:00
Andy Vandijck 7c1a6a44f7 Set avformat first to fix linking issue
Set avformat first to fix linking issue
2025-05-28 10:27:07 +02:00
Andy Vandijck 6b6e1f76cb Fix XAudio 2 build
Fix XAudio 2 build
2025-05-27 20:47:55 +02:00
Rafael Kitover 97894c7899
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-23 02:00:23 +00:00
Rafael Kitover 8a3e3841cf
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-23 02:00:07 +00:00
Rafael Kitover 39cad5feb8
build: fix build with -DENABLE_OPENAL=TRUE
Followup on 8ced18c2 (build: make OpenAL-Soft optional again,
2025-05-22), put the sources for OpenAL support in the right place in
the CMake file for the build to work.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-23 01:34:22 +00:00
Rafael Kitover 8ced18c22f
build: make OpenAL-Soft optional again
Add the CMake option `ENABLE_OPENAL` which defaults to `ON` except for
32 bit Windows builds, because OpenAL-Soft uses `avrt.dll` which is not
available on Windows XP.

Update README.md.

Fix linking `libsamplerate` for the `x86-mingw-static` triplet which we
use for 32 bit Windows XP builds.

Make some minor fixes to SDL3 detection and SDL2 fallback.

Clean up the audio API selection code paths.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-22 23:42:36 +00:00
Andy Vandijck fd2c767319 Don't set CoreAudio as default 2025-05-22 16:51:16 +02:00
Andy Vandijck 31ce5d1732 CoreAudio fix 2025-05-22 15:26:51 +02:00
Andy Vandijck fdc7d05be0 Create timeline based queue for CoreAudio 2025-05-22 14:02:36 +02:00
Andy Vandijck 11e0b8b2f6 Fix issue 2025-05-22 13:54:35 +02:00
Andy Vandijck 18e626ae58 Optimize CoreAudio buffers 2025-05-22 12:50:33 +02:00
Andy Vandijck 532a6d345b Fix CoreAudio 2025-05-22 10:01:42 +02:00
Andy Vandijck 19705e0dcf Fix CoreAudio 2025-05-22 09:55:09 +02:00
Andy Vandijck 10195bff1a Fix CoreAudio bugs 2025-05-22 09:08:14 +02:00
Rafael Kitover e0102f7242
Update win32-deps submodule
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-21 20:32:11 +00:00
Andy Vandijck 82fa5cab96 Fix deprecations for winsock2 2025-05-21 16:10:10 +02:00
Rafael Kitover b699d809d9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-21 14:00:28 +00:00
Andy Vandijck 48ba8fe197 Windows version fix 2025-05-21 15:48:22 +02:00
Andy Vandijck 020f20e494 Use SDL3 3.2.14 2025-05-21 10:17:56 +02:00
Rafael Kitover 3f436073be
build: fix 32 bit build for Windows XP
Fix x86 32 bit build for Windows XP.

Set the `WINVER` and `_WIN32_WINNT` macros to the value for Windows XP.

Disable XAudio for these builds.

Add the missing `inet_pton()` and `inet_ntop()` functions for SFML.

Fix a FetchContent warning in the CMake as well.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-20 18:33:36 +00:00
Andy Vandijck ac0dc48263 Fix SDL3 detection 2025-05-20 15:26:00 +02:00
Andy Vandijck c065851616 Fix SDL3 detection 2025-05-20 15:24:49 +02:00
Andy Vandijck e868bc959b Fix ccache build 2025-05-20 13:03:19 +02:00
Andy Vandijck 17cb394236 fix ccache build 2025-05-20 12:58:40 +02:00
Andy Vandijck 4a424c18a8 fix ccache build 2025-05-20 12:56:58 +02:00
Andy Vandijck befdea4be1 fix ccache build 2025-05-20 12:51:48 +02:00
Andy Vandijck 3c5aa7b7bb Fix ccache build 2025-05-20 12:41:36 +02:00
Andy Vandijck 311b79e03a Fix ccache build 2025-05-20 12:39:41 +02:00
Andy Vandijck cbbcea9c28 Install setuptools on python3 post 2025-05-20 12:26:13 +02:00
Andy Vandijck 6cf2400cba Remove sfml from builder list 2025-05-20 12:01:24 +02:00
Andy Vandijck 4693e6936f Fix ccache build 2025-05-20 11:59:08 +02:00
Rafael Kitover 5b9a26ba6c
build: make some minor CMake improvements
Default `ENABLE_SDL3` to whether `find_package(SDL3)` can find it.

Only add libsamplerate for SDL2 with vcpkg.

Install gettext tools on Windows if they are not available, not just
under MSVC. This makes the `x86-mingw-static` triplet work as well.

Fix syntax error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-20 01:36:14 +00:00
Andy Vandijck c9ca85b839 Compile metal shaders early 2025-05-19 19:35:45 +02:00
Andy Vandijck 0037d61ad1 Fix metal shader build for x86_64 2025-05-19 16:16:09 +02:00
Andy Vandijck 8ac1b297f7 Fix for glib build 2025-05-19 15:07:59 +02:00
Andy Vandijck 06f0537619 Use generic file dialogs for builder build 2025-05-19 12:18:17 +02:00
Andy Vandijck d89fb4846a Fix build 2025-05-19 10:49:30 +02:00
Andy Vandijck 4839a89f42 python3 build fix 2025-05-19 10:33:29 +02:00
Andy Vandijck caf064e210 xmlto build fix 2025-05-19 10:21:38 +02:00
Andy Vandijck a742d7f1dd Set libxml2 python to disabled 2025-05-19 10:10:48 +02:00
Andy Vandijck d5ea803bb8 Set libxml2 python to None 2025-05-19 10:10:23 +02:00
Andy Vandijck 0d38117e83 build xmlto after docbooks 2025-05-19 10:08:23 +02:00
Andy Vandijck 39d5761181 Fix unzip build 2025-05-19 09:33:19 +02:00
Andy Vandijck d9a392a69a Fix xmlto paths 2025-05-19 08:57:48 +02:00
Rafael Kitover 9712c424fd
build: make some minor fixes to Mac builder
Make some minor updates and fixes to the Mac builder scripts:

- use Git master for libpsl.
- Bump libicu.
- Bump libxml2 and switch it to meson.
- Link brew m4 into build root for autotools.
- Make brew precede system paths in `PATH`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-18 20:33:45 +00:00
Andy Vandijck 3625a1ad2d Fix metal compiler for builder 2025-05-18 18:46:04 +02:00
Andy Vandijck 6216a7b5d0 use system packages for wxWidgets 2025-05-18 18:28:08 +02:00
Andy Vandijck e81f4cc6ed Fix builder build 2025-05-18 17:49:34 +02:00
Andy Vandijck 7f82fa0089 Fix ffmpeg build 2025-05-18 17:29:16 +02:00
Andy Vandijck 81dbe6de6e Fix wxwidgets build 2025-05-18 17:22:22 +02:00
Andy Vandijck 9abe3f46e3 glib fix 2025-05-18 16:55:39 +02:00
Andy Vandijck 3283bcad22 Fix python build 2025-05-18 15:28:51 +02:00
Andy Vandijck 7f192348de fontconfig fix 2025-05-18 15:23:23 +02:00
Andy Vandijck 1b466d7e38 fix expat build 2025-05-18 15:09:22 +02:00
Andy Vandijck 7ce3e4db00 Fix libxml build 2025-05-18 15:00:57 +02:00
Andy Vandijck 73fd7f260f Fix build for macOS builder 2025-05-18 14:33:20 +02:00
Andy Vandijck 2175bc6edf Fix xmlto build 2025-05-18 14:27:34 +02:00
Andy Vandijck 4f00ba9662 Update core.sh 2025-05-18 11:49:34 +02:00
Andy Vandijck 8e4651d819 Fix builder downloads 2025-05-18 11:40:09 +02:00
Andy Vandijck 05707bbd26 CURL macOS fix 2025-05-18 09:53:40 +02:00
Andy Vandijck 12f2d88c73 Update versions on macOS build script 2025-05-18 09:43:04 +02:00
Andy Vandijck 79d3453544 Implement CoreAudio driver 2025-05-18 07:28:51 +02:00
Squall Leonhart ef85b71444
Update bug_report.yml 2025-05-12 22:16:39 +10:00
Squall Leonhart a2515b3bbd
Update bug_report.yml 2025-05-12 22:14:22 +10:00
Squall Leonhart 41bbb49f51
Update bug_report.yml 2025-05-12 22:08:18 +10:00
Squall Leonhart 209cb0e96a
Update bug_report.yml 2025-05-12 21:58:38 +10:00
Rafael Kitover 375e31f6cc
build: stop using Python 2.7 in the Mac builder
Remove code in the Mac builder to install Python 2.7 using pyenv. This
no longer works and it is no longer needed by anything.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-11 22:43:21 -07:00
Rafael Kitover 34e46945f9
build: generalize linking openal-soft to libfmt
Followup on the previous 3 commits to fix MSVC builds by linking libfmt
which openal-soft now needs.

Change the relevant CMake to link libfmt when it is found on all
platforms.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-11 18:10:55 +00:00
Rafael Kitover 5912be5a32
build: remove SDL3 samplerate feature, not feature
Change `sdl3[samplerate]` in the vcpkg ports lists to `sdl3` as that is
not a feature of the vcpkg SDL3 port, even if it was a feature of the
SDL2 port.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-11 17:36:58 +00:00
Andy Vandijck aa0e95a968
Fix debug build 2025-05-11 10:05:50 +02:00
Andy Vandijck a10c6b93bb Fix debug build 2025-05-11 09:58:10 +02:00
Andy Vandijck f08443f307 Fix MSVC build 2025-05-11 09:47:17 +02:00
Andy Vandijck 5529797f10 Set directory path for generic file dialog 2025-05-11 08:11:46 +02:00
Rafael Kitover bd0a59cc5f
ci: fix shell syntax for Ubuntu runner
Fix the Install Dependencies section of the CI Ubuntu runner to use `|`
instead of `>-` for the command list block, which is necessary for
running multiple shell commands.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-10 16:50:00 +00:00
Rafael Kitover d2762a95bf
ci: add libsdl3-dev for Ubuntu runner
Add the libsdl3 backport PPA for the Ubuntu CI runner because the latest
Ubuntu image does not have it.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-10 16:27:11 +00:00
Andy Vandijck 10a4b5dc71
Fix warning
Fix warning
2025-05-10 16:11:53 +02:00
Rafael Kitover 001dd9548d
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-10 13:00:21 +00:00
Andy Vandijck 1c436f2dfe Add MSVC secure library functions 2025-05-10 14:11:26 +02:00
Andy Vandijck 8f47df28bf Add entitlements file for sandboxing 2025-05-10 10:24:06 +02:00
Andy Vandijck db5c890e0d Add option for generic file dialogs 2025-05-10 09:35:41 +02:00
Rafael Kitover 7dbad8e85c
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-09 10:00:21 +00:00
Andy Vandijck d3da049269 Update nixpkgs for SDL3 2025-05-09 10:12:58 +02:00
Rafael Kitover bc0e406aba
doc: update developer manual
Update the developer manual to clarify and expand upon the instructions
for collaborating on the project.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-08 23:42:41 +00:00
Rafael Kitover eb6491ecb7
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-08 21:07:07 +00:00
Rafael Kitover 546ddfbc41
translations: rebuild source .pot
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-08 21:06:50 +00:00
Rafael Kitover ef46bb7e46
build: in installdeps for SUSE s/libSDL3/SDL3/
Change the package for SDL3 dev stuff from libSDL3-devel to SDL3-devel
which is what it is called for SDL3, that was the name for SDL2.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-08 20:59:56 +00:00
Rafael Kitover a3b92a3348
build: update installdeps to SDL3
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-08 20:58:40 +00:00
Andy Vandijck 2f92dd73b1 Add MSVC 2022 libretro support 2025-05-08 17:18:41 +02:00
Andy Vandijck 07c7bb40a1 Fix AVCodec deprecations and fix warnings
Fix AVCodec deprecations and fix warnings
2025-05-08 14:58:53 +02:00
Andy Vandijck ed013bd22c
Fix SFML deprecations and fix SFML warnings
Fix SFML deprecations and fix SFML warnings
2025-05-06 13:45:01 +02:00
Andy Vandijck aaf4e7c18c Fix SFML deprecations and fix SFML warnings
Fix SFML deprecations and fix SFML warnings
2025-05-06 10:29:02 +02:00
Rafael Kitover 116af5c6a8
build: replace sdl2 vcpkg port with sdl3
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-04 22:17:50 +00:00
Rafael Kitover 1788b366af
build: default ENABLE_SDL3=ON in CMake
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-04 20:14:50 +00:00
Zach Bacon 0820ba587e BUILDER: Updated core.sh source packages required to build vba-m
Signed-off-by: Zach Bacon <zachbacon@vba-m.com>

mend
2025-05-04 14:00:33 +00:00
Andy Vandijck f975809e3c Update to SDL3 APIs, fix bpps, add SDL audio/video, add Metal video, fix Quartz drawing
Implement SDL3 for the SDL port if the CMake definition ENABLE_SDL3 is
set.
Implement setting the color depth for both wxWidgets and the SDL port.
Fix the coloring issues in the SDL port for OpenGL.
Implement 8 bit color support.
Update and fix the wx port SDL sound driver.
Implement SDL video in the wx port.
Silence GL deprecations on macOS.
Add SDL renderer selection.
Fix filter for bit depths other than 32 bit.
Fix GDK backend for Linux.
Add Metal renderer for macOS.
Fix Quartz drawing.
2025-05-04 13:57:49 +00:00
Rafael Kitover 3a1780145c
ci: disable Libretro Ubuntu and Switch builds
The Libretro Switch build uses some kind of libtransistor without which
the build fails.

Disable the Ubuntu Libretro build for now because it uses a linker
script from libretro.

The Libretro people are using GitLab CI anyway, so we will not deal with
this and disable these builds for now.

Also fix a couple of minor issues with the header-only `INTERFACE`
libraries in CMake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-04 01:12:56 +00:00
Andy Vandijck 18c3c3bd51
build: fix link error on MSVC for SFML port
Change two `constexpr` declarations to `inline` to fix a link error on
MSVC.

Also remove the C++14 override that was used for testing on MSVC, the
project being defined as C++17 in CMake.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-03 23:51:32 +00:00
Rafael Kitover 0aecfb5d1b
build: make minor improvements to the Mac builder
Refactor the code a bit in the Mac builder.

Get `getopt` from brew, and symlink it to the build root because it is
keg-only.

Include latest Command Line Tools `clang` includes with `-isystem`
before the SDK.

Use the latest SDK instead of the oldest one from the Command Line
Tools.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-03 03:44:00 +00:00
Rafael Kitover 44b274c9fa
builder: use cmake from brew for Mac builder
Use `cmake` from Homebrew instead of building it due to a compilation
error.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-03 00:13:37 +00:00
Rafael Kitover 491bc1c009
build: set framework search path in Mac builder
Use `-F` to pass the `Frameworks` path of the selected SDK to clang.

Also remove things already in `CPPFLAGS` from `CFLAGS`, `CXXFLAGS` and
`OBJCXXFLAGS`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-02 23:51:26 +00:00
Rafael Kitover 24643675c5
build: find oldest macOS SDK for Mac builder
In the macOS builder script, find the oldest macOS SDK included in the
Command Line Tools and use its C and C++ header directories in
`CPPFLAGS` with `-isystem`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-02 23:11:45 +00:00
saulfabreg Wii VC Project 0c6617e920
Fix GameCube builds of VBA-M Libretro too
GameCube is a big-endian system too, so let's fix it too and include it on the nightly buildbot for GCN.
2025-05-02 22:27:39 +00:00
Ploggy 864cc69061
Update WiiU Makefile 2025-05-02 22:27:11 +00:00
Rafael Kitover dae4397dff
build: lower bundled SFML C++17 to C++14
Convert the C++17 code in the bundled SFML code to C++14 to hopefully
allow for targeting macOS 10.10 (Yosemite) instead of 10.15 (Catalina.)

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-05-02 21:41:39 +00:00
Rafael Kitover 4cf6cccbaf build: bundle SFML 3.x sys/network in third_party
Remove the SFML external dependency, include the SFML 3.0.1 system and
network libraries in third_party and adjust the build code, tools and
documentation accordingly.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-24 16:34:42 +00:00
Rafael Kitover 9e724ea4b8 build: support building ARM64 binary for Mac
Make some adjustments to the Mac build scripts to support building an
ARM64 binary for Apple Silicon.

Also support cross-compiling for Intel on Apple Silicon.

Also prefer using Ninja for CMake ports.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-22 05:55:19 +00:00
Rafael Kitover eb26ec2ef6
Enable Hide Status Bar in UI Settings for macOS
Enable Hide Status Bar in UI Settings for macOS, it was previously
missing because the whole UI Settings submenu was removed on macOS.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-22 05:29:51 +00:00
Zach Bacon 6a9eeeaece core.sh Switched to github source for nasm
Nasm.us is down currently and unable to pull the tarball
down from that source.

Signed-off-by: Zach Bacon <zachbacon@vba-m.com>
2025-04-21 00:00:19 -04:00
Squall Leonhart 9f6285842d
initialize sound_buffer_len_ to silence a warning. 2025-04-16 02:20:53 +10:00
Rafael Kitover e5ad7b3403
build: find_package(nanosvg) w/ vcpkg
When using vcpkg wxWidgets, call `find_package(nanosvg)` so that
`NanoSVG::` link target is available.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-12 22:47:55 +00:00
Squall Leonhart 94752f8314
[FAudio]Correct the behavior of device_changed check
Fixes the behavior to take the timeout into account properly, fixing the throttled behavior so that it matches (or strives to) the configured value instead of being stuck at <90%
2025-04-13 03:58:40 +10:00
Rafael Kitover 3c32bad886
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-12 08:00:19 +00:00
Rafael Kitover 8936feaa71
build: add libtiff to Nix derivation
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-11 22:43:18 +00:00
Rafael Kitover f93a32ab0b
build: add libtiff to brews on macOS
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-11 21:52:08 +00:00
Rafael Kitover 3fa850c15d
build: capitalize ARCH_NAME in CMake
Use capitalized `ARM` instead of `arm` for ARCH_NAME in
Architecture.cmake so that the Mac Apple Silicon zip releases are
suffixed `ARM64` not `arm64`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-07 01:43:00 -07:00
Rafael Kitover 364776b833
build: s/-Ofast/-O3 -ffast-math/
Use `-O3 -ffast-math` instead of `-Ofast`, which is deprecated by the
latest clang. In both our options and for libretro.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-07 01:28:45 -07:00
Rafael Kitover 2d439f7ba6
build: fix link error on macOS
Add `tiff zstd deflate` to link libs for macOS to fix a link error
caused by libzstd and libdeflate not being linked for libtiff which is
linked by wxWidgets.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-07 01:24:02 -07:00
Rafael Kitover 11a6068a03
build: update vcpkg install command to new form
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-06 12:21:47 -07:00
Rafael Kitover 6139428207
translations: remove dup Chinese translations
Remove zh.po, which is not on Transifex anymore and zh-Hans.po, which I
have removed from Transifex just now, leaving zh-CN.po, as suggested by
@wuweiran.

Fix #1435.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-02 13:45:14 +00:00
Rafael Kitover 5a5579d27f
build: minor followup on SFML 3.x API change
Followup on 29e85e5d (build: update Link SFML usage to SFML 3.x APIs,
2025-04-01) to alias an optional.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-02 09:07:54 +00:00
Rafael Kitover 29e85e5d87 build: update Link SFML usage to SFML 3.x APIs
Make some changes for the SFML Network library for the 3.x APIs.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-04-01 23:34:58 +00:00
Fabrice de Gans e228394656 [Input] Process key down event for some controls
In #1424, the app event handler was disabling all key down events,
preventing controls that depend on them to properly handle these. This
was done to work around an issue on macOS where unhandled keyboard
events would fire an audio alert.
Since this breaks text controls, these changes check for the currently
focused window and let the event propagate for text controls.

Fixes #1434
2025-04-01 18:57:26 +02:00
Rafael Kitover d5ac2a853b
Revert "Update Link SFML usage to SFML 3.x APIs"
This reverts commit e82ae7bb13.

Sorry, somehow I pushed to the wrong branch.
2025-03-29 19:40:59 +00:00
Rafael Kitover e82ae7bb13
Update Link SFML usage to SFML 3.x APIs
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-03-29 18:54:53 +00:00
Rafael Kitover 20b82d8ab7
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-03-29 04:00:24 +00:00
Rafael Kitover 8d26b4f49f
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-03-25 23:00:22 +00:00
Fabrice de Gans 3fdc30f7d7
Mark `wxEVT_KEY_DOWN` as processed in `wxvbamApp` (#1424)
This prevents wxWidgets from triggering the alert sound on macOS.
There should be no side effect from this.

Fixes #1384
2025-03-22 16:24:14 -07:00
Rafael Kitover 57211ddc77
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-03-20 19:00:21 +00:00
Squall Leonhart 2de7efd9eb
Reallocate GBA ROM to the the new size(#1422)
The GBA ROM was erroneously reallocated to the constant `ROM_SIZE`.

Closes #1421
2025-03-15 13:39:57 -07:00
Rafael Kitover 5b4559f4ee
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-03-07 13:00:21 +00:00
Rafael Kitover 6178526cd9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-03-06 09:00:20 +00:00
Rafael Kitover c8a1d8eb2e
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-28 23:00:26 +00:00
Rafael Kitover 6e3883937b
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-28 22:00:21 +00:00
Rafael Kitover 8dd647914a
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-20 17:00:21 +00:00
Rafael Kitover 0dae126a29
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-20 16:00:22 +00:00
Rafael Kitover 5038cd7ba5
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-16 23:00:22 +00:00
Rafael Kitover ddd8fca044
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-11 19:00:21 +00:00
Rafael Kitover 25c85a83d9
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-11 18:00:21 +00:00
Fabrice de Gans 32dd410954
[build] Disable link (#1411)
SFML 2 no longer compiles with a modern compiler and we are blocked on
SFML 3 being available in vcpkg to fix it. There is no easy way to
backport fixes to SFML 2 so disable link for the time being.
2025-02-08 15:13:10 -08:00
Fabrice de Gans e4f17d33ce
[Sound] Set volume on game startup (#1410)
On startup, the internal emulator sound volume is set to 100%. The user
value in the wx frontend is not used until the emulator volume slider is
modified, resulting in games starting with volume at 100% on startup.

This fixes #1407 by always setting the internal emulator sound volume on
game startup.
2025-02-08 12:57:12 -08:00
Rafael Kitover 2ab707c0ca
build: update default.nix
Update default.nix to remove gcc from the macOS package set and add
clang/llvm/libcxx to the Linux package set.

Change 'epoxy' in the Linux package set to the new package name
'libepoxy'.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-02-02 09:42:05 +00:00
Rafael Kitover 4dba928765
build: update installdeps for OpenSUSE
Update `installdeps` for current OpenSUSE wxWidgets and FFmpeg packages.

Disable 32 bit cross builds in OpenSUSE because those packages are no
longer available.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-29 20:21:32 +00:00
Rafael Kitover 3d6550d161
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-25 18:00:22 +00:00
Rafael Kitover 3cf12f2594
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-15 15:00:25 +00:00
Rafael Kitover de1ec01c78
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-13 18:00:26 +00:00
Rafael Kitover 295abb9cd0
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-13 15:00:26 +00:00
Rafael Kitover 8260b62482
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-13 13:00:22 +00:00
Rafael Kitover d18c6f115f
Use faster sqrt() for xBRZ for XP builds
Use the `sqrt()` introduced in 615e5863 (Add fast-inverse SSE1 sqrt()
from Quake 3 Arena, 2025-01-12) or the xBRZ filters for Windows XP 32
bit builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-12 15:50:29 +00:00
Squall Leonhart d36f80b5e6
Add fast-inverse SSE1 sqrt() from Quake 3 Arena
Add the Quake 3 Arena fast-inverse `sqrt()` using SSE1 intrinsics to
third_party.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-12 15:50:02 +00:00
Rafael Kitover 44aa859e6d
build: add cmake var and cpp macro for XP builds
Add the WINXP CMake variable and WINXP CPP macro for MinGW 32 bit
Windows XP builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-12 15:04:14 +00:00
Rafael Kitover 5a2d3a6f95
build: set arch to pentium3 not -mmx for XP builds
Set the gcc architecture to pentium3 not pentium-mmx for Windows XP 32
bit builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-12 10:04:07 +00:00
PunkPangolin d6b939c428
Set developer id/component type in metainfo.xml
Add developer block to `metainfo.xml` with id 'visualboyadvance-m.org'.

Also set component type to 'desktop-application'.

This file is used to describe the application on Linux.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-09 20:07:45 +00:00
Rafael Kitover 8b8be7d4a8
Revert "Change domain to temporary"
This reverts commit 72364fd1a4.
2025-01-08 13:12:40 +00:00
Rafael Kitover 72364fd1a4
Change domain to temporary
Domain has expired, change links to temporary domain.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2025-01-08 13:09:49 +00:00
Rafael Kitover c6da07feb3
build: link avrt for OpenAL on WIN32
For static builds for Windows, link `avrt`, a system library that is now
required by OpenAL.

Also remove our version of `FindOpenAL.cmake` in favor of the
system-provided version.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-12-16 13:47:48 +00:00
Rafael Kitover 94979eff97
build: initialize GTest submodule in CMake
Try to initialize the GTest Git submodule from the CMake code if it has
not been.

If that fails, turn off `BUILD_TESTING`.

We do not want to require recursive clones or initializing submodules
for users by default.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-12-16 13:09:02 +00:00
Rafael Kitover e8494b56d1
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-12-13 05:08:59 +00:00
Fabrice de Gans c85397518b
[win32-deps] Update win32-deps (#1375) 2024-11-24 22:03:05 -08:00
Fabrice de Gans cf2339822d
[win32-deps] Use specific commit in submodule (#1374)
This will help make older builds reproducible.
2024-11-24 21:37:11 -08:00
Fabrice de Gans dcb9ccca90
[gtest] Use googletest as a submodule (#1373)
Some Linux distributions use a hermetic build environment to build. This
resulted in issues with `FetchContent` attempting to download googletest
at configure time.
This fixes the issue by integrating googletest as a git submodule
instead of downloading it at configure time.
2024-11-24 12:39:10 -08:00
Fabrice de Gans a8ec85d536
[GB] Add support for per-game overrides (#1370)
* [GB] Add support for per-game overrides

Alleyway is a buggy game that does not work properly when a Game Boy
Printer is connected. In order to work around this issue, this adds
upport for built-in per-software Game Boy overrides. In addition, this
renames various variables to make their meaning clearer.

* This only supports built-in overrides. External INI files are not
  supported.
* Only the Game Boy Printer option is supported, this only takes effect
  on game startup and the general configuration option is restored when
  the game is unloaded.
* As a result, it is possible to override the per-game override by
  manually setting the option while the game is running, this is working
  as intended.
* Future refactors of the option handling will manage overrides better.
* Switch `gbPrinterEnabled` default to off.

Fixes #1368
2024-11-24 12:15:26 -08:00
Rafael Kitover 611f3a3409
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-11-04 02:00:27 +00:00
Rafael Kitover b6da6c490c
translations: transifex pull
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-11-04 01:00:23 +00:00
LibretroAdmin 379dd97301
Merge pull request #119 from warmenhoven/warmenhoven/pr/old-ios-tvos
ios/tvos: properly set min supported version
2024-10-21 12:00:29 -05:00
Eric Warmenhoven 60b48a3a4a ios/tvos: properly set min supported version 2024-10-21 12:51:02 -04:00
Fabrice de Gans 9d20ce9b59
[Input] Reset keyboard tracking on focus loss (#1357)
When pressing Alt+Tab, the "Alt" and "Tab" keys were considered in the
"pressed" state until the user pressed them again because the window is
no longer receiving keyboard events. This resulted in some shortcuts no
longer working, since "Alt" was always in the pressed state. This
changes the keyboard tracking to be reset when the application loses
focus, fixing the issue.

This change also adds tests for the keyboard tracking.
2024-10-08 18:22:17 -07:00
Squall Leonhart 709a322337
cherry pick d5d01a8b68 2024-10-07 00:26:31 +11:00
Rafael Kitover cdfd37fc4e
build: rename dependencies submodule -> win32-deps
Rename the Git submodule `dependencies` used for some dependent files
for Win32 builds to `win32-deps` and make the necessary adjustments to
the CMake code.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-10-04 20:05:52 +00:00
Rafael Kitover 4f8d0a8867
build: update harfbuzz for macOS builder
Update harfbuzz in the macOS builder from the ancient version to the
current release and switch it to using Meson.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-10-03 13:50:16 +00:00
Fabrice de Gans b22e9fb709
Ignore illegal opcodes used by Wii U VC (#1351)
The Wii U VC emulator incorrectly allows for armv6 thumb instructions
(like LSRS). These cause an undefined instruction error on real hardware
but the Wii U VC emulator just ignores them. This change mimicks the Wii
U VC emulator behavior.
2024-09-29 23:13:11 -07:00
Rafael Kitover 4e2799b582
build: don't hardcode Windows certificate password
Use a file for the Windows code-signing certificate instead of
hardcoding it into the CMake code.

Update the developer manual with instructions on where to put the
Windows code-signing certificate and the file containing the password
for it.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-29 20:59:40 +00:00
Fabrice de Gans 7fa90531e6
Disable open menu tracking outside of Windows (#1350)
Tracking whether or not the menus are opened is necessary on Windows since menus stop
the main loop. This is not necessary on other platforms. In particular, on Mac, we do
not get a `wxEVT_MENU_CLOSE` event when opening a dialog from a shortcut, resulting in
the menu status tracking being incorrect.

Fixes #1348
2024-09-29 13:59:19 -07:00
Fabrice de Gans e1c2ecc584
[dialogs] Display all controls in AccelConfig on Mac (#1349)
Calling `ExpandAll()` on the `wxTreeCtrl` would cause it to display outside of its
intended view, hiding other controls. Instead, this sets a minimum size for the tree
control, so the default window size is reasonable.

Fixes #1348
2024-09-28 10:38:28 -07:00
Rafael Kitover 4c450ab360
build: fix linking FAudio statically on MINGW
Link `FAudio.a` explicitly on MINGW toolchains, for some reason linking
`FAudio` with static preference no longer works.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-19 09:22:38 +00:00
Fabrice de Gans d5e1a1f36b [GB] Properly set OPRI on startup
Previously, the OPRI register was always set to be in CGB mode when not
using the CGB BIOS, resulting in graphics corruption when running DMG
software in CGB mode without using the CGB BIOS. This fixes the issue by
properly setting bit 1 of the OPRI register as expected.

This was broken in #1119.
2024-09-17 18:52:35 -07:00
Rafael Kitover 821b9176bd
build: do not use debug libs for RelWithDebInfo
Stop trying to use debug libs for `CMAKE_BUILD_TYPE=RelWithDebInfo`,
this also fixes the current link error with SFML.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-17 18:35:39 +00:00
Rafael Kitover 9031103c9a
build: fix linking non-debug pcre for debug wx
Remove the cmake code that adds the pcre library because the wxWidgets
cmake code correctly includes it now, on both vcpkg and MSYS2.

Also fix up `wxWidgets_ROOT_DIR` and `wxWidgets_LIB_DIR` for debug
builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-15 19:53:27 +00:00
Rafael Kitover 557f897ead
build: fix using host pkgconf for ARM64 cross bld
Set `VCPKG_HOST_TRIPLET` and `VCPKG_USE_HOST_TOOLS` when using an X64
host for an ARM64 cross build in order to use the host `pkgconf` and
possibly other tools.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-15 15:47:28 +00:00
Rafael Kitover c8a4f66cf8
build: fix UpdateAppcast.cmake
Hardcode `git` instead of using `${GIT_EXECUTABLE}` which we are not
using anymore.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2024-09-15 12:50:00 +00:00
LibretroAdmin b5a4788747
Merge pull request #117 from saulfabregwiivc/ngc-fix
Fix GameCube builds of VBA-M Libretro too
2024-06-28 17:55:25 -05:00
LibretroAdmin e63acb9545
Merge pull request #118 from Ploggy/master
[WiiU] Aroma CFW Compatibility
2024-06-28 17:55:11 -05:00
Ploggy 1c7db77192
Update WiiU Makefile More 2024-06-18 13:46:09 +01:00
Ploggy 02f3bd6765
Update WiiU Makefile 2024-06-18 13:43:25 +01:00
saulfabreg Wii VC Project 3c16671e39 Fix GameCube builds of VBA-M Libretro too
GameCube is a big-endian system too, so let's fix it too and include it on the nightly buildbot for GCN.
2023-08-18 15:51:12 -05:00
451 changed files with 80698 additions and 36068 deletions

View File

@ -20,7 +20,7 @@ body:
- type: markdown - type: markdown
attributes: attributes:
value: | value: |
Please try to troubleshoot using the information on this page:h ttps://wiki.archlinux.org/index.php/Gamepad **BEFORE** filing an issue. Please try to troubleshoot using the information on this page: https://wiki.archlinux.org/index.php/Gamepad **BEFORE** filing an issue.
We use SDL for joystick support, any problems will generally be an issue with SDL and **NOT** the emulator. We use SDL for joystick support, any problems will generally be an issue with SDL and **NOT** the emulator.
If relevant, the joystick you are using and the drivers you are using for it: If relevant, the joystick you are using and the drivers you are using for it:
- type: textarea - type: textarea
@ -46,7 +46,7 @@ body:
attributes: attributes:
label: Steps to reproduce the problem label: Steps to reproduce the problem
description: "How do you trigger this bug? Please walk us through it step by step." description: "How do you trigger this bug? Please walk us through it step by step."
value: | placeholder: |
1. 1.
2. 2.
3. 3.
@ -81,29 +81,76 @@ body:
Clean, Intro'd or Hacked?:(Attach Patch here) Clean, Intro'd or Hacked?:(Attach Patch here)
validations: validations:
required: false required: false
- type: textarea - type: markdown
id: Settings
attributes: attributes:
label: What settings are you using? value: "### Emulator Settings\nList the settings you are using."
description: "Please list them" - type: input
value: | id: Video_Driver
Video driver (simple, opengl): attributes:
Sound driver (directsound, xaudio, openal, SDL): label: Video Driver
Scale Filter Used?: description: "Specify which video driver you're using (e.g., Simple, OpenGL)."
validations: validations:
required: true required: true
- type: textarea - type: input
id: SysInfo id: Sound_Driver
attributes: attributes:
label: Specifications and Build details label: Sound Driver
description: "List your system information, you can obtain this from MSINFO32 and the emulators Titlebar." description: "Specify which sound driver you're using (e.g., DirectSound, XAudio, OpenAL, SDL)."
value: | validations:
VBA-M: (include commit version number and whether you are using the 32-bit or 64-bit version) required: true
OS: (include version and OS build number using WinVer if on Windows): - type: input
If using Linux, specify if using xorg or Wayland: id: Scale_Filter
CPU: attributes:
GPU: label: Scale Filter
RAM: description: "Specify which scale filter you are using."
validations:
required: true
- type: markdown
attributes:
value: "### Specifications and Build Details\nList your system information, you can obtain this from MSINFO32 and the emulator's Titlebar."
- type: input
id: VBA-M
attributes:
label: VBA-M Version
description: "Include commit version number and whether you are using the 32-bit or 64-bit version."
validations:
required: true
- type: input
id: OS
attributes:
label: Operating System
description: "Include version and OS build number using WinVer if on Windows."
validations:
required: true
- type: dropdown
id: Linux_Display_Server
attributes:
label: Linux Display Server
description: "Specify whether using Xorg or Wayland."
options:
- Xorg
- Wayland
validations:
required: false
- type: input
id: CPU
attributes:
label: CPU Model
description: "Provide details of your CPU model."
validations:
required: true
- type: input
id: GPU
attributes:
label: GPU Model
description: "Provide details of your GPU model."
validations:
required: true
- type: input
id: RAM
attributes:
label: RAM Size
description: "Specify the amount of RAM installed."
validations: validations:
required: true required: true
- type: checkboxes - type: checkboxes

View File

@ -5,7 +5,8 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
target_name: [ngc, wii, wiiu, switch] # target_name: [ngc, wii, wiiu, switch]
target_name: [ngc, wii, wiiu]
build_type: [release, debug] build_type: [release, debug]
include: include:
- libretro_build: 'DEBUG=0' - libretro_build: 'DEBUG=0'
@ -18,8 +19,8 @@ jobs:
target_name: wii target_name: wii
- devkit_container: 'devkitpro/devkitppc:latest' - devkit_container: 'devkitpro/devkitppc:latest'
target_name: wiiu target_name: wiiu
- devkit_container: 'devkitpro/devkita64:latest' # - devkit_container: 'devkitpro/devkita64:latest'
target_name: switch # target_name: switch
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ${{ matrix.devkit_container }} container: ${{ matrix.devkit_container }}
steps: steps:

View File

@ -7,7 +7,8 @@ jobs:
matrix: matrix:
build_compiler: [gcc, clang] build_compiler: [gcc, clang]
build_type: [release, debug] build_type: [release, debug]
build_options: [default, link_off, translations_only, libretro] # build_options: [default, link_off, translations_only, libretro]
build_options: [default, link_off, translations_only]
include: include:
- cmake_compiler: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++' - cmake_compiler: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++'
build_compiler: gcc build_compiler: gcc
@ -21,12 +22,12 @@ jobs:
build_options: link_off build_options: link_off
- cmake_options: '-DTRANSLATIONS_ONLY=ON' - cmake_options: '-DTRANSLATIONS_ONLY=ON'
build_options: translations_only build_options: translations_only
- libretro_build: 'DEBUG=0' # - libretro_build: 'DEBUG=0'
build_type: release # build_type: release
build_options: libretro # build_options: libretro
- libretro_build: 'DEBUG=1' # - libretro_build: 'DEBUG=1'
build_type: debug # build_type: debug
build_options: libretro # build_options: libretro
exclude: exclude:
# Exclude debug/translations_only build # Exclude debug/translations_only build
- build_type: debug - build_type: debug
@ -42,8 +43,13 @@ jobs:
submodules: recursive submodules: recursive
- name: Install Dependencies - name: Install Dependencies
run: >- run: |
bash installdeps; if [ "${{ matrix.build_compiler }}" = clang ]; then sudo apt -y install clang; fi sudo add-apt-repository ppa:hrzhu/sdl3-backport
sudo apt update
bash installdeps
if [ "${{ matrix.build_compiler }}" = clang ]; then
sudo apt -y install clang
fi
- name: Install xvfb - name: Install xvfb
run: sudo apt -y install xvfb run: sudo apt -y install xvfb
@ -61,9 +67,9 @@ jobs:
run: sudo ninja -C build install run: sudo ninja -C build install
# Libretro build # Libretro build
- if: matrix.build_options == 'libretro' # - if: matrix.build_options == 'libretro'
name: Build libretro core # name: Build libretro core
run: make -C src/libretro ${{ matrix.libretro_build }} # run: make -C src/libretro ${{ matrix.libretro_build }}
# Run tests # Run tests
- if: matrix.build_options == 'default' - if: matrix.build_options == 'default'

3
.gitignore vendored
View File

@ -17,3 +17,6 @@ compile_commands.json
# mac finder crap # mac finder crap
*.DS_Store *.DS_Store
# online updates header
src/wx/winsparkle-path.h

10
.gitmodules vendored
View File

@ -1,4 +1,6 @@
[submodule "dependencies"] [submodule "win32-deps"]
path = dependencies path = win32-deps
url = https://github.com/visualboyadvance-m/dependencies.git url = https://github.com/visualboyadvance-m/win32-deps.git
branch = master [submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git

View File

@ -4,6 +4,136 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [2.2.2] - 2025-07-30
========================
* 27acf80b - Make language configurable (requires restart) [andyvand]
* ae09ab71 - Embed translations for Windows [andyvand]
* 47a8e7e8 - Update wxWidgets for Mac builder to 3.3.1 [andyvand]
* 8ce4848d - Fix Wii U VC opcodes [andyvand]
* dab91fc8 - Fix bigger than 32MB ROM files [andyvand]
## [2.2.1] - 2025-07-19
=======================
* 23a3d0b2 - build: fix include paths for bundled SFML [rkitover]
* 53f5ec7b - build: fix building with OpenAL enabled [rkitover]
* 3ffbe781 - translations: remove ja_JP, 0% and ja exists [rkitover]
* ae8bfb4a - Several fixes for windows [danialhorton]
* bbaf70c0 - build: fix slow CMake vcpkg startup time [rkitover]
* dca11990 - Fix GBA sound [andyvand]
* 357eccc6 - build: fix checking if bin pkg host deps installed [rkitover]
* d0463ddb - Initial tar support [andyvand]
* a808cfb6 - Update macOS plist [andyvand]
* 604f5412 - Add LZIP support [andyvand]
* 6fedbdc5 - Add .xz support [andyvand]
* 0c91d456 - Add .bz2 file support [andyvand]
* 3e0541c6 - Update unrar to V7.1.8 [andyvand]
* 00e48e11 - Fix RAR support [andyvand]
* 3d8ed512 - Use macOS 10.10 Sparkle [andyvand]
## [2.2.0] - 2025-07-08
========================
* 865add06 - Adjust throttle limit 450 -> 1000 [rkitover]
* 20db9889 - Add dark mode support [andyvand]
* fac5d565 - build: use vcpkg host pkgconf when cross compiling [rkitover]
* 5702bc51 - build: fix x64-mingw-static for MSYS2 CLANG64 [rkitover]
* 5745ed3d - Use external libwebp and use built pcre2 [andyvand]
* 5f866f85 - Revert beeping fix and fix again the previous way [andyvand]
* 8002f91c - Fix save dialog [andyvand]
* cc2bda69 - build: inst host deps for bins only if not [rkitover]
* d7c6eb81 - Fix MinGW FFMpeg [andyvand]
* 43a6a90a - Fix FFMPEG for macOS [andyvand]
* 54f56fc9 - Fix libx265 build for macOS [andyvand]
* 31cfe304 - Fix MinGW compile with title of DX9 window [andyvand]
* 2c17201c - Separate window for SDL direct3d9 with background input [andyvand]
* 6f5c785a - build: add x264+x265 for ffmpeg for macOS [rkitover]
* 05d18184 - build: rm FindFFmpeg for distro ver, fix x264/x265 [rkitover]
* 856abf80 - build: add option VCPKG_BINARY_PACKAGES [rkitover]
* e8d4adaf - build: always use pwsh vcpkg-list [rkitover]
* 50aa85d9 - build: update vcpkg ports list, drop gettext [rkitover]
* ce7aa3fa - Fix FAudio crash on Windows debug [andyvand]
* 4ba7796d - Fix FAudio crash on MSVC [andyvand]
* 83707cf5 - Fix Direct3D9 [andyvand]
* b82e7a3b - Update wxvbam.rc [andyvand]
* f0a30d45 - build: fix installing host build dep bin pkgs [rkitover]
* 70d6a1ac - Make Sparkle framework optional [andyvand]
* 77f49ac6 - Clean up WinSparkle code [andyvand]
* e40c1e71 - Update macOS Sparkle [andyvand]
* 8579e192 - Check for kInputBufSize [andyvand]
* e64a8b69 - Update 7z_C to 2409 and update extractor [andyvand]
* c31499ca - Fix winsparkle dependency and update win32-deps to latest push [andyvand]
* 41895eea - Add option not to update vcpkg builds [andyvand]
* 05f2cb7d - Fix auto updates [andyvand]
* 61be54d3 - build: avoid using VS vcpkg with elevation [rkitover]
* 5e2e2ab4 - Add MinGW WinSparkle support [andyvand]
* 2c2ee701 - build: minor improvements to the Mac builder [rkitover]
* 3c048f17 - Add alert sound on macOS fix [andyvand]
* 830c8ccd - Add x264 and x265 to ffmpeg [andyvand]
* 8ced18c2 - build: make OpenAL-Soft optional again [rkitover]
* 31ce5d17 - CoreAudio fix [andyvand]
* ac0dc482 - Fix SDL3 detection [andyvand]
* 5b9a26ba - build: make some minor CMake improvements [rkitover]
* 9712c424 - build: make some minor fixes to Mac builder [rkitover]
* 12f2d88c - Update versions on macOS build script [andyvand]
* 79d34535 - Implement CoreAudio driver [andyvand]
* 34e46945 - build: generalize linking openal-soft to libfmt [rkitover]
* 5529797f - Set directory path for generic file dialog [andyvand]
* bd0a59cc - ci: fix shell syntax for Ubuntu runner [rkitover]
* d2762a95 - ci: add libsdl3-dev for Ubuntu runner [rkitover]
* 1c436f2d - Add MSVC secure library functions [andyvand]
* 8f47df28 - Add entitlements file for sandboxing [andyvand]
* db5c890e - Add option for generic file dialogs [andyvand]
* 7dbad8e8 - translations: transifex pull [rkitover]
* d3da0492 - Update nixpkgs for SDL3 [andyvand]
* ef46bb7e - build: in installdeps for SUSE s/libSDL3/SDL3/ [rkitover]
* a3b92a33 - build: update installdeps to SDL3 [rkitover]
* 2f92dd73 - Add MSVC 2022 libretro support [andyvand]
* 07c7bb40 - Fix AVCodec deprecations and fix warnings [andyvand]
* ed013bd2 - Fix SFML deprecations and fix SFML warnings [andyvand]
* 116af5c6 - build: replace sdl2 vcpkg port with sdl3 [rkitover]
* 1788b366 - build: default ENABLE_SDL3=ON in CMake [rkitover]
* 0820ba58 - BUILDER: Updated core.sh source packages required to build vba-m [zachbacon]
* f975809e - Update to SDL3 APIs, fix bpps, add SDL audio/video, add Metal video, fix Quartz drawing [andyvand]
* 18c3c3bd - build: fix link error on MSVC for SFML port [andyvand]
* 0aecfb5d - build: make minor improvements to the Mac builder [rkitover]
* dae4397d - build: lower bundled SFML C++17 to C++14 [rkitover]
* 4cf6cccb - build: bundle SFML 3.x sys/network in third_party [rkitover]
* 9e724ea4 - build: support building ARM64 binary for Mac [rkitover]
* eb26ec2e - Enable Hide Status Bar in UI Settings for macOS [rkitover]
* 6a9eeeae - core.sh Switched to github source for nasm [zachbacon]
* 9f628584 - initialize sound_buffer_len_ to silence a warning. [danialhorton]
* e5ad7b34 - build: find_package(nanosvg) w/ vcpkg [rkitover]
* 94752f83 - [FAudio]Correct the behavior of device_changed check [danialhorton]
* 8936feaa - build: add libtiff to Nix derivation [rkitover]
* f93a32ab - build: add libtiff to brews on macOS [rkitover]
* 3fa850c1 - build: capitalize ARCH_NAME in CMake [rkitover]
* 364776b8 - build: s/-Ofast/-O3 -ffast-math/ [rkitover]
* 61394282 - translations: remove dup Chinese translations [rkitover]
* 29e85e5d - build: update Link SFML usage to SFML 3.x APIs [rkitover]
* e2283946 - [Input] Process key down event for some controls [steelskin]
* 3fdc30f7 - Mark `wxEVT_KEY_DOWN` as processed in `wxvbamApp` (#1424) [Steelskin]
* 2de7efd9 - Reallocate GBA ROM to the new size(#1422) [danialhorton]
* e4f17d33 - [Sound] Set volume on game startup (#1410) [Steelskin]
* 2ab707c0 - build: update default.nix [rkitover]
* 4dba9287 - build: update installdeps for OpenSUSE [rkitover]
* 44aa859e - build: add cmake var and cpp macro for XP builds [rkitover]
* 5a2d3a6f - build: set arch to pentium3 not -mmx for XP builds [rkitover]
* d6b939c4 - Set developer id/component type in metainfo.xml [116445585+PunkPangolin]
* c6da07fe - build: link avrt for OpenAL on WIN32 [rkitover]
* 94979eff - build: initialize GTest submodule in CMake [rkitover]
* dcb9ccca - [gtest] Use googletest as a submodule (#1373) [Steelskin]
* a8ec85d5 - [GB] Add support for per-game overrides (#1370) [Steelskin]
* 9d20ce9b - [Input] Reset keyboard tracking on focus loss (#1357) [Steelskin]
* cdfd37fc - build: rename dependencies submodule -> win32-deps [rkitover]
* 4f8d0a88 - build: update harfbuzz for macOS builder [rkitover]
* b22e9fb7 - Ignore illegal opcodes used by Wii U VC (#1351) [Steelskin]
* 7fa90531 - Disable open menu tracking outside of Windows (#1350) [Steelskin]
* e1c2ecc5 - [dialogs] Display all controls in AccelConfig on Mac (#1349) [Steelskin]
* 4c450ab3 - build: fix linking FAudio statically on MINGW [rkitover]
* d5e1a1f3 - [GB] Properly set OPRI on startup [steelskin]
* 821b9176 - build: do not use debug libs for RelWithDebInfo [rkitover]
* 9031103c - build: fix linking non-debug pcre for debug wx [rkitover]
## [2.1.11] - 2024-09-15 ## [2.1.11] - 2024-09-15
========================== ==========================

View File

@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
cmake_policy(VERSION 3.19...3.28.3) cmake_policy(VERSION 3.19...3.28.3)
# Use new link library de-duplication behavior.
cmake_policy(SET CMP0156 NEW)
cmake_policy(SET CMP0179 NEW)
# cmake_policy(SET CMP0181 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
if(WIN32) if(WIN32)
@ -22,11 +27,15 @@ if(TAG_RELEASE)
include(MakeReleaseCommitAndTag) include(MakeReleaseCommitAndTag)
endif() endif()
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext wxwidgets) option(VCPKG_BINARY_PACKAGES "Use vcpkg binary packages" TRUE)
set(VCPKG_DEPS zlib bzip2 "liblzma[tools]" pthreads gettext-libintl wxwidgets nanosvg)
set(VCPKG_DEPS_OPTIONAL set(VCPKG_DEPS_OPTIONAL
sfml ENABLE_LINK "sdl3[vulkan]" ENABLE_SDL3
ffmpeg ENABLE_FFMPEG "sdl2[samplerate]" ENABLE_SDL2
openal-soft ENABLE_OPENAL
"ffmpeg[x264,x265]" ENABLE_FFMPEG
faudio ENABLE_FAUDIO faudio ENABLE_FAUDIO
) )
@ -52,7 +61,7 @@ if(GIT_FOUND AND WIN32)
# Win32 deps submodule # Win32 deps submodule
set(SUBMODULE_MANUAL_UPDATE FALSE) set(SUBMODULE_MANUAL_UPDATE FALSE)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include") if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
set(SUBMODULE_MANUAL_UPDATE TRUE) set(SUBMODULE_MANUAL_UPDATE TRUE)
execute_process( execute_process(
COMMAND "${GIT_EXECUTABLE}" submodule update --init --remote --recursive COMMAND "${GIT_EXECUTABLE}" submodule update --init --remote --recursive
@ -61,7 +70,7 @@ if(GIT_FOUND AND WIN32)
) )
endif() endif()
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include") if(NOT EXISTS "${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
if(NOT (SUBMODULE_MANUAL_UPDATE AND SUBMODULE_UPDATE_STATUS EQUAL 0)) if(NOT (SUBMODULE_MANUAL_UPDATE AND SUBMODULE_UPDATE_STATUS EQUAL 0))
message(FATAL_ERROR "Please pull in git submodules, e.g.\nrun: git submodule update --init --remote --recursive") message(FATAL_ERROR "Please pull in git submodules, e.g.\nrun: git submodule update --init --remote --recursive")
endif() endif()
@ -75,6 +84,25 @@ set(CMAKE_C_STANDARD_REQUIRED True)
project(VBA-M C CXX) project(VBA-M C CXX)
if(APPLE)
include(CheckLanguage)
include(MetalShaderSupport)
execute_process(
COMMAND xcrun -f metal
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE CMAKE_Metal_COMPILER
)
if(NOT CMAKE_Metal_COMPILER)
check_language(Metal)
endif()
if(CMAKE_Metal_COMPILER)
enable_language(Metal)
endif()
endif()
include(CTest) include(CTest)
include(FetchContent) include(FetchContent)
include(GNUInstallDirs) include(GNUInstallDirs)
@ -83,6 +111,11 @@ include(Options)
include(Toolchain) include(Toolchain)
include(Dependencies) include(Dependencies)
# We target Windows XP for 32 bit Windows builds.
if(WIN32 AND X86)
add_compile_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501)
endif()
# Disable tests when not in a git checkout. # Disable tests when not in a git checkout.
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git") if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(BUILD_TESTING OFF) set(BUILD_TESTING OFF)
@ -90,15 +123,22 @@ endif()
# Configure gtest # Configure gtest
if(BUILD_TESTING) if(BUILD_TESTING)
FetchContent_Declare(googletest
URL https://github.com/google/googletest/archive/2d16ed055d09c3689d44b272adc097393de948a0.zip
EXCLUDE_FROM_ALL
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest) set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
if(NOT EXISTS third_party/googletest/CMakeLists.txt)
execute_process(
COMMAND git submodule update --init --recursive -- third_party/googletest
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()
if(EXISTS third_party/googletest/CMakeLists.txt)
add_subdirectory(./third_party/googletest)
include(GoogleTest) include(GoogleTest)
else()
set(BUILD_TESTING OFF)
endif()
endif() endif()
if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL ""))) if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
@ -111,11 +151,6 @@ elseif(NOT CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}', must be one of: 'Release', 'Debug', 'RelWithDebInfo' or 'MinSizeRel'") message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}', must be one of: 'Release', 'Debug', 'RelWithDebInfo' or 'MinSizeRel'")
endif() endif()
# Link debug libs for RelWithDebInfo
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Debug")
endif()
set(MSYS OFF) set(MSYS OFF)
if(NOT "$ENV{MSYSTEM_PREFIX}" STREQUAL "") if(NOT "$ENV{MSYSTEM_PREFIX}" STREQUAL "")
set(MSYS ON) set(MSYS ON)
@ -183,6 +218,16 @@ set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
if(NOT TRANSLATIONS_ONLY) if(NOT TRANSLATIONS_ONLY)
add_subdirectory(third_party/include/nonstd) add_subdirectory(third_party/include/nonstd)
add_subdirectory(third_party/include/stb) add_subdirectory(third_party/include/stb)
add_subdirectory(third_party/include/ghc)
if(ENABLE_LINK)
include_directories(third_party/sfml/include)
add_subdirectory(third_party/sfml/src/SFML/System EXCLUDE_FROM_ALL)
add_subdirectory(third_party/sfml/src/SFML/Network EXCLUDE_FROM_ALL)
set(SFML_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/sfml/include)
set(SFML_LIBRARIES sfml-system sfml-network)
endif()
add_subdirectory(src/core) add_subdirectory(src/core)
add_subdirectory(src/components) add_subdirectory(src/components)
add_subdirectory(src/sdl) add_subdirectory(src/sdl)
@ -196,5 +241,5 @@ set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_PACKAGE_VERSION_MAJOR "2") set(CPACK_PACKAGE_VERSION_MAJOR "2")
set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0-Git-${COMMITHASH}") set(CPACK_PACKAGE_VERSION_PATCH "0-Git-${COMMITHASH}")
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/dependencies") list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/win32-deps")
include(CPack) include(CPack)

View File

@ -33,6 +33,8 @@ setup guides.
Follow the following steps to process newly submitted issues: Follow the following steps to process newly submitted issues:
- Edit the user's post to remove any links to illegal content such as ROM files.
- Edit the user's post to remove unused template sections etc.. Rephrase the - Edit the user's post to remove unused template sections etc.. Rephrase the
issue title if it needs to be clarified. issue title if it needs to be clarified.
@ -48,13 +50,13 @@ Follow the following steps to process newly submitted issues:
#### Resolving Issues #### Resolving Issues
- An issue is resolved by closing it in github. A commit that fixes the issue - An issue is resolved by closing it in GitHub. A commit that fixes the issue
should have the following line near the end of the body of the commit message: should have the following line near the end of the body of the commit message:
``` ```
Fix #999. Fix #999.
``` ```
This will automatically close the issue and assign the closing commit in the This will automatically close the issue and assign the closing commit in the
github metadata when it is merged to master. The issue can be reopened if GitHub metadata when it is merged to master. The issue can be reopened if
needed. needed.
- A commit that is work towards resolving an issue, should have the issue number - A commit that is work towards resolving an issue, should have the issue number
@ -83,13 +85,8 @@ A commit message must always have a title and a description, the description
must be independent of the title line, if necessary repeat the information in must be independent of the title line, if necessary repeat the information in
the title line in the description. the title line in the description.
Make sure the git history in your branch is clean and logical, edit when The commit message must **ALL** changes, unless it's a minor refactor or
necessary with `rebase -i`. white space change or something and is not important.
Use one commit per logical change if necessary, most work can be squashed into
one commit when you are done. It is not necessary to have separate commits
per-file if they are one logical change. We are less strict about this than
other projects, fewer is better.
The commit title line should be prefixed with an area, unless it involves the The commit title line should be prefixed with an area, unless it involves the
wxWidgets GUI app, in which case it should **NOT** have a prefix. wxWidgets GUI app, in which case it should **NOT** have a prefix.
@ -102,14 +99,15 @@ The text after the area prefix should not be capitalized.
Please use one of these area prefixes for non-main-GUI-app commits: Please use one of these area prefixes for non-main-GUI-app commits:
- doc: documentation, README.md etc. - doc: documentation, README.md etc..
- build: cmake, installdeps, preprocessor compatibility defines, compatibility - build: CMake, installdeps, preprocessor compatibility defines, compatibility
headers, etc. headers, macOS build system etc..
- gb: the GameBoy emulator core - gb: the GameBoy emulator core or changes related to it.
- gba: the GameBoy Advance emulator core - gba: the GameBoy Advance emulator core or changes related to it.
- libretro: the libretro core glue and build - libretro: the libretro core glue and build.
- sdl: anything for the SDL port - sdl: anything for the SDL port, but **NOT** SDL functionality in the wxWidgets
- translations: anything related to translations GUI app.
- translations: anything related to translations.
. Add other areas here if needed. . Add other areas here if needed.
@ -118,21 +116,85 @@ If a commit fixes a regression, use a title line such as:
```console ```console
Fix regression <PROBLEM> in <SHORT-SHA> Fix regression <PROBLEM> in <SHORT-SHA>
``` ```
, you can get the short sha from `git log --oneline -100` or similar. , you can get the short SHA from `git log --oneline -100` or similar.
The commit description for a regression must refer to the breaking change in The commit description for a regression must refer to the breaking change in
reference format, which you can get from e.g. `git log --format=reference -20`. reference format, which you can get from e.g. `git log --format=reference -20`.
You can refer to github issues using `#<ISSUE-NUMBER>` freely in the description #### Working on Pull Requests
text.
If a commit fixes an issue, add a line at the end of the description such as: When opening a pull request, push your branch to our repository if you were
given access, or a branch in your fork if you have not yet been given access. Do
**NOT** use `master`, use a specific branch.
```console If you are using a fork, set up your workflow like this:
Fix #<ISSUE-NUMBER>.
```bash
git clone git@github.com:visualboyadvance-m/visualboyadvance-m
git remote add fork git@github.com:<your-GitHub-user>/visualboyadvance-m
git fetch --all --prune
git checkout -b your-work-branch-name
git commit -a --verbose --signoff -S
``` ```
. .
The `-S` flags tells Git to sign your commit with GnuPG. If you do not have a
GnuPG key, you will need to create one and upload it to a keyserver. I recommend
removing the password on your private key to not deal with `gpg-agent` and all
of this stuff.
All of this works fine on Windows, just install `GnuPG.GnuPG` from WinGet.
Your first push will then be:
```bash
git push -u fork HEAD
```
.
Subsequent commits will then be:
```bash
git commit -a --verbose --amend --reset-author --signoff -S
git push -f
```
. If you are a project member, then the workflow will be roughly:
```bash
git clone git@github.com:visualboyadvance-m/visualboyadvance-m
git fetch --all --prune
git checkout -b your-work-branch-name
git commit -a --verbose --signoff -S
```
. Your first push will be:
```bash
git push -u origin HEAD
```
. And subsequent pushes will be:
```bash
git commit -a --verbose --signoff -S --amend --reset-author
git push -f
```
. Please push frequently so that we can track your progress and review it.
Make sure the git history in your branch is clean and logical, edit when
necessary with `rebase -i`. In most cases a single commit with all of the
changes will be good. Sometimes you may want to split it up into multiple
logical commits for a large work, but a single commit is also fine if the title
line encapsulates all of the work for the changelog.
See the previous section on how to write commit messages.
If you are using Windows as your development environment, I recommend reading my
manual on Windows development environments
[here](https://github.com/rkitover/windows-dev-guide).
#### Collaboration on a Branch #### Collaboration on a Branch
To update when multiple people are working on a git branch, keep a couple of To update when multiple people are working on a git branch, keep a couple of
@ -142,23 +204,32 @@ things in mind:
better to edit the history than to add more commits. Never add commits fixing better to edit the history than to add more commits. Never add commits fixing
previous commits, only improving or adding to them. previous commits, only improving or adding to them.
- To update when someone else updated the branch with a `push -f` - To update when someone else updated the branch with a `git push -f`:
```bash ```bash
git status # should be clean, with your work having been already pushed git status # should be clean, with your work having been already pushed
git fetch --all --prune git fetch --all --prune
git reset --hard origin/<branch-name> git reset --hard origin/<work-branch-name>
``` ```
. .
- While actively working on a branch, keep it rebased on top of master. - While actively working on a branch, keep it rebased on top of master, like
this:
#### Commits from Maintainers ```bash
git fetch --all --prune
git rebase origin/master
git push -f
```
. You may sometimes need to fix conflicts, follow the instructions.
#### Commits from Admins
Maintainers and project members have the power to commit directly to master. Maintainers and project members have the power to commit directly to master.
This power must be used responsibly. This power must be used responsibly.
Make your best attempt to follow these general guidelines to keep our Make your best attempt to follow these general guidelines:
history clean:
- Things that are a minor fix or improvement that does not require discussion - Things that are a minor fix or improvement that does not require discussion
can be committed directly, keeping the following guidelines in mind. can be committed directly, keeping the following guidelines in mind.
@ -166,19 +237,34 @@ history clean:
- Bigger new features, code refactors and changes in architecture should go - Bigger new features, code refactors and changes in architecture should go
through the PR process. through the PR process.
- Absolutely **NEVER** `git push -f` on `master`. If you make a mistake, revert
or push a fix commit.
- Push code changes to a branch first, so they can run through the CI. When you - Push code changes to a branch first, so they can run through the CI. When you
open the commit in GitHub there is a little icon in the upper left corner that open the commit in GitHub there is a little icon in the upper left corner that
shows the CI status for this commit. Differences in what different compilers shows the CI status for this commit. Differences in what different compilers
allow is a problem that comes up **VERY** frequently. As well as allow is a problem that comes up **VERY** frequently. As well as
incompatibilities between different configurations for both the C++ code and incompatibilities between different configurations for both the C++ code and
any supporting code. any supporting code. Once the CI is clear, you can merge your branch like
this:
```bash
git push -f
git checkout master
git merge --ff-only <your-work-branch-name>
git push
git branch -D <your-work-branch-name>
git push origin ':refs/heads/your-work-branch-nbame'
```
. The last line there deletes the branch in our repository.
### Miscellaneous ### Miscellaneous
#### Debug Messages #### Debug Messages
We have an override for `wxLogDebug()` to make it work even in non-debug builds We have an override for `wxLogDebug()` to make it work even in non-debug builds
of wx and on windows, even in mintty. of wxWidgets and on windows, even in mintty.
It works like `printf()`, e.g.: It works like `printf()`, e.g.:
@ -195,7 +281,7 @@ fprintf(stderr, "...", ...);
, will work fine. , will work fine.
You need a debug build for this to work or to even have a console on Windows. You need a debug build for this to work or to even have a console on Windows.
Pass `-DCMAKE_BUILD_TYPE=Debug` to cmake. Pass `-DCMAKE_BUILD_TYPE=Debug` to CMake.
### Release Process ### Release Process
@ -212,6 +298,10 @@ and tags.
Make sure you have set up a Windows code signing certificate with the right Make sure you have set up a Windows code signing certificate with the right
password and a Mac 'Developer ID Application' certificate. password and a Mac 'Developer ID Application' certificate.
Put the Windows certificate into `~/.codesign/windows_comodo.pkcs12` as a PKCS12
file that is password protected, and put the password for it into
`~/.codesign/windows_comodo.pkcs12.password`.
#### Release Commit and Tag #### Release Commit and Tag
Once you are sure you're ready to release, and you are in a git clone on master Once you are sure you're ready to release, and you are in a git clone on master

View File

@ -166,8 +166,7 @@ And the following development libraries:
- [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording) - [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording)
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools - [gettext](https://www.gnu.org/software/gettext/) and gettext-tools
- [SDL2](https://www.libsdl.org/) (required) - [SDL2](https://www.libsdl.org/) (required)
- [SFML](https://www.sfml-dev.org/) (optional, for link) - [openal-soft](https://kcat.strangesoft.net/openal.html) (optional, a sound interface)
- [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported) - [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
On Linux and similar, you also need the version of GTK your wxWidgets is linked On Linux and similar, you also need the version of GTK your wxWidgets is linked
@ -211,12 +210,13 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LINK=NO -G Ninja
| `ENABLE_ASM` | Enable the following two ASM options | ON for 32 bit builds | | `ENABLE_ASM` | Enable the following two ASM options | ON for 32 bit builds |
| `ENABLE_ASM_SCALERS` | Enable x86 ASM graphic filters | ON for 32 bit builds | | `ENABLE_ASM_SCALERS` | Enable x86 ASM graphic filters | ON for 32 bit builds |
| `ENABLE_MMX` | Enable MMX | ON for 32 bit builds | | `ENABLE_MMX` | Enable MMX | ON for 32 bit builds |
| `ENABLE_LINK` | Enable GBA linking functionality (requires SFML) | AUTO | | `ENABLE_LINK` | Enable GBA linking functionality | AUTO |
| `ENABLE_LIRC` | Enable LIRC support | OFF | | `ENABLE_LIRC` | Enable LIRC support | OFF |
| `ENABLE_FFMPEG` | Enable ffmpeg A/V recording | AUTO | | `ENABLE_FFMPEG` | Enable ffmpeg A/V recording | AUTO |
| `ENABLE_ONLINEUPDATES` | Enable online update checks | ON | | `ENABLE_ONLINEUPDATES` | Enable online update checks | ON |
| `ENABLE_LTO` | Compile with Link Time Optimization (gcc and clang only) | ON for release build | | `ENABLE_LTO` | Compile with Link Time Optimization (gcc and clang only) | ON for release build |
| `ENABLE_GBA_LOGGING` | Enable extended GBA logging | ON | | `ENABLE_GBA_LOGGING` | Enable extended GBA logging | ON |
| `ENABLE_OPENAL` | Enable openal-soft sound output for wxWidgets | ON, not 32 bit Win |
| `ENABLE_XAUDIO2` | Enable xaudio2 sound output for wxWidgets (Windows only) | ON | | `ENABLE_XAUDIO2` | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
| `ENABLE_FAUDIO` | Enable faudio sound output for wxWidgets, | ON, not 32 bit Win | | `ENABLE_FAUDIO` | Enable faudio sound output for wxWidgets, | ON, not 32 bit Win |
| `ENABLE_ASAN` | Enable libasan sanitizers (by default address, only in debug mode) | OFF | | `ENABLE_ASAN` | Enable libasan sanitizers (by default address, only in debug mode) | OFF |
@ -224,7 +224,6 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LINK=NO -G Ninja
| `BUILD_TESTING` | Build the tests and enable ctest support. | ON | | `BUILD_TESTING` | Build the tests and enable ctest support. | ON |
| `VBAM_STATIC` | Try link all libs statically (the following are set to ON if ON) | OFF | | `VBAM_STATIC` | Try link all libs statically (the following are set to ON if ON) | OFF |
| `SDL2_STATIC` | Try to link static SDL2 libraries | OFF | | `SDL2_STATIC` | Try to link static SDL2 libraries | OFF |
| `SFML_STATIC_LIBRARIES` | Try to link static SFML libraries | OFF |
| `FFMPEG_STATIC` | Try to link static ffmpeg libraries | OFF | | `FFMPEG_STATIC` | Try to link static ffmpeg libraries | OFF |
| `OPENAL_STATIC` | Try to link static OpenAL libraries | OFF | | `OPENAL_STATIC` | Try to link static OpenAL libraries | OFF |
| `TRANSLATIONS_ONLY` | Build only the translations.zip and nothing else | OFF | | `TRANSLATIONS_ONLY` | Build only the translations.zip and nothing else | OFF |

View File

@ -31,6 +31,15 @@ elseif(VCPKG_TARGET_TRIPLET MATCHES "^[aA][rR][mM]-")
set(CMAKE_SYSTEM_PROCESSOR ARM) set(CMAKE_SYSTEM_PROCESSOR ARM)
endif() endif()
if(APPLE AND
(CMAKE_OSX_ARCHITECTURES MATCHES "[xX]86_64") OR
(ENV{CFLAGS} MATCHES "[xX]86_64") OR
(ENV{CXXFLAGS} MATCHES "[xX]86_64") OR
(ENV{LDFLAGS} MATCHES "[xX]86_64"))
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
endif()
# Turn asm on by default on 32bit x86 and set WINARCH for windows stuff. # Turn asm on by default on 32bit x86 and set WINARCH for windows stuff.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64") if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
@ -46,22 +55,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
set(WINARCH x64) set(WINARCH x64)
set(ARCH_NAME x86_64) set(ARCH_NAME x86_64)
endif() endif()
if(DEFINED VCPKG_TARGET_TRIPLET)
string(REGEX MATCH "^x[86][64]" target_arch ${VCPKG_TARGET_TRIPLET})
if(NOT WINARCH STREQUAL target_arch)
message(FATAL_ERROR "Wrong build environment architecture for VCPKG_TARGET_TRIPLET, you specified ${target_arch} but your compiler is for ${WINARCH}")
endif()
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
set(ARM32 ON) set(ARM32 ON)
set(ARCH_NAME arm32) set(ARCH_NAME ARM32)
set(WINARCH arm) set(WINARCH arm)
elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
set(ARM64 ON) set(ARM64 ON)
set(ARCH_NAME arm64) set(ARCH_NAME ARM64)
set(WINARCH arm64) set(WINARCH arm64)
endif() endif()
@ -70,6 +71,14 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
endif() endif()
endif() endif()
if(DEFINED VCPKG_TARGET_TRIPLET)
string(REGEX MATCH "^[^-]+" target_arch ${VCPKG_TARGET_TRIPLET})
if(NOT WINARCH STREQUAL target_arch)
message(FATAL_ERROR "Wrong build environment architecture for VCPKG_TARGET_TRIPLET, you specified ${target_arch} but your compiler is for ${WINARCH}")
endif()
endif()
# We do not support amd64 asm yet # We do not support amd64 asm yet
if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX)) if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX))
message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.") message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.")

View File

@ -0,0 +1,85 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENCE.txt or https://cmake.org/licensing for details.
# CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
if(NOT CMAKE_Metal_COMPILER_NAMES)
set(CMAKE_Metal_COMPILER_NAMES metal)
endif()
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
set(CMAKE_Metal_COMPILER_XCODE_TYPE sourcecode.metal)
execute_process(COMMAND xcrun --find metal
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result
)
if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
set(CMAKE_Metal_COMPILER "${_xcrun_out}")
else()
_cmake_find_compiler_path(Metal)
endif()
else()
if(CMAKE_Metal_COMPILER)
_cmake_find_compiler_path(Metal)
else()
set(CMAKE_Metal_COMPILER_INIT NOTFOUND)
if(NOT $ENV{METALC} STREQUAL "")
get_filename_component(CMAKE_Metal_COMPILER_INIT $ENV{METALC} PROGRAM PROGRAM_ARGS CMAKE_Metal_FLAGS_ENV_INIT)
if(CMAKE_Metal_FLAGS_ENV_INIT)
set(CMAKE_Metal_COMPILER_ARG1 "${CMAKE_Metal_FLAGS_ENV_INIT}" CACHE STRING "Arguments to the Metal compiler")
endif()
if(NOT EXISTS ${CMAKE_Metal_COMPILER_INIT})
message(FATAL_ERROR "Could not find compiler set in environment variable METALC\n$ENV{METALC}.\n${CMAKE_Metal_COMPILER_INIT}")
endif()
endif()
if(NOT CMAKE_Metal_COMPILER_INIT)
set(CMAKE_Metal_COMPILER_LIST metal ${_CMAKE_TOOLCHAIN_PREFIX}metal)
endif()
_cmake_find_compiler(Metal)
endif()
mark_as_advanced(CMAKE_Metal_COMPILER)
endif()
# For Metal we need to explicitly query the version.
if(CMAKE_Metal_COMPILER AND NOT CMAKE_Metal_COMPILER_VERSION)
execute_process(
COMMAND "${CMAKE_Metal_COMPILER}" --version
OUTPUT_VARIABLE output ERROR_VARIABLE output
RESULT_VARIABLE result
TIMEOUT 10
)
message(CONFIGURE_LOG
"Running the Metal compiler: \"${CMAKE_Metal_COMPILER}\" --version\n"
"${output}\n"
)
if(output MATCHES [[metal version ([0-9]+\.[0-9]+(\.[0-9]+)?)]])
set(CMAKE_Metal_COMPILER_VERSION "${CMAKE_MATCH_1}")
if(NOT CMAKE_Metal_COMPILER_ID)
set(CMAKE_Metal_COMPILER_ID "Apple")
endif()
endif()
endif()
if(NOT _CMAKE_TOOLCHAIN_LOCATION)
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Metal_COMPILER}" PATH)
endif ()
set(_CMAKE_PROCESSING_LANGUAGE "Metal")
include(CMakeFindBinUtils)
unset(_CMAKE_PROCESSING_LANGUAGE)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/CMakeMetalCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeMetalCompiler.cmake
)
set(CMAKE_Metal_COMPILER_ENV_VAR "METALC")

View File

@ -0,0 +1,27 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENCE.txt or https://cmake.org/licensing for details.
# CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake
# This file is used to store compiler information and is copied down into try
# compile directories so that try compiles do not need to re-determine and test
# the LANG
set(CMAKE_Metal_COMPILER "@CMAKE_Metal_COMPILER@")
set(CMAKE_Metal_COMPILER_ID "@CMAKE_Metal_COMPILER_ID@")
set(CMAKE_Metal_COMPILER_VERSION "@CMAKE_Metal_COMPILER_VERSION@")
set(CMAKE_Metal_COMPILER_LOADED 1)
set(CMAKE_Metal_COMPILER_WORKS "@CMAKE_Metal_COMPILER_WORKS@")
set(CMAKE_Metal_COMPILER_ENV_VAR "METALC")
set(CMAKE_Metal_COMPILER_ID_RUN "@CMAKE_Metal_COMPILER_ID_RUN@")
set(CMAKE_Metal_SOURCE_FILE_EXTENSIONS metal)
set(CMAKE_Metal_OUTPUT_EXTENSION ".air")
set(CMAKE_STATIC_LIBRARY_PREFIX_Metal "")
set(CMAKE_STATIC_LIBRARY_SUFFIX_Metal ".metal-ar")
set(CMAKE_SHARED_LIBRARY_PREFIX_Metal "")
set(CMAKE_SHARED_LIBRARY_SUFFIX_Metal ".metallib")
set(CMAKE_SHARED_MODULE_PREFIX_Metal "")
set(CMAKE_SHARED_MODULE_SUFFIX_Metal ".metallib")
set(CMAKE_EXECUTABLE_SUFFIX_Metal ".metallib")

View File

@ -0,0 +1,85 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENCE.txt or https://cmake.org/licensing for details.
# CMake(LANG)Information.cmake -> set up rule variables for LANG :
# CMAKE_(LANG)_CREATE_SHARED_LIBRARY
# CMAKE_(LANG)_CREATE_SHARED_MODULE
# CMAKE_(LANG)_CREATE_STATIC_LIBRARY
# CMAKE_(LANG)_COMPILE_OBJECT
# CMAKE_(LANG)_LINK_EXECUTABLE
include(CMakeCommonLanguageInclude)
set(CMAKE_Metal_FLAGS_INIT "-ffast-math")
set(CMAKE_Metal_FLAGS_DEBUG_INIT "-gline-tables-only -frecord-sources")
set(CMAKE_Metal_FLAGS_RELWITHDEBINFO_INIT "-gline-tables-only -frecord-sources")
cmake_initialize_per_config_variable(CMAKE_Metal_FLAGS "Flags used by the Metal compiler")
set(CMAKE_INCLUDE_FLAG_Metal "-I ")
set(CMAKE_Metal_COMPILER_ARG1 "")
set(CMAKE_Metal_DEFINE_FLAG -D)
set(CMAKE_Metal_FRAMEWORK_SEARCH_FLAG "-F ")
set(CMAKE_Metal_LIBRARY_PATH_FLAG "-L ")
set(CMAKE_Metal_SYSROOT_FLAG "-isysroot")
set(CMAKE_Metal_COMPILE_OPTIONS_TARGET "-target ")
set(CMAKE_DEPFILE_FLAGS_Metal "-MMD -MT dependencies -MF <DEP_FILE>")
if(CMAKE_GENERATOR MATCHES "Makefiles")
set(CMAKE_Metal_DEPFILE_FORMAT gcc)
set(CMAKE_Metal_DEPENDS_USE_COMPILER TRUE)
endif()
set(CMAKE_Metal_COMPILER_PREDEFINES_COMMAND "${CMAKE_Metal_COMPILER}")
if(CMAKE_Metal_COMPILER_TARGET)
list(APPEND CMAKE_Metal_COMPILER_PREDEFINES_COMMAND "-target" "${CMAKE_Metal_COMPILER_TARGET}")
endif()
# now define the following rule variables
# CMAKE_Metal_CREATE_SHARED_LIBRARY
# CMAKE_Metal_CREATE_SHARED_MODULE
# CMAKE_Metal_COMPILE_OBJECT
# CMAKE_Metal_LINK_EXECUTABLE
# variables supplied by the generator at use time
# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# <LINK_FLAGS>
# Metal compiler information
# <CMAKE_Metal_COMPILER>
# <CMAKE_SHARED_LIBRARY_CREATE_Metal_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_Metal_FLAGS>
# <CMAKE_Metal_LINK_FLAGS>
if(NOT CMAKE_Metal_COMPILE_OBJECT)
set(CMAKE_Metal_COMPILE_OBJECT
"<CMAKE_Metal_COMPILER> -c <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>"
)
endif()
if(NOT CMAKE_Metal_CREATE_SHARED_LIBRARY)
set(CMAKE_Metal_CREATE_SHARED_LIBRARY
"<CMAKE_Metal_COMPILER> <CMAKE_SHARED_LIBRARY_Metal_FLAGS> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Metal_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
if(NOT CMAKE_Metal_CREATE_SHARED_MODULE)
set(CMAKE_Metal_CREATE_SHARED_MODULE
"${CMAKE_Metal_CREATE_SHARED_LIBRARY}"
)
endif()
if(NOT CMAKE_Metal_LINK_EXECUTABLE)
# Metal shaders don't really have "executables", but we need this for the try_compile to work properly, so we'll just have it output a metallib file
set(CMAKE_Metal_LINK_EXECUTABLE
"<CMAKE_Metal_COMPILER> <FLAGS> <CMAKE_Metal_LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
)
endif()
set(CMAKE_Metal_INFORMATION_LOADED 1)

View File

@ -0,0 +1,78 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENCE.txt or https://cmake.org/licensing for details.
# CMakeTest(LANG)Compiler.cmake -> test the compiler and set:
# SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "")
if(CMAKE_Metal_COMPILER_FORCED)
# The compiler configuration was forced by the user.
# Assume the user has configured all compiler information.
set(CMAKE_Metal_COMPILER_WORKS TRUE)
return()
endif()
include(CMakeTestCompilerCommon)
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
if(XCODE_VERSION VERSION_GREATER 7.0)
set(CMAKE_Metal_COMPILER_WORKS 1)
endif()
endif()
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that that selected Metal compiler can actually compile
# and link the most basic of programs. If not, a fatal error
# is set and cmake stops processing commands and will not generate
# any makefiles or projects.
if(NOT CMAKE_Metal_COMPILER_WORKS)
PrintTestCompilerStatus("Metal")
__TestCompiler_setTryCompileTargetType()
string(CONCAT __TestCompiler_testMetalCompilerSource
"#ifndef __METAL_VERSION__\n"
"# error \"The CMAKE_Metal_COMPILER is not a Metal compiler\"\n"
"#endif\n"
"#import <metal_stdlib>\n"
"using namespace metal;\n"
)
# Clear result from normal variable.
unset(CMAKE_Metal_COMPILER_WORKS)
# Puts test result in cache variable.
try_compile(CMAKE_Metal_COMPILER_WORKS
SOURCE_FROM_VAR testMetalCompiler.metal __TestCompiler_testMetalCompilerSource
OUTPUT_VARIABLE __CMAKE_Metal_COMPILER_OUTPUT
)
unset(__TestCompiler_testMetalCompilerSource)
# Move result from cache to normal variable.
set(CMAKE_Metal_COMPILER_WORKS ${CMAKE_Metal_COMPILER_WORKS})
unset(CMAKE_Metal_COMPILER_WORKS CACHE)
__TestCompiler_restoreTryCompileTargetType()
set(METAL_TEST_WAS_RUN 1)
endif()
if(NOT CMAKE_Metal_COMPILER_WORKS)
PrintTestCompilerResult(CHECK_FAIL "broken")
string(REPLACE "\n" "\n " _output "${__CMAKE_Metal_COMPILER_OUTPUT}")
message(FATAL_ERROR "The Metal compiler\n \"${CMAKE_Metal_COMPILER}\"\n"
"is not able to compile a simple test program.\nIt fails "
"with the following output:\n ${_output}\n\n"
"CMake will not be able to correctly generate this project."
)
else()
if(METAL_TEST_WAS_RUN)
PrintTestCompilerResult(CHECK_PASS "works")
endif()
# Re-configure to save learned information.
configure_file(
${CMAKE_CURRENT_LIST_DIR}/CMakeMetalCompiler.cmake.in
${CMAKE_PLATFORM_INFO_DIR}/CMakeMetalCompiler.cmake
@ONLY
)
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeMetalCompiler.cmake)
endif()
unset(__CMAKE_Metal_COMPILER_OUTPUT)

169
cmake/CheckLanguage.cmake Normal file
View File

@ -0,0 +1,169 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENCE.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
CheckLanguage
-------------
Check whether a language can be enabled by the :command:`enable_language`
or :command:`project` commands:
.. command:: check_language
.. code-block:: cmake
check_language(<lang>)
Try enabling language ``<lang>`` in a test project and record results
in the cache:
:variable:`CMAKE_<LANG>_COMPILER`
If the language can be enabled, this variable is set to the compiler
that was found. If the language cannot be enabled, this variable is
set to ``NOTFOUND``.
If this variable is already set, either explicitly or cached by
a previous call, the check is skipped.
:variable:`CMAKE_<LANG>_HOST_COMPILER`
This variable is set when ``<lang>`` is ``CUDA`` or ``HIP``.
If the check detects an explicit host compiler that is required for
compilation, this variable will be set to that compiler.
If the check detects that no explicit host compiler is needed,
this variable will be cleared.
If this variable is already set, its value is preserved only if
:variable:`CMAKE_<LANG>_COMPILER` is also set.
Otherwise, the check runs and overwrites
:variable:`CMAKE_<LANG>_HOST_COMPILER` with a new result.
Note that :variable:`CMAKE_<LANG>_HOST_COMPILER` documents it should
not be set without also setting
:variable:`CMAKE_<LANG>_COMPILER` to a NVCC compiler.
:variable:`CMAKE_<LANG>_PLATFORM <CMAKE_HIP_PLATFORM>`
This variable is set to the detected GPU platform when ``<lang>`` is ``HIP``.
If the variable is already set its value is always preserved. Only compatible values
will be considered for :variable:`CMAKE_<LANG>_COMPILER`.
For example:
.. code-block:: cmake
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
else()
message(STATUS "No Fortran support")
endif()
#]=======================================================================]
# This file has been modified to take into account the CMAKE_MODULES path when trying to build the test project
# Ref https://gitlab.kitware.com/cmake/cmake/-/issues/26020
# This was merged in to CMake 3.30.0, so we only need this for older versions
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.30)
include(${CMAKE_ROOT}/Modules/CheckLanguage.cmake)
else()
include_guard(GLOBAL)
block(SCOPE_FOR POLICIES)
cmake_policy(SET CMP0126 NEW)
macro(check_language lang)
if(NOT DEFINED CMAKE_${lang}_COMPILER)
set(_desc "Looking for a ${lang} compiler")
message(CHECK_START "${_desc}")
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
set(extra_compiler_variables)
if("${lang}" MATCHES "^(CUDA|HIP)$" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(extra_compiler_variables "set(CMAKE_${lang}_HOST_COMPILER \\\"\${CMAKE_${lang}_HOST_COMPILER}\\\")")
endif()
if("${lang}" STREQUAL "HIP")
list(APPEND extra_compiler_variables "set(CMAKE_${lang}_PLATFORM \\\"\${CMAKE_${lang}_PLATFORM}\\\")")
endif()
list(TRANSFORM extra_compiler_variables PREPEND "\"")
list(TRANSFORM extra_compiler_variables APPEND "\\n\"")
list(JOIN extra_compiler_variables "\n " extra_compiler_variables)
set(_cl_content
"cmake_minimum_required(VERSION ${CMAKE_VERSION})
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
project(Check${lang} ${lang})
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
${extra_compiler_variables}
)"
)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
"${_cl_content}")
if(CMAKE_GENERATOR_INSTANCE)
set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
else()
set(_D_CMAKE_GENERATOR_INSTANCE "")
endif()
if(CMAKE_GENERATOR MATCHES "^(Xcode$|Green Hills MULTI$|Visual Studio)")
set(_D_CMAKE_MAKE_PROGRAM "")
else()
set(_D_CMAKE_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
endif()
if(CMAKE_TOOLCHAIN_FILE)
set(_D_CMAKE_TOOLCHAIN_FILE "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}")
else()
set(_D_CMAKE_TOOLCHAIN_FILE "")
endif()
if(CMAKE_${lang}_PLATFORM)
set(_D_CMAKE_LANG_PLATFORM "-DCMAKE_${lang}_PLATFORM:STRING=${CMAKE_${lang}_PLATFORM}")
else()
set(_D_CMAKE_LANG_PLATFORM "")
endif()
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
-A "${CMAKE_GENERATOR_PLATFORM}"
-T "${CMAKE_GENERATOR_TOOLSET}"
${_D_CMAKE_GENERATOR_INSTANCE}
${_D_CMAKE_MAKE_PROGRAM}
${_D_CMAKE_TOOLCHAIN_FILE}
${_D_CMAKE_LANG_PLATFORM}
OUTPUT_VARIABLE _cl_output
ERROR_VARIABLE _cl_output
RESULT_VARIABLE _cl_result
)
include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL)
if(CMAKE_${lang}_COMPILER AND "${_cl_result}" STREQUAL "0")
message(CONFIGURE_LOG
"${_desc} passed with the following output:\n"
"${_cl_output}\n")
set(_CHECK_COMPILER_STATUS CHECK_PASS)
else()
set(CMAKE_${lang}_COMPILER NOTFOUND)
set(_CHECK_COMPILER_STATUS CHECK_FAIL)
message(CONFIGURE_LOG
"${_desc} failed with the following output:\n"
"${_cl_output}\n")
endif()
message(${_CHECK_COMPILER_STATUS} "${CMAKE_${lang}_COMPILER}")
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler")
mark_as_advanced(CMAKE_${lang}_COMPILER)
if(CMAKE_${lang}_HOST_COMPILER)
message(STATUS "Looking for a ${lang} host compiler - ${CMAKE_${lang}_HOST_COMPILER}")
set(CMAKE_${lang}_HOST_COMPILER "${CMAKE_${lang}_HOST_COMPILER}" CACHE FILEPATH "${lang} host compiler")
mark_as_advanced(CMAKE_${lang}_HOST_COMPILER)
endif()
if(CMAKE_${lang}_PLATFORM)
set(CMAKE_${lang}_PLATFORM "${CMAKE_${lang}_PLATFORM}" CACHE STRING "${lang} platform")
mark_as_advanced(CMAKE_${lang}_PLATFORM)
endif()
endif()
endmacro()
endblock()
endif()

View File

@ -11,33 +11,58 @@ if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(OpenGL_GL_PREFERENCE LEGACY) set(OpenGL_GL_PREFERENCE LEGACY)
endif() endif()
find_package(OpenGL REQUIRED) if(NOT DISABLE_OPENGL)
find_package(SDL2 REQUIRED) find_package(OpenGL)
if(NOT OpenGL_FOUND)
set(CMAKE_C_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_CXX_FLAGS}")
endif()
endif()
# Add libsamplerate to SDL2 with vcpkg # Add libsamplerate to SDL2 with vcpkg
unset(SDL2_LIBRARY_TEMP) unset(SDL_LIBRARY_TEMP)
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg") if((NOT ENABLE_SDL3) AND CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
if(WIN32) if(WIN32)
unset(arch_suffix) unset(arch_suffix)
unset(path_prefix) unset(path_prefix)
if(VCPKG_TARGET_TRIPLET MATCHES -static) if(VCPKG_TARGET_TRIPLET MATCHES -static)
set(arch_suffix -static) set(arch_suffix -static)
endif() endif()
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(path_prefix debug) set(path_prefix debug)
endif() endif()
set(samplerate_lib_name samplerate)
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix}) set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix})
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib) if(MINGW)
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-mingw${arch_suffix}/${path_prefix})
set(samplerate_lib_name lib${samplerate_lib_name})
endif()
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "${installed_prefix}/lib/${samplerate_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
else() else()
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate) SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} -lsamplerate)
endif() endif()
endif() endif()
if(VBAM_STATIC) if(ENABLE_SDL3)
set(VBAM_SDL2_LIBS SDL2::SDL2-static ${SDL2_LIBRARY_TEMP}) if(UNIX AND NOT APPLE)
set(VBAM_SDL_LIBS "${SDL3_LIBRARIES}")
else()
if(VBAM_STATIC)
set(VBAM_SDL_LIBS SDL3::SDL3-static ${SDL_LIBRARY_TEMP})
else()
set(VBAM_SDL_LIBS SDL3::SDL3 ${SDL_LIBRARY_TEMP})
endif()
endif()
else() else()
set(VBAM_SDL2_LIBS SDL2::SDL2 ${SDL2_LIBRARY_TEMP}) if(VBAM_STATIC)
set(VBAM_SDL_LIBS SDL2::SDL2-static ${SDL_LIBRARY_TEMP})
else()
set(VBAM_SDL_LIBS SDL2::SDL2 ${SDL_LIBRARY_TEMP})
endif()
endif() endif()
if(ENABLE_FFMPEG) if(ENABLE_FFMPEG)
@ -49,7 +74,7 @@ if(ENABLE_FFMPEG)
list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices") list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices")
if(UPSTREAM_RELEASE) if(UPSTREAM_RELEASE)
list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz) list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz -lcrypto -lssl)
endif() endif()
elseif(WIN32) elseif(WIN32)
set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid) set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid)
@ -119,4 +144,3 @@ if(ENABLE_LINK OR ENABLE_WX)
message(FATAL_ERROR "NLS requires libintl/gettext") message(FATAL_ERROR "NLS requires libintl/gettext")
endif() endif()
endif() endif()

View File

@ -33,7 +33,7 @@ include(FindPackageHandleStandardArgs)
# The default components were taken from a survey over other FindFFMPEG.cmake files # The default components were taken from a survey over other FindFFMPEG.cmake files
if (NOT FFmpeg_FIND_COMPONENTS) if (NOT FFmpeg_FIND_COMPONENTS)
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL) set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE X264 X265)
endif () endif ()
# #
@ -99,14 +99,16 @@ endmacro()
if (NOT FFMPEG_LIBRARIES) if (NOT FFMPEG_LIBRARIES)
# Check for all possible component. # Check for all possible component.
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVFORMAT libavformat avformat libavformat/avformat.h) find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
find_component(AVUTIL libavutil avutil libavutil/avutil.h) find_component(AVUTIL libavutil avutil libavutil/avutil.h)
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h) find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
find_component(SWSCALE libswscale swscale libswscale/swscale.h) find_component(SWSCALE libswscale swscale libswscale/swscale.h)
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h) find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h) find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
find_component(X264 x264 x264 x264.h)
find_component(X265 x265 x265 x265.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars. # Check if the required components were found and add their stuff to the FFMPEG_* vars.
foreach (_component ${FFmpeg_FIND_COMPONENTS}) foreach (_component ${FFmpeg_FIND_COMPONENTS})

View File

@ -1,110 +0,0 @@
#.rst:
# FindOpenAL
# ----------
#
#
#
# Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
# false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
# the headers
#
# $OPENALDIR is an environment variable that would correspond to the
# ./configure --prefix=$OPENALDIR used in building OpenAL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module.
#=============================================================================
# Copyright 2005-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# This makes the presumption that you are include al.h like
# #include "al.h"
# and not
# #include <AL/al.h>
# The reason for this is that the latter is not entirely portable.
# Windows/Creative Labs does not by default put their headers in AL/ and
# OS X uses the convention <OpenAL/al.h>.
#
# For Windows, Creative Labs seems to have added a registry key for their
# OpenAL 1.1 installer. I have added that key to the list of search paths,
# however, the key looks like it could be a little fragile depending on
# if they decide to change the 1.00.0000 number for bug fix releases.
# Also, they seem to have laid down groundwork for multiple library platforms
# which puts the library in an extra subdirectory. Currently there is only
# Win32 and I have hardcoded that here. This may need to be adjusted as
# platforms are introduced.
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
# I do not know if the Nvidia OpenAL SDK has a registry key.
#
# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
# To support the framework, I originally wrote special framework detection
# code in this module which I have now removed with CMake's introduction
# of native support for frameworks.
# In addition, OpenAL is open source, and it is possible to compile on Panther.
# Furthermore, due to bugs in the initial OpenAL release, and the
# transition to OpenAL 1.1, it is common to need to override the built-in
# framework.
# Per my request, CMake should search for frameworks first in
# the following order:
# ~/Library/Frameworks/OpenAL.framework/Headers
# /Library/Frameworks/OpenAL.framework/Headers
# /System/Library/Frameworks/OpenAL.framework/Headers
#
# On OS X, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# OPENAL_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
find_path(OPENAL_INCLUDE_DIR al.h
HINTS
ENV OPENALDIR
PATH_SUFFIXES AL OpenAL
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_OpenAL_ARCH_DIR libs/Win64)
else()
set(_OpenAL_ARCH_DIR libs/Win32)
endif()
find_library(OPENAL_LIBRARY
NAMES OpenAL al openal OpenAL32
HINTS
ENV OPENALDIR
PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
)
unset(_OpenAL_ARCH_DIR)
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)

View File

@ -1,365 +0,0 @@
# This script locates the SFML library
# ------------------------------------
#
# Usage
# -----
#
# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
# example:
# find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
#
# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
# example:
# find_package(SFML COMPONENTS ...) # no specific version required
# find_package(SFML 2 COMPONENTS ...) # any 2.x version
# find_package(SFML 2.4 COMPONENTS ...) # version 2.4 or greater
#
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
# Since you have to link yourself all the SFML dependencies when you link it statically, the following
# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
# description below).
# In case of static linking, the SFML_STATIC macro will also be defined by this script.
# example:
# set(SFML_STATIC_LIBRARIES TRUE)
# find_package(SFML 2 COMPONENTS network system)
#
# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
# are available for both release and debug modes.
#
# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
# to tell CMake where SFML is.
#
# Output
# ------
#
# This script defines the following variables:
# - For each specified module XXX (system, window, graphics, network, audio, main):
# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
# - SFML_XXX_DEPENDENCIES: the list of libraries the module depends on, in case of static linking
# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules
# - SFML_FOUND: true if all the required modules are found
# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
#
# example:
# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
# include_directories(${SFML_INCLUDE_DIR})
# add_executable(myapp ...)
# target_link_libraries(myapp ${SFML_LIBRARIES})
# define the SFML_STATIC macro if static build was chosen
if(SFML_STATIC_LIBRARIES)
add_compile_definitions(SFML_STATIC)
endif()
# define the list of search paths for headers and libraries
set(FIND_SFML_PATHS
${SFML_ROOT}
$ENV{SFML_ROOT}
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt)
# find the SFML include directory
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
PATH_SUFFIXES include
PATHS ${FIND_SFML_PATHS})
# check the version number
set(SFML_VERSION_OK TRUE)
if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
# extract the major and minor version numbers from SFML/Config.hpp
# we have to handle framework a little bit differently:
if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
else()
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
endif()
FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
STRING(REGEX REPLACE ".*#define *SFML_VERSION_MAJOR *([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
STRING(REGEX REPLACE ".*#define *SFML_VERSION_MINOR *([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
STRING(REGEX REPLACE ".*#define *SFML_VERSION_PATCH *([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$")
set(SFML_VERSION_PATCH 0)
endif()
math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
# if we could extract them, compare with the requested version number
if (SFML_VERSION_MAJOR)
# transform version numbers to an integer
math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
# compare them
if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
set(SFML_VERSION_OK FALSE)
endif()
else()
# SFML version is < 2.0
if (SFML_REQUESTED_VERSION GREATER 10900)
set(SFML_VERSION_OK FALSE)
set(SFML_VERSION_MAJOR 1)
set(SFML_VERSION_MINOR x)
set(SFML_VERSION_PATCH x)
endif()
endif()
endif()
# find the requested modules
set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
# no suffix for sfml-main, it is always a static library
if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
# release library
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
NAMES ${FIND_SFML_COMPONENT_NAME}
PATH_SUFFIXES lib64 lib
PATHS ${FIND_SFML_PATHS})
# debug library
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
NAMES ${FIND_SFML_COMPONENT_NAME}-d
PATH_SUFFIXES lib64 lib
PATHS ${FIND_SFML_PATHS})
else()
# static release library
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
NAMES ${FIND_SFML_COMPONENT_NAME}-s
PATH_SUFFIXES lib64 lib
PATHS ${FIND_SFML_PATHS})
# static debug library
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
PATH_SUFFIXES lib64 lib
PATHS ${FIND_SFML_PATHS})
# dynamic release library
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
NAMES ${FIND_SFML_COMPONENT_NAME}
PATH_SUFFIXES lib64 lib
PATHS ${FIND_SFML_PATHS})
# dynamic debug library
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
NAMES ${FIND_SFML_COMPONENT_NAME}-d
PATH_SUFFIXES lib64 lib
PATHS ${FIND_SFML_PATHS})
# choose the entries that fit the requested link type
if(SFML_STATIC_LIBRARIES)
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
endif()
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
endif()
else()
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
endif()
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
endif()
endif()
endif()
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
# library found
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
# if both are found, set SFML_XXX_LIBRARY to contain both
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
endif()
# if only one debug/release variant is found, set the other to be equal to the found one
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
# debug and not release
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
endif()
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
# release and not debug
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
endif()
else()
# library not found
set(SFML_FOUND FALSE)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
endif()
# mark as advanced
MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
# add to the global list of libraries
set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
endforeach()
# in case of static linking, we must also define the list of all the dependencies of SFML libraries
if(SFML_STATIC_LIBRARIES)
# detect the OS
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(FIND_SFML_OS_WINDOWS 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(FIND_SFML_OS_LINUX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(FIND_SFML_OS_FREEBSD 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(FIND_SFML_OS_MACOSX 1)
endif()
# start with an empty list
set(SFML_DEPENDENCIES)
set(FIND_SFML_DEPENDENCIES_NOTFOUND)
# macro that searches for a 3rd-party library
macro(find_sfml_dependency output friendlyname)
# No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
if(${${output}} STREQUAL "${output}-NOTFOUND")
unset(output)
set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
endif()
endmacro()
# sfml-system
list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
# update the list -- these are only system libraries, no need to find them
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
set(SFML_SYSTEM_DEPENDENCIES "pthread")
endif()
if(FIND_SFML_OS_LINUX)
set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
endif()
if(FIND_SFML_OS_WINDOWS)
set(SFML_SYSTEM_DEPENDENCIES "winmm")
endif()
set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
endif()
# sfml-network
list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
# update the list -- these are only system libraries, no need to find them
if(FIND_SFML_OS_WINDOWS)
set(SFML_NETWORK_DEPENDENCIES "ws2_32")
endif()
set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
endif()
# sfml-window
list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
# find libraries
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
find_sfml_dependency(X11_LIBRARY "X11" X11)
find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr)
endif()
if(FIND_SFML_OS_LINUX)
find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
endif()
# update the list
if(FIND_SFML_OS_WINDOWS)
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
elseif(FIND_SFML_OS_LINUX)
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} ${UDEV_LIBRARIES})
elseif(FIND_SFML_OS_FREEBSD)
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} "usbhid")
elseif(FIND_SFML_OS_MACOSX)
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
endif()
set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
endif()
# sfml-graphics
list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
# find libraries
find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
# update the list
set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
endif()
# sfml-audio
list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
# find libraries
find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC)
# update the list
set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
endif()
endif()
# handle errors
if(NOT SFML_VERSION_OK)
# SFML version not ok
set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
set(SFML_FOUND FALSE)
elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
set(SFML_FOUND FALSE)
elseif(NOT SFML_FOUND)
# include directory or library not found
set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
endif()
if (NOT SFML_FOUND)
if(SFML_FIND_REQUIRED)
# fatal error
message(FATAL_ERROR ${FIND_SFML_ERROR})
elseif(NOT SFML_FIND_QUIETLY)
# error but continue
message("${FIND_SFML_ERROR}")
endif()
endif()
# handle success
if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
endif()

View File

@ -221,7 +221,7 @@ release notes.
Run the following commands to commit the change: Run the following commands to commit the change:
git commit -m'release ${new_tag}' --signoff -S git commit -a -m'release ${new_tag}' --signoff -S
git tag -s -m'${new_tag}' ${new_tag} git tag -s -m'${new_tag}' ${new_tag}
To rollback these changes, run this command: To rollback these changes, run this command:

View File

@ -0,0 +1,53 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENCE.txt or https://cmake.org/licensing for details.
function(add_metal_shader_library TARGET)
cmake_parse_arguments(PARSE_ARGV 1 _amsl
""
"STANDARD"
""
)
add_library(${TARGET} MODULE ${_amsl_UNPARSED_ARGUMENTS})
set_target_properties(${TARGET} PROPERTIES
DEBUG_POSTFIX ""
XCODE_PRODUCT_TYPE com.apple.product-type.metal-library
XCODE_ATTRIBUTE_MTL_FAST_MATH "YES"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=Debug] "INCLUDE_SOURCE"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=RelWithDebInfo] "INCLUDE_SOURCE"
XCODE_ATTRIBUTE_MTL_HEADER_SEARCH_PATHS "$(HEADER_SEARCH_PATHS)"
)
if(_amsl_STANDARD AND _amsl_STANDARD MATCHES "metal([0-9]+)\.([0-9]+)")
target_compile_options(${TARGET}
PRIVATE "-std=${_amsl_STANDARD}"
)
set_target_properties(${TARGET} PROPERTIES
XCODE_ATTRIBUTE_MTL_LANGUAGE_REVISION "Metal${CMAKE_MATCH_1}${CMAKE_MATCH_2}"
)
endif()
endfunction()
function(target_embed_metal_shader_libraries TARGET)
cmake_parse_arguments(PARSE_ARGV 1 _temsl
""
""
""
)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.28 AND ${CMAKE_GENERATOR} STREQUAL "Xcode")
set_target_properties(${TARGET} PROPERTIES
XCODE_EMBED_RESOURCES "${_temsl_UNPARSED_ARGUMENTS}"
)
else()
foreach(SHADERLIB IN LISTS _temsl_UNPARSED_ARGUMENTS)
add_dependencies(${TARGET} ${SHADERLIB})
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${SHADERLIB}>" "$<TARGET_BUNDLE_CONTENT_DIR:${TARGET}>/Resources/$<TARGET_FILE_NAME:${SHADERLIB}>"
VERBATIM
)
endforeach()
endif()
endfunction()

View File

@ -9,15 +9,11 @@ else()
endif() endif()
set(ENABLE_SDL_DEFAULT ${BUILD_DEFAULT}) set(ENABLE_SDL_DEFAULT ${BUILD_DEFAULT})
if(WIN32 OR APPLE) if(WIN32 OR APPLE)
set(ENABLE_SDL_DEFAULT OFF) set(ENABLE_SDL_DEFAULT OFF)
endif() endif()
option(ENABLE_SDL "Build the SDL port" ${ENABLE_SDL_DEFAULT})
option(ENABLE_WX "Build the wxWidgets port" ${BUILD_DEFAULT})
option(ENABLE_DEBUGGER "Enable the debugger" ON)
option(ENABLE_ASAN "Enable -fsanitize=address by default. Requires debug build with GCC/Clang" OFF)
# Static linking # Static linking
set(VBAM_STATIC_DEFAULT OFF) set(VBAM_STATIC_DEFAULT OFF)
if(VCPKG_TARGET_TRIPLET MATCHES -static OR CMAKE_TOOLCHAIN_FILE MATCHES "mxe|-static") if(VCPKG_TARGET_TRIPLET MATCHES -static OR CMAKE_TOOLCHAIN_FILE MATCHES "mxe|-static")
@ -30,6 +26,7 @@ option(VBAM_STATIC "Try to link all libraries statically" ${VBAM_STATIC_DEFAULT}
if(VBAM_STATIC) if(VBAM_STATIC)
set(SDL2_STATIC ON) set(SDL2_STATIC ON)
set(SDL3_STATIC ON)
set(SFML_STATIC_LIBRARIES ON) set(SFML_STATIC_LIBRARIES ON)
set(FFMPEG_STATIC ON) set(FFMPEG_STATIC ON)
set(OPENAL_STATIC ON) set(OPENAL_STATIC ON)
@ -43,6 +40,49 @@ if(VBAM_STATIC)
endif() endif()
endif() endif()
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^([xX]86_64|[aA][mM][dD]64)$")
set(PKG_CONFIG_EXECUTABLE "$ENV{VCPKG_ROOT}/installed/x64-windows/tools/pkgconf/pkgconf.exe")
endif()
find_package(PkgConfig)
if(UNIX AND NOT APPLE)
pkg_check_modules(SDL3 sdl3 QUIET)
else()
find_package(SDL3 QUIET)
endif()
option(ENABLE_SDL3 "Use SDL3" "${SDL3_FOUND}")
if(NOT TRANSLATIONS_ONLY)
if(ENABLE_SDL3)
if(NOT UNIX)
find_package(SDL3 REQUIRED)
endif()
else()
find_package(SDL2 REQUIRED)
endif()
endif()
option(ENABLE_GENERIC_FILE_DIALOGS "Use generic file dialogs" OFF)
option(DISABLE_OPENGL "Disable OpenGL" OFF)
option(ENABLE_SDL "Build the SDL port" ${ENABLE_SDL_DEFAULT})
option(ENABLE_WX "Build the wxWidgets port" ${BUILD_DEFAULT})
option(ENABLE_DEBUGGER "Enable the debugger" ON)
option(ENABLE_ASAN "Enable -fsanitize=address by default. Requires debug build with GCC/Clang" OFF)
option(ENABLE_BZ2 "Enable BZ2 archive support" ON)
option(ENABLE_LZMA "Enable LZMA archive support" ON)
if(ENABLE_SDL3)
set(CMAKE_C_FLAGS "-DENABLE_SDL3 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-DENABLE_SDL3 ${CMAKE_CXX_FLAGS}")
endif()
if(DISABLE_OPENGL)
set(CMAKE_C_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_CXX_FLAGS}")
endif()
option(ENABLE_ASM "Enable x86 ASM related options" OFF) option(ENABLE_ASM "Enable x86 ASM related options" OFF)
# The ARM ASM core seems to be very buggy, see #98 and #54. Default to it being # The ARM ASM core seems to be very buggy, see #98 and #54. Default to it being
@ -65,50 +105,36 @@ if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS)
include(MacPackageManagers) include(MacPackageManagers)
endif() endif()
find_package(PkgConfig)
# Link / SFML # Link / SFML
if(TRANSLATIONS_ONLY) if(NOT TRANSLATIONS_ONLY)
set(ENABLE_LINK_DEFAULT OFF)
else()
find_package(SFML 2.4 COMPONENTS network system)
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
if(SFML_STATIC_LIBRARIES AND SFML_NETWORK_LIBRARY_STATIC_DEBUG AND SFML_SYSTEM_LIBRARY_STATIC_DEBUG)
set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_STATIC_DEBUG} ${SFML_SYSTEM_LIBRARY_STATIC_DEBUG})
elseif(SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG AND SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG)
set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG} ${SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG})
endif()
endif()
set(ENABLE_LINK_DEFAULT OFF)
if(SFML_FOUND)
set(ENABLE_LINK_DEFAULT ON) set(ENABLE_LINK_DEFAULT ON)
endif()
endif() endif()
option(ENABLE_LINK "Enable GBA linking functionality" ${ENABLE_LINK_DEFAULT}) option(ENABLE_LINK "Enable GBA linking functionality" ${ENABLE_LINK_DEFAULT})
# FFMpeg # FFMpeg
set(FFMPEG_DEFAULT OFF) set(FFMPEG_DEFAULT OFF)
set(FFMPEG_COMPONENTS AVCODEC AVFORMAT SWSCALE AVUTIL SWRESAMPLE) set(FFMPEG_COMPONENTS AVFORMAT AVCODEC SWSCALE AVUTIL SWRESAMPLE X264 X265)
set(FFMPEG_COMPONENT_VERSIONS AVCODEC>=58.18.100 AVFORMAT>=58.12.100 SWSCALE>=5.1.100 AVUTIL>=56.14.100 SWRESAMPLE>=3.1.100) set(FFMPEG_COMPONENT_VERSIONS AVFORMAT>=58.12.100 AVCODEC>=58.18.100 SWSCALE>=5.1.100 AVUTIL>=56.14.100 SWRESAMPLE>=3.1.100 X264>=0 X265>=0)
if(NOT TRANSLATIONS_ONLY AND (NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG) AND (NOT (X86 AND MINGW))) if(NOT TRANSLATIONS_ONLY AND (NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG))
set(FFMPEG_DEFAULT ON) set(FFMPEG_DEFAULT ON)
find_package(FFmpeg COMPONENTS ${FFMPEG_COMPONENTS}) find_package(FFmpeg COMPONENTS ${FFMPEG_COMPONENTS})
# check versions, but only if pkgconfig is available # check versions, but only if pkgconfig is available
if(FFMPEG_FOUND AND PKG_CONFIG_FOUND AND NOT CMAKE_TOOLCHAIN_FILE MATCHES vcpkg) if(FFmpeg_FOUND AND PKG_CONFIG_FOUND AND NOT CMAKE_TOOLCHAIN_FILE MATCHES vcpkg)
foreach(component ${FFMPEG_COMPONENT_VERSIONS}) foreach(component ${FFMPEG_COMPONENT_VERSIONS})
string(REPLACE ">=" ";" parts ${component}) string(REPLACE ">=" ";" parts ${component})
list(GET parts 0 name) list(GET parts 0 name)
list(GET parts 1 version) list(GET parts 1 version)
if((NOT DEFINED ${name}_VERSION) OR ${name}_VERSION VERSION_LESS ${version}) if((NOT DEFINED ${name}_VERSION) OR ${name}_VERSION VERSION_LESS ${version})
set(FFMPEG_FOUND OFF) set(FFmpeg_FOUND OFF)
endif() endif()
endforeach() endforeach()
endif() endif()
if(NOT FFMPEG_FOUND) if(NOT FFmpeg_FOUND)
set(FFMPEG_DEFAULT OFF) set(FFMPEG_DEFAULT OFF)
endif() endif()
endif() endif()
@ -139,7 +165,7 @@ if(WIN32)
option(ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" OFF) option(ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" OFF)
set(XAUDIO2_DEFAULT ON) set(XAUDIO2_DEFAULT ON)
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) if ((MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) OR (MINGW AND X86))
# TODO: We should update the XAudio headers to build with clang-cl. See # TODO: We should update the XAudio headers to build with clang-cl. See
# https://github.com/visualboyadvance-m/visualboyadvance-m/issues/1021 # https://github.com/visualboyadvance-m/visualboyadvance-m/issues/1021
set(XAUDIO2_DEFAULT OFF) set(XAUDIO2_DEFAULT OFF)
@ -147,6 +173,17 @@ if(WIN32)
option(ENABLE_XAUDIO2 "Enable xaudio2 sound output for the wxWidgets port" ${XAUDIO2_DEFAULT}) option(ENABLE_XAUDIO2 "Enable xaudio2 sound output for the wxWidgets port" ${XAUDIO2_DEFAULT})
endif() endif()
find_package(OpenAL QUIET)
set(OPENAL_DEFAULT ${OpenAL_FOUND})
if(MINGW AND X86)
# OpenAL-Soft uses avrt.dll which is not available on Windows XP.
set(OPENAL_DEFAULT OFF)
endif()
option(ENABLE_OPENAL "Enable OpenAL-Soft sound output for the wxWidgets port" ${OPENAL_DEFAULT})
set(ENABLE_FAUDIO_DEFAULT OFF) set(ENABLE_FAUDIO_DEFAULT OFF)
find_package(FAudio QUIET) find_package(FAudio QUIET)
@ -169,3 +206,13 @@ if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX))
endif() endif()
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF) option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
if(APPLE)
set(wx_mac_patched_default OFF)
if(UPSTREAM_RELEASE)
set(wx_mac_patched_default ON)
endif()
option(WX_MAC_PATCHED "A build of wxWidgets that is patched for the alert sound bug is being used" ${wx_mac_patched_default})
endif()

View File

@ -10,19 +10,27 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET)
# Check if we are in an MSVC environment. # Check if we are in an MSVC environment.
find_program(cl_exe_path NAME cl.exe HINTS ENV PATH) find_program(cl_exe_path NAME cl.exe HINTS ENV PATH)
if($ENV{CXX} MATCHES "cl.exe$" OR cl_exe_path) if(ENV{CXX} MATCHES "cl.exe$" OR cl_exe_path)
# Infer the architecture from the LIB folders. # Infer the architecture from the LIB folders.
foreach(LIB $ENV{LIB}) foreach(lib $ENV{LIB})
if(${LIB} MATCHES "x64$") if(lib MATCHES "x64$")
set(VBAM_VCPKG_PLATFORM "x64-windows-static") set(VBAM_VCPKG_PLATFORM "x64-windows-static")
break() break()
endif() endif()
if(${LIB} MATCHES "x86$") if(lib MATCHES "x86$")
set(VBAM_VCPKG_PLATFORM "x86-windows-static") set(VBAM_VCPKG_PLATFORM "x86-windows-static")
break() break()
endif() endif()
if(${LIB} MATCHES "ARM64$") if(lib MATCHES "ARM64$")
set(VBAM_VCPKG_PLATFORM "arm64-windows-static") set(VBAM_VCPKG_PLATFORM "arm64-windows-static")
foreach(path $ENV{PATH})
if(path MATCHES "[Hh]ost[Xx]64")
set(VCPKG_HOST_TRIPLET "x64-windows" CACHE STRING "Vcpkg host triplet" FORCE)
set(VCPKG_USE_HOST_TOOLS ON CACHE BOOL "Use vcpkg host tools" FORCE)
endif()
endforeach()
break() break()
endif() endif()
endforeach() endforeach()
@ -142,24 +150,16 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
string(REPLACE "-" "." pkg_ver ${pkg_ver}) string(REPLACE "-" "." pkg_ver ${pkg_ver})
if(NOT DEFINED VCPKG_INSTALLED_COUNT) if(NOT DEFINED VCPKG_INSTALLED_COUNT)
if(VCPKG_ROOT MATCHES "Visual Studio")
execute_process( execute_process(
COMMAND ${powershell} COMMAND ${powershell}
-executionpolicy bypass -noprofile -executionpolicy bypass -noprofile
-command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-list" -command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-list"
OUTPUT_VARIABLE vcpkg_list_text OUTPUT_VARIABLE vcpkg_list_text
) )
else()
execute_process(
COMMAND ${vcpkg_exe} list
OUTPUT_VARIABLE vcpkg_list_text
ERROR_QUIET
)
endif()
string(REGEX REPLACE "\r?\n" ";" vcpkg_list_raw "${vcpkg_list_text}") string(REGEX REPLACE "\r?\n" ";" vcpkg_list_raw "${vcpkg_list_text}")
set(VCPKG_INSTALLED_COUNT 0 PARENT_SCOPE) set(VCPKG_INSTALLED_COUNT 0 CACHE INTERNAL "Number of installed vcpkg packages" FORCE)
foreach(pkg ${vcpkg_list_raw}) foreach(pkg ${vcpkg_list_raw})
if(NOT pkg MATCHES "^([^:[]+)[^:]*:([^ ]+) +([0-9][^ ]*) +.*\$") if(NOT pkg MATCHES "^([^:[]+)[^:]*:([^ ]+) +([0-9][^ ]*) +.*\$")
continue() continue()
@ -181,8 +181,8 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
list(APPEND VCPKG_INSTALLED ${inst_pkg_name} ${inst_pkg_ver} ${inst_pkg_rev} ${inst_pkg_triplet}) list(APPEND VCPKG_INSTALLED ${inst_pkg_name} ${inst_pkg_ver} ${inst_pkg_rev} ${inst_pkg_triplet})
math(EXPR VCPKG_INSTALLED_COUNT "${VCPKG_INSTALLED_COUNT} + 1") math(EXPR VCPKG_INSTALLED_COUNT "${VCPKG_INSTALLED_COUNT} + 1")
endforeach() endforeach()
set(VCPKG_INSTALLED ${VCPKG_INSTALLED} PARENT_SCOPE) set(VCPKG_INSTALLED ${VCPKG_INSTALLED} CACHE INTERNAL "List of installed vcpkg packages" FORCE)
set(VCPKG_INSTALLED_COUNT ${VCPKG_INSTALLED_COUNT} PARENT_SCOPE) set(VCPKG_INSTALLED_COUNT ${VCPKG_INSTALLED_COUNT} CACHE INTERNAL "Number of installed vcpkg packages" FORCE)
endif() endif()
if(NOT VCPKG_INSTALLED_COUNT GREATER 0) if(NOT VCPKG_INSTALLED_COUNT GREATER 0)
@ -216,27 +216,11 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
endforeach() endforeach()
endfunction() endfunction()
function(get_binary_packages vcpkg_exe) function(get_triplet_package_list triplet)
set(binary_packages_installed FALSE PARENT_SCOPE) if(EXISTS "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html")
return()
endif()
unset(triplets)
unset(host_triplet)
# Determine host triplet for vcpkg build dependencies
if(WIN32)
if($ENV{PROCESSOR_ARCHITECTURE} MATCHES "[Aa][Rr][Mm]64")
set(host_triplet "arm64-windows")
elseif($ENV{PROCESSOR_ARCHITECTURE} MATCHES "[Aa][Mm][Dd]64|[Xx]64")
set(host_triplet "x64-windows")
else()
set(host_triplet "x86-windows")
endif()
endif()
if(DEFINED host_triplet)
list(APPEND triplets ${host_triplet})
endif()
list(APPEND triplets ${VCPKG_TARGET_TRIPLET})
foreach(triplet ${triplets})
file( file(
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${triplet}/" "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html" DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${triplet}/" "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html"
STATUS pkg_list_status STATUS pkg_list_status
@ -248,17 +232,64 @@ function(get_binary_packages vcpkg_exe)
message(STATUS "Failed to download vcpkg binary package list: ${pkg_list_status} - ${pkg_list_error}") message(STATUS "Failed to download vcpkg binary package list: ${pkg_list_status} - ${pkg_list_error}")
return() return()
endif() endif()
endforeach() endfunction()
unset(binary_packages) function(download_package pkg pkgs_dir)
foreach(triplet ${triplets}) string(REGEX REPLACE "^[^_]+_[^_]+_([^.]+)[.]zip\$" "\\1" pkg_triplet ${pkg})
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html" raw_html)
message(STATUS "Downloading https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg} ...")
file(
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg}" "${pkgs_dir}/${pkg}"
STATUS pkg_download_status
)
list(GET pkg_download_status 1 pkg_download_error)
list(GET pkg_download_status 0 pkg_download_status)
if(NOT pkg_download_status EQUAL 0)
message(STATUS "Failed to download vcpkg binary package '${pkg}': ${pkg_download_status} - ${pkg_download_error}")
return()
endif()
message(STATUS "done.")
endfunction()
function(zip_is_installed vcpkg_exe zip outvar)
if(NOT zip MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip")
return()
endif()
set(pkg_name ${CMAKE_MATCH_1})
set(pkg_version ${CMAKE_MATCH_2})
set(pkg_triplet ${CMAKE_MATCH_3})
vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${POWERSHELL} pkg_installed)
set(${outvar} ${pkg_installed} PARENT_SCOPE)
endfunction()
function(cleanup_binary_packages)
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/vcpkg-binary-packages")
unset(VCPKG_INSTALLED CACHE)
unset(VCPKG_INSTALLED_COUNT CACHE)
endfunction()
function(get_binary_packages vcpkg_exe)
set(binary_packages_installed FALSE PARENT_SCOPE)
get_triplet_package_list(${VCPKG_TARGET_TRIPLET})
if(NOT EXISTS "${CMAKE_BINARY_DIR}/binary_package_list_${VCPKG_TARGET_TRIPLET}.html")
message(STATUS "Failed to download binary package list found for triplet '${VCPKG_TARGET_TRIPLET}', aborting.")
return()
endif()
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${VCPKG_TARGET_TRIPLET}.html" raw_html)
string(REGEX MATCHALL "<a href=\"[^\"]+[.]zip\"" links ${raw_html}) string(REGEX MATCHALL "<a href=\"[^\"]+[.]zip\"" links ${raw_html})
foreach(link ${links}) foreach(link ${links})
string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${link}) string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${link})
list(APPEND binary_packages ${pkg}) list(APPEND binary_packages ${pkg})
endforeach() endforeach()
endforeach()
set(vcpkg_binpkg_dir ${CMAKE_BINARY_DIR}/vcpkg-binpkg) set(vcpkg_binpkg_dir ${CMAKE_BINARY_DIR}/vcpkg-binpkg)
include(FetchContent) include(FetchContent)
@ -270,19 +301,11 @@ function(get_binary_packages vcpkg_exe)
FetchContent_GetProperties(vcpkg_binpkg) FetchContent_GetProperties(vcpkg_binpkg)
if(NOT vcpkg_binpkg_POPULATED) if(NOT vcpkg_binpkg_POPULATED)
FetchContent_Populate(vcpkg_binpkg) FetchContent_MakeAvailable(vcpkg_binpkg)
endif() endif()
unset(to_install)
foreach(pkg ${binary_packages}) foreach(pkg ${binary_packages})
if(NOT pkg MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip") zip_is_installed(${vcpkg_exe} ${pkg} pkg_installed)
continue()
endif()
set(pkg_name ${CMAKE_MATCH_1})
set(pkg_version ${CMAKE_MATCH_2})
set(pkg_triplet ${CMAKE_MATCH_3})
vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${POWERSHELL} pkg_installed)
if(NOT pkg_installed) if(NOT pkg_installed)
list(APPEND to_install ${pkg}) list(APPEND to_install ${pkg})
@ -294,26 +317,82 @@ function(get_binary_packages vcpkg_exe)
file(MAKE_DIRECTORY ${bin_pkgs_dir}) file(MAKE_DIRECTORY ${bin_pkgs_dir})
foreach(pkg ${to_install}) foreach(pkg ${to_install})
string(REGEX REPLACE "^[^_]+_[^_]+_([^.]+)[.]zip\$" "\\1" pkg_triplet ${pkg}) download_package("${pkg}" "${bin_pkgs_dir}")
message(STATUS "Downloading https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg} ...") if(NOT EXISTS "${bin_pkgs_dir}/${pkg}")
message(STATUS "Failed to download package '${pkg}', aborting.")
return()
endif()
endforeach()
file( unset(installed_host_deps)
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg}" "${bin_pkgs_dir}/${pkg}"
STATUS pkg_download_status while(TRUE)
# -command "import-module ($env:USERPROFILE + '/source/repos/vcpkg-binpkg-prototype/vcpkg-binpkg.psm1'); vcpkg-listmissing ."
execute_process(
COMMAND ${POWERSHELL}
-executionpolicy bypass -noprofile
-command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-listmissing ."
WORKING_DIRECTORY ${bin_pkgs_dir}
OUTPUT_VARIABLE host_deps
RESULT_VARIABLE host_deps_status
) )
list(GET pkg_download_status 1 pkg_download_error)
list(GET pkg_download_status 0 pkg_download_status)
if(NOT pkg_download_status EQUAL 0) if(NOT host_deps_status EQUAL 0)
message(STATUS "Failed to download vcpkg binary package '${pkg}': ${pkg_download_status} - ${pkg_download_error}") message(STATUS "Failed to calculate host dependencies: ${host_deps_status}")
return() return()
endif() endif()
message(STATUS "done.") string(REGEX REPLACE "\r?\n" ";" host_deps "${host_deps}")
endforeach() string(REGEX REPLACE " *;+ *$" "" host_deps "${host_deps}")
list(LENGTH host_deps host_deps_count)
list(LENGTH installed_host_deps installed_host_deps_count)
if(host_deps_count EQUAL installed_host_deps_count)
break()
endif()
foreach(host_dep ${host_deps})
if(NOT host_dep MATCHES "^([^:]+):([^:]+)\$")
continue()
endif()
set(host_dep_name ${CMAKE_MATCH_1})
set(host_dep_triplet ${CMAKE_MATCH_2})
get_triplet_package_list(${host_dep_triplet})
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${host_dep_triplet}.html" raw_html)
string(REGEX MATCHALL "<a href=\"${host_dep_name}_[^\"]+[.]zip\"" links ${raw_html})
list(LENGTH links links_count)
if(NOT links_count EQUAL 1)
message(STATUS "Multiple host dependencies found for '${host_dep_name}' for triplet '${host_dep_triplet}', aborting.")
return()
endif()
string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${links})
list(FIND installed_host_deps "${pkg}" found_idx)
if(found_idx EQUAL -1)
zip_is_installed(${vcpkg_exe} ${pkg} pkg_installed)
if(NOT pkg_installed)
download_package("${pkg}" "${bin_pkgs_dir}")
if(NOT EXISTS "${bin_pkgs_dir}/${pkg}")
message(STATUS "Failed to download host dependency package '${pkg}', aborting.")
return()
endif()
else()
list(APPEND installed_host_deps "${pkg}")
endif()
endif()
endforeach()
endwhile()
# -command "import-module ($env:USERPROFILE + '/source/repos/vcpkg-binpkg-prototype/vcpkg-binpkg.psm1'); vcpkg-instpkg ."
execute_process( execute_process(
COMMAND ${POWERSHELL} COMMAND ${POWERSHELL}
-executionpolicy bypass -noprofile -executionpolicy bypass -noprofile
@ -324,6 +403,8 @@ function(get_binary_packages vcpkg_exe)
file(REMOVE_RECURSE ${bin_pkgs_dir}) file(REMOVE_RECURSE ${bin_pkgs_dir})
endif() endif()
cleanup_binary_packages()
set(binary_packages_installed TRUE PARENT_SCOPE) set(binary_packages_installed TRUE PARENT_SCOPE)
endfunction() endfunction()
@ -346,11 +427,12 @@ function(vcpkg_remove_optional_deps vcpkg_exe)
endfunction() endfunction()
function(vcpkg_set_toolchain) function(vcpkg_set_toolchain)
get_filename_component(preferred_root ${CMAKE_SOURCE_DIR}/../vcpkg ABSOLUTE)
if(NOT DEFINED POWERSHELL) if(NOT DEFINED POWERSHELL)
message(FATAL_ERROR "Powershell is required to use vcpkg binaries.") message(FATAL_ERROR "Powershell is required to use vcpkg binaries.")
endif() endif()
if(NOT DEFINED ENV{VCPKG_ROOT}) if(NOT DEFINED ENV{VCPKG_ROOT})
get_filename_component(preferred_root ${CMAKE_SOURCE_DIR}/../vcpkg ABSOLUTE)
if(WIN32) if(WIN32)
if(DEFINED ENV{CI} OR EXISTS /vcpkg) if(DEFINED ENV{CI} OR EXISTS /vcpkg)
@ -381,6 +463,22 @@ function(vcpkg_set_toolchain)
set(VCPKG_ROOT $ENV{VCPKG_ROOT}) set(VCPKG_ROOT $ENV{VCPKG_ROOT})
endif() endif()
# Avoid using Visual Studio default vcpkg, because that requires elevaction.
if(VCPKG_ROOT MATCHES "Visual Studio")
set(mkdir_status 0)
if(NOT EXISTS "${preferred_root}")
file(
MAKE_DIRECTORY "${preferred_root}"
RESULT mkdir_status
)
endif()
if(mkdir_status EQUAL 0)
set(VCPKG_ROOT "${preferred_root}")
set(ENV{VCPKG_ROOT} ${VCPKG_ROOT})
endif()
endif()
set(VCPKG_ROOT ${VCPKG_ROOT} CACHE FILEPATH "vcpkg installation root path" FORCE) set(VCPKG_ROOT ${VCPKG_ROOT} CACHE FILEPATH "vcpkg installation root path" FORCE)
if(NOT EXISTS ${VCPKG_ROOT}) if(NOT EXISTS ${VCPKG_ROOT})
@ -465,6 +563,10 @@ function(vcpkg_set_toolchain)
foreach(pkg ${VCPKG_DEPS}) foreach(pkg ${VCPKG_DEPS})
list(APPEND VCPKG_DEPS_QUALIFIED ${pkg}:${VCPKG_TARGET_TRIPLET}) list(APPEND VCPKG_DEPS_QUALIFIED ${pkg}:${VCPKG_TARGET_TRIPLET})
if(VCPKG_TARGET_TRIPLET STREQUAL "x86-mingw-static")
list(APPEND VCPKG_DEPS_QUALIFIED libsamplerate:x86-mingw-static)
endif()
endforeach() endforeach()
if(WIN32) if(WIN32)
@ -473,13 +575,9 @@ function(vcpkg_set_toolchain)
set(vcpkg_exe "${VCPKG_ROOT}/vcpkg") set(vcpkg_exe "${VCPKG_ROOT}/vcpkg")
endif() endif()
# update portfiles if (NOT (NO_VCPKG_UPDATES OR (NOT VCPKG_BINARY_PACKAGES)))
execute_process(
COMMAND ${vcpkg_exe} update
WORKING_DIRECTORY ${VCPKG_ROOT}
)
get_binary_packages(${vcpkg_exe}) get_binary_packages(${vcpkg_exe})
endif()
if(NOT binary_packages_installed) if(NOT binary_packages_installed)
# Get number of seconds since midnight (might be wrong if am/pm is in effect on Windows.) # Get number of seconds since midnight (might be wrong if am/pm is in effect on Windows.)
@ -493,7 +591,7 @@ function(vcpkg_set_toolchain)
# Install core deps. # Install core deps.
execute_process( execute_process(
COMMAND ${vcpkg_exe} install ${VCPKG_DEPS_QUALIFIED} COMMAND ${vcpkg_exe} --triplet ${VCPKG_TARGET_TRIPLET} install ${pkg}
WORKING_DIRECTORY ${VCPKG_ROOT} WORKING_DIRECTORY ${VCPKG_ROOT}
) )
@ -535,7 +633,7 @@ function(vcpkg_set_toolchain)
set(dep_qualified "${dep}:${VCPKG_TARGET_TRIPLET}") set(dep_qualified "${dep}:${VCPKG_TARGET_TRIPLET}")
execute_process( execute_process(
COMMAND ${vcpkg_exe} install ${dep_qualified} COMMAND --triplet ${VCPKG_TARGET_TRIPLET} ${vcpkg_exe} install ${dep}
WORKING_DIRECTORY ${VCPKG_ROOT} WORKING_DIRECTORY ${VCPKG_ROOT}
) )
@ -551,14 +649,10 @@ function(vcpkg_set_toolchain)
endif() endif()
if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT DEFINED CMAKE_CXX_COMPILER) if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT DEFINED CMAKE_CXX_COMPILER)
if(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-windows-") if(VCPKG_TARGET_TRIPLET MATCHES "-windows-")
# set toolchain to VS for e.g. Ninja or jom # set toolchain to VS for e.g. Ninja or jom
set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE)
set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE)
elseif(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-mingw-")
# set toolchain to MinGW for e.g. Ninja or jom
set(CMAKE_C_COMPILER gcc CACHE STRING "MinGW GCC C Compiler" FORCE)
set(CMAKE_CXX_COMPILER g++ CACHE STRING "MinGW G++ C++ Compiler" FORCE)
endif() endif()
endif() endif()
@ -567,14 +661,4 @@ endfunction()
vcpkg_set_toolchain() vcpkg_set_toolchain()
# Make vcpkg use debug libs for RelWithDebInfo
set(orig_build_type ${CMAKE_BUILD_TYPE})
if(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
set(CMAKE_BUILD_TYPE Debug)
endif()
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_BUILD_TYPE ${orig_build_type})
unset(orig_build_type)

View File

@ -1,14 +1,20 @@
if(X86_32 OR X86_64) if(X86_32 OR X86_64)
add_compile_options(-mfpmath=sse -msse2) add_compile_options(-msse2)
endif() endif()
if(UPSTREAM_RELEASE) if(UPSTREAM_RELEASE)
if(X86_64) if(X86_64)
# Require and optimize for Core2 level support, tune for generic. # Require and optimize for Core2 level support, tune for generic.
if(APPLE)
add_compile_options(-march=core2 -mtune=skylake)
else()
add_compile_options(-march=core2 -mtune=generic) add_compile_options(-march=core2 -mtune=generic)
endif()
elseif(X86_32) elseif(X86_32)
# Optimize for pentium-mmx and tune for generic for older builds. # Optimize for pentiumi3 and tune for generic for Windows XP builds.
add_compile_options(-march=pentium-mmx -mtune=generic) set(WINXP TRUE)
add_compile_options(-march=pentium3 -mtune=generic)
add_compile_definitions(-DWINXP)
endif() endif()
endif() endif()
@ -41,14 +47,16 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif() endif()
endif() endif()
#add_compile_options(-std=c++14)
if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC
add_compile_options(-fPIC) add_compile_options(-fPIC)
endif() endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-ggdb3 -Og -fno-omit-frame-pointer -Wall -Wextra) add_compile_options(-ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
else() else()
add_compile_options(-Ofast -fomit-frame-pointer) add_compile_options(-O3 -ffast-math -fomit-frame-pointer)
endif() endif()
# for some reason this is necessary # for some reason this is necessary

View File

@ -3,8 +3,8 @@ if (NOT MINGW)
endif() endif()
# this has to run after the toolchain is initialized. # this has to run after the toolchain is initialized.
include_directories("${CMAKE_SOURCE_DIR}/dependencies/mingw-include") include_directories("${CMAKE_SOURCE_DIR}/win32-deps/mingw-include")
include_directories("${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include") include_directories("${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
# Add Winsock as the last library linked because of broken link precedence. # Add Winsock as the last library linked because of broken link precedence.
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lws2_32") set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lws2_32")

View File

@ -10,7 +10,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif() endif()
endif() endif()
include_directories("${CMAKE_SOURCE_DIR}/dependencies/msvc") include_directories("${CMAKE_SOURCE_DIR}/win32-deps/msvc")
add_compile_definitions( add_compile_definitions(
_FORCENAMELESSUNION _FORCENAMELESSUNION
@ -68,6 +68,8 @@ if(CMAKE_VERSION VERSION_LESS "3.25")
endif() endif()
endif() endif()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/std:c++17>)
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE) set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE)
# We need to explicitly set all of these to override the CMake defaults. # We need to explicitly set all of these to override the CMake defaults.

View File

@ -16,7 +16,7 @@ Ignore the following cmake error.
# Get last tag. # Get last tag.
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} tag --sort=-v:refname COMMAND git tag --sort=-v:refname
OUTPUT_VARIABLE git_tags OUTPUT_VARIABLE git_tags
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
@ -43,7 +43,7 @@ Ignore the following cmake error.
# Clone repo. # Clone repo.
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} clone git@github.com:visualboyadvance-m/visualboyadvance-m.github.io web-data COMMAND git clone git@github.com:visualboyadvance-m/visualboyadvance-m.github.io web-data
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
@ -103,21 +103,21 @@ Ignore the following cmake error.
) )
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} add appcast.xml COMMAND git add appcast.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
) )
# Commit the change. # Commit the change.
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} commit -m "release ${new_tag}" --signoff -S COMMAND git commit -m "release ${new_tag}" --signoff -S
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
) )
# Make release tag. # Make release tag.
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} tag -s -m${new_tag} ${new_tag} COMMAND git tag -s -m${new_tag} ${new_tag}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
) )

View File

@ -37,8 +37,48 @@ function(check_clean_exit var)
set(${var} ${exit_status} PARENT_SCOPE) set(${var} ${exit_status} PARENT_SCOPE)
endfunction() endfunction()
function(try_wx_util var util conf_suffix major_version minor_version)
unset(suffix)
if(conf_suffix)
set(suffix "-${conf_suffix}")
endif()
if(major_version)
set(suffix "${suffix}-${major_version}")
if(NOT minor_version EQUAL -1)
set(suffix "${suffix}.${minor_version}")
endif()
endif()
# find_program caches the result
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
find_program(exe NAMES "${util}${suffix}")
# try infix variant, as on FreeBSD
if(NOT EXISTS "${exe}")
string(REGEX REPLACE "^-" "" suffix "${suffix}")
string(REGEX REPLACE "-" "${suffix}-" try "${util}")
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
find_program(exe NAMES "${try}")
endif()
if(EXISTS "${exe}")
# check that the utility can be executed cleanly
# in case we find e.g. the wrong architecture binary
# when cross-compiling
check_clean_exit(exit_status "${exe}" --help)
if(exit_status EQUAL 0)
set("${var}" "${exe}" PARENT_SCOPE)
return()
endif()
endif()
endfunction()
function(find_wx_util var util) function(find_wx_util var util)
if(WIN32 OR EXISTS /etc/gentoo-release) if((WIN32 AND (NOT CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")) OR EXISTS /etc/gentoo-release)
# On win32, including cross builds we prefer the plain utility # On win32, including cross builds we prefer the plain utility
# name first from PATH, with the exception of -static for static # name first from PATH, with the exception of -static for static
# builds. # builds.
@ -57,50 +97,36 @@ function(find_wx_util var util)
set(major_versions ";") set(major_versions ";")
endif() endif()
list(APPEND conf_suffixes gtk4u gtk4 gtk3u gtk3 gtk2u gtk2 "") list(APPEND conf_suffixes "" gtk3u gtk3 gtk2u gtk2)
list(APPEND major_versions 4 3 2 "") list(APPEND major_versions "" 3)
get_target_property(wx_base_lib_prop wx::base LOCATION)
string(STRIP "${wx_base_lib_prop}" wx_base_lib)
if(wx_base_lib MATCHES "wx_baseu?-([0-9]+)\\.([0-9]+)\\.")
set(lib_major "${CMAKE_MATCH_1}")
set(lib_minor "${CMAKE_MATCH_2}")
endif()
foreach(conf_suffix IN LISTS conf_suffixes) foreach(conf_suffix IN LISTS conf_suffixes)
foreach(major_version IN LISTS major_versions) if(lib_major AND lib_minor)
foreach(minor_version RANGE 100 -1 -1) try_wx_util(exe "${util}" "${conf_suffix}" "${lib_major}" "${lib_minor}")
unset(suffix)
if(conf_suffix)
set(suffix "-${conf_suffix}")
endif()
if(major_version)
set(suffix "${suffix}-${major_version}")
if(NOT minor_version EQUAL -1) if(exe)
set(suffix "${suffix}.${minor_version}") set("${var}" "${exe}" PARENT_SCOPE)
endif()
endif()
# find_program caches the result
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
find_program(exe NAMES "${util}${suffix}")
# try infix variant, as on FreeBSD
if(NOT EXISTS ${exe})
string(REGEX REPLACE "^-" "" suffix "${suffix}")
string(REGEX REPLACE "-" "${suffix}-" try ${util})
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
find_program(exe NAMES ${try})
endif()
if(EXISTS ${exe})
# check that the utility can be executed cleanly
# in case we find e.g. the wrong architecture binary
# when cross-compiling
check_clean_exit(exit_status ${exe} --help)
if(exit_status EQUAL 0)
set(${var} ${exe} PARENT_SCOPE)
return() return()
endif() endif()
endif() endif()
foreach(major_version IN LISTS major_versions)
foreach(minor_version RANGE 30 -1 -1)
try_wx_util(exe "${util}" "${conf_suffix}" "${major_version}" "${minor_version}")
if(exe)
set("${var}" "${exe}" PARENT_SCOPE)
return()
endif()
# don't iterate over minor versions for empty major version # don't iterate over minor versions for empty major version
if(major_version STREQUAL "") if(major_version STREQUAL "")
break() break()

View File

@ -2,7 +2,7 @@ with import <nixpkgs> {};
stdenv.mkDerivation { stdenv.mkDerivation {
name = "visualboyadvance-m"; name = "visualboyadvance-m";
buildInputs = if stdenv.isDarwin then buildInputs = if stdenv.isDarwin then
[ ninja cmake gcc nasm faudio gettext libintl pkg-config zip sfml zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.System darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL llvmPackages_latest.clang llvmPackages_latest.bintools ] [ ninja cmake nasm faudio gettext libintl libtiff pkg-config zip zlib openal ffmpeg wxGTK32 sdl3 pcre pcre2 darwin.apple_sdk.frameworks.System darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL llvmPackages_latest.clang llvmPackages_latest.bintools ]
else else
[ ninja cmake gcc nasm faudio gettext libintl pkg-config zip sfml zlib openal ffmpeg wxGTK32 libGL libGLU glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon epoxy dbus at-spi2-core ]; [ ninja cmake gcc clang llvm llvmPackages.libcxx nasm faudio gettext libintl libtiff pkg-config zip zlib openal ffmpeg wxGTK32 libGL libGLU glfw sdl3 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon libepoxy dbus at-spi2-core ];
} }

@ -1 +0,0 @@
Subproject commit 0a1cdd9c04f7727e2d477b070e846c5b971761de

View File

@ -191,7 +191,7 @@ freebsd_installdeps() {
check sudo pkg update check sudo pkg update
pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext pkgconf sdl2 sfml wx31-gtk3 iconv zip ninja" pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext pkgconf sdl3 wx31-gtk3 iconv zip ninja"
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg" [ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
@ -318,16 +318,8 @@ debian_installdeps() {
if [ -z "$target" ]; then if [ -z "$target" ]; then
sudo apt-get -qq -y update sudo apt-get -qq -y update
sfml_libs=
for lib in graphics window network; do
sfml_libs="$sfml_libs $(apt-cache search "libsfml-$lib" | sed 's/ - .*//' | sort -r | head -1)"
done
glew_lib=$(apt-cache search libglew | grep '^libglew[0-9]' | sed 's/ - .*//' | sort -r | head -1) glew_lib=$(apt-cache search libglew | grep '^libglew[0-9]' | sed 's/ - .*//' | sort -r | head -1)
sdl_lib=$(apt-cache search '^libsdl2-2.0' | sed 's/ - .*//' | sort -r | head -1)
# not present in trusty # not present in trusty
if [ -n "$ENABLE_FFMPEG" ]; then if [ -n "$ENABLE_FFMPEG" ]; then
libswresample_dev=$(apt-cache search libswresample-dev | awk '{print $1}') libswresample_dev=$(apt-cache search libswresample-dev | awk '{print $1}')
@ -350,7 +342,7 @@ debian_installdeps() {
;; ;;
esac esac
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl2-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev libsfml-dev $sfml_libs $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build libopenal-dev" pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl3-dev libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build libopenal-dev"
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev" [ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev"
@ -401,7 +393,7 @@ debian_installdeps() {
fi fi
fi fi
deps="gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets openal" deps="gcc zlib ffmpeg gettext sdl3 openal wxwidgets openal"
[ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg" [ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg"
set -- set --
@ -498,7 +490,7 @@ fedora_installdeps() {
# this is sometimes necessary for rawhide # this is sometimes necessary for rawhide
set -- --exclude='glibc32*' set -- --exclude='glibc32*'
fi fi
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel SFML-devel openal-soft-devel wxGTK-devel gtk3-devel; do for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL3-devel openal-soft-devel wxGTK-devel gtk3-devel; do
case $pkg in case $pkg in
*ffmpeg*) *ffmpeg*)
[ -z "$ENABLE_FFMPEG" ] && continue [ -z "$ENABLE_FFMPEG" ] && continue
@ -591,14 +583,12 @@ fedora_installdeps() {
;; ;;
esac esac
# install static deps # install static deps
for pkg in zlib gettext SDL2 wxWidgets3 openal-soft; do for pkg in zlib gettext SDL3 wxWidgets3 openal-soft; do
set -- "$@" "${target}-${pkg}-static" set -- "$@" "${target}-${pkg}-static"
done done
# get the necessary win32 headers # get the necessary win32 headers
git submodule update --init --remote --recursive git submodule update --init --remote --recursive
warning='SFML is required for LINK support, Fedora does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
fi fi
[ -z "$rpms_installed" ] && check sudo dnf -y --nogpgcheck --best --allowerasing install "$@" [ -z "$rpms_installed" ] && check sudo dnf -y --nogpgcheck --best --allowerasing install "$@"
@ -684,9 +674,7 @@ rhel_installdeps() {
set -- --exclude='glibc32*' set -- --exclude='glibc32*'
fi fi
warning='RHEL does not currently have SFML packages, LINK support will be disabled' for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL3-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
case $pkg in case $pkg in
*ffmpeg*) *ffmpeg*)
[ -z "$ENABLE_FFMPEG" ] && continue [ -z "$ENABLE_FFMPEG" ] && continue
@ -771,14 +759,12 @@ rhel_installdeps() {
;; ;;
esac esac
# install static deps # install static deps
for pkg in zlib gettext SDL2 wxWidgets openal-soft; do for pkg in zlib gettext SDL3 wxWidgets openal-soft; do
set -- "$@" "${target}-${pkg}-static" set -- "$@" "${target}-${pkg}-static"
done done
# get the necessary win32 headers # get the necessary win32 headers
git submodule update --init --remote --recursive git submodule update --init --remote --recursive
warning='SFML is required for LINK support, RHEL/EPEL does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
fi fi
[ -z "$rpms_installed" ] && check sudo yum -y install "$@" [ -z "$rpms_installed" ] && check sudo yum -y install "$@"
@ -797,14 +783,12 @@ suse_installdeps() {
check_cross check_cross
installing installing
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip sfml2-devel ninja" tools="make cmake ccache nasm gettext-tools pkg-config ccache zip ninja"
libs="gcc gcc-c++ libSDL2-devel wxWidgets-3_0-devel openal-soft-devel" # ffmpeg-devel libs="gcc gcc-c++ SDL3-devel wxGTK3-3_2-devel openal-soft-devel ffmpeg-7-libavcodec-devel ffmpeg-7-libavdevice-devel ffmpeg-7-libavfilter-devel ffmpeg-7-libavformat-devel ffmpeg-7-libavutil-devel ffmpeg-7-libpostproc-devel ffmpeg-7-libswresample-devel ffmpeg-7-libswscale-devel"
# ffmpeg requires packman repos
if [ "$target" = m32 ]; then if [ "$target" = m32 ]; then
libs=$(echo "$libs" | sed -E 's/([^ ]) ([^ ])/\1-32bit \2/g; s/$/-32bit/;') error '32 bit cross builds are no longer supported on OpenSUSE'
fi fi
check sudo zypper in -y $tools $libs check sudo zypper in -y $tools $libs
@ -868,7 +852,7 @@ archlinux_installdeps() {
$pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic $pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic
libs="zlib mesa gettext sdl2 wxgtk3 $gtk sfml openal" libs="zlib mesa gettext sdl3 wxgtk3 $gtk openal"
[ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg" [ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg"
@ -884,7 +868,7 @@ archlinux_installdeps() {
else else
# try to build 32 bit binaries # try to build 32 bit binaries
# lib32-sfml and lib32-ffmpeg are in AUR # lib32-ffmpeg is in AUR
archlinux_require_yaourt archlinux_require_yaourt
# enable multilib repos if not enabled # enable multilib repos if not enabled
@ -964,7 +948,7 @@ EOF
fi fi
done done
deps="zlib gettext pkg-config sdl2 wxmsw openal" deps="zlib gettext pkg-config sdl3 wxmsw openal"
# and the actual deps # and the actual deps
for p in $deps; do for p in $deps; do
@ -978,8 +962,6 @@ EOF
# get the necessary win32 headers # get the necessary win32 headers
git submodule update --init --remote --recursive git submodule update --init --remote --recursive
warning 'SFML is required for LINK support, the SFML package in AUR is currently broken, if you want LINK support you will need to install it manually'
fi fi
build_instructions build_instructions
@ -995,7 +977,7 @@ solus_installdeps() {
check sudo eopkg -y install -c system.devel check sudo eopkg -y install -c system.devel
check sudo eopkg -y install git ccache ninja check sudo eopkg -y install git ccache ninja
set -- sdl2-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel libglu-devel openal-soft-devel set -- sdl3-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel libglu-devel openal-soft-devel
if [ -n "$amd64" -a "$target" = m32 ]; then if [ -n "$amd64" -a "$target" = m32 ]; then
info_msg 'Calculating dependencies, this will take a while..' info_msg 'Calculating dependencies, this will take a while..'
@ -1042,13 +1024,12 @@ solus_installdeps() {
done done
else else
# no 32bit versions of these # no 32bit versions of these
set -- "$@" SFML-devel ffmpeg-devel set -- "$@" ffmpeg-devel
fi fi
check sudo eopkg -y install "$@" check sudo eopkg -y install "$@"
if [ -n "$amd64" -a "$target" = m32 ]; then if [ -n "$amd64" -a "$target" = m32 ]; then
warning 'SFML is required for LINK support, there is no 32 bit SFML package in Solus currently, if you want LINK support you will need to install it manually'
warning 'ffmpeg is required for game recording, there is no 32 bit ffmpeg package in Solus currently, you may wish to install it manually' warning 'ffmpeg is required for game recording, there is no 32 bit ffmpeg package in Solus currently, you may wish to install it manually'
fi fi
@ -1069,8 +1050,7 @@ gentoo_installdeps() {
dev-build/cmake \ dev-build/cmake \
dev-util/ccache \ dev-util/ccache \
sys-devel/binutils \ sys-devel/binutils \
media-libs/libsdl2 \ media-libs/libsdl3 \
media-libs/libsfml \
media-libs/openal \ media-libs/openal \
x11-libs/wxGTK:$wx_slot \ x11-libs/wxGTK:$wx_slot \
sys-libs/zlib \ sys-libs/zlib \
@ -1088,7 +1068,7 @@ gentoo_installdeps() {
alpine_installdeps() { alpine_installdeps() {
installing installing
check sudo apk add cmake ninja g++ ccache nasm gettext-dev zlib-dev mesa-dev sdl2-dev glu-dev sfml-dev wxwidgets-dev gtk+3.0-dev zip check sudo apk add cmake ninja g++ ccache nasm gettext-dev zlib-dev mesa-dev sdl3-dev glu-dev wxwidgets-dev gtk+3.0-dev zip
build_instructions build_instructions
} }
@ -1123,7 +1103,7 @@ windows_installdeps() {
;; ;;
esac esac
pkgs="$pkgs SDL2 sfml wxWidgets3.2 zlib binutils cmake crt-git headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache openal" pkgs="$pkgs SDL3 wxWidgets3.2 zlib binutils cmake crt-git headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache openal"
case "$target" in case "$target" in
*x86_64) *x86_64)
@ -1195,15 +1175,10 @@ brew_installdeps() {
check brew -v update check brew -v update
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets faudio ccache ninja zlib" brews="nasm cmake ccache gettext libtiff pkg-config sdl3 wxwidgets faudio ccache ninja zlib"
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg" [ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"
# sfml brew currently broken in the travis mac environment
# if [ -z "$TRAVIS" ]; then
brews="$brews sfml"
# fi
# This is necessary for the GitHub Actions CI: # This is necessary for the GitHub Actions CI:
brew -v install python brew -v install python
brew link --overwrite python brew link --overwrite python
@ -1226,7 +1201,7 @@ macports_installdeps() {
check sudo port -v selfupdate check sudo port -v selfupdate
ports="cmake ccache nasm gettext pkgconfig libsdl2 sfml wxWidgets-3.0 libiconv ninja" ports="cmake ccache nasm gettext pkgconfig libsdl3 wxWidgets-3.0 libiconv ninja"
[ -n "$ENABLE_FFMPEG" ] && ports="$ports ffmpeg" [ -n "$ENABLE_FFMPEG" ] && ports="$ports ffmpeg"
@ -1242,7 +1217,7 @@ fink_installdeps() {
check sudo fink -vy selfupdate check sudo fink -vy selfupdate
pkgs="cmake ccache nasm libgettext8-dev gettext-tools pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev sfml24-dev ccache ninja" pkgs="cmake ccache nasm libgettext8-dev gettext-tools pkgconfig sdl3 wxwidgets300-osxcocoa libiconv-dev ccache ninja"
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg" [ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1560,6 +1560,14 @@ msgstr ""
msgid "Using interframe blending: %s" msgid "Using interframe blending: %s"
msgstr "" msgstr ""
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bits per pixel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bits per pixel:"
#: dialogs/game-boy-config.cpp:142 xrc/GameBoyAdvanceConfig.xrc:122 #: dialogs/game-boy-config.cpp:142 xrc/GameBoyAdvanceConfig.xrc:122
#: xrc/GameBoyConfig.xrc:138 xrc/GameBoyConfig.xrc:159 #: xrc/GameBoyConfig.xrc:138 xrc/GameBoyConfig.xrc:159
msgid "(None)" msgid "(None)"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1553,6 +1553,14 @@ msgstr "No usable rpi plugins found in %s"
msgid "Plugin" msgid "Plugin"
msgstr "Plugin" msgstr "Plugin"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bits per píxel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bits per píxel:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

View File

@ -1549,6 +1549,14 @@ msgstr "No usable rpi plugins found in %s"
msgid "Plugin" msgid "Plugin"
msgstr "Plugin" msgstr "Plugin"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bits per píxel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bits per píxel:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

View File

@ -1549,6 +1549,14 @@ msgstr "No usable rpi plugins found in %s"
msgid "Plugin" msgid "Plugin"
msgstr "Plugin" msgstr "Plugin"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bits per píxel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bits per píxel:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

View File

@ -1563,6 +1563,14 @@ msgstr "Extension rpi utilisable non trouvée dans %s"
msgid "Plugin" msgid "Plugin"
msgstr "Extension" msgstr "Extension"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bits par pixel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bits par pixel:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1549,6 +1549,14 @@ msgstr "A %s helyen nincs használható RPI bővítmény"
msgid "Plugin" msgid "Plugin"
msgstr "Bővítmény" msgstr "Bővítmény"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bit per pixel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bit per pixel:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1552,6 +1552,14 @@ msgstr "%s에서 사용가능한 rpi 플러그인을 찾을 수 없음"
msgid "Plugin" msgid "Plugin"
msgstr "플러그인" msgstr "플러그인"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "픽셀당 비트"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "픽셀당 비트:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1552,6 +1552,14 @@ msgstr "Nie znaleziono użytecznych wtyczek rpi w %s"
msgid "Plugin" msgid "Plugin"
msgstr "Wtyczka" msgstr "Wtyczka"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bity na piksel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bity na piksel:"
#: dialogs/display-config.cpp:417 #: dialogs/display-config.cpp:417
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -362,6 +362,14 @@ msgstr ""
msgid "Plugin" msgid "Plugin"
msgstr "" msgstr ""
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr "Bits por pixel"
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr "Bits por pixel:"
#: dialogs/display-config.cpp:407 #: dialogs/display-config.cpp:407
#, c-format #, c-format
msgid "Using pixel filter: %s" msgid "Using pixel filter: %s"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1046,6 +1046,14 @@ msgstr ""
msgid "Invalid value for Default magnification." msgid "Invalid value for Default magnification."
msgstr "" msgstr ""
#: xrc/DisplayConfig.xrc
msgid "Bit Depth"
msgstr ""
#: xrc/DisplayConfig.xrc
msgid "Bit Depth:"
msgstr ""
#: dialogs/display-config.cpp:331 xrc/DisplayConfig.xrc:86 #: dialogs/display-config.cpp:331 xrc/DisplayConfig.xrc:86
#: xrc/DisplayConfig.xrc:136 xrc/DisplayConfig.xrc:222 #: xrc/DisplayConfig.xrc:136 xrc/DisplayConfig.xrc:222
#: xrc/GameBoyAdvanceConfig.xrc:32 xrc/GameBoyAdvanceConfig.xrc:204 #: xrc/GameBoyAdvanceConfig.xrc:32 xrc/GameBoyAdvanceConfig.xrc:204

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

BIN
resource.xrs Normal file

Binary file not shown.

View File

@ -19,8 +19,6 @@ parts:
cmake-generator: Ninja cmake-generator: Ninja
stage-packages: stage-packages:
- libsdl2-2.0-0 - libsdl2-2.0-0
- libsfml-network2.5
- libsfml-system2.5
- libnotify4 - libnotify4
- libsm6 - libsm6
- libopenal1 - libopenal1
@ -46,7 +44,6 @@ parts:
- zip - zip
- libnotify-dev - libnotify-dev
- libsdl2-dev - libsdl2-dev
- libsfml-dev
- libgtk-3-dev - libgtk-3-dev
- libopenal-dev - libopenal-dev
- libwxgtk3.0-gtk3-dev - libwxgtk3.0-gtk3-dev

View File

@ -2,5 +2,6 @@ add_subdirectory(av_recording)
add_subdirectory(draw_text) add_subdirectory(draw_text)
add_subdirectory(filters) add_subdirectory(filters)
add_subdirectory(filters_agb) add_subdirectory(filters_agb)
add_subdirectory(filters_cgb)
add_subdirectory(filters_interframe) add_subdirectory(filters_interframe)
add_subdirectory(user_config) add_subdirectory(user_config)

View File

@ -119,24 +119,48 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
// audio codec context // audio codec context
aenc = avcodec_alloc_context3(acodec); aenc = avcodec_alloc_context3(acodec);
if (!aenc) return MRET_ERR_BUFSIZE; if (!aenc) return MRET_ERR_BUFSIZE;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
aenc->sample_fmt = acodec->sample_fmts ? acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP; aenc->sample_fmt = acodec->sample_fmts ? acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
#else
const enum AVSampleFormat *sample_fmts = NULL;
if (acodec) {
avcodec_get_supported_config (aenc, acodec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
(const void **)&sample_fmts, NULL);
aenc->sample_fmt = sample_fmts ? sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
}
#endif
aenc->bit_rate = 128000; // mp3 aenc->bit_rate = 128000; // mp3
aenc->sample_rate = sampleRate; aenc->sample_rate = sampleRate;
// this might be useful to check if the codec suports the // this might be useful to check if the codec suports the
// sample rate, but it is not strictly needed for now // sample rate, but it is not strictly needed for now
bool isSupported = false; bool isSupported = false;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
if (acodec->supported_samplerates) if (acodec->supported_samplerates)
{ {
for (int i = 0; acodec->supported_samplerates[i]; ++i) for (int i = 0; acodec->supported_samplerates[i]; ++i)
{ {
if (acodec->supported_samplerates[i] == sampleRate) if (acodec->supported_samplerates[i] == sampleRate)
#else
const int *supported_samplerates = NULL;
int num_supported_samplerates = 0;
if (acodec) {
avcodec_get_supported_config(aenc, acodec, AV_CODEC_CONFIG_SAMPLE_RATE, 0,
(const void **) &supported_samplerates, &num_supported_samplerates);
for (int i = 0; i < num_supported_samplerates; i++)
{
if (supported_samplerates[i] == sampleRate)
#endif
{ {
isSupported = true; isSupported = true;
break; break;
} }
} }
} }
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
if (!isSupported && acodec->supported_samplerates) return MRET_ERR_NOCODEC; if (!isSupported && acodec->supported_samplerates) return MRET_ERR_NOCODEC;
#else
if (!isSupported && num_supported_samplerates) return MRET_ERR_NOCODEC;
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 60 #if LIBAVCODEC_VERSION_MAJOR >= 60
av_channel_layout_from_mask(&(aenc->ch_layout), AV_CH_LAYOUT_STEREO); av_channel_layout_from_mask(&(aenc->ch_layout), AV_CH_LAYOUT_STEREO);
#else #else
@ -226,6 +250,9 @@ recording::MediaRet recording::MediaRecorder::setup_video_stream_info(int width,
{ {
switch (depth) switch (depth)
{ {
case 8:
pixfmt = AV_PIX_FMT_RGB8;
break;
case 16: case 16:
// FIXME: test & make endian-neutral // FIXME: test & make endian-neutral
pixfmt = AV_PIX_FMT_RGB565LE; pixfmt = AV_PIX_FMT_RGB565LE;
@ -250,6 +277,9 @@ recording::MediaRet recording::MediaRecorder::setup_video_stream_info(int width,
linesize = pixsize * width; linesize = pixsize * width;
switch (pixsize) switch (pixsize)
{ {
case 1:
tbord = 1; rbord = 4;
break;
case 2: case 2:
// 16-bit: 2 @ right, 1 @ top // 16-bit: 2 @ right, 1 @ top
tbord = 1; rbord = 2; tbord = 1; rbord = 2;
@ -455,7 +485,9 @@ void recording::MediaRecorder::Stop(bool initSuccess)
if (enc) if (enc)
{ {
avcodec_free_context(&enc); avcodec_free_context(&enc);
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
avcodec_close(enc); avcodec_close(enc);
#endif
enc = NULL; enc = NULL;
} }
if (vcodec) if (vcodec)
@ -504,7 +536,9 @@ void recording::MediaRecorder::Stop(bool initSuccess)
if (aenc) if (aenc)
{ {
avcodec_free_context(&aenc); avcodec_free_context(&aenc);
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
avcodec_close(aenc); avcodec_close(aenc);
#endif
aenc = NULL; aenc = NULL;
} }
samplesCount = 0; samplesCount = 0;
@ -618,7 +652,7 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
return MRET_ERR_RECORDING; return MRET_ERR_RECORDING;
} }
int dst_nb_samples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + audioframeTmp->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP); int64_t dst_nb_samples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + audioframeTmp->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP);
av_assert0(dst_nb_samples == audioframeTmp->nb_samples); av_assert0(dst_nb_samples == audioframeTmp->nb_samples);
if (swr_convert(swr, audioframe->data, audioframe->nb_samples, (const uint8_t **)audioframeTmp->data, audioframeTmp->nb_samples) < 0) if (swr_convert(swr, audioframe->data, audioframe->nb_samples, (const uint8_t **)audioframeTmp->data, audioframeTmp->nb_samples) < 0)

View File

@ -105,7 +105,7 @@ class MediaRecorder
const AVCodec *acodec; const AVCodec *acodec;
AVStream *ast; AVStream *ast;
AVCodecContext *aenc; AVCodecContext *aenc;
int samplesCount; // for audio frame pts generation int64_t samplesCount; // for audio frame pts generation
AVFrame *audioframe; AVFrame *audioframe;
AVFrame *audioframeTmp; AVFrame *audioframeTmp;
// audio buffer // audio buffer

View File

@ -58,7 +58,7 @@ void drawText(uint8_t* screen, int pitch, int x, int y,
char c = *string++; char c = *string++;
uint8_t* scr = screen; uint8_t* scr = screen;
uint16_t mask = ~RGB_LOW_BITS_MASK; uint16_t mask = (uint16_t)(~RGB_LOW_BITS_MASK);
int h, w; int h, w;
uint16_t* s = (uint16_t*)scr; uint16_t* s = (uint16_t*)scr;
for (h = 0; h < 8; h++) { for (h = 0; h < 8; h++) {

View File

@ -1,5 +1,13 @@
add_library(vbam-components-filters OBJECT) add_library(vbam-components-filters OBJECT)
unset(extra_src)
if(WINXP)
list(APPEND extra_src
${CMAKE_SOURCE_DIR}/third_party/quake3-sqrt/quake3-sqrt.h
)
target_include_directories(vbam-components-filters PRIVATE ${CMAKE_SOURCE_DIR}/third_party/quake3-sqrt)
endif()
target_sources(vbam-components-filters target_sources(vbam-components-filters
PRIVATE PRIVATE
internal/2xSaI.cpp internal/2xSaI.cpp
@ -17,6 +25,7 @@ target_sources(vbam-components-filters
internal/xBRZ/xbrz_config.h internal/xBRZ/xbrz_config.h
internal/xBRZ/xbrz_tools.h internal/xBRZ/xbrz_tools.h
internal/xbrzfilter.cpp internal/xbrzfilter.cpp
${extra_src}
PUBLIC PUBLIC
filters.h filters.h

View File

@ -45,11 +45,11 @@ void lq2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp,
// in any case, they are worthless, since all renderers do "simple" or // in any case, they are worthless, since all renderers do "simple" or
// better by default // better by default
void Simple2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void Simple2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void Simple2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void Simple2x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void Simple3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void Simple3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void Simple3x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void Simple3x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void Simple4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void Simple4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void Simple4x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void Simple4x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
// note: 16-bit input for asm version only! // note: 16-bit input for asm version only!
void hq3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h); void hq3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
// this takes 32-bit input // this takes 32-bit input

View File

@ -620,7 +620,7 @@ void SuperEagle (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr,
*((uint32_t *) dP) = product1a; *((uint32_t *) dP) = product1a;
*((uint32_t *) (dP + dstPitch)) = product2a; *((uint32_t *) (dP + dstPitch)) = product2a;
*xP = color5; *xP = (uint16_t)color5;
bP += inc_bP; bP += inc_bP;
xP += inc_bP; xP += inc_bP;
@ -1169,7 +1169,7 @@ void Scale_2xSaI (uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */,
uint32_t E, F, G, H; uint32_t E, F, G, H;
uint32_t I, J, K, L; uint32_t I, J, K, L;
uint32_t x1, x2, a1, f1, f2; uint32_t x1, x2, a1, f1, f2;
uint32_t position, product1; uint32_t position, product1 = 0;
position = w >> 16; position = w >> 16;
A = bP[position]; // current pixel A = bP[position]; // current pixel

View File

@ -21,6 +21,10 @@
#include <cmath> //std::sqrt #include <cmath> //std::sqrt
#include "xbrz_tools.h" #include "xbrz_tools.h"
#ifdef WINXP
#include "quake3-sqrt.h"
#endif
// some gcc versions lie about having this C++17 feature // some gcc versions lie about having this C++17 feature
#define static_assert(x) static_assert(x, "assertion failed") #define static_assert(x) static_assert(x, "assertion failed")
@ -66,7 +70,9 @@ uint32_t gradientARGB(uint32_t pixFront, uint32_t pixBack) //find intermediate c
inline double fastSqrt(double n) inline double fastSqrt(double n)
{ {
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__)) #ifdef WINXP
return quake3_sqrt((float)n);
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
__asm__ ("fsqrt" : "+t" (n)); __asm__ ("fsqrt" : "+t" (n));
return n; return n;
#elif defined(_MSC_VER) && defined(_M_IX86) #elif defined(_MSC_VER) && defined(_M_IX86)

View File

@ -1,34 +1,119 @@
/*
* GBA Color Correction Shader Implementation
*
* Shader modified by Pokefan531.
* Color Mangler
* Original Author: hunterk
* Original License: Public domain
*
* This code is adapted from the original shader logic.
*/
#include "components/filters_agb/filters_agb.h" #include "components/filters_agb/filters_agb.h"
#include <cmath>
#include <algorithm>
extern int systemColorDepth; extern int systemColorDepth;
extern int systemRedShift; extern int systemRedShift;
extern int systemGreenShift; extern int systemGreenShift;
extern int systemBlueShift; extern int systemBlueShift;
extern uint8_t systemColorMap8[0x10000];
extern uint16_t systemColorMap16[0x10000]; extern uint16_t systemColorMap16[0x10000];
extern uint32_t systemColorMap32[0x10000]; extern uint32_t systemColorMap32[0x10000];
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12, // --- Global Constants and Variables for GBA Color Correction ---
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38, // Define the color profile matrix as a static const float 2D array
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80, // This replicates the column-major order of GLSL mat4 for easier translation.
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0 }; // Format: { {col0_row0, col0_row1, col0_row2, col0_row3}, ... }
static const float GBA_sRGB[4][4] = {
{0.905f, 0.10f, 0.1575f, 0.0f}, // Column 0 (R output contributions from R, G, B, A)
{0.195f, 0.65f, 0.1425f, 0.0f}, // Column 1 (G output contributions from R, G, B, A)
{-0.10f, 0.25f, 0.70f, 0.0f}, // Column 2 (B output contributions from R, G, B, A)
{0.0f, 0.0f, 0.0f, 0.91f} // Column 3 (A/Luminance contribution)
};
// output R G B static const float GBA_DCI[4][4] = {
static const unsigned char influence[3 * 3] = { 16, 4, 4, // red {0.76f, 0.125f, 0.16f, 0.0f},
8, 16, 8, // green {0.27f, 0.6375f, 0.18f, 0.0f},
0, 8, 16 }; // blue {-0.03f, 0.2375f, 0.66f, 0.0f},
{0.0f, 0.0f, 0.0f, 0.97f}
};
inline void swap(short& a, short& b) static const float GBA_Rec2020[4][4] = {
{ {0.61f, 0.155f, 0.16f, 0.0f},
short temp = a; {0.345f, 0.615f, 0.1875f, 0.0f},
a = b; {0.045f, 0.23f, 0.6525f, 0.0f},
b = temp; {0.0f, 0.0f, 0.0f, 1.0f}
};
// Screen darkening factor. Default to 0.0f
static float darken_screen = 0.0f;
// Color mode (0 for sRGB, 1 for DCI, 2 for Rec2020). Default to sRGB (0).
static int color_mode = 0;
// Pointer to the currently selected color profile matrix.
static const float (*profile)[4];
// Global constants from the shader for gamma correction values
static const float target_gamma = 2.2f;
static const float display_gamma = 2.2f;
// --- Function Implementations ---
// Forward declaration of a helper function to set the profile based on color_mode
static void set_profile_from_mode();
// This constructor-like function runs once when the program starts.
struct GbafilterInitializer {
GbafilterInitializer() {
set_profile_from_mode();
}
};
static GbafilterInitializer __gbafilter_initializer;
// Helper function to set the 'profile' pointer based on the 'color_mode' variable.
static void set_profile_from_mode() {
if (color_mode == 0) {
profile = GBA_sRGB;
}
else if (color_mode == 1) {
profile = GBA_DCI;
}
else if (color_mode == 2) {
profile = GBA_Rec2020;
}
else {
profile = GBA_sRGB; // Default to sRGB if an invalid mode is set
}
}
// Public function to set color mode and darken screen from external calls
void gbafilter_set_params(int new_color_mode, float new_darken_screen) {
color_mode = new_color_mode;
darken_screen = fmaxf(0.0f, fminf(1.0f, new_darken_screen)); // Clamp to 0.0-1.0
// Call the helper to update 'profile' based on the new 'color_mode'
set_profile_from_mode();
} }
void gbafilter_update_colors(bool lcd) { void gbafilter_update_colors(bool lcd) {
switch (systemColorDepth) { switch (systemColorDepth) {
case 16: { case 8: {
for (int i = 0; i < 0x10000; i++) { for (int i = 0; i < 0x10000; i++) {
systemColorMap8[i] = (uint8_t)((((i & 0x1f) << 3) & 0xE0) |
((((i & 0x3e0) >> 5) << 0) & 0x1C) |
((((i & 0x7c00) >> 10) >> 3) & 0x3));
}
if (lcd)
gbafilter_pal8(systemColorMap8, 0x10000);
} break;
case 16: {
for (int i = 0x0; i < 0x10000; i++) {
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) | (((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift); (((i & 0x7c00) >> 10) << systemBlueShift);
@ -49,157 +134,225 @@ void gbafilter_update_colors(bool lcd) {
} }
} }
void gbafilter_pal(uint16_t* buf, int count) void gbafilter_pal8(uint8_t* buf, int count)
{ {
short temp[3 * 3], s; // Pre-calculate constants for efficiency within function scope
uint16_t pix; const float target_gamma_exponent = target_gamma + darken_screen;
uint8_t red, green, blue; const float display_gamma_reciprocal = 1.0f / display_gamma;
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
while (count--) { while (count--) {
pix = *buf; uint8_t pix = *buf;
s = curve[(pix >> systemGreenShift) & 0x1f]; uint8_t original_r_val_3bit = (uint8_t)((pix & 0xE0) >> 5);
temp[3] = s * influence[3]; uint8_t original_g_val_3bit = (uint8_t)((pix & 0x1C) >> 2);
temp[4] = s * influence[4]; uint8_t original_b_val_2bit = (uint8_t)(pix & 0x3);
temp[5] = s * influence[5];
s = curve[(pix >> systemRedShift) & 0x1f]; // Normalize to 0.0-1.0 for calculations
temp[0] = s * influence[0]; float r = (float)original_r_val_3bit / 7.0f;
temp[1] = s * influence[1]; float g = (float)original_g_val_3bit / 7.0f;
temp[2] = s * influence[2]; float b = (float)original_b_val_2bit / 3.0f;
s = curve[(pix >> systemBlueShift) & 0x1f]; // 1. Apply initial gamma (including darken_screen as exponent) to convert to linear space.
temp[6] = s * influence[6]; // This step will affect non-"white" values.
temp[7] = s * influence[7]; r = powf(r, target_gamma_exponent);
temp[8] = s * influence[8]; g = powf(g, target_gamma_exponent);
b = powf(b, target_gamma_exponent);
if (temp[0] < temp[3]) // 2. Apply luminance factor and clamp.
swap(temp[0], temp[3]); r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
if (temp[0] < temp[6]) g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
swap(temp[0], temp[6]); b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
if (temp[3] < temp[6])
swap(temp[3], temp[6]);
temp[3] <<= 1;
temp[0] <<= 2;
temp[0] += temp[3] + temp[6];
red = ((int(temp[0]) * 160) >> 17) + 4; // 3. Apply color profile matrix (using profile[column][row] access)
if (red > 31) float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
red = 31; float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
if (temp[2] < temp[5]) // 4. Apply display gamma to convert back for display.
swap(temp[2], temp[5]); transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
if (temp[2] < temp[8]) transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
swap(temp[2], temp[8]); transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
if (temp[5] < temp[8])
swap(temp[5], temp[8]);
temp[5] <<= 1;
temp[2] <<= 2;
temp[2] += temp[5] + temp[8];
blue = ((int(temp[2]) * 160) >> 17) + 4; // Final clamp: ensure values are within 0.0-1.0 range
if (blue > 31) transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
blue = 31; transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
if (temp[1] < temp[4]) // Convert back to 3-bit or 2-bit (0-7 or 0-3) integer and combine into uint8_t
swap(temp[1], temp[4]); // Apply 5-bit to 5-bit conversion, as this palette is for 16-bit output.
if (temp[1] < temp[7]) uint8_t final_red = (uint8_t)(transformed_r * 7.0f + 0.5f);
swap(temp[1], temp[7]); uint8_t final_green = (uint8_t)(transformed_g * 7.0f + 0.5f);
if (temp[4] < temp[7]) uint8_t final_blue = (uint8_t)(transformed_b * 3.0f + 0.5f);
swap(temp[4], temp[7]);
temp[4] <<= 1;
temp[1] <<= 2;
temp[1] += temp[4] + temp[7];
green = ((int(temp[1]) * 160) >> 17) + 4; // Ensure values are strictly within 0-7 or 0-3 range after rounding
if (green > 31) if (final_red > 7) final_red = 7;
green = 31; if (final_green > 7) final_green = 7;
if (final_blue > 3) final_blue = 3;
pix = red << systemRedShift; *buf++ = ((final_red & 0x7) << 5) |
pix += green << systemGreenShift; ((final_green & 0x7) << 2) |
pix += blue << systemBlueShift; (final_blue & 0x3);
}
}
*buf++ = pix; void gbafilter_pal(uint16_t* buf, int count)
{
// Pre-calculate constants for efficiency within function scope
const float target_gamma_exponent = target_gamma + darken_screen;
const float display_gamma_reciprocal = 1.0f / display_gamma;
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
while (count--) {
uint16_t pix = *buf;
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
// Normalize to 0.0-1.0 for calculations
float r = (float)original_r_val_5bit / 31.0f;
float g = (float)original_g_val_5bit / 31.0f;
float b = (float)original_b_val_5bit / 31.0f;
// 1. Apply initial gamma (including darken_screen as exponent) to convert to linear space.
// This step will affect non-"white" values.
r = powf(r, target_gamma_exponent);
g = powf(g, target_gamma_exponent);
b = powf(b, target_gamma_exponent);
// 2. Apply luminance factor and clamp.
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
// 3. Apply color profile matrix (using profile[column][row] access)
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
// 4. Apply display gamma to convert back for display.
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
// Final clamp: ensure values are within 0.0-1.0 range
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
// Convert back to 5-bit (0-31) integer and combine into uint16_t
// Apply 5-bit to 5-bit conversion, as this palette is for 16-bit output.
uint8_t final_red = (uint8_t)(transformed_r * 31.0f + 0.5f);
uint8_t final_green = (uint8_t)(transformed_g * 31.0f + 0.5f);
uint8_t final_blue = (uint8_t)(transformed_b * 31.0f + 0.5f);
// Ensure values are strictly within 0-31 range after rounding
if (final_red > 31) final_red = 31;
if (final_green > 31) final_green = 31;
if (final_blue > 31) final_blue = 31;
*buf++ = (final_red << systemRedShift) |
(final_green << systemGreenShift) |
(final_blue << systemBlueShift);
} }
} }
void gbafilter_pal32(uint32_t* buf, int count) void gbafilter_pal32(uint32_t* buf, int count)
{ {
short temp[3 * 3], s; // Pre-calculate constants for efficiency within function scope
unsigned pix; const float target_gamma_exponent = target_gamma + darken_screen;
uint8_t red, green, blue; const float display_gamma_reciprocal = 1.0f / display_gamma;
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
while (count--) { while (count--) {
pix = *buf; uint32_t pix = *buf;
s = curve[(pix >> systemGreenShift) & 0x1f]; // Extract original 5-bit R, G, B values from the shifted positions in the 32-bit pixel.
temp[3] = s * influence[3]; // These shifts pull out the 5-bit value from its shifted position (e.g., bits 3-7 for Red).
temp[4] = s * influence[4]; uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
temp[5] = s * influence[5]; uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
s = curve[(pix >> systemRedShift) & 0x1f];
temp[0] = s * influence[0];
temp[1] = s * influence[1];
temp[2] = s * influence[2];
s = curve[(pix >> systemBlueShift) & 0x1f]; // Normalize to 0.0-1.0 for calculations
temp[6] = s * influence[6]; float r = (float)original_r_val_5bit / 31.0f;
temp[7] = s * influence[7]; float g = (float)original_g_val_5bit / 31.0f;
temp[8] = s * influence[8]; float b = (float)original_b_val_5bit / 31.0f;
if (temp[0] < temp[3]) // 1. Apply initial gamma (including darken_screen as exponent) to convert to linear space.
swap(temp[0], temp[3]); r = powf(r, target_gamma_exponent);
if (temp[0] < temp[6]) g = powf(g, target_gamma_exponent);
swap(temp[0], temp[6]); b = powf(b, target_gamma_exponent);
if (temp[3] < temp[6])
swap(temp[3], temp[6]);
temp[3] <<= 1;
temp[0] <<= 2;
temp[0] += temp[3] + temp[6];
//red = ((int(temp[0]) * 160) >> 17) + 4; // 2. Apply luminance factor and clamp.
red = ((int(temp[0]) * 160) >> 14) + 32; r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
if (temp[2] < temp[5]) // 3. Apply color profile matrix
swap(temp[2], temp[5]); float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
if (temp[2] < temp[8]) float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
swap(temp[2], temp[8]); float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
if (temp[5] < temp[8])
swap(temp[5], temp[8]);
temp[5] <<= 1;
temp[2] <<= 2;
temp[2] += temp[5] + temp[8];
//blue = ((int(temp[2]) * 160) >> 17) + 4; // 4. Apply display gamma.
blue = ((int(temp[2]) * 160) >> 14) + 32; transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
if (temp[1] < temp[4]) // Final clamp: ensure values are within 0.0-1.0 range
swap(temp[1], temp[4]); transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
if (temp[1] < temp[7]) transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
swap(temp[1], temp[7]); transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
if (temp[4] < temp[7])
swap(temp[4], temp[7]);
temp[4] <<= 1;
temp[1] <<= 2;
temp[1] += temp[4] + temp[7];
//green = ((int(temp[1]) * 160) >> 17) + 4;
green = ((int(temp[1]) * 160) >> 14) + 32;
//pix = red << redshift; // Convert the floating-point values to 8-bit integer components (0-255).
//pix += green << greenshift; uint8_t final_red_8bit = (uint8_t)(transformed_r * 255.0f + 0.5f);
//pix += blue << blueshift; uint8_t final_green_8bit = (uint8_t)(transformed_g * 255.0f + 0.5f);
uint8_t final_blue_8bit = (uint8_t)(transformed_b * 255.0f + 0.5f);
pix = red << (systemRedShift - 3); // Ensure values are strictly within 0-255 range after rounding
pix += green << (systemGreenShift - 3); if (final_red_8bit > 255) final_red_8bit = 255;
pix += blue << (systemBlueShift - 3); if (final_green_8bit > 255) final_green_8bit = 255;
if (final_blue_8bit > 255) final_blue_8bit = 255;
*buf++ = pix; // --- NEW PACKING LOGIC ---
// This is the critical change to correctly map 8-bit color to the 5-bit shifted format,
// while allowing FFFFFF.
// It uses the top 5 bits of the 8-bit value for the GBA's 5-bit component position,
// and the bottom 3 bits to fill the lower, normally zeroed, positions.
uint32_t final_pix = 0;
// Red component
// 5 most significant bits (MSBs) for the 'systemRedShift' position
final_pix |= ((final_red_8bit >> 3) & 0x1f) << systemRedShift;
// 3 least significant bits (LSBs) for the 'base' position (systemRedShift - 3)
final_pix |= (final_red_8bit & 0x07) << (systemRedShift - 3);
// Green component
// 5 MSBs for the 'systemGreenShift' position
final_pix |= ((final_green_8bit >> 3) & 0x1f) << systemGreenShift;
// 3 LSBs for the 'base' position (systemGreenShift - 3)
final_pix |= (final_green_8bit & 0x07) << (systemGreenShift - 3);
// Blue component
// 5 MSBs for the 'systemBlueShift' position
final_pix |= ((final_blue_8bit >> 3) & 0x1f) << systemBlueShift;
// 3 LSBs for the 'base' position (systemBlueShift - 3)
final_pix |= (final_blue_8bit & 0x07) << (systemBlueShift - 3);
// Preserve existing alpha if present (assuming it's at bits 24-31 for 32-bit depth)
if (systemColorDepth == 32) {
final_pix |= (pix & (0xFF << 24));
}
*buf++ = final_pix;
} }
} }
// for palette mode to work with the three spoony filters in 32bpp depth // gbafilter_pad remains unchanged as it's for masking.
void gbafilter_pad(uint8_t* buf, int count) void gbafilter_pad(uint8_t* buf, int count)
{ {
union { union {
@ -232,32 +385,3 @@ void gbafilter_pad(uint8_t* buf, int count)
} }
} }
} }
/*
void UpdateSystemColorMaps(int lcd)
{
switch(systemColorDepth) {
case 16:
{
for(int i = 0; i < 0x10000; i++) {
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000);
}
break;
case 24:
case 32:
{
for(int i = 0; i < 0x10000; i++) {
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000);
}
break;
}
}
*/

View File

@ -4,8 +4,10 @@
#include <cstdint> #include <cstdint>
void gbafilter_update_colors(bool lcd = false); void gbafilter_update_colors(bool lcd = false);
void gbafilter_pal8(uint8_t* buf, int count);
void gbafilter_pal(uint16_t* buf, int count); void gbafilter_pal(uint16_t* buf, int count);
void gbafilter_pal32(uint32_t* buf, int count); void gbafilter_pal32(uint32_t* buf, int count);
void gbafilter_pad(uint8_t* buf, int count); void gbafilter_pad(uint8_t* buf, int count);
void gbafilter_set_params(int color_mode, float darken_screen);
#endif // VBAM_COMPONENTS_FILTERS_AGB_FILTERS_AGB_H_ #endif // VBAM_COMPONENTS_FILTERS_AGB_FILTERS_AGB_H_

View File

@ -0,0 +1,6 @@
add_library(vbam-components-filters-cgb OBJECT)
target_sources(vbam-components-filters-cgb
PRIVATE filters_cgb.cpp
PUBLIC filters_cgb.h
)

View File

@ -0,0 +1,386 @@
/*
* GBC Color Correction Shader Implementation
*
* Shader modified by Pokefan531.
* Color Mangler
* Original Author: hunterk
* Original License: Public domain
*
* This code is adapted from the original shader logic.
*/
#include "components/filters_cgb/filters_cgb.h"
#include <cmath>
#include <algorithm>
extern int systemColorDepth;
extern int systemRedShift;
extern int systemGreenShift;
extern int systemBlueShift;
extern uint8_t systemColorMap8[0x10000];
extern uint16_t systemColorMap16[0x10000];
extern uint32_t systemColorMap32[0x10000];
// --- Global Constants and Variables for GBC Color Correction ---
// Define the color profile matrix as a static const float 2D array
// This replicates the column-major order of GLSL mat4 for easier translation.
// Format: { {col0_row0, col0_row1, col0_row2, col0_row3}, ... }
static const float GBC_sRGB[4][4] = {
{0.905f, 0.10f, 0.1575f, 0.0f}, // Column 0 (R output contributions from R, G, B, A)
{0.195f, 0.65f, 0.1425f, 0.0f}, // Column 1 (G output contributions from R, G, B, A)
{-0.10f, 0.25f, 0.70f, 0.0f}, // Column 2 (B output contributions from R, G, B, A)
{0.0f, 0.0f, 0.0f, 0.91f} // Column 3 (A/Luminance contribution)
};
static const float GBC_DCI[4][4] = {
{0.76f, 0.125f, 0.16f, 0.0f},
{0.27f, 0.6375f, 0.18f, 0.0f},
{-0.03f, 0.2375f, 0.66f, 0.0f},
{0.0f, 0.0f, 0.0f, 0.97f}
};
static const float GBC_Rec2020[4][4] = {
{0.61f, 0.155f, 0.16f, 0.0f},
{0.345f, 0.615f, 0.1875f, 0.0f},
{0.045f, 0.23f, 0.6525f, 0.0f},
{0.0f, 0.0f, 0.0f, 1.0f}
};
// Screen lightening factor. Default to 0.0f.
static float lighten_screen = 0.0f;
// Color mode (0 for sRGB, 1 for DCI, 2 for Rec2020). Default to sRGB (0).
static int color_mode = 0;
// Pointer to the currently selected color profile matrix.
static const float (*profile)[4];
// Global constants from the shader for gamma correction values
static const float target_gamma = 2.2f;
static const float display_gamma = 2.2f;
// --- Function Implementations ---
// Forward declaration of a helper function to set the profile based on color_mode
static void set_profile_from_mode();
// This constructor-like function runs once when the program starts.
struct GbcfilterInitializer {
GbcfilterInitializer() {
set_profile_from_mode();
}
};
static GbcfilterInitializer __gbcfilter_initializer;
// Helper function to set the 'profile' pointer based on the 'color_mode' variable.
static void set_profile_from_mode() {
if (color_mode == 0) {
profile = GBC_sRGB;
}
else if (color_mode == 1) {
profile = GBC_DCI;
}
else if (color_mode == 2) {
profile = GBC_Rec2020;
}
else {
profile = GBC_sRGB; // Default to sRGB if an invalid mode is set
}
}
// Public function to set color mode and darken screen from external calls
void gbcfilter_set_params(int new_color_mode, float new_lighten_screen) {
color_mode = new_color_mode;
lighten_screen = fmaxf(0.0f, fminf(1.0f, new_lighten_screen)); // Clamp to 0.0-1.0
// Call the helper to update 'profile' based on the new 'color_mode'
set_profile_from_mode();
}
void gbcfilter_update_colors(bool lcd) {
switch (systemColorDepth) {
case 8: {
for (int i = 0; i < 0x10000; i++) {
systemColorMap8[i] = (uint8_t)((((i & 0x1f) << 3) & 0xE0) |
((((i & 0x3e0) >> 5) << 0) & 0x1C) |
((((i & 0x7c00) >> 10) >> 3) & 0x3));
}
if (lcd)
gbcfilter_pal8(systemColorMap8, 0x10000);
} break;
case 16: {
for (int i = 0x0; i < 0x10000; i++) {
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd)
gbcfilter_pal(systemColorMap16, 0x10000);
} break;
case 24:
case 32: {
for (int i = 0; i < 0x10000; i++) {
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
(((i & 0x3e0) >> 5) << systemGreenShift) |
(((i & 0x7c00) >> 10) << systemBlueShift);
}
if (lcd)
gbcfilter_pal32(systemColorMap32, 0x10000);
} break;
}
}
void gbcfilter_pal8(uint8_t* buf, int count)
{
// Pre-calculate constants for efficiency within function scope
const float target_gamma_exponent = target_gamma + (lighten_screen * -1.0f);
const float display_gamma_reciprocal = 1.0f / display_gamma;
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
while (count--) {
uint8_t pix = *buf;
uint8_t original_r_val_3bit = (uint8_t)((pix & 0xE0) >> 5);
uint8_t original_g_val_3bit = (uint8_t)((pix & 0x1C) >> 2);
uint8_t original_b_val_2bit = (uint8_t)(pix & 0x3);
// Normalize to 0.0-1.0 for calculations
float r = (float)original_r_val_3bit / 7.0f;
float g = (float)original_g_val_3bit / 7.0f;
float b = (float)original_b_val_2bit / 3.0f;
// 1. Apply initial gamma (including lighten_screen as exponent) to convert to linear space.
// This step will affect non-"white" values.
r = powf(r, target_gamma_exponent);
g = powf(g, target_gamma_exponent);
b = powf(b, target_gamma_exponent);
// 2. Apply luminance factor and clamp.
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
// 3. Apply color profile matrix (using profile[column][row] access)
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
// 4. Apply display gamma to convert back for display.
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
// Final clamp: ensure values are within 0.0-1.0 range
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
// Convert back to 3-bit or 2-bit (0-7 or 0-3) integer and combine into uint8_t
// Apply 3-bit or 2-bit to 8-bit conversion, as this palette is for 8-bit output.
uint8_t final_red = (uint8_t)(transformed_r * 7.0f + 0.5f);
uint8_t final_green = (uint8_t)(transformed_g * 7.0f + 0.5f);
uint8_t final_blue = (uint8_t)(transformed_b * 3.0f + 0.5f);
// Ensure values are strictly within 0-7 or 0-3 range after rounding
if (final_red > 7) final_red = 7;
if (final_green > 7) final_green = 7;
if (final_blue > 3) final_blue = 3;
*buf++ = ((final_red & 0x7) << 5) |
((final_green & 0x7) << 2) |
(final_blue & 0x3);
}
}
void gbcfilter_pal(uint16_t* buf, int count)
{
// Pre-calculate constants for efficiency within function scope
const float target_gamma_exponent = target_gamma + (lighten_screen * -1.0f);
const float display_gamma_reciprocal = 1.0f / display_gamma;
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
while (count--) {
uint16_t pix = *buf;
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
// Normalize to 0.0-1.0 for calculations
float r = (float)original_r_val_5bit / 31.0f;
float g = (float)original_g_val_5bit / 31.0f;
float b = (float)original_b_val_5bit / 31.0f;
// 1. Apply initial gamma (including lighten_screen as exponent) to convert to linear space.
// This step will affect non-"white" values.
r = powf(r, target_gamma_exponent);
g = powf(g, target_gamma_exponent);
b = powf(b, target_gamma_exponent);
// 2. Apply luminance factor and clamp.
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
// 3. Apply color profile matrix (using profile[column][row] access)
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
// 4. Apply display gamma to convert back for display.
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
// Final clamp: ensure values are within 0.0-1.0 range
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
// Convert back to 5-bit (0-31) integer and combine into uint16_t
// Apply 5-bit to 5-bit conversion, as this palette is for 16-bit output.
uint8_t final_red = (uint8_t)(transformed_r * 31.0f + 0.5f);
uint8_t final_green = (uint8_t)(transformed_g * 31.0f + 0.5f);
uint8_t final_blue = (uint8_t)(transformed_b * 31.0f + 0.5f);
// Ensure values are strictly within 0-31 range after rounding
if (final_red > 31) final_red = 31;
if (final_green > 31) final_green = 31;
if (final_blue > 31) final_blue = 31;
*buf++ = (final_red << systemRedShift) |
(final_green << systemGreenShift) |
(final_blue << systemBlueShift);
}
}
void gbcfilter_pal32(uint32_t* buf, int count)
{
// Pre-calculate constants for efficiency within function scope
const float target_gamma_exponent = target_gamma + (lighten_screen * -1.0f);
const float display_gamma_reciprocal = 1.0f / display_gamma;
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
while (count--) {
uint32_t pix = *buf;
// Extract original 5-bit R, G, B values from the shifted positions in the 32-bit pixel.
// These shifts pull out the 5-bit value from its shifted position (e.g., bits 3-7 for Red).
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
// Normalize to 0.0-1.0 for calculations
float r = (float)original_r_val_5bit / 31.0f;
float g = (float)original_g_val_5bit / 31.0f;
float b = (float)original_b_val_5bit / 31.0f;
// 1. Apply initial gamma (including lighten_screen as exponent) to convert to linear space.
r = powf(r, target_gamma_exponent);
g = powf(g, target_gamma_exponent);
b = powf(b, target_gamma_exponent);
// 2. Apply luminance factor and clamp.
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
// 3. Apply color profile matrix
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
// 4. Apply display gamma.
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
// Final clamp: ensure values are within 0.0-1.0 range
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
// Convert the floating-point values to 8-bit integer components (0-255).
uint8_t final_red_8bit = (uint8_t)(transformed_r * 255.0f + 0.5f);
uint8_t final_green_8bit = (uint8_t)(transformed_g * 255.0f + 0.5f);
uint8_t final_blue_8bit = (uint8_t)(transformed_b * 255.0f + 0.5f);
// Ensure values are strictly within 0-255 range after rounding
if (final_red_8bit > 255) final_red_8bit = 255;
if (final_green_8bit > 255) final_green_8bit = 255;
if (final_blue_8bit > 255) final_blue_8bit = 255;
// --- NEW PACKING LOGIC ---
// This is the critical change to correctly map 8-bit color to the 5-bit shifted format,
// while allowing FFFFFF.
// It uses the top 5 bits of the 8-bit value for the GBC's 5-bit component position,
// and the bottom 3 bits to fill the lower, normally zeroed, positions.
uint32_t final_pix = 0;
// Red component
// 5 most significant bits (MSBs) for the 'systemRedShift' position
final_pix |= ((final_red_8bit >> 3) & 0x1f) << systemRedShift;
// 3 least significant bits (LSBs) for the 'base' position (systemRedShift - 3)
final_pix |= (final_red_8bit & 0x07) << (systemRedShift - 3);
// Green component
// 5 MSBs for the 'systemGreenShift' position
final_pix |= ((final_green_8bit >> 3) & 0x1f) << systemGreenShift;
// 3 LSBs for the 'base' position (systemGreenShift - 3)
final_pix |= (final_green_8bit & 0x07) << (systemGreenShift - 3);
// Blue component
// 5 MSBs for the 'systemBlueShift' position
final_pix |= ((final_blue_8bit >> 3) & 0x1f) << systemBlueShift;
// 3 LSBs for the 'base' position (systemBlueShift - 3)
final_pix |= (final_blue_8bit & 0x07) << (systemBlueShift - 3);
// Preserve existing alpha if present (assuming it's at bits 24-31 for 32-bit depth)
if (systemColorDepth == 32) {
final_pix |= (pix & (0xFF << 24));
}
*buf++ = final_pix;
}
}
// gbcfilter_pad remains unchanged as it's for masking.
void gbcfilter_pad(uint8_t* buf, int count)
{
union {
struct
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
} part;
unsigned whole;
} mask;
mask.whole = 0x1f << systemRedShift;
mask.whole += 0x1f << systemGreenShift;
mask.whole += 0x1f << systemBlueShift;
switch (systemColorDepth) {
case 24:
while (count--) {
*buf++ &= mask.part.r;
*buf++ &= mask.part.g;
*buf++ &= mask.part.b;
}
break;
case 32:
while (count--) {
*((uint32_t*)buf) &= mask.whole;
buf += 4;
}
}
}

View File

@ -0,0 +1,13 @@
#ifndef VBAM_COMPONENTS_FILTERS_CGB_FILTERS_CGB_H_
#define VBAM_COMPONENTS_FILTERS_CGB_FILTERS_CGB_H_
#include <cstdint>
void gbcfilter_update_colors(bool lcd = false);
void gbcfilter_pal8(uint8_t* buf, int count);
void gbcfilter_pal(uint16_t* buf, int count);
void gbcfilter_pal32(uint32_t* buf, int count);
void gbcfilter_pad(uint8_t* buf, int count);
void gbcfilter_set_params(int color_mode, float lighten_screen);
#endif // VBAM_COMPONENTS_FILTERS_CGB_FILTERS_CGB_H_

View File

@ -159,6 +159,51 @@ static void SmartIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int start
} }
#endif #endif
void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{
(void)width; // unused param
if(frm1 == NULL) {
InterframeFilterInit();
}
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch;
uint8_t *src1 = (uint8_t *)frm1 + srcPitch * starty;
uint8_t *src2 = (uint8_t *)frm2 + srcPitch * starty;
uint8_t *src3 = (uint8_t *)frm3 + srcPitch * starty;
int sPitch = srcPitch;
int pos = 0;
for (int j = 0; j < height; j++)
for (int i = 0; i < sPitch; i++) {
uint16_t color = src0[pos] == 0xff ? 0x7fff : ((src0[pos] & 0xe0) << 7) | ((src0[pos] & 0x1c) << 5) | ((src0[pos] & 0x3) << 3);
uint16_t color2 = src1[pos] == 0xff ? 0x7fff : ((src1[pos] & 0xe0) << 7) | ((src1[pos] & 0x1c) << 5) | ((src1[pos] & 0x3) << 3);
uint16_t color_dst = ((color & colorMask) >> 1) + ((color2 & colorMask) >> 1);
src0[pos] =
(src1[pos] != src2[pos]) &&
(src3[pos] != color) &&
((color == src2[pos]) || (src1[pos] == src3[pos]))
? (uint8_t)(((color_dst >> 7) & 0xe0) | ((color_dst >> 5) & 0x1c) | ((color_dst >> 3) & 0x3)) :
(uint8_t)(((color >> 7) & 0xe0) | ((color >> 5) & 0x1c) | ((color >> 3) & 0x3));
src3[pos] = (uint8_t)(((color >> 7) & 0xe0) | ((color >> 5) & 0x1c) | ((color >> 3) & 0x3)); /* oldest buffer now holds newest frame */
pos++;
}
/* Swap buffers around */
uint8_t *temp = frm1;
frm1 = frm3;
frm3 = frm2;
frm2 = temp;
}
void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
{
SmartIB8(srcPtr, srcPitch, width, 0, height);
}
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
(void)width; // unused param (void)width; // unused param
@ -172,7 +217,7 @@ void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int heig
} }
#endif #endif
uint16_t colorMask = ~RGB_LOW_BITS_MASK; uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2; uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2;
uint16_t *src1 = (uint16_t *)frm1 + srcPitch * starty / 2; uint16_t *src1 = (uint16_t *)frm1 + srcPitch * starty / 2;
@ -207,6 +252,64 @@ void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
SmartIB(srcPtr, srcPitch, width, 0, height); SmartIB(srcPtr, srcPitch, width, 0, height);
} }
void SmartIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{
(void)width; // unused param
if(frm1 == NULL) {
InterframeFilterInit();
}
uint8_t colorMask = 0xfe;
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch / 3;
uint8_t *src1 = (uint8_t *)frm1 + srcPitch * starty / 3;
uint8_t *src2 = (uint8_t *)frm2 + srcPitch * starty / 3;
uint8_t *src3 = (uint8_t *)frm3 + srcPitch * starty / 3;
int sPitch = srcPitch / 3;
int pos = 0;
for (int j = 0; j < height; j++)
for (int i = 0; i < sPitch; i++) {
uint8_t color = src0[pos];
uint8_t color2 = src0[pos+1];
uint8_t color3 = src0[pos+2];
src0[pos] =
(src1[pos] != src2[pos]) &&
(src3[pos] != color) &&
((color == src2[pos]) || (src1[pos] == src3[pos]))
? (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)) :
color;
src0[pos+1] =
(src1[pos+1] != src2[pos+1]) &&
(src3[pos+1] != color2) &&
((color2 == src2[pos+1]) || (src1[pos+1] == src3[pos+1]))
? (((color2 & colorMask) >> 1) + ((src1[pos+1] & colorMask) >> 1)) :
color2;
src0[pos+2] =
(src1[pos+2] != src2[pos+2]) &&
(src3[pos+2] != color3) &&
((color3 == src2[pos+2]) || (src1[pos+1] == src3[pos+2]))
? (((color3 & colorMask) >> 1) + ((src1[pos+2] & colorMask) >> 1)) :
color3;
src3[pos] = color; /* oldest buffer now holds newest frame */
src3[pos+1] = color2; /* oldest buffer now holds newest frame */
src3[pos+2] = color3; /* oldest buffer now holds newest frame */
pos += 3;
}
/* Swap buffers around */
uint8_t *temp = frm1;
frm1 = frm3;
frm3 = frm2;
frm2 = temp;
}
void SmartIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
{
SmartIB24(srcPtr, srcPitch, width, 0, height);
}
#ifdef MMX #ifdef MMX
static void SmartIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) static void SmartIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
@ -443,6 +546,70 @@ static void MotionBlurIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int
} }
#endif #endif
void MotionBlurIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{
(void)width; // unused param
if(frm1 == NULL) {
InterframeFilterInit();
}
uint8_t colorMask = 0xfe;
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch / 3;
uint8_t *src1 = (uint8_t *)frm1 + starty * srcPitch / 3;
int sPitch = srcPitch / 3;
int pos = 0;
for (int j = 0; j < height; j++)
for (int i = 0; i < sPitch; i++) {
uint8_t color = src0[pos];
uint8_t color2 = src0[pos+1];
uint8_t color3 = src0[pos+2];
src0[pos] = ((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1);
src0[pos+1] = ((color2 & colorMask) >> 1) + ((src1[pos+1] & colorMask) >> 1);
src0[pos+2] = ((color3 & colorMask) >> 1) + ((src1[pos+2] & colorMask) >> 1);
src1[pos] = color;
src1[pos+1] = color2;
src1[pos+2] = color3;
pos += 3;
}
}
void MotionBlurIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
{
MotionBlurIB24(srcPtr, srcPitch, width, 0, height);
}
void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{
(void)width; // unused param
if(frm1 == NULL) {
InterframeFilterInit();
}
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch;
uint8_t *src1 = (uint8_t *)frm1 + starty * srcPitch;
int sPitch = srcPitch;
int pos = 0;
for (int j = 0; j < height; j++)
for (int i = 0; i < sPitch; i++) {
uint16_t color = src0[pos] == 0xff ? 0x7fff : ((src0[pos] & 0xe0) << 7) | ((src0[pos] & 0x1c) << 5) | ((src0[pos] & 0x3) << 3);
uint16_t color2 = src1[pos] == 0xff ? 0x7fff : ((src1[pos] & 0xe0) << 7) | ((src1[pos] & 0x1c) << 5) | ((src1[pos] & 0x3) << 3);
uint16_t color_dst = ((color & colorMask) >> 1) + ((color2 & colorMask) >> 1);
src0[pos] = (uint8_t)(((color_dst >> 7) & 0xe0) | ((color_dst >> 5) & 0x1c) | ((color_dst >> 3) & 0x3));
src1[pos] = (uint8_t)(((color >> 7) & 0xe0) | ((color >> 5) & 0x1c) | ((color >> 3) & 0x3));
pos++;
}
}
void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
{
MotionBlurIB8(srcPtr, srcPitch, width, 0, height);
}
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height) void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
{ {
(void)width; // unused param (void)width; // unused param
@ -457,7 +624,7 @@ void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int
} }
#endif #endif
uint16_t colorMask = ~RGB_LOW_BITS_MASK; uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2; uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2;
uint16_t *src1 = (uint16_t *)frm1 + starty * srcPitch / 2; uint16_t *src1 = (uint16_t *)frm1 + starty * srcPitch / 2;

View File

@ -14,8 +14,12 @@ void InterframeCleanup();
// all 4 are MMX-accelerated if enabled // all 4 are MMX-accelerated if enabled
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height); void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void SmartIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height); void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height); void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void MotionBlurIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height); void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
#ifdef MMX #ifdef MMX
@ -27,8 +31,12 @@ static void MotionBlurIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, in
//Options for if start is 0 //Options for if start is 0
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height); void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void SmartIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height); void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height); void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void MotionBlurIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height); void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
#endif //VBAM_COMPONENTS_FILTERS_INTERFRAME_INTERFRAME_H_ #endif //VBAM_COMPONENTS_FILTERS_INTERFRAME_INTERFRAME_H_

View File

@ -13,8 +13,15 @@ std::string get_xdg_user_config_home()
std::string home(getenv("HOME")); std::string home(getenv("HOME"));
path = home + "/Library/Application Support"; path = home + "/Library/Application Support";
#elif _WIN32 #elif _WIN32
#if __STDC_WANT_SECURE_LIB__
char *app_data_env = NULL;
size_t app_data_env_sz = 0;
_dupenv_s(&app_data_env, &app_data_env_sz, "LOCALAPPDATA");
if (!app_data_env) _dupenv_s(&app_data_env, &app_data_env_sz, "APPDATA");
#else
char *app_data_env = getenv("LOCALAPPDATA"); char *app_data_env = getenv("LOCALAPPDATA");
if (!app_data_env) app_data_env = getenv("APPDATA"); if (!app_data_env) app_data_env = getenv("APPDATA");
#endif
std::string app_data(app_data_env); std::string app_data(app_data_env);
path = app_data; path = app_data;
#else // Unix #else // Unix
@ -40,8 +47,15 @@ std::string get_xdg_user_data_home()
std::string home(getenv("HOME")); std::string home(getenv("HOME"));
path = home + "/Library/Application Support"; path = home + "/Library/Application Support";
#elif _WIN32 #elif _WIN32
#if __STDC_WANT_SECURE_LIB__
char *app_data_env = NULL;
size_t app_data_env_sz = 0;
_dupenv_s(&app_data_env, &app_data_env_sz, "LOCALAPPDATA");
if (!app_data_env) _dupenv_s(&app_data_env, &app_data_env_sz, "APPDATA");
#else
char *app_data_env = getenv("LOCALAPPDATA"); char *app_data_env = getenv("LOCALAPPDATA");
if (!app_data_env) app_data_env = getenv("APPDATA"); if (!app_data_env) app_data_env = getenv("APPDATA");
#endif
std::string app_data(app_data_env); std::string app_data(app_data_env);
path = app_data; path = app_data;
#else // Unix #else // Unix

View File

@ -93,7 +93,7 @@ target_include_directories(vbam-core
) )
target_link_libraries(vbam-core target_link_libraries(vbam-core
PRIVATE vbam-core-apu vbam-fex PRIVATE vbam-core-apu vbam-fex nonstd-lib
PUBLIC vbam-core-base ${ZLIB_LIBRARY} PUBLIC vbam-core-base ${ZLIB_LIBRARY}
) )
@ -120,9 +120,7 @@ if(ENABLE_LINK)
gba/gbaLink.h gba/gbaLink.h
) )
target_include_directories(vbam-core target_include_directories(vbam-core PRIVATE ${SFML_INCLUDE_DIR} ${SFML_INCLUDE_DIR}/SFML/Network ${SFML_INCLUDE_DIR}/SFML/System)
PRIVATE ${SFML_INCLUDE_DIR}
)
target_link_libraries(vbam-core target_link_libraries(vbam-core
PRIVATE ${SFML_LIBRARIES} PRIVATE ${SFML_LIBRARIES}

View File

@ -445,7 +445,9 @@ void Blip_Buffer::mix_samples( blip_sample_t const* in, long count )
*out -= prev; *out -= prev;
} }
#if 0
blip_ulong const subsample_mask = (1L << BLIP_BUFFER_ACCURACY) - 1; blip_ulong const subsample_mask = (1L << BLIP_BUFFER_ACCURACY) - 1;
#endif
void Blip_Buffer::save_state( blip_buffer_state_t* out ) void Blip_Buffer::save_state( blip_buffer_state_t* out )
{ {

View File

@ -553,9 +553,9 @@ inline void Blip_Synth<quality, range>::offset_resampled(blip_resampled_time_t t
blip_long i0 = *imp; blip_long i0 = *imp;
BLIP_FWD(0) BLIP_FWD(0)
if (quality > 8) if constexpr (quality > 8)
BLIP_FWD(2) BLIP_FWD(2)
if (quality > 12) if constexpr (quality > 12)
BLIP_FWD(4) BLIP_FWD(4)
{ {
blip_long t0 = i0 * delta + buf[fwd + mid - 1]; blip_long t0 = i0 * delta + buf[fwd + mid - 1];
@ -565,9 +565,9 @@ inline void Blip_Synth<quality, range>::offset_resampled(blip_resampled_time_t t
buf[fwd + mid - 1] = t0; buf[fwd + mid - 1] = t0;
buf[fwd + mid] = t1; buf[fwd + mid] = t1;
} }
if (quality > 12) if constexpr (quality > 12)
BLIP_REV(6) BLIP_REV(6)
if (quality > 8) if constexpr (quality > 8)
BLIP_REV(4) BLIP_REV(4)
BLIP_REV(2) BLIP_REV(2)

View File

@ -103,7 +103,7 @@ blargg_err_t Effects_Buffer::set_channel_count( int count, int const* types )
for ( auto& buf : bufs ) for ( auto& buf : bufs )
RETURN_ERR( buf.set_sample_rate( sample_rate(), length() ) ); RETURN_ERR( buf.set_sample_rate( sample_rate(), length() ) );
for ( int i = chans.size(); --i >= 0; ) for ( int i = (int)chans.size(); --i >= 0; )
{ {
chan_t& ch = chans [i]; chan_t& ch = chans [i];
ch.cfg.vol = 1.0f; ch.cfg.vol = 1.0f;
@ -266,7 +266,7 @@ void Effects_Buffer::apply_config()
} }
// convert volumes // convert volumes
for ( i = chans.size(); --i >= 0; ) for ( i = (int)chans.size(); --i >= 0; )
{ {
chan_t& ch = chans [i]; chan_t& ch = chans [i];
ch.vol [0] = TO_FIXED( ch.cfg.vol - ch.cfg.vol * ch.cfg.pan ); ch.vol [0] = TO_FIXED( ch.cfg.vol - ch.cfg.vol * ch.cfg.pan );
@ -278,7 +278,7 @@ void Effects_Buffer::apply_config()
assign_buffers(); assign_buffers();
// set side channels // set side channels
for ( i = chans.size(); --i >= 0; ) for ( i = (int)chans.size(); --i >= 0; )
{ {
chan_t& ch = chans [i]; chan_t& ch = chans [i];
ch.channel.left = chans [ch.cfg.echo*2 ].channel.center; ch.channel.left = chans [ch.cfg.echo*2 ].channel.center;
@ -290,7 +290,7 @@ void Effects_Buffer::apply_config()
// determine whether effects and echo are needed at all // determine whether effects and echo are needed at all
no_effects = true; no_effects = true;
no_echo = true; no_echo = true;
for ( i = chans.size(); --i >= extra_chans; ) for ( i = (int)chans.size(); --i >= extra_chans; )
{ {
chan_t& ch = chans [i]; chan_t& ch = chans [i];
if ( ch.cfg.echo && s.feedback ) if ( ch.cfg.echo && s.feedback )
@ -313,7 +313,7 @@ void Effects_Buffer::apply_config()
if ( no_effects ) if ( no_effects )
{ {
for ( i = chans.size(); --i >= 0; ) for ( i = (int)chans.size(); --i >= 0; )
{ {
chan_t& ch = chans [i]; chan_t& ch = chans [i];
ch.channel.center = &bufs [2]; ch.channel.center = &bufs [2];
@ -343,8 +343,8 @@ void Effects_Buffer::assign_buffers()
int x = i; int x = i;
if ( i > 1 ) if ( i > 1 )
x += 2; x += 2;
if ( x >= (int) chans.size() ) if ( x >= (int)chans.size() )
x -= (chans.size() - 2); x -= (int)(chans.size() - 2);
chan_t& ch = chans [x]; chan_t& ch = chans [x];
int b = 0; int b = 0;
@ -488,7 +488,7 @@ void Effects_Buffer::mix_effects( blip_sample_t* out_, int pair_count )
// mix any modified buffers // mix any modified buffers
{ {
buf_t* buf = bufs.data(); buf_t* buf = bufs.data();
int bufs_remain = bufs.size(); int bufs_remain = (int)bufs.size();
do do
{ {
if ( buf->non_silent() && ( buf->echo == !!echo_phase ) ) if ( buf->non_silent() && ( buf->echo == !!echo_phase ) )
@ -513,11 +513,11 @@ void Effects_Buffer::mix_effects( blip_sample_t* out_, int pair_count )
int offset = -count; int offset = -count;
do do
{ {
fixed_t s = BLIP_READER_READ( in ); fixed_t _s = BLIP_READER_READ( in );
BLIP_READER_NEXT_IDX_( in, bass, offset ); BLIP_READER_NEXT_IDX_( in, bass, offset );
out [offset] [0] += s * vol_0; out [offset] [0] += _s * vol_0;
out [offset] [1] += s * vol_1; out [offset] [1] += _s * vol_1;
} }
while ( ++offset ); while ( ++offset );

View File

@ -228,7 +228,10 @@ class Stereo_Buffer : public Multi_Buffer
buf_t bufs[bufs_size]; buf_t bufs[bufs_size];
Stereo_Mixer mixer; Stereo_Mixer mixer;
channel_t chan; channel_t chan;
#if 0
long samples_avail_; long samples_avail_;
#endif
}; };
// Silent_Buffer generates no samples, useful where no sound is wanted // Silent_Buffer generates no samples, useful where no sound is wanted

View File

@ -57,7 +57,7 @@ target_include_directories(vbam-core-base
) )
target_link_libraries(vbam-core-base target_link_libraries(vbam-core-base
PRIVATE vbam-fex stb-image PRIVATE vbam-fex stb-image nonstd-lib
PUBLIC ${ZLIB_LIBRARY} PUBLIC ${ZLIB_LIBRARY}
) )

View File

@ -26,6 +26,7 @@ uint8_t *utilLoad(const char *, bool (*)(const char *), uint8_t *, int &);
IMAGE_TYPE utilFindType(const char *); IMAGE_TYPE utilFindType(const char *);
bool utilIsGBAImage(const char *); bool utilIsGBAImage(const char *);
bool utilIsGBImage(const char *); bool utilIsGBImage(const char *);
bool utilIsTARAchive(const char *);
#if defined(__LIBRETRO__) #if defined(__LIBRETRO__)
@ -40,7 +41,7 @@ void utilReadDataMem(const uint8_t *&data, variable_desc *);
#else // !defined(__LIBRETRO__) #else // !defined(__LIBRETRO__)
// strip .gz or .z off end // strip .gz or .z off end
void utilStripDoubleExtension(const char *, char *); void utilStripDoubleExtension(const char *, char *, size_t);
gzFile utilAutoGzOpen(const char *file, const char *mode); gzFile utilAutoGzOpen(const char *file, const char *mode);
gzFile utilGzOpen(const char *file, const char *mode); gzFile utilGzOpen(const char *file, const char *mode);

View File

@ -19,26 +19,41 @@ FILE* utilOpenFile(const char* filename, const char* mode) {
#ifdef _WIN32 #ifdef _WIN32
std::wstring wfilename = core::internal::ToUTF16(filename); std::wstring wfilename = core::internal::ToUTF16(filename);
if (wfilename.empty()) { if (wfilename.empty()) {
return nullptr; return NULL;
} }
std::wstring wmode = core::internal::ToUTF16(mode); std::wstring wmode = core::internal::ToUTF16(mode);
if (wmode.empty()) { if (wmode.empty()) {
return nullptr; return NULL;
} }
#if __STDC_WANT_SECURE_LIB__
FILE *ret = NULL;
_wfopen_s(&ret, wfilename.data(), wmode.data());
return ret;
#else
return _wfopen(wfilename.data(), wmode.data()); return _wfopen(wfilename.data(), wmode.data());
#endif
#else #else
return fopen(filename, mode); return fopen(filename, mode);
#endif // _WIN32 #endif // _WIN32
} }
bool utilIsTARAchive(const char* file) {
const char* p = strrchr(file, '.');
if ((strcasecmp(p, ".tar") == 0))
return true;
return false;
}
bool utilIsGBAImage(const char* file) { bool utilIsGBAImage(const char* file) {
coreOptions.cpuIsMultiBoot = false; coreOptions.cpuIsMultiBoot = false;
if (strlen(file) > 4) { if (strlen(file) > 4) {
const char* p = strrchr(file, '.'); const char* p = strrchr(file, '.');
if (p != nullptr) { if (p != NULL) {
if ((strcasecmp(p, ".agb") == 0) || (strcasecmp(p, ".gba") == 0) || if ((strcasecmp(p, ".agb") == 0) || (strcasecmp(p, ".gba") == 0) ||
(strcasecmp(p, ".bin") == 0) || (strcasecmp(p, ".elf") == 0)) (strcasecmp(p, ".bin") == 0) || (strcasecmp(p, ".elf") == 0))
return true; return true;
@ -56,7 +71,7 @@ bool utilIsGBImage(const char* file) {
if (strlen(file) > 4) { if (strlen(file) > 4) {
const char* p = strrchr(file, '.'); const char* p = strrchr(file, '.');
if (p != nullptr) { if (p != NULL) {
if ((strcasecmp(p, ".dmg") == 0) || (strcasecmp(p, ".gb") == 0) || if ((strcasecmp(p, ".dmg") == 0) || (strcasecmp(p, ".gb") == 0) ||
(strcasecmp(p, ".gbc") == 0) || (strcasecmp(p, ".cgb") == 0) || (strcasecmp(p, ".gbc") == 0) || (strcasecmp(p, ".cgb") == 0) ||
(strcasecmp(p, ".sgb") == 0)) (strcasecmp(p, ".sgb") == 0))

View File

@ -24,7 +24,7 @@ bool utilIsGzipFile(const char* file) {
if (strlen(file) > 3) { if (strlen(file) > 3) {
const char* p = strrchr(file, '.'); const char* p = strrchr(file, '.');
if (p != nullptr) { if (p != NULL) {
if (strcasecmp(p, ".gz") == 0) if (strcasecmp(p, ".gz") == 0)
return true; return true;
if (strcasecmp(p, ".z") == 0) if (strcasecmp(p, ".z") == 0)
@ -36,22 +36,27 @@ bool utilIsGzipFile(const char* file) {
} }
// Opens and scans archive using accept(). Returns fex_t if found. // Opens and scans archive using accept(). Returns fex_t if found.
// If error or not found, displays message and returns nullptr. // If error or not found, displays message and returns NULL.
fex_t* scanArchive(const char* file, bool (*accept)(const char*), char (&buffer)[2048]) { fex_t* scanArchive(const char* file, bool (*accept)(const char*), char (&buffer)[2048]) {
fex_t* fe; fex_t* fe;
fex_err_t err = fex_open(&fe, file); fex_err_t err = fex_open(&fe, file);
if (!fe) { if (!fe) {
systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s: %s"), file, err); systemMessage(MSG_CANNOT_OPEN_FILE, N_("Cannot open file %s: %s"), file, err);
return nullptr; return NULL;
} }
// Scan filenames // Scan filenames
bool found = false; bool found = false;
while (!fex_done(fe)) { while (!fex_done(fe)) {
#ifdef __STDC_WANT_SECURE_LIB__
strncpy_s(buffer, sizeof buffer, fex_name(fe), sizeof buffer);
#else
strncpy(buffer, fex_name(fe), sizeof buffer); strncpy(buffer, fex_name(fe), sizeof buffer);
#endif
buffer[sizeof buffer - 1] = '\0'; buffer[sizeof buffer - 1] = '\0';
utilStripDoubleExtension(buffer, buffer); utilStripDoubleExtension(buffer, buffer, sizeof buffer);
if (accept(buffer)) { if (accept(buffer)) {
found = true; found = true;
@ -62,14 +67,14 @@ fex_t* scanArchive(const char* file, bool (*accept)(const char*), char (&buffer)
if (err) { if (err) {
systemMessage(MSG_BAD_ZIP_FILE, N_("Cannot read archive %s: %s"), file, err); systemMessage(MSG_BAD_ZIP_FILE, N_("Cannot read archive %s: %s"), file, err);
fex_close(fe); fex_close(fe);
return nullptr; return NULL;
} }
} }
if (!found) { if (!found) {
systemMessage(MSG_NO_IMAGE_ON_ZIP, N_("No image found in file %s"), file); systemMessage(MSG_NO_IMAGE_ON_ZIP, N_("No image found in file %s"), file);
fex_close(fe); fex_close(fe);
return nullptr; return NULL;
} }
return fe; return fe;
} }
@ -96,10 +101,10 @@ IMAGE_TYPE utilFindType(const char* file, char (&buffer)[2048]) {
return utilIsGBAImage(file) ? IMAGE_GBA : IMAGE_GB; return utilIsGBAImage(file) ? IMAGE_GBA : IMAGE_GB;
} }
int(ZEXPORT* utilGzWriteFunc)(gzFile, const voidp, unsigned int) = nullptr; int(ZEXPORT* utilGzWriteFunc)(gzFile, const voidp, unsigned int) = NULL;
int(ZEXPORT* utilGzReadFunc)(gzFile, voidp, unsigned int) = nullptr; int(ZEXPORT* utilGzReadFunc)(gzFile, voidp, unsigned int) = NULL;
int(ZEXPORT* utilGzCloseFunc)(gzFile) = nullptr; int(ZEXPORT* utilGzCloseFunc)(gzFile) = NULL;
z_off_t(ZEXPORT* utilGzSeekFunc)(gzFile, z_off_t, int) = nullptr; z_off_t(ZEXPORT* utilGzSeekFunc)(gzFile, z_off_t, int) = NULL;
} // namespace } // namespace
@ -108,7 +113,7 @@ uint8_t* utilLoad(const char* file, bool (*accept)(const char*), uint8_t* data,
char buffer[2048]; char buffer[2048];
fex_t* fe = scanArchive(file, accept, buffer); fex_t* fe = scanArchive(file, accept, buffer);
if (!fe) if (!fe)
return nullptr; return NULL;
// Allocate space for image // Allocate space for image
fex_err_t err = fex_stat(fe); fex_err_t err = fex_stat(fe);
@ -117,17 +122,17 @@ uint8_t* utilLoad(const char* file, bool (*accept)(const char*), uint8_t* data,
size = fileSize; size = fileSize;
if (size > MAX_CART_SIZE) if (size > MAX_CART_SIZE)
return nullptr; return NULL;
uint8_t* image = data; uint8_t* image = data;
if (image == nullptr) { if (image == NULL) {
// allocate buffer memory if none was passed to the function // allocate buffer memory if none was passed to the function
image = (uint8_t*)malloc(utilGetSize(size)); image = (uint8_t*)malloc(utilGetSize(size));
if (image == nullptr) { if (image == NULL) {
fex_close(fe); fex_close(fe);
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "data"); systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"), "data");
return nullptr; return NULL;
} }
size = fileSize; size = fileSize;
} }
@ -136,11 +141,12 @@ uint8_t* utilLoad(const char* file, bool (*accept)(const char*), uint8_t* data,
int read = fileSize <= size ? fileSize : size; // do not read beyond file int read = fileSize <= size ? fileSize : size; // do not read beyond file
err = fex_read(fe, image, read); err = fex_read(fe, image, read);
fex_close(fe); fex_close(fe);
if (err) { if (err) {
systemMessage(MSG_ERROR_READING_IMAGE, N_("Error reading image from %s: %s"), buffer, err); systemMessage(MSG_ERROR_READING_IMAGE, N_("Error reading image from %s: %s"), buffer, err);
if (data == nullptr) if (data == NULL)
free(image); free(image);
return nullptr; return NULL;
} }
size = fileSize; size = fileSize;
@ -153,9 +159,16 @@ IMAGE_TYPE utilFindType(const char* file) {
return utilFindType(file, buffer); return utilFindType(file, buffer);
} }
void utilStripDoubleExtension(const char* file, char* buffer) { void utilStripDoubleExtension(const char* file, char* buffer, size_t len) {
#if !__STDC_WANT_SECURE_LIB__
(void)len;
#endif
if (buffer != file) // allows conversion in place if (buffer != file) // allows conversion in place
#if __STDC_WANT_SECURE_LIB__
strcpy_s(buffer, len, file);
#else
strcpy(buffer, file); strcpy(buffer, file);
#endif
if (utilIsGzipFile(file)) { if (utilIsGzipFile(file)) {
char* p = strrchr(buffer, '.'); char* p = strrchr(buffer, '.');
@ -170,7 +183,7 @@ gzFile utilAutoGzOpen(const char* file, const char* mode) {
std::wstring wfile = core::internal::ToUTF16(file); std::wstring wfile = core::internal::ToUTF16(file);
if (wfile.empty()) { if (wfile.empty()) {
return nullptr; return NULL;
} }
return gzopen_w(wfile.data(), mode); return gzopen_w(wfile.data(), mode);

View File

@ -25,12 +25,12 @@ static int utilGetSize(int size) {
} }
uint8_t* utilLoad(const char* file, bool (*)(const char*), uint8_t* data, int& size) { uint8_t* utilLoad(const char* file, bool (*)(const char*), uint8_t* data, int& size) {
FILE* fp = nullptr; FILE* fp = NULL;
fp = fopen(file, "rb"); fp = fopen(file, "rb");
if (!fp) { if (!fp) {
log("Failed to open file %s", file); log("Failed to open file %s", file);
return nullptr; return NULL;
} }
fseek(fp, 0, SEEK_END); // go to end fseek(fp, 0, SEEK_END); // go to end
@ -38,18 +38,18 @@ uint8_t* utilLoad(const char* file, bool (*)(const char*), uint8_t* data, int& s
rewind(fp); rewind(fp);
uint8_t* image = data; uint8_t* image = data;
if (image == nullptr) { if (image == NULL) {
image = (uint8_t*)malloc(utilGetSize(size)); image = (uint8_t*)malloc(utilGetSize(size));
if (image == nullptr) { if (image == NULL) {
log("Failed to allocate memory for %s", file); log("Failed to allocate memory for %s", file);
return nullptr; return NULL;
} }
} }
if (fread(image, 1, size, fp) != (size_t)size) { if (fread(image, 1, size, fp) != (size_t)size) {
log("Failed to read from %s", file); log("Failed to read from %s", file);
fclose(fp); fclose(fp);
return nullptr; return NULL;
} }
fclose(fp); fclose(fp);

View File

@ -20,6 +20,25 @@ bool utilWritePNGFile(const char* fileName, int w, int h, uint8_t* pix) {
int sizeY = h; int sizeY = h;
switch (systemColorDepth) { switch (systemColorDepth) {
case 8: {
uint8_t* pixU8 = (uint8_t*)pix + (w + 4);
for (int y = 0; y < sizeY; y++) {
for (int x = 0; x < sizeX; x++, pixU8++) {
// White color fix
if (*pixU8 == 0xff) {
*b++ = 0xff;
*b++ = 0xff;
*b++ = 0xff;
} else {
*b++ = (((*pixU8 >> 5) & 0x7) << 5);
*b++ = (((*pixU8 >> 2) & 0x7) << 5);
*b++ = ((*pixU8 & 0x3) << 6);
}
}
pixU8 += 4;
}
} break;
case 16: { case 16: {
uint16_t* p = (uint16_t*)(pix + (w + 2) * 2); // skip first black line uint16_t* p = (uint16_t*)(pix + (w + 2) * 2); // skip first black line
for (int y = 0; y < sizeY; y++) { for (int y = 0; y < sizeY; y++) {
@ -77,7 +96,12 @@ bool utilWritePNGFile(const char* fileName, int w, int h, uint8_t* pix) {
bool utilWriteBMPFile(const char* fileName, int w, int h, uint8_t* pix) { bool utilWriteBMPFile(const char* fileName, int w, int h, uint8_t* pix) {
uint8_t writeBuffer[512 * 3]; uint8_t writeBuffer[512 * 3];
#if __STDC_WANT_SECURE_LIB__
FILE* fp = NULL;
fopen_s(&fp, fileName, "wb");
#else
FILE* fp = fopen(fileName, "wb"); FILE* fp = fopen(fileName, "wb");
#endif
if (!fp) { if (!fp) {
systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName); systemMessage(MSG_ERROR_CREATING_FILE, N_("Error creating file %s"), fileName);
@ -125,6 +149,34 @@ bool utilWriteBMPFile(const char* fileName, int w, int h, uint8_t* pix) {
int sizeY = h; int sizeY = h;
switch (systemColorDepth) { switch (systemColorDepth) {
case 8: {
uint8_t* pixU8 = 0;
pixU8 = (uint8_t*)pix + ((w + 4) * (h));
for (int y = 0; y < sizeY; y++) {
for (int x = 0; x < sizeX; x++, pixU8++) {
// White color fix
if (*pixU8 == 0xff) {
*b++ = 0xff;
*b++ = 0xff;
*b++ = 0xff;
} else {
*b++ = ((*pixU8 & 0x3) << 6);
*b++ = (((*pixU8 >> 2) & 0x7) << 5);
*b++ = (((*pixU8 >> 5) & 0x7) << 5);
}
}
pixU8++;
pixU8++;
pixU8++;
pixU8++;
pixU8 -= 2 * (w + 4);
fwrite(writeBuffer, 1, 3 * w, fp);
b = writeBuffer;
}
} break;
case 16: { case 16: {
uint16_t* p = (uint16_t*)(pix + (w + 2) * (h) * 2); // skip first black line uint16_t* p = (uint16_t*)(pix + (w + 2) * (h) * 2); // skip first black line
for (int y = 0; y < sizeY; y++) { for (int y = 0; y < sizeY; y++) {

View File

@ -10,4 +10,6 @@
bool utilWritePNGFile(const char*, int, int, uint8_t*); bool utilWritePNGFile(const char*, int, int, uint8_t*);
bool utilWriteBMPFile(const char*, int, int, uint8_t*); bool utilWriteBMPFile(const char*, int, int, uint8_t*);
extern bool no_border;
#endif // VBAM_CORE_BASE_IMAGE_UTIL_H_ #endif // VBAM_CORE_BASE_IMAGE_UTIL_H_

Some files were not shown because too many files have changed in this diff Show More