diff --git a/desmume/src/mc.c b/desmume/src/mc.c index 0f8c9fa1c..acdaa19d3 100644 --- a/desmume/src/mc.c +++ b/desmume/src/mc.c @@ -1,4 +1,5 @@ #include +#include "MMU.h" #include "debug.h" #include "types.h" #include "mc.h" @@ -83,6 +84,13 @@ void mc_reset_com(memory_chip_t *mc) mc->com = 0; } +void mc_realloc(int type, u32 size) +{ + if(MMU.bupmem.data) free(MMU.bupmem.data); + mc_init(&MMU.bupmem, type); + mc_alloc(&MMU.bupmem, size); +} + void mc_read_file(memory_chip_t *mc, char* filename) { FILE* file = fopen(filename, "rb"); diff --git a/desmume/src/mc.h b/desmume/src/mc.h index be06099e6..01d9f175c 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -44,6 +44,7 @@ typedef struct void mc_init(memory_chip_t *mc, int type); /* reset and init values for memory struct */ u8 *mc_alloc(memory_chip_t *mc, u32 size); /* alloc mc memory */ +void mc_realloc(int type, u32 size); /* realloc mc memory */ void mc_free(memory_chip_t *mc); /* delete mc memory */ void mc_reset_com(memory_chip_t *mc); /* reset communication with mc */ u8 fw_transfer(memory_chip_t *mc, u8 data); /* transfer to, then receive data from firmware */