Hacking cIOSX rev21d2x: Yet Another Hot Fix!!!!

Did d2x work for you?

  • Yes, I had an issue with the official cios and d2x fixed it

    Votes: 93 48.2%
  • Yes, but everything was already working for me with the official cios

    Votes: 82 42.5%
  • No, and I posted what goes wrong

    Votes: 9 4.7%
  • No, and I won't report what goes wrong because I am a troll

    Votes: 9 4.7%

  • Total voters
    193

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Sakura Wars works good with gx on a wbfs pen drive.
However both NeoGamma and Mighty Loader show the message "An error has occurred..."
Same cios, same pen drive, same iso, same all.... only the loaders are different... but it still could be a cios issue.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
A little late, but thank you Dragbe for the installer
smile.gif


And of course, thanks to d2x team for all the improvements you added and fixed.
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
davebaol said:
Sakura Wars works good with gx on a wbfs pen drive.
However both NeoGamma and Mighty Loader show the message "An error has occurred..."
Same cios, same pen drive, same iso, same all.... only the loaders are different... but it still could be a cios issue.

I have no idea what's going on, right now it sounds like an issue that can be fixed by either loader(GX instead of NeoGamma) or cIOS(in CFG Hermes instead of d2x). This doesn't make sense.

Are you sure GX is actually using the d2x cIOS? Do you have some time to do more tests? 1 with a crippled d2x that is not supposed to work. And 1 with mload disabled to make sure the di plugin from the cIOS is used.

Does anybody know if GX does something unusual like always loading its own di plugin via mload? To me it sounds like the most likely explanation, that the d2x di plugin contains some error, which Hermes' and GX's di plugin don't contain.
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
I believe it's a DIP module issue.
From usbgecko output I can see the error "RawDiskRead failed, rc=40960" coming from the original DI module.
I suspect DIP module doesn't emulate correctly some stuff for DI.
Later I'll investigate.

PS:
Mload module is crucial.
It can't be disabled because all other custom modules apply the patches on the fly through mload.
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
davebaol said:
I believe it's a DIP module issue.
From usbgecko output I can see the error "RawDiskRead failed, rc=40960" coming from the original DI module.
I suspect DIP module doesn't emulate correctly some stuff for DI.
Later I'll investigate.

PS:
Mload module is crucial.
It can't be disabled because all other custom modules apply the patches on the fly through mload.

Hmm, there's something i don't really understand, i'm look at:
case IOCTL_DI_LOW_READ:
and
case IOCTL_DI_UNENCREAD:
case IOCTL_DI_READ_A8:
case IOCTL_DI_READ_D0:

which i guess one of both is causing the problems. For IOCTL_DI_LOW_READ it just calls DI_HandleCmd is the disc is not a decrypted disc*. Where does that lead to when loading from usb? Shouldn't this be the read that is used 99% of time? I think there might be a __DI_CheckDisc(); missing from my patch for the audio stuff. And then i don't understand where this does the range check(001 error).

Sorry that i'm not much of a help here.

