coastline 0.0.4
Loading...
Searching...
No Matches
texturescan.h File Reference

The scan of the display lists of the game in the PC port for the textures they load. More...

Include dependency graph for texturescan.h:

Go to the source code of this file.

Macros

#define TMEM_SHADOW_SIZE   0x800
 The size of g_abTmemShadow.
#define TMEM_SHADOW_TLUT_SIZE   0xf800
 The size of g_abTmemShadowTlut.

Enumerations

enum  TexScanLoadState {
  TEX_SCAN_IDLE = 0 , TEX_SCAN_IMAGE_SET = 1 , TEX_SCAN_LOAD_SYNCED = 2 , TEX_SCAN_BLOCK_LOADED = 3 ,
  TEX_SCAN_TILE_SYNCED = 4 , TEX_SCAN_TILE_SET = 5 , TEX_SCAN_TILE_SIZED = 6 , TEX_SCAN_TLUT_LOADED = 7 ,
  TEX_SCAN_PIPE_SYNCED = 8
}
 The states of the scan of a load of a texture, by the command that sets each. More...

Functions

void MarkTextureCommandBlockStart (GbiCommand *pCommand)
 Mark the first command of the commands that load a texture, when none is marked.
void ScanGbiTexture (GbiCommand *pCommand)
 Record the tile and the levels of detail of a texture command.
void ScanGbiSetTextureImage (GbiCommand *pCommand)
 Record the texture image of a command, when the scan is idle or after a block or a tile size.
void ScanGbiLoadTlut (GbiCommand *pCommand)
 Copy the palette of a command from the texture image into g_pTlutLoadList, after a texture image.
void ScanGbiLoadSync (GbiCommand *pCommand)
 Mark the sync of a load, after a texture image.
void ScanGbiLoadBlock (GbiCommand *pCommand)
 Copy the block of a command from the texture image into g_abTmemShadow, after the sync of a load.
void ScanGbiPipeSync (GbiCommand *pCommand)
 Mark the sync of the pipeline, after a palette.
void ScanGbiTileSync (GbiCommand *pCommand)
 Mark the sync of a tile, after a block or a palette.
void ScanGbiSetTileSize (GbiCommand *pCommand)
 Record the edges of the tile of a command.
void ScanGbiSetOtherModeL (GbiCommand *pCommand)
 Record bit 16 of the render mode of a command of the low word of the other modes, as g_bTexScanRenderModeBlendBit16 takes it.
void ScanGbiTextureLutMode (GbiCommand *pCommand)
 Record the format of the palettes of a command, keeping it for a command without one.
void ScanGbiSetOtherModeH (GbiCommand *pCommand)
 Record the palettes or the detail of the textures of a command of the high word of the other modes.
void ScanGbiSetTile (GbiCommand *pCommand)
 Record the settings of the tile of a command and mark the tile set.
void FlushPendingTextureLoad (GbiCommand *pCommand)
 Convert a pending texture load when a drawing command consumes it.
int CreateTextureFromTmemShadow (unsigned char *pTmem)
 Find or create a texture entry from the captured texture memory and scan state.
void PreprocessDisplayListTextures (GbiCommand *pCommand)
 Scan a display list for texture loads until its end command.

Variables

int g_dwTexScanLoadState
 The state of the scan of the load of a texture.
GbiCommand * g_pTexScanCmdBlockStart
 The first command of the commands that load a texture, or nullptr before one is marked.
int g_dwTexScanTileIndex
 The tile the last texture command chose.
int g_dwTexScanMipLevels
 The levels of detail the last texture command gave.
int g_dwTexScanImageSiz
 The size of the texels of the texture image set last.
const void * g_pTexScanImageAddress
 The texels of the texture image set last.
const void * g_pTexScanTlutAddress
 The texels of the palette loaded last, nullptr after a texture image without one.
GbiCommand * g_pTexScanSetTextureImageCmd
 The command that set the texture image when the scan was idle.
