Commit graph

215 commits

Author SHA1 Message Date
刘皓
482f21bc2e
Fix Darwin compilation error in binding-sandbox/graphics-binding.cpp 2025-04-30 23:39:51 -04:00
刘皓
5b94ce4e80
Refactor binding-sandbox header files into .cpp files 2025-04-30 22:31:13 -04:00
刘皓
09bcb1532c
Refactor out the SANDBOX_COROUTINE() macro
Removing this macro allows the correct line numbers to show up in GDB
stack traces.
2025-04-30 19:00:48 -04:00
刘皓
2de7a050db
Use property binding helper macros in libretro builds 2025-04-30 15:47:02 -04:00
刘皓
eb0b011734
Add mouse bindings in libretro builds 2025-04-30 12:26:18 -04:00
刘皓
2373a22a70
Complete the graphics bindings in libretro builds 2025-04-29 14:51:19 -04:00
刘皓
a3412bbe41
Fix Graphics.transition(0) being ignored in libretro builds 2025-04-29 14:13:41 -04:00
刘皓
8182f3591c
Fix typo in wrap_property in libretro binding utils 2025-04-29 00:07:54 -04:00
刘皓
c51e0d2701
Complete the bitmap bindings in libretro builds 2025-04-28 16:15:11 -04:00
刘皓
c0b0816b8a
Add wrap_property helper function for bindings in libretro builds 2025-04-28 13:39:06 -04:00
刘皓
fbfb14d7ad
Implement more of the bitmap bindings for libretro builds 2025-04-27 22:18:06 -04:00
刘皓
1c6debd030
Complete the audio bindings in libretro builds 2025-04-27 18:51:30 -04:00
刘皓
0b9baa1007
Add mutex and condition variable polyfill for libretro 3DS builds 2025-04-27 00:49:47 -04:00
刘皓
380fcc0ed2
Complete the bindings for Color, Tone and Rect in libretro builds 2025-04-26 18:33:53 -04:00
刘皓
0d07aff3e2
Remove exceptions from the sandbox implementation in libretro builds 2025-04-25 13:31:32 -04:00
刘皓
003602eff8
Only poll input in libretro builds when Input.update is called 2025-04-25 11:01:12 -04:00
刘皓
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
刘皓
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
刘皓
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
刘皓
c32073d200
Fix memory leak in dfree implementation in libretro builds 2025-04-20 17:48:19 -04:00
刘皓
244d88908c
Remove unnecessary reserve() in binding-base.h 2025-04-20 13:40:49 -04:00
刘皓
ced3e697bd
Fix Graphics.fadeout/.fadein causing screen flashing in libretro builds 2025-04-18 11:54:23 -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
刘皓
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
刘皓
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
刘皓
8c16bc0092
Implement config loading in libretro builds 2025-04-11 23:12:05 -04:00
刘皓
299650159f
Implement changing the frame rate in libretro builds 2025-04-10 16:51:25 -04:00
刘皓
ae19c0e42e
Reconcile the standalone and libretro build systems 2025-04-09 23:52:12 -04:00
刘皓
8fa20c660a
Implement audio fading in libretro builds 2025-04-07 14:33:50 -04:00
刘皓
9f3329e1cb
Implement more of the audio bindings for libretro builds 2025-04-06 22:38:10 -04:00
刘皓
b1f1fb7571
Make Graphics.transition a no-op in libretro builds when not frozen 2025-04-05 21:37:27 -04:00
刘皓
6b59b60fe7
Fix incorrect initialize_copy bindings in libretro builds 2025-04-05 21:10:31 -04:00
刘皓
77c5ee65fd
Use rb_num2int instead of rb_num2uint in libretro graphics bindings 2025-04-05 21:07:37 -04:00
刘皓
d60b23781b
Implement Graphics.transition binding and related bindings in libretro builds 2025-04-05 14:35:43 -04:00
刘皓
7a2702bf95
Complete more of the font bindings for libretro builds 2025-04-04 12:20:33 -04:00
刘皓
981a7a2bd0
Remove unnecessary coroutines from libretro color= binding implementations 2025-04-02 13:22:31 -04:00
刘皓
8457ac1598
Rename mkxp-threads to mkxp-polyfill 2025-04-02 13:06:17 -04:00
刘皓
23781a645b
Implement bindings for changing font size and color in libretro builds 2025-03-31 18:48:14 -04:00
刘皓
dcd29f44a9
Remove dependency on libzip in libretro builds 2025-03-31 13:26:54 -04:00
刘皓
de5216c3ce
Implement loading from encrypted game archives in libretro builds 2025-03-30 23:37:19 -04:00
刘皓
d9f32b97a7
Fix libretro compilation error when using devkitARM 2025-03-29 13:40:13 -04:00
刘皓
6f6d0044ff
Decrease size of Ruby in libretro builds
This decreases the size of the libretro core by around 10% without
having a discernable effect on game compatibility.
2025-03-27 22:00:00 -04:00