![]() |
Demonstrating the mishandling of FPRs by Dolphin - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14) +--- Forum: Coding & Hacking General Discussion (https://mariokartwii.com/forumdisplay.php?fid=23) +--- Thread: Demonstrating the mishandling of FPRs by Dolphin (/showthread.php?tid=1886) |
Demonstrating the mishandling of FPRs by Dolphin - Vega - 08-13-2021 Below is a code that will show an output on your screen. Due to how Dolphin doesn't utilize the FPRs 100% correctly compared to how real hardware utilizes them, the code will produce different results on console vs Dolphin. If you are familiar with floating point and paired single stuff in PPC ASM, read the included source below to understand what this code is doing in technical terms. Code is PAL only, start a race, pick up a box. C27BA164 00000013 3FA08000 3C00BB0F 6000B824 9001FFFC C001FFFC 3FC03FD5 63DE5555 3FE05555 63FF5555 BFC1FFF8 C821FFF8 FC000890 100004A0 D81D1500 80BD1500 80DD1504 48000011 25303858 20253038 58000000 7C8802A6 387D1540 4CC63182 3D808001 618C1A2C 7D8903A6 4E800421 4800000D FFFFFFFF 000000FF 7C6802A6 38830004 38BD1540 3D80801A 618C4EC4 7D8903A6 4E800420 00000000 The code manipulates a simple bug of dolphin leaving 'leftovers' in ps1 in the destination register during the execution of an fmr instruction if the source register contains a double precision float. Whenever a float is double precision in the source register of an fmr instruction, Broadway will copy the entire fpr over to the destination register. But because Dolphin runs FPRs as a two 64-bit segments, this does not exactly occur. Thus, we get 'leftovers' in ps1 which we can then manipulate. Nothing to be concerned about as this bug can only botch poorly handwritten assembly. Thus it won't effect how Wii games run on Dolphin. You can also reproduce this bug with some other instructions as well such as lfd. Source: Code: #PAL = 807BA164 Screen results What shows up on screen on Dolphin (incorrect) - BF61F704 80000000 What shows up on console (correct) - 3FE00000 00000000 I have no idea how the value of 0.5 shows for the console, I was expecting some crazy value or NaN since a double float is being ps swapped. If anybody knows why, please let me know. Couldn't find any info with a quick glance into the Broadway manual. It's definitely some sort of deliberate mechanism the Float Point Unit (FPU) is doing. RE: Demonstrating the mishandling of FPRs by Dolphin - Leseratte10 - 08-19-2021 Has this been reported to the Dolphin developers already? Who knows, there might still be obscure games using code like that. Or is it 100% guaranteed that no compiler will emit code like this? RE: Demonstrating the mishandling of FPRs by Dolphin - Vega - 08-19-2021 This exact bug has not been reported afaik. But the Devs have been aware that Dolphin's quirky usage of the FPRs does not 100% replicate the Wii's hardware. I cannot think of a way on how a compiler can produce botchy/improper Assembly (like the source used in the code) to replicate this bug. Which, in my opinion, is the reason why the Devs have never got rid of the FPR quirks. |