From fea026fec4f6c528ef325c1ea8a38eaf0089f9ed Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Sun, 5 Apr 2020 14:21:40 +0800 Subject: Fix cheevos support --- libretro.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libretro.c b/libretro.c index 6018d87..3aacfec 100644 --- a/libretro.c +++ b/libretro.c @@ -514,6 +514,27 @@ static void frame_time_cb(retro_usec_t usec) frame_time = usec / 1000000.0; } +static void set_memory_descriptors(void) +{ + const uint64_t mem = RETRO_MEMORY_SYSTEM_RAM; + struct retro_memory_descriptor desc[9] = { + { mem, iwram, 0x00000 + 0x8000, 0x3000000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x00000 + 0x8000, 0x2000000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x10000 + 0x8000, 0x2008000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x20000 + 0x8000, 0x2010000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x30000 + 0x8000, 0x2018000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x40000 + 0x8000, 0x2020000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x50000 + 0x8000, 0x2028000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x60000 + 0x8000, 0x2030000, 0, 0, 0x8000, NULL }, + { mem, ewram, 0x70000 + 0x8000, 0x2038000, 0, 0, 0x8000, NULL } + }; + struct retro_memory_map retromap = { + desc, + sizeof(desc) / sizeof(desc[0]) + }; + environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &retromap); +} + bool retro_load_game(const struct retro_game_info* info) { if (!info) @@ -604,6 +625,8 @@ bool retro_load_game(const struct retro_game_info* info) init_context_switch(); + set_memory_descriptors(); + return true; } -- cgit v1.2.3