Counts requeues at the three sites in dequeue_external_messages,
wait_for_external_message, and wait_for_external_message_timed. A
sustained nonzero rate means a target OSMesgQueue is being overrun —
the existing requeue mechanism prevents a softlock, but the
underlying receiver-thread starvation is worth investigating, so
giving runners a way to observe it is useful.
Adds:
- static std::atomic<uint64_t> g_external_requeues
- extern "C" uint64_t ultramodern_external_requeues(void) accessor
- fetch_add at each of the three requeue sites (one bulk-add for
the dequeue path which collects then bulk-requeues, single-adds
for the two wait paths which requeue inline)
Zero impact on the hot path. Atomics fire only when the requeue path
fires; in normal operation that's never. The dequeue site uses a
single bulk fetch_add for the whole batch instead of N individual
adds.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .github/workflows | ||
| librecomp | ||
| N64Recomp@81213c1831 | ||
| thirdparty | ||
| ultramodern | ||
| .gitignore | ||
| .gitmodules | ||
| CMakeLists.txt | ||
| COPYING | ||
| README.md | ||
N64 Modern Runtime
A modern runtime for traditional ports and recompilations of N64 games.
The runtime is consists of two libraries: ultramodern and librecomp.
ultramodern
ultramodern is a reimplementation of much of the core functionality of libultra. It can be used with either statically recompiled projects that use N64Recomp or direct source ports. It implements the following libultra functionality:
- Threads
- Controllers
- Audio
- Message Queues
- Timers
- RSP Task Handling
- VI timing
Platform-specific I/O is handled via callbacks that are provided by the project using ultramodern. This includes reading from controllers and playing back audio samples.
ultramodern expects the user to provide and register a graphics renderer. The recommended one is RT64.
librecomp
librecomp is a library meant to be used to bridge the gap between code generated by N64Recomp and ultramodern. It provides wrappers to allow recompiled code to call ultramodern. Librecomp also provides some of the remaining libultra functionality that ultramodern doesn't provide, which includes:
- Overlay handling
- PI DMA (ROM reads)
- EEPROM, SRAM and Flashram saving (these may be partially moved to ultramodern in the future)
Building
The recommended usage of these libraries is to include them in your project's CMakeLists.txt file via add_subdirectory. This project requires C++20 support and was developed using Clang 15, older versions of clang may not work. Recent enough versions of MSVC and GCC should work as well, but are not regularly tested.
These libraries can be built in a standalone environment (ie, developing new features for the libraries of this project) via the following:
cmake -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Debug
cmake --build build