Ejemplo n.º 1
0
// search for specified scene file and load it
// return 1 on success, 0 on failure
u8 files_load_scene_name(const char* name) {
  void* fp;
  u32 size = 0;
  u8 ret = 0;

  app_pause();

  fp = list_open_file_name(&sceneList, name, "r", &size);

  if( fp != NULL) {	  
    fake_fread((volatile u8*)sceneData, sizeof(sceneData_t), fp);
    fl_fclose(fp);
    scene_read_buf();

    // try and load dsp module indicated by scene descriptor
    //// DUDE! NO!!! scene does this. when did this happen!
    //// probably snuck in in some merge.
    //    ret = files_load_dsp_name(sceneData->desc.moduleName);
  } else {
    print_dbg("\r\n error: fp was null in files_load_scene_name \r\n");
    ret = 0;
  } 
  app_resume();
  return ret;
}
Ejemplo n.º 2
0
// search for specified dsp file and load it
u8 files_load_dsp_name(const char* name) {
  void* fp;
  u32 size = 0;
  u8 ret;
  //  ModuleVersion modVers;

  delay_ms(10);

  app_pause();

  fp = list_open_file_name(&dspList, name, "r", &size);

  if( fp != NULL) {	  
    print_dbg("\r\n found file, loading dsp: ");
    print_dbg(name);
    fake_fread(bfinLdrData, size, fp);

    fl_fclose(fp);
    bfinLdrSize = size;

    if(bfinLdrSize > 0) {
      print_dbg("\r\n loading bfin from buf");
      // reboot the dsp with new firmware in RAM
      bfin_load_buf();
      print_dbg("\r\n finished load");
      // write module name in global scene data

      /////////////////
      /// FIXME: filename and reported modulename should be decoupled
      /// bees should search for aleph-module-x.y.z.ldr
      /// but try aleph-module*.ldr on failure
      ////
      /// query name and version to the scene data
      //      scene_query_module();
      /// now set it to the actual filename because we are dumb
      scene_set_module_name(name);
      ///////////////////////////

      print_dbg("\r\n sceneData->moduleName : ");
      print_dbg(name);

      ret = 1;
    } else {
      print_dbg("\r\n bfin ldr size was <=0, aborting");
      ret = 0;
    }
  } else {
    print_dbg("\r\n error: fp was null in files_load_dsp_name \r\n");
    ret = 0;
  }
  app_resume();
  return ret;
}
Ejemplo n.º 3
0
// search for specified scene file and load it
// return 1 on success, 0 on failure
u8 files_load_scene_name(const char* name) {
  void* fp;
  u32 size = 0;
  u8 ret = 0;

    //// ahhhhh, i see.. 
    /// this is overwriting the descriptor in sceneData as well as the serialized blob.
    /// woud be fine, except it f***s up the comparison later.
    /// for now, let's do this ugly-ass workaround.

  char oldModuleName[MODULE_NAME_LEN];
  /// store extant module name
  strncpy(oldModuleName, sceneData->desc.moduleName, MODULE_NAME_LEN);

  app_pause();

  fp = list_open_file_name(&sceneList, name, "r", &size);

  if( fp != NULL) {	  
    print_dbg("\r\n reading binary into sceneData serialized data buffer...");
    fake_fread((volatile u8*)sceneData, sizeof(sceneData_t), fp);
    print_dbg(" done.");
    
    /// copy old name back to descriptor field... dumb dumb dumb.
    strncpy(sceneData->desc.moduleName, oldModuleName, MODULE_NAME_LEN);
    
    fl_fclose(fp);
    scene_read_buf();

    // try and load dsp module indicated by scene descriptor
    //// DUDE! NO!!! scene does this. when did this happen!
    //// probably snuck in in some merge.
    //    ret = files_load_dsp_name(sceneData->desc.moduleName);
  } else {
    print_dbg("\r\n error: fp was null in files_load_scene_name \r\n");
    ret = 0;
  } 

  app_resume();
  return ret;
}
Ejemplo n.º 4
0
// search for specified scaler file and load it to specified buffer
// return 1 on success, 0 on failure
u8 files_load_scaler_name(const char* name, s32* dst, u32 dstSize) {
  void* fp;
  u32 size = 0;
  u32 i;
  union { u32 u; s32 s; u8 b[4]; } swap;
  u8 ret = 0;
  //// test
  //s32* p = dst;
  ///

  app_pause();
  fp = list_open_file_name(&scalerList, name, "r", &size);
  if( fp != NULL) {	  

    print_dbg("\r\n scaler file pointer: 0x");
    print_dbg_hex((u32)fp);
#ifdef SCALER_LE
    swap.b[3] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[0] = fl_fgetc(fp);
#else
    swap.b[0] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[3] = fl_fgetc(fp);
#endif
    size = swap.u;

    print_dbg("\r\n read size (words): 0x");
    print_dbg_ulong(size);

    if(size > dstSize) {
      print_dbg("\r\n warning: requested scaler data is > target, truncating");
      for(i=0; i<dstSize; ++i) {

#ifdef SCALER_LE
    swap.b[3] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[0] = fl_fgetc(fp);
#else
    swap.b[0] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[3] = fl_fgetc(fp);
#endif
	*dst++ = swap.s;
      }
    } else if (size < dstSize) {
      print_dbg("\r\n warning: requested scaler data is < target, padding");
      for(i=0; i<size; ++i) {
#ifdef SCALER_LE
    swap.b[3] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[0] = fl_fgetc(fp);
#else
    swap.b[0] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[3] = fl_fgetc(fp);
#endif
	*dst++ = swap.s;
      }
      // remainder
      size = dstSize - size;
      for(i=0; i<size; ++i) {
	*dst++ = 0;
      }
    } else {
      for(i=0; i<size; ++i) {
#ifdef SCALER_LE
    swap.b[3] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[0] = fl_fgetc(fp);
#else
    swap.b[0] = fl_fgetc(fp);
    swap.b[1] = fl_fgetc(fp);
    swap.b[2] = fl_fgetc(fp);
    swap.b[3] = fl_fgetc(fp);
#endif
	*dst++ = swap.s;
      }
    }
    fl_fclose(fp);
    ret = 1;
  } else {
    print_dbg("\r\n error: fp was null in files_load_scaler_name \r\n");
    ret = 0;
  } 

  print_dbg("\r\n finished loading scaler file (?)");

  ///// TEST: verify
  /* for(i=0; i<size; i++) { */
  /*   print_dbg(" 0x"); print_dbg_hex(p[i]); if((i%4)==0) { print_dbg("\r\n"); } */
  /* } */

  app_resume();
  return ret;
}