mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Changelog: - added Cocoa target: higan can now be compiled for OS X Lion [Cydrak, byuu] - SNES/accuracy profile hires color blending improvements - fixes Marvelous text [AWJ] - fixed a slight bug in SNES/SA-1 VBR support caused by a typo - added support for multi-pass shaders that can load external textures (requires OpenGL 3.2+) - added game library path (used by ananke->Import Game) to Settings->Advanced - system profiles, shaders and cheats database can be stored in "all users" shared folders now (eg /usr/share on Linux) - all configuration files are in BML format now, instead of XML (much easier to read and edit this way) - main window supports drag-and-drop of game folders (but not game files / ZIP archives) - audio buffer clears when entering a modal loop on Windows (prevents audio repetition with DirectSound driver) - a substantial amount of code clean-up (probably the biggest refactoring to date) One highly desired target for this release was to default to the optimal drivers instead of the safest drivers, but because AMD drivers don't seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD has too big a market share. Hopefully with v093 officially released, we can get some public input on what AMD doesn't like.
86 lines
3.2 KiB
C++
86 lines
3.2 KiB
C++
//this should only be called by CPU::PPUcounter::tick();
|
|
//keeps track of previous counter positions in history table
|
|
void PPUcounter::tick() {
|
|
status.hcounter += 2; //increment by smallest unit of time
|
|
if(status.hcounter >= 1360 && status.hcounter == lineclocks()) {
|
|
status.hcounter = 0;
|
|
vcounter_tick();
|
|
}
|
|
|
|
history.index = (history.index + 1) & 2047;
|
|
history.field [history.index] = status.field;
|
|
history.vcounter[history.index] = status.vcounter;
|
|
history.hcounter[history.index] = status.hcounter;
|
|
}
|
|
|
|
//this should only be called by PPU::PPUcounter::tick(n);
|
|
//allows stepping by more than the smallest unit of time
|
|
void PPUcounter::tick(unsigned clocks) {
|
|
status.hcounter += clocks;
|
|
if(status.hcounter >= lineclocks()) {
|
|
status.hcounter -= lineclocks();
|
|
vcounter_tick();
|
|
}
|
|
}
|
|
|
|
//internal
|
|
void PPUcounter::vcounter_tick() {
|
|
if(++status.vcounter == 128) status.interlace = ppu.interlace();
|
|
|
|
if((system.region() == System::Region::NTSC && status.interlace == false && status.vcounter == 262)
|
|
|| (system.region() == System::Region::NTSC && status.interlace == true && status.vcounter == 263)
|
|
|| (system.region() == System::Region::NTSC && status.interlace == true && status.vcounter == 262 && status.field == 1)
|
|
|| (system.region() == System::Region::PAL && status.interlace == false && status.vcounter == 312)
|
|
|| (system.region() == System::Region::PAL && status.interlace == true && status.vcounter == 313)
|
|
|| (system.region() == System::Region::PAL && status.interlace == true && status.vcounter == 312 && status.field == 1)
|
|
) {
|
|
status.vcounter = 0;
|
|
status.field = !status.field;
|
|
}
|
|
if(scanline) scanline();
|
|
}
|
|
|
|
bool PPUcounter::field () const { return status.field; }
|
|
uint16 PPUcounter::vcounter() const { return status.vcounter; }
|
|
uint16 PPUcounter::hcounter() const { return status.hcounter; }
|
|
|
|
bool PPUcounter::field (unsigned offset) const { return history.field [(history.index - (offset >> 1)) & 2047]; }
|
|
uint16 PPUcounter::vcounter(unsigned offset) const { return history.vcounter[(history.index - (offset >> 1)) & 2047]; }
|
|
uint16 PPUcounter::hcounter(unsigned offset) const { return history.hcounter[(history.index - (offset >> 1)) & 2047]; }
|
|
|
|
//one PPU dot = 4 CPU clocks
|
|
//
|
|
//PPU dots 323 and 327 are 6 CPU clocks long.
|
|
//this does not apply to NTSC non-interlace scanline 240 on odd fields. this is
|
|
//because the PPU skips one dot to alter the color burst phase of the video signal.
|
|
//
|
|
//dot 323 range = { 1292, 1294, 1296 }
|
|
//dot 327 range = { 1310, 1312, 1314 }
|
|
|
|
uint16 PPUcounter::hdot() const {
|
|
if(system.region() == System::Region::NTSC && status.interlace == false && vcounter() == 240 && field() == 1) {
|
|
return (hcounter() >> 2);
|
|
} else {
|
|
return (hcounter() - ((hcounter() > 1292) << 1) - ((hcounter() > 1310) << 1)) >> 2;
|
|
}
|
|
}
|
|
|
|
uint16 PPUcounter::lineclocks() const {
|
|
if(system.region() == System::Region::NTSC && status.interlace == false && vcounter() == 240 && field() == 1) return 1360;
|
|
return 1364;
|
|
}
|
|
|
|
void PPUcounter::reset() {
|
|
status.interlace = false;
|
|
status.field = 0;
|
|
status.vcounter = 0;
|
|
status.hcounter = 0;
|
|
history.index = 0;
|
|
|
|
for(unsigned i = 0; i < 2048; i++) {
|
|
history.field [i] = 0;
|
|
history.vcounter[i] = 0;
|
|
history.hcounter[i] = 0;
|
|
}
|
|
}
|