From f1cea640e2f349f7c7b840f0ee2d2dd71611e6f0 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Fri, 8 Mar 2019 20:01:54 +0100 Subject: [PATCH] naomi: crash on exit when M4 cart fails to load avoid loading AW cart on Naomi and the other way around --- core/hw/naomi/m4cartridge.h | 2 +- core/hw/naomi/naomi_cart.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/hw/naomi/m4cartridge.h b/core/hw/naomi/m4cartridge.h index b2c3947b6..52b5dd031 100644 --- a/core/hw/naomi/m4cartridge.h +++ b/core/hw/naomi/m4cartridge.h @@ -62,7 +62,7 @@ private: static const u8 k_sboxes[4][16]; u16 m4id; - u8 *m_key_data; // 2048 bytes + u8 *m_key_data = NULL; // 2048 bytes u16 subkey1, subkey2; u16 one_round[0x10000]; diff --git a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp index aea8b5e39..f91324d62 100644 --- a/core/hw/naomi/naomi_cart.cpp +++ b/core/hw/naomi/naomi_cart.cpp @@ -164,7 +164,19 @@ static bool naomi_cart_LoadZip(char *filename) } struct Game *game = &Games[gameid]; - +#if DC_PLATFORM == DC_PLATFORM_NAOMI + if (game->cart_type == AW) + { + msgboxf("Atomiswave cartridges are not supported by NAOMI", 0); + return false; + } +#else + if (game->cart_type != AW) + { + msgboxf("NAOMI cartridges are not supported by Atomiswave", 0); + return false; + } +#endif Archive *archive = OpenArchive(filename); if (archive != NULL) printf("Opened %s\n", filename);