coastline 0.0.4
Loading...
Searching...
No Matches
texturescan.h
Go to the documentation of this file.
1#pragma once
2
7
9#include "win32/displaylist.h"
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
27
29#define TMEM_SHADOW_SIZE 0x800
30
32#define TMEM_SHADOW_TLUT_SIZE 0xf800
33
40extern int g_dwTexScanLoadState;
41
49
56extern int g_dwTexScanTileIndex;
57
64extern int g_dwTexScanMipLevels;
65
72extern int g_dwTexScanImageSiz;
73
80extern const void *g_pTexScanImageAddress;
81
88extern const void *g_pTexScanTlutAddress;
89
97
104extern unsigned char g_abTmemShadow[TMEM_SHADOW_SIZE];
105
112extern unsigned char g_abTmemShadowTlut[TMEM_SHADOW_TLUT_SIZE];
113
120extern unsigned char *g_pTlutLoadList;
121
128extern const void *g_pTexScanLoadBlockSource;
129
136extern int g_dwTexScanLoadBlockSize;
137
145
154
163
172
181
191
200
209
218
227
236
246
253extern int g_dwTexScanTlutMode;
254
262
269extern int g_dwTexScanMaxTileIndex;
270
279
289
298
305extern int g_bTexScanColorCombine;
312extern int g_bTexScanPrimColorSet;
319extern int g_bTexScanEnvColorSet;
326extern unsigned char g_bTexScanPrimColorR;
333extern unsigned char g_bTexScanPrimColorG;
340extern unsigned char g_bTexScanPrimColorB;
347extern unsigned char g_bTexScanPrimColorA;
354extern unsigned char g_bTexScanEnvColorR;
361extern unsigned char g_bTexScanEnvColorG;
368extern unsigned char g_bTexScanEnvColorB;
375extern unsigned char g_bTexScanEnvColorA;
376
385
394int CreateTextureFromTmemShadow(unsigned char *pTmem);
395
404
410extern void (*g_pfnPreprocessDisplayListTextures)(GbiCommand *pCommand);
411
412#ifdef __cplusplus
413}
414#endif
The interpreter of the display lists of the game in the PC port.
A command of a display list of the game.
Definition gbicommand.h:30
A tile recorded by texture scans and loaded texture entries.
Definition texturetile.h:8
void ScanGbiTextureLutMode(GbiCommand *pCommand)
Record the format of the palettes of a command, keeping it for a command without one.
const void * g_pTexScanTlutAddress
The texels of the palette loaded last, nullptr after a texture image without one.
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 rend...
int g_bTexScanPrimColorSet
Whether the current primitive colour was set by a display-list command.
void ScanGbiTexture(GbiCommand *pCommand)
Record the tile and the levels of detail of a texture command.
unsigned char g_bTexScanEnvColorR
The red channel of the current environment colour.
int CreateTextureFromTmemShadow(unsigned char *pTmem)
Find or create a texture entry from the captured texture memory and scan state.
TexScanTile g_aTexScanTiles[TEX_SCAN_TILE_COUNT]
The tiles the scan records.
int g_bTexScanEnvColorSet
Whether the current environment colour was set by a display-list command.
int g_dwTexScanMipLevels
The levels of detail the last texture command gave.
unsigned char g_bTexScanEnvColorA
The alpha channel of the current environment colour.
#define TMEM_SHADOW_SIZE
The size of g_abTmemShadow.
Definition texturescan.h:29
unsigned char g_bTexScanPrimColorR
The red channel of the current primitive colour.
unsigned char g_bTexScanEnvColorB
The blue channel of the current environment colour.
GbiCommand * g_pTexScanSetTextureImageCmd
The command that set the texture image when the scan was idle.
void(* g_pfnPreprocessDisplayListTextures)(GbiCommand *pCommand)
The backend callback that scans a display list for texture loads.
TexScanLoadState
The states of the scan of a load of a texture, by the command that sets each.
Definition texturescan.h:16
@ TEX_SCAN_TILE_SIZED
Definition texturescan.h:23
@ TEX_SCAN_IMAGE_SET
Definition texturescan.h:18
@ TEX_SCAN_LOAD_SYNCED
Definition texturescan.h:19
@ TEX_SCAN_TILE_SYNCED
Definition texturescan.h:21
@ TEX_SCAN_IDLE
Definition texturescan.h:17
@ TEX_SCAN_PIPE_SYNCED
Definition texturescan.h:25
@ TEX_SCAN_BLOCK_LOADED
Definition texturescan.h:20
@ TEX_SCAN_TILE_SET
Definition texturescan.h:22
@ TEX_SCAN_TLUT_LOADED
Definition texturescan.h:24
int g_dwTexScanImageSiz
The size of the texels of the texture image set last.
unsigned char g_bTexScanPrimColorA
The alpha channel of the current primitive colour.
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 ScanGbiLoadTlut(GbiCommand *pCommand)
Copy the palette of a command from the texture image into g_pTlutLoadList, after a texture image.
int g_dwTexScanLoadState
The state of the scan of the load of a texture.
const void * g_pTexScanLoadBlockSource
The texels the last block was loaded from.
void FlushPendingTextureLoad(GbiCommand *pCommand)
Convert a pending texture load when a drawing command consumes it.
unsigned char g_bTexScanEnvColorG
The green channel of the current environment colour.
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.
#define TMEM_SHADOW_TLUT_SIZE
The size of g_abTmemShadowTlut.
Definition texturescan.h:32
int g_dwTexScanMaxTileIndex
The highest tile a tile command set since a block, a tile sync, or a palette.
unsigned char g_abTmemShadow[TMEM_SHADOW_SIZE]
The copy of the texture memory of the console that the blocks load into.
void ScanGbiSetTile(GbiCommand *pCommand)
Record the settings of the tile of a command and mark the tile set.
void ScanGbiSetTileSize(GbiCommand *pCommand)
Record the edges of the tile of a command.
unsigned char g_bTexScanPrimColorG
The green channel of the current primitive colour.
const void * g_pTexScanImageAddress
The texels of the texture image set last.
unsigned char * g_pTlutLoadList
Where ScanGbiLoadTlut() copies a palette.
void ScanGbiSetOtherModeL(GbiCommand *pCommand)
Record bit 16 of the render mode of a command of the low word of the other modes, as g_bTexScanRender...
void PreprocessDisplayListTextures(GbiCommand *pCommand)
Scan a display list for texture loads until its end command.
void ScanGbiTileSync(GbiCommand *pCommand)
Mark the sync of a tile, after a block or a palette.
unsigned char g_bTexScanPrimColorB
The blue channel of the current primitive colour.
void ScanGbiLoadBlock(GbiCommand *pCommand)
Copy the block of a command from the texture image into g_abTmemShadow, after the sync of a load.
void ScanGbiLoadSync(GbiCommand *pCommand)
Mark the sync of a load, after a texture image.
int g_bTexScanColorCombine
Whether texture matching includes the captured primitive and environment colours.
int g_dwTexScanLoadBlockSize
The bytes of the last block loaded.
void ScanGbiPipeSync(GbiCommand *pCommand)
Mark the sync of the pipeline, after a palette.
unsigned char g_abTmemShadowTlut[TMEM_SHADOW_TLUT_SIZE]
The copy of the palettes the scan loads.
void MarkTextureCommandBlockStart(GbiCommand *pCommand)
Mark the first command of the commands that load a texture, when none is marked.
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.
void ScanGbiSetTextureImage(GbiCommand *pCommand)
Record the texture image of a command, when the scan is idle or after a block or a tile size.
#define TEX_SCAN_TILE_COUNT
The number of tile records in a scan or loaded texture entry.
Definition texturetile.h:28