This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#2911 - (S)NES emulator
Attached to Project:
Rockbox
Opened by RonSijm (ronsijm) - Thursday, 12 January 2006, 23:51 GMT+2
Last edited by Robert Menes (RMenes379) - Wednesday, 21 December 2011, 17:02 GMT+2
Opened by RonSijm (ronsijm) - Thursday, 12 January 2006, 23:51 GMT+2
Last edited by Robert Menes (RMenes379) - Wednesday, 21 December 2011, 17:02 GMT+2
|
DetailsWould it be possible to make a (S)nes emulator?
just something like Rockboy, but then for (S)nes roms. I know it will be hard to just make an emulator, but maybe there are already open source NES emulators, so you can just port / edit it so it works on RockBox Gr. Ron |
This task depends upon
Closed by Robert Menes (RMenes379)
Wednesday, 21 December 2011, 17:02 GMT+2
Reason for closing: Out of Date
Additional comments about closing: No one has worked on this patch for 2 years, and it doesn't compile against current SVN at all.
Wednesday, 21 December 2011, 17:02 GMT+2
Reason for closing: Out of Date
Additional comments about closing: No one has worked on this patch for 2 years, and it doesn't compile against current SVN at all.
I do have to agree it'll be really hard to get to a playable speed...
The problem would be displaying the graphics on the smaller devices, and the coding of the actual emulator.
A NES emulator for the GBC? will wonders ever cease? =D
Brarei, the reason iDarcnes in Ipodlinux works so well is because they're using a part of the ipod (forgot which one, lol :B) to make it run so fast sometimes the sound can't keep up. Something you really need to keep in mind with Rockbox and Ipod Linux; Ipod Linux is only for Ipods. the reason it's (for lack of a better word) better than Rockbox is that they're only working with Ipods, and take advantage of every little part to have excellent performance in programs Rockbox has trouble keeping up with (but at least our Doom has sound >:3 muahaha). Rockbox, on the other hand, is for many different MP3's, and many different functions. that's why Rockboy is slow on the H10, but perfect on the Gigabeat. it's the different systems that make Coding a new program for rockbox in general so difficult.
What I'm saying, Brarei, is to not make too many similarities with Ipodlinux. I like IPL, but it is MUCH different from Rockbox, and you need to keep that in mind when making a technilogical statement or question with Rockbox.
Rockbox is Rockbox and IPL is IPL. done :-)
ahem... getting back on subject...
The graphics and coding difficulty are a given when it comes to anything emulation-related. it's not unique to the nes .
one more thing to think about, Michael. When you aren't playing a Nes emulator on your GBC, play a GBC game. then play that GBC game on an ipod or whatever. notice the difference? As I just said with Brarei, most of the systems that run Rockbox can't run emulators at full speed. and since the GBC is slow, then doesn't that mean the NES'll be slow?
The NES emulator won't be perfect, but I still can't wait to try it.
It's not accurate to say that IPL is better because they are only focused on developing for ipods, and hence take advantage of "every little part".
IMO, the relevant differences are not technical, they are:
1) IPL has active developers with an interest in gaming and emulators. Rockbox doesn't.
2) IPL is split into a distinct kernel and userland, which means they can port non-GPL'd software (such as DarcNES and MAME) to the ipod. Rockbox's all-in-one nature won't allow that, and unfortunately very few emulators are GPL'd.
Good work, though the zip file contains a lot of duplicate code?
I would suggest to you to open a new task (patch, not on feature request) and make an svn diff of your work so that it will be more easy to compile.
Well it is quite awesome, thanks! :)
The nes_rockbox.h only includes defines for the H10 (the same as the original patch) and the Gigabeat (just an initial attempt - maybe they need changing). Maybe others could add definitions for their devices.
Note that the NES needs 8 buttons - the four directions, A, B, select and start. So for example the ipods will probably need the same approach as rockboy - using the wheel as a touchpad to generate 8 different button locations.
*PANIC*
Stkov (6)
i then have to do a hard reboot. i dont believe its a problem with the roms as i can run them on fine on znes. also any .snes games wont show up at all.
i believe the viewer needs to turned into a port of znes just like rockboy is a port of gnuboy.
znes has most if not all the features that i think we would require. Game specific button mapping, grayscale support, full stereo sound, frame skip, save/load, emulation speed etc and it is very fast it doesn't look like that much of a resource hog but it might be a bit of a pain to port but theres Snes9x aswell which is very port friendly apparently.
I've have only been working with rockbox for a few days, but I've been building and tweaking plugin code. I had been looking at the other NES port thread and playing with FCEU code, but this one looks promising.
oh, and 5.5g version, por favor? that'll be so awesome =D
I tweaked the InfoNES_LoadFrame function to access the frame buffer directly on my ipod and it runs faster now. Still not fast enough... I also tweaked a few inner loops in the InfoNes line rendering code, but no major speed gains there. Once I get a bit more, I'll try to put together a patch.
sorry, I'm a little lost, is this the NES emulator everyone's talking about, or an Snes Emulator?
by the way Criznach, I think SNES9x and Znes would be hard to port, since they're higher-end SNES emulators. a low-tech SNES emulator that's GPL'ed would be good
sorry I can't help with Development. My computer has no internet, and I don't think people'll be kosher with me downloading VMware everywhere
http://forums.rockbox.org/index.php?topic=13157.0
This includes:
Optimized 1:1 lcd copy for displays as large as or larger than NES frame buffer.
Changed the #ifdefs around frame buffer copy to toggle 1:1 code when appropriate
Optimized sprite to scanline copy (minimal gain, I suspect).
Forced backlight on.
Wrapped non-simulator-compatible code in #ifdefs.
Grafted some ipod scroll wheel code from rockboy, toggled on with platform #ifdefs.
Added rb->yield() to InfoNes_DrawLine that gets executed each frame.
Nice work anyway, I hope to see more updates.
As I have neither any hardware that this is expected to run on, nor any NES roms to try, this is as far as I go.
/files/src/rockbox-svn/apps/plugins/infones/InfoNES_System_Rockbox.c:118: error: conflicting types for ‘plugin_start’
/files/src/rockbox-svn/apps/plugin.h:854: error: previous declaration of ‘plugin_start’ was here
make: *** [/files/src/rockbox-svn/build-dir/apps/plugins/infones/InfoNES_System_Rockbox.o] Error 1
Also has anybody thought about porting Mednafen ? It's a GPL multi-system emulator that supports the Atari Lynx, GameBoy (Color), GameBoy Advance, NES, PC Engine(TurboGrafx 16), SuperGrafx, Neo Geo Pocket (Color), PC-FX, and WonderSwan (Color).Many of these systems should be fast enough to run on most targets, and the code is much more up to date than infones or gnuboy.
But basically you go down to line 117 in InfoNES_System_Rockbox.c and remove 'const struct plugin_api* api' leaving just const void* paramter in the parenthesis. Then higher up in the file where plugin_api was already declared (should be line 16), change *rb to *api to line up with the calls in the rest of the file to *api as it was in the plugin_start function.
With that, the InfoNES_System_Rockbox.c file compiles cleanly now. Though now there's a tone of 'undefined reference' errors in K6502.c that are beyond my comprehension.
Here's what I've done:
* fixed the K6502.c LD errors ("static void" > "extern void" in K6502.h was probably correct code-wise, but it messed up the build, so I reverted it.)
* several code corrections to fix warnings... the rest of the warnings I couldn't fix, I hid (-w in the Makefile). It's cheating, yeah, but I'm too lazy to do the right thing and actually fix them.
* Added keymaps for all the targets I could find (stolen from rockboy). Unfortunately I don't have any of those players so I didn't bother testing them. (even in the simulator)
* Fixed the menu code to reflect the new menu API, and added a video mode menu (to scale, stretch, and halve the screen [size]).
* Several other things I don't remember. Now it compiles and works on my Sansa. It's still slow! I attempted to add an ARM-optimized 6502 core, but it looks like just as much work as porting a whole new C++ emulator (i.e. FCEUX).
I'm lost. D:
Roger: The old patch is conflicting with the new one. You need to start with a clean Rockbox build environment. (If you don't want to do that, try reversing the patch. Or you could delete apps/plugins/infones and edit SUBDIRS and viewers.config by hand. THEN try my patch.)
Still though, it's really cool seeing the intro to Super Mario Bros. 3 running on my MP3 player.
But came up with the error. What's wrong with my way?
Jeffrey: I don't have a Fuze; I just copied the keymaps from Rockboy. Take a look at the lines below "#elif CONFIG_KEYPAD == SANSA_FUZE_PAD" in keymaps.h if you don't know what the mappings are. If none of the buttons respond (Scrolling back should be the Start button), try changing them around. If it still doesn't work, I probably need to do some Fuze-specific stuff.
I tried loading a game that didn't require the start button (in this case, Kirby's Adventure). It didn't take long before I was actually playing the game. (setting the frameskip to two yielded pretty close to full speed!)
I'm assuming that the sound is disabled for a reason. When I go to enable it, I get a "*PANIC* Unaligned pointer!" error, followed by a reboot.
I uploaded the InfoNES_System_Rockbox.c file.
Apart from a few graphical glitches (typically when the screen was scrolling vertically, entering pipes, etc..., all stuff I've seen in less-advanced NES emulators on the PC) and the lack of sound, the game was completely playable. The frameskip was a bit annoying at times, but that's relatively minor and in my opinion to be expected.
Jeff: I'm glad you worked that out. I had a similar problem with my Sansa e200 scrollwheel, which I fixed by duplicating some code from Rockboy. I guess it's the same for the Fuze. As for sound, it's really distorted on my e200, but it works. I don't know what triggered your sound panic, but my uneducated guess would be that it's Fuze/sAMSa specific. On my 80Mhz e200v1, SMB3 is quite a bit slow even with a frameskip of 6 and sound off. I'm sure having a 250Mhz (max?) Fuze makes a difference. Oh well. I might eventually decide to do a port of FCE Ultra/FCEUX or maybe Mednafen if I can somehow get around the fact that they are all written in C++.
I deleted every line after (but not including) line 966.
I'm sorry to put you to so much trouble. Thanks so much!
Also, if you were to port FCEU(X) or Mednafen... I'd be very grateful. And willing to help out in whatever limited capacity I can. :D
It's essentially an updated, optimized version of InfoNES, and the author claims "If you are using InfoNES in your project, it should be very simple to switch to NESCore."
Rather than start a new port, I'm thinking it may be a good idea to at least attempt updating the existing plugin with this core.
I'd attempt it myself, but my programming knowledge is rather limited... but I'm learning!
Since this task is for an NES emulator in general and not specific to InfoNES, I'm posting my work here instead of opening up a new task.
*****WARNING!!! THIS DOES NOT COMPILE AT ALL!!!*****
My changes to the vanilla Mednafen 0.8.C sources:
* thanks to my mass renamer, I renamed any .cpp files to .c. I also moved around some docs.
* removed problematic emulator source code - namely, anything related to CDROM or netplay. I also removed the wswan, ngp, lynx, pcfx, and pce emulator files because they use CDROM and netplay code.
* made a template mednafen_rockbox.c out of InfoNES_System_Rockbox.c for Rockbox-specific stuff
* made mednafen.make, Makefile, and SOURCES since configure script isn't allowed/needed for inclusion with Rockbox and doesn't work
* edited some files to convert classes to structures and remove references to std::vector/std::string, etc. NOTE: I haven't done this with all the needed files.
I still need a little help with the first couple of steps. If anyone has experience with converting C++ to C, please contact me! After I get through the conversion to C, the other steps will be likely be much easier - except maybe the SDL audio and video. In the meantime, I'm starting to take the first/next step-and-a-half or whatever you want to call it...
(To start working on this, just put the mednafen folder in apps/plugins and add "mednafen" to SUBDIRS.)
---
I finally got it to compile! Unfortunately, the solution was temporarily increasing the plugin buffer size (a big no-no) because I couldn't find a proper solution. And I'm still stuck trying to adapt the video stuff. Anyway, I forked/renamed the emulator since it only has a couple lines of InfoNES code now - all the rest is either stuff I've written or from NESCore. I decided to rename it to BoNES for a couple of reasons: 1: You can pronounce it "Bo-Ness", "Bonus", or "Bones" (as in skeleton) 2: I felt like it, and 3: I got BOred coming up with a name. If you don't like it, suggest a better one.
Here's what I have so far. Unfortunately, it's severely lacking without video...
It'll [hopefully] be finished by tomorrow.
Anyway, It looks like you added HAVE_SCROLLWHEEL (which is only for Sansa e200/Fuze - it might do something weird to your iPod) to input.h. That's the source of your problem.
In file included from /home/calvin/Desktop/rockbox-20090817/rockbox-21932/apps/plugins/infones/InfoNES_System_Rockbox.c:27:
/home/calvin/Desktop/rockbox-20090817/rockbox-21932/apps/plugins/infones/keymaps.h:28:1: error: unterminated #else
/home/calvin/Desktop/rockbox-20090817/rockbox-21932/apps/plugins/infones/keymaps.h:1:1: error: unterminated #ifndef
make: *** [/home/calvin/Desktop/rockbox-20090817/rockbox-21932/fuze/apps/plugins/infones/InfoNES_System_Rockbox.o] Error 1
I'm REALLY bad at C, does anyone know how to fix this? I cant figure out how(where) to terminate these.
Status update* on BoNES - I'm going to do a maximum of 10 code changes to fix the video output before I post the next patch. As much as I don't want to flood this task with unnecessary non-working patches, I'm nearing the end of my patience in fixing this problem, and letting others see my code will likely make this much easier. I'll be back soon!
* not much of an update
"The above license terms are incompatible with GPL. Thus, you should avoid making the source code from this page and any derived code part of a GPLed project."
So he clearly does not allow you to use this with rockbox.
I am just wondering ^^
Have A Good Day.