Hacking Trying to make the Supercard suck less in 2022...

metroid maniac

An idiot with an opinion
OP
Member
Joined
May 16, 2009
Messages
2,088
Trophies
2
XP
2,634
Country
Intro

If you've been looking for a GBA flashcart recently, you'll probably be aware of the fact that the functional cheap flashcarts of old like the EZ Flash IV just aren't around any more. There are high end carts which are better like the Everdrive GBA and EZ Flash Omega Definitive Edition, but they'll easily set you back some £80-£90. On the other hand, it's easy to find cheap listings for this little guy.
1672648299040.png

This seems to be a clone of the Supercard Mini SD, albeit with the obsolete and obscure Mini SD slot replaced by a micro SD slot instead (interestingly, the shell still has a mini-SD sized hole). You can grab it for about £20 and it's widely available on eBay or Aliexpress. I already have a few good GBA flashcarts but I wanted to buy one of these to find out just how capable it really was. As it turns out, this cart suffers a lot of heavy limitations.
  • The cart uses slow SDRAM, meaning GBA games must be patched to prevent reducing wait games which introduces lags and slowdowns in some games.
  • The patching above requires the use of external client software. I had some problems using this due seemingly to DPI scaling cropping parts of the UI. The client also needs to perform SRAM patching for many games to save.
  • You can somewhat mitigate the slowdown by using prefetch patching, but that's another tool you have to use.
  • The cart does not support SDHC, so you're limited to only 2GB Micro SD cards or less.
  • Unlike most flashcarts, SRAM is not automatically copied to the SD card on reboot. You have to copy it ingame with a patch and a key combo, or by selecting the save file in the file browser after rebooting.
Some of these limitations are hardware-based, but others are due to poor software.
  • The client software seems unnecessary. The EZ Flash IV 2.0 firmware update added the ability for the cart itself to perform SRAM patching. Maybe a firmware update could add this and also waitstate/prefetch patching, removing the need for client software.
  • The EZ Flash IV 2.0 also added SDHC support. Based on the open source DLDI drivers available, it looks like the SD card is mainly software driven - so maybe it's possible here to patch in SDHC support?
  • Automatically copying SRAM on reboot is an obvious and easy thing to fix.
With that all in mind, I decided it'd be an interesting venture to see whether I could get an alternative firmware booting on the Supercard and then how far it would be possible to push it. Spoiler alert for those who aren't interested in reading the whole thing - I wasn't able to get very far.

Accessing flash
At this point, I didn't have any real clue what sort of hardware is in the Supercard. Unlike say the EZ Flash Omega/Definitive Edition, there's no documentation out there and only a few code samples. Fortunately I was able to find a few existing tools for flashing a Supercard SD. Those are flashmp and scflash_sd. Source wasn't available for these tools but I was able to understand just enough of the assembly to figure out how to access the internal flash chip which stores the firmware. With that I was able to find out the size of the flash at 512KB, dump its contents on the latest 1.85 firmware (sc.zip), and write a small NDS program which can flash an alternative firmware to it (sckill.zip).
1672649962697.png

Writing something bootable

With that out of the way it was time. I noticed when trying to dump the supercard's firmware that the full firmware chip isn't readable unless some magic pokes are done, or else only the top ~0x400 bytes or so. A normally built GBA homebrew wouldn't run unless that space were unlocked, so I needed to write a quick bootloader which would enable this before handing control over to whatever GBA multiboot or NDS binary you wanted to run. This has been attached as scfw.zip. Combining it with the Hello World example included with devkitARM, I was finally able to get my Supercard to boot to something other than the official firmware.
1672650507759.png

Reading the SD card

At this point I wanted to be able to get filesystem access. I just want to be read out any file from the SD card, without caring much about how it's done for the time being. libgba provides a few different builtin drivers for libfat to use, but even though _io_scsd is present, this seems to be incompatible with the cartridges I have.
C:
// Include known io-interfaces:
#include "io_mpcf.h"
#include "io_m3cf.h"
#include "io_sccf.h"
#include "io_scsd.h"
#include "io_m3sd.h"

