Browsing and Moving Files on Memstick C++, Playlist Selector

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Locked
xgumbi
Posts: 5
Joined: Thu Jul 31, 2008 2:27 am

Browsing and Moving Files on Memstick C++, Playlist Selector

Post by xgumbi »

Hi all, just some quick questions if anyone can help me out.

I'm new to PSP development, but I've been programming for a few years now in other languages so I don't need hand holding, just need some pointers.

I've never been real happy with the PSP's mp3 playlist support. As you probably know you can only have one playlist per folder. So I've written a simple program that lets me swap out the current playlist in my mp3 folder. I have all my mp3's in one folder /MUSIC/Tunes and all the playlists right under the /MUSIC folder.

It works fine and I'm happy with it, but I'd like to improve it. Currently all my playlists are hard coded into the app, so each time i create or add a new playlist i need to add it to the code and recompile. Ideally I'd like to dynamically search the /MUSIC folder for playlists (.m3u) files and display them for the user to select the one they want. Or even better, Id like to incorporate a simple file browser so the user can save playlists on the memstick wherever they want and browse to them.

This is where i'm stumped, I'm not sure how to do this on the PSP. Any ideas? Thanks in advance :)
Gimme Toro, Gimme Some More!!
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Use a simple "while (sceIoDread(fd, &a_dir) > 0)", this function is documented in the pspsdk..
( If you want to scan all the MS I think that you have to build a recursive function... ;) )
Hellcat
Posts: 83
Joined: Wed Jan 24, 2007 2:52 pm

Post by Hellcat »

RightDirection* ThereYouGo;

There you have your pointer :p

Yah, bad joke, I know, sorry.... here something (hopefulle) more helpfull ;)

You can use sceIoDopen() to open a directory and sceIoDread() to "scan" through the directories entries.
(every call of sceIoDread() puts the next entry into the structure passed to it, when it reached the end of the dir entries it returns 0.)

To determine if you hit a file or a (sub)folder you can use sceIoGetStat().
In the structure it returns, look at the st_mode value, if bit 0x2000 is set, it's a file, is 0x1000 set, then it's another (sub)folder.

All theese functions are documented pretty well in the SDKs include "pspiofilemanager.h" - or similar, if memory servs right now :)


[edit]
whooops, a few seconds too late....
xgumbi
Posts: 5
Joined: Thu Jul 31, 2008 2:27 am

Post by xgumbi »

great! thanks for the tips guys.

@Hellcat: I think these functions are exactly what i was looking for. Thanks for the pointer lol

P.S. Is there any online documentation for these I/O functions? ... I know, google is my friend ;) but if you know any off hand that'd be cool. I'll check out that header file when i get home today, hopefully this weekend i'll have some time to revise my app.

Thanks again,
Gimme Toro, Gimme Some More!!
Hellcat
Posts: 83
Joined: Wed Jan 24, 2007 2:52 pm

Post by Hellcat »

I think the header include is all the documentation you need.
The parameters of the functions are briefly, but to the point, explained and the struct definitions are present in their full beauty :)

If you have any questions left, don't hasitate to ask, I used those functions a lot myself lately for very similar things.
When I get back to my own comp, I can post a code snipped as well :)
xgumbi
Posts: 5
Joined: Thu Jul 31, 2008 2:27 am

Post by xgumbi »

Awesome, thanks Hellcat. A code sample would be great.

If i hit any snags I'll be sure to post.
Gimme Toro, Gimme Some More!!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

xgumbi wrote:Awesome, thanks Hellcat. A code sample would be great.

If i hit any snags I'll be sure to post.
There is already TONS of sample code using directory commands out there! Nearly every homebrew out uses a file requester, and hence has sample code on getting directories. I suggest you just take a look at the existing code. SHEESH! Noobies... can't live with 'em, not allowed to fire them into the sun.
xgumbi
Posts: 5
Joined: Thu Jul 31, 2008 2:27 am

Post by xgumbi »

Hey c'mon man, if you don't ask questions you don't get answers. And I'm sure you were new to this once too.

I've been in an Oracle shop for the last 4 years and I don't think any less of my co workers when they ask me for help on topics they've never had any exposure to, no point in re-inventing the wheel.

Anyway, thanks for the help Hellcat, ne0h. I've gone over the documentation on these functions and it's pretty straight forward. I've already pseudo'd my changes, I just created this post to get a shove in the right direction.
Gimme Toro, Gimme Some More!!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

