SIO0 overhaul
~~Draft~~ PR, trying to shore up various changes I had worked up in preparation of adding multitap support. My initial branch became sorely outdated and conflicted, this branch attempts to cherry pick some of these changes and bring the branch back in line with head. Needs some additional cleanup; get rid of vectors, mentions of multitap, test various things, etc.
- Moved all/most card + pad specific code out of SIO class
- Began abstracting generic card & pad functions such as file IO to a parent class
This one is ready for review. Moved a lot of things around to split the card and pad code away from the sio class.
You're making Linux sad :)
Looks like there's still an asan error, with a mismatched new/delete type.
Codecov Report
Attention: Patch coverage is 8.85781% with 391 lines in your changes missing coverage. Please review.
Please upload report for BASE (
main@15520a9). Learn more about missing BASE report.
Additional details and impacted files
@@ Coverage Diff @@
## main #1673 +/- ##
=======================================
Coverage ? 9.87%
=======================================
Files ? 448
Lines ? 133030
Branches ? 0
=======================================
Hits ? 13143
Misses ? 119887
Partials ? 0
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@coderabbitai full review
:white_check_mark: Actions performed
Full review triggered.
Summary by CodeRabbit
Based on the comprehensive changes across multiple files, here are the release notes:
Release Notes
-
Memory Card Management
- Introduced a new
MemoryCardsclass to centralize memory card operations - Enhanced memory card block information retrieval and management
- Improved error handling for memory card interactions
- Introduced a new
-
Pad and SIO Interactions
- Refined communication protocols for game controllers
- Streamlined device selection and data transmission methods
- Added more robust acknowledgment handling
-
Emulator State Management
- Updated save state structure for more efficient memory card tracking
- Simplified memory card initialization and configuration
- Improved type safety with enumerated memory card references
-
User Interface
- Updated memory card manager to support new memory card management system
- Enhanced icon and file export capabilities for memory card blocks
These changes represent a significant refactoring of the memory card and device interaction systems, focusing on improved reliability and maintainability.
Walkthrough
The pull request introduces a comprehensive refactoring of memory card and serial input/output (SIO) management in the PCSX emulator. The changes centralize memory card operations into a new MemoryCards class, removing memory card-related functionality from the SIO class. This restructuring enhances code organization, introduces more robust error handling, and provides a clearer interface for memory card interactions. The modifications span multiple files, updating method signatures, adding new methods, and reorganizing how memory card data is accessed and managed throughout the emulator.
Changes
| File | Change Summary |
|---|---|
src/core/memorycard.cc/h |
Added MemoryCards class with methods for loading, saving, erasing, and managing memory card blocks. Introduced new methods like loadMcds, getMcdBlockInfo, eraseMcdFile, and getFreeSpace. |
src/core/pad.cc/h |
Refined pad interaction methods, adding transceive and deselect methods to improve communication handling. |
src/core/psxemulator.cc/h |
Added m_memoryCards member to Emulator class, introducing a new management point for memory card operations. |
src/core/sio.cc/h |
Removed memory card-specific methods and simplified SIO class functionality. |
src/core/sstate.cc/h |
Updated save state structure to reference memory card data through new m_memoryCards. |
src/gui/widgets/memcard_manager.cc/h |
Updated method signatures and memory card handling to use new MemoryCards class. |
src/main/main.cc |
Simplified memory card initialization logic by consolidating loading into a single function call using m_memoryCards->loadMcds(args). |
Sequence Diagram
sequenceDiagram
participant Emulator
participant MemoryCards
participant MemoryCard
participant SIO
Emulator->>MemoryCards: loadMcds(args)
MemoryCards->>MemoryCard: createMcd(path)
MemoryCards->>SIO: writePad/writeCard
MemoryCard-->>MemoryCards: return block info
MemoryCards-->>Emulator: memory card loaded
Suggested reviewers
- nicolasnoble
Poem
🐰 Hop, hop, memory cards anew,
Refactored code, a cleaner view!
SIO's burden, now set free,
Emulator's dance of clarity
Memory managed with rabbit's might! 🎮
[!TIP]
⚡💬 Agentic Chat (Pro Plan, General Availability)
- We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🪧 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai planto trigger planning for file edits and PR creation. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere 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.