Dolphin Progress Report: October 2017

The October Progress Report is here! ...A little late, but, all here in one piece. While on the outside it may have looked like October was a slow month, the blog staff and devs have been busy behind the scenes. A big feature (and blog article) was being worked on right up until the end of the month... and then we realized it wasn't going to be done in time. We shifted gears a bit too late and resulted in a tardy Progress Report. Fortunately, there are still many very important changes that arrived this month. With all that in mind, we hope you enjoy this month's Dolphin Progress Report.

Notable Changes

5.0-5661, 5.0-5726, and 5.0-5755 - NAND Check and Launch WAD Hack Removal by leoetlino

With the Wii Shop purchasing scheduled to turn off in 2019, giving users the ability to easily access the shop is of a high priority. Without a valid NAND, accessing the Wii Shop Channel is not possible and you may run into crashes when using Wii Menu features. Unfortunately, some poorly thought out behaviors from Dolphin's past were making it very difficult to maintain a valid NAND. This could result in some very, very, very strange behaviors.

Is this the power of the Pikachu?

On a Wii, every channel or disc-based game has an associated metadata file: the TMD. For disc games, the TMD is copied to the NAND the first time a game is launched. For channels and other NAND titles, it contains essential information about installed contents, so it is also always copied when installing a title. This means that it is normally impossible for a title to have save data without also having an associated TMD.

Both the Wii Menu and the Wii Shop Channel assume that these system files are always present. If some TMDs turn out to be missing (which is never supposed to happen), the shop will either just throw an error, or worse, behave weirdly and corrupt installs; just loading the Data Management screen in the Wii Menu may cause the emulated console to crash!

The sad fact is, if you've launched a Wii Channel from the gamelist prior to 5.0-5726, your NAND is very likely to be affected by this problem, because old versions of Dolphin do not copy the TMD or the ticket when launching a WAD. To make things worse, these versions often have buggy and/or incomplete emulation which can easily further corrupt the NAND.

In 5.0-5755, leoetlino gave users the ability to repair broken NANDs with a suite of fixes. Many minor issues in the NAND can be fixed without any repercussions at all. But, if the check finds problems that require further work, it'll warn users before proceeding.

Sometimes Dolphin will find a save without the necessary TMD. If it's a save for something that doesn't matter, you can click yes and delete the incomplete data. Installing the WAD or booting it from the gamelist in version 5.0-5755 or newer may also repair titles without having to delete the savedata.

Of course, it would be far nicer if Dolphin wasn't constantly breaking your NAND, so leoetlino set his eyes on that. The easy way out would be to remove the ability to launch WADs from the gamelist, but, he wasn't interested in removing such a convenience. Instead, he replaced it with a new way to launch WADs that does not corrupt your NAND. The gamelist now using a very similar system to the SD Launch feature added in Wii Menu 4.0 by Nintendo to get around the Wii's limitations.

That means that Dolphin will now import all the correct metadata without having to permanently take up much valuable space on your emulated Wii NAND. Again, version 5.0-5726 or newer is required for this. Using older versions of Dolphin will continue to corrupt the NAND when launching WADs from the gamelist. As such, users who prefer launching WiiWare titles from the gamelist are recommended to upgrade immediately.

These fixes also bring forward some other benefits. NANDs that have Priiloader installed will finally load correctly in Dolphin as of version 5.0-5726. Again, please use this feature with extreme caution, as it does have the capability to delete savedata.

Note: While the NAND check feature originally showed up in 5.0-5661, it is highly recommended you do not use the feature in that build. An oversight in the detection was causing valid saves to be removed. This bug was fixed in 5.0-5755, and we put our own NANDs on the line to test it this time. Always remember to backup your data regularly!

5.0-5688 - Do Not Allocate GPU Texture Decoding Resources on Systems That Do Not Support It by ligfx

The OpenGL version in macOS is too old to use Dolphin's GPU Texture Decoding, and as such is disabled and hidden from the UI. Unfortunately, we were still allocating resources for it which was breaking certain games.

