#include <ppu.h>
Public Member Functions | |
Ppu (memory::Memory &memory, Clock &clock) | |
void | Init () |
void | Reset () |
void | Update () |
void | UpdateClock (double delta_time) |
void | HandleFrameStart () |
void | RunLine (int line) |
void | HandlePixel (int x, int y) |
void | LatchHV () |
int | GetPixel (int x, int y, bool sub, int *r, int *g, int *b) |
void | EvaluateSprites (int line) |
void | CalculateMode7Starts (int y) |
bool | GetWindowState (int layer, int x) |
bool | CheckOverscan () |
void | HandleVblank () |
void | HandleOPT (int layer, int *lx, int *ly) |
uint16_t | GetOffsetValue (int col, int row) |
int | GetPixelForBgLayer (int x, int y, int layer, bool priority) |
uint8_t | Read (uint8_t adr, bool latch) |
void | Write (uint8_t adr, uint8_t val) |
uint16_t | GetVramRemap () |
void | PutPixels (uint8_t *pixel_data) |
const std::vector< uint8_t > & | GetFrameBuffer () const |
Public Member Functions inherited from yaze::app::SharedRom | |
SharedRom ()=default | |
virtual | ~SharedRom ()=default |
std::shared_ptr< Rom > | shared_rom () |
auto | rom () |
Public Attributes | |
bool | frame_overscan_ = false |
bool | overscan_ = false |
bool | forced_blank_ |
uint8_t | brightness |
uint8_t | mode |
bool | bg3priority |
bool | even_frame |
bool | pseudo_hires_ |
bool | interlace |
bool | frame_interlace |
bool | direct_color_ |
Private Member Functions | |
int | GetPixelForMode7 (int x, int layer, bool priority) |
Additional Inherited Members | |
Static Public Attributes inherited from yaze::app::SharedRom | |
static std::shared_ptr< Rom > | shared_rom_ = nullptr |
|
inline |
|
inline |
Definition at line 265 of file ppu.h.
References frame_buffer_, and pixelOutputFormat.
Referenced by yaze::app::emu::SNES::Init().
void yaze::app::emu::video::Ppu::Reset | ( | ) |
Definition at line 45 of file ppu.cc.
References add_subscreen_, bg3priority, bg_layer_, yaze::app::emu::video::BgLayer::bigTiles, brightness, cgram, cgram_buffer_, cgram_pointer_, cgram_second_write_, clip_mode_, counters_latched_, direct_color_, even_frame, fixed_color_b_, fixed_color_g_, fixed_color_r_, forced_blank_, frame_interlace, frame_overscan_, h_count_, h_count_second_, half_color_, high_oam_, yaze::app::emu::video::BgLayer::hScroll, interlace, layer_, m7charFill, m7extBg, m7largeField, m7matrix, m7prev, m7startX, m7startY, m7xFlip, m7yFlip, yaze::app::emu::video::Layer::mainScreenEnabled, yaze::app::emu::video::Layer::mainScreenWindowed, yaze::app::emu::video::WindowLayer::maskLogic, math_enabled_array_, mode, mosaic_size_, mosaic_startline_, yaze::app::emu::video::BgLayer::mosaicEnabled, oam, oam_adr_, oam_adr_written_, oam_buffer_, oam_in_high_, oam_in_high_written_, oam_second_write_, obj_interlace_, obj_pixel_buffer_, obj_priority_, obj_priority_buffer_, obj_size_, obj_tile_adr1_, obj_tile_adr2_, overscan_, pixelBuffer, ppu1_open_bus_, ppu2_open_bus_, prevent_math_mode_, pseudo_hires_, range_over_, scroll_prev2_, scroll_prev_, yaze::app::emu::video::Layer::subScreenEnabled, yaze::app::emu::video::Layer::subScreenWindowed, subtract_color_, yaze::app::emu::video::BgLayer::tileAdr, yaze::app::emu::video::BgLayer::tilemapAdr, yaze::app::emu::video::BgLayer::tilemapHigher, yaze::app::emu::video::BgLayer::tilemapWider, time_over_, v_count_, v_count_second_, vram, vram_increment_, vram_increment_on_high_, vram_pointer, vram_read_buffer_, vram_remap_mode_, yaze::app::emu::video::BgLayer::vScroll, yaze::app::emu::video::WindowLayer::window1enabled, yaze::app::emu::video::WindowLayer::window1inversed, window1left, window1right, yaze::app::emu::video::WindowLayer::window2enabled, yaze::app::emu::video::WindowLayer::window2inversed, window2left, window2right, and windowLayer.
Referenced by yaze::app::emu::SNES::Reset().
|
inline |
Definition at line 275 of file ppu.h.
References clock_, and yaze::app::emu::Clock::UpdateClock().
void yaze::app::emu::video::Ppu::HandleFrameStart | ( | ) |
Definition at line 143 of file ppu.cc.
References even_frame, mosaic_startline_, range_over_, and time_over_.
Referenced by yaze::app::emu::SNES::RunCycle().
void yaze::app::emu::video::Ppu::RunLine | ( | int | line | ) |
Definition at line 151 of file ppu.cc.
References CalculateMode7Starts(), EvaluateSprites(), forced_blank_, HandlePixel(), mode, and obj_pixel_buffer_.
Referenced by yaze::app::emu::SNES::RunCycle().
void yaze::app::emu::video::Ppu::HandlePixel | ( | int | x, |
int | y ) |
Definition at line 163 of file ppu.cc.
References add_subscreen_, brightness, clip_mode_, even_frame, fixed_color_b_, fixed_color_g_, fixed_color_r_, forced_blank_, GetPixel(), GetWindowState(), half_color_, math_enabled_array_, mode, pixelBuffer, pixelOutputFormat, prevent_math_mode_, pseudo_hires_, and subtract_color_.
Referenced by RunLine().
|
inline |
Definition at line 281 of file ppu.h.
References counters_latched_, h_count_, yaze::app::emu::memory::Memory::h_pos(), memory_, v_count_, and yaze::app::emu::memory::Memory::v_pos().
Referenced by Read(), and yaze::app::emu::SNES::WriteReg().
int yaze::app::emu::video::Ppu::GetPixel | ( | int | x, |
int | y, | ||
bool | sub, | ||
int * | r, | ||
int * | g, | ||
int * | b ) |
Definition at line 230 of file ppu.cc.
References bg3priority, bg_layer_, cgram, direct_color_, even_frame, GetPixelForBgLayer(), GetPixelForMode7(), GetWindowState(), HandleOPT(), yaze::app::emu::video::BgLayer::hScroll, interlace, layer_, m7extBg, yaze::app::emu::video::Layer::mainScreenEnabled, yaze::app::emu::video::Layer::mainScreenWindowed, mode, mosaic_size_, mosaic_startline_, yaze::app::emu::video::BgLayer::mosaicEnabled, obj_pixel_buffer_, obj_priority_buffer_, yaze::app::emu::video::Layer::subScreenEnabled, yaze::app::emu::video::Layer::subScreenWindowed, and yaze::app::emu::video::BgLayer::vScroll.
Referenced by HandlePixel().
void yaze::app::emu::video::Ppu::EvaluateSprites | ( | int | line | ) |
Definition at line 472 of file ppu.cc.
References even_frame, high_oam_, oam, oam_adr_, obj_interlace_, obj_pixel_buffer_, obj_priority_, obj_priority_buffer_, obj_size_, obj_tile_adr1_, obj_tile_adr2_, range_over_, time_over_, and vram.
Referenced by RunLine().
void yaze::app::emu::video::Ppu::CalculateMode7Starts | ( | int | y | ) |
Definition at line 567 of file ppu.cc.
References bg_layer_, m7matrix, m7startX, m7startY, m7yFlip, mosaic_size_, and mosaic_startline_.
Referenced by RunLine().
bool yaze::app::emu::video::Ppu::GetWindowState | ( | int | layer, |
int | x ) |
Definition at line 326 of file ppu.cc.
References yaze::app::emu::video::WindowLayer::window1inversed, window1left, window1right, yaze::app::emu::video::WindowLayer::window2inversed, window2left, window2right, and windowLayer.
Referenced by GetPixel(), and HandlePixel().
|
inline |
Definition at line 311 of file ppu.h.
References frame_overscan_, and overscan_.
Referenced by yaze::app::emu::SNES::RunCycle().
void yaze::app::emu::video::Ppu::HandleVblank | ( | ) |
Definition at line 588 of file ppu.cc.
References forced_blank_, frame_interlace, interlace, oam_adr_, oam_adr_written_, oam_in_high_, oam_in_high_written_, and oam_second_write_.
Referenced by yaze::app::emu::SNES::RunCycle().
void yaze::app::emu::video::Ppu::HandleOPT | ( | int | layer, |
int * | lx, | ||
int * | ly ) |
Definition at line 356 of file ppu.cc.
References bg_layer_, GetOffsetValue(), yaze::app::emu::video::BgLayer::hScroll, and mode.
Referenced by GetPixel().
uint16_t yaze::app::emu::video::Ppu::GetOffsetValue | ( | int | col, |
int | row ) |
Definition at line 391 of file ppu.cc.
References bg_layer_, yaze::app::emu::video::BgLayer::bigTiles, yaze::app::emu::video::BgLayer::hScroll, yaze::app::emu::video::BgLayer::tilemapAdr, yaze::app::emu::video::BgLayer::tilemapWider, vram, and yaze::app::emu::video::BgLayer::vScroll.
Referenced by HandleOPT().
int yaze::app::emu::video::Ppu::GetPixelForBgLayer | ( | int | x, |
int | y, | ||
int | layer, | ||
bool | priority ) |
Definition at line 405 of file ppu.cc.
References bg_layer_, yaze::app::emu::video::BgLayer::bigTiles, mode, yaze::app::emu::video::BgLayer::tileAdr, yaze::app::emu::video::BgLayer::tilemapAdr, yaze::app::emu::video::BgLayer::tilemapWider, and vram.
Referenced by GetPixel().
uint8_t yaze::app::emu::video::Ppu::Read | ( | uint8_t | adr, |
bool | latch ) |
Definition at line 598 of file ppu.cc.
References cgram, cgram_pointer_, cgram_second_write_, counters_latched_, even_frame, GetVramRemap(), h_count_, h_count_second_, high_oam_, LatchHV(), m7matrix, memory_, oam, oam_adr_, oam_in_high_, oam_second_write_, yaze::app::emu::memory::Memory::open_bus(), yaze::app::emu::memory::Memory::pal_timing(), ppu1_open_bus_, ppu2_open_bus_, range_over_, time_over_, v_count_, v_count_second_, vram, vram_increment_, vram_increment_on_high_, vram_pointer, and vram_read_buffer_.
Referenced by yaze::app::emu::SNES::ReadBBus().
void yaze::app::emu::video::Ppu::Write | ( | uint8_t | adr, |
uint8_t | val ) |
Definition at line 733 of file ppu.cc.
References add_subscreen_, bg3priority, bg_layer_, yaze::app::emu::video::BgLayer::bigTiles, brightness, cgram, cgram_buffer_, cgram_pointer_, cgram_second_write_, clip_mode_, direct_color_, fixed_color_b_, fixed_color_g_, fixed_color_r_, forced_blank_, GetVramRemap(), half_color_, high_oam_, interlace, layer_, m7charFill, m7extBg, m7largeField, m7matrix, m7prev, m7xFlip, m7yFlip, yaze::app::emu::video::Layer::mainScreenEnabled, yaze::app::emu::video::Layer::mainScreenWindowed, yaze::app::emu::video::WindowLayer::maskLogic, math_enabled_array_, memory_, mode, mosaic_size_, mosaic_startline_, yaze::app::emu::video::BgLayer::mosaicEnabled, oam, oam_adr_, oam_adr_written_, oam_buffer_, oam_in_high_, oam_in_high_written_, oam_second_write_, obj_interlace_, obj_priority_, obj_size_, obj_tile_adr1_, obj_tile_adr2_, overscan_, prevent_math_mode_, pseudo_hires_, scroll_prev2_, scroll_prev_, yaze::app::emu::video::Layer::subScreenEnabled, yaze::app::emu::video::Layer::subScreenWindowed, subtract_color_, yaze::app::emu::video::BgLayer::tileAdr, yaze::app::emu::video::BgLayer::tilemapAdr, yaze::app::emu::video::BgLayer::tilemapHigher, yaze::app::emu::video::BgLayer::tilemapWider, yaze::app::emu::memory::Memory::v_pos(), vram, vram_increment_, vram_increment_on_high_, vram_pointer, vram_read_buffer_, vram_remap_mode_, window1left, window1right, window2left, window2right, and windowLayer.
Referenced by yaze::app::emu::SNES::WriteBBus().
uint16_t yaze::app::emu::video::Ppu::GetVramRemap | ( | ) |
Definition at line 1023 of file ppu.cc.
References vram_pointer, and vram_remap_mode_.
void yaze::app::emu::video::Ppu::PutPixels | ( | uint8_t * | pixel_data | ) |
Definition at line 1038 of file ppu.cc.
References even_frame, frame_interlace, frame_overscan_, and pixelBuffer.
Referenced by yaze::app::emu::SNES::SetPixels().
|
inline |
Definition at line 329 of file ppu.h.
References frame_buffer_.
|
private |
Definition at line 307 of file ppu.cc.
References m7charFill, m7largeField, m7matrix, m7startX, m7startY, m7xFlip, and vram.
Referenced by GetPixel().
bool yaze::app::emu::video::Ppu::frame_overscan_ = false |
Definition at line 296 of file ppu.h.
Referenced by CheckOverscan(), PutPixels(), and Reset().
bool yaze::app::emu::video::Ppu::overscan_ = false |
Definition at line 297 of file ppu.h.
Referenced by CheckOverscan(), Reset(), and Write().
bool yaze::app::emu::video::Ppu::forced_blank_ |
Definition at line 300 of file ppu.h.
Referenced by HandlePixel(), HandleVblank(), Reset(), RunLine(), and Write().
uint8_t yaze::app::emu::video::Ppu::brightness |
Definition at line 301 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
uint8_t yaze::app::emu::video::Ppu::mode |
Definition at line 302 of file ppu.h.
Referenced by GetPixel(), GetPixelForBgLayer(), HandleOPT(), HandlePixel(), Reset(), RunLine(), and Write().
bool yaze::app::emu::video::Ppu::bg3priority |
Definition at line 303 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
bool yaze::app::emu::video::Ppu::even_frame |
Definition at line 304 of file ppu.h.
Referenced by EvaluateSprites(), GetPixel(), HandleFrameStart(), HandlePixel(), PutPixels(), Read(), Reset(), and yaze::app::emu::SNES::RunCycle().
bool yaze::app::emu::video::Ppu::pseudo_hires_ |
Definition at line 305 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
bool yaze::app::emu::video::Ppu::interlace |
Definition at line 306 of file ppu.h.
Referenced by GetPixel(), HandleVblank(), Reset(), and Write().
bool yaze::app::emu::video::Ppu::frame_interlace |
Definition at line 307 of file ppu.h.
Referenced by HandleVblank(), PutPixels(), Reset(), and yaze::app::emu::SNES::RunCycle().
bool yaze::app::emu::video::Ppu::direct_color_ |
Definition at line 309 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 344 of file ppu.h.
Referenced by EvaluateSprites(), GetOffsetValue(), GetPixelForBgLayer(), GetPixelForMode7(), Read(), Reset(), and Write().
|
private |
|
private |
|
private |
|
private |
Definition at line 348 of file ppu.h.
Referenced by GetVramRemap(), Reset(), and Write().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 360 of file ppu.h.
Referenced by EvaluateSprites(), HandleVblank(), Read(), Reset(), and Write().
|
private |
Definition at line 361 of file ppu.h.
Referenced by HandleVblank(), Reset(), and Write().
|
private |
|
private |
Definition at line 363 of file ppu.h.
Referenced by HandleVblank(), Reset(), and Write().
|
private |
|
private |
|
private |
Definition at line 368 of file ppu.h.
Referenced by EvaluateSprites(), HandleFrameStart(), Read(), and Reset().
|
private |
Definition at line 369 of file ppu.h.
Referenced by EvaluateSprites(), HandleFrameStart(), Read(), and Reset().
|
private |
Definition at line 370 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 371 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 372 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 373 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 374 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 375 of file ppu.h.
Referenced by EvaluateSprites(), GetPixel(), Reset(), and RunLine().
|
private |
Definition at line 376 of file ppu.h.
Referenced by EvaluateSprites(), GetPixel(), and Reset().
|
private |
Definition at line 379 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 380 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 381 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 382 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 383 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 384 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 385 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 386 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 387 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 390 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
|
private |
Definition at line 393 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixelForMode7(), Read(), Reset(), and Write().
|
private |
|
private |
Definition at line 395 of file ppu.h.
Referenced by GetPixelForMode7(), Reset(), and Write().
|
private |
Definition at line 396 of file ppu.h.
Referenced by GetPixelForMode7(), Reset(), and Write().
|
private |
Definition at line 397 of file ppu.h.
Referenced by GetPixelForMode7(), Reset(), and Write().
|
private |
Definition at line 398 of file ppu.h.
Referenced by CalculateMode7Starts(), Reset(), and Write().
|
private |
Definition at line 399 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
|
private |
Definition at line 402 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixelForMode7(), and Reset().
|
private |
Definition at line 403 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixelForMode7(), and Reset().
|
private |
Definition at line 406 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 407 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 408 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 409 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 410 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
|
private |
Definition at line 414 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixel(), HandleFrameStart(), Reset(), and Write().
|
private |
Definition at line 416 of file ppu.h.
Referenced by CalculateMode7Starts(), GetOffsetValue(), GetPixel(), GetPixelForBgLayer(), HandleOPT(), Reset(), and Write().
|
private |
|
private |
|
private |
Definition at line 419 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixel(), Reset(), and Write().
|
private |
Definition at line 423 of file ppu.h.
Referenced by HandlePixel(), PutPixels(), and Reset().
|
private |
Definition at line 424 of file ppu.h.
Referenced by HandlePixel(), and Init().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 441 of file ppu.h.
Referenced by UpdateClock().
|
private |
|
private |
|
private |
|
private |
Definition at line 447 of file ppu.h.
Referenced by GetFrameBuffer(), and Init().
|
private |
|
private |
|
private |
|
private |