void CommandTable::Dump(void) { for(CommandList::iterator iter = m_commands.begin(); iter != m_commands.end(); ++iter) { _DMESSAGE("%08X %04X %s %s", iter->opcode, iter->needsParent, iter->longName, iter->shortName); gLog.Indent(); #if 0 for(UInt32 i = 0; i < iter->numParams; i++) { ParamInfo * param = &iter->params[i]; _DMESSAGE("%08X %08X %s", param->typeID, param->isOptional, param->typeStr); } #endif gLog.Outdent(); } }
bool BoundItemMgefHandler::DialogMessageCallback(HWND dialog, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& result) { HWND ctl; // parse message switch (uMsg) { case WM_USERCOMMAND: case WM_COMMAND: { UInt32 commandCode = HIWORD(wParam); switch (LOWORD(wParam)) // switch on control id { case IDC_SMBO_USEWEAPON: // Armor/Weapon toggle case IDC_SMBO_USEARMOR: { if (commandCode == BN_CLICKED) { _VMESSAGE("Weapon/Armor toggle clicked"); bool clicked = false; // weapon ctl = GetDlgItem(dialog,IDC_SMBO_WEAPON); clicked = IsDlgButtonChecked(dialog,IDC_SMBO_USEWEAPON); EnableWindow(ctl,clicked); _DMESSAGE("Setting Weap sel to %08X", clicked ? parentEffect.mgefParam : 0); TESComboBox::SetCurSelByData(ctl, clicked ? TESForm::LookupByFormID(parentEffect.mgefParam) : 0); // armor ctl = GetDlgItem(dialog,IDC_SMBO_ARMOR); clicked = IsDlgButtonChecked(dialog,IDC_SMBO_USEARMOR); EnableWindow(ctl,clicked); _DMESSAGE("Setting Armo sel to %08X", clicked ? parentEffect.mgefParam : 0); TESComboBox::SetCurSelByData(ctl, clicked ? TESForm::LookupByFormID(parentEffect.mgefParam) : 0); // result = 0; return true; // retval = false signals command handled } break; } } } } return false; }
// CSE command parsing void CSEPrintCallback(const char* message, const char* prefix) {/* Called whenever output is provided to CSE console, if present Commands recognized by this parser take the form 'solutionName commandName [args...]' */ char buffer[0x200]; strcpy_s(buffer,sizeof(buffer),message); char* context = 0; if (!message || _stricmp(strtok_s(const_cast<char*>(buffer)," \t",&context),SOLUTIONNAME) != 0) return; // output is not a command targeted to this plugin const char* command = strtok_s(0," \t",&context); // extract command name using strtok() _DMESSAGE("%s %s %s",prefix,buffer,command); if (!command) return; const char* argA = strtok_s(0," \t",&context); // extract 1st arg, if present const char* argB = strtok_s(0," \t",&context); // extract 2nd arg, if present const char* argC = strtok_s(0," \t",&context); // extract 3rd arg, if present if (_stricmp(command,"Description") == 0) // 'Description' command { _MESSAGE("%s",g_submoduleInfc->Description()); } else if (_stricmp(command,"ListMyForms") == 0) // 'ListMyForms' command { g_submoduleInfc->ListMyForms(); } }
void SubmoduleInterface::COEFTest(TESObjectREFR* thisObj, const char* argA, const char* argB, const char* argC) {// this is a stub, just to demonstrate the concept of a general interface function BSStringT desc; if (thisObj) thisObj->GetDebugDescription(desc); _DMESSAGE("Test command on <%p> '%s' w/ args A='%s' B='%s' C='%s'",thisObj,desc.c_str(),argA,argB,argC); }