comparison ym2612.c @ 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 6ce36c3f250b
children 804f13c090b4
comparison
equal deleted inserted replaced
1653:858d52140375 1654:4637ab86be8c
133 void ym_reset(ym2612_context *context) 133 void ym_reset(ym2612_context *context)
134 { 134 {
135 memset(context->part1_regs, 0, sizeof(context->part1_regs)); 135 memset(context->part1_regs, 0, sizeof(context->part1_regs));
136 memset(context->part2_regs, 0, sizeof(context->part2_regs)); 136 memset(context->part2_regs, 0, sizeof(context->part2_regs));
137 memset(context->operators, 0, sizeof(context->operators)); 137 memset(context->operators, 0, sizeof(context->operators));
138 FILE* savedlogs[NUM_CHANNELS];
139 for (int i = 0; i < NUM_CHANNELS; i++)
140 {
141 savedlogs[i] = context->channels[i].logfile;
142 }
138 memset(context->channels, 0, sizeof(context->channels)); 143 memset(context->channels, 0, sizeof(context->channels));
139 memset(context->ch3_supp, 0, sizeof(context->ch3_supp)); 144 memset(context->ch3_supp, 0, sizeof(context->ch3_supp));
140 context->selected_reg = 0; 145 context->selected_reg = 0;
141 context->csm_keyon = 0; 146 context->csm_keyon = 0;
142 context->ch3_mode = 0; 147 context->ch3_mode = 0;
151 //TODO: Reset LFO state 156 //TODO: Reset LFO state
152 157
153 //some games seem to expect that the LR flags start out as 1 158 //some games seem to expect that the LR flags start out as 1
154 for (int i = 0; i < NUM_CHANNELS; i++) { 159 for (int i = 0; i < NUM_CHANNELS; i++) {
155 context->channels[i].lr = 0xC0; 160 context->channels[i].lr = 0xC0;
161 context->channels[i].logfile = savedlogs[i];
156 } 162 }
157 context->write_cycle = CYCLE_NEVER; 163 context->write_cycle = CYCLE_NEVER;
158 for (int i = 0; i < NUM_OPERATORS; i++) { 164 for (int i = 0; i < NUM_OPERATORS; i++) {
159 context->operators[i].envelope = MAX_ENVELOPE; 165 context->operators[i].envelope = MAX_ENVELOPE;
160 context->operators[i].env_phase = PHASE_RELEASE; 166 context->operators[i].env_phase = PHASE_RELEASE;