This commit is contained in:
Themaister 2011-02-25 12:47:29 +01:00
parent ba59765774
commit eed83fa4ff
8 changed files with 20 additions and 15 deletions

View File

@ -24,8 +24,8 @@ void Audio::sample(int16 left, int16 right) {
system.interface->audio_sample(left, right);
} else {
dsp_buffer[dsp_wroffset] = ((uint16)left << 0) + ((uint16)right << 16);
dsp_wroffset = (dsp_wroffset + 1) & 32767;
dsp_length = (dsp_length + 1) & 32767;
dsp_wroffset = (dsp_wroffset + 1) & buffer_mask;
dsp_length = (dsp_length + 1) & buffer_mask;
flush();
}
}
@ -50,8 +50,8 @@ void Audio::coprocessor_sample(int16 left, int16 right) {
r_frac = r_step - first;
cop_buffer[cop_wroffset] = (output_left << 0) + (output_right << 16);
cop_wroffset = (cop_wroffset + 1) & 32767;
cop_length = (cop_length + 1) & 32767;
cop_wroffset = (cop_wroffset + 1) & buffer_mask;
cop_length = (cop_length + 1) & buffer_mask;
flush();
}
@ -63,8 +63,8 @@ void Audio::flush() {
uint32 dsp_sample = dsp_buffer[dsp_rdoffset];
uint32 cop_sample = cop_buffer[cop_rdoffset];
dsp_rdoffset = (dsp_rdoffset + 1) & 32767;
cop_rdoffset = (cop_rdoffset + 1) & 32767;
dsp_rdoffset = (dsp_rdoffset + 1) & buffer_mask;
cop_rdoffset = (cop_rdoffset + 1) & buffer_mask;
dsp_length--;
cop_length--;

View File

@ -8,7 +8,8 @@ public:
private:
bool coprocessor;
uint32 dsp_buffer[32768], cop_buffer[32768];
enum : unsigned { buffer_size = 32768, buffer_mask = buffer_size - 1 };
uint32 dsp_buffer[buffer_size], cop_buffer[buffer_size];
unsigned dsp_rdoffset, cop_rdoffset;
unsigned dsp_wroffset, cop_wroffset;
unsigned dsp_length, cop_length;

View File

@ -80,7 +80,6 @@ void Cheat::init() {
Cheat::Cheat() {
lookup = new uint8[16 * 1024 * 1024];
system_enabled = true;
//synchronize();
}
Cheat::~Cheat() {

View File

@ -22,7 +22,8 @@ void ICD2::enter() {
step(GameBoy::system.clocks_executed);
GameBoy::system.clocks_executed = 0;
} else { //DMG halted
step(4);
audio.coprocessor_sample(0x0000, 0x0000);
step(1);
}
synchronize_cpu();
}
@ -44,6 +45,9 @@ void ICD2::unload() {
}
void ICD2::power() {
audio.coprocessor_enable(true);
audio.coprocessor_frequency(4 * 1024 * 1024);
reset();
}

View File

@ -73,7 +73,8 @@ void ICD2::joyp_write(bool p15, bool p14) {
void ICD2::video_refresh(const uint8_t *data) {
}
void ICD2::audio_sample(signed left, signed right) {
void ICD2::audio_sample(int16_t center, int16_t left, int16_t right) {
audio.coprocessor_sample(left, right);
}
void ICD2::input_poll() {

View File

@ -1,6 +1,6 @@
void joyp_write(bool p15, bool p14);
void video_refresh(const uint8_t *data);
void audio_sample(signed left, signed right);
void audio_sample(int16_t center, int16_t left, int16_t right);
void input_poll();
bool input_poll(unsigned id);

View File

@ -1,8 +1,8 @@
namespace SNES {
namespace Info {
static const char Name[] = "bsnes";
static const char Version[] = "075";
static const unsigned SerializerVersion = 17;
static const char Version[] = "076";
static const unsigned SerializerVersion = 18;
}
}

View File

@ -121,6 +121,8 @@ void System::load() {
if(cartridge.has_st0018()) st0018.load();
if(cartridge.has_msu1()) msu1.load();
if(cartridge.has_serial()) serial.load();
serialize_init();
}
void System::unload() {
@ -183,7 +185,6 @@ void System::power() {
if(cartridge.has_serial()) cpu.coprocessors.append(&serial);
scheduler.init();
serialize_init();
cheat.init();
input.update();
@ -221,7 +222,6 @@ void System::reset() {
if(cartridge.has_serial()) cpu.coprocessors.append(&serial);
scheduler.init();
serialize_init();
cheat.init();
input.port_set_device(0, config.controller_port1.i);