emuforge

Status

What works today, and what does not. ROADMAP.md says what comes next.

All parts are joined, and the app has the base from forge. Some of the console was measured on one console, and much is still a named guess. What games do is in the compatibility database, which has no results yet.

Starting games

  • Games with the 6105 chip begin with our own start, as their boot code needs the console's own program in the RSP's memory: n64emu does what a boot code leaves, by what the 6102's leaves, with three named guesses for the 6105.
  • The 6105's challenge is not answered. Ten of these files send one, and what a game does without the answer is not known. No source that may be used gives the answer. X-Scale's published algorithm is not used: it was made from another emulator's data, and the decision is to wait for a way that rests only on clean sources.
  • Values that no source gives, and with which games start, are named guesses: the stack pointer and t3 at the start of the boot code, and what a 32-bit write in the MI's normal mode puts on the other half of the bus (memory and the bus, the PIF).

The parts

  • The processor's interpreter, from NEC's manual: tested over every row of the manual's opcode tables, with its own programs, and with random programs cut into pieces in many ways, with the same result. Some of its guesses were measured on a console. What the manual does not say is a named guess, and the multiplication bug of early consoles is missing. A recompiler for it was built, and removed: it was exact, and never faster than the interpreter (the processor).
  • Floating point arithmetic: agrees with exact calculations. Nine rules that the manual leaves open were measured on a console, and n64emu gives the same. Two are still guesses.
  • The RSP, a port: its interpreter agreed with ares wherever the two were compared. Its recompiler (n64-rsp-jit, on Cranelift) is on in every build, and the interpreter runs each step that uses the rest of the console. It gave the same hashes of memory, sound, state and picture as the interpreter in every one of 900 frames of the games it was checked on (the RSP). What was measured (Super Mario 64 (USA), 900 frames, n64emu-dev, the computer's user cycles by perf, build 3bfbfb3, with other work on the machine): in a second run, with its hot code compiled at the start, the RSP's own work in play took about 12.5 G cycles against the interpreter's 21.9 G (sums of a profile's parts). The whole run took 41.7 G against 39.4 G, as compiling at the start took 2.25 s. So the run as a whole was not faster yet then, and later builds were not timed.
  • The RDP and the VI's filters, a port, on Vulkan: the same bytes as the original in our own 63 lists of commands, but where the original has no defined result or its noise is not used, and the same on two drivers (an Intel Arc A750 and llvmpipe). 6,000 random and broken lists passed. Registers of the VI that change in the middle of a field are not ported (the RDP).
  • Memory and its timing: a model with named guesses. A read's time, the PI's address time and the ninth bits are fitted to our own measurements on a console (memory and the bus).
  • Cartridges and the PIF: file formats, saves, controllers, paks, the clock, the reset button and the state in which a game starts. SRAM of more than 32 KB cannot be saved in full, and Controller Paks have one bank (cartridges, the PIF).
  • The 64DD is not there. It comes after cartridges, with a survey of its own.

The app

apps/n64emu is forge's standalone app (forge-app, at a pinned commit) with a thin layer of ours. It builds only for x86-64 for now, and was built and tried on Linux only: the recompilers' code heap refuses other processors (development).

  • The controller: the stick is the gamepad's left stick and W A S D. A key pushes it 80 of the 127 of each way, which is a guess. The C buttons are the right stick and I J K L, and the D-pad is the gamepad's and the arrows. All can be changed in Controls.
  • The menu has the GPU, the render scale, the Pak and Rumble, with forge's own settings. The GPU is Automatic (a discrete GPU, or else an integrated one, or else the CPU), "CPU (slow)", or a device by its name. Render scale (1x, 2x, 4x) changes while a game runs.
  • What is plugged in: a Rumble Pak in each controller by default. Pak puts a Controller Pak in each instead, which turns Rumble off, and the other way round. Controllers are plugged in as forge has them: the first always, and the others while they have a gamepad.
  • The region, the memory, the save chip and the security chip are found from the game, and are not in the menu. The memory has the Expansion Pak. n64emu-dev can set each of them for developers.
  • Rumble: a Rumble Pak's motor makes the player's gamepad rumble, all of the way or not at all.
  • The reset button is F9 and the menu's Reset game. It is held for one frame.
  • Saves: the game's own is in saves/. Controller Paks are the player's own, one for each port (cards/port1.sav to port4.sav), whatever game is played. A save of an earlier build of the app has the paks in it: such a pak becomes the player's own for its port when that port has none. When the port has one that differs, the game does not start, and says so. Both files are left as they are, so that the player chooses.
  • Each game's hot code and its list of the RDP's shaders are kept in the data folder, and compiled before the first frame, so that a game that ran before compiles nothing while it is played.
  • The picture is shown one frame late, so the console does not wait for the GPU. When the RDP is on the GPU that the window's OpenGL draws with, the picture is not copied. Otherwise it is read back once.
  • When the GPU fails, forge says why, runs no more frames and writes no state, until a state is loaded or the game is reset.

What is still open in it:

A controls.txt of an earlier buildit had the stick as four buttons with other names. Those names are now the stick's directions, so such a file makes the stick the D-pad. Choose the defaults in Controls, or delete the file
A Controller Pak that a state takes outthe core then gives the pak that the port had when the game started, or none, so forge keeps that, and copies the one from before the state beside it
The stick's edge on the keyboard80 is a guess, to be measured on a console
--data-dirforge-app does not give it to the emulator, so the hot code and the shader lists always go to the default data folder
Pictures with no copyused in the app on an Intel Arc A750, and checked there with a second Vulkan device in OpenGL's place. Where OpenGL is on another GPU or cannot share, the picture goes through memory

apps/n64emu-lab is forge's lab of stepped consoles (forge-sweep). Its list of games is empty, so a sweep runs nothing until the list is made. It was tried on our own test program only. Its directions push the stick and the D-pad together, and its RDP runs on a device of the CPU type.

Commandments not kept yet

What every core has to have, and what is missing here. Take a row out when a test shows that it is kept.

Missing
1, 2emuforge's interface, the C API, --core and libretro, and mapping buttons from a front end. There is only the standalone mode, and no package
5rewind, and of what the base has for a console that draws in 3D, antialiasing (FXAA) and anisotropic filtering. The render scale is there
6savestates have versions, and each crate has tests of its state
8the standard for its speed, and its measurement in use, in each mode, from the core to the screen
9the lab's list of games, and so a public record of what games do. Test programs are not run by tools/check.sh or CI yet. The published binary is not tested in every mode

From commit 9ba9172cfa64. Edit this page