From 88d48cd3437bd23e41f9e54b639692bfdbbe69e9 Mon Sep 17 00:00:00 2001 From: Sky <skylersaleh@gmail.com> Date: Sat, 22 Jul 2023 21:59:24 -0700 Subject: [PATCH] =?UTF-8?q?=E3=80=90CHEAT=E3=80=91Fixed=20bugs=20in=20chea?= =?UTF-8?q?t=20code=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index e6c2200ae..101f7776d 100644 --- a/src/main.c +++ b/src/main.c @@ -4207,11 +4207,13 @@ void se_draw_menu_panel(){ igPushFont(gui_state.mono_font); char code_buffer[SE_MAX_CHEAT_CODE_SIZE*8] = { 0 }; int off=0; - for(int i=0;i<cheat->size;i+=2){ - off+=snprintf(code_buffer+off,sizeof(code_buffer)-off,"%08X %08X\n",cheat->buffer[i], cheat->buffer[i+1]); + for(int i=0;i<cheat->size;i+=1){ + off+=snprintf(code_buffer+off,sizeof(code_buffer)-off,"%08X",cheat->buffer[i]); + if(i%2)off+=snprintf(code_buffer+off,sizeof(code_buffer)-off,"\n"); + else off+=snprintf(code_buffer+off,sizeof(code_buffer)-off," "); } // Not setting ImGuiInputTextFlags_CharsHexadecimal as it doesn't allow whitespace - if(igInputTextMultiline("##CheatCode",code_buffer,SE_MAX_CHEAT_CODE_SIZE,(ImVec2){0,300},ImGuiInputTextFlags_CharsUppercase,NULL,NULL)){ + if(igInputTextMultiline("##CheatCode",code_buffer,sizeof(code_buffer),(ImVec2){0,300},ImGuiInputTextFlags_CharsUppercase,NULL,NULL)){ se_convert_cheat_code(code_buffer,gui_state.editing_cheat_index); } igPopFont();