Homebrew [RELEASE] Wii-DOOM / Wii-HERETIC / Wii-HEXEN / Wii-STRIFE (ALL-IN-ONE) *PROPER*

niuus

Well-Known Member
Member
Joined
Mar 4, 2016
Messages
2,023
Trophies
1
XP
4,456
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:
 

sparkle86

Member
Newcomer
Joined
Dec 12, 2019
Messages
9
Trophies
0
Age
38
XP
95
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.
 

nitr8

Well-Known Member
OP
Member
Joined
Apr 4, 2007
Messages
366
Trophies
1
Website
vermillion57.wixsite.com
XP
1,453
Country
Gambia, The
I have the current all-in-one R33 installed and still can't get Hexen working. DVD light on and system blank crashes.

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...
 
  • Like
Reactions: CaptainHIT

nitr8

Well-Known Member
OP
Member
Joined
Apr 4, 2007
Messages
366
Trophies
1
Website
vermillion57.wixsite.com
XP
1,453
Country
Gambia, The
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:

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()".

 
Last edited by nitr8,

niuus

Well-Known Member
Member
Joined
Mar 4, 2016
Messages
2,023
Trophies
1
XP
4,456
Country
Venezuela
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...
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.
 

nitr8

Well-Known Member
OP
Member
Joined
Apr 4, 2007
Messages
366
Trophies
1
Website
vermillion57.wixsite.com
XP
1,453
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.



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...



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 by nitr8,

nitr8

Well-Known Member
OP
Member
Joined
Apr 4, 2007
Messages
366
Trophies
1
Website
vermillion57.wixsite.com
XP
1,453
Country
Gambia, The
Great work you do there m8! So if I understand it correct, does that mean you can compile Wii system native apps now?

What do you mean by saying "system native apps"?

--------------------- MERGED ---------------------------

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 by nitr8,

nitr8

Well-Known Member
OP
Member
Joined
Apr 4, 2007
Messages
366
Trophies
1
Website
vermillion57.wixsite.com
XP
1,453
Country
Gambia, The
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.

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 by nitr8,

CaptainHIT

Well-Known Member
Member
Joined
Mar 2, 2011
Messages
384
Trophies
1
Age
47
Location
Frankfurt
XP
1,454
Country
Germany
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

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...
 

Jayro

MediCat USB Dev
Developer
Joined
Jul 23, 2012
Messages
12,973
Trophies
4
Location
WA State
Website
ko-fi.com
XP
17,003
Country
United States
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:



We have the following threads: Audio, Video, Timer, MAIN, Semaphore, Controls, Idle (REQUIRED)
Got a link?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Sak is a fishy pineapple