Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions LIB386/H/SVGA/VIDEO.H
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ void HandleEventsVideo(const void *event);
typedef void (*PrePresentFn)(U32 *frameBuffer, U32 pitch, U32 width, U32 height, const U8 *palette_rgb);
void SetPrePresentCallback(PrePresentFn fn);

/** Optional SCENE-level pre-present pass, called BEFORE the pre-present overlay
* (so it sits under the console/touch overlays). Same signature. Used by the
* experimental iso xBR brick compositor to overwrite brick pixels in the
* finished frame with an RGB-filtered layer. */
void SetScenePresentCallback(PrePresentFn fn);

/** Optional overlay rendered after the main pre-present callback. Used by the
* touch virtual gamepad overlay on Android so it draws on top of the console
* overlay. Same signature as PrePresentFn. */
Expand Down
11 changes: 9 additions & 2 deletions LIB386/SVGA/SDL.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ U32 TabOffPhysLine[ADELINE_MAX_Y_RES];
SDL_Palette *sdlPalette = NULL;
S32 screenLockCount = 0;
bool frameDirty = false;
static PrePresentFn s_scenePresent = NULL;
static PrePresentFn s_prePresent = NULL;
static PrePresentFn s_overlayPrePresent = NULL;
static PresentTimingFn s_presentBegin = NULL;
Expand Down Expand Up @@ -237,6 +238,10 @@ void CopyVideoArea(void *dst, const void *src, const U32 tabOffDst[],
}
}

void SetScenePresentCallback(PrePresentFn fn) {
s_scenePresent = fn;
}

void SetPrePresentCallback(PrePresentFn fn) {
s_prePresent = fn;
}
Expand Down Expand Up @@ -308,15 +313,17 @@ static void PresentFrame() {
}
}

if (s_prePresent || s_overlayPrePresent) {
/* Build the 256-entry RGB table once; both callbacks take the same. */
if (s_scenePresent || s_prePresent || s_overlayPrePresent) {
/* Build the 256-entry RGB table once; the callbacks take the same. */
static U8 paletteRgb[256 * 3];
for (int i = 0; i < 256; i++) {
U32 c = paletteLUT[i];
paletteRgb[i * 3 + 0] = (U8)(c >> 16);
paletteRgb[i * 3 + 1] = (U8)(c >> 8);
paletteRgb[i * 3 + 2] = (U8)(c);
}
if (s_scenePresent) /* scene composite first, under the overlays */
s_scenePresent((U32 *)stagingPixels, stagingPitch, ModeResX, ModeResY, paletteRgb);
if (s_prePresent)
s_prePresent((U32 *)stagingPixels, stagingPitch, ModeResX, ModeResY, paletteRgb);
if (s_overlayPrePresent)
Expand Down
7 changes: 7 additions & 0 deletions SOURCES/CONSOLE/CONSOLE_CMD.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ static void cmd_iso(int argc, const char *argv[]) {
} else if (argc >= 2 && !strcmp(argv[1], "reset")) {
SetIsoScale(ISO_SCALE_ONE);
changed = 1;
} else if (argc >= 3 && !strcmp(argv[1], "epx")) {
extern S32 BrickEpxOn; /* GRILLE.CPP: composed-background brick filter (2x) */
BrickEpxOn = (S32)strtol(argv[2], NULL, 0);
FirstTime = AFF_ALL_FLIP;
Console_Print("iso epx = %d (0 off, 1 EPX-blend, 2 xBR, 3 xBR SSAA; interior, zoom > 1)",
(int)BrickEpxOn);
return;
} else if (argc >= 2 && !strcmp(argv[1], "probe")) {
/* Compare the per-brick screen delta from the model projector
(LongProjectPointIso, world coords; 1 brick = SIZE_BRICK_XZ 512 / _Y 256)
Expand Down
Loading
Loading