static const DISC_INTERFACE* discInterfaces[] = {
    &_io_mpcf, &_io_m3cf, &_io_sccf, &_io_scsd, &_io_m3sd
};

const DISC_INTERFACE* discGetInterface (void)
{
    int i;

    for (i = 0; i < (sizeof(discInterfaces) / sizeof(DISC_INTERFACE*)); i++) {
        if (discInterfaces[i]->startup()) {
            return discInterfaces[i];
        }
    }
    return NULL;
}
So I changed tack and decided I'd see if I can get NDS mode software to read the SD card. Rather than relying on static drivers, the default libfat uses DLDI instead. Chishm's old webpage still seems to be up with a few options, but these drivers are also mirrored on github.
1672651271818.png

Chishm's driver which seems to be the same one from libgba always failed to init, but the alternative driver from Moonshell seemed to work! I patched nds-hb-menu and launched it through the official Supercard firmware and was able to see the SD card contents just fine.
1672651463237.png

But look again at that comment on the alternative driver - "Must be booted from Supercard firmware." I had hoped it'd work regardless, but after flashing the Supercard with this version of nds-hb-menu...
1672651642349.png

Drat! And this is where things are currently stuck. I have no idea what magic the Supercard firmware performs which makes this driver able to work. I could try to dig into the official firmware a little more, but that sort of reverse engineering is a little daunting! Anyway, I'm glad I was able to make it this far, maybe I'll figure it out in the future but for now this is where things stand.
 

Attachments

  • flashmp.rar
    435.8 KB · Views: 94
  • SCflash_sd.rar
    307.7 KB · Views: 102
  • sc.zip
    288.6 KB · Views: 108
  • sckill.zip
    900 bytes · Views: 99
  • scfw.zip
    773 bytes · Views: 103

r1vver

Well-Known Member
Member
Joined
Oct 7, 2017
Messages
551
Trophies
0
XP
979
Country
Russia
I also received this cartridge the other day, and also with the aim of carrying out terrible experiments on it.
True, I haven’t started yet, I’m still celebrating the holidays (tradition).

What I noted to myself while collecting information about this cartridge:
There are more DLDIs. I don't know how much different they really are, but they are different.
in "addition" to the scsd and scsd_moon
there are sclt (marked for SuperCard Lite SD card) and scrb (marked for SuperCard Rumble SD card, but "May work for other SuperCard devices that use SD cards") - https://gbatemp.net/threads/ds-i-3d...menu-replacement.472200/page-550#post-9056417
and also:
mysterious scsd2 - https://github.com/DS-Homebrew/DLDI/blob/master/scsd2.dldi
and somehow hacked scsd-moon from here https://vespenegas.com/dldi.html - https://gbatemp.net/threads/ds-i-3d...menu-replacement.472200/page-550#post-9057668
 
Last edited by r1vver,

StrayGuitarist

A genuine feline disaster.
Member
Joined
Mar 28, 2019
Messages
817
Trophies
1
Location
Vana'diel
XP
2,707
Country
United States
I got one of these cartridges, though mine still has the garbage MiniSD slot, just with a MicroSD adapter. I got it 3 or 4 years ago for something like 5 bucks, from a local reseller. I'm willing to perform experiments with my card, as well, if you ever need additional testing.
 

metroid maniac

An idiot with an opinion
OP
Member
Joined
May 16, 2009
Messages
2,088
Trophies
2
XP
2,634
Country
I also received this cartridge the other day, and also with the aim of carrying out terrible experiments on it.
True, I haven’t started yet, I’m still celebrating the holidays (tradition).

What I noted to myself while collecting information about this cartridge:
There are more DLDIs. I don't know how much different they really are, but they are different.
in "addition" to the scsd and scsd_moon
there are sclt (marked for SuperCard Lite SD card) and scrb (marked for SuperCard Rumble SD card, but "May work for other SuperCard devices that use SD cards") - https://gbatemp.net/threads/ds-i-3d...menu-replacement.472200/page-550#post-9056417
and also:
mysterious scsd2 - https://github.com/DS-Homebrew/DLDI/blob/master/scsd2.dldi
and somehow hacked scsd-moon from here https://vespenegas.com/dldi.html - https://gbatemp.net/threads/ds-i-3d...menu-replacement.472200/page-550#post-9057668
Tried out several of the drivers you posted here.

