Homebrew Official [5.5.0/1][WIP] LiteNESU - A terrible (userspace) NES emulator

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
So that example is for a HBL ELF, and I've got a branch here that does it that way. As seen here it no longer uses the struct-passing method. However! I haven't tested if this works on 5.5.x or not.

I have a suspicion that exporting the functions like that requires kernel access, but am happy to be proven wrong
I rewrote my asturoids game without passing the functions in a struct, and it worked fine. I haven't released the new version yet, but yes, it can be done. There are a few global issues though, and QuarkTheAwesome mentioned one of them.

Finished a basic debugger here. I guess I'm gonna be spending some time with SMB now ;3
It's probably RAM corruption - I've noticed a few weird things just while making sure the debugger works.

Also, has anyone else noticed that you can't declare a global variable with an initial value properly? It seems like you have to add 1 to the value you actually want.
I was working on re-writing this for you for an elf version, and I encountered the same problem. I've got the initial loading completed, but it crashes on the "mmc_append_chr_rom_page" function right now. I am not sure if the rom I am testing just isn't compatible with the emulator, or if there is something else wrong. I am in the process of debugging the problem.

I want to add that I am also making it so you can have the roms embedded inside the elf file, instead of having to acquire them over the network. If it eventually works, you could theoretically make a menu to select the rom you wanted, and load that one, and then go back to the menu after playing the game you were on. You would just be limited on the number of roms, by the memory available.

Also, you can get very fast speeds by rendering pixels one at a time, it is all in how you do it. You can also directly write to the framebuffer, although I found with that method, only one of the framebuffers gets written, but I believe I have a fix for it, just haven't had the time to test it yet.

Update: So I decided to actually use your app, which I should have done in the first place, before trying to make another version, and your latest code does nothing, and an older version from when you first released will get to the point of saying the rom was downloaded, but then does nothing. So maybe the rom I have is bad. It's a standard Yie Ar Kung-Fu NES rom (I tried both Rev 1.2 and Rev 1.4) and it will get past the initial loading, it just fails when it gets to the "mmc_append_chr_rom_page" function.
 
Last edited by brienj,

QuarkTheAwesome

🦊
OP
Member
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,909
Country
Australia
Update: So I decided to actually use your app, which I should have done in the first place, before trying to make another version, and your latest code does nothing, and an older version from when you first released will get to the point of saying the rom was downloaded, but then does nothing. So maybe the rom I have is bad. It's a standard Yie Ar Kung-Fu NES rom (I tried both Rev 1.2 and Rev 1.4) and it will get past the initial loading, it just fails when it gets to the "mmc_append_chr_rom_page" function.

I just ran a quick test with the latest master source off GitHub and it seems to be working fine. Your specific issue is probably related to RAM (and lack thereof.) I suppose I should be more specific around my setup, which may help people actually run the thing ;3

Basically I'm hosting these two repos on my Mac to get code running on my 5.5.x U. Those two files are then running the 5.5.x ELF Loader which then downloads the LiteNESU ELF. From there, LiteNESU downloads play.nes (finding the URL using the same algorithm as the ELF loader) and launches the game.

Using that specific ELF loader is kinda important since it leaves a heck of a lot of free RAM that I can suck up ;3

The URLs for everything on my setup are as follows:

Code:
Loader: http://webhost/payload/browserhax_fright_tx3g_wiiu.php?sysver=550

Elf Loader: http://webhost/payload/code550.bin

LiteNESU: http://webhost/payload/boot.elf

NES ROM: http://webhost/payload/play.nes

Kinda important bit: The latest revision is very likely to be crashing at the exact same spot as the older version. The reason it doesn't seem to be doing anything is because I removed the debugging messages to speed up the initial loading phase.

When I get home this arvo I can point you all too the ROMs I'm using. (although it should work with most of them anyway)
 
  • Like
Reactions: brienj

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
I just ran a quick test with the latest master source off GitHub and it seems to be working fine. Your specific issue is probably related to RAM (and lack thereof.) I suppose I should be more specific around my setup, which may help people actually run the thing ;3

Basically I'm hosting these two repos on my Mac to get code running on my 5.5.x U. Those two files are then running the 5.5.x ELF Loader which then downloads the LiteNESU ELF. From there, LiteNESU downloads play.nes (finding the URL using the same algorithm as the ELF loader) and launches the game.

Using that specific ELF loader is kinda important since it leaves a heck of a lot of free RAM that I can suck up ;3

The URLs for everything on my setup are as follows:

