Skip to content

feat: memory card manager#1050

Open
dfederspiel wants to merge 9 commits intoemukidid:masterfrom
dfederspiel:feature/card-manager
Open

feat: memory card manager#1050
dfederspiel wants to merge 9 commits intoemukidid:masterfrom
dfederspiel:feature/card-manager

Conversation

@dfederspiel
Copy link

No description provided.

dfederspiel and others added 9 commits March 11, 2026 04:49
New menu button (between Refresh and Exit) opens a card manager screen
that lists all saves on a physical memory card with filename, game code,
block count, and size. Supports switching between Slot A and Slot B via
L/R triggers, scrolling through saves, and automatic detection of card
insertion/removal via polling.

- New files: cardmanager.c/h with modal UI following info.c patterns
- 6-button menu bar (re-spaced from 119px to 98px intervals)
- Placeholder button icon (btnmemcard.tif)
- Logs session telemetry to swiss/cardmanager.log on config device

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Increase CM_LOG_MAX from 4KB to 16KB. The 4KB buffer was truncating
mid-write around entry 16 when logging a 35-save MemCard Pro card
across multiple slot switches in a single session.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Z button to initiate delete with L+A confirmation, matching Swiss's
existing file management UX. Logs delete/cancel actions. Context-aware
hint bar shows Z: Delete only when saves are present.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
libogc2's CARD_SetStatus has multiple bugs that corrupt directory entries:
- Strips banner animation bit from banner_fmt (CARD_ANIM_BOUNCE)
- Overrides timestamp with current time instead of preserving original
- Rejects icon_addr >= 512 with CARD_ERROR_FATAL_ERROR
- No way to restore copy_counter (CARD_Create zeros it)

Export now reads raw 64-byte directory entries directly from the card's
sys_area buffer instead of using CARD_GetStatus. Import patches both
directory block copies in sys_area and flushes via CARD_SetAttributes.

Also documents GCI struct fields (permission, copy_counter, first_block)
and exposes get_card_sys_area() from deviceHandler-CARD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Redesign card manager as side-by-side panels (Slot A / Slot B) with
animated icon grid, shared detail bar with banner, and pixel-exact
custom UI elements replacing DrawEmptyColouredBox.

Bypass CARD_GetStatus for icon offset computation - compute offsets
ourselves from raw GCI directory fields to fix broken animations,
trash pixels, and missing icons caused by unreliable libogc2 internals.

Key changes:
- Dual cm_panel architecture with independent state per slot
- Icon grid (6x4) with animated icons and frame timing
- NONE icon frames handled as "hold previous" per GC spec
- Shared detail bar below both panels (title, stats, banner)
- cm_draw_rect utility for pixel-exact borders/separators/selection
- L/R to switch active panel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e matching

Compute icon data offsets ourselves from raw GCI directory fields
(icon_fmt, icon_speed, icon_addr, banner_fmt) instead of relying on
CARD_GetStatus which returned incorrect offsets for some games.

Key fixes:
- Self-computed icon offsets matching GC memory card data layout:
  [banner][icon pixels...][shared CI TLUT]
- NONE-format frames with non-zero speed handled as "hold previous
  frame" per GC spec (fixes Luigi's Mansion, Pikmin sparse animations)
- read_len clamp now accounts for sector_offset (was reading past EOF)
- sys_area filename lookup uses strncmp instead of memcmp to handle
  0xFF padding after null terminator (fixes Mario Golf missing icon)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix icon BOUNCE/LOOP animation timing with forward-resolution model
  for NONE frames, producing balanced visual cycles matching GC browser
- Add Nintendo Memory Card Guidelines v2.1 error handling: WRONGDEVICE,
  ENCODING, BROKEN mount errors with format prompts
- Add "Do not remove the Memory Card" warnings during card access
- Display NoCopy/NoMove file attributes in detail stats
- Add memcard manager icon in title bar
- Polish layout: centered panels, dynamic box height, improved spacing
- Add detailed icon/animation debug logging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace bottom rail memcard button with custom 32x32 RGBA icon
- Show 64x64 memcard icon centered in grid when no card inserted
- Display "Reading..." loading state during card enumeration to
  prevent jarring UI disappearance on card hotswap

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntering

- Fixed box height (no more collapsing when no selection)
- Expanded grid from 4 to 6 visible rows
- Vertically centered layout on screen with cascading defines
- Removed separator line between grid and detail bar
- Tightened spacing between detail bar and button hints

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant