Homebrew WIP NES Emulator Port

Fadi5555

Well-Known Member
Member
Joined
Jan 3, 2018
Messages
499
Trophies
0
Age
35
XP
2,402
Country
United States
Hey everyone, this is my first time posting here. I recently started work on porting an NES emulator to the switch.

My progress at this point is:
- emulator runs on switch
- no audio support
- no save support
- frame rate is a bit slow but playable

This project is more of a just for fun project I wanted to try out but I intend to:
- get audio working
- get saving working
- optimize to help frame rate
- build a UI that resembles the NES classic

If anyone is interested in contributing to the project just let me know. I will release the emulator along with the source as soon as I am done or if demand for it is high I could just release in stages.

One question I have for any switch developers out there is..
is there a way on the switch to calculate delta time in milliseconds ? I've tried using time.h along with clock(), but clock() doesn't seem to work on the switch.

Here is a video of the current state of the emulator:

That’s really amazing.
Please can you make this emu running in fullscreen? Because all current emulators are running pretty good but with lack of fullscreen.
 

waywardson07

Member
OP
Newcomer
Joined
May 12, 2018
Messages
12
Trophies
0
XP
161
Country
United States
You can use svcGetSystemTick (or just read the CNTPCT_EL0 system register directly since thats the only thing the svc does anyway) to get the system tick count, it's frequency is 19200000 hz so you just need to divide the value you read from it by 19200 (remember to use floating point or fixed point integer, you can just multiply by 1 / 19200 since multiplications are usually faster than divisions) to get a milliseconds timestamp. You can then store this value on a variable and calculate the delta on the next iteration of your main loop.

Thank you so much! life saver!

Quick question which NES emulator are you porting over?

It is a port of fogleman's NES emulator written in go. I would link to it but I am unable to post links at this point. there is a link in the readme file in the OP.

Also, I have updated the original post with a download link to the emulator for people to test out. I will work on getting the GitHub up next for those people I have told about it.
 
  • Like
Reactions: Leonidas87

Leonidas87

Well-Known Member
Member
Joined
Jul 15, 2014
Messages
651
Trophies
0
Location
Toronto, Ontario
Website
www.youtube.com
XP
960
Country
Canada
Roms are correct but when it loads I'm stuck at a black screen.

Dont give up on this emulator @waywardson07 options are always good and the Other NES emulator is not running well and is buggy also
 

Attachments

  • 20180523_000451.jpg
    20180523_000451.jpg
    2.5 MB · Views: 332
  • Like
Reactions: machine69_420

Leonidas87

Well-Known Member
Member
Joined
Jul 15, 2014
Messages
651
Trophies
0
Location
Toronto, Ontario
Website
www.youtube.com
XP
960
Country
Canada
Want to say thanks to the developer there has been some great progression.

Some games not running with the alternative NES emulator seem to run with this.

Audio is not running yet but give it time.

Speed will increase.

Features will then be added.

All the best and here's a video showing NES ClassicSwitch NES Emulator:

 

waywardson07

Member
OP
Newcomer
Joined
May 12, 2018
Messages
12
Trophies
0
XP
161
Country
United States
I have a question for any devs out there willing to answer. So I am having trouble with audio on the switch.
I am able to get audio playback to work, but it causes severe lag. I am not using sdl2, just plain c with libnx.
The emulator outputs samples in float format.
I've taken a look at the audio examples and it seems the pcm format is u8. So by converting the output samples and adding them in the buffer I am able to get playback to work following the audio examples but as I said above it causes major lag.

At this point I have the emulator running at full speed even when scaled full screen. If I could get a little guidance on this part that would be much appreciated.

EDIT: Also updated the OP with alpha v0.0.3
 
Last edited by waywardson07,

Leonidas87

Well-Known Member
Member
Joined
Jul 15, 2014
Messages
651
Trophies
0
Location
Toronto, Ontario
Website
www.youtube.com
XP
960
Country
Canada
I have a question for any devs out there willing to answer. So I am having trouble with audio on the switch.
I am able to get audio playback to work, but it causes severe lag. I am not using sdl2, just plain c with libnx.
The emulator outputs samples in float format.
I've taken a look at the audio examples and it seems the pcm format is u8. So by converting the output samples and adding them in the buffer I am able to get playback to work following the audio examples but as I said above it causes major lag.

At this point I have the emulator running at full speed even when scaled full screen. If I could get a little guidance on this part that would be much appreciated.

EDIT: Also updated the OP with alpha v0.0.3


@jakibaki would you be willing to assist or guide @waywardson07 in any way?

Even with just a link or some specifics that would be beneficial in regards to the audio.
 
D

Deletedmember448668

Guest
Hey everyone, this is my first time posting here. I recently started work on porting an NES emulator to the switch.

My progress at this point is:
- emulator runs on switch
- no audio support
- no save support
- frame rate is a bit slow but playable

This project is more of a just for fun project I wanted to try out but I intend to:
- get audio working
- get saving working
- optimize to help frame rate
- build a UI that resembles the NES classic

