UNES
is an emulator plug-in that runs Nintendo Entertainment System
Nintendo FC Game *.nes
files in the Unity
environment. The project is based on Emulator.NES to achieve cross-platform through Unity
.
-
- 2.1. Resources loading
- 2.2. FileStream loading
-
- 3.1. Filter Mode
- 3.2. Logic Thread
- 3.3. Input Config
-
- Create a new or select a
GameObject
in the scene and add theUNESBehaviour
component.
- Create a new or select a
-
- Create a new
RenderTexture
to render the game screen.
- Create a new
-
- Use any way you want to display the
RenderTexture
file in the game.
- Use any way you want to display the
-
- Use the default input method or realize custom input on demand.
-
- Implement the loading of
*.nes
files on demand to obtainbyte[]
format data.
- Implement the loading of
-
- Call the
UNESBehaviour.Boot(byte[] romData)
interface to start the game.
- Call the
If you need to use the Resources.Load()
interface to load the ROM file, you need to pay attention to changing the .nes
extension to .bytes
, and then use the following method to load:
var bytes = Resources.Load<TextAsset>(romPath).bytes;
UNES.BootRom(bytes);
If you use the method of loading the original file byte stream, you can directly call the UNESBehaviour.Boot(byte[] romData)
interface.
Filter mode of game screen rendering:
Mode | Description |
---|---|
Point | Texture pixels become blocky at close range. |
Bilinear | Bilinear bilinear filtering-averages the texture samples. |
Trilinear | Trilinear Trilinear filtering-averages texture samples and blends between mipmap levels. |
For detailed explanation, please refer to FilterMode
If the Logic Thread
option is turned on, the simulation calculations of the CPU
and PPU
parts will be executed by other thread, and the Unity main thread is only responsible for reading the status data to refresh the game screen, which can significantly increase the number of frames.
Customize the physical keyboard keys corresponding to the native keys.
Default configuration control method:
Native buttons | Operation buttons |
---|---|
Start | Num1 |
Select | Num2 |
Up | Up Arrow |
Down | Down Arrow |
Left | Left Arrow |
Right | Right Arrow |
A | A |
B | S |
Obtain the byte array format of the original ROM file in any way for the emulator to start:
public void Boot(byte[] romData);
The simulator itself only provides the data of the current running state, and does not provide the persistence implementation of the data file. Need to realize the preservation of archived data by oneself.
public byte[] GetSaveData();
Obtain archive file data in any way for the emulator to restore game progress:
public void LoadSaveData(byte[] saveData);
There are many Mapper extension formats in NES, and the implemented part of the project implementation can theoretically support most common games.
0 | NROM |
1 | MMC1 |
2 | UxROM |
3 | CNROM |
4 | MMC3 |
7 | AxROM |
9 | MMC2 (Mike Tyson's Punch-Out!!) |
10 | MMC4 |
11 | Color Dreams |
66 | GxROM |
71 | Camerica |
79 | NINA-003-006 |
94 | Senjou no Ookami |
140 | Jaleco |
155 | MMC1A |
180 | Crazy Climber |
206 | DxROM |
- Audio
APU
simulation is not implemented. - Only realize Unity basic input system and pure keyboard operation mode.
- Not all Mappers are implemented.
- The performance of the PPU simulation part is low, and the frame number is unstable on the low-end mobile devices.