From 35aa8b7e802a762ed8284c805fc4a7e9bae320b4 Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 6 Jun 2024 23:02:58 +0200 Subject: [PATCH] coreinit: Add "SavedFrame" related functions --- include/coreinit/savedframe.h | 106 ++++++++++++++++++ .../test_compile_headers_list.h | 1 + 2 files changed, 107 insertions(+) create mode 100644 include/coreinit/savedframe.h diff --git a/include/coreinit/savedframe.h b/include/coreinit/savedframe.h new file mode 100644 index 000000000..bf5fa89f8 --- /dev/null +++ b/include/coreinit/savedframe.h @@ -0,0 +1,106 @@ +#pragma once +#include + +/** + * \defgroup coreinit_savedframe + * \ingroup coreinit + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum OSSavedFrameType +{ + OS_SAVED_FRAME_A = 0, + OS_SAVED_FRAME_B = 1, +} OSSavedFrameType; + +typedef enum OSSavedFrameScreen +{ + OS_SAVED_FRAME_SCREEN_TV = 2, + OS_SAVED_FRAME_SCREEN_DRC = 4, +} OSSavedFrameScreen; + +uint32_t +__OSClearSavedFrame(OSSavedFrameType type, + OSSavedFrameScreen screen); + +/** + * Gets the GX2Texture saved via \link __OSSetSavedFrame \endlink + * @param ptr_size must be <= 0x100 + */ +void +__OSGetSavedFrame(OSSavedFrameScreen screen, + void *outPtr, + uint32_t ptr_size); + +/** + * Gets the GX2Texture saved via \link __OSSetSavedFrame \endlink + * @param ptr_size must be <= 0x100 + */ +void +__OSGetSavedFrameA(OSSavedFrameScreen screen, + void *outPtr, + uint32_t ptr_size); + +/** + * Gets the GX2Texture saved via \link __OSSetSavedFrame \endlink + * @param ptr_size must be <= 0x100 + */ +void +__OSGetSavedFrameB(OSSavedFrameScreen screen, + void *outPtr, + uint32_t ptr_size); + +BOOL +__OSGetSavedFrameGammaA(OSSavedFrameScreen screen, + float *outGamma); + +BOOL +__OSGetSavedFrameGammaB(OSSavedFrameScreen screen, + float *outGamma); + +void * +__OSGetSavedFramePtr(OSSavedFrameType type, + OSSavedFrameScreen screen); + +void * +__OSGetSavedFramePtrForRead(OSSavedFrameScreen screen); + +void * +__OSGetSavedFramePtrForWrite(OSSavedFrameScreen screen); + +uint32_t +__OSGetSavedFrames(); + +uint32_t +__OSGetSavedFramesA(); + +uint32_t +__OSGetSavedFramesB(); + +void +__OSResetSavedFrame(OSSavedFrameScreen screen); + +/** + * + * @param data expected to be a GX2Texture + * @param size must be <= 0x100 + * @return 0 on succes, -1 on error + */ +int +__OSSetSavedFrame(OSSavedFrameScreen screen, + void *data, + uint32_t size); + +void +__OSSetSavedFrameGamma(float gamma, + OSSavedFrameScreen screen); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/tests/test_compile_headers_common/test_compile_headers_list.h b/tests/test_compile_headers_common/test_compile_headers_list.h index 559766080..6a15035eb 100644 --- a/tests/test_compile_headers_common/test_compile_headers_list.h +++ b/tests/test_compile_headers_common/test_compile_headers_list.h @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include