Browse Source

Refactor: pass the entire Config object to the emulator.

master
Ben Kurtovic 8 years ago
parent
commit
cbe14eadcd
3 changed files with 5 additions and 4 deletions
  1. +1
    -1
      crater.c
  2. +2
    -2
      src/emulator.c
  3. +2
    -1
      src/emulator.h

+ 1
- 1
crater.c View File

@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
retval = EXIT_FAILURE; retval = EXIT_FAILURE;
} else { } else {
printf("crater: emulating: %s\n", rom.name); printf("crater: emulating: %s\n", rom.name);
emulate(&rom, config->fullscreen, config->scale);
emulate(&rom, config);
rom_close(&rom); rom_close(&rom);
} }
} }


+ 2
- 2
src/emulator.c View File

@@ -130,11 +130,11 @@ static void cleanup_graphics()


Block until emulation is finished. Block until emulation is finished.
*/ */
void emulate(ROM *rom, bool fullscreen, unsigned scale)
void emulate(ROM *rom, Config *config)
{ {
emu.gg = gamegear_create(); emu.gg = gamegear_create();
signal(SIGINT, handle_sigint); signal(SIGINT, handle_sigint);
setup_graphics(fullscreen, scale);
setup_graphics(config->fullscreen, config->scale);


gamegear_attach_callback(emu.gg, frame_callback); gamegear_attach_callback(emu.gg, frame_callback);
gamegear_attach_display(emu.gg, emu.pixels); gamegear_attach_display(emu.gg, emu.pixels);


+ 2
- 1
src/emulator.h View File

@@ -5,8 +5,9 @@


#include <stdbool.h> #include <stdbool.h>


#include "config.h"
#include "rom.h" #include "rom.h"


/* Functions */ /* Functions */


void emulate(ROM*, bool, unsigned);
void emulate(ROM*, Config*);

Loading…
Cancel
Save