Commit graph

2267 commits

Author SHA1 Message Date
刘皓
2b3a97e83c
Fix frame duping bugs in libretro builds
* Fixed a bug where frames are still duped when the frontend is
  fast-forwarding

* Fixed a bug where manual frame duping (without
  `RETRO_ENVIRONMENT_GET_CAN_DUPE`) causes screen flickering during a
  `Graphics.transition` call
2025-04-25 10:45:11 -04:00
刘皓
5c14f2352e
Implement frame duping properly in libretro builds 2025-04-24 15:36:26 -04:00
刘皓
a12e3caf77
Always run at display rate in libretro builds
Apparently we're not supposed to use
`RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO` to change the FPS. The core
should be running at the display refresh rate and resampling the game's
video output.
2025-04-24 15:08:42 -04:00
刘皓
286ae0fe4d
Fix resource starvation in deinit_sandbox() when using threaded audio 2025-04-24 11:32:04 -04:00
刘皓
784ec38b3d
Throttle the frame rate in libretro builds with threaded audio
When not using the threaded audio driver, the frontend is supposed to
block until enough audio samples have been rendered for one frame, so
the frontend throttles the frame rate automatically if the core's frame
rate is slower than the display frame rate.

However, when using the threaded audio driver, there's no more
throttling, so we have to do it ourselves.
2025-04-23 16:58:03 -04:00
刘皓
1474a2a03f
Switch back to Emscripten 4.0.6 in the autobuild 2025-04-23 14:29:13 -04:00
刘皓
21596fb9b0
Disable LTO for libretro Emscripten build 2025-04-23 12:54:21 -04:00
刘皓
fae9df6324
Add a mirror URL for libiconv 2025-04-23 10:31:14 -04:00
刘皓
6e0ec968bc
Switch back to Emscripten 3.1.46 in the autobuild 2025-04-23 01:15:06 -04:00
刘皓
e5a4309402
Try using the latest version of Emscripten in the autobuild 2025-04-22 21:47:38 -04:00
刘皓
a3e53a944b
Disable AudioWorklet driver for now 2025-04-22 20:22:47 -04:00
刘皓
98cc4bb9a0
Set HAVE_AL=0 in libretro Emscripten autobuild 2025-04-22 19:10:42 -04:00
刘皓
fafad03874
Temporarily use nightly build of RetroArch in libretro Emscripten autobuild 2025-04-22 16:51:38 -04:00
刘皓
4b78778a38
Upload mkxp-z_libretro.worker.js in the threaded libretro Emscripten autobuild 2025-04-22 14:33:56 -04:00
刘皓
71653549f2
Add threaded audio driver in libretro builds
This adds a new driver for audio in libretro builds for devices with
multithreading support that defers audio rendering to a worker thread
provided by the libretro frontend.

The threaded driver has the advantage that video lag will not also cause
the audio to lag, which is very noticeable since it manifests in the
form of audio crackling when it happens.
2025-04-22 12:17:15 -04:00
刘皓
52d65cfe96
Decrease Ruby stack size in libretro builds from 16 MiB to 2 MiB
I highly doubt any game needs that much stack space.
2025-04-21 13:05:17 -04:00
刘皓
46bd055c0a
Fix memory leak in cont_restore_thread in Ruby in libretro builds 2025-04-21 11:16:21 -04:00
刘皓
75946ab6a5
Download uchardet tarball instead of Git repository in libretro builds
The Git repository seems to be down.
2025-04-20 23:04:40 -04:00
刘皓
fef948a1c8
Fix needsRewind audio flag in libretro builds
This fixes a number of issues with the audio in libretro builds, such as
a problem where the ME stream resumes from its previous position when
played instead of starting from the beginning.
2025-04-20 21:23:35 -04:00
刘皓
c32073d200
Fix memory leak in dfree implementation in libretro builds 2025-04-20 17:48:19 -04:00
刘皓
23affbe96f
Remove unnecessary cleanup code from rb_ec_tag_jump() 2025-04-20 14:21:41 -04:00
刘皓
244d88908c
Remove unnecessary reserve() in binding-base.h 2025-04-20 13:40:49 -04:00
刘皓
f00cfdbcf5
Rework the patches for Ruby WASI memory leaks 2025-04-20 11:56:50 -04:00
刘皓
6c83fbe180
Implement UTF-8 parsing for Bitmap.draw_text/.text_size in libretro builds 2025-04-19 23:37:39 -04:00
刘皓
ae0a7a7f87
Implement text shadow and outline in libretro builds 2025-04-19 11:53:53 -04:00
刘皓
ced3e697bd
Fix Graphics.fadeout/.fadein causing screen flashing in libretro builds 2025-04-18 11:54:23 -04:00
刘皓
996e47ed81
Fix geometry calculation in core.cpp 2025-04-18 10:42:30 -04:00
刘皓
56056914d7
Enable subimage fix by default when using OpenGL ES in libretro builds 2025-04-17 22:08:06 -04:00
刘皓
dafcb15ea5
Add enough bindings in libretro builds to play Crysalis 2025-04-17 14:17:17 -04:00
刘皓
e1c0e62aed
Fix Font.default_size binding in libretro builds 2025-04-17 11:34:42 -04:00
刘皓
35ffaff26e
Add bindings for snap_to_bitmap in libretro builds 2025-04-17 00:00:03 -04:00
刘皓
726b7f77f8
Fix bugs in VX/VXA input and window bindings in libretro builds 2025-04-16 23:42:52 -04:00
刘皓
b3976bf61e
Fix several bugs and missing bindings in libretro builds 2025-04-16 21:57:13 -04:00
刘皓
5a5fcd26c5
Delete copy constructor for stack_frame_guard and stack_frame
The copy constructors are causing problems when the `fiber.stack` vector
gets reallocated when its capacity is full, since when vectors are
reallocated, the elements are moved (or copied if there's no usable move
constructor) to the reallocated memory and then the original elements
are destroyed.