unsigned char g_abTmemShadow [TMEM_SHADOW_SIZE]
 The copy of the texture memory of the console that the blocks load into.
unsigned char g_abTmemShadowTlut [TMEM_SHADOW_TLUT_SIZE]
 The copy of the palettes the scan loads.
unsigned char * g_pTlutLoadList
 Where ScanGbiLoadTlut() copies a palette.
const void * g_pTexScanLoadBlockSource
 The texels the last block was loaded from.
int g_dwTexScanLoadBlockSize
 The bytes of the last block loaded.
TexScanTile g_aTexScanTiles [TEX_SCAN_TILE_COUNT]
 The tiles the scan records.
int g_bTexScanRenderModeBlendBit16
 Bit 16 of the render mode set last when bit 11 or 12 of it is set, and 0 otherwise and for three render modes the scan knows.
int g_dwTexScanTlutMode
 The format of the palettes the textures use, 0 for RGBA and 3 for IA.
int g_dwTexScanRenderTileIndex
 Whether the detail of the textures is the mode of detail textures.
int g_dwTexScanMaxTileIndex
 The highest tile a tile command set since a block, a tile sync, or a palette.
int g_bTexScanColorCombine
 Whether texture matching includes the captured primitive and environment colours.
int g_bTexScanPrimColorSet
 Whether the current primitive colour was set by a display-list command.
int g_bTexScanEnvColorSet
 Whether the current environment colour was set by a display-list command.
unsigned char g_bTexScanPrimColorR
 The red channel of the current primitive colour.
unsigned char g_bTexScanPrimColorG
 The green channel of the current primitive colour.
unsigned char g_bTexScanPrimColorB
 The blue channel of the current primitive colour.
unsigned char g_bTexScanPrimColorA
 The alpha channel of the current primitive colour.
unsigned char g_bTexScanEnvColorR
 The red channel of the current environment colour.
unsigned char g_bTexScanEnvColorG
 The green channel of the current environment colour.
unsigned char g_bTexScanEnvColorB
 The blue channel of the current environment colour.
unsigned char g_bTexScanEnvColorA
 The alpha channel of the current environment colour.
void(* g_pfnPreprocessDisplayListTextures )(GbiCommand *pCommand)
 The backend callback that scans a display list for texture loads.

Detailed Description

The scan of the display lists of the game in the PC port for the textures they load.

Macro Definition Documentation

◆ TMEM_SHADOW_SIZE

#define TMEM_SHADOW_SIZE   0x800

The size of g_abTmemShadow.

◆ TMEM_SHADOW_TLUT_SIZE

#define TMEM_SHADOW_TLUT_SIZE   0xf800

The size of g_abTmemShadowTlut.

Enumeration Type Documentation

◆ TexScanLoadState

The states of the scan of a load of a texture, by the command that sets each.

Enumerator
TEX_SCAN_IDLE 

No load is being scanned.

TEX_SCAN_IMAGE_SET 

ScanGbiSetTextureImage().

TEX_SCAN_LOAD_SYNCED 

ScanGbiLoadSync().

TEX_SCAN_BLOCK_LOADED 

ScanGbiLoadBlock().

TEX_SCAN_TILE_SYNCED 

ScanGbiTileSync().

TEX_SCAN_TILE_SET 

ScanGbiSetTile().

TEX_SCAN_TILE_SIZED 

ScanGbiSetTileSize().

TEX_SCAN_TLUT_LOADED 

ScanGbiLoadTlut().

TEX_SCAN_PIPE_SYNCED 

ScanGbiPipeSync().

Function Documentation

◆ MarkTextureCommandBlockStart()

void MarkTextureCommandBlockStart ( GbiCommand * pCommand)

Mark the first command of the commands that load a texture, when none is marked.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x10029e60
Ghidra address:
BRGlide: 0x100293d0

◆ ScanGbiTexture()

void ScanGbiTexture ( GbiCommand * pCommand)

