You better believe it, it's a whitespace trim, and line conversions, eol settings comming up.
This commit is contained in:
parent
454a1a233d
commit
b248000efb
154
src/Sound.cpp
154
src/Sound.cpp
|
@ -76,11 +76,11 @@ class Gba_Pcm_Fifo {
|
||||||
public:
|
public:
|
||||||
int which;
|
int which;
|
||||||
Gba_Pcm pcm;
|
Gba_Pcm pcm;
|
||||||
|
|
||||||
void write_control( int data );
|
void write_control( int data );
|
||||||
void write_fifo( int data );
|
void write_fifo( int data );
|
||||||
void timer_overflowed( int which_timer );
|
void timer_overflowed( int which_timer );
|
||||||
|
|
||||||
// public only so save state routines can access it
|
// public only so save state routines can access it
|
||||||
int readIndex;
|
int readIndex;
|
||||||
int count;
|
int count;
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
u8 fifo [32];
|
u8 fifo [32];
|
||||||
int dac;
|
int dac;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int timer;
|
int timer;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
@ -115,11 +115,11 @@ void Gba_Pcm::init()
|
||||||
void Gba_Pcm::apply_control( int idx )
|
void Gba_Pcm::apply_control( int idx )
|
||||||
{
|
{
|
||||||
shift = ~ioMem [SGCNT0_H] >> (2 + idx) & 1;
|
shift = ~ioMem [SGCNT0_H] >> (2 + idx) & 1;
|
||||||
|
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
if ( (soundEnableFlag >> idx & 0x100) && (ioMem [NR52] & 0x80) )
|
if ( (soundEnableFlag >> idx & 0x100) && (ioMem [NR52] & 0x80) )
|
||||||
ch = ioMem [SGCNT0_H+1] >> (idx * 4) & 3;
|
ch = ioMem [SGCNT0_H+1] >> (idx * 4) & 3;
|
||||||
|
|
||||||
Blip_Buffer* out = 0;
|
Blip_Buffer* out = 0;
|
||||||
switch ( ch )
|
switch ( ch )
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ void Gba_Pcm::apply_control( int idx )
|
||||||
case 2: out = stereo_buffer->left(); break;
|
case 2: out = stereo_buffer->left(); break;
|
||||||
case 3: out = stereo_buffer->center(); break;
|
case 3: out = stereo_buffer->center(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( output != out )
|
if ( output != out )
|
||||||
{
|
{
|
||||||
if ( output )
|
if ( output )
|
||||||
|
@ -145,7 +145,7 @@ void Gba_Pcm::end_frame( blip_time_t time )
|
||||||
last_time -= time;
|
last_time -= time;
|
||||||
if ( last_time < -2048 )
|
if ( last_time < -2048 )
|
||||||
last_time = -2048;
|
last_time = -2048;
|
||||||
|
|
||||||
if ( output )
|
if ( output )
|
||||||
output->set_modified();
|
output->set_modified();
|
||||||
}
|
}
|
||||||
|
@ -155,27 +155,27 @@ void Gba_Pcm::update( int dac )
|
||||||
if ( output )
|
if ( output )
|
||||||
{
|
{
|
||||||
blip_time_t time = blip_time();
|
blip_time_t time = blip_time();
|
||||||
|
|
||||||
dac = (s8) dac >> shift;
|
dac = (s8) dac >> shift;
|
||||||
int delta = dac - last_amp;
|
int delta = dac - last_amp;
|
||||||
if ( delta )
|
if ( delta )
|
||||||
{
|
{
|
||||||
last_amp = dac;
|
last_amp = dac;
|
||||||
|
|
||||||
int filter = 0;
|
int filter = 0;
|
||||||
if ( soundInterpolation )
|
if ( soundInterpolation )
|
||||||
{
|
{
|
||||||
// base filtering on how long since last sample was output
|
// base filtering on how long since last sample was output
|
||||||
int period = time - last_time;
|
int period = time - last_time;
|
||||||
|
|
||||||
int idx = (unsigned) period / 512;
|
int idx = (unsigned) period / 512;
|
||||||
if ( idx >= 3 )
|
if ( idx >= 3 )
|
||||||
idx = 3;
|
idx = 3;
|
||||||
|
|
||||||
static int const filters [4] = { 0, 0, 1, 2 };
|
static int const filters [4] = { 0, 0, 1, 2 };
|
||||||
filter = filters [idx];
|
filter = filters [idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm_synth [filter].offset( time, delta, output );
|
pcm_synth [filter].offset( time, delta, output );
|
||||||
}
|
}
|
||||||
last_time = time;
|
last_time = time;
|
||||||
|
@ -201,7 +201,7 @@ void Gba_Pcm_Fifo::timer_overflowed( int which_timer )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read next sample from FIFO
|
// Read next sample from FIFO
|
||||||
count--;
|
count--;
|
||||||
dac = fifo [readIndex];
|
dac = fifo [readIndex];
|
||||||
|
@ -214,7 +214,7 @@ void Gba_Pcm_Fifo::write_control( int data )
|
||||||
{
|
{
|
||||||
enabled = (data & 0x0300) ? true : false;
|
enabled = (data & 0x0300) ? true : false;
|
||||||
timer = (data & 0x0400) ? 1 : 0;
|
timer = (data & 0x0400) ? 1 : 0;
|
||||||
|
|
||||||
if ( data & 0x0800 )
|
if ( data & 0x0800 )
|
||||||
{
|
{
|
||||||
// Reset
|
// Reset
|
||||||
|
@ -224,7 +224,7 @@ void Gba_Pcm_Fifo::write_control( int data )
|
||||||
dac = 0;
|
dac = 0;
|
||||||
memset( fifo, 0, sizeof fifo );
|
memset( fifo, 0, sizeof fifo );
|
||||||
}
|
}
|
||||||
|
|
||||||
pcm.apply_control( which );
|
pcm.apply_control( which );
|
||||||
pcm.update( dac );
|
pcm.update( dac );
|
||||||
}
|
}
|
||||||
|
@ -268,11 +268,11 @@ void soundEvent(u32 address, u8 data)
|
||||||
{
|
{
|
||||||
ioMem[address] = data;
|
ioMem[address] = data;
|
||||||
gb_apu->write_register( blip_time(), gb_addr, data );
|
gb_apu->write_register( blip_time(), gb_addr, data );
|
||||||
|
|
||||||
if ( address == NR52 )
|
if ( address == NR52 )
|
||||||
apply_control();
|
apply_control();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: what about byte writes to SGCNT0_H etc.?
|
// TODO: what about byte writes to SGCNT0_H etc.?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,17 +280,17 @@ static void apply_volume( bool apu_only = false )
|
||||||
{
|
{
|
||||||
if ( !apu_only )
|
if ( !apu_only )
|
||||||
soundVolume_ = soundVolume;
|
soundVolume_ = soundVolume;
|
||||||
|
|
||||||
// Emulator volume
|
// Emulator volume
|
||||||
static float const vols [6] = { 1, 2, 3, 4, 0.25, 0.5 };
|
static float const vols [6] = { 1, 2, 3, 4, 0.25, 0.5 };
|
||||||
double const volume = vols [soundVolume_];
|
double const volume = vols [soundVolume_];
|
||||||
|
|
||||||
if ( gb_apu )
|
if ( gb_apu )
|
||||||
{
|
{
|
||||||
static float const apu_vols [4] = { 0.25, 0.5, 1, 0.25 };
|
static float const apu_vols [4] = { 0.25, 0.5, 1, 0.25 };
|
||||||
gb_apu->volume( volume * apu_vols [ioMem [SGCNT0_H] & 3] );
|
gb_apu->volume( volume * apu_vols [ioMem [SGCNT0_H] & 3] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !apu_only )
|
if ( !apu_only )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < 3; i++ )
|
for ( int i = 0; i < 3; i++ )
|
||||||
|
@ -313,24 +313,24 @@ void soundEvent(u32 address, u16 data)
|
||||||
case SGCNT0_H:
|
case SGCNT0_H:
|
||||||
write_SGCNT0_H( data );
|
write_SGCNT0_H( data );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIFOA_L:
|
case FIFOA_L:
|
||||||
case FIFOA_H:
|
case FIFOA_H:
|
||||||
pcm [0].write_fifo( data );
|
pcm [0].write_fifo( data );
|
||||||
WRITE16LE( &ioMem[address], data );
|
WRITE16LE( &ioMem[address], data );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIFOB_L:
|
case FIFOB_L:
|
||||||
case FIFOB_H:
|
case FIFOB_H:
|
||||||
pcm [1].write_fifo( data );
|
pcm [1].write_fifo( data );
|
||||||
WRITE16LE( &ioMem[address], data );
|
WRITE16LE( &ioMem[address], data );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x88:
|
case 0x88:
|
||||||
data &= 0xC3FF;
|
data &= 0xC3FF;
|
||||||
WRITE16LE( &ioMem[address], data );
|
WRITE16LE( &ioMem[address], data );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
soundEvent( address & ~1, (u8) (data ) ); // even
|
soundEvent( address & ~1, (u8) (data ) ); // even
|
||||||
soundEvent( address | 1, (u8) (data >> 8) ); // odd
|
soundEvent( address | 1, (u8) (data >> 8) ); // odd
|
||||||
|
@ -348,7 +348,7 @@ static void end_frame( blip_time_t time )
|
||||||
{
|
{
|
||||||
pcm [0].pcm.end_frame( time );
|
pcm [0].pcm.end_frame( time );
|
||||||
pcm [1].pcm.end_frame( time );
|
pcm [1].pcm.end_frame( time );
|
||||||
|
|
||||||
gb_apu ->end_frame( time );
|
gb_apu ->end_frame( time );
|
||||||
stereo_buffer->end_frame( time );
|
stereo_buffer->end_frame( time );
|
||||||
}
|
}
|
||||||
|
@ -357,10 +357,10 @@ static void flush_samples()
|
||||||
{
|
{
|
||||||
// soundBufferLen should have a whole number of sample pairs
|
// soundBufferLen should have a whole number of sample pairs
|
||||||
assert( soundBufferLen % (2 * sizeof *soundFinalWave) == 0 );
|
assert( soundBufferLen % (2 * sizeof *soundFinalWave) == 0 );
|
||||||
|
|
||||||
// number of samples in output buffer
|
// number of samples in output buffer
|
||||||
int const out_buf_size = soundBufferLen / sizeof *soundFinalWave;
|
int const out_buf_size = soundBufferLen / sizeof *soundFinalWave;
|
||||||
|
|
||||||
// Keep filling and writing soundFinalWave until it can't be fully filled
|
// Keep filling and writing soundFinalWave until it can't be fully filled
|
||||||
while ( stereo_buffer->samples_avail() >= out_buf_size )
|
while ( stereo_buffer->samples_avail() >= out_buf_size )
|
||||||
{
|
{
|
||||||
|
@ -378,10 +378,10 @@ static void flush_samples()
|
||||||
static void apply_filtering()
|
static void apply_filtering()
|
||||||
{
|
{
|
||||||
soundFiltering_ = soundFiltering;
|
soundFiltering_ = soundFiltering;
|
||||||
|
|
||||||
int const base_freq = (int) (32768 - soundFiltering_ * 16384);
|
int const base_freq = (int) (32768 - soundFiltering_ * 16384);
|
||||||
int const nyquist = stereo_buffer->sample_rate() / 2;
|
int const nyquist = stereo_buffer->sample_rate() / 2;
|
||||||
|
|
||||||
for ( int i = 0; i < 3; i++ )
|
for ( int i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
int cutoff = base_freq >> i;
|
int cutoff = base_freq >> i;
|
||||||
|
@ -397,12 +397,12 @@ static void soundTick()
|
||||||
{
|
{
|
||||||
// Run sound hardware to present
|
// Run sound hardware to present
|
||||||
end_frame( SOUND_CLOCK_TICKS );
|
end_frame( SOUND_CLOCK_TICKS );
|
||||||
|
|
||||||
flush_samples();
|
flush_samples();
|
||||||
|
|
||||||
if ( soundFiltering_ != soundFiltering )
|
if ( soundFiltering_ != soundFiltering )
|
||||||
apply_filtering();
|
apply_filtering();
|
||||||
|
|
||||||
if ( soundVolume_ != soundVolume )
|
if ( soundVolume_ != soundVolume )
|
||||||
apply_volume();
|
apply_volume();
|
||||||
}
|
}
|
||||||
|
@ -414,10 +414,10 @@ static void apply_muting()
|
||||||
{
|
{
|
||||||
if ( !stereo_buffer || !ioMem )
|
if ( !stereo_buffer || !ioMem )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// PCM
|
// PCM
|
||||||
apply_control();
|
apply_control();
|
||||||
|
|
||||||
if ( gb_apu )
|
if ( gb_apu )
|
||||||
{
|
{
|
||||||
// APU
|
// APU
|
||||||
|
@ -435,10 +435,10 @@ static void apply_muting()
|
||||||
static void reset_apu()
|
static void reset_apu()
|
||||||
{
|
{
|
||||||
gb_apu->reset( gb_apu->mode_agb, true );
|
gb_apu->reset( gb_apu->mode_agb, true );
|
||||||
|
|
||||||
if ( stereo_buffer )
|
if ( stereo_buffer )
|
||||||
stereo_buffer->clear();
|
stereo_buffer->clear();
|
||||||
|
|
||||||
soundTicks = SOUND_CLOCK_TICKS;
|
soundTicks = SOUND_CLOCK_TICKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,32 +446,32 @@ static void remake_stereo_buffer()
|
||||||
{
|
{
|
||||||
if ( !ioMem )
|
if ( !ioMem )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Clears pointers kept to old stereo_buffer
|
// Clears pointers kept to old stereo_buffer
|
||||||
pcm [0].pcm.init();
|
pcm [0].pcm.init();
|
||||||
pcm [1].pcm.init();
|
pcm [1].pcm.init();
|
||||||
|
|
||||||
// Stereo_Buffer
|
// Stereo_Buffer
|
||||||
delete stereo_buffer;
|
delete stereo_buffer;
|
||||||
stereo_buffer = 0;
|
stereo_buffer = 0;
|
||||||
|
|
||||||
stereo_buffer = new Stereo_Buffer; // TODO: handle out of memory
|
stereo_buffer = new Stereo_Buffer; // TODO: handle out of memory
|
||||||
long const sample_rate = 44100 / soundQuality;
|
long const sample_rate = 44100 / soundQuality;
|
||||||
stereo_buffer->set_sample_rate( sample_rate ); // TODO: handle out of memory
|
stereo_buffer->set_sample_rate( sample_rate ); // TODO: handle out of memory
|
||||||
stereo_buffer->clock_rate( gb_apu->clock_rate );
|
stereo_buffer->clock_rate( gb_apu->clock_rate );
|
||||||
|
|
||||||
// PCM
|
// PCM
|
||||||
pcm [0].which = 0;
|
pcm [0].which = 0;
|
||||||
pcm [1].which = 1;
|
pcm [1].which = 1;
|
||||||
apply_filtering();
|
apply_filtering();
|
||||||
|
|
||||||
// APU
|
// APU
|
||||||
if ( !gb_apu )
|
if ( !gb_apu )
|
||||||
{
|
{
|
||||||
gb_apu = new Gb_Apu; // TODO: handle out of memory
|
gb_apu = new Gb_Apu; // TODO: handle out of memory
|
||||||
reset_apu();
|
reset_apu();
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_muting();
|
apply_muting();
|
||||||
apply_volume();
|
apply_volume();
|
||||||
}
|
}
|
||||||
|
@ -523,16 +523,16 @@ int soundGetEnable()
|
||||||
void soundReset()
|
void soundReset()
|
||||||
{
|
{
|
||||||
systemSoundReset();
|
systemSoundReset();
|
||||||
|
|
||||||
remake_stereo_buffer();
|
remake_stereo_buffer();
|
||||||
reset_apu();
|
reset_apu();
|
||||||
|
|
||||||
setsoundPaused(true);
|
setsoundPaused(true);
|
||||||
SOUND_CLOCK_TICKS = SOUND_CLOCK_TICKS_;
|
SOUND_CLOCK_TICKS = SOUND_CLOCK_TICKS_;
|
||||||
soundTicks = SOUND_CLOCK_TICKS_;
|
soundTicks = SOUND_CLOCK_TICKS_;
|
||||||
|
|
||||||
soundNextPosition = 0;
|
soundNextPosition = 0;
|
||||||
|
|
||||||
soundEvent( NR52, (u8) 0x80 );
|
soundEvent( NR52, (u8) 0x80 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ bool soundInit()
|
||||||
{
|
{
|
||||||
if ( !systemSoundInit() )
|
if ( !systemSoundInit() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
soundPaused = true;
|
soundPaused = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -553,10 +553,10 @@ void soundSetQuality(int quality)
|
||||||
{
|
{
|
||||||
if ( !soundOffFlag )
|
if ( !soundOffFlag )
|
||||||
soundShutdown();
|
soundShutdown();
|
||||||
|
|
||||||
soundQuality = quality;
|
soundQuality = quality;
|
||||||
soundNextPosition = 0;
|
soundNextPosition = 0;
|
||||||
|
|
||||||
if ( !soundOffFlag )
|
if ( !soundOffFlag )
|
||||||
soundInit();
|
soundInit();
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ void soundSetQuality(int quality)
|
||||||
soundQuality = quality;
|
soundQuality = quality;
|
||||||
soundNextPosition = 0;
|
soundNextPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
remake_stereo_buffer();
|
remake_stereo_buffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ static int dummy_state [16];
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
gb_apu_state_t apu;
|
gb_apu_state_t apu;
|
||||||
|
|
||||||
// old state
|
// old state
|
||||||
u8 soundDSAValue;
|
u8 soundDSAValue;
|
||||||
int soundDSBValue;
|
int soundDSBValue;
|
||||||
|
@ -656,7 +656,7 @@ static variable_desc old_gba_state [] =
|
||||||
SKIP( int, soundDSBTimer ),
|
SKIP( int, soundDSBTimer ),
|
||||||
LOAD( u8 [32], pcm [1].fifo ),
|
LOAD( u8 [32], pcm [1].fifo ),
|
||||||
LOAD( int, state.soundDSBValue ),
|
LOAD( int, state.soundDSBValue ),
|
||||||
|
|
||||||
// skipped manually
|
// skipped manually
|
||||||
//LOAD( int, soundBuffer[0][0], 6*735 },
|
//LOAD( int, soundBuffer[0][0], 6*735 },
|
||||||
//LOAD( int, soundFinalWave[0], 2*735 },
|
//LOAD( int, soundFinalWave[0], 2*735 },
|
||||||
|
@ -681,45 +681,45 @@ static variable_desc gba_state [] =
|
||||||
LOAD( int, pcm [0].writeIndex ),
|
LOAD( int, pcm [0].writeIndex ),
|
||||||
LOAD(u8[32],pcm[0].fifo ),
|
LOAD(u8[32],pcm[0].fifo ),
|
||||||
LOAD( int, pcm [0].dac ),
|
LOAD( int, pcm [0].dac ),
|
||||||
|
|
||||||
SKIP( int [4], room_for_expansion ),
|
SKIP( int [4], room_for_expansion ),
|
||||||
|
|
||||||
LOAD( int, pcm [1].readIndex ),
|
LOAD( int, pcm [1].readIndex ),
|
||||||
LOAD( int, pcm [1].count ),
|
LOAD( int, pcm [1].count ),
|
||||||
LOAD( int, pcm [1].writeIndex ),
|
LOAD( int, pcm [1].writeIndex ),
|
||||||
LOAD(u8[32],pcm[1].fifo ),
|
LOAD(u8[32],pcm[1].fifo ),
|
||||||
LOAD( int, pcm [1].dac ),
|
LOAD( int, pcm [1].dac ),
|
||||||
|
|
||||||
SKIP( int [4], room_for_expansion ),
|
SKIP( int [4], room_for_expansion ),
|
||||||
|
|
||||||
// APU
|
// APU
|
||||||
LOAD( u8 [0x40], state.apu.regs ), // last values written to registers and wave RAM (both banks)
|
LOAD( u8 [0x40], state.apu.regs ), // last values written to registers and wave RAM (both banks)
|
||||||
LOAD( int, state.apu.frame_time ), // clocks until next frame sequencer action
|
LOAD( int, state.apu.frame_time ), // clocks until next frame sequencer action
|
||||||
LOAD( int, state.apu.frame_phase ), // next step frame sequencer will run
|
LOAD( int, state.apu.frame_phase ), // next step frame sequencer will run
|
||||||
|
|
||||||
LOAD( int, state.apu.sweep_freq ), // sweep's internal frequency register
|
LOAD( int, state.apu.sweep_freq ), // sweep's internal frequency register
|
||||||
LOAD( int, state.apu.sweep_delay ), // clocks until next sweep action
|
LOAD( int, state.apu.sweep_delay ), // clocks until next sweep action
|
||||||
LOAD( int, state.apu.sweep_enabled ),
|
LOAD( int, state.apu.sweep_enabled ),
|
||||||
LOAD( int, state.apu.sweep_neg ), // obscure internal flag
|
LOAD( int, state.apu.sweep_neg ), // obscure internal flag
|
||||||
LOAD( int, state.apu.noise_divider ),
|
LOAD( int, state.apu.noise_divider ),
|
||||||
LOAD( int, state.apu.wave_buf ), // last read byte of wave RAM
|
LOAD( int, state.apu.wave_buf ), // last read byte of wave RAM
|
||||||
|
|
||||||
LOAD( int [4], state.apu.delay ), // clocks until next channel action
|
LOAD( int [4], state.apu.delay ), // clocks until next channel action
|
||||||
LOAD( int [4], state.apu.length_ctr ),
|
LOAD( int [4], state.apu.length_ctr ),
|
||||||
LOAD( int [4], state.apu.phase ), // square/wave phase, noise LFSR
|
LOAD( int [4], state.apu.phase ), // square/wave phase, noise LFSR
|
||||||
LOAD( int [4], state.apu.enabled ), // internal enabled flag
|
LOAD( int [4], state.apu.enabled ), // internal enabled flag
|
||||||
|
|
||||||
LOAD( int [3], state.apu.env_delay ), // clocks until next envelope action
|
LOAD( int [3], state.apu.env_delay ), // clocks until next envelope action
|
||||||
LOAD( int [3], state.apu.env_volume ),
|
LOAD( int [3], state.apu.env_volume ),
|
||||||
LOAD( int [3], state.apu.env_enabled ),
|
LOAD( int [3], state.apu.env_enabled ),
|
||||||
|
|
||||||
SKIP( int [13], room_for_expansion ),
|
SKIP( int [13], room_for_expansion ),
|
||||||
|
|
||||||
// Emulator
|
// Emulator
|
||||||
LOAD( int, soundEnableFlag ),
|
LOAD( int, soundEnableFlag ),
|
||||||
|
|
||||||
SKIP( int [15], room_for_expansion ),
|
SKIP( int [15], room_for_expansion ),
|
||||||
|
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -727,13 +727,13 @@ static variable_desc gba_state [] =
|
||||||
static void skip_read( gzFile in, int count )
|
static void skip_read( gzFile in, int count )
|
||||||
{
|
{
|
||||||
char buf [512];
|
char buf [512];
|
||||||
|
|
||||||
while ( count )
|
while ( count )
|
||||||
{
|
{
|
||||||
int n = sizeof buf;
|
int n = sizeof buf;
|
||||||
if ( n > count )
|
if ( n > count )
|
||||||
n = count;
|
n = count;
|
||||||
|
|
||||||
count -= n;
|
count -= n;
|
||||||
utilGzRead( in, buf, n );
|
utilGzRead( in, buf, n );
|
||||||
}
|
}
|
||||||
|
@ -742,10 +742,10 @@ static void skip_read( gzFile in, int count )
|
||||||
void soundSaveGame( gzFile out )
|
void soundSaveGame( gzFile out )
|
||||||
{
|
{
|
||||||
gb_apu->save_state( &state.apu );
|
gb_apu->save_state( &state.apu );
|
||||||
|
|
||||||
// Be sure areas for expansion get written as zero
|
// Be sure areas for expansion get written as zero
|
||||||
memset( dummy_state, 0, sizeof dummy_state );
|
memset( dummy_state, 0, sizeof dummy_state );
|
||||||
|
|
||||||
utilWriteData( out, gba_state );
|
utilWriteData( out, gba_state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ static void soundReadGameOld( gzFile in, int version )
|
||||||
// Read main data
|
// Read main data
|
||||||
utilReadData( in, old_gba_state );
|
utilReadData( in, old_gba_state );
|
||||||
skip_read( in, 6*735 + 2*735 );
|
skip_read( in, 6*735 + 2*735 );
|
||||||
|
|
||||||
// Copy APU regs
|
// Copy APU regs
|
||||||
static int const regs_to_copy [] = {
|
static int const regs_to_copy [] = {
|
||||||
NR10, NR11, NR12, NR13, NR14,
|
NR10, NR11, NR12, NR13, NR14,
|
||||||
|
@ -763,24 +763,24 @@ static void soundReadGameOld( gzFile in, int version )
|
||||||
NR41, NR42, NR43, NR44,
|
NR41, NR42, NR43, NR44,
|
||||||
NR50, NR51, NR52, -1
|
NR50, NR51, NR52, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
ioMem [NR52] |= 0x80; // old sound played even when this wasn't set (power on)
|
ioMem [NR52] |= 0x80; // old sound played even when this wasn't set (power on)
|
||||||
|
|
||||||
for ( int i = 0; regs_to_copy [i] >= 0; i++ )
|
for ( int i = 0; regs_to_copy [i] >= 0; i++ )
|
||||||
state.apu.regs [gba_to_gb_sound( regs_to_copy [i] ) - 0xFF10] = ioMem [regs_to_copy [i]];
|
state.apu.regs [gba_to_gb_sound( regs_to_copy [i] ) - 0xFF10] = ioMem [regs_to_copy [i]];
|
||||||
|
|
||||||
// Copy wave RAM to both banks
|
// Copy wave RAM to both banks
|
||||||
memcpy( &state.apu.regs [0x20], &ioMem [0x90], 0x10 );
|
memcpy( &state.apu.regs [0x20], &ioMem [0x90], 0x10 );
|
||||||
memcpy( &state.apu.regs [0x30], &ioMem [0x90], 0x10 );
|
memcpy( &state.apu.regs [0x30], &ioMem [0x90], 0x10 );
|
||||||
|
|
||||||
// Read both banks of wave RAM if available
|
// Read both banks of wave RAM if available
|
||||||
if ( version >= SAVE_GAME_VERSION_3 )
|
if ( version >= SAVE_GAME_VERSION_3 )
|
||||||
utilReadData( in, old_gba_state2 );
|
utilReadData( in, old_gba_state2 );
|
||||||
|
|
||||||
// Restore PCM
|
// Restore PCM
|
||||||
pcm [0].dac = state.soundDSAValue;
|
pcm [0].dac = state.soundDSAValue;
|
||||||
pcm [1].dac = state.soundDSBValue;
|
pcm [1].dac = state.soundDSBValue;
|
||||||
|
|
||||||
int quality = utilReadInt( in ); // ignore this crap
|
int quality = utilReadInt( in ); // ignore this crap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,14 +791,14 @@ void soundReadGame( gzFile in, int version )
|
||||||
// Prepare APU and default state
|
// Prepare APU and default state
|
||||||
reset_apu();
|
reset_apu();
|
||||||
gb_apu->save_state( &state.apu );
|
gb_apu->save_state( &state.apu );
|
||||||
|
|
||||||
if ( version > SAVE_GAME_VERSION_9 )
|
if ( version > SAVE_GAME_VERSION_9 )
|
||||||
utilReadData( in, gba_state );
|
utilReadData( in, gba_state );
|
||||||
else
|
else
|
||||||
soundReadGameOld( in, version );
|
soundReadGameOld( in, version );
|
||||||
|
|
||||||
gb_apu->load_state( state.apu );
|
gb_apu->load_state( state.apu );
|
||||||
write_SGCNT0_H( READ16LE( &ioMem [SGCNT0_H] ) & 0x770F );
|
write_SGCNT0_H( READ16LE( &ioMem [SGCNT0_H] ) & 0x770F );
|
||||||
|
|
||||||
apply_muting();
|
apply_muting();
|
||||||
}
|
}
|
||||||
|
|
7966
src/agb/GBA.cpp
7966
src/agb/GBA.cpp
File diff suppressed because it is too large
Load Diff
320
src/agb/GBA.h
320
src/agb/GBA.h
|
@ -1,160 +1,160 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2005 Forgotten and the VBA development team
|
// Copyright (C) 2005 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef VBA_GBA_H
|
#ifndef VBA_GBA_H
|
||||||
#define VBA_GBA_H
|
#define VBA_GBA_H
|
||||||
|
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
|
|
||||||
#define SAVE_GAME_VERSION_1 1
|
#define SAVE_GAME_VERSION_1 1
|
||||||
#define SAVE_GAME_VERSION_2 2
|
#define SAVE_GAME_VERSION_2 2
|
||||||
#define SAVE_GAME_VERSION_3 3
|
#define SAVE_GAME_VERSION_3 3
|
||||||
#define SAVE_GAME_VERSION_4 4
|
#define SAVE_GAME_VERSION_4 4
|
||||||
#define SAVE_GAME_VERSION_5 5
|
#define SAVE_GAME_VERSION_5 5
|
||||||
#define SAVE_GAME_VERSION_6 6
|
#define SAVE_GAME_VERSION_6 6
|
||||||
#define SAVE_GAME_VERSION_7 7
|
#define SAVE_GAME_VERSION_7 7
|
||||||
#define SAVE_GAME_VERSION_8 8
|
#define SAVE_GAME_VERSION_8 8
|
||||||
#define SAVE_GAME_VERSION_9 9
|
#define SAVE_GAME_VERSION_9 9
|
||||||
#define SAVE_GAME_VERSION_10 10
|
#define SAVE_GAME_VERSION_10 10
|
||||||
#define SAVE_GAME_VERSION SAVE_GAME_VERSION_10
|
#define SAVE_GAME_VERSION SAVE_GAME_VERSION_10
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 *address;
|
u8 *address;
|
||||||
u32 mask;
|
u32 mask;
|
||||||
} memoryMap;
|
} memoryMap;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
u8 B3;
|
u8 B3;
|
||||||
u8 B2;
|
u8 B2;
|
||||||
u8 B1;
|
u8 B1;
|
||||||
u8 B0;
|
u8 B0;
|
||||||
#else
|
#else
|
||||||
u8 B0;
|
u8 B0;
|
||||||
u8 B1;
|
u8 B1;
|
||||||
u8 B2;
|
u8 B2;
|
||||||
u8 B3;
|
u8 B3;
|
||||||
#endif
|
#endif
|
||||||
} B;
|
} B;
|
||||||
struct {
|
struct {
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
u16 W1;
|
u16 W1;
|
||||||
u16 W0;
|
u16 W0;
|
||||||
#else
|
#else
|
||||||
u16 W0;
|
u16 W0;
|
||||||
u16 W1;
|
u16 W1;
|
||||||
#endif
|
#endif
|
||||||
} W;
|
} W;
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
volatile u32 I;
|
volatile u32 I;
|
||||||
#else
|
#else
|
||||||
u32 I;
|
u32 I;
|
||||||
#endif
|
#endif
|
||||||
} reg_pair;
|
} reg_pair;
|
||||||
|
|
||||||
#ifndef NO_GBA_MAP
|
#ifndef NO_GBA_MAP
|
||||||
extern memoryMap map[256];
|
extern memoryMap map[256];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern reg_pair reg[45];
|
extern reg_pair reg[45];
|
||||||
extern u8 biosProtected[4];
|
extern u8 biosProtected[4];
|
||||||
|
|
||||||
extern bool N_FLAG;
|
extern bool N_FLAG;
|
||||||
extern bool Z_FLAG;
|
extern bool Z_FLAG;
|
||||||
extern bool C_FLAG;
|
extern bool C_FLAG;
|
||||||
extern bool V_FLAG;
|
extern bool V_FLAG;
|
||||||
extern bool armIrqEnable;
|
extern bool armIrqEnable;
|
||||||
extern bool armState;
|
extern bool armState;
|
||||||
extern int armMode;
|
extern int armMode;
|
||||||
extern void (*cpuSaveGameFunc)(u32,u8);
|
extern void (*cpuSaveGameFunc)(u32,u8);
|
||||||
|
|
||||||
#ifdef BKPT_SUPPORT
|
#ifdef BKPT_SUPPORT
|
||||||
extern u8 freezeWorkRAM[0x40000];
|
extern u8 freezeWorkRAM[0x40000];
|
||||||
extern u8 freezeInternalRAM[0x8000];
|
extern u8 freezeInternalRAM[0x8000];
|
||||||
extern u8 freezeVRAM[0x18000];
|
extern u8 freezeVRAM[0x18000];
|
||||||
extern u8 freezeOAM[0x400];
|
extern u8 freezeOAM[0x400];
|
||||||
extern u8 freezePRAM[0x400];
|
extern u8 freezePRAM[0x400];
|
||||||
extern bool debugger_last;
|
extern bool debugger_last;
|
||||||
extern int oldreg[17];
|
extern int oldreg[17];
|
||||||
extern char oldbuffer[10];
|
extern char oldbuffer[10];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool CPUReadGSASnapshot(const char *);
|
extern bool CPUReadGSASnapshot(const char *);
|
||||||
extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *);
|
extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *);
|
||||||
extern bool CPUWriteBatteryFile(const char *);
|
extern bool CPUWriteBatteryFile(const char *);
|
||||||
extern bool CPUReadBatteryFile(const char *);
|
extern bool CPUReadBatteryFile(const char *);
|
||||||
extern bool CPUExportEepromFile(const char *);
|
extern bool CPUExportEepromFile(const char *);
|
||||||
extern bool CPUImportEepromFile(const char *);
|
extern bool CPUImportEepromFile(const char *);
|
||||||
extern bool CPUWritePNGFile(const char *);
|
extern bool CPUWritePNGFile(const char *);
|
||||||
extern bool CPUWriteBMPFile(const char *);
|
extern bool CPUWriteBMPFile(const char *);
|
||||||
extern void CPUCleanUp();
|
extern void CPUCleanUp();
|
||||||
extern void CPUUpdateRender();
|
extern void CPUUpdateRender();
|
||||||
extern void CPUUpdateRenderBuffers(bool);
|
extern void CPUUpdateRenderBuffers(bool);
|
||||||
extern bool CPUReadMemState(char *, int);
|
extern bool CPUReadMemState(char *, int);
|
||||||
extern bool CPUReadState(const char *);
|
extern bool CPUReadState(const char *);
|
||||||
extern bool CPUWriteMemState(char *, int);
|
extern bool CPUWriteMemState(char *, int);
|
||||||
extern bool CPUWriteState(const char *);
|
extern bool CPUWriteState(const char *);
|
||||||
extern int CPULoadRom(const char *);
|
extern int CPULoadRom(const char *);
|
||||||
extern void doMirroring(bool);
|
extern void doMirroring(bool);
|
||||||
extern void CPUUpdateRegister(u32, u16);
|
extern void CPUUpdateRegister(u32, u16);
|
||||||
extern void applyTimer ();
|
extern void applyTimer ();
|
||||||
extern void CPUInit(const char *,bool);
|
extern void CPUInit(const char *,bool);
|
||||||
extern void CPUReset();
|
extern void CPUReset();
|
||||||
extern void CPULoop(int);
|
extern void CPULoop(int);
|
||||||
extern void CPUCheckDMA(int,int);
|
extern void CPUCheckDMA(int,int);
|
||||||
extern bool CPUIsGBAImage(const char *);
|
extern bool CPUIsGBAImage(const char *);
|
||||||
extern bool CPUIsZipFile(const char *);
|
extern bool CPUIsZipFile(const char *);
|
||||||
#ifdef PROFILING
|
#ifdef PROFILING
|
||||||
#include "prof/prof.h"
|
#include "prof/prof.h"
|
||||||
extern void cpuProfil(profile_segment *seg);
|
extern void cpuProfil(profile_segment *seg);
|
||||||
extern void cpuEnableProfiling(int hz);
|
extern void cpuEnableProfiling(int hz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern struct EmulatedSystem GBASystem;
|
extern struct EmulatedSystem GBASystem;
|
||||||
|
|
||||||
#define R13_IRQ 18
|
#define R13_IRQ 18
|
||||||
#define R14_IRQ 19
|
#define R14_IRQ 19
|
||||||
#define SPSR_IRQ 20
|
#define SPSR_IRQ 20
|
||||||
#define R13_USR 26
|
#define R13_USR 26
|
||||||
#define R14_USR 27
|
#define R14_USR 27
|
||||||
#define R13_SVC 28
|
#define R13_SVC 28
|
||||||
#define R14_SVC 29
|
#define R14_SVC 29
|
||||||
#define SPSR_SVC 30
|
#define SPSR_SVC 30
|
||||||
#define R13_ABT 31
|
#define R13_ABT 31
|
||||||
#define R14_ABT 32
|
#define R14_ABT 32
|
||||||
#define SPSR_ABT 33
|
#define SPSR_ABT 33
|
||||||
#define R13_UND 34
|
#define R13_UND 34
|
||||||
#define R14_UND 35
|
#define R14_UND 35
|
||||||
#define SPSR_UND 36
|
#define SPSR_UND 36
|
||||||
#define R8_FIQ 37
|
#define R8_FIQ 37
|
||||||
#define R9_FIQ 38
|
#define R9_FIQ 38
|
||||||
#define R10_FIQ 39
|
#define R10_FIQ 39
|
||||||
#define R11_FIQ 40
|
#define R11_FIQ 40
|
||||||
#define R12_FIQ 41
|
#define R12_FIQ 41
|
||||||
#define R13_FIQ 42
|
#define R13_FIQ 42
|
||||||
#define R14_FIQ 43
|
#define R14_FIQ 43
|
||||||
#define SPSR_FIQ 44
|
#define SPSR_FIQ 44
|
||||||
|
|
||||||
#include "../Cheats.h"
|
#include "../Cheats.h"
|
||||||
#include "../Globals.h"
|
#include "../Globals.h"
|
||||||
#include "../EEprom.h"
|
#include "../EEprom.h"
|
||||||
#include "../Flash.h"
|
#include "../Flash.h"
|
||||||
|
|
||||||
#endif //VBA_GBA_H
|
#endif //VBA_GBA_H
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
|
|
||||||
int coeff[32] = {
|
int coeff[32] = {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16};
|
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16};
|
||||||
|
|
||||||
u32 line0[240];
|
u32 line0[240];
|
||||||
u32 line1[240];
|
u32 line1[240];
|
||||||
u32 line2[240];
|
u32 line2[240];
|
||||||
u32 line3[240];
|
u32 line3[240];
|
||||||
u32 lineOBJ[240];
|
u32 lineOBJ[240];
|
||||||
u32 lineOBJWin[240];
|
u32 lineOBJWin[240];
|
||||||
u32 lineMix[240];
|
u32 lineMix[240];
|
||||||
bool gfxInWin0[240];
|
bool gfxInWin0[240];
|
||||||
bool gfxInWin1[240];
|
bool gfxInWin1[240];
|
||||||
int lineOBJpixleft[128];
|
int lineOBJpixleft[128];
|
||||||
|
|
||||||
int gfxBG2Changed = 0;
|
int gfxBG2Changed = 0;
|
||||||
int gfxBG3Changed = 0;
|
int gfxBG3Changed = 0;
|
||||||
|
|
||||||
int gfxBG2X = 0;
|
int gfxBG2X = 0;
|
||||||
int gfxBG2Y = 0;
|
int gfxBG2Y = 0;
|
||||||
int gfxBG2LastX = 0;
|
int gfxBG2LastX = 0;
|
||||||
int gfxBG2LastY = 0;
|
int gfxBG2LastY = 0;
|
||||||
int gfxBG3X = 0;
|
int gfxBG3X = 0;
|
||||||
int gfxBG3Y = 0;
|
int gfxBG3Y = 0;
|
||||||
int gfxBG3LastX = 0;
|
int gfxBG3LastX = 0;
|
||||||
int gfxBG3LastY = 0;
|
int gfxBG3LastY = 0;
|
||||||
int gfxLastVCOUNT = 0;
|
int gfxLastVCOUNT = 0;
|
||||||
|
|
3204
src/agb/GBAGfx.h
3204
src/agb/GBAGfx.h
File diff suppressed because it is too large
Load Diff
2166
src/agb/GBALink.cpp
2166
src/agb/GBALink.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,124 +1,124 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include<winsock.h>
|
#include<winsock.h>
|
||||||
|
|
||||||
#ifndef LINKH
|
#ifndef LINKH
|
||||||
#define LINKH
|
#define LINKH
|
||||||
#define LINK_PARENTLOST 0x80
|
#define LINK_PARENTLOST 0x80
|
||||||
#define UNSUPPORTED -1
|
#define UNSUPPORTED -1
|
||||||
#define MULTIPLAYER 0
|
#define MULTIPLAYER 0
|
||||||
#define NORMAL8 1
|
#define NORMAL8 1
|
||||||
#define NORMAL32 2
|
#define NORMAL32 2
|
||||||
#define UART 3
|
#define UART 3
|
||||||
#define JOYBUS 4
|
#define JOYBUS 4
|
||||||
#define GP 5
|
#define GP 5
|
||||||
#define RFU_INIT 0
|
#define RFU_INIT 0
|
||||||
#define RFU_COMM 1
|
#define RFU_COMM 1
|
||||||
#define RFU_SEND 2
|
#define RFU_SEND 2
|
||||||
#define RFU_RECV 3
|
#define RFU_RECV 3
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD linkdata[4];
|
WORD linkdata[4];
|
||||||
WORD linkcmd[4];
|
WORD linkcmd[4];
|
||||||
WORD numtransfers;
|
WORD numtransfers;
|
||||||
int lastlinktime;
|
int lastlinktime;
|
||||||
unsigned char numgbas;
|
unsigned char numgbas;
|
||||||
unsigned char linkflags;
|
unsigned char linkflags;
|
||||||
int rfu_q[4];
|
int rfu_q[4];
|
||||||
u8 rfu_request[4];
|
u8 rfu_request[4];
|
||||||
int rfu_linktime[4];
|
int rfu_linktime[4];
|
||||||
u32 rfu_bdata[4][7];
|
u32 rfu_bdata[4][7];
|
||||||
u32 rfu_data[4][32];
|
u32 rfu_data[4][32];
|
||||||
} LINKDATA;
|
} LINKDATA;
|
||||||
|
|
||||||
class lserver{
|
class lserver{
|
||||||
int numbytes;
|
int numbytes;
|
||||||
fd_set fdset;
|
fd_set fdset;
|
||||||
timeval wsocktimeout;
|
timeval wsocktimeout;
|
||||||
//timeval udptimeout;
|
//timeval udptimeout;
|
||||||
char inbuffer[256], outbuffer[256];
|
char inbuffer[256], outbuffer[256];
|
||||||
int *intinbuffer;
|
int *intinbuffer;
|
||||||
u16 *u16inbuffer;
|
u16 *u16inbuffer;
|
||||||
int *intoutbuffer;
|
int *intoutbuffer;
|
||||||
u16 *u16outbuffer;
|
u16 *u16outbuffer;
|
||||||
int counter;
|
int counter;
|
||||||
int done;
|
int done;
|
||||||
public:
|
public:
|
||||||
int howmanytimes;
|
int howmanytimes;
|
||||||
SOCKET tcpsocket[4];
|
SOCKET tcpsocket[4];
|
||||||
SOCKADDR_IN udpaddr[4];
|
SOCKADDR_IN udpaddr[4];
|
||||||
lserver(void);
|
lserver(void);
|
||||||
int Init(void*);
|
int Init(void*);
|
||||||
void Send(void);
|
void Send(void);
|
||||||
void Recv(void);
|
void Recv(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class lclient{
|
class lclient{
|
||||||
fd_set fdset;
|
fd_set fdset;
|
||||||
timeval wsocktimeout;
|
timeval wsocktimeout;
|
||||||
char inbuffer[256], outbuffer[256];
|
char inbuffer[256], outbuffer[256];
|
||||||
int *intinbuffer;
|
int *intinbuffer;
|
||||||
u16 *u16inbuffer;
|
u16 *u16inbuffer;
|
||||||
int *intoutbuffer;
|
int *intoutbuffer;
|
||||||
u16 *u16outbuffer;
|
u16 *u16outbuffer;
|
||||||
int numbytes;
|
int numbytes;
|
||||||
public:
|
public:
|
||||||
bool oncesend;
|
bool oncesend;
|
||||||
SOCKADDR_IN serverinfo;
|
SOCKADDR_IN serverinfo;
|
||||||
SOCKET noblock;
|
SOCKET noblock;
|
||||||
int numtransfers;
|
int numtransfers;
|
||||||
lclient(void);
|
lclient(void);
|
||||||
int Init(LPHOSTENT, void*);
|
int Init(LPHOSTENT, void*);
|
||||||
void Send(void);
|
void Send(void);
|
||||||
void Recv(void);
|
void Recv(void);
|
||||||
void CheckConn(void);
|
void CheckConn(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SOCKET tcpsocket;
|
SOCKET tcpsocket;
|
||||||
//SOCKET udpsocket;
|
//SOCKET udpsocket;
|
||||||
int numgbas;
|
int numgbas;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
u8 type;
|
u8 type;
|
||||||
u8 server;
|
u8 server;
|
||||||
bool terminate;
|
bool terminate;
|
||||||
bool connected;
|
bool connected;
|
||||||
bool speed;
|
bool speed;
|
||||||
bool active;
|
bool active;
|
||||||
} LANLINKDATA;
|
} LANLINKDATA;
|
||||||
|
|
||||||
extern void LinkUpdate(void);
|
extern void LinkUpdate(void);
|
||||||
extern void LinkChildStop(void);
|
extern void LinkChildStop(void);
|
||||||
extern void LinkChildSend(u16);
|
extern void LinkChildSend(u16);
|
||||||
extern int openLinkLog(void);
|
extern int openLinkLog(void);
|
||||||
extern void closeLinkLog();
|
extern void closeLinkLog();
|
||||||
extern void CloseLanLink(void);
|
extern void CloseLanLink(void);
|
||||||
extern char *MakeInstanceFilename(const char *Input);
|
extern char *MakeInstanceFilename(const char *Input);
|
||||||
|
|
||||||
extern LANLINKDATA lanlink;
|
extern LANLINKDATA lanlink;
|
||||||
extern FILE *linklogfile;
|
extern FILE *linklogfile;
|
||||||
extern int vbaid;
|
extern int vbaid;
|
||||||
extern int linklog;
|
extern int linklog;
|
||||||
extern bool adapter;
|
extern bool adapter;
|
||||||
extern bool linkenable;
|
extern bool linkenable;
|
||||||
extern int linktimeout;
|
extern int linktimeout;
|
||||||
extern lclient lc;
|
extern lclient lc;
|
||||||
extern int linkid;
|
extern int linkid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
1478
src/agb/GBAinline.h
1478
src/agb/GBAinline.h
File diff suppressed because it is too large
Load Diff
|
@ -1,99 +1,99 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "GBA.h"
|
#include "GBA.h"
|
||||||
#include "../Globals.h"
|
#include "../Globals.h"
|
||||||
#include "../Port.h"
|
#include "../Port.h"
|
||||||
|
|
||||||
#define debuggerWriteHalfWord(addr, value) \
|
#define debuggerWriteHalfWord(addr, value) \
|
||||||
WRITE16LE((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask], (value))
|
WRITE16LE((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask], (value))
|
||||||
|
|
||||||
#define debuggerReadHalfWord(addr) \
|
#define debuggerReadHalfWord(addr) \
|
||||||
READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]))
|
READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]))
|
||||||
|
|
||||||
static bool agbPrintEnabled = false;
|
static bool agbPrintEnabled = false;
|
||||||
static bool agbPrintProtect = false;
|
static bool agbPrintProtect = false;
|
||||||
|
|
||||||
bool agbPrintWrite(u32 address, u16 value)
|
bool agbPrintWrite(u32 address, u16 value)
|
||||||
{
|
{
|
||||||
if(agbPrintEnabled) {
|
if(agbPrintEnabled) {
|
||||||
if(address == 0x9fe2ffe) { // protect
|
if(address == 0x9fe2ffe) { // protect
|
||||||
agbPrintProtect = (value != 0);
|
agbPrintProtect = (value != 0);
|
||||||
debuggerWriteHalfWord(address, value);
|
debuggerWriteHalfWord(address, value);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if(agbPrintProtect &&
|
if(agbPrintProtect &&
|
||||||
((address >= 0x9fe20f8 && address <= 0x9fe20ff) // control structure
|
((address >= 0x9fe20f8 && address <= 0x9fe20ff) // control structure
|
||||||
|| (address >= 0x8fd0000 && address <= 0x8fdffff)
|
|| (address >= 0x8fd0000 && address <= 0x8fdffff)
|
||||||
|| (address >= 0x9fd0000 && address <= 0x9fdffff))) {
|
|| (address >= 0x9fd0000 && address <= 0x9fdffff))) {
|
||||||
debuggerWriteHalfWord(address, value);
|
debuggerWriteHalfWord(address, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void agbPrintReset()
|
void agbPrintReset()
|
||||||
{
|
{
|
||||||
agbPrintProtect = false;
|
agbPrintProtect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void agbPrintEnable(bool enable)
|
void agbPrintEnable(bool enable)
|
||||||
{
|
{
|
||||||
agbPrintEnabled = enable;
|
agbPrintEnabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool agbPrintIsEnabled()
|
bool agbPrintIsEnabled()
|
||||||
{
|
{
|
||||||
return agbPrintEnabled;
|
return agbPrintEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void (*dbgOutput)(const char *, u32);
|
extern void (*dbgOutput)(const char *, u32);
|
||||||
|
|
||||||
void agbPrintFlush()
|
void agbPrintFlush()
|
||||||
{
|
{
|
||||||
u16 get = debuggerReadHalfWord(0x9fe20fc);
|
u16 get = debuggerReadHalfWord(0x9fe20fc);
|
||||||
u16 put = debuggerReadHalfWord(0x9fe20fe);
|
u16 put = debuggerReadHalfWord(0x9fe20fe);
|
||||||
|
|
||||||
u32 address = (debuggerReadHalfWord(0x9fe20fa) << 16);
|
u32 address = (debuggerReadHalfWord(0x9fe20fa) << 16);
|
||||||
if(address != 0xfd0000 && address != 0x1fd0000) {
|
if(address != 0xfd0000 && address != 0x1fd0000) {
|
||||||
dbgOutput("Did you forget to call AGBPrintInit?\n", 0);
|
dbgOutput("Did you forget to call AGBPrintInit?\n", 0);
|
||||||
// get rid of the text otherwise we will continue to be called
|
// get rid of the text otherwise we will continue to be called
|
||||||
debuggerWriteHalfWord(0x9fe20fc, put);
|
debuggerWriteHalfWord(0x9fe20fc, put);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *data = &rom[address];
|
u8 *data = &rom[address];
|
||||||
|
|
||||||
while(get != put) {
|
while(get != put) {
|
||||||
char c = data[get++];
|
char c = data[get++];
|
||||||
char s[2];
|
char s[2];
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
s[1] = 0;
|
s[1] = 0;
|
||||||
|
|
||||||
if(systemVerbose & VERBOSE_AGBPRINT)
|
if(systemVerbose & VERBOSE_AGBPRINT)
|
||||||
dbgOutput(s, 0);
|
dbgOutput(s, 0);
|
||||||
if(c == '\n')
|
if(c == '\n')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
debuggerWriteHalfWord(0x9fe20fc, get);
|
debuggerWriteHalfWord(0x9fe20fc, get);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef VBA_AGBPRINT_H
|
#ifndef VBA_AGBPRINT_H
|
||||||
#define VBA_AGBPRINT_H
|
#define VBA_AGBPRINT_H
|
||||||
extern void agbPrintEnable(bool);
|
extern void agbPrintEnable(bool);
|
||||||
extern bool agbPrintIsEnabled();
|
extern bool agbPrintIsEnabled();
|
||||||
extern void agbPrintReset();
|
extern void agbPrintReset();
|
||||||
extern bool agbPrintWrite(u32, u16);
|
extern bool agbPrintWrite(u32, u16);
|
||||||
extern void agbPrintFlush();
|
extern void agbPrintFlush();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,227 +1,227 @@
|
||||||
#include "gbafilter.h"
|
#include "gbafilter.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
extern int systemColorDepth;
|
extern int systemColorDepth;
|
||||||
extern int systemRedShift;
|
extern int systemRedShift;
|
||||||
extern int systemGreenShift;
|
extern int systemGreenShift;
|
||||||
extern int systemBlueShift;
|
extern int systemBlueShift;
|
||||||
|
|
||||||
extern u16 systemColorMap16[0x10000];
|
extern u16 systemColorMap16[0x10000];
|
||||||
extern u32 systemColorMap32[0x10000];
|
extern u32 systemColorMap32[0x10000];
|
||||||
|
|
||||||
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
|
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
|
||||||
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38,
|
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38,
|
||||||
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80,
|
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80,
|
||||||
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0};
|
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0};
|
||||||
|
|
||||||
// output R G B
|
// output R G B
|
||||||
static const unsigned char influence[3 * 3] = { 16, 4, 4, // red
|
static const unsigned char influence[3 * 3] = { 16, 4, 4, // red
|
||||||
8, 16, 8, // green
|
8, 16, 8, // green
|
||||||
0, 8, 16};// blue
|
0, 8, 16};// blue
|
||||||
|
|
||||||
inline void swap(short & a, short & b)
|
inline void swap(short & a, short & b)
|
||||||
{
|
{
|
||||||
short temp = a;
|
short temp = a;
|
||||||
a = b;
|
a = b;
|
||||||
b = temp;
|
b = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbafilter_pal(u16 * buf, int count)
|
void gbafilter_pal(u16 * buf, int count)
|
||||||
{
|
{
|
||||||
short temp[3 * 3], s;
|
short temp[3 * 3], s;
|
||||||
unsigned pix;
|
unsigned pix;
|
||||||
u8 red, green, blue;
|
u8 red, green, blue;
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
pix = *buf;
|
pix = *buf;
|
||||||
|
|
||||||
s = curve[(pix >> systemGreenShift) & 0x1f];
|
s = curve[(pix >> systemGreenShift) & 0x1f];
|
||||||
temp[3] = s * influence[3];
|
temp[3] = s * influence[3];
|
||||||
temp[4] = s * influence[4];
|
temp[4] = s * influence[4];
|
||||||
temp[5] = s * influence[5];
|
temp[5] = s * influence[5];
|
||||||
|
|
||||||
s = curve[(pix >> systemRedShift) & 0x1f];
|
s = curve[(pix >> systemRedShift) & 0x1f];
|
||||||
temp[0] = s * influence[0];
|
temp[0] = s * influence[0];
|
||||||
temp[1] = s * influence[1];
|
temp[1] = s * influence[1];
|
||||||
temp[2] = s * influence[2];
|
temp[2] = s * influence[2];
|
||||||
|
|
||||||
s = curve[(pix >> systemBlueShift) & 0x1f];
|
s = curve[(pix >> systemBlueShift) & 0x1f];
|
||||||
temp[6] = s * influence[6];
|
temp[6] = s * influence[6];
|
||||||
temp[7] = s * influence[7];
|
temp[7] = s * influence[7];
|
||||||
temp[8] = s * influence[8];
|
temp[8] = s * influence[8];
|
||||||
|
|
||||||
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
||||||
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
||||||
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
||||||
temp[3] <<= 1;
|
temp[3] <<= 1;
|
||||||
temp[0] <<= 2;
|
temp[0] <<= 2;
|
||||||
temp[0] += temp[3] + temp[6];
|
temp[0] += temp[3] + temp[6];
|
||||||
|
|
||||||
red = ((int(temp[0]) * 160) >> 17) + 4;
|
red = ((int(temp[0]) * 160) >> 17) + 4;
|
||||||
if (red > 31) red = 31;
|
if (red > 31) red = 31;
|
||||||
|
|
||||||
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
||||||
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
||||||
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
||||||
temp[5] <<= 1;
|
temp[5] <<= 1;
|
||||||
temp[2] <<= 2;
|
temp[2] <<= 2;
|
||||||
temp[2] += temp[5] + temp[8];
|
temp[2] += temp[5] + temp[8];
|
||||||
|
|
||||||
blue = ((int(temp[2]) * 160) >> 17) + 4;
|
blue = ((int(temp[2]) * 160) >> 17) + 4;
|
||||||
if (blue > 31) blue = 31;
|
if (blue > 31) blue = 31;
|
||||||
|
|
||||||
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
||||||
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
||||||
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
||||||
temp[4] <<= 1;
|
temp[4] <<= 1;
|
||||||
temp[1] <<= 2;
|
temp[1] <<= 2;
|
||||||
temp[1] += temp[4] + temp[7];
|
temp[1] += temp[4] + temp[7];
|
||||||
|
|
||||||
green = ((int(temp[1]) * 160) >> 17) + 4;
|
green = ((int(temp[1]) * 160) >> 17) + 4;
|
||||||
if (green > 31) green = 31;
|
if (green > 31) green = 31;
|
||||||
|
|
||||||
pix = red << systemRedShift;
|
pix = red << systemRedShift;
|
||||||
pix += green << systemGreenShift;
|
pix += green << systemGreenShift;
|
||||||
pix += blue << systemBlueShift;
|
pix += blue << systemBlueShift;
|
||||||
|
|
||||||
*buf++ = pix;
|
*buf++ = pix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbafilter_pal32(u32 * buf, int count)
|
void gbafilter_pal32(u32 * buf, int count)
|
||||||
{
|
{
|
||||||
short temp[3 * 3], s;
|
short temp[3 * 3], s;
|
||||||
unsigned pix;
|
unsigned pix;
|
||||||
u8 red, green, blue;
|
u8 red, green, blue;
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
pix = *buf;
|
pix = *buf;
|
||||||
|
|
||||||
s = curve[(pix >> systemGreenShift) & 0x1f];
|
s = curve[(pix >> systemGreenShift) & 0x1f];
|
||||||
temp[3] = s * influence[3];
|
temp[3] = s * influence[3];
|
||||||
temp[4] = s * influence[4];
|
temp[4] = s * influence[4];
|
||||||
temp[5] = s * influence[5];
|
temp[5] = s * influence[5];
|
||||||
|
|
||||||
s = curve[(pix >> systemRedShift) & 0x1f];
|
s = curve[(pix >> systemRedShift) & 0x1f];
|
||||||
temp[0] = s * influence[0];
|
temp[0] = s * influence[0];
|
||||||
temp[1] = s * influence[1];
|
temp[1] = s * influence[1];
|
||||||
temp[2] = s * influence[2];
|
temp[2] = s * influence[2];
|
||||||
|
|
||||||
s = curve[(pix >> systemBlueShift) & 0x1f];
|
s = curve[(pix >> systemBlueShift) & 0x1f];
|
||||||
temp[6] = s * influence[6];
|
temp[6] = s * influence[6];
|
||||||
temp[7] = s * influence[7];
|
temp[7] = s * influence[7];
|
||||||
temp[8] = s * influence[8];
|
temp[8] = s * influence[8];
|
||||||
|
|
||||||
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
if (temp[0] < temp[3]) swap(temp[0], temp[3]);
|
||||||
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
if (temp[0] < temp[6]) swap(temp[0], temp[6]);
|
||||||
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
if (temp[3] < temp[6]) swap(temp[3], temp[6]);
|
||||||
temp[3] <<= 1;
|
temp[3] <<= 1;
|
||||||
temp[0] <<= 2;
|
temp[0] <<= 2;
|
||||||
temp[0] += temp[3] + temp[6];
|
temp[0] += temp[3] + temp[6];
|
||||||
|
|
||||||
//red = ((int(temp[0]) * 160) >> 17) + 4;
|
//red = ((int(temp[0]) * 160) >> 17) + 4;
|
||||||
red = ((int(temp[0]) * 160) >> 14) + 32;
|
red = ((int(temp[0]) * 160) >> 14) + 32;
|
||||||
|
|
||||||
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
if (temp[2] < temp[5]) swap(temp[2], temp[5]);
|
||||||
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
if (temp[2] < temp[8]) swap(temp[2], temp[8]);
|
||||||
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
if (temp[5] < temp[8]) swap(temp[5], temp[8]);
|
||||||
temp[5] <<= 1;
|
temp[5] <<= 1;
|
||||||
temp[2] <<= 2;
|
temp[2] <<= 2;
|
||||||
temp[2] += temp[5] + temp[8];
|
temp[2] += temp[5] + temp[8];
|
||||||
|
|
||||||
//blue = ((int(temp[2]) * 160) >> 17) + 4;
|
//blue = ((int(temp[2]) * 160) >> 17) + 4;
|
||||||
blue = ((int(temp[2]) * 160) >> 14) + 32;
|
blue = ((int(temp[2]) * 160) >> 14) + 32;
|
||||||
|
|
||||||
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
if (temp[1] < temp[4]) swap(temp[1], temp[4]);
|
||||||
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
if (temp[1] < temp[7]) swap(temp[1], temp[7]);
|
||||||
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
if (temp[4] < temp[7]) swap(temp[4], temp[7]);
|
||||||
temp[4] <<= 1;
|
temp[4] <<= 1;
|
||||||
temp[1] <<= 2;
|
temp[1] <<= 2;
|
||||||
temp[1] += temp[4] + temp[7];
|
temp[1] += temp[4] + temp[7];
|
||||||
|
|
||||||
//green = ((int(temp[1]) * 160) >> 17) + 4;
|
//green = ((int(temp[1]) * 160) >> 17) + 4;
|
||||||
green = ((int(temp[1]) * 160) >> 14) + 32;
|
green = ((int(temp[1]) * 160) >> 14) + 32;
|
||||||
|
|
||||||
//pix = red << redshift;
|
//pix = red << redshift;
|
||||||
//pix += green << greenshift;
|
//pix += green << greenshift;
|
||||||
//pix += blue << blueshift;
|
//pix += blue << blueshift;
|
||||||
|
|
||||||
pix = red << (systemRedShift - 3);
|
pix = red << (systemRedShift - 3);
|
||||||
pix += green << (systemGreenShift - 3);
|
pix += green << (systemGreenShift - 3);
|
||||||
pix += blue << (systemBlueShift - 3);
|
pix += blue << (systemBlueShift - 3);
|
||||||
|
|
||||||
*buf++ = pix;
|
*buf++ = pix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for palette mode to work with the three spoony filters in 32bpp depth
|
// for palette mode to work with the three spoony filters in 32bpp depth
|
||||||
|
|
||||||
void gbafilter_pad(u8 * buf, int count)
|
void gbafilter_pad(u8 * buf, int count)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
u8 r;
|
u8 r;
|
||||||
u8 g;
|
u8 g;
|
||||||
u8 b;
|
u8 b;
|
||||||
u8 a;
|
u8 a;
|
||||||
} part;
|
} part;
|
||||||
unsigned whole;
|
unsigned whole;
|
||||||
}
|
}
|
||||||
mask;
|
mask;
|
||||||
|
|
||||||
mask.whole = 0x1f << systemRedShift;
|
mask.whole = 0x1f << systemRedShift;
|
||||||
mask.whole += 0x1f << systemGreenShift;
|
mask.whole += 0x1f << systemGreenShift;
|
||||||
mask.whole += 0x1f << systemBlueShift;
|
mask.whole += 0x1f << systemBlueShift;
|
||||||
|
|
||||||
switch (systemColorDepth)
|
switch (systemColorDepth)
|
||||||
{
|
{
|
||||||
case 24:
|
case 24:
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
*buf++ &= mask.part.r;
|
*buf++ &= mask.part.r;
|
||||||
*buf++ &= mask.part.g;
|
*buf++ &= mask.part.g;
|
||||||
*buf++ &= mask.part.b;
|
*buf++ &= mask.part.b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
*((u32*)buf) &= mask.whole;
|
*((u32*)buf) &= mask.whole;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void UpdateSystemColorMaps(int lcd)
|
void UpdateSystemColorMaps(int lcd)
|
||||||
{
|
{
|
||||||
switch(systemColorDepth) {
|
switch(systemColorDepth) {
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 0x10000; i++) {
|
for(int i = 0; i < 0x10000; i++) {
|
||||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||||
}
|
}
|
||||||
if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000);
|
if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 0x10000; i++) {
|
for(int i = 0; i < 0x10000; i++) {
|
||||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||||
}
|
}
|
||||||
if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000);
|
if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
|
|
||||||
void gbafilter_pal(u16 * buf, int count);
|
void gbafilter_pal(u16 * buf, int count);
|
||||||
void gbafilter_pal32(u32 * buf, int count);
|
void gbafilter_pal32(u32 * buf, int count);
|
||||||
void gbafilter_pad(u8 * buf, int count);
|
void gbafilter_pad(u8 * buf, int count);
|
||||||
|
|
10898
src/dmg/GB.cpp
10898
src/dmg/GB.cpp
File diff suppressed because it is too large
Load Diff
128
src/dmg/gb.h
128
src/dmg/gb.h
|
@ -1,64 +1,64 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef VBA_GB_GB_H
|
#ifndef VBA_GB_GB_H
|
||||||
#define VBA_GB_GB_H
|
#define VBA_GB_GB_H
|
||||||
|
|
||||||
#define C_FLAG 0x10
|
#define C_FLAG 0x10
|
||||||
#define H_FLAG 0x20
|
#define H_FLAG 0x20
|
||||||
#define N_FLAG 0x40
|
#define N_FLAG 0x40
|
||||||
#define Z_FLAG 0x80
|
#define Z_FLAG 0x80
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
u8 B1, B0;
|
u8 B1, B0;
|
||||||
#else
|
#else
|
||||||
u8 B0,B1;
|
u8 B0,B1;
|
||||||
#endif
|
#endif
|
||||||
} B;
|
} B;
|
||||||
u16 W;
|
u16 W;
|
||||||
} gbRegister;
|
} gbRegister;
|
||||||
|
|
||||||
extern bool gbLoadRom(const char *);
|
extern bool gbLoadRom(const char *);
|
||||||
extern void gbEmulate(int);
|
extern void gbEmulate(int);
|
||||||
extern void gbWriteMemory(register u16, register u8);
|
extern void gbWriteMemory(register u16, register u8);
|
||||||
extern void gbDrawLine();
|
extern void gbDrawLine();
|
||||||
extern bool gbIsGameboyRom(const char *);
|
extern bool gbIsGameboyRom(const char *);
|
||||||
extern void gbSoundReset();
|
extern void gbSoundReset();
|
||||||
extern void gbSoundSetQuality(int);
|
extern void gbSoundSetQuality(int);
|
||||||
extern void gbGetHardwareType();
|
extern void gbGetHardwareType();
|
||||||
extern void gbReset();
|
extern void gbReset();
|
||||||
extern void gbCleanUp();
|
extern void gbCleanUp();
|
||||||
extern void gbCPUInit(const char *,bool);
|
extern void gbCPUInit(const char *,bool);
|
||||||
extern bool gbWriteBatteryFile(const char *);
|
extern bool gbWriteBatteryFile(const char *);
|
||||||
extern bool gbWriteBatteryFile(const char *, bool);
|
extern bool gbWriteBatteryFile(const char *, bool);
|
||||||
extern bool gbReadBatteryFile(const char *);
|
extern bool gbReadBatteryFile(const char *);
|
||||||
extern bool gbWriteSaveState(const char *);
|
extern bool gbWriteSaveState(const char *);
|
||||||
extern bool gbWriteMemSaveState(char *, int);
|
extern bool gbWriteMemSaveState(char *, int);
|
||||||
extern bool gbReadSaveState(const char *);
|
extern bool gbReadSaveState(const char *);
|
||||||
extern bool gbReadMemSaveState(char *, int);
|
extern bool gbReadMemSaveState(char *, int);
|
||||||
extern void gbSgbRenderBorder();
|
extern void gbSgbRenderBorder();
|
||||||
extern bool gbWritePNGFile(const char *);
|
extern bool gbWritePNGFile(const char *);
|
||||||
extern bool gbWriteBMPFile(const char *);
|
extern bool gbWriteBMPFile(const char *);
|
||||||
extern bool gbReadGSASnapshot(const char *);
|
extern bool gbReadGSASnapshot(const char *);
|
||||||
|
|
||||||
extern struct EmulatedSystem GBSystem;
|
extern struct EmulatedSystem GBSystem;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
1044
src/dmg/gbCheats.cpp
1044
src/dmg/gbCheats.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,62 +1,62 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef __VBA_GB_GBCHEATS_H
|
#ifndef __VBA_GB_GBCHEATS_H
|
||||||
#define __VBA_GB_GBCHEATS_H
|
#define __VBA_GB_GBCHEATS_H
|
||||||
|
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
|
|
||||||
struct gbXxCheat {
|
struct gbXxCheat {
|
||||||
char cheatDesc[100];
|
char cheatDesc[100];
|
||||||
char cheatCode[20];
|
char cheatCode[20];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gbCheat {
|
struct gbCheat {
|
||||||
char cheatCode[20];
|
char cheatCode[20];
|
||||||
char cheatDesc[32];
|
char cheatDesc[32];
|
||||||
u16 address;
|
u16 address;
|
||||||
int code;
|
int code;
|
||||||
u8 compare;
|
u8 compare;
|
||||||
u8 value;
|
u8 value;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
void gbCheatsSaveGame(gzFile);
|
void gbCheatsSaveGame(gzFile);
|
||||||
void gbCheatsReadGame(gzFile, int);
|
void gbCheatsReadGame(gzFile, int);
|
||||||
void gbCheatsSaveCheatList(const char *);
|
void gbCheatsSaveCheatList(const char *);
|
||||||
bool gbCheatsLoadCheatList(const char *);
|
bool gbCheatsLoadCheatList(const char *);
|
||||||
bool gbCheatReadGSCodeFile(const char *);
|
bool gbCheatReadGSCodeFile(const char *);
|
||||||
|
|
||||||
bool gbAddGsCheat(const char *, const char*);
|
bool gbAddGsCheat(const char *, const char*);
|
||||||
bool gbAddGgCheat(const char *, const char*);
|
bool gbAddGgCheat(const char *, const char*);
|
||||||
void gbCheatRemove(int);
|
void gbCheatRemove(int);
|
||||||
void gbCheatRemoveAll();
|
void gbCheatRemoveAll();
|
||||||
void gbCheatEnable(int);
|
void gbCheatEnable(int);
|
||||||
void gbCheatDisable(int);
|
void gbCheatDisable(int);
|
||||||
u8 gbCheatRead(u16);
|
u8 gbCheatRead(u16);
|
||||||
void gbCheatWrite(bool);
|
void gbCheatWrite(bool);
|
||||||
bool gbVerifyGsCode(const char *code);
|
bool gbVerifyGsCode(const char *code);
|
||||||
bool gbVerifyGgCode(const char *code);
|
bool gbVerifyGgCode(const char *code);
|
||||||
|
|
||||||
|
|
||||||
extern int gbCheatNumber;
|
extern int gbCheatNumber;
|
||||||
extern gbCheat gbCheatList[100];
|
extern gbCheat gbCheatList[100];
|
||||||
extern bool gbCheatMap[0x10000];
|
extern bool gbCheatMap[0x10000];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
2920
src/dmg/gbCodes.h
2920
src/dmg/gbCodes.h
File diff suppressed because it is too large
Load Diff
2582
src/dmg/gbCodesCB.h
2582
src/dmg/gbCodesCB.h
File diff suppressed because it is too large
Load Diff
|
@ -1,249 +1,249 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
#include "gbGlobals.h"
|
#include "gbGlobals.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 mask;
|
u8 mask;
|
||||||
u8 value;
|
u8 value;
|
||||||
const char *mnen;
|
const char *mnen;
|
||||||
} GBOPCODE;
|
} GBOPCODE;
|
||||||
|
|
||||||
#define GB_READ(x) gbMemoryMap[(x)>>12][(x)&0xfff]
|
#define GB_READ(x) gbMemoryMap[(x)>>12][(x)&0xfff]
|
||||||
|
|
||||||
static const char *registers[] =
|
static const char *registers[] =
|
||||||
{ "B", "C", "D", "E", "H", "L", "(HL)", "A" };
|
{ "B", "C", "D", "E", "H", "L", "(HL)", "A" };
|
||||||
|
|
||||||
static const char *registers16[] =
|
static const char *registers16[] =
|
||||||
{ "BC", "DE", "HL", "SP", // for some operations
|
{ "BC", "DE", "HL", "SP", // for some operations
|
||||||
"BC", "DE", "HL", "AF" }; // for push/pop
|
"BC", "DE", "HL", "AF" }; // for push/pop
|
||||||
|
|
||||||
static const char *cond[] =
|
static const char *cond[] =
|
||||||
{ "NZ", "Z", "NC", "C" };
|
{ "NZ", "Z", "NC", "C" };
|
||||||
|
|
||||||
static char hexDigits[16] = {
|
static char hexDigits[16] = {
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
};
|
};
|
||||||
|
|
||||||
static GBOPCODE opcodes[] = {
|
static GBOPCODE opcodes[] = {
|
||||||
{ 0xff, 0x00, "NOP" },
|
{ 0xff, 0x00, "NOP" },
|
||||||
{ 0xcf, 0x01, "LD %R4,%W" },
|
{ 0xcf, 0x01, "LD %R4,%W" },
|
||||||
{ 0xff, 0x02, "LD (BC),A" },
|
{ 0xff, 0x02, "LD (BC),A" },
|
||||||
{ 0xcf, 0x03, "INC %R4" },
|
{ 0xcf, 0x03, "INC %R4" },
|
||||||
{ 0xc7, 0x04, "INC %r3" },
|
{ 0xc7, 0x04, "INC %r3" },
|
||||||
{ 0xc7, 0x05, "DEC %r3" },
|
{ 0xc7, 0x05, "DEC %r3" },
|
||||||
{ 0xc7, 0x06, "LD %r3,%B" },
|
{ 0xc7, 0x06, "LD %r3,%B" },
|
||||||
{ 0xff, 0x07, "RLCA" },
|
{ 0xff, 0x07, "RLCA" },
|
||||||
{ 0xff, 0x08, "LD (%W),SP" },
|
{ 0xff, 0x08, "LD (%W),SP" },
|
||||||
{ 0xcf, 0x09, "ADD HL,%R4" },
|
{ 0xcf, 0x09, "ADD HL,%R4" },
|
||||||
{ 0xff, 0x0a, "LD A,(BC)" },
|
{ 0xff, 0x0a, "LD A,(BC)" },
|
||||||
{ 0xcf, 0x0b, "DEC %R4" },
|
{ 0xcf, 0x0b, "DEC %R4" },
|
||||||
{ 0xff, 0x0f, "RRCA" },
|
{ 0xff, 0x0f, "RRCA" },
|
||||||
{ 0xff, 0x10, "STOP" },
|
{ 0xff, 0x10, "STOP" },
|
||||||
{ 0xff, 0x12, "LD (DE),A" },
|
{ 0xff, 0x12, "LD (DE),A" },
|
||||||
{ 0xff, 0x17, "RLA" },
|
{ 0xff, 0x17, "RLA" },
|
||||||
{ 0xff, 0x18, "JR %d" },
|
{ 0xff, 0x18, "JR %d" },
|
||||||
{ 0xff, 0x1a, "LD A,(DE)" },
|
{ 0xff, 0x1a, "LD A,(DE)" },
|
||||||
{ 0xff, 0x1f, "RRA" },
|
{ 0xff, 0x1f, "RRA" },
|
||||||
{ 0xe7, 0x20, "JR %c3,%d" },
|
{ 0xe7, 0x20, "JR %c3,%d" },
|
||||||
{ 0xff, 0x22, "LDI (HL),A" },
|
{ 0xff, 0x22, "LDI (HL),A" },
|
||||||
{ 0xff, 0x27, "DAA" },
|
{ 0xff, 0x27, "DAA" },
|
||||||
{ 0xff, 0x2a, "LDI A,(HL)" },
|
{ 0xff, 0x2a, "LDI A,(HL)" },
|
||||||
{ 0xff, 0x2f, "CPL" },
|
{ 0xff, 0x2f, "CPL" },
|
||||||
{ 0xff, 0x32, "LDD (HL),A" },
|
{ 0xff, 0x32, "LDD (HL),A" },
|
||||||
{ 0xff, 0x37, "SCF" },
|
{ 0xff, 0x37, "SCF" },
|
||||||
{ 0xff, 0x3a, "LDD A,(HL)" },
|
{ 0xff, 0x3a, "LDD A,(HL)" },
|
||||||
{ 0xff, 0x3f, "CCF" },
|
{ 0xff, 0x3f, "CCF" },
|
||||||
{ 0xff, 0x76, "HALT" },
|
{ 0xff, 0x76, "HALT" },
|
||||||
{ 0xc0, 0x40, "LD %r3,%r0" },
|
{ 0xc0, 0x40, "LD %r3,%r0" },
|
||||||
{ 0xf8, 0x80, "ADD A,%r0" },
|
{ 0xf8, 0x80, "ADD A,%r0" },
|
||||||
{ 0xf8, 0x88, "ADC A,%r0" },
|
{ 0xf8, 0x88, "ADC A,%r0" },
|
||||||
{ 0xf8, 0x90, "SUB %r0" },
|
{ 0xf8, 0x90, "SUB %r0" },
|
||||||
{ 0xf8, 0x98, "SBC A,%r0" },
|
{ 0xf8, 0x98, "SBC A,%r0" },
|
||||||
{ 0xf8, 0xa0, "AND %r0" },
|
{ 0xf8, 0xa0, "AND %r0" },
|
||||||
{ 0xf8, 0xa8, "XOR %r0" },
|
{ 0xf8, 0xa8, "XOR %r0" },
|
||||||
{ 0xf8, 0xb0, "OR %r0" },
|
{ 0xf8, 0xb0, "OR %r0" },
|
||||||
{ 0xf8, 0xb8, "CP %r0" },
|
{ 0xf8, 0xb8, "CP %r0" },
|
||||||
{ 0xe7, 0xc0, "RET %c3" },
|
{ 0xe7, 0xc0, "RET %c3" },
|
||||||
{ 0xcf, 0xc1, "POP %t4" },
|
{ 0xcf, 0xc1, "POP %t4" },
|
||||||
{ 0xe7, 0xc2, "JP %c3,%W" },
|
{ 0xe7, 0xc2, "JP %c3,%W" },
|
||||||
{ 0xff, 0xc3, "JP %W" },
|
{ 0xff, 0xc3, "JP %W" },
|
||||||
{ 0xe7, 0xc4, "CALL %c3,%W" },
|
{ 0xe7, 0xc4, "CALL %c3,%W" },
|
||||||
{ 0xcf, 0xc5, "PUSH %t4" },
|
{ 0xcf, 0xc5, "PUSH %t4" },
|
||||||
{ 0xff, 0xc6, "ADD A,%B" },
|
{ 0xff, 0xc6, "ADD A,%B" },
|
||||||
{ 0xc7, 0xc7, "RST %P" },
|
{ 0xc7, 0xc7, "RST %P" },
|
||||||
{ 0xff, 0xc9, "RET" },
|
{ 0xff, 0xc9, "RET" },
|
||||||
{ 0xff, 0xcd, "CALL %W" },
|
{ 0xff, 0xcd, "CALL %W" },
|
||||||
{ 0xff, 0xce, "ADC %B" },
|
{ 0xff, 0xce, "ADC %B" },
|
||||||
{ 0xff, 0xd6, "SUB %B" },
|
{ 0xff, 0xd6, "SUB %B" },
|
||||||
{ 0xff, 0xd9, "RETI" },
|
{ 0xff, 0xd9, "RETI" },
|
||||||
{ 0xff, 0xde, "SBC %B" },
|
{ 0xff, 0xde, "SBC %B" },
|
||||||
{ 0xff, 0xe0, "LD (FF%B),A" },
|
{ 0xff, 0xe0, "LD (FF%B),A" },
|
||||||
{ 0xff, 0xe2, "LD (FF00h+C),A" },
|
{ 0xff, 0xe2, "LD (FF00h+C),A" },
|
||||||
{ 0xff, 0xe6, "AND %B" },
|
{ 0xff, 0xe6, "AND %B" },
|
||||||
{ 0xff, 0xe8, "ADD SP,%D" },
|
{ 0xff, 0xe8, "ADD SP,%D" },
|
||||||
{ 0xff, 0xe9, "LD PC,HL" },
|
{ 0xff, 0xe9, "LD PC,HL" },
|
||||||
{ 0xff, 0xea, "LD (%W),A" },
|
{ 0xff, 0xea, "LD (%W),A" },
|
||||||
{ 0xff, 0xee, "XOR %B" },
|
{ 0xff, 0xee, "XOR %B" },
|
||||||
{ 0xff, 0xf0, "LD A,(FF%B)" },
|
{ 0xff, 0xf0, "LD A,(FF%B)" },
|
||||||
{ 0xff, 0xf2, "LD A,(FF00h+C)" },
|
{ 0xff, 0xf2, "LD A,(FF00h+C)" },
|
||||||
{ 0xff, 0xf3, "DI" },
|
{ 0xff, 0xf3, "DI" },
|
||||||
{ 0xff, 0xf6, "OR %B" },
|
{ 0xff, 0xf6, "OR %B" },
|
||||||
{ 0xff, 0xf8, "LD HL,SP%D" },
|
{ 0xff, 0xf8, "LD HL,SP%D" },
|
||||||
{ 0xff, 0xf9, "LD SP,HL" },
|
{ 0xff, 0xf9, "LD SP,HL" },
|
||||||
{ 0xff, 0xfa, "LD A,(%W)" },
|
{ 0xff, 0xfa, "LD A,(%W)" },
|
||||||
{ 0xff, 0xfb, "EI" },
|
{ 0xff, 0xfb, "EI" },
|
||||||
{ 0xff, 0xfe, "CP %B" },
|
{ 0xff, 0xfe, "CP %B" },
|
||||||
{ 0x00, 0x00, "DB %B" }
|
{ 0x00, 0x00, "DB %B" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static GBOPCODE cbOpcodes[] = {
|
static GBOPCODE cbOpcodes[] = {
|
||||||
{ 0xf8, 0x00, "RLC %r0" },
|
{ 0xf8, 0x00, "RLC %r0" },
|
||||||
{ 0xf8, 0x08, "RRC %r0" },
|
{ 0xf8, 0x08, "RRC %r0" },
|
||||||
{ 0xf8, 0x10, "RL %r0" },
|
{ 0xf8, 0x10, "RL %r0" },
|
||||||
{ 0xf8, 0x18, "RR %r0" },
|
{ 0xf8, 0x18, "RR %r0" },
|
||||||
{ 0xf8, 0x20, "SLA %r0" },
|
{ 0xf8, 0x20, "SLA %r0" },
|
||||||
{ 0xf8, 0x28, "SRA %r0" },
|
{ 0xf8, 0x28, "SRA %r0" },
|
||||||
{ 0xf8, 0x30, "SWAP %r0" },
|
{ 0xf8, 0x30, "SWAP %r0" },
|
||||||
{ 0xf8, 0x38, "SRL %r0" },
|
{ 0xf8, 0x38, "SRL %r0" },
|
||||||
{ 0xc0, 0x40, "BIT %b,%r0" },
|
{ 0xc0, 0x40, "BIT %b,%r0" },
|
||||||
{ 0xc0, 0x80, "RES %b,%r0" },
|
{ 0xc0, 0x80, "RES %b,%r0" },
|
||||||
{ 0xc0, 0xc0, "SET %b,%r0" },
|
{ 0xc0, 0xc0, "SET %b,%r0" },
|
||||||
{ 0x00, 0x00, "DB CBh,%B" }
|
{ 0x00, 0x00, "DB CBh,%B" }
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *addHex(char *p, u8 value)
|
static char *addHex(char *p, u8 value)
|
||||||
{
|
{
|
||||||
*p++ = hexDigits[value >> 4];
|
*p++ = hexDigits[value >> 4];
|
||||||
*p++ = hexDigits[value & 15];
|
*p++ = hexDigits[value & 15];
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *addHex16(char *p, u16 value)
|
static char *addHex16(char *p, u16 value)
|
||||||
{
|
{
|
||||||
p = addHex(p, value>>8);
|
p = addHex(p, value>>8);
|
||||||
return addHex(p, value & 255);
|
return addHex(p, value & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *addStr(char *p, const char *s)
|
static char *addStr(char *p, const char *s)
|
||||||
{
|
{
|
||||||
while(*s) {
|
while(*s) {
|
||||||
*p++ = *s++;
|
*p++ = *s++;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gbDis(char *buffer, u16 address)
|
int gbDis(char *buffer, u16 address)
|
||||||
{
|
{
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
int instr = 1;
|
int instr = 1;
|
||||||
u16 addr = address;
|
u16 addr = address;
|
||||||
sprintf(p, "%04x ", address);
|
sprintf(p, "%04x ", address);
|
||||||
p += 12;
|
p += 12;
|
||||||
|
|
||||||
u8 opcode = GB_READ(address);
|
u8 opcode = GB_READ(address);
|
||||||
address++;
|
address++;
|
||||||
const char *mnen;
|
const char *mnen;
|
||||||
GBOPCODE *op;
|
GBOPCODE *op;
|
||||||
if(opcode == 0xcb) {
|
if(opcode == 0xcb) {
|
||||||
opcode = GB_READ(address);
|
opcode = GB_READ(address);
|
||||||
address++;
|
address++;
|
||||||
instr++;
|
instr++;
|
||||||
op = cbOpcodes;
|
op = cbOpcodes;
|
||||||
} else {
|
} else {
|
||||||
op = opcodes;
|
op = opcodes;
|
||||||
}
|
}
|
||||||
while(op->value != (opcode & op->mask)) op++;
|
while(op->value != (opcode & op->mask)) op++;
|
||||||
mnen = op->mnen;
|
mnen = op->mnen;
|
||||||
|
|
||||||
u8 b0, b1;
|
u8 b0, b1;
|
||||||
s8 disp;
|
s8 disp;
|
||||||
int shift;
|
int shift;
|
||||||
|
|
||||||
while(*mnen) {
|
while(*mnen) {
|
||||||
if(*mnen == '%') {
|
if(*mnen == '%') {
|
||||||
mnen++;
|
mnen++;
|
||||||
switch(*mnen++) {
|
switch(*mnen++) {
|
||||||
case 'W':
|
case 'W':
|
||||||
b0 = GB_READ(address);
|
b0 = GB_READ(address);
|
||||||
address++;
|
address++;
|
||||||
b1 = GB_READ(address);
|
b1 = GB_READ(address);
|
||||||
address++;
|
address++;
|
||||||
p = addHex16(p, b0|b1<<8);
|
p = addHex16(p, b0|b1<<8);
|
||||||
instr += 2;
|
instr += 2;
|
||||||
*p++ = 'h';
|
*p++ = 'h';
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
p = addHex(p, GB_READ(address));
|
p = addHex(p, GB_READ(address));
|
||||||
*p++ = 'h';
|
*p++ = 'h';
|
||||||
address++;
|
address++;
|
||||||
instr++;
|
instr++;
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
disp = GB_READ(address);
|
disp = GB_READ(address);
|
||||||
if(disp >= 0)
|
if(disp >= 0)
|
||||||
*p++ = '+';
|
*p++ = '+';
|
||||||
p += sprintf(p, "%d", disp);
|
p += sprintf(p, "%d", disp);
|
||||||
instr++;
|
instr++;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
disp = GB_READ(address);
|
disp = GB_READ(address);
|
||||||
address++;
|
address++;
|
||||||
p = addHex16(p, address+disp);
|
p = addHex16(p, address+disp);
|
||||||
*p++ = 'h';
|
*p++ = 'h';
|
||||||
instr++;
|
instr++;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
// kind of a hack, but it works :-)
|
// kind of a hack, but it works :-)
|
||||||
*p++ = hexDigits[(opcode >> 3) & 7];
|
*p++ = hexDigits[(opcode >> 3) & 7];
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
shift = *mnen++ - '0';
|
shift = *mnen++ - '0';
|
||||||
p = addStr(p, registers[(opcode >> shift) & 7]);
|
p = addStr(p, registers[(opcode >> shift) & 7]);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
shift = *mnen++ - '0';
|
shift = *mnen++ - '0';
|
||||||
p = addStr(p, registers16[(opcode >> shift) & 3]);
|
p = addStr(p, registers16[(opcode >> shift) & 3]);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
shift = *mnen++ - '0';
|
shift = *mnen++ - '0';
|
||||||
p = addStr(p, registers16[4+((opcode >> shift) & 3)]);
|
p = addStr(p, registers16[4+((opcode >> shift) & 3)]);
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
p = addHex(p, ((opcode >> 3) & 7) * 8);
|
p = addHex(p, ((opcode >> 3) & 7) * 8);
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
shift = *mnen++ - '0';
|
shift = *mnen++ - '0';
|
||||||
p = addStr(p, cond[(opcode >> shift) & 3]);
|
p = addStr(p, cond[(opcode >> shift) & 3]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
*p++ = *mnen++;
|
*p++ = *mnen++;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < instr; i++) {
|
for(int i = 0; i < instr; i++) {
|
||||||
u16 a = addr + i;
|
u16 a = addr + i;
|
||||||
addHex(buffer+5+i*2, GB_READ(a));
|
addHex(buffer+5+i*2, GB_READ(a));
|
||||||
}
|
}
|
||||||
*p = 0;
|
*p = 0;
|
||||||
return instr;
|
return instr;
|
||||||
}
|
}
|
||||||
|
|
1202
src/dmg/gbGfx.cpp
1202
src/dmg/gbGfx.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,57 +1,57 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "../agb/GBA.h"
|
#include "../agb/GBA.h"
|
||||||
|
|
||||||
u8 *gbMemoryMap[16];
|
u8 *gbMemoryMap[16];
|
||||||
|
|
||||||
int gbRomSizeMask = 0;
|
int gbRomSizeMask = 0;
|
||||||
int gbRomSize = 0;
|
int gbRomSize = 0;
|
||||||
int gbRamSizeMask = 0;
|
int gbRamSizeMask = 0;
|
||||||
int gbRamSize = 0;
|
int gbRamSize = 0;
|
||||||
int gbTAMA5ramSize = 0;
|
int gbTAMA5ramSize = 0;
|
||||||
|
|
||||||
u8 *gbMemory = NULL;
|
u8 *gbMemory = NULL;
|
||||||
u8 *gbVram = NULL;
|
u8 *gbVram = NULL;
|
||||||
u8 *gbRom = NULL;
|
u8 *gbRom = NULL;
|
||||||
u8 *gbRam = NULL;
|
u8 *gbRam = NULL;
|
||||||
u8 *gbWram = NULL;
|
u8 *gbWram = NULL;
|
||||||
u16 *gbLineBuffer = NULL;
|
u16 *gbLineBuffer = NULL;
|
||||||
u8 *gbTAMA5ram = NULL;
|
u8 *gbTAMA5ram = NULL;
|
||||||
|
|
||||||
u16 gbPalette[128];
|
u16 gbPalette[128];
|
||||||
u8 gbBgp[4] = { 0, 1, 2, 3};
|
u8 gbBgp[4] = { 0, 1, 2, 3};
|
||||||
u8 gbObp0[4] = { 0, 1, 2, 3};
|
u8 gbObp0[4] = { 0, 1, 2, 3};
|
||||||
u8 gbObp1[4] = { 0, 1, 2, 3};
|
u8 gbObp1[4] = { 0, 1, 2, 3};
|
||||||
int gbWindowLine = -1;
|
int gbWindowLine = -1;
|
||||||
|
|
||||||
bool genericflashcardEnable = false;
|
bool genericflashcardEnable = false;
|
||||||
int gbCgbMode = 0;
|
int gbCgbMode = 0;
|
||||||
|
|
||||||
u16 gbColorFilter[32768];
|
u16 gbColorFilter[32768];
|
||||||
int gbColorOption = 0;
|
int gbColorOption = 0;
|
||||||
int gbPaletteOption = 0;
|
int gbPaletteOption = 0;
|
||||||
int gbEmulatorType = 0;
|
int gbEmulatorType = 0;
|
||||||
int gbBorderOn = 1;
|
int gbBorderOn = 1;
|
||||||
int gbBorderAutomatic = 0;
|
int gbBorderAutomatic = 0;
|
||||||
int gbBorderLineSkip = 160;
|
int gbBorderLineSkip = 160;
|
||||||
int gbBorderRowSkip = 0;
|
int gbBorderRowSkip = 0;
|
||||||
int gbBorderColumnSkip = 0;
|
int gbBorderColumnSkip = 0;
|
||||||
int gbDmaTicks = 0;
|
int gbDmaTicks = 0;
|
||||||
|
|
||||||
u8 (*gbSerialFunction)(u8) = NULL;
|
u8 (*gbSerialFunction)(u8) = NULL;
|
||||||
|
|
|
@ -1,89 +1,89 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern int gbRomSizeMask;
|
extern int gbRomSizeMask;
|
||||||
extern int gbRomSize;
|
extern int gbRomSize;
|
||||||
extern int gbRamSize;
|
extern int gbRamSize;
|
||||||
extern int gbRamSizeMask;
|
extern int gbRamSizeMask;
|
||||||
extern int gbTAMA5ramSize;
|
extern int gbTAMA5ramSize;
|
||||||
|
|
||||||
extern bool useBios;
|
extern bool useBios;
|
||||||
extern bool skipBios;
|
extern bool skipBios;
|
||||||
extern u8 *bios;
|
extern u8 *bios;
|
||||||
|
|
||||||
extern u8 *gbRom;
|
extern u8 *gbRom;
|
||||||
extern u8 *gbRam;
|
extern u8 *gbRam;
|
||||||
extern u8 *gbVram;
|
extern u8 *gbVram;
|
||||||
extern u8 *gbWram;
|
extern u8 *gbWram;
|
||||||
extern u8 *gbMemory;
|
extern u8 *gbMemory;
|
||||||
extern u16 *gbLineBuffer;
|
extern u16 *gbLineBuffer;
|
||||||
extern u8 *gbTAMA5ram;
|
extern u8 *gbTAMA5ram;
|
||||||
|
|
||||||
extern u8 *gbMemoryMap[16];
|
extern u8 *gbMemoryMap[16];
|
||||||
|
|
||||||
extern int gbFrameSkip;
|
extern int gbFrameSkip;
|
||||||
extern u16 gbColorFilter[32768];
|
extern u16 gbColorFilter[32768];
|
||||||
extern int gbColorOption;
|
extern int gbColorOption;
|
||||||
extern int gbPaletteOption;
|
extern int gbPaletteOption;
|
||||||
extern int gbEmulatorType;
|
extern int gbEmulatorType;
|
||||||
extern int gbBorderOn;
|
extern int gbBorderOn;
|
||||||
extern int gbBorderAutomatic;
|
extern int gbBorderAutomatic;
|
||||||
extern int gbCgbMode;
|
extern int gbCgbMode;
|
||||||
extern int gbSgbMode;
|
extern int gbSgbMode;
|
||||||
extern int gbWindowLine;
|
extern int gbWindowLine;
|
||||||
extern int gbSpeed;
|
extern int gbSpeed;
|
||||||
extern u8 gbBgp[4];
|
extern u8 gbBgp[4];
|
||||||
extern u8 gbObp0[4];
|
extern u8 gbObp0[4];
|
||||||
extern u8 gbObp1[4];
|
extern u8 gbObp1[4];
|
||||||
extern u16 gbPalette[128];
|
extern u16 gbPalette[128];
|
||||||
extern bool gbScreenOn;
|
extern bool gbScreenOn;
|
||||||
extern bool gbDrawWindow;
|
extern bool gbDrawWindow;
|
||||||
extern u8 gbSCYLine[300];
|
extern u8 gbSCYLine[300];
|
||||||
// gbSCXLine is used for the emulation (bug) of the SX change
|
// gbSCXLine is used for the emulation (bug) of the SX change
|
||||||
// found in the Artic Zone game.
|
// found in the Artic Zone game.
|
||||||
extern u8 gbSCXLine[300];
|
extern u8 gbSCXLine[300];
|
||||||
// gbBgpLine is used for the emulation of the
|
// gbBgpLine is used for the emulation of the
|
||||||
// Prehistorik Man's title screen scroller.
|
// Prehistorik Man's title screen scroller.
|
||||||
extern u8 gbBgpLine[300];
|
extern u8 gbBgpLine[300];
|
||||||
extern u8 gbObp0Line [300];
|
extern u8 gbObp0Line [300];
|
||||||
extern u8 gbObp1Line [300];
|
extern u8 gbObp1Line [300];
|
||||||
// gbSpritesTicks is used for the emulation of Parodius' Laser Beam.
|
// gbSpritesTicks is used for the emulation of Parodius' Laser Beam.
|
||||||
extern u8 gbSpritesTicks[300];
|
extern u8 gbSpritesTicks[300];
|
||||||
|
|
||||||
extern u8 register_LCDC;
|
extern u8 register_LCDC;
|
||||||
extern u8 register_LY;
|
extern u8 register_LY;
|
||||||
extern u8 register_SCY;
|
extern u8 register_SCY;
|
||||||
extern u8 register_SCX;
|
extern u8 register_SCX;
|
||||||
extern u8 register_WY;
|
extern u8 register_WY;
|
||||||
extern u8 register_WX;
|
extern u8 register_WX;
|
||||||
extern u8 register_VBK;
|
extern u8 register_VBK;
|
||||||
extern u8 oldRegister_WY;
|
extern u8 oldRegister_WY;
|
||||||
|
|
||||||
extern int emulating;
|
extern int emulating;
|
||||||
extern bool genericflashcardEnable;
|
extern bool genericflashcardEnable;
|
||||||
|
|
||||||
extern int gbBorderLineSkip;
|
extern int gbBorderLineSkip;
|
||||||
extern int gbBorderRowSkip;
|
extern int gbBorderRowSkip;
|
||||||
extern int gbBorderColumnSkip;
|
extern int gbBorderColumnSkip;
|
||||||
extern int gbDmaTicks;
|
extern int gbDmaTicks;
|
||||||
|
|
||||||
extern void gbRenderLine();
|
extern void gbRenderLine();
|
||||||
extern void gbDrawSprites(bool);
|
extern void gbDrawSprites(bool);
|
||||||
|
|
||||||
extern u8 (*gbSerialFunction)(u8);
|
extern u8 (*gbSerialFunction)(u8);
|
||||||
|
|
3434
src/dmg/gbMemory.cpp
3434
src/dmg/gbMemory.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,206 +1,206 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004-2006 Forgotten and the VBA development team
|
// Copyright (C) 2004-2006 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
struct mapperMBC1 {
|
struct mapperMBC1 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperMemoryModel;
|
int mapperMemoryModel;
|
||||||
int mapperROMHighAddress;
|
int mapperROMHighAddress;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int mapperRomBank0Remapping;
|
int mapperRomBank0Remapping;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperMBC2 {
|
struct mapperMBC2 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperMBC3 {
|
struct mapperMBC3 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int mapperClockLatch;
|
int mapperClockLatch;
|
||||||
int mapperClockRegister;
|
int mapperClockRegister;
|
||||||
int mapperSeconds;
|
int mapperSeconds;
|
||||||
int mapperMinutes;
|
int mapperMinutes;
|
||||||
int mapperHours;
|
int mapperHours;
|
||||||
int mapperDays;
|
int mapperDays;
|
||||||
int mapperControl;
|
int mapperControl;
|
||||||
int mapperLSeconds;
|
int mapperLSeconds;
|
||||||
int mapperLMinutes;
|
int mapperLMinutes;
|
||||||
int mapperLHours;
|
int mapperLHours;
|
||||||
int mapperLDays;
|
int mapperLDays;
|
||||||
int mapperLControl;
|
int mapperLControl;
|
||||||
time_t mapperLastTime;
|
time_t mapperLastTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperMBC5 {
|
struct mapperMBC5 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperROMHighAddress;
|
int mapperROMHighAddress;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int isRumbleCartridge;
|
int isRumbleCartridge;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperMBC7 {
|
struct mapperMBC7 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int cs;
|
int cs;
|
||||||
int sk;
|
int sk;
|
||||||
int state;
|
int state;
|
||||||
int buffer;
|
int buffer;
|
||||||
int idle;
|
int idle;
|
||||||
int count;
|
int count;
|
||||||
int code;
|
int code;
|
||||||
int address;
|
int address;
|
||||||
int writeEnable;
|
int writeEnable;
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperHuC1 {
|
struct mapperHuC1 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperMemoryModel;
|
int mapperMemoryModel;
|
||||||
int mapperROMHighAddress;
|
int mapperROMHighAddress;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperHuC3 {
|
struct mapperHuC3 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int mapperAddress;
|
int mapperAddress;
|
||||||
int mapperRAMFlag;
|
int mapperRAMFlag;
|
||||||
int mapperRAMValue;
|
int mapperRAMValue;
|
||||||
int mapperRegister1;
|
int mapperRegister1;
|
||||||
int mapperRegister2;
|
int mapperRegister2;
|
||||||
int mapperRegister3;
|
int mapperRegister3;
|
||||||
int mapperRegister4;
|
int mapperRegister4;
|
||||||
int mapperRegister5;
|
int mapperRegister5;
|
||||||
int mapperRegister6;
|
int mapperRegister6;
|
||||||
int mapperRegister7;
|
int mapperRegister7;
|
||||||
int mapperRegister8;
|
int mapperRegister8;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperTAMA5 {
|
struct mapperTAMA5 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int mapperRamByteSelect;
|
int mapperRamByteSelect;
|
||||||
int mapperCommandNumber;
|
int mapperCommandNumber;
|
||||||
int mapperLastCommandNumber;
|
int mapperLastCommandNumber;
|
||||||
int mapperCommands[0x10];
|
int mapperCommands[0x10];
|
||||||
int mapperRegister;
|
int mapperRegister;
|
||||||
int mapperClockLatch;
|
int mapperClockLatch;
|
||||||
int mapperClockRegister;
|
int mapperClockRegister;
|
||||||
int mapperSeconds;
|
int mapperSeconds;
|
||||||
int mapperMinutes;
|
int mapperMinutes;
|
||||||
int mapperHours;
|
int mapperHours;
|
||||||
int mapperDays;
|
int mapperDays;
|
||||||
int mapperMonths;
|
int mapperMonths;
|
||||||
int mapperYears;
|
int mapperYears;
|
||||||
int mapperControl;
|
int mapperControl;
|
||||||
int mapperLSeconds;
|
int mapperLSeconds;
|
||||||
int mapperLMinutes;
|
int mapperLMinutes;
|
||||||
int mapperLHours;
|
int mapperLHours;
|
||||||
int mapperLDays;
|
int mapperLDays;
|
||||||
int mapperLMonths;
|
int mapperLMonths;
|
||||||
int mapperLYears;
|
int mapperLYears;
|
||||||
int mapperLControl;
|
int mapperLControl;
|
||||||
time_t mapperLastTime;
|
time_t mapperLastTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperMMM01 {
|
struct mapperMMM01 {
|
||||||
int mapperRAMEnable;
|
int mapperRAMEnable;
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
int mapperRAMBank;
|
int mapperRAMBank;
|
||||||
int mapperMemoryModel;
|
int mapperMemoryModel;
|
||||||
int mapperROMHighAddress;
|
int mapperROMHighAddress;
|
||||||
int mapperRAMAddress;
|
int mapperRAMAddress;
|
||||||
int mapperRomBank0Remapping;
|
int mapperRomBank0Remapping;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mapperGS3 {
|
struct mapperGS3 {
|
||||||
int mapperROMBank;
|
int mapperROMBank;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern mapperMBC1 gbDataMBC1;
|
extern mapperMBC1 gbDataMBC1;
|
||||||
extern mapperMBC2 gbDataMBC2;
|
extern mapperMBC2 gbDataMBC2;
|
||||||
extern mapperMBC3 gbDataMBC3;
|
extern mapperMBC3 gbDataMBC3;
|
||||||
extern mapperMBC5 gbDataMBC5;
|
extern mapperMBC5 gbDataMBC5;
|
||||||
extern mapperHuC1 gbDataHuC1;
|
extern mapperHuC1 gbDataHuC1;
|
||||||
extern mapperHuC3 gbDataHuC3;
|
extern mapperHuC3 gbDataHuC3;
|
||||||
extern mapperTAMA5 gbDataTAMA5;
|
extern mapperTAMA5 gbDataTAMA5;
|
||||||
extern mapperMMM01 gbDataMMM01;
|
extern mapperMMM01 gbDataMMM01;
|
||||||
extern mapperGS3 gbDataGS3;
|
extern mapperGS3 gbDataGS3;
|
||||||
|
|
||||||
void mapperMBC1ROM(u16,u8);
|
void mapperMBC1ROM(u16,u8);
|
||||||
void mapperMBC1RAM(u16,u8);
|
void mapperMBC1RAM(u16,u8);
|
||||||
u8 mapperMBC1ReadRAM(u16);
|
u8 mapperMBC1ReadRAM(u16);
|
||||||
void mapperMBC2ROM(u16,u8);
|
void mapperMBC2ROM(u16,u8);
|
||||||
void mapperMBC2RAM(u16,u8);
|
void mapperMBC2RAM(u16,u8);
|
||||||
void mapperMBC3ROM(u16,u8);
|
void mapperMBC3ROM(u16,u8);
|
||||||
void mapperMBC3RAM(u16,u8);
|
void mapperMBC3RAM(u16,u8);
|
||||||
u8 mapperMBC3ReadRAM(u16);
|
u8 mapperMBC3ReadRAM(u16);
|
||||||
void mapperMBC5ROM(u16,u8);
|
void mapperMBC5ROM(u16,u8);
|
||||||
void mapperMBC5RAM(u16,u8);
|
void mapperMBC5RAM(u16,u8);
|
||||||
u8 mapperMBC5ReadRAM(u16);
|
u8 mapperMBC5ReadRAM(u16);
|
||||||
void mapperMBC7ROM(u16,u8);
|
void mapperMBC7ROM(u16,u8);
|
||||||
void mapperMBC7RAM(u16,u8);
|
void mapperMBC7RAM(u16,u8);
|
||||||
u8 mapperMBC7ReadRAM(u16);
|
u8 mapperMBC7ReadRAM(u16);
|
||||||
void mapperHuC1ROM(u16,u8);
|
void mapperHuC1ROM(u16,u8);
|
||||||
void mapperHuC1RAM(u16,u8);
|
void mapperHuC1RAM(u16,u8);
|
||||||
void mapperHuC3ROM(u16,u8);
|
void mapperHuC3ROM(u16,u8);
|
||||||
void mapperHuC3RAM(u16,u8);
|
void mapperHuC3RAM(u16,u8);
|
||||||
u8 mapperHuC3ReadRAM(u16);
|
u8 mapperHuC3ReadRAM(u16);
|
||||||
void mapperTAMA5RAM(u16,u8);
|
void mapperTAMA5RAM(u16,u8);
|
||||||
u8 mapperTAMA5ReadRAM(u16);
|
u8 mapperTAMA5ReadRAM(u16);
|
||||||
void memoryUpdateTAMA5Clock();
|
void memoryUpdateTAMA5Clock();
|
||||||
void mapperMMM01ROM(u16,u8);
|
void mapperMMM01ROM(u16,u8);
|
||||||
void mapperMMM01RAM(u16,u8);
|
void mapperMMM01RAM(u16,u8);
|
||||||
void mapperGGROM(u16,u8);
|
void mapperGGROM(u16,u8);
|
||||||
void mapperGS3ROM(u16,u8);
|
void mapperGS3ROM(u16,u8);
|
||||||
//extern void (*mapper)(u16,u8);
|
//extern void (*mapper)(u16,u8);
|
||||||
//extern void (*mapperRAM)(u16,u8);
|
//extern void (*mapperRAM)(u16,u8);
|
||||||
//extern u8 (*mapperReadRAM)(u16);
|
//extern u8 (*mapperReadRAM)(u16);
|
||||||
|
|
||||||
extern void memoryUpdateMapMBC1();
|
extern void memoryUpdateMapMBC1();
|
||||||
extern void memoryUpdateMapMBC2();
|
extern void memoryUpdateMapMBC2();
|
||||||
extern void memoryUpdateMapMBC3();
|
extern void memoryUpdateMapMBC3();
|
||||||
extern void memoryUpdateMapMBC5();
|
extern void memoryUpdateMapMBC5();
|
||||||
extern void memoryUpdateMapMBC7();
|
extern void memoryUpdateMapMBC7();
|
||||||
extern void memoryUpdateMapHuC1();
|
extern void memoryUpdateMapHuC1();
|
||||||
extern void memoryUpdateMapHuC3();
|
extern void memoryUpdateMapHuC3();
|
||||||
extern void memoryUpdateMapTAMA5();
|
extern void memoryUpdateMapTAMA5();
|
||||||
extern void memoryUpdateMapMMM01();
|
extern void memoryUpdateMapMMM01();
|
||||||
extern void memoryUpdateMapGS3();
|
extern void memoryUpdateMapGS3();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,229 +1,229 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include "../agb/GBA.h"
|
#include "../agb/GBA.h"
|
||||||
|
|
||||||
u8 gbPrinterStatus = 0;
|
u8 gbPrinterStatus = 0;
|
||||||
int gbPrinterState = 0;
|
int gbPrinterState = 0;
|
||||||
u8 gbPrinterData[0x280*9];
|
u8 gbPrinterData[0x280*9];
|
||||||
u8 gbPrinterPacket[0x400];
|
u8 gbPrinterPacket[0x400];
|
||||||
int gbPrinterCount = 0;
|
int gbPrinterCount = 0;
|
||||||
int gbPrinterDataCount = 0;
|
int gbPrinterDataCount = 0;
|
||||||
int gbPrinterDataSize = 0;
|
int gbPrinterDataSize = 0;
|
||||||
int gbPrinterResult = 0;
|
int gbPrinterResult = 0;
|
||||||
|
|
||||||
bool gbPrinterCheckCRC()
|
bool gbPrinterCheckCRC()
|
||||||
{
|
{
|
||||||
u16 crc = 0;
|
u16 crc = 0;
|
||||||
|
|
||||||
for(int i = 2; i < (6+gbPrinterDataSize); i++) {
|
for(int i = 2; i < (6+gbPrinterDataSize); i++) {
|
||||||
crc += gbPrinterPacket[i];
|
crc += gbPrinterPacket[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int msgCrc = gbPrinterPacket[6+gbPrinterDataSize] +
|
int msgCrc = gbPrinterPacket[6+gbPrinterDataSize] +
|
||||||
(gbPrinterPacket[7+gbPrinterDataSize]<<8);
|
(gbPrinterPacket[7+gbPrinterDataSize]<<8);
|
||||||
|
|
||||||
return msgCrc == crc;
|
return msgCrc == crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbPrinterReset()
|
void gbPrinterReset()
|
||||||
{
|
{
|
||||||
gbPrinterState = 0;
|
gbPrinterState = 0;
|
||||||
gbPrinterDataSize = 0;
|
gbPrinterDataSize = 0;
|
||||||
gbPrinterDataCount = 0;
|
gbPrinterDataCount = 0;
|
||||||
gbPrinterCount = 0;
|
gbPrinterCount = 0;
|
||||||
gbPrinterStatus = 0;
|
gbPrinterStatus = 0;
|
||||||
gbPrinterResult = 0;
|
gbPrinterResult = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbPrinterShowData()
|
void gbPrinterShowData()
|
||||||
{
|
{
|
||||||
systemGbPrint(gbPrinterData,
|
systemGbPrint(gbPrinterData,
|
||||||
gbPrinterPacket[6],
|
gbPrinterPacket[6],
|
||||||
gbPrinterPacket[7],
|
gbPrinterPacket[7],
|
||||||
gbPrinterPacket[8],
|
gbPrinterPacket[8],
|
||||||
gbPrinterPacket[9]);
|
gbPrinterPacket[9]);
|
||||||
/*
|
/*
|
||||||
allegro_init();
|
allegro_init();
|
||||||
install_keyboard();
|
install_keyboard();
|
||||||
set_gfx_mode(GFX_AUTODETECT, 160, 144, 0, 0);
|
set_gfx_mode(GFX_AUTODETECT, 160, 144, 0, 0);
|
||||||
PALETTE pal;
|
PALETTE pal;
|
||||||
pal[0].r = 255;
|
pal[0].r = 255;
|
||||||
pal[0].g = 255;
|
pal[0].g = 255;
|
||||||
pal[0].b = 255;
|
pal[0].b = 255;
|
||||||
pal[1].r = 168;
|
pal[1].r = 168;
|
||||||
pal[1].g = 168;
|
pal[1].g = 168;
|
||||||
pal[1].b = 168;
|
pal[1].b = 168;
|
||||||
pal[2].r = 96;
|
pal[2].r = 96;
|
||||||
pal[2].g = 96;
|
pal[2].g = 96;
|
||||||
pal[2].b = 96;
|
pal[2].b = 96;
|
||||||
pal[3].r = 0;
|
pal[3].r = 0;
|
||||||
pal[3].g = 0;
|
pal[3].g = 0;
|
||||||
pal[3].b = 0;
|
pal[3].b = 0;
|
||||||
set_palette(pal);
|
set_palette(pal);
|
||||||
acquire_screen();
|
acquire_screen();
|
||||||
u8 *data = gbPrinterData;
|
u8 *data = gbPrinterData;
|
||||||
for(int y = 0; y < 0x12; y++) {
|
for(int y = 0; y < 0x12; y++) {
|
||||||
for(int x = 0; x < 0x14; x++) {
|
for(int x = 0; x < 0x14; x++) {
|
||||||
for(int k = 0; k < 8; k++) {
|
for(int k = 0; k < 8; k++) {
|
||||||
int a = *data++;
|
int a = *data++;
|
||||||
int b = *data++;
|
int b = *data++;
|
||||||
for(int j = 0; j < 8; j++) {
|
for(int j = 0; j < 8; j++) {
|
||||||
int mask = 1 << (7-j);
|
int mask = 1 << (7-j);
|
||||||
int c = 0;
|
int c = 0;
|
||||||
if(a & mask)
|
if(a & mask)
|
||||||
c++;
|
c++;
|
||||||
if(b & mask)
|
if(b & mask)
|
||||||
c+=2;
|
c+=2;
|
||||||
putpixel(screen, x*8+j, y*8+k, c);
|
putpixel(screen, x*8+j, y*8+k, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release_screen();
|
release_screen();
|
||||||
while(!keypressed()) {
|
while(!keypressed()) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbPrinterReceiveData()
|
void gbPrinterReceiveData()
|
||||||
{
|
{
|
||||||
if(gbPrinterPacket[3]) { // compressed
|
if(gbPrinterPacket[3]) { // compressed
|
||||||
u8 *data = &gbPrinterPacket[6];
|
u8 *data = &gbPrinterPacket[6];
|
||||||
u8 *dest = &gbPrinterData[gbPrinterDataCount];
|
u8 *dest = &gbPrinterData[gbPrinterDataCount];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
while(len < gbPrinterDataSize) {
|
while(len < gbPrinterDataSize) {
|
||||||
u8 control = *data++;
|
u8 control = *data++;
|
||||||
if(control & 0x80) { // repeated data
|
if(control & 0x80) { // repeated data
|
||||||
control &= 0x7f;
|
control &= 0x7f;
|
||||||
control += 2;
|
control += 2;
|
||||||
memset(dest, *data++, control);
|
memset(dest, *data++, control);
|
||||||
len += control;
|
len += control;
|
||||||
dest += control;
|
dest += control;
|
||||||
} else { // raw data
|
} else { // raw data
|
||||||
control++;
|
control++;
|
||||||
memcpy(dest, data, control);
|
memcpy(dest, data, control);
|
||||||
dest += control;
|
dest += control;
|
||||||
data += control;
|
data += control;
|
||||||
len += control;
|
len += control;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy(&gbPrinterData[gbPrinterDataCount],
|
memcpy(&gbPrinterData[gbPrinterDataCount],
|
||||||
&gbPrinterPacket[6],
|
&gbPrinterPacket[6],
|
||||||
gbPrinterDataSize);
|
gbPrinterDataSize);
|
||||||
gbPrinterDataCount += gbPrinterDataSize;
|
gbPrinterDataCount += gbPrinterDataSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbPrinterCommand()
|
void gbPrinterCommand()
|
||||||
{
|
{
|
||||||
switch(gbPrinterPacket[2]) {
|
switch(gbPrinterPacket[2]) {
|
||||||
case 0x01:
|
case 0x01:
|
||||||
// reset/initialize packet
|
// reset/initialize packet
|
||||||
gbPrinterDataCount = 0;
|
gbPrinterDataCount = 0;
|
||||||
gbPrinterStatus = 0;
|
gbPrinterStatus = 0;
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
// print packet
|
// print packet
|
||||||
gbPrinterShowData();
|
gbPrinterShowData();
|
||||||
break;
|
break;
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// data packet
|
// data packet
|
||||||
gbPrinterReceiveData();
|
gbPrinterReceiveData();
|
||||||
break;
|
break;
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
// NUL packet
|
// NUL packet
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 gbPrinterSend(u8 b)
|
u8 gbPrinterSend(u8 b)
|
||||||
{
|
{
|
||||||
switch(gbPrinterState) {
|
switch(gbPrinterState) {
|
||||||
case 0:
|
case 0:
|
||||||
gbPrinterCount = 0;
|
gbPrinterCount = 0;
|
||||||
// receiving preamble
|
// receiving preamble
|
||||||
if(b == 0x88) {
|
if(b == 0x88) {
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
} else {
|
} else {
|
||||||
// todo: handle failure
|
// todo: handle failure
|
||||||
gbPrinterReset();
|
gbPrinterReset();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// receiving preamble
|
// receiving preamble
|
||||||
if(b == 0x33) {
|
if(b == 0x33) {
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
} else {
|
} else {
|
||||||
// todo: handle failure
|
// todo: handle failure
|
||||||
gbPrinterReset();
|
gbPrinterReset();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// receiving header
|
// receiving header
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
if(gbPrinterCount == 6) {
|
if(gbPrinterCount == 6) {
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
gbPrinterDataSize = gbPrinterPacket[4] + (gbPrinterPacket[5]<<8);
|
gbPrinterDataSize = gbPrinterPacket[4] + (gbPrinterPacket[5]<<8);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// receiving data
|
// receiving data
|
||||||
if(gbPrinterDataSize) {
|
if(gbPrinterDataSize) {
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
if(gbPrinterCount == (6+gbPrinterDataSize)) {
|
if(gbPrinterCount == (6+gbPrinterDataSize)) {
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
// intentionally move to next if no data to receive
|
// intentionally move to next if no data to receive
|
||||||
case 4:
|
case 4:
|
||||||
// receiving CRC
|
// receiving CRC
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// receiving CRC-2
|
// receiving CRC-2
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
if(gbPrinterCheckCRC()) {
|
if(gbPrinterCheckCRC()) {
|
||||||
gbPrinterCommand();
|
gbPrinterCommand();
|
||||||
}
|
}
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// receiving dummy 1
|
// receiving dummy 1
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
gbPrinterResult = 0x81;
|
gbPrinterResult = 0x81;
|
||||||
gbPrinterState++;
|
gbPrinterState++;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// receiving dummy 2
|
// receiving dummy 2
|
||||||
gbPrinterPacket[gbPrinterCount++] = b;
|
gbPrinterPacket[gbPrinterCount++] = b;
|
||||||
gbPrinterResult = gbPrinterStatus;
|
gbPrinterResult = gbPrinterStatus;
|
||||||
gbPrinterState = 0;
|
gbPrinterState = 0;
|
||||||
gbPrinterCount = 0;
|
gbPrinterCount = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return gbPrinterResult;
|
return gbPrinterResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern u8 gbPrinterSend(u8 b);
|
extern u8 gbPrinterSend(u8 b);
|
||||||
|
|
1834
src/dmg/gbSGB.cpp
1834
src/dmg/gbSGB.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,39 +1,39 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
void gbSgbInit();
|
void gbSgbInit();
|
||||||
void gbSgbShutdown();
|
void gbSgbShutdown();
|
||||||
void gbSgbCommand();
|
void gbSgbCommand();
|
||||||
void gbSgbResetPacketState();
|
void gbSgbResetPacketState();
|
||||||
void gbSgbReset();
|
void gbSgbReset();
|
||||||
void gbSgbDoBitTransfer(u8);
|
void gbSgbDoBitTransfer(u8);
|
||||||
void gbSgbSaveGame(gzFile);
|
void gbSgbSaveGame(gzFile);
|
||||||
void gbSgbReadGame(gzFile, int version);
|
void gbSgbReadGame(gzFile, int version);
|
||||||
void gbSgbRenderBorder();
|
void gbSgbRenderBorder();
|
||||||
|
|
||||||
extern u8 gbSgbATF[20*18];
|
extern u8 gbSgbATF[20*18];
|
||||||
extern int gbSgbMode;
|
extern int gbSgbMode;
|
||||||
extern int gbSgbMask;
|
extern int gbSgbMask;
|
||||||
extern int gbSgbMultiplayer;
|
extern int gbSgbMultiplayer;
|
||||||
extern u8 gbSgbNextController;
|
extern u8 gbSgbNextController;
|
||||||
extern int gbSgbPacketTimeout;
|
extern int gbSgbPacketTimeout;
|
||||||
extern u8 gbSgbReadingController;
|
extern u8 gbSgbReadingController;
|
||||||
extern int gbSgbFourPlayers;
|
extern int gbSgbFourPlayers;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,412 +1,412 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
// Copyright (C) 2005-2006 Forgotten and the VBA development team
|
||||||
// Copyright (C) 2007-2008 VBA-M development team
|
// Copyright (C) 2007-2008 VBA-M development team
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
#include "gbGlobals.h"
|
#include "gbGlobals.h"
|
||||||
#include "gbSound.h"
|
#include "gbSound.h"
|
||||||
|
|
||||||
#include "gb_apu/Gb_Apu.h"
|
#include "gb_apu/Gb_Apu.h"
|
||||||
#include "gb_apu/Effects_Buffer.h"
|
#include "gb_apu/Effects_Buffer.h"
|
||||||
|
|
||||||
static Gb_Apu* gb_apu;
|
static Gb_Apu* gb_apu;
|
||||||
static Simple_Effects_Buffer* stereo_buffer;
|
static Simple_Effects_Buffer* stereo_buffer;
|
||||||
|
|
||||||
extern u16 soundFinalWave[1470];
|
extern u16 soundFinalWave[1470];
|
||||||
extern int soundVolume;
|
extern int soundVolume;
|
||||||
|
|
||||||
extern int gbHardware;
|
extern int gbHardware;
|
||||||
|
|
||||||
extern void soundResume();
|
extern void soundResume();
|
||||||
|
|
||||||
extern int soundBufferLen;
|
extern int soundBufferLen;
|
||||||
extern int soundQuality;
|
extern int soundQuality;
|
||||||
extern bool soundPaused;
|
extern bool soundPaused;
|
||||||
extern int soundTicks;
|
extern int soundTicks;
|
||||||
extern int SOUND_CLOCK_TICKS;
|
extern int SOUND_CLOCK_TICKS;
|
||||||
extern u32 soundNextPosition;
|
extern u32 soundNextPosition;
|
||||||
|
|
||||||
extern int soundDebug;
|
extern int soundDebug;
|
||||||
|
|
||||||
extern bool soundEcho;
|
extern bool soundEcho;
|
||||||
extern bool soundLowPass;
|
extern bool soundLowPass;
|
||||||
extern bool soundReverse;
|
extern bool soundReverse;
|
||||||
extern bool soundOffFlag;
|
extern bool soundOffFlag;
|
||||||
|
|
||||||
int const ticks_to_time = 2 * GB_APU_OVERCLOCK;
|
int const ticks_to_time = 2 * GB_APU_OVERCLOCK;
|
||||||
|
|
||||||
static inline blip_time_t blip_time()
|
static inline blip_time_t blip_time()
|
||||||
{
|
{
|
||||||
return (SOUND_CLOCK_TICKS - soundTicks) * ticks_to_time;
|
return (SOUND_CLOCK_TICKS - soundTicks) * ticks_to_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 gbSoundRead( u16 address )
|
u8 gbSoundRead( u16 address )
|
||||||
{
|
{
|
||||||
if ( gb_apu && address >= NR10 && address <= 0xFF3F )
|
if ( gb_apu && address >= NR10 && address <= 0xFF3F )
|
||||||
return gb_apu->read_register( blip_time(), address );
|
return gb_apu->read_register( blip_time(), address );
|
||||||
|
|
||||||
return gbMemory[address];
|
return gbMemory[address];
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbSoundEvent(register u16 address, register int data)
|
void gbSoundEvent(register u16 address, register int data)
|
||||||
{
|
{
|
||||||
int freq = 0;
|
int freq = 0;
|
||||||
|
|
||||||
gbMemory[address] = data;
|
gbMemory[address] = data;
|
||||||
|
|
||||||
#ifndef FINAL_VERSION
|
#ifndef FINAL_VERSION
|
||||||
if(soundDebug) {
|
if(soundDebug) {
|
||||||
// don't translate. debug only
|
// don't translate. debug only
|
||||||
log("Sound event: %08lx %02x\n", address, data);
|
log("Sound event: %08lx %02x\n", address, data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( gb_apu && address >= NR10 && address <= 0xFF3F )
|
if ( gb_apu && address >= NR10 && address <= 0xFF3F )
|
||||||
gb_apu->write_register( blip_time(), address, data );
|
gb_apu->write_register( blip_time(), address, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void end_frame( blip_time_t time )
|
static void end_frame( blip_time_t time )
|
||||||
{
|
{
|
||||||
gb_apu ->end_frame( time );
|
gb_apu ->end_frame( time );
|
||||||
stereo_buffer->end_frame( time );
|
stereo_buffer->end_frame( time );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flush_samples()
|
static void flush_samples()
|
||||||
{
|
{
|
||||||
// number of samples in output buffer
|
// number of samples in output buffer
|
||||||
int const out_buf_size = soundBufferLen / sizeof *soundFinalWave;
|
int const out_buf_size = soundBufferLen / sizeof *soundFinalWave;
|
||||||
|
|
||||||
// Keep filling and writing soundFinalWave until it can't be fully filled
|
// Keep filling and writing soundFinalWave until it can't be fully filled
|
||||||
while ( stereo_buffer->samples_avail() >= out_buf_size )
|
while ( stereo_buffer->samples_avail() >= out_buf_size )
|
||||||
{
|
{
|
||||||
stereo_buffer->read_samples( (blip_sample_t*) soundFinalWave, out_buf_size );
|
stereo_buffer->read_samples( (blip_sample_t*) soundFinalWave, out_buf_size );
|
||||||
if(systemSoundOn)
|
if(systemSoundOn)
|
||||||
{
|
{
|
||||||
if(soundPaused)
|
if(soundPaused)
|
||||||
soundResume();
|
soundResume();
|
||||||
|
|
||||||
systemWriteDataToSoundBuffer();
|
systemWriteDataToSoundBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int const chan_count = 4;
|
int const chan_count = 4;
|
||||||
|
|
||||||
gb_effects_config_t gb_effects_config;
|
gb_effects_config_t gb_effects_config;
|
||||||
static gb_effects_config_t gb_effects_config_current;
|
static gb_effects_config_t gb_effects_config_current;
|
||||||
|
|
||||||
static void apply_effects()
|
static void apply_effects()
|
||||||
{
|
{
|
||||||
gb_effects_config_current = gb_effects_config;
|
gb_effects_config_current = gb_effects_config;
|
||||||
|
|
||||||
stereo_buffer->config().enabled = gb_effects_config_current.enabled;
|
stereo_buffer->config().enabled = gb_effects_config_current.enabled;
|
||||||
stereo_buffer->config().echo = gb_effects_config_current.echo;
|
stereo_buffer->config().echo = gb_effects_config_current.echo;
|
||||||
stereo_buffer->config().stereo = gb_effects_config_current.stereo;
|
stereo_buffer->config().stereo = gb_effects_config_current.stereo;
|
||||||
stereo_buffer->config().surround = gb_effects_config_current.surround;
|
stereo_buffer->config().surround = gb_effects_config_current.surround;
|
||||||
stereo_buffer->apply_config();
|
stereo_buffer->apply_config();
|
||||||
|
|
||||||
for ( int i = 0; i < chan_count; i++ )
|
for ( int i = 0; i < chan_count; i++ )
|
||||||
{
|
{
|
||||||
Multi_Buffer::channel_t ch = stereo_buffer->channel( i );
|
Multi_Buffer::channel_t ch = stereo_buffer->channel( i );
|
||||||
gb_apu->set_output( ch.center, ch.left, ch.right, i );
|
gb_apu->set_output( ch.center, ch.left, ch.right, i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbSoundTick()
|
void gbSoundTick()
|
||||||
{
|
{
|
||||||
if ( systemSoundOn && gb_apu && stereo_buffer )
|
if ( systemSoundOn && gb_apu && stereo_buffer )
|
||||||
{
|
{
|
||||||
// Run sound hardware to present
|
// Run sound hardware to present
|
||||||
end_frame( SOUND_CLOCK_TICKS * ticks_to_time );
|
end_frame( SOUND_CLOCK_TICKS * ticks_to_time );
|
||||||
|
|
||||||
flush_samples();
|
flush_samples();
|
||||||
|
|
||||||
gb_effects_config.enabled = soundEcho;
|
gb_effects_config.enabled = soundEcho;
|
||||||
|
|
||||||
// Update effects config if it was changed
|
// Update effects config if it was changed
|
||||||
if ( memcmp( &gb_effects_config_current, &gb_effects_config,
|
if ( memcmp( &gb_effects_config_current, &gb_effects_config,
|
||||||
sizeof gb_effects_config ) )
|
sizeof gb_effects_config ) )
|
||||||
apply_effects();
|
apply_effects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset_apu()
|
static void reset_apu()
|
||||||
{
|
{
|
||||||
// Use DMG or CGB sound differences based on type of game
|
// Use DMG or CGB sound differences based on type of game
|
||||||
gb_apu->reset( gbHardware & 1 ? gb_apu->mode_dmg : gb_apu->mode_cgb );
|
gb_apu->reset( gbHardware & 1 ? gb_apu->mode_dmg : gb_apu->mode_cgb );
|
||||||
|
|
||||||
if ( stereo_buffer )
|
if ( stereo_buffer )
|
||||||
stereo_buffer->clear();
|
stereo_buffer->clear();
|
||||||
|
|
||||||
soundTicks = SOUND_CLOCK_TICKS;
|
soundTicks = SOUND_CLOCK_TICKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remake_stereo_buffer()
|
static void remake_stereo_buffer()
|
||||||
{
|
{
|
||||||
// Stereo_Buffer
|
// Stereo_Buffer
|
||||||
delete stereo_buffer;
|
delete stereo_buffer;
|
||||||
stereo_buffer = 0;
|
stereo_buffer = 0;
|
||||||
|
|
||||||
stereo_buffer = new Simple_Effects_Buffer; // TODO: handle out of memory
|
stereo_buffer = new Simple_Effects_Buffer; // TODO: handle out of memory
|
||||||
stereo_buffer->set_sample_rate( 44100 / soundQuality ); // TODO: handle out of memory
|
stereo_buffer->set_sample_rate( 44100 / soundQuality ); // TODO: handle out of memory
|
||||||
stereo_buffer->clock_rate( gb_apu->clock_rate );
|
stereo_buffer->clock_rate( gb_apu->clock_rate );
|
||||||
|
|
||||||
// APU
|
// APU
|
||||||
static int const chan_types [chan_count] = {
|
static int const chan_types [chan_count] = {
|
||||||
Multi_Buffer::wave_type+1, Multi_Buffer::wave_type+2,
|
Multi_Buffer::wave_type+1, Multi_Buffer::wave_type+2,
|
||||||
Multi_Buffer::wave_type+3, Multi_Buffer::mixed_type+1
|
Multi_Buffer::wave_type+3, Multi_Buffer::mixed_type+1
|
||||||
};
|
};
|
||||||
stereo_buffer->set_channel_count( chan_count, chan_types );
|
stereo_buffer->set_channel_count( chan_count, chan_types );
|
||||||
|
|
||||||
if ( !gb_apu )
|
if ( !gb_apu )
|
||||||
{
|
{
|
||||||
gb_apu = new Gb_Apu;
|
gb_apu = new Gb_Apu;
|
||||||
reset_apu();
|
reset_apu();
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_effects();
|
apply_effects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gbSoundReset()
|
void gbSoundReset()
|
||||||
{
|
{
|
||||||
gb_effects_config.echo = 0.20f;
|
gb_effects_config.echo = 0.20f;
|
||||||
gb_effects_config.stereo = 0.15f;
|
gb_effects_config.stereo = 0.15f;
|
||||||
gb_effects_config.surround = false;
|
gb_effects_config.surround = false;
|
||||||
|
|
||||||
SOUND_CLOCK_TICKS = 20000;
|
SOUND_CLOCK_TICKS = 20000;
|
||||||
|
|
||||||
remake_stereo_buffer();
|
remake_stereo_buffer();
|
||||||
reset_apu();
|
reset_apu();
|
||||||
|
|
||||||
soundPaused = 1;
|
soundPaused = 1;
|
||||||
soundNextPosition = 0;
|
soundNextPosition = 0;
|
||||||
|
|
||||||
// don't translate
|
// don't translate
|
||||||
#ifndef FINAL_VERSION
|
#ifndef FINAL_VERSION
|
||||||
if(soundDebug) {
|
if(soundDebug) {
|
||||||
log("*** Sound Init ***\n");
|
log("*** Sound Init ***\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
gbSoundEvent(0xff10, 0x80);
|
gbSoundEvent(0xff10, 0x80);
|
||||||
gbSoundEvent(0xff11, 0xbf);
|
gbSoundEvent(0xff11, 0xbf);
|
||||||
gbSoundEvent(0xff12, 0xf3);
|
gbSoundEvent(0xff12, 0xf3);
|
||||||
gbSoundEvent(0xff14, 0xbf);
|
gbSoundEvent(0xff14, 0xbf);
|
||||||
gbSoundEvent(0xff16, 0x3f);
|
gbSoundEvent(0xff16, 0x3f);
|
||||||
gbSoundEvent(0xff17, 0x00);
|
gbSoundEvent(0xff17, 0x00);
|
||||||
gbSoundEvent(0xff19, 0xbf);
|
gbSoundEvent(0xff19, 0xbf);
|
||||||
|
|
||||||
gbSoundEvent(0xff1a, 0x7f);
|
gbSoundEvent(0xff1a, 0x7f);
|
||||||
gbSoundEvent(0xff1b, 0xff);
|
gbSoundEvent(0xff1b, 0xff);
|
||||||
gbSoundEvent(0xff1c, 0xbf);
|
gbSoundEvent(0xff1c, 0xbf);
|
||||||
gbSoundEvent(0xff1e, 0xbf);
|
gbSoundEvent(0xff1e, 0xbf);
|
||||||
|
|
||||||
gbSoundEvent(0xff20, 0xff);
|
gbSoundEvent(0xff20, 0xff);
|
||||||
gbSoundEvent(0xff21, 0x00);
|
gbSoundEvent(0xff21, 0x00);
|
||||||
gbSoundEvent(0xff22, 0x00);
|
gbSoundEvent(0xff22, 0x00);
|
||||||
gbSoundEvent(0xff23, 0xbf);
|
gbSoundEvent(0xff23, 0xbf);
|
||||||
gbSoundEvent(0xff24, 0x77);
|
gbSoundEvent(0xff24, 0x77);
|
||||||
gbSoundEvent(0xff25, 0xf3);
|
gbSoundEvent(0xff25, 0xf3);
|
||||||
|
|
||||||
if (gbHardware & 0x4)
|
if (gbHardware & 0x4)
|
||||||
gbSoundEvent(0xff26, 0xf0);
|
gbSoundEvent(0xff26, 0xf0);
|
||||||
else
|
else
|
||||||
gbSoundEvent(0xff26, 0xf1);
|
gbSoundEvent(0xff26, 0xf1);
|
||||||
|
|
||||||
// don't translate
|
// don't translate
|
||||||
#ifndef FINAL_VERSION
|
#ifndef FINAL_VERSION
|
||||||
if(soundDebug) {
|
if(soundDebug) {
|
||||||
log("*** Sound Init Complete ***\n");
|
log("*** Sound Init Complete ***\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int addr = 0xff30;
|
int addr = 0xff30;
|
||||||
|
|
||||||
while(addr < 0xff40) {
|
while(addr < 0xff40) {
|
||||||
gbMemory[addr++] = 0x00;
|
gbMemory[addr++] = 0x00;
|
||||||
gbMemory[addr++] = 0xff;
|
gbMemory[addr++] = 0xff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool soundInit();
|
extern bool soundInit();
|
||||||
extern void soundShutdown();
|
extern void soundShutdown();
|
||||||
|
|
||||||
void gbSoundSetQuality(int quality)
|
void gbSoundSetQuality(int quality)
|
||||||
{
|
{
|
||||||
if ( soundQuality != quality )
|
if ( soundQuality != quality )
|
||||||
{
|
{
|
||||||
if ( systemCanChangeSoundQuality() )
|
if ( systemCanChangeSoundQuality() )
|
||||||
{
|
{
|
||||||
if ( !soundOffFlag )
|
if ( !soundOffFlag )
|
||||||
soundShutdown();
|
soundShutdown();
|
||||||
|
|
||||||
soundQuality = quality;
|
soundQuality = quality;
|
||||||
soundNextPosition = 0;
|
soundNextPosition = 0;
|
||||||
|
|
||||||
if ( !soundOffFlag )
|
if ( !soundOffFlag )
|
||||||
soundInit();
|
soundInit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
soundQuality = quality;
|
soundQuality = quality;
|
||||||
soundNextPosition = 0;
|
soundNextPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
remake_stereo_buffer();
|
remake_stereo_buffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char dummy_buf [735 * 2];
|
static char dummy_buf [735 * 2];
|
||||||
|
|
||||||
#define SKIP( type, name ) { dummy_buf, sizeof (type) }
|
#define SKIP( type, name ) { dummy_buf, sizeof (type) }
|
||||||
|
|
||||||
// funny expr at end ensures that type matches type of variable
|
// funny expr at end ensures that type matches type of variable
|
||||||
#define LOAD( type, name ) { &name, sizeof (name) + (&name - (type*) &name) }
|
#define LOAD( type, name ) { &name, sizeof (name) + (&name - (type*) &name) }
|
||||||
|
|
||||||
static variable_desc gbsound_format [] =
|
static variable_desc gbsound_format [] =
|
||||||
{
|
{
|
||||||
SKIP( int, soundPaused ),
|
SKIP( int, soundPaused ),
|
||||||
SKIP( int, soundPlay ),
|
SKIP( int, soundPlay ),
|
||||||
SKIP( int, soundTicks ),
|
SKIP( int, soundTicks ),
|
||||||
SKIP( int, SOUND_CLOCK_TICKS ),
|
SKIP( int, SOUND_CLOCK_TICKS ),
|
||||||
SKIP( int, soundLevel1 ),
|
SKIP( int, soundLevel1 ),
|
||||||
SKIP( int, soundLevel2 ),
|
SKIP( int, soundLevel2 ),
|
||||||
SKIP( int, soundBalance ),
|
SKIP( int, soundBalance ),
|
||||||
SKIP( int, soundMasterOn ),
|
SKIP( int, soundMasterOn ),
|
||||||
SKIP( int, soundIndex ),
|
SKIP( int, soundIndex ),
|
||||||
SKIP( int, soundVIN ),
|
SKIP( int, soundVIN ),
|
||||||
SKIP( int, soundOn [0] ),
|
SKIP( int, soundOn [0] ),
|
||||||
SKIP( int, soundATL [0] ),
|
SKIP( int, soundATL [0] ),
|
||||||
SKIP( int, sound1Skip ),
|
SKIP( int, sound1Skip ),
|
||||||
SKIP( int, soundIndex [0] ),
|
SKIP( int, soundIndex [0] ),
|
||||||
SKIP( int, sound1Continue ),
|
SKIP( int, sound1Continue ),
|
||||||
SKIP( int, soundEnvelopeVolume [0] ),
|
SKIP( int, soundEnvelopeVolume [0] ),
|
||||||
SKIP( int, soundEnvelopeATL [0] ),
|
SKIP( int, soundEnvelopeATL [0] ),
|
||||||
SKIP( int, sound1EnvelopeATLReload ),
|
SKIP( int, sound1EnvelopeATLReload ),
|
||||||
SKIP( int, sound1EnvelopeUpDown ),
|
SKIP( int, sound1EnvelopeUpDown ),
|
||||||
SKIP( int, sound1SweepATL ),
|
SKIP( int, sound1SweepATL ),
|
||||||
SKIP( int, sound1SweepATLReload ),
|
SKIP( int, sound1SweepATLReload ),
|
||||||
SKIP( int, sound1SweepSteps ),
|
SKIP( int, sound1SweepSteps ),
|
||||||
SKIP( int, sound1SweepUpDown ),
|
SKIP( int, sound1SweepUpDown ),
|
||||||
SKIP( int, sound1SweepStep ),
|
SKIP( int, sound1SweepStep ),
|
||||||
SKIP( int, soundOn [1] ),
|
SKIP( int, soundOn [1] ),
|
||||||
SKIP( int, soundATL [1] ),
|
SKIP( int, soundATL [1] ),
|
||||||
SKIP( int, sound2Skip ),
|
SKIP( int, sound2Skip ),
|
||||||
SKIP( int, soundIndex [1] ),
|
SKIP( int, soundIndex [1] ),
|
||||||
SKIP( int, sound2Continue ),
|
SKIP( int, sound2Continue ),
|
||||||
SKIP( int, soundEnvelopeVolume [1] ),
|
SKIP( int, soundEnvelopeVolume [1] ),
|
||||||
SKIP( int, soundEnvelopeATL [1] ),
|
SKIP( int, soundEnvelopeATL [1] ),
|
||||||
SKIP( int, sound2EnvelopeATLReload ),
|
SKIP( int, sound2EnvelopeATLReload ),
|
||||||
SKIP( int, sound2EnvelopeUpDown ),
|
SKIP( int, sound2EnvelopeUpDown ),
|
||||||
SKIP( int, soundOn [2] ),
|
SKIP( int, soundOn [2] ),
|
||||||
SKIP( int, soundATL [2] ),
|
SKIP( int, soundATL [2] ),
|
||||||
SKIP( int, sound3Skip ),
|
SKIP( int, sound3Skip ),
|
||||||
SKIP( int, soundIndex [2] ),
|
SKIP( int, soundIndex [2] ),
|
||||||
SKIP( int, sound3Continue ),
|
SKIP( int, sound3Continue ),
|
||||||
SKIP( int, sound3OutputLevel ),
|
SKIP( int, sound3OutputLevel ),
|
||||||
SKIP( int, soundOn [3] ),
|
SKIP( int, soundOn [3] ),
|
||||||
SKIP( int, soundATL [3] ),
|
SKIP( int, soundATL [3] ),
|
||||||
SKIP( int, sound4Skip ),
|
SKIP( int, sound4Skip ),
|
||||||
SKIP( int, soundIndex [3] ),
|
SKIP( int, soundIndex [3] ),
|
||||||
SKIP( int, sound4Clock ),
|
SKIP( int, sound4Clock ),
|
||||||
SKIP( int, sound4ShiftRight ),
|
SKIP( int, sound4ShiftRight ),
|
||||||
SKIP( int, sound4ShiftSkip ),
|
SKIP( int, sound4ShiftSkip ),
|
||||||
SKIP( int, sound4ShiftIndex ),
|
SKIP( int, sound4ShiftIndex ),
|
||||||
SKIP( int, sound4NSteps ),
|
SKIP( int, sound4NSteps ),
|
||||||
SKIP( int, sound4CountDown ),
|
SKIP( int, sound4CountDown ),
|
||||||
SKIP( int, sound4Continue ),
|
SKIP( int, sound4Continue ),
|
||||||
SKIP( int, soundEnvelopeVolume [2] ),
|
SKIP( int, soundEnvelopeVolume [2] ),
|
||||||
SKIP( int, soundEnvelopeATL [2] ),
|
SKIP( int, soundEnvelopeATL [2] ),
|
||||||
SKIP( int, sound4EnvelopeATLReload ),
|
SKIP( int, sound4EnvelopeATLReload ),
|
||||||
SKIP( int, sound4EnvelopeUpDown ),
|
SKIP( int, sound4EnvelopeUpDown ),
|
||||||
SKIP( int, soundEnableFlag ),
|
SKIP( int, soundEnableFlag ),
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static variable_desc gbsound_format2 [] =
|
static variable_desc gbsound_format2 [] =
|
||||||
{
|
{
|
||||||
SKIP( int, sound1ATLreload ),
|
SKIP( int, sound1ATLreload ),
|
||||||
SKIP( int, freq1low ),
|
SKIP( int, freq1low ),
|
||||||
SKIP( int, freq1high ),
|
SKIP( int, freq1high ),
|
||||||
SKIP( int, sound2ATLreload ),
|
SKIP( int, sound2ATLreload ),
|
||||||
SKIP( int, freq2low ),
|
SKIP( int, freq2low ),
|
||||||
SKIP( int, freq2high ),
|
SKIP( int, freq2high ),
|
||||||
SKIP( int, sound3ATLreload ),
|
SKIP( int, sound3ATLreload ),
|
||||||
SKIP( int, freq3low ),
|
SKIP( int, freq3low ),
|
||||||
SKIP( int, freq3high ),
|
SKIP( int, freq3high ),
|
||||||
SKIP( int, sound4ATLreload ),
|
SKIP( int, sound4ATLreload ),
|
||||||
SKIP( int, freq4 ),
|
SKIP( int, freq4 ),
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static variable_desc gbsound_format3 [] =
|
static variable_desc gbsound_format3 [] =
|
||||||
{
|
{
|
||||||
SKIP( u8[2*735], soundBuffer ),
|
SKIP( u8[2*735], soundBuffer ),
|
||||||
SKIP( u8[2*735], soundBuffer ),
|
SKIP( u8[2*735], soundBuffer ),
|
||||||
SKIP( u16[735], soundFinalWave ),
|
SKIP( u16[735], soundFinalWave ),
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
void gbSoundSaveGame(gzFile gzFile)
|
void gbSoundSaveGame(gzFile gzFile)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
nr10 = 0,
|
nr10 = 0,
|
||||||
nr11, nr12, nr13, nr14,
|
nr11, nr12, nr13, nr14,
|
||||||
nr20, nr21, nr22, nr23, nr24,
|
nr20, nr21, nr22, nr23, nr24,
|
||||||
nr30, nr31, nr32, nr33, nr34,
|
nr30, nr31, nr32, nr33, nr34,
|
||||||
nr40, nr41, nr42, nr43, nr44,
|
nr40, nr41, nr42, nr43, nr44,
|
||||||
nr50, nr51, nr52
|
nr50, nr51, nr52
|
||||||
};
|
};
|
||||||
|
|
||||||
void gbSoundReadGame(int version,gzFile gzFile)
|
void gbSoundReadGame(int version,gzFile gzFile)
|
||||||
{
|
{
|
||||||
return; // TODO: apparently GB save states don't work in the main emulator
|
return; // TODO: apparently GB save states don't work in the main emulator
|
||||||
|
|
||||||
// Load state
|
// Load state
|
||||||
utilReadData( gzFile, gbsound_format );
|
utilReadData( gzFile, gbsound_format );
|
||||||
|
|
||||||
if ( version >= 11 )
|
if ( version >= 11 )
|
||||||
utilReadData( gzFile, gbsound_format2 );
|
utilReadData( gzFile, gbsound_format2 );
|
||||||
|
|
||||||
utilReadData( gzFile, gbsound_format3 );
|
utilReadData( gzFile, gbsound_format3 );
|
||||||
|
|
||||||
int quality = 1;
|
int quality = 1;
|
||||||
if ( version >= 7 )
|
if ( version >= 7 )
|
||||||
quality = utilReadInt( gzFile );
|
quality = utilReadInt( gzFile );
|
||||||
|
|
||||||
gbSoundSetQuality( quality );
|
gbSoundSetQuality( quality );
|
||||||
|
|
||||||
// Convert to format Gb_Apu uses
|
// Convert to format Gb_Apu uses
|
||||||
reset_apu();
|
reset_apu();
|
||||||
gb_apu_state_t s;
|
gb_apu_state_t s;
|
||||||
gb_apu->save_state( &s ); // use fresh values for anything not restored
|
gb_apu->save_state( &s ); // use fresh values for anything not restored
|
||||||
|
|
||||||
// Only some registers are properly preserved
|
// Only some registers are properly preserved
|
||||||
static int const regs_to_copy [] = {
|
static int const regs_to_copy [] = {
|
||||||
nr10, nr11, nr12, nr21, nr22, nr30, nr32, nr42, nr43, nr50, nr51, nr52, -1
|
nr10, nr11, nr12, nr21, nr22, nr30, nr32, nr42, nr43, nr50, nr51, nr52, -1
|
||||||
};
|
};
|
||||||
for ( int i = 0; regs_to_copy [i] >= 0; i++ )
|
for ( int i = 0; regs_to_copy [i] >= 0; i++ )
|
||||||
s.regs [regs_to_copy [i]] = gbMemory [0xFF10 + regs_to_copy [i]];
|
s.regs [regs_to_copy [i]] = gbMemory [0xFF10 + regs_to_copy [i]];
|
||||||
|
|
||||||
memcpy( &s.regs [0x20], &gbMemory [0xFF30], 0x10 ); // wave
|
memcpy( &s.regs [0x20], &gbMemory [0xFF30], 0x10 ); // wave
|
||||||
|
|
||||||
gb_apu->load_state( s );
|
gb_apu->load_state( s );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,74 +1,74 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#define NR10 0xff10
|
#define NR10 0xff10
|
||||||
#define NR11 0xff11
|
#define NR11 0xff11
|
||||||
#define NR12 0xff12
|
#define NR12 0xff12
|
||||||
#define NR13 0xff13
|
#define NR13 0xff13
|
||||||
#define NR14 0xff14
|
#define NR14 0xff14
|
||||||
#define NR21 0xff16
|
#define NR21 0xff16
|
||||||
#define NR22 0xff17
|
#define NR22 0xff17
|
||||||
#define NR23 0xff18
|
#define NR23 0xff18
|
||||||
#define NR24 0xff19
|
#define NR24 0xff19
|
||||||
#define NR30 0xff1a
|
#define NR30 0xff1a
|
||||||
#define NR31 0xff1b
|
#define NR31 0xff1b
|
||||||
#define NR32 0xff1c
|
#define NR32 0xff1c
|
||||||
#define NR33 0xff1d
|
#define NR33 0xff1d
|
||||||
#define NR34 0xff1e
|
#define NR34 0xff1e
|
||||||
#define NR41 0xff20
|
#define NR41 0xff20
|
||||||
#define NR42 0xff21
|
#define NR42 0xff21
|
||||||
#define NR43 0xff22
|
#define NR43 0xff22
|
||||||
#define NR44 0xff23
|
#define NR44 0xff23
|
||||||
#define NR50 0xff24
|
#define NR50 0xff24
|
||||||
#define NR51 0xff25
|
#define NR51 0xff25
|
||||||
#define NR52 0xff26
|
#define NR52 0xff26
|
||||||
|
|
||||||
#define SOUND_EVENT(address,value) \
|
#define SOUND_EVENT(address,value) \
|
||||||
gbSoundEvent(address,value)
|
gbSoundEvent(address,value)
|
||||||
|
|
||||||
extern void gbSoundTick();
|
extern void gbSoundTick();
|
||||||
extern void gbSoundPause();
|
extern void gbSoundPause();
|
||||||
extern void gbSoundResume();
|
extern void gbSoundResume();
|
||||||
extern void gbSoundEnable(int);
|
extern void gbSoundEnable(int);
|
||||||
extern void gbSoundDisable(int);
|
extern void gbSoundDisable(int);
|
||||||
extern int gbSoundGetEnable();
|
extern int gbSoundGetEnable();
|
||||||
extern void gbSoundReset();
|
extern void gbSoundReset();
|
||||||
extern void gbSoundSaveGame(gzFile);
|
extern void gbSoundSaveGame(gzFile);
|
||||||
extern void gbSoundReadGame(int,gzFile);
|
extern void gbSoundReadGame(int,gzFile);
|
||||||
extern void gbSoundEvent(register u16, register int);
|
extern void gbSoundEvent(register u16, register int);
|
||||||
extern void gbSoundSetQuality(int);
|
extern void gbSoundSetQuality(int);
|
||||||
|
|
||||||
extern u8 gbSoundRead(u16 address);
|
extern u8 gbSoundRead(u16 address);
|
||||||
|
|
||||||
extern int soundTicks;
|
extern int soundTicks;
|
||||||
extern int soundQuality;
|
extern int soundQuality;
|
||||||
extern int SOUND_CLOCK_TICKS;
|
extern int SOUND_CLOCK_TICKS;
|
||||||
|
|
||||||
struct gb_effects_config_t
|
struct gb_effects_config_t
|
||||||
{
|
{
|
||||||
bool enabled; // false = disable all effects
|
bool enabled; // false = disable all effects
|
||||||
|
|
||||||
float echo; // 0.0 = none, 1.0 = lots
|
float echo; // 0.0 = none, 1.0 = lots
|
||||||
float stereo; // 0.0 = channels in center, 1.0 = channels on left/right
|
float stereo; // 0.0 = channels in center, 1.0 = channels on left/right
|
||||||
bool surround; // true = put some channels in back
|
bool surround; // true = put some channels in back
|
||||||
};
|
};
|
||||||
|
|
||||||
// Can be changed at any time, probably from another thread too.
|
// Can be changed at any time, probably from another thread too.
|
||||||
// Sound will notice changes during next 1/100 second.
|
// Sound will notice changes during next 1/100 second.
|
||||||
extern gb_effects_config_t gb_effects_config;
|
extern gb_effects_config_t gb_effects_config;
|
||||||
|
|
|
@ -37,18 +37,18 @@ Blip_Buffer::Blip_Buffer()
|
||||||
clock_rate_ = 0;
|
clock_rate_ = 0;
|
||||||
bass_freq_ = 16;
|
bass_freq_ = 16;
|
||||||
length_ = 0;
|
length_ = 0;
|
||||||
|
|
||||||
// assumptions code makes about implementation-defined features
|
// assumptions code makes about implementation-defined features
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// right shift of negative value preserves sign
|
// right shift of negative value preserves sign
|
||||||
buf_t_ i = -0x7FFFFFFE;
|
buf_t_ i = -0x7FFFFFFE;
|
||||||
assert( (i >> 1) == -0x3FFFFFFF );
|
assert( (i >> 1) == -0x3FFFFFFF );
|
||||||
|
|
||||||
// casting to short truncates to 16 bits and sign-extends
|
// casting to short truncates to 16 bits and sign-extends
|
||||||
i = 0x18000;
|
i = 0x18000;
|
||||||
assert( (short) i == -0x8000 );
|
assert( (short) i == -0x8000 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ Blip_Buffer::blargg_err_t Blip_Buffer::set_sample_rate( long new_rate, int msec
|
||||||
assert( 0 );
|
assert( 0 );
|
||||||
return "Internal (tried to resize Silent_Blip_Buffer)";
|
return "Internal (tried to resize Silent_Blip_Buffer)";
|
||||||
}
|
}
|
||||||
|
|
||||||
// start with maximum length that resampled time can represent
|
// start with maximum length that resampled time can represent
|
||||||
long new_size = (ULONG_MAX >> BLIP_BUFFER_ACCURACY) - blip_buffer_extra_ - 64;
|
long new_size = (ULONG_MAX >> BLIP_BUFFER_ACCURACY) - blip_buffer_extra_ - 64;
|
||||||
if ( msec != blip_max_length )
|
if ( msec != blip_max_length )
|
||||||
|
@ -96,7 +96,7 @@ Blip_Buffer::blargg_err_t Blip_Buffer::set_sample_rate( long new_rate, int msec
|
||||||
else
|
else
|
||||||
assert( 0 ); // fails if requested buffer length exceeds limit
|
assert( 0 ); // fails if requested buffer length exceeds limit
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( buffer_size_ != new_size )
|
if ( buffer_size_ != new_size )
|
||||||
{
|
{
|
||||||
void* p = realloc( buffer_, (new_size + blip_buffer_extra_) * sizeof *buffer_ );
|
void* p = realloc( buffer_, (new_size + blip_buffer_extra_) * sizeof *buffer_ );
|
||||||
|
@ -104,23 +104,23 @@ Blip_Buffer::blargg_err_t Blip_Buffer::set_sample_rate( long new_rate, int msec
|
||||||
return "Out of memory";
|
return "Out of memory";
|
||||||
buffer_ = (buf_t_*) p;
|
buffer_ = (buf_t_*) p;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_size_ = new_size;
|
buffer_size_ = new_size;
|
||||||
assert( buffer_size_ != silent_buf_size ); // size should never happen to match this
|
assert( buffer_size_ != silent_buf_size ); // size should never happen to match this
|
||||||
|
|
||||||
// update things based on the sample rate
|
// update things based on the sample rate
|
||||||
sample_rate_ = new_rate;
|
sample_rate_ = new_rate;
|
||||||
length_ = new_size * 1000 / new_rate - 1;
|
length_ = new_size * 1000 / new_rate - 1;
|
||||||
if ( msec )
|
if ( msec )
|
||||||
assert( length_ == msec ); // ensure length is same as that passed in
|
assert( length_ == msec ); // ensure length is same as that passed in
|
||||||
|
|
||||||
// update these since they depend on sample rate
|
// update these since they depend on sample rate
|
||||||
if ( clock_rate_ )
|
if ( clock_rate_ )
|
||||||
clock_rate( clock_rate_ );
|
clock_rate( clock_rate_ );
|
||||||
bass_freq( bass_freq_ );
|
bass_freq( bass_freq_ );
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
return 0; // success
|
return 0; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ blip_time_t Blip_Buffer::count_clocks( long count ) const
|
||||||
assert( 0 ); // sample rate and clock rates must be set first
|
assert( 0 ); // sample rate and clock rates must be set first
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( count > buffer_size_ )
|
if ( count > buffer_size_ )
|
||||||
count = buffer_size_;
|
count = buffer_size_;
|
||||||
blip_resampled_time_t time = (blip_resampled_time_t) count << BLIP_BUFFER_ACCURACY;
|
blip_resampled_time_t time = (blip_resampled_time_t) count << BLIP_BUFFER_ACCURACY;
|
||||||
|
@ -177,7 +177,7 @@ void Blip_Buffer::remove_samples( long count )
|
||||||
if ( count )
|
if ( count )
|
||||||
{
|
{
|
||||||
remove_silence( count );
|
remove_silence( count );
|
||||||
|
|
||||||
// copy remaining samples to beginning and clear old samples
|
// copy remaining samples to beginning and clear old samples
|
||||||
long remain = samples_avail() + blip_buffer_extra_;
|
long remain = samples_avail() + blip_buffer_extra_;
|
||||||
memmove( buffer_, buffer_ + count, remain * sizeof *buffer_ );
|
memmove( buffer_, buffer_ + count, remain * sizeof *buffer_ );
|
||||||
|
@ -219,12 +219,12 @@ static void gen_sinc( float* out, int count, double oversample, double treble, d
|
||||||
{
|
{
|
||||||
if ( cutoff >= 0.999 )
|
if ( cutoff >= 0.999 )
|
||||||
cutoff = 0.999;
|
cutoff = 0.999;
|
||||||
|
|
||||||
if ( treble < -300.0 )
|
if ( treble < -300.0 )
|
||||||
treble = -300.0;
|
treble = -300.0;
|
||||||
if ( treble > 5.0 )
|
if ( treble > 5.0 )
|
||||||
treble = 5.0;
|
treble = 5.0;
|
||||||
|
|
||||||
double const maxh = 4096.0;
|
double const maxh = 4096.0;
|
||||||
double const rolloff = pow( 10.0, 1.0 / (maxh * 20.0) * treble / (1.0 - cutoff) );
|
double const rolloff = pow( 10.0, 1.0 / (maxh * 20.0) * treble / (1.0 - cutoff) );
|
||||||
double const pow_a_n = pow( rolloff, maxh - maxh * cutoff );
|
double const pow_a_n = pow( rolloff, maxh - maxh * cutoff );
|
||||||
|
@ -236,12 +236,12 @@ static void gen_sinc( float* out, int count, double oversample, double treble, d
|
||||||
double cos_nc_angle = cos( maxh * cutoff * angle );
|
double cos_nc_angle = cos( maxh * cutoff * angle );
|
||||||
double cos_nc1_angle = cos( (maxh * cutoff - 1.0) * angle );
|
double cos_nc1_angle = cos( (maxh * cutoff - 1.0) * angle );
|
||||||
double cos_angle = cos( angle );
|
double cos_angle = cos( angle );
|
||||||
|
|
||||||
c = c * pow_a_n - rolloff * cos_nc1_angle + cos_nc_angle;
|
c = c * pow_a_n - rolloff * cos_nc1_angle + cos_nc_angle;
|
||||||
double d = 1.0 + rolloff * (rolloff - cos_angle - cos_angle);
|
double d = 1.0 + rolloff * (rolloff - cos_angle - cos_angle);
|
||||||
double b = 2.0 - cos_angle - cos_angle;
|
double b = 2.0 - cos_angle - cos_angle;
|
||||||
double a = 1.0 - cos_angle - cos_nc_angle + cos_nc1_angle;
|
double a = 1.0 - cos_angle - cos_nc_angle + cos_nc1_angle;
|
||||||
|
|
||||||
out [i] = (float) ((a * d + c * b) / (b * d)); // a / b + c / d
|
out [i] = (float) ((a * d + c * b) / (b * d)); // a / b + c / d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,9 +255,9 @@ void blip_eq_t::generate( float* out, int count ) const
|
||||||
if ( cutoff_freq )
|
if ( cutoff_freq )
|
||||||
oversample = half_rate / cutoff_freq;
|
oversample = half_rate / cutoff_freq;
|
||||||
double cutoff = rolloff_freq * oversample / half_rate;
|
double cutoff = rolloff_freq * oversample / half_rate;
|
||||||
|
|
||||||
gen_sinc( out, count, blip_res * oversample, treble, cutoff );
|
gen_sinc( out, count, blip_res * oversample, treble, cutoff );
|
||||||
|
|
||||||
// apply (half of) hamming window
|
// apply (half of) hamming window
|
||||||
double to_fraction = PI / (count - 1);
|
double to_fraction = PI / (count - 1);
|
||||||
for ( int i = count; i--; )
|
for ( int i = count; i--; )
|
||||||
|
@ -282,7 +282,7 @@ void Blip_Synth_::adjust_impulse()
|
||||||
impulses [size - blip_res + p] += (short) error;
|
impulses [size - blip_res + p] += (short) error;
|
||||||
//printf( "error: %ld\n", error );
|
//printf( "error: %ld\n", error );
|
||||||
}
|
}
|
||||||
|
|
||||||
//for ( int i = blip_res; i--; printf( "\n" ) )
|
//for ( int i = blip_res; i--; printf( "\n" ) )
|
||||||
// for ( int j = 0; j < width / 2; j++ )
|
// for ( int j = 0; j < width / 2; j++ )
|
||||||
// printf( "%5ld,", impulses [j * blip_res + i + 1] );
|
// printf( "%5ld,", impulses [j * blip_res + i + 1] );
|
||||||
|
@ -291,31 +291,31 @@ void Blip_Synth_::adjust_impulse()
|
||||||
void Blip_Synth_::treble_eq( blip_eq_t const& eq )
|
void Blip_Synth_::treble_eq( blip_eq_t const& eq )
|
||||||
{
|
{
|
||||||
float fimpulse [blip_res / 2 * (blip_widest_impulse_ - 1) + blip_res * 2];
|
float fimpulse [blip_res / 2 * (blip_widest_impulse_ - 1) + blip_res * 2];
|
||||||
|
|
||||||
int const half_size = blip_res / 2 * (width - 1);
|
int const half_size = blip_res / 2 * (width - 1);
|
||||||
eq.generate( &fimpulse [blip_res], half_size );
|
eq.generate( &fimpulse [blip_res], half_size );
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// need mirror slightly past center for calculation
|
// need mirror slightly past center for calculation
|
||||||
for ( i = blip_res; i--; )
|
for ( i = blip_res; i--; )
|
||||||
fimpulse [blip_res + half_size + i] = fimpulse [blip_res + half_size - 1 - i];
|
fimpulse [blip_res + half_size + i] = fimpulse [blip_res + half_size - 1 - i];
|
||||||
|
|
||||||
// starts at 0
|
// starts at 0
|
||||||
for ( i = 0; i < blip_res; i++ )
|
for ( i = 0; i < blip_res; i++ )
|
||||||
fimpulse [i] = 0.0f;
|
fimpulse [i] = 0.0f;
|
||||||
|
|
||||||
// find rescale factor
|
// find rescale factor
|
||||||
double total = 0.0;
|
double total = 0.0;
|
||||||
for ( i = 0; i < half_size; i++ )
|
for ( i = 0; i < half_size; i++ )
|
||||||
total += fimpulse [blip_res + i];
|
total += fimpulse [blip_res + i];
|
||||||
|
|
||||||
//double const base_unit = 44800.0 - 128 * 18; // allows treble up to +0 dB
|
//double const base_unit = 44800.0 - 128 * 18; // allows treble up to +0 dB
|
||||||
//double const base_unit = 37888.0; // allows treble to +5 dB
|
//double const base_unit = 37888.0; // allows treble to +5 dB
|
||||||
double const base_unit = 32768.0; // necessary for blip_unscaled to work
|
double const base_unit = 32768.0; // necessary for blip_unscaled to work
|
||||||
double rescale = base_unit / 2 / total;
|
double rescale = base_unit / 2 / total;
|
||||||
kernel_unit = (long) base_unit;
|
kernel_unit = (long) base_unit;
|
||||||
|
|
||||||
// integrate, first difference, rescale, convert to int
|
// integrate, first difference, rescale, convert to int
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
double next = 0.0;
|
double next = 0.0;
|
||||||
|
@ -327,7 +327,7 @@ void Blip_Synth_::treble_eq( blip_eq_t const& eq )
|
||||||
next += fimpulse [i + blip_res];
|
next += fimpulse [i + blip_res];
|
||||||
}
|
}
|
||||||
adjust_impulse();
|
adjust_impulse();
|
||||||
|
|
||||||
// volume might require rescaling
|
// volume might require rescaling
|
||||||
double vol = volume_unit_;
|
double vol = volume_unit_;
|
||||||
if ( vol )
|
if ( vol )
|
||||||
|
@ -344,26 +344,26 @@ void Blip_Synth_::volume_unit( double new_unit )
|
||||||
// use default eq if it hasn't been set yet
|
// use default eq if it hasn't been set yet
|
||||||
if ( !kernel_unit )
|
if ( !kernel_unit )
|
||||||
treble_eq( -8.0 );
|
treble_eq( -8.0 );
|
||||||
|
|
||||||
volume_unit_ = new_unit;
|
volume_unit_ = new_unit;
|
||||||
double factor = new_unit * (1L << blip_sample_bits) / kernel_unit;
|
double factor = new_unit * (1L << blip_sample_bits) / kernel_unit;
|
||||||
|
|
||||||
if ( factor > 0.0 )
|
if ( factor > 0.0 )
|
||||||
{
|
{
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
|
|
||||||
// if unit is really small, might need to attenuate kernel
|
// if unit is really small, might need to attenuate kernel
|
||||||
while ( factor < 2.0 )
|
while ( factor < 2.0 )
|
||||||
{
|
{
|
||||||
shift++;
|
shift++;
|
||||||
factor *= 2.0;
|
factor *= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shift )
|
if ( shift )
|
||||||
{
|
{
|
||||||
kernel_unit >>= shift;
|
kernel_unit >>= shift;
|
||||||
assert( kernel_unit > 0 ); // fails if volume unit is too low
|
assert( kernel_unit > 0 ); // fails if volume unit is too low
|
||||||
|
|
||||||
// keep values positive to avoid round-towards-zero of sign-preserving
|
// keep values positive to avoid round-towards-zero of sign-preserving
|
||||||
// right shift for negative values
|
// right shift for negative values
|
||||||
long offset = 0x8000 + (1 << (shift - 1));
|
long offset = 0x8000 + (1 << (shift - 1));
|
||||||
|
@ -384,7 +384,7 @@ long Blip_Buffer::read_samples( blip_sample_t* out_, long max_samples, int stere
|
||||||
long count = samples_avail();
|
long count = samples_avail();
|
||||||
if ( count > max_samples )
|
if ( count > max_samples )
|
||||||
count = max_samples;
|
count = max_samples;
|
||||||
|
|
||||||
if ( count )
|
if ( count )
|
||||||
{
|
{
|
||||||
int const bass = BLIP_READER_BASS( *this );
|
int const bass = BLIP_READER_BASS( *this );
|
||||||
|
@ -392,7 +392,7 @@ long Blip_Buffer::read_samples( blip_sample_t* out_, long max_samples, int stere
|
||||||
BLIP_READER_ADJ_( reader, count );
|
BLIP_READER_ADJ_( reader, count );
|
||||||
blip_sample_t* BLIP_RESTRICT out = out_ + count;
|
blip_sample_t* BLIP_RESTRICT out = out_ + count;
|
||||||
blip_long offset = (blip_long) -count;
|
blip_long offset = (blip_long) -count;
|
||||||
|
|
||||||
if ( !stereo )
|
if ( !stereo )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
@ -415,9 +415,9 @@ long Blip_Buffer::read_samples( blip_sample_t* out_, long max_samples, int stere
|
||||||
}
|
}
|
||||||
while ( ++offset );
|
while ( ++offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
BLIP_READER_END( reader, *this );
|
BLIP_READER_END( reader, *this );
|
||||||
|
|
||||||
remove_samples( count );
|
remove_samples( count );
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
@ -430,9 +430,9 @@ void Blip_Buffer::mix_samples( blip_sample_t const* in, long count )
|
||||||
assert( 0 );
|
assert( 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf_t_* out = buffer_ + (offset_ >> BLIP_BUFFER_ACCURACY) + blip_widest_impulse_ / 2;
|
buf_t_* out = buffer_ + (offset_ >> BLIP_BUFFER_ACCURACY) + blip_widest_impulse_ / 2;
|
||||||
|
|
||||||
int const sample_shift = blip_sample_bits - 16;
|
int const sample_shift = blip_sample_bits - 16;
|
||||||
int prev = 0;
|
int prev = 0;
|
||||||
while ( count-- )
|
while ( count-- )
|
||||||
|
@ -458,7 +458,7 @@ void Blip_Buffer::save_state( blip_buffer_state_t* out )
|
||||||
void Blip_Buffer::load_state( blip_buffer_state_t const& in )
|
void Blip_Buffer::load_state( blip_buffer_state_t const& in )
|
||||||
{
|
{
|
||||||
clear( false );
|
clear( false );
|
||||||
|
|
||||||
offset_ = in.offset_;
|
offset_ = in.offset_;
|
||||||
reader_accum_ = in.reader_accum_;
|
reader_accum_ = in.reader_accum_;
|
||||||
memcpy( buffer_, in.buf, sizeof in.buf );
|
memcpy( buffer_, in.buf, sizeof in.buf );
|
||||||
|
|
|
@ -26,81 +26,81 @@ struct blip_buffer_state_t;
|
||||||
class Blip_Buffer {
|
class Blip_Buffer {
|
||||||
public:
|
public:
|
||||||
typedef const char* blargg_err_t;
|
typedef const char* blargg_err_t;
|
||||||
|
|
||||||
// Sets output sample rate and buffer length in milliseconds (1/1000 sec, defaults
|
// Sets output sample rate and buffer length in milliseconds (1/1000 sec, defaults
|
||||||
// to 1/4 second) and clears buffer. If there isn't enough memory, leaves buffer
|
// to 1/4 second) and clears buffer. If there isn't enough memory, leaves buffer
|
||||||
// untouched and returns "Out of memory", otherwise returns NULL.
|
// untouched and returns "Out of memory", otherwise returns NULL.
|
||||||
blargg_err_t set_sample_rate( long samples_per_sec, int msec_length = 1000 / 4 );
|
blargg_err_t set_sample_rate( long samples_per_sec, int msec_length = 1000 / 4 );
|
||||||
|
|
||||||
// Sets number of source time units per second
|
// Sets number of source time units per second
|
||||||
void clock_rate( long clocks_per_sec );
|
void clock_rate( long clocks_per_sec );
|
||||||
|
|
||||||
// Ends current time frame of specified duration and makes its samples available
|
// Ends current time frame of specified duration and makes its samples available
|
||||||
// (along with any still-unread samples) for reading with read_samples(). Begins
|
// (along with any still-unread samples) for reading with read_samples(). Begins
|
||||||
// a new time frame at the end of the current frame.
|
// a new time frame at the end of the current frame.
|
||||||
void end_frame( blip_time_t time );
|
void end_frame( blip_time_t time );
|
||||||
|
|
||||||
// Reads at most 'max_samples' out of buffer into 'dest', removing them from from
|
// Reads at most 'max_samples' out of buffer into 'dest', removing them from from
|
||||||
// the buffer. Returns number of samples actually read and removed. If stereo is
|
// the buffer. Returns number of samples actually read and removed. If stereo is
|
||||||
// true, increments 'dest' one extra time after writing each sample, to allow
|
// true, increments 'dest' one extra time after writing each sample, to allow
|
||||||
// easy interleving of two channels into a stereo output buffer.
|
// easy interleving of two channels into a stereo output buffer.
|
||||||
long read_samples( blip_sample_t* dest, long max_samples, int stereo = 0 );
|
long read_samples( blip_sample_t* dest, long max_samples, int stereo = 0 );
|
||||||
|
|
||||||
// Additional features
|
// Additional features
|
||||||
|
|
||||||
// Removes all available samples and clear buffer to silence. If 'entire_buffer' is
|
// Removes all available samples and clear buffer to silence. If 'entire_buffer' is
|
||||||
// false, just clears out any samples waiting rather than the entire buffer.
|
// false, just clears out any samples waiting rather than the entire buffer.
|
||||||
void clear( int entire_buffer = 1 );
|
void clear( int entire_buffer = 1 );
|
||||||
|
|
||||||
// Number of samples available for reading with read_samples()
|
// Number of samples available for reading with read_samples()
|
||||||
long samples_avail() const;
|
long samples_avail() const;
|
||||||
|
|
||||||
// Removes 'count' samples from those waiting to be read
|
// Removes 'count' samples from those waiting to be read
|
||||||
void remove_samples( long count );
|
void remove_samples( long count );
|
||||||
|
|
||||||
// Sets frequency high-pass filter frequency, where higher values reduce bass more
|
// Sets frequency high-pass filter frequency, where higher values reduce bass more
|
||||||
void bass_freq( int frequency );
|
void bass_freq( int frequency );
|
||||||
|
|
||||||
// Current output sample rate
|
// Current output sample rate
|
||||||
long sample_rate() const;
|
long sample_rate() const;
|
||||||
|
|
||||||
// Length of buffer in milliseconds
|
// Length of buffer in milliseconds
|
||||||
int length() const;
|
int length() const;
|
||||||
|
|
||||||
// Number of source time units per second
|
// Number of source time units per second
|
||||||
long clock_rate() const;
|
long clock_rate() const;
|
||||||
|
|
||||||
// Experimental features
|
// Experimental features
|
||||||
|
|
||||||
// Saves state, including high-pass filter and tails of last deltas.
|
// Saves state, including high-pass filter and tails of last deltas.
|
||||||
// All samples must have been read from buffer before calling this.
|
// All samples must have been read from buffer before calling this.
|
||||||
void save_state( blip_buffer_state_t* out );
|
void save_state( blip_buffer_state_t* out );
|
||||||
|
|
||||||
// Loads state. State must have been saved from Blip_Buffer with same
|
// Loads state. State must have been saved from Blip_Buffer with same
|
||||||
// settings during same run of program. States can NOT be stored on disk.
|
// settings during same run of program. States can NOT be stored on disk.
|
||||||
// Clears buffer before loading state.
|
// Clears buffer before loading state.
|
||||||
void load_state( blip_buffer_state_t const& in );
|
void load_state( blip_buffer_state_t const& in );
|
||||||
|
|
||||||
// Number of samples delay from synthesis to samples read out
|
// Number of samples delay from synthesis to samples read out
|
||||||
int output_latency() const;
|
int output_latency() const;
|
||||||
|
|
||||||
// Counts number of clocks needed until 'count' samples will be available.
|
// Counts number of clocks needed until 'count' samples will be available.
|
||||||
// If buffer can't even hold 'count' samples, returns number of clocks until
|
// If buffer can't even hold 'count' samples, returns number of clocks until
|
||||||
// buffer becomes full.
|
// buffer becomes full.
|
||||||
blip_time_t count_clocks( long count ) const;
|
blip_time_t count_clocks( long count ) const;
|
||||||
|
|
||||||
// Number of raw samples that can be mixed within frame of specified duration.
|
// Number of raw samples that can be mixed within frame of specified duration.
|
||||||
long count_samples( blip_time_t duration ) const;
|
long count_samples( blip_time_t duration ) const;
|
||||||
|
|
||||||
// Mixes in 'count' samples from 'buf_in'
|
// Mixes in 'count' samples from 'buf_in'
|
||||||
void mix_samples( blip_sample_t const* buf_in, long count );
|
void mix_samples( blip_sample_t const* buf_in, long count );
|
||||||
|
|
||||||
|
|
||||||
// Signals that sound has been added to buffer. Could be done automatically in
|
// Signals that sound has been added to buffer. Could be done automatically in
|
||||||
// Blip_Synth, but that would affect performance more, as you can arrange that
|
// Blip_Synth, but that would affect performance more, as you can arrange that
|
||||||
// this is called only once per time frame rather than for every delta.
|
// this is called only once per time frame rather than for every delta.
|
||||||
void set_modified() { modified_ = this; }
|
void set_modified() { modified_ = this; }
|
||||||
|
|
||||||
// not documented yet
|
// not documented yet
|
||||||
blip_ulong unsettled() const;
|
blip_ulong unsettled() const;
|
||||||
Blip_Buffer* clear_modified() { Blip_Buffer* b = modified_; modified_ = 0; return b; }
|
Blip_Buffer* clear_modified() { Blip_Buffer* b = modified_; modified_ = 0; return b; }
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
public:
|
public:
|
||||||
Blip_Buffer();
|
Blip_Buffer();
|
||||||
~Blip_Buffer();
|
~Blip_Buffer();
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
typedef blip_resampled_time_t resampled_time_t;
|
typedef blip_resampled_time_t resampled_time_t;
|
||||||
blargg_err_t sample_rate( long r ) { return set_sample_rate( r ); }
|
blargg_err_t sample_rate( long r ) { return set_sample_rate( r ); }
|
||||||
|
@ -165,24 +165,24 @@ private:
|
||||||
int const blip_buffer_extra_ = blip_widest_impulse_ + 2;
|
int const blip_buffer_extra_ = blip_widest_impulse_ + 2;
|
||||||
int const blip_res = 1 << BLIP_PHASE_BITS;
|
int const blip_res = 1 << BLIP_PHASE_BITS;
|
||||||
class blip_eq_t;
|
class blip_eq_t;
|
||||||
|
|
||||||
class Blip_Synth_Fast_ {
|
class Blip_Synth_Fast_ {
|
||||||
public:
|
public:
|
||||||
Blip_Buffer* buf;
|
Blip_Buffer* buf;
|
||||||
int last_amp;
|
int last_amp;
|
||||||
int delta_factor;
|
int delta_factor;
|
||||||
|
|
||||||
void volume_unit( double );
|
void volume_unit( double );
|
||||||
Blip_Synth_Fast_();
|
Blip_Synth_Fast_();
|
||||||
void treble_eq( blip_eq_t const& ) { }
|
void treble_eq( blip_eq_t const& ) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Blip_Synth_ {
|
class Blip_Synth_ {
|
||||||
public:
|
public:
|
||||||
Blip_Buffer* buf;
|
Blip_Buffer* buf;
|
||||||
int last_amp;
|
int last_amp;
|
||||||
int delta_factor;
|
int delta_factor;
|
||||||
|
|
||||||
void volume_unit( double );
|
void volume_unit( double );
|
||||||
Blip_Synth_( short* impulses, int width );
|
Blip_Synth_( short* impulses, int width );
|
||||||
void treble_eq( blip_eq_t const& );
|
void treble_eq( blip_eq_t const& );
|
||||||
|
@ -208,14 +208,14 @@ class Blip_Synth {
|
||||||
public:
|
public:
|
||||||
// Sets overall volume of waveform
|
// Sets overall volume of waveform
|
||||||
void volume( double v ) { impl.volume_unit( v * (1.0 / (range < 0 ? -range : range)) ); }
|
void volume( double v ) { impl.volume_unit( v * (1.0 / (range < 0 ? -range : range)) ); }
|
||||||
|
|
||||||
// Configures low-pass filter (see blip_buffer.txt)
|
// Configures low-pass filter (see blip_buffer.txt)
|
||||||
void treble_eq( blip_eq_t const& eq ) { impl.treble_eq( eq ); }
|
void treble_eq( blip_eq_t const& eq ) { impl.treble_eq( eq ); }
|
||||||
|
|
||||||
// Gets/sets Blip_Buffer used for output
|
// Gets/sets Blip_Buffer used for output
|
||||||
Blip_Buffer* output() const { return impl.buf; }
|
Blip_Buffer* output() const { return impl.buf; }
|
||||||
void output( Blip_Buffer* b ) { impl.buf = b; impl.last_amp = 0; }
|
void output( Blip_Buffer* b ) { impl.buf = b; impl.last_amp = 0; }
|
||||||
|
|
||||||
// Updates amplitude of waveform at given time. Using this requires a separate
|
// Updates amplitude of waveform at given time. Using this requires a separate
|
||||||
// Blip_Synth for each waveform.
|
// Blip_Synth for each waveform.
|
||||||
void update( blip_time_t time, int amplitude );
|
void update( blip_time_t time, int amplitude );
|
||||||
|
@ -227,10 +227,10 @@ public:
|
||||||
// The actual change in amplitude is delta * (volume / range)
|
// The actual change in amplitude is delta * (volume / range)
|
||||||
void offset( blip_time_t, int delta, Blip_Buffer* ) const;
|
void offset( blip_time_t, int delta, Blip_Buffer* ) const;
|
||||||
void offset( blip_time_t t, int delta ) const { offset( t, delta, impl.buf ); }
|
void offset( blip_time_t t, int delta ) const { offset( t, delta, impl.buf ); }
|
||||||
|
|
||||||
// Works directly in terms of fractional output samples. Contact author for more info.
|
// Works directly in terms of fractional output samples. Contact author for more info.
|
||||||
void offset_resampled( blip_resampled_time_t, int delta, Blip_Buffer* ) const;
|
void offset_resampled( blip_resampled_time_t, int delta, Blip_Buffer* ) const;
|
||||||
|
|
||||||
// Same as offset(), except code is inlined for higher performance
|
// Same as offset(), except code is inlined for higher performance
|
||||||
void offset_inline( blip_time_t t, int delta, Blip_Buffer* buf ) const {
|
void offset_inline( blip_time_t t, int delta, Blip_Buffer* buf ) const {
|
||||||
offset_resampled( t * buf->factor_ + buf->offset_, delta, buf );
|
offset_resampled( t * buf->factor_ + buf->offset_, delta, buf );
|
||||||
|
@ -238,7 +238,7 @@ public:
|
||||||
void offset_inline( blip_time_t t, int delta ) const {
|
void offset_inline( blip_time_t t, int delta ) const {
|
||||||
offset_resampled( t * impl.buf->factor_ + impl.buf->offset_, delta, impl.buf );
|
offset_resampled( t * impl.buf->factor_ + impl.buf->offset_, delta, impl.buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if BLIP_BUFFER_FAST
|
#if BLIP_BUFFER_FAST
|
||||||
Blip_Synth_Fast_ impl;
|
Blip_Synth_Fast_ impl;
|
||||||
|
@ -257,10 +257,10 @@ public:
|
||||||
// Logarithmic rolloff to treble dB at half sampling rate. Negative values reduce
|
// Logarithmic rolloff to treble dB at half sampling rate. Negative values reduce
|
||||||
// treble, small positive values (0 to 5.0) increase treble.
|
// treble, small positive values (0 to 5.0) increase treble.
|
||||||
blip_eq_t( double treble_db = 0 );
|
blip_eq_t( double treble_db = 0 );
|
||||||
|
|
||||||
// See blip_buffer.txt
|
// See blip_buffer.txt
|
||||||
blip_eq_t( double treble, long rolloff_freq, long sample_rate, long cutoff_freq = 0 );
|
blip_eq_t( double treble, long rolloff_freq, long sample_rate, long cutoff_freq = 0 );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double treble;
|
double treble;
|
||||||
long rolloff_freq;
|
long rolloff_freq;
|
||||||
|
@ -281,7 +281,7 @@ public:
|
||||||
blargg_err_t set_sample_rate( long samples_per_sec, int msec_length );
|
blargg_err_t set_sample_rate( long samples_per_sec, int msec_length );
|
||||||
blip_time_t count_clocks( long count ) const;
|
blip_time_t count_clocks( long count ) const;
|
||||||
void mix_samples( blip_sample_t const* buf, long count );
|
void mix_samples( blip_sample_t const* buf, long count );
|
||||||
|
|
||||||
Silent_Blip_Buffer();
|
Silent_Blip_Buffer();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -393,21 +393,21 @@ inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t t
|
||||||
// If this assertion fails, it means that an attempt was made to add a delta
|
// If this assertion fails, it means that an attempt was made to add a delta
|
||||||
// at a negative time or past the end of the buffer.
|
// at a negative time or past the end of the buffer.
|
||||||
assert( (blip_long) (time >> BLIP_BUFFER_ACCURACY) < blip_buf->buffer_size_ );
|
assert( (blip_long) (time >> BLIP_BUFFER_ACCURACY) < blip_buf->buffer_size_ );
|
||||||
|
|
||||||
delta *= impl.delta_factor;
|
delta *= impl.delta_factor;
|
||||||
blip_long* BLIP_RESTRICT buf = blip_buf->buffer_ + (time >> BLIP_BUFFER_ACCURACY);
|
blip_long* BLIP_RESTRICT buf = blip_buf->buffer_ + (time >> BLIP_BUFFER_ACCURACY);
|
||||||
int phase = (int) (time >> (BLIP_BUFFER_ACCURACY - BLIP_PHASE_BITS) & (blip_res - 1));
|
int phase = (int) (time >> (BLIP_BUFFER_ACCURACY - BLIP_PHASE_BITS) & (blip_res - 1));
|
||||||
|
|
||||||
#if BLIP_BUFFER_FAST
|
#if BLIP_BUFFER_FAST
|
||||||
blip_long left = buf [0] + delta;
|
blip_long left = buf [0] + delta;
|
||||||
|
|
||||||
// Kind of crappy, but doing shift after multiply results in overflow.
|
// Kind of crappy, but doing shift after multiply results in overflow.
|
||||||
// Alternate way of delaying multiply by delta_factor results in worse
|
// Alternate way of delaying multiply by delta_factor results in worse
|
||||||
// sub-sample resolution.
|
// sub-sample resolution.
|
||||||
blip_long right = (delta >> BLIP_PHASE_BITS) * phase;
|
blip_long right = (delta >> BLIP_PHASE_BITS) * phase;
|
||||||
left -= right;
|
left -= right;
|
||||||
right += buf [1];
|
right += buf [1];
|
||||||
|
|
||||||
buf [0] = left;
|
buf [0] = left;
|
||||||
buf [1] = right;
|
buf [1] = right;
|
||||||
#else
|
#else
|
||||||
|
@ -415,17 +415,17 @@ inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t t
|
||||||
int const fwd = (blip_widest_impulse_ - quality) / 2;
|
int const fwd = (blip_widest_impulse_ - quality) / 2;
|
||||||
int const rev = fwd + quality - 2;
|
int const rev = fwd + quality - 2;
|
||||||
int const mid = quality / 2 - 1;
|
int const mid = quality / 2 - 1;
|
||||||
|
|
||||||
imp_t const* BLIP_RESTRICT imp = impulses + blip_res - phase;
|
imp_t const* BLIP_RESTRICT imp = impulses + blip_res - phase;
|
||||||
|
|
||||||
#if defined (_M_IX86) || defined (_M_IA64) || defined (__i486__) || \
|
#if defined (_M_IX86) || defined (_M_IA64) || defined (__i486__) || \
|
||||||
defined (__x86_64__) || defined (__ia64__) || defined (__i386__)
|
defined (__x86_64__) || defined (__ia64__) || defined (__i386__)
|
||||||
|
|
||||||
// this straight forward version gave in better code on GCC for x86
|
// this straight forward version gave in better code on GCC for x86
|
||||||
|
|
||||||
#define ADD_IMP( out, in ) \
|
#define ADD_IMP( out, in ) \
|
||||||
buf [out] += (blip_long) imp [blip_res * (in)] * delta
|
buf [out] += (blip_long) imp [blip_res * (in)] * delta
|
||||||
|
|
||||||
#define BLIP_FWD( i ) {\
|
#define BLIP_FWD( i ) {\
|
||||||
ADD_IMP( fwd + i, i );\
|
ADD_IMP( fwd + i, i );\
|
||||||
ADD_IMP( fwd + 1 + i, i + 1 );\
|
ADD_IMP( fwd + 1 + i, i + 1 );\
|
||||||
|
@ -446,16 +446,16 @@ inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t t
|
||||||
if ( quality > 12 ) BLIP_REV( 6 )
|
if ( quality > 12 ) BLIP_REV( 6 )
|
||||||
if ( quality > 8 ) BLIP_REV( 4 )
|
if ( quality > 8 ) BLIP_REV( 4 )
|
||||||
BLIP_REV( 2 )
|
BLIP_REV( 2 )
|
||||||
|
|
||||||
ADD_IMP( rev , 1 );
|
ADD_IMP( rev , 1 );
|
||||||
ADD_IMP( rev + 1, 0 );
|
ADD_IMP( rev + 1, 0 );
|
||||||
|
|
||||||
#undef ADD_IMP
|
#undef ADD_IMP
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// for RISC processors, help compiler by reading ahead of writes
|
// for RISC processors, help compiler by reading ahead of writes
|
||||||
|
|
||||||
#define BLIP_FWD( i ) {\
|
#define BLIP_FWD( i ) {\
|
||||||
blip_long t0 = i0 * delta + buf [fwd + i];\
|
blip_long t0 = i0 * delta + buf [fwd + i];\
|
||||||
blip_long t1 = imp [blip_res * (i + 1)] * delta + buf [fwd + 1 + i];\
|
blip_long t1 = imp [blip_res * (i + 1)] * delta + buf [fwd + 1 + i];\
|
||||||
|
@ -470,7 +470,7 @@ inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t t
|
||||||
buf [rev - r] = t0;\
|
buf [rev - r] = t0;\
|
||||||
buf [rev + 1 - r] = t1;\
|
buf [rev + 1 - r] = t1;\
|
||||||
}
|
}
|
||||||
|
|
||||||
blip_long i0 = *imp;
|
blip_long i0 = *imp;
|
||||||
BLIP_FWD( 0 )
|
BLIP_FWD( 0 )
|
||||||
if ( quality > 8 ) BLIP_FWD( 2 )
|
if ( quality > 8 ) BLIP_FWD( 2 )
|
||||||
|
@ -486,13 +486,13 @@ inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t t
|
||||||
if ( quality > 12 ) BLIP_REV( 6 )
|
if ( quality > 12 ) BLIP_REV( 6 )
|
||||||
if ( quality > 8 ) BLIP_REV( 4 )
|
if ( quality > 8 ) BLIP_REV( 4 )
|
||||||
BLIP_REV( 2 )
|
BLIP_REV( 2 )
|
||||||
|
|
||||||
blip_long t0 = i0 * delta + buf [rev ];
|
blip_long t0 = i0 * delta + buf [rev ];
|
||||||
blip_long t1 = *imp * delta + buf [rev + 1];
|
blip_long t1 = *imp * delta + buf [rev + 1];
|
||||||
buf [rev ] = t0;
|
buf [rev ] = t0;
|
||||||
buf [rev + 1] = t1;
|
buf [rev + 1] = t1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,31 +13,31 @@ public:
|
||||||
// To reduce memory usage, fewer buffers can be used (with a best-fit
|
// To reduce memory usage, fewer buffers can be used (with a best-fit
|
||||||
// approach if there are too few), and maximum echo delay can be reduced
|
// approach if there are too few), and maximum echo delay can be reduced
|
||||||
Effects_Buffer( int max_bufs = 32, long echo_size = 24 * 1024L );
|
Effects_Buffer( int max_bufs = 32, long echo_size = 24 * 1024L );
|
||||||
|
|
||||||
struct pan_vol_t
|
struct pan_vol_t
|
||||||
{
|
{
|
||||||
float vol; // 0.0 = silent, 0.5 = half volume, 1.0 = normal
|
float vol; // 0.0 = silent, 0.5 = half volume, 1.0 = normal
|
||||||
float pan; // -1.0 = left, 0.0 = center, +1.0 = right
|
float pan; // -1.0 = left, 0.0 = center, +1.0 = right
|
||||||
};
|
};
|
||||||
|
|
||||||
// Global configuration
|
// Global configuration
|
||||||
struct config_t
|
struct config_t
|
||||||
{
|
{
|
||||||
bool enabled; // false = disable all effects
|
bool enabled; // false = disable all effects
|
||||||
|
|
||||||
// Current sound is echoed at adjustable left/right delay,
|
// Current sound is echoed at adjustable left/right delay,
|
||||||
// with reduced treble and volume (feedback).
|
// with reduced treble and volume (feedback).
|
||||||
float treble; // 1.0 = full treble, 0.1 = very little, 0.0 = silent
|
float treble; // 1.0 = full treble, 0.1 = very little, 0.0 = silent
|
||||||
int delay [2]; // left, right delays (msec)
|
int delay [2]; // left, right delays (msec)
|
||||||
float feedback; // 0.0 = no echo, 0.5 = each echo half previous, 1.0 = cacophony
|
float feedback; // 0.0 = no echo, 0.5 = each echo half previous, 1.0 = cacophony
|
||||||
pan_vol_t side_chans [2]; // left and right side channel volume and pan
|
pan_vol_t side_chans [2]; // left and right side channel volume and pan
|
||||||
};
|
};
|
||||||
config_t& config() { return config_; }
|
config_t& config() { return config_; }
|
||||||
|
|
||||||
// Limits of delay (msec)
|
// Limits of delay (msec)
|
||||||
int min_delay() const;
|
int min_delay() const;
|
||||||
int max_delay() const;
|
int max_delay() const;
|
||||||
|
|
||||||
// Per-channel configuration. Two or more channels with matching parameters are
|
// Per-channel configuration. Two or more channels with matching parameters are
|
||||||
// optimized to internally use the same buffer.
|
// optimized to internally use the same buffer.
|
||||||
struct chan_config_t : pan_vol_t
|
struct chan_config_t : pan_vol_t
|
||||||
|
@ -49,10 +49,10 @@ public:
|
||||||
bool echo; // false = channel doesn't have any echo
|
bool echo; // false = channel doesn't have any echo
|
||||||
};
|
};
|
||||||
chan_config_t& chan_config( int i ) { return chans [i + extra_chans].cfg; }
|
chan_config_t& chan_config( int i ) { return chans [i + extra_chans].cfg; }
|
||||||
|
|
||||||
// Apply any changes made to config() and chan_config()
|
// Apply any changes made to config() and chan_config()
|
||||||
virtual void apply_config();
|
virtual void apply_config();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Effects_Buffer();
|
~Effects_Buffer();
|
||||||
blargg_err_t set_sample_rate( long samples_per_sec, int msec = blip_default_length );
|
blargg_err_t set_sample_rate( long samples_per_sec, int msec = blip_default_length );
|
||||||
|
@ -72,9 +72,9 @@ private:
|
||||||
config_t config_;
|
config_t config_;
|
||||||
long clock_rate_;
|
long clock_rate_;
|
||||||
int bass_freq_;
|
int bass_freq_;
|
||||||
|
|
||||||
blargg_long echo_size;
|
blargg_long echo_size;
|
||||||
|
|
||||||
struct chan_t
|
struct chan_t
|
||||||
{
|
{
|
||||||
fixed_t vol [stereo];
|
fixed_t vol [stereo];
|
||||||
|
@ -82,35 +82,35 @@ private:
|
||||||
channel_t channel;
|
channel_t channel;
|
||||||
};
|
};
|
||||||
blargg_vector<chan_t> chans;
|
blargg_vector<chan_t> chans;
|
||||||
|
|
||||||
struct buf_t : Tracked_Blip_Buffer
|
struct buf_t : Tracked_Blip_Buffer
|
||||||
{
|
{
|
||||||
fixed_t vol [stereo];
|
fixed_t vol [stereo];
|
||||||
bool echo;
|
bool echo;
|
||||||
|
|
||||||
void* operator new ( size_t, void* p ) { return p; }
|
void* operator new ( size_t, void* p ) { return p; }
|
||||||
void operator delete ( void* ) { }
|
void operator delete ( void* ) { }
|
||||||
|
|
||||||
~buf_t() { }
|
~buf_t() { }
|
||||||
};
|
};
|
||||||
buf_t* bufs;
|
buf_t* bufs;
|
||||||
int bufs_size;
|
int bufs_size;
|
||||||
int bufs_max; // bufs_size <= bufs_max, to limit memory usage
|
int bufs_max; // bufs_size <= bufs_max, to limit memory usage
|
||||||
Stereo_Mixer mixer;
|
Stereo_Mixer mixer;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
long delay [stereo];
|
long delay [stereo];
|
||||||
fixed_t treble;
|
fixed_t treble;
|
||||||
fixed_t feedback;
|
fixed_t feedback;
|
||||||
fixed_t low_pass [stereo];
|
fixed_t low_pass [stereo];
|
||||||
} s;
|
} s;
|
||||||
|
|
||||||
blargg_vector<fixed_t> echo;
|
blargg_vector<fixed_t> echo;
|
||||||
blargg_long echo_pos;
|
blargg_long echo_pos;
|
||||||
|
|
||||||
bool no_effects;
|
bool no_effects;
|
||||||
bool no_echo;
|
bool no_echo;
|
||||||
|
|
||||||
void assign_buffers();
|
void assign_buffers();
|
||||||
void clear_echo();
|
void clear_echo();
|
||||||
void mix_effects( blip_sample_t* out, int pair_count );
|
void mix_effects( blip_sample_t* out, int pair_count );
|
||||||
|
@ -129,10 +129,10 @@ public:
|
||||||
bool surround; // true = put some channels in back
|
bool surround; // true = put some channels in back
|
||||||
};
|
};
|
||||||
config_t& config() { return config_; }
|
config_t& config() { return config_; }
|
||||||
|
|
||||||
// Apply any changes made to config()
|
// Apply any changes made to config()
|
||||||
void apply_config();
|
void apply_config();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Simple_Effects_Buffer();
|
Simple_Effects_Buffer();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -39,13 +39,13 @@ void Gb_Apu::set_output( Blip_Buffer* center, Blip_Buffer* left, Blip_Buffer* ri
|
||||||
// Must be silent (all NULL), mono (left and right NULL), or stereo (none NULL)
|
// Must be silent (all NULL), mono (left and right NULL), or stereo (none NULL)
|
||||||
require( !center || (center && !left && !right) || (center && left && right) );
|
require( !center || (center && !left && !right) || (center && left && right) );
|
||||||
require( (unsigned) osc <= osc_count ); // fails if you pass invalid osc index
|
require( (unsigned) osc <= osc_count ); // fails if you pass invalid osc index
|
||||||
|
|
||||||
if ( !center || !left || !right )
|
if ( !center || !left || !right )
|
||||||
{
|
{
|
||||||
left = center;
|
left = center;
|
||||||
right = center;
|
right = center;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = (unsigned) osc % osc_count;
|
int i = (unsigned) osc % osc_count;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -90,12 +90,12 @@ void Gb_Apu::reset_regs()
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < 0x20; i++ )
|
for ( int i = 0; i < 0x20; i++ )
|
||||||
regs [i] = 0;
|
regs [i] = 0;
|
||||||
|
|
||||||
square1.reset();
|
square1.reset();
|
||||||
square2.reset();
|
square2.reset();
|
||||||
wave .reset();
|
wave .reset();
|
||||||
noise .reset();
|
noise .reset();
|
||||||
|
|
||||||
apply_volume();
|
apply_volume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,15 +110,15 @@ void Gb_Apu::reset_lengths()
|
||||||
void Gb_Apu::reduce_clicks( bool reduce )
|
void Gb_Apu::reduce_clicks( bool reduce )
|
||||||
{
|
{
|
||||||
reduce_clicks_ = reduce;
|
reduce_clicks_ = reduce;
|
||||||
|
|
||||||
// Click reduction makes DAC off generate same output as volume 0
|
// Click reduction makes DAC off generate same output as volume 0
|
||||||
int dac_off_amp = 0;
|
int dac_off_amp = 0;
|
||||||
if ( reduce && wave.mode != mode_agb ) // AGB already eliminates clicks
|
if ( reduce && wave.mode != mode_agb ) // AGB already eliminates clicks
|
||||||
dac_off_amp = -Gb_Osc::dac_bias;
|
dac_off_amp = -Gb_Osc::dac_bias;
|
||||||
|
|
||||||
for ( int i = 0; i < osc_count; i++ )
|
for ( int i = 0; i < osc_count; i++ )
|
||||||
oscs [i]->dac_off_amp = dac_off_amp;
|
oscs [i]->dac_off_amp = dac_off_amp;
|
||||||
|
|
||||||
// AGB always eliminates clicks on wave channel using same method
|
// AGB always eliminates clicks on wave channel using same method
|
||||||
if ( wave.mode == mode_agb )
|
if ( wave.mode == mode_agb )
|
||||||
wave.dac_off_amp = -Gb_Osc::dac_bias;
|
wave.dac_off_amp = -Gb_Osc::dac_bias;
|
||||||
|
@ -133,15 +133,15 @@ void Gb_Apu::reset( mode_t mode, bool agb_wave )
|
||||||
for ( int i = 0; i < osc_count; i++ )
|
for ( int i = 0; i < osc_count; i++ )
|
||||||
oscs [i]->mode = mode;
|
oscs [i]->mode = mode;
|
||||||
reduce_clicks( reduce_clicks_ );
|
reduce_clicks( reduce_clicks_ );
|
||||||
|
|
||||||
// Reset state
|
// Reset state
|
||||||
frame_time = 0;
|
frame_time = 0;
|
||||||
last_time = 0;
|
last_time = 0;
|
||||||
frame_phase = 0;
|
frame_phase = 0;
|
||||||
|
|
||||||
reset_regs();
|
reset_regs();
|
||||||
reset_lengths();
|
reset_lengths();
|
||||||
|
|
||||||
// Load initial wave RAM
|
// Load initial wave RAM
|
||||||
static byte const initial_wave [2] [16] = {
|
static byte const initial_wave [2] [16] = {
|
||||||
{0x84,0x40,0x43,0xAA,0x2D,0x78,0x92,0x3C,0x60,0x59,0x59,0xB0,0x34,0xB8,0x2E,0xDA},
|
{0x84,0x40,0x43,0xAA,0x2D,0x78,0x92,0x3C,0x60,0x59,0x59,0xB0,0x34,0xB8,0x2E,0xDA},
|
||||||
|
@ -167,12 +167,12 @@ void Gb_Apu::set_tempo( double t )
|
||||||
Gb_Apu::Gb_Apu()
|
Gb_Apu::Gb_Apu()
|
||||||
{
|
{
|
||||||
wave.wave_ram = ®s [wave_ram - start_addr];
|
wave.wave_ram = ®s [wave_ram - start_addr];
|
||||||
|
|
||||||
oscs [0] = &square1;
|
oscs [0] = &square1;
|
||||||
oscs [1] = &square2;
|
oscs [1] = &square2;
|
||||||
oscs [2] = &wave;
|
oscs [2] = &wave;
|
||||||
oscs [3] = &noise;
|
oscs [3] = &noise;
|
||||||
|
|
||||||
for ( int i = osc_count; --i >= 0; )
|
for ( int i = osc_count; --i >= 0; )
|
||||||
{
|
{
|
||||||
Gb_Osc& o = *oscs [i];
|
Gb_Osc& o = *oscs [i];
|
||||||
|
@ -185,7 +185,7 @@ Gb_Apu::Gb_Apu()
|
||||||
o.good_synth = &good_synth;
|
o.good_synth = &good_synth;
|
||||||
o.med_synth = &med_synth;
|
o.med_synth = &med_synth;
|
||||||
}
|
}
|
||||||
|
|
||||||
reduce_clicks_ = false;
|
reduce_clicks_ = false;
|
||||||
set_tempo( 1.0 );
|
set_tempo( 1.0 );
|
||||||
volume_ = 1.0;
|
volume_ = 1.0;
|
||||||
|
@ -200,16 +200,16 @@ void Gb_Apu::run_until_( blip_time_t end_time )
|
||||||
blip_time_t time = end_time;
|
blip_time_t time = end_time;
|
||||||
if ( time > frame_time )
|
if ( time > frame_time )
|
||||||
time = frame_time;
|
time = frame_time;
|
||||||
|
|
||||||
square1.run( last_time, time );
|
square1.run( last_time, time );
|
||||||
square2.run( last_time, time );
|
square2.run( last_time, time );
|
||||||
wave .run( last_time, time );
|
wave .run( last_time, time );
|
||||||
noise .run( last_time, time );
|
noise .run( last_time, time );
|
||||||
last_time = time;
|
last_time = time;
|
||||||
|
|
||||||
if ( time == end_time )
|
if ( time == end_time )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// run frame sequencer
|
// run frame sequencer
|
||||||
frame_time += frame_period * Gb_Osc::clk_mul;
|
frame_time += frame_period * Gb_Osc::clk_mul;
|
||||||
switch ( frame_phase++ )
|
switch ( frame_phase++ )
|
||||||
|
@ -226,7 +226,7 @@ void Gb_Apu::run_until_( blip_time_t end_time )
|
||||||
wave .clock_length();
|
wave .clock_length();
|
||||||
noise .clock_length();
|
noise .clock_length();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
// 64 Hz
|
// 64 Hz
|
||||||
frame_phase = 0;
|
frame_phase = 0;
|
||||||
|
@ -248,10 +248,10 @@ void Gb_Apu::end_frame( blip_time_t end_time )
|
||||||
{
|
{
|
||||||
if ( end_time > last_time )
|
if ( end_time > last_time )
|
||||||
run_until( end_time );
|
run_until( end_time );
|
||||||
|
|
||||||
frame_time -= end_time;
|
frame_time -= end_time;
|
||||||
assert( frame_time >= 0 );
|
assert( frame_time >= 0 );
|
||||||
|
|
||||||
last_time -= end_time;
|
last_time -= end_time;
|
||||||
assert( last_time >= 0 );
|
assert( last_time >= 0 );
|
||||||
}
|
}
|
||||||
|
@ -287,28 +287,28 @@ void Gb_Apu::apply_stereo()
|
||||||
void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
||||||
{
|
{
|
||||||
require( (unsigned) data < 0x100 );
|
require( (unsigned) data < 0x100 );
|
||||||
|
|
||||||
int reg = addr - start_addr;
|
int reg = addr - start_addr;
|
||||||
if ( (unsigned) reg >= register_count )
|
if ( (unsigned) reg >= register_count )
|
||||||
{
|
{
|
||||||
require( false );
|
require( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( addr < status_reg && !(regs [status_reg - start_addr] & power_mask) )
|
if ( addr < status_reg && !(regs [status_reg - start_addr] & power_mask) )
|
||||||
{
|
{
|
||||||
// Power is off
|
// Power is off
|
||||||
|
|
||||||
// length counters can only be written in DMG mode
|
// length counters can only be written in DMG mode
|
||||||
if ( wave.mode != mode_dmg || (reg != 1 && reg != 5+1 && reg != 10+1 && reg != 15+1) )
|
if ( wave.mode != mode_dmg || (reg != 1 && reg != 5+1 && reg != 10+1 && reg != 15+1) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( reg < 10 )
|
if ( reg < 10 )
|
||||||
data &= 0x3F; // clear square duty
|
data &= 0x3F; // clear square duty
|
||||||
}
|
}
|
||||||
|
|
||||||
run_until( time );
|
run_until( time );
|
||||||
|
|
||||||
if ( addr >= wave_ram )
|
if ( addr >= wave_ram )
|
||||||
{
|
{
|
||||||
wave.write( addr, data );
|
wave.write( addr, data );
|
||||||
|
@ -317,7 +317,7 @@ void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
||||||
{
|
{
|
||||||
int old_data = regs [reg];
|
int old_data = regs [reg];
|
||||||
regs [reg] = data;
|
regs [reg] = data;
|
||||||
|
|
||||||
if ( addr < vol_reg )
|
if ( addr < vol_reg )
|
||||||
{
|
{
|
||||||
// Oscillator
|
// Oscillator
|
||||||
|
@ -328,7 +328,7 @@ void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
||||||
// Master volume
|
// Master volume
|
||||||
for ( int i = osc_count; --i >= 0; )
|
for ( int i = osc_count; --i >= 0; )
|
||||||
silence_osc( *oscs [i] );
|
silence_osc( *oscs [i] );
|
||||||
|
|
||||||
apply_volume();
|
apply_volume();
|
||||||
}
|
}
|
||||||
else if ( addr == stereo_reg )
|
else if ( addr == stereo_reg )
|
||||||
|
@ -342,11 +342,11 @@ void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
||||||
frame_phase = 0;
|
frame_phase = 0;
|
||||||
for ( int i = osc_count; --i >= 0; )
|
for ( int i = osc_count; --i >= 0; )
|
||||||
silence_osc( *oscs [i] );
|
silence_osc( *oscs [i] );
|
||||||
|
|
||||||
reset_regs();
|
reset_regs();
|
||||||
if ( wave.mode != mode_dmg )
|
if ( wave.mode != mode_dmg )
|
||||||
reset_lengths();
|
reset_lengths();
|
||||||
|
|
||||||
regs [status_reg - start_addr] = data;
|
regs [status_reg - start_addr] = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,17 +355,17 @@ void Gb_Apu::write_register( blip_time_t time, unsigned addr, int data )
|
||||||
int Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
int Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
||||||
{
|
{
|
||||||
run_until( time );
|
run_until( time );
|
||||||
|
|
||||||
int reg = addr - start_addr;
|
int reg = addr - start_addr;
|
||||||
if ( (unsigned) reg >= register_count )
|
if ( (unsigned) reg >= register_count )
|
||||||
{
|
{
|
||||||
require( false );
|
require( false );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( addr >= wave_ram )
|
if ( addr >= wave_ram )
|
||||||
return wave.read( addr );
|
return wave.read( addr );
|
||||||
|
|
||||||
// Value read back has some bits always set
|
// Value read back has some bits always set
|
||||||
static byte const masks [] = {
|
static byte const masks [] = {
|
||||||
0x80,0x3F,0x00,0xFF,0xBF,
|
0x80,0x3F,0x00,0xFF,0xBF,
|
||||||
|
@ -379,7 +379,7 @@ int Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
||||||
if ( wave.agb_mask && (reg == 10 || reg == 12) )
|
if ( wave.agb_mask && (reg == 10 || reg == 12) )
|
||||||
mask = 0x1F; // extra implemented bits in wave regs on AGB
|
mask = 0x1F; // extra implemented bits in wave regs on AGB
|
||||||
int data = regs [reg] | mask;
|
int data = regs [reg] | mask;
|
||||||
|
|
||||||
// Status register
|
// Status register
|
||||||
if ( addr == status_reg )
|
if ( addr == status_reg )
|
||||||
{
|
{
|
||||||
|
@ -389,6 +389,6 @@ int Gb_Apu::read_register( blip_time_t time, unsigned addr )
|
||||||
data |= (int) wave .enabled << 2;
|
data |= (int) wave .enabled << 2;
|
||||||
data |= (int) noise .enabled << 3;
|
data |= (int) noise .enabled << 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,17 @@ struct gb_apu_state_t;
|
||||||
class Gb_Apu {
|
class Gb_Apu {
|
||||||
public:
|
public:
|
||||||
// Basics
|
// Basics
|
||||||
|
|
||||||
// Clock rate that sound hardware runs at.
|
// Clock rate that sound hardware runs at.
|
||||||
enum { clock_rate = 4194304 * GB_APU_OVERCLOCK };
|
enum { clock_rate = 4194304 * GB_APU_OVERCLOCK };
|
||||||
|
|
||||||
// Sets buffer(s) to generate sound into. If left and right are NULL, output is mono.
|
// Sets buffer(s) to generate sound into. If left and right are NULL, output is mono.
|
||||||
// If all are NULL, no output is generated but other emulation still runs.
|
// If all are NULL, no output is generated but other emulation still runs.
|
||||||
// If chan is specified, only that channel's output is changed, otherwise all are.
|
// If chan is specified, only that channel's output is changed, otherwise all are.
|
||||||
enum { osc_count = 4 }; // 0: Square 1, 1: Square 2, 2: Wave, 3: Noise
|
enum { osc_count = 4 }; // 0: Square 1, 1: Square 2, 2: Wave, 3: Noise
|
||||||
void set_output( Blip_Buffer* center, Blip_Buffer* left = NULL, Blip_Buffer* right = NULL,
|
void set_output( Blip_Buffer* center, Blip_Buffer* left = NULL, Blip_Buffer* right = NULL,
|
||||||
int chan = osc_count );
|
int chan = osc_count );
|
||||||
|
|
||||||
// Resets hardware to initial power on state BEFORE boot ROM runs. Mode selects
|
// Resets hardware to initial power on state BEFORE boot ROM runs. Mode selects
|
||||||
// sound hardware. Additional AGB wave features are enabled separately.
|
// sound hardware. Additional AGB wave features are enabled separately.
|
||||||
enum mode_t {
|
enum mode_t {
|
||||||
|
@ -30,38 +30,38 @@ public:
|
||||||
mode_agb // Game Boy Advance
|
mode_agb // Game Boy Advance
|
||||||
};
|
};
|
||||||
void reset( mode_t mode = mode_cgb, bool agb_wave = false );
|
void reset( mode_t mode = mode_cgb, bool agb_wave = false );
|
||||||
|
|
||||||
// Reads and writes must be within the start_addr to end_addr range, inclusive.
|
// Reads and writes must be within the start_addr to end_addr range, inclusive.
|
||||||
// Addresses outside this range are not mapped to the sound hardware.
|
// Addresses outside this range are not mapped to the sound hardware.
|
||||||
enum { start_addr = 0xFF10 };
|
enum { start_addr = 0xFF10 };
|
||||||
enum { end_addr = 0xFF3F };
|
enum { end_addr = 0xFF3F };
|
||||||
enum { register_count = end_addr - start_addr + 1 };
|
enum { register_count = end_addr - start_addr + 1 };
|
||||||
|
|
||||||
// Times are specified as the number of clocks since the beginning of the
|
// Times are specified as the number of clocks since the beginning of the
|
||||||
// current time frame.
|
// current time frame.
|
||||||
|
|
||||||
// Emulates CPU write of data to addr at specified time.
|
// Emulates CPU write of data to addr at specified time.
|
||||||
void write_register( blip_time_t time, unsigned addr, int data );
|
void write_register( blip_time_t time, unsigned addr, int data );
|
||||||
|
|
||||||
// Emulates CPU read from addr at specified time.
|
// Emulates CPU read from addr at specified time.
|
||||||
int read_register( blip_time_t time, unsigned addr );
|
int read_register( blip_time_t time, unsigned addr );
|
||||||
|
|
||||||
// Emulates sound hardware up to specified time, ends current time frame, then
|
// Emulates sound hardware up to specified time, ends current time frame, then
|
||||||
// starts a new frame at time 0.
|
// starts a new frame at time 0.
|
||||||
void end_frame( blip_time_t frame_length );
|
void end_frame( blip_time_t frame_length );
|
||||||
|
|
||||||
// Sound adjustments
|
// Sound adjustments
|
||||||
|
|
||||||
// Sets overall volume, where 1.0 is normal.
|
// Sets overall volume, where 1.0 is normal.
|
||||||
void volume( double );
|
void volume( double );
|
||||||
|
|
||||||
// If true, reduces clicking by disabling DAC biasing. Note that this reduces
|
// If true, reduces clicking by disabling DAC biasing. Note that this reduces
|
||||||
// emulation accuracy, since the clicks are authentic.
|
// emulation accuracy, since the clicks are authentic.
|
||||||
void reduce_clicks( bool reduce = true );
|
void reduce_clicks( bool reduce = true );
|
||||||
|
|
||||||
// Sets treble equalization.
|
// Sets treble equalization.
|
||||||
void treble_eq( blip_eq_t const& );
|
void treble_eq( blip_eq_t const& );
|
||||||
|
|
||||||
// Treble and bass values for various hardware.
|
// Treble and bass values for various hardware.
|
||||||
enum {
|
enum {
|
||||||
speaker_treble = -47, // speaker on system
|
speaker_treble = -47, // speaker on system
|
||||||
|
@ -73,24 +73,24 @@ public:
|
||||||
agb_treble = 0,
|
agb_treble = 0,
|
||||||
agb_bass = 30
|
agb_bass = 30
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sets frame sequencer rate, where 1.0 is normal. Meant for adjusting the
|
// Sets frame sequencer rate, where 1.0 is normal. Meant for adjusting the
|
||||||
// tempo in a game music player.
|
// tempo in a game music player.
|
||||||
void set_tempo( double );
|
void set_tempo( double );
|
||||||
|
|
||||||
// Save states
|
// Save states
|
||||||
|
|
||||||
// Saves full emulation state to state_out. Data format is portable and
|
// Saves full emulation state to state_out. Data format is portable and
|
||||||
// includes some extra space to avoid expansion in case more state needs
|
// includes some extra space to avoid expansion in case more state needs
|
||||||
// to be stored in the future.
|
// to be stored in the future.
|
||||||
void save_state( gb_apu_state_t* state_out );
|
void save_state( gb_apu_state_t* state_out );
|
||||||
|
|
||||||
// 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 );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Gb_Apu();
|
Gb_Apu();
|
||||||
|
|
||||||
// Use set_output() in place of these
|
// Use set_output() in place of these
|
||||||
BLARGG_DEPRECATED void output ( Blip_Buffer* c ) { set_output( c, c, c ); }
|
BLARGG_DEPRECATED void output ( Blip_Buffer* c ) { set_output( c, c, c ); }
|
||||||
BLARGG_DEPRECATED void output ( Blip_Buffer* c, Blip_Buffer* l, Blip_Buffer* r ) { set_output( c, l, r ); }
|
BLARGG_DEPRECATED void output ( Blip_Buffer* c, Blip_Buffer* l, Blip_Buffer* r ) { set_output( c, l, r ); }
|
||||||
|
@ -101,13 +101,13 @@ private:
|
||||||
// noncopyable
|
// noncopyable
|
||||||
Gb_Apu( const Gb_Apu& );
|
Gb_Apu( const Gb_Apu& );
|
||||||
Gb_Apu& operator = ( const Gb_Apu& );
|
Gb_Apu& operator = ( const Gb_Apu& );
|
||||||
|
|
||||||
Gb_Osc* oscs [osc_count];
|
Gb_Osc* oscs [osc_count];
|
||||||
blip_time_t last_time; // time sound emulator has been run to
|
blip_time_t last_time; // time sound emulator has been run to
|
||||||
blip_time_t frame_period; // clocks between each frame sequencer step
|
blip_time_t frame_period; // clocks between each frame sequencer step
|
||||||
double volume_;
|
double volume_;
|
||||||
bool reduce_clicks_;
|
bool reduce_clicks_;
|
||||||
|
|
||||||
Gb_Sweep_Square square1;
|
Gb_Sweep_Square square1;
|
||||||
Gb_Square square2;
|
Gb_Square square2;
|
||||||
Gb_Wave wave;
|
Gb_Wave wave;
|
||||||
|
@ -116,11 +116,11 @@ private:
|
||||||
int frame_phase; // phase of next frame sequencer step
|
int frame_phase; // phase of next frame sequencer step
|
||||||
enum { regs_size = register_count + 0x10 };
|
enum { regs_size = register_count + 0x10 };
|
||||||
BOOST::uint8_t regs [regs_size];// last values written to registers
|
BOOST::uint8_t regs [regs_size];// last values written to registers
|
||||||
|
|
||||||
// large objects after everything else
|
// large objects after everything else
|
||||||
Gb_Osc::Good_Synth good_synth;
|
Gb_Osc::Good_Synth good_synth;
|
||||||
Gb_Osc::Med_Synth med_synth;
|
Gb_Osc::Med_Synth med_synth;
|
||||||
|
|
||||||
void reset_lengths();
|
void reset_lengths();
|
||||||
void reset_regs();
|
void reset_regs();
|
||||||
int calc_output( int osc ) const;
|
int calc_output( int osc ) const;
|
||||||
|
@ -150,32 +150,32 @@ struct gb_apu_state_t
|
||||||
// to be written directly to disk.
|
// to be written directly to disk.
|
||||||
typedef unsigned char val_t [4];
|
typedef unsigned char val_t [4];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum { format0 = 0x50414247 };
|
enum { format0 = 0x50414247 };
|
||||||
|
|
||||||
val_t format; // format of all following data
|
val_t format; // format of all following data
|
||||||
val_t version; // later versions just add fields to end
|
val_t version; // later versions just add fields to end
|
||||||
|
|
||||||
unsigned char regs [0x40];
|
unsigned char regs [0x40];
|
||||||
val_t frame_time;
|
val_t frame_time;
|
||||||
val_t frame_phase;
|
val_t frame_phase;
|
||||||
|
|
||||||
val_t sweep_freq;
|
val_t sweep_freq;
|
||||||
val_t sweep_delay;
|
val_t sweep_delay;
|
||||||
val_t sweep_enabled;
|
val_t sweep_enabled;
|
||||||
val_t sweep_neg;
|
val_t sweep_neg;
|
||||||
val_t noise_divider;
|
val_t noise_divider;
|
||||||
val_t wave_buf;
|
val_t wave_buf;
|
||||||
|
|
||||||
val_t delay [4];
|
val_t delay [4];
|
||||||
val_t length_ctr [4];
|
val_t length_ctr [4];
|
||||||
val_t phase [4];
|
val_t phase [4];
|
||||||
val_t enabled [4];
|
val_t enabled [4];
|
||||||
|
|
||||||
val_t env_delay [3];
|
val_t env_delay [3];
|
||||||
val_t env_volume [3];
|
val_t env_volume [3];
|
||||||
val_t env_enabled [3];
|
val_t env_enabled [3];
|
||||||
|
|
||||||
val_t unused [13]; // for future expansion
|
val_t unused [13]; // for future expansion
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
#define REFLECT( x, y ) (save ? (io->y) = (x) : (x) = (io->y) )
|
#define REFLECT( x, y ) (save ? (io->y) = (x) : (x) = (io->y) )
|
||||||
#else
|
#else
|
||||||
#define REFLECT( x, y ) (save ? set_val( io->y, x ) : (void) ((x) = get_val( io->y )))
|
#define REFLECT( x, y ) (save ? set_val( io->y, x ) : (void) ((x) = get_val( io->y )))
|
||||||
|
|
||||||
static blargg_ulong get_val( byte const* p )
|
static blargg_ulong get_val( byte const* p )
|
||||||
{
|
{
|
||||||
return p [3] * 0x1000000 + p [2] * 0x10000 + p [1] * 0x100 + p [0];
|
return p [3] * 0x1000000 + p [2] * 0x10000 + p [1] * 0x100 + p [0];
|
||||||
|
@ -41,34 +41,34 @@ inline const char* Gb_Apu::save_load( gb_apu_state_t* io, bool save )
|
||||||
#if !GB_APU_CUSTOM_STATE
|
#if !GB_APU_CUSTOM_STATE
|
||||||
assert( sizeof (gb_apu_state_t) == 256 );
|
assert( sizeof (gb_apu_state_t) == 256 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int format = io->format0;
|
int format = io->format0;
|
||||||
REFLECT( format, format );
|
REFLECT( format, format );
|
||||||
if ( format != io->format0 )
|
if ( format != io->format0 )
|
||||||
return "Unsupported sound save state format";
|
return "Unsupported sound save state format";
|
||||||
|
|
||||||
int version = 0;
|
int version = 0;
|
||||||
REFLECT( version, version );
|
REFLECT( version, version );
|
||||||
|
|
||||||
// Registers and wave RAM
|
// Registers and wave RAM
|
||||||
assert( regs_size == sizeof io->regs );
|
assert( regs_size == sizeof io->regs );
|
||||||
if ( save )
|
if ( save )
|
||||||
memcpy( io->regs, regs, sizeof io->regs );
|
memcpy( io->regs, regs, sizeof io->regs );
|
||||||
else
|
else
|
||||||
memcpy( regs, io->regs, sizeof regs );
|
memcpy( regs, io->regs, sizeof regs );
|
||||||
|
|
||||||
// Frame sequencer
|
// Frame sequencer
|
||||||
REFLECT( frame_time, frame_time );
|
REFLECT( frame_time, frame_time );
|
||||||
REFLECT( frame_phase, frame_phase );
|
REFLECT( frame_phase, frame_phase );
|
||||||
|
|
||||||
REFLECT( square1.sweep_freq, sweep_freq );
|
REFLECT( square1.sweep_freq, sweep_freq );
|
||||||
REFLECT( square1.sweep_delay, sweep_delay );
|
REFLECT( square1.sweep_delay, sweep_delay );
|
||||||
REFLECT( square1.sweep_enabled, sweep_enabled );
|
REFLECT( square1.sweep_enabled, sweep_enabled );
|
||||||
REFLECT( square1.sweep_neg, sweep_neg );
|
REFLECT( square1.sweep_neg, sweep_neg );
|
||||||
|
|
||||||
REFLECT( noise.divider, noise_divider );
|
REFLECT( noise.divider, noise_divider );
|
||||||
REFLECT( wave.sample_buf, wave_buf );
|
REFLECT( wave.sample_buf, wave_buf );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ inline void Gb_Apu::save_load2( gb_apu_state_t* io, bool save )
|
||||||
REFLECT( osc.length_ctr, length_ctr [i] );
|
REFLECT( osc.length_ctr, length_ctr [i] );
|
||||||
REFLECT( osc.phase, phase [i] );
|
REFLECT( osc.phase, phase [i] );
|
||||||
REFLECT( osc.enabled, enabled [i] );
|
REFLECT( osc.enabled, enabled [i] );
|
||||||
|
|
||||||
if ( i != 2 )
|
if ( i != 2 )
|
||||||
{
|
{
|
||||||
int j = min( i, 2 );
|
int j = min( i, 2 );
|
||||||
|
@ -98,7 +98,7 @@ void Gb_Apu::save_state( gb_apu_state_t* out )
|
||||||
{
|
{
|
||||||
(void) save_load( out, true );
|
(void) save_load( out, true );
|
||||||
save_load2( out, true );
|
save_load2( out, true );
|
||||||
|
|
||||||
#if !GB_APU_CUSTOM_STATE
|
#if !GB_APU_CUSTOM_STATE
|
||||||
memset( out->unused, 0, sizeof out->unused );
|
memset( out->unused, 0, sizeof out->unused );
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,11 +108,11 @@ blargg_err_t Gb_Apu::load_state( gb_apu_state_t const& in )
|
||||||
{
|
{
|
||||||
RETURN_ERR( save_load( CONST_CAST(gb_apu_state_t*,&in), false ) );
|
RETURN_ERR( save_load( CONST_CAST(gb_apu_state_t*,&in), false ) );
|
||||||
save_load2( CONST_CAST(gb_apu_state_t*,&in), false );
|
save_load2( CONST_CAST(gb_apu_state_t*,&in), false );
|
||||||
|
|
||||||
apply_stereo();
|
apply_stereo();
|
||||||
synth_volume( 0 ); // suppress output for the moment
|
synth_volume( 0 ); // suppress output for the moment
|
||||||
run_until_( last_time ); // get last_amp updated
|
run_until_( last_time ); // get last_amp updated
|
||||||
apply_volume(); // now use correct volume
|
apply_volume(); // now use correct volume
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ void Gb_Sweep_Square::calc_sweep( bool update )
|
||||||
int const delta = sweep_freq >> shift;
|
int const delta = sweep_freq >> shift;
|
||||||
sweep_neg = (regs [0] & 0x08) != 0;
|
sweep_neg = (regs [0] & 0x08) != 0;
|
||||||
int const freq = sweep_freq + (sweep_neg ? -delta : delta);
|
int const freq = sweep_freq + (sweep_neg ? -delta : delta);
|
||||||
|
|
||||||
if ( freq > 0x7FF )
|
if ( freq > 0x7FF )
|
||||||
{
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
|
@ -92,7 +92,7 @@ void Gb_Sweep_Square::calc_sweep( bool update )
|
||||||
else if ( shift && update )
|
else if ( shift && update )
|
||||||
{
|
{
|
||||||
sweep_freq = freq;
|
sweep_freq = freq;
|
||||||
|
|
||||||
regs [3] = freq & 0xFF;
|
regs [3] = freq & 0xFF;
|
||||||
regs [4] = (regs [4] & ~0x07) | (freq >> 8 & 0x07);
|
regs [4] = (regs [4] & ~0x07) | (freq >> 8 & 0x07);
|
||||||
}
|
}
|
||||||
|
@ -132,13 +132,13 @@ int Gb_Wave::access( unsigned addr ) const
|
||||||
int Gb_Osc::write_trig( int frame_phase, int max_len, int old_data )
|
int Gb_Osc::write_trig( int frame_phase, int max_len, int old_data )
|
||||||
{
|
{
|
||||||
int data = regs [4];
|
int data = regs [4];
|
||||||
|
|
||||||
if ( (frame_phase & 1) && !(old_data & length_enabled) && length_ctr )
|
if ( (frame_phase & 1) && !(old_data & length_enabled) && length_ctr )
|
||||||
{
|
{
|
||||||
if ( (data & length_enabled) || cgb_02 )
|
if ( (data & length_enabled) || cgb_02 )
|
||||||
length_ctr--;
|
length_ctr--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( data & trigger_mask )
|
if ( data & trigger_mask )
|
||||||
{
|
{
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
@ -149,10 +149,10 @@ int Gb_Osc::write_trig( int frame_phase, int max_len, int old_data )
|
||||||
length_ctr--;
|
length_ctr--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !length_ctr )
|
if ( !length_ctr )
|
||||||
enabled = false;
|
enabled = false;
|
||||||
|
|
||||||
return data & trigger_mask;
|
return data & trigger_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ inline void Gb_Env::zombie_volume( int old, int data )
|
||||||
if ( old & 7 )
|
if ( old & 7 )
|
||||||
v++;
|
v++;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = 16 - v;
|
v = 16 - v;
|
||||||
}
|
}
|
||||||
else if ( (old & 0x0F) == 8 )
|
else if ( (old & 0x0F) == 8 )
|
||||||
|
@ -185,7 +185,7 @@ inline void Gb_Env::zombie_volume( int old, int data )
|
||||||
v++;
|
v++;
|
||||||
else if ( !(old & 8) )
|
else if ( !(old & 8) )
|
||||||
v += 2;
|
v += 2;
|
||||||
|
|
||||||
if ( (old ^ data) & 8 )
|
if ( (old ^ data) & 8 )
|
||||||
v = 16 - v;
|
v = 16 - v;
|
||||||
}
|
}
|
||||||
|
@ -195,26 +195,26 @@ inline void Gb_Env::zombie_volume( int old, int data )
|
||||||
bool Gb_Env::write_register( int frame_phase, int reg, int old, int data )
|
bool Gb_Env::write_register( int frame_phase, int reg, int old, int data )
|
||||||
{
|
{
|
||||||
int const max_len = 64;
|
int const max_len = 64;
|
||||||
|
|
||||||
switch ( reg )
|
switch ( reg )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
length_ctr = max_len - (data & (max_len - 1));
|
length_ctr = max_len - (data & (max_len - 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if ( !dac_enabled() )
|
if ( !dac_enabled() )
|
||||||
enabled = false;
|
enabled = false;
|
||||||
|
|
||||||
zombie_volume( old, data );
|
zombie_volume( old, data );
|
||||||
|
|
||||||
if ( (data & 7) && env_delay == 8 )
|
if ( (data & 7) && env_delay == 8 )
|
||||||
{
|
{
|
||||||
env_delay = 1;
|
env_delay = 1;
|
||||||
clock_envelope(); // TODO: really happens at next length clock
|
clock_envelope(); // TODO: really happens at next length clock
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if ( write_trig( frame_phase, max_len, old ) )
|
if ( write_trig( frame_phase, max_len, old ) )
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ inline void Gb_Sweep_Square::write_register( int frame_phase, int reg, int old_d
|
||||||
{
|
{
|
||||||
if ( reg == 0 && sweep_enabled && sweep_neg && !(data & 0x08) )
|
if ( reg == 0 && sweep_enabled && sweep_neg && !(data & 0x08) )
|
||||||
enabled = false; // sweep negate disabled after used
|
enabled = false; // sweep negate disabled after used
|
||||||
|
|
||||||
if ( Gb_Square::write_register( frame_phase, reg, old_data, data ) )
|
if ( Gb_Square::write_register( frame_phase, reg, old_data, data ) )
|
||||||
{
|
{
|
||||||
sweep_freq = frequency();
|
sweep_freq = frequency();
|
||||||
|
@ -277,18 +277,18 @@ void Gb_Wave::corrupt_wave()
|
||||||
inline void Gb_Wave::write_register( int frame_phase, int reg, int old_data, int data )
|
inline void Gb_Wave::write_register( int frame_phase, int reg, int old_data, int data )
|
||||||
{
|
{
|
||||||
int const max_len = 256;
|
int const max_len = 256;
|
||||||
|
|
||||||
switch ( reg )
|
switch ( reg )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if ( !dac_enabled() )
|
if ( !dac_enabled() )
|
||||||
enabled = false;
|
enabled = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
length_ctr = max_len - data;
|
length_ctr = max_len - data;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
bool was_enabled = enabled;
|
bool was_enabled = enabled;
|
||||||
if ( write_trig( frame_phase, max_len, old_data ) )
|
if ( write_trig( frame_phase, max_len, old_data ) )
|
||||||
|
@ -298,7 +298,7 @@ inline void Gb_Wave::write_register( int frame_phase, int reg, int old_data, int
|
||||||
else if ( mode == Gb_Apu::mode_dmg && was_enabled &&
|
else if ( mode == Gb_Apu::mode_dmg && was_enabled &&
|
||||||
(unsigned) (delay - 2 * clk_mul) < 2 * clk_mul )
|
(unsigned) (delay - 2 * clk_mul) < 2 * clk_mul )
|
||||||
corrupt_wave();
|
corrupt_wave();
|
||||||
|
|
||||||
phase = 0;
|
phase = 0;
|
||||||
delay = period() + 6 * clk_mul;
|
delay = period() + 6 * clk_mul;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ void Gb_Square::run( blip_time_t time, blip_time_t end_time )
|
||||||
duty = 8 - duty;
|
duty = 8 - duty;
|
||||||
}
|
}
|
||||||
int ph = (this->phase + duty_offset) & 7;
|
int ph = (this->phase + duty_offset) & 7;
|
||||||
|
|
||||||
// Determine what will be generated
|
// Determine what will be generated
|
||||||
int vol = 0;
|
int vol = 0;
|
||||||
Blip_Buffer* const out = this->output;
|
Blip_Buffer* const out = this->output;
|
||||||
|
@ -345,18 +345,18 @@ void Gb_Square::run( blip_time_t time, blip_time_t end_time )
|
||||||
{
|
{
|
||||||
if ( enabled )
|
if ( enabled )
|
||||||
vol = this->volume;
|
vol = this->volume;
|
||||||
|
|
||||||
amp = -dac_bias;
|
amp = -dac_bias;
|
||||||
if ( mode == Gb_Apu::mode_agb )
|
if ( mode == Gb_Apu::mode_agb )
|
||||||
amp = -(vol >> 1);
|
amp = -(vol >> 1);
|
||||||
|
|
||||||
// Play inaudible frequencies as constant amplitude
|
// Play inaudible frequencies as constant amplitude
|
||||||
if ( frequency() >= 0x7FA && delay < 32 * clk_mul )
|
if ( frequency() >= 0x7FA && delay < 32 * clk_mul )
|
||||||
{
|
{
|
||||||
amp += (vol * duty) >> 3;
|
amp += (vol * duty) >> 3;
|
||||||
vol = 0;
|
vol = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ph < duty )
|
if ( ph < duty )
|
||||||
{
|
{
|
||||||
amp += vol;
|
amp += vol;
|
||||||
|
@ -365,7 +365,7 @@ void Gb_Square::run( blip_time_t time, blip_time_t end_time )
|
||||||
}
|
}
|
||||||
update_amp( time, amp );
|
update_amp( time, amp );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate wave
|
// Generate wave
|
||||||
time += delay;
|
time += delay;
|
||||||
if ( time < end_time )
|
if ( time < end_time )
|
||||||
|
@ -393,7 +393,7 @@ void Gb_Square::run( blip_time_t time, blip_time_t end_time )
|
||||||
time += per;
|
time += per;
|
||||||
}
|
}
|
||||||
while ( time < end_time );
|
while ( time < end_time );
|
||||||
|
|
||||||
if ( delta != vol )
|
if ( delta != vol )
|
||||||
last_amp -= delta;
|
last_amp -= delta;
|
||||||
}
|
}
|
||||||
|
@ -407,34 +407,34 @@ void Gb_Square::run( blip_time_t time, blip_time_t end_time )
|
||||||
static unsigned run_lfsr( unsigned s, unsigned mask, int count )
|
static unsigned run_lfsr( unsigned s, unsigned mask, int count )
|
||||||
{
|
{
|
||||||
bool const optimized = true; // set to false to use only unoptimized loop in middle
|
bool const optimized = true; // set to false to use only unoptimized loop in middle
|
||||||
|
|
||||||
// optimization used in several places:
|
// optimization used in several places:
|
||||||
// ((s & (1 << b)) << n) ^ ((s & (1 << b)) << (n + 1)) = (s & (1 << b)) * (3 << n)
|
// ((s & (1 << b)) << n) ^ ((s & (1 << b)) << (n + 1)) = (s & (1 << b)) * (3 << n)
|
||||||
|
|
||||||
if ( mask == 0x4000 && optimized )
|
if ( mask == 0x4000 && optimized )
|
||||||
{
|
{
|
||||||
if ( count >= 32767 )
|
if ( count >= 32767 )
|
||||||
count %= 32767;
|
count %= 32767;
|
||||||
|
|
||||||
// Convert from Fibonacci to Galois configuration,
|
// Convert from Fibonacci to Galois configuration,
|
||||||
// shifted left 1 bit
|
// shifted left 1 bit
|
||||||
s ^= (s & 1) * 0x8000;
|
s ^= (s & 1) * 0x8000;
|
||||||
|
|
||||||
// Each iteration is equivalent to clocking LFSR 255 times
|
// Each iteration is equivalent to clocking LFSR 255 times
|
||||||
while ( (count -= 255) > 0 )
|
while ( (count -= 255) > 0 )
|
||||||
s ^= ((s & 0xE) << 12) ^ ((s & 0xE) << 11) ^ (s >> 3);
|
s ^= ((s & 0xE) << 12) ^ ((s & 0xE) << 11) ^ (s >> 3);
|
||||||
count += 255;
|
count += 255;
|
||||||
|
|
||||||
// Each iteration is equivalent to clocking LFSR 15 times
|
// Each iteration is equivalent to clocking LFSR 15 times
|
||||||
// (interesting similarity to single clocking below)
|
// (interesting similarity to single clocking below)
|
||||||
while ( (count -= 15) > 0 )
|
while ( (count -= 15) > 0 )
|
||||||
s ^= ((s & 2) * (3 << 13)) ^ (s >> 1);
|
s ^= ((s & 2) * (3 << 13)) ^ (s >> 1);
|
||||||
count += 15;
|
count += 15;
|
||||||
|
|
||||||
// Remaining singles
|
// Remaining singles
|
||||||
while ( --count >= 0 )
|
while ( --count >= 0 )
|
||||||
s = ((s & 2) * (3 << 13)) ^ (s >> 1);
|
s = ((s & 2) * (3 << 13)) ^ (s >> 1);
|
||||||
|
|
||||||
// Convert back to Fibonacci configuration
|
// Convert back to Fibonacci configuration
|
||||||
s &= 0x7FFF;
|
s &= 0x7FFF;
|
||||||
}
|
}
|
||||||
|
@ -452,29 +452,29 @@ static unsigned run_lfsr( unsigned s, unsigned mask, int count )
|
||||||
if ( !count )
|
if ( !count )
|
||||||
count = 127; // must run at least once
|
count = 127; // must run at least once
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to keep one extra bit of history
|
// Need to keep one extra bit of history
|
||||||
s = s << 1 & 0xFF;
|
s = s << 1 & 0xFF;
|
||||||
|
|
||||||
// Convert from Fibonacci to Galois configuration,
|
// Convert from Fibonacci to Galois configuration,
|
||||||
// shifted left 2 bits
|
// shifted left 2 bits
|
||||||
s ^= (s & 2) * 0x80;
|
s ^= (s & 2) * 0x80;
|
||||||
|
|
||||||
// Each iteration is equivalent to clocking LFSR 7 times
|
// Each iteration is equivalent to clocking LFSR 7 times
|
||||||
// (interesting similarity to single clocking below)
|
// (interesting similarity to single clocking below)
|
||||||
while ( (count -= 7) > 0 )
|
while ( (count -= 7) > 0 )
|
||||||
s ^= ((s & 4) * (3 << 5)) ^ (s >> 1);
|
s ^= ((s & 4) * (3 << 5)) ^ (s >> 1);
|
||||||
count += 7;
|
count += 7;
|
||||||
|
|
||||||
// Remaining singles
|
// Remaining singles
|
||||||
while ( --count >= 0 )
|
while ( --count >= 0 )
|
||||||
s = ((s & 4) * (3 << 5)) ^ (s >> 1);
|
s = ((s & 4) * (3 << 5)) ^ (s >> 1);
|
||||||
|
|
||||||
// Convert back to Fibonacci configuration and
|
// Convert back to Fibonacci configuration and
|
||||||
// repeat last 8 bits above significant 7
|
// repeat last 8 bits above significant 7
|
||||||
s = (s << 7 & 0x7F80) | (s >> 1 & 0x7F);
|
s = (s << 7 & 0x7F80) | (s >> 1 & 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,28 +490,28 @@ void Gb_Noise::run( blip_time_t time, blip_time_t end_time )
|
||||||
{
|
{
|
||||||
if ( enabled )
|
if ( enabled )
|
||||||
vol = this->volume;
|
vol = this->volume;
|
||||||
|
|
||||||
amp = -dac_bias;
|
amp = -dac_bias;
|
||||||
if ( mode == Gb_Apu::mode_agb )
|
if ( mode == Gb_Apu::mode_agb )
|
||||||
amp = -(vol >> 1);
|
amp = -(vol >> 1);
|
||||||
|
|
||||||
if ( !(phase & 1) )
|
if ( !(phase & 1) )
|
||||||
{
|
{
|
||||||
amp += vol;
|
amp += vol;
|
||||||
vol = -vol;
|
vol = -vol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AGB negates final output
|
// AGB negates final output
|
||||||
if ( mode == Gb_Apu::mode_agb )
|
if ( mode == Gb_Apu::mode_agb )
|
||||||
{
|
{
|
||||||
vol = -vol;
|
vol = -vol;
|
||||||
amp = -amp;
|
amp = -amp;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_amp( time, amp );
|
update_amp( time, amp );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run timer and calculate time of next LFSR clock
|
// Run timer and calculate time of next LFSR clock
|
||||||
static byte const period1s [8] = { 1, 2, 4, 6, 8, 10, 12, 14 };
|
static byte const period1s [8] = { 1, 2, 4, 6, 8, 10, 12, 14 };
|
||||||
int const period1 = period1s [regs [3] & 7] * clk_mul;
|
int const period1 = period1s [regs [3] & 7] * clk_mul;
|
||||||
|
@ -519,18 +519,18 @@ void Gb_Noise::run( blip_time_t time, blip_time_t end_time )
|
||||||
int extra = (end_time - time) - delay;
|
int extra = (end_time - time) - delay;
|
||||||
int const per2 = this->period2();
|
int const per2 = this->period2();
|
||||||
time += delay + ((divider ^ (per2 >> 1)) & (per2 - 1)) * period1;
|
time += delay + ((divider ^ (per2 >> 1)) & (per2 - 1)) * period1;
|
||||||
|
|
||||||
int count = (extra < 0 ? 0 : (extra + period1 - 1) / period1);
|
int count = (extra < 0 ? 0 : (extra + period1 - 1) / period1);
|
||||||
divider = (divider - count) & period2_mask;
|
divider = (divider - count) & period2_mask;
|
||||||
delay = count * period1 - extra;
|
delay = count * period1 - extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate wave
|
// Generate wave
|
||||||
if ( time < end_time )
|
if ( time < end_time )
|
||||||
{
|
{
|
||||||
unsigned const mask = this->lfsr_mask();
|
unsigned const mask = this->lfsr_mask();
|
||||||
unsigned bits = this->phase;
|
unsigned bits = this->phase;
|
||||||
|
|
||||||
int per = period2( period1 * 8 );
|
int per = period2( period1 * 8 );
|
||||||
if ( period2_index() >= 0xE )
|
if ( period2_index() >= 0xE )
|
||||||
{
|
{
|
||||||
|
@ -560,7 +560,7 @@ void Gb_Noise::run( blip_time_t time, blip_time_t end_time )
|
||||||
time += per;
|
time += per;
|
||||||
}
|
}
|
||||||
while ( time < end_time );
|
while ( time < end_time );
|
||||||
|
|
||||||
if ( delta == vol )
|
if ( delta == vol )
|
||||||
last_amp += delta;
|
last_amp += delta;
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
|
||||||
int const volume_shift = 2;
|
int const volume_shift = 2;
|
||||||
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];
|
||||||
|
|
||||||
// Determine what will be generated
|
// Determine what will be generated
|
||||||
int playing = false;
|
int playing = false;
|
||||||
Blip_Buffer* const out = this->output;
|
Blip_Buffer* const out = this->output;
|
||||||
|
@ -586,27 +586,27 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
|
||||||
{
|
{
|
||||||
// Play inaudible frequencies as constant amplitude
|
// Play inaudible frequencies as constant amplitude
|
||||||
amp = 8 << 4; // really depends on average of all samples in wave
|
amp = 8 << 4; // really depends on average of all samples in wave
|
||||||
|
|
||||||
// if delay is larger, constant amplitude won't start yet
|
// if delay is larger, constant amplitude won't start yet
|
||||||
if ( frequency() <= 0x7FB || delay > 15 * clk_mul )
|
if ( frequency() <= 0x7FB || delay > 15 * clk_mul )
|
||||||
{
|
{
|
||||||
if ( volume_mul )
|
if ( volume_mul )
|
||||||
playing = (int) enabled;
|
playing = (int) enabled;
|
||||||
|
|
||||||
amp = (sample_buf << (phase << 2 & 4) & 0xF0) * playing;
|
amp = (sample_buf << (phase << 2 & 4) & 0xF0) * playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
amp = ((amp * volume_mul) >> (volume_shift + 4)) - dac_bias;
|
amp = ((amp * volume_mul) >> (volume_shift + 4)) - dac_bias;
|
||||||
}
|
}
|
||||||
update_amp( time, amp );
|
update_amp( time, amp );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate wave
|
// Generate wave
|
||||||
time += delay;
|
time += delay;
|
||||||
if ( time < end_time )
|
if ( time < end_time )
|
||||||
{
|
{
|
||||||
byte const* wave = this->wave_ram;
|
byte const* wave = this->wave_ram;
|
||||||
|
|
||||||
// wave size and bank
|
// wave size and bank
|
||||||
int const size20_mask = 0x20;
|
int const size20_mask = 0x20;
|
||||||
int const flags = regs [0] & agb_mask;
|
int const flags = regs [0] & agb_mask;
|
||||||
|
@ -617,10 +617,10 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
|
||||||
swap_banks = flags & size20_mask;
|
swap_banks = flags & size20_mask;
|
||||||
wave += bank_size/2 - (swap_banks >> 1);
|
wave += bank_size/2 - (swap_banks >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ph = this->phase ^ swap_banks;
|
int ph = this->phase ^ swap_banks;
|
||||||
ph = (ph + 1) & wave_mask; // pre-advance
|
ph = (ph + 1) & wave_mask; // pre-advance
|
||||||
|
|
||||||
int const per = this->period();
|
int const per = this->period();
|
||||||
if ( !playing )
|
if ( !playing )
|
||||||
{
|
{
|
||||||
|
@ -638,10 +638,10 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
|
||||||
// Extract nybble
|
// Extract nybble
|
||||||
int nybble = wave [ph >> 1] << (ph << 2 & 4) & 0xF0;
|
int nybble = wave [ph >> 1] << (ph << 2 & 4) & 0xF0;
|
||||||
ph = (ph + 1) & wave_mask;
|
ph = (ph + 1) & wave_mask;
|
||||||
|
|
||||||
// Scale by volume
|
// Scale by volume
|
||||||
int amp = (nybble * volume_mul) >> (volume_shift + 4);
|
int amp = (nybble * volume_mul) >> (volume_shift + 4);
|
||||||
|
|
||||||
int delta = amp - lamp;
|
int delta = amp - lamp;
|
||||||
if ( delta )
|
if ( delta )
|
||||||
{
|
{
|
||||||
|
@ -654,11 +654,11 @@ void Gb_Wave::run( blip_time_t time, blip_time_t end_time )
|
||||||
this->last_amp = lamp - dac_bias;
|
this->last_amp = lamp - dac_bias;
|
||||||
}
|
}
|
||||||
ph = (ph - 1) & wave_mask; // undo pre-advance and mask position
|
ph = (ph - 1) & wave_mask; // undo pre-advance and mask position
|
||||||
|
|
||||||
// Keep track of last byte read
|
// Keep track of last byte read
|
||||||
if ( enabled )
|
if ( enabled )
|
||||||
sample_buf = wave [ph >> 1];
|
sample_buf = wave [ph >> 1];
|
||||||
|
|
||||||
this->phase = ph ^ swap_banks; // undo swapped banks
|
this->phase = ph ^ swap_banks; // undo swapped banks
|
||||||
}
|
}
|
||||||
delay = time - end_time;
|
delay = time - end_time;
|
||||||
|
|
|
@ -17,17 +17,17 @@
|
||||||
|
|
||||||
class Gb_Osc {
|
class Gb_Osc {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// 11-bit frequency in NRx3 and NRx4
|
// 11-bit frequency in NRx3 and NRx4
|
||||||
int frequency() const { return (regs [4] & 7) * 0x100 + regs [3]; }
|
int frequency() const { return (regs [4] & 7) * 0x100 + regs [3]; }
|
||||||
|
|
||||||
void update_amp( blip_time_t, int new_amp );
|
void update_amp( blip_time_t, int new_amp );
|
||||||
int write_trig( int frame_phase, int max_len, int old_data );
|
int write_trig( int frame_phase, int max_len, int old_data );
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum { clk_mul = GB_APU_OVERCLOCK };
|
enum { clk_mul = GB_APU_OVERCLOCK };
|
||||||
enum { dac_bias = 7 };
|
enum { dac_bias = 7 };
|
||||||
|
|
||||||
Blip_Buffer* outputs [4];// NULL, right, left, center
|
Blip_Buffer* outputs [4];// NULL, right, left, center
|
||||||
Blip_Buffer* output; // where to output sound
|
Blip_Buffer* output; // where to output sound
|
||||||
BOOST::uint8_t* regs; // osc's 5 registers
|
BOOST::uint8_t* regs; // osc's 5 registers
|
||||||
|
@ -38,12 +38,12 @@ public:
|
||||||
typedef Blip_Synth<blip_med_quality ,1> Med_Synth;
|
typedef Blip_Synth<blip_med_quality ,1> Med_Synth;
|
||||||
Good_Synth const* good_synth;
|
Good_Synth const* good_synth;
|
||||||
Med_Synth const* med_synth;
|
Med_Synth const* med_synth;
|
||||||
|
|
||||||
int delay; // clocks until frequency timer expires
|
int delay; // clocks until frequency timer expires
|
||||||
int length_ctr; // length counter
|
int length_ctr; // length counter
|
||||||
unsigned phase; // waveform phase (or equivalent)
|
unsigned phase; // waveform phase (or equivalent)
|
||||||
bool enabled; // internal enabled flag
|
bool enabled; // internal enabled flag
|
||||||
|
|
||||||
void clock_length();
|
void clock_length();
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
@ -53,10 +53,10 @@ public:
|
||||||
int env_delay;
|
int env_delay;
|
||||||
int volume;
|
int volume;
|
||||||
bool env_enabled;
|
bool env_enabled;
|
||||||
|
|
||||||
void clock_envelope();
|
void clock_envelope();
|
||||||
bool write_register( int frame_phase, int reg, int old_data, int data );
|
bool write_register( int frame_phase, int reg, int old_data, int data );
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
env_delay = 0;
|
env_delay = 0;
|
||||||
|
@ -75,7 +75,7 @@ class Gb_Square : public Gb_Env {
|
||||||
public:
|
public:
|
||||||
bool write_register( int frame_phase, int reg, int old_data, int data );
|
bool 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 );
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
Gb_Env::reset();
|
Gb_Env::reset();
|
||||||
|
@ -95,7 +95,7 @@ public:
|
||||||
|
|
||||||
void clock_sweep();
|
void clock_sweep();
|
||||||
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 reset()
|
void reset()
|
||||||
{
|
{
|
||||||
sweep_freq = 0;
|
sweep_freq = 0;
|
||||||
|
@ -107,19 +107,19 @@ public:
|
||||||
private:
|
private:
|
||||||
enum { period_mask = 0x70 };
|
enum { period_mask = 0x70 };
|
||||||
enum { shift_mask = 0x07 };
|
enum { shift_mask = 0x07 };
|
||||||
|
|
||||||
void calc_sweep( bool update );
|
void calc_sweep( bool update );
|
||||||
void reload_sweep_timer();
|
void reload_sweep_timer();
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
divider = 0;
|
divider = 0;
|
||||||
|
@ -128,7 +128,7 @@ public:
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
enum { period2_mask = 0x1FFFF };
|
enum { period2_mask = 0x1FFFF };
|
||||||
|
|
||||||
int period2_index() const { return regs [3] >> 4; }
|
int period2_index() const { return regs [3] >> 4; }
|
||||||
int period2( int base = 8 ) const { return base << period2_index(); }
|
int period2( int base = 8 ) const { return base << period2_index(); }
|
||||||
unsigned lfsr_mask() const { return (regs [3] & 0x08) ? ~0x4040 : ~0x4000; }
|
unsigned lfsr_mask() const { return (regs [3] & 0x08) ? ~0x4040 : ~0x4000; }
|
||||||
|
@ -137,39 +137,39 @@ private:
|
||||||
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)
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
// Reads/writes wave RAM
|
// Reads/writes wave RAM
|
||||||
int read( unsigned addr ) const;
|
int read( unsigned addr ) const;
|
||||||
void write( unsigned addr, int data );
|
void write( unsigned addr, int data );
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
sample_buf = 0;
|
sample_buf = 0;
|
||||||
Gb_Osc::reset();
|
Gb_Osc::reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { bank40_mask = 0x40 };
|
enum { bank40_mask = 0x40 };
|
||||||
enum { bank_size = 32 };
|
enum { bank_size = 32 };
|
||||||
|
|
||||||
int agb_mask; // 0xFF if AGB features enabled, 0 otherwise
|
int agb_mask; // 0xFF if AGB features enabled, 0 otherwise
|
||||||
BOOST::uint8_t* wave_ram; // 32 bytes (64 nybbles), stored in APU
|
BOOST::uint8_t* wave_ram; // 32 bytes (64 nybbles), stored in APU
|
||||||
|
|
||||||
friend class Gb_Apu;
|
friend class Gb_Apu;
|
||||||
|
|
||||||
// Frequency timer period
|
// Frequency timer period
|
||||||
int period() const { return (2048 - frequency()) * (2 * clk_mul); }
|
int period() const { return (2048 - frequency()) * (2 * clk_mul); }
|
||||||
|
|
||||||
// Non-zero if DAC is enabled
|
// Non-zero if DAC is enabled
|
||||||
int dac_enabled() const { return regs [0] & 0x80; }
|
int dac_enabled() const { return regs [0] & 0x80; }
|
||||||
|
|
||||||
void corrupt_wave();
|
void corrupt_wave();
|
||||||
|
|
||||||
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( unsigned addr ) const;
|
int access( unsigned addr ) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -178,7 +178,7 @@ long Stereo_Buffer::read_samples( blip_sample_t* out, long out_size )
|
||||||
if ( pair_count )
|
if ( pair_count )
|
||||||
{
|
{
|
||||||
mixer.read_pairs( out, pair_count );
|
mixer.read_pairs( out, pair_count );
|
||||||
|
|
||||||
if ( samples_avail() <= 0 || immediate_removal() )
|
if ( samples_avail() <= 0 || immediate_removal() )
|
||||||
{
|
{
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( int i = bufs_size; --i >= 0; )
|
||||||
|
@ -219,7 +219,7 @@ void Stereo_Mixer::mix_mono( blip_sample_t* out_, int count )
|
||||||
int const bass = BLIP_READER_BASS( *bufs [2] );
|
int const bass = BLIP_READER_BASS( *bufs [2] );
|
||||||
BLIP_READER_BEGIN( center, *bufs [2] );
|
BLIP_READER_BEGIN( center, *bufs [2] );
|
||||||
BLIP_READER_ADJ_( center, samples_read );
|
BLIP_READER_ADJ_( center, samples_read );
|
||||||
|
|
||||||
typedef blip_sample_t stereo_blip_sample_t [stereo];
|
typedef blip_sample_t stereo_blip_sample_t [stereo];
|
||||||
stereo_blip_sample_t* BLIP_RESTRICT out = (stereo_blip_sample_t*) out_ + count;
|
stereo_blip_sample_t* BLIP_RESTRICT out = (stereo_blip_sample_t*) out_ + count;
|
||||||
int offset = -count;
|
int offset = -count;
|
||||||
|
@ -228,33 +228,33 @@ void Stereo_Mixer::mix_mono( blip_sample_t* out_, int count )
|
||||||
blargg_long s = BLIP_READER_READ( center );
|
blargg_long s = BLIP_READER_READ( center );
|
||||||
BLIP_READER_NEXT_IDX_( center, bass, offset );
|
BLIP_READER_NEXT_IDX_( center, bass, offset );
|
||||||
BLIP_CLAMP( s, s );
|
BLIP_CLAMP( s, s );
|
||||||
|
|
||||||
out [offset] [0] = (blip_sample_t) s;
|
out [offset] [0] = (blip_sample_t) s;
|
||||||
out [offset] [1] = (blip_sample_t) s;
|
out [offset] [1] = (blip_sample_t) s;
|
||||||
}
|
}
|
||||||
while ( ++offset );
|
while ( ++offset );
|
||||||
|
|
||||||
BLIP_READER_END( center, *bufs [2] );
|
BLIP_READER_END( center, *bufs [2] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stereo_Mixer::mix_stereo( blip_sample_t* out_, int count )
|
void Stereo_Mixer::mix_stereo( blip_sample_t* out_, int count )
|
||||||
{
|
{
|
||||||
blip_sample_t* BLIP_RESTRICT out = out_ + count * stereo;
|
blip_sample_t* BLIP_RESTRICT out = out_ + count * stereo;
|
||||||
|
|
||||||
// do left + center and right + center separately to reduce register load
|
// do left + center and right + center separately to reduce register load
|
||||||
Tracked_Blip_Buffer* const* buf = &bufs [2];
|
Tracked_Blip_Buffer* const* buf = &bufs [2];
|
||||||
while ( true ) // loop runs twice
|
while ( true ) // loop runs twice
|
||||||
{
|
{
|
||||||
--buf;
|
--buf;
|
||||||
--out;
|
--out;
|
||||||
|
|
||||||
int const bass = BLIP_READER_BASS( *bufs [2] );
|
int const bass = BLIP_READER_BASS( *bufs [2] );
|
||||||
BLIP_READER_BEGIN( side, **buf );
|
BLIP_READER_BEGIN( side, **buf );
|
||||||
BLIP_READER_BEGIN( center, *bufs [2] );
|
BLIP_READER_BEGIN( center, *bufs [2] );
|
||||||
|
|
||||||
BLIP_READER_ADJ_( side, samples_read );
|
BLIP_READER_ADJ_( side, samples_read );
|
||||||
BLIP_READER_ADJ_( center, samples_read );
|
BLIP_READER_ADJ_( center, samples_read );
|
||||||
|
|
||||||
int offset = -count;
|
int offset = -count;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -263,17 +263,17 @@ void Stereo_Mixer::mix_stereo( blip_sample_t* out_, int count )
|
||||||
BLIP_READER_NEXT_IDX_( side, bass, offset );
|
BLIP_READER_NEXT_IDX_( side, bass, offset );
|
||||||
BLIP_READER_NEXT_IDX_( center, bass, offset );
|
BLIP_READER_NEXT_IDX_( center, bass, offset );
|
||||||
BLIP_CLAMP( s, s );
|
BLIP_CLAMP( s, s );
|
||||||
|
|
||||||
++offset; // before write since out is decremented to slightly before end
|
++offset; // before write since out is decremented to slightly before end
|
||||||
out [offset * stereo] = (blip_sample_t) s;
|
out [offset * stereo] = (blip_sample_t) s;
|
||||||
}
|
}
|
||||||
while ( offset );
|
while ( offset );
|
||||||
|
|
||||||
BLIP_READER_END( side, **buf );
|
BLIP_READER_END( side, **buf );
|
||||||
|
|
||||||
if ( buf != bufs )
|
if ( buf != bufs )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// only end center once
|
// only end center once
|
||||||
BLIP_READER_END( center, *bufs [2] );
|
BLIP_READER_END( center, *bufs [2] );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -13,14 +13,14 @@ class Multi_Buffer {
|
||||||
public:
|
public:
|
||||||
Multi_Buffer( int samples_per_frame );
|
Multi_Buffer( int samples_per_frame );
|
||||||
virtual ~Multi_Buffer() { }
|
virtual ~Multi_Buffer() { }
|
||||||
|
|
||||||
// Sets the number of channels available and optionally their types
|
// Sets the number of channels available and optionally their types
|
||||||
// (type information used by Effects_Buffer)
|
// (type information used by Effects_Buffer)
|
||||||
enum { type_index_mask = 0xFF };
|
enum { type_index_mask = 0xFF };
|
||||||
enum { wave_type = 0x100, noise_type = 0x200, mixed_type = wave_type | noise_type };
|
enum { wave_type = 0x100, noise_type = 0x200, mixed_type = wave_type | noise_type };
|
||||||
virtual blargg_err_t set_channel_count( int, int const* types = 0 );
|
virtual blargg_err_t set_channel_count( int, int const* types = 0 );
|
||||||
int channel_count() const { return channel_count_; }
|
int channel_count() const { return channel_count_; }
|
||||||
|
|
||||||
// Gets indexed channel, from 0 to channel count - 1
|
// Gets indexed channel, from 0 to channel count - 1
|
||||||
struct channel_t {
|
struct channel_t {
|
||||||
Blip_Buffer* center;
|
Blip_Buffer* center;
|
||||||
|
@ -28,31 +28,31 @@ public:
|
||||||
Blip_Buffer* right;
|
Blip_Buffer* right;
|
||||||
};
|
};
|
||||||
virtual channel_t channel( int index ) BLARGG_PURE( ; )
|
virtual channel_t channel( int index ) BLARGG_PURE( ; )
|
||||||
|
|
||||||
// See Blip_Buffer.h
|
// See Blip_Buffer.h
|
||||||
virtual blargg_err_t set_sample_rate( long rate, int msec = blip_default_length ) BLARGG_PURE( ; )
|
virtual blargg_err_t set_sample_rate( long rate, int msec = blip_default_length ) BLARGG_PURE( ; )
|
||||||
virtual void clock_rate( long ) BLARGG_PURE( { } )
|
virtual void clock_rate( long ) BLARGG_PURE( { } )
|
||||||
virtual void bass_freq( int ) BLARGG_PURE( { } )
|
virtual void bass_freq( int ) BLARGG_PURE( { } )
|
||||||
virtual void clear() BLARGG_PURE( { } )
|
virtual void clear() BLARGG_PURE( { } )
|
||||||
long sample_rate() const;
|
long sample_rate() const;
|
||||||
|
|
||||||
// Length of buffer, in milliseconds
|
// Length of buffer, in milliseconds
|
||||||
int length() const;
|
int length() const;
|
||||||
|
|
||||||
// See Blip_Buffer.h
|
// See Blip_Buffer.h
|
||||||
virtual void end_frame( blip_time_t ) BLARGG_PURE( { } )
|
virtual void end_frame( blip_time_t ) BLARGG_PURE( { } )
|
||||||
|
|
||||||
// Number of samples per output frame (1 = mono, 2 = stereo)
|
// Number of samples per output frame (1 = mono, 2 = stereo)
|
||||||
int samples_per_frame() const;
|
int samples_per_frame() const;
|
||||||
|
|
||||||
// Count of changes to channel configuration. Incremented whenever
|
// Count of changes to channel configuration. Incremented whenever
|
||||||
// a change is made to any of the Blip_Buffers for any channel.
|
// a change is made to any of the Blip_Buffers for any channel.
|
||||||
unsigned channels_changed_count() { return channels_changed_count_; }
|
unsigned channels_changed_count() { return channels_changed_count_; }
|
||||||
|
|
||||||
// See Blip_Buffer.h
|
// See Blip_Buffer.h
|
||||||
virtual long read_samples( blip_sample_t*, long ) BLARGG_PURE( { return 0; } )
|
virtual long read_samples( blip_sample_t*, long ) BLARGG_PURE( { return 0; } )
|
||||||
virtual long samples_avail() const BLARGG_PURE( { return 0; } )
|
virtual long samples_avail() const BLARGG_PURE( { return 0; } )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BLARGG_DISABLE_NOTHROW
|
BLARGG_DISABLE_NOTHROW
|
||||||
void disable_immediate_removal() { immediate_removal_ = false; }
|
void disable_immediate_removal() { immediate_removal_ = false; }
|
||||||
|
@ -64,7 +64,7 @@ private:
|
||||||
// noncopyable
|
// noncopyable
|
||||||
Multi_Buffer( const Multi_Buffer& );
|
Multi_Buffer( const Multi_Buffer& );
|
||||||
Multi_Buffer& operator = ( const Multi_Buffer& );
|
Multi_Buffer& operator = ( const Multi_Buffer& );
|
||||||
|
|
||||||
unsigned channels_changed_count_;
|
unsigned channels_changed_count_;
|
||||||
long sample_rate_;
|
long sample_rate_;
|
||||||
int length_;
|
int length_;
|
||||||
|
@ -81,7 +81,7 @@ class Mono_Buffer : public Multi_Buffer {
|
||||||
public:
|
public:
|
||||||
// Buffer used for all channels
|
// Buffer used for all channels
|
||||||
Blip_Buffer* center() { return &buf; }
|
Blip_Buffer* center() { return &buf; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mono_Buffer();
|
Mono_Buffer();
|
||||||
~Mono_Buffer();
|
~Mono_Buffer();
|
||||||
|
@ -100,13 +100,13 @@ public:
|
||||||
// Non-zero if buffer still has non-silent samples in it. Requires that you call
|
// Non-zero if buffer still has non-silent samples in it. Requires that you call
|
||||||
// set_modified() appropriately.
|
// set_modified() appropriately.
|
||||||
blip_ulong non_silent() const;
|
blip_ulong non_silent() const;
|
||||||
|
|
||||||
// remove_samples( samples_avail() )
|
// remove_samples( samples_avail() )
|
||||||
void remove_all_samples();
|
void remove_all_samples();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BLARGG_DISABLE_NOTHROW
|
BLARGG_DISABLE_NOTHROW
|
||||||
|
|
||||||
long read_samples( blip_sample_t*, long );
|
long read_samples( blip_sample_t*, long );
|
||||||
void remove_silence( long );
|
void remove_silence( long );
|
||||||
void remove_samples( long );
|
void remove_samples( long );
|
||||||
|
@ -117,12 +117,12 @@ public:
|
||||||
blip_long last_non_silence;
|
blip_long last_non_silence;
|
||||||
void remove_( long );
|
void remove_( long );
|
||||||
};
|
};
|
||||||
|
|
||||||
class Stereo_Mixer {
|
class Stereo_Mixer {
|
||||||
public:
|
public:
|
||||||
Tracked_Blip_Buffer* bufs [3];
|
Tracked_Blip_Buffer* bufs [3];
|
||||||
blargg_long samples_read;
|
blargg_long samples_read;
|
||||||
|
|
||||||
Stereo_Mixer() : samples_read( 0 ) { }
|
Stereo_Mixer() : samples_read( 0 ) { }
|
||||||
void read_pairs( blip_sample_t* out, int count );
|
void read_pairs( blip_sample_t* out, int count );
|
||||||
private:
|
private:
|
||||||
|
@ -133,12 +133,12 @@ public:
|
||||||
// Uses three buffers (one for center) and outputs stereo sample pairs.
|
// Uses three buffers (one for center) and outputs stereo sample pairs.
|
||||||
class Stereo_Buffer : public Multi_Buffer {
|
class Stereo_Buffer : public Multi_Buffer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Buffers used for all channels
|
// Buffers used for all channels
|
||||||
Blip_Buffer* center() { return &bufs [2]; }
|
Blip_Buffer* center() { return &bufs [2]; }
|
||||||
Blip_Buffer* left() { return &bufs [0]; }
|
Blip_Buffer* left() { return &bufs [0]; }
|
||||||
Blip_Buffer* right() { return &bufs [1]; }
|
Blip_Buffer* right() { return &bufs [1]; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Stereo_Buffer();
|
Stereo_Buffer();
|
||||||
~Stereo_Buffer();
|
~Stereo_Buffer();
|
||||||
|
@ -148,10 +148,10 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
channel_t channel( int ) { return chan; }
|
channel_t channel( int ) { return chan; }
|
||||||
void end_frame( blip_time_t );
|
void end_frame( blip_time_t );
|
||||||
|
|
||||||
long samples_avail() const { return (bufs [0].samples_avail() - mixer.samples_read) * 2; }
|
long samples_avail() const { return (bufs [0].samples_avail() - mixer.samples_read) * 2; }
|
||||||
long read_samples( blip_sample_t*, long );
|
long read_samples( blip_sample_t*, long );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { bufs_size = 3 };
|
enum { bufs_size = 3 };
|
||||||
typedef Tracked_Blip_Buffer buf_t;
|
typedef Tracked_Blip_Buffer buf_t;
|
||||||
|
|
|
@ -165,7 +165,7 @@ public:
|
||||||
typedef struct see_blargg_common_h int8_t;
|
typedef struct see_blargg_common_h int8_t;
|
||||||
typedef struct see_blargg_common_h uint8_t;
|
typedef struct see_blargg_common_h uint8_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USHRT_MAX == 0xFFFF
|
#if USHRT_MAX == 0xFFFF
|
||||||
typedef short int16_t;
|
typedef short int16_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
|
@ -174,7 +174,7 @@ public:
|
||||||
typedef struct see_blargg_common_h int16_t;
|
typedef struct see_blargg_common_h int16_t;
|
||||||
typedef struct see_blargg_common_h uint16_t;
|
typedef struct see_blargg_common_h uint16_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ULONG_MAX == 0xFFFFFFFF
|
#if ULONG_MAX == 0xFFFFFFFF
|
||||||
typedef long int32_t;
|
typedef long int32_t;
|
||||||
typedef unsigned long uint32_t;
|
typedef unsigned long uint32_t;
|
||||||
|
|
280
src/fex.h
280
src/fex.h
|
@ -1,140 +1,140 @@
|
||||||
/* Compressed file archive C interface (also usable from C++) */
|
/* Compressed file archive C interface (also usable from C++) */
|
||||||
|
|
||||||
/* File_Extractor 0.4.3 */
|
/* File_Extractor 0.4.3 */
|
||||||
#ifndef FEX_H
|
#ifndef FEX_H
|
||||||
#define FEX_H
|
#define FEX_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Error string returned by library functions, or NULL if no error (success).
|
/* Error string returned by library functions, or NULL if no error (success).
|
||||||
If function takes fex_err_t* err_out, it sets *err_out to NULL on success,
|
If function takes fex_err_t* err_out, it sets *err_out to NULL on success,
|
||||||
otherwise error string, or you can pass NULL if you don't care about exact
|
otherwise error string, or you can pass NULL if you don't care about exact
|
||||||
cause of error (these functions still report error by returning NULL). */
|
cause of error (these functions still report error by returning NULL). */
|
||||||
typedef const char* fex_err_t;
|
typedef const char* fex_err_t;
|
||||||
|
|
||||||
/* First parameter of most extractor_ functions is a pointer to the
|
/* First parameter of most extractor_ functions is a pointer to the
|
||||||
File_Extractor being acted on. */
|
File_Extractor being acted on. */
|
||||||
typedef struct File_Extractor File_Extractor;
|
typedef struct File_Extractor File_Extractor;
|
||||||
|
|
||||||
|
|
||||||
/**** Basics ****/
|
/**** Basics ****/
|
||||||
|
|
||||||
/* Opens archive and returns pointer to it, or NULL if error. */
|
/* Opens archive and returns pointer to it, or NULL if error. */
|
||||||
File_Extractor* fex_open( const char* path, fex_err_t* err_out );
|
File_Extractor* fex_open( const char* path, fex_err_t* err_out );
|
||||||
|
|
||||||
/* True if at end of archive. */
|
/* True if at end of archive. */
|
||||||
int fex_done( File_Extractor const* );
|
int fex_done( File_Extractor const* );
|
||||||
|
|
||||||
/* Name of current file. */
|
/* Name of current file. */
|
||||||
const char* fex_name( File_Extractor* );
|
const char* fex_name( File_Extractor* );
|
||||||
|
|
||||||
/* Size of current file. */
|
/* Size of current file. */
|
||||||
long fex_size( File_Extractor const* );
|
long fex_size( File_Extractor const* );
|
||||||
|
|
||||||
/* Extracts n bytes and writes them to *out. Returns error if all n
|
/* Extracts n bytes and writes them to *out. Returns error if all n
|
||||||
bytes couldn't be extracted (due to end of file or read error). */
|
bytes couldn't be extracted (due to end of file or read error). */
|
||||||
fex_err_t fex_read( File_Extractor*, void* out, long n );
|
fex_err_t fex_read( File_Extractor*, void* out, long n );
|
||||||
|
|
||||||
/* Goes to next file in archive (skips directories). */
|
/* Goes to next file in archive (skips directories). */
|
||||||
fex_err_t fex_next( File_Extractor* );
|
fex_err_t fex_next( File_Extractor* );
|
||||||
|
|
||||||
/* Closes archive and frees memory. */
|
/* Closes archive and frees memory. */
|
||||||
void fex_close( File_Extractor* );
|
void fex_close( File_Extractor* );
|
||||||
|
|
||||||
|
|
||||||
/**** Advanced ****/
|
/**** Advanced ****/
|
||||||
|
|
||||||
/* Goes back to first file in archive. */
|
/* Goes back to first file in archive. */
|
||||||
fex_err_t fex_rewind( File_Extractor* );
|
fex_err_t fex_rewind( File_Extractor* );
|
||||||
|
|
||||||
/* Hints to fex_next() that no file extraction will occur, speeding scanning
|
/* Hints to fex_next() that no file extraction will occur, speeding scanning
|
||||||
of some archive types. */
|
of some archive types. */
|
||||||
void fex_scan_only( File_Extractor* );
|
void fex_scan_only( File_Extractor* );
|
||||||
|
|
||||||
/* Modification date of current file (MS-DOS format). */
|
/* Modification date of current file (MS-DOS format). */
|
||||||
unsigned long fex_dos_date( File_Extractor const* );
|
unsigned long fex_dos_date( File_Extractor const* );
|
||||||
|
|
||||||
/* Number of bytes remaining to be read from current file. */
|
/* Number of bytes remaining to be read from current file. */
|
||||||
long fex_remain( File_Extractor const* );
|
long fex_remain( File_Extractor const* );
|
||||||
|
|
||||||
/* Reads at most n bytes and returns number actually read, or negative if error. */
|
/* Reads at most n bytes and returns number actually read, or negative if error. */
|
||||||
long fex_read_avail( File_Extractor*, void* out, long n );
|
long fex_read_avail( File_Extractor*, void* out, long n );
|
||||||
|
|
||||||
/* Extracts first n bytes and ignores rest. Faster than a normal read since it
|
/* Extracts first n bytes and ignores rest. Faster than a normal read since it
|
||||||
doesn't need to read any more data. Must not be called twice in a row. */
|
doesn't need to read any more data. Must not be called twice in a row. */
|
||||||
fex_err_t fex_read_once( File_Extractor*, void* out, long n );
|
fex_err_t fex_read_once( File_Extractor*, void* out, long n );
|
||||||
|
|
||||||
/* Loads file data into memory (if not already) and returns pointer to it, or
|
/* Loads file data into memory (if not already) and returns pointer to it, or
|
||||||
NULL if error. Pointer is valid until fex_next(), fex_rewind(), or fex_close() are
|
NULL if error. Pointer is valid until fex_next(), fex_rewind(), or fex_close() are
|
||||||
called. Will return same pointer if called more than once. */
|
called. Will return same pointer if called more than once. */
|
||||||
const unsigned char* fex_data( File_Extractor*, fex_err_t* err_out );
|
const unsigned char* fex_data( File_Extractor*, fex_err_t* err_out );
|
||||||
|
|
||||||
|
|
||||||
/**** Archive types ****/
|
/**** Archive types ****/
|
||||||
|
|
||||||
/* fex_type_t is a pointer to this structure. For example, fex_zip_type->extension is
|
/* fex_type_t is a pointer to this structure. For example, fex_zip_type->extension is
|
||||||
"ZIP" and ex_zip_type->new_fex() is equilvant to 'new Zip_Extractor' (in C++). */
|
"ZIP" and ex_zip_type->new_fex() is equilvant to 'new Zip_Extractor' (in C++). */
|
||||||
struct fex_type_t_
|
struct fex_type_t_
|
||||||
{
|
{
|
||||||
const char* extension; /* file extension/type */
|
const char* extension; /* file extension/type */
|
||||||
File_Extractor* (*new_fex)();
|
File_Extractor* (*new_fex)();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Archive type constants for each supported file type */
|
/* Archive type constants for each supported file type */
|
||||||
extern struct fex_type_t_ const
|
extern struct fex_type_t_ const
|
||||||
fex_7z_type [1], /* .7z (7-zip) */
|
fex_7z_type [1], /* .7z (7-zip) */
|
||||||
fex_gz_type [1], /* .gz (gzip) */
|
fex_gz_type [1], /* .gz (gzip) */
|
||||||
/*fex_rar_type [1],*/ /* .rar */
|
/*fex_rar_type [1],*/ /* .rar */
|
||||||
fex_zip_type [1], /* .zip */
|
fex_zip_type [1], /* .zip */
|
||||||
fex_bin_type [1]; /* binary file, possibly gzipped */
|
fex_bin_type [1]; /* binary file, possibly gzipped */
|
||||||
typedef struct fex_type_t_ const* fex_type_t;
|
typedef struct fex_type_t_ const* fex_type_t;
|
||||||
|
|
||||||
/* Array of supported archive types, with NULL entry at end. */
|
/* Array of supported archive types, with NULL entry at end. */
|
||||||
fex_type_t const* fex_type_list();
|
fex_type_t const* fex_type_list();
|
||||||
|
|
||||||
/* Type of archive this extractor handles. */
|
/* Type of archive this extractor handles. */
|
||||||
fex_type_t fex_type( File_Extractor const* );
|
fex_type_t fex_type( File_Extractor const* );
|
||||||
|
|
||||||
|
|
||||||
/******** Advanced opening ********/
|
/******** Advanced opening ********/
|
||||||
|
|
||||||
/* Error returned if file is wrong type */
|
/* Error returned if file is wrong type */
|
||||||
extern const char fex_wrong_file_type [29];
|
extern const char fex_wrong_file_type [29];
|
||||||
|
|
||||||
/* Determines likely archive type based on first four bytes of file. Returns string
|
/* Determines likely archive type based on first four bytes of file. Returns string
|
||||||
containing proper file suffix (i.e. "ZIP", "GZ", etc.) or "" (empty string) if file
|
containing proper file suffix (i.e. "ZIP", "GZ", etc.) or "" (empty string) if file
|
||||||
header is not recognized. */
|
header is not recognized. */
|
||||||
const char* fex_identify_header( void const* header );
|
const char* fex_identify_header( void const* header );
|
||||||
|
|
||||||
/* Gets corresponding archive type for file path or extension passed in. Returns NULL
|
/* Gets corresponding archive type for file path or extension passed in. Returns NULL
|
||||||
if type isn't recognized. */
|
if type isn't recognized. */
|
||||||
fex_type_t fex_identify_extension( const char* path_or_extension );
|
fex_type_t fex_identify_extension( const char* path_or_extension );
|
||||||
|
|
||||||
/* Determines file type based on filename extension, or file header (if extension
|
/* Determines file type based on filename extension, or file header (if extension
|
||||||
isn't recognized). Returns NULL if unrecognized or error. */
|
isn't recognized). Returns NULL if unrecognized or error. */
|
||||||
fex_type_t fex_identify_file( const char* path, fex_err_t* err_out );
|
fex_type_t fex_identify_file( const char* path, fex_err_t* err_out );
|
||||||
|
|
||||||
/* Opens archive of specific type and returns pointer to it, or NULL if error. */
|
/* Opens archive of specific type and returns pointer to it, or NULL if error. */
|
||||||
File_Extractor* fex_open_type( fex_type_t, const char* path, fex_err_t* err_out );
|
File_Extractor* fex_open_type( fex_type_t, const char* path, fex_err_t* err_out );
|
||||||
|
|
||||||
|
|
||||||
/******** User data ********/
|
/******** User data ********/
|
||||||
|
|
||||||
/* Sets/gets pointer to data you want to associate with this extractor.
|
/* Sets/gets pointer to data you want to associate with this extractor.
|
||||||
You can use this for whatever you want. */
|
You can use this for whatever you want. */
|
||||||
void fex_set_user_data( File_Extractor*, void* new_user_data );
|
void fex_set_user_data( File_Extractor*, void* new_user_data );
|
||||||
void* fex_user_data( File_Extractor const* );
|
void* fex_user_data( File_Extractor const* );
|
||||||
|
|
||||||
/* Registers cleanup function to be called when closing extractor, or NULL to
|
/* Registers cleanup function to be called when closing extractor, or NULL to
|
||||||
clear it. Passes user_data (see above) to cleanup function. */
|
clear it. Passes user_data (see above) to cleanup function. */
|
||||||
typedef void (*fex_user_cleanup_t)( void* user_data );
|
typedef void (*fex_user_cleanup_t)( void* user_data );
|
||||||
void fex_set_user_cleanup( File_Extractor*, fex_user_cleanup_t func );
|
void fex_set_user_cleanup( File_Extractor*, fex_user_cleanup_t func );
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
444
src/fex_mini.cpp
444
src/fex_mini.cpp
|
@ -1,222 +1,222 @@
|
||||||
// Minimal implementation of fex.h. Supports gzipped files if you have zlib
|
// Minimal implementation of fex.h. Supports gzipped files if you have zlib
|
||||||
// available and HAVE_ZLIB_H is defined.
|
// available and HAVE_ZLIB_H is defined.
|
||||||
|
|
||||||
// File_Extractor 0.4.3. http://www.slack.net/~ant/
|
// File_Extractor 0.4.3. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "fex.h"
|
#include "fex.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Copyright (C) 2007 Shay Green. This module is free software; you
|
/* Copyright (C) 2007 Shay Green. This module is free software; you
|
||||||
can redistribute it and/or modify it under the terms of the GNU Lesser
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
General Public License as published by the Free Software Foundation; either
|
General Public License as published by the Free Software Foundation; either
|
||||||
version 2.1 of the License, or (at your option) any later version. This
|
version 2.1 of the License, or (at your option) any later version. This
|
||||||
module is distributed in the hope that it will be useful, but WITHOUT ANY
|
module is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||||
details. You should have received a copy of the GNU Lesser General Public
|
details. You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this module; if not, write to the Free Software Foundation,
|
License along with this module; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||||
|
|
||||||
#ifndef HAVE_ZLIB_H
|
#ifndef HAVE_ZLIB_H
|
||||||
#define FILE_GZ( norm, gz ) norm
|
#define FILE_GZ( norm, gz ) norm
|
||||||
#define FILE_READ( ptr, size, file ) fread( ptr, 1, size, file )
|
#define FILE_READ( ptr, size, file ) fread( ptr, 1, size, file )
|
||||||
#else
|
#else
|
||||||
#define FILE_GZ( norm, gz ) gz
|
#define FILE_GZ( norm, gz ) gz
|
||||||
#define FILE_READ( ptr, size, file ) gzread( file, ptr, size )
|
#define FILE_READ( ptr, size, file ) gzread( file, ptr, size )
|
||||||
|
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
static const char* get_gzip_size( const char* path, long* eof )
|
static const char* get_gzip_size( const char* path, long* eof )
|
||||||
{
|
{
|
||||||
FILE* file = fopen( path, "rb" );
|
FILE* file = fopen( path, "rb" );
|
||||||
if ( !file )
|
if ( !file )
|
||||||
return "Couldn't open file";
|
return "Couldn't open file";
|
||||||
|
|
||||||
unsigned char buf [4];
|
unsigned char buf [4];
|
||||||
if ( fread( buf, 2, 1, file ) > 0 && buf [0] == 0x1F && buf [1] == 0x8B )
|
if ( fread( buf, 2, 1, file ) > 0 && buf [0] == 0x1F && buf [1] == 0x8B )
|
||||||
{
|
{
|
||||||
fseek( file, -4, SEEK_END );
|
fseek( file, -4, SEEK_END );
|
||||||
fread( buf, 4, 1, file );
|
fread( buf, 4, 1, file );
|
||||||
*eof = buf [3] * 0x1000000 + buf [2] * 0x10000 + buf [1] * 0x100 + buf [0];
|
*eof = buf [3] * 0x1000000 + buf [2] * 0x10000 + buf [1] * 0x100 + buf [0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fseek( file, 0, SEEK_END );
|
fseek( file, 0, SEEK_END );
|
||||||
*eof = ftell( file );
|
*eof = ftell( file );
|
||||||
}
|
}
|
||||||
const char* err = (ferror( file ) || feof( file )) ? "Couldn't get file size" : 0;
|
const char* err = (ferror( file ) || feof( file )) ? "Couldn't get file size" : 0;
|
||||||
fclose( file );
|
fclose( file );
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char fex_wrong_file_type [] = "Archive format not supported";
|
const char fex_wrong_file_type [] = "Archive format not supported";
|
||||||
|
|
||||||
struct File_Extractor
|
struct File_Extractor
|
||||||
{
|
{
|
||||||
FILE_GZ(FILE*,gzFile) file;
|
FILE_GZ(FILE*,gzFile) file;
|
||||||
int done;
|
int done;
|
||||||
long size;
|
long size;
|
||||||
void* data; // file data read into memory, ot 0 if not read
|
void* data; // file data read into memory, ot 0 if not read
|
||||||
void* user_data;
|
void* user_data;
|
||||||
fex_user_cleanup_t user_cleanup;
|
fex_user_cleanup_t user_cleanup;
|
||||||
|
|
||||||
char* name() const { return (char*) (this + 1); }
|
char* name() const { return (char*) (this + 1); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Always identify as single file extractor
|
// Always identify as single file extractor
|
||||||
fex_type_t_ const fex_bin_type [1] = {{ "" , 0 }};
|
fex_type_t_ const fex_bin_type [1] = {{ "" , 0 }};
|
||||||
const char* fex_identify_header ( void const* ) { return ""; }
|
const char* fex_identify_header ( void const* ) { return ""; }
|
||||||
fex_type_t fex_identify_extension( const char* ) { return fex_bin_type; }
|
fex_type_t fex_identify_extension( const char* ) { return fex_bin_type; }
|
||||||
fex_type_t fex_identify_file ( const char*, fex_err_t* e ) { if ( e ) *e = 0; return fex_bin_type; }
|
fex_type_t fex_identify_file ( const char*, fex_err_t* e ) { if ( e ) *e = 0; return fex_bin_type; }
|
||||||
|
|
||||||
static fex_err_t fex_open_( const char* path, File_Extractor** fe_out )
|
static fex_err_t fex_open_( const char* path, File_Extractor** fe_out )
|
||||||
{
|
{
|
||||||
*fe_out = 0;
|
*fe_out = 0;
|
||||||
|
|
||||||
// name
|
// name
|
||||||
const char* name = strrchr( path, '\\' ); // DOS
|
const char* name = strrchr( path, '\\' ); // DOS
|
||||||
if ( !name )
|
if ( !name )
|
||||||
name = strrchr( path, '/' ); // UNIX
|
name = strrchr( path, '/' ); // UNIX
|
||||||
if ( !name )
|
if ( !name )
|
||||||
name = strrchr( path, ':' ); // Mac
|
name = strrchr( path, ':' ); // Mac
|
||||||
if ( !name )
|
if ( !name )
|
||||||
name = path;
|
name = path;
|
||||||
|
|
||||||
// allocate space for struct and name
|
// allocate space for struct and name
|
||||||
long name_size = strlen( name ) + 1;
|
long name_size = strlen( name ) + 1;
|
||||||
File_Extractor* fe = (File_Extractor*) malloc( sizeof (File_Extractor) + name_size );
|
File_Extractor* fe = (File_Extractor*) malloc( sizeof (File_Extractor) + name_size );
|
||||||
if ( !fe ) return "Out of memory";
|
if ( !fe ) return "Out of memory";
|
||||||
|
|
||||||
fe->done = 0;
|
fe->done = 0;
|
||||||
fe->data = 0;
|
fe->data = 0;
|
||||||
fe->user_data = 0;
|
fe->user_data = 0;
|
||||||
fe->user_cleanup = 0;
|
fe->user_cleanup = 0;
|
||||||
memcpy( fe->name(), name, name_size );
|
memcpy( fe->name(), name, name_size );
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
// get gzip size BEFORE opening file
|
// get gzip size BEFORE opening file
|
||||||
const char* err = get_gzip_size( path, &fe->size );
|
const char* err = get_gzip_size( path, &fe->size );
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
free( fe );
|
free( fe );
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
fe->file = FILE_GZ(fopen,gzopen)( path, "rb" );
|
fe->file = FILE_GZ(fopen,gzopen)( path, "rb" );
|
||||||
if ( !fe->file )
|
if ( !fe->file )
|
||||||
{
|
{
|
||||||
free( fe );
|
free( fe );
|
||||||
return "Couldn't open file";
|
return "Couldn't open file";
|
||||||
}
|
}
|
||||||
|
|
||||||
// get normal size
|
// get normal size
|
||||||
#ifndef HAVE_ZLIB_H
|
#ifndef HAVE_ZLIB_H
|
||||||
fseek( fe->file, 0, SEEK_END );
|
fseek( fe->file, 0, SEEK_END );
|
||||||
fe->size = ftell( fe->file );
|
fe->size = ftell( fe->file );
|
||||||
rewind( fe->file );
|
rewind( fe->file );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*fe_out = fe;
|
*fe_out = fe;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
File_Extractor* fex_open( const char* path, fex_err_t* err_out )
|
File_Extractor* fex_open( const char* path, fex_err_t* err_out )
|
||||||
{
|
{
|
||||||
File_Extractor* fe;
|
File_Extractor* fe;
|
||||||
fex_err_t err = fex_open_( path, &fe );
|
fex_err_t err = fex_open_( path, &fe );
|
||||||
if ( err_out )
|
if ( err_out )
|
||||||
*err_out = err;
|
*err_out = err;
|
||||||
return fe;
|
return fe;
|
||||||
}
|
}
|
||||||
|
|
||||||
File_Extractor* fex_open_type( fex_type_t, const char* path, fex_err_t* err_out )
|
File_Extractor* fex_open_type( fex_type_t, const char* path, fex_err_t* err_out )
|
||||||
{
|
{
|
||||||
return fex_open( path, err_out );
|
return fex_open( path, err_out );
|
||||||
}
|
}
|
||||||
|
|
||||||
void* fex_user_data ( File_Extractor const* fe ) { return fe->user_data; }
|
void* fex_user_data ( File_Extractor const* fe ) { return fe->user_data; }
|
||||||
void fex_set_user_data ( File_Extractor* fe, void* new_user_data ) { fe->user_data = new_user_data; }
|
void fex_set_user_data ( File_Extractor* fe, void* new_user_data ) { fe->user_data = new_user_data; }
|
||||||
void fex_set_user_cleanup ( File_Extractor* fe, fex_user_cleanup_t func ) { fe->user_cleanup = func; }
|
void fex_set_user_cleanup ( File_Extractor* fe, fex_user_cleanup_t func ) { fe->user_cleanup = func; }
|
||||||
|
|
||||||
fex_type_t fex_type ( File_Extractor const* ) { return fex_bin_type; }
|
fex_type_t fex_type ( File_Extractor const* ) { return fex_bin_type; }
|
||||||
int fex_done ( File_Extractor const* fe ) { return fe->done; }
|
int fex_done ( File_Extractor const* fe ) { return fe->done; }
|
||||||
const char* fex_name ( File_Extractor* fe ) { return fe->name(); }
|
const char* fex_name ( File_Extractor* fe ) { return fe->name(); }
|
||||||
unsigned long fex_dos_date ( File_Extractor const* ) { return 0; }
|
unsigned long fex_dos_date ( File_Extractor const* ) { return 0; }
|
||||||
long fex_size ( File_Extractor const* fe ) { return fe->size; }
|
long fex_size ( File_Extractor const* fe ) { return fe->size; }
|
||||||
long fex_remain ( File_Extractor const* fe ) { return fe->size - FILE_GZ(ftell,gztell)( fe->file ); }
|
long fex_remain ( File_Extractor const* fe ) { return fe->size - FILE_GZ(ftell,gztell)( fe->file ); }
|
||||||
void fex_scan_only ( File_Extractor* ) { }
|
void fex_scan_only ( File_Extractor* ) { }
|
||||||
fex_err_t fex_read_once ( File_Extractor* fe, void* out, long count ) { return fex_read( fe, out, count ); }
|
fex_err_t fex_read_once ( File_Extractor* fe, void* out, long count ) { return fex_read( fe, out, count ); }
|
||||||
long fex_read_avail ( File_Extractor* fe, void* out, long count ) { return FILE_READ( out, count, fe->file ); }
|
long fex_read_avail ( File_Extractor* fe, void* out, long count ) { return FILE_READ( out, count, fe->file ); }
|
||||||
|
|
||||||
fex_err_t fex_read( File_Extractor* fe, void* out, long count )
|
fex_err_t fex_read( File_Extractor* fe, void* out, long count )
|
||||||
{
|
{
|
||||||
if ( count == (long) FILE_READ( out, count, fe->file ) )
|
if ( count == (long) FILE_READ( out, count, fe->file ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( FILE_GZ(feof,gzeof)( fe->file ) )
|
if ( FILE_GZ(feof,gzeof)( fe->file ) )
|
||||||
return "Unexpected end of file";
|
return "Unexpected end of file";
|
||||||
|
|
||||||
return "Couldn't read from file";
|
return "Couldn't read from file";
|
||||||
}
|
}
|
||||||
|
|
||||||
fex_err_t fex_next( File_Extractor* fe )
|
fex_err_t fex_next( File_Extractor* fe )
|
||||||
{
|
{
|
||||||
fe->done = 1;
|
fe->done = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fex_err_t fex_rewind( File_Extractor* fe )
|
fex_err_t fex_rewind( File_Extractor* fe )
|
||||||
{
|
{
|
||||||
fe->done = 0;
|
fe->done = 0;
|
||||||
FILE_GZ(rewind,gzrewind)( fe->file );
|
FILE_GZ(rewind,gzrewind)( fe->file );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fex_err_t fex_data_( File_Extractor* fe )
|
static fex_err_t fex_data_( File_Extractor* fe )
|
||||||
{
|
{
|
||||||
if ( !fe->data )
|
if ( !fe->data )
|
||||||
{
|
{
|
||||||
fe->data = malloc( fe->size );
|
fe->data = malloc( fe->size );
|
||||||
if ( !fe->data ) return "Out of memory";
|
if ( !fe->data ) return "Out of memory";
|
||||||
|
|
||||||
fex_err_t err = fex_read( fe, fe->data, fe->size );
|
fex_err_t err = fex_read( fe, fe->data, fe->size );
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
free( fe->data );
|
free( fe->data );
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char* fex_data( File_Extractor* fe, fex_err_t* err_out )
|
const unsigned char* fex_data( File_Extractor* fe, fex_err_t* err_out )
|
||||||
{
|
{
|
||||||
fex_err_t err = fex_data_( fe );
|
fex_err_t err = fex_data_( fe );
|
||||||
if ( err_out )
|
if ( err_out )
|
||||||
*err_out = err;
|
*err_out = err;
|
||||||
return (const unsigned char*) fe->data;
|
return (const unsigned char*) fe->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fex_close( File_Extractor* fe )
|
void fex_close( File_Extractor* fe )
|
||||||
{
|
{
|
||||||
if ( fe )
|
if ( fe )
|
||||||
{
|
{
|
||||||
free( fe->data );
|
free( fe->data );
|
||||||
FILE_GZ(fclose,gzclose)( fe->file );
|
FILE_GZ(fclose,gzclose)( fe->file );
|
||||||
|
|
||||||
if ( fe->user_cleanup )
|
if ( fe->user_cleanup )
|
||||||
fe->user_cleanup( fe->user_data );
|
fe->user_cleanup( fe->user_data );
|
||||||
|
|
||||||
free( fe );
|
free( fe );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,168 +1,168 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2005 Forgotten and the VBA development team
|
// Copyright (C) 2005 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "../../Util.h"
|
#include "../../Util.h"
|
||||||
#define __STDC_CONSTANT_MACROS
|
#define __STDC_CONSTANT_MACROS
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void hq3x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
void hq3x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||||
void hq3x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
void hq3x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||||
void hq4x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
void hq4x_16(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||||
void hq4x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
void hq4x_32(unsigned char*, unsigned char*, uint32_t, uint32_t, uint32_t, uint32_t);
|
||||||
|
|
||||||
unsigned int LUT16to32[65536];
|
unsigned int LUT16to32[65536];
|
||||||
unsigned int RGBtoYUV[65536];
|
unsigned int RGBtoYUV[65536];
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitLUTs(void)
|
void InitLUTs(void)
|
||||||
{
|
{
|
||||||
int i, j, k, r, g, b, Y, u, v;
|
int i, j, k, r, g, b, Y, u, v;
|
||||||
|
|
||||||
for (i=0; i<65536; i++)
|
for (i=0; i<65536; i++)
|
||||||
LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
|
LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
|
||||||
|
|
||||||
for (i=0; i<32; i++)
|
for (i=0; i<32; i++)
|
||||||
for (j=0; j<64; j++)
|
for (j=0; j<64; j++)
|
||||||
for (k=0; k<32; k++)
|
for (k=0; k<32; k++)
|
||||||
{
|
{
|
||||||
r = i << 3;
|
r = i << 3;
|
||||||
g = j << 2;
|
g = j << 2;
|
||||||
b = k << 3;
|
b = k << 3;
|
||||||
Y = (r + g + b) >> 2;
|
Y = (r + g + b) >> 2;
|
||||||
u = 128 + ((r - b) >> 2);
|
u = 128 + ((r - b) >> 2);
|
||||||
v = 128 + ((-r + 2*g -b)>>3);
|
v = 128 + ((-r + 2*g -b)>>3);
|
||||||
RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
|
RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int hq3xinited=0;
|
int hq3xinited=0;
|
||||||
extern int realsystemRedShift, realsystemBlueShift;
|
extern int realsystemRedShift, realsystemBlueShift;
|
||||||
|
|
||||||
//16 bit input, see below for 32 bit input
|
//16 bit input, see below for 32 bit input
|
||||||
void hq3x32(unsigned char * pIn, unsigned int srcPitch,
|
void hq3x32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
{
|
{
|
||||||
if (!hq3xinited)
|
if (!hq3xinited)
|
||||||
{
|
{
|
||||||
InitLUTs();
|
InitLUTs();
|
||||||
hq3xinited=1;
|
hq3xinited=1;
|
||||||
}
|
}
|
||||||
hq3x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2) );
|
hq3x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2) );
|
||||||
if (realsystemRedShift == 3)
|
if (realsystemRedShift == 3)
|
||||||
{ // damn you opengl...
|
{ // damn you opengl...
|
||||||
int offset = (dstPitch - (Xres *12)) / 4;
|
int offset = (dstPitch - (Xres *12)) / 4;
|
||||||
unsigned int *p = (unsigned int *)pOut;
|
unsigned int *p = (unsigned int *)pOut;
|
||||||
Yres *= 3;
|
Yres *= 3;
|
||||||
while(Yres--)
|
while(Yres--)
|
||||||
{
|
{
|
||||||
for(int i=0;i<Xres*3;i++)
|
for(int i=0;i<Xres*3;i++)
|
||||||
{
|
{
|
||||||
*p = (*p & 0xFF0000) >> 16 |
|
*p = (*p & 0xFF0000) >> 16 |
|
||||||
(*p & 0x0000FF) << 16 |
|
(*p & 0x0000FF) << 16 |
|
||||||
(*p & 0x00FF00);
|
(*p & 0x00FF00);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
p += offset;
|
p += offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hq3x16(unsigned char * pIn, unsigned int srcPitch,
|
void hq3x16(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
{
|
{
|
||||||
if (!hq3xinited)
|
if (!hq3xinited)
|
||||||
{
|
{
|
||||||
InitLUTs();
|
InitLUTs();
|
||||||
hq3xinited=1;
|
hq3xinited=1;
|
||||||
}
|
}
|
||||||
hq3x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
hq3x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void hq4x16(unsigned char * pIn, unsigned int srcPitch,
|
void hq4x16(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
{
|
{
|
||||||
if (!hq3xinited)
|
if (!hq3xinited)
|
||||||
{
|
{
|
||||||
InitLUTs();
|
InitLUTs();
|
||||||
hq3xinited=1;
|
hq3xinited=1;
|
||||||
}
|
}
|
||||||
hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//16 bit input, see below for 32 bit input
|
//16 bit input, see below for 32 bit input
|
||||||
void hq4x32(unsigned char * pIn, unsigned int srcPitch,
|
void hq4x32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
{
|
{
|
||||||
if (!hq3xinited)
|
if (!hq3xinited)
|
||||||
{
|
{
|
||||||
InitLUTs();
|
InitLUTs();
|
||||||
hq3xinited=1;
|
hq3xinited=1;
|
||||||
}
|
}
|
||||||
hq4x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
hq4x_32( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
||||||
if (realsystemRedShift == 3)
|
if (realsystemRedShift == 3)
|
||||||
{ // damn you opengl...
|
{ // damn you opengl...
|
||||||
int offset = (dstPitch - (Xres *16)) / 4;
|
int offset = (dstPitch - (Xres *16)) / 4;
|
||||||
unsigned int *p = (unsigned int *)pOut;
|
unsigned int *p = (unsigned int *)pOut;
|
||||||
Yres *= 4;
|
Yres *= 4;
|
||||||
while(Yres--)
|
while(Yres--)
|
||||||
{
|
{
|
||||||
for(int i=0;i<Xres*4;i++)
|
for(int i=0;i<Xres*4;i++)
|
||||||
{
|
{
|
||||||
*p = (*p & 0xFF0000) >> 16 |
|
*p = (*p & 0xFF0000) >> 16 |
|
||||||
(*p & 0x0000FF) << 16 |
|
(*p & 0x0000FF) << 16 |
|
||||||
(*p & 0x00FF00);
|
(*p & 0x00FF00);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
p += offset;
|
p += offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void convert32bpp_16bpp(unsigned char *pIn, unsigned int width)
|
static inline void convert32bpp_16bpp(unsigned char *pIn, unsigned int width)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < width; i+=4)
|
for (unsigned int i = 0; i < width; i+=4)
|
||||||
{
|
{
|
||||||
unsigned int p4 = ((unsigned int)pIn[i+2] << 16) | (unsigned int) (pIn[i+1] << 8) | pIn[i+0];
|
unsigned int p4 = ((unsigned int)pIn[i+2] << 16) | (unsigned int) (pIn[i+1] << 8) | pIn[i+0];
|
||||||
unsigned short p2 = ((p4 >> 8)&0xF800) | ((p4 >> 5)&0x07E0) | ((p4 >> 3)&0x001F);
|
unsigned short p2 = ((p4 >> 8)&0xF800) | ((p4 >> 5)&0x07E0) | ((p4 >> 3)&0x001F);
|
||||||
pIn[i/2] = (p2 >> 0);
|
pIn[i/2] = (p2 >> 0);
|
||||||
pIn[i/2+1] = (p2 >> 8);
|
pIn[i/2+1] = (p2 >> 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hq3x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
void hq3x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
||||||
{
|
{
|
||||||
convert32bpp_16bpp(pIn, srcPitch*Yres);
|
convert32bpp_16bpp(pIn, srcPitch*Yres);
|
||||||
hq3x32(pIn, srcPitch/2, 0, pOut, dstPitch, Xres, Yres);
|
hq3x32(pIn, srcPitch/2, 0, pOut, dstPitch, Xres, Yres);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hq4x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
void hq4x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
||||||
{
|
{
|
||||||
convert32bpp_16bpp(pIn, srcPitch*Yres);
|
convert32bpp_16bpp(pIn, srcPitch*Yres);
|
||||||
hq4x32(pIn, srcPitch/2, 0, pOut, dstPitch, Xres, Yres);
|
hq4x32(pIn, srcPitch/2, 0, pOut, dstPitch, Xres, Yres);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,73 +1,73 @@
|
||||||
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach )
|
||||||
;
|
;
|
||||||
;http://www.zsnes.com
|
;http://www.zsnes.com
|
||||||
;http://sourceforge.net/projects/zsnes
|
;http://sourceforge.net/projects/zsnes
|
||||||
;https://zsnes.bountysource.com
|
;https://zsnes.bountysource.com
|
||||||
;
|
;
|
||||||
;This program is free software; you can redistribute it and/or
|
;This program is free software; you can redistribute it and/or
|
||||||
;modify it under the terms of the GNU General Public License
|
;modify it under the terms of the GNU General Public License
|
||||||
;version 2 as published by the Free Software Foundation.
|
;version 2 as published by the Free Software Foundation.
|
||||||
;
|
;
|
||||||
;This program is distributed in the hope that it will be useful,
|
;This program is distributed in the hope that it will be useful,
|
||||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
;GNU General Public License for more details.
|
;GNU General Public License for more details.
|
||||||
;
|
;
|
||||||
;You should have received a copy of the GNU General Public License
|
;You should have received a copy of the GNU General Public License
|
||||||
;along with this program; if not, write to the Free Software
|
;along with this program; if not, write to the Free Software
|
||||||
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
|
||||||
%ifdef __AMD64__
|
%ifdef __AMD64__
|
||||||
bits 64
|
bits 64
|
||||||
%else
|
%else
|
||||||
bits 32
|
bits 32
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%ifdef MACHO
|
%ifdef MACHO
|
||||||
section .text align=16
|
section .text align=16
|
||||||
section .data align=4
|
section .data align=4
|
||||||
section .bss align=4
|
section .bss align=4
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%ifdef ELF
|
%ifdef ELF
|
||||||
|
|
||||||
%imacro newsym 1
|
%imacro newsym 1
|
||||||
GLOBAL %1
|
GLOBAL %1
|
||||||
%1:
|
%1:
|
||||||
%endmacro
|
%endmacro
|
||||||
%imacro newsym 2+
|
%imacro newsym 2+
|
||||||
GLOBAL %1
|
GLOBAL %1
|
||||||
%1: %2
|
%1: %2
|
||||||
%endmacro
|
%endmacro
|
||||||
%define EXTSYM EXTERN
|
%define EXTSYM EXTERN
|
||||||
|
|
||||||
section .note.GNU-stack noalloc noexec nowrite progbits
|
section .note.GNU-stack noalloc noexec nowrite progbits
|
||||||
|
|
||||||
%else
|
%else
|
||||||
|
|
||||||
%imacro newsym 1
|
%imacro newsym 1
|
||||||
GLOBAL _%1
|
GLOBAL _%1
|
||||||
_%1:
|
_%1:
|
||||||
%1:
|
%1:
|
||||||
%endmacro
|
%endmacro
|
||||||
%imacro newsym 2+
|
%imacro newsym 2+
|
||||||
GLOBAL _%1
|
GLOBAL _%1
|
||||||
_%1:
|
_%1:
|
||||||
%1: %2
|
%1: %2
|
||||||
%endmacro
|
%endmacro
|
||||||
%imacro EXTSYM 1-*
|
%imacro EXTSYM 1-*
|
||||||
%rep %0
|
%rep %0
|
||||||
EXTERN _%1
|
EXTERN _%1
|
||||||
%define %1 _%1
|
%define %1 _%1
|
||||||
%rotate 1
|
%rotate 1
|
||||||
%endrep
|
%endrep
|
||||||
%endmacro
|
%endmacro
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%macro ALIGN32 0
|
%macro ALIGN32 0
|
||||||
times ($$-$) & 1Fh nop ; Long word alignment
|
times ($$-$) & 1Fh nop ; Long word alignment
|
||||||
%endmacro
|
%endmacro
|
||||||
%macro ALIGN16 0
|
%macro ALIGN16 0
|
||||||
times ($$-$) & 1Fh nop ; Long word alignment
|
times ($$-$) & 1Fh nop ; Long word alignment
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,449 +1,449 @@
|
||||||
/*
|
/*
|
||||||
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
|
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
|
||||||
|
|
||||||
Copyright (C) 2008 VBA-M development team
|
Copyright (C) 2008 VBA-M development team
|
||||||
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
hq filter by Maxim Stepin ( http://hiend3d.com )
|
hq filter by Maxim Stepin ( http://hiend3d.com )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef _16BIT
|
#ifdef _16BIT
|
||||||
#ifdef _32BIT
|
#ifdef _32BIT
|
||||||
#error _16BIT and _32BIT defined at the same time!
|
#error _16BIT and _32BIT defined at the same time!
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _16BIT
|
#ifdef _16BIT
|
||||||
#define SIZE_PIXEL 2 // 16bit = 2 bytes
|
#define SIZE_PIXEL 2 // 16bit = 2 bytes
|
||||||
#define COLORTYPE unsigned short
|
#define COLORTYPE unsigned short
|
||||||
#define RGBtoYUV RGBtoYUV_16
|
#define RGBtoYUV RGBtoYUV_16
|
||||||
#define Interp1 Interp1_16
|
#define Interp1 Interp1_16
|
||||||
#define Interp2 Interp2_16
|
#define Interp2 Interp2_16
|
||||||
#define Interp3 Interp3_16
|
#define Interp3 Interp3_16
|
||||||
#define Interp4 Interp4_16
|
#define Interp4 Interp4_16
|
||||||
#define Interp5 Interp5_16
|
#define Interp5 Interp5_16
|
||||||
#define Interp6 Interp6_16
|
#define Interp6 Interp6_16
|
||||||
#define Interp7 Interp7_16
|
#define Interp7 Interp7_16
|
||||||
#define Interp8 Interp8_16
|
#define Interp8 Interp8_16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _32BIT
|
#ifdef _32BIT
|
||||||
#define SIZE_PIXEL 4 // 32bit = 4 bytes
|
#define SIZE_PIXEL 4 // 32bit = 4 bytes
|
||||||
#define COLORTYPE unsigned int
|
#define COLORTYPE unsigned int
|
||||||
#define RGBtoYUV RGBtoYUV_32
|
#define RGBtoYUV RGBtoYUV_32
|
||||||
#define Interp1 Interp1_32
|
#define Interp1 Interp1_32
|
||||||
#define Interp2 Interp2_32
|
#define Interp2 Interp2_32
|
||||||
#define Interp3 Interp3_32
|
#define Interp3 Interp3_32
|
||||||
#define Interp4 Interp4_32
|
#define Interp4 Interp4_32
|
||||||
#define Interp5 Interp5_32
|
#define Interp5 Interp5_32
|
||||||
#define Interp6 Interp6_32
|
#define Interp6 Interp6_32
|
||||||
#define Interp7 Interp7_32
|
#define Interp7 Interp7_32
|
||||||
#define Interp8 Interp8_32
|
#define Interp8 Interp8_32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _HQ3X
|
#ifdef _HQ3X
|
||||||
|
|
||||||
#define _MAGNIFICATION 3
|
#define _MAGNIFICATION 3
|
||||||
|
|
||||||
#define PIXEL00_1M Interp1( pOut, c[5], c[1] );
|
#define PIXEL00_1M Interp1( pOut, c[5], c[1] );
|
||||||
#define PIXEL00_1U Interp1( pOut, c[5], c[2] );
|
#define PIXEL00_1U Interp1( pOut, c[5], c[2] );
|
||||||
#define PIXEL00_1L Interp1( pOut, c[5], c[4] );
|
#define PIXEL00_1L Interp1( pOut, c[5], c[4] );
|
||||||
#define PIXEL00_2 Interp2( pOut, c[5], c[4], c[2] );
|
#define PIXEL00_2 Interp2( pOut, c[5], c[4], c[2] );
|
||||||
#define PIXEL00_4 Interp4( pOut, c[5], c[4], c[2] );
|
#define PIXEL00_4 Interp4( pOut, c[5], c[4], c[2] );
|
||||||
#define PIXEL00_5 Interp5( pOut, c[4], c[2] );
|
#define PIXEL00_5 Interp5( pOut, c[4], c[2] );
|
||||||
#define PIXEL00_C *((COLORTYPE*)(pOut)) = c[5];
|
#define PIXEL00_C *((COLORTYPE*)(pOut)) = c[5];
|
||||||
|
|
||||||
#define PIXEL01_1 Interp1( pOut+SIZE_PIXEL, c[5], c[2] );
|
#define PIXEL01_1 Interp1( pOut+SIZE_PIXEL, c[5], c[2] );
|
||||||
#define PIXEL01_3 Interp3( pOut+SIZE_PIXEL, c[5], c[2] );
|
#define PIXEL01_3 Interp3( pOut+SIZE_PIXEL, c[5], c[2] );
|
||||||
#define PIXEL01_6 Interp1( pOut+SIZE_PIXEL, c[2], c[5] );
|
#define PIXEL01_6 Interp1( pOut+SIZE_PIXEL, c[2], c[5] );
|
||||||
#define PIXEL01_C *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5];
|
#define PIXEL01_C *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5];
|
||||||
|
|
||||||
#define PIXEL02_1M Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3] );
|
#define PIXEL02_1M Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3] );
|
||||||
#define PIXEL02_1U Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2] );
|
#define PIXEL02_1U Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2] );
|
||||||
#define PIXEL02_1R Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
#define PIXEL02_1R Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||||
#define PIXEL02_2 Interp2( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] );
|
#define PIXEL02_2 Interp2( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] );
|
||||||
#define PIXEL02_4 Interp4( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] );
|
#define PIXEL02_4 Interp4( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] );
|
||||||
#define PIXEL02_5 Interp5( pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6] );
|
#define PIXEL02_5 Interp5( pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6] );
|
||||||
#define PIXEL02_C *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL02_C *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
|
|
||||||
#define PIXEL10_1 Interp1( pOut+dstPitch, c[5], c[4] );
|
#define PIXEL10_1 Interp1( pOut+dstPitch, c[5], c[4] );
|
||||||
#define PIXEL10_3 Interp3( pOut+dstPitch, c[5], c[4] );
|
#define PIXEL10_3 Interp3( pOut+dstPitch, c[5], c[4] );
|
||||||
#define PIXEL10_6 Interp1( pOut+dstPitch, c[4], c[5] );
|
#define PIXEL10_6 Interp1( pOut+dstPitch, c[4], c[5] );
|
||||||
#define PIXEL10_C *((COLORTYPE*)(pOut+dstPitch)) = c[5];
|
#define PIXEL10_C *((COLORTYPE*)(pOut+dstPitch)) = c[5];
|
||||||
|
|
||||||
#define PIXEL11 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5];
|
#define PIXEL11 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5];
|
||||||
|
|
||||||
#define PIXEL12_1 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
#define PIXEL12_1 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||||
#define PIXEL12_3 Interp3( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
#define PIXEL12_3 Interp3( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||||
#define PIXEL12_6 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5] );
|
#define PIXEL12_6 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5] );
|
||||||
#define PIXEL12_C *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL12_C *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
|
|
||||||
#define PIXEL20_1M Interp1( pOut+dstPitch+dstPitch, c[5], c[7] );
|
#define PIXEL20_1M Interp1( pOut+dstPitch+dstPitch, c[5], c[7] );
|
||||||
#define PIXEL20_1D Interp1( pOut+dstPitch+dstPitch, c[5], c[8] );
|
#define PIXEL20_1D Interp1( pOut+dstPitch+dstPitch, c[5], c[8] );
|
||||||
#define PIXEL20_1L Interp1( pOut+dstPitch+dstPitch, c[5], c[4] );
|
#define PIXEL20_1L Interp1( pOut+dstPitch+dstPitch, c[5], c[4] );
|
||||||
#define PIXEL20_2 Interp2( pOut+dstPitch+dstPitch, c[5], c[8], c[4] );
|
#define PIXEL20_2 Interp2( pOut+dstPitch+dstPitch, c[5], c[8], c[4] );
|
||||||
#define PIXEL20_4 Interp4( pOut+dstPitch+dstPitch, c[5], c[8], c[4] );
|
#define PIXEL20_4 Interp4( pOut+dstPitch+dstPitch, c[5], c[8], c[4] );
|
||||||
#define PIXEL20_5 Interp5( pOut+dstPitch+dstPitch, c[8], c[4] );
|
#define PIXEL20_5 Interp5( pOut+dstPitch+dstPitch, c[8], c[4] );
|
||||||
#define PIXEL20_C *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5];
|
#define PIXEL20_C *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5];
|
||||||
|
|
||||||
#define PIXEL21_1 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] );
|
#define PIXEL21_1 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] );
|
||||||
#define PIXEL21_3 Interp3( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] );
|
#define PIXEL21_3 Interp3( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] );
|
||||||
#define PIXEL21_6 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5] );
|
#define PIXEL21_6 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5] );
|
||||||
#define PIXEL21_C *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
#define PIXEL21_C *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
||||||
|
|
||||||
#define PIXEL22_1M Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9] );
|
#define PIXEL22_1M Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9] );
|
||||||
#define PIXEL22_1D Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8] );
|
#define PIXEL22_1D Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8] );
|
||||||
#define PIXEL22_1R Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
#define PIXEL22_1R Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||||
#define PIXEL22_2 Interp2( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] );
|
#define PIXEL22_2 Interp2( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] );
|
||||||
#define PIXEL22_4 Interp4( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] );
|
#define PIXEL22_4 Interp4( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] );
|
||||||
#define PIXEL22_5 Interp5( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8] );
|
#define PIXEL22_5 Interp5( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8] );
|
||||||
#define PIXEL22_C *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL22_C *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
|
|
||||||
#endif // #ifdef _HQ3X
|
#endif // #ifdef _HQ3X
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _HQ4X
|
#ifdef _HQ4X
|
||||||
|
|
||||||
#define _MAGNIFICATION 4
|
#define _MAGNIFICATION 4
|
||||||
|
|
||||||
#define PIXEL00_0 *((COLORTYPE*)(pOut)) = c[5];
|
#define PIXEL00_0 *((COLORTYPE*)(pOut)) = c[5];
|
||||||
#define PIXEL00_11 Interp1(pOut, c[5], c[4]);
|
#define PIXEL00_11 Interp1(pOut, c[5], c[4]);
|
||||||
#define PIXEL00_12 Interp1(pOut, c[5], c[2]);
|
#define PIXEL00_12 Interp1(pOut, c[5], c[2]);
|
||||||
#define PIXEL00_20 Interp2(pOut, c[5], c[2], c[4]);
|
#define PIXEL00_20 Interp2(pOut, c[5], c[2], c[4]);
|
||||||
#define PIXEL00_50 Interp5(pOut, c[2], c[4]);
|
#define PIXEL00_50 Interp5(pOut, c[2], c[4]);
|
||||||
#define PIXEL00_80 Interp8(pOut, c[5], c[1]);
|
#define PIXEL00_80 Interp8(pOut, c[5], c[1]);
|
||||||
#define PIXEL00_81 Interp8(pOut, c[5], c[4]);
|
#define PIXEL00_81 Interp8(pOut, c[5], c[4]);
|
||||||
#define PIXEL00_82 Interp8(pOut, c[5], c[2]);
|
#define PIXEL00_82 Interp8(pOut, c[5], c[2]);
|
||||||
|
|
||||||
#define PIXEL01_0 *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5];
|
#define PIXEL01_0 *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL01_10 Interp1(pOut+SIZE_PIXEL, c[5], c[1]);
|
#define PIXEL01_10 Interp1(pOut+SIZE_PIXEL, c[5], c[1]);
|
||||||
#define PIXEL01_12 Interp1(pOut+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL01_12 Interp1(pOut+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL01_14 Interp1(pOut+SIZE_PIXEL, c[2], c[5]);
|
#define PIXEL01_14 Interp1(pOut+SIZE_PIXEL, c[2], c[5]);
|
||||||
#define PIXEL01_21 Interp2(pOut+SIZE_PIXEL, c[2], c[5], c[4]);
|
#define PIXEL01_21 Interp2(pOut+SIZE_PIXEL, c[2], c[5], c[4]);
|
||||||
#define PIXEL01_31 Interp3(pOut+SIZE_PIXEL, c[5], c[4]);
|
#define PIXEL01_31 Interp3(pOut+SIZE_PIXEL, c[5], c[4]);
|
||||||
#define PIXEL01_50 Interp5(pOut+SIZE_PIXEL, c[2], c[5]);
|
#define PIXEL01_50 Interp5(pOut+SIZE_PIXEL, c[2], c[5]);
|
||||||
#define PIXEL01_60 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[4]);
|
#define PIXEL01_60 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[4]);
|
||||||
#define PIXEL01_61 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[1]);
|
#define PIXEL01_61 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[1]);
|
||||||
#define PIXEL01_82 Interp8(pOut+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL01_82 Interp8(pOut+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL01_83 Interp8(pOut+SIZE_PIXEL, c[2], c[4]);
|
#define PIXEL01_83 Interp8(pOut+SIZE_PIXEL, c[2], c[4]);
|
||||||
|
|
||||||
#define PIXEL02_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL02_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL02_10 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
#define PIXEL02_10 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
||||||
#define PIXEL02_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL02_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL02_13 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]);
|
#define PIXEL02_13 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]);
|
||||||
#define PIXEL02_21 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5], c[6]);
|
#define PIXEL02_21 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5], c[6]);
|
||||||
#define PIXEL02_32 Interp3(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL02_32 Interp3(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL02_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]);
|
#define PIXEL02_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]);
|
||||||
#define PIXEL02_60 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]);
|
#define PIXEL02_60 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]);
|
||||||
#define PIXEL02_61 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[3]);
|
#define PIXEL02_61 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[3]);
|
||||||
#define PIXEL02_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL02_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL02_83 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]);
|
#define PIXEL02_83 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]);
|
||||||
|
|
||||||
#define PIXEL03_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL03_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL03_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL03_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL03_12 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL03_12 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL03_20 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]);
|
#define PIXEL03_20 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]);
|
||||||
#define PIXEL03_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]);
|
#define PIXEL03_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]);
|
||||||
#define PIXEL03_80 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
#define PIXEL03_80 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
||||||
#define PIXEL03_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL03_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL03_82 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL03_82 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
|
|
||||||
#define PIXEL10_0 *((COLORTYPE*)(pOut+dstPitch)) = c[5];
|
#define PIXEL10_0 *((COLORTYPE*)(pOut+dstPitch)) = c[5];
|
||||||
#define PIXEL10_10 Interp1(pOut+dstPitch, c[5], c[1]);
|
#define PIXEL10_10 Interp1(pOut+dstPitch, c[5], c[1]);
|
||||||
#define PIXEL10_11 Interp1(pOut+dstPitch, c[5], c[4]);
|
#define PIXEL10_11 Interp1(pOut+dstPitch, c[5], c[4]);
|
||||||
#define PIXEL10_13 Interp1(pOut+dstPitch, c[4], c[5]);
|
#define PIXEL10_13 Interp1(pOut+dstPitch, c[4], c[5]);
|
||||||
#define PIXEL10_21 Interp2(pOut+dstPitch, c[4], c[5], c[2]);
|
#define PIXEL10_21 Interp2(pOut+dstPitch, c[4], c[5], c[2]);
|
||||||
#define PIXEL10_32 Interp3(pOut+dstPitch, c[5], c[2]);
|
#define PIXEL10_32 Interp3(pOut+dstPitch, c[5], c[2]);
|
||||||
#define PIXEL10_50 Interp5(pOut+dstPitch, c[4], c[5]);
|
#define PIXEL10_50 Interp5(pOut+dstPitch, c[4], c[5]);
|
||||||
#define PIXEL10_60 Interp6(pOut+dstPitch, c[5], c[4], c[2]);
|
#define PIXEL10_60 Interp6(pOut+dstPitch, c[5], c[4], c[2]);
|
||||||
#define PIXEL10_61 Interp6(pOut+dstPitch, c[5], c[4], c[1]);
|
#define PIXEL10_61 Interp6(pOut+dstPitch, c[5], c[4], c[1]);
|
||||||
#define PIXEL10_81 Interp8(pOut+dstPitch, c[5], c[4]);
|
#define PIXEL10_81 Interp8(pOut+dstPitch, c[5], c[4]);
|
||||||
#define PIXEL10_83 Interp8(pOut+dstPitch, c[4], c[2]);
|
#define PIXEL10_83 Interp8(pOut+dstPitch, c[4], c[2]);
|
||||||
|
|
||||||
#define PIXEL11_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5];
|
#define PIXEL11_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL11_30 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[1]);
|
#define PIXEL11_30 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[1]);
|
||||||
#define PIXEL11_31 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[4]);
|
#define PIXEL11_31 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[4]);
|
||||||
#define PIXEL11_32 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL11_32 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL11_70 Interp7(pOut+dstPitch+SIZE_PIXEL, c[5], c[4], c[2]);
|
#define PIXEL11_70 Interp7(pOut+dstPitch+SIZE_PIXEL, c[5], c[4], c[2]);
|
||||||
|
|
||||||
#define PIXEL12_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL12_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL12_30 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
#define PIXEL12_30 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
||||||
#define PIXEL12_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL12_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL12_32 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL12_32 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL12_70 Interp7(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]);
|
#define PIXEL12_70 Interp7(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]);
|
||||||
|
|
||||||
#define PIXEL13_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL13_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL13_10 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
#define PIXEL13_10 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
|
||||||
#define PIXEL13_12 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL13_12 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL13_14 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
#define PIXEL13_14 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
||||||
#define PIXEL13_21 Interp2(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[2]);
|
#define PIXEL13_21 Interp2(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[2]);
|
||||||
#define PIXEL13_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
#define PIXEL13_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
|
||||||
#define PIXEL13_50 Interp5(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
#define PIXEL13_50 Interp5(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
||||||
#define PIXEL13_60 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]);
|
#define PIXEL13_60 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]);
|
||||||
#define PIXEL13_61 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[3]);
|
#define PIXEL13_61 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[3]);
|
||||||
#define PIXEL13_82 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL13_82 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL13_83 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[2]);
|
#define PIXEL13_83 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[2]);
|
||||||
|
|
||||||
#define PIXEL20_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5];
|
#define PIXEL20_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5];
|
||||||
#define PIXEL20_10 Interp1(pOut+dstPitch+dstPitch, c[5], c[7]);
|
#define PIXEL20_10 Interp1(pOut+dstPitch+dstPitch, c[5], c[7]);
|
||||||
#define PIXEL20_12 Interp1(pOut+dstPitch+dstPitch, c[5], c[4]);
|
#define PIXEL20_12 Interp1(pOut+dstPitch+dstPitch, c[5], c[4]);
|
||||||
#define PIXEL20_14 Interp1(pOut+dstPitch+dstPitch, c[4], c[5]);
|
#define PIXEL20_14 Interp1(pOut+dstPitch+dstPitch, c[4], c[5]);
|
||||||
#define PIXEL20_21 Interp2(pOut+dstPitch+dstPitch, c[4], c[5], c[8]);
|
#define PIXEL20_21 Interp2(pOut+dstPitch+dstPitch, c[4], c[5], c[8]);
|
||||||
#define PIXEL20_31 Interp3(pOut+dstPitch+dstPitch, c[5], c[8]);
|
#define PIXEL20_31 Interp3(pOut+dstPitch+dstPitch, c[5], c[8]);
|
||||||
#define PIXEL20_50 Interp5(pOut+dstPitch+dstPitch, c[4], c[5]);
|
#define PIXEL20_50 Interp5(pOut+dstPitch+dstPitch, c[4], c[5]);
|
||||||
#define PIXEL20_60 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[8]);
|
#define PIXEL20_60 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[8]);
|
||||||
#define PIXEL20_61 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[7]);
|
#define PIXEL20_61 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[7]);
|
||||||
#define PIXEL20_82 Interp8(pOut+dstPitch+dstPitch, c[5], c[4]);
|
#define PIXEL20_82 Interp8(pOut+dstPitch+dstPitch, c[5], c[4]);
|
||||||
#define PIXEL20_83 Interp8(pOut+dstPitch+dstPitch, c[4], c[8]);
|
#define PIXEL20_83 Interp8(pOut+dstPitch+dstPitch, c[4], c[8]);
|
||||||
|
|
||||||
#define PIXEL21_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
#define PIXEL21_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL21_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]);
|
#define PIXEL21_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]);
|
||||||
#define PIXEL21_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL21_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL21_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]);
|
#define PIXEL21_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]);
|
||||||
#define PIXEL21_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4], c[8]);
|
#define PIXEL21_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4], c[8]);
|
||||||
#define PIXEL22_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL22_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL22_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
#define PIXEL22_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
||||||
#define PIXEL22_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL22_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL22_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL22_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL22_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]);
|
#define PIXEL22_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]);
|
||||||
|
|
||||||
#define PIXEL23_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL23_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL23_10 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
#define PIXEL23_10 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
||||||
#define PIXEL23_11 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL23_11 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL23_13 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
#define PIXEL23_13 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
||||||
#define PIXEL23_21 Interp2(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[8]);
|
#define PIXEL23_21 Interp2(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[8]);
|
||||||
#define PIXEL23_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL23_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL23_50 Interp5(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
#define PIXEL23_50 Interp5(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
|
||||||
#define PIXEL23_60 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]);
|
#define PIXEL23_60 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]);
|
||||||
#define PIXEL23_61 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[9]);
|
#define PIXEL23_61 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[9]);
|
||||||
#define PIXEL23_81 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL23_81 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL23_83 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8]);
|
#define PIXEL23_83 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8]);
|
||||||
|
|
||||||
#define PIXEL30_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch)) = c[5];
|
#define PIXEL30_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch)) = c[5];
|
||||||
#define PIXEL30_11 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]);
|
#define PIXEL30_11 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]);
|
||||||
#define PIXEL30_12 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]);
|
#define PIXEL30_12 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]);
|
||||||
#define PIXEL30_20 Interp2(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8], c[4]);
|
#define PIXEL30_20 Interp2(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8], c[4]);
|
||||||
#define PIXEL30_50 Interp5(pOut+dstPitch+dstPitch+dstPitch, c[8], c[4]);
|
#define PIXEL30_50 Interp5(pOut+dstPitch+dstPitch+dstPitch, c[8], c[4]);
|
||||||
#define PIXEL30_80 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[7]);
|
#define PIXEL30_80 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[7]);
|
||||||
#define PIXEL30_81 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]);
|
#define PIXEL30_81 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]);
|
||||||
#define PIXEL30_82 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]);
|
#define PIXEL30_82 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]);
|
||||||
|
|
||||||
#define PIXEL31_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
#define PIXEL31_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL31_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]);
|
#define PIXEL31_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]);
|
||||||
#define PIXEL31_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL31_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL31_13 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]);
|
#define PIXEL31_13 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]);
|
||||||
#define PIXEL31_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5], c[4]);
|
#define PIXEL31_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5], c[4]);
|
||||||
#define PIXEL31_32 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]);
|
#define PIXEL31_32 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]);
|
||||||
#define PIXEL31_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]);
|
#define PIXEL31_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]);
|
||||||
#define PIXEL31_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[4]);
|
#define PIXEL31_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[4]);
|
||||||
#define PIXEL31_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[7]);
|
#define PIXEL31_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[7]);
|
||||||
#define PIXEL31_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL31_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL31_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[4]);
|
#define PIXEL31_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[4]);
|
||||||
|
|
||||||
#define PIXEL32_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL32_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL32_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
#define PIXEL32_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
||||||
#define PIXEL32_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL32_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL32_14 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]);
|
#define PIXEL32_14 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]);
|
||||||
#define PIXEL32_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5], c[6]);
|
#define PIXEL32_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5], c[6]);
|
||||||
#define PIXEL32_31 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL32_31 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL32_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]);
|
#define PIXEL32_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]);
|
||||||
#define PIXEL32_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]);
|
#define PIXEL32_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]);
|
||||||
#define PIXEL32_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[9]);
|
#define PIXEL32_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[9]);
|
||||||
#define PIXEL32_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL32_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL32_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]);
|
#define PIXEL32_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]);
|
||||||
|
|
||||||
#define PIXEL33_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
#define PIXEL33_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||||
#define PIXEL33_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL33_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL33_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL33_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
||||||
#define PIXEL33_20 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]);
|
#define PIXEL33_20 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]);
|
||||||
#define PIXEL33_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]);
|
#define PIXEL33_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]);
|
||||||
#define PIXEL33_80 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
#define PIXEL33_80 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
|
||||||
#define PIXEL33_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
#define PIXEL33_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
|
||||||
#define PIXEL33_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
#define PIXEL33_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
|
||||||
|
|
||||||
#endif // #ifdef _HQ4X
|
#endif // #ifdef _HQ4X
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// function header
|
// function header
|
||||||
#ifdef _16BIT
|
#ifdef _16BIT
|
||||||
#ifdef _HQ3X
|
#ifdef _HQ3X
|
||||||
void hq3x16(
|
void hq3x16(
|
||||||
#endif
|
#endif
|
||||||
#ifdef _HQ4X
|
#ifdef _HQ4X
|
||||||
void hq4x16(
|
void hq4x16(
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _32BIT
|
#ifdef _32BIT
|
||||||
#ifdef _HQ3X
|
#ifdef _HQ3X
|
||||||
void hq3x32(
|
void hq3x32(
|
||||||
#endif
|
#endif
|
||||||
#ifdef _HQ4X
|
#ifdef _HQ4X
|
||||||
void hq4x32(
|
void hq4x32(
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned char *pIn, unsigned int srcPitch,
|
unsigned char *pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char *pOut, unsigned int dstPitch,
|
unsigned char *pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres )
|
int Xres, int Yres )
|
||||||
{
|
{
|
||||||
unsigned int yuv[10]; // yuv[0] not used
|
unsigned int yuv[10]; // yuv[0] not used
|
||||||
// yuv[1-9] allows reusage of calculated YUV values
|
// yuv[1-9] allows reusage of calculated YUV values
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned int linePlus, lineMinus;
|
unsigned int linePlus, lineMinus;
|
||||||
|
|
||||||
COLORTYPE c[10]; // c[0] not used
|
COLORTYPE c[10]; // c[0] not used
|
||||||
// +----+----+----+
|
// +----+----+----+
|
||||||
// | | | |
|
// | | | |
|
||||||
// | c1 | c2 | c3 |
|
// | c1 | c2 | c3 |
|
||||||
// +----+----+----+
|
// +----+----+----+
|
||||||
// | | | |
|
// | | | |
|
||||||
// | c4 | c5 | c6 |
|
// | c4 | c5 | c6 |
|
||||||
// +----+----+----+
|
// +----+----+----+
|
||||||
// | | | |
|
// | | | |
|
||||||
// | c7 | c8 | c9 |
|
// | c7 | c8 | c9 |
|
||||||
// +----+----+----+
|
// +----+----+----+
|
||||||
|
|
||||||
for (y=0; y<Yres; y++)
|
for (y=0; y<Yres; y++)
|
||||||
{
|
{
|
||||||
if( y == 0 ) {
|
if( y == 0 ) {
|
||||||
linePlus = srcPitch;
|
linePlus = srcPitch;
|
||||||
lineMinus = 0;
|
lineMinus = 0;
|
||||||
} else if( y == ( Yres - 1 ) ) {
|
} else if( y == ( Yres - 1 ) ) {
|
||||||
linePlus = 0;
|
linePlus = 0;
|
||||||
lineMinus = srcPitch;
|
lineMinus = srcPitch;
|
||||||
} else {
|
} else {
|
||||||
linePlus = srcPitch;
|
linePlus = srcPitch;
|
||||||
lineMinus = srcPitch;
|
lineMinus = srcPitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x=0; x<Xres; x++)
|
for (x=0; x<Xres; x++)
|
||||||
{
|
{
|
||||||
c[2] = *((COLORTYPE*)(pIn - lineMinus));
|
c[2] = *((COLORTYPE*)(pIn - lineMinus));
|
||||||
c[5] = *((COLORTYPE*)(pIn ));
|
c[5] = *((COLORTYPE*)(pIn ));
|
||||||
c[8] = *((COLORTYPE*)(pIn + linePlus ));
|
c[8] = *((COLORTYPE*)(pIn + linePlus ));
|
||||||
|
|
||||||
if (x>0)
|
if (x>0)
|
||||||
{
|
{
|
||||||
// upper border possible:
|
// upper border possible:
|
||||||
c[1] = *((COLORTYPE*)(pIn - lineMinus - SIZE_PIXEL));
|
c[1] = *((COLORTYPE*)(pIn - lineMinus - SIZE_PIXEL));
|
||||||
|
|
||||||
c[4] = *((COLORTYPE*)(pIn - SIZE_PIXEL));
|
c[4] = *((COLORTYPE*)(pIn - SIZE_PIXEL));
|
||||||
|
|
||||||
// lower border possible:
|
// lower border possible:
|
||||||
c[7] = *((COLORTYPE*)(pIn + linePlus - SIZE_PIXEL));
|
c[7] = *((COLORTYPE*)(pIn + linePlus - SIZE_PIXEL));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // left border
|
{ // left border
|
||||||
c[1] = c[2];
|
c[1] = c[2];
|
||||||
c[4] = c[5];
|
c[4] = c[5];
|
||||||
c[7] = c[8];
|
c[7] = c[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x<Xres-1)
|
if (x<Xres-1)
|
||||||
{
|
{
|
||||||
// upper border possible:
|
// upper border possible:
|
||||||
c[3] = *((COLORTYPE*)(pIn - lineMinus + SIZE_PIXEL));
|
c[3] = *((COLORTYPE*)(pIn - lineMinus + SIZE_PIXEL));
|
||||||
|
|
||||||
c[6] = *((COLORTYPE*)(pIn + SIZE_PIXEL));
|
c[6] = *((COLORTYPE*)(pIn + SIZE_PIXEL));
|
||||||
|
|
||||||
// lower border possible:
|
// lower border possible:
|
||||||
c[9] = *((COLORTYPE*)(pIn + linePlus + SIZE_PIXEL));
|
c[9] = *((COLORTYPE*)(pIn + linePlus + SIZE_PIXEL));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // right border
|
{ // right border
|
||||||
c[3] = c[2];
|
c[3] = c[2];
|
||||||
c[6] = c[5];
|
c[6] = c[5];
|
||||||
c[9] = c[8];
|
c[9] = c[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int pattern = 0;
|
unsigned int pattern = 0;
|
||||||
unsigned int flag = 1;
|
unsigned int flag = 1;
|
||||||
|
|
||||||
yuv[5] = RGBtoYUV( c[5] );
|
yuv[5] = RGBtoYUV( c[5] );
|
||||||
|
|
||||||
for( unsigned char k = 1; k <= 9; k++)
|
for( unsigned char k = 1; k <= 9; k++)
|
||||||
{
|
{
|
||||||
if( k == 5 ) continue;
|
if( k == 5 ) continue;
|
||||||
|
|
||||||
if( c[k] != c[5] )
|
if( c[k] != c[5] )
|
||||||
{
|
{
|
||||||
// pre-calculating the YUV-values for every pixel does
|
// pre-calculating the YUV-values for every pixel does
|
||||||
// not speed up the process
|
// not speed up the process
|
||||||
yuv[k] = RGBtoYUV( c[k] );
|
yuv[k] = RGBtoYUV( c[k] );
|
||||||
|
|
||||||
if( ( abs_32((yuv[5] & 0x00FF0000) - (yuv[k] & 0x00FF0000)) > 0x00300000 ) ||
|
if( ( abs_32((yuv[5] & 0x00FF0000) - (yuv[k] & 0x00FF0000)) > 0x00300000 ) ||
|
||||||
( abs_32((yuv[5] & 0x0000FF00) - (yuv[k] & 0x0000FF00)) > 0x00000700 ) ||
|
( abs_32((yuv[5] & 0x0000FF00) - (yuv[k] & 0x0000FF00)) > 0x00000700 ) ||
|
||||||
( abs_32((yuv[5] & 0x000000FF) - (yuv[k] & 0x000000FF)) > 0x00000006 )
|
( abs_32((yuv[5] & 0x000000FF) - (yuv[k] & 0x000000FF)) > 0x00000006 )
|
||||||
) {
|
) {
|
||||||
pattern |= flag;
|
pattern |= flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flag <<= 1;
|
flag <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _HQ3X
|
#ifdef _HQ3X
|
||||||
#include "hq3x_pattern.h"
|
#include "hq3x_pattern.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _HQ4X
|
#ifdef _HQ4X
|
||||||
#include "hq4x_pattern.h"
|
#include "hq4x_pattern.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pIn += SIZE_PIXEL;
|
pIn += SIZE_PIXEL;
|
||||||
pOut += _MAGNIFICATION * SIZE_PIXEL;
|
pOut += _MAGNIFICATION * SIZE_PIXEL;
|
||||||
}
|
}
|
||||||
pIn += srcPitch - ( Xres * SIZE_PIXEL );
|
pIn += srcPitch - ( Xres * SIZE_PIXEL );
|
||||||
pOut += dstPitch - ( _MAGNIFICATION * Xres * SIZE_PIXEL );
|
pOut += dstPitch - ( _MAGNIFICATION * Xres * SIZE_PIXEL );
|
||||||
pOut += ( _MAGNIFICATION - 1 ) * dstPitch;
|
pOut += ( _MAGNIFICATION - 1 ) * dstPitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _32BIT
|
#ifdef _32BIT
|
||||||
#ifdef _HQ3X
|
#ifdef _HQ3X
|
||||||
void hq3x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
void hq3x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
||||||
{
|
{
|
||||||
hq3x32(pIn, srcPitch, 0, pOut, dstPitch, Xres, Yres);
|
hq3x32(pIn, srcPitch, 0, pOut, dstPitch, Xres, Yres);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef _HQ4X
|
#ifdef _HQ4X
|
||||||
void hq4x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
void hq4x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
||||||
{
|
{
|
||||||
hq4x32(pIn, srcPitch, 0, pOut, dstPitch, Xres, Yres);
|
hq4x32(pIn, srcPitch, 0, pOut, dstPitch, Xres, Yres);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef SIZE_PIXEL
|
#undef SIZE_PIXEL
|
||||||
#undef COLORTYPE
|
#undef COLORTYPE
|
||||||
#undef _MAGNIFICATION
|
#undef _MAGNIFICATION
|
||||||
#undef RGBtoYUV
|
#undef RGBtoYUV
|
||||||
#undef Interp1
|
#undef Interp1
|
||||||
#undef Interp2
|
#undef Interp2
|
||||||
#undef Interp3
|
#undef Interp3
|
||||||
#undef Interp4
|
#undef Interp4
|
||||||
#undef Interp5
|
#undef Interp5
|
||||||
#undef Interp6
|
#undef Interp6
|
||||||
#undef Interp7
|
#undef Interp7
|
||||||
#undef Interp8
|
#undef Interp8
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
/*
|
/*
|
||||||
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
|
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
|
||||||
|
|
||||||
Copyright (C) 2008 VBA-M development team
|
Copyright (C) 2008 VBA-M development team
|
||||||
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
hq filter by Maxim Stepin ( http://hiend3d.com )
|
hq filter by Maxim Stepin ( http://hiend3d.com )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "hq_shared.h"
|
#include "hq_shared.h"
|
||||||
|
|
||||||
|
|
||||||
#define _16BIT
|
#define _16BIT
|
||||||
#define _HQ3X
|
#define _HQ3X
|
||||||
// hq3x, 16bit
|
// hq3x, 16bit
|
||||||
#include "hq_base.h"
|
#include "hq_base.h"
|
||||||
#undef _HQ3X
|
#undef _HQ3X
|
||||||
|
|
||||||
#define _HQ4X
|
#define _HQ4X
|
||||||
// hq4x, 16bit
|
// hq4x, 16bit
|
||||||
#include "hq_base.h"
|
#include "hq_base.h"
|
||||||
#undef _HQ4X
|
#undef _HQ4X
|
||||||
#undef _16BIT
|
#undef _16BIT
|
||||||
|
|
||||||
|
|
||||||
#define _32BIT
|
#define _32BIT
|
||||||
#define _HQ3X
|
#define _HQ3X
|
||||||
// hq3x, 32bit
|
// hq3x, 32bit
|
||||||
#include "hq_base.h"
|
#include "hq_base.h"
|
||||||
#undef _HQ3X
|
#undef _HQ3X
|
||||||
|
|
||||||
#define _HQ4X
|
#define _HQ4X
|
||||||
// hq4x, 32bit
|
// hq4x, 32bit
|
||||||
#include "hq_base.h"
|
#include "hq_base.h"
|
||||||
#undef _HQ4X
|
#undef _HQ4X
|
||||||
#undef _32BIT
|
#undef _32BIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef GMASK
|
#undef GMASK
|
||||||
#undef RBMASK
|
#undef RBMASK
|
||||||
#undef GSHIFT1MASK
|
#undef GSHIFT1MASK
|
||||||
#undef RBSHIFT1MASK
|
#undef RBSHIFT1MASK
|
||||||
#undef GSHIFT2MASK
|
#undef GSHIFT2MASK
|
||||||
#undef RBSHIFT2MASK
|
#undef RBSHIFT2MASK
|
||||||
#undef GSHIFT3MASK
|
#undef GSHIFT3MASK
|
||||||
#undef RBSHIFT3MASK
|
#undef RBSHIFT3MASK
|
||||||
#undef GSHIFT4MASK
|
#undef GSHIFT4MASK
|
||||||
#undef RBSHIFT4MASK
|
#undef RBSHIFT4MASK
|
||||||
|
|
|
@ -1,445 +1,445 @@
|
||||||
/*
|
/*
|
||||||
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
|
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
|
||||||
|
|
||||||
Copyright (C) 2008 VBA-M development team
|
Copyright (C) 2008 VBA-M development team
|
||||||
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
hq filter by Maxim Stepin ( http://hiend3d.com )
|
hq filter by Maxim Stepin ( http://hiend3d.com )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef RGB555
|
#ifdef RGB555
|
||||||
// 5 bits for green
|
// 5 bits for green
|
||||||
#define GMASK 0x03E0
|
#define GMASK 0x03E0
|
||||||
#define RBMASK 0x7C1F
|
#define RBMASK 0x7C1F
|
||||||
// MASK << 1
|
// MASK << 1
|
||||||
#define GSHIFT1MASK 0x000007C0
|
#define GSHIFT1MASK 0x000007C0
|
||||||
#define RBSHIFT1MASK 0x0000F83E
|
#define RBSHIFT1MASK 0x0000F83E
|
||||||
// MASK << 2
|
// MASK << 2
|
||||||
#define GSHIFT2MASK 0x00000F80
|
#define GSHIFT2MASK 0x00000F80
|
||||||
#define RBSHIFT2MASK 0x0001F07C
|
#define RBSHIFT2MASK 0x0001F07C
|
||||||
// MASK << 3
|
// MASK << 3
|
||||||
#define GSHIFT3MASK 0x00001F00
|
#define GSHIFT3MASK 0x00001F00
|
||||||
#define RBSHIFT3MASK 0x0003E0F8
|
#define RBSHIFT3MASK 0x0003E0F8
|
||||||
// MASK << 4
|
// MASK << 4
|
||||||
#define GSHIFT4MASK 0x00003E00
|
#define GSHIFT4MASK 0x00003E00
|
||||||
#define RBSHIFT4MASK 0x0007C1F0
|
#define RBSHIFT4MASK 0x0007C1F0
|
||||||
#else
|
#else
|
||||||
// RGB565
|
// RGB565
|
||||||
// 6 bits for green
|
// 6 bits for green
|
||||||
#define GMASK 0x07E0
|
#define GMASK 0x07E0
|
||||||
#define RBMASK 0xF81F
|
#define RBMASK 0xF81F
|
||||||
#define GSHIFT1MASK 0x00000FC0
|
#define GSHIFT1MASK 0x00000FC0
|
||||||
#define RBSHIFT1MASK 0x0001F03E
|
#define RBSHIFT1MASK 0x0001F03E
|
||||||
#define GSHIFT2MASK 0x00001F80
|
#define GSHIFT2MASK 0x00001F80
|
||||||
#define RBSHIFT2MASK 0x0003E07C
|
#define RBSHIFT2MASK 0x0003E07C
|
||||||
#define GSHIFT3MASK 0x00003F00
|
#define GSHIFT3MASK 0x00003F00
|
||||||
#define RBSHIFT3MASK 0x0007C0F8
|
#define RBSHIFT3MASK 0x0007C0F8
|
||||||
#define GSHIFT4MASK 0x00007E00
|
#define GSHIFT4MASK 0x00007E00
|
||||||
#define RBSHIFT4MASK 0x000F81F0
|
#define RBSHIFT4MASK 0x000F81F0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// we only need the 32bit version because our YUV format has 32bits
|
// we only need the 32bit version because our YUV format has 32bits
|
||||||
#define abs_32( value ) ( value & 0x7FFFFFFF )
|
#define abs_32( value ) ( value & 0x7FFFFFFF )
|
||||||
|
|
||||||
|
|
||||||
inline bool Diff( unsigned int YUV1, unsigned int YUV2 )
|
inline bool Diff( unsigned int YUV1, unsigned int YUV2 )
|
||||||
{
|
{
|
||||||
if( YUV1 == YUV2 ) return false; // Save some processing power
|
if( YUV1 == YUV2 ) return false; // Save some processing power
|
||||||
|
|
||||||
return
|
return
|
||||||
( abs_32((YUV1 & 0x00FF0000) - (YUV2 & 0x00FF0000)) > 0x00300000 ) ||
|
( abs_32((YUV1 & 0x00FF0000) - (YUV2 & 0x00FF0000)) > 0x00300000 ) ||
|
||||||
( abs_32((YUV1 & 0x0000FF00) - (YUV2 & 0x0000FF00)) > 0x00000700 ) ||
|
( abs_32((YUV1 & 0x0000FF00) - (YUV2 & 0x0000FF00)) > 0x00000700 ) ||
|
||||||
( abs_32((YUV1 & 0x000000FF) - (YUV2 & 0x000000FF)) > 0x00000006 );
|
( abs_32((YUV1 & 0x000000FF) - (YUV2 & 0x000000FF)) > 0x00000006 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ===============
|
// ===============
|
||||||
// 32bit routines:
|
// 32bit routines:
|
||||||
// ===============
|
// ===============
|
||||||
|
|
||||||
// ( c1*3 + c2 ) / 4
|
// ( c1*3 + c2 ) / 4
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp1_32( pc, c1, c2 ) \
|
#define Interp1_32( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0x00FF00 ) * 3 ) + \
|
( ( (c1) & 0x00FF00 ) * 3 ) + \
|
||||||
( (c2) & 0x00FF00 ) \
|
( (c2) & 0x00FF00 ) \
|
||||||
) & 0x0003FC00 ) \
|
) & 0x0003FC00 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0xFF00FF ) * 3 ) + \
|
( ( (c1) & 0xFF00FF ) * 3 ) + \
|
||||||
( (c2) & 0xFF00FF ) \
|
( (c2) & 0xFF00FF ) \
|
||||||
) & 0x03FC03FC ) \
|
) & 0x03FC03FC ) \
|
||||||
) >> 2 \
|
) >> 2 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*2 + c2 + c3 ) / 4
|
// ( c1*2 + c2 + c3 ) / 4
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp2_32( pc, c1, c2, c3 ) \
|
#define Interp2_32( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0x00FF00 ) * 2 ) + \
|
( ( (c1) & 0x00FF00 ) * 2 ) + \
|
||||||
( (c2) & 0x00FF00 ) + \
|
( (c2) & 0x00FF00 ) + \
|
||||||
( (c3) & 0x00FF00 ) \
|
( (c3) & 0x00FF00 ) \
|
||||||
) & 0x0003FC00 ) \
|
) & 0x0003FC00 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0xFF00FF ) * 2 ) + \
|
( ( (c1) & 0xFF00FF ) * 2 ) + \
|
||||||
( (c2) & 0xFF00FF ) + \
|
( (c2) & 0xFF00FF ) + \
|
||||||
( (c3) & 0xFF00FF ) \
|
( (c3) & 0xFF00FF ) \
|
||||||
) & 0x03FC03FC ) \
|
) & 0x03FC03FC ) \
|
||||||
) >> 2 \
|
) >> 2 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*7 + c2 ) / 8
|
// ( c1*7 + c2 ) / 8
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp3_32( pc, c1, c2 ) \
|
#define Interp3_32( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0x00FF00 ) * 7 ) + \
|
( ( (c1) & 0x00FF00 ) * 7 ) + \
|
||||||
( (c2) & 0x00FF00 ) \
|
( (c2) & 0x00FF00 ) \
|
||||||
) & 0x0007F800 ) \
|
) & 0x0007F800 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0xFF00FF ) * 7 ) + \
|
( ( (c1) & 0xFF00FF ) * 7 ) + \
|
||||||
( (c2) & 0xFF00FF ) \
|
( (c2) & 0xFF00FF ) \
|
||||||
) & 0x07F807F8 ) \
|
) & 0x07F807F8 ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*2 + (c2+c3)*7 ) / 16
|
// ( c1*2 + (c2+c3)*7 ) / 16
|
||||||
// hq3x, not used by hq4x
|
// hq3x, not used by hq4x
|
||||||
#define Interp4_32( pc, c1, c2, c3 ) \
|
#define Interp4_32( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( ( ( (c1) & 0x00FF00 ) * 2 ) + ( ( ( (c2) & 0x00FF00 ) + ( (c3) & 0x00FF00 ) ) * 7 ) ) & 0x000FF000 ) + \
|
( ( ( ( (c1) & 0x00FF00 ) * 2 ) + ( ( ( (c2) & 0x00FF00 ) + ( (c3) & 0x00FF00 ) ) * 7 ) ) & 0x000FF000 ) + \
|
||||||
( ( ( ( (c1) & 0xFF00FF ) * 2 ) + ( ( ( (c2) & 0xFF00FF ) + ( (c3) & 0xFF00FF ) ) * 7 ) ) & 0x0FF00FF0 ) \
|
( ( ( ( (c1) & 0xFF00FF ) * 2 ) + ( ( ( (c2) & 0xFF00FF ) + ( (c3) & 0xFF00FF ) ) * 7 ) ) & 0x0FF00FF0 ) \
|
||||||
) >> 4 \
|
) >> 4 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1 + c2 ) / 2
|
// ( c1 + c2 ) / 2
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp5_32( pc, c1, c2 ) \
|
#define Interp5_32( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( (c1) & 0x00FF00 ) + \
|
( (c1) & 0x00FF00 ) + \
|
||||||
( (c2) & 0x00FF00 ) \
|
( (c2) & 0x00FF00 ) \
|
||||||
) & 0x0001FE00 ) \
|
) & 0x0001FE00 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( (c1) & 0xFF00FF ) + \
|
( (c1) & 0xFF00FF ) + \
|
||||||
( (c2) & 0xFF00FF ) \
|
( (c2) & 0xFF00FF ) \
|
||||||
) & 0x01FE01FE ) \
|
) & 0x01FE01FE ) \
|
||||||
) >> 1 \
|
) >> 1 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*5 + c2*2 + c3 ) / 8
|
// ( c1*5 + c2*2 + c3 ) / 8
|
||||||
// hq4x
|
// hq4x
|
||||||
#define Interp6_32( pc, c1, c2, c3 ) \
|
#define Interp6_32( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0x00FF00 ) * 5 ) + \
|
( ( (c1) & 0x00FF00 ) * 5 ) + \
|
||||||
( ( (c2) & 0x00FF00 ) * 2 ) + \
|
( ( (c2) & 0x00FF00 ) * 2 ) + \
|
||||||
( (c3) & 0x00FF00 ) \
|
( (c3) & 0x00FF00 ) \
|
||||||
) & 0x0007F800 ) \
|
) & 0x0007F800 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0xFF00FF ) * 5 ) + \
|
( ( (c1) & 0xFF00FF ) * 5 ) + \
|
||||||
( ( (c2) & 0xFF00FF ) * 2 ) + \
|
( ( (c2) & 0xFF00FF ) * 2 ) + \
|
||||||
( (c3) & 0xFF00FF ) \
|
( (c3) & 0xFF00FF ) \
|
||||||
) & 0x07F807F8 ) \
|
) & 0x07F807F8 ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*6 + c2 + c3 ) / 8
|
// ( c1*6 + c2 + c3 ) / 8
|
||||||
// hq4x
|
// hq4x
|
||||||
#define Interp7_32( pc, c1, c2, c3 ) \
|
#define Interp7_32( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0x00FF00 ) * 6 ) + \
|
( ( (c1) & 0x00FF00 ) * 6 ) + \
|
||||||
( (c2) & 0x00FF00 ) + \
|
( (c2) & 0x00FF00 ) + \
|
||||||
( (c3) & 0x00FF00 ) \
|
( (c3) & 0x00FF00 ) \
|
||||||
) & 0x0007F800 ) \
|
) & 0x0007F800 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0xFF00FF ) * 6 ) + \
|
( ( (c1) & 0xFF00FF ) * 6 ) + \
|
||||||
( (c2) & 0xFF00FF ) + \
|
( (c2) & 0xFF00FF ) + \
|
||||||
( (c3) & 0xFF00FF ) \
|
( (c3) & 0xFF00FF ) \
|
||||||
) & 0x07F807F8 ) \
|
) & 0x07F807F8 ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*5 + c2*3 ) / 8
|
// ( c1*5 + c2*3 ) / 8
|
||||||
// hq4x
|
// hq4x
|
||||||
#define Interp8_32( pc, c1, c2 ) \
|
#define Interp8_32( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned int *)(pc) ) = \
|
*( (unsigned int *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0x00FF00 ) * 5 ) + \
|
( ( (c1) & 0x00FF00 ) * 5 ) + \
|
||||||
( ( (c2) & 0x00FF00 ) * 3 ) \
|
( ( (c2) & 0x00FF00 ) * 3 ) \
|
||||||
) & 0x0007F800 ) \
|
) & 0x0007F800 ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & 0xFF00FF ) * 5 ) + \
|
( ( (c1) & 0xFF00FF ) * 5 ) + \
|
||||||
( ( (c2) & 0xFF00FF ) * 3 ) \
|
( ( (c2) & 0xFF00FF ) * 3 ) \
|
||||||
) & 0x07F807F8 ) \
|
) & 0x07F807F8 ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// 32 bit input color
|
// 32 bit input color
|
||||||
// 0x00YYUUVV return value
|
// 0x00YYUUVV return value
|
||||||
inline unsigned int RGBtoYUV_32( unsigned int c )
|
inline unsigned int RGBtoYUV_32( unsigned int c )
|
||||||
{
|
{
|
||||||
// Division through 3 slows down the emulation about 10% !!!
|
// Division through 3 slows down the emulation about 10% !!!
|
||||||
|
|
||||||
register unsigned char r, g, b;
|
register unsigned char r, g, b;
|
||||||
b = c & 0x0000FF;
|
b = c & 0x0000FF;
|
||||||
g = ( c & 0x00FF00 ) >> 8;
|
g = ( c & 0x00FF00 ) >> 8;
|
||||||
r = c >> 16;
|
r = c >> 16;
|
||||||
return ( (r + g + b) << 14 ) +
|
return ( (r + g + b) << 14 ) +
|
||||||
( ( r - b + 512 ) << 4 ) +
|
( ( r - b + 512 ) << 4 ) +
|
||||||
( ( 2*g - r - b ) >> 3 ) + 128;
|
( ( 2*g - r - b ) >> 3 ) + 128;
|
||||||
|
|
||||||
// unoptimized:
|
// unoptimized:
|
||||||
//unsigned char r, g, b, Y, u, v;
|
//unsigned char r, g, b, Y, u, v;
|
||||||
//b = (c & 0x000000FF);
|
//b = (c & 0x000000FF);
|
||||||
//g = (c & 0x0000FF00) >> 8;
|
//g = (c & 0x0000FF00) >> 8;
|
||||||
//r = (c & 0x00FF0000) >> 16;
|
//r = (c & 0x00FF0000) >> 16;
|
||||||
//Y = (r + g + b) >> 2;
|
//Y = (r + g + b) >> 2;
|
||||||
//u = 128 + ((r - b) >> 2);
|
//u = 128 + ((r - b) >> 2);
|
||||||
//v = 128 + ((-r + 2*g -b)>>3);
|
//v = 128 + ((-r + 2*g -b)>>3);
|
||||||
//return (Y<<16) + (u<<8) + v;
|
//return (Y<<16) + (u<<8) + v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ===============
|
// ===============
|
||||||
// 16bit routines:
|
// 16bit routines:
|
||||||
// ===============
|
// ===============
|
||||||
|
|
||||||
// ( c1*3 + c2 ) / 4
|
// ( c1*3 + c2 ) / 4
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp1_16( pc, c1, c2 ) \
|
#define Interp1_16( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & GMASK ) * 3 ) + \
|
( ( (c1) & GMASK ) * 3 ) + \
|
||||||
( (c2) & GMASK ) \
|
( (c2) & GMASK ) \
|
||||||
) & GSHIFT2MASK ) \
|
) & GSHIFT2MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & RBMASK ) * 3 ) + \
|
( ( (c1) & RBMASK ) * 3 ) + \
|
||||||
( (c2) & RBMASK ) \
|
( (c2) & RBMASK ) \
|
||||||
) & RBSHIFT2MASK ) \
|
) & RBSHIFT2MASK ) \
|
||||||
) >> 2 \
|
) >> 2 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*2 + c2 + c3 ) / 4
|
// ( c1*2 + c2 + c3 ) / 4
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp2_16( pc, c1, c2, c3 ) \
|
#define Interp2_16( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & GMASK ) * 2 ) + \
|
( ( (c1) & GMASK ) * 2 ) + \
|
||||||
( (c2) & GMASK ) + \
|
( (c2) & GMASK ) + \
|
||||||
( (c3) & GMASK ) \
|
( (c3) & GMASK ) \
|
||||||
) & GSHIFT2MASK ) \
|
) & GSHIFT2MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & RBMASK ) * 2 ) + \
|
( ( (c1) & RBMASK ) * 2 ) + \
|
||||||
( (c2) & RBMASK ) + \
|
( (c2) & RBMASK ) + \
|
||||||
( (c3) & RBMASK ) \
|
( (c3) & RBMASK ) \
|
||||||
) & RBSHIFT2MASK ) \
|
) & RBSHIFT2MASK ) \
|
||||||
) >> 2 \
|
) >> 2 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*7 + c2 ) / 8
|
// ( c1*7 + c2 ) / 8
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp3_16( pc, c1, c2 ) \
|
#define Interp3_16( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & GMASK ) * 7 ) + \
|
( ( (c1) & GMASK ) * 7 ) + \
|
||||||
( (c2) & GMASK ) \
|
( (c2) & GMASK ) \
|
||||||
) & GSHIFT3MASK ) \
|
) & GSHIFT3MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & RBMASK ) * 7 ) + \
|
( ( (c1) & RBMASK ) * 7 ) + \
|
||||||
( (c2) & RBMASK ) \
|
( (c2) & RBMASK ) \
|
||||||
) & RBSHIFT3MASK ) \
|
) & RBSHIFT3MASK ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*2 + (c2+c3)*7 ) / 16
|
// ( c1*2 + (c2+c3)*7 ) / 16
|
||||||
// hq3x, not used by hq4x
|
// hq3x, not used by hq4x
|
||||||
#define Interp4_16( pc, c1, c2, c3 ) \
|
#define Interp4_16( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( ( ( (c1) & GMASK ) * 2 ) + ( ( ( (c2) & GMASK ) + ( (c3) & GMASK ) ) * 7 ) ) & GSHIFT4MASK ) + \
|
( ( ( ( (c1) & GMASK ) * 2 ) + ( ( ( (c2) & GMASK ) + ( (c3) & GMASK ) ) * 7 ) ) & GSHIFT4MASK ) + \
|
||||||
( ( ( ( (c1) & RBMASK ) * 2 ) + ( ( ( (c2) & RBMASK ) + ( (c3) & RBMASK ) ) * 7 ) ) & RBSHIFT4MASK ) \
|
( ( ( ( (c1) & RBMASK ) * 2 ) + ( ( ( (c2) & RBMASK ) + ( (c3) & RBMASK ) ) * 7 ) ) & RBSHIFT4MASK ) \
|
||||||
) >> 4 \
|
) >> 4 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1 + c2 ) / 2
|
// ( c1 + c2 ) / 2
|
||||||
// hq3x, hq4x
|
// hq3x, hq4x
|
||||||
#define Interp5_16( pc, c1, c2 ) \
|
#define Interp5_16( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( (c1) & GMASK ) + \
|
( (c1) & GMASK ) + \
|
||||||
( (c2) & GMASK ) \
|
( (c2) & GMASK ) \
|
||||||
) & GSHIFT1MASK ) \
|
) & GSHIFT1MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( (c1) & RBMASK ) + \
|
( (c1) & RBMASK ) + \
|
||||||
( (c2) & RBMASK ) \
|
( (c2) & RBMASK ) \
|
||||||
) & RBSHIFT1MASK ) \
|
) & RBSHIFT1MASK ) \
|
||||||
) >> 1 \
|
) >> 1 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*5 + c2*2 + c3 ) / 8
|
// ( c1*5 + c2*2 + c3 ) / 8
|
||||||
// hq4x
|
// hq4x
|
||||||
#define Interp6_16( pc, c1, c2, c3 ) \
|
#define Interp6_16( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & GMASK ) * 5 ) + \
|
( ( (c1) & GMASK ) * 5 ) + \
|
||||||
( ( (c2) & GMASK ) * 2 ) + \
|
( ( (c2) & GMASK ) * 2 ) + \
|
||||||
( (c3) & GMASK ) \
|
( (c3) & GMASK ) \
|
||||||
) & GSHIFT3MASK ) \
|
) & GSHIFT3MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & RBMASK ) * 5 ) + \
|
( ( (c1) & RBMASK ) * 5 ) + \
|
||||||
( ( (c2) & RBMASK ) * 2 ) + \
|
( ( (c2) & RBMASK ) * 2 ) + \
|
||||||
( (c3) & RBMASK ) \
|
( (c3) & RBMASK ) \
|
||||||
) & RBSHIFT3MASK ) \
|
) & RBSHIFT3MASK ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*6 + c2 + c3 ) / 8
|
// ( c1*6 + c2 + c3 ) / 8
|
||||||
// hq4x
|
// hq4x
|
||||||
#define Interp7_16( pc, c1, c2, c3 ) \
|
#define Interp7_16( pc, c1, c2, c3 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) == (c3) ) ? c1 : \
|
( (c1) == (c2) == (c3) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & GMASK ) * 6 ) + \
|
( ( (c1) & GMASK ) * 6 ) + \
|
||||||
( (c2) & GMASK ) + \
|
( (c2) & GMASK ) + \
|
||||||
( (c3) & GMASK ) \
|
( (c3) & GMASK ) \
|
||||||
) & GSHIFT3MASK ) \
|
) & GSHIFT3MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & RBMASK ) * 6 ) + \
|
( ( (c1) & RBMASK ) * 6 ) + \
|
||||||
( (c2) & RBMASK ) + \
|
( (c2) & RBMASK ) + \
|
||||||
( (c3) & RBMASK ) \
|
( (c3) & RBMASK ) \
|
||||||
) & RBSHIFT3MASK ) \
|
) & RBSHIFT3MASK ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// ( c1*5 + c2*3 ) / 8
|
// ( c1*5 + c2*3 ) / 8
|
||||||
// hq4x
|
// hq4x
|
||||||
#define Interp8_16( pc, c1, c2 ) \
|
#define Interp8_16( pc, c1, c2 ) \
|
||||||
( \
|
( \
|
||||||
*( (unsigned short *)(pc) ) = \
|
*( (unsigned short *)(pc) ) = \
|
||||||
( (c1) == (c2) ) ? c1 : \
|
( (c1) == (c2) ) ? c1 : \
|
||||||
( \
|
( \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & GMASK ) * 5 ) + \
|
( ( (c1) & GMASK ) * 5 ) + \
|
||||||
( ( (c2) & GMASK ) * 3 ) \
|
( ( (c2) & GMASK ) * 3 ) \
|
||||||
) & GSHIFT3MASK ) \
|
) & GSHIFT3MASK ) \
|
||||||
+ \
|
+ \
|
||||||
( ( \
|
( ( \
|
||||||
( ( (c1) & RBMASK ) * 5 ) + \
|
( ( (c1) & RBMASK ) * 5 ) + \
|
||||||
( ( (c2) & RBMASK ) * 3 ) \
|
( ( (c2) & RBMASK ) * 3 ) \
|
||||||
) & RBSHIFT3MASK ) \
|
) & RBSHIFT3MASK ) \
|
||||||
) >> 3 \
|
) >> 3 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// 16 bit input color
|
// 16 bit input color
|
||||||
// 0x00YYUUVV return value
|
// 0x00YYUUVV return value
|
||||||
inline unsigned int RGBtoYUV_16( unsigned short c )
|
inline unsigned int RGBtoYUV_16( unsigned short c )
|
||||||
{
|
{
|
||||||
// Division through 3 slows down the emulation about 10% !!!
|
// Division through 3 slows down the emulation about 10% !!!
|
||||||
|
|
||||||
register unsigned char r, g, b;
|
register unsigned char r, g, b;
|
||||||
#ifdef RGB555
|
#ifdef RGB555
|
||||||
r = ( c & 0x7C00 ) >> 7;
|
r = ( c & 0x7C00 ) >> 7;
|
||||||
g = ( c & 0x03E0 ) >> 2;
|
g = ( c & 0x03E0 ) >> 2;
|
||||||
b = ( c & 0x001F ) << 3;
|
b = ( c & 0x001F ) << 3;
|
||||||
#else
|
#else
|
||||||
r = ( c & 0xF800 ) >> 8;
|
r = ( c & 0xF800 ) >> 8;
|
||||||
g = ( c & 0x07E0 ) >> 3;
|
g = ( c & 0x07E0 ) >> 3;
|
||||||
b = ( c & 0x001F ) << 3;
|
b = ( c & 0x001F ) << 3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ( (r + g + b) << 14 ) +
|
return ( (r + g + b) << 14 ) +
|
||||||
( ( r - b + 512 ) << 4 ) +
|
( ( r - b + 512 ) << 4 ) +
|
||||||
( ( 2*g - r - b ) >> 3 ) + 128;
|
( ( 2*g - r - b ) >> 3 ) + 128;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,85 +1,85 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#include "EmuManager.h"
|
#include "EmuManager.h"
|
||||||
|
|
||||||
|
|
||||||
EmuManager::EmuManager()
|
EmuManager::EmuManager()
|
||||||
: romBuffer( 0 )
|
: romBuffer( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EmuManager::~EmuManager()
|
EmuManager::~EmuManager()
|
||||||
{
|
{
|
||||||
if( romBuffer != 0 ) {
|
if( romBuffer != 0 ) {
|
||||||
free( romBuffer );
|
free( romBuffer );
|
||||||
romBuffer = 0;
|
romBuffer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EmuManager::setROM( QString &file )
|
void EmuManager::setROM( QString &file )
|
||||||
{
|
{
|
||||||
romPath = file;
|
romPath = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString &EmuManager::getROM()
|
QString &EmuManager::getROM()
|
||||||
{
|
{
|
||||||
return romPath;
|
return romPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EmuManager::loadROM()
|
bool EmuManager::loadROM()
|
||||||
{
|
{
|
||||||
// validate ROM
|
// validate ROM
|
||||||
if( romPath.isEmpty() ) return false;
|
if( romPath.isEmpty() ) return false;
|
||||||
|
|
||||||
QFile file( romPath );
|
QFile file( romPath );
|
||||||
|
|
||||||
if( !file.exists() ) return false;
|
if( !file.exists() ) return false;
|
||||||
|
|
||||||
qint64 size = file.size();
|
qint64 size = file.size();
|
||||||
if( ( size == 0 ) || ( size > 0x2000000 /* 32MB */ ) ) return false;
|
if( ( size == 0 ) || ( size > 0x2000000 /* 32MB */ ) ) return false;
|
||||||
|
|
||||||
// TODO: add further validation
|
// TODO: add further validation
|
||||||
|
|
||||||
// read ROM into memory
|
// read ROM into memory
|
||||||
if( !file.open( QIODevice::ReadOnly ) ) return false;
|
if( !file.open( QIODevice::ReadOnly ) ) return false;
|
||||||
|
|
||||||
if( romBuffer != 0 ) {
|
if( romBuffer != 0 ) {
|
||||||
// resize the buffer
|
// resize the buffer
|
||||||
unsigned char *temp;
|
unsigned char *temp;
|
||||||
temp = (unsigned char *)realloc( romBuffer, size );
|
temp = (unsigned char *)realloc( romBuffer, size );
|
||||||
if( temp == 0 ) {
|
if( temp == 0 ) {
|
||||||
free( romBuffer );
|
free( romBuffer );
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
romBuffer = temp;
|
romBuffer = temp;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// create the buffer
|
// create the buffer
|
||||||
romBuffer = (unsigned char *)malloc( size );
|
romBuffer = (unsigned char *)malloc( size );
|
||||||
if( romBuffer == 0 ) return false;
|
if( romBuffer == 0 ) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( -1 == file.read( (char *)romBuffer, size ) ) return false;
|
if( -1 == file.read( (char *)romBuffer, size ) ) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef EMUMANAGER_H
|
#ifndef EMUMANAGER_H
|
||||||
#define EMUMANAGER_H
|
#define EMUMANAGER_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
// class to abstract emulation control
|
// class to abstract emulation control
|
||||||
class EmuManager
|
class EmuManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EmuManager();
|
EmuManager();
|
||||||
~EmuManager();
|
~EmuManager();
|
||||||
|
|
||||||
void setROM( QString &file );
|
void setROM( QString &file );
|
||||||
QString &getROM();
|
QString &getROM();
|
||||||
|
|
||||||
bool loadROM();
|
bool loadROM();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString romPath;
|
QString romPath;
|
||||||
unsigned char *romBuffer;
|
unsigned char *romBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef EMUMANAGER_H
|
#endif // #ifndef EMUMANAGER_H
|
||||||
|
|
|
@ -1,94 +1,94 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#include "GraphicsOutput.h"
|
#include "GraphicsOutput.h"
|
||||||
|
|
||||||
|
|
||||||
GraphicsOutput::GraphicsOutput( QWidget *parent)
|
GraphicsOutput::GraphicsOutput( QWidget *parent)
|
||||||
: QGLWidget( parent ),
|
: QGLWidget( parent ),
|
||||||
m_api( NONE )
|
m_api( NONE )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GraphicsOutput::~GraphicsOutput()
|
GraphicsOutput::~GraphicsOutput()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GraphicsOutput::setAPI( GraphicsOutput::DISPLAY_API api )
|
bool GraphicsOutput::setAPI( GraphicsOutput::DISPLAY_API api )
|
||||||
{
|
{
|
||||||
if( ( api == OPENGL ) && ( !QGLFormat::hasOpenGL() ) ) {
|
if( ( api == OPENGL ) && ( !QGLFormat::hasOpenGL() ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_api = api;
|
m_api = api;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GraphicsOutput::DISPLAY_API GraphicsOutput::getAPI()
|
GraphicsOutput::DISPLAY_API GraphicsOutput::getAPI()
|
||||||
{
|
{
|
||||||
return m_api;
|
return m_api;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicsOutput::render()
|
void GraphicsOutput::render()
|
||||||
{
|
{
|
||||||
repaint(); // immediately calls paintEvent()
|
repaint(); // immediately calls paintEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GraphicsOutput::paintEvent( QPaintEvent *event )
|
void GraphicsOutput::paintEvent( QPaintEvent *event )
|
||||||
{
|
{
|
||||||
if( m_api == NONE ) return;
|
if( m_api == NONE ) return;
|
||||||
|
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
|
||||||
painter.begin( this );
|
painter.begin( this );
|
||||||
|
|
||||||
painter.setRenderHint( QPainter::Antialiasing ); // enable AA if supported by OpenGL device
|
painter.setRenderHint( QPainter::Antialiasing ); // enable AA if supported by OpenGL device
|
||||||
|
|
||||||
painter.setRenderHint( QPainter::TextAntialiasing );
|
painter.setRenderHint( QPainter::TextAntialiasing );
|
||||||
|
|
||||||
painter.setRenderHint( QPainter::HighQualityAntialiasing );
|
painter.setRenderHint( QPainter::HighQualityAntialiasing );
|
||||||
|
|
||||||
painter.fillRect( rect(), QBrush( QColor( 0xFF, 0x00, 0x00 ), Qt::SolidPattern ) );
|
painter.fillRect( rect(), QBrush( QColor( 0xFF, 0x00, 0x00 ), Qt::SolidPattern ) );
|
||||||
|
|
||||||
painter.setPen( QColor( 0x00, 0x00, 0xFF ) );
|
painter.setPen( QColor( 0x00, 0x00, 0xFF ) );
|
||||||
painter.drawEllipse( rect() );
|
painter.drawEllipse( rect() );
|
||||||
|
|
||||||
static unsigned int counter = 0;
|
static unsigned int counter = 0;
|
||||||
static QTime firstTime = QTime::currentTime();
|
static QTime firstTime = QTime::currentTime();
|
||||||
|
|
||||||
int tDiff = firstTime.secsTo( QTime::currentTime() );
|
int tDiff = firstTime.secsTo( QTime::currentTime() );
|
||||||
|
|
||||||
int fps = 0;
|
int fps = 0;
|
||||||
|
|
||||||
if( tDiff != 0 ) {
|
if( tDiff != 0 ) {
|
||||||
fps = counter / tDiff;
|
fps = counter / tDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.setPen( QColor( 0x00, 0xFF, 0x00 ) );
|
painter.setPen( QColor( 0x00, 0xFF, 0x00 ) );
|
||||||
painter.setFont( QFont( "Arial", 14, QFont::Bold ) );
|
painter.setFont( QFont( "Arial", 14, QFont::Bold ) );
|
||||||
painter.drawText( rect(), Qt::AlignCenter, "Frame Number " + QString::number( counter++ ) +
|
painter.drawText( rect(), Qt::AlignCenter, "Frame Number " + QString::number( counter++ ) +
|
||||||
"\nFPS: " + QString::number( fps ) );
|
"\nFPS: " + QString::number( fps ) );
|
||||||
|
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef GRAPHICSOUTPUT_H
|
#ifndef GRAPHICSOUTPUT_H
|
||||||
#define GRAPHICSOUTPUT_H
|
#define GRAPHICSOUTPUT_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
// this class uses a QGLWidget with QPainter, which uses OpenGL acceleration if supported
|
// this class uses a QGLWidget with QPainter, which uses OpenGL acceleration if supported
|
||||||
class GraphicsOutput : public QGLWidget
|
class GraphicsOutput : public QGLWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GraphicsOutput( QWidget *parent );
|
GraphicsOutput( QWidget *parent );
|
||||||
~GraphicsOutput();
|
~GraphicsOutput();
|
||||||
|
|
||||||
enum DISPLAY_API
|
enum DISPLAY_API
|
||||||
{
|
{
|
||||||
NONE,
|
NONE,
|
||||||
QPAINTER,
|
QPAINTER,
|
||||||
OPENGL,
|
OPENGL,
|
||||||
DIRECT3D
|
DIRECT3D
|
||||||
};
|
};
|
||||||
|
|
||||||
bool setAPI( DISPLAY_API api );
|
bool setAPI( DISPLAY_API api );
|
||||||
DISPLAY_API getAPI();
|
DISPLAY_API getAPI();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent( QPaintEvent *event );
|
void paintEvent( QPaintEvent *event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISPLAY_API m_api;
|
DISPLAY_API m_api;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef GRAPHICSOUTPUT_H
|
#endif // #ifndef GRAPHICSOUTPUT_H
|
||||||
|
|
|
@ -1,139 +1,139 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#include "MainOptions.h"
|
#include "MainOptions.h"
|
||||||
|
|
||||||
VideoOptionsPage::VideoOptionsPage(QWidget *parent)
|
VideoOptionsPage::VideoOptionsPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
QGroupBox *RenderGroup = new QGroupBox(tr("Renderer Selection"));
|
QGroupBox *RenderGroup = new QGroupBox(tr("Renderer Selection"));
|
||||||
QLabel *RenderLabel = new QLabel(tr("Renderer:"));
|
QLabel *RenderLabel = new QLabel(tr("Renderer:"));
|
||||||
QComboBox *RenderCombo = new QComboBox;
|
QComboBox *RenderCombo = new QComboBox;
|
||||||
RenderCombo->addItem("OpenGL");
|
RenderCombo->addItem("OpenGL");
|
||||||
//RenderCombo->addItem(tr("D3D"));
|
//RenderCombo->addItem(tr("D3D"));
|
||||||
RenderCombo->addItem("QPainter");
|
RenderCombo->addItem("QPainter");
|
||||||
|
|
||||||
QHBoxLayout *RenderLayout = new QHBoxLayout;
|
QHBoxLayout *RenderLayout = new QHBoxLayout;
|
||||||
RenderLayout->addWidget(RenderLabel);
|
RenderLayout->addWidget(RenderLabel);
|
||||||
RenderLayout->addWidget(RenderCombo);
|
RenderLayout->addWidget(RenderCombo);
|
||||||
|
|
||||||
QVBoxLayout *configLayout = new QVBoxLayout;
|
QVBoxLayout *configLayout = new QVBoxLayout;
|
||||||
configLayout->addLayout(RenderLayout);
|
configLayout->addLayout(RenderLayout);
|
||||||
RenderGroup->setLayout(configLayout);
|
RenderGroup->setLayout(configLayout);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addWidget(RenderGroup);
|
mainLayout->addWidget(RenderGroup);
|
||||||
mainLayout->addStretch(1);
|
mainLayout->addStretch(1);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InputOptionsPage::InputOptionsPage(QWidget *parent)
|
InputOptionsPage::InputOptionsPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
QGroupBox *InputGroup = new QGroupBox(tr("Input Keys"));
|
QGroupBox *InputGroup = new QGroupBox(tr("Input Keys"));
|
||||||
|
|
||||||
QLabel *StartLabel = new QLabel(tr("Start:"));
|
QLabel *StartLabel = new QLabel(tr("Start:"));
|
||||||
QLineEdit *StartEdit = new QLineEdit;
|
QLineEdit *StartEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *SelectLabel = new QLabel(tr("Select:"));
|
QLabel *SelectLabel = new QLabel(tr("Select:"));
|
||||||
QLineEdit *SelectEdit = new QLineEdit;
|
QLineEdit *SelectEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *UpLabel = new QLabel(tr("Up:"));
|
QLabel *UpLabel = new QLabel(tr("Up:"));
|
||||||
QLineEdit *UpEdit = new QLineEdit;
|
QLineEdit *UpEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *DownLabel = new QLabel(tr("Down:"));
|
QLabel *DownLabel = new QLabel(tr("Down:"));
|
||||||
QLineEdit *DownEdit = new QLineEdit;
|
QLineEdit *DownEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *LeftLabel = new QLabel(tr("Left:"));
|
QLabel *LeftLabel = new QLabel(tr("Left:"));
|
||||||
QLineEdit *LeftEdit = new QLineEdit;
|
QLineEdit *LeftEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *RightLabel = new QLabel(tr("Right:"));
|
QLabel *RightLabel = new QLabel(tr("Right:"));
|
||||||
QLineEdit *RightEdit = new QLineEdit;
|
QLineEdit *RightEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *ALabel = new QLabel(tr("A:"));
|
QLabel *ALabel = new QLabel(tr("A:"));
|
||||||
QLineEdit *AEdit = new QLineEdit;
|
QLineEdit *AEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *BLabel = new QLabel(tr("B:"));
|
QLabel *BLabel = new QLabel(tr("B:"));
|
||||||
QLineEdit *BEdit = new QLineEdit;
|
QLineEdit *BEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *LLabel = new QLabel(tr("L:"));
|
QLabel *LLabel = new QLabel(tr("L:"));
|
||||||
QLineEdit *LEdit = new QLineEdit;
|
QLineEdit *LEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *RLabel = new QLabel(tr("R:"));
|
QLabel *RLabel = new QLabel(tr("R:"));
|
||||||
QLineEdit *REdit = new QLineEdit;
|
QLineEdit *REdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *GSLabel = new QLabel(tr("Gameshark:"));
|
QLabel *GSLabel = new QLabel(tr("Gameshark:"));
|
||||||
QLineEdit *GSEdit = new QLineEdit;
|
QLineEdit *GSEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *SpeedUpLabel = new QLabel(tr("Speed Up:"));
|
QLabel *SpeedUpLabel = new QLabel(tr("Speed Up:"));
|
||||||
QLineEdit *SpeedUpEdit = new QLineEdit;
|
QLineEdit *SpeedUpEdit = new QLineEdit;
|
||||||
|
|
||||||
QLabel *ScreenshotLabel = new QLabel(tr("Screenshot:"));
|
QLabel *ScreenshotLabel = new QLabel(tr("Screenshot:"));
|
||||||
QLineEdit *ScreenshotEdit = new QLineEdit;
|
QLineEdit *ScreenshotEdit = new QLineEdit;
|
||||||
|
|
||||||
QCheckBox *MultipleAssignCheckBox = new QCheckBox(tr("Multiple key assignments"));
|
QCheckBox *MultipleAssignCheckBox = new QCheckBox(tr("Multiple key assignments"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QGridLayout *InputLayout = new QGridLayout;
|
QGridLayout *InputLayout = new QGridLayout;
|
||||||
InputLayout->addWidget(StartLabel, 0, 0);
|
InputLayout->addWidget(StartLabel, 0, 0);
|
||||||
InputLayout->addWidget(StartEdit, 0, 1);
|
InputLayout->addWidget(StartEdit, 0, 1);
|
||||||
InputLayout->addWidget(SelectLabel, 1, 0);
|
InputLayout->addWidget(SelectLabel, 1, 0);
|
||||||
InputLayout->addWidget(SelectEdit, 1, 1);
|
InputLayout->addWidget(SelectEdit, 1, 1);
|
||||||
InputLayout->addWidget(UpLabel, 2, 0);
|
InputLayout->addWidget(UpLabel, 2, 0);
|
||||||
InputLayout->addWidget(UpEdit, 2, 1);
|
InputLayout->addWidget(UpEdit, 2, 1);
|
||||||
InputLayout->addWidget(DownLabel, 3, 0);
|
InputLayout->addWidget(DownLabel, 3, 0);
|
||||||
InputLayout->addWidget(DownEdit, 3, 1);
|
InputLayout->addWidget(DownEdit, 3, 1);
|
||||||
InputLayout->addWidget(LeftLabel, 4, 0);
|
InputLayout->addWidget(LeftLabel, 4, 0);
|
||||||
InputLayout->addWidget(LeftEdit, 4, 1);
|
InputLayout->addWidget(LeftEdit, 4, 1);
|
||||||
InputLayout->addWidget(RightLabel, 5, 0);
|
InputLayout->addWidget(RightLabel, 5, 0);
|
||||||
InputLayout->addWidget(RightEdit, 5, 1);
|
InputLayout->addWidget(RightEdit, 5, 1);
|
||||||
InputLayout->addWidget(ALabel, 6, 0);
|
InputLayout->addWidget(ALabel, 6, 0);
|
||||||
InputLayout->addWidget(AEdit, 6, 1);
|
InputLayout->addWidget(AEdit, 6, 1);
|
||||||
InputLayout->addWidget(BLabel, 7, 0);
|
InputLayout->addWidget(BLabel, 7, 0);
|
||||||
InputLayout->addWidget(BEdit, 7, 1);
|
InputLayout->addWidget(BEdit, 7, 1);
|
||||||
InputLayout->addWidget(LLabel, 8, 0);
|
InputLayout->addWidget(LLabel, 8, 0);
|
||||||
InputLayout->addWidget(LEdit, 8, 1);
|
InputLayout->addWidget(LEdit, 8, 1);
|
||||||
InputLayout->addWidget(RLabel, 9, 0);
|
InputLayout->addWidget(RLabel, 9, 0);
|
||||||
InputLayout->addWidget(REdit, 9, 1);
|
InputLayout->addWidget(REdit, 9, 1);
|
||||||
InputLayout->addWidget(GSLabel, 0, 2);
|
InputLayout->addWidget(GSLabel, 0, 2);
|
||||||
InputLayout->addWidget(GSEdit, 0, 3);
|
InputLayout->addWidget(GSEdit, 0, 3);
|
||||||
InputLayout->addWidget(SpeedUpLabel, 1, 2);
|
InputLayout->addWidget(SpeedUpLabel, 1, 2);
|
||||||
InputLayout->addWidget(SpeedUpEdit, 1, 3);
|
InputLayout->addWidget(SpeedUpEdit, 1, 3);
|
||||||
InputLayout->addWidget(ScreenshotLabel, 2, 2);
|
InputLayout->addWidget(ScreenshotLabel, 2, 2);
|
||||||
InputLayout->addWidget(ScreenshotEdit, 2, 3);
|
InputLayout->addWidget(ScreenshotEdit, 2, 3);
|
||||||
InputLayout->addWidget(MultipleAssignCheckBox, 3, 2);
|
InputLayout->addWidget(MultipleAssignCheckBox, 3, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InputGroup->setLayout(InputLayout);
|
InputGroup->setLayout(InputLayout);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addWidget(InputGroup);
|
mainLayout->addWidget(InputGroup);
|
||||||
mainLayout->addSpacing(12);
|
mainLayout->addSpacing(12);
|
||||||
mainLayout->addStretch(1);
|
mainLayout->addStretch(1);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SoundOptionsPage::SoundOptionsPage(QWidget *parent)
|
SoundOptionsPage::SoundOptionsPage(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAINOPTIONS_H
|
#ifndef MAINOPTIONS_H
|
||||||
#define MAINOPTIONS_H
|
#define MAINOPTIONS_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
class VideoOptionsPage : public QWidget
|
class VideoOptionsPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VideoOptionsPage(QWidget *parent = 0);
|
VideoOptionsPage(QWidget *parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputOptionsPage : public QWidget
|
class InputOptionsPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputOptionsPage(QWidget *parent = 0);
|
InputOptionsPage(QWidget *parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SoundOptionsPage : public QWidget
|
class SoundOptionsPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SoundOptionsPage(QWidget *parent = 0);
|
SoundOptionsPage(QWidget *parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,383 +1,383 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#include "MainWnd.h"
|
#include "MainWnd.h"
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "configdialog.h"
|
#include "configdialog.h"
|
||||||
#include "sidewidget_cheats.h"
|
#include "sidewidget_cheats.h"
|
||||||
|
|
||||||
|
|
||||||
MainWnd::MainWnd( QTranslator **trans, QSettings *settings, QWidget *parent )
|
MainWnd::MainWnd( QTranslator **trans, QSettings *settings, QWidget *parent )
|
||||||
: QMainWindow( parent ),
|
: QMainWindow( parent ),
|
||||||
translator( trans ),
|
translator( trans ),
|
||||||
settings( settings ),
|
settings( settings ),
|
||||||
fileMenu( 0 ),
|
fileMenu( 0 ),
|
||||||
settingsMenu( 0 ),
|
settingsMenu( 0 ),
|
||||||
toolsMenu( 0 ),
|
toolsMenu( 0 ),
|
||||||
helpMenu( 0 ),
|
helpMenu( 0 ),
|
||||||
enableTranslationAct( 0 ),
|
enableTranslationAct( 0 ),
|
||||||
dockWidget_cheats( 0 ),
|
dockWidget_cheats( 0 ),
|
||||||
emuManager( 0 ),
|
emuManager( 0 ),
|
||||||
graphicsOutput( 0 )
|
graphicsOutput( 0 )
|
||||||
{
|
{
|
||||||
createDisplay();
|
createDisplay();
|
||||||
setMinimumSize( 320, 240 );
|
setMinimumSize( 320, 240 );
|
||||||
setWindowTitle( "VBA-M" );
|
setWindowTitle( "VBA-M" );
|
||||||
|
|
||||||
createDockWidgets();
|
createDockWidgets();
|
||||||
createActions();
|
createActions();
|
||||||
createMenus();
|
createMenus();
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
emuManager = new EmuManager();
|
emuManager = new EmuManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWnd::~MainWnd()
|
MainWnd::~MainWnd()
|
||||||
{
|
{
|
||||||
if( emuManager != 0 ) {
|
if( emuManager != 0 ) {
|
||||||
delete emuManager;
|
delete emuManager;
|
||||||
emuManager = 0;
|
emuManager = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( graphicsOutput != 0 ) {
|
if( graphicsOutput != 0 ) {
|
||||||
delete graphicsOutput;
|
delete graphicsOutput;
|
||||||
graphicsOutput = 0;
|
graphicsOutput = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::loadSettings()
|
void MainWnd::loadSettings()
|
||||||
{
|
{
|
||||||
QVariant v;
|
QVariant v;
|
||||||
|
|
||||||
v = settings->value( "MainWnd/geometry");
|
v = settings->value( "MainWnd/geometry");
|
||||||
if( v.isValid() ) {
|
if( v.isValid() ) {
|
||||||
restoreGeometry( v.toByteArray() );
|
restoreGeometry( v.toByteArray() );
|
||||||
}
|
}
|
||||||
|
|
||||||
v = settings->value( "MainWnd/state" );
|
v = settings->value( "MainWnd/state" );
|
||||||
if( v.isValid() ) {
|
if( v.isValid() ) {
|
||||||
restoreState( v.toByteArray() );
|
restoreState( v.toByteArray() );
|
||||||
}
|
}
|
||||||
|
|
||||||
v = settings->value( "App/language_file" );
|
v = settings->value( "App/language_file" );
|
||||||
if( v.isValid() ) {
|
if( v.isValid() ) {
|
||||||
languageFile = v.toString();
|
languageFile = v.toString();
|
||||||
if( loadTranslation() ) {
|
if( loadTranslation() ) {
|
||||||
// only enable language if it loaded correctly
|
// only enable language if it loaded correctly
|
||||||
v = settings->value( "App/language_enable" );
|
v = settings->value( "App/language_enable" );
|
||||||
enableTranslation( v.toBool() );
|
enableTranslation( v.toBool() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::saveSettings()
|
void MainWnd::saveSettings()
|
||||||
{
|
{
|
||||||
QVariant v;
|
QVariant v;
|
||||||
|
|
||||||
v = saveGeometry();
|
v = saveGeometry();
|
||||||
settings->setValue( "MainWnd/geometry", v );
|
settings->setValue( "MainWnd/geometry", v );
|
||||||
|
|
||||||
// state of toolbars and dock widgets
|
// state of toolbars and dock widgets
|
||||||
// all memorizable widgets need an objectName!
|
// all memorizable widgets need an objectName!
|
||||||
v = saveState();
|
v = saveState();
|
||||||
settings->setValue( "MainWnd/state", v );
|
settings->setValue( "MainWnd/state", v );
|
||||||
|
|
||||||
v = enableTranslationAct->isChecked();
|
v = enableTranslationAct->isChecked();
|
||||||
settings->setValue( "App/language_enable", v );
|
settings->setValue( "App/language_enable", v );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::createActions()
|
void MainWnd::createActions()
|
||||||
{
|
{
|
||||||
bool enabled, checked;
|
bool enabled, checked;
|
||||||
|
|
||||||
|
|
||||||
if( enableTranslationAct != 0 ) {
|
if( enableTranslationAct != 0 ) {
|
||||||
enabled = enableTranslationAct->isEnabled(); // memorize state
|
enabled = enableTranslationAct->isEnabled(); // memorize state
|
||||||
checked = enableTranslationAct->isChecked();
|
checked = enableTranslationAct->isChecked();
|
||||||
delete enableTranslationAct;
|
delete enableTranslationAct;
|
||||||
enableTranslationAct = 0;
|
enableTranslationAct = 0;
|
||||||
} else {
|
} else {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
checked = false;
|
checked = false;
|
||||||
}
|
}
|
||||||
enableTranslationAct = new QAction( tr( "Enable translation" ), this );
|
enableTranslationAct = new QAction( tr( "Enable translation" ), this );
|
||||||
enableTranslationAct->setEnabled( enabled );
|
enableTranslationAct->setEnabled( enabled );
|
||||||
enableTranslationAct->setCheckable( true );
|
enableTranslationAct->setCheckable( true );
|
||||||
enableTranslationAct->setChecked( checked );
|
enableTranslationAct->setChecked( checked );
|
||||||
connect( enableTranslationAct, SIGNAL( toggled( bool ) ), this, SLOT( enableTranslation( bool ) ) );
|
connect( enableTranslationAct, SIGNAL( toggled( bool ) ), this, SLOT( enableTranslation( bool ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::createMenus()
|
void MainWnd::createMenus()
|
||||||
{
|
{
|
||||||
if( fileMenu ) {
|
if( fileMenu ) {
|
||||||
delete fileMenu;
|
delete fileMenu;
|
||||||
fileMenu = 0;
|
fileMenu = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( settingsMenu ) {
|
if( settingsMenu ) {
|
||||||
delete settingsMenu;
|
delete settingsMenu;
|
||||||
settingsMenu = 0;
|
settingsMenu = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( toolsMenu ) {
|
if( toolsMenu ) {
|
||||||
delete toolsMenu;
|
delete toolsMenu;
|
||||||
toolsMenu = 0;
|
toolsMenu = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( helpMenu ) {
|
if( helpMenu ) {
|
||||||
delete helpMenu;
|
delete helpMenu;
|
||||||
helpMenu = 0;
|
helpMenu = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// File menu
|
// File menu
|
||||||
fileMenu = menuBar()->addMenu( tr( "File" ) );
|
fileMenu = menuBar()->addMenu( tr( "File" ) );
|
||||||
fileMenu->addAction( QIcon( ":/resources/open.png" ), tr( "Open ROM" ), this, SLOT( showOpenROM() ) );
|
fileMenu->addAction( QIcon( ":/resources/open.png" ), tr( "Open ROM" ), this, SLOT( showOpenROM() ) );
|
||||||
fileMenu->addAction( QIcon( ":/resources/exit.png" ), tr( "Exit" ), this, SLOT( close() ) );
|
fileMenu->addAction( QIcon( ":/resources/exit.png" ), tr( "Exit" ), this, SLOT( close() ) );
|
||||||
|
|
||||||
|
|
||||||
// Settings menu
|
// Settings menu
|
||||||
settingsMenu = menuBar()->addMenu( tr( "Settings" ) );
|
settingsMenu = menuBar()->addMenu( tr( "Settings" ) );
|
||||||
settingsMenu->addAction( QIcon( ":/resources/settings.png" ), tr( "Main options..." ), this, SLOT( showMainOptions() ) );
|
settingsMenu->addAction( QIcon( ":/resources/settings.png" ), tr( "Main options..." ), this, SLOT( showMainOptions() ) );
|
||||||
settingsMenu->addAction( QIcon( ":/resources/locale.png" ), tr( "Select language..." ), this, SLOT( selectLanguage() ) );
|
settingsMenu->addAction( QIcon( ":/resources/locale.png" ), tr( "Select language..." ), this, SLOT( selectLanguage() ) );
|
||||||
settingsMenu->addAction( enableTranslationAct );
|
settingsMenu->addAction( enableTranslationAct );
|
||||||
|
|
||||||
|
|
||||||
// Tools menu
|
// Tools menu
|
||||||
toolsMenu = menuBar()->addMenu( tr( "Tools" ) );
|
toolsMenu = menuBar()->addMenu( tr( "Tools" ) );
|
||||||
QAction *toggleCheats = dockWidget_cheats->toggleViewAction();
|
QAction *toggleCheats = dockWidget_cheats->toggleViewAction();
|
||||||
toggleCheats->setText( tr( "Show cheats sidebar" ) );
|
toggleCheats->setText( tr( "Show cheats sidebar" ) );
|
||||||
toolsMenu->addAction( toggleCheats ) ;
|
toolsMenu->addAction( toggleCheats ) ;
|
||||||
|
|
||||||
|
|
||||||
// Help menu
|
// Help menu
|
||||||
helpMenu = menuBar()->addMenu( tr( "Help" ) );
|
helpMenu = menuBar()->addMenu( tr( "Help" ) );
|
||||||
|
|
||||||
helpMenu->addAction( QIcon( ":/resources/vba-m.png" ), tr( "About VBA-M..." ), this, SLOT( showAbout() ) );
|
helpMenu->addAction( QIcon( ":/resources/vba-m.png" ), tr( "About VBA-M..." ), this, SLOT( showAbout() ) );
|
||||||
helpMenu->addAction( QIcon( ":/resources/gl.png" ), tr( "About OpenGL..." ), this, SLOT( showAboutOpenGL() ) );
|
helpMenu->addAction( QIcon( ":/resources/gl.png" ), tr( "About OpenGL..." ), this, SLOT( showAboutOpenGL() ) );
|
||||||
helpMenu->addAction( QIcon( ":/resources/qt_logo.png" ), tr( "About Qt..." ), qApp, SLOT( aboutQt() ) );
|
helpMenu->addAction( QIcon( ":/resources/qt_logo.png" ), tr( "About Qt..." ), qApp, SLOT( aboutQt() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::createDockWidgets()
|
void MainWnd::createDockWidgets()
|
||||||
{
|
{
|
||||||
if( dockWidget_cheats != 0 ) {
|
if( dockWidget_cheats != 0 ) {
|
||||||
delete dockWidget_cheats;
|
delete dockWidget_cheats;
|
||||||
dockWidget_cheats = 0;
|
dockWidget_cheats = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cheat Widget
|
// Cheat Widget
|
||||||
dockWidget_cheats = new QDockWidget( tr( "Cheats" ), this );
|
dockWidget_cheats = new QDockWidget( tr( "Cheats" ), this );
|
||||||
dockWidget_cheats->setObjectName( "dockWidget_cheats" ); // necessary for MainWnd::saveState
|
dockWidget_cheats->setObjectName( "dockWidget_cheats" ); // necessary for MainWnd::saveState
|
||||||
SideWidget_Cheats *sw_cheats = new SideWidget_Cheats( dockWidget_cheats );
|
SideWidget_Cheats *sw_cheats = new SideWidget_Cheats( dockWidget_cheats );
|
||||||
dockWidget_cheats->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
dockWidget_cheats->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
|
||||||
dockWidget_cheats->setWidget( sw_cheats );
|
dockWidget_cheats->setWidget( sw_cheats );
|
||||||
addDockWidget( Qt::LeftDockWidgetArea, dockWidget_cheats );
|
addDockWidget( Qt::LeftDockWidgetArea, dockWidget_cheats );
|
||||||
dockWidget_cheats->hide();
|
dockWidget_cheats->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MainWnd::createDisplay()
|
bool MainWnd::createDisplay()
|
||||||
{
|
{
|
||||||
if( graphicsOutput != 0 ) {
|
if( graphicsOutput != 0 ) {
|
||||||
delete graphicsOutput;
|
delete graphicsOutput;
|
||||||
graphicsOutput = 0;
|
graphicsOutput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
graphicsOutput = new GraphicsOutput( this );
|
graphicsOutput = new GraphicsOutput( this );
|
||||||
|
|
||||||
if( !graphicsOutput->setAPI( GraphicsOutput::QPAINTER ) ) return false;
|
if( !graphicsOutput->setAPI( GraphicsOutput::QPAINTER ) ) return false;
|
||||||
|
|
||||||
setCentralWidget( graphicsOutput );
|
setCentralWidget( graphicsOutput );
|
||||||
|
|
||||||
QTimer *timer = new QTimer( this );
|
QTimer *timer = new QTimer( this );
|
||||||
connect( timer, SIGNAL( timeout() ), graphicsOutput, SLOT( render() ) );
|
connect( timer, SIGNAL( timeout() ), graphicsOutput, SLOT( render() ) );
|
||||||
timer->start( 15 ); // set to 0 for idle time processing
|
timer->start( 15 ); // set to 0 for idle time processing
|
||||||
// 1000 / 60 = 60 fps, but only results to 40 fps in reality.
|
// 1000 / 60 = 60 fps, but only results to 40 fps in reality.
|
||||||
// possible workaround: call timer more often and return or wait if too early
|
// possible workaround: call timer more often and return or wait if too early
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::closeEvent( QCloseEvent * )
|
void MainWnd::closeEvent( QCloseEvent * )
|
||||||
{
|
{
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MainWnd::selectLanguage()
|
bool MainWnd::selectLanguage()
|
||||||
{
|
{
|
||||||
QString file = QFileDialog::getOpenFileName(
|
QString file = QFileDialog::getOpenFileName(
|
||||||
this,
|
this,
|
||||||
tr( "Select language" ),
|
tr( "Select language" ),
|
||||||
"lang",
|
"lang",
|
||||||
tr( "Language files (*.qm)" ) );
|
tr( "Language files (*.qm)" ) );
|
||||||
|
|
||||||
if( file.isNull() ) return false;
|
if( file.isNull() ) return false;
|
||||||
|
|
||||||
languageFile = file;
|
languageFile = file;
|
||||||
|
|
||||||
bool ret = loadTranslation();
|
bool ret = loadTranslation();
|
||||||
ret &= enableTranslation( true );
|
ret &= enableTranslation( true );
|
||||||
|
|
||||||
if( ret == false ) {
|
if( ret == false ) {
|
||||||
QMessageBox::critical( this, tr( "Error!" ), tr( "Language file can not be loaded!" ) );
|
QMessageBox::critical( this, tr( "Error!" ), tr( "Language file can not be loaded!" ) );
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MainWnd::loadTranslation()
|
bool MainWnd::loadTranslation()
|
||||||
{
|
{
|
||||||
settings->setValue( "App/language_file", languageFile );
|
settings->setValue( "App/language_file", languageFile );
|
||||||
if( !languageFile.endsWith( tr( ".qm" ), Qt::CaseInsensitive ) ) return false;
|
if( !languageFile.endsWith( tr( ".qm" ), Qt::CaseInsensitive ) ) return false;
|
||||||
QString file = languageFile;
|
QString file = languageFile;
|
||||||
|
|
||||||
// remove current translation
|
// remove current translation
|
||||||
enableTranslation( false );
|
enableTranslation( false );
|
||||||
if( *translator != 0 ) {
|
if( *translator != 0 ) {
|
||||||
delete *translator;
|
delete *translator;
|
||||||
*translator = 0;
|
*translator = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.chop( 3 ); // remove file extension ".qm"
|
file.chop( 3 ); // remove file extension ".qm"
|
||||||
|
|
||||||
// load new translation
|
// load new translation
|
||||||
*translator = new QTranslator();
|
*translator = new QTranslator();
|
||||||
bool ret = (*translator)->load( file );
|
bool ret = (*translator)->load( file );
|
||||||
enableTranslationAct->setEnabled( ret );
|
enableTranslationAct->setEnabled( ret );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MainWnd::enableTranslation( bool enable )
|
bool MainWnd::enableTranslation( bool enable )
|
||||||
{
|
{
|
||||||
if( enable ) {
|
if( enable ) {
|
||||||
if( *translator != 0 ) {
|
if( *translator != 0 ) {
|
||||||
qApp->installTranslator( *translator );
|
qApp->installTranslator( *translator );
|
||||||
enableTranslationAct->setChecked( true );
|
enableTranslationAct->setChecked( true );
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( *translator != 0 ) {
|
if( *translator != 0 ) {
|
||||||
qApp->removeTranslator( *translator );
|
qApp->removeTranslator( *translator );
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply translation
|
// apply translation
|
||||||
// the user might have to restart the application to apply changes completely
|
// the user might have to restart the application to apply changes completely
|
||||||
QByteArray windowState = saveState();
|
QByteArray windowState = saveState();
|
||||||
createDockWidgets();
|
createDockWidgets();
|
||||||
createActions();
|
createActions();
|
||||||
createMenus();
|
createMenus();
|
||||||
restoreState( windowState );
|
restoreState( windowState );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::showAbout()
|
void MainWnd::showAbout()
|
||||||
{
|
{
|
||||||
QString info( "VisualBoyAdvance-M\n" );
|
QString info( "VisualBoyAdvance-M\n" );
|
||||||
info += tr( "Version" ) + " " + VERSION_STR + "\n";
|
info += tr( "Version" ) + " " + VERSION_STR + "\n";
|
||||||
|
|
||||||
info += tr( "Compile date:" ) + " " + __DATE__ + "\n";
|
info += tr( "Compile date:" ) + " " + __DATE__ + "\n";
|
||||||
|
|
||||||
// translators may use this string to give informations about the language file
|
// translators may use this string to give informations about the language file
|
||||||
info += "\n" + tr ( "No language file loaded." ) + "\n";
|
info += "\n" + tr ( "No language file loaded." ) + "\n";
|
||||||
|
|
||||||
info += "\n" + tr ( "This program is licensed under terms of the GNU General Public License." );
|
info += "\n" + tr ( "This program is licensed under terms of the GNU General Public License." );
|
||||||
|
|
||||||
QMessageBox::about( this, tr( "About VBA-M" ), info );
|
QMessageBox::about( this, tr( "About VBA-M" ), info );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::showOpenROM()
|
void MainWnd::showOpenROM()
|
||||||
{
|
{
|
||||||
QString file = QFileDialog::getOpenFileName(
|
QString file = QFileDialog::getOpenFileName(
|
||||||
this,
|
this,
|
||||||
tr( "Select ROM" ),
|
tr( "Select ROM" ),
|
||||||
"",
|
"",
|
||||||
tr( "Game Boy Advance ROMs (*.gba);;All Files (*.*)" ) );
|
tr( "Game Boy Advance ROMs (*.gba);;All Files (*.*)" ) );
|
||||||
|
|
||||||
if( file.isNull() ) return;
|
if( file.isNull() ) return;
|
||||||
|
|
||||||
emuManager->setROM( file );
|
emuManager->setROM( file );
|
||||||
if( !emuManager->loadROM() ) {
|
if( !emuManager->loadROM() ) {
|
||||||
QMessageBox::critical( this, tr( "Error!" ), tr( "Can not load ROM!" ) );
|
QMessageBox::critical( this, tr( "Error!" ), tr( "Can not load ROM!" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: start emulation
|
// TODO: start emulation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::showMainOptions()
|
void MainWnd::showMainOptions()
|
||||||
{
|
{
|
||||||
ConfigDialog dialog;
|
ConfigDialog dialog;
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWnd::showAboutOpenGL()
|
void MainWnd::showAboutOpenGL()
|
||||||
{
|
{
|
||||||
QString info;
|
QString info;
|
||||||
if( QGLFormat::hasOpenGL() ) {
|
if( QGLFormat::hasOpenGL() ) {
|
||||||
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
|
QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
|
||||||
if( flags & QGLFormat::OpenGL_Version_2_1 ) {
|
if( flags & QGLFormat::OpenGL_Version_2_1 ) {
|
||||||
info = tr( "OpenGL version 2.1 is present." );
|
info = tr( "OpenGL version 2.1 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_2_0 ) {
|
if( flags & QGLFormat::OpenGL_Version_2_0 ) {
|
||||||
info = tr( "OpenGL version 2.0 is present." );
|
info = tr( "OpenGL version 2.0 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_1_5 ) {
|
if( flags & QGLFormat::OpenGL_Version_1_5 ) {
|
||||||
info = tr( "OpenGL version 1.5 is present." );
|
info = tr( "OpenGL version 1.5 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_1_4 ) {
|
if( flags & QGLFormat::OpenGL_Version_1_4 ) {
|
||||||
info = tr( "OpenGL version 1.4 is present." );
|
info = tr( "OpenGL version 1.4 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_1_3 ) {
|
if( flags & QGLFormat::OpenGL_Version_1_3 ) {
|
||||||
info = tr( "OpenGL version 1.3 is present." );
|
info = tr( "OpenGL version 1.3 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_1_2 ) {
|
if( flags & QGLFormat::OpenGL_Version_1_2 ) {
|
||||||
info = tr( "OpenGL version 1.2 is present." );
|
info = tr( "OpenGL version 1.2 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_1_1 ) {
|
if( flags & QGLFormat::OpenGL_Version_1_1 ) {
|
||||||
info = tr( "OpenGL version 1.1 is present." );
|
info = tr( "OpenGL version 1.1 is present." );
|
||||||
} else
|
} else
|
||||||
if( flags & QGLFormat::OpenGL_Version_None ) {
|
if( flags & QGLFormat::OpenGL_Version_None ) {
|
||||||
info = tr( "OpenGL is NOT available!" );
|
info = tr( "OpenGL is NOT available!" );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info = tr( "OpenGL is NOT available!" );
|
info = tr( "OpenGL is NOT available!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox *test = new QMessageBox( QMessageBox::NoIcon, tr( "About OpenGL" ), info, QMessageBox::NoButton, this );
|
QMessageBox *test = new QMessageBox( QMessageBox::NoIcon, tr( "About OpenGL" ), info, QMessageBox::NoButton, this );
|
||||||
test->setWindowIcon( QIcon( ":/resources/gl.png" ) );
|
test->setWindowIcon( QIcon( ":/resources/gl.png" ) );
|
||||||
test->show();
|
test->show();
|
||||||
}
|
}
|
||||||
|
|
136
src/qt/MainWnd.h
136
src/qt/MainWnd.h
|
@ -1,68 +1,68 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAINWND_H
|
#ifndef MAINWND_H
|
||||||
#define MAINWND_H
|
#define MAINWND_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
#include "EmuManager.h"
|
#include "EmuManager.h"
|
||||||
#include "GraphicsOutput.h"
|
#include "GraphicsOutput.h"
|
||||||
|
|
||||||
class MainWnd : public QMainWindow
|
class MainWnd : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWnd( QTranslator **trans, QSettings *settings, QWidget *parent = 0 );
|
MainWnd( QTranslator **trans, QSettings *settings, QWidget *parent = 0 );
|
||||||
~MainWnd();
|
~MainWnd();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void closeEvent( QCloseEvent * );
|
void closeEvent( QCloseEvent * );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
bool loadTranslation();
|
bool loadTranslation();
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void createDockWidgets();
|
void createDockWidgets();
|
||||||
bool createDisplay();
|
bool createDisplay();
|
||||||
|
|
||||||
QTranslator **translator;
|
QTranslator **translator;
|
||||||
QString languageFile;
|
QString languageFile;
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu;
|
||||||
QMenu *settingsMenu;
|
QMenu *settingsMenu;
|
||||||
QAction *enableTranslationAct;
|
QAction *enableTranslationAct;
|
||||||
QMenu *toolsMenu;
|
QMenu *toolsMenu;
|
||||||
QMenu *helpMenu;
|
QMenu *helpMenu;
|
||||||
QDockWidget *dockWidget_cheats;
|
QDockWidget *dockWidget_cheats;
|
||||||
EmuManager *emuManager;
|
EmuManager *emuManager;
|
||||||
GraphicsOutput *graphicsOutput;
|
GraphicsOutput *graphicsOutput;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
bool selectLanguage();
|
bool selectLanguage();
|
||||||
bool enableTranslation( bool enable );
|
bool enableTranslation( bool enable );
|
||||||
void showAbout();
|
void showAbout();
|
||||||
void showAboutOpenGL();
|
void showAboutOpenGL();
|
||||||
void showOpenROM();
|
void showOpenROM();
|
||||||
void showMainOptions();
|
void showMainOptions();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef MAINWND_H
|
#endif // #ifndef MAINWND_H
|
||||||
|
|
|
@ -1,97 +1,97 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#include "configdialog.h"
|
#include "configdialog.h"
|
||||||
|
|
||||||
#include "MainOptions.h"
|
#include "MainOptions.h"
|
||||||
|
|
||||||
ConfigDialog::ConfigDialog()
|
ConfigDialog::ConfigDialog()
|
||||||
{
|
{
|
||||||
// close button
|
// close button
|
||||||
QPushButton *closeButton = new QPushButton( tr( "Close" ) );
|
QPushButton *closeButton = new QPushButton( tr( "Close" ) );
|
||||||
closeButton->setMaximumSize( closeButton->sizeHint() );
|
closeButton->setMaximumSize( closeButton->sizeHint() );
|
||||||
connect( closeButton, SIGNAL( clicked() ), this, SLOT( close() ) );
|
connect( closeButton, SIGNAL( clicked() ), this, SLOT( close() ) );
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
pagesWidget = new QStackedWidget;
|
pagesWidget = new QStackedWidget;
|
||||||
pagesWidget->addWidget( new VideoOptionsPage( pagesWidget ) );
|
pagesWidget->addWidget( new VideoOptionsPage( pagesWidget ) );
|
||||||
pagesWidget->addWidget( new SoundOptionsPage( pagesWidget ) );
|
pagesWidget->addWidget( new SoundOptionsPage( pagesWidget ) );
|
||||||
pagesWidget->addWidget( new InputOptionsPage( pagesWidget ) );
|
pagesWidget->addWidget( new InputOptionsPage( pagesWidget ) );
|
||||||
|
|
||||||
// item box
|
// item box
|
||||||
contentsWidget = new QListWidget;
|
contentsWidget = new QListWidget;
|
||||||
contentsWidget->setViewMode( QListView::IconMode );
|
contentsWidget->setViewMode( QListView::IconMode );
|
||||||
contentsWidget->setIconSize( QSize( 64, 64 ) );
|
contentsWidget->setIconSize( QSize( 64, 64 ) );
|
||||||
contentsWidget->setUniformItemSizes( true ); // enable optimizations
|
contentsWidget->setUniformItemSizes( true ); // enable optimizations
|
||||||
contentsWidget->setMovement( QListView::Static );
|
contentsWidget->setMovement( QListView::Static );
|
||||||
contentsWidget->setResizeMode( QListView::Adjust );
|
contentsWidget->setResizeMode( QListView::Adjust );
|
||||||
contentsWidget->setFlow( QListView::TopToBottom );
|
contentsWidget->setFlow( QListView::TopToBottom );
|
||||||
contentsWidget->setSpacing( 8 );
|
contentsWidget->setSpacing( 8 );
|
||||||
createIcons();
|
createIcons();
|
||||||
contentsWidget->setCurrentRow( 0 );
|
contentsWidget->setCurrentRow( 0 );
|
||||||
// set optimal width
|
// set optimal width
|
||||||
int width = contentsWidget->sizeHintForColumn( 0 ) + 16; // not 100% accurate yet!
|
int width = contentsWidget->sizeHintForColumn( 0 ) + 16; // not 100% accurate yet!
|
||||||
contentsWidget->setMinimumWidth( width );
|
contentsWidget->setMinimumWidth( width );
|
||||||
contentsWidget->setMaximumWidth( width );
|
contentsWidget->setMaximumWidth( width );
|
||||||
|
|
||||||
// set up layout
|
// set up layout
|
||||||
QVBoxLayout *verticalLayout = new QVBoxLayout;
|
QVBoxLayout *verticalLayout = new QVBoxLayout;
|
||||||
verticalLayout->addWidget( pagesWidget );
|
verticalLayout->addWidget( pagesWidget );
|
||||||
verticalLayout->addWidget( closeButton, 0, Qt::AlignRight );
|
verticalLayout->addWidget( closeButton, 0, Qt::AlignRight );
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout( this );
|
QHBoxLayout *horizontalLayout = new QHBoxLayout( this );
|
||||||
horizontalLayout->addWidget( contentsWidget );
|
horizontalLayout->addWidget( contentsWidget );
|
||||||
horizontalLayout->addLayout( verticalLayout );
|
horizontalLayout->addLayout( verticalLayout );
|
||||||
|
|
||||||
|
|
||||||
setWindowTitle(tr("Options"));
|
setWindowTitle(tr("Options"));
|
||||||
setWindowIcon( QIcon( ":/resources/settings.png" ) );
|
setWindowIcon( QIcon( ":/resources/settings.png" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::createIcons()
|
void ConfigDialog::createIcons()
|
||||||
{
|
{
|
||||||
QListWidgetItem *VideoButton = new QListWidgetItem(contentsWidget); // automatically inserts item into parent
|
QListWidgetItem *VideoButton = new QListWidgetItem(contentsWidget); // automatically inserts item into parent
|
||||||
VideoButton->setIcon(QIcon(":/resources/video.png"));
|
VideoButton->setIcon(QIcon(":/resources/video.png"));
|
||||||
VideoButton->setText(tr("Video"));
|
VideoButton->setText(tr("Video"));
|
||||||
VideoButton->setTextAlignment(Qt::AlignHCenter);
|
VideoButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
VideoButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
VideoButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QListWidgetItem *SoundButton = new QListWidgetItem(contentsWidget);
|
QListWidgetItem *SoundButton = new QListWidgetItem(contentsWidget);
|
||||||
SoundButton->setIcon(QIcon(":/resources/sound.png"));
|
SoundButton->setIcon(QIcon(":/resources/sound.png"));
|
||||||
SoundButton->setText(tr("Sound"));
|
SoundButton->setText(tr("Sound"));
|
||||||
SoundButton->setTextAlignment(Qt::AlignHCenter);
|
SoundButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
SoundButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
SoundButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
QListWidgetItem *InputButton = new QListWidgetItem(contentsWidget);
|
QListWidgetItem *InputButton = new QListWidgetItem(contentsWidget);
|
||||||
InputButton->setIcon(QIcon(":/resources/input.png"));
|
InputButton->setIcon(QIcon(":/resources/input.png"));
|
||||||
InputButton->setText(tr("Input"));
|
InputButton->setText(tr("Input"));
|
||||||
InputButton->setTextAlignment(Qt::AlignHCenter);
|
InputButton->setTextAlignment(Qt::AlignHCenter);
|
||||||
InputButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
InputButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
connect(contentsWidget,
|
connect(contentsWidget,
|
||||||
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
|
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
|
||||||
this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
|
this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
{
|
{
|
||||||
if (!current)
|
if (!current)
|
||||||
current = previous;
|
current = previous;
|
||||||
|
|
||||||
pagesWidget->setCurrentIndex(contentsWidget->row(current));
|
pagesWidget->setCurrentIndex(contentsWidget->row(current));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIGDIALOG_H
|
#ifndef CONFIGDIALOG_H
|
||||||
#define CONFIGDIALOG_H
|
#define CONFIGDIALOG_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
class ConfigDialog : public QDialog
|
class ConfigDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConfigDialog();
|
ConfigDialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void changePage( QListWidgetItem *current, QListWidgetItem *previous );
|
void changePage( QListWidgetItem *current, QListWidgetItem *previous );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createIcons();
|
void createIcons();
|
||||||
|
|
||||||
QListWidget *contentsWidget;
|
QListWidget *contentsWidget;
|
||||||
QStackedWidget *pagesWidget;
|
QStackedWidget *pagesWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include "MainWnd.h"
|
#include "MainWnd.h"
|
||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
QApplication theApp( argc, argv );
|
QApplication theApp( argc, argv );
|
||||||
// create/open ini file for settings
|
// create/open ini file for settings
|
||||||
QSettings settings( "vba-m.ini", QSettings::IniFormat, &theApp );
|
QSettings settings( "vba-m.ini", QSettings::IniFormat, &theApp );
|
||||||
QTranslator *translator = 0;
|
QTranslator *translator = 0;
|
||||||
|
|
||||||
MainWnd *mainWnd = new MainWnd( &translator, &settings, 0 );
|
MainWnd *mainWnd = new MainWnd( &translator, &settings, 0 );
|
||||||
mainWnd->show();
|
mainWnd->show();
|
||||||
|
|
||||||
return theApp.exec();
|
return theApp.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef MAIN_H
|
#ifndef MAIN_H
|
||||||
#define MAIN_H
|
#define MAIN_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
#endif // #ifndef MAIN_H
|
#endif // #ifndef MAIN_H
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef PRECOMPILE_H
|
#ifndef PRECOMPILE_H
|
||||||
#define PRECOMPILE_H
|
#define PRECOMPILE_H
|
||||||
|
|
||||||
#if defined __cplusplus
|
#if defined __cplusplus
|
||||||
// Add C++ includes here
|
// Add C++ includes here
|
||||||
#include <QtGui/QtGui>
|
#include <QtGui/QtGui>
|
||||||
#include <QtOpenGL/QtOpenGL>
|
#include <QtOpenGL/QtOpenGL>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // #ifndef PRECOMPILE_H
|
#endif // #ifndef PRECOMPILE_H
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "sidewidget_cheats.h"
|
#include "sidewidget_cheats.h"
|
||||||
|
|
||||||
SideWidget_Cheats::SideWidget_Cheats( QWidget *parent )
|
SideWidget_Cheats::SideWidget_Cheats( QWidget *parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
{
|
{
|
||||||
ui.setupUi( this );
|
ui.setupUi( this );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef SIDEWIDGET_CHEAT_H
|
#ifndef SIDEWIDGET_CHEAT_H
|
||||||
#define SIDEWIDGET_CHEAT_H
|
#define SIDEWIDGET_CHEAT_H
|
||||||
|
|
||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
#include "ui_sidewidget_cheats.h"
|
#include "ui_sidewidget_cheats.h"
|
||||||
|
|
||||||
class SideWidget_Cheats : public QWidget
|
class SideWidget_Cheats : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SideWidget_Cheats( QWidget *parent = 0 );
|
SideWidget_Cheats( QWidget *parent = 0 );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::sidewidget_cheats ui;
|
Ui::sidewidget_cheats ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef SIDEWIDGET_CHEAT_H
|
#endif // #ifndef SIDEWIDGET_CHEAT_H
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
// VBA-M, A Nintendo Handheld Console Emulator
|
// VBA-M, A Nintendo Handheld Console Emulator
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef VERSION_H
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
// Windows VERSIONINFO compatible
|
// Windows VERSIONINFO compatible
|
||||||
#define VERSION 0,0,0,0
|
#define VERSION 0,0,0,0
|
||||||
|
|
||||||
#define VERSION_STR "SVN"
|
#define VERSION_STR "SVN"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ void sdlInitVideo() {
|
||||||
screenWidth = destWidth;
|
screenWidth = destWidth;
|
||||||
screenHeight = destHeight;
|
screenHeight = destHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = SDL_SetVideoMode(screenWidth, screenHeight, 0, flags);
|
surface = SDL_SetVideoMode(screenWidth, screenHeight, 0, flags);
|
||||||
|
|
||||||
if(surface == NULL) {
|
if(surface == NULL) {
|
||||||
|
@ -1601,7 +1601,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// Get home dir
|
// Get home dir
|
||||||
homeDir = getenv("HOME");
|
homeDir = getenv("HOME");
|
||||||
|
@ -2097,7 +2097,7 @@ void drawSpeed(u8 *screen, int pitch, int x, int y)
|
||||||
sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed,
|
sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed,
|
||||||
systemFrameSkip,
|
systemFrameSkip,
|
||||||
showRenderedFrames);
|
showRenderedFrames);
|
||||||
|
|
||||||
drawText(screen, pitch, x, y, buffer, showSpeedTransparent);
|
drawText(screen, pitch, x, y, buffer, showSpeedTransparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1340
src/sdl/filters.cpp
1340
src/sdl/filters.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,61 +1,61 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004-2008 Forgotten and the VBA development team
|
// Copyright (C) 2004-2008 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef VBA_SDL_FILTERS_H
|
#ifndef VBA_SDL_FILTERS_H
|
||||||
#define VBA_SDL_FILTERS_H
|
#define VBA_SDL_FILTERS_H
|
||||||
|
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Screen filters
|
// Screen filters
|
||||||
//
|
//
|
||||||
|
|
||||||
// List of available filters
|
// List of available filters
|
||||||
enum Filter { kStretch1x, kStretch2x, k2xSaI, kSuper2xSaI, kSuperEagle, kPixelate,
|
enum Filter { kStretch1x, kStretch2x, k2xSaI, kSuper2xSaI, kSuperEagle, kPixelate,
|
||||||
kAdMame2x, kBilinear, kBilinearPlus, kScanlines, kScanlinesTV,
|
kAdMame2x, kBilinear, kBilinearPlus, kScanlines, kScanlinesTV,
|
||||||
klq2x, khq2x, kStretch3x, khq3x, kStretch4x, khq4x, kInvalidFilter };
|
klq2x, khq2x, kStretch3x, khq3x, kStretch4x, khq4x, kInvalidFilter };
|
||||||
|
|
||||||
// Function pointer type for a filter function
|
// Function pointer type for a filter function
|
||||||
typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int);
|
typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int);
|
||||||
|
|
||||||
// Initialize a filter and get the corresponding filter function pointer
|
// Initialize a filter and get the corresponding filter function pointer
|
||||||
FilterFunc initFilter(const Filter f, const int colorDepth, const int srcWidth);
|
FilterFunc initFilter(const Filter f, const int colorDepth, const int srcWidth);
|
||||||
|
|
||||||
// Get the enlarge factor of a filter
|
// Get the enlarge factor of a filter
|
||||||
int getFilterEnlargeFactor(const Filter f);
|
int getFilterEnlargeFactor(const Filter f);
|
||||||
|
|
||||||
// Get the display name for a filter
|
// Get the display name for a filter
|
||||||
char* getFilterName(const Filter f);
|
char* getFilterName(const Filter f);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Interframe filters
|
// Interframe filters
|
||||||
//
|
//
|
||||||
|
|
||||||
// List of available IFB filters
|
// List of available IFB filters
|
||||||
enum IFBFilter { kIFBNone, kIBMotionBlur, kIBSmart, kInvalidIFBFilter };
|
enum IFBFilter { kIFBNone, kIBMotionBlur, kIBSmart, kInvalidIFBFilter };
|
||||||
|
|
||||||
// Function pointer type for an IFB filter function
|
// Function pointer type for an IFB filter function
|
||||||
typedef void(*IFBFilterFunc)(u8*, u32, int, int);
|
typedef void(*IFBFilterFunc)(u8*, u32, int, int);
|
||||||
|
|
||||||
// Initialize an IFB filter and get the corresponding filter function pointer
|
// Initialize an IFB filter and get the corresponding filter function pointer
|
||||||
IFBFilterFunc initIFBFilter(const IFBFilter f, const int colorDepth);
|
IFBFilterFunc initIFBFilter(const IFBFilter f, const int colorDepth);
|
||||||
|
|
||||||
// Get the display name for an IFB filter
|
// Get the display name for an IFB filter
|
||||||
char* getIFBFilterName(const IFBFilter f);
|
char* getIFBFilterName(const IFBFilter f);
|
||||||
|
|
||||||
#endif // VBA_SDL_FILTERS_H
|
#endif // VBA_SDL_FILTERS_H
|
||||||
|
|
2120
src/sdl/getopt.c
2120
src/sdl/getopt.c
File diff suppressed because it is too large
Load Diff
282
src/sdl/getopt.h
282
src/sdl/getopt.h
|
@ -1,141 +1,141 @@
|
||||||
/* Declarations for getopt.
|
/* Declarations for getopt.
|
||||||
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000
|
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
NOTE: The canonical source of this file is maintained with the GNU C Library.
|
||||||
Bugs can be reported to bug-glibc@gnu.org.
|
Bugs can be reported to bug-glibc@gnu.org.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
This program is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
USA. */
|
USA. */
|
||||||
|
|
||||||
#ifndef _GETOPT_H
|
#ifndef _GETOPT_H
|
||||||
#define _GETOPT_H 1
|
#define _GETOPT_H 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For communication from `getopt' to the caller.
|
/* For communication from `getopt' to the caller.
|
||||||
When `getopt' finds an option that takes an argument,
|
When `getopt' finds an option that takes an argument,
|
||||||
the argument value is returned here.
|
the argument value is returned here.
|
||||||
Also, when `ordering' is RETURN_IN_ORDER,
|
Also, when `ordering' is RETURN_IN_ORDER,
|
||||||
each non-option ARGV-element is returned here. */
|
each non-option ARGV-element is returned here. */
|
||||||
|
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
|
||||||
/* Index in ARGV of the next element to be scanned.
|
/* Index in ARGV of the next element to be scanned.
|
||||||
This is used for communication to and from the caller
|
This is used for communication to and from the caller
|
||||||
and for communication between successive calls to `getopt'.
|
and for communication between successive calls to `getopt'.
|
||||||
|
|
||||||
On entry to `getopt', zero means this is the first call; initialize.
|
On entry to `getopt', zero means this is the first call; initialize.
|
||||||
|
|
||||||
When `getopt' returns -1, this is the index of the first of the
|
When `getopt' returns -1, this is the index of the first of the
|
||||||
non-option elements that the caller should itself scan.
|
non-option elements that the caller should itself scan.
|
||||||
|
|
||||||
Otherwise, `optind' communicates from one call to the next
|
Otherwise, `optind' communicates from one call to the next
|
||||||
how much of ARGV has been scanned so far. */
|
how much of ARGV has been scanned so far. */
|
||||||
|
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
|
||||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||||
for unrecognized options. */
|
for unrecognized options. */
|
||||||
|
|
||||||
extern int opterr;
|
extern int opterr;
|
||||||
|
|
||||||
/* Set to an option character which was unrecognized. */
|
/* Set to an option character which was unrecognized. */
|
||||||
|
|
||||||
extern int optopt;
|
extern int optopt;
|
||||||
|
|
||||||
/* Describe the long-named options requested by the application.
|
/* Describe the long-named options requested by the application.
|
||||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||||
of `struct option' terminated by an element containing a name which is
|
of `struct option' terminated by an element containing a name which is
|
||||||
zero.
|
zero.
|
||||||
|
|
||||||
The field `has_arg' is:
|
The field `has_arg' is:
|
||||||
no_argument (or 0) if the option does not take an argument,
|
no_argument (or 0) if the option does not take an argument,
|
||||||
required_argument (or 1) if the option requires an argument,
|
required_argument (or 1) if the option requires an argument,
|
||||||
optional_argument (or 2) if the option takes an optional argument.
|
optional_argument (or 2) if the option takes an optional argument.
|
||||||
|
|
||||||
If the field `flag' is not NULL, it points to a variable that is set
|
If the field `flag' is not NULL, it points to a variable that is set
|
||||||
to the value given in the field `val' when the option is found, but
|
to the value given in the field `val' when the option is found, but
|
||||||
left unchanged if the option is not found.
|
left unchanged if the option is not found.
|
||||||
|
|
||||||
To have a long-named option do something other than set an `int' to
|
To have a long-named option do something other than set an `int' to
|
||||||
a compiled-in constant, such as set a value from `optarg', set the
|
a compiled-in constant, such as set a value from `optarg', set the
|
||||||
option's `flag' field to zero and its `val' field to a nonzero
|
option's `flag' field to zero and its `val' field to a nonzero
|
||||||
value (the equivalent single-letter option character, if there is
|
value (the equivalent single-letter option character, if there is
|
||||||
one). For long options that have a zero `flag' field, `getopt'
|
one). For long options that have a zero `flag' field, `getopt'
|
||||||
returns the contents of the `val' field. */
|
returns the contents of the `val' field. */
|
||||||
|
|
||||||
struct option
|
struct option
|
||||||
{
|
{
|
||||||
#if defined (__STDC__) && __STDC__
|
#if defined (__STDC__) && __STDC__
|
||||||
const char *name;
|
const char *name;
|
||||||
#else
|
#else
|
||||||
char *name;
|
char *name;
|
||||||
#endif
|
#endif
|
||||||
/* has_arg can't be an enum because some compilers complain about
|
/* has_arg can't be an enum because some compilers complain about
|
||||||
type mismatches in all the code that assumes it is an int. */
|
type mismatches in all the code that assumes it is an int. */
|
||||||
int has_arg;
|
int has_arg;
|
||||||
int *flag;
|
int *flag;
|
||||||
int val;
|
int val;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||||
|
|
||||||
#define no_argument 0
|
#define no_argument 0
|
||||||
#define required_argument 1
|
#define required_argument 1
|
||||||
#define optional_argument 2
|
#define optional_argument 2
|
||||||
|
|
||||||
#if defined (__STDC__) && __STDC__
|
#if defined (__STDC__) && __STDC__
|
||||||
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
|
/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
|
||||||
undefined, we haven't run the autoconf check so provide the
|
undefined, we haven't run the autoconf check so provide the
|
||||||
declaration without arguments. If it is 0, we checked and failed
|
declaration without arguments. If it is 0, we checked and failed
|
||||||
to find the declaration so provide a fully prototyped one. If it
|
to find the declaration so provide a fully prototyped one. If it
|
||||||
is 1, we found it so don't provide any declaration at all. */
|
is 1, we found it so don't provide any declaration at all. */
|
||||||
#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT)
|
#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT)
|
||||||
/* Many other libraries have conflicting prototypes for getopt, with
|
/* Many other libraries have conflicting prototypes for getopt, with
|
||||||
differences in the consts, in stdlib.h. To avoid compilation
|
differences in the consts, in stdlib.h. To avoid compilation
|
||||||
errors, only prototype getopt for the GNU C library. */
|
errors, only prototype getopt for the GNU C library. */
|
||||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||||
#else /* not __GNU_LIBRARY__ */
|
#else /* not __GNU_LIBRARY__ */
|
||||||
# if !defined (HAVE_DECL_GETOPT)
|
# if !defined (HAVE_DECL_GETOPT)
|
||||||
extern int getopt ();
|
extern int getopt ();
|
||||||
# endif
|
# endif
|
||||||
#endif /* __GNU_LIBRARY__ */
|
#endif /* __GNU_LIBRARY__ */
|
||||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||||
const struct option *longopts, int *longind);
|
const struct option *longopts, int *longind);
|
||||||
extern int getopt_long_only (int argc, char *const *argv,
|
extern int getopt_long_only (int argc, char *const *argv,
|
||||||
const char *shortopts,
|
const char *shortopts,
|
||||||
const struct option *longopts, int *longind);
|
const struct option *longopts, int *longind);
|
||||||
|
|
||||||
/* Internal only. Users should not call this directly. */
|
/* Internal only. Users should not call this directly. */
|
||||||
extern int _getopt_internal (int argc, char *const *argv,
|
extern int _getopt_internal (int argc, char *const *argv,
|
||||||
const char *shortopts,
|
const char *shortopts,
|
||||||
const struct option *longopts, int *longind,
|
const struct option *longopts, int *longind,
|
||||||
int long_only);
|
int long_only);
|
||||||
#else /* not __STDC__ */
|
#else /* not __STDC__ */
|
||||||
extern int getopt ();
|
extern int getopt ();
|
||||||
extern int getopt_long ();
|
extern int getopt_long ();
|
||||||
extern int getopt_long_only ();
|
extern int getopt_long_only ();
|
||||||
|
|
||||||
extern int _getopt_internal ();
|
extern int _getopt_internal ();
|
||||||
#endif /* __STDC__ */
|
#endif /* __STDC__ */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* getopt.h */
|
#endif /* getopt.h */
|
||||||
|
|
|
@ -1,190 +1,190 @@
|
||||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
NOTE: This source is derived from an old version taken from the GNU C
|
NOTE: This source is derived from an old version taken from the GNU C
|
||||||
Library (glibc).
|
Library (glibc).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
This program is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
USA. */
|
USA. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
#if !defined __STDC__ || !__STDC__
|
#if !defined __STDC__ || !__STDC__
|
||||||
/* This is a separate conditional since some stdc systems
|
/* This is a separate conditional since some stdc systems
|
||||||
reject `defined (const)'. */
|
reject `defined (const)'. */
|
||||||
#ifndef const
|
#ifndef const
|
||||||
#define const
|
#define const
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||||
actually compiling the library itself. This code is part of the GNU C
|
actually compiling the library itself. This code is part of the GNU C
|
||||||
Library, but also included in many other GNU distributions. Compiling
|
Library, but also included in many other GNU distributions. Compiling
|
||||||
and linking in this code is a waste when using the GNU C library
|
and linking in this code is a waste when using the GNU C library
|
||||||
(especially if it is a shared library). Rather than having every GNU
|
(especially if it is a shared library). Rather than having every GNU
|
||||||
program understand `configure --with-gnu-libc' and omit the object files,
|
program understand `configure --with-gnu-libc' and omit the object files,
|
||||||
it is simpler to just do this in the source for each such file. */
|
it is simpler to just do this in the source for each such file. */
|
||||||
|
|
||||||
#define GETOPT_INTERFACE_VERSION 2
|
#define GETOPT_INTERFACE_VERSION 2
|
||||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||||
#include <gnu-versions.h>
|
#include <gnu-versions.h>
|
||||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||||
#define ELIDE_CODE
|
#define ELIDE_CODE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ELIDE_CODE
|
#ifndef ELIDE_CODE
|
||||||
|
|
||||||
|
|
||||||
/* This needs to come after some library #include
|
/* This needs to come after some library #include
|
||||||
to get __GNU_LIBRARY__ defined. */
|
to get __GNU_LIBRARY__ defined. */
|
||||||
#ifdef __GNU_LIBRARY__
|
#ifdef __GNU_LIBRARY__
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
getopt_long (argc, argv, options, long_options, opt_index)
|
getopt_long (argc, argv, options, long_options, opt_index)
|
||||||
int argc;
|
int argc;
|
||||||
char *const *argv;
|
char *const *argv;
|
||||||
const char *options;
|
const char *options;
|
||||||
const struct option *long_options;
|
const struct option *long_options;
|
||||||
int *opt_index;
|
int *opt_index;
|
||||||
{
|
{
|
||||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||||
but does match a short option, it is parsed as a short option
|
but does match a short option, it is parsed as a short option
|
||||||
instead. */
|
instead. */
|
||||||
|
|
||||||
int
|
int
|
||||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||||
int argc;
|
int argc;
|
||||||
char *const *argv;
|
char *const *argv;
|
||||||
const char *options;
|
const char *options;
|
||||||
const struct option *long_options;
|
const struct option *long_options;
|
||||||
int *opt_index;
|
int *opt_index;
|
||||||
{
|
{
|
||||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* Not ELIDE_CODE. */
|
#endif /* Not ELIDE_CODE. */
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int digit_optind = 0;
|
int digit_optind = 0;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
int this_option_optind = optind ? optind : 1;
|
int this_option_optind = optind ? optind : 1;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"add", 1, 0, 0},
|
{"add", 1, 0, 0},
|
||||||
{"append", 0, 0, 0},
|
{"append", 0, 0, 0},
|
||||||
{"delete", 1, 0, 0},
|
{"delete", 1, 0, 0},
|
||||||
{"verbose", 0, 0, 0},
|
{"verbose", 0, 0, 0},
|
||||||
{"create", 0, 0, 0},
|
{"create", 0, 0, 0},
|
||||||
{"file", 1, 0, 0},
|
{"file", 1, 0, 0},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||||
long_options, &option_index);
|
long_options, &option_index);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
printf ("option %s", long_options[option_index].name);
|
printf ("option %s", long_options[option_index].name);
|
||||||
if (optarg)
|
if (optarg)
|
||||||
printf (" with arg %s", optarg);
|
printf (" with arg %s", optarg);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '0':
|
case '0':
|
||||||
case '1':
|
case '1':
|
||||||
case '2':
|
case '2':
|
||||||
case '3':
|
case '3':
|
||||||
case '4':
|
case '4':
|
||||||
case '5':
|
case '5':
|
||||||
case '6':
|
case '6':
|
||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||||
printf ("digits occur in two different argv-elements.\n");
|
printf ("digits occur in two different argv-elements.\n");
|
||||||
digit_optind = this_option_optind;
|
digit_optind = this_option_optind;
|
||||||
printf ("option %c\n", c);
|
printf ("option %c\n", c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
printf ("option a\n");
|
printf ("option a\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
printf ("option b\n");
|
printf ("option b\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
printf ("option c with value `%s'\n", optarg);
|
printf ("option c with value `%s'\n", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
printf ("option d with value `%s'\n", optarg);
|
printf ("option d with value `%s'\n", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc)
|
if (optind < argc)
|
||||||
{
|
{
|
||||||
printf ("non-option ARGV-elements: ");
|
printf ("non-option ARGV-elements: ");
|
||||||
while (optind < argc)
|
while (optind < argc)
|
||||||
printf ("%s ", argv[optind++]);
|
printf ("%s ", argv[optind++]);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* TEST */
|
#endif /* TEST */
|
||||||
|
|
296
src/sdl/text.cpp
296
src/sdl/text.cpp
|
@ -1,148 +1,148 @@
|
||||||
/* FCE Ultra - NES/Famicom Emulator
|
/* FCE Ultra - NES/Famicom Emulator
|
||||||
*
|
*
|
||||||
* Copyright notice for this file:
|
* Copyright notice for this file:
|
||||||
* Copyright (C) 2002 Ben Parnell
|
* Copyright (C) 2002 Ben Parnell
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Code originally from fceu/drawing.h file, adapted by Forgotten
|
/* Code originally from fceu/drawing.h file, adapted by Forgotten
|
||||||
*/
|
*/
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
|
|
||||||
extern int RGB_LOW_BITS_MASK;
|
extern int RGB_LOW_BITS_MASK;
|
||||||
|
|
||||||
static const u8 fontdata2[2048] = {
|
static const u8 fontdata2[2048] = {
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x1c,0x3e,0x1c,0x7f,0x7f,0x3e,0x1c,0x3e,0x08,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x3e,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xf0,0xe0,0xf0,0xbe,0x33,0x33,0x33,0x1e,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0xfc,0xcc,0xfc,0x0c,0x0c,0x0e,0x0f,0x07,0xfe,0xc6,0xfe,0xc6,0xc6,0xe6,0x67,0x03,0x99,0x5a,0x3c,0xe7,0xe7,0x3c,0x5a,0x99,0x01,0x07,0x1f,0x7f,0x1f,0x07,0x01,0x00,0x40,0x70,0x7c,0x7f,0x7c,0x70,0x40,0x00,0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0xfe,0xdb,0xdb,0xde,0xd8,0xd8,0xd8,0x00,0x7c,0xc6,0x1c,0x36,0x36,0x1c,0x33,0x1e,0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x18,0x30,0x7f,0x30,0x18,0x00,0x00,0x00,0x0c,0x06,0x7f,0x06,0x0c,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x7f,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00,
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e,0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e,0x36,0x7f,0x7f,0x7f,0x3e,0x1c,0x08,0x00,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x08,0x00,0x1c,0x3e,0x1c,0x7f,0x7f,0x3e,0x1c,0x3e,0x08,0x08,0x1c,0x3e,0x7f,0x3e,0x1c,0x3e,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xf0,0xe0,0xf0,0xbe,0x33,0x33,0x33,0x1e,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0xfc,0xcc,0xfc,0x0c,0x0c,0x0e,0x0f,0x07,0xfe,0xc6,0xfe,0xc6,0xc6,0xe6,0x67,0x03,0x99,0x5a,0x3c,0xe7,0xe7,0x3c,0x5a,0x99,0x01,0x07,0x1f,0x7f,0x1f,0x07,0x01,0x00,0x40,0x70,0x7c,0x7f,0x7c,0x70,0x40,0x00,0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0xfe,0xdb,0xdb,0xde,0xd8,0xd8,0xd8,0x00,0x7c,0xc6,0x1c,0x36,0x36,0x1c,0x33,0x1e,0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00,0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x18,0x30,0x7f,0x30,0x18,0x00,0x00,0x00,0x0c,0x06,0x7f,0x06,0x0c,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x7f,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00,
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x1e,0x1e,0x0c,0x0c,0x00,0x0c,0x00,0x36,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x36,0x36,0x7f,0x36,0x7f,0x36,0x36,0x00,0x0c,0x3e,0x03,0x1e,0x30,0x1f,0x0c,0x00,0x00,0x63,0x33,0x18,0x0c,0x66,0x63,0x00,0x1c,0x36,0x1c,0x6e,0x3b,0x33,0x6e,0x00,0x06,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0x06,0x06,0x06,0x0c,0x18,0x00,0x06,0x0c,0x18,0x18,0x18,0x0c,0x06,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x06,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x00,0x60,0x30,0x18,0x0c,0x06,0x03,0x01,0x00,0x3e,0x63,0x73,0x7b,0x6f,0x67,0x3e,0x00,0x0c,0x0e,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x1e,0x33,0x30,0x1c,0x06,0x33,0x3f,0x00,0x1e,0x33,0x30,0x1c,0x30,0x33,0x1e,0x00,0x38,0x3c,0x36,0x33,0x7f,0x30,0x78,0x00,0x3f,0x03,0x1f,0x30,0x30,0x33,0x1e,0x00,0x1c,0x06,0x03,0x1f,0x33,0x33,0x1e,0x00,0x3f,0x33,0x30,0x18,0x0c,0x0c,0x0c,0x00,0x1e,0x33,0x33,0x1e,0x33,0x33,0x1e,0x00,0x1e,0x33,0x33,0x3e,0x30,0x18,0x0e,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x06,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x00,0x00,0x00,0x3f,0x00,0x00,0x3f,0x00,0x00,0x06,0x0c,0x18,0x30,0x18,0x0c,0x06,0x00,0x1e,0x33,0x30,0x18,0x0c,0x00,0x0c,0x00,
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x1e,0x1e,0x0c,0x0c,0x00,0x0c,0x00,0x36,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0x36,0x36,0x7f,0x36,0x7f,0x36,0x36,0x00,0x0c,0x3e,0x03,0x1e,0x30,0x1f,0x0c,0x00,0x00,0x63,0x33,0x18,0x0c,0x66,0x63,0x00,0x1c,0x36,0x1c,0x6e,0x3b,0x33,0x6e,0x00,0x06,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0x06,0x06,0x06,0x0c,0x18,0x00,0x06,0x0c,0x18,0x18,0x18,0x0c,0x06,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x06,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x00,0x60,0x30,0x18,0x0c,0x06,0x03,0x01,0x00,0x3e,0x63,0x73,0x7b,0x6f,0x67,0x3e,0x00,0x0c,0x0e,0x0c,0x0c,0x0c,0x0c,0x3f,0x00,0x1e,0x33,0x30,0x1c,0x06,0x33,0x3f,0x00,0x1e,0x33,0x30,0x1c,0x30,0x33,0x1e,0x00,0x38,0x3c,0x36,0x33,0x7f,0x30,0x78,0x00,0x3f,0x03,0x1f,0x30,0x30,0x33,0x1e,0x00,0x1c,0x06,0x03,0x1f,0x33,0x33,0x1e,0x00,0x3f,0x33,0x30,0x18,0x0c,0x0c,0x0c,0x00,0x1e,0x33,0x33,0x1e,0x33,0x33,0x1e,0x00,0x1e,0x33,0x33,0x3e,0x30,0x18,0x0e,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x00,0x00,0x0c,0x0c,0x06,0x18,0x0c,0x06,0x03,0x06,0x0c,0x18,0x00,0x00,0x00,0x3f,0x00,0x00,0x3f,0x00,0x00,0x06,0x0c,0x18,0x30,0x18,0x0c,0x06,0x00,0x1e,0x33,0x30,0x18,0x0c,0x00,0x0c,0x00,
|
||||||
0x3e,0x63,0x7b,0x7b,0x7b,0x03,0x1e,0x00,0x0c,0x1e,0x33,0x33,0x3f,0x33,0x33,0x00,0x3f,0x66,0x66,0x3e,0x66,0x66,0x3f,0x00,0x3c,0x66,0x03,0x03,0x03,0x66,0x3c,0x00,0x1f,0x36,0x66,0x66,0x66,0x36,0x1f,0x00,0x7f,0x46,0x16,0x1e,0x16,0x46,0x7f,0x00,0x7f,0x46,0x16,0x1e,0x16,0x06,0x0f,0x00,0x3c,0x66,0x03,0x03,0x73,0x66,0x7c,0x00,0x33,0x33,0x33,0x3f,0x33,0x33,0x33,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x78,0x30,0x30,0x30,0x33,0x33,0x1e,0x00,0x67,0x66,0x36,0x1e,0x36,0x66,0x67,0x00,0x0f,0x06,0x06,0x06,0x46,0x66,0x7f,0x00,0x63,0x77,0x7f,0x7f,0x6b,0x63,0x63,0x00,0x63,0x67,0x6f,0x7b,0x73,0x63,0x63,0x00,0x1c,0x36,0x63,0x63,0x63,0x36,0x1c,0x00,0x3f,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00,0x1e,0x33,0x33,0x33,0x3b,0x1e,0x38,0x00,0x3f,0x66,0x66,0x3e,0x36,0x66,0x67,0x00,0x1e,0x33,0x07,0x0e,0x38,0x33,0x1e,0x00,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x33,0x33,0x33,0x33,0x33,0x33,0x3f,0x00,0x33,0x33,0x33,0x33,0x33,0x1e,0x0c,0x00,0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x00,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x1e,0x00,0x7f,0x63,0x31,0x18,0x4c,0x66,0x7f,0x00,0x1e,0x06,0x06,0x06,0x06,0x06,0x1e,0x00,0x03,0x06,0x0c,0x18,0x30,0x60,0x40,0x00,0x1e,0x18,0x18,0x18,0x18,0x18,0x1e,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
|
0x3e,0x63,0x7b,0x7b,0x7b,0x03,0x1e,0x00,0x0c,0x1e,0x33,0x33,0x3f,0x33,0x33,0x00,0x3f,0x66,0x66,0x3e,0x66,0x66,0x3f,0x00,0x3c,0x66,0x03,0x03,0x03,0x66,0x3c,0x00,0x1f,0x36,0x66,0x66,0x66,0x36,0x1f,0x00,0x7f,0x46,0x16,0x1e,0x16,0x46,0x7f,0x00,0x7f,0x46,0x16,0x1e,0x16,0x06,0x0f,0x00,0x3c,0x66,0x03,0x03,0x73,0x66,0x7c,0x00,0x33,0x33,0x33,0x3f,0x33,0x33,0x33,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x78,0x30,0x30,0x30,0x33,0x33,0x1e,0x00,0x67,0x66,0x36,0x1e,0x36,0x66,0x67,0x00,0x0f,0x06,0x06,0x06,0x46,0x66,0x7f,0x00,0x63,0x77,0x7f,0x7f,0x6b,0x63,0x63,0x00,0x63,0x67,0x6f,0x7b,0x73,0x63,0x63,0x00,0x1c,0x36,0x63,0x63,0x63,0x36,0x1c,0x00,0x3f,0x66,0x66,0x3e,0x06,0x06,0x0f,0x00,0x1e,0x33,0x33,0x33,0x3b,0x1e,0x38,0x00,0x3f,0x66,0x66,0x3e,0x36,0x66,0x67,0x00,0x1e,0x33,0x07,0x0e,0x38,0x33,0x1e,0x00,0x3f,0x2d,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x33,0x33,0x33,0x33,0x33,0x33,0x3f,0x00,0x33,0x33,0x33,0x33,0x33,0x1e,0x0c,0x00,0x63,0x63,0x63,0x6b,0x7f,0x77,0x63,0x00,0x63,0x63,0x36,0x1c,0x1c,0x36,0x63,0x00,0x33,0x33,0x33,0x1e,0x0c,0x0c,0x1e,0x00,0x7f,0x63,0x31,0x18,0x4c,0x66,0x7f,0x00,0x1e,0x06,0x06,0x06,0x06,0x06,0x1e,0x00,0x03,0x06,0x0c,0x18,0x30,0x60,0x40,0x00,0x1e,0x18,0x18,0x18,0x18,0x18,0x1e,0x00,0x08,0x1c,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,
|
||||||
0x0c,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x30,0x3e,0x33,0x6e,0x00,0x07,0x06,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x1e,0x33,0x03,0x33,0x1e,0x00,0x38,0x30,0x30,0x3e,0x33,0x33,0x6e,0x00,0x00,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x1c,0x36,0x06,0x0f,0x06,0x06,0x0f,0x00,0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x1f,0x07,0x06,0x36,0x6e,0x66,0x66,0x67,0x00,0x0c,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x30,0x00,0x30,0x30,0x30,0x33,0x33,0x1e,0x07,0x06,0x66,0x36,0x1e,0x36,0x67,0x00,0x0e,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x33,0x7f,0x7f,0x6b,0x63,0x00,0x00,0x00,0x1f,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x1e,0x33,0x33,0x33,0x1e,0x00,0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x0f,0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x78,0x00,0x00,0x3b,0x6e,0x66,0x06,0x0f,0x00,0x00,0x00,0x3e,0x03,0x1e,0x30,0x1f,0x00,0x08,0x0c,0x3e,0x0c,0x0c,0x2c,0x18,0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x6e,0x00,0x00,0x00,0x33,0x33,0x33,0x1e,0x0c,0x00,0x00,0x00,0x63,0x6b,0x7f,0x7f,0x36,0x00,0x00,0x00,0x63,0x36,0x1c,0x36,0x63,0x00,0x00,0x00,0x33,0x33,0x33,0x3e,0x30,0x1f,0x00,0x00,0x3f,0x19,0x0c,0x26,0x3f,0x00,0x38,0x0c,0x0c,0x07,0x0c,0x0c,0x38,0x00,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x07,0x0c,0x0c,0x38,0x0c,0x0c,0x07,0x00,0x6e,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,
|
0x0c,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0x30,0x3e,0x33,0x6e,0x00,0x07,0x06,0x06,0x3e,0x66,0x66,0x3b,0x00,0x00,0x00,0x1e,0x33,0x03,0x33,0x1e,0x00,0x38,0x30,0x30,0x3e,0x33,0x33,0x6e,0x00,0x00,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x1c,0x36,0x06,0x0f,0x06,0x06,0x0f,0x00,0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x1f,0x07,0x06,0x36,0x6e,0x66,0x66,0x67,0x00,0x0c,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x30,0x00,0x30,0x30,0x30,0x33,0x33,0x1e,0x07,0x06,0x66,0x36,0x1e,0x36,0x67,0x00,0x0e,0x0c,0x0c,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x33,0x7f,0x7f,0x6b,0x63,0x00,0x00,0x00,0x1f,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x1e,0x33,0x33,0x33,0x1e,0x00,0x00,0x00,0x3b,0x66,0x66,0x3e,0x06,0x0f,0x00,0x00,0x6e,0x33,0x33,0x3e,0x30,0x78,0x00,0x00,0x3b,0x6e,0x66,0x06,0x0f,0x00,0x00,0x00,0x3e,0x03,0x1e,0x30,0x1f,0x00,0x08,0x0c,0x3e,0x0c,0x0c,0x2c,0x18,0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x6e,0x00,0x00,0x00,0x33,0x33,0x33,0x1e,0x0c,0x00,0x00,0x00,0x63,0x6b,0x7f,0x7f,0x36,0x00,0x00,0x00,0x63,0x36,0x1c,0x36,0x63,0x00,0x00,0x00,0x33,0x33,0x33,0x3e,0x30,0x1f,0x00,0x00,0x3f,0x19,0x0c,0x26,0x3f,0x00,0x38,0x0c,0x0c,0x07,0x0c,0x0c,0x38,0x00,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x07,0x0c,0x0c,0x38,0x0c,0x0c,0x07,0x00,0x6e,0x3b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x1c,0x36,0x63,0x63,0x7f,0x00,
|
||||||
0x1e,0x33,0x03,0x33,0x1e,0x18,0x30,0x1e,0x00,0x33,0x00,0x33,0x33,0x33,0x7e,0x00,0x38,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x7e,0xc3,0x3c,0x60,0x7c,0x66,0xfc,0x00,0x33,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x07,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x0c,0x0c,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x00,0x00,0x1e,0x03,0x03,0x1e,0x30,0x1c,0x7e,0xc3,0x3c,0x66,0x7e,0x06,0x3c,0x00,0x33,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x07,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x33,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x3e,0x63,0x1c,0x18,0x18,0x18,0x3c,0x00,0x07,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x63,0x1c,0x36,0x63,0x7f,0x63,0x63,0x00,0x0c,0x0c,0x00,0x1e,0x33,0x3f,0x33,0x00,0x38,0x00,0x3f,0x06,0x1e,0x06,0x3f,0x00,0x00,0x00,0xfe,0x30,0xfe,0x33,0xfe,0x00,0x7c,0x36,0x33,0x7f,0x33,0x33,0x73,0x00,0x1e,0x33,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x33,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x07,0x00,0x1e,0x33,0x33,0x1e,0x00,0x1e,0x33,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x07,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x33,0x00,0x33,0x33,0x3e,0x30,0x1f,0xc3,0x18,0x3c,0x66,0x66,0x3c,0x18,0x00,0x33,0x00,0x33,0x33,0x33,0x33,0x1e,0x00,0x18,0x18,0x7e,0x03,0x03,0x7e,0x18,0x18,0x1c,0x36,0x26,0x0f,0x06,0x67,0x3f,0x00,0x33,0x33,0x1e,0x3f,0x0c,0x3f,0x0c,0x0c,0x1f,0x33,0x33,0x5f,0x63,0xf3,0x63,0xe3,0x70,0xd8,0x18,0x3c,0x18,0x18,0x1b,0x0e,
|
0x1e,0x33,0x03,0x33,0x1e,0x18,0x30,0x1e,0x00,0x33,0x00,0x33,0x33,0x33,0x7e,0x00,0x38,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x7e,0xc3,0x3c,0x60,0x7c,0x66,0xfc,0x00,0x33,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x07,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x0c,0x0c,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x00,0x00,0x1e,0x03,0x03,0x1e,0x30,0x1c,0x7e,0xc3,0x3c,0x66,0x7e,0x06,0x3c,0x00,0x33,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x07,0x00,0x1e,0x33,0x3f,0x03,0x1e,0x00,0x33,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x3e,0x63,0x1c,0x18,0x18,0x18,0x3c,0x00,0x07,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x63,0x1c,0x36,0x63,0x7f,0x63,0x63,0x00,0x0c,0x0c,0x00,0x1e,0x33,0x3f,0x33,0x00,0x38,0x00,0x3f,0x06,0x1e,0x06,0x3f,0x00,0x00,0x00,0xfe,0x30,0xfe,0x33,0xfe,0x00,0x7c,0x36,0x33,0x7f,0x33,0x33,0x73,0x00,0x1e,0x33,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x33,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x07,0x00,0x1e,0x33,0x33,0x1e,0x00,0x1e,0x33,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x07,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x33,0x00,0x33,0x33,0x3e,0x30,0x1f,0xc3,0x18,0x3c,0x66,0x66,0x3c,0x18,0x00,0x33,0x00,0x33,0x33,0x33,0x33,0x1e,0x00,0x18,0x18,0x7e,0x03,0x03,0x7e,0x18,0x18,0x1c,0x36,0x26,0x0f,0x06,0x67,0x3f,0x00,0x33,0x33,0x1e,0x3f,0x0c,0x3f,0x0c,0x0c,0x1f,0x33,0x33,0x5f,0x63,0xf3,0x63,0xe3,0x70,0xd8,0x18,0x3c,0x18,0x18,0x1b,0x0e,
|
||||||
0x38,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x1c,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x38,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x38,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x1f,0x00,0x1f,0x33,0x33,0x33,0x00,0x3f,0x00,0x33,0x37,0x3f,0x3b,0x33,0x00,0x3c,0x36,0x36,0x7c,0x00,0x7e,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x3e,0x00,0x00,0x0c,0x00,0x0c,0x06,0x03,0x33,0x1e,0x00,0x00,0x00,0x00,0x3f,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x30,0x00,0x00,0xc3,0x63,0x33,0x7b,0xcc,0x66,0x33,0xf0,0xc3,0x63,0x33,0xdb,0xec,0xf6,0xf3,0xc0,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0xcc,0x66,0x33,0x66,0xcc,0x00,0x00,0x00,0x33,0x66,0xcc,0x66,0x33,0x00,0x00,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xdb,0xee,0xdb,0x77,0xdb,0xee,0xdb,0x77,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x6c,0x6c,0x6c,0x6c,0x6f,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x7f,0x6c,0x6c,0x6c,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x6c,0x6c,0x6f,0x60,0x6f,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x7f,0x60,0x6f,0x6c,0x6c,0x6c,0x6c,0x6c,0x6f,0x60,0x7f,0x00,0x00,0x00,0x6c,0x6c,0x6c,0x6c,0x7f,0x00,0x00,0x00,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,
|
0x38,0x00,0x1e,0x30,0x3e,0x33,0x7e,0x00,0x1c,0x00,0x0e,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x38,0x00,0x1e,0x33,0x33,0x1e,0x00,0x00,0x38,0x00,0x33,0x33,0x33,0x7e,0x00,0x00,0x1f,0x00,0x1f,0x33,0x33,0x33,0x00,0x3f,0x00,0x33,0x37,0x3f,0x3b,0x33,0x00,0x3c,0x36,0x36,0x7c,0x00,0x7e,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x3e,0x00,0x00,0x0c,0x00,0x0c,0x06,0x03,0x33,0x1e,0x00,0x00,0x00,0x00,0x3f,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x30,0x00,0x00,0xc3,0x63,0x33,0x7b,0xcc,0x66,0x33,0xf0,0xc3,0x63,0x33,0xdb,0xec,0xf6,0xf3,0xc0,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0xcc,0x66,0x33,0x66,0xcc,0x00,0x00,0x00,0x33,0x66,0xcc,0x66,0x33,0x00,0x00,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xdb,0xee,0xdb,0x77,0xdb,0xee,0xdb,0x77,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x6c,0x6c,0x6c,0x6c,0x6f,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x7f,0x6c,0x6c,0x6c,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x6c,0x6c,0x6f,0x60,0x6f,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x7f,0x60,0x6f,0x6c,0x6c,0x6c,0x6c,0x6c,0x6f,0x60,0x7f,0x00,0x00,0x00,0x6c,0x6c,0x6c,0x6c,0x7f,0x00,0x00,0x00,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,
|
||||||
0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x6c,0x6c,0x6c,0x6c,0xec,0x6c,0x6c,0x6c,0x6c,0x6c,0xec,0x0c,0xfc,0x00,0x00,0x00,0x00,0x00,0xfc,0x0c,0xec,0x6c,0x6c,0x6c,0x6c,0x6c,0xef,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xef,0x6c,0x6c,0x6c,0x6c,0x6c,0xec,0x0c,0xec,0x6c,0x6c,0x6c,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x6c,0x6c,0xef,0x00,0xef,0x6c,0x6c,0x6c,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x6c,0x6c,0x6c,0x6c,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xfc,0x00,0x00,0x00,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xfc,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xff,0x6c,0x6c,0x6c,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
|
0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x6c,0x6c,0x6c,0x6c,0xec,0x6c,0x6c,0x6c,0x6c,0x6c,0xec,0x0c,0xfc,0x00,0x00,0x00,0x00,0x00,0xfc,0x0c,0xec,0x6c,0x6c,0x6c,0x6c,0x6c,0xef,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xef,0x6c,0x6c,0x6c,0x6c,0x6c,0xec,0x0c,0xec,0x6c,0x6c,0x6c,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x6c,0x6c,0xef,0x00,0xef,0x6c,0x6c,0x6c,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x6c,0x6c,0x6c,0x6c,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xff,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xfc,0x00,0x00,0x00,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0xfc,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0xff,0x6c,0x6c,0x6c,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
|
||||||
0x00,0x00,0x6e,0x3b,0x13,0x3b,0x6e,0x00,0x00,0x1e,0x33,0x1f,0x33,0x1f,0x03,0x03,0x00,0x3f,0x33,0x03,0x03,0x03,0x03,0x00,0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,0x3f,0x33,0x06,0x0c,0x06,0x33,0x3f,0x00,0x00,0x00,0x7e,0x1b,0x1b,0x1b,0x0e,0x00,0x00,0x66,0x66,0x66,0x66,0x3e,0x06,0x03,0x00,0x6e,0x3b,0x18,0x18,0x18,0x18,0x00,0x3f,0x0c,0x1e,0x33,0x33,0x1e,0x0c,0x3f,0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x38,0x0c,0x18,0x3e,0x33,0x33,0x1e,0x00,0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,0x60,0x30,0x7e,0xdb,0xdb,0x7e,0x06,0x03,0x1c,0x06,0x03,0x1f,0x03,0x06,0x1c,0x00,0x1e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x3f,0x00,0x3f,0x00,0x3f,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x3f,0x00,0x06,0x0c,0x18,0x0c,0x06,0x00,0x3f,0x00,0x18,0x0c,0x06,0x0c,0x18,0x00,0x3f,0x00,0x70,0xd8,0xd8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x0e,0x0c,0x0c,0x00,0x3f,0x00,0x0c,0x0c,0x00,0x00,0x6e,0x3b,0x00,0x6e,0x3b,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xf0,0x30,0x30,0x30,0x37,0x36,0x3c,0x38,0x1e,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x0e,0x18,0x0c,0x06,0x1e,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
0x00,0x00,0x6e,0x3b,0x13,0x3b,0x6e,0x00,0x00,0x1e,0x33,0x1f,0x33,0x1f,0x03,0x03,0x00,0x3f,0x33,0x03,0x03,0x03,0x03,0x00,0x00,0x7f,0x36,0x36,0x36,0x36,0x36,0x00,0x3f,0x33,0x06,0x0c,0x06,0x33,0x3f,0x00,0x00,0x00,0x7e,0x1b,0x1b,0x1b,0x0e,0x00,0x00,0x66,0x66,0x66,0x66,0x3e,0x06,0x03,0x00,0x6e,0x3b,0x18,0x18,0x18,0x18,0x00,0x3f,0x0c,0x1e,0x33,0x33,0x1e,0x0c,0x3f,0x1c,0x36,0x63,0x7f,0x63,0x36,0x1c,0x00,0x1c,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x38,0x0c,0x18,0x3e,0x33,0x33,0x1e,0x00,0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00,0x60,0x30,0x7e,0xdb,0xdb,0x7e,0x06,0x03,0x1c,0x06,0x03,0x1f,0x03,0x06,0x1c,0x00,0x1e,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x3f,0x00,0x3f,0x00,0x3f,0x00,0x00,0x0c,0x0c,0x3f,0x0c,0x0c,0x00,0x3f,0x00,0x06,0x0c,0x18,0x0c,0x06,0x00,0x3f,0x00,0x18,0x0c,0x06,0x0c,0x18,0x00,0x3f,0x00,0x70,0xd8,0xd8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1b,0x1b,0x0e,0x0c,0x0c,0x00,0x3f,0x00,0x0c,0x0c,0x00,0x00,0x6e,0x3b,0x00,0x6e,0x3b,0x00,0x00,0x1c,0x36,0x36,0x1c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xf0,0x30,0x30,0x30,0x37,0x36,0x3c,0x38,0x1e,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x0e,0x18,0x0c,0x06,0x1e,0x00,0x00,0x00,0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
void drawText(u8 *screen, int pitch, int x, int y,
|
void drawText(u8 *screen, int pitch, int x, int y,
|
||||||
const char *string, bool trans)
|
const char *string, bool trans)
|
||||||
{
|
{
|
||||||
screen += y*pitch;
|
screen += y*pitch;
|
||||||
int inc = 2;
|
int inc = 2;
|
||||||
switch(systemColorDepth) {
|
switch(systemColorDepth) {
|
||||||
case 24:
|
case 24:
|
||||||
inc = 3;
|
inc = 3;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
inc = 4;
|
inc = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
screen += x*inc;
|
screen += x*inc;
|
||||||
|
|
||||||
switch(systemColorDepth) {
|
switch(systemColorDepth) {
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
while(*string) {
|
while(*string) {
|
||||||
char c = *string++;
|
char c = *string++;
|
||||||
u8 *scr = screen;
|
u8 *scr = screen;
|
||||||
|
|
||||||
u16 mask = ~RGB_LOW_BITS_MASK;
|
u16 mask = ~RGB_LOW_BITS_MASK;
|
||||||
int h, w;
|
int h, w;
|
||||||
u16 *s = (u16 *)scr;
|
u16 *s = (u16 *)scr;
|
||||||
for (h = 0; h < 8; h++) {
|
for (h = 0; h < 8; h++) {
|
||||||
for (w = 0; w < 8; w++, s++) {
|
for (w = 0; w < 8; w++, s++) {
|
||||||
int on = (fontdata2[(c<<3)+h]>>w)&1;
|
int on = (fontdata2[(c<<3)+h]>>w)&1;
|
||||||
|
|
||||||
if(trans) {
|
if(trans) {
|
||||||
if(on)
|
if(on)
|
||||||
*s = ((0xf) << systemRedShift) +
|
*s = ((0xf) << systemRedShift) +
|
||||||
((*s & mask) >>1);
|
((*s & mask) >>1);
|
||||||
} else {
|
} else {
|
||||||
if(on)
|
if(on)
|
||||||
*s = (0x1f) << systemRedShift;
|
*s = (0x1f) << systemRedShift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scr += pitch;
|
scr += pitch;
|
||||||
s = (u16 *)scr;
|
s = (u16 *)scr;
|
||||||
}
|
}
|
||||||
screen += inc*8;
|
screen += inc*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
{
|
{
|
||||||
while(*string) {
|
while(*string) {
|
||||||
char c = *string++;
|
char c = *string++;
|
||||||
u8 *scr = screen;
|
u8 *scr = screen;
|
||||||
|
|
||||||
int h, w;
|
int h, w;
|
||||||
u8 *s = (u8 *)scr;
|
u8 *s = (u8 *)scr;
|
||||||
for (h = 0; h < 8; h++) {
|
for (h = 0; h < 8; h++) {
|
||||||
for (w = 0; w < 8; w++, s+=3) {
|
for (w = 0; w < 8; w++, s+=3) {
|
||||||
int on = (fontdata2[(c<<3)+h]>>w)&1;
|
int on = (fontdata2[(c<<3)+h]>>w)&1;
|
||||||
|
|
||||||
if(trans) {
|
if(trans) {
|
||||||
if(on) {
|
if(on) {
|
||||||
u32 color = (0x1f) << systemRedShift;
|
u32 color = (0x1f) << systemRedShift;
|
||||||
*s = ((color & 255)>>1)+(*s>>1);
|
*s = ((color & 255)>>1)+(*s>>1);
|
||||||
*(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1);
|
*(s+1) = (((color >> 8) & 255)>>1)+(*(s+1)>>1);
|
||||||
*(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1);
|
*(s+2) = (((color >> 16) & 255)>>1)+(*(s+2)>>1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(on) {
|
if(on) {
|
||||||
u32 color = (0x1f) << systemRedShift;
|
u32 color = (0x1f) << systemRedShift;
|
||||||
*s = (color & 255);
|
*s = (color & 255);
|
||||||
*(s+1) = (color >> 8) & 255;
|
*(s+1) = (color >> 8) & 255;
|
||||||
*(s+2) = (color >> 16) & 255;
|
*(s+2) = (color >> 16) & 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scr += pitch;
|
scr += pitch;
|
||||||
s = (u8 *)scr;
|
s = (u8 *)scr;
|
||||||
}
|
}
|
||||||
screen += inc*8;
|
screen += inc*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
while(*string) {
|
while(*string) {
|
||||||
char c = *string++;
|
char c = *string++;
|
||||||
u8 *scr = screen;
|
u8 *scr = screen;
|
||||||
|
|
||||||
int h, w;
|
int h, w;
|
||||||
u32 mask = 0xfefefe;
|
u32 mask = 0xfefefe;
|
||||||
u32 *s = (u32 *)scr;
|
u32 *s = (u32 *)scr;
|
||||||
for (h = 0; h < 8; h++) {
|
for (h = 0; h < 8; h++) {
|
||||||
for (w = 0; w < 8; w++, s++) {
|
for (w = 0; w < 8; w++, s++) {
|
||||||
int on = (fontdata2[(c<<3)+h]>>w)&1;
|
int on = (fontdata2[(c<<3)+h]>>w)&1;
|
||||||
|
|
||||||
if(trans) {
|
if(trans) {
|
||||||
if(on)
|
if(on)
|
||||||
*s = ((0xf) << systemRedShift) + ((*s & mask)>>1);
|
*s = ((0xf) << systemRedShift) + ((*s & mask)>>1);
|
||||||
} else {
|
} else {
|
||||||
if(on)
|
if(on)
|
||||||
*s = (0x1f) << systemRedShift;
|
*s = (0x1f) << systemRedShift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scr += pitch;
|
scr += pitch;
|
||||||
s = (u32 *)scr;
|
s = (u32 *)scr;
|
||||||
}
|
}
|
||||||
screen += inc*8;
|
screen += inc*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 1999-2003 Forgotten
|
// Copyright (C) 1999-2003 Forgotten
|
||||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern void drawText(u8 *, int, int, int, const char *, bool);
|
extern void drawText(u8 *, int, int, int, const char *, bool);
|
||||||
|
|
|
@ -137,7 +137,7 @@ bool AVIWrite::CreateVideoStream( LONG imageWidth, LONG imageHeight, WORD colorB
|
||||||
settings[0],
|
settings[0],
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
AVISaveOptionsFree( 1, settings );
|
AVISaveOptionsFree( 1, settings );
|
||||||
if( FAILED( err ) ) {
|
if( FAILED( err ) ) {
|
||||||
m_failed = true;
|
m_failed = true;
|
||||||
|
@ -293,7 +293,7 @@ bool AVIWrite::AddAudioFrame( LPVOID soundData )
|
||||||
m_failed = true;
|
m_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sampleCounter += m_audioFrameSize / m_audioBlockAlign;
|
m_sampleCounter += m_audioFrameSize / m_audioBlockAlign;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,107 +1,107 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "BIOSDialog.h"
|
#include "BIOSDialog.h"
|
||||||
|
|
||||||
|
|
||||||
// BIOSDialog dialog
|
// BIOSDialog dialog
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC(BIOSDialog, CDialog)
|
IMPLEMENT_DYNAMIC(BIOSDialog, CDialog)
|
||||||
|
|
||||||
BIOSDialog::BIOSDialog(CWnd* pParent /*=NULL*/)
|
BIOSDialog::BIOSDialog(CWnd* pParent /*=NULL*/)
|
||||||
: CDialog(BIOSDialog::IDD, pParent)
|
: CDialog(BIOSDialog::IDD, pParent)
|
||||||
, m_enableBIOS_GB(FALSE)
|
, m_enableBIOS_GB(FALSE)
|
||||||
, m_enableBIOS_GBA(FALSE)
|
, m_enableBIOS_GBA(FALSE)
|
||||||
, m_skipLogo(FALSE)
|
, m_skipLogo(FALSE)
|
||||||
, m_pathGB(_T(""))
|
, m_pathGB(_T(""))
|
||||||
, m_pathGBA(_T(""))
|
, m_pathGBA(_T(""))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BIOSDialog::~BIOSDialog()
|
BIOSDialog::~BIOSDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIOSDialog::DoDataExchange(CDataExchange* pDX)
|
void BIOSDialog::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
CDialog::DoDataExchange(pDX);
|
CDialog::DoDataExchange(pDX);
|
||||||
DDX_Check(pDX, IDC_ENABLE_GB_BIOS, m_enableBIOS_GB);
|
DDX_Check(pDX, IDC_ENABLE_GB_BIOS, m_enableBIOS_GB);
|
||||||
DDX_Check(pDX, IDC_ENABLE_GBA_BIOS, m_enableBIOS_GBA);
|
DDX_Check(pDX, IDC_ENABLE_GBA_BIOS, m_enableBIOS_GBA);
|
||||||
DDX_Check(pDX, IDC_SKIP_BOOT_LOGO, m_skipLogo);
|
DDX_Check(pDX, IDC_SKIP_BOOT_LOGO, m_skipLogo);
|
||||||
DDX_Text(pDX, IDC_GB_BIOS_PATH, m_pathGB);
|
DDX_Text(pDX, IDC_GB_BIOS_PATH, m_pathGB);
|
||||||
DDX_Text(pDX, IDC_GBA_BIOS_PATH, m_pathGBA);
|
DDX_Text(pDX, IDC_GBA_BIOS_PATH, m_pathGBA);
|
||||||
DDX_Control(pDX, IDC_GB_BIOS_PATH, m_editGB);
|
DDX_Control(pDX, IDC_GB_BIOS_PATH, m_editGB);
|
||||||
DDX_Control(pDX, IDC_GBA_BIOS_PATH, m_editGBA);
|
DDX_Control(pDX, IDC_GBA_BIOS_PATH, m_editGBA);
|
||||||
|
|
||||||
if( pDX->m_bSaveAndValidate == TRUE ) {
|
if( pDX->m_bSaveAndValidate == TRUE ) {
|
||||||
// disable BIOS usage when it does not exist
|
// disable BIOS usage when it does not exist
|
||||||
if( !fileExists( m_pathGBA ) ) {
|
if( !fileExists( m_pathGBA ) ) {
|
||||||
m_enableBIOS_GBA = FALSE;
|
m_enableBIOS_GBA = FALSE;
|
||||||
}
|
}
|
||||||
if( !fileExists( m_pathGB ) ) {
|
if( !fileExists( m_pathGB ) ) {
|
||||||
m_enableBIOS_GB = FALSE;
|
m_enableBIOS_GB = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(BIOSDialog, CDialog)
|
BEGIN_MESSAGE_MAP(BIOSDialog, CDialog)
|
||||||
ON_BN_CLICKED(IDC_SELECT_GB_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbBiosPath)
|
ON_BN_CLICKED(IDC_SELECT_GB_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbBiosPath)
|
||||||
ON_BN_CLICKED(IDC_SELECT_GBA_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbaBiosPath)
|
ON_BN_CLICKED(IDC_SELECT_GBA_BIOS_PATH, &BIOSDialog::OnBnClickedSelectGbaBiosPath)
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
// BIOSDialog message handlers
|
// BIOSDialog message handlers
|
||||||
|
|
||||||
void BIOSDialog::OnBnClickedSelectGbBiosPath()
|
void BIOSDialog::OnBnClickedSelectGbBiosPath()
|
||||||
{
|
{
|
||||||
CString current;
|
CString current;
|
||||||
m_editGB.GetWindowText( current );
|
m_editGB.GetWindowText( current );
|
||||||
if( !fileExists( current ) ) {
|
if( !fileExists( current ) ) {
|
||||||
current = _T("");
|
current = _T("");
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileDialog dlg(
|
CFileDialog dlg(
|
||||||
TRUE,
|
TRUE,
|
||||||
NULL,
|
NULL,
|
||||||
current,
|
current,
|
||||||
OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST,
|
OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST,
|
||||||
_T("BIOS Files (*.bin;*.rom)|*.bin;*.rom|All Files (*.*)|*.*||"),
|
_T("BIOS Files (*.bin;*.rom)|*.bin;*.rom|All Files (*.*)|*.*||"),
|
||||||
this,
|
this,
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
if( IDOK == dlg.DoModal() ) {
|
if( IDOK == dlg.DoModal() ) {
|
||||||
m_editGB.SetWindowText( dlg.GetPathName() );
|
m_editGB.SetWindowText( dlg.GetPathName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BIOSDialog::OnBnClickedSelectGbaBiosPath()
|
void BIOSDialog::OnBnClickedSelectGbaBiosPath()
|
||||||
{
|
{
|
||||||
CString current;
|
CString current;
|
||||||
m_editGBA.GetWindowText( current );
|
m_editGBA.GetWindowText( current );
|
||||||
if( !fileExists( current ) ) {
|
if( !fileExists( current ) ) {
|
||||||
current = _T("");
|
current = _T("");
|
||||||
}
|
}
|
||||||
|
|
||||||
CFileDialog dlg(
|
CFileDialog dlg(
|
||||||
TRUE,
|
TRUE,
|
||||||
NULL,
|
NULL,
|
||||||
current,
|
current,
|
||||||
OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST,
|
OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST,
|
||||||
_T("BIOS Files (*.bin;*.rom)|*.bin;*.rom|All Files (*.*)|*.*||"),
|
_T("BIOS Files (*.bin;*.rom)|*.bin;*.rom|All Files (*.*)|*.*||"),
|
||||||
this,
|
this,
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
if( IDOK == dlg.DoModal() ) {
|
if( IDOK == dlg.DoModal() ) {
|
||||||
m_editGBA.SetWindowText( dlg.GetPathName() );
|
m_editGBA.SetWindowText( dlg.GetPathName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BIOSDialog::fileExists(CString& file)
|
bool BIOSDialog::fileExists(CString& file)
|
||||||
{
|
{
|
||||||
CFileStatus stat;
|
CFileStatus stat;
|
||||||
BOOL retVal = CFile::GetStatus( file, stat );
|
BOOL retVal = CFile::GetStatus( file, stat );
|
||||||
bool noFile = false;
|
bool noFile = false;
|
||||||
if( retVal == TRUE ) {
|
if( retVal == TRUE ) {
|
||||||
noFile |= ( stat.m_attribute & CFile::directory ) != 0;
|
noFile |= ( stat.m_attribute & CFile::directory ) != 0;
|
||||||
}
|
}
|
||||||
return ( retVal == TRUE ) && !noFile;
|
return ( retVal == TRUE ) && !noFile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "afxwin.h"
|
#include "afxwin.h"
|
||||||
|
|
||||||
|
|
||||||
// BIOSDialog dialog
|
// BIOSDialog dialog
|
||||||
|
|
||||||
class BIOSDialog : public CDialog
|
class BIOSDialog : public CDialog
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC(BIOSDialog)
|
DECLARE_DYNAMIC(BIOSDialog)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BIOSDialog(CWnd* pParent = NULL); // standard constructor
|
BIOSDialog(CWnd* pParent = NULL); // standard constructor
|
||||||
virtual ~BIOSDialog();
|
virtual ~BIOSDialog();
|
||||||
|
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
enum { IDD = IDD_BIOS };
|
enum { IDD = IDD_BIOS };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
private:
|
private:
|
||||||
CEdit m_editGB;
|
CEdit m_editGB;
|
||||||
CEdit m_editGBA;
|
CEdit m_editGBA;
|
||||||
bool fileExists(CString& file);
|
bool fileExists(CString& file);
|
||||||
afx_msg void OnBnClickedSelectGbBiosPath();
|
afx_msg void OnBnClickedSelectGbBiosPath();
|
||||||
afx_msg void OnBnClickedSelectGbaBiosPath();
|
afx_msg void OnBnClickedSelectGbaBiosPath();
|
||||||
public:
|
public:
|
||||||
BOOL m_enableBIOS_GB;
|
BOOL m_enableBIOS_GB;
|
||||||
BOOL m_enableBIOS_GBA;
|
BOOL m_enableBIOS_GBA;
|
||||||
BOOL m_skipLogo;
|
BOOL m_skipLogo;
|
||||||
CString m_pathGB;
|
CString m_pathGB;
|
||||||
CString m_pathGBA;
|
CString m_pathGBA;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,7 @@ private:
|
||||||
HANDLE dsbEvent;
|
HANDLE dsbEvent;
|
||||||
WAVEFORMATEX wfx; // Primary buffer wave format
|
WAVEFORMATEX wfx; // Primary buffer wave format
|
||||||
int soundBufferTotalLen;
|
int soundBufferTotalLen;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DirectSound();
|
DirectSound();
|
||||||
virtual ~DirectSound();
|
virtual ~DirectSound();
|
||||||
|
@ -72,7 +72,7 @@ DirectSound::DirectSound()
|
||||||
dsbNotify = NULL;
|
dsbNotify = NULL;
|
||||||
dsbEvent = NULL;
|
dsbEvent = NULL;
|
||||||
|
|
||||||
soundBufferTotalLen = 14700;
|
soundBufferTotalLen = 14700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,11 +84,11 @@ BOOL Directories::OnInitDialog()
|
||||||
{
|
{
|
||||||
CDialog::OnInitDialog();
|
CDialog::OnInitDialog();
|
||||||
CString p;
|
CString p;
|
||||||
|
|
||||||
p = regQueryStringValue("romdir", NULL);
|
p = regQueryStringValue("romdir", NULL);
|
||||||
if(!p.IsEmpty())
|
if(!p.IsEmpty())
|
||||||
GetDlgItem(IDC_ROM_PATH)->SetWindowText(p);
|
GetDlgItem(IDC_ROM_PATH)->SetWindowText(p);
|
||||||
|
|
||||||
p = regQueryStringValue("gbcromdir", NULL);
|
p = regQueryStringValue("gbcromdir", NULL);
|
||||||
if(!p.IsEmpty())
|
if(!p.IsEmpty())
|
||||||
GetDlgItem(IDC_GBCROM_PATH)->SetWindowText(p);
|
GetDlgItem(IDC_GBCROM_PATH)->SetWindowText(p);
|
||||||
|
@ -287,7 +287,7 @@ CString Directories::browseForDir(CString title)
|
||||||
|
|
||||||
// returns true if the directory does exist
|
// returns true if the directory does exist
|
||||||
bool Directories::directoryDoesExist(const char *directory)
|
bool Directories::directoryDoesExist(const char *directory)
|
||||||
{
|
{
|
||||||
HANDLE hDir;
|
HANDLE hDir;
|
||||||
hDir = CreateFile(
|
hDir = CreateFile(
|
||||||
directory,
|
directory,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,80 +1,80 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 2008 VBA-M development team
|
// Copyright (C) 2008 VBA-M development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "afxwin.h"
|
#include "afxwin.h"
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_D3D
|
#ifndef NO_D3D
|
||||||
#pragma comment( lib, "d3d9.lib" )
|
#pragma comment( lib, "d3d9.lib" )
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define D3D_DEBUG_INFO
|
#define D3D_DEBUG_INFO
|
||||||
#endif
|
#endif
|
||||||
#define DIRECT3D_VERSION 0x0900
|
#define DIRECT3D_VERSION 0x0900
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// FullscreenSettings dialog
|
// FullscreenSettings dialog
|
||||||
|
|
||||||
class FullscreenSettings : public CDialog
|
class FullscreenSettings : public CDialog
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC(FullscreenSettings)
|
DECLARE_DYNAMIC(FullscreenSettings)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FullscreenSettings(CWnd* pParent = NULL); // standard constructor
|
FullscreenSettings(CWnd* pParent = NULL); // standard constructor
|
||||||
virtual ~FullscreenSettings();
|
virtual ~FullscreenSettings();
|
||||||
|
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
enum { IDD = IDD_FULLSCREEN };
|
enum { IDD = IDD_FULLSCREEN };
|
||||||
|
|
||||||
// Call this function to select the API for the display mode enumeration.
|
// Call this function to select the API for the display mode enumeration.
|
||||||
void setAPI( DISPLAY_TYPE type );
|
void setAPI( DISPLAY_TYPE type );
|
||||||
afx_msg void OnCbnSelchangeComboDevice();
|
afx_msg void OnCbnSelchangeComboDevice();
|
||||||
afx_msg void OnCbnSelchangeComboColorDepth();
|
afx_msg void OnCbnSelchangeComboColorDepth();
|
||||||
afx_msg void OnCbnSelchangeComboResolution();
|
afx_msg void OnCbnSelchangeComboResolution();
|
||||||
|
|
||||||
unsigned int m_device;
|
unsigned int m_device;
|
||||||
unsigned int m_colorDepth;
|
unsigned int m_colorDepth;
|
||||||
unsigned int m_width;
|
unsigned int m_width;
|
||||||
unsigned int m_height;
|
unsigned int m_height;
|
||||||
unsigned int m_refreshRate;
|
unsigned int m_refreshRate;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
virtual void OnOK();
|
virtual void OnOK();
|
||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISPLAY_TYPE api;
|
DISPLAY_TYPE api;
|
||||||
bool failed;
|
bool failed;
|
||||||
|
|
||||||
#ifndef NO_D3D
|
#ifndef NO_D3D
|
||||||
LPDIRECT3D9 pD3D;
|
LPDIRECT3D9 pD3D;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual BOOL OnInitDialog();
|
virtual BOOL OnInitDialog();
|
||||||
|
|
||||||
CComboBox combo_device;
|
CComboBox combo_device;
|
||||||
CComboBox combo_resolution;
|
CComboBox combo_resolution;
|
||||||
CComboBox combo_color_depth;
|
CComboBox combo_color_depth;
|
||||||
CComboBox combo_refresh_rate;
|
CComboBox combo_refresh_rate;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1015,13 +1015,13 @@ void GBCheatList::OnNMDblclkCheatList(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
int selection = m_list.GetSelectionMark();
|
int selection = m_list.GetSelectionMark();
|
||||||
// get index value of corresponding code in cheatlist
|
// get index value of corresponding code in cheatlist
|
||||||
if( selection == -1 ) return;
|
if( selection == -1 ) return;
|
||||||
|
|
||||||
LVITEM item;
|
LVITEM item;
|
||||||
ZeroMemory( &item, sizeof(item) );
|
ZeroMemory( &item, sizeof(item) );
|
||||||
item.mask = LVIF_PARAM;
|
item.mask = LVIF_PARAM;
|
||||||
item.iItem = selection;
|
item.iItem = selection;
|
||||||
if( FALSE == m_list.GetItem( &item ) ) return;
|
if( FALSE == m_list.GetItem( &item ) ) return;
|
||||||
|
|
||||||
// modify code
|
// modify code
|
||||||
INT_PTR res;
|
INT_PTR res;
|
||||||
if( gbVerifyGsCode( gbCheatList[ item.lParam ].cheatCode ) ) {
|
if( gbVerifyGsCode( gbCheatList[ item.lParam ].cheatCode ) ) {
|
||||||
|
|
|
@ -1,448 +1,448 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Creative Labs Inc.
|
* Copyright (c) 2006, Creative Labs Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
* that the following conditions are met:
|
* that the following conditions are met:
|
||||||
*
|
*
|
||||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||||
* the following disclaimer.
|
* the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||||
* and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
* and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or
|
* * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or
|
||||||
* promote products derived from this software without specific prior written permission.
|
* promote products derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "LoadOAL.h"
|
#include "LoadOAL.h"
|
||||||
|
|
||||||
HINSTANCE g_hOpenALDLL = NULL;
|
HINSTANCE g_hOpenALDLL = NULL;
|
||||||
|
|
||||||
ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable)
|
ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable)
|
||||||
{
|
{
|
||||||
if (!lpOALFnTable)
|
if (!lpOALFnTable)
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
|
|
||||||
if (szOALFullPathName)
|
if (szOALFullPathName)
|
||||||
g_hOpenALDLL = LoadLibrary(szOALFullPathName);
|
g_hOpenALDLL = LoadLibrary(szOALFullPathName);
|
||||||
else
|
else
|
||||||
g_hOpenALDLL = LoadLibrary("openal32.dll");
|
g_hOpenALDLL = LoadLibrary("openal32.dll");
|
||||||
|
|
||||||
if (!g_hOpenALDLL)
|
if (!g_hOpenALDLL)
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
|
|
||||||
memset(lpOALFnTable, 0, sizeof(OPENALFNTABLE));
|
memset(lpOALFnTable, 0, sizeof(OPENALFNTABLE));
|
||||||
|
|
||||||
// Get function pointers
|
// Get function pointers
|
||||||
lpOALFnTable->alEnable = (LPALENABLE)GetProcAddress(g_hOpenALDLL, "alEnable");
|
lpOALFnTable->alEnable = (LPALENABLE)GetProcAddress(g_hOpenALDLL, "alEnable");
|
||||||
if (lpOALFnTable->alEnable == NULL)
|
if (lpOALFnTable->alEnable == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alEnable' function address\n");
|
OutputDebugString("Failed to retrieve 'alEnable' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alDisable = (LPALDISABLE)GetProcAddress(g_hOpenALDLL, "alDisable");
|
lpOALFnTable->alDisable = (LPALDISABLE)GetProcAddress(g_hOpenALDLL, "alDisable");
|
||||||
if (lpOALFnTable->alDisable == NULL)
|
if (lpOALFnTable->alDisable == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alDisable' function address\n");
|
OutputDebugString("Failed to retrieve 'alDisable' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alIsEnabled = (LPALISENABLED)GetProcAddress(g_hOpenALDLL, "alIsEnabled");
|
lpOALFnTable->alIsEnabled = (LPALISENABLED)GetProcAddress(g_hOpenALDLL, "alIsEnabled");
|
||||||
if (lpOALFnTable->alIsEnabled == NULL)
|
if (lpOALFnTable->alIsEnabled == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alIsEnabled' function address\n");
|
OutputDebugString("Failed to retrieve 'alIsEnabled' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetBoolean = (LPALGETBOOLEAN)GetProcAddress(g_hOpenALDLL, "alGetBoolean");
|
lpOALFnTable->alGetBoolean = (LPALGETBOOLEAN)GetProcAddress(g_hOpenALDLL, "alGetBoolean");
|
||||||
if (lpOALFnTable->alGetBoolean == NULL)
|
if (lpOALFnTable->alGetBoolean == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetBoolean' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetBoolean' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetInteger = (LPALGETINTEGER)GetProcAddress(g_hOpenALDLL, "alGetInteger");
|
lpOALFnTable->alGetInteger = (LPALGETINTEGER)GetProcAddress(g_hOpenALDLL, "alGetInteger");
|
||||||
if (lpOALFnTable->alGetInteger == NULL)
|
if (lpOALFnTable->alGetInteger == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetInteger' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetInteger' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetFloat = (LPALGETFLOAT)GetProcAddress(g_hOpenALDLL, "alGetFloat");
|
lpOALFnTable->alGetFloat = (LPALGETFLOAT)GetProcAddress(g_hOpenALDLL, "alGetFloat");
|
||||||
if (lpOALFnTable->alGetFloat == NULL)
|
if (lpOALFnTable->alGetFloat == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetFloat' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetFloat' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetDouble = (LPALGETDOUBLE)GetProcAddress(g_hOpenALDLL, "alGetDouble");
|
lpOALFnTable->alGetDouble = (LPALGETDOUBLE)GetProcAddress(g_hOpenALDLL, "alGetDouble");
|
||||||
if (lpOALFnTable->alGetDouble == NULL)
|
if (lpOALFnTable->alGetDouble == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetDouble' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetDouble' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetBooleanv = (LPALGETBOOLEANV)GetProcAddress(g_hOpenALDLL, "alGetBooleanv");
|
lpOALFnTable->alGetBooleanv = (LPALGETBOOLEANV)GetProcAddress(g_hOpenALDLL, "alGetBooleanv");
|
||||||
if (lpOALFnTable->alGetBooleanv == NULL)
|
if (lpOALFnTable->alGetBooleanv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetBooleanv' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetBooleanv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetIntegerv = (LPALGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alGetIntegerv");
|
lpOALFnTable->alGetIntegerv = (LPALGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alGetIntegerv");
|
||||||
if (lpOALFnTable->alGetIntegerv == NULL)
|
if (lpOALFnTable->alGetIntegerv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetIntegerv' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetIntegerv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetFloatv = (LPALGETFLOATV)GetProcAddress(g_hOpenALDLL, "alGetFloatv");
|
lpOALFnTable->alGetFloatv = (LPALGETFLOATV)GetProcAddress(g_hOpenALDLL, "alGetFloatv");
|
||||||
if (lpOALFnTable->alGetFloatv == NULL)
|
if (lpOALFnTable->alGetFloatv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetFloatv' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetFloatv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetDoublev = (LPALGETDOUBLEV)GetProcAddress(g_hOpenALDLL, "alGetDoublev");
|
lpOALFnTable->alGetDoublev = (LPALGETDOUBLEV)GetProcAddress(g_hOpenALDLL, "alGetDoublev");
|
||||||
if (lpOALFnTable->alGetDoublev == NULL)
|
if (lpOALFnTable->alGetDoublev == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetDoublev' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetDoublev' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetString = (LPALGETSTRING)GetProcAddress(g_hOpenALDLL, "alGetString");
|
lpOALFnTable->alGetString = (LPALGETSTRING)GetProcAddress(g_hOpenALDLL, "alGetString");
|
||||||
if (lpOALFnTable->alGetString == NULL)
|
if (lpOALFnTable->alGetString == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetString' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetString' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetError = (LPALGETERROR)GetProcAddress(g_hOpenALDLL, "alGetError");
|
lpOALFnTable->alGetError = (LPALGETERROR)GetProcAddress(g_hOpenALDLL, "alGetError");
|
||||||
if (lpOALFnTable->alGetError == NULL)
|
if (lpOALFnTable->alGetError == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetError' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetError' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alIsExtensionPresent = (LPALISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alIsExtensionPresent");
|
lpOALFnTable->alIsExtensionPresent = (LPALISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alIsExtensionPresent");
|
||||||
if (lpOALFnTable->alIsExtensionPresent == NULL)
|
if (lpOALFnTable->alIsExtensionPresent == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alIsExtensionPresent' function address\n");
|
OutputDebugString("Failed to retrieve 'alIsExtensionPresent' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetProcAddress = (LPALGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alGetProcAddress");
|
lpOALFnTable->alGetProcAddress = (LPALGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alGetProcAddress");
|
||||||
if (lpOALFnTable->alGetProcAddress == NULL)
|
if (lpOALFnTable->alGetProcAddress == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetProcAddress' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetProcAddress' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetEnumValue = (LPALGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alGetEnumValue");
|
lpOALFnTable->alGetEnumValue = (LPALGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alGetEnumValue");
|
||||||
if (lpOALFnTable->alGetEnumValue == NULL)
|
if (lpOALFnTable->alGetEnumValue == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetEnumValue' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetEnumValue' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alListeneri = (LPALLISTENERI)GetProcAddress(g_hOpenALDLL, "alListeneri");
|
lpOALFnTable->alListeneri = (LPALLISTENERI)GetProcAddress(g_hOpenALDLL, "alListeneri");
|
||||||
if (lpOALFnTable->alListeneri == NULL)
|
if (lpOALFnTable->alListeneri == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alListeneri' function address\n");
|
OutputDebugString("Failed to retrieve 'alListeneri' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alListenerf = (LPALLISTENERF)GetProcAddress(g_hOpenALDLL, "alListenerf");
|
lpOALFnTable->alListenerf = (LPALLISTENERF)GetProcAddress(g_hOpenALDLL, "alListenerf");
|
||||||
if (lpOALFnTable->alListenerf == NULL)
|
if (lpOALFnTable->alListenerf == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alListenerf' function address\n");
|
OutputDebugString("Failed to retrieve 'alListenerf' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alListener3f = (LPALLISTENER3F)GetProcAddress(g_hOpenALDLL, "alListener3f");
|
lpOALFnTable->alListener3f = (LPALLISTENER3F)GetProcAddress(g_hOpenALDLL, "alListener3f");
|
||||||
if (lpOALFnTable->alListener3f == NULL)
|
if (lpOALFnTable->alListener3f == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alListener3f' function address\n");
|
OutputDebugString("Failed to retrieve 'alListener3f' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alListenerfv = (LPALLISTENERFV)GetProcAddress(g_hOpenALDLL, "alListenerfv");
|
lpOALFnTable->alListenerfv = (LPALLISTENERFV)GetProcAddress(g_hOpenALDLL, "alListenerfv");
|
||||||
if (lpOALFnTable->alListenerfv == NULL)
|
if (lpOALFnTable->alListenerfv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alListenerfv' function address\n");
|
OutputDebugString("Failed to retrieve 'alListenerfv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetListeneri = (LPALGETLISTENERI)GetProcAddress(g_hOpenALDLL, "alGetListeneri");
|
lpOALFnTable->alGetListeneri = (LPALGETLISTENERI)GetProcAddress(g_hOpenALDLL, "alGetListeneri");
|
||||||
if (lpOALFnTable->alGetListeneri == NULL)
|
if (lpOALFnTable->alGetListeneri == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetListeneri' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetListeneri' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetListenerf =(LPALGETLISTENERF)GetProcAddress(g_hOpenALDLL, "alGetListenerf");
|
lpOALFnTable->alGetListenerf =(LPALGETLISTENERF)GetProcAddress(g_hOpenALDLL, "alGetListenerf");
|
||||||
if (lpOALFnTable->alGetListenerf == NULL)
|
if (lpOALFnTable->alGetListenerf == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetListenerf' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetListenerf' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetListener3f = (LPALGETLISTENER3F)GetProcAddress(g_hOpenALDLL, "alGetListener3f");
|
lpOALFnTable->alGetListener3f = (LPALGETLISTENER3F)GetProcAddress(g_hOpenALDLL, "alGetListener3f");
|
||||||
if (lpOALFnTable->alGetListener3f == NULL)
|
if (lpOALFnTable->alGetListener3f == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetListener3f' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetListener3f' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetListenerfv = (LPALGETLISTENERFV)GetProcAddress(g_hOpenALDLL, "alGetListenerfv");
|
lpOALFnTable->alGetListenerfv = (LPALGETLISTENERFV)GetProcAddress(g_hOpenALDLL, "alGetListenerfv");
|
||||||
if (lpOALFnTable->alGetListenerfv == NULL)
|
if (lpOALFnTable->alGetListenerfv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetListenerfv' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetListenerfv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGenSources = (LPALGENSOURCES)GetProcAddress(g_hOpenALDLL, "alGenSources");
|
lpOALFnTable->alGenSources = (LPALGENSOURCES)GetProcAddress(g_hOpenALDLL, "alGenSources");
|
||||||
if (lpOALFnTable->alGenSources == NULL)
|
if (lpOALFnTable->alGenSources == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGenSources' function address\n");
|
OutputDebugString("Failed to retrieve 'alGenSources' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alDeleteSources = (LPALDELETESOURCES)GetProcAddress(g_hOpenALDLL, "alDeleteSources");
|
lpOALFnTable->alDeleteSources = (LPALDELETESOURCES)GetProcAddress(g_hOpenALDLL, "alDeleteSources");
|
||||||
if (lpOALFnTable->alDeleteSources == NULL)
|
if (lpOALFnTable->alDeleteSources == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alDeleteSources' function address\n");
|
OutputDebugString("Failed to retrieve 'alDeleteSources' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alIsSource = (LPALISSOURCE)GetProcAddress(g_hOpenALDLL, "alIsSource");
|
lpOALFnTable->alIsSource = (LPALISSOURCE)GetProcAddress(g_hOpenALDLL, "alIsSource");
|
||||||
if (lpOALFnTable->alIsSource == NULL)
|
if (lpOALFnTable->alIsSource == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alIsSource' function address\n");
|
OutputDebugString("Failed to retrieve 'alIsSource' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourcei = (LPALSOURCEI)GetProcAddress(g_hOpenALDLL, "alSourcei");
|
lpOALFnTable->alSourcei = (LPALSOURCEI)GetProcAddress(g_hOpenALDLL, "alSourcei");
|
||||||
if (lpOALFnTable->alSourcei == NULL)
|
if (lpOALFnTable->alSourcei == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourcei' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourcei' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourcef = (LPALSOURCEF)GetProcAddress(g_hOpenALDLL, "alSourcef");
|
lpOALFnTable->alSourcef = (LPALSOURCEF)GetProcAddress(g_hOpenALDLL, "alSourcef");
|
||||||
if (lpOALFnTable->alSourcef == NULL)
|
if (lpOALFnTable->alSourcef == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourcef' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourcef' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSource3f = (LPALSOURCE3F)GetProcAddress(g_hOpenALDLL, "alSource3f");
|
lpOALFnTable->alSource3f = (LPALSOURCE3F)GetProcAddress(g_hOpenALDLL, "alSource3f");
|
||||||
if (lpOALFnTable->alSource3f == NULL)
|
if (lpOALFnTable->alSource3f == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSource3f' function address\n");
|
OutputDebugString("Failed to retrieve 'alSource3f' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourcefv = (LPALSOURCEFV)GetProcAddress(g_hOpenALDLL, "alSourcefv");
|
lpOALFnTable->alSourcefv = (LPALSOURCEFV)GetProcAddress(g_hOpenALDLL, "alSourcefv");
|
||||||
if (lpOALFnTable->alSourcefv == NULL)
|
if (lpOALFnTable->alSourcefv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourcefv' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourcefv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetSourcei = (LPALGETSOURCEI)GetProcAddress(g_hOpenALDLL, "alGetSourcei");
|
lpOALFnTable->alGetSourcei = (LPALGETSOURCEI)GetProcAddress(g_hOpenALDLL, "alGetSourcei");
|
||||||
if (lpOALFnTable->alGetSourcei == NULL)
|
if (lpOALFnTable->alGetSourcei == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetSourcei' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetSourcei' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetSourcef = (LPALGETSOURCEF)GetProcAddress(g_hOpenALDLL, "alGetSourcef");
|
lpOALFnTable->alGetSourcef = (LPALGETSOURCEF)GetProcAddress(g_hOpenALDLL, "alGetSourcef");
|
||||||
if (lpOALFnTable->alGetSourcef == NULL)
|
if (lpOALFnTable->alGetSourcef == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetSourcef' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetSourcef' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetSourcefv = (LPALGETSOURCEFV)GetProcAddress(g_hOpenALDLL, "alGetSourcefv");
|
lpOALFnTable->alGetSourcefv = (LPALGETSOURCEFV)GetProcAddress(g_hOpenALDLL, "alGetSourcefv");
|
||||||
if (lpOALFnTable->alGetSourcefv == NULL)
|
if (lpOALFnTable->alGetSourcefv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetSourcefv' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetSourcefv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourcePlayv = (LPALSOURCEPLAYV)GetProcAddress(g_hOpenALDLL, "alSourcePlayv");
|
lpOALFnTable->alSourcePlayv = (LPALSOURCEPLAYV)GetProcAddress(g_hOpenALDLL, "alSourcePlayv");
|
||||||
if (lpOALFnTable->alSourcePlayv == NULL)
|
if (lpOALFnTable->alSourcePlayv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourcePlayv' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourcePlayv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourceStopv = (LPALSOURCESTOPV)GetProcAddress(g_hOpenALDLL, "alSourceStopv");
|
lpOALFnTable->alSourceStopv = (LPALSOURCESTOPV)GetProcAddress(g_hOpenALDLL, "alSourceStopv");
|
||||||
if (lpOALFnTable->alSourceStopv == NULL)
|
if (lpOALFnTable->alSourceStopv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourceStopv' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourceStopv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourcePlay = (LPALSOURCEPLAY)GetProcAddress(g_hOpenALDLL, "alSourcePlay");
|
lpOALFnTable->alSourcePlay = (LPALSOURCEPLAY)GetProcAddress(g_hOpenALDLL, "alSourcePlay");
|
||||||
if (lpOALFnTable->alSourcePlay == NULL)
|
if (lpOALFnTable->alSourcePlay == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourcePlay' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourcePlay' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourcePause = (LPALSOURCEPAUSE)GetProcAddress(g_hOpenALDLL, "alSourcePause");
|
lpOALFnTable->alSourcePause = (LPALSOURCEPAUSE)GetProcAddress(g_hOpenALDLL, "alSourcePause");
|
||||||
if (lpOALFnTable->alSourcePause == NULL)
|
if (lpOALFnTable->alSourcePause == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourcePause' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourcePause' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourceStop = (LPALSOURCESTOP)GetProcAddress(g_hOpenALDLL, "alSourceStop");
|
lpOALFnTable->alSourceStop = (LPALSOURCESTOP)GetProcAddress(g_hOpenALDLL, "alSourceStop");
|
||||||
if (lpOALFnTable->alSourceStop == NULL)
|
if (lpOALFnTable->alSourceStop == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourceStop' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourceStop' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGenBuffers = (LPALGENBUFFERS)GetProcAddress(g_hOpenALDLL, "alGenBuffers");
|
lpOALFnTable->alGenBuffers = (LPALGENBUFFERS)GetProcAddress(g_hOpenALDLL, "alGenBuffers");
|
||||||
if (lpOALFnTable->alGenBuffers == NULL)
|
if (lpOALFnTable->alGenBuffers == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGenBuffers' function address\n");
|
OutputDebugString("Failed to retrieve 'alGenBuffers' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alDeleteBuffers = (LPALDELETEBUFFERS)GetProcAddress(g_hOpenALDLL, "alDeleteBuffers");
|
lpOALFnTable->alDeleteBuffers = (LPALDELETEBUFFERS)GetProcAddress(g_hOpenALDLL, "alDeleteBuffers");
|
||||||
if (lpOALFnTable->alDeleteBuffers == NULL)
|
if (lpOALFnTable->alDeleteBuffers == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alDeleteBuffers' function address\n");
|
OutputDebugString("Failed to retrieve 'alDeleteBuffers' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alIsBuffer = (LPALISBUFFER)GetProcAddress(g_hOpenALDLL, "alIsBuffer");
|
lpOALFnTable->alIsBuffer = (LPALISBUFFER)GetProcAddress(g_hOpenALDLL, "alIsBuffer");
|
||||||
if (lpOALFnTable->alIsBuffer == NULL)
|
if (lpOALFnTable->alIsBuffer == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alIsBuffer' function address\n");
|
OutputDebugString("Failed to retrieve 'alIsBuffer' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alBufferData = (LPALBUFFERDATA)GetProcAddress(g_hOpenALDLL, "alBufferData");
|
lpOALFnTable->alBufferData = (LPALBUFFERDATA)GetProcAddress(g_hOpenALDLL, "alBufferData");
|
||||||
if (lpOALFnTable->alBufferData == NULL)
|
if (lpOALFnTable->alBufferData == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alBufferData' function address\n");
|
OutputDebugString("Failed to retrieve 'alBufferData' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetBufferi = (LPALGETBUFFERI)GetProcAddress(g_hOpenALDLL, "alGetBufferi");
|
lpOALFnTable->alGetBufferi = (LPALGETBUFFERI)GetProcAddress(g_hOpenALDLL, "alGetBufferi");
|
||||||
if (lpOALFnTable->alGetBufferi == NULL)
|
if (lpOALFnTable->alGetBufferi == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetBufferi' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetBufferi' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alGetBufferf = (LPALGETBUFFERF)GetProcAddress(g_hOpenALDLL, "alGetBufferf");
|
lpOALFnTable->alGetBufferf = (LPALGETBUFFERF)GetProcAddress(g_hOpenALDLL, "alGetBufferf");
|
||||||
if (lpOALFnTable->alGetBufferf == NULL)
|
if (lpOALFnTable->alGetBufferf == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alGetBufferf' function address\n");
|
OutputDebugString("Failed to retrieve 'alGetBufferf' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourceQueueBuffers = (LPALSOURCEQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceQueueBuffers");
|
lpOALFnTable->alSourceQueueBuffers = (LPALSOURCEQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceQueueBuffers");
|
||||||
if (lpOALFnTable->alSourceQueueBuffers == NULL)
|
if (lpOALFnTable->alSourceQueueBuffers == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourceQueueBuffers' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourceQueueBuffers' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alSourceUnqueueBuffers = (LPALSOURCEUNQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceUnqueueBuffers");
|
lpOALFnTable->alSourceUnqueueBuffers = (LPALSOURCEUNQUEUEBUFFERS)GetProcAddress(g_hOpenALDLL, "alSourceUnqueueBuffers");
|
||||||
if (lpOALFnTable->alSourceUnqueueBuffers == NULL)
|
if (lpOALFnTable->alSourceUnqueueBuffers == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alSourceUnqueueBuffers' function address\n");
|
OutputDebugString("Failed to retrieve 'alSourceUnqueueBuffers' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alDistanceModel = (LPALDISTANCEMODEL)GetProcAddress(g_hOpenALDLL, "alDistanceModel");
|
lpOALFnTable->alDistanceModel = (LPALDISTANCEMODEL)GetProcAddress(g_hOpenALDLL, "alDistanceModel");
|
||||||
if (lpOALFnTable->alDistanceModel == NULL)
|
if (lpOALFnTable->alDistanceModel == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alDistanceModel' function address\n");
|
OutputDebugString("Failed to retrieve 'alDistanceModel' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alDopplerFactor = (LPALDOPPLERFACTOR)GetProcAddress(g_hOpenALDLL, "alDopplerFactor");
|
lpOALFnTable->alDopplerFactor = (LPALDOPPLERFACTOR)GetProcAddress(g_hOpenALDLL, "alDopplerFactor");
|
||||||
if (lpOALFnTable->alDopplerFactor == NULL)
|
if (lpOALFnTable->alDopplerFactor == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alDopplerFactor' function address\n");
|
OutputDebugString("Failed to retrieve 'alDopplerFactor' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alDopplerVelocity = (LPALDOPPLERVELOCITY)GetProcAddress(g_hOpenALDLL, "alDopplerVelocity");
|
lpOALFnTable->alDopplerVelocity = (LPALDOPPLERVELOCITY)GetProcAddress(g_hOpenALDLL, "alDopplerVelocity");
|
||||||
if (lpOALFnTable->alDopplerVelocity == NULL)
|
if (lpOALFnTable->alDopplerVelocity == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alDopplerVelocity' function address\n");
|
OutputDebugString("Failed to retrieve 'alDopplerVelocity' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetString = (LPALCGETSTRING)GetProcAddress(g_hOpenALDLL, "alcGetString");
|
lpOALFnTable->alcGetString = (LPALCGETSTRING)GetProcAddress(g_hOpenALDLL, "alcGetString");
|
||||||
if (lpOALFnTable->alcGetString == NULL)
|
if (lpOALFnTable->alcGetString == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetString' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetString' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetIntegerv = (LPALCGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alcGetIntegerv");
|
lpOALFnTable->alcGetIntegerv = (LPALCGETINTEGERV)GetProcAddress(g_hOpenALDLL, "alcGetIntegerv");
|
||||||
if (lpOALFnTable->alcGetIntegerv == NULL)
|
if (lpOALFnTable->alcGetIntegerv == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetIntegerv' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetIntegerv' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcOpenDevice = (LPALCOPENDEVICE)GetProcAddress(g_hOpenALDLL, "alcOpenDevice");
|
lpOALFnTable->alcOpenDevice = (LPALCOPENDEVICE)GetProcAddress(g_hOpenALDLL, "alcOpenDevice");
|
||||||
if (lpOALFnTable->alcOpenDevice == NULL)
|
if (lpOALFnTable->alcOpenDevice == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcOpenDevice' function address\n");
|
OutputDebugString("Failed to retrieve 'alcOpenDevice' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcCloseDevice = (LPALCCLOSEDEVICE)GetProcAddress(g_hOpenALDLL, "alcCloseDevice");
|
lpOALFnTable->alcCloseDevice = (LPALCCLOSEDEVICE)GetProcAddress(g_hOpenALDLL, "alcCloseDevice");
|
||||||
if (lpOALFnTable->alcCloseDevice == NULL)
|
if (lpOALFnTable->alcCloseDevice == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcCloseDevice' function address\n");
|
OutputDebugString("Failed to retrieve 'alcCloseDevice' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcCreateContext = (LPALCCREATECONTEXT)GetProcAddress(g_hOpenALDLL, "alcCreateContext");
|
lpOALFnTable->alcCreateContext = (LPALCCREATECONTEXT)GetProcAddress(g_hOpenALDLL, "alcCreateContext");
|
||||||
if (lpOALFnTable->alcCreateContext == NULL)
|
if (lpOALFnTable->alcCreateContext == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcCreateContext' function address\n");
|
OutputDebugString("Failed to retrieve 'alcCreateContext' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcMakeContextCurrent = (LPALCMAKECONTEXTCURRENT)GetProcAddress(g_hOpenALDLL, "alcMakeContextCurrent");
|
lpOALFnTable->alcMakeContextCurrent = (LPALCMAKECONTEXTCURRENT)GetProcAddress(g_hOpenALDLL, "alcMakeContextCurrent");
|
||||||
if (lpOALFnTable->alcMakeContextCurrent == NULL)
|
if (lpOALFnTable->alcMakeContextCurrent == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcMakeContextCurrent' function address\n");
|
OutputDebugString("Failed to retrieve 'alcMakeContextCurrent' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcProcessContext = (LPALCPROCESSCONTEXT)GetProcAddress(g_hOpenALDLL, "alcProcessContext");
|
lpOALFnTable->alcProcessContext = (LPALCPROCESSCONTEXT)GetProcAddress(g_hOpenALDLL, "alcProcessContext");
|
||||||
if (lpOALFnTable->alcProcessContext == NULL)
|
if (lpOALFnTable->alcProcessContext == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcProcessContext' function address\n");
|
OutputDebugString("Failed to retrieve 'alcProcessContext' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetCurrentContext = (LPALCGETCURRENTCONTEXT)GetProcAddress(g_hOpenALDLL, "alcGetCurrentContext");
|
lpOALFnTable->alcGetCurrentContext = (LPALCGETCURRENTCONTEXT)GetProcAddress(g_hOpenALDLL, "alcGetCurrentContext");
|
||||||
if (lpOALFnTable->alcGetCurrentContext == NULL)
|
if (lpOALFnTable->alcGetCurrentContext == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetCurrentContext' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetCurrentContext' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetContextsDevice = (LPALCGETCONTEXTSDEVICE)GetProcAddress(g_hOpenALDLL, "alcGetContextsDevice");
|
lpOALFnTable->alcGetContextsDevice = (LPALCGETCONTEXTSDEVICE)GetProcAddress(g_hOpenALDLL, "alcGetContextsDevice");
|
||||||
if (lpOALFnTable->alcGetContextsDevice == NULL)
|
if (lpOALFnTable->alcGetContextsDevice == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetContextsDevice' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetContextsDevice' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcSuspendContext = (LPALCSUSPENDCONTEXT)GetProcAddress(g_hOpenALDLL, "alcSuspendContext");
|
lpOALFnTable->alcSuspendContext = (LPALCSUSPENDCONTEXT)GetProcAddress(g_hOpenALDLL, "alcSuspendContext");
|
||||||
if (lpOALFnTable->alcSuspendContext == NULL)
|
if (lpOALFnTable->alcSuspendContext == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcSuspendContext' function address\n");
|
OutputDebugString("Failed to retrieve 'alcSuspendContext' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcDestroyContext = (LPALCDESTROYCONTEXT)GetProcAddress(g_hOpenALDLL, "alcDestroyContext");
|
lpOALFnTable->alcDestroyContext = (LPALCDESTROYCONTEXT)GetProcAddress(g_hOpenALDLL, "alcDestroyContext");
|
||||||
if (lpOALFnTable->alcDestroyContext == NULL)
|
if (lpOALFnTable->alcDestroyContext == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcDestroyContext' function address\n");
|
OutputDebugString("Failed to retrieve 'alcDestroyContext' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetError = (LPALCGETERROR)GetProcAddress(g_hOpenALDLL, "alcGetError");
|
lpOALFnTable->alcGetError = (LPALCGETERROR)GetProcAddress(g_hOpenALDLL, "alcGetError");
|
||||||
if (lpOALFnTable->alcGetError == NULL)
|
if (lpOALFnTable->alcGetError == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetError' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetError' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcIsExtensionPresent = (LPALCISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alcIsExtensionPresent");
|
lpOALFnTable->alcIsExtensionPresent = (LPALCISEXTENSIONPRESENT)GetProcAddress(g_hOpenALDLL, "alcIsExtensionPresent");
|
||||||
if (lpOALFnTable->alcIsExtensionPresent == NULL)
|
if (lpOALFnTable->alcIsExtensionPresent == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcIsExtensionPresent' function address\n");
|
OutputDebugString("Failed to retrieve 'alcIsExtensionPresent' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetProcAddress = (LPALCGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alcGetProcAddress");
|
lpOALFnTable->alcGetProcAddress = (LPALCGETPROCADDRESS)GetProcAddress(g_hOpenALDLL, "alcGetProcAddress");
|
||||||
if (lpOALFnTable->alcGetProcAddress == NULL)
|
if (lpOALFnTable->alcGetProcAddress == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetProcAddress' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetProcAddress' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
lpOALFnTable->alcGetEnumValue = (LPALCGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alcGetEnumValue");
|
lpOALFnTable->alcGetEnumValue = (LPALCGETENUMVALUE)GetProcAddress(g_hOpenALDLL, "alcGetEnumValue");
|
||||||
if (lpOALFnTable->alcGetEnumValue == NULL)
|
if (lpOALFnTable->alcGetEnumValue == NULL)
|
||||||
{
|
{
|
||||||
OutputDebugString("Failed to retrieve 'alcGetEnumValue' function address\n");
|
OutputDebugString("Failed to retrieve 'alcGetEnumValue' function address\n");
|
||||||
return AL_FALSE;
|
return AL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AL_TRUE;
|
return AL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALvoid UnloadOAL10Library()
|
ALvoid UnloadOAL10Library()
|
||||||
{
|
{
|
||||||
// Unload the dll
|
// Unload the dll
|
||||||
if (g_hOpenALDLL)
|
if (g_hOpenALDLL)
|
||||||
{
|
{
|
||||||
FreeLibrary(g_hOpenALDLL);
|
FreeLibrary(g_hOpenALDLL);
|
||||||
g_hOpenALDLL = NULL;
|
g_hOpenALDLL = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,164 +1,164 @@
|
||||||
#include <al.h>
|
#include <al.h>
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
|
|
||||||
// Open AL Function table definition
|
// Open AL Function table definition
|
||||||
|
|
||||||
#ifndef _OPENALFNTABLE
|
#ifndef _OPENALFNTABLE
|
||||||
#define _OPENALFNTABLE
|
#define _OPENALFNTABLE
|
||||||
|
|
||||||
// AL 1.0 did not define the ALchar and ALCchar types, so define them here
|
// AL 1.0 did not define the ALchar and ALCchar types, so define them here
|
||||||
// if they don't exist
|
// if they don't exist
|
||||||
|
|
||||||
#ifndef ALchar
|
#ifndef ALchar
|
||||||
#define ALchar char
|
#define ALchar char
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ALCchar
|
#ifndef ALCchar
|
||||||
#define ALCchar char
|
#define ALCchar char
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Complete list of functions available in AL 1.0 implementations
|
// Complete list of functions available in AL 1.0 implementations
|
||||||
|
|
||||||
typedef void (ALAPIENTRY *LPALENABLE)( ALenum capability );
|
typedef void (ALAPIENTRY *LPALENABLE)( ALenum capability );
|
||||||
typedef void (ALAPIENTRY *LPALDISABLE)( ALenum capability );
|
typedef void (ALAPIENTRY *LPALDISABLE)( ALenum capability );
|
||||||
typedef ALboolean (ALAPIENTRY *LPALISENABLED)( ALenum capability );
|
typedef ALboolean (ALAPIENTRY *LPALISENABLED)( ALenum capability );
|
||||||
typedef const ALchar* (ALAPIENTRY *LPALGETSTRING)( ALenum param );
|
typedef const ALchar* (ALAPIENTRY *LPALGETSTRING)( ALenum param );
|
||||||
typedef void (ALAPIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
|
typedef void (ALAPIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
|
||||||
typedef void (ALAPIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
|
typedef void (ALAPIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
|
||||||
typedef void (ALAPIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
|
typedef void (ALAPIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
|
||||||
typedef void (ALAPIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
|
typedef void (ALAPIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
|
||||||
typedef ALboolean (ALAPIENTRY *LPALGETBOOLEAN)( ALenum param );
|
typedef ALboolean (ALAPIENTRY *LPALGETBOOLEAN)( ALenum param );
|
||||||
typedef ALint (ALAPIENTRY *LPALGETINTEGER)( ALenum param );
|
typedef ALint (ALAPIENTRY *LPALGETINTEGER)( ALenum param );
|
||||||
typedef ALfloat (ALAPIENTRY *LPALGETFLOAT)( ALenum param );
|
typedef ALfloat (ALAPIENTRY *LPALGETFLOAT)( ALenum param );
|
||||||
typedef ALdouble (ALAPIENTRY *LPALGETDOUBLE)( ALenum param );
|
typedef ALdouble (ALAPIENTRY *LPALGETDOUBLE)( ALenum param );
|
||||||
typedef ALenum (ALAPIENTRY *LPALGETERROR)( void );
|
typedef ALenum (ALAPIENTRY *LPALGETERROR)( void );
|
||||||
typedef ALboolean (ALAPIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
|
typedef ALboolean (ALAPIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
|
||||||
typedef void* (ALAPIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
|
typedef void* (ALAPIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
|
||||||
typedef ALenum (ALAPIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
|
typedef ALenum (ALAPIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
|
||||||
typedef void (ALAPIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
|
typedef void (ALAPIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
|
||||||
typedef void (ALAPIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
typedef void (ALAPIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||||
typedef void (ALAPIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
|
typedef void (ALAPIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
|
||||||
typedef void (ALAPIENTRY *LPALLISTENERI)( ALenum param, ALint value );
|
typedef void (ALAPIENTRY *LPALLISTENERI)( ALenum param, ALint value );
|
||||||
typedef void (ALAPIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
|
typedef void (ALAPIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
|
||||||
typedef void (ALAPIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
typedef void (ALAPIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||||
typedef void (ALAPIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
|
typedef void (ALAPIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
|
||||||
typedef void (ALAPIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
|
typedef void (ALAPIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
|
||||||
typedef void (ALAPIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
|
typedef void (ALAPIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
|
||||||
typedef void (ALAPIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
|
typedef void (ALAPIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
|
||||||
typedef ALboolean (ALAPIENTRY *LPALISSOURCE)( ALuint sid );
|
typedef ALboolean (ALAPIENTRY *LPALISSOURCE)( ALuint sid );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
|
typedef void (ALAPIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
|
||||||
typedef void (ALAPIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
typedef void (ALAPIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
|
typedef void (ALAPIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
|
typedef void (ALAPIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
|
||||||
typedef void (ALAPIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
|
typedef void (ALAPIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
|
||||||
typedef void (ALAPIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
typedef void (ALAPIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||||
typedef void (ALAPIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
|
typedef void (ALAPIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
|
||||||
typedef void (ALAPIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
|
typedef void (ALAPIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
|
typedef void (ALAPIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
|
typedef void (ALAPIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
|
typedef void (ALAPIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
|
typedef void (ALAPIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEPLAY)( ALuint sid );
|
typedef void (ALAPIENTRY *LPALSOURCEPLAY)( ALuint sid );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCESTOP)( ALuint sid );
|
typedef void (ALAPIENTRY *LPALSOURCESTOP)( ALuint sid );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEREWIND)( ALuint sid );
|
typedef void (ALAPIENTRY *LPALSOURCEREWIND)( ALuint sid );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEPAUSE)( ALuint sid );
|
typedef void (ALAPIENTRY *LPALSOURCEPAUSE)( ALuint sid );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
|
typedef void (ALAPIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
|
||||||
typedef void (ALAPIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
|
typedef void (ALAPIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||||
typedef void (ALAPIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
|
typedef void (ALAPIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
|
||||||
typedef void (ALAPIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
|
typedef void (ALAPIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
|
||||||
typedef ALboolean (ALAPIENTRY *LPALISBUFFER)( ALuint bid );
|
typedef ALboolean (ALAPIENTRY *LPALISBUFFER)( ALuint bid );
|
||||||
typedef void (ALAPIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
typedef void (ALAPIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||||
typedef void (ALAPIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
|
typedef void (ALAPIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
|
||||||
typedef void (ALAPIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
|
typedef void (ALAPIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
|
||||||
typedef void (ALAPIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
|
typedef void (ALAPIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
|
||||||
typedef void (ALAPIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
|
typedef void (ALAPIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
|
||||||
typedef void (ALAPIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
|
typedef void (ALAPIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
|
||||||
|
|
||||||
typedef ALCcontext * (ALCAPIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
|
typedef ALCcontext * (ALCAPIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
|
||||||
typedef ALCboolean (ALCAPIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
|
typedef ALCboolean (ALCAPIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
|
||||||
typedef void (ALCAPIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
|
typedef void (ALCAPIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
|
||||||
typedef void (ALCAPIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
|
typedef void (ALCAPIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
|
||||||
typedef void (ALCAPIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
|
typedef void (ALCAPIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
|
||||||
typedef ALCcontext * (ALCAPIENTRY *LPALCGETCURRENTCONTEXT)( ALCvoid );
|
typedef ALCcontext * (ALCAPIENTRY *LPALCGETCURRENTCONTEXT)( ALCvoid );
|
||||||
typedef ALCdevice * (ALCAPIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
|
typedef ALCdevice * (ALCAPIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
|
||||||
typedef ALCdevice * (ALCAPIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
|
typedef ALCdevice * (ALCAPIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
|
||||||
typedef ALCboolean (ALCAPIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
|
typedef ALCboolean (ALCAPIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
|
||||||
typedef ALCenum (ALCAPIENTRY *LPALCGETERROR)( ALCdevice *device );
|
typedef ALCenum (ALCAPIENTRY *LPALCGETERROR)( ALCdevice *device );
|
||||||
typedef ALCboolean (ALCAPIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
|
typedef ALCboolean (ALCAPIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
|
||||||
typedef void * (ALCAPIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
|
typedef void * (ALCAPIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
|
||||||
typedef ALCenum (ALCAPIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
|
typedef ALCenum (ALCAPIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
|
||||||
typedef const ALCchar* (ALCAPIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
|
typedef const ALCchar* (ALCAPIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
|
||||||
typedef void (ALCAPIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
|
typedef void (ALCAPIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
LPALENABLE alEnable;
|
LPALENABLE alEnable;
|
||||||
LPALDISABLE alDisable;
|
LPALDISABLE alDisable;
|
||||||
LPALISENABLED alIsEnabled;
|
LPALISENABLED alIsEnabled;
|
||||||
LPALGETBOOLEAN alGetBoolean;
|
LPALGETBOOLEAN alGetBoolean;
|
||||||
LPALGETINTEGER alGetInteger;
|
LPALGETINTEGER alGetInteger;
|
||||||
LPALGETFLOAT alGetFloat;
|
LPALGETFLOAT alGetFloat;
|
||||||
LPALGETDOUBLE alGetDouble;
|
LPALGETDOUBLE alGetDouble;
|
||||||
LPALGETBOOLEANV alGetBooleanv;
|
LPALGETBOOLEANV alGetBooleanv;
|
||||||
LPALGETINTEGERV alGetIntegerv;
|
LPALGETINTEGERV alGetIntegerv;
|
||||||
LPALGETFLOATV alGetFloatv;
|
LPALGETFLOATV alGetFloatv;
|
||||||
LPALGETDOUBLEV alGetDoublev;
|
LPALGETDOUBLEV alGetDoublev;
|
||||||
LPALGETSTRING alGetString;
|
LPALGETSTRING alGetString;
|
||||||
LPALGETERROR alGetError;
|
LPALGETERROR alGetError;
|
||||||
LPALISEXTENSIONPRESENT alIsExtensionPresent;
|
LPALISEXTENSIONPRESENT alIsExtensionPresent;
|
||||||
LPALGETPROCADDRESS alGetProcAddress;
|
LPALGETPROCADDRESS alGetProcAddress;
|
||||||
LPALGETENUMVALUE alGetEnumValue;
|
LPALGETENUMVALUE alGetEnumValue;
|
||||||
LPALLISTENERI alListeneri;
|
LPALLISTENERI alListeneri;
|
||||||
LPALLISTENERF alListenerf;
|
LPALLISTENERF alListenerf;
|
||||||
LPALLISTENER3F alListener3f;
|
LPALLISTENER3F alListener3f;
|
||||||
LPALLISTENERFV alListenerfv;
|
LPALLISTENERFV alListenerfv;
|
||||||
LPALGETLISTENERI alGetListeneri;
|
LPALGETLISTENERI alGetListeneri;
|
||||||
LPALGETLISTENERF alGetListenerf;
|
LPALGETLISTENERF alGetListenerf;
|
||||||
LPALGETLISTENER3F alGetListener3f;
|
LPALGETLISTENER3F alGetListener3f;
|
||||||
LPALGETLISTENERFV alGetListenerfv;
|
LPALGETLISTENERFV alGetListenerfv;
|
||||||
LPALGENSOURCES alGenSources;
|
LPALGENSOURCES alGenSources;
|
||||||
LPALDELETESOURCES alDeleteSources;
|
LPALDELETESOURCES alDeleteSources;
|
||||||
LPALISSOURCE alIsSource;
|
LPALISSOURCE alIsSource;
|
||||||
LPALSOURCEI alSourcei;
|
LPALSOURCEI alSourcei;
|
||||||
LPALSOURCEF alSourcef;
|
LPALSOURCEF alSourcef;
|
||||||
LPALSOURCE3F alSource3f;
|
LPALSOURCE3F alSource3f;
|
||||||
LPALSOURCEFV alSourcefv;
|
LPALSOURCEFV alSourcefv;
|
||||||
LPALGETSOURCEI alGetSourcei;
|
LPALGETSOURCEI alGetSourcei;
|
||||||
LPALGETSOURCEF alGetSourcef;
|
LPALGETSOURCEF alGetSourcef;
|
||||||
LPALGETSOURCEFV alGetSourcefv;
|
LPALGETSOURCEFV alGetSourcefv;
|
||||||
LPALSOURCEPLAYV alSourcePlayv;
|
LPALSOURCEPLAYV alSourcePlayv;
|
||||||
LPALSOURCESTOPV alSourceStopv;
|
LPALSOURCESTOPV alSourceStopv;
|
||||||
LPALSOURCEPLAY alSourcePlay;
|
LPALSOURCEPLAY alSourcePlay;
|
||||||
LPALSOURCEPAUSE alSourcePause;
|
LPALSOURCEPAUSE alSourcePause;
|
||||||
LPALSOURCESTOP alSourceStop;
|
LPALSOURCESTOP alSourceStop;
|
||||||
LPALGENBUFFERS alGenBuffers;
|
LPALGENBUFFERS alGenBuffers;
|
||||||
LPALDELETEBUFFERS alDeleteBuffers;
|
LPALDELETEBUFFERS alDeleteBuffers;
|
||||||
LPALISBUFFER alIsBuffer;
|
LPALISBUFFER alIsBuffer;
|
||||||
LPALBUFFERDATA alBufferData;
|
LPALBUFFERDATA alBufferData;
|
||||||
LPALGETBUFFERI alGetBufferi;
|
LPALGETBUFFERI alGetBufferi;
|
||||||
LPALGETBUFFERF alGetBufferf;
|
LPALGETBUFFERF alGetBufferf;
|
||||||
LPALSOURCEQUEUEBUFFERS alSourceQueueBuffers;
|
LPALSOURCEQUEUEBUFFERS alSourceQueueBuffers;
|
||||||
LPALSOURCEUNQUEUEBUFFERS alSourceUnqueueBuffers;
|
LPALSOURCEUNQUEUEBUFFERS alSourceUnqueueBuffers;
|
||||||
LPALDISTANCEMODEL alDistanceModel;
|
LPALDISTANCEMODEL alDistanceModel;
|
||||||
LPALDOPPLERFACTOR alDopplerFactor;
|
LPALDOPPLERFACTOR alDopplerFactor;
|
||||||
LPALDOPPLERVELOCITY alDopplerVelocity;
|
LPALDOPPLERVELOCITY alDopplerVelocity;
|
||||||
LPALCGETSTRING alcGetString;
|
LPALCGETSTRING alcGetString;
|
||||||
LPALCGETINTEGERV alcGetIntegerv;
|
LPALCGETINTEGERV alcGetIntegerv;
|
||||||
LPALCOPENDEVICE alcOpenDevice;
|
LPALCOPENDEVICE alcOpenDevice;
|
||||||
LPALCCLOSEDEVICE alcCloseDevice;
|
LPALCCLOSEDEVICE alcCloseDevice;
|
||||||
LPALCCREATECONTEXT alcCreateContext;
|
LPALCCREATECONTEXT alcCreateContext;
|
||||||
LPALCMAKECONTEXTCURRENT alcMakeContextCurrent;
|
LPALCMAKECONTEXTCURRENT alcMakeContextCurrent;
|
||||||
LPALCPROCESSCONTEXT alcProcessContext;
|
LPALCPROCESSCONTEXT alcProcessContext;
|
||||||
LPALCGETCURRENTCONTEXT alcGetCurrentContext;
|
LPALCGETCURRENTCONTEXT alcGetCurrentContext;
|
||||||
LPALCGETCONTEXTSDEVICE alcGetContextsDevice;
|
LPALCGETCONTEXTSDEVICE alcGetContextsDevice;
|
||||||
LPALCSUSPENDCONTEXT alcSuspendContext;
|
LPALCSUSPENDCONTEXT alcSuspendContext;
|
||||||
LPALCDESTROYCONTEXT alcDestroyContext;
|
LPALCDESTROYCONTEXT alcDestroyContext;
|
||||||
LPALCGETERROR alcGetError;
|
LPALCGETERROR alcGetError;
|
||||||
LPALCISEXTENSIONPRESENT alcIsExtensionPresent;
|
LPALCISEXTENSIONPRESENT alcIsExtensionPresent;
|
||||||
LPALCGETPROCADDRESS alcGetProcAddress;
|
LPALCGETPROCADDRESS alcGetProcAddress;
|
||||||
LPALCGETENUMVALUE alcGetEnumValue;
|
LPALCGETENUMVALUE alcGetEnumValue;
|
||||||
} OPENALFNTABLE, *LPOPENALFNTABLE;
|
} OPENALFNTABLE, *LPOPENALFNTABLE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable);
|
ALboolean LoadOAL10Library(char *szOALFullPathName, LPOPENALFNTABLE lpOALFnTable);
|
||||||
ALvoid UnloadOAL10Library();
|
ALvoid UnloadOAL10Library();
|
||||||
|
|
|
@ -723,7 +723,7 @@ void MainWnd::OnInitMenuPopup(CMenu* pMenu, UINT nIndex, BOOL bSysMenu)
|
||||||
void MainWnd::OnMoving(UINT fwSide, LPRECT pRect)
|
void MainWnd::OnMoving(UINT fwSide, LPRECT pRect)
|
||||||
{
|
{
|
||||||
CWnd::OnMoving(fwSide, pRect);
|
CWnd::OnMoving(fwSide, pRect);
|
||||||
|
|
||||||
if( emulating ) {
|
if( emulating ) {
|
||||||
soundPause();
|
soundPause();
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ void MainWnd::OnMoving(UINT fwSide, LPRECT pRect)
|
||||||
void MainWnd::OnMove(int x, int y)
|
void MainWnd::OnMove(int x, int y)
|
||||||
{
|
{
|
||||||
CWnd::OnMove(x, y);
|
CWnd::OnMove(x, y);
|
||||||
|
|
||||||
if(!theApp.changingVideoSize) {
|
if(!theApp.changingVideoSize) {
|
||||||
if(this) {
|
if(this) {
|
||||||
if(!IsIconic()) {
|
if(!IsIconic()) {
|
||||||
|
@ -1077,7 +1077,7 @@ bool MainWnd::fileOpenSelect( int system )
|
||||||
filter = winLoadFilter( IDS_FILTER_GBROM );
|
filter = winLoadFilter( IDS_FILTER_GBROM );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
title = winResLoadString( IDS_SELECT_ROM );
|
title = winResLoadString( IDS_SELECT_ROM );
|
||||||
|
|
||||||
if( !initialDir.IsEmpty() ) {
|
if( !initialDir.IsEmpty() ) {
|
||||||
|
|
|
@ -1768,7 +1768,7 @@ void MainWnd::OnOutputapiOalconfiguration()
|
||||||
|
|
||||||
dlg.selectedDevice = theApp.oalDevice;
|
dlg.selectedDevice = theApp.oalDevice;
|
||||||
dlg.bufferCount = theApp.oalBufferCount;
|
dlg.bufferCount = theApp.oalBufferCount;
|
||||||
|
|
||||||
if( dlg.DoModal() == IDOK ) {
|
if( dlg.DoModal() == IDOK ) {
|
||||||
systemSoundShutdown();
|
systemSoundShutdown();
|
||||||
// do this before changing any values OpenAL
|
// do this before changing any values OpenAL
|
||||||
|
|
|
@ -344,36 +344,36 @@ void MainWnd::OnToolsRecordStartavirecording()
|
||||||
{
|
{
|
||||||
CString captureBuffer;
|
CString captureBuffer;
|
||||||
CString capdir = regQueryStringValue( "aviRecordDir", NULL );
|
CString capdir = regQueryStringValue( "aviRecordDir", NULL );
|
||||||
|
|
||||||
if( capdir.IsEmpty() ) {
|
if( capdir.IsEmpty() ) {
|
||||||
capdir = getDirFromFile( theApp.filename );
|
capdir = getDirFromFile( theApp.filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
CString filter = theApp.winLoadFilter( IDS_FILTER_AVI );
|
CString filter = theApp.winLoadFilter( IDS_FILTER_AVI );
|
||||||
CString title = winResLoadString( IDS_SELECT_AVI_NAME );
|
CString title = winResLoadString( IDS_SELECT_AVI_NAME );
|
||||||
|
|
||||||
LPCTSTR exts[] = { ".AVI" };
|
LPCTSTR exts[] = { ".AVI" };
|
||||||
|
|
||||||
FileDlg dlg( this, "", filter, 1, "AVI", exts, capdir, title, true );
|
FileDlg dlg( this, "", filter, 1, "AVI", exts, capdir, title, true );
|
||||||
|
|
||||||
if( dlg.DoModal() == IDCANCEL ) {
|
if( dlg.DoModal() == IDCANCEL ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
captureBuffer = theApp.soundRecordName = dlg.GetPathName();
|
captureBuffer = theApp.soundRecordName = dlg.GetPathName();
|
||||||
theApp.aviRecordName = captureBuffer;
|
theApp.aviRecordName = captureBuffer;
|
||||||
theApp.aviRecording = true;
|
theApp.aviRecording = true;
|
||||||
|
|
||||||
if( dlg.m_ofn.nFileOffset > 0 ) {
|
if( dlg.m_ofn.nFileOffset > 0 ) {
|
||||||
captureBuffer = captureBuffer.Left( dlg.m_ofn.nFileOffset );
|
captureBuffer = captureBuffer.Left( dlg.m_ofn.nFileOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = captureBuffer.GetLength();
|
int len = captureBuffer.GetLength();
|
||||||
|
|
||||||
if( ( len > 3 ) && captureBuffer[ len - 1 ] == '\\' ) {
|
if( ( len > 3 ) && captureBuffer[ len - 1 ] == '\\' ) {
|
||||||
captureBuffer = captureBuffer.Left( len - 1 );
|
captureBuffer = captureBuffer.Left( len - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
regSetStringValue( "aviRecordDir", captureBuffer );
|
regSetStringValue( "aviRecordDir", captureBuffer );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,91 +1,91 @@
|
||||||
// src/win32/OALConfig.cpp : implementation file
|
// src/win32/OALConfig.cpp : implementation file
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef NO_OAL
|
#ifndef NO_OAL
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "OALConfig.h"
|
#include "OALConfig.h"
|
||||||
|
|
||||||
// OpenAL
|
// OpenAL
|
||||||
#include <al.h>
|
#include <al.h>
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
#include "LoadOAL.h"
|
#include "LoadOAL.h"
|
||||||
|
|
||||||
|
|
||||||
// OALConfig dialog
|
// OALConfig dialog
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC(OALConfig, CDialog)
|
IMPLEMENT_DYNAMIC(OALConfig, CDialog)
|
||||||
|
|
||||||
OALConfig::OALConfig(CWnd* pParent /*=NULL*/)
|
OALConfig::OALConfig(CWnd* pParent /*=NULL*/)
|
||||||
: CDialog(OALConfig::IDD, pParent)
|
: CDialog(OALConfig::IDD, pParent)
|
||||||
, selectedDevice(_T(""))
|
, selectedDevice(_T(""))
|
||||||
, bufferCount(0)
|
, bufferCount(0)
|
||||||
{
|
{
|
||||||
if( !LoadOAL10Library( NULL, &ALFunction ) ) {
|
if( !LoadOAL10Library( NULL, &ALFunction ) ) {
|
||||||
systemMessage( IDS_OAL_NODLL, "OpenAL32.dll could not be found on your system. Please install the runtime from http://openal.org" );
|
systemMessage( IDS_OAL_NODLL, "OpenAL32.dll could not be found on your system. Please install the runtime from http://openal.org" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OALConfig::~OALConfig()
|
OALConfig::~OALConfig()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OALConfig::DoDataExchange(CDataExchange* pDX)
|
void OALConfig::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
CDialog::DoDataExchange(pDX);
|
CDialog::DoDataExchange(pDX);
|
||||||
DDX_Control(pDX, IDC_DEVICE, m_cbDevice);
|
DDX_Control(pDX, IDC_DEVICE, m_cbDevice);
|
||||||
|
|
||||||
if( !pDX->m_bSaveAndValidate ) {
|
if( !pDX->m_bSaveAndValidate ) {
|
||||||
// enumerate devices
|
// enumerate devices
|
||||||
const ALchar *devices = NULL;
|
const ALchar *devices = NULL;
|
||||||
devices = ALFunction.alcGetString( NULL, ALC_DEVICE_SPECIFIER );
|
devices = ALFunction.alcGetString( NULL, ALC_DEVICE_SPECIFIER );
|
||||||
if( strlen( devices ) ) {
|
if( strlen( devices ) ) {
|
||||||
while( *devices ) {
|
while( *devices ) {
|
||||||
m_cbDevice.AddString( devices );
|
m_cbDevice.AddString( devices );
|
||||||
devices += strlen( devices ) + 1;
|
devices += strlen( devices ) + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
systemMessage( IDS_OAL_NODEVICE, "There are no sound devices present on this system." );
|
systemMessage( IDS_OAL_NODEVICE, "There are no sound devices present on this system." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DDX_CBString(pDX, IDC_DEVICE, selectedDevice);
|
DDX_CBString(pDX, IDC_DEVICE, selectedDevice);
|
||||||
DDX_Control(pDX, IDC_SLIDER_BUFFERCOUNT, m_sliderBufferCount);
|
DDX_Control(pDX, IDC_SLIDER_BUFFERCOUNT, m_sliderBufferCount);
|
||||||
DDX_Slider(pDX, IDC_SLIDER_BUFFERCOUNT, bufferCount);
|
DDX_Slider(pDX, IDC_SLIDER_BUFFERCOUNT, bufferCount);
|
||||||
DDX_Control(pDX, IDC_BUFFERINFO, m_bufferInfo);
|
DDX_Control(pDX, IDC_BUFFERINFO, m_bufferInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL OALConfig::OnInitDialog()
|
BOOL OALConfig::OnInitDialog()
|
||||||
{
|
{
|
||||||
CDialog::OnInitDialog();
|
CDialog::OnInitDialog();
|
||||||
m_sliderBufferCount.SetRange( 2, 10, FALSE );
|
m_sliderBufferCount.SetRange( 2, 10, FALSE );
|
||||||
m_sliderBufferCount.SetTicFreq( 1 );
|
m_sliderBufferCount.SetTicFreq( 1 );
|
||||||
m_sliderBufferCount.SetPos( bufferCount );
|
m_sliderBufferCount.SetPos( bufferCount );
|
||||||
|
|
||||||
CString info;
|
CString info;
|
||||||
int pos = m_sliderBufferCount.GetPos();
|
int pos = m_sliderBufferCount.GetPos();
|
||||||
info.Format( _T("%i frames = %.2f ms"), pos, (float)pos / 60.0f * 1000.0f );
|
info.Format( _T("%i frames = %.2f ms"), pos, (float)pos / 60.0f * 1000.0f );
|
||||||
m_bufferInfo.SetWindowText( info );
|
m_bufferInfo.SetWindowText( info );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(OALConfig, CDialog)
|
BEGIN_MESSAGE_MAP(OALConfig, CDialog)
|
||||||
ON_WM_HSCROLL()
|
ON_WM_HSCROLL()
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
// OALConfig message handlers
|
// OALConfig message handlers
|
||||||
|
|
||||||
void OALConfig::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
void OALConfig::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
||||||
{
|
{
|
||||||
CString info;
|
CString info;
|
||||||
int pos = m_sliderBufferCount.GetPos();
|
int pos = m_sliderBufferCount.GetPos();
|
||||||
info.Format( _T("%i frames = %.2f ms"), pos, (float)pos / 60.0f * 1000.0f );
|
info.Format( _T("%i frames = %.2f ms"), pos, (float)pos / 60.0f * 1000.0f );
|
||||||
m_bufferInfo.SetWindowText( info );
|
m_bufferInfo.SetWindowText( info );
|
||||||
|
|
||||||
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
#ifndef NO_OAL
|
#ifndef NO_OAL
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "afxwin.h"
|
#include "afxwin.h"
|
||||||
|
|
||||||
// OpenAL
|
// OpenAL
|
||||||
#include <al.h>
|
#include <al.h>
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
#include "LoadOAL.h"
|
#include "LoadOAL.h"
|
||||||
#include "afxcmn.h"
|
#include "afxcmn.h"
|
||||||
|
|
||||||
|
|
||||||
// OALConfig dialog
|
// OALConfig dialog
|
||||||
|
|
||||||
class OALConfig : public CDialog
|
class OALConfig : public CDialog
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC(OALConfig)
|
DECLARE_DYNAMIC(OALConfig)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OALConfig(CWnd* pParent = NULL); // standard constructor
|
OALConfig(CWnd* pParent = NULL); // standard constructor
|
||||||
virtual ~OALConfig();
|
virtual ~OALConfig();
|
||||||
|
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
enum { IDD = IDD_OAL_CONFIG };
|
enum { IDD = IDD_OAL_CONFIG };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
virtual BOOL OnInitDialog();
|
virtual BOOL OnInitDialog();
|
||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
private:
|
private:
|
||||||
OPENALFNTABLE ALFunction;
|
OPENALFNTABLE ALFunction;
|
||||||
CComboBox m_cbDevice;
|
CComboBox m_cbDevice;
|
||||||
CSliderCtrl m_sliderBufferCount;
|
CSliderCtrl m_sliderBufferCount;
|
||||||
CStatic m_bufferInfo;
|
CStatic m_bufferInfo;
|
||||||
public:
|
public:
|
||||||
CString selectedDevice;
|
CString selectedDevice;
|
||||||
int bufferCount;
|
int bufferCount;
|
||||||
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,344 +1,344 @@
|
||||||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||||
// Copyright (C) 2007-2008 VBA-M development team
|
// Copyright (C) 2007-2008 VBA-M development team
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation; either version 2, or(at your option)
|
// the Free Software Foundation; either version 2, or(at your option)
|
||||||
// any later version.
|
// any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software Foundation,
|
// along with this program; if not, write to the Free Software Foundation,
|
||||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef NO_OAL
|
#ifndef NO_OAL
|
||||||
|
|
||||||
|
|
||||||
// === LOGALL writes very detailed informations to vba-trace.log ===
|
// === LOGALL writes very detailed informations to vba-trace.log ===
|
||||||
//#define LOGALL
|
//#define LOGALL
|
||||||
|
|
||||||
|
|
||||||
#include "stdafx.h" // includes VBA.h for 'theApp.throttle'
|
#include "stdafx.h" // includes VBA.h for 'theApp.throttle'
|
||||||
|
|
||||||
// Interface
|
// Interface
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
|
|
||||||
// OpenAL
|
// OpenAL
|
||||||
#include <al.h>
|
#include <al.h>
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
#include "LoadOAL.h"
|
#include "LoadOAL.h"
|
||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
#include <windows.h> // for 'Sleep' function
|
#include <windows.h> // for 'Sleep' function
|
||||||
|
|
||||||
// Internals
|
// Internals
|
||||||
#include "../Sound.h"
|
#include "../Sound.h"
|
||||||
#include "../Globals.h" // for 'speedup' and 'synchronize'
|
#include "../Globals.h" // for 'speedup' and 'synchronize'
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifndef LOGALL
|
#ifndef LOGALL
|
||||||
// replace logging functions with comments
|
// replace logging functions with comments
|
||||||
#define winlog //
|
#define winlog //
|
||||||
#define debugState() //
|
#define debugState() //
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class OpenAL : public ISound
|
class OpenAL : public ISound
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpenAL();
|
OpenAL();
|
||||||
virtual ~OpenAL();
|
virtual ~OpenAL();
|
||||||
|
|
||||||
bool init(); // initialize the sound buffer queue
|
bool init(); // initialize the sound buffer queue
|
||||||
void pause(); // pause the secondary sound buffer
|
void pause(); // pause the secondary sound buffer
|
||||||
void reset(); // stop and reset the secondary sound buffer
|
void reset(); // stop and reset the secondary sound buffer
|
||||||
void resume(); // play/resume the secondary sound buffer
|
void resume(); // play/resume the secondary sound buffer
|
||||||
void write(); // write the emulated sound to a sound buffer
|
void write(); // write the emulated sound to a sound buffer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OPENALFNTABLE ALFunction;
|
OPENALFNTABLE ALFunction;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
bool buffersLoaded;
|
bool buffersLoaded;
|
||||||
ALCdevice *device;
|
ALCdevice *device;
|
||||||
ALCcontext *context;
|
ALCcontext *context;
|
||||||
ALuint *buffer;
|
ALuint *buffer;
|
||||||
ALuint tempBuffer;
|
ALuint tempBuffer;
|
||||||
ALuint source;
|
ALuint source;
|
||||||
int freq;
|
int freq;
|
||||||
|
|
||||||
#ifdef LOGALL
|
#ifdef LOGALL
|
||||||
void debugState();
|
void debugState();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OpenAL::OpenAL()
|
OpenAL::OpenAL()
|
||||||
{
|
{
|
||||||
initialized = false;
|
initialized = false;
|
||||||
buffersLoaded = false;
|
buffersLoaded = false;
|
||||||
device = NULL;
|
device = NULL;
|
||||||
context = NULL;
|
context = NULL;
|
||||||
buffer = (ALuint*)malloc( theApp.oalBufferCount * sizeof( ALuint ) );
|
buffer = (ALuint*)malloc( theApp.oalBufferCount * sizeof( ALuint ) );
|
||||||
memset( buffer, 0, theApp.oalBufferCount * sizeof( ALuint ) );
|
memset( buffer, 0, theApp.oalBufferCount * sizeof( ALuint ) );
|
||||||
tempBuffer = 0;
|
tempBuffer = 0;
|
||||||
source = 0;
|
source = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OpenAL::~OpenAL()
|
OpenAL::~OpenAL()
|
||||||
{
|
{
|
||||||
if( !initialized ) return;
|
if( !initialized ) return;
|
||||||
|
|
||||||
ALFunction.alSourceStop( source );
|
ALFunction.alSourceStop( source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alSourcei( source, AL_BUFFER, 0 );
|
ALFunction.alSourcei( source, AL_BUFFER, 0 );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alDeleteSources( 1, &source );
|
ALFunction.alDeleteSources( 1, &source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alDeleteBuffers( theApp.oalBufferCount, buffer );
|
ALFunction.alDeleteBuffers( theApp.oalBufferCount, buffer );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
free( buffer );
|
free( buffer );
|
||||||
|
|
||||||
ALFunction.alcMakeContextCurrent( NULL );
|
ALFunction.alcMakeContextCurrent( NULL );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alcDestroyContext( context );
|
ALFunction.alcDestroyContext( context );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alcCloseDevice( device );
|
ALFunction.alcCloseDevice( device );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOGALL
|
#ifdef LOGALL
|
||||||
void OpenAL::debugState()
|
void OpenAL::debugState()
|
||||||
{
|
{
|
||||||
|
|
||||||
ALint value = 0;
|
ALint value = 0;
|
||||||
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &value );
|
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &value );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
winlog( " soundPaused = %i\n", soundPaused );
|
winlog( " soundPaused = %i\n", soundPaused );
|
||||||
winlog( " Source:\n" );
|
winlog( " Source:\n" );
|
||||||
winlog( " State: " );
|
winlog( " State: " );
|
||||||
switch( value )
|
switch( value )
|
||||||
{
|
{
|
||||||
case AL_INITIAL:
|
case AL_INITIAL:
|
||||||
winlog( "AL_INITIAL\n" );
|
winlog( "AL_INITIAL\n" );
|
||||||
break;
|
break;
|
||||||
case AL_PLAYING:
|
case AL_PLAYING:
|
||||||
winlog( "AL_PLAYING\n" );
|
winlog( "AL_PLAYING\n" );
|
||||||
break;
|
break;
|
||||||
case AL_PAUSED:
|
case AL_PAUSED:
|
||||||
winlog( "AL_PAUSED\n" );
|
winlog( "AL_PAUSED\n" );
|
||||||
break;
|
break;
|
||||||
case AL_STOPPED:
|
case AL_STOPPED:
|
||||||
winlog( "AL_STOPPED\n" );
|
winlog( "AL_STOPPED\n" );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
winlog( "!unknown!\n" );
|
winlog( "!unknown!\n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ALFunction.alGetSourcei( source, AL_BUFFERS_QUEUED, &value );
|
ALFunction.alGetSourcei( source, AL_BUFFERS_QUEUED, &value );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
winlog( " Buffers in queue: %i\n", value );
|
winlog( " Buffers in queue: %i\n", value );
|
||||||
|
|
||||||
ALFunction.alGetSourcei( source, AL_BUFFERS_PROCESSED, &value );
|
ALFunction.alGetSourcei( source, AL_BUFFERS_PROCESSED, &value );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
winlog( " Buffers processed: %i\n", value );
|
winlog( " Buffers processed: %i\n", value );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool OpenAL::init()
|
bool OpenAL::init()
|
||||||
{
|
{
|
||||||
winlog( "OpenAL::init\n" );
|
winlog( "OpenAL::init\n" );
|
||||||
assert( initialized == false );
|
assert( initialized == false );
|
||||||
|
|
||||||
if( !LoadOAL10Library( NULL, &ALFunction ) ) {
|
if( !LoadOAL10Library( NULL, &ALFunction ) ) {
|
||||||
systemMessage( IDS_OAL_NODLL, "OpenAL32.dll could not be found on your system. Please install the runtime from http://openal.org" );
|
systemMessage( IDS_OAL_NODLL, "OpenAL32.dll could not be found on your system. Please install the runtime from http://openal.org" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( theApp.oalDevice ) {
|
if( theApp.oalDevice ) {
|
||||||
device = ALFunction.alcOpenDevice( theApp.oalDevice );
|
device = ALFunction.alcOpenDevice( theApp.oalDevice );
|
||||||
} else {
|
} else {
|
||||||
device = ALFunction.alcOpenDevice( NULL );
|
device = ALFunction.alcOpenDevice( NULL );
|
||||||
}
|
}
|
||||||
assert( device != NULL );
|
assert( device != NULL );
|
||||||
|
|
||||||
context = ALFunction.alcCreateContext( device, NULL );
|
context = ALFunction.alcCreateContext( device, NULL );
|
||||||
assert( context != NULL );
|
assert( context != NULL );
|
||||||
|
|
||||||
ALCboolean retVal = ALFunction.alcMakeContextCurrent( context );
|
ALCboolean retVal = ALFunction.alcMakeContextCurrent( context );
|
||||||
assert( ALC_TRUE == retVal );
|
assert( ALC_TRUE == retVal );
|
||||||
|
|
||||||
ALFunction.alGenBuffers( theApp.oalBufferCount, buffer );
|
ALFunction.alGenBuffers( theApp.oalBufferCount, buffer );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alGenSources( 1, &source );
|
ALFunction.alGenSources( 1, &source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
freq = 44100 / soundQuality;
|
freq = 44100 / soundQuality;
|
||||||
|
|
||||||
// calculate the number of samples per frame first
|
// calculate the number of samples per frame first
|
||||||
// then multiply it with the size of a sample frame (16 bit * stereo)
|
// then multiply it with the size of a sample frame (16 bit * stereo)
|
||||||
soundBufferLen = ( freq / 60 ) * 4;
|
soundBufferLen = ( freq / 60 ) * 4;
|
||||||
|
|
||||||
|
|
||||||
setsystemSoundOn( true );
|
setsystemSoundOn( true );
|
||||||
initialized = true;
|
initialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenAL::resume()
|
void OpenAL::resume()
|
||||||
{
|
{
|
||||||
if( !initialized ) return;
|
if( !initialized ) return;
|
||||||
winlog( "OpenAL::resume\n" );
|
winlog( "OpenAL::resume\n" );
|
||||||
if( !buffersLoaded ) return;
|
if( !buffersLoaded ) return;
|
||||||
debugState();
|
debugState();
|
||||||
|
|
||||||
|
|
||||||
ALint sourceState = 0;
|
ALint sourceState = 0;
|
||||||
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
if( sourceState != AL_PLAYING ) {
|
if( sourceState != AL_PLAYING ) {
|
||||||
ALFunction.alSourcePlay( source );
|
ALFunction.alSourcePlay( source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
debugState();
|
debugState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenAL::pause()
|
void OpenAL::pause()
|
||||||
{
|
{
|
||||||
if( !initialized ) return;
|
if( !initialized ) return;
|
||||||
winlog( "OpenAL::pause\n" );
|
winlog( "OpenAL::pause\n" );
|
||||||
if( !buffersLoaded ) return;
|
if( !buffersLoaded ) return;
|
||||||
debugState();
|
debugState();
|
||||||
|
|
||||||
|
|
||||||
ALint sourceState = 0;
|
ALint sourceState = 0;
|
||||||
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
if( sourceState == AL_PLAYING ) {
|
if( sourceState == AL_PLAYING ) {
|
||||||
ALFunction.alSourcePause( source );
|
ALFunction.alSourcePause( source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
debugState();
|
debugState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenAL::reset()
|
void OpenAL::reset()
|
||||||
{
|
{
|
||||||
if( !initialized ) return;
|
if( !initialized ) return;
|
||||||
winlog( "OpenAL::reset\n" );
|
winlog( "OpenAL::reset\n" );
|
||||||
if( !buffersLoaded ) return;
|
if( !buffersLoaded ) return;
|
||||||
debugState();
|
debugState();
|
||||||
|
|
||||||
ALint sourceState = 0;
|
ALint sourceState = 0;
|
||||||
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
if( sourceState != AL_STOPPED ) {
|
if( sourceState != AL_STOPPED ) {
|
||||||
ALFunction.alSourceStop( source );
|
ALFunction.alSourceStop( source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
debugState();
|
debugState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OpenAL::write()
|
void OpenAL::write()
|
||||||
{
|
{
|
||||||
if( !initialized ) return;
|
if( !initialized ) return;
|
||||||
winlog( "OpenAL::write\n" );
|
winlog( "OpenAL::write\n" );
|
||||||
|
|
||||||
debugState();
|
debugState();
|
||||||
|
|
||||||
ALint sourceState = 0;
|
ALint sourceState = 0;
|
||||||
ALint nBuffersProcessed = 0;
|
ALint nBuffersProcessed = 0;
|
||||||
|
|
||||||
if( !buffersLoaded ) {
|
if( !buffersLoaded ) {
|
||||||
// ==initial buffer filling==
|
// ==initial buffer filling==
|
||||||
winlog( " initial buffer filling\n" );
|
winlog( " initial buffer filling\n" );
|
||||||
for( int i = 0 ; i < theApp.oalBufferCount ; i++ ) {
|
for( int i = 0 ; i < theApp.oalBufferCount ; i++ ) {
|
||||||
// Filling the buffers explicitly with silence would be cleaner,
|
// Filling the buffers explicitly with silence would be cleaner,
|
||||||
// but the very first sample is usually silence anyway.
|
// but the very first sample is usually silence anyway.
|
||||||
ALFunction.alBufferData( buffer[i], AL_FORMAT_STEREO16, soundFinalWave, soundBufferLen, freq );
|
ALFunction.alBufferData( buffer[i], AL_FORMAT_STEREO16, soundFinalWave, soundBufferLen, freq );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
ALFunction.alSourceQueueBuffers( source, theApp.oalBufferCount, buffer );
|
ALFunction.alSourceQueueBuffers( source, theApp.oalBufferCount, buffer );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
buffersLoaded = true;
|
buffersLoaded = true;
|
||||||
} else {
|
} else {
|
||||||
// ==normal buffer refreshing==
|
// ==normal buffer refreshing==
|
||||||
nBuffersProcessed = 0;
|
nBuffersProcessed = 0;
|
||||||
ALFunction.alGetSourcei( source, AL_BUFFERS_PROCESSED, &nBuffersProcessed );
|
ALFunction.alGetSourcei( source, AL_BUFFERS_PROCESSED, &nBuffersProcessed );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
if( nBuffersProcessed == theApp.oalBufferCount ) {
|
if( nBuffersProcessed == theApp.oalBufferCount ) {
|
||||||
if( ( theApp.throttle >= 100 ) || ( theApp.throttle == 0 ) ) {
|
if( ( theApp.throttle >= 100 ) || ( theApp.throttle == 0 ) ) {
|
||||||
// we only want to know about it when we are emulating at full speed (or faster)
|
// we only want to know about it when we are emulating at full speed (or faster)
|
||||||
static int i = 0;
|
static int i = 0;
|
||||||
log( "OpenAL: Buffers were not refilled fast enough (%i)\n", i++ );
|
log( "OpenAL: Buffers were not refilled fast enough (%i)\n", i++ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !speedup && synchronize && !theApp.throttle ) {
|
if( !speedup && synchronize && !theApp.throttle ) {
|
||||||
// wait until at least one buffer has finished
|
// wait until at least one buffer has finished
|
||||||
while( nBuffersProcessed == 0 ) {
|
while( nBuffersProcessed == 0 ) {
|
||||||
winlog( " waiting...\n" );
|
winlog( " waiting...\n" );
|
||||||
// wait for about half the time one buffer needs to finish
|
// wait for about half the time one buffer needs to finish
|
||||||
// unoptimized: ( sourceBufferLen * 1000 ) / ( freq * 2 * 2 ) * 1/2
|
// unoptimized: ( sourceBufferLen * 1000 ) / ( freq * 2 * 2 ) * 1/2
|
||||||
Sleep( soundBufferLen / ( freq >> 7 ) );
|
Sleep( soundBufferLen / ( freq >> 7 ) );
|
||||||
ALFunction.alGetSourcei( source, AL_BUFFERS_PROCESSED, &nBuffersProcessed );
|
ALFunction.alGetSourcei( source, AL_BUFFERS_PROCESSED, &nBuffersProcessed );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if( nBuffersProcessed == 0 ) return;
|
if( nBuffersProcessed == 0 ) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( nBuffersProcessed > 0 );
|
assert( nBuffersProcessed > 0 );
|
||||||
|
|
||||||
// tempBuffer contains the Buffer ID for the unqueued Buffer
|
// tempBuffer contains the Buffer ID for the unqueued Buffer
|
||||||
tempBuffer = 0;
|
tempBuffer = 0;
|
||||||
ALFunction.alSourceUnqueueBuffers( source, 1, &tempBuffer );
|
ALFunction.alSourceUnqueueBuffers( source, 1, &tempBuffer );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
ALFunction.alBufferData( tempBuffer, AL_FORMAT_STEREO16, soundFinalWave, soundBufferLen, freq );
|
ALFunction.alBufferData( tempBuffer, AL_FORMAT_STEREO16, soundFinalWave, soundBufferLen, freq );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
|
|
||||||
// refill buffer
|
// refill buffer
|
||||||
ALFunction.alSourceQueueBuffers( source, 1, &tempBuffer );
|
ALFunction.alSourceQueueBuffers( source, 1, &tempBuffer );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// start playing the source if necessary
|
// start playing the source if necessary
|
||||||
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
ALFunction.alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
if( !soundPaused && ( sourceState != AL_PLAYING ) ) {
|
if( !soundPaused && ( sourceState != AL_PLAYING ) ) {
|
||||||
ALFunction.alSourcePlay( source );
|
ALFunction.alSourcePlay( source );
|
||||||
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
assert( AL_NO_ERROR == ALFunction.alGetError() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ISound *newOpenAL()
|
ISound *newOpenAL()
|
||||||
{
|
{
|
||||||
winlog( "newOpenAL\n" );
|
winlog( "newOpenAL\n" );
|
||||||
return new OpenAL();
|
return new OpenAL();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,7 +75,7 @@ private:
|
||||||
bool failed;
|
bool failed;
|
||||||
GLFONT font;
|
GLFONT font;
|
||||||
int pitch;
|
int pitch;
|
||||||
GLuint displaylist;
|
GLuint displaylist;
|
||||||
u8 *data;
|
u8 *data;
|
||||||
GLhandleARB v,f,p,t;
|
GLhandleARB v,f,p,t;
|
||||||
DWORD currentAdapter;
|
DWORD currentAdapter;
|
||||||
|
@ -191,7 +191,7 @@ void OpenGLDisplay::cleanup()
|
||||||
glDeleteTextures(1, &texture);
|
glDeleteTextures(1, &texture);
|
||||||
texture = 0;
|
texture = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displaylist)
|
if (displaylist)
|
||||||
{
|
{
|
||||||
glDeleteLists(displaylist, 1);
|
glDeleteLists(displaylist, 1);
|
||||||
|
@ -301,7 +301,7 @@ bool OpenGLDisplay::initialize()
|
||||||
if( theApp.videoOption <= VIDEO_4X )
|
if( theApp.videoOption <= VIDEO_4X )
|
||||||
AdjustWindowRectEx( &theApp.dest, style, TRUE, styleEx );
|
AdjustWindowRectEx( &theApp.dest, style, TRUE, styleEx );
|
||||||
else
|
else
|
||||||
AdjustWindowRectEx( &theApp.dest, style, FALSE, styleEx );
|
AdjustWindowRectEx( &theApp.dest, style, FALSE, styleEx );
|
||||||
|
|
||||||
int winSizeX = theApp.dest.right - theApp.dest.left;
|
int winSizeX = theApp.dest.right - theApp.dest.left;
|
||||||
int winSizeY = theApp.dest.bottom - theApp.dest.top;
|
int winSizeY = theApp.dest.bottom - theApp.dest.top;
|
||||||
|
@ -327,14 +327,14 @@ bool OpenGLDisplay::initialize()
|
||||||
x,y,winSizeX,winSizeY,
|
x,y,winSizeX,winSizeY,
|
||||||
NULL,
|
NULL,
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
if (!(HWND)*pWnd) {
|
if (!(HWND)*pWnd) {
|
||||||
winlog("Error creating Window %08x\n", GetLastError());
|
winlog("Error creating Window %08x\n", GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
theApp.updateMenuBar();
|
theApp.updateMenuBar();
|
||||||
|
|
||||||
theApp.adjustDestRect();
|
theApp.adjustDestRect();
|
||||||
theApp.mode320Available = FALSE;
|
theApp.mode320Available = FALSE;
|
||||||
theApp.mode640Available = FALSE;
|
theApp.mode640Available = FALSE;
|
||||||
|
@ -342,7 +342,7 @@ bool OpenGLDisplay::initialize()
|
||||||
theApp.mode1024Available = FALSE;
|
theApp.mode1024Available = FALSE;
|
||||||
theApp.mode1280Available = FALSE;
|
theApp.mode1280Available = FALSE;
|
||||||
|
|
||||||
|
|
||||||
currentAdapter = theApp.fsAdapter;
|
currentAdapter = theApp.fsAdapter;
|
||||||
DISPLAY_DEVICE dev;
|
DISPLAY_DEVICE dev;
|
||||||
ZeroMemory( &dev, sizeof(dev) );
|
ZeroMemory( &dev, sizeof(dev) );
|
||||||
|
@ -376,7 +376,7 @@ bool OpenGLDisplay::initialize()
|
||||||
glEnable( GL_TEXTURE_2D );
|
glEnable( GL_TEXTURE_2D );
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
initializeMatrices( theApp.surfaceSizeX, theApp.surfaceSizeY );
|
initializeMatrices( theApp.surfaceSizeX, theApp.surfaceSizeY );
|
||||||
|
|
||||||
setVSync( theApp.vsync );
|
setVSync( theApp.vsync );
|
||||||
|
@ -409,7 +409,7 @@ bool OpenGLDisplay::initialize()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear colour buffer
|
//clear colour buffer
|
||||||
void OpenGLDisplay::clear()
|
void OpenGLDisplay::clear()
|
||||||
{
|
{
|
||||||
glClearColor(0.0,0.0,0.0,1.0);
|
glClearColor(0.0,0.0,0.0,1.0);
|
||||||
|
@ -440,7 +440,7 @@ void OpenGLDisplay::renderlist()
|
||||||
|
|
||||||
//main render func
|
//main render func
|
||||||
void OpenGLDisplay::render()
|
void OpenGLDisplay::render()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
pitch = theApp.filterWidth * (systemColorDepth>>3) + 4;
|
pitch = theApp.filterWidth * (systemColorDepth>>3) + 4;
|
||||||
|
@ -468,11 +468,11 @@ void OpenGLDisplay::render()
|
||||||
glPixelStorei( GL_UNPACK_ROW_LENGTH, theApp.sizeX + 1 );
|
glPixelStorei( GL_UNPACK_ROW_LENGTH, theApp.sizeX + 1 );
|
||||||
}
|
}
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data );
|
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,data );
|
||||||
|
|
||||||
|
|
||||||
glCallList(displaylist);
|
|
||||||
|
glCallList(displaylist);
|
||||||
|
|
||||||
|
|
||||||
if( theApp.showSpeed ) { // && ( theApp.videoOption > VIDEO_4X ) ) {
|
if( theApp.showSpeed ) { // && ( theApp.videoOption > VIDEO_4X ) ) {
|
||||||
char buffer[30];
|
char buffer[30];
|
||||||
if( theApp.showSpeed == 1 ) {
|
if( theApp.showSpeed == 1 ) {
|
||||||
|
@ -508,12 +508,12 @@ void OpenGLDisplay::render()
|
||||||
theApp.screenMessage = false;
|
theApp.screenMessage = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
SwapBuffers( hDC );
|
SwapBuffers( hDC );
|
||||||
// since OpenGL draws on the back buffer,
|
// since OpenGL draws on the back buffer,
|
||||||
// we have to swap it to the front buffer to see the content
|
// we have to swap it to the front buffer to see the content
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//resize screen
|
//resize screen
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ int systemGetSensorY()
|
||||||
bool systemSoundInit()
|
bool systemSoundInit()
|
||||||
{
|
{
|
||||||
systemSoundShutdown();
|
systemSoundShutdown();
|
||||||
|
|
||||||
switch( theApp.audioAPI )
|
switch( theApp.audioAPI )
|
||||||
{
|
{
|
||||||
case DIRECTSOUND:
|
case DIRECTSOUND:
|
||||||
|
@ -1219,7 +1219,7 @@ void systemSoundShutdown()
|
||||||
}
|
}
|
||||||
theApp.soundRecording = false;
|
theApp.soundRecording = false;
|
||||||
|
|
||||||
|
|
||||||
if( theApp.sound ) {
|
if( theApp.sound ) {
|
||||||
delete theApp.sound;
|
delete theApp.sound;
|
||||||
theApp.sound = NULL;
|
theApp.sound = NULL;
|
||||||
|
@ -1281,7 +1281,7 @@ void systemWriteDataToSoundBuffer()
|
||||||
|
|
||||||
if( theApp.sound ) {
|
if( theApp.sound ) {
|
||||||
theApp.sound->write();
|
theApp.sound->write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool systemCanChangeSoundQuality()
|
bool systemCanChangeSoundQuality()
|
||||||
|
@ -1803,8 +1803,8 @@ void VBA::updateWindowSize(int value)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input->checkKeys();
|
input->checkKeys();
|
||||||
|
|
||||||
|
|
||||||
changingVideoSize = FALSE;
|
changingVideoSize = FALSE;
|
||||||
updateWindowSize(videoOption);
|
updateWindowSize(videoOption);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -847,7 +847,7 @@
|
||||||
#define ID_FILE_OPEN_GBC 40358
|
#define ID_FILE_OPEN_GBC 40358
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 163
|
#define _APS_NEXT_RESOURCE_VALUE 163
|
||||||
|
|
Loading…
Reference in New Issue