Code:
Loader: http://webhost/payload/browserhax_fright_tx3g_wiiu.php?sysver=550

Elf Loader: http://webhost/payload/code550.bin

LiteNESU: http://webhost/payload/boot.elf

NES ROM: http://webhost/payload/play.nes

Kinda important bit: The latest revision is very likely to be crashing at the exact same spot as the older version. The reason it doesn't seem to be doing anything is because I removed the debugging messages to speed up the initial loading phase.

When I get home this arvo I can point you all too the ROMs I'm using. (although it should work with most of them anyway)
That's what I don't understand then, because I am using the same files to load the elf file.
 

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
Update, I have my version working now, and it seems to run at full speed. I never played Yie Ar Kung-Fu before, but it doesn't seem very slow at all to me. I am going to do a couple more improvements, then I'll upload the source code for my version along with an elf file. Just give me some time.
 

QuarkTheAwesome

🦊
OP
Member
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,909
Country
Australia
Update, I have my version working now, and it seems to run at full speed. I never played Yie Ar Kung-Fu before, but it doesn't seem very slow at all to me. I am going to do a couple more improvements, then I'll upload the source code for my version along with an elf file. Just give me some time.

No luck with mine? That may be something to be worried about. If anyone else has any issues running my code on their WiiU please tell me. I'd hate to release a thing that only works for me.
 
  • Like
Reactions: brienj

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
No luck with mine? That may be something to be worried about. If anyone else has any issues running my code on their WiiU please tell me. I'd hate to release a thing that only works for me.
No, sorry, I never could get yours to work.

After finding a video of the gameplay on Youtube, I can see that mine is a little bit slower than it should, but I have no idea how fast yours was running either, so mine may be just as slow. I am experimenting with drawing straight to the buffer and going to see if it is any better. Right now I have to go to bed, it's getting late. I'll resume work on it in the morning.
 

QuarkTheAwesome

🦊
OP
Member
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,909
Country
Australia
No, sorry, I never could get yours to work.

After finding a video of the gameplay on Youtube, I can see that mine is a little bit slower than it should, but I have no idea how fast yours was running either, so mine may be just as slow. I am experimenting with drawing straight to the buffer and going to see if it is any better. Right now I have to go to bed, it's getting late. I'll resume work on it in the morning.

No worries. I'll keep looking into the PPU.
 

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
Just a quick update on this, 1942 works with a few minor graphical issues. Super Mario Bros. has really bad graphical glitches, 10 yard fight "worked", but also with scrolling and graphical issues. Battle City works, Burger Time wouldn't load, and of course, Yie Ar Kung-Fu works pretty good. The ones that play, play at full speed, I am going through all the ROMs that should work, testing them, and if they work fine, including them in my package. I will be releasing my version, hopefully soon™.
 

QuarkTheAwesome

🦊
OP
Member
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,909
Country
Australia
Just a quick update on this, 1942 works with a few minor graphical issues. Super Mario Bros. has really bad graphical glitches, 10 yard fight "worked", but also with scrolling and graphical issues. Battle City works, Burger Time wouldn't load, and of course, Yie Ar Kung-Fu works pretty good. The ones that play, play at full speed, I am going through all the ROMs that should work, testing them, and if they work fine, including them in my package. I will be releasing my version, hopefully soon™.

Awesome to hear. By the way, when you say that they run "at full speed" does that mean you've added a framerate cap? (not present in mine because it never gets near 60fps anyway)

Also, for anyone wondering, whenever I'm sick of the PPU I've been working on a "quicker" rendering method that involves storing our pixels in a char array as rgba then padding as appropriate and pushing straight into 0xF4000000. Again, may be out soon™. Time's probably better spent porting the lot to GX2 anyway.
 

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
Awesome to hear. By the way, when you say that they run "at full speed" does that mean you've added a framerate cap? (not present in mine because it never gets near 60fps anyway)

Also, for anyone wondering, whenever I'm sick of the PPU I've been working on a "quicker" rendering method that involves storing our pixels in a char array as rgba then padding as appropriate and pushing straight into 0xF4000000. Again, may be out soon™. Time's probably better spent porting the lot to GX2 anyway.
Mine will run too fast sometimes, but I've implemented a filter, which you can turn on by pressing the R button, and that slows it down to normal speeds. I'll attach the release I promised too. I also created a GitHub account now, and once I figure it all out, I'll upload my source code on there.
XHP Creations GitHub

Here is the readme from the release, and the emulator is attached to this post.
LiteNESU 16-in-1 NES Emulator Elf Version for 5.5.x by brienj

