Remove GB DMG hacks that were a poor attempt to mimic vgmplay
parent
bf7e405ad8
commit
8c6f1fa152
|
@ -161,12 +161,6 @@ void Gb_Apu::set_tempo( double t )
|
||||||
frame_period = t ? blip_time_t (frame_period / t) : blip_time_t(0);
|
frame_period = t ? blip_time_t (frame_period / t) : blip_time_t(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gb_Apu::set_hacks( unsigned int mask )
|
|
||||||
{
|
|
||||||
wave.set_volume_hack((mask & 1) != 0);
|
|
||||||
noise.set_volume_hack((mask & 2) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Gb_Apu::Gb_Apu()
|
Gb_Apu::Gb_Apu()
|
||||||
{
|
{
|
||||||
wave.wave_ram = ®s [wave_ram - io_addr];
|
wave.wave_ram = ®s [wave_ram - io_addr];
|
||||||
|
@ -193,7 +187,6 @@ Gb_Apu::Gb_Apu()
|
||||||
set_tempo( 1.0 );
|
set_tempo( 1.0 );
|
||||||
volume_ = 1.0;
|
volume_ = 1.0;
|
||||||
reset();
|
reset();
|
||||||
set_hacks(4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gb_Apu::run_until_( blip_time_t end_time )
|
void Gb_Apu::run_until_( blip_time_t end_time )
|
||||||
|
|
|
@ -84,11 +84,6 @@ public:
|
||||||
// Loads state. You should call reset() BEFORE this.
|
// Loads state. You should call reset() BEFORE this.
|
||||||
blargg_err_t load_state( gb_apu_state_t const& in );
|
blargg_err_t load_state( gb_apu_state_t const& in );
|
||||||
|
|
||||||
// Enable hacks (bitmask):
|
|
||||||
// 0x01 = Double wave channel volume
|
|
||||||
// 0x02 = Low noise channel volume (disable doubling it)
|
|
||||||
void set_hacks( unsigned int mask );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// noncopyable
|
// noncopyable
|
||||||
Gb_Apu( const Gb_Apu& );
|
Gb_Apu( const Gb_Apu& );
|
||||||
|
|
|
@ -571,7 +571,6 @@ void Gb_Noise::run( blip_time_t time, blip_time_t end_time )
|
||||||
Blip_Synth_Fast const* const synth = fast_synth; // cache
|
Blip_Synth_Fast const* const synth = fast_synth; // cache
|
||||||
|
|
||||||
// Output amplitude transitions
|
// Output amplitude transitions
|
||||||
if (volume_hack) vol <<= 1;
|
|
||||||
int delta = -vol;
|
int delta = -vol;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -604,11 +603,11 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
|
||||||
#if GB_APU_NO_AGB
|
#if GB_APU_NO_AGB
|
||||||
static byte const shifts [4] = { 4+4, 0+4, 1+4, 2+4 };
|
static byte const shifts [4] = { 4+4, 0+4, 1+4, 2+4 };
|
||||||
int const volume_idx = regs [2] >> 5 & 3;
|
int const volume_idx = regs [2] >> 5 & 3;
|
||||||
int const volume_shift = shifts [volume_idx] - (volume_hack ? 1 : 0);
|
int const volume_shift = shifts [volume_idx];
|
||||||
int const volume_mul = 1;
|
int const volume_mul = 1;
|
||||||
#else
|
#else
|
||||||
static byte const volumes [8] = { 0, 4, 2, 1, 3, 3, 3, 3 };
|
static byte const volumes [8] = { 0, 4, 2, 1, 3, 3, 3, 3 };
|
||||||
int const volume_shift = 2 + 4 - (volume_hack ? 1 : 0);
|
int const volume_shift = 2 + 4;
|
||||||
int const volume_idx = regs [2] >> 5 & (agb_mask | 3); // 2 bits on DMG/CGB, 3 on AGB
|
int const volume_idx = regs [2] >> 5 & (agb_mask | 3); // 2 bits on DMG/CGB, 3 on AGB
|
||||||
int const volume_mul = volumes [volume_idx];
|
int const volume_mul = volumes [volume_idx];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,11 +112,8 @@ private:
|
||||||
|
|
||||||
class Gb_Noise : public Gb_Env {
|
class Gb_Noise : public Gb_Env {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int divider; // noise has more complex frequency divider setup
|
int divider; // noise has more complex frequency divider setup
|
||||||
|
|
||||||
bool volume_hack;
|
|
||||||
|
|
||||||
void run( blip_time_t, blip_time_t );
|
void run( blip_time_t, blip_time_t );
|
||||||
void write_register( int frame_phase, int reg, int old_data, int data );
|
void write_register( int frame_phase, int reg, int old_data, int data );
|
||||||
|
|
||||||
|
@ -125,11 +122,8 @@ public:
|
||||||
divider = 0;
|
divider = 0;
|
||||||
Gb_Env::reset();
|
Gb_Env::reset();
|
||||||
delay = 4 * clk_mul; // TODO: remove?
|
delay = 4 * clk_mul; // TODO: remove?
|
||||||
volume_hack = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_volume_hack( bool enable );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { period2_mask = 0x1FFFF };
|
enum { period2_mask = 0x1FFFF };
|
||||||
|
|
||||||
|
@ -138,14 +132,10 @@ private:
|
||||||
unsigned lfsr_mask() const { return (regs [3] & 0x08) ? ~0x4040 : ~0x4000; }
|
unsigned lfsr_mask() const { return (regs [3] & 0x08) ? ~0x4040 : ~0x4000; }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Gb_Noise::set_volume_hack( bool enable ) { volume_hack = enable; }
|
|
||||||
|
|
||||||
class Gb_Wave : public Gb_Osc {
|
class Gb_Wave : public Gb_Osc {
|
||||||
public:
|
public:
|
||||||
int sample_buf; // last wave RAM byte read (hardware has this as well)
|
int sample_buf; // last wave RAM byte read (hardware has this as well)
|
||||||
|
|
||||||
bool volume_hack;
|
|
||||||
|
|
||||||
void write_register( int frame_phase, int reg, int old_data, int data );
|
void write_register( int frame_phase, int reg, int old_data, int data );
|
||||||
void run( blip_time_t, blip_time_t );
|
void run( blip_time_t, blip_time_t );
|
||||||
|
|
||||||
|
@ -157,7 +147,6 @@ public:
|
||||||
{
|
{
|
||||||
sample_buf = 0;
|
sample_buf = 0;
|
||||||
Gb_Osc::reset();
|
Gb_Osc::reset();
|
||||||
volume_hack = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -177,16 +166,12 @@ private:
|
||||||
|
|
||||||
void corrupt_wave();
|
void corrupt_wave();
|
||||||
|
|
||||||
void set_volume_hack( bool enable );
|
|
||||||
|
|
||||||
BOOST::uint8_t* wave_bank() const { return &wave_ram [(~regs [0] & bank40_mask) >> 2 & agb_mask]; }
|
BOOST::uint8_t* wave_bank() const { return &wave_ram [(~regs [0] & bank40_mask) >> 2 & agb_mask]; }
|
||||||
|
|
||||||
// Wave index that would be accessed, or -1 if no access would occur
|
// Wave index that would be accessed, or -1 if no access would occur
|
||||||
int access( int addr ) const;
|
int access( int addr ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Gb_Wave::set_volume_hack( bool enable ) { volume_hack = enable; }
|
|
||||||
|
|
||||||
inline int Gb_Wave::read( int addr ) const
|
inline int Gb_Wave::read( int addr ) const
|
||||||
{
|
{
|
||||||
int index = access( addr );
|
int index = access( addr );
|
||||||
|
|
|
@ -895,9 +895,6 @@ blargg_err_t Vgm_Core::load_mem_( byte const data [], int size )
|
||||||
if ( !gbdmg_rate )
|
if ( !gbdmg_rate )
|
||||||
gbdmg_rate = Gb_Apu::clock_rate;
|
gbdmg_rate = Gb_Apu::clock_rate;
|
||||||
stereo_buf[3].clock_rate( gbdmg_rate );
|
stereo_buf[3].clock_rate( gbdmg_rate );
|
||||||
const int gbdmg_hacks = 3;
|
|
||||||
gbdmg[0].set_hacks( gbdmg_hacks );
|
|
||||||
gbdmg[1].set_hacks( gbdmg_hacks );
|
|
||||||
|
|
||||||
// Disable FM
|
// Disable FM
|
||||||
fm_rate = 0;
|
fm_rate = 0;
|
||||||
|
|
Loading…
Reference in New Issue