Dolphin, the GameCube and Wii emulator - Forums

Full Version: Homebrew detection of dolphin in newer builds
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
In more recent builds of Dolphin, I'm no longer able to detect if homebrew is running in Dolphin.

The code I was using is the following:

Code:
    u32 ifpr11 = 0x12345678;
    u32 ifpr12 = 0x9abcdef0;
    u32 ofpr1 = 0x00000000;
    u32 ofpr2 = 0x00000000;
    asm volatile (
        "lwz 3,%[ifpr11]\n\t"
        "stw 3,8(1)\n\t"
        "lwz 3,%[ifpr12]\n\t"
        "stw 3,12(1)\n\t"

        "lfd 1,8(1)\n\t"
        "frsqrte    1, 1\n\t"
        "stfd     1,8(1)\n\t"

        "lwz     3,8(1)\n\t"
        "stw    3, %[ofpr1]\n\t"
        "lwz     3,12(1)\n\t"
        "stw    3, %[ofpr2]\n\t"

        :
    [ofpr1]"=m" (ofpr1)
        , [ofpr2]"=m" (ofpr2)
        :
        [ifpr11]"m" (ifpr11)
        , [ifpr12]"m" (ifpr12)

        );
    return (ofpr1 != 0x56cc62b2);

I believe skidau wrote the original code. Can somebody help with a code for the newer builds?
Looks like it relied on the (at the time?) inaccuracy of frsqrte to detect Dolphin.

I suspect you might have use more tricky methods now, like the method HBC used at one point (I think it was taking advantage of the bug where <32-bit writes didn't work correctly to uncached memory on the real Wii, but work on Dolphin).

You might also be able to use FPSCR result flags of some sort, since Dolphin is notoriously inaccurate in emulating those, but that might be fixed at some point.
(05-04-2015, 01:12 AM)Fiora Wrote: [ -> ]Looks like it relied on the (at the time?) inaccuracy of frsqrte to detect Dolphin.

I suspect you might have use more tricky methods now, like the method HBC used at one point (I think it was taking advantage of the bug where <32-bit writes didn't work correctly to uncached memory on the real Wii, but work on Dolphin).

You might also be able to use FPSCR result flags of some sort, since Dolphin is notoriously inaccurate in emulating those, but that might be fixed at some point.

I'm not well-versed in assembly, and to be honest. Is there a way to use Dolphin's Idle Skips to detect it?
Idle skips can be turned off though, so I'm not sure that's reliable?

The uncached memory bug, IIRC, is that if you store an 8-bit value to somewhere in the 0xC_______ memory range, it'll actually duplicate it 4 times and store it as a 32-bit value (on the real GC/Wii) due to a hardware bug. I think you may be able to use that as a test without any assembly.
(05-04-2015, 02:19 AM)Fiora Wrote: [ -> ]Idle skips can be turned off though, so I'm not sure that's reliable?

The uncached memory bug, IIRC, is that if you store an 8-bit value to somewhere in the 0xC_______ memory range, it'll actually duplicate it 4 times and store it as a 32-bit value (on the real GC/Wii) due to a hardware bug. I think you may be able to use that as a test without any assembly.

I didn't even think of using a GC/Wii bug! I'll look into it, thanks!
I'm curious; why are you trying to detect Dolphin? I mean, it's always good to have homebrew examples that do that so we can fix it Wink
There are literally dozens of easier ways to detect Dolphin. The simplest way is probably reading the SPRs that hold the CPU's unique ID: https://github.com/dolphin-emu/dolphin/b...PC.cpp#L94
Hey, these are from my physical hardware, please don't ban it :'(
Check for those IDs, and if they're found, ask for a password only Shuffle knows. Still, I can't think of many situations where it'd be a good idea to run differently in Dolphin.
I laughed too hard at how this turned out.
Pages: 1 2 3