Record the tile and the levels of detail of a texture command.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x10029e80
Ghidra address:
BRGlide: 0x100293f0

◆ ScanGbiSetTextureImage()

void ScanGbiSetTextureImage ( GbiCommand * pCommand)

Record the texture image of a command, when the scan is idle or after a block or a tile size.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x10029eb0
Ghidra address:
BRGlide: 0x10029420

◆ ScanGbiLoadTlut()

void ScanGbiLoadTlut ( GbiCommand * pCommand)

Copy the palette of a command from the texture image into g_pTlutLoadList, after a texture image.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x10029f10
Ghidra address:
BRGlide: 0x10029480

◆ ScanGbiLoadSync()

void ScanGbiLoadSync ( GbiCommand * pCommand)

Mark the sync of a load, after a texture image.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x10029f80
Ghidra address:
BRGlide: 0x100294f0

◆ ScanGbiLoadBlock()

void ScanGbiLoadBlock ( GbiCommand * pCommand)

Copy the block of a command from the texture image into g_abTmemShadow, after the sync of a load.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x10029fa0
Ghidra address:
BRGlide: 0x10029510

◆ ScanGbiPipeSync()

void ScanGbiPipeSync ( GbiCommand * pCommand)

Mark the sync of the pipeline, after a palette.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a000
Ghidra address:
BRGlide: 0x10029570

◆ ScanGbiTileSync()

void ScanGbiTileSync ( GbiCommand * pCommand)

Mark the sync of a tile, after a block or a palette.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a020
Ghidra address:
BRGlide: 0x10029590

◆ ScanGbiSetTileSize()

void ScanGbiSetTileSize ( GbiCommand * pCommand)

Record the edges of the tile of a command.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a140
Ghidra address:
BRGlide: 0x100296b0

◆ ScanGbiSetOtherModeL()

void ScanGbiSetOtherModeL ( GbiCommand * pCommand)

Record bit 16 of the render mode of a command of the low word of the other modes, as g_bTexScanRenderModeBlendBit16 takes it.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a1a0
Ghidra address:
BRGlide: 0x10029710

◆ ScanGbiTextureLutMode()

void ScanGbiTextureLutMode ( GbiCommand * pCommand)

Record the format of the palettes of a command, keeping it for a command without one.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a250
Ghidra address:
BRGlide: 0x100297c0

◆ ScanGbiSetOtherModeH()

void ScanGbiSetOtherModeH ( GbiCommand * pCommand)

Record the palettes or the detail of the textures of a command of the high word of the other modes.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a210
Ghidra address:
BRGlide: 0x10029780

◆ ScanGbiSetTile()

void ScanGbiSetTile ( GbiCommand * pCommand)

Record the settings of the tile of a command and mark the tile set.

Parameters
pCommandThe command.
Ghidra address:
BRD3D: 0x1002a040
Ghidra address:
BRGlide: 0x100295b0

◆ FlushPendingTextureLoad()

void FlushPendingTextureLoad ( GbiCommand * pCommand)

Convert a pending texture load when a drawing command consumes it.

Parameters
pCommandThe drawing command.
Ghidra address:
BRD3D: 0x10029410
Ghidra address:
BRGlide: 0x10028b50

◆ CreateTextureFromTmemShadow()

int CreateTextureFromTmemShadow ( unsigned char * pTmem)

Find or create a texture entry from the captured texture memory and scan state.

Parameters
pTmemThe captured texture memory, unused.
Returns
The texture entry.
Ghidra address:
BRD3D: 0x10029470
Ghidra address:
BRGlide: 0x10028bb0

◆ PreprocessDisplayListTextures()

void PreprocessDisplayListTextures ( GbiCommand * pCommand)

Scan a display list for texture loads until its end command.

Parameters
pCommandThe first command, or null.
Ghidra address:
BRD3D: 0x100290e0
Ghidra address:
BRGlide: 0x10028820

