Allow creating sav files from the tester (Fixes #311)
This commit is contained in:
parent
9fa564f97c
commit
807712b9c2
@ -22,6 +22,7 @@ static bool running = false;
|
|||||||
static char *filename;
|
static char *filename;
|
||||||
static char *bmp_filename;
|
static char *bmp_filename;
|
||||||
static char *log_filename;
|
static char *log_filename;
|
||||||
|
static char *sav_filename;
|
||||||
static FILE *log_file;
|
static FILE *log_file;
|
||||||
static void replace_extension(const char *src, size_t length, char *dest, const char *ext);
|
static void replace_extension(const char *src, size_t length, char *dest, const char *ext);
|
||||||
static bool push_start_a, start_is_not_first, a_is_bad, b_is_confirm, push_faster, push_slower,
|
static bool push_start_a, start_is_not_first, a_is_bad, b_is_confirm, push_faster, push_slower,
|
||||||
@ -160,6 +161,9 @@ static void vblank(GB_gameboy_t *gb)
|
|||||||
if (is_screen_blank) {
|
if (is_screen_blank) {
|
||||||
GB_log(gb, "Game probably stuck with blank screen. \n");
|
GB_log(gb, "Game probably stuck with blank screen. \n");
|
||||||
}
|
}
|
||||||
|
if (sav_filename) {
|
||||||
|
GB_save_battery(gb, sav_filename);
|
||||||
|
}
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,7 +263,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "SameBoy Tester v" xstr(VERSION) "\n");
|
fprintf(stderr, "SameBoy Tester v" xstr(VERSION) "\n");
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
fprintf(stderr, "Usage: %s [--dmg] [--start] [--length seconds] [--boot path to boot ROM]"
|
fprintf(stderr, "Usage: %s [--dmg] [--start] [--length seconds] [--sav] [--boot path to boot ROM]"
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
" [--jobs number of tests to run simultaneously]"
|
" [--jobs number of tests to run simultaneously]"
|
||||||
#endif
|
#endif
|
||||||
@ -273,6 +277,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool dmg = false;
|
bool dmg = false;
|
||||||
|
bool sav = false;
|
||||||
const char *boot_rom_path = NULL;
|
const char *boot_rom_path = NULL;
|
||||||
|
|
||||||
GB_random_set_enabled(false);
|
GB_random_set_enabled(false);
|
||||||
@ -308,6 +313,12 @@ int main(int argc, char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(argv[i], "--sav") == 0) {
|
||||||
|
fprintf(stderr, "Saving a battery save\n");
|
||||||
|
sav = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (strcmp(argv[i], "--jobs") == 0 && i != argc - 1) {
|
if (strcmp(argv[i], "--jobs") == 0 && i != argc - 1) {
|
||||||
max_forks = atoi(argv[++i]);
|
max_forks = atoi(argv[++i]);
|
||||||
@ -340,6 +351,12 @@ int main(int argc, char **argv)
|
|||||||
replace_extension(filename, path_length, log_path, ".log");
|
replace_extension(filename, path_length, log_path, ".log");
|
||||||
log_filename = &log_path[0];
|
log_filename = &log_path[0];
|
||||||
|
|
||||||
|
char sav_path[path_length + 5];
|
||||||
|
if (sav) {
|
||||||
|
replace_extension(filename, path_length, sav_path, ".sav");
|
||||||
|
sav_filename = &sav_path[0];
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Testing ROM %s\n", filename);
|
fprintf(stderr, "Testing ROM %s\n", filename);
|
||||||
|
|
||||||
if (dmg) {
|
if (dmg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user