void Module::run() { enter(); _running = true; EventMan.enableKeyRepeat(); try { EventMan.flushEvents(); while (!EventMan.quitRequested() && !_exit && !_newArea.empty()) { replaceModule(); enterArea(); if (_exit) break; handleEvents(); if (!EventMan.quitRequested() && !_exit && !_newArea.empty()) EventMan.delay(10); } } catch (Common::Exception &e) { _running = false; e.add("Failed running module \"%s\"", _ifo.getName().getString().c_str()); throw e; } EventMan.enableKeyRepeat(0); _running = false; }
void Module::processEventQueue() { if (!isRunning()) return; replaceModule(); if (!isRunning()) return; handleEvents(); handleActions(); }
void Module::processEventQueue() { if (!isRunning()) return; replaceModule(); enterArea(); if (!isRunning()) return; handleEvents(); handleActions(); _ingameGUI->updatePartyMember(0, *_pc); }
static BOOL replaceImport(HMODULE hModule, const char *szModule, const char *pszDllName, HMODULE hNewModule) { if (NOOP) { return TRUE; } PIMAGE_IMPORT_DESCRIPTOR pImportDescriptor = getImportDescriptor(hModule, szModule, pszDllName); if (pImportDescriptor == NULL) { return TRUE; } replaceModule(hModule, szModule, pImportDescriptor, hNewModule); return TRUE; }
void Module::run() { enter(); _running = true; EventMan.enableKeyRepeat(); _ingameGUI->show(); try { EventMan.flushEvents(); while (!EventMan.quitRequested() && !_exit && !_newArea.empty()) { replaceModule(); enterArea(); if (_exit) break; handleEvents(); handleActions(); _ingameGUI->updatePartyMember(0, *_pc); if (!EventMan.quitRequested() && !_exit && !_newArea.empty()) EventMan.delay(10); } } catch (Common::Exception &e) { _running = false; e.add("Failed running module \"%s\"", _ifo.getName().getString().c_str()); throw e; } _ingameGUI->stopConversation(); _ingameGUI->hide(); EventMan.enableKeyRepeat(0); _running = false; }
bool RowStoreModel::changeContentModule(ContentModulePtr const &new_module) { return replaceModule(content_module_handle_, new_module) != modules().end(); }
void __cdecl FindSettings(LPVOID di) { char* text = ((FindInfo*)di)->text; char* replace = ((FindInfo*)di)->replace; int mode = ((FindInfo*)di)->mode; HWND hwnd = ((FindInfo*)di)->hwnd; HWND prnthwnd = GetParent(hwnd); int options = ((FindInfo*)di)->options; ModuleSettingLL ModuleList, SettingList; ModSetLinkLinkItem *module, *setting; HANDLE hContact; DBVARIANT dbv = { 0 }; int caseSensitive = options & FW_CASE; int exactMatch = options & FW_EXACT; int inModuleName = options & FW_MODNAME; int inSettingName = options & FW_SETNAME; int inSettingValue = options & FW_SETVAL; int foundCount = 0; int replaceCount = 0; char szTmp[128]; int settingValue, isNumber, NULLContactDone = 0; freeItems(hwnd); if (!text) return; if (!EnumModules(&ModuleList)) { msg(Translate("Error Loading Module List"), modFullname); mir_free(di); return; } SendMessage(GetDlgItem(GetParent(hwnd), IDC_SBAR), SB_SETTEXT, 0, (LPARAM)Translate("Searching...")); hContact = 0; isNumber = sscanf(text, "%d", &settingValue); while (GetWindowLongPtr(GetDlgItem(prnthwnd, IDC_SEARCH), GWLP_USERDATA)) { if (!hContact) { if (NULLContactDone) break; else { NULLContactDone = 1; hContact = db_find_first(); } } else hContact = db_find_next(hContact); module = ModuleList.first; while (module) { if (IsModuleEmpty(hContact, module->name)) { module = module->next; continue; } if (!EnumSettings(hContact, module->name, &SettingList)) { msg(Translate("Error Loading Setting List"), modFullname); mir_free(text); mir_free(di); FreeModuleSettingLL(&ModuleList); return; } setting = SettingList.first; // check in settings value while (setting) { if (inSettingValue) { dbv.type = 0; // check the setting value if (!GetSetting(hContact, module->name, setting->name, &dbv)) { switch (dbv.type) { case DBVT_UTF8: // no conversion atm case DBVT_ASCIIZ: if ((exactMatch && !(caseSensitive ? strcmp(dbv.pszVal, text) : strcmpi(dbv.pszVal, text))) || (!exactMatch && (caseSensitive ? strstr(dbv.pszVal, text) : StrStrI(dbv.pszVal, text)))) { if ((mode & RW_FOUND) || (mode & RW_SETVAL)) replaceCount += replaceValue(hwnd, hContact, module->name, setting->name, &dbv, text, replace, mode); else ItemFound(hwnd, hContact, module->name, setting->name, dbv.pszVal, FW_SETTINGVALUE); foundCount++; } break; case DBVT_BYTE: if (isNumber && settingValue == dbv.bVal) { if ((mode & RW_FOUND) || (mode & RW_SETVAL)) replaceCount += replaceValue(hwnd, hContact, module->name, setting->name, &dbv, NULL, replace, mode); else ItemFound(hwnd, hContact, module->name, setting->name, text, FW_SETTINGVALUE); foundCount++; } break; case DBVT_WORD: if (isNumber && settingValue == dbv.wVal) { if ((mode & RW_FOUND) || (mode & RW_SETVAL)) replaceCount += replaceValue(hwnd, hContact, module->name, setting->name, &dbv, NULL, replace, mode); else ItemFound(hwnd, hContact, module->name, setting->name, text, FW_SETTINGVALUE); foundCount++; } break; case DBVT_DWORD: if (isNumber && settingValue == (int)dbv.dVal) { if ((mode & RW_FOUND) || (mode & RW_SETVAL)) replaceCount += replaceValue(hwnd, hContact, module->name, setting->name, &dbv, NULL, replace, mode); else ItemFound(hwnd, hContact, module->name, setting->name, text, FW_SETTINGVALUE); foundCount++; } break; } db_free(&dbv); } } // check in setting name if (inSettingName) { if ((exactMatch && !(caseSensitive ? strcmp(setting->name, text) : strcmpi(setting->name, text))) || (!exactMatch && (caseSensitive ? StrStrI(setting->name, text) : StrStrI(setting->name, text)))) { if ((mode & RW_FOUND) || (mode & RW_SETNAME)) { if (!GetSetting(hContact, module->name, setting->name, &dbv)) { replaceCount += replaceSetting(hwnd, hContact, module->name, setting->name, &dbv, text, replace, mode); db_free(&dbv); } } else ItemFound(hwnd, hContact, module->name, setting->name, NULL, FW_SETTINGNAME); foundCount++; } } setting = (ModSetLinkLinkItem *)setting->next; } // check in module name if (inModuleName) { if ((exactMatch && !(caseSensitive ? strcmp(module->name, text) : strcmpi(module->name, text))) || (!exactMatch && (caseSensitive ? strstr(module->name, text) : StrStrI(module->name, text)))) { if ((mode & RW_FOUND) || (mode & RW_MODULE)) replaceCount += replaceModule(hwnd, hContact, module->name, text, replace, mode); else ItemFound(hwnd, hContact, module->name, 0, 0, FW_MODULE); foundCount++; } } FreeModuleSettingLL(&SettingList); module = (ModSetLinkLinkItem *)module->next; } } if (mode) { if (!replace[0]) mir_snprintf(szTmp, SIZEOF(szTmp), Translate("Finished. %d items were found, %d items were deleted."), foundCount, replaceCount); else mir_snprintf(szTmp, SIZEOF(szTmp), Translate("Finished. %d items were found, %d items were replaced."), foundCount, replaceCount); } else mir_snprintf(szTmp, SIZEOF(szTmp), Translate("Finished. %d items were found."), foundCount); SendMessage(GetDlgItem(prnthwnd, IDC_SBAR), SB_SETTEXT, 0, (LPARAM)szTmp); SetWindowLongPtr(GetDlgItem(prnthwnd, IDC_SEARCH), GWLP_USERDATA, 0); if (GetWindowLongPtr(GetDlgItem(prnthwnd, IDC_REPLACE), GWLP_USERDATA)) { SetWindowLongPtr(GetDlgItem(prnthwnd, IDC_REPLACE), GWLP_USERDATA, 0); EnableWindow(GetDlgItem(prnthwnd, IDC_SEARCH), 1); SetWindowText(GetDlgItem(prnthwnd, IDOK), Translate("&Replace")); } else { SetWindowText(GetDlgItem(prnthwnd, IDC_SEARCH), Translate("&Search")); EnableWindow(GetDlgItem(prnthwnd, IDOK), 1); } mir_free(replace); mir_free(text); mir_free(di); FreeModuleSettingLL(&ModuleList); EnableWindow(GetDlgItem(prnthwnd, IDCANCEL), 1); }