#118543 - thing - Wed Feb 14, 2007 4:43 am
Hello,
First of all, I'm new to NDS and development and libfat so please take this into account :)
I'm playing with libfat and I managed to do basic stuff like printing the contents of a directory (huray!) So my next step was to play a bit with partitions and try to list the root of a DSX on slot1 AND a SCL on slot2. For that I've written a basic app that mainly does the following:
1. call 'fatInitDefault()'
- this should mount slot1 (default) and slot2, right?
2. call 'diropen("fat0:/")' and use 'dirnext()' to interact over structure
3. call 'diropen("fat1:/")' and use 'dirnext()' exactly like in step '2'.
4. call 'fatUnmount()' to unmount the devices
(should I post the source? - it's full of debug printouts right now...)
On DSX (with or without DLDI patch)
- step 1 OK
- step 2 OK: dump slot1 contents
- step 3 Not OK: dump slot1 contents too!
- step 4 OK
On SCL (with DLDI patch)
- step1 OK
- step2 Not OK: dump slot2 contents (shouldn't it be slot1?)
- step3 Not OK: 'diropen()' call fails
- step4 Not Ok: fails to unmount 'PI_SLOT_1'
So, what am I missing to get the two carts working altogether? And how can I apply DLDI patch for, say, DSX AND SCL??
Thanks a lot for the help,
Thing
#118549 - chishm - Wed Feb 14, 2007 5:10 am
You actually want fat1:/ for Slot-1 and fat2:/ for Slot-2. fat0:/ is the same as fat:/, which will depend on the whichever device mounted first or was set as the default.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#118554 - thing - Wed Feb 14, 2007 6:04 am
Oooups!! :)
Thanks, Chishm!
Now I'm getting the proper device identification through:
Code: |
char *_getDeviceType(char *partition, char *device) {
struct stat st;
if(stat(partition, &st) == 0) {
strncpy(device, (char *)&st.st_dev, 4);
device[4] = '\0';
} else {
// Something went wrong
strcpy(device, "N/A");
}
return device;
}
|
But I'm still having the DLDI patching problem: If I patch the app with SCL DLDI, DSX in slot1 is not recognized; if I patch the app with DSX DLDI, SCL is not properly identified, etc...
How should I patch an app that is supposed to access the two devices?
Thanks!
#118556 - chishm - Wed Feb 14, 2007 6:43 am
Unfortunately there's no way to do it. That's one of the current limitations of DLDI.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#118558 - thing - Wed Feb 14, 2007 7:07 am
Hmm... Okay...
It was a fun start anyway :)
Well, my initial idea was to try copying files from one device to another... any idea if a pre-DLDI libfat could do that?
Thanks.
#118564 - Diddl - Wed Feb 14, 2007 8:52 am
For this DLDI must be redesigned. You have to allocate memory for two possible driver (DLDI slot1, DLDI slot) and you need two different idetnification strigs (Chishm1/Chishm2). The DLDI driver itself knows if it is for slot 1 or 2, I think I saw a flag for this.
The DLDI patch program has to look into the choosen DLDI file if it is written for slot1 or slot2 and patch the correct memory slot.
LIBFAT must be changed to look into both memory slots ...
###
many work for Chishm ... ;)
but I think it's feasible and it would be very nice!
#118565 - Diddl - Wed Feb 14, 2007 8:59 am
After this it would be nice do code a "midnight commander for NDS". With copy/rename/move function between slot 1 and slot 2 or between different directories.
Maybe with FTP connect ...
Maybe with link to another DS over Wifi ...
Maybe with Firelink support! Firelink is a Slot 2 Modul which comes with this DS Linker card (slot 1 solution). Firelink has a USB connector and could connect to a PC, a external harddisk, a photo camera, a printer ...
Maybe with DSerial Suport. This would be the USB connector for slot 1 ...
#118567 - OOPMan - Wed Feb 14, 2007 9:12 am
I noticed the Firelink myself recently. It looks cool, kinda like a DS-X but with 1 gigabyte of memory, as opposed to 512 mebabytes. Still, there's no trace of any kind of FAT drivers, source or anything on the site.
I'd mark it as dodgy until that's cleared up...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...
#118570 - chishm - Wed Feb 14, 2007 9:40 am
thing wrote: |
Well, my initial idea was to try copying files from one device to another... any idea if a pre-DLDI libfat could do that? |
libfat can do that now, with the condition being that at least one of the slots use one of the built in drivers (MPCF, SCCF, SCSD, M3CF, M3SD, NJSD, NMMC).
Diddl: It doesn't need 2 identification strings, but the patcher would need a slight modification.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#118571 - Diddl - Wed Feb 14, 2007 9:43 am
It is a wonderful solution for developer. You only need to compile, upload and test. Without any laod/unload card and such things.
There are old gba_nds_fat sources and a DLDI file for it. Moonshell and DS organizer works fine. But there is only read support for it in the moment. Allegedly there is a lib with write support provided from ncard, search for "NCard fatio" in google ...
There are over 5 companies which provide exactly the same hardware under different names: DS linker, MK5 from NeoFlash, NCard, DS Firecard, PIRATECARD ... all this are exactly the same. You can change the firmware as desired.
PIRATECARD ist on of the cheapest. The 16G costs GBP44.90, the 2GB card GBP24.90. You don't need a additional TF or SD card. look at PIRACY-DOT-NET.
[Product name and web site removed by MOD because the manufacturer's web site carries pirated ROMs]
Last edited by Diddl on Wed Feb 14, 2007 9:51 am; edited 1 time in total
#118572 - Diddl - Wed Feb 14, 2007 9:46 am
chishm wrote: |
libfat can do that now, with the condition being that at least one of the slots use one of the built in drivers (MPCF, SCCF, SCSD, M3CF, M3SD, NJSD, NMMC). |
oh, so it should be no problem, cause most people use a SC or a M3 solution for slot 2. :)
#118589 - thing - Wed Feb 14, 2007 1:17 pm
Diddl wrote: |
chishm wrote: |
libfat can do that now, with the condition being that at least one of the slots use one of the built in drivers (MPCF, SCCF, SCSD, M3CF, M3SD, NJSD, NMMC). |
oh, so it should be no problem, cause most people use a SC or a M3 solution for slot 2. :) |
That might be a silly question, but in my case I have a DSX and SCL... Well, the SCL does need to be patched, but the DSX seems to work fine with the built in drivers (at least it doesn't need a patch). So doesn't this setup qualify for the "condition being at least one of the slots using the built in drivers"?
Launching from DSX, if I patch with SCL DLDI it just hangs at 'fatInitDefault()'; and with no patch or DSX patch it gets slot1 for 'fat1' and 'fat2'.
#118590 - chishm - Wed Feb 14, 2007 1:27 pm
The DS-X is special. It does it's own internal patching, and overwrites the original libfat drivers with it's own when you load a file. Unfortunately, this causes weird problems, as you described.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#118593 - thing - Wed Feb 14, 2007 1:55 pm
chishm wrote: |
The DS-X is special. It does it's own internal patching, and overwrites the original libfat drivers with it's own when you load a file. Unfortunately, this causes weird problems, as you described. |
Ahh... ok.
Good to know, thanks... So I guess I've picked the wrong devices... ;)
#118596 - cory1492 - Wed Feb 14, 2007 2:26 pm
OOPMan wrote: |
I noticed the Firelink myself recently. It looks cool, kinda like a DS-X but with 1 gigabyte of memory, as opposed to 512 mebabytes. Still, there's no trace of any kind of FAT drivers, source or anything on the site.
I'd mark it as dodgy until that's cleared up... |
I read the DSLinker/Neo MK5 dldi drivers work with the Firelink, quite possibly the USB protocols (gamepad/mousepad apps) that were sourced as well. The DLDI is read only though...
#118602 - Diddl - Wed Feb 14, 2007 3:20 pm
cory1492 wrote: |
... quite possibly the USB protocols (gamepad/mousepad apps) that were sourced as well... |
Right, this source are also available now. but much to my regret the USB removable drive source is not available.
I was in hope I can use firelink for my other slot 1 solutions also.
But now it's clear, fireline uses for USB a standard chip from Philips: ISP1581 - I have downloaded the datasheet so maybe I can access it from own code.
#118638 - HyperHacker - Thu Feb 15, 2007 1:14 am
Will future versions of libFAT provide the ability to patch in two drivers?
_________________
I'm a PSP hacker now, but I still <3 DS.
#118647 - thing - Thu Feb 15, 2007 2:27 am
HyperHacker wrote: |
Will future versions of libFAT provide the ability to patch in two drivers? |
That would be very nice :)
#118658 - OOPMan - Thu Feb 15, 2007 9:16 am
Er, correct me if I'm wrong, but isn't libfat's current support for SLOT-2 devices pretty complete? I mean, most of them work with both read and write access, right?
So....
Why do we need to be able to patch two drivers in?
What I mean is, new SLOT-2 devices will probably be rare output now and hence the current SLOT-2 support level is probably pretty much fine.
In other words, for people with one device, SLOT-1 or SLOT-2, the DLDI stuff is great. For people with two devices, a SLOT-1 *and* a SLOT-2, the current DLDI+old drivers is still pretty usable, right...?
Or am I missing something?
I was under the impression that at present one can use two devices pretty easily in the form of *some* SLOT-1 solution (Excluding that naughty DS-X anyway) and a supported SLOT-2 solution...
I guess having two drivers patchable-in would be consistent though, which is a good reason I suppose :-)
Blah :-)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...
#118662 - Diddl - Thu Feb 15, 2007 9:44 am
you are right. but who says there will no more slot 2 solution in future?
and of course, the code will be smaller if there is no unused io-driver code in it ...
#118708 - dantheman - Thu Feb 15, 2007 10:52 pm
OOPMan wrote: |
I was under the impression that at present one can use two devices pretty easily in the form of *some* SLOT-1 solution (Excluding that naughty DS-X anyway) and a supported SLOT-2 solution... |
The DS-X team recently released a DS-X DLDI file, and despite some slight issues in the first one, Chishm and a DS-X coder worked together to improve both the DLDI file itself and the way libfat handles certain processes regarding initialization (okay, I'm not a coder, I'm not entirely sure what got fixed). But the point is, from what I can tell, the DS-X actually helped improve the entire DLDI system as a whole.
I read on their forums that DS-X users can now use NitroTracker perfectly, which was impossible earlier, among other homebrew programs that were giving them issues previously.
That's not to say that I like the product. Just wanted to bring some recent happenings to your attention.
#118739 - OOPMan - Fri Feb 16, 2007 9:37 am
Nice catch dan :-)
I was mainly referring to the problems experienced by a previous dev in this thread...
It's nice to hear that DS-X users are getting better compatibility now. Still, their dodgy in-stream driver patching didn't help for a while :-)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...
#118747 - kusma - Fri Feb 16, 2007 11:29 am
dantheman wrote: |
okay, I'm not a coder, I'm not entirely sure what got fixed
|
What got fixed was unaligned access to the card.
dantheman wrote: |
But the point is, from what I can tell, the DS-X actually helped improve the entire DLDI system as a whole.
|
Some unhandled error codes and a clarity-issue in the documentation was spotted. No "big" things were improved AFAIK.