FILE* os_open_script_file(void) { char filename[256]; filereq (ScriptReq, filename, "Play Script", 0); if (strcmp (filename, "") == 0) return FALSE; return fopen (filename, "rt"); }
L9BOOL os_save_file (L9BYTE * Ptr, int Bytes) { char filename[256]; FILE *f; filereq (SaveReq, filename, "Save Game", 1); if (strcmp (filename, "") == 0) return FALSE; if (f = fopen (filename, "w")) { fwrite (Ptr, 1, Bytes, f); fclose (f); return TRUE; } return FALSE; }
L9BOOL os_load_file(L9BYTE *Ptr,int *Bytes,int Max) { char filename[256]; FILE *f; filereq (SaveReq, filename, "Restore Game", 0); if (strcmp (filename, "") == 0) return FALSE; if (f = fopen (filename, "r")) { *Bytes = fread (Ptr, 1, Max, f); fclose (f); return TRUE; } return FALSE; }
static void handle_new( LWControl *ectl, void *edata ) { static char node[ 256 ] = { 0 }, path[ 256 ] = { 0 }; LWDirInfoFunc *dif; const char *dir; if ( !filename[ 0 ] ) { if ( dif = panf->globalFun( LWDIRINFOFUNC_GLOBAL, GFUSE_TRANSIENT )) { dir = dif( "Content" ); if ( dir ) strcpy( path, dir ); } } if ( 0 > filereq( "View", node, path, filename, sizeof( filename ))) return; SET_STR( ctl[ 1 ], filename, sizeof( filename )); handle_file( ctl[ 1 ], NULL ); }
L9BOOL os_get_game_file(char *NewName,int Size) { filereq (GameReq, NewName, "Next Level9 Game File", 0); }