Page 22 of 23

Re: Mesen-S - SNES Emulator

Posted: Thu May 21, 2020 6:44 pm
by Sour
FitzRoy wrote:
Thu May 21, 2020 10:31 am
I have a lot of downtime at work and I'm about 1/3 done bugtesting your core against the library. The bugs I've found so far are here. I'll test your other cores eventually, too. It takes about 80 man hours to go through a 3000 game library, which I did twice for bsnes.
Ah, nice! Thanks for that - I simply do not have the time to test most games, so having reports like these is great.
You'll definitely want to skip the GB/GBC core for now, since it's something I've only started less than 2 weeks ago and it's still very rough around the edges - it should hopefully get much better over the next few weeks, though.

Thanks for the controller DB - that's definitely useful. It's a feature in Mesen, and it would make sense to have the same in Mesen-S as well, I'll get it integrated when I get a chance.


For anybody that might be interested: Mesen-S now supports GB and GBC games as of a few days ago. Originally, this was mostly for the sake of adding Super Game Boy support (which I still haven't gotten around to), but I figured I might as well allow GB (and GBC since they're basically the same) games to run directly without the SGB layer. I've added (most) of the basic debug tools (including an event viewer that shows the LCD's pauses while it fetches data) and they should be getting more fleshed out over the next few weeks:
gb.png
If you use it, just keep in mind it's still very early in development - there are still issues with a lot of games. The CPU and APU should be fairly accurate, but there are a lot of details about IRQs, the LCD's timings, DMA, etc. that aren't taken care of still.

Re: Mesen-S - SNES Emulator

Posted: Fri May 22, 2020 4:08 am
by FitzRoy
Sour wrote:
Thu May 21, 2020 6:44 pm
Thanks for the controller DB - that's definitely useful. It's a feature in Mesen, and it would make sense to have the same in Mesen-S as well, I'll get it integrated when I get a chance.
Yeah, I just noticed that your mapper db for Mesen has a controller field. It's definitely possible to do it this way, too. I maintain my own board dbs and I guess I just didn't want the extra two fields tacked onto every entry, considering how few games had special controllers. So that's why I just made a separate db containing every system in it.

Re: Mesen-S - SNES Emulator

Posted: Fri May 22, 2020 5:23 pm
by bklD
FitzRoy wrote:
Thu May 21, 2020 10:31 am
I have a lot of downtime at work and I'm about 1/3 done bugtesting your core against the library. The bugs I've found so far are here. I'll test your other cores eventually, too. It takes about 80 man hours to go through a 3000 game library, which I did twice for bsnes.
wow, thats really cool. thank you. when was the last time you tested bsnes with all games? i think someone did this recently as well.

Re: Mesen-S - SNES Emulator

Posted: Sat May 23, 2020 4:22 am
by FitzRoy
bklD wrote:
Fri May 22, 2020 5:23 pm
wow, thats really cool. thank you. when was the last time you tested bsnes with all games? i think someone did this recently as well.
Well, bsnes first appeared in 2004, so it was sometime between 2006 and 2013. byuu tinkers with his code a lot, so there were some regressions after that. But there were also some bugs in a few homebrew games (which I don't have or test). I think the last library test came from a guy named Max.

Re: Mesen-S - SNES Emulator

Posted: Sat May 23, 2020 10:48 pm
by byuu
Sour wrote:
Thu May 21, 2020 6:44 pm
For anybody that might be interested: Mesen-S now supports GB and GBC games as of a few days ago. Originally, this was mostly for the sake of adding Super Game Boy support (which I still haven't gotten around to), but I figured I might as well allow GB (and GBC since they're basically the same) games to run directly without the SGB layer.
That's how it all started for me, too. Next up will be Game Boy Advance support once you already have the CPU core for your future ST018 support.

I'll go ahead and give you a sneak peak at your future ;)

Image

Re: Mesen-S - SNES Emulator

Posted: Sun May 24, 2020 3:30 am
by paulb_nl
Sour wrote:
Thu May 21, 2020 6:44 pm

For anybody that might be interested: Mesen-S now supports GB and GBC games as of a few days ago. Originally, this was mostly for the sake of adding Super Game Boy support (which I still haven't gotten around to), but I figured I might as well allow GB (and GBC since they're basically the same) games to run directly without the SGB layer. I've added (most) of the basic debug tools (including an event viewer that shows the LCD's pauses while it fetches data) and they should be getting more fleshed out over the next few weeks:gb.png
That looks amazing. The event viewer with the LCD's pauses is very interesting.

