summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2018-12-28 12:08:43 -0800
committerMichael Pavone <pavone@retrodev.com>2018-12-28 12:08:43 -0800
commit6b9767ff8b2343b9a16c96f26534179c33d4a0fb (patch)
tree70c91efe311904c6e2ac89952085b86ee051bb62
parentafda815d163582c44c5e93cf05dd4da3e073dac4 (diff)
Preserve WAVE logging FILE * across YM2612 device reset
-rw-r--r--ym2612.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ym2612.c b/ym2612.c
index 15482fc..de707c7 100644
--- a/ym2612.c
+++ b/ym2612.c
@@ -135,6 +135,11 @@ void ym_reset(ym2612_context *context)
memset(context->part1_regs, 0, sizeof(context->part1_regs));
memset(context->part2_regs, 0, sizeof(context->part2_regs));
memset(context->operators, 0, sizeof(context->operators));
+ FILE* savedlogs[NUM_CHANNELS];
+ for (int i = 0; i < NUM_CHANNELS; i++)
+ {
+ savedlogs[i] = context->channels[i].logfile;
+ }
memset(context->channels, 0, sizeof(context->channels));
memset(context->ch3_supp, 0, sizeof(context->ch3_supp));
context->selected_reg = 0;
@@ -153,6 +158,7 @@ void ym_reset(ym2612_context *context)
//some games seem to expect that the LR flags start out as 1
for (int i = 0; i < NUM_CHANNELS; i++) {
context->channels[i].lr = 0xC0;
+ context->channels[i].logfile = savedlogs[i];
}
context->write_cycle = CYCLE_NEVER;
for (int i = 0; i < NUM_OPERATORS; i++) {