Rayyan Ansari 435c06e55d JIT: add support for PaX MPROTECT on NetBSD
Call mprotect to switch the code memory protection between RW and RX
when needed on NetBSD, which is required due to PaX MPROTECT being
enabled on all binaries by default by the operating system.

This removes the need to run `paxctl +m melonDS`.

This patch was tested on a x64 VM running NetBSD 10.1. I can confirm
that this fixes JIT on NetBSD, however fastmem does not work as of yet
due to a segfault.

Although invoking mprotect does incur a performance penalty, it is still
faster than running without JIT.

A potentially faster alternative is to back the JIT code memory with an
anonymous file descriptor in physical memory, then map this physical
memory to two virtual memory addresses: one with RW permissions for code
generation, the other with RX permissions for code execution.

Instead of using platform-specific methods to create the anonymous file
descriptor, such as memfd_create on Linux, we could copy a 'trick' that
we use in fastmem already: calling shm_open, a POSIX standard, with a
random name, and immediately unlinking it.

However, this would add some more complexity and would be a bit harder
to implement. For now, this works fine. Perhaps another time...
2025-08-29 16:48:03 +01:00
2025-08-16 09:13:27 +02:00
2025-08-16 09:13:27 +02:00
2025-05-27 00:31:37 +02:00
2025-08-15 13:04:38 +02:00
2017-03-16 23:01:22 +01:00
2025-07-13 22:34:38 +02:00
2025-08-16 09:13:27 +02:00

melonDS


DS emulator, sorta

The goal is to do things right and fast, akin to blargSNES (but hopefully better). But also to, you know, have a fun challenge :)


How to use

Firmware boot (not direct boot) requires a BIOS/firmware dump from an original DS or DS Lite. DS firmwares dumped from a DSi or 3DS aren't bootable and only contain configuration data, thus they are only suitable when booting games directly.

Possible firmware sizes

  • 128KB: DSi/3DS DS-mode firmware (reduced size due to lacking bootcode)
  • 256KB: regular DS firmware
  • 512KB: iQue DS firmware

DS BIOS dumps from a DSi or 3DS can be used with no compatibility issues. DSi BIOS dumps (in DSi mode) are not compatible. Or maybe they are. I don't know.

As for the rest, the interface should be pretty straightforward. If you have a question, don't hesitate to ask, though!

How to build

See BUILD.md for build instructions.

TODO LIST

  • better DSi emulation
  • better OpenGL rendering
  • netplay
  • the impossible quest of pixel-perfect 3D graphics
  • support for rendering screens to separate windows
  • emulating some fancy addons
  • other non-core shit (debugger, graphics viewers, etc)

TODO LIST FOR LATER (low priority)

  • big-endian compatibility (Wii, etc)
  • LCD refresh time (used by some games for blending effects)
  • any feature you can eventually ask for that isn't outright stupid

Credits

  • Martin for GBAtek, a good piece of documentation
  • Cydrak for the extra 3D GPU research
  • limittox for the icon
  • All of you comrades who have been testing melonDS, reporting issues, suggesting shit, etc

Licenses

GNU GPLv3 Image

melonDS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

External

  • Images used in the Input Config Dialog - see src/frontend/qt_sdl/InputConfig/resources/LICENSE.md
Description
DS emulator, sorta
Readme GPL-3.0 51 MiB
Languages
C++ 55.8%
C 42.4%
CMake 0.8%
Assembly 0.7%
Ruby 0.1%