Variable Documentation

◆ g_dwTexScanLoadState

int g_dwTexScanLoadState
extern

The state of the scan of the load of a texture.

Ghidra address:
BRD3D: 0x104d51ac
Ghidra address:
BRGlide: 0x105e17fc

◆ g_pTexScanCmdBlockStart

GbiCommand* g_pTexScanCmdBlockStart
extern

The first command of the commands that load a texture, or nullptr before one is marked.

Ghidra address:
BRD3D: 0x10575438
Ghidra address:
BRGlide: 0x106b7a9c

◆ g_dwTexScanTileIndex

int g_dwTexScanTileIndex
extern

The tile the last texture command chose.

Ghidra address:
BRD3D: 0x105553e8
Ghidra address:
BRGlide: 0x10697a50

◆ g_dwTexScanMipLevels

int g_dwTexScanMipLevels
extern

The levels of detail the last texture command gave.

Ghidra address:
BRD3D: 0x105553e0
Ghidra address:
BRGlide: 0x10697a48

◆ g_dwTexScanImageSiz

int g_dwTexScanImageSiz
extern

The size of the texels of the texture image set last.

Ghidra address:
BRD3D: 0x104d51b4
Ghidra address:
BRGlide: 0x105e1804

◆ g_pTexScanImageAddress

const void* g_pTexScanImageAddress
extern

The texels of the texture image set last.

Ghidra address:
BRD3D: 0x104d51bc
Ghidra address:
BRGlide: 0x105e180c

◆ g_pTexScanTlutAddress

const void* g_pTexScanTlutAddress
extern

The texels of the palette loaded last, nullptr after a texture image without one.

Ghidra address:
BRD3D: 0x10575434
Ghidra address:
BRGlide: 0x106b7a98

◆ g_pTexScanSetTextureImageCmd

GbiCommand* g_pTexScanSetTextureImageCmd
extern

The command that set the texture image when the scan was idle.

Ghidra address:
BRD3D: 0x105553fc
Ghidra address:
BRGlide: 0x10697a64

◆ g_abTmemShadow

unsigned char g_abTmemShadow[TMEM_SHADOW_SIZE]
extern

The copy of the texture memory of the console that the blocks load into.

Ghidra address:
BRD3D: 0x104c51a8
Ghidra address:
BRGlide: 0x105d17f8

◆ g_abTmemShadowTlut

unsigned char g_abTmemShadowTlut[TMEM_SHADOW_TLUT_SIZE]
extern

The copy of the palettes the scan loads.

Ghidra address:
BRD3D: 0x104c59a8
Ghidra address:
BRGlide: 0x105d1ff8

◆ g_pTlutLoadList

unsigned char* g_pTlutLoadList
extern

Where ScanGbiLoadTlut() copies a palette.

Ghidra address:
BRD3D: 0x100a7df0
Ghidra address:
BRGlide: 0x100a9e58

◆ g_pTexScanLoadBlockSource

const void* g_pTexScanLoadBlockSource
extern

The texels the last block was loaded from.

Ghidra address:
BRD3D: 0x104c51a4
Ghidra address:
BRGlide: 0x105d17f0

◆ g_dwTexScanLoadBlockSize

int g_dwTexScanLoadBlockSize
extern

The bytes of the last block loaded.

Ghidra address:
BRD3D: 0x105553ec
Ghidra address:
BRGlide: 0x10697a54

◆ g_aTexScanTiles

TexScanTile g_aTexScanTiles[TEX_SCAN_TILE_COUNT]
extern

The tiles the scan records.

Ghidra address:
BRD3D: 0x105551d8
Ghidra address:
BRGlide: 0x10697840

◆ g_bTexScanRenderModeBlendBit16

int g_bTexScanRenderModeBlendBit16
extern

Bit 16 of the render mode set last when bit 11 or 12 of it is set, and 0 otherwise and for three render modes the scan knows.

