Skip to main content

display-h

source
Expand description

At any point in time, there are 3 frames in progress:

- one frame is fully rendered and being drawn on the screen.

this frame just sits in the frame buffer, and isn't tracked by the display system.

- one frame is being rendered

(frame buffer is being written to by GS, VU1 sending tris to GS, VIF1 feeding VU1)

this frame needs a DMA buffer that is full, and being read by VIF1

- one frame is being set up. The engine is running gameplay code and generating DMA data

this frame also needs a DMA buffer, which is being filled up.

Types


display

display: basicsource
Fields
type: type
on-screen: int32
last-screen: int32
frames: display-frame
bgcolor: gs-bgcolor
pmode: gs-pmode
clock: clock
session-clock: clock
game-clock: clock
base-clock: clock
real-clock: clock
frame-clock: clock
real-frame-clock: clock
target-clock: clock
entity-clock: clock
part-clock: clock
bg-clock: clock
camera-clock: clock
user0-clock: clock
total-game-clock: clock
time-factor: float
dog-ratio: float
vblank-start-time: int64
total-run-time: int64
run-half-speed: basic
dog-count: float
vu1-enable-user: vu1-renderer-mask
vu1-enable-user-menu: vu1-renderer-mask
force-sync: uint32
Methods
set-time-ratios(obj: display, arg0: float) => floatsource

Set the 'dog ratio'. This should be 1 when the game is running at full speed.
Larger dog ratio means slower.

display-frame

display-frame: basicsource
Fields
type: type
buffer: dma-buffer
calc-buf: dma-buffer
vu1-buf: dma-buffer
debug-buf: dma-buffer
global-buf: dma-buffer
bucket-group: inline-array
profile-array: profile-array
start-time: int64
run-time: int64

Variables


*post-draw-hook*

*post-draw-hook*: functionsource

*pre-draw-hook*

*pre-draw-hook*: functionsource

DEFAULT_ALL_RENDERERS

DEFAULT_ALL_RENDERERS: unknownsource

display

source

Functions


allocate-dma-buffers

allocate-dma-buffers(arg0: display) => displaysource

Allocate the main, debug, and calc dma buffers.

draw-quad2d

draw-quad2d(arg0: dma-buffer, arg1: draw-context) => nonesource

Draw a quad that fills the entire context

draw-sprite2d-xy

draw-sprite2d-xy(arg0: dma-buffer, arg1: int, arg2: int, arg3: int, arg4: int, arg5: rgba) => nonesource

Draw a sprite primitive with the given color and dimensions.

draw-sprite2d-xy-absolute

draw-sprite2d-xy-absolute(arg0: dma-buffer, arg1: int, arg2: int, arg3: int, arg4: int, arg5: rgba) => nonesource

Draw a sprite primitive, setting the gs-xzyf register to exactly the values specified (no offset/clamp)

get-current-time

get-current-time() => time-framesource

Get the base-clock time.

get-integral-current-time

get-integral-current-time() => uintsource

Get the number of frames that have happened.

reset-display-gs-state

reset-display-gs-state(arg0: display, arg1: dma-buffer) => displaysource

screen-gradient

screen-gradient(arg0: dma-buffer, arg1: rgba, arg2: rgba, arg3: rgba, arg4: rgba) => nonesource

Fill the screen with a sprite with the given colors.

set-display

set-display(arg0: display) => displaysource

Allocate and initialize clocks for the display.

set-display-gs-state

set-display-gs-state(arg0: dma-buffer, arg1: int, arg2: int, arg3: int, arg4: int, arg5: int) => dma-buffersource

set-display-gs-state-offset

set-display-gs-state-offset(arg0: dma-buffer, arg1: int, arg2: int, arg3: int, arg4: int, arg5: int, arg6: int, arg7: int) => dma-buffersource

vblank-handler

vblank-handler() => intsource

Record the time of the last two vblanks.

vif1-handler

vif1-handler() => nonesource

vif1-handler-debug

vif1-handler-debug(mark-in: int) => nonesource

Handle the VIF1 interrupt.
The mark register of VIF will be set to the bucket that is now starting.

Variables


*display*

*display*: displaysource

*font-context*

*font-context*: font-contextsource

*vu0-dma-list*

*vu0-dma-list*: dma-buffersource

DMA_BUFFER_DEBUG_SIZE

DMA_BUFFER_DEBUG_SIZE: unknownsource

DMA_BUFFER_GLOBAL_SIZE

DMA_BUFFER_GLOBAL_SIZE: unknownsource

Types


draw-context

draw-context: basicsource
Fields
type: type
orgx: int32
orgy: int32
orgz: int32
width: int32
height: int32
color: rgba

gif-bank

gif-bank: structuresource
Fields
ctrl: gif-ctrl
mode: gif-mode
stat: gif-stat
tag0: uint32
tag1: uint32
tag2: uint32
tag3: uint32
cnt: gif-cnt
p3cnt: gif-p3cnt
p3tag: gif-p3tag

gif-cnt

gif-cnt: uint32source

gif-ctrl

gif-ctrl: uint32source

gif-mode

gif-mode: uint32source

gif-p3cnt

gif-p3cnt: uint32source

gif-p3tag

gif-p3tag: uint32source

gif-packet

gif-packet: basicsource
Fields
type: type
reg-count: int32
gif-tag: gs-gif-tag
gif-tag0: uint128
args: uint64

gif-stat

gif-stat: uint32source

gif-tag

gif-tag: uint128source

gif-tag-count

gif-tag-count: uint32source

gif-tag-prim

gif-tag-prim: uint32source

gif-tag-regs

gif-tag-regs: uint64source

gif-tag-regs-32

