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

Method LoadBlock

Source/HLEGraphics/RDPStateManager.cpp:357–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357void CRDPStateManager::LoadBlock(const SetLoadTile & load)
358{
359 u32 uls {load.sl}; //Left
360 u32 ult {load.tl}; //Top
361 u32 dxt {load.th}; // 1.11 fixed point
362 u32 tile_idx {load.tile};
363 u32 address {g_TI.GetAddress( uls, ult )};
364 //u32 ByteSize = (load.sh + 1) << (g_TI.Size == G_IM_SIZ_32b);
365
366 bool swapped = (dxt) ? false : true;
367
368#ifdef DAEDALUS_DEBUG_DISPLAYLIST
369 DL_PF(" Tile[%d] (%d,%d - %d) DXT[0x%04x] = [%d]Bytes/line => [%d]Pixels/line Address[0x%08x]",
370 tile_idx,
371 uls, ult,
372 load.sh,
373 dxt,
374 (g_TI.Width << g_TI.Size >> 1),
375 bytes2pixels( (g_TI.Width << g_TI.Size >> 1), g_TI.Size ),
376 address);
377#endif
378
379 InvalidateAllTileTextureInfo(); // Can potentially invalidate all texture infos
380
381 const RDP_Tile & rdp_tile {mTiles[tile_idx]};
382
383 u32 tmem_lookup {(u32)(rdp_tile.tmem >> 4)};
384
385 //Invalidate load info after current TMEM address to the end of TMEM (fixes Fzero and SSV) //Corn
386 ClearEntries( tmem_lookup );
387 SetValidEntry( tmem_lookup );
388
389 TimgLoadDetails & info = mTmemLoadInfo[ tmem_lookup ];
390 info.Address = address;
391 info.Pitch = ~0;
392 info.Swapped = swapped;
393
394
395#ifdef DAEDALUS_ACCURATE_TMEM
396 u32 lrs {load.sh};
397 u32 bytes {((lrs+1) << g_TI.Size) >> 1};
398
399 DAEDALUS_DL_ASSERT( bytes <= 4096, "Suspiciously large loadblock: %d bytes", bytes );
400 DAEDALUS_DL_ASSERT( bytes, "LoadBLock: No bytes??" );
401
402 u32 qwords {(bytes+7) / 8};
403 u32 tmem_offset {(rdp_tile.tmem << 3)};
404 u32 ram_offset {address};
405
406 if (( (address + bytes) > MAX_RAM_ADDRESS) || (tmem_offset + bytes) > MAX_TMEM_ADDRESS )
407 {
408 DBGConsole_Msg(0, "[WWarning LoadBlock address is invalid]" );
409 return;
410 }
411
412 u32* dst {(u32*)(gTMEM + tmem_offset)};
413 u32* src {(u32*)(g_pu8RamBase + ram_offset)};
414

Callers 1

DLParser_LoadBlockFunction · 0.80

Calls 3

bytes2pixelsFunction · 0.85
CopyLineQwordsFunction · 0.85
GetAddressMethod · 0.80

Tested by

no test coverage detected