2010-08-09 13:31:09 +00:00
|
|
|
#ifdef PPU_CPP
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2010-08-09 13:31:09 +00:00
|
|
|
inline uint16 PPU::get_palette(uint8 index) {
|
2010-08-09 13:28:56 +00:00
|
|
|
const unsigned addr = index << 1;
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
return cgram[addr] + (cgram[addr + 1] << 8);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//p = 00000bgr <palette data>
|
|
|
|
//t = BBGGGRRR <tilemap data>
|
|
|
|
//r = 0BBb00GGGg0RRRr0 <return data>
|
2010-08-09 13:31:09 +00:00
|
|
|
inline uint16 PPU::get_direct_color(uint8 p, uint8 t) {
|
2010-08-09 13:28:56 +00:00
|
|
|
return ((t & 7) << 2) | ((p & 1) << 1) |
|
|
|
|
(((t >> 3) & 7) << 7) | (((p >> 1) & 1) << 6) |
|
|
|
|
((t >> 6) << 13) | ((p >> 2) << 12);
|
|
|
|
}
|
|
|
|
|
2010-08-09 13:31:09 +00:00
|
|
|
inline uint16 PPU::get_pixel_normal(uint32 x) {
|
2013-05-05 09:21:30 +00:00
|
|
|
pixel_t& p = pixel_cache[x];
|
2010-08-09 13:28:56 +00:00
|
|
|
uint16 src_main, src_sub;
|
2013-05-05 09:21:30 +00:00
|
|
|
uint8 bg_sub;
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
src_main = p.src_main;
|
|
|
|
|
|
|
|
if(!regs.addsub_mode) {
|
|
|
|
bg_sub = BACK;
|
|
|
|
src_sub = regs.color_rgb;
|
|
|
|
} else {
|
|
|
|
bg_sub = p.bg_sub;
|
|
|
|
src_sub = p.src_sub;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!window[COL].main[x]) {
|
|
|
|
if(!window[COL].sub[x]) {
|
|
|
|
return 0x0000;
|
|
|
|
}
|
|
|
|
src_main = 0x0000;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!p.ce_main && regs.color_enabled[p.bg_main] && window[COL].sub[x]) {
|
|
|
|
bool halve = false;
|
|
|
|
if(regs.color_halve && window[COL].main[x]) {
|
|
|
|
if(regs.addsub_mode && bg_sub == BACK);
|
|
|
|
else {
|
|
|
|
halve = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return addsub(src_main, src_sub, halve);
|
|
|
|
}
|
|
|
|
|
|
|
|
return src_main;
|
|
|
|
}
|
|
|
|
|
2010-08-09 13:31:09 +00:00
|
|
|
inline uint16 PPU::get_pixel_swap(uint32 x) {
|
2013-05-05 09:21:30 +00:00
|
|
|
pixel_t& p = pixel_cache[x];
|
2010-08-09 13:28:56 +00:00
|
|
|
uint16 src_main, src_sub;
|
2013-05-05 09:21:30 +00:00
|
|
|
uint8 bg_sub;
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
src_main = p.src_sub;
|
|
|
|
|
|
|
|
if(!regs.addsub_mode) {
|
|
|
|
bg_sub = BACK;
|
|
|
|
src_sub = regs.color_rgb;
|
|
|
|
} else {
|
|
|
|
bg_sub = p.bg_main;
|
|
|
|
src_sub = p.src_main;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!window[COL].main[x]) {
|
|
|
|
if(!window[COL].sub[x]) {
|
|
|
|
return 0x0000;
|
|
|
|
}
|
|
|
|
src_main = 0x0000;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!p.ce_sub && regs.color_enabled[p.bg_sub] && window[COL].sub[x]) {
|
|
|
|
bool halve = false;
|
|
|
|
if(regs.color_halve && window[COL].main[x]) {
|
|
|
|
if(regs.addsub_mode && bg_sub == BACK);
|
|
|
|
else {
|
|
|
|
halve = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return addsub(src_main, src_sub, halve);
|
|
|
|
}
|
|
|
|
|
|
|
|
return src_main;
|
|
|
|
}
|
|
|
|
|
2010-08-09 13:31:09 +00:00
|
|
|
inline void PPU::render_line_output() {
|
2013-05-05 09:21:30 +00:00
|
|
|
uint32* ptr = (uint32*)output + (line * 1024) + ((interlace() && field()) ? 512 : 0);
|
2011-09-24 09:51:08 +00:00
|
|
|
uint32 curr, prev;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
if(!regs.pseudo_hires && regs.bg_mode != 5 && regs.bg_mode != 6) {
|
|
|
|
for(unsigned x = 0; x < 256; x++) {
|
2011-09-24 09:51:08 +00:00
|
|
|
curr = (regs.display_brightness << 15) | get_pixel_normal(x);
|
2013-12-20 11:40:39 +00:00
|
|
|
*ptr++ = curr;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for(unsigned x = 0, prev = 0; x < 256; x++) {
|
2011-04-27 08:57:31 +00:00
|
|
|
//blending is disabled below, as this should be done via video filtering
|
|
|
|
//blending code is left for reference purposes
|
|
|
|
|
2011-09-24 09:51:08 +00:00
|
|
|
curr = (regs.display_brightness << 15) | get_pixel_swap(x);
|
2013-12-20 11:40:39 +00:00
|
|
|
*ptr++ = curr; //(prev + curr - ((prev ^ curr) & 0x0421)) >> 1;
|
2011-04-27 08:57:31 +00:00
|
|
|
//prev = curr;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2011-09-24 09:51:08 +00:00
|
|
|
curr = (regs.display_brightness << 15) | get_pixel_normal(x);
|
2013-12-20 11:40:39 +00:00
|
|
|
*ptr++ = curr; //(prev + curr - ((prev ^ curr) & 0x0421)) >> 1;
|
2011-04-27 08:57:31 +00:00
|
|
|
//prev = curr;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-09 13:31:09 +00:00
|
|
|
inline void PPU::render_line_clear() {
|
2013-05-05 09:21:30 +00:00
|
|
|
uint32* ptr = (uint32*)output + (line * 1024) + ((interlace() && field()) ? 512 : 0);
|
Update to v082r33 release.
byuu says:
Added MMC2, MMC4, VRC4, VRC7 (no audio.)
Split NES audio code up into individual modules.
Fixed libsnes to compile: Themaister, can you please test to make sure
it works? I don't have a libsnes client on my work PC to test it.
Added about / license information to bottom of advanced settings screen
for now (better than nothing, I guess.)
Blocked PPU reads/writes while rendering for now, easier than coming up
with a bus address locking thing :/
I can't seem to fix MMC5 graphics during the intro to Uchuu Keibitai.
Without that, trying to implement vertical-split screen mode doesn't
make sense.
So as far as special audio chips go ...
* VRC6 is completed
* Sunsoft 5B has everything the only game to use it uses, but there are
more unused channels I'd like to support anyway (they aren't
documented, though.)
* MMC5 audio unsupported for now
* VRC7 audio unsupported, probably for a long time (hardest audio driver
of all. More complex than core NES APU.)
* audio PCM games (Moero Pro Yakyuu!) I probably won't ever support
(they require external WAV packs.)
2011-10-12 12:03:58 +00:00
|
|
|
unsigned width = (!regs.pseudo_hires && regs.bg_mode != 5 && regs.bg_mode != 6) ? 256 : 512;
|
|
|
|
memset(ptr, 0, width * 2 * sizeof(uint32));
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|