Eleazar escribió:Por desgracia para mi, no tengo una PS3 disponible para "trastear" con ella
Pero puedes probar algo así:
s32 fd;
char cwd[2048] = "/\0";
sysFSDirent entry;
u64 read;
if(sysLv2FsOpenDir(cwd, &fd) == 0) {
while(sysLv2FsReadDir(fd, &entry, &read) == 0 && read > 0) {
//Aqui lo que quieras! El nombre de la "entrada" sería entry.d_name... por ejemplo:
printf(" %s", entry.d_name);
}
sysLv2FsCloseDir(fd);
}
Algo así, del estilo... supongo. cwd sería current working directory
(Este ejemplo lo he "extraido" de client.c de OpenPS3FTP (googleando un poco))
Edit: Recalco, que no he podido probar nada, son suposiciones... pero espero q puedan guiarte
Muchas gracias por ayudar!! Yo algo taba intentando, y habia hecho algo parecido a esto, pero no lo logro que funciones, ahroa voy a poner esto que me dijiste! El problema es q toy usando las librerias libps3gui... ahi va el codigo que tengo
int loadFile()
{
int ret = MENU_EXIT;
//trigger
GuiTrigger trigO;
trigO.SetSimpleTrigger( -1, BTN_CIRCLE_ );
GuiTrigger trigX;
trigX.SetSimpleTrigger( -1, BTN_CROSS_ );
GuiTrigger trigU;
trigU.SetButtonOnlyTrigger( 0, BTN_UP_ );
GuiTrigger trigD;
trigD.SetButtonOnlyTrigger( 0, BTN_DOWN_ );
//button image
GuiImageData btnImgData( button_png, button_png_size );
GuiImageData btnImgOverData( button_over_png, button_over_png_size );
//button sound
GuiSound btnSndOver( button_over_wav, button_over_wav_size, SOUND_WAV );
GuiSound btnSndClick2( button_click2_wav, button_click2_wav_size, SOUND_WAV );
btnSndClick2.SetVolume( 50 );
//title text
char t[ MAX_KEYBOARD_DISPLAY + 1 ];
strncpy( t, "NotePS3", MAX_KEYBOARD_DISPLAY );
GuiText titleTxt( font, t, 32, GUI_TEXT_COLOR );
titleTxt.SetPosition( 0, 0 );
titleTxt.SetAlignment( ALIGN_TOP | ALIGN_CENTER );
GuiImage buttonImg( &btnImgData );
GuiImage buttonOverImg( &btnImgOverData );
GuiText txt( font, "Load File", buttonImg.GetHeight() - 22, GUI_TEXT_COLOR );
txt.SetPosition( 0, -5 );
GuiButton exitBtn( buttonImg.GetWidth(), buttonImg.GetHeight() );
exitBtn.SetTrigger( &trigX );
exitBtn.SetImage( &buttonImg );
exitBtn.SetImageOver( &buttonOverImg );
exitBtn.SetPosition( 100, -80 );
exitBtn.SetAlignment( ALIGN_BOTTOM | ALIGN_LEFT );
exitBtn.SetLabel( &txt );
OptionList options;
int numOptions = 0;
options.SetName( ++numOptions, "PS3HDD");
//options.SetValue( numOptions, "%i", viewportX );
GuiOptionBrowser optionBrowser( 552, 248, &options );
optionBrowser.SetPosition( 0, 120 );
optionBrowser.SetAlignment( ALIGN_CENTRE | ALIGN_TOP );
optionBrowser.SetCol2Position( 260 );
optionBrowser.SetFocus( 1 );
GuiWindow w( WINDOW_WIDTH, WINDOW_HEIGHT );
w.Append( &exitBtn);
w.Append( &titleTxt);
w.Append( &optionBrowser);
HaltGui();
mainWindow->Append( &w );
ResumeGui();
while( 1 )
{
if( exitBtn.GetState() == STATE_CLICKED )
{
WindowPrompt( "NotePS3", "Do you want to go to the MainScreen", "Yes", "No" );
exitBtn.ResetState();
ret = MENU_MAIN_SCREEN;
break;
}
int cl = optionBrowser.GetClickedOption();
switch( cl )
{
case 0:
{
{
int dirhandle;
lv2FsOpenDir("/", &dirhandle);
while (1)
{
uint64_t readsize;
Lv2FsDirent item;
lv2FsReadDir(dirhandle, &item, &readsize);
if(item.d_type == 1)
{
if(strcmp(item.d_name, ".") == 0 || strcmp(item.d_name, "..") == 0)
{
continue;
}
if(!strstr(item.d_name, "hdd") && !strstr(item.d_name, "usb"))
{
continue;
}
}
string fullpath = string("/") + item.d_name + (item.d_type == 1 ? "/" : "");
string filename = string(item.d_name) + (item.d_type == 1 ? "/" : "");
options.SetName( ++numOptions, filename.c_str() );
options.SetValue( numOptions, "%s", fullpath.c_str() );
}
}
break;
}
case 1:
{
{
int dirhandle;
lv2FsOpenDir("/", &dirhandle);
while (1)
{
uint64_t readsize;
Lv2FsDirent item;
lv2FsReadDir(dirhandle, &item, &readsize);
if(item.d_type == 1)
{
if(strcmp(item.d_name, ".") == 0 || strcmp(item.d_name, "..") == 0)
{
continue;
}
if(!strstr(item.d_name, "hdd") && !strstr(item.d_name, "usb"))
{
continue;
}
}
string fullpath = string("/") + item.d_name + (item.d_type == 1 ? "/" : "");
string filename = string(item.d_name) + (item.d_type == 1 ? "/" : "");
options.SetName( ++numOptions, filename.c_str() );
options.SetValue( numOptions, "%s", fullpath.c_str() );
}
}
break;
}
}
}
while( btnSndOver.IsPlaying() || btnSndClick2.IsPlaying() )
usleep( THREAD_SLEEP );
HaltGui();
mainWindow->Remove( &w );
ResumeGui();
return ret;
}