-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clear mapped RAM on subsong change #125
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, basically a cleaner version of my local edit.
mapper.c
Outdated
@@ -246,3 +254,7 @@ struct mapper *mapper_gb(struct gbcpu *gbcpu, const uint8_t *rom, size_t size, u | |||
void mapper_free(struct mapper *m) { | |||
free(m); | |||
} | |||
|
|||
void mapper_init(struct mapper *m) { | |||
memset(m->ram, 0, MAPPER_MAX_EXTRAM_SIZE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe assert(sizeof(m->ram) == MAPPER_MAX_EXTRAM_SIZE)
beforehand, or use sizeof(m->ram)
as the count?
"mapped external cartridge mapped" in the message for 2f6a309 should probably be "mapped external cartridge RAM" ;-) |
based on git history
On a subsong change the player has to reset the CPU, registers, RAM etc. Until now the mapped external cartridge RAM was not reset, which could make state from one subsong spill over into the next. Depending on the player routine and subsong sequence this could lead to playback errors. This fixes issue #124.
2f6a309
to
d44670b
Compare
I have added both changes (went with the |
This should fix #124.
I know @mrehkopf has already fixed the bug locally, but there was no pull request yet and it's only 6 lines of code ;-)
He did most of the debugging, that's not my achievement.
Please have a good look at my commit message and HISTORY entry, I'm not sure if they are comprehensible and if I have used the correct technical terms. I'm open for better wording :)