I was once new, but I didn't ask questions like "How do I read a directory?" That's OBVIOUS and there are (and were) TONS of examples out there. I wanted to know how to read directories as well when I first started, so I simply looked at the code for an open source PSP program that had a file requester. DUH!!! In fact, the majority of PSP questions can be answered by looking at already written programs. If you're too lazy to look at a single app, don't expect us to go easy on you.
xgumbi
Posts: 5
Joined: Thu Jul 31, 2008 2:27 am

Post by xgumbi »

It's okay, I'm no longer bothered by your responses. I've been reading some of your other posts and it's usually the same thing "go figure it out for yourself". You're that guy who did figure it out for himself and doesn't want anyone else to have an easier time than you did.

Instead of just saying "do it yourself", maybe list some resources that you've found to be helpful in your experience. I mean, that's the whole benefit of going to someone with more experience than you, they know more. I clearly said I wasn't looking for hand holding, just direction.

With work and family, I'm a busy guy. So rather than spending valuable time finding and then hunting through the source of other ppl's apps for something that I suspected would be relatively simple, I came here looking for a simple answer to a simple question, not criticism from arrogant vets. Don't bother responding to posts from inexperienced PSP developers if you're just going to belittle them. Constructive criticism dude, look it up.

Besides, I never intended on going all out with PSP development, I don't have the time to invest. I just wanted to improve my PSP as an mp3 player, since that's one of my primary uses for it. I thought this would be a fun, short little side project for me. And it has been... mostly.

In any case, I've finished my app and I'm pretty happy with it now. Thanks for the help Hellcat.

I won't be revisiting this, so newbie flame away J.F. The floor is yours.
Gimme Toro, Gimme Some More!!
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

J.F is boring :)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

So YOUR time is more valuable than ours? WE should have to search the threads and examples so you don't have to??? Will a mod PLEASE ban this a-hole? He's even smug about it!

Hellcat, I'm warning you. Help one more a-hole like this and I'll push to have YOU banned as well. This is EXACTLY the kind of crap we don't need here. Poeple like this need to be nipped in the bud or we'll be flooded with pretentious jerks who think their time is more valuable than ours.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

just a quick comment before this gets locked out (because it will be...)... i think that IF and only IF moderators get a little more rough kicking in the a** those stupid little kids only wanting to play the "great hacker" part, we all could get more relaxed and answer more kindly to people really wanting to learn. This is a dev board indeed, but this doesn't mean that only super-professional can access it; but i repeat: don't be afraid of banning or reproach idiot people....the mood of good willing people cannot but improve.
Maxiime
Posts: 18
Joined: Thu Jun 19, 2008 11:34 pm

Post by Maxiime »

@J.F : Do you know what a forum is? No, i don't think so.
A forum is a place to help each other.

Not to flame people who are asking questions wich are stupid for YOU.
Printing "Hello world" can be a dream for a beginner. Not for you(Normally).
Saying 'noob', 'learn programming first', etc is very lazy. If you don't know the answer on a question, then shut up and stop spamming.

JF, YOU should be banned. You have 1933 posts, probable 'figure it out yourself' or spam posts

Cyaa
Last edited by Maxiime on Fri Aug 01, 2008 7:47 am, edited 1 time in total.
Maxiime
Posts: 18
Joined: Thu Jun 19, 2008 11:34 pm

Post by Maxiime »

xgumbi wrote:You're that guy who did figure it out for himself and doesn't want anyone else to have an easier time than you did.
Totally agreed.
I'm thinking the same (like many other people here)

Cyaa

(Srry for double-post)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Maxiime wrote:@J.F : Do you know what a forum is? No, i don't think so.
A forum is a place to help each other.

Not to flame people who are asking questions wich are stupid for YOU.
Printing "Hello world" can be a dream for a beginner. Not for you(Normally).
Saying 'noob', 'learn programming first', etc is very lazy. If you don't know the answer on a question, then shut up and stop spamming.
Do you know what THIS forum is for? Obviously not. Forums have different purposes, and THIS FORUM is NOT to help noobies. Never has been, never will be. You're also clearly a noobie, so shut the hell up or go away.
JF, YOU should be banned. You have 1933 posts, probable 'figure it out yourself' or spam posts
You clearly have no idea what is done here and by whom. Again, shut your pie hole you stupid noobie.
Maxiime
Posts: 18
Joined: Thu Jun 19, 2008 11:34 pm

Post by Maxiime »

@jf : Oh, so this forun is not for noobs? Euhm. . Where did you read that ? Is it written in the logo 'not for noobs' ?

Go home and shut up with your f*cking own rules. Everyone is flaming you. Plz accept what we're saying. Thank you.

Cyaa
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Locked because of excessive llamadrama.

Try to be nice to each other, folks.
Locked