New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryWidget: Add 'Offset' and General Improvements #9080
Conversation
75876c2
to
47c9fac
Compare
|
fwiw ctrl+k,ctrl+d is "format document" in VS (also a named action in vscode / shift+alt+f) |
|
Not sure if I fully understand how the offset should be used, but otherwise looks fine to me. I could see extracting the 'calc address from GUI fields' code to a separate function so it's not there three times, maybe? But not a huge deal. |
|
All groups have a header, except for the dumping buttons. I suggest adding one saying "Memory Dump" |
|
Also, the "Search" group should be closer to the actual search bar. Like after the "Set Value" button, the "Find Next" and "Find Previous" buttons should be right after, making the "Search" header unnecessary. |
Not bad suggestions!
Say hypothetically you have a class at address Now sure that's easy to do in your head and easily change the search address field. But what if we use more real numbers, you have a function loading the address It does an operation, r5 + r6. You want to figure out the answer to that? You have to copy the register Or with this new PR? Copy r4 into the memory search address field. Copy I have to do this process a lot for a variety of different scenarios, this feature while very simple, would be a pretty big time saver. No more needing to store the address somewhere and open a calculator every time I need to calculate an offset without doing it in my head. Especially useful if you're trying to map out a class and have to go between several offsets to see what is doing what. In the end, you can ignore it if you want, you can even collapse it so its hidden. |
|
Yeah, using offsets is something I see in a lot of other debugging GUIs and I believe it would be a nice feature to have in Dolphin's debugger too. |
|
So while I'm not 100% happy with some of this, this works fine for what it's intended to do, so I don't really have any objections to just merging it as-is even if those are not addressed. The debugger needs more work anyway. |
47c9fac
to
a5b6c77
Compare
|
Is this okay to be merged? It seems all specific issues and comments have been resolved. |
| @@ -85,13 +86,23 @@ void MemoryWidget::CreateWidgets() | |||
| //// Sidebar | |||
|
|
|||
| // Search | |||
| QSplitter* m_address_splitter = new QSplitter(Qt::Horizontal); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, but there's no point in repeating the type name here:
| QSplitter* m_address_splitter = new QSplitter(Qt::Horizontal); | |
| auto* m_address_splitter = new QSplitter(Qt::Horizontal); |
| @@ -424,25 +443,34 @@ void MemoryWidget::SetAddress(u32 address) | |||
|
|
|||
| void MemoryWidget::OnSearchAddress() | |||
| { | |||
| bool good; | |||
| u32 addr = m_search_address->text().toUInt(&good, 16); | |||
| bool good_addr, good_off; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bool good_addr, good_off; | |
| bool good_addr, good_offset; |
off isn't a particularly common abbreviation for offset, and you use offset below, so I'd prefer to see it written out.
|
|
||
| QFont font; | ||
| QPalette palette; | ||
| QFont addr_font, off_font; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| QFont addr_font, off_font; | |
| QFont addr_font, offset_font; |
| QFont font; | ||
| QPalette palette; | ||
| QFont addr_font, off_font; | ||
| QPalette addr_palette, off_palette; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| QPalette addr_palette, off_palette; | |
| QPalette addr_palette, offset_palette; |
| bool good; | ||
| u32 addr = m_search_address->text().toUInt(&good, 16); | ||
| bool good_addr, good_off; | ||
| u32 addr = m_search_address->text().toUInt(&good_addr, 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| u32 addr = m_search_address->text().toUInt(&good_addr, 16); | |
| const u32 addr = m_search_address->text().toUInt(&good_addr, 16); |
| u32 addr = m_search_address->text().toUInt(&good, 16); | ||
| bool good_addr, good_off; | ||
| u32 addr = m_search_address->text().toUInt(&good_addr, 16); | ||
| u32 offset = m_search_offset->text().toUInt(&good_off, 16); // Returns 0 if conversion fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| u32 offset = m_search_offset->text().toUInt(&good_off, 16); // Returns 0 if conversion fails | |
| // Returns 0 if conversion fails | |
| const u32 offset = m_search_offset->text().toUInt(&good_offset, 16); |
| if (!Core::IsRunning()) | ||
| return; | ||
|
|
||
| bool good_address, good_off; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
| u32 addr = m_search_address->text().toUInt(&good_address, 16); | ||
| addr += m_search_offset->text().toUInt(&good_off, 16); // Returns 0 if conversion fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should be on its own line.
3f815e7
to
2b01633
Compare
Summary of changes:
The primary change here is adding an
Offsetfield next toSearch Address. All this does is add the offset to the supplied search address. While this sounds mediocre on paper, this is incredibly convenient for hack and cheat developers (and especially reverse engineers) who frequently work with base addresses and classes. I have been working on PrimeHack for nearly a year, and I constantly need to work with addresses that are offset from dynamically allocated classes in memory. Adding this simpleOffsetfield streamlines traversing through large classes in memory rather than the otherwise clunky process.The
Offsetfield is resizeable and can be totally collapsed if wanted, but it really doesn't get in the way of the regularSearch Address. TheFind Next/Find Previousbuttons work as expected, they simply clear the offset field if it finds a result.Before/After
