SDL: PSP: fix regression, GetTicks64 should return millisecs

From 37c664a13d8a83298df686a6ffcafb3984150cc4 Mon Sep 17 00:00:00 2001
From: rofl0r <[EMAIL REDACTED]>
Date: Sat, 23 Mar 2024 23:13:48 +0000
Subject: [PATCH] PSP: fix regression, GetTicks64 should return millisecs

introduced in 82b449611afc4129c562512a5463da0cd9937406
---
 src/timer/psp/SDL_systimer.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/timer/psp/SDL_systimer.c b/src/timer/psp/SDL_systimer.c
index 64ccc82f81787..1e84313624a88 100644
--- a/src/timer/psp/SDL_systimer.c
+++ b/src/timer/psp/SDL_systimer.c
@@ -32,24 +32,35 @@
 #include <pspthreadman.h>
 #include <psprtc.h>
 
+static Uint64 start_tick;
+
+static Uint64 PSP_Ticks(void)
+{
+    Uint64 ticks;
+    sceRtcGetCurrentTick(&ticks);
+    return ticks;
+}
+
 void SDL_TicksInit(void)
 {
+    if (start_tick == 0) {
+        start_tick = PSP_Ticks();
+    }
 }
 
 void SDL_TicksQuit(void)
 {
 }
 
+/* return ticks as milliseconds */
 Uint64 SDL_GetTicks64(void)
 {
-    Uint64 ticks;
-    sceRtcGetCurrentTick(&ticks);
-    return ticks;
+    return (PSP_Ticks() - start_tick) / 1000ULL;
 }
 
 Uint64 SDL_GetPerformanceCounter(void)
 {
-    return SDL_GetTicks64();
+    return PSP_Ticks();
 }
 
 Uint64 SDL_GetPerformanceFrequency(void)