Remove GB DMG hacks that were a poor attempt to mimic vgmplay

CQTexperiment
Chris Moeller 2015-01-27 19:11:40 -08:00
parent bf7e405ad8
commit 8c6f1fa152
5 changed files with 2 additions and 33 deletions

View File

@ -161,12 +161,6 @@ void Gb_Apu::set_tempo( double t )
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()
{
wave.wave_ram = &regs [wave_ram - io_addr];
@ -193,7 +187,6 @@ Gb_Apu::Gb_Apu()
set_tempo( 1.0 );
volume_ = 1.0;
reset();
set_hacks(4);
}
void Gb_Apu::run_until_( blip_time_t end_time )

View File

@ -84,11 +84,6 @@ public:
// Loads state. You should call reset() BEFORE this.
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:
// noncopyable
Gb_Apu( const Gb_Apu& );

View File

@ -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
// Output amplitude transitions
if (volume_hack) vol <<= 1;
int delta = -vol;
do
{
@ -604,11 +603,11 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
#if GB_APU_NO_AGB
static byte const shifts [4] = { 4+4, 0+4, 1+4, 2+4 };
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;
#else
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_mul = volumes [volume_idx];
#endif

View File

@ -112,11 +112,8 @@ private:
class Gb_Noise : public Gb_Env {
public:
int divider; // noise has more complex frequency divider setup
bool volume_hack;
void run( blip_time_t, blip_time_t );
void write_register( int frame_phase, int reg, int old_data, int data );
@ -125,11 +122,8 @@ public:
divider = 0;
Gb_Env::reset();
delay = 4 * clk_mul; // TODO: remove?
volume_hack = true;
}
void set_volume_hack( bool enable );
private:
enum { period2_mask = 0x1FFFF };
@ -138,14 +132,10 @@ private:
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 {
public:
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 run( blip_time_t, blip_time_t );
@ -157,7 +147,6 @@ public:
{
sample_buf = 0;
Gb_Osc::reset();
volume_hack = false;
}
private:
@ -177,16 +166,12 @@ private:
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]; }
// Wave index that would be accessed, or -1 if no access would occur
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
{
int index = access( addr );

View File

@ -895,9 +895,6 @@ blargg_err_t Vgm_Core::load_mem_( byte const data [], int size )
if ( !gbdmg_rate )
gbdmg_rate = Gb_Apu::clock_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
fm_rate = 0;