If anyone is interested in contributing to the project just let me know. I will release the emulator along with the source as soon as I am done or if demand for it is high I could just release in stages.

One question I have for any switch developers out there is..
is there a way on the switch to calculate delta time in milliseconds ? I've tried using time.h along with clock(), but clock() doesn't seem to work on the switch.
(answered)

Here is a video of the current state of the emulator(Thank you@Leonidas87)

UPDATE_1: NES ClasSwitch Alpha v0.0.1 Release

Hey guys, sorry for the delay. I was able to build a semi user friendly interface to use with testing the emulator. I have attached a zip containing the emulator. Please Please Please read the README.txt for more information. Everything you need to know is in there.

UPDATE_2: NES ClasSwitch Alpha v0.0.2 Release

This second update is to fix some bugs that where a result of two problems: 1) a piece of old code accidentally left in. 2) a problem with reading file names.
Both have been solved in this update and the emulator should fine now. File names can be whatever you want now.

UPDATE_3: NES ClasSwitch Alpha v0.0.3 Release

This update adds full speed gameplay and full screen scaling.

Thank you! Great work so far! Keep it up!

Edit: Did some quick testing, 1 out 5 games seemed to load, few of them crashed, Super Mario Bro 3 seems solid though, the rom list selection seems to be missing 2/3 of my roms and is laggy to select. Def cool though when it did work!
 
Last edited by , , Reason: testing

waywardson07

Member
OP
Newcomer
Joined
May 12, 2018
Messages
12
Trophies
0
XP
161
Country
United States
Thank you! Great work so far! Keep it up!

Edit: Did some quick testing, 1 out 5 games seemed to load, few of them crashed, Super Mario Bro 3 seems solid though, the rom list selection seems to be missing 2/3 of my roms and is laggy to select. Def cool though when it did work!

Thanks for testing. Currently the only games expected to work are games that use mapper 1 and 4. If you google "nes bis ass mapper list" you will get a list of which games use which mappers. I would link you directly but I can't post links yet.
 
D

Deletedmember448668

Guest
Thanks for testing. Currently the only games expected to work are games that use mapper 1 and 4. If you google "nes bis ass mapper list" you will get a list of which games use which mappers. I would link you directly but I can't post links yet.
No worries! Will keep an eye on updates, thanks for your hard work
 
  • Like
Reactions: waywardson07

Dillw33d

Member
Newcomer
Joined
Aug 19, 2017
Messages
8
Trophies
0
Age
26
XP
130
Country
United States
Hey, I just tried out your latest build, v0.0.5, and the menu appears to be completely unresponsive for me. Any clue as to why it's not working?
 

Proto-Propski

Legally Weird!
Member
Joined
Apr 29, 2018
Messages
266
Trophies
0
Age
25
Location
Boulevard of Broken Meme's
XP
768
Country
United Kingdom
Figured it would be easier to find in the Homebrew Menue View attachment 125266
You know you can seperate your Homebrew into categories if you place each of your .nro's into their own individual folders, and then place those folders into a parent folder named whatever category you choose...

Example(s)
sdmc:/Switch/Emulators/NES/NES.nro
sdmc:/Switch/Emulators/GBA/GBA.nro

you do have to have multiple Homebrew folders in the category folder for this to work however, and you can't place just one .nro outside of a folder (basically don't do "sdmc:/Switch/Emulators/GBA.nro"), or it'll only read just that single .nro, and ignore everything else... hope this helps.
______________________________________________
My Switch Homebrew Category System

z0Qko4l.jpg A4GJDFE.jpg
 
Last edited by Proto-Propski,
  • Like
Reactions: Leonidas87

Leonidas87

Well-Known Member
Member
Joined
Jul 15, 2014
Messages
651
Trophies
0
Location
Toronto, Ontario
Website
www.youtube.com
XP
960
Country
Canada
You know you can seperate your Homebrew into categories if you place each of your .nro's into their own individual folders, and then place those folders into a parent folder named whatever category you choose...

Example(s)
sdmc:/Switch/Emulators/NES/NES.nro
sdmc:/Switch/Emulators/GBA/GBA.nro

you do have to have multiple Homebrew folders in the category folder for this to work however, and you can't place just one .nro outside of a folder (basically don't do "sdmc:/Switch/Emulators/GBA.nro"), or it'll only read just that single .nro, and ignore everything else... hope this helps.
______________________________________________
My Switch Homebrew Category System

View attachment 125269 View attachment 125270

Doing that right now
 

waywardson07

Member
OP
Newcomer
Joined
May 12, 2018
Messages
12
Trophies
0
XP
161
Country
United States
Hey, I just tried out your latest build, v0.0.5, and the menu appears to be completely unresponsive for me. Any clue as to why it's not working?

Was the menu working for you on earlier versions? Just downloaded the zip file and it seems to be working fine. What firmware are you on? I am on 5.0.0 so I am unable to test lower firmware to confirm it is working.
 
  • Like
Reactions: Leonidas87

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
    BakerMan @ BakerMan: damn