Skip to content

Commit

Permalink
Minor fixes that I found while writing homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydr8gon committed Mar 25, 2023
1 parent 98238cc commit 559f1ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ namespace Memory

void Memory::reset()
{
// Clear the remaining memory locations
// Clear RDRAM and RSP DMEM/IMEM
memset(rdram, 0, sizeof(rdram));
memset(rspMem, 0, sizeof(rspMem));
memset(entries, 0, sizeof(entries));

// Map TLB entries to inaccessible locations
for (int i = 0; i < 32; i++)
entries[i].entryHi = 0x80000000;
}

void Memory::getEntry(uint32_t index, uint32_t &entryLo0, uint32_t &entryLo1, uint32_t &entryHi, uint32_t &pageMask)
Expand Down
4 changes: 2 additions & 2 deletions src/rdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@ uint32_t RDP::getTexel(Tile &tile, int s, int t)
{
// Convert a CI4 texel to RGBA32, using a TLUT in the high banks
uint8_t index = (tmem[(tile.address + t * tile.width + s / 2) & 0xFFF] >> (~s & 1) * 4) & 0xF;
uint8_t *value = &tmem[(tile.address + 0x800 + (tile.palette + index) * 8) & 0xFF8];
uint8_t *value = &tmem[(0x800 + (tile.palette + index) * 8) & 0xFF8];
return RGBA16toRGBA32((value[0] << 8) | value[1]);
}

case CI8:
{
// Convert a CI8 texel to RGBA32, using a TLUT in the high banks
uint8_t index = tmem[(tile.address + t * tile.width + s) & 0xFFF];
uint8_t *value = &tmem[(tile.address + 0x800 + index * 8) & 0xFF8];
uint8_t *value = &tmem[(0x800 + index * 8) & 0xFF8];
return RGBA16toRGBA32((value[0] << 8) | value[1]);
}

Expand Down

0 comments on commit 559f1ed

Please sign in to comment.