Writer 1: RIDE doesn't have this problem, so you should just go play that.
Writer 2: Only someone who's never played RIDE could say that.

In another era we could have said the technicolor mode was an exclusive macOS feature, but, this era of actually trying to fix bugs has deprived us of the opportunity.

5.0-5700 - Fix GameCube Audio Interface Sample Rate by JMC47

Emulating obscure hardware behaviors can be fairly difficult to fix in many cases. But sometimes it's not because the actual behavior is hard to emulate; it's actually because no one realizes that's the actual behavior. Numerous hardware tests confirmed that the GameCube's sample rate was slightly different than the Wiis.

For some reason, instead of outputting samples every 1125 cycles of the 54MHz clock like on the Wii, the GameCube outputs samples every 1124 cycles. Because the difference is so slight, most games aren't really bothered by Dolphin just using 1125 regardless of whether it is a GameCube or Wii game. Years ago, Extrems pointed out the hardware difference but there didn't seem to be any games that cared.

Fast forward to a few months ago and something finally did come up. An issue about Sonic Mega Collection slowly falling further and further behind in Dolphin immediately made us think of Extrems' report. After quickly hacking Dolphin's sample rate to match what Extrems said, the issue disappeared.

This is because the GameCube was processing audio slightly faster than Dolphin was emulating it. In truth, the GameCube's sample rates are not 48,000Hz and 32,000Hz like on the Wii, but ~48,043Hz and ~32,029Hz. JMC47 rectifies this with a hotfix to approximate the correct sample rate for GameCube games. Because Dolphin was not designed to have a non-whole number sample rate, he was not able to make it match exactly. A better implementation should be done in the future that more correctly matches the behavior.

Note: 32,000Hz mode is likely just upsampled to 48,000Hz mode on hardware.

5.0-5705 - Fix Negative Offset for TGC Files by JosJuice

Games on GameCube demo discs are stored on a special disc format known as TGC. In order to load them directly (and sometimes ignore demo launcher defined time limits!) JosJuice added support for these types of files.

The Legend of Zelda: Collector's Edition and The Legend of Zelda: Ocarina of Time Master Quest both contained TGC files with negative offset in their header. Due to an oversight in JosJuice's original implementation, these TGC files were incompatible with Dolphin. After taking a look at one of these negative offset TGC files first hand, JosJuice was quickly able to fix the oversight. Now all known TGC files should be able to load in Dolphin.

In some cases, various limitations were imposed by the demo disc loader, so when extracting them you may be able to access content the demo disc didn't intend for you to reach!

5.0-5730 - Fix Out of Bounds EFB Access by endrift

endrift is the developer of mGBA and maintains a Wii version of mGBA. Sometimes when testing bugs on the Wii version of mGBA, Dolphin is used for verification. In the master version of mGBA released on October 1st, there was a bug in the emulator causing the CPU to do EFB Peeks out of bounds. On the console, it merely resulted in Super GameBoy borders not working, but Dolphin would outright crash. The fix in mGBA was simply making sure not to read out of bounds. Regardless of that, Dolphin should not have been crashing, so endrift also provided a safeguard to prevent Dolphin from crashing. Instead of the emulator crashing, it'll return zeroes for out of bounds reads.

5.0-5735 - Add Support for NAND Dumps Without Keys Appended by leoetlino

For a few months, Dolphin has supported importing Wii NANDs dumped by BootMii. When originally testing it, developers didn't have much of an issue importing NANDs from tons of Wiis, but upon merging there were a few forum users saying their NANDs weren't detected. After analyzing the issue a bit, it was discovered that some users were getting NANDs from BootMii without the keys.bin appended at the end.

Once this was confirmed, leoetlino added support for this case and now Dolphin should be able to import NANDs without the keys.bin attached.

5.0-5745 - Add Heuristic for Detecting Custom Mipmaps by Tomcc

