MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / LoadTlut

Method LoadTlut

Source/HLEGraphics/RDPStateManager.cpp:551–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549}
550
551void CRDPStateManager::LoadTlut(const SetLoadTile & load)
552{
553 // Tlut fmt is sometimes wrong (in 007) and is set after tlut load, but before tile load
554 // Format is always 16bpp - RGBA16 or IA16:
555 //DAEDALUS_DL_ASSERT(g_TI.Size == G_IM_SIZ_16b, "Crazy tlut load - not 16bpp");
556
557 u32 uls {load.sl}; //Left
558 u32 ult {load.tl}; //Top
559 u32 lrs {load.sh}; //Right
560 u32 lrt {load.th}; //Bottom
561 u32 tile_idx {load.tile};
562 u32 ram_offset {g_TI.GetAddress16bpp(uls >> 2, ult >> 2)};
563 u8* address {g_pu8RamBase + ram_offset};
564
565 const RDP_Tile & rdp_tile {mTiles[tile_idx]};
566
567 u32 count {((lrs - uls)>>2) + 1};
568
569 #ifdef DAEDALUS_DEBUG_DISPLAYLIST
570 DAEDALUS_USE(count);
571 DAEDALUS_USE(lrt);
572#endif
573
574 //Store address of PAL (assuming PAL is only stored in upper half of TMEM) //Corn
575 gTlutLoadAddresses[ (rdp_tile.tmem>>2) & 0x3F ] = (u32*)address;
576 #ifdef DAEDALUS_DEBUG_DISPLAYLIST
577 DL_PF(" TLut Addr[0x%08x] TMEM[0x%03x] Tile[%d] Count[%d] Format[%s] (%d,%d)->(%d,%d)",
578 address, rdp_tile.tmem, tile_idx, count, kTLUTTypeName[gRDPOtherMode.text_tlut], uls >> 2, ult >> 2, lrs >> 2, lrt >> 2);
579#endif
580#ifdef DAEDALUS_ACCURATE_TMEM
581 DAEDALUS_DL_ASSERT( (rdp_tile.tmem + count) <= (MAX_TMEM_ADDRESS/8), "LoadTlut address is invalid" );
582
583 u16* dst {(u16*)(((u64*)gTMEM) + rdp_tile.tmem)};
584 u16* src {(u16*)(address)};
585
586 CopyLine16(dst, src, count);
587#endif
588}
589
590// Limit the tile's width/height to the number of bits specified by mask_s/t.
591// See the detailed noted in BaseRenderer::UpdateTileSnapshots for issues relating to this.

Callers 1

DLParser_LoadTLutFunction · 0.80

Calls 2

CopyLine16Function · 0.85
GetAddress16bppMethod · 0.80

Tested by

no test coverage detected