gif-tag-regs-32: uint32source

gif-tag64

gif-tag64: uint64source

gs-adcmd

gs-adcmd: structuresource
Fields
word: uint32
quad: uint128
data: uint64
cmds: gs-reg64
cmd: uint8
x: uint32
y: uint32
z: uint32
w: uint32

gs-alpha

gs-alpha: uint64source

gs-bank

gs-bank: structuresource
Fields
pmode: gs-pmode
smode2: gs-smode2
dspfb1: gs-display-fb
display1: gs-display
dspfb2: gs-display-fb
display2: gs-display
extbuf: uint64
extdata: uint64
extwrite: uint64
bgcolor: gs-bgcolor
csr: gs-csr
imr: uint64
busdir: uint64

gs-bgcolor

gs-bgcolor: uint64source

gs-bitbltbuf

gs-bitbltbuf: uint64source

gs-clamp

gs-clamp: uint64source

gs-color-clamp

gs-color-clamp: uint64source

gs-csr

gs-csr: uint64source

gs-display

gs-display: uint64source

gs-display-fb

gs-display-fb: uint64source

gs-dthe

gs-dthe: uint64source

gs-fog

gs-fog: uint64source

gs-fogcol

gs-fogcol: uint64source

gs-frame

gs-frame: uint64source

gs-gif-tag

gs-gif-tag: structuresource
Fields
qword: uint128
tag: gif-tag64
regs: gif-tag-regs
dword: uint64
word: uint32

gs-miptbp

gs-miptbp: uint64source

gs-packed-gt

gs-packed-gt: structuresource

gs-packed-gt4

gs-packed-gt4: structuresource
Fields
data: gs-packed-gt

gs-packed-rgba

gs-packed-rgba: vector4wsource
Fields
data: int32
x: int32
y: int32
z: int32
w: int32
dword: uint64
quad: uint128
r: int32
g: int32
b: int32
a: int32

gs-packed-stq

gs-packed-stq: vectorsource
Fields
data: float
x: float
y: float
z: float
w: float
quad: uint128
tex-s: float
tex-t: float
tex-q: float

gs-packed-uv

gs-packed-uv: vectorsource
Fields
data: float
x: float
y: float
z: float
w: float
quad: uint128
u: int16
v: int16

gs-packed-xyzw

gs-packed-xyzw: vectorsource
Fields
data: float
x: float
y: float
z: float
w: float
quad: uint128
ix: int32
iy: int32
iz: int32
iw: int32

gs-pmode

gs-pmode: uint64source

gs-prim

gs-prim: uint64source

gs-prmode-cont

gs-prmode-cont: uint64source

gs-rgbaq

gs-rgbaq: uint64source

gs-scissor

gs-scissor: uint64source

gs-smode2

gs-smode2: uint64source

gs-st

gs-st: uint64source

gs-test

gs-test: uint64source

gs-tex0

gs-tex0: uint64source

gs-tex1

gs-tex1: uint64source

gs-texa

gs-texa: uint64source

gs-texclut

gs-texclut: uint64source

gs-trxdir

gs-trxdir: uint64source

gs-trxpos

gs-trxpos: uint64source

gs-trxreg

gs-trxreg: uint64source

gs-uv

gs-uv: uint64source

gs-xy-offset

gs-xy-offset: uint64source

gs-xyz

gs-xyz: uint64source

gs-xyzf

gs-xyzf: uint64source

gs-zbuf

gs-zbuf: uint64source

Functions


add-reg-gif-packet

add-reg-gif-packet(arg0: gif-packet, arg1: int, arg2: int) => nonesource

Add a register + value to the packet

close-gif-packet

close-gif-packet(arg0: gif-packet, arg1: int) => gif-packetsource

Finish adding registers.

draw-context-set-xy

draw-context-set-xy(arg0: draw-context, arg1: int, arg2: int) => nonesource

Set the origin of the draw context.

open-gif-packet

open-gif-packet(arg0: gif-packet) => gif-packetsource

Initialize an existing gif-packet for 0 registers

psm->string

psm->string(arg0: gs-psm) => stringsource

Get the name of a texture format.

psm-page-height

psm-page-height(arg0: gs-psm) => intsource

Convert texture format to some type of page height

psm-size

psm-size(arg0: gs-psm) => intsource

Convert texture format to some type of size.

Variables


*fog-color*

*fog-color*: rgbasource

GIF_REGS_ALL_AD

GIF_REGS_ALL_AD: unknownsource

video-h

source

Types


video-params

video-params: structuresource
Fields
set-video-mode: symbol
reset-video-mode: symbol
display-fbp: int32
relative-x-scale: float
display-dx: int32
display-dy: int32
display-sy: int32
relative-x-scale-reciprical: float
screen-pages-high: int32

Variables


*video-params*

*video-params*: video-paramssource

Functions


get-aspect-ratio

get-aspect-ratio() => symbolsource

get-progressive-scan

get-progressive-scan() => symbolsource

get-video-mode

get-video-mode() => symbolsource

set-aspect-ratio

set-aspect-ratio(aspect: symbol) => nonesource

Set video-params aspect-ratio related settings based on the mode provided.

set-graphics-mode

set-graphics-mode() => nonesource

TODO

set-progressive-scan

set-progressive-scan(val: symbol) => nonesource

Flip the progressive scan setting flag depending on the value provided

set-video-mode

set-video-mode(tv-format: symbol) => nonesource

Set related settings to the video mode in the settings, video-params and the [[video-mode]]
ntsc has a video-mode value of 0, where as pal has a value of 1

Will also set a bunch of common settings related to profiling and the camera to finalize the switch

Variables


*smode2*

*smode2*: intsource