mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Add a dialog to enter a jit compare address.
For now, requires buttons.
This commit is contained in:
parent
a29f1a9192
commit
2808c288ea
@ -273,7 +273,53 @@ void SystemInfoScreen::CreateViews() {
|
||||
}
|
||||
}
|
||||
|
||||
void AddressPromptScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
addrView_ = new UI::TextView("Enter address", ALIGN_HCENTER, false);
|
||||
parent->Add(addrView_);
|
||||
}
|
||||
|
||||
void AddressPromptScreen::OnCompleted(DialogResult result) {
|
||||
if (result == DR_OK) {
|
||||
UI::EventParams e;
|
||||
e.v = root_;
|
||||
e.a = addr_;
|
||||
OnChoice.Trigger(e);
|
||||
}
|
||||
}
|
||||
|
||||
void AddressPromptScreen::key(const KeyInput &key) {
|
||||
int nextDigit = -1;
|
||||
if (key.flags & KEY_DOWN) {
|
||||
if (key.keyCode >= NKCODE_0 && key.keyCode <= NKCODE_9) {
|
||||
nextDigit = key.keyCode - NKCODE_0;
|
||||
} else if (key.keyCode >= NKCODE_A && key.keyCode <= NKCODE_F) {
|
||||
nextDigit = 10 + key.keyCode - NKCODE_A;
|
||||
// NKCODE_DEL is backspace.
|
||||
} else if (key.keyCode == NKCODE_DEL) {
|
||||
addr_ /= 16;
|
||||
} else if (key.keyCode == NKCODE_ENTER) {
|
||||
OnCompleted(DR_OK);
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
return;
|
||||
} else {
|
||||
UIDialogScreen::key(key);
|
||||
}
|
||||
} else {
|
||||
UIDialogScreen::key(key);
|
||||
}
|
||||
|
||||
if (nextDigit != -1 && (addr_ & 0xF0000000) == 0) {
|
||||
addr_ = addr_ * 16 + nextDigit;
|
||||
}
|
||||
|
||||
if (addr_ != 0) {
|
||||
char temp[32];
|
||||
snprintf(temp, 32, "%8X", addr_);
|
||||
addrView_->SetText(temp);
|
||||
} else {
|
||||
addrView_->SetText("Enter address");
|
||||
}
|
||||
}
|
||||
|
||||
// Three panes: Block chooser, MIPS view, ARM/x86 view
|
||||
void JitCompareScreen::CreateViews() {
|
||||
@ -297,6 +343,7 @@ void JitCompareScreen::CreateViews() {
|
||||
rightDisasm_->SetSpacing(0.0f);
|
||||
|
||||
leftColumn->Add(new Choice("Current"))->OnClick.Handle(this, &JitCompareScreen::OnCurrentBlock);
|
||||
leftColumn->Add(new Choice("By Address"))->OnClick.Handle(this, &JitCompareScreen::OnSelectBlock);
|
||||
leftColumn->Add(new Choice("Random"))->OnClick.Handle(this, &JitCompareScreen::OnRandomBlock);
|
||||
leftColumn->Add(new Choice("Random VFPU"))->OnClick.Handle(this, &JitCompareScreen::OnRandomVFPUBlock);
|
||||
leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
@ -373,6 +420,24 @@ void JitCompareScreen::UpdateDisasm() {
|
||||
#endif
|
||||
}
|
||||
|
||||
UI::EventReturn JitCompareScreen::OnSelectBlock(UI::EventParams &e) {
|
||||
auto addressPrompt = new AddressPromptScreen("Block address");
|
||||
addressPrompt->OnChoice.Handle(this, &JitCompareScreen::OnBlockAddress);
|
||||
screenManager()->push(addressPrompt);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn JitCompareScreen::OnBlockAddress(UI::EventParams &e) {
|
||||
JitBlockCache *blockCache = MIPSComp::jit->GetBlockCache();
|
||||
if (Memory::IsValidAddress(e.a)) {
|
||||
currentBlock_ = blockCache->GetBlockNumberFromStartAddress(e.a);
|
||||
} else {
|
||||
currentBlock_ = -1;
|
||||
}
|
||||
UpdateDisasm();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn JitCompareScreen::OnRandomBlock(UI::EventParams &e) {
|
||||
JitBlockCache *blockCache = MIPSComp::jit->GetBlockCache();
|
||||
int numBlocks = blockCache->GetNumBlocks();
|
||||
|
@ -69,6 +69,23 @@ public:
|
||||
virtual void CreateViews();
|
||||
};
|
||||
|
||||
class AddressPromptScreen : public PopupScreen {
|
||||
public:
|
||||
AddressPromptScreen(const std::string &title) : PopupScreen(title, "OK", "Cancel"), addrView_(NULL), addr_(0) {
|
||||
}
|
||||
|
||||
virtual void key(const KeyInput &key);
|
||||
|
||||
UI::Event OnChoice;
|
||||
|
||||
protected:
|
||||
void CreatePopupContents(UI::ViewGroup *parent);
|
||||
virtual void OnCompleted(DialogResult result);
|
||||
|
||||
UI::TextView *addrView_;
|
||||
unsigned int addr_;
|
||||
};
|
||||
|
||||
class JitCompareScreen : public UIDialogScreenWithBackground {
|
||||
public:
|
||||
JitCompareScreen() : currentBlock_(-1) {}
|
||||
@ -79,6 +96,8 @@ private:
|
||||
UI::EventReturn OnRandomBlock(UI::EventParams &e);
|
||||
UI::EventReturn OnRandomVFPUBlock(UI::EventParams &e);
|
||||
UI::EventReturn OnCurrentBlock(UI::EventParams &e);
|
||||
UI::EventReturn OnSelectBlock(UI::EventParams &e);
|
||||
UI::EventReturn OnBlockAddress(UI::EventParams &e);
|
||||
|
||||
int currentBlock_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user