diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 1468ecf418..232c969d8c 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -19,16 +19,9 @@ #include #include -#ifdef _WIN32 -namespace MainWindow { - void BrowseAndBoot(std::string defaultPath); -} - -#pragma execution_character_set("utf-8") -#endif - #ifdef _MSC_VER #define snprintf _snprintf +#pragma execution_character_set("utf-8") #endif #include "base/display.h" @@ -72,6 +65,13 @@ namespace MainWindow { #include #endif +#ifdef _WIN32 +namespace MainWindow { + extern HWND hwndMain; + void BrowseAndBoot(std::string defaultPath); +} +#endif + #if !defined(nullptr) #define nullptr NULL #endif @@ -251,12 +251,12 @@ void MenuScreen::render() { } if (UIButton(GEN_ID, vlinear, w, 0, m->T("Exit"), ALIGN_RIGHT)) { - // TODO: Save when setting changes, rather than when we quit - NativeShutdown(); // TODO: Need a more elegant way to quit #ifdef _WIN32 - ExitProcess(0); + PostMessage(MainWindow::hwndMain, WM_CLOSE, 0, 0); #else + // TODO: Save when setting changes, rather than when we quit + NativeShutdown(); exit(0); #endif } diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 67c3f83329..b57871f5d3 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -244,12 +244,12 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) const char *mojs=strstr(dis2,"->$"); if (mojs) { - for (int i=0; i<8; i++) + for (int j=0; j<8; ++j) { bool found=false; - for (int j=0; j<22; j++) + for (int k=0; k<22; ++k) { - if (mojs[i+3]=="0123456789ABCDEFabcdef"[j]) + if (mojs[j+3]=="0123456789ABCDEFabcdef"[k]) found=true; } if (!found) diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index 0436a23f6b..267a28fa16 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -201,11 +201,11 @@ void CtrlMemView::onPaint(WPARAM wParam, LPARAM lParam) sprintf(temp, "%08x %08x %08x %08x ................", memory[0],memory[1],memory[2],memory[3]); } - for (int i=0; i<16; i++) + for (int j=0; j<16; ++j) { - int c = (unsigned char)m[i]; + int c = (unsigned char)m[j]; if (c>=32 && c<255) - temp[i+37]=c; + temp[j+37]=c; } } // if (align == 16) diff --git a/Windows/Debugger/CtrlRegisterList.cpp b/Windows/Debugger/CtrlRegisterList.cpp index 37b355cbde..2e80c32ecb 100644 --- a/Windows/Debugger/CtrlRegisterList.cpp +++ b/Windows/Debugger/CtrlRegisterList.cpp @@ -224,11 +224,11 @@ void CtrlRegisterList::onPaint(WPARAM wParam, LPARAM lParam) // Check for any changes in the registers. if (lastPC != cpu->GetPC()) { - for (int i = 0, n = cpu->GetNumRegsInCategory(0); i < n; ++i) + for (int j = 0, n = cpu->GetNumRegsInCategory(0); j < n; ++j) { - u32 v = cpu->GetRegValue(0, i); - changedCat0Regs[i] = v != lastCat0Values[i]; - lastCat0Values[i] = v; + u32 v = cpu->GetRegValue(0, j); + changedCat0Regs[j] = v != lastCat0Values[j]; + lastCat0Values[j] = v; } lastPC = cpu->GetPC(); } diff --git a/Windows/Debugger/Debugger_VFPUDlg.cpp b/Windows/Debugger/Debugger_VFPUDlg.cpp index 558c3cbfd1..4e25eff3f3 100644 --- a/Windows/Debugger/Debugger_VFPUDlg.cpp +++ b/Windows/Debugger/Debugger_VFPUDlg.cpp @@ -155,7 +155,6 @@ BOOL CVFPUDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) int x = column * columnWidth + xStart; Rectangle(hdc, x, y, x + columnWidth, y+rowHeight); - char temp[256]; temp_len = sprintf_s(temp, "R%i0%i", matrix, column); TextOut(hdc,x+3,y+2,temp,temp_len); @@ -169,8 +168,6 @@ BOOL CVFPUDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { float val = mipsr4k.v[column*32+row+matrix*4]; u32 hex = *((u32*)&val); - char temp[256]; - int temp_len; switch (mode) { case 0: temp_len = sprintf_s(temp,"%f",val); break; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 5ca843cff2..01f1be8fef 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -390,8 +390,6 @@ namespace MainWindow int wmId, wmEvent; std::string fn; - I18NCategory *g = GetI18NCategory("Graphics"); - switch (message) { case WM_CREATE: @@ -415,6 +413,9 @@ namespace MainWindow return 0; case WM_COMMAND: + { + I18NCategory *g = GetI18NCategory("Graphics"); + wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: @@ -698,22 +699,21 @@ namespace MainWindow case ID_EMULATION_SOUND: g_Config.bEnableSound = !g_Config.bEnableSound; break; - case ID_HELP_OPENWEBSITE: + case ID_HELP_OPENWEBSITE: ShellExecute(NULL, "open", "http://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL); - break; + break; - case ID_HELP_ABOUT: + case ID_HELP_ABOUT: DialogManager::EnableAll(FALSE); DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); DialogManager::EnableAll(TRUE); break; default: - { - MessageBox(hwndMain,"Unimplemented","Sorry",0); - } + MessageBox(hwndMain,"Unimplemented","Sorry",0); break; } + } break; case WM_KEYDOWN: return 0; @@ -1342,7 +1342,7 @@ namespace MainWindow } else { int n = 1; if (buttonCode != -1) { - for (int i = buttonCode >> 8; i > 1; i >>= 1) { + for (int j = buttonCode >> 8; j > 1; j >>= 1) { n++; } snprintf(str, CONTROLS_BUTTONNAME_MAX, "%s",