In celebration of another year of Dolphin, we're taking a look back at some of our favorite features, fixes, and large scale changes of the year!
As long as development continues, we're bound to find silly mistakes and bugs going through code that spans eleven years of development. While not all of these are simple bugs or mistakes, they all were focused changes to the emulator designed to fix specific things. Let's take a look at some of our favorite bug fixes of 2014!
This very issue was the inspiration for the Dolphin Progress Report. The Legend of Zelda: The Wind Waker is one of the most well remembered games on the GameCube and looks absolutely stunning when upscaled to HD resolutions in Dolphin. While there were a ton of minor visual glitches back in 4.0.2, the biggest one that people would run into was the heat distortion issue. While the entire game suffered from this unavoidable problem, the volcano based Dragon Roost Island made what was a minor annoyance into a major distraction.
This problem plagued the emulator for years with no solution in sight. delroth decided he was sick of the bug and reverse engineered the issue to figure out exactly what Dolphin was doing wrong. Fortunately, he discovered that framework.map had been mistakenly left on the disc by Nintendo. By comparing the framework.map with Dolphin's code, the culprit was discovered: a simple, ancient mistake in hex math hiding in Dolphin's code.
Funnily enough, this also fixed issues in VP6 Video playback!
Users that have picked up Dolphin since this build may not be able to appreciate just how annoying this bug could be. Audio was always 200ms behind the game action, and there was nothing that could be done about it.
Of course, it wasn't always like this; in fact the bug was relegated to LLE audio only for a very long time, simply because the old HLE audio was asynchronous and skipped parts of our audio mixer. But when New-AX-HLE was merged, a lot LLE audio bugs manifested themselves in HLE audio. Both audio systems were now doing a lot of the same things.
But these bugs had been around for a long time, hidden behind the extreme performance demands of LLE audio. With more users running into these problems and levying complaints, the developers were made very aware that something was wrong. So once again, we have another example where doing things the right way fixes underlying problems that years of hacking had buried. Even though the transition had its problems, Dolphin's audio situation is in a much better place after ironing out the many problems.
For those curious about just how bad this issue was, compare audio latency between a modern development build and 4.0.2 in any AX microcode game. It will become apparent very quickly that things were a bit off.
Luigi's Mansion is a GameCube launch title featuring Mario's cowardly younger brother inheriting a mansion (spoilers)! The game has a much different tone compared to most Mario games, and has gained a cult following. Yet one of the most iconic features of that tone evaded Dolphin for years: the shadows.
Everyone hoped that the merger of tev_fixes_new would be the magic bullet that closed this ancient issue, but it came and went without fixing the problem. It looked as though Luigi would have to take out his frustrations by other means until neobrain stumbled upon a lead while messing with some things post tev_fixes_new.
Just under 100 builds later, tev_combiner_fixes was merged into the emulator fixing the shadows once and for all.
This was a very obtuse fix with easy to see results. Basically, the center of a pixel isn't exactly at (0.5,0.5) in some games. EFB Copy Regions are boxes where EFB effects are stored before being drawn to the screen (flick on the option in advanced within the GPU Settings, and you'll see some visuals). In Sonic Heroes, Dolphin not considering the shifted pixel centers meant that the region used to draw the shadows was grabbing garbage data outside of the intended area. For those of you curious more technical explanation, check out the issue report.
Due to an unknown behavior, this game failed to render correctly in OpenGL and D3D at most IRs, including 1x on OpenGL.
This finally allows Dolphin to play NES Virtual Console games without graphical glitches. Considering that the NES VC library is quite expansive, this fixes a lot of games. Who doesn't want to just boot up The Legend of Zelda and play it in Dolphin; heck, it can even be launched from the System Menu! People who have bought NES Virtual Console games on Wii and are looking for an easy way to play them on an emulator can just load those same wads on Dolphin.
Of course, this fix was only possible after tev_fixes_new allowed NES games to show up at all.
Despite appearances, the Wii does not have an operating system at all and gives every piece of software direct control over the hardware. To be able to switch between programs the Wii uses E-ticket Service Launch (ES_Launch). Dolphin has had a form of ES_Launch for some time, but with the older implementation failed to pass driving signing once a bug was fixed in IOS37 and newer. In order to work around this, skidau used high level emulation to manually boot the game's executable with Dolphin. While this prevented games like Metroid Prime Trilogy from hanging on ES_Launch; it also caused them to launch with the wrong settings.
magumagu stepped in with a more accurate implementation that managed to pass signing; allowing us to correctly emulate the ES_Launch in newer IOSes. While this is yet another huge win for accuracy, it is arguably made more impressive by all of the possibilities opened up to the emulator. For instance, the System Menu really works under Dolphin now. Users can boot just about any channel from the system menu, and even launch discs with the disc channel! (save for GameCube games) With all of the other upgrades available in latest master even the masterpieces in Super Smash Bros. Brawl will work.
No one thought that games would (or really could) rely on GQR reserved bits for anything. Even if a game could change them, it could be assumed that professionally developed games wouldn't rely on undefined behaviors in the GameCube and Wii, right?
Yet a half dozen games found them too tempting to ignore!
DiRT 2 is a prime example. It was fully playable except for some weird graphical glitches that everyone assumed to be GPU problems. There was no real dead giveaway that this was a CPU bug, other than the fact that we know the CPU can cause graphical glitches. Blinded by obvious graphical disruption, focus was set on possible GPU solutions while ignoring the potential CPU problems.
On an issue report of another game, a user was inspired by the Mario Kart Wii replay bugs in a progress report and tried out JITIL and found out that the behavior of the glitch was different! When the same thing happened on DiRT 2, it was only a matter of time before the issue was sorted out. After a bit of a struggle, FioraAeterna properly implemented the behavior of the GQR reserved bits in Dolphin's JIT.
It's time for a story of poor decisions and bad assumptions. You see, unbeknownst to everyone, there was a nasty bug in the D3D11 depth matrix shaders. This meant that certain situations had bugs in the D3D11 backend. But there were two other backends, so that isn't so bad right?
When OpenGL was rewritten by degasus and Sonicadvance1, a lot of what was once different between the two backends were standardized. Sonicadvance1 argued that the depth matrix shaders in OpenGL were better, but the other developers requested that the OpenGL implementation be made equivalent to the D3D11 variant. As such, during the massive OpenGL rewrite, OpenGL adopted the flawed implementation. At the time, no one had any idea that there would be tons of games affected by this; it was only a tiny footnote in an absolutely massive rewrite.
Even after the problem was identified, it was nearly impossible to bisect a bug that occurred as part of a massive rewrite. It only got worse when D3D9 was removed for accuracy reasons; it was the only backend that didn't run into this problem! With it gone, there were no more workarounds.
While galop1n was the first to catch this mistake, KScorp finally brought this bug to its end in Master with his own implementation that fixed depth matrix shaders in OpenGL and D3D. This alleviated graphical issues in popular titles such as Super Mario Galaxy 2, the Metroid Prime series, The Legend of Zelda: Skyward Sword and many more.
This allows Star Wars Rogue Squadron III: Rebel Strike to boot. Finding this bug was another case of luck, severe stubbornness, and even more luck.
Dolphin is blessed with some very obsessive testers, willing to do pretty ridiculous things in order to track down bugs. One of those ridiculous things was importing the PAL version of Rebel Strike on the hunch that it may have some kind of different behavior than the NTSC version. Considering that Star Wars Rogue Squadron II: Rogue Leader has FIFO issues, comparing the PAL version to the NTSC version isn't exactly an uneducated guess. While the tester was completely wrong about the fifo issues, fortunately, it didn't matter; for other reasons the PAL version managed to boot anyway!
But the game crashed a lot and had horrific physics and animation issues, on top of the many issues already plaguing its predecessor. Since Fiora had just finished up on the Faster MMU project, she was called to look into the instabilities. After a thorough memory bisecting of the PAL version, she noticed something weird about certain addresses were being handled in the JIT compared to the interpreter. She made a pull request to fix an animation bug while playing in JIT with no idea what she had actually done.
The experimentation lead to Fiora stumbling upon the bug that had been plaguing Rebel Strike all along. The NTSC version not only booted in Dolphin as of this merge, but it was even completable in Dolphin for those that could deal with the zfreeze issues.
To stumble upon the solution was extremely fortuitous. The bugs that were being bisected only happened on the JIT, and Rebel Strike NTSC didn't even boot on interpreter. Fiora worked her JIT magic so well that she somehow fixed the interpreter too!
We miss you, Factor 5, you magnificent bastards.
This should hopefully be the end of a projection hack known as "The Sonic Unleashed Hack." That little hack was introduced to the emulator because Sonic Unleashed and other notable games wouldn't have their UI or sometimes any graphics show without the projection skewed slightly. Based on extensive hardware testing, it was discovered that the GameCube and Wii's depth calculations are off by exactly epsilon (the difference between 1 and the smallest floating point number of type float that is greater than 1). Adding epsilon in Dolphin fixes everything with no regressions in other games.
Curiously, this code was actually in Dolphin a long time ago. Donko came to the same conclusion years ago and added the same exact epsilon to the code. Unfortunately, during cleanups, the behavior couldn't be verified as accurate and was assumed to be a hack and removed. After that, problems were noticed in certain games and the projection hack was added as a work around. Oops.