metroid-maniac / SCFW

SCFW Supercard Custom Firmware & Kernel
GNU General Public License v3.0
83 stars 4 forks source link

fat init broken on SuperCard Lite (MicroSD) #16

Closed ApacheThunder closed 3 weeks ago

ApacheThunder commented 3 weeks ago

After finally figuring out how to compile SCFW and related projects I have investigated the issue with fat init not working with SCFW kernal on SuperCard Lite (MicroSD edition, not the Rumble version)

I have identified the 2 commits that break fat init for this card:

https://github.com/metroid-maniac/SCFW/commit/6324930cecb0498736ba8cd3ec6f645bfb006758

And:

https://github.com/metroid-maniac/SCFW/commit/228b8b6f3abab36cf16df6261f4d987040d0ab61

The specific part of the waitstate commit that breaks SC Lite was the changing of 152043522 to 0x0b100002. I was able to keep the rest of the changes from this commit with no issue but not that final line. I had to use the old value. I tried other values but it seems to only work with the one that was originally set so I guess SC Lite doesn't like that one. That or there's some aspect of this code I'm missing which is more then possible as I am not familiar with thumb code very well.

As for the "Use SWP instruction to optimize block read" commit since I don't understand thumb code very well I can't really identify why that one is not working. All I know is, the fat init fail error returns if I include that commit to the file.

I have confirmed all the other optimizations/commits work fine. It's just these two that break it. Maybe performance will still be fine without these specific commits...otherwise SC Lite will require a separate build I suppose if you don't want to give them up for SC Lite users. Since I do not own other versions of the SuperCard I can't really test if omitting those specific commits has a noticable impact on performance.

After omitting the above commits I have confirmed rom loading and such still works in latest SCFW as well as the "SCFW-Modular" fork. So the rest of this custom firmware does indeed work as intended on SuperCard Lite. :D

This issue impacts pretty much all the SCFW forks and related projects. (SuperFW also seems to have this problem but since it's not open source at the moment I am not sure if it's even using the same SD code...but it's likely that it does)

Also note a modified build of SCKill is required to flash the frm file to SuperCard Lite as it unlike the others doesn't use the same FLASH_RW command. Refer for my fork if you wish to include my improvements on that. :D

https://github.com/ApacheThunder/SCKILL

I've noticed even with the new flash unlock command the original write code doesn't do anything. I actually had to pull the norflash write code from GBA-Exploader that was originally used for flashing norflash on 3in1's. For some reason that works on SuperCard Lite... :P

My build of SCKILL defaults to the original unlock command and write code and uses dpad to switch to SCLite mode. Loading of external frm file instead of using binary compiled in is also possible. These are just a few of the improvements I made to it.

OmDRetro commented 3 weeks ago

Assigning this bug to myself temporarily. I'll try setting up a pre-release involving your changes, but this change will be isolated to a different kernel for the time being. So for now, I'll try working on both the Supercard SD version as well as the Supercard Lite version and I'll upload a build for you to test.

OmDRetro commented 3 weeks ago

This is done via commit 40ff02f. The latest pre-release should also have the sclite version of the kernel.

Closing this bug for now. Will reopen if regressions occur.