1. XDel

    XDel Author of Alien Breed: Projekt Odamex
    Member

    Joined:
    Jul 25, 2012
    Messages:
    1,872
    Country:
    United States
    @ Nitra8 I don't recall noticing those errors before the system locked up. What I got were system errors not related to DOOM (in game) specifically.
     
  2. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    huh? Anything special?
     
  3. XDel

    XDel Author of Alien Breed: Projekt Odamex
    Member

    Joined:
    Jul 25, 2012
    Messages:
    1,872
    Country:
    United States
    Sorry, I will duplicate the error next time I am around my gear.
     
  4. niuus

    niuus GBAtemp Advanced Fan
    Member

    Joined:
    Mar 4, 2016
    Messages:
    978
    Country:
    Venezuela
    Hi @nitr8! Any chance for a release as a christmas gift, or will we have to patiently wait for 2020? Anyway, great work! Can't wait to replay all Doom chapters and the newest Sigil with my WUPro Controller :yaywii:
     
  5. sparkle86

    sparkle86 Newbie
    Newcomer

    Joined:
    Dec 12, 2019
    Messages:
    8
    Country:
    United States
    I have the current all-in-one R33 installed and still can't get Hexen working. DVD light on and system blank crashes.
     
  6. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    ...you actually "see" it...

    — Posts automatically merged - Please don't double post! —
     
    Last edited: Dec 20, 2019
  7. sparkle86

    sparkle86 Newbie
    Newcomer

    Joined:
    Dec 12, 2019
    Messages:
    8
    Country:
    United States
    @nitr8 What does that even mean!? I'm excited either way.
     
  8. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    Hexen has a bug that i fixed back in those days when i released the latest DOL. Though, to actually get around that crash i had to switch only one variable but didn't when i actually released it so it's my fault. It's actually fixed in the current binary. But there's trouble which i might explain after this post...
     
    CaptainHIT likes this.
  9. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    I was used to release new binaries (DOL's) and i was definitely working on something new at the start of December last year.
    Then i came across a really weird bug which is actually coming from libOGC and causes either a Decrementer Exception or Interrupt Exception - both which are related to Decrementer Handling by libOGC.

    Background:

    Porting libOGC to the RVL-SDK is nothing hard at all. It basically is a reverse-engineered SDK which has been working on, since back in the Gamecube days. It basically depends on NEWLIB (libC, libGLOSS, libM etc...) but it also depends on libGCC (runtime) which provides a function ("__udivdi3") for calculation of the time support routines and this also means that it effects the Decrementer.

    The RVL-SDK which provides it's own runtime library, doesn't have stuff like "__udivdi3". Instead, it uses the function called "__divdi2" and therefore may calculate "wrong" timer settings. This was my first thought, back over a year when i first came across this ridiculous behaviour - BUT I WAS WRONG.

    When i came back to work on those ports, starting in December, i ran into this problem again. I was at testing state and suddenly DOOM crashed with libOGC's "Decrementer Exception" screen and remembered very quickly what was going on.

    So what i tried, was writing only a very simple printout (printf) program that shows me some variables from the "__lwp_wd_settimer" function and the result was kinda frustrating...:



    With this knowledge, i tried other things, which included modifying libOGC to load the MetroTRK debugger and then compiling the very same simple printout program under MWCC (RVL-SDK C-Compiler) and POWERPC-EABI-GCC whilst starting the debugging unter CodeWarrior.

    BOTH ELF's crash at the very same point with the very same exception even before they reach the MAIN() function and they BOTH give the same exception through the debugger: DECREMENTER.

    I have no idea what is going on but from what i have read about PowerPC and the Decrementer yet, it seems to me, the Decrementer (which is always counting down) is getting wrong values from the time calculation in BOTH situations (MWCC & GCC) which means, that the libOGC code definitely has bug - even within it's official release.

    Anyway.. I wasn't lazy the last few weeks. I completely decompiled 4 libraries in order to get the debugger to run under GCC (which was useless because it simply compiles the required MWCC libraries using GCC without any problem). Those were the UART library, the TRK library, the library containing OSReport and the NDEV debugger driver library.

    The main goal which currently must be achieved is either: DISABLE the decrementer interrupt or FIX the bug or feed the decrementer with some values BEFORE it counts to ZERO. In the first case, the decrementer would STILL cound below "ZERO" (which it shouldn't). If the Decrementer reaches ZERO, it sends an exception notification out which then is being caught by the Processor if it executes it's current instruction to the end. Then it gives the final exception that you would see on the screen.

    In the second case it would required much more work than i want to do as it's hard for me to understand all that stuff libOGC does in it's time calculation routines. It seems to me as if there is no Decrementer callback included within libOGC or is it???

    The third case would require checking the decrementer for it's current value against ZERO and IF IT IS within a range that would cause the next decrement to cause an exception, raise the decrementer value to something above the one which would fall at or below ZERO. This would also require to write some code and implement it into some LOOP which is being run through all the time while libOGC is running during your gameplay.

    I think, i'm - at the moment - out of luck. This is even worse than what i thought of. As long as this isn't fixed, i'm not willing to release anything new as this would also frustrate all of you, playing my ports - and i want to do some good stuff. No worse and buggy sh*t...

    Anyway... the decrementer crash (if exception-checking is activated for the decrementer vector value 0x0900), happens in BOTH cases (MWCC & GCC) at the very same state: inside libOGC's function "idle_func()" at reading the WHILE loop. This is even BEFORE we reach our main thread "MAIN()".

    [​IMG]
     
    Last edited: Feb 6, 2020
    Hakaisha, niuus and CaptainHIT like this.
  10. niuus

    niuus GBAtemp Advanced Fan
    Member

    Joined:
    Mar 4, 2016
    Messages:
    978
    Country:
    Venezuela
    I totally understand. I enjoyed reading your explanation, even if i don't understand it 100%.

    Have you tried posting an issue on their Github or devkitpro forums? Maybe you could reach a fix with them, eventually. I seem to remember Oibaf (FBZX Wii / C64 Frodo Wii) did something similar and ended up fixing 3rd party controllers together with WUPC support, and adding that fix to libOGC.
     
  11. Tetsuo Shima

    Tetsuo Shima GBAtemp Advanced Fan
    Member

    Joined:
    Oct 29, 2008
    Messages:
    813
    Country:
    Italy
    he also worked on adding usb support to Quake GX, if I'm not mistaken.
     
  12. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    What you see in the picture below, is a fully running debug session using ECLIPSE and a USB GECKO over serial connection on a NATIVE WII.

    We might finally can use this setup to get things finally done.

    [​IMG]

    I've spent the whole day to get this done. I finally realized that i had to run the app on the console FIRST and AFTER THAT connect the debugger into the almost running ELF.

    So if that works for now, let's see if INSIGHT (the GDB GUI) can do the same...

    [​IMG]

    Yup, it's also working there. But INSIGHT GDB is buggy...
    Looks like i will stay at Eclipse...

    Now need to setup all my projects within Eclipse - this will take some time as i also have to compile all the libraries I used for those ports once again... This is really ridiculous.
     
    Last edited: Feb 7, 2020
  13. CaptainHIT

    CaptainHIT GBAtemp Regular
    Member

    Joined:
    Mar 2, 2011
    Messages:
    244
    Country:
    Turkey
    Great work you do there m8! So if I understand it correct, does that mean you can compile Wii system native apps now?
     
  14. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    What do you mean by saying "system native apps"?

    — Posts automatically merged - Please don't double post! —

    So i'll give an example to what i've meant before by saying "libOGC is a decompilation of what the Gamecube / RVL SDK" used to boot up and why libOGC has some buggy functions. Let's take a look at their function "__queuelength" which is called "QueueLength" in the RVL-SDK:

    libOGC's decompilation looks like this:

    static s32 __queuelength()
    {
    u32 reg;
    u8 len = 0;

    if(EXI_Select(exi_uart_chan,exi_uart_dev,EXI_SPEED8MHZ)==0) return -1;

    reg = 0x20010000;
    EXI_Imm(exi_uart_chan,&reg,sizeof(u32),EXI_WRITE,NULL);
    EXI_Sync(exi_uart_chan);
    EXI_Imm(exi_uart_chan,&len,sizeof(u8),EXI_READ,NULL);
    EXI_Sync(exi_uart_chan);

    EXI_Deselect(exi_uart_chan);

    return (16-len);
    }

    But this is completely wrong and buggy - for the Wii at last.
    This function is used by the function WriteUARTN, which sends debug messages over the serial communication line of the NDEV.

    My decompiled and working version is this one:

    u32 __queuelength(void)
    {
    u32 reg;
    u32 len;

    // 8MHz (3)
    if (EXI_Select(0, 1, EXI_SPEED8MHZ) == 0)
    return -1;

    reg = 0x30000100;

    EXI_Imm(0, &reg, 4, EXI_WRITE, NULL);
    EXI_Sync(0);
    EXI_Imm(0, &len, 4, EXI_READ, NULL);
    EXI_Sync(0);
    EXI_Deselect(0);
    return (0x20 - (len >> 0x18 & 0x3f));
    }

    As being said: this is only ONE example of what llibOGC is doing wrong.
    There even are more functions which are completely busted.

    Let's say... for the debug messages stuff, the functions InitializeUART() and WriteUARTN of libOGC are completely wrong as well!
    WriteUARTN in it's state of libOGC is NEVER able to send anything out over the serial port.

    BTW.: I've got all the libraries set up (Release-Libraries AND Debug-Libraries as well) and even set up a completely fresh devkitpro base and just compiled a fresh copy of WIIDOOM R33: it works!

    Now it's time to move the main project over to Eclipse...
     
    Last edited: Feb 8, 2020
  15. CaptainHIT

    CaptainHIT GBAtemp Regular
    Member

    Joined:
    Mar 2, 2011
    Messages:
    244
    Country:
    Turkey
    I mean, a real Wii executable programm who works on Wii's own system resources and uses full potential of the system. That's what I was expecting when you got your hands on that SDK from Nintendo.
     
    Last edited: Feb 8, 2020
  16. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    I could do that, sure. But that's not my intention.
    On the other side, i would most likely violate Nintendo's NDA.

    You see what they are currently up to, regarding those ROM sites all over the web.
    They currently even sued some people for doing a real-life Mario-Kart race in the streets for "copyright infringment". They did this once and now they did it again. The court agreed to Nintendo in the first case. Let's see what happens with the current one.

    See here:
    https://www.polygon.com/nintendo/20...real-life-tour-company-tokyo-nintendo-lawsuit
     
    Last edited: Feb 8, 2020
  17. CaptainHIT

    CaptainHIT GBAtemp Regular
    Member

    Joined:
    Mar 2, 2011
    Messages:
    244
    Country:
    Turkey
    I'm really surprised now! Shame on Nintendo doing for such a thing sueing real-life Mario Kart race. About those ROM sites, they might be right, but that's a really long story. About your work on this SDK, I'm really waiting for a progress to see what will happen next. Keeping fingers crossed...
     
  18. Jayro

    Jayro MediCat USB and Mini Windows 10 Developer
    Member

    Joined:
    Jul 23, 2012
    Messages:
    7,425
    Country:
    United States
    Any newer updated version since the R33 2015 release?
     
  19. nitr8

    OP nitr8 GBAtemp Regular
    Member

    Joined:
    Apr 4, 2007
    Messages:
    272
    Country:
    Gambia, The
    Yup...

    I just couldn't imagine that we actually run up to 7 threads in a row while playing one single game, see for yourself:

    [​IMG]

    We have the following threads: Audio, Video, Timer, MAIN, Semaphore, Controls, Idle (REQUIRED)
     
  20. Jayro

    Jayro MediCat USB and Mini Windows 10 Developer
    Member

    Joined:
    Jul 23, 2012
    Messages:
    7,425
    Country:
    United States
    Got a link?
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - [RELEASE], *PROPER*, HERETIC