Record every pad, not the one that happened to be first
The first recording ever made with this came back 1,766 frames of nothing. It recorded pad NOUGHT and the controller was somewhere else - which pad one lands on is an accident of the host, the same accident that made Lunar Porter read all four in the first place - and a flight flown for the purpose was lost to it. So every pad is or-ed into the byte. A demo is a record of what somebody DID, and on a machine one person is playing the number it arrived on is not part of that. It plays back on pad nought, where --pad puts the first file given, and any program that reads more than one pad reads them or-ed anyway for exactly the same reason. --record-pad takes one file now rather than filling pads in turn, because there is nothing left for the second one to mean. The check for it plays a recording on pad ONE with nought holding nothing and requires the bytes back. That is the case that was missing: the round trip was tested and passed, on pad nought, which is the only pad it could not have gone wrong on. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
eb695a3f3b
commit
de1857f5f7
+9
-10
@@ -10,7 +10,7 @@ static uint8_t held[PAD_COUNT];
|
||||
static FILE *recorded[PAD_COUNT];
|
||||
static uint8_t live[PAD_COUNT];
|
||||
static int connected[PAD_COUNT];
|
||||
static FILE *recording[PAD_COUNT];
|
||||
static FILE *recording;
|
||||
|
||||
// ---- The frame the recordings advance on ----
|
||||
//
|
||||
@@ -43,11 +43,8 @@ static uint8_t effective(int which) {
|
||||
return (recorded[which] != NULL) ? held[which] : live[which];
|
||||
}
|
||||
|
||||
void padRecordTo(int which, FILE *file) {
|
||||
if (which < 0 || which >= PAD_COUNT) {
|
||||
return;
|
||||
}
|
||||
recording[which] = file;
|
||||
void padRecordTo(FILE *file) {
|
||||
recording = file;
|
||||
}
|
||||
|
||||
void padFromFile(int which, FILE *file) {
|
||||
@@ -96,11 +93,13 @@ void padTick(unsigned long now) {
|
||||
// Flushed as it goes, because a recording is usually stopped by whoever is playing
|
||||
// rather than by the program ending, and a demo lost to a buffer would be a demo
|
||||
// flown twice.
|
||||
for (int n = 0; n < PAD_COUNT; n++) {
|
||||
if (recording[n] != NULL) {
|
||||
fputc(effective(n), recording[n]);
|
||||
fflush(recording[n]);
|
||||
if (recording != NULL) {
|
||||
uint8_t all = 0;
|
||||
for (int n = 0; n < PAD_COUNT; n++) {
|
||||
all |= effective(n);
|
||||
}
|
||||
fputc(all, recording);
|
||||
fflush(recording);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user