Skip to content

Conversation

@jyetcv
Copy link
Contributor

@jyetcv jyetcv commented Jan 12, 2026

Based on ehw's PR.
The code was simplified a little bit.
Feel free to modify whatever you want.

ehw and others added 10 commits November 16, 2025 17:32
- Use symbolic constant for entry count 
- Remove explicit save
- Add early return
- Add an assert for invalid index
- Remove invalid entries
- Renamed History to Recent for consistency
- Added a red X so that each entry can be manually deleted
- Made it so the "Recent Discs" becomes grey and unclickable if no discs are in the list
- Bumped the max disc in the list from 10 to 15
- Added something to clear just the missing discs from the list
@gemini-code-assist
Copy link

Summary of Changes

Hello @jyetcv, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a 'Recent Discs' feature, significantly enhancing user convenience by providing quick access to previously loaded disc images directly from the application's menu. This streamlines the process of switching between or revisiting frequently used discs, improving the overall user experience by reducing repetitive navigation.

Highlights

  • Configuration Update: A new general.recent.discs section has been added to config_spec.yml to store an array of strings representing paths to recently loaded disc images.
  • Recent Disc Management Logic: The ActionLoadDiscFile function in ui/xui/actions.cc now includes logic to manage the recent discs list. This involves initializing the list, moving an already present disc to the top when reloaded, adding new discs to the top, and enforcing a maximum limit (MAX_RECENT_DISCS = 11) by freeing older entries.
  • Clear Recent Discs Functionality: A new function, ActionClearDiscRecent, has been introduced in ui/xui/actions.cc and declared in ui/xui/actions.hh. This function is responsible for clearing all entries from the recent discs list and deallocating associated memory.
  • User Interface Integration: A 'Recent Discs' submenu has been integrated into the main application menu in ui/xui/menubar.cc. This submenu dynamically lists recently loaded discs, allowing users to quickly reload them. It also includes an option to 'Clear Recent Discs'.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a 'Recent Discs' history feature. The implementation adds the necessary configuration, logic to manage the recent list when a disc is loaded, and a UI menu to display and interact with the history. My review focuses on improving code style and clarity. I've suggested using a const variable instead of a #define for better type safety in C++, and refactoring the ImGui menu rendering logic to be simpler and more readable. The core logic for managing the recent list appears correct, though complex.

#include "../xemu-notifications.h"
#include "snapshot-manager.hh"

#define MAX_RECENT_DISCS 11

Choose a reason for hiding this comment

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

medium

In C++, it's generally better to use const or constexpr variables instead of #define for constants. This provides type safety and respects scope. Consider defining MAX_RECENT_DISCS as a static const.

static const unsigned int MAX_RECENT_DISCS = 11;

Comment on lines 145 to 165
bool has_any_entries = (g_config.general.recent.discs_count > 0);
if (ImGui::BeginMenu("Recent Discs", has_any_entries)) {
for (int i = 0; i < g_config.general.recent.discs_count; i++) {
const char *disc_path = g_config.general.recent.discs[i];

const char *filename = g_path_get_basename(disc_path);

if (ImGui::MenuItem(filename)) {
ActionLoadDiscFile(disc_path);
}

g_free((void *)filename);
}
if (g_config.general.recent.discs_count > 0) {
ImGui::Separator();
if (ImGui::MenuItem("Clear Recent Discs")) {
ActionClearDiscRecent();
}
ImGui::EndMenu();
}
}

Choose a reason for hiding this comment

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

medium

The logic for displaying the 'Recent Discs' menu can be simplified for better readability and to follow ImGui's usage patterns more closely. The if (g_config.general.recent.discs_count > 0) check is redundant since ImGui::BeginMenu would have already returned false if the list were empty. Also, ImGui::EndMenu() should be called unconditionally at the end of the ImGui::BeginMenu block if it returned true. The indentation of some items is also inconsistent. The suggested change simplifies the logic and fixes the styling.

            bool has_any_entries = (g_config.general.recent.discs_count > 0);
            if (ImGui::BeginMenu("Recent Discs", has_any_entries)) {
                for (int i = 0; i < g_config.general.recent.discs_count; i++) {
                    const char *disc_path = g_config.general.recent.discs[i];

                    const char *filename = g_path_get_basename(disc_path);

                    if (ImGui::MenuItem(filename)) {
                        ActionLoadDiscFile(disc_path);
                    }

                    g_free((void *)filename);
                }
                ImGui::Separator();
                if (ImGui::MenuItem("Clear Recent Discs")) {
                    ActionClearDiscRecent();
                }
                ImGui::EndMenu();
            }

@jyetcv jyetcv marked this pull request as ready for review January 12, 2026 14:27
@jyetcv jyetcv marked this pull request as draft January 12, 2026 16:26
@jyetcv jyetcv marked this pull request as ready for review January 12, 2026 22:24
@jyetcv jyetcv marked this pull request as draft January 13, 2026 05:33
@jyetcv jyetcv marked this pull request as ready for review January 13, 2026 22:34
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