From f715f492bf16fb6f6c3a9772a7d43331b20cb344 Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Thu, 14 Nov 2024 20:52:20 +0800 Subject: [PATCH 1/7] add other sceDisplay functions --- src/display/Makefile.am | 2 +- src/display/pspdisplay.h | 8 ++++++++ src/display/sceDisplay.S | 20 +++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/display/Makefile.am b/src/display/Makefile.am index 3388d27355..5430cf918e 100644 --- a/src/display/Makefile.am +++ b/src/display/Makefile.am @@ -10,7 +10,7 @@ CPPFLAGS = -I$(top_srcdir)/src/base -I$(top_srcdir)/src/kernel CFLAGS = @PSPSDK_CFLAGS@ CCASFLAGS = $(CFLAGS) -DISPLAY_OBJS = sceDisplay_0000.o sceDisplay_0001.o sceDisplay_0002.o sceDisplay_0003.o sceDisplay_0004.o sceDisplay_0005.o sceDisplay_0006.o sceDisplay_0007.o sceDisplay_0008.o sceDisplay_0009.o sceDisplay_0010.o sceDisplay_0011.o sceDisplay_0012.o sceDisplay_0013.o sceDisplay_0014.o sceDisplay_0015.o sceDisplay_0016.o sceDisplay_0017.o +DISPLAY_OBJS = sceDisplay_0000.o sceDisplay_0001.o sceDisplay_0002.o sceDisplay_0003.o sceDisplay_0004.o sceDisplay_0005.o sceDisplay_0006.o sceDisplay_0007.o sceDisplay_0008.o sceDisplay_0009.o sceDisplay_0010.o sceDisplay_0011.o sceDisplay_0012.o sceDisplay_0013.o sceDisplay_0014.o sceDisplay_0015.o sceDisplay_0016.o sceDisplay_0017.o sceDisplay_0018.o sceDisplay_0019.o sceDisplay_0020.o sceDisplay_0021.o sceDisplay_0022.o sceDisplay_0023.o DISPLAYDRIVER_OBJS = sceDisplay_driver_0000.o sceDisplay_driver_0001.o sceDisplay_driver_0002.o sceDisplay_driver_0003.o sceDisplay_driver_0004.o sceDisplay_driver_0005.o sceDisplay_driver_0006.o sceDisplay_driver_0007.o sceDisplay_driver_0008.o sceDisplay_driver_0009.o sceDisplay_driver_0010.o sceDisplay_driver_0011.o sceDisplay_driver_0012.o sceDisplay_driver_0013.o sceDisplay_driver_0014.o sceDisplay_driver_0015.o sceDisplay_driver_0016.o sceDisplay_driver_0017.o sceDisplay_driver_0018.o sceDisplay_driver_0019.o sceDisplay_driver_0020.o sceDisplay_driver_0021.o sceDisplay_driver_0022.o sceDisplay_driver_0023.o sceDisplay_driver_0024.o sceDisplay_driver_0025.o sceDisplay_driver_0026.o diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index c72ca31dd5..53aab6e3d9 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -146,6 +146,14 @@ int sceDisplayIsForeground(void); */ int sceDisplayIsVblank(void); +int sceDisplayGetBrightness(void); +int sceDisplayGetResumeMode(void); +int sceDisplayGetVblankRest(void); +int sceDisplayIsVsync(void); +int sceDisplayWaitVblankStartMulti(void); +int sceDisplayWaitVblankStartMultiCB(void); +int sceDisplayAdjustAccumulatedHcount(void); + #ifdef __cplusplus } #endif diff --git a/src/display/sceDisplay.S b/src/display/sceDisplay.S index 558a71933c..4ddbc41a60 100644 --- a/src/display/sceDisplay.S +++ b/src/display/sceDisplay.S @@ -30,7 +30,7 @@ IMPORT_FUNC "sceDisplay",0xB4F378FA,sceDisplayIsForeground #endif #ifdef F_sceDisplay_0009 - IMPORT_FUNC "sceDisplay",0x31C4BAA8,sceDisplay_31C4BAA8 + IMPORT_FUNC "sceDisplay",0x31C4BAA8,sceDisplayGetBrightness #endif #ifdef F_sceDisplay_0010 IMPORT_FUNC "sceDisplay",0x9C6EAAD7,sceDisplayGetVcount @@ -56,3 +56,21 @@ #ifdef F_sceDisplay_0017 IMPORT_FUNC "sceDisplay",0x210EAB3A,sceDisplayGetAccumulatedHcount #endif +#ifdef F_sceDisplay_0018 + IMPORT_FUNC "sceDisplay",0xBF79F646,sceDisplayGetResumeMode +#endif +#ifdef F_sceDisplay_0019 + IMPORT_FUNC "sceDisplay",0x69B53541,sceDisplayGetVblankRest +#endif +#ifdef F_sceDisplay_0020 + IMPORT_FUNC "sceDisplay",0x210EAB3A,sceDisplayIsVsync +#endif +#ifdef F_sceDisplay_0021 + IMPORT_FUNC "sceDisplay",0x21038913,sceDisplayWaitVblankStartMulti +#endif +#ifdef F_sceDisplay_0022 + IMPORT_FUNC "sceDisplay",0x77ED8B3A,sceDisplayWaitVblankStartMultiCB +#endif +#ifdef F_sceDisplay_0023 + IMPORT_FUNC "sceDisplay",0xA83EF139,sceDisplayAdjustAccumulatedHcount +#endif From 846f7979cc4e7de145f7fee50e9e7832a5be6ce8 Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Fri, 15 Nov 2024 16:20:52 +0800 Subject: [PATCH 2/7] add `sceDisplayGetBrightness` doc --- src/display/pspdisplay.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index 53aab6e3d9..2d9e3688e0 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -146,7 +146,16 @@ int sceDisplayIsForeground(void); */ int sceDisplayIsVblank(void); -int sceDisplayGetBrightness(void); +/** + * Get current display brightness + * + * @param level - Pointer to int to receive the current brightness level (0-100) + * @param unk1 - Pointer to int, receives unknown, it's 1 or 0 + * + * @return 0 on success + */ +int sceDisplayGetBrightness(int *level, int *unk1); + int sceDisplayGetResumeMode(void); int sceDisplayGetVblankRest(void); int sceDisplayIsVsync(void); From 39c9cdfc86e2acefbc7711d59634bf7db8aa5ef2 Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Fri, 15 Nov 2024 17:27:40 +0800 Subject: [PATCH 3/7] add `sceDisplayAdjustAccumulatedHcount` doc --- src/display/pspdisplay.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index 2d9e3688e0..d449b1a4ce 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -161,7 +161,15 @@ int sceDisplayGetVblankRest(void); int sceDisplayIsVsync(void); int sceDisplayWaitVblankStartMulti(void); int sceDisplayWaitVblankStartMultiCB(void); -int sceDisplayAdjustAccumulatedHcount(void); + +/** + * Adjust the accumulated HSYNC count + * + * @param hcount - Set accumulated HSYNC count + * + * @return 0 on success + */ +int sceDisplayAdjustAccumulatedHcount(int hcount); #ifdef __cplusplus } From f918d1a3edfccf098ce7b3045c75910218fe9b1c Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Fri, 15 Nov 2024 18:08:44 +0800 Subject: [PATCH 4/7] add `sceDisplayWaitVblankStartMulti`/`CB` docs --- src/display/pspdisplay.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index d449b1a4ce..cd651d6281 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -159,8 +159,24 @@ int sceDisplayGetBrightness(int *level, int *unk1); int sceDisplayGetResumeMode(void); int sceDisplayGetVblankRest(void); int sceDisplayIsVsync(void); -int sceDisplayWaitVblankStartMulti(void); -int sceDisplayWaitVblankStartMultiCB(void); + +/** + * Wait for vertical blank start after specified number of vertical periods + * + * @param vblank_count - Number of vertical periods before waiting for vertical blank start + * + * @return 0 on success + */ +int sceDisplayWaitVblankStartMulti(unsigned int vblank_count); + +/** + * Wait for vertical blank start with callback after specified number of vertical periods + * + * @param vblank_count - Number of vertical periods before waiting for vertical blank start + * + * @return 0 on success + */ +int sceDisplayWaitVblankStartMultiCB(unsigned int vblank_count); /** * Adjust the accumulated HSYNC count From 8cdb8dd54605d2f1b5e3f97dbc1d8cb0aee241ee Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Fri, 15 Nov 2024 18:33:57 +0800 Subject: [PATCH 5/7] add `sceDisplayIsVsync` doc --- src/display/pspdisplay.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index cd651d6281..e421ea9c0e 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -158,6 +158,10 @@ int sceDisplayGetBrightness(int *level, int *unk1); int sceDisplayGetResumeMode(void); int sceDisplayGetVblankRest(void); + +/** + * Test whether VSYNC is active + */ int sceDisplayIsVsync(void); /** From 3a35cb4ae0b17ff050152f134fc1f12cac66e26f Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Fri, 15 Nov 2024 22:23:33 +0800 Subject: [PATCH 6/7] add `sceDisplayGetVblankRest` doc --- src/display/pspdisplay.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index e421ea9c0e..0197ced841 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -157,6 +157,16 @@ int sceDisplayIsVblank(void); int sceDisplayGetBrightness(int *level, int *unk1); int sceDisplayGetResumeMode(void); + +/** + * Get the time remaining until the next vertical blank + * + * @note start with sceDisplayWaitVblankStart() to take effect + * + * @return time remaining(in microsecond? or millisecond?) + * + * @return < 0 on error + */ int sceDisplayGetVblankRest(void); /** From 17d8b80ca1fa3cbee6f3eafd64d3157fdcfb6bac Mon Sep 17 00:00:00 2001 From: Diamond Rivero Date: Sat, 16 Nov 2024 09:48:21 +0800 Subject: [PATCH 7/7] add `sceDisplayGetResumeMode` doc --- src/display/pspdisplay.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/display/pspdisplay.h b/src/display/pspdisplay.h index 0197ced841..1b16a1ffc5 100644 --- a/src/display/pspdisplay.h +++ b/src/display/pspdisplay.h @@ -156,7 +156,16 @@ int sceDisplayIsVblank(void); */ int sceDisplayGetBrightness(int *level, int *unk1); -int sceDisplayGetResumeMode(void); +/** + * Get resume mode + * + * @warning This function can crash your app or worst(unexpected forced turn off your PSP) + * + * @param resume_mode - Pointer to int to receive the current resume mode + * + * @return ??? + */ +int sceDisplayGetResumeMode(int *resume_mode); /** * Get the time remaining until the next vertical blank