mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 00:29:52 +02:00
Update to v093r07 release.
byuu says: Changelog: - importing a game won't show message box on success - importing a game will select the game that was imported in the list - caveat: GTK+ port doesn't seem to be removing focus from item 0 even though the selection is on item 2 - Game Boy audio reduced in volume by 50% - Game Boy Advance audio reduced in volume by 50% - Game Boy internally mixes audio at 2MHz now - Game Boy Advance's Game Boy audio hardware internally mixes audio at 2MHz now - Game Boy Color doesn't sort sprites by X-coordinate - Game Boy Color allows transparency on BGpriority pixels - caveat: this seems to allow sprites to appear on top of windows - Game Boy Color VRAM DMA transfers 16 bytes in 8 clocks (or 16 clocks in double speed mode) - Game Boy Color VRAM DMA masks low 4-bits of source and destination address - Game Boy Color VRAM DMA only allows reads from ROM or RAM - Game Boy Color VRAM DMA only allows writes to VRAM - fixed a bug in dereferencing a nullptr from pObject::find(), should fix crash when pressing enter key on blank windows - fixed Windows RadioItem selection - Game Boy Advance color emulation code added
This commit is contained in:
@@ -25,7 +25,7 @@ void APU::Enter() {
|
||||
}
|
||||
|
||||
void APU::main() {
|
||||
for(unsigned n = 0; n < 128; n++) {
|
||||
for(unsigned n = 0; n < 64; n++) {
|
||||
runsequencer();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void APU::main() {
|
||||
if(regs.bias.amplitude == 3) lsample &= ~15, rsample &= ~15;
|
||||
|
||||
if(cpu.regs.mode == CPU::Registers::Mode::Stop) lsample = 0, rsample = 0;
|
||||
interface->audioSample(sclamp<16>(lsample << 7), sclamp<16>(rsample << 7)); //should be <<5, use <<7 for added volume
|
||||
interface->audioSample(sclamp<16>(lsample << 6), sclamp<16>(rsample << 6)); //should be <<5, use <<6 for added volume
|
||||
step(512);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
unsigned APU::Noise::divider() const {
|
||||
if(divisor == 0) return 8;
|
||||
return divisor * 16;
|
||||
if(divisor == 0) return 4;
|
||||
return divisor * 8;
|
||||
}
|
||||
|
||||
void APU::Noise::run() {
|
||||
|
@@ -128,7 +128,7 @@ struct Sequencer {
|
||||
uint1 enable[4];
|
||||
uint1 masterenable;
|
||||
|
||||
uint13 base;
|
||||
uint12 base;
|
||||
uint3 step;
|
||||
int16 lsample;
|
||||
int16 rsample;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
void APU::Square::run() {
|
||||
if(period && --period == 0) {
|
||||
period = 4 * (2048 - frequency);
|
||||
period = 2 * (2048 - frequency);
|
||||
phase++;
|
||||
switch(duty) {
|
||||
case 0: signal = (phase == 6); break; //_____-_
|
||||
|
@@ -10,7 +10,7 @@ void APU::Square1::runsweep(bool update) {
|
||||
} else if(sweep.shift && update) {
|
||||
shadowfrequency = updatefrequency;
|
||||
frequency = updatefrequency;
|
||||
period = 4 * (2048 - frequency);
|
||||
period = 2 * (2048 - frequency);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void APU::Square1::write(unsigned addr, uint8 byte) {
|
||||
|
||||
if(initialize) {
|
||||
enable = envelope.dacenable();
|
||||
period = 4 * (2048 - frequency);
|
||||
period = 2 * (2048 - frequency);
|
||||
envelope.period = envelope.frequency;
|
||||
volume = envelope.volume;
|
||||
shadowfrequency = frequency;
|
||||
|
@@ -32,7 +32,7 @@ void APU::Square2::write(unsigned addr, uint8 byte) {
|
||||
|
||||
if(initialize) {
|
||||
enable = envelope.dacenable();
|
||||
period = 4 * (2048 - frequency);
|
||||
period = 2 * (2048 - frequency);
|
||||
envelope.period = envelope.frequency;
|
||||
volume = envelope.volume;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
void APU::Wave::run() {
|
||||
if(period && --period == 0) {
|
||||
period = 2 * (2048 - frequency);
|
||||
period = 1 * (2048 - frequency);
|
||||
patternsample = pattern[patternbank * 16 + patternaddr++];
|
||||
if(patternaddr == 0) patternbank ^= mode;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ void APU::Wave::write(unsigned addr, uint8 byte) {
|
||||
|
||||
if(initialize) {
|
||||
enable = dacenable;
|
||||
period = 2 * (2048 - frequency);
|
||||
period = 1 * (2048 - frequency);
|
||||
patternaddr = 0;
|
||||
patternbank = mode ? (uint1)0 : bank;
|
||||
}
|
||||
|
@@ -7,13 +7,51 @@ Video video;
|
||||
void Video::generate_palette(bool color_emulation) {
|
||||
//todo: implement LCD color emulation
|
||||
for(unsigned color = 0; color < (1 << 15); color++) {
|
||||
uint5 b = color >> 10;
|
||||
uint5 g = color >> 5;
|
||||
uint5 r = color >> 0;
|
||||
unsigned B = (color >> 10) & 31;
|
||||
unsigned G = (color >> 5) & 31;
|
||||
unsigned R = (color >> 0) & 31;
|
||||
|
||||
uint16 R = r << 11 | r << 6 | r << 1 | r >> 4;
|
||||
uint16 G = g << 11 | g << 6 | g << 1 | g >> 4;
|
||||
uint16 B = b << 11 | b << 6 | b << 1 | b >> 4;
|
||||
if(color_emulation) {
|
||||
R = curve[R];
|
||||
G = curve[G];
|
||||
B = curve[B];
|
||||
|
||||
unsigned Rr = R * 16;
|
||||
unsigned Gr = R * 4;
|
||||
unsigned Br = R * 4;
|
||||
|
||||
unsigned Rg = G * 8;
|
||||
unsigned Gg = G * 16;
|
||||
unsigned Bg = G * 8;
|
||||
|
||||
unsigned Rb = B * 0; //intentionally always zero
|
||||
unsigned Gb = B * 8;
|
||||
unsigned Bb = B * 16;
|
||||
|
||||
if(Rr < Rg) std::swap(Rr, Rg);
|
||||
if(Rr < Rb) std::swap(Rr, Rb);
|
||||
if(Rg < Rb) std::swap(Rg, Rb);
|
||||
|
||||
if(Gr < Gg) std::swap(Gr, Gg);
|
||||
if(Gr < Gb) std::swap(Gr, Gb);
|
||||
if(Gg < Gb) std::swap(Gg, Gb);
|
||||
|
||||
if(Br < Bg) std::swap(Br, Bg);
|
||||
if(Br < Bb) std::swap(Br, Bb);
|
||||
if(Bg < Bb) std::swap(Bg, Bb);
|
||||
|
||||
R = (((4 * Rr + 2 * Rg + Rb) * 160) >> 14) + 32;
|
||||
G = (((4 * Gr + 2 * Gg + Gb) * 160) >> 14) + 32;
|
||||
B = (((4 * Br + 2 * Bg + Bb) * 160) >> 14) + 32;
|
||||
|
||||
R = R << 8 | R;
|
||||
G = G << 8 | G;
|
||||
B = B << 8 | B;
|
||||
} else {
|
||||
R = R << 11 | R << 6 | R << 1 | R >> 4;
|
||||
G = G << 11 | G << 6 | G << 1 | G >> 4;
|
||||
B = B << 11 | B << 6 | B << 1 | B >> 4;
|
||||
}
|
||||
|
||||
palette[color] = interface->videoColor(color, R, G, B);
|
||||
}
|
||||
@@ -27,4 +65,11 @@ Video::~Video() {
|
||||
delete[] palette;
|
||||
}
|
||||
|
||||
const uint8 Video::curve[32] = {
|
||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
|
||||
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x38, 0x38,
|
||||
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80,
|
||||
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,9 @@ struct Video {
|
||||
|
||||
Video();
|
||||
~Video();
|
||||
|
||||
private:
|
||||
static const uint8 curve[32];
|
||||
};
|
||||
|
||||
extern Video video;
|
||||
|
Reference in New Issue
Block a user