Browse Source

Refactor: pass the entire Config object to the emulator.

master
Ben Kurtovic 3 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[])
42 42
             retval = EXIT_FAILURE;
43 43
         } else {
44 44
             printf("crater: emulating: %s\n", rom.name);
45
-            emulate(&rom, config->fullscreen, config->scale);
45
+            emulate(&rom, config);
46 46
             rom_close(&rom);
47 47
         }
48 48
     }

+ 2
- 2
src/emulator.c View File

@@ -130,11 +130,11 @@ static void cleanup_graphics()
130 130
 
131 131
     Block until emulation is finished.
132 132
 */
133
-void emulate(ROM *rom, bool fullscreen, unsigned scale)
133
+void emulate(ROM *rom, Config *config)
134 134
 {
135 135
     emu.gg = gamegear_create();
136 136
     signal(SIGINT, handle_sigint);
137
-    setup_graphics(fullscreen, scale);
137
+    setup_graphics(config->fullscreen, config->scale);
138 138
 
139 139
     gamegear_attach_callback(emu.gg, frame_callback);
140 140
     gamegear_attach_display(emu.gg, emu.pixels);

+ 2
- 1
src/emulator.h View File

@@ -5,8 +5,9 @@
5 5
 
6 6
 #include <stdbool.h>
7 7
 
8
+#include "config.h"
8 9
 #include "rom.h"
9 10
 
10 11
 /* Functions */
11 12
 
12
-void emulate(ROM*, bool, unsigned);
13
+void emulate(ROM*, Config*);

Loading…
Cancel
Save