CMemoryCardView::CMemoryCardView(HWND hParent, const RECT& rect) : m_itemCount(0) , m_memoryCard(NULL) , m_render(NULL) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wc); } Create(WS_EX_CLIENTEDGE, CLSNAME, _T(""), WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, rect, hParent, NULL); SetClassPtr(); UpdateGeometry(); m_render = new CRender(m_hWnd, &m_viewState); }
CMainWindow::CMainWindow() : CDialog(MAKEINTRESOURCE(IDD_MAINWINDOW)) { CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_MAINWINDOW_RECT_LEFT, 0); CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_MAINWINDOW_RECT_TOP, 0); CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_MAINWINDOW_RECT_RIGHT, 0); CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_MAINWINDOW_RECT_BOTTOM, 0); CAppConfig::GetInstance().RegisterPreferenceBoolean(PREF_MAINWINDOW_MAXIMIZED, true); SetClassPtr(); m_tabs = Framework::Win32::CTab(GetItem(IDC_MAINWINDOW_TABS)); { int smallIconSizeX = GetSystemMetrics(SM_CXSMICON); int smallIconSizeY = GetSystemMetrics(SM_CYSMICON); int bigIconSizeX = GetSystemMetrics(SM_CXICON); int bigIconSizeY = GetSystemMetrics(SM_CYICON); HICON smallIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, smallIconSizeX, smallIconSizeY, 0)); HICON bigIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, bigIconSizeX, bigIconSizeY, 0)); SetIcon(ICON_SMALL, smallIcon); SetIcon(ICON_BIG, bigIcon); } ShowWelcomePage(); LoadWindowRect(); m_accelerators = LoadAccelerators(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MAINWINDOW_ACCELERATORS)); }
CVu1ProgramView::CVu1ProgramView(HWND parent, const RECT& rect, CVu1Vm& virtualMachine) : m_virtualMachine(virtualMachine) , m_vuMemPacketAddress(0) { Create(0, Framework::Win32::CDefaultWndClass::GetName(), NULL, WNDSTYLE, rect, parent, NULL); SetClassPtr(); m_mainSplitter = std::make_unique<Framework::Win32::CVerticalSplitter>(m_hWnd, GetClientRect()); m_subSplitter = std::make_unique<Framework::Win32::CHorizontalSplitter>(*m_mainSplitter, GetClientRect()); m_memoryTab = std::make_unique<CTabHost>(*m_mainSplitter, GetClientRect()); m_memoryView = std::make_unique<CMemoryViewMIPS>(*m_memoryTab, GetClientRect(), m_virtualMachine, m_virtualMachine.GetVu1Context()); m_packetView = std::make_unique<CGifPacketView>(*m_memoryTab, GetClientRect()); m_memoryTab->InsertTab(_T("VU Memory"), m_memoryView.get()); m_memoryTab->InsertTab(_T("Packet"), m_packetView.get()); m_disAsm = std::make_unique<CDisAsmVu>(*m_subSplitter, GetClientRect(), m_virtualMachine, m_virtualMachine.GetVu1Context()); m_regView = std::make_unique<CRegViewVU>(*m_subSplitter, GetClientRect(), m_virtualMachine, m_virtualMachine.GetVu1Context()); m_regView->Show(SW_SHOW); m_mainSplitter->SetChild(0, *m_subSplitter); m_mainSplitter->SetChild(1, *m_memoryTab); m_mainSplitter->SetMasterChild(1); m_mainSplitter->SetEdgePosition(0.65); m_subSplitter->SetChild(0, *m_disAsm); m_subSplitter->SetChild(1, *m_regView); m_subSplitter->SetMasterChild(1); m_subSplitter->SetEdgePosition(0.65); }
CPatcherWindow::CPatcherWindow(const boost::filesystem::path& gamePath, const boost::filesystem::path& downloadPath) : CDialog(MAKEINTRESOURCE(IDD_PATCHERWINDOW)) , m_gamePath(gamePath) , m_downloadPath(downloadPath) { SetClassPtr(); m_downloadStatusLabel = Framework::Win32::CStatic(GetDlgItem(m_hWnd, IDC_DOWNLOADSTATUS_LABEL)); m_downloadProgressLabel = Framework::Win32::CStatic(GetDlgItem(m_hWnd, IDC_DOWNLOADPROGRESS_LABEL)); m_downloadProgress = Framework::Win32::CProgress(GetDlgItem(m_hWnd, IDC_DOWNLOAD_PROGRESS)); m_patchStatusLabel = Framework::Win32::CStatic(GetDlgItem(m_hWnd, IDC_PATCHSTATUS_LABEL)); m_patchProgressLabel = Framework::Win32::CStatic(GetDlgItem(m_hWnd, IDC_PATCHPROGRESS_LABEL)); m_patchProgress = Framework::Win32::CProgress(GetDlgItem(m_hWnd, IDC_PATCH_PROGRESS)); m_cancelButton = Framework::Win32::CButton(GetDlgItem(m_hWnd, IDCANCEL)); SetTimer(m_hWnd, 0, TIMER_RATE, nullptr); m_patchStatusLabel.SetText(_T("Patcher waiting for download to complete...")); m_patchProgressLabel.SetText(_T("0%")); StepDownloader(); UpdateDownloaderStatus(); }
CRegViewWnd::CRegViewWnd(HWND parentWnd, CVirtualMachine& virtualMachine, CMIPS* ctx) { auto windowRect = Framework::Win32::CRect(0, 0, 320, 240); Create(NULL, Framework::Win32::CDefaultWndClass::GetName(), _T("Registers"), WND_STYLE, windowRect, parentWnd, NULL); SetClassPtr(); m_tabs = Framework::Win32::CTab(m_hWnd, windowRect, TCS_BOTTOM); m_tabs.InsertTab(_T("General")); m_tabs.InsertTab(_T("SCU")); m_tabs.InsertTab(_T("FPU")); m_tabs.InsertTab(_T("VU")); m_regView[0] = new CRegViewGeneral(m_hWnd, windowRect, virtualMachine, ctx); m_regView[1] = new CRegViewSCU(m_hWnd, windowRect, virtualMachine, ctx); m_regView[2] = new CRegViewFPU(m_hWnd, windowRect, virtualMachine, ctx); m_regView[3] = new CRegViewVU(m_hWnd, windowRect, virtualMachine, ctx); for(unsigned int i = 0; i < MAXTABS; i++) { m_regView[i]->Enable(false); m_regView[i]->Show(SW_HIDE); } SelectTab(0); RefreshLayout(); }
CCallStackWnd::CCallStackWnd(HWND hParent, CVirtualMachine& virtualMachine, CMIPS* context, CBiosDebugInfoProvider* biosDebugInfoProvider) : m_virtualMachine(virtualMachine) , m_context(context) , m_list(nullptr) , m_biosDebugInfoProvider(biosDebugInfoProvider) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; RegisterClassEx(&wc); } Create(NULL, CLSNAME, _T("Call Stack"), WS_CLIPCHILDREN | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_CHILD | WS_MAXIMIZEBOX, Framework::Win32::CRect(0, 0, 320, 240), hParent, NULL); SetClassPtr(); m_list = new Framework::Win32::CListView(m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), LVS_REPORT); m_list->SetExtendedListViewStyle(m_list->GetExtendedListViewStyle() | LVS_EX_FULLROWSELECT); m_virtualMachine.OnMachineStateChange.connect(boost::bind(&CCallStackWnd::Update, this)); m_virtualMachine.OnRunningStateChange.connect(boost::bind(&CCallStackWnd::Update, this)); CreateColumns(); RefreshLayout(); Update(); }
CThreadCallStackViewWnd::CThreadCallStackViewWnd(HWND parentWindow) : CDialog(MAKEINTRESOURCE(IDD_DEBUG_THREADCALLSTACK), parentWindow) , m_hasSelection(false) , m_selectedAddress(0) { SetClassPtr(); m_okButton = new Framework::Win32::CButton(GetItem(IDOK)); m_cancelButton = new Framework::Win32::CButton(GetItem(IDCANCEL)); m_callStackItemList = new Framework::Win32::CListBox(GetItem(IDC_CALLSTACKITEM_LIST)); RECT buttonSize; SetRect(&buttonSize, 0, 0, 75, 16); MapDialogRect(m_hWnd, &buttonSize); unsigned int buttonWidth = buttonSize.right - buttonSize.left; unsigned int buttonHeight = buttonSize.bottom - buttonSize.top; m_layout = Framework::VerticalLayoutContainer ( Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateCustomBehavior(100, 20, 1, 1, m_callStackItemList)) + Framework::HorizontalLayoutContainer ( Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(buttonWidth, buttonHeight, m_okButton)) + Framework::LayoutExpression(Framework::CLayoutStretch::Create()) + Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(buttonWidth, buttonHeight, m_cancelButton)) ) ); { RECT rc = GetClientRect(); m_layout->SetRect(rc.left + 10, rc.top + 10, rc.right - 10, rc.bottom - 10); m_layout->RefreshGeometry(); } }
CTabHost::CTabHost(HWND parent, const RECT& rect) : m_currentSelection(-1) { Create(0, Framework::Win32::CDefaultWndClass::GetName(), _T(""), WNDSTYLE, rect, parent, nullptr); SetClassPtr(); m_tab = std::make_unique<Framework::Win32::CTab>(m_hWnd, rect); }
CSpuRegViewPanel::CSpuRegViewPanel(HWND parentWnd, const TCHAR* title) : Framework::Win32::CDialog(MAKEINTRESOURCE(IDD_SPUREGVIEW), parentWnd) { SetClassPtr(); m_regView = new CSpuRegView(m_hWnd, title); RefreshLayout(); }
CGameSettingsWindow::CGameSettingsWindow(HWND parentWnd) : CDialog(MAKEINTRESOURCE(IDD_GAMESETTINGSWINDOW), parentWnd) { SetClassPtr(); m_gameLocationEdit = Framework::Win32::CEdit(GetDlgItem(m_hWnd, IDC_GAMELOCATION_EDIT)); auto gameLocation = Framework::Utf8::ConvertFrom(CAppConfig::GetInstance().GetPreferenceString(PREF_LAUNCHER_GAME_LOCATION)); m_gameLocationEdit.SetText(gameLocation.c_str()); }
CFindCallersViewWnd::CFindCallersViewWnd(HWND parentWnd) { auto windowRect = Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 700, 400)); Create(NULL, Framework::Win32::CDefaultWndClass().GetName(), _T(""), WND_STYLE, windowRect, parentWnd, NULL); SetClassPtr(); m_callersList = Framework::Win32::CListBox(m_hWnd, Framework::Win32::CRect(0, 0, 10, 10), WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT); RefreshLayout(); }
CMiniDebugger::CMiniDebugger(CVirtualMachine& virtualMachine, const CDebuggable& debuggable) : m_virtualMachine(virtualMachine) , m_debuggable(debuggable) , m_functionsView(nullptr) , m_mainSplitter(nullptr) , m_subSplitter(nullptr) , m_disAsmView(nullptr) , m_registerView(nullptr) , m_memoryView(nullptr) { InitializeConsole(); if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX w; memset(&w, 0, sizeof(WNDCLASSEX)); w.cbSize = sizeof(WNDCLASSEX); w.lpfnWndProc = CWindow::WndProc; w.lpszClassName = CLSNAME; w.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_BTNFACE); w.hInstance = GetModuleHandle(NULL); w.hCursor = LoadCursor(NULL, IDC_ARROW); RegisterClassEx(&w); } auto windowRect = Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 1000, 600)); Create(WNDSTYLEEX, CLSNAME, _T("MiniDebugger"), WNDSTYLE, windowRect, NULL, NULL); SetClassPtr(); Center(); CreateAccelerators(); m_mainSplitter = new Framework::Win32::CVerticalSplitter(m_hWnd, GetClientRect()); m_subSplitter = new Framework::Win32::CHorizontalSplitter(m_mainSplitter->m_hWnd, GetClientRect()); m_memoryView = new CMemoryViewMIPS(m_mainSplitter->m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), m_virtualMachine, &m_debuggable.GetCpu()); m_disAsmView = new CDisAsm(m_subSplitter->m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), m_virtualMachine, &m_debuggable.GetCpu()); m_registerView = new CRegViewGeneral(m_subSplitter->m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), m_virtualMachine, &m_debuggable.GetCpu()); m_registerView->Show(SW_SHOW); m_functionsView = new CFunctionsView(NULL); m_functionsView->OnFunctionDblClick.connect(boost::bind(&CMiniDebugger::OnFunctionDblClick, this, _1)); m_functionsView->SetContext(&m_debuggable.GetCpu(), m_debuggable.biosDebugInfoProvider); m_functionsView->Refresh(); m_subSplitter->SetChild(0, *m_disAsmView); m_subSplitter->SetChild(1, *m_registerView); m_subSplitter->SetEdgePosition(0.675); m_mainSplitter->SetChild(0, *m_subSplitter); m_mainSplitter->SetChild(1, *m_memoryView); m_disAsmView->SetAddress(m_debuggable.GetCpu().m_State.nPC); }
CPixelBufferViewOverlay::CPixelBufferViewOverlay(HWND parentWnd) { Create(0, Framework::Win32::CDefaultWndClass::GetName(), _T(""), WNDSTYLE, Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 64, 32 + 21)), parentWnd, nullptr); SetClassPtr(); m_saveButton = Framework::Win32::CButton(_T("Save"), m_hWnd, Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 32, 32))); m_fitButton = Framework::Win32::CButton(_T("Fit"), m_hWnd, Framework::Win32::PointsToPixels(Framework::Win32::CRect(32, 0, 64, 32))); m_pixelBufferComboBox = Framework::Win32::CComboBox(m_hWnd, Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 32, 64, 32 + 21)), CBS_DROPDOWNLIST); }
CELFProgramView::CELFProgramView(HWND hParent, CELF* pELF) : CDialog(MAKEINTRESOURCE(IDD_ELFVIEW_PROGRAMVIEW), hParent) , m_nProgram(-1) , m_pELF(pELF) { SetClassPtr(); m_pType = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_TYPE_EDIT)); m_pOffset = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_OFFSET_EDIT)); m_pVAddr = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_VADDR_EDIT)); m_pPAddr = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_PADDR_EDIT)); m_pFileSize = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FILESIZE_EDIT)); m_pMemSize = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_MEMSIZE_EDIT)); m_pFlags = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FLAGS_EDIT)); m_pAlign = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_PROGRAMVIEW_ALIGN_EDIT)); RECT columnEditBoxSize; SetRect(&columnEditBoxSize, 0, 0, 70, 12); MapDialogRect(m_hWnd, &columnEditBoxSize); unsigned int columnEditBoxWidth = columnEditBoxSize.right - columnEditBoxSize.left; unsigned int columnEditBoxHeight = columnEditBoxSize.bottom - columnEditBoxSize.top; RECT columnLabelSize; SetRect(&columnLabelSize, 0, 0, 70, 8); MapDialogRect(m_hWnd, &columnLabelSize); unsigned int columnLabelWidth = columnLabelSize.right - columnLabelSize.left; unsigned int columnLabelHeight = columnLabelSize.bottom - columnLabelSize.top; m_pLayout = Framework::CGridLayout::Create(2, 9); m_pLayout->SetObject(0, 0, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_TYPE_LABEL)))); m_pLayout->SetObject(0, 1, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_OFFSET_LABEL)))); m_pLayout->SetObject(0, 2, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_VADDR_LABEL)))); m_pLayout->SetObject(0, 3, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_PADDR_LABEL)))); m_pLayout->SetObject(0, 4, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FILESIZE_LABEL)))); m_pLayout->SetObject(0, 5, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_MEMSIZE_LABEL)))); m_pLayout->SetObject(0, 6, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_FLAGS_LABEL)))); m_pLayout->SetObject(0, 7, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_PROGRAMVIEW_ALIGN_LABEL)))); m_pLayout->SetObject(1, 0, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pType)); m_pLayout->SetObject(1, 1, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pOffset)); m_pLayout->SetObject(1, 2, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pVAddr)); m_pLayout->SetObject(1, 3, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pPAddr)); m_pLayout->SetObject(1, 4, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pFileSize)); m_pLayout->SetObject(1, 5, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pMemSize)); m_pLayout->SetObject(1, 6, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pFlags)); m_pLayout->SetObject(1, 7, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pAlign)); m_pLayout->SetObject(1, 8, Framework::CLayoutStretch::Create()); RefreshLayout(); }
CFunctionsView::CFunctionsView(HWND hParent) : m_context(nullptr) , m_biosDebugInfoProvider(nullptr) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; RegisterClassEx(&wc); } unsigned long windowStyle = WS_CLIPCHILDREN | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX; #ifndef FUNCTIONSVIEW_STANDALONE windowStyle |= WS_CHILD; #endif int ydpi = GetDeviceCaps(GetDC(NULL), LOGPIXELSY); Create(NULL, CLSNAME, _T("Functions"), windowStyle, Framework::Win32::CRect(0, 0, SCALE(320), SCALE(240)), hParent, NULL); SetClassPtr(); m_pList = new Framework::Win32::CListView(m_hWnd, Framework::Win32::CRect(0, 0, 0, 0), LVS_REPORT | LVS_SINGLESEL | LVS_SORTASCENDING | LVS_SHOWSELALWAYS); m_pList->SetExtendedListViewStyle(m_pList->GetExtendedListViewStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); CreateListColumns(); m_pNew = new Framework::Win32::CButton(_T("New..."), m_hWnd, Framework::Win32::CRect(0, 0, 0, 0)); m_pRename = new Framework::Win32::CButton(_T("Rename..."), m_hWnd, Framework::Win32::CRect(0, 0, 0, 0)); m_pDelete = new Framework::Win32::CButton(_T("Delete"), m_hWnd, Framework::Win32::CRect(0, 0, 0, 0)); m_pImport = new Framework::Win32::CButton(_T("Load ELF symbols"), m_hWnd, Framework::Win32::CRect(0, 0, 0, 0)); Framework::FlatLayoutPtr pSubLayout0 = Framework::CHorizontalLayout::Create(); pSubLayout0->InsertObject(Framework::CLayoutStretch::Create()); pSubLayout0->InsertObject(Framework::Win32::CLayoutWindow::CreateButtonBehavior(SCALE(100), SCALE(23), m_pNew)); pSubLayout0->InsertObject(Framework::Win32::CLayoutWindow::CreateButtonBehavior(SCALE(100), SCALE(23), m_pRename)); pSubLayout0->InsertObject(Framework::Win32::CLayoutWindow::CreateButtonBehavior(SCALE(100), SCALE(23), m_pDelete)); pSubLayout0->InsertObject(Framework::Win32::CLayoutWindow::CreateButtonBehavior(SCALE(100), SCALE(23), m_pImport)); m_pLayout = Framework::CVerticalLayout::Create(); m_pLayout->InsertObject(Framework::Win32::CLayoutWindow::CreateCustomBehavior(1, 1, 1, 1, m_pList)); m_pLayout->InsertObject(pSubLayout0); SetSize(SCALE(469), SCALE(612)); RefreshLayout(); }
CLauncherWindow::CLauncherWindow() : Framework::Win32::CDialog(MAKEINTRESOURCE(IDD_LAUNCHERWINDOW)) , m_pageLoaded(false) , m_pageLoadTimerId(NULL) { CAppConfig::GetInstance().RegisterPreferenceString(PREF_LAUNCHER_SERVER_NAME, ""); CAppConfig::GetInstance().RegisterPreferenceString(PREF_LAUNCHER_SERVER_ADDRESS, ""); SetClassPtr(); { int smallIconSizeX = GetSystemMetrics(SM_CXSMICON); int smallIconSizeY = GetSystemMetrics(SM_CYSMICON); int bigIconSizeX = GetSystemMetrics(SM_CXICON); int bigIconSizeY = GetSystemMetrics(SM_CYICON); HICON smallIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, smallIconSizeX, smallIconSizeY, 0)); HICON bigIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, bigIconSizeX, bigIconSizeY, 0)); SetIcon(ICON_SMALL, smallIcon); SetIcon(ICON_BIG, bigIcon); } try { m_serverDefs.Read(Framework::CStdStream("servers.xml", "rb")); } catch(...) { } { auto webBrowserPlaceholder = Framework::Win32::CStatic(GetItem(IDC_WEBBROWSER_PLACEHODLER)); RECT placeHolderRect = webBrowserPlaceholder.GetWindowRect(); ScreenToClient(m_hWnd, reinterpret_cast<LPPOINT>(&placeHolderRect) + 0); ScreenToClient(m_hWnd, reinterpret_cast<LPPOINT>(&placeHolderRect) + 1); m_webBrowser = Framework::Win32::CWebBrowser(m_hWnd, placeHolderRect); } m_serverAddressComboBox = Framework::Win32::CComboBox(GetItem(IDC_SERVERADDRESS_COMBOBOX)); m_versionInfoLabel = Framework::Win32::CStatic(GetItem(IDC_VERSIONINFO_LABEL)); FillServerAddressComboBox(); LoadServerAddressComboBoxSetting(); SetVersionInfo(); LoadLoginPage(); }
CMemoryViewMIPSWnd::CMemoryViewMIPSWnd(HWND parentWnd, CVirtualMachine& virtualMachine, CMIPS* ctx) { auto wndRect = Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 320, 240)); Create(NULL, Framework::Win32::CDefaultWndClass::GetName(), _T("Memory"), WNDSTYLE, wndRect, parentWnd, NULL); SetClassPtr(); m_addressEdit = new Framework::Win32::CEdit(m_hWnd, wndRect, _T(""), ES_READONLY); m_memoryView = new CMemoryViewMIPS(m_hWnd, wndRect, virtualMachine, ctx); m_memoryView->OnSelectionChange.connect(boost::bind(&CMemoryViewMIPSWnd::OnMemoryViewSelectionChange, this, _1)); UpdateStatusBar(); RefreshLayout(); }
CStatsOverlayWindow::CStatsOverlayWindow(HWND parentWnd) : m_font(Framework::Win32::CreateFont(_T("Courier New"), 11)) { //Fill in render metrics { auto fontSize = Framework::Win32::GetFixedFontSize(m_font); m_renderMetrics.marginX = Framework::Win32::PointsToPixels(10); m_renderMetrics.marginY = Framework::Win32::PointsToPixels(10); m_renderMetrics.fontSizeX = fontSize.cx; m_renderMetrics.fontSizeY = fontSize.cy; m_renderMetrics.spaceY = Framework::Win32::PointsToPixels(3); } Create(WS_EX_TRANSPARENT | WS_EX_LAYERED, Framework::Win32::CDefaultWndClass::GetName(), _T(""), WS_POPUP, Framework::Win32::CRect(0, 0, 128, 128), parentWnd, NULL); SetClassPtr(); }
CCdromSelectionWnd::CCdromSelectionWnd(HWND hParent, const TCHAR* sTitle, CDROMBINDING* pInitBinding) : CModalWindow(hParent) { if(pInitBinding != NULL) { m_nType = pInitBinding->nType; m_sImagePath = pInitBinding->sImagePath; m_nPhysicalDevice = pInitBinding->nPhysicalDevice; } Create(WNDSTYLEEX, Framework::Win32::CDefaultWndClass::GetName(), sTitle, WNDSTYLE, Framework::Win32::CRect(0, 0, 300, 170), hParent, NULL); SetClassPtr(); m_pOk = new Framework::Win32::CButton(_T("OK"), m_hWnd, Framework::Win32::CRect(0, 0, 1, 1)); m_pCancel = new Framework::Win32::CButton(_T("Cancel"), m_hWnd, Framework::Win32::CRect(0, 0, 1, 1)); m_pImageRadio = new Framework::Win32::CButton(_T("ISO9660 Disk Image"), m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), BS_RADIOBUTTON); m_pDeviceRadio = new Framework::Win32::CButton(_T("Physical CD/DVD Reader Device"), m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), BS_RADIOBUTTON); m_pImageEdit = new Framework::Win32::CEdit(m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), _T(""), ES_READONLY); m_pImageBrowse = new Framework::Win32::CButton(_T("..."), m_hWnd, Framework::Win32::CRect(0, 0, 1, 1)); m_pDeviceCombo = new Framework::Win32::CComboBox(m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), CBS_DROPDOWNLIST | WS_VSCROLL); PopulateDeviceList(); m_pLayout = Framework::VerticalLayoutContainer( Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(100, 15, m_pImageRadio)) + Framework::HorizontalLayoutContainer( Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(100, 21, m_pImageEdit)) + Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(20, 21, m_pImageBrowse)) ) + Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(100, 15, m_pDeviceRadio)) + Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(100, 20, m_pDeviceCombo)) + Framework::LayoutExpression(Framework::CLayoutStretch::Create()) + Framework::HorizontalLayoutContainer( Framework::LayoutExpression(Framework::CLayoutStretch::Create()) + Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(100, 23, m_pOk)) + Framework::LayoutExpression(Framework::Win32::CLayoutWindow::CreateButtonBehavior(100, 23, m_pCancel)) ) ); UpdateControls(); RefreshLayout(); m_pDeviceCombo->FixHeight(100); }
COutputWnd::COutputWnd(HWND hParent) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wc); } Create(NULL, CLSNAME, NULL, WNDSTYLE, Framework::Win32::CRect(0, 0, 1, 1), hParent, NULL); SetClassPtr(); }
CDisAsmWnd::CDisAsmWnd(HWND parentWnd, CVirtualMachine& virtualMachine, CMIPS* ctx, DISASM_TYPE disAsmType) { Create(NULL, Framework::Win32::CDefaultWndClass::GetName(), _T("Disassembly"), WNDSTYLE, Framework::Win32::CRect(0, 0, 320, 240), parentWnd, NULL); SetClassPtr(); switch(disAsmType) { case DISASM_STANDARD: m_disAsm = new CDisAsm(m_hWnd, Framework::Win32::CRect(0, 0, 320, 240), virtualMachine, ctx); break; case DISASM_VU: m_disAsm = new CDisAsmVu(m_hWnd, Framework::Win32::CRect(0, 0, 320, 240), virtualMachine, ctx); break; default: assert(0); break; } RefreshLayout(); }
CSaveIconView::CSaveIconView(HWND hParent, const RECT& rect) : m_nGrabbing(false) , m_iconMesh(NULL) , m_iconType(CSave::ICON_NORMAL) , m_nRotationX(0) , m_nRotationY(0) , m_nGrabPosX(0) , m_nGrabPosY(0) , m_nGrabDistX(0) , m_nGrabDistY(0) , m_nGrabRotX(0) , m_nGrabRotY(0) , m_nZoom(-7.0f) , m_save(NULL) , m_hRC(NULL) , m_thread(NULL) , m_threadOver(false) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = NULL; wc.hbrBackground = NULL; wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wc); } Create(WS_EX_STATICEDGE, CLSNAME, _T(""), WS_VISIBLE | WS_CLIPCHILDREN | WS_CHILD, rect, hParent, NULL); SetClassPtr(); m_thread = new std::thread(std::bind(&CSaveIconView::ThreadProc, this)); }
CGsRegisterWriteListView::CGsRegisterWriteListView(HWND parentWnd, const RECT& rect) : m_frameDump(nullptr) { Create(0, Framework::Win32::CDefaultWndClass::GetName(), _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPCHILDREN, Framework::Win32::CRect(0, 0, 1024, 768), parentWnd, nullptr); SetClassPtr(); m_packetsTreeView = std::make_unique<Framework::Win32::CTreeView>(m_hWnd, Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 300, 300)), TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_HASLINES); { LOGFONT fontInfo; HFONT packetsTreeViewFont = m_packetsTreeView->GetFont(); GetObject(packetsTreeViewFont, sizeof(LOGFONT), &fontInfo); fontInfo.lfWeight = FW_BOLD; m_drawCallItemFont = CreateFontIndirect(&fontInfo); } m_prevDrawKickButton = std::make_unique<Framework::Win32::CButton>(_T("Prev Draw Kick"), m_hWnd, Framework::Win32::PointsToPixels(Framework::Win32::CRect(0, 0, 100, 25))); m_nextDrawKickButton = std::make_unique<Framework::Win32::CButton>(_T("Next Draw Kick"), m_hWnd, Framework::Win32::PointsToPixels(Framework::Win32::CRect(100, 0, 200, 25))); }
CELFSymbolView::CELFSymbolView(HWND hParent, CELF* pELF) : m_pELF(pELF) , m_listView(NULL) { if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; RegisterClassEx(&wc); } Create(NULL, CLSNAME, _T(""), WS_CHILD | WS_DISABLED | WS_CLIPCHILDREN, Framework::Win32::CRect(0, 0, 1, 1), hParent, NULL); SetClassPtr(); m_listView = new Framework::Win32::CListView(m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), LVS_REPORT | LVS_OWNERDATA); m_listView->SetExtendedListViewStyle(m_listView->GetExtendedListViewStyle() | LVS_EX_FULLROWSELECT); LVCOLUMN col; memset(&col, 0, sizeof(LVCOLUMN)); col.pszText = _T("Name"); col.mask = LVCF_TEXT; m_listView->InsertColumn(0, col); memset(&col, 0, sizeof(LVCOLUMN)); col.pszText = _T("Address"); col.mask = LVCF_TEXT; m_listView->InsertColumn(1, col); memset(&col, 0, sizeof(LVCOLUMN)); col.pszText = _T("Size"); col.mask = LVCF_TEXT; m_listView->InsertColumn(2, col); memset(&col, 0, sizeof(LVCOLUMN)); col.pszText = _T("Type"); col.mask = LVCF_TEXT; m_listView->InsertColumn(3, col); memset(&col, 0, sizeof(LVCOLUMN)); col.pszText = _T("Binding"); col.mask = LVCF_TEXT; m_listView->InsertColumn(4, col); memset(&col, 0, sizeof(LVCOLUMN)); col.pszText = _T("Section"); col.mask = LVCF_TEXT; m_listView->InsertColumn(5, col); RefreshLayout(); RECT rc = m_listView->GetClientRect(); m_listView->SetColumnWidth(0, rc.right / 3); m_listView->SetColumnWidth(1, rc.right / 4); m_listView->SetColumnWidth(2, rc.right / 4); m_listView->SetColumnWidth(3, rc.right / 4); m_listView->SetColumnWidth(4, rc.right / 4); m_listView->SetColumnWidth(5, rc.right / 4); PopulateList(); m_listView->Redraw(); }
CMainWindow::CMainWindow(CPsfVm& virtualMachine) : Framework::Win32::CDialog(MAKEINTRESOURCE(IDD_MAINWINDOW)) , m_virtualMachine(virtualMachine) , m_ready(false) , m_frames(0) , m_lastUpdateTime(~0) , m_selectedAudioPlugin(DEFAULT_SOUND_HANDLER_ID) , m_selectedCharEncoding(DEFAULT_CHAR_ENCODING_ID) , m_playlistPanel(NULL) , m_fileInformationPanel(NULL) , m_spu0RegViewPanel(NULL) , m_spu1RegViewPanel(NULL) , m_currentPlaylistItem(0) , m_repeatMode(DEFAULT_REPEAT_MODE) , m_trackLength(0) , m_accel(CreateAccelerators()) , m_reverbEnabled(true) , m_playListOnceIcon(NULL) , m_repeatListIcon(NULL) , m_shuffleListIcon(NULL) , m_repeatTrackIcon(NULL) , m_toolTip(NULL) , m_trayPopupMenu(NULL) , m_configPopupMenu(NULL) , m_useTrayIcon(false) , m_trayIconServer(NULL) , m_taskBarList(NULL) , m_randomSeed(0) { OSVERSIONINFO versionInfo; memset(&versionInfo, 0, sizeof(OSVERSIONINFO)); versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&versionInfo); if(versionInfo.dwMajorVersion > 6) { m_useTrayIcon = false; } else if(versionInfo.dwMajorVersion == 6) { m_useTrayIcon = versionInfo.dwMinorVersion < 1; } else { m_useTrayIcon = true; } #ifdef FORCE_ENABLE_TRAYICON m_useTrayIcon = true; #endif if(!m_useTrayIcon) { m_taskBarList = new Framework::Win32::CTaskBarList(); } { srand(static_cast<unsigned int>(time(NULL)) * 0x13579ACD); float delta = (static_cast<float>(rand()) / static_cast<float>(RAND_MAX)); m_randomSeed = delta * static_cast<float>(0xCAFECAFE) + 0xDAEBB042; } CAppConfig::GetInstance().RegisterPreferenceBoolean(PREF_REVERB_ENABLED, true); CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_SOUNDHANDLER_ID, DEFAULT_SOUND_HANDLER_ID); CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_CHAR_ENCODING_ID, DEFAULT_CHAR_ENCODING_ID); CAppConfig::GetInstance().RegisterPreferenceInteger(PREF_REPEAT_MODE, DEFAULT_REPEAT_MODE); m_reverbEnabled = CAppConfig::GetInstance().GetPreferenceBoolean(PREF_REVERB_ENABLED); m_repeatMode = static_cast<REPEAT_MODE>(CAppConfig::GetInstance().GetPreferenceInteger(PREF_REPEAT_MODE)); LoadAudioPluginPreferences(); LoadCharEncodingPreferences(); for(unsigned int i = 0; i < MAX_PANELS; i++) { m_panels[i] = NULL; } SetClassPtr(); SetTimer(m_hWnd, TIMER_UPDATE_CLOCK, 200, NULL); SetTimer(m_hWnd, TIMER_UPDATE_FADE, 50, NULL); SetTimer(m_hWnd, TIMER_UPDATE_DISCOVERIES, 100, NULL); { int smallIconSizeX = GetSystemMetrics(SM_CXSMICON); int smallIconSizeY = GetSystemMetrics(SM_CYSMICON); int bigIconSizeX = GetSystemMetrics(SM_CXICON); int bigIconSizeY = GetSystemMetrics(SM_CYICON); HICON smallIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, smallIconSizeX, smallIconSizeY, 0)); HICON bigIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, bigIconSizeX, bigIconSizeY, 0)); SetIcon(ICON_SMALL, smallIcon); SetIcon(ICON_BIG, bigIcon); } m_trayPopupMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_TRAY_POPUP)); m_configPopupMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_CONFIG_POPUP)); m_virtualMachine.OnNewFrame.connect(std::bind(&CMainWindow::OnNewFrame, this)); m_toolTip = new Framework::Win32::CToolTip(m_hWnd); m_toolTip->Activate(true); ChangeAudioPlugin(FindAudioPlugin(m_selectedAudioPlugin)); m_playListOnceIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PLAYONCE), IMAGE_ICON, 16, 16, 0)); m_repeatListIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_REPEAT_LIST), IMAGE_ICON, 16, 16, 0)); m_shuffleListIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SHUFFLE_LIST), IMAGE_ICON, 16, 16, 0)); m_repeatTrackIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_REPEAT_TRACK), IMAGE_ICON, 16, 16, 0)); m_configIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_CONFIG), IMAGE_ICON, 16, 16, 0)); m_playIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PLAY), IMAGE_ICON, 16, 16, 0)); m_pauseIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PAUSE), IMAGE_ICON, 16, 16, 0)); m_prevTrackIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PREV_TRACK), IMAGE_ICON, 16, 16, 0)); m_nextTrackIcon = reinterpret_cast<HICON>(LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NEXT_TRACK), IMAGE_ICON, 16, 16, 0)); m_timerLabel = Framework::Win32::CStatic(GetItem(IDC_TIMER_LABEL)); m_titleLabel = Framework::Win32::CStatic(GetItem(IDC_TITLE_LABEL)); m_placeHolder = Framework::Win32::CStatic(GetItem(IDC_PLACEHOLDER)); m_configButton = Framework::Win32::CButton(GetItem(IDC_CONFIG_BUTTON)); m_toolTip->AddTool(m_configButton.m_hWnd, _T("Configuration")); m_configButton.SetIcon(m_configIcon); m_repeatButton = Framework::Win32::CButton(GetItem(IDC_REPEAT_BUTTON)); m_toolTip->AddTool(m_repeatButton.m_hWnd, _T("")); UpdateRepeatButton(); m_pauseButton = Framework::Win32::CButton(GetItem(IDC_PAUSE_BUTTON)); //Initialize symbol fonts CreateSymbolFonts(); { m_pauseButton.SetFont(m_webdingsFont); SendMessage(GetItem(ID_FILE_PREVIOUSTRACK), WM_SETFONT, reinterpret_cast<WPARAM>(static_cast<HFONT>(m_webdingsFont)), 0); SendMessage(GetItem(ID_FILE_NEXTTRACK), WM_SETFONT, reinterpret_cast<WPARAM>(static_cast<HFONT>(m_webdingsFont)), 0); SendMessage(GetItem(IDC_PREVTAB_BUTTON), WM_SETFONT, reinterpret_cast<WPARAM>(static_cast<HFONT>(m_webdingsFont)), 0); SendMessage(GetItem(IDC_NEXTTAB_BUTTON), WM_SETFONT, reinterpret_cast<WPARAM>(static_cast<HFONT>(m_webdingsFont)), 0); } if(m_segoeUiSymbolFont.IsValid()) { SendMessage(GetItem(IDC_EJECT_BUTTON), WM_SETFONT, reinterpret_cast<WPARAM>(static_cast<HFONT>(m_segoeUiSymbolFont)), 0); SendMessage(GetItem(IDC_EJECT_BUTTON), WM_SETTEXT, NULL, reinterpret_cast<LPARAM>(_T("\u23CF"))); } //Create tray icon if(m_useTrayIcon) { m_trayIconServer = new Framework::Win32::CTrayIconServer(); Framework::Win32::CTrayIcon* trayIcon = m_trayIconServer->Insert(); trayIcon->SetIcon(LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN))); trayIcon->SetTip(_T("PsfPlayer")); m_trayIconServer->RegisterHandler(std::bind(&CMainWindow::OnTrayIconEvent, this, std::placeholders::_1, std::placeholders::_2)); } //Create play list panel m_playlistPanel = new CPlaylistPanel(m_hWnd, m_playlist); m_playlistPanel->OnItemDblClick.connect(std::bind(&CMainWindow::OnPlaylistItemDblClick, this, std::placeholders::_1)); m_playlistPanel->OnAddClick.connect(std::bind(&CMainWindow::OnPlaylistAddClick, this)); m_playlistPanel->OnRemoveClick.connect(std::bind(&CMainWindow::OnPlaylistRemoveClick, this, std::placeholders::_1)); m_playlistPanel->OnSaveClick.connect(std::bind(&CMainWindow::OnPlaylistSaveClick, this)); //Create file information panel m_fileInformationPanel = new CFileInformationPanel(m_hWnd); //Create RegView panels m_spu0RegViewPanel = new CSpuRegViewPanel(m_hWnd, _T("SPU0")); m_spu1RegViewPanel = new CSpuRegViewPanel(m_hWnd, _T("SPU1")); //Initialize panels m_panels[0] = m_playlistPanel; m_panels[1] = m_fileInformationPanel; m_panels[2] = m_spu0RegViewPanel; m_panels[3] = m_spu1RegViewPanel; CreateAudioPluginMenu(); UpdateAudioPluginMenu(); CreateCharEncodingMenu(); UpdateCharEncodingMenu(); UpdateClock(); UpdateTitle(); UpdatePlaybackButtons(); UpdateConfigMenu(); m_currentPanel = -1; ActivatePanel(0); }
CMainWindow::CMainWindow(CPS2VM& virtualMachine, char* cmdLine) : m_virtualMachine(virtualMachine) , m_recordingAvi(false) , m_recordBuffer(nullptr) , m_recordBufferWidth(0) , m_recordBufferHeight(0) , m_recordAviMutex(NULL) , m_frames(0) , m_drawCallCount(0) , m_stateSlot(0) , m_outputWnd(nullptr) , m_statusBar(nullptr) , m_accTable(NULL) { m_recordAviMutex = CreateMutex(NULL, FALSE, NULL); TCHAR sVersion[256]; CAppConfig::GetInstance().RegisterPreferenceBoolean(PREF_UI_PAUSEWHENFOCUSLOST, true); if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wc); } Create(NULL, CLSNAME, _T(""), WNDSTYLE, Framework::Win32::CRect(0, 0, 640, 480), NULL, NULL); SetClassPtr(); #ifdef DEBUGGER_INCLUDED CDebugger::InitializeConsole(); #endif m_virtualMachine.Initialize(); SetIcon(ICON_SMALL, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PUREI))); SetIcon(ICON_BIG, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_PUREI))); SetMenu(LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MAINWINDOW))); #ifdef DEBUGGER_INCLUDED m_debugger = std::unique_ptr<CDebugger>(new CDebugger(m_virtualMachine)); m_frameDebugger = std::unique_ptr<CFrameDebugger>(new CFrameDebugger()); CreateDebugMenu(); #endif PrintVersion(sVersion, countof(sVersion)); m_outputWnd = new COutputWnd(m_hWnd); m_statusBar = new Framework::Win32::CStatusBar(m_hWnd); m_statusBar->SetParts(2, m_statusBarPanelWidths); m_statusBar->SetText(STATUSPANEL, sVersion); m_statusBar->SetText(FPSPANEL, _T("")); //m_virtualMachine.CreateGSHandler(CGSH_Null::GetFactoryFunction()); m_virtualMachine.CreateGSHandler(CGSH_OpenGLWin32::GetFactoryFunction(m_outputWnd)); m_virtualMachine.CreatePadHandler(CPH_DirectInput::GetFactoryFunction(m_hWnd)); m_deactivatePause = false; m_pauseFocusLost = CAppConfig::GetInstance().GetPreferenceBoolean(PREF_UI_PAUSEWHENFOCUSLOST); m_virtualMachine.m_gs->OnNewFrame.connect(boost::bind(&CMainWindow::OnNewFrame, this, _1)); SetTimer(m_hWnd, NULL, 1000, NULL); //Initialize status bar OnTimer(0); m_virtualMachine.m_os->OnExecutableChange.connect(boost::bind(&CMainWindow::OnExecutableChange, this)); CreateStateSlotMenu(); CreateAccelerators(); if(strstr(cmdLine, "--cdrom0") != nullptr) { BootCDROM(); } #ifdef DEBUGGER_INCLUDED if(strstr(cmdLine, "--debugger") != nullptr) { ShowDebugger(); } if(strstr(cmdLine, "--framedebugger") != nullptr) { ShowFrameDebugger(); } #endif RefreshLayout(); UpdateUI(); Center(); Show(SW_SHOW); }
CELFSectionView::CELFSectionView(HWND hParent, CELF* pELF) : CDialog(MAKEINTRESOURCE(IDD_ELFVIEW_SECTIONVIEW), hParent) , m_nSection(-1) , m_pELF(pELF) , m_dynamicSectionListView(NULL) , m_memoryView(NULL) { SetClassPtr(); m_pType = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_TYPE_EDIT)); m_pFlags = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_FLAGS_EDIT)); m_pAddress = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_ADDRESS_EDIT)); m_pOffset = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_OFFSET_EDIT)); m_pSize = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_SIZE_EDIT)); m_pLink = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_LINK_EDIT)); m_pInfo = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_INFO_EDIT)); m_pAlignment = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_ALIGN_EDIT)); m_pEntrySize = new Framework::Win32::CEdit(GetItem(IDC_ELFVIEW_SECTIONVIEW_ENTRYSIZE_EDIT)); m_contentsPlaceHolder = new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_CONTENTS_PLACEHOLDER)); //Create content views { m_memoryView = new CMemoryViewPtr(m_hWnd, Framework::Win32::CRect(0, 0, 1, 1)); m_dynamicSectionListView = new Framework::Win32::CListView(m_hWnd, Framework::Win32::CRect(0, 0, 1, 1), LVS_REPORT); m_dynamicSectionListView->SetExtendedListViewStyle(m_dynamicSectionListView->GetExtendedListViewStyle() | LVS_EX_FULLROWSELECT); } RECT columnEditBoxSize; SetRect(&columnEditBoxSize, 0, 0, 70, 12); MapDialogRect(m_hWnd, &columnEditBoxSize); unsigned int columnEditBoxWidth = columnEditBoxSize.right - columnEditBoxSize.left; unsigned int columnEditBoxHeight = columnEditBoxSize.bottom - columnEditBoxSize.top; RECT columnLabelSize; SetRect(&columnLabelSize, 0, 0, 70, 8); MapDialogRect(m_hWnd, &columnLabelSize); unsigned int columnLabelWidth = columnLabelSize.right - columnLabelSize.left; unsigned int columnLabelHeight = columnLabelSize.bottom - columnLabelSize.top; Framework::GridLayoutPtr pSubLayout0 = Framework::CGridLayout::Create(2, 9); pSubLayout0->SetObject(0, 0, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_TYPE_LABEL)))); pSubLayout0->SetObject(0, 1, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_FLAGS_LABEL)))); pSubLayout0->SetObject(0, 2, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_ADDRESS_LABEL)))); pSubLayout0->SetObject(0, 3, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_OFFSET_LABEL)))); pSubLayout0->SetObject(0, 4, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_SIZE_LABEL)))); pSubLayout0->SetObject(0, 5, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_LINK_LABEL)))); pSubLayout0->SetObject(0, 6, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_INFO_LABEL)))); pSubLayout0->SetObject(0, 7, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_ALIGN_LABEL)))); pSubLayout0->SetObject(0, 8, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnLabelWidth, columnLabelHeight, new Framework::Win32::CStatic(GetItem(IDC_ELFVIEW_SECTIONVIEW_ENTRYSIZE_LABEL)))); pSubLayout0->SetObject(1, 0, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pType)); pSubLayout0->SetObject(1, 1, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pFlags)); pSubLayout0->SetObject(1, 2, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pAddress)); pSubLayout0->SetObject(1, 3, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pOffset)); pSubLayout0->SetObject(1, 4, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pSize)); pSubLayout0->SetObject(1, 5, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pLink)); pSubLayout0->SetObject(1, 6, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pInfo)); pSubLayout0->SetObject(1, 7, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pAlignment)); pSubLayout0->SetObject(1, 8, Framework::Win32::CLayoutWindow::CreateTextBoxBehavior(columnEditBoxWidth, columnEditBoxHeight, m_pEntrySize)); pSubLayout0->SetVerticalStretch(0); m_pLayout = Framework::CVerticalLayout::Create(); m_pLayout->InsertObject(pSubLayout0); m_pLayout->InsertObject(Framework::Win32::CLayoutWindow::CreateCustomBehavior(200, 200, 1, 1, m_contentsPlaceHolder)); RefreshLayout(); CreateDynamicSectionListViewColumns(); }
CDebugger::CDebugger(CPS2VM& virtualMachine) : m_virtualMachine(virtualMachine) { RegisterPreferences(); if(!DoesWindowClassExist(CLSNAME)) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); wc.hInstance = GetModuleHandle(NULL); wc.lpszClassName = CLSNAME; wc.lpfnWndProc = CWindow::WndProc; RegisterClassEx(&wc); } Create(NULL, CLSNAME, _T(""), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, Framework::Win32::CRect(0, 0, 640, 480), NULL, NULL); SetClassPtr(); SetMenu(LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_DEBUGGER))); CreateClient(NULL); //Show(SW_MAXIMIZE); //ELF View Initialization m_pELFView = new CELFView(m_pMDIClient->m_hWnd); m_pELFView->Show(SW_HIDE); //Functions View Initialization m_pFunctionsView = new CFunctionsView(m_pMDIClient->m_hWnd); m_pFunctionsView->Show(SW_HIDE); m_pFunctionsView->OnFunctionDblClick.connect(boost::bind(&CDebugger::OnFunctionsViewFunctionDblClick, this, _1)); m_pFunctionsView->OnFunctionsStateChange.connect(boost::bind(&CDebugger::OnFunctionsViewFunctionsStateChange, this)); //Threads View Initialization m_threadsView = new CThreadsViewWnd(m_pMDIClient->m_hWnd, m_virtualMachine); m_threadsView->Show(SW_HIDE); m_threadsView->OnGotoAddress.connect(boost::bind(&CDebugger::OnThreadsViewAddressDblClick, this, _1)); //Find Callers View Initialization m_findCallersView = new CFindCallersViewWnd(m_pMDIClient->m_hWnd); m_findCallersView->Show(SW_HIDE); m_findCallersView->AddressSelected.connect([&] (uint32 address) { OnFindCallersAddressDblClick(address); }); //Debug Views Initialization m_nCurrentView = -1; memset(m_pView, 0, sizeof(m_pView)); m_pView[DEBUGVIEW_EE] = new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_ee->m_EE, std::bind(&CPS2VM::StepEe, &m_virtualMachine), m_virtualMachine.m_ee->m_os, "EmotionEngine"); m_pView[DEBUGVIEW_VU0] = new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_ee->m_VU0, std::bind(&CPS2VM::StepVu0, &m_virtualMachine), nullptr, "Vector Unit 0", CDisAsmWnd::DISASM_VU); m_pView[DEBUGVIEW_VU1] = new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_ee->m_VU1, std::bind(&CPS2VM::StepVu1, &m_virtualMachine), nullptr, "Vector Unit 1", CDisAsmWnd::DISASM_VU); m_pView[DEBUGVIEW_IOP] = new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_iop->m_cpu, std::bind(&CPS2VM::StepIop, &m_virtualMachine), m_virtualMachine.m_iopOs.get(), "IO Processor"); m_virtualMachine.m_ee->m_os->OnExecutableChange.connect(boost::bind(&CDebugger::OnExecutableChange, this)); m_virtualMachine.m_ee->m_os->OnExecutableUnloading.connect(boost::bind(&CDebugger::OnExecutableUnloading, this)); ActivateView(DEBUGVIEW_EE); LoadSettings(); if(GetDisassemblyWindow()->IsVisible()) { GetDisassemblyWindow()->SetFocus(); } CreateAccelerators(); }