Rockbox Technical Forums
Rockbox Development => Starting Development and Compiling => Topic started by: Jazz00006 on August 29, 2006, 06:39:13 PM
-
Well, i was making my own plugin, and im not the best @ C, and i was wondering if it was possible for me to get some help?
I don't want to post anything just yet, incase this might not be allowed.
But, is there a simplified list of the API calls you can make, and their corrent syntax, because i followed the tutorial, HowtoWritePlugins and it says to take a look @ plugin.h, but i cant read it properly, (becuase its not formated for easy reading IMHO.
-
You should probably ask more specific questions, or check out the IRC channel. Or both.
BTW, you're allowed to post code. Its all under GPL.
-
thanx, im off to the irc right now :)
-
It is always a good idea to look at plugins made by others and "steal" the button handling, LCD code, etc. from there :)
-
:D
ok then, ive got my program working (to the extent of showing a splashscreen, and some text, what i wanted to know is;
How would i make a function that looked for a particular file;
i have no C coding experiance (well, not that much) so ill write it in english/basic/c (ish?)
If_file_exists as boolean (filepath)
{
blah, looking for file.
found{If_file_exists = true
}else{
If_file_exists = false
}
}
is there any way i can do that? (im going to look @ more 'basic' tutorials soon)
-
dir.c defines a funtion readdir function that returns a list of directory contents. I haven't used it, but it seems like it would be ok.
Does you function need to search subdirectories? If not, then just get the file list and see if its there. If yes, then after that step, call the function recursively on each of the directories in the folder. I don't think you can recurse all that much on embedded systems, but theres not all that many directories in Rockbox anyway, so it'd probably be ok.
-
yeah, i guess it needs the readdir, for (.rockbox/rocks) then find the file. i was gonna try and make it find
.rockbox/rocks/dummy.rock FYI
working on it now
-
this is what i have got so far... havent tested it yet
i know thats a butched copy of the disktidy, but its all i have to go off at the moment
updated trial script(test2)
[attachment deleted by admin, too old]
-
I think you should ask yourself why you want to look for the file instead of just trying to open it and use it. A quick example of what I mean:
char buffer[256];
int f, rc;
f = rb->open("/.rockbox/rocks/myrock.rock", O_RDONLY);
if(f < 0) {
rb->splash(HZ, true, "Can't open file");
} else {
rc = rb->read(f, buffer, 256);
}
etc...
-
meh, what you have does the job :D
i only wanted to check for the file, not run it at first, then i was going to learn how to run it :)
thanx alot
-
...is there a simplified list of the API calls you can make, and their corrent syntax
This is a really good idea, i'll look into it.
It should probably be a wiki page. :)
-
...is there a simplified list of the API calls you can make, and their corrent syntax
This is a really good idea, i'll look into it.
It should probably be a wiki page. :)
Yeah please do :)
This is what i have so far, with a bit more help from other files :)
(Redone)
but when it comes to saving the file, all i get is a weird char, not the ones i write, can anyone help me now?
[attachment deleted by admin, too old]