Project

General

Profile

Emulator Issues #6923

Mario Kart Wii crashes on D3D with EFB2Ram on during lense flare effect

Added by wespipes69 over 7 years ago.

Status:
Fixed
Priority:
Normal
% Done:

0%

Operating system:
Windows
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

Game Name?
Mario Kart Wii

Game ID?
RMCE01

What's the problem? Describe what went wrong in few words.
Crashes because of sun flair effect.

What did you expect to happen instead?
Stability

What steps will reproduce the problem?
[Don't assume we have ever played the game and know any level names. Be as
specific as possible.]
1. Start Leaf Cup (mirrored) > DS Desert Hills
2. Dolphin crashes before you get to the first turn

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-595

Does using an older version of Dolphin solve your issue? If yes, which
versions of Dolphin used to work?
I'm sure this wasn't a problem before.

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

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

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)
[Upload big files to a hosting service and post links here!]
- Works fine in OGL since this effect is not emulated.
- Tried turning off EFB>CPU but the effect remained.

[Do not attach files to this issue. Upload them to another site and
link here. Use imgur.com for images and pastie.org for logs.]


Related issues

Has duplicate Emulator - Emulator Issues #7352: mario kart wii crashes when using directx & EFB RAM copiesDuplicate

Has duplicate Emulator - Emulator Issues #7407: Mario Kart Wii d3d efb2ram crash possible fix!!!Duplicate

Has duplicate Emulator - Emulator Issues #8288: Dolphin Hang in Mario Kart wii when using efb to ramDuplicate

History

#1 Updated by skidau over 7 years ago

Does crash occur if you are using EFB 2 Texture?

#2 Updated by JMC4789 over 7 years ago

  • Status changed from New to Questionable

1: The sun flare effect works in OpenGL just fine.
2: It doesn't crash for me in either backend. The sun flare works and there is no crash.

I'm thinking this is highly questionable.

Core i5 3570K, Geforce GTX 760, Windows 7 x64.

btw, the flare effects need EFB2Ram to work, which is probably why it isn't showing up in OGL for you.

#3 Updated by WesaMcDaniel over 7 years ago

It's an issue, trust me. I know what I'm doing here.

But you're right about OGL, I must have had it set to EFB>Texture when I checked there. And I guess somehow when I went to check EFB>Texture in DX I did something wrong because that DOES turn off the effect and prevents the crash.

Here's what I just did:
Download x64 package from official site
Unpack
Launch Mario Kart (pure defaults)
Navigate to Mirror Grand Prix > Leaf Cup > DS Desert Hills
Start and play race just fine (no sun flair)
Stop emulation
Switch to EFB>Ram
Relaunch game and repeat
Crash at the exact same spot every single time

I'm surprised no one else is seeing this. Let me know what more information I can provide.

#4 Updated by JMC4789 over 7 years ago

I agree, D3D doesn't seem entirely stable. Skid said it was, and I thought back and remembered something happening to me at one point when playing on my laptop long ago...

Either way, I don't think OGL will crash, I've played a lot of Mario Kart on Wifi + did recording for the Dolphin 4.0 video with EFB2Ram on.

It seems random though, I haven't had an issue yet today. What do I need to do? Is one race enough?

(If you have an issue with the name change just let me know when you update us. Thanks!)

#5 Updated by JMC4789 over 7 years ago

err, I should say that skid_au is the one who said the behavior would be unpredictable. That was very, very poor wording on my part. I thought D3D worked fine from my testing/playing late last year.

#6 Updated by WesaMcDaniel over 7 years ago

OGL does not crash with/without EFB>Ram. DX crashes only with EFB>Ram active (sun flair/other effects on).

Happens seconds after you start a race on Mirrored DS Desert Hills. At this exact point: http://imageshack.us/photo/my-images/208/d3zm.png/

#7 Updated by JMC4789 over 7 years ago

  • Status changed from Questionable to Accepted
  • Category set to gfx
  • Operating system Windows added

Absolutely 100% confirmed. For what its worth, I wasn't using mirror mode, and I think that was my problem.

I really didn't realize the mirrored part was important, I had to use cheats to unlock it.

#8 Updated by JMC4789 over 7 years ago

Here appears to be the culprit, this panic handler comes up if you do it in vs mode instead of grand prix.

DX11::PSTextureEncoder::EncodeFailed in PSTextureEncoder.cpp at line 1170: map staging buffer

