changeset 1654:4637ab86be8c

Preserve WAVE logging FILE * across YM2612 device reset
author Michael Pavone <pavone@retrodev.com>
date Fri, 28 Dec 2018 12:08:43 -0800
parents 858d52140375
children 3128d4e0bc68
files ym2612.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ym2612.c	Thu Dec 27 10:40:24 2018 -0800
+++ b/ym2612.c	Fri Dec 28 12:08:43 2018 -0800
@@ -135,6 +135,11 @@
 	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 @@
 	//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++) {