Author Topic: New defines & unicode file names  (Read 2477 times)

Harteex (OP)

  • * Administrator
  • Posts: 709
    • Harteex Productions
New defines & unicode file names
« on: October 26, 2009, 09:41:18 pm »
Unicode stuff:

You can access files with filenames specified in unicode with fsys_fopenW. It has the same arguments as the normal fopen:
extern FSYS_FILE* fsys_fopenW(const char*, const char*);

To convert strings to unicode, __to_unicode_le can be used:
extern char* __to_unicode_le(char*);

It returns a pointer to a newly created string. I think you'll need to free it yourself.

Although it might be better to call these wchar* or something, as normal string operations won't work, such as strlen.

Just a note about __to_unicode_le... The ascii the Dingoo uses is different than the ascii I use. So if I try to use this function on the character ?, it will still not be right. But if I convert it to the right unicode code myself, it works :)

Other stuff

Here's a define for the function strncasecmp which compares strings with case insensitive.
extern int strncasecmp(const char* inStr0, const char* inStr1, size_t inLength);

And here is finally a repost about fsys_findfirst etc, since they disappeared at the old forum:
typedef struct {
   unsigned int  handle;
   unsigned int  size;
   unsigned int  attributes;
   unsigned int  time;
   short         padding;
   char          filename[544];
} findData;

extern int        fsys_findfirst(const char*, int, findData*);
extern int        fsys_findnext(findData*);
extern int        fsys_findclose(findData*);

The functions returns 0 on success and -1 on failure.
findfirst arguments are:
1. path + * where * could be for example *.ogg
2. flags
3. findData struct

A note about char filename[544]:
The whole filename field is not the actual filename. There seem to be parts of the filename in unicode(?) or something as well. But the extra data is always separated by 0, so string operations on filename works without problems.