Creating new accessors
This commit is contained in:
parent
557ef1224b
commit
4844904217
|
@ -138,6 +138,11 @@ class Cpu
|
|||
{
|
||||
return (uint8_t *)code_map[addr >> page_bits] + addr;
|
||||
}
|
||||
|
||||
inline const uint8_t *get_code(nes_addr_t addr) const
|
||||
{
|
||||
return (const uint8_t *)code_map[addr >> page_bits] + addr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace quickNES
|
|
@ -225,6 +225,17 @@ class Emu
|
|||
const char *set_sample_rate(long rate, class Nes_Effects_Buffer *);
|
||||
void irq_changed() { emu.irq_changed(); }
|
||||
|
||||
// Palette memory
|
||||
uint8_t *pal_mem() const { return emu.ppu.getPaletteRAM(); }
|
||||
uint16_t pal_mem_size() const { return emu.ppu.getPaletteRAMSize(); }
|
||||
|
||||
uint8_t peek_prg(nes_addr_t addr) const { return *emu.get_code(addr); }
|
||||
void poke_prg(nes_addr_t addr, uint8_t value) { *emu.get_code(addr) = value; }
|
||||
uint8_t peek_ppu(int addr) { return emu.ppu.peekaddr(addr); }
|
||||
|
||||
uint8_t get_ppu2000() const { return emu.ppu.w2000; }
|
||||
|
||||
|
||||
private:
|
||||
frame_t *frame_;
|
||||
int buffer_height_;
|
||||
|
|
|
@ -89,10 +89,27 @@ class Ppu_Impl : public ppu_state_t
|
|||
};
|
||||
impl_t *impl;
|
||||
|
||||
long map_chr_addr_peek( unsigned a ) const
|
||||
{
|
||||
return chr_pages[a / chr_page_size] + a;
|
||||
}
|
||||
|
||||
int peekaddr(int addr)
|
||||
{
|
||||
if (addr < 0x2000)
|
||||
return chr_data[map_chr_addr_peek(addr)];
|
||||
else
|
||||
return get_nametable(addr)[addr & 0x3ff];
|
||||
}
|
||||
|
||||
static const uint16_t scanline_len = 341;
|
||||
|
||||
uint8_t *getSpriteRAM() const { return (uint8_t*)spr_ram; }
|
||||
uint16_t getSpriteRAMSize() const { return spr_ram_size; }
|
||||
|
||||
uint8_t *getPaletteRAM() const { return (uint8_t*)palette; }
|
||||
uint16_t getPaletteRAMSize() const { return sizeof(palette); }
|
||||
|
||||
uint8_t spr_ram[spr_ram_size];
|
||||
void all_tiles_modified();
|
||||
|
||||
|
|
Loading…
Reference in New Issue