scrb - old DLDI spec, uses 32KB (latest libnds uses 16KB). Found an old version of nds-hb-menu with compatible DLDI stub instead. Same behaviour as scsd_moon.
sclt - does not work even from firmware.
scsd2 - same behaviour as scsd_moon
scsd_moon hacked - same behaviour os scsd_moon
 

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,879
Trophies
2
XP
29,196
Country
United Kingdom
Interesting experiments, I wish you luck!

Out of curiosity, is there a list of the games that suffer slow downs or other issues when patched as best they can be and running on supercard?
 
  • Like
Reactions: StrayGuitarist

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Interesting experiments, I wish you luck!

Out of curiosity, is there a list of the games that suffer slow downs or other issues when patched as best they can be and running on supercard?
Kind of.

https://web.archive.org/web/20081015031903/http://rothmans.joskeonline.com/supercardsite/ was the link most originally used and was reasonably feature complete but its capture within internet archive is rather less than is ideal (this being peak "HTML is bad, php is the new hotness").
You might also gain something from the various changelogs of the kernel.


As far as making new speed patches I figure there is a reason nobody has really bothered in all the years since, and not just because EZ4s were fairly cheap for a while there. Every other flash cart that is not a clone or this or one of the very first just has whatever AP concerns, hardware concerns and save patching (which is trivial). Speed patching even before you get into the subjective stuff takes a fair bit more effort to do well as you are optimising assembly code on a compiled language that tends to be fairly optimised already (there are many exceptions and stupidities done by devs but to recognise them and sort them is itself quite the skill).
 
  • Like
Reactions: hippy dave

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,879
Trophies
2
XP
29,196
Country
United Kingdom
Kind of.

https://web.archive.org/web/20081015031903/http://rothmans.joskeonline.com/supercardsite/ was the link most originally used and was reasonably feature complete but its capture within internet archive is rather less than is ideal (this being peak "HTML is bad, php is the new hotness").
You might also gain something from the various changelogs of the kernel.
Thanks! It's a shame if that data didn't get fully backed up anywhere. You can find info about quite a few more games if you scroll back through the years, but then can't tell if they'd had any improvements with later updates. Looks like a lot of games I like would work normally, but some notable problem games too.
 

Nikokaro

Lost philosopher... searching for a way out...
Member
Joined
Feb 3, 2020
Messages
2,184
Trophies
1
Location
Nautilus (under) Lake Como, Italy 🇮🇹
XP
6,751
Country
Italy
Hi. If I understand correctly you would like:
1) Set up an SRAM, waitstate and prefetch patching, without the need for the client software;
2) Support micro SDs larger than 2 GB;
3) Automatically copy SRAM on card reboot.
If you could do these things, that would be quite an accomplishment already; I wish you good luck. 😉
By now I think I'm the only one who actually plays GBA roms on this much despised cart just for fun and not as a "guinea pig" to perform risky experiments...🤣

Here is an old compatibility list, but it is in my language (by the way, the same as the original founder of this site 😎):
https://www.gbarl.it/index.php?showtopic=17414&st=0
If anyone is interested in a specific title and how to improve its performance (prefetch and fast-restart patching), please let me know if I can help. And excuse my eternally clumsy english.😅
 

pustal

Yeah! This is happenin'!
Member
Joined
Jul 19, 2011
Messages
1,560
Trophies
2
Location
Emerald Coast
Website
web.archive.org
XP
6,214
Country
Portugal
I have one of these too. I bought it to take it with me on a transatlantic travel and it was so bad. The saving system is awful just for starters, ruined my whole game time I spent on the going journey.
 

metroid maniac

