// store scene to sdcard at name void files_store_scene_name(const char* name, u8 ext) { //u32 i; void* fp; char namebuf[64] = SCENES_PATH; u8* pScene; app_pause(); strcat(namebuf, name); if(ext) { // weird.. strip_space(namebuf, 32); strcat(namebuf, ".scn"); } print_dbg("\r\n opening scene file for writing: "); print_dbg(namebuf); // fill the scene RAM buffer from current state of system scene_write_buf(); // open FP for writing fp = fl_fopen(namebuf, "wb"); pScene = (u8*)sceneData; fl_fwrite((const void*)pScene, sizeof(sceneData_t), 1, fp); fl_fclose(fp); // rescan list_scan(&sceneList, SCENES_PATH); delay_ms(10); app_resume(); }
// store scene to sdcard at name void files_store_scene_name(const char* name, u8 ext) { //u32 i; void* fp; char namebuf[64] = SCENES_PATH; u8* pScene; app_pause(); strcat(namebuf, name); if(ext) { // weird.. strip_space(namebuf, 32); strcat(namebuf, ".scn"); } print_dbg("\r\n opening scene file for writing: "); print_dbg(namebuf); // fill the scene RAM buffer from current state of system scene_write_buf(); print_dbg("\r\n filled scene binary buffer"); // open FP for writing fp = fl_fopen(namebuf, "wb"); print_dbg("\r\n opened file for binary write at 0x"); print_dbg_hex((u32)fp); pScene = (u8*)sceneData; print_dbg("\r\n writing data from scene buffer at 0x"); print_dbg_hex((u32)pScene); print_dbg(", size : "); print_dbg_hex(sizeof(sceneData_t)); // dump the scene data to debug output... fl_fwrite((const void*)pScene, sizeof(sceneData_t), 1, fp); fl_fclose(fp); print_dbg("\r\n ... finished writing, closed file pointer"); // rescan list_scan(&sceneList, SCENES_PATH); delay_ms(10); print_dbg("\r\n re-scanned scene file list and waited."); app_resume(); }
// store scene to sdcard at name void files_store_scene_name(const char* name) { FILE* f = fopen(name, "w"); scene_write_buf(); fwrite((const void*)sceneData, sizeof(sceneData_t), 1, f); fclose(f); }