Ghidra address:
BRD3D: 0x10575414
Ghidra address:
BRGlide: 0x106b7a7c

◆ g_dwTexScanTlutMode

int g_dwTexScanTlutMode
extern

The format of the palettes the textures use, 0 for RGBA and 3 for IA.

Ghidra address:
BRD3D: 0x105553dc
Ghidra address:
BRGlide: 0x10697a44

◆ g_dwTexScanRenderTileIndex

int g_dwTexScanRenderTileIndex
extern

Whether the detail of the textures is the mode of detail textures.

Ghidra address:
BRD3D: 0x1057544c
Ghidra address:
BRGlide: 0x106b7ab0

◆ g_dwTexScanMaxTileIndex

int g_dwTexScanMaxTileIndex
extern

The highest tile a tile command set since a block, a tile sync, or a palette.

Ghidra address:
BRD3D: 0x10575430
Ghidra address:
BRGlide: 0x106b7a94

◆ g_bTexScanColorCombine

int g_bTexScanColorCombine
extern

Whether texture matching includes the captured primitive and environment colours.

Ghidra address:
BRD3D: 0x10575448
Ghidra address:
BRGlide: 0x106b7aac

◆ g_bTexScanPrimColorSet

int g_bTexScanPrimColorSet
extern

Whether the current primitive colour was set by a display-list command.

Ghidra address:
BRD3D: 0x10575444
Ghidra address:
BRGlide: 0x106b7aa8

◆ g_bTexScanEnvColorSet

int g_bTexScanEnvColorSet
extern

Whether the current environment colour was set by a display-list command.

Ghidra address:
BRD3D: 0x10575440
Ghidra address:
BRGlide: 0x106b7aa4

◆ g_bTexScanPrimColorR

unsigned char g_bTexScanPrimColorR
extern

The red channel of the current primitive colour.

Ghidra address:
BRD3D: 0x10555400
Ghidra address:
BRGlide: 0x10697a68

◆ g_bTexScanPrimColorG

unsigned char g_bTexScanPrimColorG
extern

The green channel of the current primitive colour.

Ghidra address:
BRD3D: 0x10575410
Ghidra address:
BRGlide: 0x106b7a78

◆ g_bTexScanPrimColorB

unsigned char g_bTexScanPrimColorB
extern

The blue channel of the current primitive colour.

Ghidra address:
BRD3D: 0x105553d8
Ghidra address:
BRGlide: 0x10697a40

◆ g_bTexScanPrimColorA

unsigned char g_bTexScanPrimColorA
extern

The alpha channel of the current primitive colour.

Ghidra address:
BRD3D: 0x105551d0
Ghidra address:
BRGlide: 0x10661828

◆ g_bTexScanEnvColorR

unsigned char g_bTexScanEnvColorR
extern

The red channel of the current environment colour.

Ghidra address:
BRD3D: 0x104d51b0
Ghidra address:
BRGlide: 0x105e1800

◆ g_bTexScanEnvColorG

unsigned char g_bTexScanEnvColorG
extern

The green channel of the current environment colour.

Ghidra address:
BRD3D: 0x105551d4
Ghidra address:
BRGlide: 0x1066182c

◆ g_bTexScanEnvColorB

unsigned char g_bTexScanEnvColorB
extern

The blue channel of the current environment colour.

Ghidra address:
BRD3D: 0x104d51a8
Ghidra address:
BRGlide: 0x105e17f8

◆ g_bTexScanEnvColorA

unsigned char g_bTexScanEnvColorA
extern

The alpha channel of the current environment colour.

Ghidra address:
BRD3D: 0x104c51a0
Ghidra address:
BRGlide: 0x105d17e8

◆ g_pfnPreprocessDisplayListTextures

void(* g_pfnPreprocessDisplayListTextures) (GbiCommand *pCommand) ( GbiCommand * pCommand)
extern

The backend callback that scans a display list for texture loads.

Ghidra address:
BRD3D: 0x118aa0c4