shithub: m8c

Download patch

ref: 65053fe34bd36b0b6b5965c78b0c456f134ab9a5
parent: 000b805eca3dc9ede83cc53bc838f0b0a7a6f7e7
author: ryandam <py.ryan.dam@gmail.com>
date: Fri Apr 14 16:43:16 EDT 2023

default render canvas

--- a/config.c
+++ b/config.c
@@ -26,7 +26,6 @@
 
   c.init_fullscreen = 0; // default fullscreen state at load
   c.init_use_gpu = 1;    // default to use hardware acceleration
-  c.canvas_color = 0;    // default to not render M8 background color to DSL canvas
   c.idle_ms = 10;        // default to high performance
   c.wait_for_device = 1; // default to exit if device disconnected
   c.wait_packets = 1024; // default zero-byte attempts to disconnect (about 2
@@ -84,7 +83,7 @@
 
   SDL_Log("Writing config file to %s", config_path);
 
-  const unsigned int INI_LINE_COUNT = 45;
+  const unsigned int INI_LINE_COUNT = 44;
   const unsigned int LINELEN = 50;
 
   // Entries for the config file
@@ -95,8 +94,6 @@
            conf->init_fullscreen ? "true" : "false");
   snprintf(ini_values[initPointer++], LINELEN, "use_gpu=%s\n",
            conf->init_use_gpu ? "true" : "false");
-  snprintf(ini_values[initPointer++], LINELEN, "canvas_color=%s\n",
-           conf->canvas_color ? "true" : "false");
   snprintf(ini_values[initPointer++], LINELEN, "idle_ms=%d\n", conf->idle_ms);
   snprintf(ini_values[initPointer++], LINELEN, "wait_for_device=%s\n",
            conf->wait_for_device ? "true" : "false");
@@ -246,7 +243,6 @@
 void read_graphics_config(ini_t *ini, config_params_s *conf) {
   const char *param_fs = ini_get(ini, "graphics", "fullscreen");
   const char *param_gpu = ini_get(ini, "graphics", "use_gpu");
-  const char *param_canvas_color = ini_get(ini, "graphics", "canvas_color");
   const char *idle_ms = ini_get(ini, "graphics", "idle_ms");
   const char *param_wait = ini_get(ini, "graphics", "wait_for_device");
   const char *wait_packets = ini_get(ini, "graphics", "wait_packets");
@@ -261,13 +257,6 @@
       conf->init_use_gpu = 1;
     } else
       conf->init_use_gpu = 0;
-  }
-
-  if (param_canvas_color != NULL) {
-    if (strcmpci(param_canvas_color, "true") == 0) {
-      conf->canvas_color = 1;
-    } else
-      conf->canvas_color = 0;
   }
 
   if (idle_ms != NULL)
--- a/config.h
+++ b/config.h
@@ -10,7 +10,6 @@
   char *filename;
   int init_fullscreen;
   int init_use_gpu;
-  int canvas_color;
   int idle_ms;
   int wait_for_device;
   int wait_packets;
--- a/config.ini.sample
+++ b/config.ini.sample
@@ -9,8 +9,6 @@
 ; set this to false to run m8c in software rendering mode (may be useful for Raspberry Pi)
 use_gpu=true
 ; the delay amount in ms in the main loop, decrease value for faster operation, increase value if too much cpu usage
-canvas_color=false
-; set this to true to render m8 background color to canvas color of sdl, set to false to use default color (black)
 idle_ms = 10
 ; show a spinning cube if device is not inserted
 wait_for_device = true
--- a/main.c
+++ b/main.c
@@ -73,7 +73,7 @@
   }
 
   // initialize all SDL systems
-  if (initialize_sdl(conf.init_fullscreen, conf.init_use_gpu, conf.canvas_color) == -1)
+  if (initialize_sdl(conf.init_fullscreen, conf.init_use_gpu) == -1)
     run = QUIT;
 
   // initial scan for (existing) game controllers
--- a/render.c
+++ b/render.c
@@ -19,7 +19,6 @@
 
 static uint32_t ticks_fps;
 static int fps;
-static int render_canvas_color;
 
 uint8_t fullscreen = 0;
 
@@ -26,7 +25,7 @@
 static uint8_t dirty = 0;
 
 // Initializes SDL and creates a renderer and required surfaces
-int initialize_sdl(int init_fullscreen, int init_use_gpu, int init_canvas_color) {
+int initialize_sdl(int init_fullscreen, int init_use_gpu) {
   //ticks = SDL_GetTicks();
 
   const int window_width = 640;  // SDL window width
@@ -54,13 +53,8 @@
 
   SDL_SetRenderTarget(rend, maintexture);
 
-  render_canvas_color = init_canvas_color;
-  if (render_canvas_color == 0) {
-    SDL_SetRenderDrawColor(rend, 0x00, 0x00, 0x00, 0x00);
-  } else {
-    SDL_SetRenderDrawColor(rend, background_color.r, background_color.g,
-                                background_color.b, background_color.a);
-  }
+  SDL_SetRenderDrawColor(rend, background_color.r, background_color.g,
+                              background_color.b, background_color.a);
 
   SDL_RenderClear(rend);
 
@@ -238,12 +232,8 @@
     //ticks = SDL_GetTicks();
     SDL_SetRenderTarget(rend, NULL);
     
-    if (render_canvas_color == 0) {
-      SDL_SetRenderDrawColor(rend, 0x00, 0x00, 0x00, 0x00);
-    } else {
-      SDL_SetRenderDrawColor(rend, background_color.r, background_color.g,
-                                  background_color.b, background_color.a);
-    }
+    SDL_SetRenderDrawColor(rend, background_color.r, background_color.g,
+                                background_color.b, background_color.a);
 
     SDL_RenderClear(rend);
     SDL_RenderCopy(rend, maintexture, NULL, NULL);
--- a/render.h
+++ b/render.h
@@ -6,7 +6,7 @@
 
 #include "command.h"
 
-int initialize_sdl(int init_fullscreen, int init_use_gpu, int init_canvas_color);
+int initialize_sdl(int init_fullscreen, int init_use_gpu);
 void close_renderer();
 
 int process_queues(struct command_queues *queues);
@@ -22,4 +22,4 @@
 void screensaver_draw();
 void screensaver_destroy();
 
-#endif
\ No newline at end of file
+#endif
--