An idiot with an opinion
OP
Member
Joined
May 16, 2009
Messages
2,088
Trophies
2
XP
2,634
Country
Looks like the open source scsd driver will function when booted from official firmware so long as the _SCSD_startUp,_SCSD_isInserted and _SCSD_clearStatus functions are stubbed out with dummy functions This seems to be the best starting point for trying to make a dldi that will bootstrap itself on these supercards.
 

RaidenNinja

New Member
Newbie
Joined
Feb 27, 2023
Messages
1
Trophies
0
XP
17
Country
Spain
If you wanna do what you want to do (make it suck less) you're gonna have to decompile the kernel. The kernel is made with DKARM Developer's Kit (this was replaced with the DB-ARM Debugger Kit). Also, im not entirely sure about this, the Supercard can interact with the Nintendo DS internal clock, adding the RTC support to it. As i said, i'm not 100% sure about this fact, but maybe this helps in your daunting task of making this card work properly.
 

metroid maniac

An idiot with an opinion
OP
Member
Joined
May 16, 2009
Messages
2,088
Trophies
2
XP
2,634
Country
If you wanna do what you want to do (make it suck less) you're gonna have to decompile the kernel. The kernel is made with DKARM Developer's Kit (this was replaced with the DB-ARM Debugger Kit). Also, im not entirely sure about this, the Supercard can interact with the Nintendo DS internal clock, adding the RTC support to it. As i said, i'm not 100% sure about this fact, but maybe this helps in your daunting task of making this card work properly.
Disassembling the kernel to some degree will be necessary, to find out how to initialise the SD card correctly. Understanding the rest of the kernel should not be necessary. Reading/writing files and being able to use SDRAM is all that's needed to write a new kernel from scratch.

Right now this is on hold, I'm looking at other (easier!) projects to ramp up my skill with low level programming first.

side note: the WSL install holding my project files for this got deleted by windows update the other day, I'm glad I uploaded them here first.
 

SiliconExarch

New Member
Newbie
Joined
Feb 18, 2023
Messages
2
Trophies
0
Age
32
XP
40
Country
United Kingdom
Disassembling the kernel to some degree will be necessary, to find out how to initialise the SD card correctly. Understanding the rest of the kernel should not be necessary. Reading/writing files and being able to use SDRAM is all that's needed to write a new kernel from scratch.

Right now this is on hold, I'm looking at other (easier!) projects to ramp up my skill with low level programming first.

side note: the WSL install holding my project files for this got deleted by windows update the other day, I'm glad I uploaded them here first.
I've also been looking into this independently and have managed to initialise the SD card correctly using a patched libfat however building anything that interfaces with the Supercard on devkitARM r38 or newer results in a lockup when trying to call _SCSD_writeData_s. I believe this to be a linker error as I swapped in just the ld executable from r37 into my r38 installation and that resulted in a working binary.

I've got a couple of examples built for both GBA and NDS mode but my post count isn't sufficient to upload or link them here yet, if you want to send me a PM I'd be happy to share these and elaborate on what I believe the issue is with newer versions of the toolchain. It's kinda just speculation atm so I'm not quite ready to file a bug report with devkitPro yet.
 
Last edited by SiliconExarch,

loizlol

New Member
Newbie
Joined
Apr 28, 2023
Messages
1
Trophies
0
Age
29
XP
13
Country
Brazil
Since i was using the scflash_sd to flash a new firmware on the sdcard, it erases it 100% and when its writing the firmware it get some error and stops at 13498bytes, and now my sc mini sd its dead, any tips of what are the chip that gives this error? so i can try soldering another one on it?
 

xy1154

