1
0
Fork 0

GUI: fixed GuiSelectionGet & GuiSelectionSet

This commit is contained in:
Mr. eXoDia 2014-05-02 18:40:00 +02:00
parent 92df7faea1
commit 8e76a108e2
4 changed files with 77 additions and 13 deletions

View File

@ -258,6 +258,10 @@ void Bridge::emitMenuClearMenu(int hMenu)
bool Bridge::emitSelectionGet(int hWindow, SELECTIONDATA* selection)
{
if(!DbgIsDebugging())
return false;
mBridgeMutex.lock();
hasBridgeResult=false;
switch(hWindow)
{
case GUI_DISASSEMBLY:
@ -270,13 +274,21 @@ bool Bridge::emitSelectionGet(int hWindow, SELECTIONDATA* selection)
emit selectionStackGet(selection);
break;
default:
mBridgeMutex.unlock();
return false;
}
while(!hasBridgeResult) //wait for thread completion
Sleep(100);
mBridgeMutex.unlock();
return true;
}
bool Bridge::emitSelectionSet(int hWindow, const SELECTIONDATA* selection)
{
if(!DbgIsDebugging())
return false;
mBridgeMutex.lock();
hasBridgeResult=false;
switch(hWindow)
{
case GUI_DISASSEMBLY:
@ -289,9 +301,13 @@ bool Bridge::emitSelectionSet(int hWindow, const SELECTIONDATA* selection)
emit selectionStackSet(selection);
break;
default:
mBridgeMutex.unlock();
return false;
}
return true;
while(!hasBridgeResult) //wait for thread completion
Sleep(100);
mBridgeMutex.unlock();
return bridgeResult;
}
/************************************************************************************
@ -587,6 +603,18 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
}
break;
case GUI_SELECTION_GET:
{
Bridge::getBridge()->emitSelectionGet((int)(uint_t)param1, (SELECTIONDATA*)param2);
}
break;
case GUI_SELECTION_SET:
{
Bridge::getBridge()->emitSelectionSet((int)(uint_t)param1, (const SELECTIONDATA*)param2);
}
break;
default:
{
}

View File

@ -683,12 +683,24 @@ void CPUDisassembly::findStrings()
void CPUDisassembly::selectionGet(SELECTIONDATA* selection)
{
selection->start=getSelectionStart();
selection->end=getSelectionEnd();
selection->start=rvaToVa(getSelectionStart());
selection->end=rvaToVa(getSelectionEnd());
Bridge::getBridge()->BridgeSetResult(1);
}
void CPUDisassembly::selectionSet(const SELECTIONDATA* selection)
{
setSingleSelection(selection->start);
expandSelectionUpTo(selection->end);
int_t selMin=getBase();
int_t selMax=selMin + getSize();
int_t start=selection->start;
int_t end=selection->end;
if(start < selMin || start >= selMax || end < selMin || end >= selMax) //selection out of range
{
Bridge::getBridge()->BridgeSetResult(0);
return;
}
setSingleSelection(start - selMin);
expandSelectionUpTo(end - selMin);
reloadData();
Bridge::getBridge()->BridgeSetResult(1);
}

View File

@ -585,12 +585,24 @@ void CPUDump::disassemblySlot()
void CPUDump::selectionGet(SELECTIONDATA* selection)
{
selection->start=getSelectionStart();
selection->end=getSelectionEnd();
selection->start=getSelectionStart() + mBase;
selection->end=getSelectionEnd() + mBase;
Bridge::getBridge()->BridgeSetResult(1);
}
void CPUDump::selectionSet(const SELECTIONDATA* selection)
{
setSingleSelection(selection->start);
expandSelectionUpTo(selection->end);
int_t selMin=mBase;
int_t selMax=selMin + mSize;
int_t start=selection->start;
int_t end=selection->end;
if(start < selMin || start >= selMax || end < selMin || end >= selMax) //selection out of range
{
Bridge::getBridge()->BridgeSetResult(0);
return;
}
setSingleSelection(start - selMin);
expandSelectionUpTo(end - selMin);
reloadData();
Bridge::getBridge()->BridgeSetResult(1);
}

View File

@ -172,12 +172,24 @@ void CPUStack::gotoExpressionSlot()
void CPUStack::selectionGet(SELECTIONDATA* selection)
{
selection->start=getSelectionStart();
selection->end=getSelectionEnd();
selection->start=getSelectionStart() + mBase;
selection->end=getSelectionEnd() + mBase;
Bridge::getBridge()->BridgeSetResult(1);
}
void CPUStack::selectionSet(const SELECTIONDATA* selection)
{
setSingleSelection(selection->start);
expandSelectionUpTo(selection->end);
int_t selMin=mBase;
int_t selMax=selMin + mSize;
int_t start=selection->start;
int_t end=selection->end;
if(start < selMin || start >= selMax || end < selMin || end >= selMax) //selection out of range
{
Bridge::getBridge()->BridgeSetResult(0);
return;
}
setSingleSelection(start - selMin);
expandSelectionUpTo(end - selMin);
reloadData();
Bridge::getBridge()->BridgeSetResult(1);
}