Do you have any insight in how the GB sprite priority fetching works? Especially when there are 2 sprites on the same x position and the highest priority sprite has some transparent pixels so the 2nd sprite is shown. When does it fetch the 2nd priority sprite? It fetches per 8 pixel sliver right?

Re: Mesen-S - SNES Emulator

Posted: Sun May 24, 2020 3:42 pm
by tepples
On GB and on GBC in GB mode:
Selection of the 10 sprites in secondary OAM is based on the 10 sprites with the lowest OAM index that intersect this scanline.
Those 10 are sorted by horizontal position (left in front), with secondary OAM index as a tiebreaker (lower index in front).
On each pixel, the X position of each sprite in secondary OAM is compared against the LCD X value. The sprite with the lowest secondary OAM index that matches gets fetched until there are no more sprites that match.
I estimate 4 bits per pixel in the sprite FIFO: pixel value (2), palette choice (1), and sprite-to-BG priority (1).

On GBC in GBC mode:
Selection of the 10 sprites in secondary OAM is based on the 10 sprites with the lowest OAM index that intersect this scanline.
For pixel fetching, those 10 are shown as if sorted purely by secondary OAM index. This requires several more bits in the sprite FIFO to tell from what OAM index each pixel came: pixel value (2), palette choice (3), sprite-to-BG priority (1), and secondary OAM index (4).

On GBA in GBA mode:
I seem to remember sprites are rendered into a line buffer, as on Atari 7800, Genesis, Super NES, and Neo Geo.

Re: Mesen-S - SNES Emulator

Posted: Sun May 24, 2020 7:57 pm
by Sour
byuu wrote:
Sat May 23, 2020 10:48 pm
I'll go ahead and give you a sneak peak at your future ;)
Haha, I really don't plan on going beyond the GB/SGB, though. I'm still not sure I even want to bother with the ST018 at this point (it's a lot of effort for a game nobody wants to play :p) Realistically speaking, it would be impossible for me to write (and support) that many cores along with all the debugger tools I would want to write for them.
paulb_nl wrote:
Sun May 24, 2020 3:30 am
Do you have any insight in how the GB sprite priority fetching works?
I knew nothing about the gameboy 2 weeks ago, so I'm not really the best person to ask. :p Most of the code is based on documentation, posts or test roms at the moment. I also just committed some fixes/improvements to the LCD timings (this was mostly based on sameboy's logic.) What tepples wrote matches my current understanding of it at least (for the original GB)

As of the latest commit, the core passes most of mooneye's tests (everything aside from ~5-6 ppu timing tests), and most of blargg's tests (except some APU-related tests.) So it should be fairly decent at this point, but in terms of testing games, I've only actually tested a handful of games, so it's very likely some stuff is still broken.

The event viewer was also updated to display different colors based on the what the cycle was, when the LCD doesn't output a pixel on that cycle (hblank, vblank, oam evaluation, fetching BG data, fetching sprite data, and idle cycles during rendering), so it gives a pretty decent idea on what the LCD is doing (although I'm sure the timings are still off by a pixel or 2 in a lot of scenarios)

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 3:54 am
by FitzRoy
I finally found a bug that used to exist in bsnes as well. The Lemmings 2 intro, if you let it play before the title screen, has tile corruption. The fix is documented here, something about a buffer overflow:
https://gitlab.com/higan/bsnes-history/ ... 63302f5eff

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 4:00 am
by Ice Man
Oddly enough this only happens to the US and JP version. EU version does not have this bug.

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 4:44 am
by olddb
A PC Engine emu with Mesen-s's debugger like functions would be more than awesome.

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 5:14 am
by FitzRoy
Ice Man wrote:
Tue May 26, 2020 4:00 am
Oddly enough this only happens to the US and JP version. EU version does not have this bug.
Hmm, I was able to trigger it in every version.

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 6:21 am
by Ice Man
I'm using the latest dev build from Github and region is set to Auto.
If you have it set on NTSC only then the EU will glitch a bit as well.

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 6:47 am
by FitzRoy
I would not speed up PAL games doing a library test. ¯\_(ツ)_/¯
l2e.png

Re: Mesen-S - SNES Emulator

Posted: Tue May 26, 2020 8:21 am
by Ice Man
Hmm, this is weird.
I did power up the game multiple times and each of them were different.
Sometimes barely any glitches and sometmes alot.
Maybe my first test was lucky then.

In that case I take back what I said and the issue is indeed for all regions of this game.