Project

General

Profile

Actions

Emulator Issues #7288

closed

Mario Kart Wii custom patch not working properly with JIT recompiler

Added by thethiala almost 10 years ago. Updated about 5 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
PPC
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:
5.0-540

Description

Game Name?
Wiimms Mario Kart Retro 2014-02, a patched version of Mario Kart Wii. This issue should however also apply to all Mario Kart Wii patches adding more cups than in the original game.

Game ID?
KMCE99, a patched version of RMCE01.

What's the problem? Describe what went wrong in few words.
When the CPU Emulator Engine is set to JIT recompiler the racing cup selection doesn't work properly. Depending on the revision of Dolphin it'll either be completely scrambled (see http://i.imgur.com/7Zu6aoN.png) or several of the cups will be filled with copies of the track Mario Circuit (see: http://i.imgur.com/DObM4C3.png). The latter happens on all revisions that are 4.0-617 or older, while the former started to happen somewhere between revision 4.0-617 and 4.0-1569.

What did you expect to happen instead?
All the extra cups are supposed to show with the right icons and tracks (see: http://i.imgur.com/cnSEPih.png). This issue does not happen when played on a real Wii, and it does not happen if you set the CPU Emulator Engine to JITIL Recompiler in Dolphin. The issue is thus tied to the JIT Recompiler.

What steps will reproduce the problem?

  1. Download Wiimms Mario Kart Retro 2014-02 from here: http://wiimm.de/r/d/retro-2014-02
  2. Extract it and place a version of the original Mario Kart Wii in its folder.
  3. Use create-image.bat and follow its instructions to create a patched version of Mario Kart Wii. Language, image format and save game options don't matter, they all give the same result.
  4. Load the patched version of Mario Kart Wii in Dolphin, make sure the CPU Emulator Engine is set to JIT Recompiler.
  5. Navigate to VS mode, the amount of players selected doesn't matter.
  6. Select any combination of characters/vehicles/drifting. Again they don't matter.
  7. Observe how the cup selection screen is bugged. In Dolphin revision 4.0-617 and older this will show by some of the later cups being filled with copies of the track Mario Circuit instead of the proper tracks, while somewhere between revision 4.0-617 and revision 4.0-1569 the cups starts to become completely scrambled.

Dolphin 3.5 and 3.5-367 are old versions of Dolphin that have
known issues and bugs, so don't report issues about them and test the
latest Dolphin version first.
Which versions of Dolphin did you test on?
4.0-1569
4.0-617
3.5-1344

Does using an older version of Dolphin solve your issue? If yes, which
versions of Dolphin used to work?
Using older versions doesn't solve the issue, however the issue takes a different form somewhere between 4.0-617 and 4.0-1569 compared to in earlier revisions.

What are your PC specifications? (including, but not limited to: Operating
System, CPU and GPU)

  • Windows 7
  • Intel i7-3610QM
  • GeForce GT 630M

Are you using the 32 or the 64 bit version of Dolphin?
64 bit

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)


Related issues 2 (0 open2 closed)

Has duplicate Emulator - Emulator Issues #7303: Wiimms Mario Kart and old CTGP ISOs have broken cup selection in JIT onlyDuplicate

Actions
Has duplicate Emulator - Emulator Issues #9694: Wiimms Custom Mario Kart BugDuplicate

Actions
Actions #1

Updated by JMC4789 almost 10 years ago

Can you find the exact build where the behavior changes?

Actions #2

Updated by thethiala almost 10 years ago

I'll be doing tests tomorrow to find the build in which the behavior changes, though it might take some time.

Actions #3

Updated by thethiala almost 10 years ago

I found it after doing some testing: In build 4.0-1494 the bug is still taking its old form (http://i.imgur.com/ZPIyRdy.png) where the first few cups are working properly while the later cups have the wrong icons and are filled with copies of Mario Circuit, while build 4.0-1503 introduces the new form of the bug (http://i.imgur.com/1xzOWTa.png) where all of them have the wrong icon and only four cups are selectable, the scrolling function doesn't work. The newer-ppcanalyst changes that Sonicadvance1 made should thus be relevant to this bug in some form.

To summarize:

List of the expected tracks/cups

Real Wii

  • Everything works correctly

Dolphin with JITIL recompiler

  • Everything works correctly

Dolphin with JIT recompiler

  • In build 4.0-1494 and older the first few cups appear correctly, while the later cups have the wrong icons and are filled with duplicates of the track Mario Circuit
  • In build 4.0-1503 and newer all the cups have the wrong icons and only four cups are selectable, you can't scroll to the other cups
Actions #4

Updated by JMC4789 almost 10 years ago

  • Status changed from New to Accepted
  • Category set to ppc

If it's working in JITIL but not JIT, something is wrong with Dolphin. (Usually.)

Tenatively accepting because I've seen others with this issue

Actions #5

Updated by thethiala almost 10 years ago

I completely forgot about a related bug, and I retract my earlier statement about everything working correctly with the JITIL recompiler.

The tracks/cups do indeed show up properly with the JITIL recompiler, but only before you've completed a race. After you've done so and use the "Next race" option all the new cups disappear, leaving you with only the standard Mario Kart Wii cups. To get the extra cups back you have to leave and reenter VS mode entirely every time you complete a race, which is quite the hassle. Again this is something that doesn't happen if you play the patch on a real Wii.

My updated summary is thus as follows:

List of the expected tracks/cups

Real Wii

  • Everything works correctly

Dolphin with JITIL recompiler

  • Everything initially works correctly, but after completing a race and using the "Next Race" option the cup selection shrinks to just the cups found in the original Mario Kart Wii. To get the extra cups back you have to leave and reenter VS mode entirely

Dolphin with JIT recompiler

  • In build 4.0-1494 and older the first few cups appear correctly, while the later cups have the wrong icons and are filled with duplicates of the track Mario Circuit
  • In build 4.0-1503 and newer all the cups have the wrong icons and only four cups are selectable, you can't scroll to the other cups

I'm sorry about the confusion, my summary should be correct this time though.

Actions #6

Updated by JMC4789 almost 10 years ago

Can it be checked in the latest builds? 4.0-1706 fixes some JIT problems, should at least make JIT and JITIL act the same.

It won't fix any PPC_Analyst problems, though.

Actions #7

Updated by thethiala almost 10 years ago

I tested 4.0-1711 today both with JIT and JITIL, I noted no change in behavior for either.

Actions #8

Updated by JMC4789 almost 10 years ago

Does interpreter behave the same way?

Actions #9

Updated by thethiala almost 10 years ago

I was afraid you were going to ask that, I'm hovering between 0 and 2 FPS with interpreter... :P

The initial cup and track selection is at least working properly (http://i.imgur.com/fTRugjj.png). I'll leave a race on tonight, hopefully the CPU will be finished by tomorrow so I can check whether the cups also appear correctly after using the "Next Race" option.

Actions #10

Updated by JMC4789 almost 10 years ago

thetheiala: I'm sorry I didn't explain things. But, you can load a cup on JITIL, go all the way to the end of the race, and right before it goes to the menu, you can savestate, close the game, switch to interpreter, and then load the game, load the savestate, and that'll work.

Actions #11

Updated by thethiala almost 10 years ago

You're a smart guy, you know that?

Unfortunately the cup selection resets to just the standard Wii cups after using "Next Race", in other words interpreter has the same behavior as JITIL.

Actions #12

Updated by JMC4789 almost 10 years ago

So, JIT is more broken than both Interpreter and JITIL? That actually narrows down the culprit quite a bit. Please let me know!

Actions #13

Updated by JMC4789 almost 10 years ago

I'm going to actually download and set this up on my other computer so I can help out directly.

Thanks for your help in narrowing it down this far, hopefully I'll be able to bring you some answers within a week or so.

Actions #14

Updated by thethiala almost 10 years ago

That's correct.

With JITIL and interpreter the initial cup selection works properly, but after completing a track in VS mode and using the "Next Race" option all the bonus cups disappear.

With JIT the initial cup selection is also bugged, with the cups being completely scrambled in 4.0-1503 or newer (http://i.imgur.com/1xzOWTa.png) or some of the cups being filled with copies of Mario Circuit in 4.0-1494 and older (http://i.imgur.com/ZPIyRdy.png).

Actions #15

Updated by thethiala almost 10 years ago

Give me a heads up if you need help patching the ISO. :)

Actions #16

Updated by JMC4789 almost 10 years ago

So, even before the PPC_Analyst merge, JIT was broken differently/more than Interpreter and JITIL? Interpreter and JITIL have the exact same output?

Sorry if I keep repeating this, but I wanna make sure I don't have any misconceptions by the time the patcher downloads. I'm going to dig in, hopefully narrow down what function is messed up, and hopefully it will get fixed. The goal isn't just to make JIT less broken; we also would like to make it act like Wii.

Just for verification purposes, is there any way you could load the patched ISO (the same one you use for Dolphin) onto your Wii (if you have one) and verify it works there? I know that's a bit to ask, but it'll save me time to know that it works on hardware. Thanks.

Actions #17

Updated by thethiala almost 10 years ago

JIT was indeed behaving differently than JITIL and interpreter before the PPC_Analyst merge, and continues to do so after. Interpreter and JITIL are giving the same results.

My real Wii is unfortunately several hundred kilometers away currently, the best thing I can do on short notice is to provide a Youtube video. I couldn't find any relevant videos of Mario Kart Retro, but here's one of CTGP Revolution: https://www.youtube.com/watch?v=4vcPfrka4k0#t=297 You can see the added cups still being there after using the "Next Race" option on a real Wii.

Some quick background information on why CTGP is relevant to this case: Mario Kart custom mods could previously only replace tracks in the 8 default cups, not add new cups. CTGP Revolution was the first custom mod that made adding more cups possible by modifying the main.dol file of Mario Kart Wii. Mario Kart Retro is based on the same code, they differ only in the selection of tracks. They thus function the same on both a real Wii and on Dolphin (CTGP Rev produces all the same bugs as Mario Kart Fun on Dolphin).

Actions #18

Updated by JMC4789 almost 10 years ago

Well, this is enough information for me to start debugging. I've confirmed the issue.

Actions #19

Updated by thethiala almost 10 years ago

Here's a link to the very same issues being described on the Mario Kart forums (the main place for discussing Mario Kart fan mods) a year ago: http://www.mariokartwii.com/threads/115972-CTGP-on-Dolphin Notice the third post especially.
I know it goes even further back than that as well, but that's buried in a more than 1000 pages long thread about CTGP Revolution. I ain't searching through that, at least not at 5AM. :P

Actions #20

Updated by JMC4789 almost 10 years ago

So, I was right and wrong.

I was right that JIT should act like JITIL/Interpreter as of 4.0-1706; it's just the PPC_Analyzer change has messed with that. Disabling the PPC_Analyzer makes it so 1706 and newer work just like JITIL And Interpreter. Unfortunately, that means we have no leads on why it's forgetting the new tracks are there after one race.

Actions #21

Updated by JMC4789 almost 10 years ago

To really get a good jump on this, we'd need to know what the game is doing on the inside; if Wiimm would let us see the source code, or maybe even just explain how it adds the extra cups or something, that'd probably be the easiest way to get this fixed. Past that, it's going to be blind guesses at what's going wrong. And due to the fact that none of his projects are open source, I don't know if he'll be willing to give any inside information on it.

If that ends the second bug (Only basic 8 cups existing after a vs race) may not be fixed for quite a while. Best bets to getting this fixed quickly would be going to them and seeing if they'd be willing to tell us how it works.

Actions #23

Updated by JMC4789 almost 10 years ago

Does that one have the glitch in it? If so, we'll investigate.

Actions #24

Updated by JMC4789 almost 10 years ago

Quickly skimming it says it'll be useful, but I just want to know before I get too excited.

Actions #25

Updated by thethiala almost 10 years ago

I'm pretty sure I read somewhere that CTGPR wouldn't share all their code regarding the bonus cups, so Wiimm had to reverse engineer parts of it for his own project. He is probably the most knowledgeable person there is when it comes to stuff like this and has always been giving a lot back to the community, so he would be my best bet if you can't find the needed information in the source code posted above.

He might be a bit busy these days with the Wiimmfi Server project though, replacing the official Nintendo WFC servers for Mario Kart when they shut down (http://www.mariokartwii.com/threads/134892-MKWii-Server-Project). Still wouldn't hurt to ask.

Actions #26

Updated by JMC4789 almost 10 years ago

Issue 7303 has been merged into this issue.

Actions #27

Updated by aeacan almost 10 years ago

Yes,the same problem exists in the CTGP old version.After "Next Race",you can only see the official track.

Actions #28

Updated by anonymous14519 almost 10 years ago

I get the same problem on ctgp and the wiimms fun pack

Actions #29

Updated by sosa.cristian.tdf almost 10 years ago

Any solution to this problem? The same thing happens to me when I use dolphin 4.02 but when i use dolphin 3.5 after I play a race most of the custom cups dissapear but not all of them. Another thing is that in dolphin 3.5 the game runs better, at least that is my experience on my pc.

Actions #30

Updated by simmonsiram over 9 years ago

Hey guys has there been any progress with this issue? The custom tracks are fun but having to quit VS and enter all information again just to play another race really takes some of that fun away.

Actions #31

Updated by kamilwit3 over 9 years ago

Hey guys has there been any progress with this issue? ???

Actions #32

Updated by Anonymous over 9 years ago

some dev said somewhere that CTGP patch relies on a very difficult to emulate feature of the Wii. The Wii has a code cache or something which must be flushed when code is modified. CTGP patch modifies code, then runs the code and expects the old code to be run. It is difficult to emulate in Dolphin, the exact behavior of which code gets kept and discarded in the cache. Or it's too slow, or something.

Again, I'm not a dev.

Actions #33

Updated by fioraaeterna over 9 years ago

This branch adds a primitive icache emulation feature for the JIT. Enable it in game opions and this hack should work: https://github.com/FioraAeterna/dolphin/tree/icache2

Downside: ~2.5x slower on my machine

Actions #34

Updated by fioraaeterna over 9 years ago

Also, for posterity, this commit in the branch https://github.com/FioraAeterna/dolphin/commit/fc688fc83c74ea4734f50dc54954896cd9ba27e2 emulates the full icache logic, rather than the above branch which emulates a zero-icache. It's another 2-3x slower, so unlike the previous branch, it's not really feasible for real use, at least not at the moment.

Actions #35

Updated by fioraaeterna over 9 years ago

Oh right, I should note that branch will only work on CPUs with SSE4.2 because I really didn't make the code generic yet...

Actions #36

Updated by kamilwit3 over 9 years ago

Hey, is there a newbie version of dolphin to download ?

I tried using Visual studio 2013
"Use the solution file Source/dolphin-emu.sln to build Dolphin on Windows. Visual Studio 2013 is a hard requirement since previous versions don't support many C++ features that we use. Other compilers might be able to build Dolphin on Windows but have not been tested and are not recommended to be used."

But i get an error:
like in the atachment

Actions #37

Updated by kamilwit3 over 9 years ago

help?

Actions #38

Updated by JMC4789 over 9 years ago

I've never ran into that error and can't really help you, unfortunately.

Actions #39

Updated by kamilwit3 over 9 years ago

I mean, can't you send me this version of dolphin, but already compilled ?

Actions #40

Updated by xavi.palou.r over 9 years ago

hey! can you please upload the compiled version of that dolphin that emulates the icache logic? thanks in advance!

Actions #41

Updated by diando19 over 9 years ago

Is the icache logic emulator only for the interpreter? Also is there any version of this compiled.

Actions #42

Updated by xavi.palou.r about 9 years ago

can someone send me the compiled version please, i can't build it, thanks

Actions #43

Updated by juliencapuano about 9 years ago

Hello,

Are you still working on this problem ?
I have the same issue.

Best was to play actualy is to choose random track to avoid this section.

Actions #44

Updated by project.jgc about 9 years ago

Well, it seems that random mode avoids extra cups so we can't play mario kart fun add-on with dolphin :(

Actions #45

Updated by JMC4789 about 9 years ago

Get them to modify the patch to manually invalidate the icache; this is not going to be fixed without a huge speed down (3x - 4x slower than it is now)

Actions #46

Updated by project.jgc about 9 years ago

I don't understand, what i have to get to modify the patch ?

Actions #47

Updated by Anonymous about 9 years ago

Old patch is open-source, new patch is DRMed and locked down so it won't work on Dolphin.

Actions #48

Updated by JMC4789 about 9 years ago

  • Status changed from Accepted to Won't fix

Hey, if they don't want it to run on Dolphin because the people are using it are causing problems, then screw it.

Closing this issue.

Actions #49

Updated by juliencapuano about 9 years ago

What is the Last patch working with dolphin please ?

Actions #50

Updated by JMC4789 about 9 years ago

Why don't you go ask them?

I think this is a case of users using Dolphin making things hard on whoever is developing the hack (as it's used for online play.) I don't want to cause them any more trouble if they don't want it running on Dolphin, and at the same time, I have no real desire to run it. In the end, they'll just keep modifying it not to work on Dolphin if that's the case, and eventually they'll win.

The other case is that something they did simply doesn't work on Dolphin, and that it'll randomly get fixed someday.

Actions #51

Updated by StefanRass92 almost 9 years ago

So this wont be fixed and there is no way to fix it manually right?

Actions #52

Updated by JMC4789 almost 8 years ago

  • Status changed from Won't fix to Fix pending

Apparently I was wrong.

Fixed by PR-1882 -> https://github.com/dolphin-emu/dolphin/pull/1882

Actions #53

Updated by PEmu over 7 years ago

Dynamic BAT was merged in #4146 (https://github.com/dolphin-emu/dolphin/pull/4146). Is this fixed now?

Actions #54

Updated by JMC4789 over 7 years ago

  • Status changed from Fix pending to Fixed

To a degree. We're not fixing it any more as that'd cause a huge slowdown to the emulator. There's info about this case in the article.

Actions #55

Updated by JosJuice over 7 years ago

  • Fixed in set to 5.0-540
Actions #56

Updated by JosJuice over 7 years ago

Actions #57

Updated by blackman91 over 5 years ago

Any news on this guys? The only the basic 8 cups existing after a vs race bug is still present even on the latest wiim tracks patch and latest dolphin dev as of January 15 2019.

Actions #58

Updated by JosJuice over 5 years ago

We can't fix this without making Dolphin much slower, so we aren't really able to do anything about the problem. The only way to fix it without significant trade-offs is by changing how the patch works, but I guess the author of the patch doesn't want to do that.

Actions #59

Updated by blackman91 over 5 years ago

Nevermind, the latest patch from here (download the most recent on the last row):
http://wiki.tockdom.com/wiki/Wiimms_Mario_Kart_Fun

actually fixes the bug playing on dolphin, so they changed the patch after all.

Actions #60

Updated by JMC4789 over 5 years ago

Yeah, the Wiimm's people are fine with Dolphin, it was just an oversight.

Actions #61

Updated by blackman91 over 5 years ago

Spoke too soon, I had to repatch my vanilla iso again because the custom tracks names were wrong because I replaced all the files in the scene/UI extracted iso folder because of my custom characters but with the new correct patching the bug of only the default tracks being available after the first race is back, it seems I just stumbled upon a potential solution to the bug, maybe the bug didn't have anything to do with icache emulation? Any ideas?

Actions #62

Updated by JMC4789 over 5 years ago

It is icache emulation for sure if it works on interpreter. It works on interpreter for me on every build.

If it's still broken for you (latest Wiimms wasn't for me,) it's an unintentional reliance on icache on their end somewhere. There's nothing we can do to fix this outside of completely murdering performance.

Actions #63

Updated by blackman91 over 5 years ago

Managed to reproduce it and fix it again by replacing the scene folder again, I am using wiims custom tracks latest patch 2018-12-22, just patched a new iso and when the patch asks you if you want to translate and reorder the tracks after translation this time I selected no on both, then I just copied the scene folder from the previous patched iso that had those options on yes and for some reason the bug is gone now, pretty weird but hey it works now.

Actions #64

Updated by blackman91 over 5 years ago

Forget all that I finally figured it out, the 60fps for multiplayer gecko code was the one causing the bug of the custom tracks not been selectable after the first race for some reason, a shame because 60 fps for more than 2 local players would be awesome with custom tracks.

Actions #65

Updated by blackman91 over 5 years ago

This is the code I am talking about
Mario Kart Wii
$60FPS in Multiplayer [Nick Reynolds]
004250D4 00000001
0029FD69 00000000

Strange that it causes the same exact bug described in this issue.

Actions #66

Updated by blackman91 over 5 years ago

blackman91 wrote:

This is the code I am talking about
Mario Kart Wii
$60FPS in Multiplayer [Nick Reynolds]
004250D4 00000001
0029FD69 00000000

Strange that it causes the same exact bug described in this issue.

Edit: I works if you use it as an AR code instead of gecko, finally everything is perfect now.

Actions #67

Updated by kostasmaiden about 5 years ago

Hey blackman91, so did you actually manage to play a 2nd race in vs mode with all custom tracks shown? If yes, could you please explain how to do it or what kind of code must be altered?

thanks a lot
Kostas

Actions

Also available in: Atom PDF