TCP Gecko.NET Memory Reading Exception

Discussion in 'Wii U - Hacking & Backup Loaders' started by BullyWiiPlaza, Dec 12, 2015.

  1. BullyWiiPlaza
    OP

    BullyWiiPlaza Nintendo Hacking <3

    Member
    1,750
    1,423
    Aug 2, 2014
    Germany
    I'm sorry for opening yet another topic about this TCP Gecko.NET issue but it has to catch some attention since many people are suffering from this. I also spent some time trying to debug the issue. Luckily, exception logs have been written. I'm referring to the TCP Gecko.NET build by wj44 in case you want to follow along so let's get started with the analysis. :)

    The following appears to be the first exception that is being thrown:
    Code:
    12/12/2015 2:34:08 AM: Opened log
    2:34:08 AM: Exception occured!
    Message: Exception of type 'TCPTCPGecko.ETCPGeckoException' was thrown.
    Stack Trace:
       at TCPTCPGecko.TCPGecko.Dump(UInt32 startdump, UInt32 enddump, Stream[] saveStream) in d:\Consoles\WiiU\Applications\TCP Gecko.NET\Source\Gecko dNet\TCPGecko.cs:line 525
       at TCPTCPGecko.TCPGecko.Dump(UInt32 startdump, UInt32 enddump, Stream saveStream) in d:\Consoles\WiiU\Applications\TCP Gecko.NET\Source\Gecko dNet\TCPGecko.cs:line 492
       at GeckoApp.MemoryViewer.Update(Boolean fast) in d:\Consoles\WiiU\Applications\TCP Gecko.NET\Source\Gecko dNet\MemViewer.cs:line 136
    Inner Exception: 
    This stack trace must be read from the bottom to the top meaning that the function calls at the bottom were called first and then the one above. In this case we can see that the function
    Code:
    public void Update(bool fast)
    in the file
    Code:
    MemViewer.cs
    has been called and it threw an exception in line 136. What happens in this line? The gecko handler dumps memory for the memory viewer cells. The called function looks as follows:
    Code:
    gecko.Dump(sAddress, sAddress + 0x100, miniDump);
    Let's follow that in the TCPGecko.cs file and we find the function definition:
    Code:
    public void Dump(UInt32 startdump, UInt32 enddump, Stream saveStream)
    {
        Stream [] tempStream = { saveStream };
        Dump(startdump, enddump, tempStream);
    }
    The second lowest entry in the stack trace says that in this function, the second line has thrown the exception which obviously is
    Code:
    Dump(startdump, enddump, tempStream);
    This overloaded function can be found right below in the source code.

    The final stack trace points to line 525 but it only contains a Byte assignment:
    Code:
    Byte retry = 0;
    It's quite obvious that reading memory somehow fails but how does this make sense? It works on some games but not on others. Also it seems to work flawlessly on static screens like the main screen for any game but not everywhere after. As you might have noticed, I indeed tried switching to the memory viewer when the crash occurred but as we know, the feature isn't broken by default.

    I will go over the second exception much quicker now:
    Code:
    2:38:22 AM: Exception occured!
    Message: Exception of type 'TCPTCPGecko.ETCPGeckoException' was thrown.
    Stack Trace:
       at TCPTCPGecko.TCPGecko.Dump(UInt32 startdump, UInt32 enddump, Stream[] saveStream) in d:\Consoles\WiiU\Applications\TCP Gecko.NET\Source\Gecko dNet\TCPGecko.cs:line 533
       at TCPTCPGecko.TCPGecko.Dump(UInt32 startdump, UInt32 enddump, Stream saveStream) in d:\Consoles\WiiU\Applications\TCP Gecko.NET\Source\Gecko dNet\TCPGecko.cs:line 492
       at GeckoApp.MemoryViewer.Update(Boolean fast) in d:\Consoles\WiiU\Applications\TCP Gecko.NET\Source\Gecko dNet\MemViewer.cs:line 136
    Inner Exception: 
    Line 535 contains
    Code:
    GameNameStored = false;
    , line 566 is empty (wtf?), line 1400 calls
    Code:
    Dump(paddress, paddress + 4, stream);
    , line 492 calls
    Code:
    Dump(startdump, enddump, tempStream);
    again and finally line 631 executes
    Code:
    Byte reply = response[0];
    . Is the read response possibly invalid?
    Code:
    Byte[] response = new Byte[1];
    if (GeckoRead(response, 1) != FTDICommand.CMD_OK)
    {
        //Major fail, give it up
        GeckoWrite(BitConverter.GetBytes(GCFAIL), 1);
        throw new ETCPGeckoException(ETCPErrorCode.FTDIReadDataError);
    }
    I'm not really sure how this can be fixed therefore. :( Anyway, I'm looking forward to you guys' opinions.

    @Mr. Mysterio
    @NWPlayer123
    @Marionumber1
    @Chadderz
     
  2. BullyWiiPlaza
    OP

    BullyWiiPlaza Nintendo Hacking <3

    Member
    1,750
    1,423
    Aug 2, 2014
    Germany
    Bump
     
  3. NWPlayer123

    NWPlayer123 GBAtemp Addict

    Member
    2,632
    6,232
    Feb 17, 2012
    United States
    The Everfree Forest
    I haven't had the energy to do much and I haven't touched that .net mess, someone's been poking at the GUI and I've been meaning to do some other stuff as well, also planning to make a program in C/D so it'll compile natively.
     
  4. BullyWiiPlaza
    OP

    BullyWiiPlaza Nintendo Hacking <3

    Member
    1,750
    1,423
    Aug 2, 2014
    Germany
    It's a mess indeed, quite unmaintainable with all the Wii and Wii U stuff randomly mixed together in 10.000+ lines of code. A clean rewrite probably is much better :P
     
    Last edited by BullyWiiPlaza, Dec 16, 2015
    aracom likes this.
  5. icw35

    icw35 GBAtemp Fan

    Member
    480
    112
    Sep 22, 2010
    Wish I'd seen your youtube post before trying to dump BO II with TCPGecko. So I just went ahead and bought the game. Selling for £2.95 with free delivery in UK. Bargain.
     
  6. BullyWiiPlaza
    OP

    BullyWiiPlaza Nintendo Hacking <3

    Member
    1,750
    1,423
    Aug 2, 2014
    Germany
    Uhm, which one? I always use a real copy of the game, so I don't know why you make it seem like you bought it for no reason.
     
  7. FaTaL_ErRoR

    FaTaL_ErRoR AKA ŦƕƎ ƠṀƐƝ

    Member
    491
    346
    Mar 9, 2014
    United States
    If I had to wager a guess...(and by guess it's just that a guess)
    I would say it looks like the boolean modifier is crashing because it is too complex. Someone should add cork to tcp gecko...(if it's not already)
    Maybe it could handle more complex stuff.
     
  8. Onion_Knight

    Onion_Knight GBAtemp Advanced Fan

    Member
    878
    832
    Feb 6, 2014
    -snip-
     
    Last edited by Onion_Knight, Dec 16, 2015 - Reason: ehh..changed my mind about posting.