From 25fa85bce4d1a43b30f8c3985046b2140080f453 Mon Sep 17 00:00:00 2001 From: OV2 Date: Mon, 30 Apr 2018 23:58:49 +0200 Subject: [PATCH] win32: changes to GUI cheat handling --- win32/wsnes9x.cpp | 56 +++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 41fb35430..4ac3520d4 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -2306,10 +2306,8 @@ LRESULT CALLBACK WinProc( break; case ID_CHEAT_ENTER: RestoreGUIDisplay (); - S9xCheatsDisable (); DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CHEATER), hWnd, DlgCheater); S9xSaveCheatFile (S9xGetFilename (".cht", CHEAT_DIR)); - S9xCheatsEnable (); RestoreSNESDisplay (); break; case ID_CHEAT_SEARCH: @@ -8544,19 +8542,18 @@ INT_PTR CALLBACK DlgCheater(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) for(counter=0; counter < Cheat.g.size(); counter++) { char *code_string; - Utf8ToWide *wstring; int curr_idx=-1; code_string = S9xCheatGroupToText(counter); - wstring = new Utf8ToWide(code_string); + Utf8ToWide wstring(code_string); + delete[] code_string; + LVITEM lvi; memset(&lvi, 0, sizeof(LVITEM)); lvi.mask=LVIF_TEXT; lvi.cchTextMax = CHEAT_SIZE; - lvi.pszText = *wstring; + lvi.pszText = wstring; lvi.iItem=counter; curr_idx=ListView_InsertItem(GetDlgItem(hDlg,IDC_CHEAT_LIST), &lvi); - delete[] code_string; - delete wstring; unsigned int k; for(k=0;k