DXWindow::DXWindow(UINT width, UINT height, std::wstring name): width(width), height(height), useWarpDevice(false) { ParseCommandLineArgs(); title = name + (useWarpDevice ? L" (WARP)" : L""); WCHAR nassetsPath[512]; GetAssetsPath(nassetsPath, _countof(nassetsPath)); assetsPath = nassetsPath; aspectRatio = static_cast<float>(width) / static_cast<float>(height); }
bool WabbitemuApp::OnInit() { wxImage::AddHandler(new wxPNGHandler); //stolen from the windows version ParseCommandLineArgs(); memset(frames, 0, sizeof(frames)); LPCALC lpCalc = calc_slot_new(); LoadSettings(lpCalc); WabbitemuFrame *frame; int result = rom_load(lpCalc, lpCalc->rom_path); if (result == TRUE) { frame = gui_frame(lpCalc); } else { calc_slot_free(lpCalc); BOOL loadedRom = FALSE; if (parsedArgs.num_rom_files > 0) { for (int i = 0; i < parsedArgs.num_rom_files; i++) { if (rom_load(lpCalc, parsedArgs.rom_files[i])) { gui_frame(lpCalc); loadedRom = TRUE; break; } } } if (!loadedRom) { bool success = DoRomWizard(); if (!success) { return FALSE; } } } LoadCommandlineFiles((INT_PTR) lpCalc, LoadToLPCALC); timer = new wxTimer(); timer->Connect(wxEVT_TIMER, (wxObjectEventFunction) &WabbitemuApp::OnTimer); timer->Start(TPF, false); return TRUE; }
void NET_WaitForLaunch(void) { if (!TXT_Init()) { fprintf(stderr, "Failed to initialize GUI\n"); exit(-1); } I_InitWindowIcon(); ParseCommandLineArgs(); OpenWaitDialog(); had_warning = false; while (net_waiting_for_launch) { UpdateGUI(); CheckAutoLaunch(); CheckSHA1Sums(); CheckMasterStatus(); TXT_DispatchEvents(); TXT_DrawDesktop(); NET_CL_Run(); NET_SV_Run(); if (!net_client_connected) { I_Error("Lost connection to server"); } TXT_Sleep(100); } TXT_Shutdown(); }
qtDLGNanomite::qtDLGNanomite(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags), m_IsRestart(false) { setupUi(this); setAcceptDrops(true); QApplication::setStyle(new QPlastiqueStyle); QFontDatabase::addApplicationFont(":/Fonts/Fonts/consola.ttf"); this->setStyleSheet(clsHelperClass::LoadStyleSheet()); qRegisterMetaType<DWORD>("DWORD"); qRegisterMetaType<quint64>("quint64"); qRegisterMetaType<BPStruct>("BPStruct"); qRegisterMetaType<HANDLE>("HANDLE"); clsAPIImport::LoadFunctions(); coreBPManager = new clsBreakpointManager; coreDebugger = new clsDebugger(coreBPManager); coreDisAs = new clsDisassembler; PEManager = new clsPEManager; dlgDetInfo = new qtDLGDetailInfo(this,Qt::Window); dlgDbgStr = new qtDLGDebugStrings(this,Qt::Window); dlgBPManager = new qtDLGBreakPointManager(this,Qt::Window); dlgTraceWindow = new qtDLGTrace(this,Qt::Window); dlgPatchManager = new qtDLGPatchManager(this,Qt::Window); dlgBookmark = new qtDLGBookmark(this, Qt::Window); qtNanomiteDisAsColor = new qtNanomiteDisAsColorSettings; qtDLGMyWindow = this; lExceptionCount = 0; LoadWidgets(); settings->CheckIfFirstRun(); settings->LoadDebuggerSettings(coreDebugger); settings->LoadDisassemblerColor(qtNanomiteDisAsColor); settings->LoadRecentDebuggedFiles(m_recentDebuggedFiles); LoadRecentFileMenu(true); DisAsGUI = new qtDLGDisassembler(this); this->setCentralWidget(DisAsGUI); // Callbacks from Debugger Thread to GUI connect(coreDebugger,SIGNAL(OnThread(DWORD,DWORD,quint64,bool,DWORD,bool)), dlgDetInfo,SLOT(OnThread(DWORD,DWORD,quint64,bool,DWORD,bool)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnPID(DWORD,QString,DWORD,quint64,bool)), dlgDetInfo,SLOT(OnPID(DWORD,QString,DWORD,quint64,bool)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnException(QString,QString,quint64,quint64,DWORD,DWORD)), dlgDetInfo,SLOT(OnException(QString,QString,quint64,quint64,DWORD,DWORD)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDbgString(QString,DWORD)), dlgDbgStr,SLOT(OnDbgString(QString,DWORD)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDll(QString,DWORD,quint64,bool)), dlgDetInfo,SLOT(OnDll(QString,DWORD,quint64,bool)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnLog(QString)), logView,SLOT(OnLog(QString)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(AskForException(DWORD)),this,SLOT(AskForException(DWORD)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDebuggerBreak()),this,SLOT(OnDebuggerBreak()),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnDebuggerTerminated()),this,SLOT(OnDebuggerTerminated()),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),dlgBPManager,SLOT(UpdateCompleter(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),dlgBookmark,SLOT(UpdateBookmarks(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(UpdateOffsetsPatches(HANDLE,int)),dlgPatchManager,SLOT(UpdateOffsetPatch(HANDLE,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(UpdateOffsetsPatches(HANDLE,int)),dlgBookmark,SLOT(BookmarkUpdateOffsets(HANDLE,int)),Qt::QueuedConnection); connect(coreBPManager,SIGNAL(OnBreakpointAdded(BPStruct,int)),dlgBPManager,SLOT(OnUpdate(BPStruct,int)),Qt::QueuedConnection); connect(coreBPManager,SIGNAL(OnBreakpointDeleted(quint64)),dlgBPManager,SLOT(OnDelete(quint64)),Qt::QueuedConnection); // Callbacks from Debugger to PEManager connect(coreDebugger,SIGNAL(OnNewPID(QString,int)),PEManager,SLOT(InsertPIDForFile(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(DeletePEManagerObject(QString,int)),PEManager,SLOT(CloseFile(QString,int)),Qt::QueuedConnection); connect(coreDebugger,SIGNAL(CleanPEManager()),PEManager,SLOT(CleanPEManager()),Qt::QueuedConnection); // Actions for the MainMenu and Toolbar connect(actionFile_OpenNew, SIGNAL(triggered()), this, SLOT(action_FileOpenNewFile())); connect(actionFile_AttachTo, SIGNAL(triggered()), this, SLOT(action_FileAttachTo())); connect(actionFile_Detach, SIGNAL(triggered()), this, SLOT(action_FileDetach())); connect(actionFile_Exit, SIGNAL(triggered()), this, SLOT(action_FileTerminateGUI())); connect(actionFile_Load, SIGNAL(triggered()), this, SLOT(action_FileLoad())); connect(actionFile_Save, SIGNAL(triggered()), this, SLOT(action_FileSave())); connect(actionDebug_Start, SIGNAL(triggered()), this, SLOT(action_DebugStart())); connect(actionDebug_Stop, SIGNAL(triggered()), this, SLOT(action_DebugStop())); connect(actionDebug_Restart, SIGNAL(triggered()), this, SLOT(action_DebugRestart())); connect(actionDebug_Suspend, SIGNAL(triggered()), this, SLOT(action_DebugSuspend())); connect(actionDebug_Step_In, SIGNAL(triggered()), this, SLOT(action_DebugStepIn())); connect(actionDebug_Step_Out, SIGNAL(triggered()), this, SLOT(action_DebugStepOut())); connect(actionDebug_Step_Over, SIGNAL(triggered()), this, SLOT(action_DebugStepOver())); connect(actionOptions_About, SIGNAL(triggered()), this, SLOT(action_OptionsAbout())); connect(actionOptions_Options, SIGNAL(triggered()), this, SLOT(action_OptionsOptions())); connect(actionOptions_Update, SIGNAL(triggered()), this, SLOT(action_OptionsUpdate())); connect(actionWindow_Detail_Information, SIGNAL(triggered()), this, SLOT(action_WindowDetailInformation())); connect(actionWindow_Breakpoint_Manager, SIGNAL(triggered()), this, SLOT(action_WindowBreakpointManager())); connect(actionWindow_Show_Patches, SIGNAL(triggered()), this, SLOT(action_WindowPatches())); connect(actionWindow_Show_Memory, SIGNAL(triggered()), this, SLOT(action_WindowShowMemory())); connect(actionWindow_Show_Heap, SIGNAL(triggered()), this, SLOT(action_WindowShowHeap())); connect(actionWindow_Show_Strings, SIGNAL(triggered()), this, SLOT(action_WindowShowStrings())); connect(actionWindow_Show_Debug_Output, SIGNAL(triggered()), this, SLOT(action_WindowShowDebugOutput())); connect(actionWindow_Show_Handles, SIGNAL(triggered()), this, SLOT(action_WindowShowHandles())); connect(actionWindow_Show_Windows, SIGNAL(triggered()), this, SLOT(action_WindowShowWindows())); connect(actionWindow_Show_Functions, SIGNAL(triggered()), this, SLOT(action_WindowShowFunctions())); connect(actionWindow_Show_Privileges, SIGNAL(triggered()), this, SLOT(action_WindowShowPrivileges())); connect(actionWindow_Show_Bookmarks, SIGNAL(triggered()), this, SLOT(action_WindowShowBookmarks())); connect(action_Debug_Run_to_UserCode,SIGNAL(triggered()), this, SLOT(action_DebugRunToUserCode())); connect(actionDebug_Trace_Start, SIGNAL(triggered()), this, SLOT(action_DebugTraceStart())); connect(actionDebug_Trace_Stop, SIGNAL(triggered()), this, SLOT(action_DebugTraceStop())); connect(actionDebug_Trace_Show, SIGNAL(triggered()), this, SLOT(action_DebugTraceShow())); connect(actionWindow_Show_PEEditor, SIGNAL(triggered()), this, SLOT(action_WindowShowPEEditor())); // Callbacks to display disassembly connect(dlgTraceWindow,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(cpuRegView,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(dlgDetInfo,SIGNAL(ShowInDisassembler(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(coreDisAs,SIGNAL(DisAsFinished(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64)),Qt::QueuedConnection); connect(dlgBPManager,SIGNAL(OnDisplayDisassembly(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); connect(dlgBookmark,SIGNAL(ShowInDisassembler(quint64)),DisAsGUI,SLOT(OnDisplayDisassembly(quint64))); // Callbacks from PatchManager to GUI connect(dlgPatchManager,SIGNAL(OnReloadDebugger()),this,SLOT(OnDebuggerBreak())); // Callbacks from Disassembler GUI to GUI connect(DisAsGUI,SIGNAL(OnDebuggerBreak()),this,SLOT(OnDebuggerBreak())); // Callbacks to StateBar connect(dlgTraceWindow,SIGNAL(OnUpdateStatusBar(int,quint64)),this,SLOT(UpdateStateBar(int,quint64))); actionDebug_Trace_Stop->setDisabled(true); ParseCommandLineArgs(); }
//-------------------------------------------------------------------------------------------------- LE_SHARED void* le_comm_Create ( const int argc, ///< [IN] Number of strings pointed to by argv. const char *argv[], ///< [IN] Pointer to an array of character strings. le_result_t* resultPtr ///< [OUT] Return Code ) { // // Create Connection Socket // // Verify result pointer is valid if (resultPtr == NULL) { LE_ERROR("resultPtr is NULL"); return NULL; } if (!le_hashmap_isEmpty(HandleRecordByFileDescriptor)) { LE_ERROR("Sanity Check Failure: Hashmap is not empty"); *resultPtr = LE_FAULT; return NULL; } // Parse the Command Line arguments to extract the IP Address and TCP Port number *resultPtr = ParseCommandLineArgs(argc, argv); if (*resultPtr != LE_OK) { return NULL; } HandleRecord_t* connectionRecordPtr = le_mem_AssertAlloc(HandleRecordPoolRef); // Initialize the connection record connectionRecordPtr->fd = -1; connectionRecordPtr->isListeningFd = false; connectionRecordPtr->parentRecordPtr = NULL; // Create the socket connectionRecordPtr->fd = socket(AF_INET, SOCK_STREAM, 0); if (connectionRecordPtr->fd < 0) { LE_WARN("Failed to create AF_INET socket. Errno = %d", errno); // Set the result pointer with a fault code *resultPtr = LE_FAULT; connectionRecordPtr->fd = -1; return (connectionRecordPtr); } #ifdef SOCKET_SERVER struct sockaddr_in sockAddr; // Prepare the sockaddr_in structure sockAddr.sin_family = AF_INET; sockAddr.sin_addr.s_addr = INADDR_ANY; sockAddr.sin_port = htons(NetworkSocketTCPListeningPort); // Bind if (bind(connectionRecordPtr->fd, (struct sockaddr *)&sockAddr, sizeof(sockAddr)) < 0) { LE_WARN("Failed to bind socket, fd %d, result = %d", connectionRecordPtr->fd, errno); // Close the Socket handle close(connectionRecordPtr->fd); connectionRecordPtr->fd = -1; // Set the result pointer with a fault code *resultPtr = LE_FAULT; return (connectionRecordPtr); } // Listen if (listen(connectionRecordPtr->fd, NETWORK_SOCKET_MAX_CONNECT_REQUEST_BACKLOG) != 0) { LE_WARN("Server socket listen() call failed with errno %d", errno); } LE_INFO("Registering handle_monitor callback"); char socketName[80]; snprintf(socketName, sizeof(socketName) - 1, "inetSocket-%d", connectionRecordPtr->fd); // Create thread to monitor FD handle for activity, as defined by the events ListeningFdMonitorRef = le_fdMonitor_Create(socketName, connectionRecordPtr->fd, (le_fdMonitor_HandlerFunc_t) &ListeningRecvHandler, POLLIN); // Flag as a listening socket connectionRecordPtr->isListeningFd = true; LE_INFO("Successfully registered listening callback function, events [0x%x]", POLLIN); #endif LE_INFO("Created AF_INET Socket, fd %d", connectionRecordPtr->fd); // Set the return code to reflect if client can proceed with connect call, or whether it needs to // wait for asynchronous connection #ifdef SOCKET_SERVER *resultPtr = LE_IN_PROGRESS; #else *resultPtr = LE_OK; #endif // Store the Handle record le_hashmap_Put(HandleRecordByFileDescriptor, (void*)(intptr_t) connectionRecordPtr->fd, connectionRecordPtr); return (connectionRecordPtr); }