|
@@ -13,30 +13,36 @@ |
|
|
int main(int argc, char *argv[]) |
|
|
int main(int argc, char *argv[]) |
|
|
{ |
|
|
{ |
|
|
Config *config; |
|
|
Config *config; |
|
|
ROM *rom; |
|
|
|
|
|
int retval; |
|
|
int retval; |
|
|
|
|
|
|
|
|
retval = config_create(&config, argc, argv); |
|
|
retval = config_create(&config, argc, argv); |
|
|
if (retval != CONFIG_OK) |
|
|
if (retval != CONFIG_OK) |
|
|
return retval == CONFIG_EXIT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE; |
|
|
return retval == CONFIG_EXIT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE; |
|
|
|
|
|
|
|
|
printf("crater: a Sega Game Gear emulator\n\n"); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_MODE |
|
|
#ifdef DEBUG_MODE |
|
|
config_dump_args(config); |
|
|
config_dump_args(config); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
if (!(rom = rom_open(config->rom_path))) { |
|
|
|
|
|
if (errno == ENOMEM) |
|
|
|
|
|
OUT_OF_MEMORY() |
|
|
|
|
|
else |
|
|
|
|
|
FATAL_ERRNO("couldn't load ROM image '%s'", config->rom_path) |
|
|
|
|
|
|
|
|
if (config->assemble) { |
|
|
|
|
|
printf("Running assembler: %s -> %s.\n",config->src_path, config->dst_path); |
|
|
|
|
|
} else if (config->disassemble) { |
|
|
|
|
|
printf("Running disassembler: %s -> %s.\n", config->src_path, config->dst_path); |
|
|
|
|
|
} else { |
|
|
|
|
|
ROM *rom; |
|
|
|
|
|
|
|
|
|
|
|
printf("crater: a Sega Game Gear emulator\n\n"); |
|
|
|
|
|
if (!(rom = rom_open(config->rom_path))) { |
|
|
|
|
|
if (errno == ENOMEM) |
|
|
|
|
|
OUT_OF_MEMORY() |
|
|
|
|
|
else |
|
|
|
|
|
FATAL_ERRNO("couldn't load ROM image '%s'", config->rom_path) |
|
|
|
|
|
} |
|
|
|
|
|
printf("Loaded ROM image: %s.\n", rom->name); |
|
|
|
|
|
|
|
|
|
|
|
// TODO: start from here |
|
|
|
|
|
rom_close(rom); |
|
|
} |
|
|
} |
|
|
printf("Loaded ROM image: %s.\n", rom->name); |
|
|
|
|
|
|
|
|
|
|
|
// TODO: start from here |
|
|
|
|
|
|
|
|
|
|
|
rom_close(rom); |
|
|
|
|
|
config_destroy(config); |
|
|
config_destroy(config); |
|
|
return EXIT_SUCCESS; |
|
|
return EXIT_SUCCESS; |
|
|
} |
|
|
} |