*Do you know what a decrypted disc is? This is the format the 1st backup launcher used for the discs and since cIOS rev 7 it is able to read 1:1 discs.
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
@WiiPower
About the broken GC audio streaming command, are all GC discs single layer?
If so, I think this approach is safer and less invasive:
[*]Remove __DI_CheckDisc call from IOCTL_DI_READID[*]Modify the code at the end of __DI_ReadDiscId like that
Code:
ÂÂÂÂ/* Check WOD magic word */
ÂÂÂÂif (outbuf[6] == WOD_MAGIC) {
ÂÂÂÂÂÂÂÂextern u8 *dip_readctrl;

ÂÂÂÂÂÂÂÂ/* Set read control */
ÂÂÂÂÂÂÂÂdip_readctrl[0] = 1;

ÂÂÂÂÂÂÂÂ/* Read hash */
ÂÂÂÂÂÂÂÂif (!dip_readctrl[1])
ÂÂÂÂÂÂÂÂÂÂÂÂret = DI_ReadHash();

ÂÂÂÂÂÂÂÂ/* Check disc type */
ÂÂÂÂÂÂÂÂif (!ret)
ÂÂÂÂÂÂÂÂÂÂÂÂ__DI_CheckDisc();
ÂÂÂÂ}
ÂÂÂÂelse {
ÂÂÂÂÂÂÂÂ/* Assume single layer disc */
ÂÂÂÂÂÂÂÂconfig.type = DISC_DVD5;
ÂÂÂÂ}
It means all non Wii discs are implicitly considered single layer.
This way the GC audio streaming command should work for GC discs because no further reading is executed.
What do you think?
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
Different approach:
Check for the GC magic word in the disc id, *(u32 *)0x8000001c == 0xc2339f3d, if that's found, don't check the type and just set to DL(for DL multi game disc support, even if i haven't tested one). And do everything like it's done until now if it's not found.
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Hmm, ok.... if I got it right you mean something like that

Code:
ÂÂÂÂ/* Check WOD magic word */
ÂÂÂÂif (outbuf[6] == WOD_MAGIC) {

ÂÂÂÂÂÂÂÂ.....

ÂÂÂÂÂÂÂÂ/* Check disc type */
ÂÂÂÂÂÂÂÂif (!ret)
ÂÂÂÂÂÂÂÂÂÂÂÂ__DI_CheckDisc();
ÂÂÂÂ}
ÂÂÂÂelse if (outbuf[7] == 0xc2339f3d) {

ÂÂÂÂÂÂÂÂconfig.type = DISC_DVD9;
ÂÂÂÂ}
ÂÂÂÂelse {
ÂÂÂÂÂÂÂÂ__DI_CheckDisc();
ÂÂÂÂ}
But I don't understand why you are assuming DVD9 for GC games.
unsure.gif
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
DVD5 or DVD9 is only relevant if something tries to read more than possiblle. And that's only done by the 001 for wii games, and multi game GC discs could be dual layer discs, so you don't want the read on the 2nd layer to fail.
 

flowlapache

Well-Known Member
Member
Joined
Sep 7, 2010
Messages
245
Trophies
1
Age
38
Website
Visit site
XP
1,077
Country
France
XFlak said:
AFAIK forwarder ISOs always required a hermes cIOS to load properly

just change it to use cIOS222 to load forwarder ISOs, it's a simple solution, but if it's even on davebaol to do list it's bound to be near the bottom of it for sure

thanks for the answer, i use already hermes ios to load it. I would like just knowing if somebody was working on it! davebaol is around it!great!!
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
@WiiPower
Ok, so can you make this mod and test it for audio streaming?
In the meantime I start investigating Sakura issue.
 

IceIceBird

Well-Known Member
Member
Joined
Nov 14, 2009
Messages
407
Trophies
0
XP
119
Country
davebaol said:
@WiiPower
Ok, so can you make this mod and test it for audio streaming?
In the meantime I start investigating Sakura issue.
One quick question did you do anything with the nand emulation on this last v5alpha1 version (and v4 final). The game Dr Mario can now only be played once then you have to remove the save if you want to play it again, otherwise you get an "The Wii System Memory Has Been Corrupt.." message. This game has always worked before..
(Even tried with a new NAND and same thing happens)

PS. This is one of my favorite games of all time
wink.gif
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
Code:
ÂÂÂÂ/** Read disc ID **/
ÂÂÂÂcase IOCTL_DI_READID: {
ÂÂÂÂÂÂÂÂu32 offset = (config.offset[0] | config.offset[1]);

ÂÂÂÂÂÂÂÂ/* Read disc ID */
ÂÂÂÂÂÂÂÂif (!DI_ChkMode(MODE_FILE | MODE_WBFS)) {
ÂÂÂÂÂÂÂÂÂÂÂÂ/* Call command */
ÂÂÂÂÂÂÂÂÂÂÂÂret = DI_HandleCmd(inbuf, outbuf, size);

ÂÂÂÂÂÂÂÂÂÂÂÂ/* Set DVD mode */
ÂÂÂÂÂÂÂÂÂÂÂÂif (ret)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂDI_SetMode(MODE_DVDROM);
ÂÂÂÂÂÂÂÂ}

ÂÂÂÂÂÂÂÂ/* Manual read */
ÂÂÂÂÂÂÂÂif (DI_ChkMode(MODE_DVDROM | MODE_FILE | MODE_WBFS) || offset)
ÂÂÂÂÂÂÂÂÂÂÂÂret = __DI_ReadDiscId(outbuf, size);

ÂÂÂÂÂÂÂÂ/* Check disc type */
ÂÂÂÂÂÂÂÂif (!ret)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂif (outbuf[7] == 0xc2339f3d)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ// For gamecube games it's not required to know the disc type, but DL access has to be possible for GC DL multi game discs
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ// If there was a read executed here for GC games, IOCTL_DI_AUDIO_CONFIG would fail(->audio streaming error)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂconfig.type = DISC_DVD9;
ÂÂÂÂÂÂÂÂÂÂÂÂ} else
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ__DI_CheckDisc();
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂ}

