From b95d041976247dff2d82092fca4bc49bc0fbc7fe Mon Sep 17 00:00:00 2001 From: luigi__ Date: Thu, 4 Jun 2009 21:34:25 +0000 Subject: [PATCH] Oops... the prevoius attempt was fucking horrible. This should be better. --- desmume/src/mc.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index 09c24ce69..adcc62c42 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -133,8 +133,18 @@ void mc_free(memory_chip_t *mc) void fw_reset_com(memory_chip_t *mc) { + if(mc->com == FW_CMD_PAGEWRITE) + { + if (mc->fp) + { + fseek(mc->fp, 0, SEEK_SET); + fwrite(mc->data, mc->size, 1, mc->fp); + } + + mc->write_enable = FALSE; + } + mc->com = 0; - fwrite(mc->data, 0x40000, 1, mc->fp); } u8 fw_transfer(memory_chip_t *mc, u8 data)