#123978 - Globoeil - Mon Apr 02, 2007 8:07 am
Hi all
I've searched everywhere but can't find an answer;
I'm programming VGMDS -The "RPG Maker-like" for DS- And at the beginning VGMDS was coded with gba_nds_fat.
I've entirely rewritten the code to use libfat and DLDI.
But there is a problem:
To identify a file, VGMDS uses short file names, and libfat only returns long filenames...
I know some of you will say: "You only have to use long filename to identify a file", but VGMDS identify a LOT of files, and 13 bytes for short filenames are really better for mem & disk space than 256 bytes for long filenames to identify just 1 file.
So How can I have short filename with libfat? I need this please!
Thank you
Globoeil
VGMDS:
Website: http://www.globoeil.com/
Forum: http://vgmds.keogratuit.com/phpBB2/
If I can use libfat, VGMDS will be compatible with most of the linkers!!
#123979 - chishm - Mon Apr 02, 2007 8:33 am
You should be able to open short filenames (aliases) using the normal open functions. This still isn't a good idea, though, because the alias can change depending on what order the files are placed on the card.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#123980 - Dwedit - Mon Apr 02, 2007 8:34 am
The original version had that wonderful GetAlias function, didn't it... Strange how much things change once you try to play the game of "Let's be like the standard library". You lose all of the API that doesn't map back to there.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#123982 - Globoeil - Mon Apr 02, 2007 8:58 am
Quote: |
You should be able to open short filenames (aliases) using the normal open functions. This still isn't a good idea, though, because the alias can change depending on what order the files are placed on the card. |
That's not a problem(file names of VGMDS can't exceed 8 chars lol); in fact the great problem is that I need to have short filenames with dirnext function, because I want to list file with their short filenames... Do you understand what I mean? Sorry if my english is notperfect... :(
Thanks for your really quick response (7:07->7:33 O_O)
#123985 - chishm - Mon Apr 02, 2007 9:41 am
Unfortunately there is no equivalent to FAT_GetAlias.
Dwedit:
Well yeah, but it has the benefits of being able to read multiple diretories at once, and nearly everything else is still there.
Also, I seem to recall that you were the one that demanded LFN support way back in the early days of gba_nds_fat, when it was GBAMP only ;)
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#123986 - HyperHacker - Mon Apr 02, 2007 9:46 am
Would it be too terrible to add FAT_xxx functions, adding things that aren't present in the standard library?
_________________
I'm a PSP hacker now, but I still <3 DS.
#123992 - chishm - Mon Apr 02, 2007 11:31 am
HyperHacker wrote: |
Would it be too terrible to add FAT_xxx functions, adding things that aren't present in the standard library? |
It would break the entire layered design concept, and would require access to functions with libfat that may change in future.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com
#124002 - Globoeil - Mon Apr 02, 2007 12:21 pm
So can I hope a libfat release in the future with a "GetShortname()" function? Or is it really too hard to implement in libfat?
If it is not possible, I'll try to make my own "pseudoshort()" function; like this:
pseudoshort("long name file.txt.sav;nds.jpg") => "LONGNA~1.JPG"
I think it may works at 95%... that's the best I can make alone lol.
#124014 - tepples - Mon Apr 02, 2007 1:58 pm
Globoeil wrote: |
So can I hope a libfat release in the future with a "GetShortname()" function? Or is it really too hard to implement in libfat? |
Yes, because libfat can provide only those functions that are listed in devoptab. Or would it be a good idea for devoptab to provide an ioctl() style interface that can affect subsequent calls to the findfirst() series?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#124018 - Diddl - Mon Apr 02, 2007 2:27 pm
tepples wrote: |
... Or would it be a good idea for devoptab to provide an ioctl() style interface ... |
it would be a nice feature to support ioctl() style interface like win32 does with direct block access for special utils. for example defragmentation or udisk support.
#124090 - josath - Tue Apr 03, 2007 2:29 am
Globoeil wrote: |
Quote: | You should be able to open short filenames (aliases) using the normal open functions. This still isn't a good idea, though, because the alias can change depending on what order the files are placed on the card. |
That's not a problem(file names of VGMDS can't exceed 8 chars lol); in fact the great problem is that I need to have short filenames with dirnext function, because I want to list file with their short filenames... Do you understand what I mean? Sorry if my english is notperfect... :(
Thanks for your really quick response (7:07->7:33 O_O) |
How about you just ignore any files longer than 8.3 characters then?
And for dirnext, you don't need to store 256 bytes for every single file, you only need 1 temporary 256 byte buffer, then after you read the filename, you could check if it's too long, and then if it is short enough, copy it to a shorter 13 byte buffer.
#124126 - Globoeil - Tue Apr 03, 2007 9:52 am
Quote: |
How about you just ignore any files longer than 8.3 characters then? |
It's possible, but then VGMDS users will be restricted to short name for their ressources (gif,raw...) and in the previous version of VGMDS it was not needed.
Quote: |
And for dirnext, you don't need to store 256 bytes for every single file, you only need 1 temporary 256 byte buffer, then after you read the filename, you could check if it's too long, and then if it is short enough, copy it to a shorter 13 byte buffer. |
It will works only if there is no file with >8 characters.
[/quote]
#124142 - tepples - Tue Apr 03, 2007 3:13 pm
Globoeil wrote: |
Quote: | How about you just ignore any files longer than 8.3 characters then? |
It's possible, but then VGMDS users will be restricted to short name for their ressources (gif,raw...) and in the previous version of VGMDS it was not needed. |
What about files that specify the name of another file? If they specify the actual name and not the alias, and you only stored the alias, then you have a problem.
The reliance on aliases will bite you once people develop "libext3" and "libntfs" to make the DS work more smoothly with Linux and with Windows >= XP. I don't think ext3fs has an alias for every file name, and people turn off aliases in NTFS.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#124170 - Globoeil - Tue Apr 03, 2007 8:14 pm
But save 256 bytes filenames is really bigger than save 13 bytes...
I think I'll just restrict the file names of the resources to 8+.???=13 characters.
#124224 - tepples - Wed Apr 04, 2007 6:36 am
Globoeil wrote: |
But save 256 bytes filenames is really bigger than save 13 bytes...
I think I'll just restrict the file names of the resources to 8+.???=13 characters. |
In GBFS, I chose 24 bytes as a decent compromise.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#124564 - Globoeil - Fri Apr 06, 2007 11:02 pm
Thanks for the tip