Raw memory-card sector calls report completion without transferring data

Open
#235 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c
Domain
embedded-iot

Research direction

Read psyz/src/psyz/libcard.c, especially _card_read, _card_write, and card_op, then trace the file level card implementation to understand how media, channels, events, bounds, and persistence are handled. The issue reports that raw calls discard the sector and buffer and do not transfer data; no card test file is named. Done means a successful 128-byte transfer at the requested sector, failure when media is unavailable, and a write/read round trip that preserves the bytes.

Written by the indexing model from the issue text.

Description

In PsyZ 35c673ecf1c4ba799a812d701918c2c52935475b, _card_read and
_card_write explicitly ignore the sector number and data buffer and only call
card_op. Games that inspect the card directory or save blocks through these
APIs cannot use the file-level emulation as a substitute.

Source-confirmed behavior and suggested runtime check

In a disposable card setup, initialize/start the card, fill a 128-byte read
buffer with a sentinel, and issue _card_read(0, 0, buffer). Observe completion
through the normal card event/status mechanism. The current implementation never
copies card bytes into the buffer. Similarly, _card_write never consumes its
input buffer. The relevant bodies are in libcard.c: both discard block and buf, then return card_op(0, chan). For valid non-multitap channels that helper raises HwCARD / EvSpIOE without a transfer.

Expected: successful completion corresponds to a 128-byte transfer at the
requested sector; unavailable media should report failure rather than apparent
successful transfer. A write/read round trip should recover the same bytes.

This packet records a source-confirmed limitation. A standalone card-event
runtime test has not been included; the GPU repro runner does not exercise cards.

Desired scope

Raw sector and file-level views should represent the same card, with consistent
channel selection, sector bounds, completion/error events and persistence. A
browser storage strategy can remain a platform choice. Our port currently uses
a local 128 KiB image as a workaround, but that game-specific wrapper is not a
proposal for PsyZ's public API.

No real saves or card images are needed for a disposable test. Do not run a write
experiment against an existing user's memory card.

Dominant language
C
Stars
107
Forks
26
Avg merge
2d 21h
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Xeeynamo/psyz

All issues in Xeeynamo/psyz

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.