This premature calling of destructors leads to double-free and
use-after-free errors.

I fixed it by deleting the copy constructors and explicitly defining
move constructors.
2025-04-16 21:39:04 -04:00
刘皓
8e9e7700f0
Fix stack pointer corruption in binding-base.h 2025-04-16 19:21:48 -04:00
刘皓
3ace4ad6ae
Merge branch 'misc-fixes' into libretro 2025-04-15 23:25:55 -04:00
刘皓
8bae6e65db
Merge branch 'dev' into misc-fixes 2025-04-15 23:16:06 -04:00
Splendide Imaginarius
8243ee53e9
Merge pull request #242 from Splendide-Imaginarius/mkxp-z-matrix
Some checks failed
Automatic Build / Ubuntu 22.04 x86_64 (push) Failing after 3s
Automatic Build / Ubuntu 22.04 arm64 (push) Failing after 2s
Automatic Build / Ubuntu 22.04 armv6 (push) Failing after 2s
Automatic Build / Ubuntu 22.04 armv7 (push) Failing after 2s
Automatic Build / Ubuntu 22.04 armv7-neon (push) Failing after 2s
Automatic Build / Ubuntu 22.04 power8le (push) Failing after 2s
Automatic Build / Ubuntu 22.04 power9le (push) Failing after 2s
Automatic Build / Ubuntu 22.04 riscv64 (push) Failing after 2s
Automatic Build / Ubuntu 22.04 s390x (push) Failing after 3s
Automatic Build / Windows (push) Has been cancelled
Automatic Build / macOS (push) Has been cancelled
README: Link to Matrix space
2025-04-16 01:58:24 +00:00
Splendide Imaginarius
8f3fbd972d README: Link to Matrix space
Fixes https://github.com/mkxp-z/mkxp-z/issues/85
2025-04-16 01:16:26 +00:00
刘皓
8277390e13
Move embedtool.cpp into tools directory 2025-04-15 12:20:22 -04:00
刘皓
c7f35c96c9
Make sandbox-bindgen allocate varargs buffers on the stack
Not sure why, but this fixes crashes when calling variadic functions in
the Ruby API in libretro builds when Ruby is built without `-DNDEBUG`.
Maybe the previous way of calling varargs functions was undefined
behaviour somehow.
2025-04-14 21:04:14 -04:00
刘皓
911cfc29f5
Fix sandbox-bindgen.rb not generating bindings for functions that take no arguments 2025-04-13 22:48:58 -04:00
刘皓
dae17511aa
Rescue all Ruby errors in libretro builds instead of only StandardErrors
`rb_rescue` only catches `StandardError`s, which doesn't include things
like Ruby syntax errors that we'd like to catch. We need to explicitly
use `rb_rescue2` to catch `Exception` in order to catch everything.
2025-04-13 22:18:41 -04:00
刘皓
06819fb9a9
Start implementing VX/VX Ace bindings in libretro builds 2025-04-13 17:30:50 -04:00
刘皓
539dbb3a84
Add SDL_IntersectRect implementation for libretro builds 2025-04-13 12:41:25 -04:00
刘皓
7a01d1cc56
Fix libretro compilation errors caused by the config-reading implementation 2025-04-12 17:09:41 -04:00
刘皓
07a03be7df
Use libiconv instead of the system iconv in libretro builds 2025-04-12 16:40:50 -04:00
刘皓
8c16bc0092
Implement config loading in libretro builds 2025-04-11 23:12:05 -04:00
刘皓
c5af94c25a
Merge branch 'misc-fixes' into libretro 2025-04-11 12:47:05 -04:00
刘皓
3625ab9989
Merge branch 'dev' into misc-fixes 2025-04-11 12:46:48 -04:00