#9 Updated by JMC4789 over 7 years ago

more info: EFB: Poke Z not implemented (tried to poke z value at (44,16))

#10 Updated by JMC4789 over 7 years ago

I tried this about a dozen more times. There are indeed multiple error messages.

new one

DX11::PSTextureEncoder::EncodeFailed in PSTextureEncoder.cpp at line 110: map staging buffer (0x887a0005)

Sorry about the delay, I really thought the new message was the EFB Poke one.

#11 Updated by NeoBrainX over 7 years ago

  • Category deleted (gfx)

0x887a0005 = DXGI_ERROR_DEVICE_REMOVED

Given that the error makes no sense and the error message seems to differ between builds for no reason, something bad is going on here :|

(also btw, Component-Gfx made no sense at all here)

#12 Updated by spenserwhaley over 7 years ago

I've been told my random crashes with Dolphin (latest build) are related to this issue. I get random freeze/crashes in most of the game I've tried to run. This includes Mario Kart Double Dash. Though I haven't seen a particular effect cause it. (the lens flare effects in Double Dash seem to work fine for me)

On crash, I've seen the map stating buffer error before. I think I got that in Golden Eye 007. I get a different error for GameCube games/in DX9 mode.

#13 Updated by JMC4789 over 7 years ago

this isn't a new problem, so this isn't related to any of your other crashes, afaik.

#14 Updated by JMC4789 about 7 years ago

issue 7352 has been merged into this issue.

#15 Updated by spenserwhaley about 7 years ago

After upgrading to a new video card that supports DX11 (my old card only supported DX10) the issue has since gone away.

#16 Updated by JMC4789 almost 7 years ago

issue 7407 has been merged into this issue.

#17 Updated by darknessknightes over 6 years ago

Invalid Write to 0x50303118, PC= 0x80511544 (infinite code)

http://i.imgur.com/iYp9iH5.png

#18 Updated by JMC4789 over 6 years ago

issue 8288 has been merged into this issue.

#19 Updated by JMC4789 over 6 years ago

I think this is the issue you meant to put yourself on :)

#20 Updated by rodolfoosvaldobogado over 6 years ago

yes sorry :)

#21 Updated by JMC4789 over 6 years ago

I'm setting this to current because it's a pretty big problem when Mario Kart Wii requires EFB Copies to RAM for some effects to work, and on D3D it just crashes.

I wonder if this has something to do with EFB Peeks/Pokes being offset in D3D?

#22 Updated by rodolfoosvaldobogado over 6 years ago

the error is happening because sometimes dx11 is writing to memory a incorrect amount of bytes and that is corrupting the gc/wii memory. I still have to discover where is the error in the algorithm.

#23 Updated by mimimi over 6 years ago

There's a source rectangle with the following dimensions:
left: 304, right: 308, top: 1020, bottom: 1024

In d3d, the rectangle is clamped to the efb size:
correctSrc.ClampUL(0, 0, EFB_WIDTH, EFB_HEIGHT);

which results in height being 492 instead of 4, resulting in that crash.

Thanks rodolfo for tracking it down to writing an incorrect amount of bytes, from there it was easy to find out what's wrong.

#24 Updated by rodolfoosvaldobogado over 6 years ago

:) nice catch I was going to look at that this weekend you save me the work :)

#25 Updated by mimimi over 6 years ago

Now the question is: Can we just remove that?

// Clamp srcRect to 640x528. BPS: The Strike tries to encode an 800x600
// texture, which is invalid.

So i wonder if this "BPS: The Strike" works right now in OpenGL using efb2ram.

#26 Updated by rodolfoosvaldobogado over 6 years ago

Good question we have to found someone with the game to get some testing

#27 Updated by magumagu9 over 6 years ago

See https://github.com/dolphin-emu/dolphin/pull/2169 . I'm not sure clamping is correct, but that fixes the part where clamping increases the height of a rectangle.

#28 Updated by rodolfoosvaldobogado over 6 years ago

you are rigth, it fixes the issue but i don't know if clamping is the correct way to go here i think a hardware test will really help here

#29 Updated by JMC4789 over 6 years ago

  • Status changed from Accepted to Fixed

No idea if this is a proper fix, but it's no longer crashing of 4.0-5819 -> https://dolphin-emu.org/download/dev/5dc23a93b6513918f9619990856010de7245c915/

Also available in: Atom PDF