mupen64plus / mupen64plus-core

Core module of the Mupen64Plus project
1.29k stars 257 forks source link

Interpreter accuracy improvements #1001

Closed Rosalie241 closed 1 year ago

Rosalie241 commented 1 year ago

This (currently draft) PR makes the pure interpreter more accurate, allowing n64-systemtest to progress much further than current upstream mupen64plus-core, I've mainly used n64-systemtest, the ares source code and the CPU manual as reference to make these changes.

Here's the output from before my changes: before_changes.txt

and here's the output from after my changes: after_changes.txt

I've used the paraLLEl video plugin and paraLLEl RSP plugin to test these changes.

Some of these changes do need some code cleanup and further accuracy improvements could be made, but I'm just posting it was a draft to see what you (the maintainers) think of these changes.

richard42 commented 1 year ago

looks promising. most of the tests fail but at least they run with your changes. and it looks like you have made a lot of changes to increase accuracy with the pure interpreter.

loganmc10 commented 1 year ago

Looks good to me. The only thing I'd say is that we should try to maintain parity between the pure and cached interpreter. So for the newly implemented opcodes (break, dmtc0, etc..) there should be something there for the cached interpreter as well. I'd expect we should be able to get the same results from the test ROM via the pure or cached interpreter.

Rosalie241 commented 1 year ago

Looks good to me. The only thing I'd say is that we should try to maintain parity between the pure and cached interpreter. So for the newly implemented opcodes (break, dmtc0, etc..) there should be something there for the cached interpreter as well. I'd expect we should be able to get the same results from the test ROM via the pure or cached interpreter.

I agree, but first I want to work more on the FPU tests, then work on the cached interpreter and then I'll cleanup the code and mark this PR as ready to review.

m4xw commented 1 year ago

Starting to look good indeed. you have my review on Discord, looking forward to it! Can start to yeet changes from my branches too!

m4xw commented 1 year ago

I'll also be looking for debugger cb's on break when u are done

Rosalie241 commented 1 year ago

I think this PR is ready for review now, pure and cached interpreter produce identical results with n64-systemtest:

pure_interpreter.log cached_interpreter.log

I've used this n64-systemtest build:

n64-systemtest.zip

There is of course room for further accuracy improvements, which I might do in the future, however I feel like this is a good starting point for now.

loganmc10 commented 1 year ago

I took a quick look through and it looks good to me, one question:

this new latch variable, should it be part of the save state? If the variable is set, and then they create a save state, and load it, latch won't retain it's value pre-savestate

Rosalie241 commented 1 year ago

That's a good point, I hadn't even thought about save states and yes, I agree it should be added, I'll try to get it done as soon as I'm able to, thank you!

Rosalie241 commented 1 year ago

ping @richard42, it's ready for review!