Ok i have this simple test to read all the files and directories from the memory stick root and check if the file or directory can be opened.
this is the main.cpp code:
Code: Select all
/*
*/
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern "C" {
#include "fat.h"
}
PSP_MODULE_INFO("FAT_TEST", 0x0, 0, 1);
PSP_MAIN_THREAD_NAME("Fat Test");
#define printf pspDebugScreenPrintf
#define MS_ROOT "ms0:/"
int main( int argc, char *argv[] )
{
p_fat_info fat_info;
char path[256];
char shortpath[256];
char file[256];
pspDebugScreenInit();
fat_init();
strcpy(path, MS_ROOT);
strcpy(shortpath, MS_ROOT);
u32 count = fat_readdir(path, shortpath, &fat_info);
if( count != INVALID ) {
printf( "Dir opened (%s)\n", shortpath);
printf( "%d Entries\n", count);
for(int i = 0; i < count; i++) {
printf( "%d - %s\n", i, fat_info[i].filename);
sprintf(file, "%s%s", MS_ROOT, fat_info[i].filename);
if( fat_info[i].attr & FAT_FILEATTR_DIRECTORY ) {
p_fat_info f_info;
char shortdir[256], dir[256];
u32 c = -1;
sprintf(shortdir, "%s%s", shortpath, fat_info[i].filename);
sprintf(dir, "%s%s", path, fat_info[i].longname);
if( (c = fat_readdir(dir, shortdir, &f_info)) != INVALID ) {
printf( "Dir opened (%s)\n", shortdir);
printf( "Found %d entries\n", c);
}
else {
printf( "Could not open dir (%s - %d)\n", shortdir, c);
}
}
else {
FILE *f = fopen(file, "rb");
if( f == NULL ) {
printf( "Could not open file (%s)\n", file);
}
else {
printf( "File opened (%s)\n", file);
fclose(f);
}
}
}
}
else {
printf( "Could not open dir (%s)\n", shortpath);
}
printf( "Done\n");
exit_app:
sceKernelDelayThread( 2 * 1000000 );
sceKernelExitGame( );
return 0;
}
Inside the ms root i have several files and dirs, some with english names and
others with japanese names. Now if i compile the app like a kernel one with the PSP_MODULE_INFO("FAT_TEST", 0x1000, 0, 1); all the japanese names get read properly and I can open the files, but if i compile it like a user mode app with PSP_MODULE_INFO("FAT_TEST", 0x0, 0, 1); the japanese names get read wrong (something like ___.mp3) and cannot be opened.
I have tried some apps like the ereader and it works fine for the 1.5 kernel version but for the 3.xx kernel version it cannot play the japanese names mp3s, and the latest build of cooleyes ppa for 3.xx kernel can't enter directories with japanese names either.
I'm using the 3.90 m33 firmware and a psp fat for testing. Does it have anything to do with the firmware version?
Does anyone know how to solve this? Thanks in advance!!