ref: b2cdb2a885b586f771b1c5ee8b6feecca998dbd0
parent: b52d27be64fd0dfda4402e5e8b4e5704c2978299
author: Jeff Alyanak <jeff@alyanak.ca>
date: Sat Oct 2 12:52:20 EDT 2021
Moved config read to its own func
--- a/config.ini
+++ b/config.ini
@@ -1,2 +1,3 @@
[graphics]
-fullscreen=true
+; set this to true to have m8c start fullscreen
+fullscreen=false
--- a/main.c
+++ b/main.c
@@ -24,11 +24,11 @@
// Handles CTRL+C / SIGINT
void intHandler(int dummy) { run = 0; }-int main(int argc, char *argv[]) {+// Config variables
+int init_fullscreen = 0;
- // Default initialize fullscreen setting is 0 (false)
- int init_fullscreen = 0;
-
+// Read config
+void read_config() {// Load the config and read the fullscreen setting from the graphics section
ini_t *config = ini_load("config.ini");const char *setting_fullscren = ini_get(config, "graphics", "fullscreen");
@@ -41,6 +41,10 @@
// Frees the mem used for the config
ini_free(config);
+}
+
+int main(int argc, char *argv[]) {+ read_config();
// allocate memory for serial buffer
uint8_t *serial_buf = malloc(serial_read_size);
--
⑨