Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Requesting Coding help
« previous next »
  • Print
Pages: [1]

Author Topic: Requesting Coding help  (Read 6732 times)

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Requesting Coding help
« 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.
Logged
Whats that got to do with the price of feet?

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9136
Re: Requesting Coding help
« Reply #1 on: August 30, 2006, 10:09:25 AM »
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.
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Requesting Coding help
« Reply #2 on: August 31, 2006, 01:47:13 AM »
thanx, im off to the irc right now :)
Logged
Whats that got to do with the price of feet?

Offline Rincewind

  • Member
  • *
  • Posts: 266
Re: Requesting Coding help
« Reply #3 on: August 31, 2006, 02:11:31 PM »
It is always a good idea to look at plugins made by others and "steal" the button handling, LCD code, etc. from there  :)
Logged
Iriver H120, Sansa e280

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Requesting Coding help
« Reply #4 on: August 31, 2006, 10:41:44 PM »
 :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)
Logged
Whats that got to do with the price of feet?

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9136
Re: Requesting Coding help
« Reply #5 on: August 31, 2006, 10:59:12 PM »
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.  
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Requesting Coding help
« Reply #6 on: August 31, 2006, 11:16:02 PM »
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
Logged
Whats that got to do with the price of feet?

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Requesting Coding help
« Reply #7 on: August 31, 2006, 11:28:10 PM »
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]
« Last Edit: September 01, 2006, 01:32:30 AM by Jazz00006 »
Logged
Whats that got to do with the price of feet?

Offline LinusN

  • Member
  • *
  • Posts: 1914
Re: Requesting Coding help
« Reply #8 on: September 01, 2006, 02:32:00 AM »
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:

Code: [Select]
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...
Logged
Archos Jukebox 6000, Recorder, FM Recorder/iAudio X5/iriver H1x0, H3x0/Toshiba Gigabeat F20/iPod G5, G5.5

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Requesting Coding help
« Reply #9 on: September 01, 2006, 03:20:33 AM »
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
Logged
Whats that got to do with the price of feet?

Offline Travis

  • Member
  • *
  • Posts: 21
Re: Requesting Coding help
« Reply #10 on: September 01, 2006, 10:10:35 PM »
Quote
...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. :)
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Requesting Coding help
« Reply #11 on: September 02, 2006, 02:15:36 AM »
Quote from: Travis on September 01, 2006, 10:10:35 PM
Quote
...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]
« Last Edit: September 02, 2006, 10:25:27 PM by Jazz00006 »
Logged
Whats that got to do with the price of feet?

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Requesting Coding help
 

  • SMF 2.0.18 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.038 seconds with 21 queries.