Skip to content

Memory Observer improvements: #1927

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

notdodgeball
Copy link

• proper TextFlags in input box
• new remove button in address tables
• changed position for "fixed-point values" checkbox
• new buttons for (un)freeze/all
• smaller buttons for read and write breakpoints, unified in a single column
• validate sequence size to prevent error

• proper TextFlags in input box
• remove button in address tables
• new position for "fixed-point values" checkbox
• new buttons for (un)freeze/all
• smaller buttons for read and write breakpoints
• validate sequence size to prevent error
Copy link
Contributor

coderabbitai bot commented Apr 24, 2025

Walkthrough

The changes update the "Plain search," "Delta-over-time search," and "Pattern search" tabs within the memory observer GUI widget. Input fields now restrict characters based on user selections (hex or decimal). The "Found values" tables in both search tabs add new columns, including "Remove" buttons for individual address management and updated breakpoint controls. The "Delta-over-time search" tab introduces new controls for freezing/unfreezing addresses and displaying values as fixed-point, with UI elements shown conditionally. In the "Pattern search" tab, sequence strings are truncated to match the selected byte size when necessary.

Changes

File(s) Change Summary
src/gui/widgets/memory_observer.cc - Input fields in "Plain search" now restrict to hex or decimal characters based on "Hex" checkbox.
- "Found values" tables in "Plain search" and "Delta-over-time search" add "Remove" buttons for each address.
- "Delta-over-time search" tab adds "Freeze all," "Unfreeze all," and "Remove all frozen addresses" buttons, and a "Display as fixed-point values" checkbox (conditionally visible).
- Breakpoint columns are renamed and buttons relabeled/relocated.
- "Pattern search" tab truncates sequence string to selected byte size when necessary.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GUI
    participant MemoryObserver

    User->>GUI: Enter value in "Plain search" input
    GUI->>GUI: Restrict input to hex/decimal based on "Hex" checkbox

    User->>GUI: Click "Remove" on found address
    GUI->>MemoryObserver: Remove address from list

    User->>GUI: Use "Delta-over-time search" controls
    alt Stride > 1 and not hex mode
        GUI->>User: Show "Display as fixed-point values" checkbox
    end
    User->>GUI: Click "Freeze all"/"Unfreeze all"/"Remove all frozen addresses"
    GUI->>MemoryObserver: Perform freeze/unfreeze/remove actions

    User->>GUI: Select sequence size in "Pattern search"
    GUI->>GUI: Truncate sequence string if it exceeds selected size
Loading

Suggested reviewers

  • nicolasnoble

Poem

In fields of memory, buttons bloom anew,
Remove, freeze, and unfreeze—so much to do!
Hex or decimal, input’s now precise,
Breakpoints renamed, controls concise.
Sequence strings trimmed to fit just right,
A bunny’s delight in the GUI’s new light!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dec9cd9 and 943c847.

📒 Files selected for processing (1)
  • src/gui/widgets/memory_observer.cc (7 hunks)
🧰 Additional context used
🪛 GitHub Check: CodeScene Cloud Delta Analysis (main)
src/gui/widgets/memory_observer.cc

[warning] 98-449: ❌ Getting worse: Complex Method
PCSX::Widgets::MemoryObserver::draw increases in cyclomatic complexity from 99 to 111, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.


[warning] 98-449: ❌ Getting worse: Complex Method
PCSX::Widgets::MemoryObserver::draw increases in cyclomatic complexity from 99 to 111, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (9)
src/gui/widgets/memory_observer.cc (9)

98-101: Input restriction based on mode is a good usability enhancement.

The addition of input flags to restrict character input based on whether the user is in hex or decimal mode is a nice improvement. This prevents users from entering invalid characters, reducing potential errors.

🧰 Tools
🪛 GitHub Check: CodeScene Cloud Delta Analysis (main)

[warning] 98-449: ❌ Getting worse: Complex Method
PCSX::Widgets::MemoryObserver::draw increases in cyclomatic complexity from 99 to 111, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.


172-175: Table structure improvements look good.

Adding the "Remove" column to the found values table provides better management capabilities for users. This change aligns with the PR objective of improving the UI and functionality.


194-200: Remove button implementation is well-executed.

The implementation correctly removes items from the list and updates the clipper to maintain UI consistency. Breaking out of the loop after removing an item prevents accessing invalid indices.


301-304: Conditional display of fixed-point checkbox is sensible.

Showing the fixed-point values checkbox only when not in hex mode and when the stride is greater than 1 is a good UI design decision. It prevents showing options that wouldn't make sense in certain contexts.


340-359: Freeze/unfreeze functionality enhances user control.

The new buttons for freezing, unfreezing, and removing frozen addresses provide valuable functionality that aligns with the PR objectives. The implementation correctly handles the state of each address value pair.


366-367: Column header changes improve clarity.

Renaming headers to "Add breakpoint" and "Remove" makes the purpose of each column clearer to users.


413-420: Streamlined breakpoint buttons improve UI density.

Placing the read and write breakpoint buttons on the same line with shorter labels makes the UI more compact while maintaining functionality. This aligns with the PR objective of streamlining the interface.


424-430: Remove button implementation is consistent.

The implementation is consistent with the one in the plain search tab, correctly removing items and updating the clipper.


443-445: Sequence size validation prevents potential errors.

Truncating the sequence string when selecting a smaller sequence size is a good safeguard against potential buffer overflow issues or unexpected behavior when the string length exceeds the selected size.

Also applies to: 447-449

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nicolasnoble nicolasnoble requested a review from Copilot April 24, 2025 21:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines the Memory Observer widget with improved input handling, new removal buttons, updated layout for checkboxes and breakpoints, and sequence size validation to prevent errors.

  • Enhanced the TextFlags for the pattern input to support hexadecimal/decimal validation
  • Added new buttons for removing addresses and for freezing/unfreezing memory addresses
  • Implemented sequence length truncation when selecting preset sequence sizes
Comments suppressed due to low confidence (1)

src/gui/widgets/memory_observer.cc:443

  • Truncating m_sequence in the radio button selection logic may inadvertently remove valid data if the sequence exceeds the expected length; please verify that this behavior is intended and consider adding a clarifying comment or test to document it.
if (ImGui::RadioButton(_("8 bytes (fast)"), &m_sequenceSize, 8) && strlen(m_sequence) > 8) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant