shithub: m8c

Download patch

ref: 9e477ed2cff57c4b51a81341eab66a5023d8ecf6
parent: 1f56243d53f90c566e2f5acd466c387b09677d4d
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Thu Apr 24 16:24:12 EDT 2025

revert default model back to 01, add scaling mode toggling on iOS by double tapping the screen

--- a/src/events.c
+++ b/src/events.c
@@ -47,6 +47,10 @@
       renderer_clear_screen();
       m8_resume_processing();
     }
+    break;
+  case SDL_EVENT_FINGER_DOWN:
+    input_handle_finger_down(ctx, event);
+    break;
 
   // --- Input events ---
   case SDL_EVENT_GAMEPAD_ADDED:
--- a/src/input.c
+++ b/src/input.c
@@ -366,4 +366,18 @@
   default:;
   }
   return 1;
+}
+
+void input_handle_finger_down(struct app_context *ctx, const SDL_Event *event) {
+  static Uint64 last_finger_down_time = 0;
+  SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Finger down");
+  Uint64 current_time = SDL_GetTicks();
+  const Uint64 time_diff = current_time - last_finger_down_time;
+  // Check if the screen has been double-tapped and change the scaling mode
+  if (time_diff > 50 && time_diff < 500) {
+    ctx->conf.integer_scaling = !ctx->conf.integer_scaling;
+    renderer_fix_texture_scaling_after_window_resize(&ctx->conf);
+    SDL_Log("integer scaling: %d", ctx->conf.integer_scaling);
+  }
+  last_finger_down_time = current_time;
 }
\ No newline at end of file
--- a/src/input.h
+++ b/src/input.h
@@ -51,6 +51,6 @@
 void input_handle_key_up_event(const struct app_context *ctx, const SDL_Event *event);
 void input_handle_gamepad_button(struct app_context *ctx, SDL_GamepadButton button, bool pressed);
 void input_handle_gamepad_axis(const struct app_context *ctx, SDL_GamepadAxis axis, Sint16 value);
-void input_handle_finger_down(const struct app_context *ctx, const SDL_Event *event);
+void input_handle_finger_down(struct app_context *ctx, const SDL_Event *event);
 
 #endif // INPUT_H
--- a/src/render.c
+++ b/src/render.c
@@ -30,13 +30,13 @@
 static uint32_t ticks_fps;
 static int fps;
 static int font_mode = -1;
-static unsigned int m8_hardware_model = 1;
+static unsigned int m8_hardware_model = 0;
 static int screen_offset_y = 0;
 static int text_offset_y = 0;
 static int waveform_max_height = 24;
 
-static int texture_width = 480;
-static int texture_height = 320;
+static int texture_width = 320;
+static int texture_height = 240;
 static int hd_texture_width, hd_texture_height = 0;
 
 static int screensaver_initialized = 0;
@@ -124,7 +124,6 @@
   }
 
   setup_hd_texture_scaling();
-
 }
 
 static void change_font(struct inline_font *font) {
--