Well-Known Member
Newcomer
Joined
Feb 4, 2015
Messages
49
Trophies
0
Age
29
Location
Somewhere
XP
154
Country
Switzerland
Since i was using the scflash_sd to flash a new firmware on the sdcard, it erases it 100% and when its writing the firmware it get some error and stops at 13498bytes, and now my sc mini sd its dead, any tips of what are the chip that gives this error? so i can try soldering another one on it?
I remember receiving a "broken" SC Mini-SD from my friend, who told me that the card was falty, so much that "it only works occasionally". After extensive testing I found out that the MX chip was the culpit - sometimes knocking it gently would temporarily fix the problem. May I suggest running the recovery utility first so you can at least try to revive the card? (You'll need a DS Phat or Lite as the recovery program runs from Slot-1) Once the firmware has been restored, you can then tackle the MX chip.
 
Last edited by xy1154,
  • Like
Reactions: zfreeman

blckbear

Member
Newcomer
Joined
Jan 2, 2020
Messages
9
Trophies
0
Age
24
Website
github.com
XP
242
Country
Uruguay
Hey, this is great!

I've been interested in doing something like this for a while (specially to upgrade the built-in Goomba Color emulator to the latest release) to give the cart more and better functionality and maybe reduce bugs.

I'd love to help with this, I am not that knowledgeable with GBA programming but I know the basics of assembly (Z80 assembly is what I have a bit of experience with) and I know C (I mainly wrote software in C for the PS2 so I guess it's something) but I have no clue on how software reverse engineering is done. I guess we could make some kind of log with detailed info of what has been done/achieved, how, which tools were used, etc, so it's easy to pick up where the other person left at and maybe achieve something as a community. I'm clearly not expecting you to do this ASAP (or at all, people also have lives and limited time so it's understandable if you don't want to do this now or ever), but I may start making some sort of compilation of info from what you and others posted here to start to understand what is being done.

Seeing this thread got me hyped lol

The only useful (I hope) thing I can say for now is that I took a look at your dump of the firmware and I saw that the Goomba emulator is not stored plainly, it seems to have some data intermittently between chunks of the emulator, maybe it would be better to decompile the firmware in order to replace the emulator. I was hoping replacing the emu would be as easy as hex copying the newer one into the firmware but I guess not. Also, the firmware update file (sd_185.bin) does not contain the plain firmware, but it seems to be encrypted/compressed or something like that as no strings are recognisable. I was hoping it would also be a case of hex editing to paste a new firmware into the installer.
 

metroid maniac

An idiot with an opinion
OP
Member
Joined
May 16, 2009
Messages
2,088
Trophies
2
XP
2,634
Country
The only useful (I hope) thing I can say for now is that I took a look at your dump of the firmware and I saw that the Goomba emulator is not stored plainly, it seems to have some data intermittently between chunks of the emulator, maybe it would be better to decompile the firmware in order to replace the emulator. I was hoping replacing the emu would be as easy as hex copying the newer one into the firmware but I guess not. Also, the firmware update file (sd_185.bin) does not contain the plain firmware, but it seems to be encrypted/compressed or something like that as no strings are recognisable. I was hoping it would also be a case of hex editing to paste a new firmware into the installer.
If I ever manage to make progress on the SD access issue, I plan to load as much as possible from the SD card. The firmware in the cart would just be a bootloader and the menu interface and integrated extras like Goomba would be loaded from the SD card. This would make it easier to swap components out or update them piecemeal.

EDIT: This approach may also help get a partially working solution sooner, because the bootloader can take some shortcuts to init the SD card and the kernel can use an existing DLDI.
 
Last edited by metroid maniac,

GorGylka

Well-Known Member
Newcomer
Joined
May 3, 2016
Messages
53
Trophies
0
Age
27
XP
620
Country
Serbia, Republic of
I'm not very good at low-level stuff, but I think there are 2 things that should be fixed in Supercard:
- update internal Goomba emulator (add border for example)
- fix file sorting (at this stage it sorts files by date, not alphabetically)
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Does it sort by date or does it sort by file table order? Many embedded devices will sort things by the order they appear in the file table as it is easy to do that (you just read it) rather than having to do work and that can look like date order (almost certainly is date added order).
There are tools like fat sorter that allow you to change things there. If you could test one of those it might both solve your problem and also confirm it is the case.
https://www.softpedia.com/get/System/File-Management/FAT-Sorter.shtml
 
  • Like
Reactions: metroid maniac

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    S @ salazarcosplay: @BakerMan can one play cod from hen ps3?