This is a port of QuarkTheAwesome's port of LiteNES. It has 16 NES ROMs (All titles between A and E, plus Yie Ar Kung Fu) built-in that "work" in the emulator. Source code and possibly more versions with different games coming soon(TM).

LiteNESU (QuarkTheAwesome source code): https://github.com/QuarkTheAwesome/LiteNESU
LiteNES source code: https://github.com/NJUOS/LiteNES

This is ONLY for 5.5.x firmware and there will NOT be any other firmware version made. If you have lower than 5.5.x, then go and enjoy your kernel access. If you really want me to make it for your version, then tell people with kernel or IOSU access in 5.5.x to release, since I can not make the game compatible with the homebrew channel at the moment, since I have no way to test. Or just wait until I get kernel or IOSU access on my own.

Setup:
Put the included boot.elf on your webserver that can launch elf files or find a site that has this hosted.

Instructions:
Launch games or select EXIT with the B Button on the main menu. When in game, D-PAD for movement, A and B button like on an NES. PLUS button is START and MINUS button is SELECT. Pressing the HOME button while in game will return you to the selection menu.

You can press the R button to change the graphics filter.

Full list of titles in this release:
1942 (playable, but graphic glitches on the scrolling playfield)
Arkanoid (no major problems)
Astro Robo Sasa (no major problems)
Balloon Fight (no major problems)
Baltron (scrolling graphic issues)
Battle City (no major problems)
Chack 'n Pop (no major problems)
Defender (scrolling graphic issues)
Dig Dug (graphic glitches, but playable)
Donkey Kong (no major problems)
Donkey Kong Jr (no major problems)
Donkey Kong 3 (no major problems)
Dough Boy (playable, but graphic glitches, can get stuck)
Exed Exes (playable, but scrolling graphic glitches)
Exerion (no major problems, but you can't see background, had to turn off so it didn't crash)
Yie Ar Kung-Fu (no major problems)

I was disappointed that Elevator Action and Excite Bike didn't work, since they should have. I thought Burger Time would have worked too, but it didn't. All of these games have no mapper though, may be able to fix the emulator to play them. Elevator Action's only problem was the graphics not scrolling properly. Baltron and Exerion would crash until I was able to fix it.

Planned to be added:
Another version with more games???
GX2 graphics???
A different emulator base??? (No point until kernel or IOSU)

Edit: You'll have to supply the ROM data files in the source code and compile on your own or PM me for direct link.
 
Last edited by brienj,

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
Maybe keyboard support can be added to specify remote ROM filenames on the hosting server? @cmdj13 has a WIP library here for text entry.
I never noticed that keyboard library, I was actually working on one of my own, just never said anything, in case it never worked out. LOL

BTW, you can acquire a handle to the swkbd library, but you'd either have to write your application in C++ or create a wrapper to it.
 
Last edited by brienj,
  • Like
Reactions: ShadowOne333

QuarkTheAwesome

🦊
OP
Member
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,909
Country
Australia
Mine will run too fast sometimes, but I've implemented a filter, which you can turn on by pressing the R button, and that slows it down to normal speeds. I'll attach the release I promised too. I also created a GitHub account now, and once I figure it all out, I'll upload my source code on there.
XHP Creations GitHub

Here is the readme from the release, and the emulator is attached to this post.


Edit: You'll have to supply the ROM data files in the source code and compile on your own or PM me for direct link.

This is probably the coolest thing I've seen for a while. Mind if I edit this into the main post?
 

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
This is probably the coolest thing I've seen for a while. Mind if I edit this into the main post?
Sure. What's cool? BTW, I found another NES emu that has better compatibility that I am working on porting. For now, I will remove the audio portion and re-implement it when possible. Not sure how successful it will be, but I'll find out.

The main parts that need fixed right now, is implementing the loader correctly, and then modifying the input routines from using the SDL library, to using the VPAD library.

And the graphics should be easy to modify, I can't test though until I get the loading working right.
 
Last edited by brienj,

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
Now that the kernel exploit for 5.5.0 and 5.5.1 has been leaked, would it be possible to implement other features that were absent due to limitations of the userland exploit?
Like sound, GUI, fullscreen, and other syscalls?
I hate to speak for Quark The Awesome, but I do know from porting it myself, that this emulator does not have sound, so we couldn't do it with this exact same emulator, and was one of the reasons this emulator was chosen for the old 5.5 userland exploit. A different emulator would need to be ported.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: https://www.keepretro.com/products/miyoo-a30