mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Checks for valid file before init
This commit is contained in:
parent
0e50d35a0d
commit
77a1e1541c
12
ssnes.c
12
ssnes.c
@ -212,6 +212,14 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Usage: %s file\n", argv[0]);
|
fprintf(stderr, "Usage: %s file\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FILE *file = fopen(argv[1], "rb");
|
||||||
|
if ( file == NULL )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Could not open file: \"%s\"\n", argv[1]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
char savefile_name[strlen(argv[1]+5)];
|
char savefile_name[strlen(argv[1]+5)];
|
||||||
strcpy(savefile_name, argv[1]);
|
strcpy(savefile_name, argv[1]);
|
||||||
strcat(savefile_name, ".sav");
|
strcat(savefile_name, ".sav");
|
||||||
@ -226,10 +234,6 @@ int main(int argc, char *argv[])
|
|||||||
snes_set_input_state(input_state);
|
snes_set_input_state(input_state);
|
||||||
|
|
||||||
|
|
||||||
FILE *file = fopen(argv[1], "rb");
|
|
||||||
if ( file == NULL )
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
long length = ftell(file);
|
long length = ftell(file);
|
||||||
rewind(file);
|
rewind(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user