1
0
Fork 0

DBG: added plugreload command

This commit is contained in:
mrexodia 2017-08-17 23:54:19 +02:00
parent 8c797ef42d
commit ca296699b0
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
6 changed files with 32 additions and 13 deletions

View File

@ -49,16 +49,27 @@ bool cbInstrPluginLoad(int argc, char* argv[])
{
if(IsArgumentsLessThan(argc, 2))
return false;
if(pluginload(argv[1]))
return true;
return false;
return pluginload(argv[1]);
}
bool cbInstrPluginUnload(int argc, char* argv[])
{
if(IsArgumentsLessThan(argc, 2))
return false;
if(pluginunload(argv[1]))
return true;
return false;
return pluginunload(argv[1]);
}
bool cbInstrPluginReload(int argc, char* argv[])
{
if(IsArgumentsLessThan(argc, 2))
return false;
if(!pluginunload(argv[1]))
return false;
if(argc <= 2)
{
auto text = StringUtils::Utf8ToUtf16(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Press OK to reload the plugin...")));
auto title = StringUtils::Utf8ToUtf16(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Reload")));
MessageBoxW(GuiGetWindowHandle(), text.c_str(), title.c_str(), 0);
}
return pluginload(argv[1]);
}

View File

@ -4,4 +4,5 @@
bool cbDebugStartScylla(int argc, char* argv[]);
bool cbInstrPluginLoad(int argc, char* argv[]);
bool cbInstrPluginUnload(int argc, char* argv[]);
bool cbInstrPluginUnload(int argc, char* argv[]);
bool cbInstrPluginReload(int argc, char* argv[]);

View File

@ -451,9 +451,14 @@ String StringUtils::ToLower(const String & s)
return result;
}
bool StringUtils::StartsWith(const String & h, const String & n)
bool StringUtils::StartsWith(const String & str, const String & prefix)
{
return strstr(h.c_str(), n.c_str()) == h.c_str();
return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix);
}
bool StringUtils::EndsWith(const String & str, const String & suffix)
{
return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix);
}
static int hex2int(char ch)

View File

@ -38,7 +38,8 @@ public:
static WString vsprintf(_In_z_ _Printf_format_string_ const wchar_t* format, va_list args);
static WString sprintf(_In_z_ _Printf_format_string_ const wchar_t* format, ...);
static String ToLower(const String & s);
static bool StartsWith(const String & h, const String & n);
static bool StartsWith(const String & str, const String & prefix);
static bool EndsWith(const String & str, const String & suffix);
static bool FromHex(const String & text, std::vector<unsigned char> & data, bool reverse = false);
static String ToHex(unsigned long long value);
static String ToHex(unsigned char* buffer, size_t size, bool reverse = false);

View File

@ -369,6 +369,7 @@ static void registercommands()
dbgcmdnew("StartScylla,scylla,imprec", cbDebugStartScylla, false); //start scylla
dbgcmdnew("plugload,pluginload,loadplugin", cbInstrPluginLoad, false); //load plugin
dbgcmdnew("plugunload,pluginunload,unloadplugin", cbInstrPluginUnload, false); //unload plugin
dbgcmdnew("plugreload,plugunreload,reloadplugin", cbInstrPluginReload, false); //reload plugin
//script
dbgcmdnew("scriptload", cbScriptLoad, false);

View File

@ -274,7 +274,7 @@ void StdTable::addColumnAt(int width, QString title, bool isClickable, QString c
AbstractTableView::addColumnAt(width, title, isClickable, sortFn);
//append empty column to list of rows
for(int i = 0; i < mData.size(); i++)
for(size_t i = 0; i < mData.size(); i++)
mData[i].push_back(CellData());
//Append copy title
@ -335,9 +335,9 @@ duint StdTable::getCellUserdata(int r, int c)
bool StdTable::isValidIndex(int r, int c)
{
if(r < 0 || c < 0 || r >= mData.size())
if(r < 0 || c < 0 || r >= int(mData.size()))
return false;
return c < mData.at(r).size();
return c < int(mData.at(r).size());
}
void StdTable::copyLineSlot()