Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAT module update for UStealth support #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#d2x cIOS

[![d2x-cios logo](http://img403.imageshack.us/img403/585/d2xcioslogo.png)](https://github.com/davebaol/d2x-cios/)

[![d2x-cios logo](https://gbatemp.net/attachments/d2x-logo-jpg.313534)](https://github.com/davebaol/d2x-cios/)

#### DISCLAIMER

**DO NOT USE THIS ON THE WII MINI!**
````
THIS APPLICATION COMES WITH NO WARRANTY AT ALL, NEITHER EXPRESSED NOR IMPLIED.
NO ONE BUT YOURSELF IS RESPONSIBLE FOR ANY DAMAGE TO YOUR WII CONSOLE BECAUSE OF A IMPROPER USAGE OF THIS SOFTWARE.
````



#### DESCRIPTION

This is a custom IOS for the Wii console, i.e. an IOS modified to add some new features
Expand All @@ -36,7 +33,7 @@ NO ONE BUT YOURSELF IS RESPONSIBLE FOR ANY DAMAGE TO YOUR WII CONSOLE BECAUSE OF
* *Oggzee*, for his brilliant fraglist.
* *WiiPower*, for the great help with ios reload block from usb.
* *dragbe* and *NutNut*, for their [d2x cios installer](http://code.google.com/p/d2x-cios-installer).
* *XFlak*, for his wonderful [ModMii](http://gbatemp.net/topic/207126-modmii-for-windows) which supported d2x wads since its birth. Without ModMii d2x cios would probably never have existed. Also, XFlak had the original idea to replace the buggy EHCI module of cIOSX rev21 with the working one from rev19.
* *XFlak*, for his wonderful [ModMii](https://gbatemp.net/threads/best-way-to-mod-any-wii-modmii-for-windows-official-support-thread.207126) which supported d2x wads since its birth. Without ModMii d2x cios would probably never have existed. Also, XFlak had the original idea to replace the buggy EHCI module of cIOSX rev21 with the working one from rev19.
* *[HackWii](http://www.hackwii.it)* and *[GBAtemp](http://www.gbatemp.net)* communities, for their ideas and support.
* *Totoro*, for the official d2x logo
* *ChaN*, for his [FatFs](http://elm-chan.org/fsw/ff/00index_e.html).
Expand Down
25 changes: 13 additions & 12 deletions source/fat-module/ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1977,12 +1977,13 @@ BYTE check_fs ( /* 0:The FAT BR, 1:Valid BR but not an FAT, 2:Not a BR, 3:Disk e
DWORD sect /* Sector# (lba) to check if it is an FAT boot record or not */
)
{
if (disk_read(fs->drv, fs->win, sect, 1) != RES_OK) /* Load boot record */
return 3;
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
return 2;
if (disk_read(fs->drv, fs->win, sect, 1) != RES_OK) /* Load boot record */
return 3;

if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55 && LD_WORD(&fs->win[BS_55AA]) != 0xAB55) /* Check record signature (always placed at offset 510 even if the sector size is >512) */
return 2;

if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146) /* Check "FAT" string */
return 0;
if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
return 0;
Expand Down Expand Up @@ -2130,13 +2131,13 @@ FRESULT chk_mounted ( /* FR_OK(0): successful, !=0: any error occurred */

/* Get fsinfo if available */
if (fmt == FS_FAT32) {
fs->fsi_flag = 0;
fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);
if (disk_read(fs->drv, fs->win, fs->fsi_sector, 1) == RES_OK &&
LD_WORD(fs->win+BS_55AA) == 0xAA55 &&
LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&
LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {
fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);
fs->fsi_flag = 0;
fs->fsi_sector = bsect + LD_WORD(fs->win+BPB_FSInfo);
if (disk_read(fs->drv, fs->win, fs->fsi_sector, 1) == RES_OK &&
(LD_WORD(fs->win+BS_55AA) == 0xAA55 || LD_WORD(fs->win+BS_55AA) == 0xAB55)&&
LD_DWORD(fs->win+FSI_LeadSig) == 0x41615252 &&
LD_DWORD(fs->win+FSI_StrucSig) == 0x61417272) {
fs->last_clust = LD_DWORD(fs->win+FSI_Nxt_Free);
fs->free_clust = LD_DWORD(fs->win+FSI_Free_Count);
}
}
Expand Down