Unless you're trying to emulate the PS2, mipmaps are typically very boring. Mipmaps are a set of copies of a texture, with each copy being smaller than the last. By using lower resolution copies of a texture at a distance, mipmaps prevent artifacts and aid performance.

The power of the Monado demonstrating the typical setup for mipmaps.

But to get the effects they want, the graphical masterminds at Nintendo go the extra mile. As such, Super Mario Galaxy, Super Mario Galaxy 2, The Legend of Zelda: Twilight Princess, and some other games have custom, hand-made mipmaps used for effects.

Shifting between textures is just one of the many weird things games can do with mipmaps.
As we can see on the texture, it's lava up close, but an orange sun texture far away.

While Dolphin emulates these effects fine at native resolution, our higher than native resolution support assumes (correctly 99% of the time) that mipmaps are only used in the standard way. At 2x native resolution, Dolphin uses the highest resolution version of the texture twice as far as the game would at native resolution. Anisotropic Filtering (AF) pushes the highest resolution version of a texture out further still. Assuming the game uses mipmaps in the standard way, these enhancements greatly improve texture quality. However, if the game was relying on mipmap levels to control effects and switch between textures, things get a bit awkward.

At native resolution (with AF off) Dolphin properly rendered this effect.
But at high resolutions, everything is lava!
Twilight Princess uses mipmaps to control how strongly these sunbeams appear.
Raising internal resolution and AF reduced the sunbeam, even erasing it entirely if you went high enough!
Galaxy 2 reads the mipmap level to control this fog effect in the sky.
My god, it's full of clouds.

Progress Report newcomer Tomcc used custom mipmaps in game development years ago and ran into a similar issue at higher resolutions. So when he saw Super Mario Galaxy doing this in Dolphin, he was immediately able to make a diagnosis! The initial implementation was flawed, but Tomcc rededicated himself to the task and in the end built a fantastic solution - a heuristic that can detect custom mipmaps. Detecting which textures have custom mipmaps is incredibly important - mipmaps are lower resolution than the texture itself, so if Dolphin starts using native mipmaps for textures that don't need it, everything would look blurrier.

With this heuristic in place, Dolphin will only drop to using accurate mipmap levels (and disable anisotropic filtering) for textures that make use of the mipmap levels for special effects. By knowing what textures need accurate mipmap levels and which don't, we can continue to enhance the mipmap levels of the majority of textures for maximum clarity, while also making these custom mipmap effects work correctly!

Now you can have your metaphorical cake and metaphorically eat it too! (click for full size)

One of the downsides of this fix is that the benefits of GPU Texture Decoding are nullified as we need to send the result to the CPU. As such, any time GPU Texture Decoding is enabled, the heuristic will not work. On a small note to our custom texture pack creators and users, this fix will not touch custom textures. It's up to the custom texture creators to manage custom mipmap effects as they see fit.

Dolphin Android UI Cleanups

5.0-5618, 5.0-5630, 5.0-5681 Android UI Cleanups by hackbar, 5.0-5684 - Android Input Settings Refactor and Cleanup by hackbar

hackbar has taken up the challenge of renovating Dolphin's Android UI! With maintenance being sporatic in recent years, Dolphin's Android UI really needed some love, and with hackbar's help, a few very, very longstanding issues have been fixed. Probably the most notable, though fairly harmless, UI bug in the Android port is that some gamepad axis were inverted, meaning up was down and down was up and so on. This is finally fixed after two long years. For those using the NVIDIA Shield TV, many animation glitches with the menu have been fixed, including one that would cause the menu to be invisible.

To see these fixes in action, please download the latest development builds. Considering that hackbar is actively working on things, it's safe to say that more fixes will show up in the near future.

Last Month's Contributors...

Special thanks to all of the contributors that incremented Dolphin from 5.0-5620 through to 5.0-5755!

フォーラムでこの記事に対する反応を見る。

次の記事

前の記事

内容の近い記事