From 78bf9dac7d93c3eb4b6ecba794eccbcdc909023f Mon Sep 17 00:00:00 2001 From: Lephe Date: Sat, 1 May 2021 18:29:36 +0200 Subject: [PATCH] gray: expose pointers to the screen buffers --- include/gint/gray.h | 4 ++++ src/gray/engine.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/gint/gray.h b/include/gint/gray.h index 99dbdb0..bff4c0f 100644 --- a/include/gint/gray.h +++ b/include/gint/gray.h @@ -144,4 +144,8 @@ void dgray_getdelays(uint32_t *light, uint32_t *dark); These pointers can be used for custom rendering functions. */ void dgray_getvram(uint32_t **light, uint32_t **dark); +/* dgray_getscreen(): Get the current screen pointers + These pointers can be used to make screen captures. */ +void dgray_getscreen(uint32_t **light, uint32_t **dark); + #endif /* GINT_GRAY */ diff --git a/src/gray/engine.c b/src/gray/engine.c index 6809bb4..764105c 100644 --- a/src/gray/engine.c +++ b/src/gray/engine.c @@ -258,3 +258,12 @@ void dgray_getvram(uint32_t **light, uint32_t **dark) if(light) *light = vrams[base & 2]; if(dark) *dark = vrams[base | 1]; } + +/* dgray_getscreen(): Get the current screen pointers */ +void dgray_getscreen(uint32_t **light, uint32_t **dark) +{ + int base = st ^ 2; + + if(light) *light = vrams[base & 2]; + if(dark) *dark = vrams[base | 1]; +}