// 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; }
// search for specified scene file and load it // return 1 on success, 0 on failure u8 files_load_scene_name(const char* name) { char path[64] = ""; FILE* f; u8 ret = 1; // strcpy(path, workingDir); strcat(path, name); printf("\r\n attempting to open scene file; path: %s", path); f = fopen(path, "r"); if(f == NULL) { printf("\r\n couldn't find scene file; path: %s", path); return 0; } fread(sceneData, sizeof(sceneData_t), 1, f); fclose(f); scene_read_buf(); printf("\r\n loaded scene buffer, search DSP:"); ret = files_load_dsp_name(sceneData->desc.moduleName); return ret; }
// 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; }