CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/JitCompareScreen.h
Views: 1401
1
#pragma once
2
#include "Common/UI/UIScreen.h"
3
#include "UI/MiscScreens.h"
4
5
class JitCompareScreen : public UIDialogScreenWithBackground {
6
public:
7
JitCompareScreen();
8
void CreateViews() override;
9
10
const char *tag() const override { return "JitCompare"; }
11
12
private:
13
void Flip();
14
void UpdateDisasm();
15
16
// Uses the current ListType
17
void FillBlockList();
18
19
UI::LinearLayout *comparisonView_;
20
UI::LinearLayout *leftDisasm_;
21
UI::LinearLayout *rightDisasm_;
22
23
UI::LinearLayout *blockListView_;
24
UI::LinearLayout *blockListContainer_;
25
26
UI::LinearLayout *statsView_;
27
UI::LinearLayout *statsContainer_;
28
29
UI::EventReturn OnSelectBlock(UI::EventParams &e);
30
UI::EventReturn OnBlockAddress(UI::EventParams &e);
31
UI::EventReturn OnAddressChange(UI::EventParams &e);
32
UI::EventReturn OnShowStats(UI::EventParams &e);
33
UI::EventReturn OnBlockClick(UI::EventParams &e);
34
35
// To switch, change the below things and call RecreateViews();
36
enum class ViewMode {
37
BLOCK_LIST,
38
DISASM,
39
STATS,
40
};
41
enum class ListType {
42
ALL_BLOCKS,
43
FPU_BLOCKS,
44
VFPU_BLOCKS,
45
};
46
enum class ListSort {
47
BLOCK_NUM,
48
BLOCK_LENGTH_DESC,
49
BLOCK_LENGTH_ASC,
50
TIME_SPENT,
51
EXECUTIONS,
52
MAX
53
};
54
ViewMode viewMode_ = ViewMode::BLOCK_LIST;
55
ListType listType_ = ListType::ALL_BLOCKS;
56
ListSort listSort_ = ListSort::TIME_SPENT;
57
58
int currentBlock_ = -1; // For DISASM mode
59
int64_t sumTotalNanos_ = 0;
60
int64_t sumExecutions_ = 0;
61
std::vector<int> blockList_; // for BLOCK_LIST mode
62
63
UI::TextView *blockName_;
64
UI::TextEdit *blockAddr_;
65
UI::TextView *blockStats_;
66
};
67
68
class AddressPromptScreen : public PopupScreen {
69
public:
70
AddressPromptScreen(std::string_view title) : PopupScreen(title, "OK", "Cancel") {}
71
72
const char *tag() const override { return "AddressPrompt"; }
73
74
bool key(const KeyInput &key) override;
75
76
UI::Event OnChoice;
77
78
protected:
79
void CreatePopupContents(UI::ViewGroup *parent) override;
80
void OnCompleted(DialogResult result) override;
81
UI::EventReturn OnDigitButton(UI::EventParams &e);
82
UI::EventReturn OnBackspace(UI::EventParams &e);
83
84
private:
85
void AddDigit(int n);
86
void BackspaceDigit();
87
void UpdatePreviewDigits();
88
89
UI::TextView *addrView_ = nullptr;
90
UI::Button *buttons_[16]{};
91
unsigned int addr_ = 0;
92
};
93
94