From f1e31ac6d4726ed89810878c000f541fb2c162a1 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Fri, 1 Apr 2022 17:14:18 +0200
Subject: [PATCH] Add missing pico init in case of successful autodetect

---
 pico/cart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pico/cart.c b/pico/cart.c
index 2e4f500c..4e0c2e62 100644
--- a/pico/cart.c
+++ b/pico/cart.c
@@ -850,6 +850,10 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
     PicoCartDetect(carthw_cfg);
   if (PicoIn.AHW & PAHW_SMS)
     PicoCartDetectMS();
+  if (PicoIn.AHW & PAHW_SVP)
+    PicoSVPStartup();
+  if (PicoIn.AHW & PAHW_PICO)
+    PicoInitPico();
 
   // setup correct memory map for loaded ROM
   switch (PicoIn.AHW) {
@@ -1118,9 +1122,9 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
       rstrip(p);
 
       if      (strcmp(p, "svp") == 0)
-        PicoSVPStartup();
+        PicoIn.AHW = PAHW_SVP;
       else if (strcmp(p, "pico") == 0)
-        PicoInitPico();
+        PicoIn.AHW = PAHW_PICO;
       else if (strcmp(p, "prot") == 0)
         carthw_sprot_startup();
       else if (strcmp(p, "ssf2_mapper") == 0)
-- 
2.39.5