sdl/runner.c
/** Called when a disk data entry was saved */
Called when a disk data entry was saved
Called when a disk data entry was saved
void diskDriveDidSave(void *context, struct DataManager *diskDataManager)
{
    struct Runner *runner = context;
#ifdef __EMSCRIPTEN__
    overlay_message(runner->core, "NO DISK");
#else
    char *output = data_export(diskDataManager);
    if (output)
    {
        char diskFilename[FILENAME_MAX];
        getDiskFilename(diskFilename);
        FILE *file = fopen_utf8(diskFilename, "wb");
        if (file)
        {
            fwrite(output, 1, strlen(output), file);
            fclose(file);
        }
        else
        {
            struct TextLib *lib = &runner->core->overlay->textLib;
            txtlib_printText(lib, "COULD NOT SAVE:\n");
            txtlib_printText(lib, diskFilename);
            txtlib_printText(lib, "\n");
        }
        free(output);
    }
#endif
}
void diskDriveDidSave ( void * context , struct DataManager * diskDataManager ) { struct Runner * runner = context ; #ifdef __EMSCRIPTEN__ overlay_message ( runner -> core , " " ) ; #else char * output = data_export ( diskDataManager ) ; if ( output ) { char diskFilename [ FILENAME_MAX ] ; getDiskFilename ( diskFilename ) ; FILE * file = fopen_utf8 ( diskFilename , " " ) ; if ( file ) { fwrite ( output , 1 , strlen ( output ) , file ) ; fclose ( file ) ; } else { struct TextLib * lib = & runner -> core -> overlay -> textLib ; txtlib_printText ( lib , " \n " ) ; txtlib_printText ( lib , diskFilename ) ; txtlib_printText ( lib , " \n " ) ; } free ( output ) ; } #endif }
Called when a disk data entry was saved
Called when a disk data entry was saved