Skip to content

Added Reload Disk Image option to file menu #1898

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

Merged
merged 1 commit into from
Mar 15, 2025

Conversation

mziab
Copy link
Contributor

@mziab mziab commented Mar 14, 2025

I find myself reloading images a lot, so I've added a simple Reload Image feature to the File menu. This code works for me, I've used it for a few months now in a previous iteration. Hopefully everything is in order.

Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

Walkthrough

This change modifies the GUI by adding a new menu item in the endFrame() method to allow users to dynamically reload a disk image. The code checks if the current ISO is valid and then displays the "Reload Disk Image" option. When selected, the process clears the current ISO, sets a new one, verifies the CD-ROM, and finally triggers a hard system reset. There are no modifications to any public or exported declarations.

Changes

File Change Summary
src/.../gui.cc Added a new menu item in endFrame() that checks for a valid ISO. On selection, it clears the ISO, sets a new one, performs a CD-ROM check, and triggers a hard reset.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant G as GUI (endFrame)
    participant C as CDROM
    participant S as System

    U->>G: Opens GUI frame
    G->>C: getIso()
    alt ISO is valid
      G->>U: Display "Reload Disk Image" option
      U->>G: Selects reload option
      G->>C: clearIso()
      G->>C: setIso(new CDRIso(path))
      G->>C: check()
      G->>S: hardReset()
    else ISO is invalid
      G-->>U: Option not shown
    end
Loading

Poem

I'm a little hopper, full of cheer,
Watching new changes appear right here.
A menu leaps with a brand new role,
Reloading disks to make things whole.
With each hard reset, I bounce with delight—
An ASCII bunny celebrates the code tonight!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 45675f1 and b274766.

📒 Files selected for processing (1)
  • src/gui/gui.cc (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: macos-arm-build-and-test
  • GitHub Check: macos-intel-build-and-test
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: pcsx-redux (x86_64-linux)
  • GitHub Check: pcsx-redux (aarch64-linux)
  • GitHub Check: toolchain
  • GitHub Check: macos-build-and-test-toolchain
  • GitHub Check: aur-build
  • GitHub Check: asan
  • GitHub Check: build
  • GitHub Check: cross-arm64
  • GitHub Check: coverage
🔇 Additional comments (1)
src/gui/gui.cc (1)

1209-1215: Clean implementation of disk image reloading feature.

The implementation properly checks if a valid ISO exists before enabling the option, then correctly reloads it by clearing the existing ISO, creating a new one with the same path, checking the CD-ROM, and performing a hard reset. This implementation follows the existing code patterns in the file and provides a useful shortcut for users who frequently need to reload disk images.

✨ 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 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 merged commit 4e9948a into grumpycoders:main Mar 15, 2025
22 checks passed
@mziab mziab deleted the reload-image branch March 17, 2025 08:47
@coderabbitai coderabbitai bot mentioned this pull request Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants