Fix loading too many states from a file

This commit is contained in:
Jeffrey Pfau 2014-07-19 17:54:29 -07:00
parent 7172e6428c
commit 7d4f1fb661
1 changed files with 6 additions and 1 deletions

View File

@ -85,7 +85,11 @@ bool GBARRLoad(struct GBARRContext* rr, struct VDir* vdir) {
return false;
}
struct GBARRBlock block;
struct GBARRBlock block = {
.next = 0,
.numInputs = GBA_RR_BLOCK_SIZE
};
ssize_t read;
do {
read = inputs->read(inputs, block.inputs, sizeof(block.inputs));
@ -99,6 +103,7 @@ bool GBARRLoad(struct GBARRContext* rr, struct VDir* vdir) {
rr->currentBlock->next = newBlock;
}
rr->currentBlock = newBlock;
newBlock->numInputs = read / sizeof(block.inputs[0]);
}
} while (read > 0);