ÂÂÂÂÂÂÂÂbreak;
ÂÂÂÂ}

Audio streaming and 001 SL games working.
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
@IceIceBird
No, nothing has changed on nand emulation.
Can anybody else confirm his issue?

@WiiPower
Ok, thanks.
I'll check 001 DL games asap.
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
Ok, now I know what's the issue for Sakura Wars.
The cios believes it's a single layer disc while it's actually a dual layer.
It means this instruction doesn't detect correctly all possible dl discs.
Code:
ÂÂÂÂ/* Read second layer */
ÂÂÂÂret = __DI_ReadUnencrypted(buffer, SECTOR_SIZE, 0x50000000);
Does anybody know an offset able to to detect dl discs more accurately than 0x50000000 ?
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
davebaol said:
Ok, now I know what's the issue for Sakura Wars.
The cios believes it's a single layer disc while it's actually a dual layer.
It means this instruction doesn't detect correctly all possible dl discs.
Code:
ÂÂÂÂ/* Read second layer */
ÂÂÂÂret = __DI_ReadUnencrypted(buffer, SECTOR_SIZE, 0x50000000);
Does anybody know an offset able to to detect dl discs more accurately than 0x50000000 ?

You are loading from usb, right? Can't you check the type of the disc by the .iso size?

Anyways, it's strange if this is really the problem:
#define DVD5_LENGTH 0x46090000
#define DVD9_LENGTH 0x7ED38000

The used value does sound bad to me, but i expect it to fail for 4.4-5 GB .iso files. Is the game really smaller than 5GB? I would prefer a value like 46090200 to check if it's DL, it should be a valid offset on DL discs, but not SL discs. (+0x200 should be 1 sector further)

Edit: Maybe the drive can actually read some more sectors than the number of sectors that are on the disc? If this is changed, it needs confirmation if it still works correctly with retail and DVD-R discs, SL and DL.
 

davebaol

Well-Known Member
OP
Member
Joined
Sep 3, 2010
Messages
912
Trophies
0
XP
192
Country
Italy
IIRC it's about 6GB.
Already tested offset 0x46888000 (that is DVD5_LENGTH + MAX_SECTOR_SIZE) but the disc is still detected as sl.
I'm going to try 46090200.

EDIT:
SECTOR_SIZE seems to be 0x800, not 0x200
 

WiiPower

Well-Known Member
Member
Joined
Oct 17, 2008
Messages
8,165
Trophies
0
XP
345
Country
Gambia, The
davebaol said:
IIRC it's about 6GB.
Already tested offset 0x46888000 (that is DVD5_LENGTH + MAX_SECTOR_SIZE) but the disc is still detected as sl.
I'm going to try 46090200.

I have a theory, and if i'm right, it's bad. Where do the offsets in those read command relate to? Don't they relate to the offset of the currently opened partition? The 5 GB read may fail, because the 2nd partiton of the game is smaller than 5 GB.

Well if i'm right, i have an idea how to change the type detection:
Read the partiton table, sum up all partiton sizes and check if they all would fit on a SL.

Edit:
"SECTOR_SIZE seems to be 0x800, not 0x200", true, but the offsets are / 4 to fit DL disc offsets in u32.

Edit2: Only 1:1 wii discs should have a partition table, GC and decrypted discs need another solution. While a soltution for gc disc is something we have.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    D @ diamondsofmayhem: G'night!