sdl/runner.c
/** Called when persistent RAM should be saved */
Called when persistent RAM should be saved
Called when persistent RAM should be saved
void persistentRamDidChange(void *context, uint8_t *data, int size)
{
#ifndef __EMSCRIPTEN__
    struct Runner *runner = context;
    char ramFilename[FILENAME_MAX];
    getRamFilename(ramFilename);
    FILE *file = fopen_utf8(ramFilename, "wb");
    if (file)
    {
        fwrite(data, 1, size, file);
        fclose(file);
    }
    else
    {
        struct TextLib *lib = &runner->core->overlay->textLib;
        txtlib_printText(lib, "COULD NOT SAVE:\n");
        txtlib_printText(lib, ramFilename);
        txtlib_printText(lib, "\n");
    }
#endif
}
void persistentRamDidChange ( void * context , uint8_t * data , int size ) { #ifndef __EMSCRIPTEN__ struct Runner * runner = context ; char ramFilename [ FILENAME_MAX ] ; getRamFilename ( ramFilename ) ; FILE * file = fopen_utf8 ( ramFilename , " " ) ; if ( file ) { fwrite ( data , 1 , size , file ) ; fclose ( file ) ; } else { struct TextLib * lib = & runner -> core -> overlay -> textLib ; txtlib_printText ( lib , " \n " ) ; txtlib_printText ( lib , ramFilename ) ; txtlib_printText ( lib , " \n " ) ; } #endif }
Called when persistent RAM should be saved
Called when persistent RAM should be saved