diff --git a/source/dbg/debug_menu_functions.cpp b/source/dbg/debug_menu_functions.cpp index 8fe7545..059b17c 100644 --- a/source/dbg/debug_menu_functions.cpp +++ b/source/dbg/debug_menu_functions.cpp @@ -195,7 +195,7 @@ void show_debug_info_screen(void *context, unsigned user_param) void dbg_set_byte_val(void *context, unsigned user_param) { u8 *flag_ptr = (u8*)context; - *flag_ptr = (user_param != 0); + *flag_ptr = (u8)user_param; } void dbg_play_song(void *context, unsigned user_param) diff --git a/source/link_handler.cpp b/source/link_handler.cpp index 17bcff0..1683fe9 100644 --- a/source/link_handler.cpp +++ b/source/link_handler.cpp @@ -209,6 +209,7 @@ void LinkConnection::writeData() // If the buffer is full or we reached nextSubState == END, we save the buffer to the cartridge save if (link_cable_array_index >= 0x1000 || nextSubState == END) { + erase_sector(0x1000 * link_cable_memory_section_index); copy_ram_to_save(&global_memory_buffer[0], 0x1000 * link_cable_memory_section_index, 0x1000); ++link_cable_memory_section_index; link_cable_array_index = 0;