GUI: fixed GuiSelectionGet & GuiSelectionSet
This commit is contained in:
parent
92df7faea1
commit
8e76a108e2
|
@ -258,6 +258,10 @@ void Bridge::emitMenuClearMenu(int hMenu)
|
||||||
|
|
||||||
bool Bridge::emitSelectionGet(int hWindow, SELECTIONDATA* selection)
|
bool Bridge::emitSelectionGet(int hWindow, SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
|
if(!DbgIsDebugging())
|
||||||
|
return false;
|
||||||
|
mBridgeMutex.lock();
|
||||||
|
hasBridgeResult=false;
|
||||||
switch(hWindow)
|
switch(hWindow)
|
||||||
{
|
{
|
||||||
case GUI_DISASSEMBLY:
|
case GUI_DISASSEMBLY:
|
||||||
|
@ -270,13 +274,21 @@ bool Bridge::emitSelectionGet(int hWindow, SELECTIONDATA* selection)
|
||||||
emit selectionStackGet(selection);
|
emit selectionStackGet(selection);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
mBridgeMutex.unlock();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
while(!hasBridgeResult) //wait for thread completion
|
||||||
|
Sleep(100);
|
||||||
|
mBridgeMutex.unlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bridge::emitSelectionSet(int hWindow, const SELECTIONDATA* selection)
|
bool Bridge::emitSelectionSet(int hWindow, const SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
|
if(!DbgIsDebugging())
|
||||||
|
return false;
|
||||||
|
mBridgeMutex.lock();
|
||||||
|
hasBridgeResult=false;
|
||||||
switch(hWindow)
|
switch(hWindow)
|
||||||
{
|
{
|
||||||
case GUI_DISASSEMBLY:
|
case GUI_DISASSEMBLY:
|
||||||
|
@ -289,9 +301,13 @@ bool Bridge::emitSelectionSet(int hWindow, const SELECTIONDATA* selection)
|
||||||
emit selectionStackSet(selection);
|
emit selectionStackSet(selection);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
mBridgeMutex.unlock();
|
||||||
return false;
|
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;
|
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:
|
default:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,12 +683,24 @@ void CPUDisassembly::findStrings()
|
||||||
|
|
||||||
void CPUDisassembly::selectionGet(SELECTIONDATA* selection)
|
void CPUDisassembly::selectionGet(SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
selection->start=getSelectionStart();
|
selection->start=rvaToVa(getSelectionStart());
|
||||||
selection->end=getSelectionEnd();
|
selection->end=rvaToVa(getSelectionEnd());
|
||||||
|
Bridge::getBridge()->BridgeSetResult(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDisassembly::selectionSet(const SELECTIONDATA* selection)
|
void CPUDisassembly::selectionSet(const SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
setSingleSelection(selection->start);
|
int_t selMin=getBase();
|
||||||
expandSelectionUpTo(selection->end);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -585,12 +585,24 @@ void CPUDump::disassemblySlot()
|
||||||
|
|
||||||
void CPUDump::selectionGet(SELECTIONDATA* selection)
|
void CPUDump::selectionGet(SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
selection->start=getSelectionStart();
|
selection->start=getSelectionStart() + mBase;
|
||||||
selection->end=getSelectionEnd();
|
selection->end=getSelectionEnd() + mBase;
|
||||||
|
Bridge::getBridge()->BridgeSetResult(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUDump::selectionSet(const SELECTIONDATA* selection)
|
void CPUDump::selectionSet(const SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
setSingleSelection(selection->start);
|
int_t selMin=mBase;
|
||||||
expandSelectionUpTo(selection->end);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,12 +172,24 @@ void CPUStack::gotoExpressionSlot()
|
||||||
|
|
||||||
void CPUStack::selectionGet(SELECTIONDATA* selection)
|
void CPUStack::selectionGet(SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
selection->start=getSelectionStart();
|
selection->start=getSelectionStart() + mBase;
|
||||||
selection->end=getSelectionEnd();
|
selection->end=getSelectionEnd() + mBase;
|
||||||
|
Bridge::getBridge()->BridgeSetResult(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPUStack::selectionSet(const SELECTIONDATA* selection)
|
void CPUStack::selectionSet(const SELECTIONDATA* selection)
|
||||||
{
|
{
|
||||||
setSingleSelection(selection->start);
|
int_t selMin=mBase;
|
||||||
expandSelectionUpTo(selection->end);
|
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue