102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
com_directdrawsurface7.c File Reference
#include "graphics_com_private.h"
#include "graphics_private.h"
#include <dttr_log.h>
#include <khash.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <xxhash.h>

Go to the source code of this file.

Data Structures

struct  surface_texture_cache_seed

Functions

static khash_t (dttr_surface_texture_cache)
static bool surface_bgra_upload_size (uint32_t width, uint32_t height, size_t *out_size)
HRESULT dttr_graphics_com_validate_directdrawsurface7 (uint32_t width, uint32_t height, uint32_t bpp, uint32_t *out_pitch, size_t *out_pixel_size)
static HRESULT blit_rect_from_optional (const RECT *rect, uint32_t default_w, uint32_t default_h, blit_rect *out)
static bool blit_rect_clip_to_surface (blit_rect *rect, uint32_t surface_w, uint32_t surface_h)
void dttr_graphics_surface_texture_cache_reset ()
static bool surface_texture_cache_ensure_initialized ()
static void surface_texture_cache_insert_locked (uint64_t key, DTTR_Texture tex)
static void surface_texture_cache_remove_locked (uint64_t key, DTTR_Texture tex)
static DTTR_Texture surface_texture_cache_lookup_locked (uint64_t key)
static uint64_t surface_texture_cache_key (const DTTR_Graphics_COM_DirectDrawSurface7 *self, uint32_t width, uint32_t height, uint64_t source_hash)
static void surface_fill_pixelformat (const DTTR_Graphics_COM_DirectDrawSurface7 *self, DDPIXELFORMAT *pf)
static void surface_convert_argb4444_to_bgra8888 (const uint16_t *restrict src, uint32_t *restrict dst, uint32_t w, uint32_t h, uint32_t src_pitch)
 Converts ARGB4444 surface pixels to BGRA8888 pixels.
static void surface_convert_rgb565_to_bgra8888 (const uint16_t *restrict src, uint32_t *restrict dst, uint32_t w, uint32_t h, uint32_t src_pitch, bool has_colorkey, uint16_t colorkey)
 Converts RGB565 pixels to BGRA8888 and applies black/colorkey transparency.
static uint32_t * surface_ensure_convert_buffer (DTTR_Graphics_COM_DirectDrawSurface7 *self, size_t size)
static uint64_t surface_hash_source_pixels (const DTTR_Graphics_COM_DirectDrawSurface7 *self, uint32_t upload_w, uint32_t upload_h)
static void surface_queue_pending_upload_locked (DTTR_BackendState *state, int idx)
static uint32_t surface_texture_refcount (DTTR_Texture tex)
static bool surface_texture_retain (DTTR_Texture tex)
static DTTR_Texture surface_texture_create_or_retain (int width, int height, const void *pixels, uint64_t cache_key)
 Creates or reuses a staged GPU texture handle for a CPU pixel buffer.
static void surface_texture_release (DTTR_Texture tex)
 Releases one staged texture reference and destroys GPU resources at zero refs.
static bool surface_texture_update_unique (DTTR_Texture tex, int width, int height, const void *pixels, uint64_t cache_key)
static void surface_present ()
 Ends and presents the current frame when a frame is active.
static void surface_upload_texture (DTTR_Graphics_COM_DirectDrawSurface7 *self)
 Uploads dirty surface pixels to the staged texture cache.
static HRESULT ddrawsurface7_queryinterface (DTTR_Graphics_COM_DirectDrawSurface7 *self, void *riid, void **ppv)
static ULONG ddrawsurface7_addref (DTTR_Graphics_COM_DirectDrawSurface7 *self)
static ULONG ddrawsurface7_release (DTTR_Graphics_COM_DirectDrawSurface7 *self)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_addattachedsurface, DTTR_Graphics_COM_DirectDrawSurface7 *self, void *surf) DTTR_COM_NOOP_HRESULT(ddrawsurface7_addoverlaydirtyrect
DTTR_Graphics_COM_DirectDrawSurface7 void *static rect HRESULT ddrawsurface7_blt (DTTR_Graphics_COM_DirectDrawSurface7 *self, void *dstRect, void *srcSurf, void *srcRect, DWORD flags, void *bltFx)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_bltbatch, DTTR_Graphics_COM_DirectDrawSurface7 *self, void *batch, DWORD count, DWORD flags) DTTR_COM_NOOP_HRESULT(ddrawsurface7_bltfast
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_COM_NOOP_HRESULT (ddrawsurface7_deleteattachedsurface, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD flags, void *surf) DTTR_COM_NOOP_HRESULT(ddrawsurface7_enumattachedsurfaces
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void *cb DTTR_COM_NOOP_HRESULT (ddrawsurface7_enumoverlayzorders, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD flags, void *ctx, void *cb) static HRESULT ddrawsurface7_flip(DTTR_Graphics_COM_DirectDrawSurface7 *self
static HRESULT ddrawsurface7_getattachedsurface (DTTR_Graphics_COM_DirectDrawSurface7 *self, void *caps, void **surf)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_getbltstatus, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD flags) DTTR_COM_STUB_MEMSET(ddrawsurface7_getcaps
DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_COM_STUB_SET (ddrawsurface7_getclipper, void *, NULL, DTTR_Graphics_COM_DirectDrawSurface7 *self) static HRESULT ddrawsurface7_getcolorkey(DTTR_Graphics_COM_DirectDrawSurface7 *self
 DTTR_COM_STUB_SET (ddrawsurface7_getdc, HDC, NULL, DTTR_Graphics_COM_DirectDrawSurface7 *self) DTTR_COM_NOOP_HRESULT(ddrawsurface7_getflipstatus
DTTR_Graphics_COM_DirectDrawSurface7 DWORD static flags HRESULT ddrawsurface7_getoverlayposition (DTTR_Graphics_COM_DirectDrawSurface7 *self, LONG *x, LONG *y)
 DTTR_COM_STUB_SET (ddrawsurface7_getpalette, void *, NULL, DTTR_Graphics_COM_DirectDrawSurface7 *self) static HRESULT ddrawsurface7_getpixelformat(DTTR_Graphics_COM_DirectDrawSurface7 *self
 surface_fill_pixelformat (self, pf)
static void surface_fill_desc (const DTTR_Graphics_COM_DirectDrawSurface7 *self, DDSURFACEDESC2 *d)
 Fills a caller-provided DDSURFACEDESC2 buffer from surface state.
static HRESULT ddrawsurface7_getsurfacedesc (DTTR_Graphics_COM_DirectDrawSurface7 *self, void *desc)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_initialize, DTTR_Graphics_COM_DirectDrawSurface7 *self, void *dd, void *desc) static HRESULT ddrawsurface7_lock(DTTR_Graphics_COM_DirectDrawSurface7 *self
 if (!desc)
 if (size==DTTR_SIZEOF_DDSURFACEDESC||size==DTTR_SIZEOF_DDSURFACEDESC2)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_releasedc, DTTR_Graphics_COM_DirectDrawSurface7 *self, HDC dc) DTTR_COM_NOOP_HRESULT(ddrawsurface7_setclipper
DTTR_Graphics_COM_DirectDrawSurface7 void *static clipper HRESULT ddrawsurface7_setcolorkey (DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD flags, void *colorKey)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_setoverlayposition, DTTR_Graphics_COM_DirectDrawSurface7 *self, LONG x, LONG y) DTTR_COM_NOOP_HRESULT(ddrawsurface7_setpalette
DTTR_Graphics_COM_DirectDrawSurface7 void *static palette HRESULT ddrawsurface7_unlock (DTTR_Graphics_COM_DirectDrawSurface7 *self, void *rect)
 DTTR_COM_NOOP_HRESULT (ddrawsurface7_updateoverlay, DTTR_Graphics_COM_DirectDrawSurface7 *self, void *srcRect, void *dstSurf, void *dstRect, DWORD flags, void *fx) DTTR_COM_NOOP_HRESULT(ddrawsurface7_updateoverlaydisplay
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_COM_NOOP_HRESULT (ddrawsurface7_updateoverlayzorder, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD flags, void *refSurf) DTTR_COM_STUB_SET(ddrawsurface7_getddinterface
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_COM_NOOP_HRESULT (ddrawsurface7_pagelock, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD flags) DTTR_COM_NOOP_HRESULT(ddrawsurface7_pageunlock
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_COM_NOOP_HRESULT (ddrawsurface7_setsurfacedesc, DTTR_Graphics_COM_DirectDrawSurface7 *self, void *desc, DWORD flags) DTTR_COM_NOOP_HRESULT(ddrawsurface7_setprivatedata
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void DWORD DWORD flags DTTR_COM_STUB_SET (ddrawsurface7_getprivatedata, DWORD, 0, DTTR_Graphics_COM_DirectDrawSurface7 *self, void *tag, void *data) DTTR_COM_NOOP_HRESULT(ddrawsurface7_freeprivatedata
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void DWORD DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void *tag DTTR_COM_STUB_SET (ddrawsurface7_getuniquenessvalue, DWORD, 1, DTTR_Graphics_COM_DirectDrawSurface7 *self) DTTR_COM_NOOP_HRESULT(ddrawsurface7_changeuniquenessvalue
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void DWORD DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void *tag DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_COM_NOOP_HRESULT (ddrawsurface7_setpriority, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD priority) DTTR_COM_STUB_SET(ddrawsurface7_getpriority
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void DWORD DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void *tag DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_COM_NOOP_HRESULT (ddrawsurface7_setlod, DTTR_Graphics_COM_DirectDrawSurface7 *self, DWORD lod) DTTR_COM_STUB_SET(ddrawsurface7_getlod
DTTR_Graphics_COM_DirectDrawSurface7dttr_graphics_com_create_directdrawsurface7 (uint32_t width, uint32_t height, uint32_t bpp, uint32_t r_mask, uint32_t g_mask, uint32_t b_mask, uint32_t a_mask)

Variables

 blit_rect
DTTR_Graphics_COM_DirectDrawSurface7self
DTTR_Graphics_COM_DirectDrawSurface7 DWORD x
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD y
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD voidsrcSurf
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void voidsrcRect
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 voidctx
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void *cb voidtarget
DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void *cb void DWORD flags
return S_OK
 DTTR_SIZEOF_DDSCAPS2
 void
DTTR_Graphics_COM_DirectDrawSurface7 *self DWORD voidcolorKey
voidfmt
voidrect
void voiddesc
void void DWORD HANDLE event
DDSURFACEDESC2 * d = (DDSURFACEDESC2 *)desc
const DWORD size = d->dwSize
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 voidtag
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void voiddata
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void DWORD DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void *tag DTTR_Graphics_COM_DirectDrawSurface7 *self DWORD
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void DWORD DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void *tag DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_Graphics_COM_DirectDrawSurface7 *static self DTTR_Graphics_COM_DirectDrawSurface7_VT vtbl

Function Documentation

◆ blit_rect_clip_to_surface()

bool blit_rect_clip_to_surface ( blit_rect * rect,
uint32_t surface_w,
uint32_t surface_h )
static

Definition at line 135 of file com_directdrawsurface7.c.

References blit_rect, and rect.

Referenced by ddrawsurface7_blt().

◆ blit_rect_from_optional()

HRESULT blit_rect_from_optional ( const RECT * rect,
uint32_t default_w,
uint32_t default_h,
blit_rect * out )
static

Definition at line 105 of file com_directdrawsurface7.c.

References blit_rect, rect, and S_OK.

Referenced by ddrawsurface7_blt().

◆ ddrawsurface7_addref()

ULONG ddrawsurface7_addref ( DTTR_Graphics_COM_DirectDrawSurface7 * self)
static

Definition at line 796 of file com_directdrawsurface7.c.

References self.

◆ ddrawsurface7_blt()

◆ ddrawsurface7_getattachedsurface()

HRESULT ddrawsurface7_getattachedsurface ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * caps,
void ** surf )
static

◆ ddrawsurface7_getoverlayposition()

DTTR_Graphics_COM_DirectDrawSurface7 DWORD static flags HRESULT ddrawsurface7_getoverlayposition ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
LONG * x,
LONG * y )
static

Definition at line 1104 of file com_directdrawsurface7.c.

References ddrawsurface7_getoverlayposition(), S_OK, self, x, and y.

Referenced by ddrawsurface7_getoverlayposition().

◆ ddrawsurface7_getsurfacedesc()

HRESULT ddrawsurface7_getsurfacedesc ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * desc )
static

◆ ddrawsurface7_queryinterface()

HRESULT ddrawsurface7_queryinterface ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * riid,
void ** ppv )
static

◆ ddrawsurface7_release()

ULONG ddrawsurface7_release ( DTTR_Graphics_COM_DirectDrawSurface7 * self)
static

Definition at line 800 of file com_directdrawsurface7.c.

References free, NULL, self, and surface_texture_release().

◆ ddrawsurface7_setcolorkey()

DTTR_Graphics_COM_DirectDrawSurface7 void *static clipper HRESULT ddrawsurface7_setcolorkey ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
DWORD flags,
void * colorKey )
static

◆ ddrawsurface7_unlock()

DTTR_Graphics_COM_DirectDrawSurface7 void *static palette HRESULT ddrawsurface7_unlock ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * rect )
static

Definition at line 1272 of file com_directdrawsurface7.c.

References ddrawsurface7_unlock(), rect, S_OK, self, and surface_upload_texture().

Referenced by ddrawsurface7_unlock().

◆ DTTR_COM_NOOP_HRESULT() [1/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_addattachedsurface ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * surf )

References self.

◆ DTTR_COM_NOOP_HRESULT() [2/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_bltbatch ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * batch,
DWORD count,
DWORD flags )

References count, DWORD, flags, and self.

◆ DTTR_COM_NOOP_HRESULT() [3/14]

DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_COM_NOOP_HRESULT ( ddrawsurface7_deleteattachedsurface ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
DWORD flags,
void * surf )

References DTTR_COM_NOOP_HRESULT, DWORD, flags, and self.

◆ DTTR_COM_NOOP_HRESULT() [4/14]

DTTR_Graphics_COM_DirectDrawSurface7 DWORD DWORD void void DWORD flags DTTR_Graphics_COM_DirectDrawSurface7 void void *cb DTTR_COM_NOOP_HRESULT ( ddrawsurface7_enumoverlayzorders ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
DWORD flags,
void * ctx,
void * cb )

References cb, ctx, DTTR_COM_NOOP_HRESULT, DWORD, flags, and self.

◆ DTTR_COM_NOOP_HRESULT() [5/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_getbltstatus ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
DWORD flags )

References DWORD, flags, and self.

◆ DTTR_COM_NOOP_HRESULT() [6/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_initialize ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * dd,
void * desc )

References desc, and self.

◆ DTTR_COM_NOOP_HRESULT() [7/14]

◆ DTTR_COM_NOOP_HRESULT() [8/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_releasedc ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
HDC dc )

References self.

◆ DTTR_COM_NOOP_HRESULT() [9/14]

◆ DTTR_COM_NOOP_HRESULT() [10/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_setoverlayposition ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
LONG x,
LONG y )

References self, x, and y.

◆ DTTR_COM_NOOP_HRESULT() [11/14]

◆ DTTR_COM_NOOP_HRESULT() [12/14]

◆ DTTR_COM_NOOP_HRESULT() [13/14]

DTTR_COM_NOOP_HRESULT ( ddrawsurface7_updateoverlay ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
void * srcRect,
void * dstSurf,
void * dstRect,
DWORD flags,
void * fx )

References DWORD, flags, self, and srcRect.

◆ DTTR_COM_NOOP_HRESULT() [14/14]

DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags DTTR_COM_NOOP_HRESULT ( ddrawsurface7_updateoverlayzorder ,
DTTR_Graphics_COM_DirectDrawSurface7 * self,
DWORD flags,
void * refSurf )

◆ DTTR_COM_STUB_SET() [1/5]

DTTR_Graphics_COM_DirectDrawSurface7 *self DTTR_COM_STUB_SET ( ddrawsurface7_getclipper ,
void * ,
NULL ,
DTTR_Graphics_COM_DirectDrawSurface7 * self )

References DTTR_COM_STUB_SET, DWORD, flags, NULL, and self.

◆ DTTR_COM_STUB_SET() [2/5]

DTTR_COM_STUB_SET ( ddrawsurface7_getdc ,
HDC ,
NULL ,
DTTR_Graphics_COM_DirectDrawSurface7 * self )

References DWORD, flags, NULL, and self.

◆ DTTR_COM_STUB_SET() [3/5]

DTTR_COM_STUB_SET ( ddrawsurface7_getpalette ,
void * ,
NULL ,
DTTR_Graphics_COM_DirectDrawSurface7 * self )

References NULL, and self.

◆ DTTR_COM_STUB_SET() [4/5]

◆ DTTR_COM_STUB_SET() [5/5]

◆ dttr_graphics_com_create_directdrawsurface7()

◆ dttr_graphics_com_validate_directdrawsurface7()

HRESULT dttr_graphics_com_validate_directdrawsurface7 ( uint32_t width,
uint32_t height,
uint32_t bpp,
uint32_t * out_pitch,
size_t * out_pixel_size )

◆ dttr_graphics_surface_texture_cache_reset()

void dttr_graphics_surface_texture_cache_reset ( )

Definition at line 158 of file com_directdrawsurface7.c.

References NULL.

Referenced by dttr_graphics_cleanup(), and init_common_state().

◆ if() [1/2]

if ( ! desc)

Definition at line 1201 of file com_directdrawsurface7.c.

References desc, and S_OK.

◆ if() [2/2]

◆ khash_t()

khash_t ( dttr_surface_texture_cache )
static

Definition at line 31 of file com_directdrawsurface7.c.

References h, w, x, and y.

◆ surface_bgra_upload_size()

bool surface_bgra_upload_size ( uint32_t width,
uint32_t height,
size_t * out_size )
static

◆ surface_convert_argb4444_to_bgra8888()

void surface_convert_argb4444_to_bgra8888 ( const uint16_t *restrict src,
uint32_t *restrict dst,
uint32_t w,
uint32_t h,
uint32_t src_pitch )
static

Converts ARGB4444 surface pixels to BGRA8888 pixels.

Definition at line 270 of file com_directdrawsurface7.c.

References dst, h, r, src, w, x, and y.

Referenced by surface_upload_texture().

◆ surface_convert_rgb565_to_bgra8888()

void surface_convert_rgb565_to_bgra8888 ( const uint16_t *restrict src,
uint32_t *restrict dst,
uint32_t w,
uint32_t h,
uint32_t src_pitch,
bool has_colorkey,
uint16_t colorkey )
static

Converts RGB565 pixels to BGRA8888 and applies black/colorkey transparency.

Definition at line 297 of file com_directdrawsurface7.c.

References dst, h, r, src, w, x, and y.

Referenced by surface_upload_texture().

◆ surface_ensure_convert_buffer()

uint32_t * surface_ensure_convert_buffer ( DTTR_Graphics_COM_DirectDrawSurface7 * self,
size_t size )
static

Definition at line 326 of file com_directdrawsurface7.c.

References NULL, self, and size.

Referenced by surface_upload_texture().

◆ surface_fill_desc()

void surface_fill_desc ( const DTTR_Graphics_COM_DirectDrawSurface7 * self,
DDSURFACEDESC2 * d )
static

Fills a caller-provided DDSURFACEDESC2 buffer from surface state.

Definition at line 1143 of file com_directdrawsurface7.c.

References d, self, and surface_fill_pixelformat().

Referenced by ddrawsurface7_getsurfacedesc(), and if().

◆ surface_fill_pixelformat() [1/2]

void surface_fill_pixelformat ( const DTTR_Graphics_COM_DirectDrawSurface7 * self,
DDPIXELFORMAT * pf )
static

Definition at line 254 of file com_directdrawsurface7.c.

References self.

Referenced by surface_fill_desc().

◆ surface_fill_pixelformat() [2/2]

surface_fill_pixelformat ( self ,
pf  )

References S_OK, and self.

◆ surface_hash_source_pixels()

uint64_t surface_hash_source_pixels ( const DTTR_Graphics_COM_DirectDrawSurface7 * self,
uint32_t upload_w,
uint32_t upload_h )
static

Definition at line 348 of file com_directdrawsurface7.c.

References self, and y.

Referenced by surface_upload_texture().

◆ surface_present()

void surface_present ( )
static

Ends and presents the current frame when a frame is active.

Definition at line 646 of file com_directdrawsurface7.c.

References dttr_backend, and dttr_graphics_end_frame().

◆ surface_queue_pending_upload_locked()

void surface_queue_pending_upload_locked ( DTTR_BackendState * state,
int idx )
static

Definition at line 377 of file com_directdrawsurface7.c.

References st, and state.

Referenced by surface_texture_create_or_retain(), and surface_texture_update_unique().

◆ surface_texture_cache_ensure_initialized()

bool surface_texture_cache_ensure_initialized ( )
static

Definition at line 167 of file com_directdrawsurface7.c.

References NULL.

Referenced by surface_texture_cache_insert_locked().

◆ surface_texture_cache_insert_locked()

void surface_texture_cache_insert_locked ( uint64_t key,
DTTR_Texture tex )
static

◆ surface_texture_cache_key()

uint64_t surface_texture_cache_key ( const DTTR_Graphics_COM_DirectDrawSurface7 * self,
uint32_t width,
uint32_t height,
uint64_t source_hash )
static

Definition at line 232 of file com_directdrawsurface7.c.

References self.

Referenced by surface_upload_texture().

◆ surface_texture_cache_lookup_locked()

DTTR_Texture surface_texture_cache_lookup_locked ( uint64_t key)
static

Definition at line 206 of file com_directdrawsurface7.c.

References dttr_backend, DTTR_INVALID_TEXTURE, and st.

Referenced by surface_texture_create_or_retain().

◆ surface_texture_cache_remove_locked()

void surface_texture_cache_remove_locked ( uint64_t key,
DTTR_Texture tex )
static

◆ surface_texture_create_or_retain()

DTTR_Texture surface_texture_create_or_retain ( int width,
int height,
const void * pixels,
uint64_t cache_key )
static

◆ surface_texture_refcount()

uint32_t surface_texture_refcount ( DTTR_Texture tex)
static

Definition at line 391 of file com_directdrawsurface7.c.

References dttr_backend, and state.

Referenced by surface_upload_texture().

◆ surface_texture_release()

void surface_texture_release ( DTTR_Texture tex)
static

Releases one staged texture reference and destroys GPU resources at zero refs.

Definition at line 521 of file com_directdrawsurface7.c.

References dttr_backend, DTTR_INVALID_TEXTURE, free, NULL, st, state, and surface_texture_cache_remove_locked().

Referenced by ddrawsurface7_blt(), ddrawsurface7_release(), and surface_upload_texture().

◆ surface_texture_retain()

bool surface_texture_retain ( DTTR_Texture tex)
static

Definition at line 410 of file com_directdrawsurface7.c.

References dttr_backend, st, and state.

Referenced by ddrawsurface7_blt().

◆ surface_texture_update_unique()

bool surface_texture_update_unique ( DTTR_Texture tex,
int width,
int height,
const void * pixels,
uint64_t cache_key )
static

Replaces pixel data and dimensions for an existing uniquely-owned staged texture handle.

Definition at line 571 of file com_directdrawsurface7.c.

References dttr_backend, NULL, size, st, state, surface_bgra_upload_size(), surface_queue_pending_upload_locked(), surface_texture_cache_insert_locked(), and surface_texture_cache_remove_locked().

Referenced by surface_upload_texture().

◆ surface_upload_texture()

Variable Documentation

◆ blit_rect

blit_rect

◆ colorKey

Initial value:
{
if (colorKey) {
DDCOLORKEY *ck = (DDCOLORKEY *)colorKey;
ck->dwColorSpaceLowValue = self->has_colorkey ? self->colorkey : 0;
ck->dwColorSpaceHighValue = ck->dwColorSpaceLowValue;
}
return S_OK
DTTR_Graphics_COM_Direct3DDevice7 * self
return S_OK
DTTR_Graphics_COM_DirectDrawSurface7 *self DWORD void * colorKey

Definition at line 1080 of file com_directdrawsurface7.c.

Referenced by ddrawsurface7_setcolorkey().

◆ ctx

◆ d

DDSURFACEDESC2* d = (DDSURFACEDESC2 *)desc

Definition at line 1205 of file com_directdrawsurface7.c.

◆ data

◆ desc

void void* desc

Definition at line 1190 of file com_directdrawsurface7.c.

◆ DTTR_SIZEOF_DDSCAPS2

DTTR_SIZEOF_DDSCAPS2

Definition at line 1065 of file com_directdrawsurface7.c.

◆ DWORD

◆ event

◆ flags

void void DWORD flags
Initial value:
{
static void surface_present()
Ends and presents the current frame when a frame is active.

Definition at line 1020 of file com_directdrawsurface7.c.

◆ fmt

void* fmt
Initial value:
{
if (!fmt) {
return S_OK;
}
DDPIXELFORMAT *pf = (DDPIXELFORMAT *)fmt

Definition at line 1129 of file com_directdrawsurface7.c.

Referenced by DTTR_Log(), DTTR_Log_Unchecked(), dttr_vlog_unchecked(), and errors_addf().

◆ NULL

Definition at line 1316 of file com_directdrawsurface7.c.

Referenced by acquire_upload_pool_slot(), aob_scan_with(), append_table_header_text(), begin_clear_pass(), begin_draw_pass_if_needed(), begin_frame(), browse_callback(), build_saves_dir(), child_iso_path(), choice_combo(), cleanup(), cleanup(), cleanup_sigscan_cache(), clear_sample_wave(), close_audio(), close_gamepad(), collect_and_upload_pending(), compile_shader(), compute_exe_hash(), config_choice_list(), config_format_field_string(), config_object_for_section(), CONFIG_PARSE_CHOICE_FN(), config_parse_float(), config_path_from_args(), config_schema_find(), confirm_discard_changes(), create_device(), create_dir_if_set(), create_fbo(), create_program(), create_render_textures(), create_shader(), d3d7_createvertexbuffer(), d3d_device7_clear_bound_texture(), d3d_device7_get_transform_state(), d3d_device7_set_transform_state(), d3ddevice7_gettransform(), d3ddevice7_multiplytransform(), ddraw7_createclipper(), ddraw7_createpalette(), ddraw7_createsurface(), ddrawsurface7_queryinterface(), ddrawsurface7_release(), decode_prologue(), default_load_entry(), destroy_device(), destroy_mod_context(), destroy_sample_audio_object(), destroy_stream_objects(), destroy_window(), dialog_parent_window(), drain_eof(), draw_centered_text(), draw_copyable_stack_trace(), draw_dump_text(), draw_mod_toggle_row(), draw_shortcut_debug_row(), draw_shortcut_debug_window(), draw_tabs(), draw_toolbar(), dttr_audio_cleanup(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_COM_STUB_SET(), DTTR_Compat_CreateProcess(), DTTR_Config_ChoiceGet(), DTTR_Config_Choices(), DTTR_Config_LastError(), DTTR_Config_Load(), DTTR_Config_Save(), DTTR_Config_SchemaGet(), DTTR_Core_HookAOB(), DTTR_Core_HookAttachFunction(), DTTR_Core_HookAttachPointer(), DTTR_Core_HookCleanupAllChecked(), DTTR_Core_HookFunction(), DTTR_Core_HookPatchBytes(), DTTR_Core_HookPointer(), dttr_core_patch_group_context(), DTTR_Core_PatchAOBRel32Jump(), DTTR_Core_PatchBytes(), DTTR_Core_PatchGroupCreate(), DTTR_Core_PatchGroupHookFunction(), DTTR_Core_PatchGroupHookPointer(), DTTR_Core_PatchGroupInstallTargets(), DTTR_Core_PatchGroupPatchBytes(), DTTR_Core_PatchGroupPatchRel32Jump(), DTTR_Core_PatchGroupRelease(), DTTR_Core_PatchRel32Jump(), DTTR_CrashDump_ClearSymbolProvider(), DTTR_CrashDump_FormatStackTrace(), DTTR_CrashDump_Write(), DTTR_Errors_ShowMessage(), dttr_game_data_find_data_segment(), dttr_game_data_resolve_existing_read_path(), dttr_game_data_resolve_media_path(), dttr_game_hooks_cleanup(), dttr_game_hooks_init(), dttr_graphics_cleanup(), dttr_graphics_com_create_directdrawsurface7(), dttr_graphics_com_validate_directdrawsurface7(), dttr_graphics_ensure_staged_texture(), dttr_graphics_hooks_cleanup(), dttr_graphics_hooks_init(), dttr_graphics_init(), dttr_graphics_opengl_init(), dttr_graphics_sdl3gpu_create_pipelines(), dttr_graphics_sdl3gpu_init(), dttr_graphics_sdl3gpu_resize_render_textures(), dttr_graphics_surface_texture_cache_reset(), dttr_hook_cleanup_title_resources_callback(), dttr_hook_directdraw_enumerate_ex_a_callback(), DTTR_Hook_WinMainCallback(), DTTR_ImGuiDialog_BeginRoot(), DTTR_ImGuiDialog_DrawHeader(), dttr_inputs_hook_dinput_poll_callback(), dttr_inputs_hook_get_async_key_state_callback(), dttr_inputs_hooks_init(), DTTR_ISO_Open(), DTTR_Loader_GameSubpathAt(), DTTR_Loader_InjectSidecar(), DTTR_LoaderUI_ChoiceFromID(), DTTR_LoaderUI_ShowError(), DTTR_Mods_GetWriteExceptionReportFn(), dttr_mods_loaded_name(), dttr_movies_hooks_init(), dttr_mss_ail_allocate_sample_handle(), dttr_mss_ail_open_stream(), dttr_mss_ail_waveOutOpen(), dttr_mss_core_destroy_mixer(), dttr_mss_sdl_release_hooks(), dttr_mss_wave_decode_f32(), dttr_mss_wave_free(), dttr_mss_wave_parse(), DTTR_Path_CurrentDir(), DTTR_Path_ModuleDir(), DTTR_Path_ModuleSibling(), DTTR_Path_ResolveRelativeTo(), DTTR_PCDOGS_Hook_DataPointer(), DTTR_PCDOGS_PatchGroup_HookDataPointer(), DTTR_PCDOGS_PatchGroup_Install(), DTTR_SDL_ShowSimpleMessageBox(), dttr_sidecar_write_exception_report(), DTTR_Sigscan_Bytes(), dttr_test_find_case(), dttr_test_join_path(), dttr_test_pe_cstr(), dttr_test_pe_for_each_fixture(), dttr_test_pe_load_fixture(), dttr_test_run_case(), DTTR_Util_GetActiveActor(), DTTR_Util_PkgVisit_AsCollisionShape(), DTTR_Util_PkgVisit_AsLevelRuntimeData(), DTTR_Util_PkgVisit_AsLoadedEntry(), DTTR_Util_PkgVisit_AsMaterialEntry(), DTTR_Util_PkgVisit_AsMeshNode(), DTTR_Util_PkgVisit_AsSceneNode(), DTTR_Util_PkgVisit_AsSpriteContext(), DTTR_Util_PkgVisit_AsTOCEntry(), DTTR_Util_PkgWalk(), DTTR_Util_SameActor(), end_frame(), end_frame(), end_render_pass_if_active(), ensure_pcdogs_dbghelp_module(), ensure_video_texture(), enter_dbghelp_lock(), file_open_with_mode(), file_url_for_parent_dir(), find_stream(), find_summary_dump(), free_sample_audio(), function_chain_append(), function_chain_push_head(), function_link_create(), function_link_detach(), function_link_next_target(), gamepad_button_row_choice(), get_basic_frag_blob(), get_basic_vert_blob(), get_exe_dir(), get_full_path(), get_hwnd(), get_loader_dir(), get_mod_info(), graphics_api_driver_name(), has_audio_driver(), hook_create(), hook_find_function_chain(), init_dialog_imgui(), init_event(), init_sidecar_context(), init_state_from_args(), initialize_pcdogs_runtime(), install_one_target(), install_pointer_hook(), khash_t(), khash_t(), kvec_t(), labeled_input_text(), labeled_path_picker_with_dialog(), link_stream(), load_pe_image(), load_sample_frames(), log_file_path_dialog_callback(), log_win32_failure(), main(), make_shadow_path(), make_visit(), mount_fixture_dir(), msaa_enabled(), native_choose_game_source(), normalize_path_for_compare(), open_codec(), open_log_file(), open_log_file_dialog(), open_movie(), open_pcdogs_dir_dialog(), open_pcdogs_iso_dialog(), optional_path(), parse_aob(), patch_group_detach_checked(), patch_group_hook_symbol_function(), patch_group_uninstall_from(), pcdogs_file_open_detour(), pcdogs_path_dialog_callback(), pe_rva_bytes(), preference_slot(), prepare_audio(), present_video_frame_bgra(), queue_audio_frame(), queue_video_frame(), replay_batch_records(), report_dialog_failure(), report_file_open_failure(), request_reset_defaults(), require_sample(), reset_replay_state(), reset_video_buffer(), resolve_config_path(), resolve_loader_dir(), resolve_modules_dir(), resolve_nt_path_and_cwd(), resolve_sdl_dll_path(), resolve_sidecar_dll_path(), resolve_toc(), run_browse_dialog(), safe_relative_rejects_absolute_and_traversal_paths(), scan_mod_file(), scan_mods(), set_dump_dir(), set_mods_dir_from_config_path(), should_disable_watchdog(), show_startup_error(), show_tooltip(), surface_ensure_convert_buffer(), surface_texture_cache_ensure_initialized(), surface_texture_create_or_retain(), surface_texture_release(), surface_texture_update_unique(), surface_upload_texture(), target_original_slot(), test_blueprint_functions_resolve_and_match_abi(), test_expected_mss32_imports_are_hooked(), test_expected_pcdogs_signatures_resolve(), test_function_hooks_chain_and_detach(), test_patch_group_target_failure_rolls_back_only_new_entries(), test_pcdogs_generated_function_patch_specs_name_current_hooks(), test_pcdogs_generated_title_resource_patch_specs_use_current_names(), test_pcdogs_unstable_patch_specs_match_stable_shape(), test_pointer_hook_detach_restores_original(), try_fix_permissions(), try_open_configured_gamepad(), try_open_read_path(), unhandled_exception_filter(), unlink_stream(), unload_mod(), upload_pending_textures_gl(), upload_texture_data(), write_remote_payload(), write_remote_shim_data(), and zydis_decoder32().

◆ rect

◆ S_OK

return S_OK

Definition at line 1025 of file com_directdrawsurface7.c.

◆ self

◆ size

◆ srcRect

◆ srcSurf

◆ tag

◆ target

◆ void

void

Definition at line 1066 of file com_directdrawsurface7.c.

◆ vtbl

◆ x

◆ y