示例#1
0
文件: files.c 项目: Someone101/aleph
void files_store_default_dsp(u8 idx) {
  files_store_default_dsp_name((const char*)files_get_dsp_name(idx));
  /* const char* name; */
  /* void* fp;	   */
  /* u32 size; */

  /* app_pause(); */

  /* name = (const char*)files_get_dsp_name(idx); */
  /* fp = list_open_file_name(&dspList, name, "r", &size); */

  /* if( fp != NULL) { */
  /*   print_dbg("\r\n writing default DSP..."); */
  /*   bfinLdrSize = size; */
  /*   fl_fread((void*)bfinLdrData, 1, size, fp); */
  /*   flash_write_ldr(); */
  /*   fl_fclose(fp); */
  /*   print_dbg("finished writing LDR to flash"); */
    
  /* } else { */
  /*   print_dbg("\r\n error: fp was null in files_store_default_dsp \r\n"); */
  /* } */

  /* app_resume(); */
}
示例#2
0
// fill tmp region with new content
// given input index
static void render_line(s16 idx, u16 max) {
  region_fill(lineRegion, 0x0);
  if((idx > max) || (idx < 0)) { return; }
  clearln();
  appendln((const char*)files_get_dsp_name(idx));
  endln();
  font_string_region_clip(lineRegion, lineBuf, 0, 0, 0xa, 0);
}
示例#3
0
文件: files.c 项目: Someone101/aleph
/* // not used
static void fake_fseek(void* fp, u32 loc) {
  u32 n = 0;
  u8 dum;
  while(n < loc) {
    dum = fl_fgetc(fp);
    n++;
  }
}
*/

// fread: no size arg
static void fake_fread(volatile u8* dst, u32 size, void* fp) {
  u32 n = 0;
  while(n < size) {
    *dst = fl_fgetc(fp);
    n++;
    dst++;
  }
}

// strip space from the end of a string
static void strip_space(char* str, u8 len) {
  u8 i;
  for( i=(len-1); i>0; i-- ) {
    if(str[i] == '\0') { continue; }
    else if(str[i] == ' ') { str[i] = '\0'; }
    else { break; }
  }
}


// strip extension from the end of a string
static void strip_ext(char* str) {
  int i;
  int dotpos = -1;
  i = strlen(str);
  while(i > 0) {
    --i;
    if(str[i] == '.') {
      dotpos = i;
      break;
    }
  } 
  if(dotpos >= 0) {
    str[dotpos] = '\0';
  }
}


//---------------------------
//------------- extern defs

void files_init(void) {
  // scan directories
  print_dbg("\r\n BEES file_init, scanning directories..");
  list_scan(&dspList, DSP_PATH);
  list_scan(&sceneList, SCENES_PATH);
  list_scan(&scalerList, SCALERS_PATH);
}


////////////////////////
//// modules

// return filename for DSP given index in list
const volatile char* files_get_dsp_name(u8 idx) {
  return list_get_name(&dspList, idx);
}

// load a blacfkin executable by index */
u8 files_load_dsp(u8 idx) {  
  //  app_notify("loading dsp...");
  return files_load_dsp_name((const char*)files_get_dsp_name(idx));
}