void CGraphStudioModelessDialog::OnClose() { if (this->IsWindowVisible()) { SavePosition(); } __super::OnClose(); }
void CMainWindow::closeEvent( QCloseEvent* anEvent ) { TRACE_FUN( Routine, "CMainWindow::closeEvent" ); bool allViewsDestroyed( true ); _closeRequired = true; if( _ecuDeviceView->IsReadyToClose() ) { delete _ecuDeviceView; _ecuDeviceView = 0; } else { allViewsDestroyed = false; _ecuDeviceView->close(); } if( allViewsDestroyed ) { SavePosition(); QMainWindow::closeEvent( anEvent ); } else { anEvent->ignore(); } }
static void HandleSizeChange(int newSizingType) { SavePosition(); Core_NotifyWindowHidden(false); if (!g_Config.bPauseWhenMinimized) { NativeMessageReceived("window minimized", "false"); } int width = 0, height = 0; RECT rc; GetClientRect(hwndMain, &rc); width = rc.right - rc.left; height = rc.bottom - rc.top; // Moves the internal display window to match the inner size of the main window. MoveWindow(hwndDisplay, 0, 0, width, height, TRUE); // Setting pixelWidth to be too small could have odd consequences. if (width >= 4 && height >= 4) { // The framebuffer manager reads these once per frame, hopefully safe enough.. should really use a mutex or some // much better mechanism. PSP_CoreParameter().pixelWidth = width; PSP_CoreParameter().pixelHeight = height; } DEBUG_LOG(SYSTEM, "Pixel width/height: %dx%d", PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight); if (UpdateScreenScale(width, height)) { NativeMessageReceived("gpu_resized", ""); } // Don't save the window state if fullscreen. if (!g_Config.bFullScreen) { g_WindowState = newSizingType; } }
void CGraphStudioModelessDialog::OnDestroy() { if (!position_saved) { SavePosition(); } __super::OnDestroy(); }
frmDatabaseDesigner::~frmDatabaseDesigner() { closing = true; // Save form's position SavePosition(); // Uninitialize wxAUIManager manager.UnInit(); if (mainForm) mainForm->RemoveFrame(this); if(modelBrowser) delete modelBrowser; if(browserPanel) delete browserPanel; if(diagrams) delete diagrams; if(design) delete design; if (connection) { if (connection->IsAlive()) delete connection; } }
BOOL CChildFrame::DestroyWindow() { SavePosition(); // If we are active, save the restored/maximized state // If we are not, do nothing and let the active frame do the job. if (this->GetParentFrame()->GetActiveFrame() == (CFrameWnd*)this) { WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(&wp); theApp.WriteProfileInt(_T("Settings"), _T("ActiveFrameMax"), (wp.showCmd == SW_MAXIMIZE)); } if (m_hIdentical != NULL) { DestroyIcon(m_hIdentical); m_hIdentical = NULL; } if (m_hDifferent != NULL) { DestroyIcon(m_hDifferent); m_hDifferent = NULL; } return CMDIChildWnd::DestroyWindow(); }
void MainFrame::OnClose(wxCloseEvent &event) { if (!SaveWarning()) return; SavePosition(wxT("mainframe")); event.Skip(); }
pgFrame::~pgFrame() { if (!dlgName.IsEmpty()) SavePosition(); if (menuFactories) delete menuFactories; }
void SaveWindowPos(WindowPtr win) { Rect r; GetWindowBounds(win, kWindowContentRgn, &r); SavePosition(GetWinKind(win), r.top, r.left); }
BOOL CDKnownProcesses::DestroyWindow() { // TODO: Add your specialized code here and/or call the base class SavePosition(); CListColumnPositions list_columns(_T("KnownProcess_List"), &m_lKnownProcesses); list_columns.SavePositions(); return CDialog::DestroyWindow(); }
INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { TranslateDialogDefault(hdlg); LoadPosition(hdlg, "ExitDlg"); ShowWindow(hdlg,SW_SHOW); }break; case WM_COMMAND: switch(LOWORD(wparam)) { case IDOK: { SavePosition(hdlg, "ExitDlg"); SaveSessionDate(); SaveSessionHandles(0,0); db_set_b(NULL, MODNAME, "lastempty", 0); DestroyWindow(hdlg); }break; case IDCANCEL: { SavePosition(hdlg, "ExitDlg"); db_set_b(NULL, MODNAME, "lastempty", 1); DestroyWindow(hdlg); }break; } case WM_CLOSE: DestroyWindow(hdlg); break; case WM_DESTROY: PostQuitMessage(0); break; default: return FALSE; } return TRUE; }
BOOL Show(HINSTANCE hInstance) { hInst = hInstance; // Store instance handle in our global variable. RECT rc = DetermineWindowRectangle(); SavePosition(); u32 style = WS_OVERLAPPEDWINDOW; hwndMain = CreateWindowEx(0,szWindowClass, L"", style, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL); if (!hwndMain) return FALSE; SetWindowLong(hwndMain, GWL_EXSTYLE, WS_EX_APPWINDOW); RECT rcClient; GetClientRect(hwndMain, &rcClient); hwndDisplay = CreateWindowEx(0, szDisplayClass, L"", WS_CHILD | WS_VISIBLE, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hwndMain, 0, hInstance, 0); if (!hwndDisplay) return FALSE; menu = GetMenu(hwndMain); MENUINFO info; ZeroMemory(&info,sizeof(MENUINFO)); info.cbSize = sizeof(MENUINFO); info.cyMax = 0; info.dwStyle = MNS_CHECKORBMP; info.fMask = MIM_STYLE; for (int i = 0; i < GetMenuItemCount(menu); i++) { SetMenuInfo(GetSubMenu(menu,i), &info); } // Always translate first: translating resets the menu. TranslateMenus(hwndMain, menu); UpdateMenus(); // Accept dragged files. DragAcceptFiles(hwndMain, TRUE); hideCursor = true; SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0); ToggleFullscreen(hwndMain, g_Config.bFullScreen); W32Util::MakeTopMost(hwndMain, g_Config.bTopMost); touchHandler.registerTouchWindow(hwndDisplay); WindowsRawInput::Init(); SetFocus(hwndMain); return TRUE; }
Position* AccountTradeInfo::CreatePosition(Order const*pOrder,QDateTime const& oTimestamp,size_t nQuantity,double dPrice) { QMutexLocker oLocker(&m_mLock); OrderOperator oOperator; Position *pPosition = oOperator.Open(pOrder,oTimestamp,nQuantity,dPrice); UpdateOrder(const_cast<Order*>(pOrder)); SavePosition(pPosition); m_lPositions.push_back(pPosition); return pPosition; }
void CMonitorWidget::OnButtonClose() { ShowWindow(SW_HIDE); SavePosition(); CMainFrameA *pMainFrameA = CMainFrameA::GetCurrentInstance(); if (pMainFrameA != NULL) pMainFrameA->SetShowAvMonitor(false); // OBS: don't save CMonitorWidget visible/hidden value in this regs, as this is saved when app closes. }
void MDLViewer::SaveWindowPositions( void ) { // Save the model viewer position SavePosition(); int c = IFacePoserToolWindow::GetToolCount(); for ( int i = 0; i < c; i++ ) { IFacePoserToolWindow *w = IFacePoserToolWindow::GetTool( i ); w->SavePosition(); } }
void CMergeEditFrame::OnTimer(UINT_PTR nIDEvent) { if (nIDEvent == IDT_SAVEPOSITION) { SavePosition(); KillTimer(IDT_SAVEPOSITION); } else { UpdateHeaderSizes(); } CMDIChildWnd::OnTimer(nIDEvent); }
bool StringList::GetString(char *Str,wchar *StrW,int MaxLength,int StringNum) { SavePosition(); Rewind(); bool RetCode=true; while (StringNum-- >=0) if (!GetString(Str,StrW,MaxLength)) { RetCode=false; break; } RestorePosition(); return(RetCode); }
frmHint::~frmHint() { if (!force && chkSuppress->GetValue()) { size_t i; for (i = 0 ; i < hintnos.GetCount() ; i++) { int hintno = hintnos.Item(i); if (hintArray[hintno].flags & HINT_CANSUPPRESS) settings->Write(wxString(wxT("Hints/")) + hintArray[hintno].hintPage, wxT("Suppress")); } } SavePosition(); }
BOOL CMergeEditFrame::DestroyWindow() { SavePosition(); // If we are active, save the restored/maximized state // If we are not, do nothing and let the active frame do the job. if (this->GetParentFrame()->GetActiveFrame() == (CFrameWnd*)this) { WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(&wp); GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE)); } return CMDIChildWnd::DestroyWindow(); }
void CMonitorWidget::OnMouseMove(UINT nFlags, CPoint point) { CRect rc; GetWindowRect(rc); ClientToScreen(&point); int cx = m_ptStartDrag.x - point.x; int cy = m_ptStartDrag.y - point.y; int nLeft = rc.left - cx; int nTop = rc.top - cy; int nRight = rc.right - cx; int nBottom = rc.bottom - cy; if(m_bLimitToWindow && m_bDisableLimitToWindow == false) { CRect rcWnd; CWnd *pParentRef = GetParent(); if ( pParentRef != NULL ) { pParentRef->GetWindowRect(rcWnd); if(rcWnd.left > nLeft) nLeft = rcWnd.left; if (rcWnd.top > nTop) nTop = rcWnd.top; if (rcWnd.right < nRight) nLeft = rcWnd.right - rc.Width(); if (rcWnd.bottom < nBottom) nTop = rcWnd.bottom - rc.Height(); } } if(nLeft != rc.left || nTop != rc.top) { if(m_bLeftButtonPressed && m_bEnableDrag) { SetWindowPos(NULL, nLeft, nTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE); m_ptStartDrag = point; SavePosition(); } } CWnd::OnMouseMove(nFlags, point); }
bool StringList::Search(char *Str,wchar *StrW,bool CaseSensitive) { SavePosition(); Rewind(); bool Found=false; char *CurStr; wchar *CurStrW; while (GetString(&CurStr,&CurStrW)) { if ((CaseSensitive ? strcmp(Str,CurStr):stricomp(Str,CurStr))!=0) continue; if (StrW!=NULL && CurStrW!=NULL) if ((CaseSensitive ? strcmpw(StrW,CurStrW):stricmpw(StrW,CurStrW))!=0) continue; Found=true; break; } RestorePosition(); return(Found); }
void CChildFrame::OnClose() //------------------------- { SavePosition(); CMDIChildWnd::OnClose(); }
dlgReassignDropOwned::~dlgReassignDropOwned() { SavePosition(); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; std::string fn; switch (message) { case WM_CREATE: break; case WM_MOVE: SavePosition(); ResizeDisplay(); break; case WM_SIZE: SavePosition(); ResizeDisplay(); break; case WM_TIMER: // Hack: Take the opportunity to also show/hide the mouse cursor in fullscreen mode. switch (wParam) { case TIMER_CURSORUPDATE: CorrectCursor(); return 0; case TIMER_CURSORMOVEUPDATE: hideCursor = true; KillTimer(hWnd, TIMER_CURSORMOVEUPDATE); return 0; } break; // For some reason, need to catch this here rather than in DisplayProc. case WM_MOUSEWHEEL: { int wheelDelta = (short)(wParam >> 16); KeyInput key; key.deviceId = DEVICE_ID_MOUSE; if (wheelDelta < 0) { key.keyCode = KEYCODE_EXT_MOUSEWHEEL_DOWN; wheelDelta = -wheelDelta; } else { key.keyCode = KEYCODE_EXT_MOUSEWHEEL_UP; } // There's no separate keyup event for mousewheel events, let's pass them both together. // This also means it really won't work great for key mapping :( Need to build a 1 frame delay or something. key.flags = KEY_DOWN | KEY_UP | KEY_HASWHEELDELTA | (wheelDelta << 16); NativeKey(key); break; } case WM_COMMAND: { if (!EmuThread_Ready()) return DefWindowProc(hWnd, message, wParam, lParam); I18NCategory *g = GetI18NCategory("Graphics"); wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case ID_FILE_LOAD: BrowseAndBoot(""); break; case ID_FILE_LOAD_MEMSTICK: { std::string memStickDir, flash0dir; GetSysDirectories(memStickDir, flash0dir); memStickDir += "PSP\\GAME\\"; BrowseAndBoot(memStickDir); } break; case ID_FILE_REFRESHGAMELIST: break; case ID_FILE_MEMSTICK: { std::string memStickDir, flash0dir; GetSysDirectories(memStickDir, flash0dir); ShellExecuteA(NULL, "open", memStickDir.c_str(), 0, 0, SW_SHOW); } break; case ID_TOGGLE_PAUSE: if (globalUIState == UISTATE_PAUSEMENU) { NativeMessageReceived("run", ""); if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0); } else if (Core_IsStepping()) //It is paused, then continue to run { if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0); else Core_EnableStepping(false); } else { if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_STOP, 0); else Core_EnableStepping(true); } break; case ID_EMULATION_STOP: if (memoryWindow[0]) { SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); } if (disasmWindow[0]) { SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); } if (Core_IsStepping()) { Core_EnableStepping(false); } NativeMessageReceived("stop", ""); SetPlaying(0); Update(); break; case ID_EMULATION_RESET: if (globalUIState == UISTATE_PAUSEMENU) NativeMessageReceived("run", ""); NativeMessageReceived("reset", ""); break; case ID_EMULATION_SPEEDLIMIT: g_Config.bSpeedLimit = !g_Config.bSpeedLimit; break; case ID_FILE_LOADSTATEFILE: if (W32Util::BrowseForFileName(true, hWnd, "Load state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) { SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::Load(fn, SaveStateActionFinished); } break; case ID_FILE_SAVESTATEFILE: if (W32Util::BrowseForFileName(false, hWnd, "Save state",0,"Save States (*.ppst)\0*.ppst\0All files\0*.*\0\0","ppst",fn)) { SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::Save(fn, SaveStateActionFinished); } break; // TODO: Improve UI for multiple slots case ID_FILE_SAVESTATE_NEXT_SLOT: { currentSavestateSlot = (currentSavestateSlot + 1)%5; char msg[30]; sprintf(msg, "Using save state slot %d.", currentSavestateSlot + 1); osm.Show(msg); break; } case ID_FILE_QUICKLOADSTATE: SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::LoadSlot(currentSavestateSlot, SaveStateActionFinished); break; case ID_FILE_QUICKSAVESTATE: SetCursor(LoadCursor(0, IDC_WAIT)); SaveState::SaveSlot(currentSavestateSlot, SaveStateActionFinished); break; case ID_OPTIONS_SCREEN1X: SetZoom(1); break; case ID_OPTIONS_SCREEN2X: SetZoom(2); break; case ID_OPTIONS_SCREEN3X: SetZoom(3); break; case ID_OPTIONS_SCREEN4X: SetZoom(4); break; case ID_OPTIONS_MIPMAP: g_Config.bMipMap = !g_Config.bMipMap; break; case ID_OPTIONS_VSYNC: g_Config.iVSyncInterval = !g_Config.iVSyncInterval; break; case ID_TEXTURESCALING_OFF: setTexScalingLevel(1); break; case ID_TEXTURESCALING_2X: setTexScalingLevel(2); break; case ID_TEXTURESCALING_3X: setTexScalingLevel(3); break; case ID_TEXTURESCALING_4X: setTexScalingLevel(4); break; case ID_TEXTURESCALING_5X: setTexScalingLevel(5); break; case ID_TEXTURESCALING_XBRZ: setTexScalingType(TextureScaler::XBRZ); break; case ID_TEXTURESCALING_HYBRID: setTexScalingType(TextureScaler::HYBRID); break; case ID_TEXTURESCALING_BICUBIC: setTexScalingType(TextureScaler::BICUBIC); break; case ID_TEXTURESCALING_HYBRID_BICUBIC: setTexScalingType(TextureScaler::HYBRID_BICUBIC); break; case ID_TEXTURESCALING_DEPOSTERIZE: g_Config.bTexDeposterize = !g_Config.bTexDeposterize; if(gpu) gpu->ClearCacheNextFrame(); break; case ID_OPTIONS_BUFFEREDRENDERING: g_Config.bBufferedRendering = !g_Config.bBufferedRendering; osm.ShowOnOff(g->T("Buffered Rendering"), g_Config.bBufferedRendering); if (gpu) gpu->Resized(); // easy way to force a clear... break; case ID_OPTIONS_READFBOTOMEMORY: g_Config.bFramebuffersToMem = !g_Config.bFramebuffersToMem; osm.ShowOnOff(g->T("Read Framebuffers To Memory"), g_Config.bFramebuffersToMem); if (gpu) gpu->Resized(); // easy way to force a clear... break; case ID_OPTIONS_SHOWDEBUGSTATISTICS: g_Config.bShowDebugStats = !g_Config.bShowDebugStats; break; case ID_OPTIONS_HARDWARETRANSFORM: g_Config.bHardwareTransform = !g_Config.bHardwareTransform; osm.ShowOnOff(g->T("Hardware Transform"), g_Config.bHardwareTransform); break; case ID_OPTIONS_STRETCHDISPLAY: g_Config.bStretchToDisplay = !g_Config.bStretchToDisplay; if (gpu) gpu->Resized(); // easy way to force a clear... break; case ID_OPTIONS_FRAMESKIP: g_Config.iFrameSkip = g_Config.iFrameSkip == 0 ? 1 : 0; osm.ShowOnOff(g->T("Frame Skipping"), g_Config.iFrameSkip != 0); break; case ID_FILE_EXIT: DestroyWindow(hWnd); break; case ID_CPU_DYNAREC: g_Config.bJit = true; osm.ShowOnOff(g->T("Dynarec", "Dynarec (JIT)"), g_Config.bJit); break; case ID_CPU_INTERPRETER: g_Config.bJit = false; break; case ID_EMULATION_RUNONLOAD: g_Config.bAutoRun = !g_Config.bAutoRun; break; case ID_DEBUG_DUMPNEXTFRAME: if (gpu) gpu->DumpNextFrame(); break; case ID_DEBUG_LOADMAPFILE: if (W32Util::BrowseForFileName(true, hWnd, "Load .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) { symbolMap.LoadSymbolMap(fn.c_str()); // HLE_PatchFunctions(); if (disasmWindow[0]) disasmWindow[0]->NotifyMapLoaded(); if (memoryWindow[0]) memoryWindow[0]->NotifyMapLoaded(); } break; case ID_DEBUG_SAVEMAPFILE: if (W32Util::BrowseForFileName(false, hWnd, "Save .MAP",0,"Maps\0*.map\0All files\0*.*\0\0","map",fn)) symbolMap.SaveSymbolMap(fn.c_str()); break; case ID_DEBUG_RESETSYMBOLTABLE: symbolMap.ResetSymbolMap(); for (int i=0; i<numCPUs; i++) if (disasmWindow[i]) disasmWindow[i]->NotifyMapLoaded(); for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->NotifyMapLoaded(); break; case ID_DEBUG_DISASSEMBLY: if (disasmWindow[0]) disasmWindow[0]->Show(true); break; case ID_DEBUG_MEMORYVIEW: if (memoryWindow[0]) memoryWindow[0]->Show(true); break; case ID_DEBUG_LOG: LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden()); break; case ID_OPTIONS_IGNOREILLEGALREADS: g_Config.bIgnoreBadMemAccess = !g_Config.bIgnoreBadMemAccess; break; case ID_OPTIONS_FULLSCREEN: g_Config.bFullScreen = !g_Config.bFullScreen ; if(g_bFullScreen) { _ViewNormal(hWnd); } else { _ViewFullScreen(hWnd); } break; case ID_OPTIONS_VERTEXCACHE: g_Config.bVertexCache = !g_Config.bVertexCache; break; case ID_OPTIONS_SHOWFPS: g_Config.iShowFPSCounter = !g_Config.iShowFPSCounter; break; case ID_OPTIONS_DISPLAYRAWFRAMEBUFFER: g_Config.bDisplayFramebuffer = !g_Config.bDisplayFramebuffer; break; case ID_OPTIONS_FASTMEMORY: g_Config.bFastMemory = !g_Config.bFastMemory; break; case ID_OPTIONS_USEVBO: g_Config.bUseVBO = !g_Config.bUseVBO; break; case ID_OPTIONS_TEXTUREFILTERING_AUTO: setTexFiltering(0); break; case ID_OPTIONS_NEARESTFILTERING: setTexFiltering(2) ; break; case ID_OPTIONS_LINEARFILTERING: setTexFiltering(3) ; break; case ID_OPTIONS_LINEARFILTERING_CG: setTexFiltering(4) ; break; case ID_OPTIONS_TOPMOST: g_Config.bTopMost = !g_Config.bTopMost; W32Util::MakeTopMost(hWnd, g_Config.bTopMost); break; case ID_OPTIONS_SIMPLE2XSSAA: g_Config.SSAntiAliasing = !g_Config.SSAntiAliasing; ResizeDisplay(true); break; case ID_OPTIONS_CONTROLS: MessageBox(hWnd, "Control mapping has been moved to the in-window Settings menu.\n", "Sorry", 0); break; case ID_EMULATION_SOUND: g_Config.bEnableSound = !g_Config.bEnableSound; break; case ID_HELP_OPENWEBSITE: ShellExecute(NULL, "open", "http://www.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL); break; case ID_HELP_OPENFORUM: ShellExecute(NULL, "open", "http://forums.ppsspp.org/", NULL, NULL, SW_SHOWNORMAL); break; case ID_HELP_ABOUT: DialogManager::EnableAll(FALSE); DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About); DialogManager::EnableAll(TRUE); break; case ID_DEBUG_TAKESCREENSHOT: g_TakeScreenshot = true; break; default: MessageBox(hwndMain,"Unimplemented","Sorry",0); break; } } break; case WM_INPUT: { UINT dwSize; GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)); if (!rawInputBuffer) { rawInputBuffer = malloc(dwSize); rawInputBufferSize = dwSize; } if (dwSize > rawInputBufferSize) { rawInputBuffer = realloc(rawInputBuffer, dwSize); } GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBuffer, &dwSize, sizeof(RAWINPUTHEADER)); RAWINPUT* raw = (RAWINPUT*)rawInputBuffer; if (raw->header.dwType == RIM_TYPEKEYBOARD) { KeyInput key; key.deviceId = DEVICE_ID_KEYBOARD; if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) { key.flags = KEY_DOWN; key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)]; if (key.keyCode) { NativeKey(key); } } else if (raw->data.keyboard.Message == WM_KEYUP) { key.flags = KEY_UP; key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)]; if (key.keyCode) { NativeKey(key); } } } } return 0; case WM_DROPFILES: { if (!EmuThread_Ready()) return DefWindowProc(hWnd, message, wParam, lParam); HDROP hdrop = (HDROP)wParam; int count = DragQueryFile(hdrop,0xFFFFFFFF,0,0); if (count != 1) { MessageBox(hwndMain,"You can only load one file at a time","Error",MB_ICONINFORMATION); } else { TCHAR filename[512]; DragQueryFile(hdrop,0,filename,512); TCHAR *type = filename+_tcslen(filename)-3; SendMessage(hWnd, WM_COMMAND, ID_EMULATION_STOP, 0); // Ugly, need to wait for the stop message to process in the EmuThread. Sleep(20); MainWindow::SetPlaying(filename); MainWindow::Update(); NativeMessageReceived("boot", filename); } } break; case WM_CLOSE: /* if (g_Config.bConfirmOnQuit && __KernelIsRunning()) if (IDYES != MessageBox(hwndMain, "A game is in progress. Are you sure you want to exit?", "Are you sure?", MB_YESNO | MB_ICONQUESTION)) return 0; //*/ EmuThread_Stop(); return DefWindowProc(hWnd,message,wParam,lParam); case WM_DESTROY: KillTimer(hWnd, TIMER_CURSORUPDATE); KillTimer(hWnd, TIMER_CURSORMOVEUPDATE); PostQuitMessage(0); break; case WM_USER+1: if (disasmWindow[0]) SendMessage(disasmWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); if (memoryWindow[0]) SendMessage(memoryWindow[0]->GetDlgHandle(), WM_CLOSE, 0, 0); disasmWindow[0] = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS); DialogManager::AddDlg(disasmWindow[0]); disasmWindow[0]->Show(g_Config.bShowDebuggerOnLoad); if (g_Config.bFullScreen) _ViewFullScreen(hWnd); memoryWindow[0] = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS); DialogManager::AddDlg(memoryWindow[0]); if (disasmWindow[0]) disasmWindow[0]->NotifyMapLoaded(); if (memoryWindow[0]) memoryWindow[0]->NotifyMapLoaded(); SetForegroundWindow(hwndMain); break; case WM_MENUSELECT: // Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states // with corresponding menu items. UpdateMenus(); break; // Turn off the screensaver. // Note that if there's a screensaver password, this simple method // doesn't work on Vista or higher. case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: return 0; case SC_MONITORPOWER: return 0; } return DefWindowProc(hWnd, message, wParam, lParam); } default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
dlgHbaConfig::~dlgHbaConfig() { SavePosition(); }
frmExport::~frmExport() { SavePosition(); }
dlgSelectConnection::~dlgSelectConnection() { SavePosition(); }
frmReport::~frmReport() { SavePosition(); }
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { //if (!m_hDlg) return FALSE; switch(message) { case WM_INITDIALOG: { return TRUE; } break; case WM_NOTIFY: switch (wParam) { case IDC_LEFTTABS: leftTabs->HandleNotify(lParam); break; case IDC_BREAKPOINTLIST: breakpointList->HandleNotify(lParam); break; case IDC_THREADLIST: threadList->HandleNotify(lParam); break; case IDC_STACKFRAMES: stackTraceView->HandleNotify(lParam); break; case IDC_MODULELIST: moduleList->HandleNotify(lParam); break; case IDC_DEBUG_BOTTOMTABS: bottomTabs->HandleNotify(lParam); break; } break; case WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case ID_TOGGLE_PAUSE: SendMessage(MainWindow::GetHWND(),WM_COMMAND,ID_TOGGLE_PAUSE,0); break; case ID_DEBUG_DISPLAYMEMVIEW: bottomTabs->ShowTab(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); break; case ID_DEBUG_DISPLAYBREAKPOINTLIST: bottomTabs->ShowTab(breakpointList->GetHandle()); break; case ID_DEBUG_DISPLAYTHREADLIST: bottomTabs->ShowTab(threadList->GetHandle()); break; case ID_DEBUG_DISPLAYSTACKFRAMELIST: bottomTabs->ShowTab(stackTraceView->GetHandle()); break; case ID_DEBUG_DSIPLAYREGISTERLIST: leftTabs->ShowTab(0); break; case ID_DEBUG_DSIPLAYFUNCTIONLIST: leftTabs->ShowTab(1); break; case ID_DEBUG_ADDBREAKPOINT: { keepStatusBarText = true; bool isRunning = Core_IsActive(); if (isRunning) { SetDebugMode(true, false); Core_EnableStepping(true); Core_WaitInactive(200); } BreakpointWindow bpw(m_hDlg,cpu); if (bpw.exec()) bpw.addBreakpoint(); if (isRunning) { SetDebugMode(false, false); Core_EnableStepping(false); } keepStatusBarText = false; } break; case ID_DEBUG_STEPOVER: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOver(); break; case ID_DEBUG_STEPINTO: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepInto(); break; case ID_DEBUG_RUNTOLINE: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) runToLine(); break; case ID_DEBUG_STEPOUT: if (GetFocus() == GetDlgItem(m_hDlg,IDC_DISASMVIEW)) stepOut(); break; case ID_DEBUG_HIDEBOTTOMTABS: { RECT rect; hideBottomTabs = !hideBottomTabs; GetClientRect(m_hDlg,&rect); UpdateSize(rect.right-rect.left,rect.bottom-rect.top); } break; case ID_DEBUG_TOGGLEBOTTOMTABTITLES: bottomTabs->SetShowTabTitles(!bottomTabs->GetShowTabTitles()); break; case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: { HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ListBox_GetCurSel(lb); if (n!=-1) { unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GOTOINT: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ComboBox_GetCurSel(lb); unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); if (addr != 0xFFFFFFFF) { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_STOPGO: { if (!PSP_IsInited()) { break; } if (!Core_IsStepping()) // stop { ptr->setDontRedraw(false); SetDebugMode(true, true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } else { // go lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); SetDebugMode(false, true); Core_EnableStepping(false); } } break; case IDC_STEP: stepInto(); break; case IDC_STEPOVER: stepOver(); break; case IDC_STEPOUT: stepOut(); break; case IDC_STEPHLE: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); hleDebugBreak(); SetDebugMode(false, true); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_MEMCHECK: SendMessage(m_hDlg,WM_COMMAND,ID_DEBUG_ADDBREAKPOINT,0); break; case IDC_GOTOPC: { ptr->gotoPC(); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } break; case IDC_ALLFUNCTIONS: { symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); break; } default: return FALSE; } return TRUE; } case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->gotoAddr(wParam); SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); break; } case WM_DEB_GOTOADDRESSEDIT: { if (!PSP_IsInited()) { break; } wchar_t szBuffer[256]; CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256); u32 addr; if (parseExpression(ConvertWStringToUTF8(szBuffer).c_str(),cpu,addr) == false) { displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS)); } else { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } UpdateDialog(); } break; case WM_DEB_SETDEBUGLPARAM: SetDebugMode(lParam != 0, true); return TRUE; case WM_DEB_UPDATE: Update(); return TRUE; case WM_DEB_TABPRESSED: bottomTabs->NextTab(true); SetFocus(bottomTabs->CurrentTabHandle()); break; case WM_DEB_SETSTATUSBARTEXT: if (!keepStatusBarText) SetWindowText(statusBarWnd, ConvertUTF8ToWString((const char *)lParam).c_str()); break; case WM_DEB_GOTOHEXEDIT: { CtrlMemView *memory = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); memory->gotoAddr(wParam); // display the memory viewer too bottomTabs->ShowTab(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW)); } break; case WM_SIZE: { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SendMessage(statusBarWnd,WM_SIZE,0,10); SavePosition(); return TRUE; } case WM_MOVE: SavePosition(); break; case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; // Reduce the minimum size slightly, so they can size it however they like. m->ptMinTrackSize.x = minWidth; //m->ptMaxTrackSize.x = m->ptMinTrackSize.x; m->ptMinTrackSize.y = minHeight; } return TRUE; case WM_CLOSE: Show(false); return TRUE; case WM_ACTIVATE: if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) { g_activeWindow = WINDOW_CPUDEBUGGER; } break; } return FALSE; }
BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { //if (!m_hDlg) return FALSE; switch(message) { case WM_INITDIALOG: { return TRUE; } break; case WM_TIMER: { int iPage = TabCtrl_GetCurSel (GetDlgItem(m_hDlg, IDC_LEFTTABS)); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), iPage?SW_HIDE:SW_NORMAL); } break; case WM_NOTIFY: switch (wParam) { case IDC_LEFTTABS: { HWND tabs = GetDlgItem(m_hDlg, IDC_LEFTTABS); NMHDR* pNotifyMessage = NULL; pNotifyMessage = (LPNMHDR)lParam; if (pNotifyMessage->hwndFrom == tabs) { int iPage = TabCtrl_GetCurSel (tabs); ShowWindow(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), iPage?SW_NORMAL:SW_HIDE); ShowWindow(GetDlgItem(m_hDlg, IDC_REGLIST), iPage?SW_HIDE:SW_NORMAL); } } break; case IDC_BREAKPOINTLIST: breakpointList->handleNotify(lParam); break; case IDC_THREADLIST: threadList->handleNotify(lParam); break; } break; case WM_COMMAND: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST)); switch(LOWORD(wParam)) { case IDC_SHOWVFPU: vfpudlg->Show(true); break; case IDC_FUNCTIONLIST: switch (HIWORD(wParam)) { case CBN_DBLCLK: { HWND lb = GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ListBox_GetCurSel(lb); if (n!=-1) { unsigned int addr = (unsigned int)ListBox_GetItemData(lb,n); ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GOTOINT: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { HWND lb =GetDlgItem(m_hDlg,LOWORD(wParam)); int n = ComboBox_GetCurSel(lb); unsigned int addr = (unsigned int)ComboBox_GetItemData(lb,n); if (addr != 0xFFFFFFFF) { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } } break; }; break; case IDC_GO: { lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); SetDebugMode(false); Core_EnableStepping(false); } break; case IDC_STEP: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); Core_DoSingleStep(); Sleep(1); _dbg_update_(); ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW))->redraw(); threadList->reloadThreads(); updateThreadLabel(false); } break; case IDC_STEPOVER: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); const char* dis = cpu->disasm(cpu->GetPC(),4); const char* pos = strstr(dis,"->$"); const char* reg = strstr(dis,"->"); ptr->setDontRedraw(true); u32 breakpointAddress = cpu->GetPC()+cpu->getInstructionSize(0); if (memcmp(dis,"jal\t",4) == 0 || memcmp(dis,"jalr\t",5) == 0) { // it's a function call with a delay slot - skip that too breakpointAddress += cpu->getInstructionSize(0); } else if (memcmp(dis,"j\t",2) == 0 || memcmp(dis,"b\t",2) == 0) { // in case of absolute branches, set the breakpoint at the branch target sscanf(pos+3,"%08x",&breakpointAddress); } else if (memcmp(dis,"jr\t",3) == 0) { // the same for jumps to registers int regNum = -1; for (int i = 0; i < 32; i++) { if (strcasecmp(reg+2,cpu->GetRegName(0,i)) == 0) { regNum = i; break; } } if (regNum == -1) break; breakpointAddress = cpu->GetRegValue(0,regNum); } else if (pos != NULL) { // get branch target sscanf(pos+3,"%08x",&breakpointAddress); CBreakPoints::AddBreakPoint(breakpointAddress,true); // also add a breakpoint after the delay slot breakpointAddress = cpu->GetPC()+2*cpu->getInstructionSize(0); } SetDebugMode(false); CBreakPoints::AddBreakPoint(breakpointAddress,true); _dbg_update_(); Core_EnableStepping(false); Sleep(1); ptr->gotoAddr(breakpointAddress); UpdateDialog(); } break; case IDC_STEPHLE: { if (Core_IsActive()) break; lastTicks = CoreTiming::GetTicks(); // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); hleDebugBreak(); SetDebugMode(false); _dbg_update_(); Core_EnableStepping(false); } break; case IDC_STOP: { ptr->setDontRedraw(false); SetDebugMode(true); Core_EnableStepping(true); _dbg_update_(); Sleep(1); //let cpu catch up ptr->gotoPC(); UpdateDialog(); vfpudlg->Update(); } break; case IDC_SKIP: { cpu->SetPC(cpu->GetPC() + cpu->getInstructionSize(0)); Sleep(1); ptr->gotoPC(); UpdateDialog(); } break; case IDC_MEMCHECK: { bool isRunning = Core_IsActive(); if (isRunning) { SetDebugMode(true); Core_EnableStepping(true); Core_WaitInactive(200); } BreakpointWindow bpw(m_hDlg,cpu); if (bpw.exec()) bpw.addBreakpoint(); if (isRunning) { SetDebugMode(false); Core_EnableStepping(false); } } break; case IDC_UPDATECALLSTACK: { HWND hDlg = m_hDlg; HWND list = GetDlgItem(hDlg,IDC_CALLSTACK); ComboBox_ResetContent(list); u32 pc = currentMIPS->pc; u32 ra = currentMIPS->r[MIPS_REG_RA]; DWORD addr = Memory::ReadUnchecked_U32(pc); int count=1; ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(pc)),pc); if (symbolMap.GetDescription(pc) != symbolMap.GetDescription(ra)) { ComboBox_SetItemData(list,ComboBox_AddString(list,symbolMap.GetDescription(ra)),ra); count++; } //walk the stack chain while (addr != 0xFFFFFFFF && addr!=0 && count++<20) { DWORD fun = Memory::ReadUnchecked_U32(addr+4); const char *str = symbolMap.GetDescription(fun); if (strlen(str)==0) str = "(unknown)"; ComboBox_SetItemData(list, ComboBox_AddString(list,str), fun); addr = Memory::ReadUnchecked_U32(addr); } ComboBox_SetCurSel(list,0); } break; case IDC_GOTOPC: { ptr->gotoPC(); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); UpdateDialog(); } break; case IDC_GOTOLR: { ptr->gotoAddr(cpu->GetLR()); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } break; case IDC_BACKWARDLINKS: { HWND box = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST); int funcnum = symbolMap.GetSymbolNum(ListBox_GetItemData(box,ListBox_GetCurSel(box))); if (funcnum!=-1) symbolMap.FillListBoxBLinks(box,funcnum); break; } case IDC_ALLFUNCTIONS: { symbolMap.FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST),ST_FUNCTION); break; } default: return FALSE; } return TRUE; } case WM_DEB_MAPLOADED: NotifyMapLoaded(); break; case WM_DEB_RUNTOWPARAM: { lastTicks = CoreTiming::GetTicks(); CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->setDontRedraw(true); SetDebugMode(false); CBreakPoints::AddBreakPoint(wParam,true); _dbg_update_(); Core_EnableStepping(false); break; } case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->gotoAddr(wParam); SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); break; } case WM_DEB_GOTOADDRESSEDIT: { char szBuffer[256]; CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); GetWindowText(GetDlgItem(m_hDlg,IDC_ADDRESS),szBuffer,256); u32 addr; if (parseExpression(szBuffer,cpu,addr) == false) { displayExpressionError(GetDlgItem(m_hDlg,IDC_ADDRESS)); } else { ptr->gotoAddr(addr); SetFocus(GetDlgItem(m_hDlg, IDC_DISASMVIEW)); } UpdateDialog(); } break; case WM_DEB_SETDEBUGLPARAM: SetDebugMode(lParam != 0); return TRUE; case WM_DEB_UPDATE: Update(); return TRUE; case WM_DEB_TABPRESSED: { HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST); HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW); HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST); if (IsWindowVisible(bp)) { ShowWindow(bp,SW_HIDE); ShowWindow(mem,SW_HIDE); ShowWindow(threads,SW_NORMAL); SetFocus(threads); } else if (IsWindowVisible(threads)) { ShowWindow(bp,SW_HIDE); ShowWindow(mem,SW_NORMAL); ShowWindow(threads,SW_HIDE); SetFocus(mem); } else { ShowWindow(bp,SW_NORMAL); ShowWindow(mem,SW_HIDE); ShowWindow(threads,SW_HIDE); SetFocus(bp); } } break; case WM_SIZE: { UpdateSize(LOWORD(lParam), HIWORD(lParam)); SavePosition(); return TRUE; } case WM_MOVE: SavePosition(); break; case WM_GETMINMAXINFO: { MINMAXINFO *m = (MINMAXINFO *)lParam; // Reduce the minimum size slightly, so they can size it however they like. m->ptMinTrackSize.x = defaultRect.right - defaultRect.left - 100; //m->ptMaxTrackSize.x = m->ptMinTrackSize.x; m->ptMinTrackSize.y = defaultRect.bottom - defaultRect.top - 200; } return TRUE; case WM_CLOSE: Show(false); return TRUE; } return FALSE; }