Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken games or graphical issues report #9

Open
davidgfnet opened this issue Jan 14, 2022 · 8 comments
Open

Broken games or graphical issues report #9

davidgfnet opened this issue Jan 14, 2022 · 8 comments

Comments

@davidgfnet
Copy link

Hey folks! Great work you are doing here :)
To help you a bit with finding games that have issues or are broken, I ran mgba with your BIOS and the official one and compared them. I run it for 9000 frames and then compare the outputs. There are obviously many differences since each BIOS takes a different amount of cycles and causes the game to drift slightly, but those can be ignored. Only cases where the output is obviously wrong (for instance FIFA 2004 or Doom II), or the game seems to hang/crash (for instance ZooCube, where it reboots to BIOS, or Super Street Fighter which seems to hang somewhere) are interesting for debugging.
Here goes the full report: https://davidgfnet-cultgba-mgba-testing-1c75d903.netlify.app/ (48MB!!!)

I could also classify the games on the SWIs they use automatically if you find it can be useful (might be easy to spot a pattern!), or I could even do automated A/B testing of the different SWI calls (by running both BIOSes and using the official one for some SWIs and yours for others).
Hope it is helpful :)

@skylersaleh
Copy link
Contributor

This is pretty awesome!

When I was fixing bugs in other games, a large chunk of the effort was just figuring out what SWIs were broken. So, if you can automate that, it would be incredibly helpful.

Another, thing that could be really useful to automate is if you could generate a summary for each of the SWIs, how many games use that SWI (both working and non working), and how many broken games use that SWI.

@davidgfnet
Copy link
Author

Hey there!

So I can generate something like a list of SWIs that a game uses. (I just run it with the official BIOS so that it works well) This won't cover them all, since I do not play the game (just some dummy inputs to get past most start screens but not a lot, see https://www.davidgf.net/2021/08/15/miniretro/ -> there's videos at the bottom if you dont feel like reading and wanna see action). This should be incomplete but already very much useful for many games. Given there's so many games it's probably good enough if you miss a few SWIs here and there.

With this information, we could already have some sort of idea of what the problematic SWI might be, right? However the "perfect" test would be to run both BIOSes, just using yours for one particular SWI number. Comparing results we could know if the SWI causes trouble or not. The only issue is that we need N*M tests (N being game count and M SWI count). Also might need a bit of work to enable some sort of dual-bios mode in mgba or similar emulator.

So, should I start with the low hanging fruit and get you a SWI list per game?

@skylersaleh
Copy link
Contributor

Just having the SWI list per game would be a great first start. If we have that, we could at least prioritize fixing the SWIs that will give us the most game coverage.

@davidgfnet
Copy link
Author

The cpuset/fast routines must have some interesting bug (eyeballing I'd say the bits you check are wrong? According to tonc it's bits 24 and 26 that have a meaning), since games that only use those ones fail with your bios.
Here you go a CSV: https://pastebin.com/86Bw3Zjb

@fleroviux
Copy link
Collaborator

fleroviux commented Feb 11, 2022

Hey. Thanks for your effort here! And sorry for the very late response.
The code should actually use bits 24 and 26 unless there's a bug there that I'm overlooking right now. The comment about bit0/bit1 is about the function table index that the code builds.

@davidgfnet
Copy link
Author

Ah you are indeed right! Missread it!
I guess the only thing that might be missing is clearing out bits to ensure that other non-zero bits break that function. (As the TODO says)
Take a look at the csv, theres a couple of games that use these SWIs only and are broken, which indicates theres something going on there. Perhaps they rely on some weird BIOS behaviour (for example they might assume that r0-r2 values after the call follow some pattern).
Glad to help!

@skylersaleh
Copy link
Contributor

skylersaleh commented Feb 12, 2022

Thanks!

I parsed your data to create a histogram showing what the most important SWIs to get correct are.

SWI # # of games that use this SWI
0xb 778
0x5 551
0xc 524
0x6 409
0x11 394
0x12 361
0x1 235
0x2 162
0xf 128
0x8 114
0xa 106
0xe 91
0x13 79
0x15 78
0x14 63
0x7 31
0x4 21
0x3e 7
0x3d 7
0x3c 7
0x3b 7
0x3a 7
0x39 7
0x38 7
0x37 7
0x36 7
0x35 7
0x34 7
0x33 7
0x32 7
0x31 7
0x30 7
0x2f 7
0x2e 7
0x2d 7
0x2c 7
0x2b 7
0x2a 7
0x29 7
0x28 7
0x27 7
0x26 7
0x25 7
0x24 7
0x23 7
0x22 7
0x21 7
0x20 7
0x1f 7
0x1e 7
0x1d 7
0x1c 7
0x1b 7
0x1a 7
0x16 6
0x18 4
0xd 4
0x17 3
0x9 3
0x10 2

@davidgfnet
Copy link
Author

I only recorded SWIs in the [0, 64) range, since i used a 64bit bitmap. It is possible that there are more weird 64+ calls, but AFAIK they do ..nothing? so we should not worry. It's surprising that there are games doing that, perhaps they have bugs or it's an emulator bug too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants