00cc9309cb
de6e324bdseparate emu thread10d3daf86Roms List improvements95d202f37Let's make the rom list process on a separate thread so the emulator doesnt take ages to load.fc306967fWow the ROM Header was just completely busted. Game list view works nowbad1691eefuck this shit2b59e5f46game list in progressd26417b83remappable inputs in progressac4af8106inpute72abc240update readme430139dc9Qt6 frontend3080d4d45Fix this small bug too08cd13b85Cop0 unused functions do not actually pose a threat (as per manual). They don't do anything, so shall we.61bb4fb44make idle loop detection a little more specific with where the load goesb037de4c3SAZDFsdff12e81e73eneed to figure out why n64-systemtest loops indefinitely at some address that appears to be valid (i think it's me not invalidating the cache properly)204f0e13bidle skipping seems to work!cb8bb634asdkfjlasdf58e5c89c1Fix compilation issue on my machine (no idea)24fb2898eattempting more serious idle skipping214719577Place rsp.Step inside cached interpreter. Gains about 3 more fpsbb97dcc23mmmmm920b77d38wjkhasdfjhkasdf430ccdab4it's a start...4f42a673aCached interpreter plays Mario 64. Start looking into RSP as wellc9a030787idle skipping works!5fbda03cenew idea366637abaIdle skipping... maybe?609fa2fb0Cache instructions implemented but broken lmao. Commented out for nowe140a6d12- Stop using inheritance for CPU, instead use composition. - Introduce KAIZEN_JIT_ENABLED optional define instead of relying on __aarch64__ and the like. - More cache work68e613057prep cache impl811b4d809fix clang formatfda755f7didkd5024ebbfsmall MI refactor in preparation of (eventually) implementing the RDRAM interface properly694b45341Merge commit '206dcdedf195fb320913584180edb12c7731e396' as 'external/SDL'206dcdedfSquashed 'external/SDL/' content from commit 4d17b99d0a4d16e1cb4need to update sdl848b19920Fix compilation errordb61b5299Merge commit 'e94a94559f28e49678fbcf72199a5258137b0fe9' as 'external/imgui'e94a94559Squashed 'external/imgui/' content from commit 02e9b8cac52edb3757need to update imguic1a705e86Emulate weird JALR behaviour4b4c32f4bFix exception for "unusable COP1" in 4 instructions i missed accidentally (again)df5828142Bug putting 0s in the log everywheref8b580048Make isviewer a sink to file8241e9735Fix exception for "unusable COP1" in 4 instructions i missed accidentallyb29715f20small changesd9a620bc1make use of my new small utility library0d1aa938eAdd 'external/ircolib/' from commit 'ce3cd726c8df8388d554abf8bb55d55020eb4450'e64eb40b3Fuck git git-subtree-dir: external/ircolib git-subtree-split:de6e324bde
208 lines
6.4 KiB
C
208 lines
6.4 KiB
C
/**
|
|
* Timer test suite
|
|
*/
|
|
#include <SDL3/SDL.h>
|
|
#include <SDL3/SDL_test.h>
|
|
#include "testautomation_suites.h"
|
|
|
|
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
|
|
|
/* Flag indicating if the param should be checked */
|
|
static int g_paramCheck = 0;
|
|
|
|
/* Userdata value to check */
|
|
static int g_paramValue = 0;
|
|
|
|
/* Flag indicating that the callback was called */
|
|
static int g_timerCallbackCalled = 0;
|
|
|
|
#endif
|
|
|
|
/* Fixture */
|
|
|
|
static void SDLCALL timerSetUp(void **arg)
|
|
{
|
|
}
|
|
|
|
/* Test case functions */
|
|
|
|
/**
|
|
* Call to SDL_GetPerformanceCounter
|
|
*/
|
|
static int SDLCALL timer_getPerformanceCounter(void *arg)
|
|
{
|
|
Uint64 result;
|
|
|
|
result = SDL_GetPerformanceCounter();
|
|
SDLTest_AssertPass("Call to SDL_GetPerformanceCounter()");
|
|
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result);
|
|
|
|
return TEST_COMPLETED;
|
|
}
|
|
|
|
/**
|
|
* Call to SDL_GetPerformanceFrequency
|
|
*/
|
|
static int SDLCALL timer_getPerformanceFrequency(void *arg)
|
|
{
|
|
Uint64 result;
|
|
|
|
result = SDL_GetPerformanceFrequency();
|
|
SDLTest_AssertPass("Call to SDL_GetPerformanceFrequency()");
|
|
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result);
|
|
|
|
return TEST_COMPLETED;
|
|
}
|
|
|
|
/**
|
|
* Call to SDL_Delay and SDL_GetTicks
|
|
*/
|
|
static int SDLCALL timer_delayAndGetTicks(void *arg)
|
|
{
|
|
const int testDelay = 100;
|
|
const int marginOfError = 25;
|
|
Uint64 result;
|
|
Uint64 result2;
|
|
Sint64 difference;
|
|
|
|
/* Zero delay */
|
|
SDL_Delay(0);
|
|
SDLTest_AssertPass("Call to SDL_Delay(0)");
|
|
|
|
/* Non-zero delay */
|
|
SDL_Delay(1);
|
|
SDLTest_AssertPass("Call to SDL_Delay(1)");
|
|
|
|
SDL_Delay(SDLTest_RandomIntegerInRange(5, 15));
|
|
SDLTest_AssertPass("Call to SDL_Delay()");
|
|
|
|
/* Get ticks count - should be non-zero by now */
|
|
result = SDL_GetTicks();
|
|
SDLTest_AssertPass("Call to SDL_GetTicks()");
|
|
SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result);
|
|
|
|
/* Delay a bit longer and measure ticks and verify difference */
|
|
SDL_Delay(testDelay);
|
|
SDLTest_AssertPass("Call to SDL_Delay(%d)", testDelay);
|
|
result2 = SDL_GetTicks();
|
|
SDLTest_AssertPass("Call to SDL_GetTicks()");
|
|
SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result2);
|
|
difference = result2 - result;
|
|
SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %" SDL_PRIu64, testDelay - marginOfError, difference);
|
|
#if 0
|
|
/* Disabled because this might fail on non-interactive systems. Moved to testtimer. */
|
|
SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %" SDL_PRIu64, testDelay + marginOfError, difference);
|
|
#endif
|
|
|
|
return TEST_COMPLETED;
|
|
}
|
|
|
|
#ifndef SDL_PLATFORM_EMSCRIPTEN
|
|
|
|
/* Test callback */
|
|
static Uint32 SDLCALL timerTestCallback(void *param, SDL_TimerID timerID, Uint32 interval)
|
|
{
|
|
g_timerCallbackCalled = 1;
|
|
|
|
if (g_paramCheck != 0) {
|
|
SDLTest_AssertCheck(param != NULL, "Check param pointer, expected: non-NULL, got: %s", (param != NULL) ? "non-NULL" : "NULL");
|
|
if (param != NULL) {
|
|
SDLTest_AssertCheck(*(int *)param == g_paramValue, "Check param value, expected: %i, got: %i", g_paramValue, *(int *)param);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif
|
|
|
|
/**
|
|
* Call to SDL_AddTimer and SDL_RemoveTimer
|
|
*/
|
|
static int SDLCALL timer_addRemoveTimer(void *arg)
|
|
{
|
|
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
|
SDLTest_Log("Timer callbacks on Emscripten require a main loop to handle events");
|
|
return TEST_SKIPPED;
|
|
#else
|
|
SDL_TimerID id;
|
|
int result;
|
|
int param;
|
|
|
|
/* Reset state */
|
|
g_paramCheck = 0;
|
|
g_timerCallbackCalled = 0;
|
|
|
|
/* Set timer with a long delay */
|
|
id = SDL_AddTimer(10000, timerTestCallback, NULL);
|
|
SDLTest_AssertPass("Call to SDL_AddTimer(10000,...)");
|
|
SDLTest_AssertCheck(id > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, id);
|
|
|
|
/* Remove timer again and check that callback was not called */
|
|
result = SDL_RemoveTimer(id);
|
|
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
|
SDLTest_AssertCheck(result == true, "Check result value, expected: true, got: %i", result);
|
|
SDLTest_AssertCheck(g_timerCallbackCalled == 0, "Check callback WAS NOT called, expected: 0, got: %i", g_timerCallbackCalled);
|
|
|
|
/* Try to remove timer again (should be a NOOP) */
|
|
result = SDL_RemoveTimer(id);
|
|
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
|
SDLTest_AssertCheck(result == false, "Check result value, expected: false, got: %i", result);
|
|
|
|
/* Reset state */
|
|
param = SDLTest_RandomIntegerInRange(-1024, 1024);
|
|
g_paramCheck = 1;
|
|
g_paramValue = param;
|
|
g_timerCallbackCalled = 0;
|
|
|
|
/* Set timer with a short delay */
|
|
id = SDL_AddTimer(10, timerTestCallback, (void *)¶m);
|
|
SDLTest_AssertPass("Call to SDL_AddTimer(10, param)");
|
|
SDLTest_AssertCheck(id > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, id);
|
|
|
|
/* Wait to let timer trigger callback */
|
|
SDL_Delay(100);
|
|
SDLTest_AssertPass("Call to SDL_Delay(100)");
|
|
|
|
/* Remove timer again and check that callback was called */
|
|
result = SDL_RemoveTimer(id);
|
|
SDLTest_AssertPass("Call to SDL_RemoveTimer()");
|
|
SDLTest_AssertCheck(result == false, "Check result value, expected: false, got: %i", result);
|
|
SDLTest_AssertCheck(g_timerCallbackCalled == 1, "Check callback WAS called, expected: 1, got: %i", g_timerCallbackCalled);
|
|
|
|
return TEST_COMPLETED;
|
|
#endif
|
|
}
|
|
|
|
/* ================= Test References ================== */
|
|
|
|
/* Timer test cases */
|
|
static const SDLTest_TestCaseReference timerTest1 = {
|
|
timer_getPerformanceCounter, "timer_getPerformanceCounter", "Call to SDL_GetPerformanceCounter", TEST_ENABLED
|
|
};
|
|
|
|
static const SDLTest_TestCaseReference timerTest2 = {
|
|
timer_getPerformanceFrequency, "timer_getPerformanceFrequency", "Call to SDL_GetPerformanceFrequency", TEST_ENABLED
|
|
};
|
|
|
|
static const SDLTest_TestCaseReference timerTest3 = {
|
|
timer_delayAndGetTicks, "timer_delayAndGetTicks", "Call to SDL_Delay and SDL_GetTicks", TEST_ENABLED
|
|
};
|
|
|
|
static const SDLTest_TestCaseReference timerTest4 = {
|
|
timer_addRemoveTimer, "timer_addRemoveTimer", "Call to SDL_AddTimer and SDL_RemoveTimer", TEST_ENABLED
|
|
};
|
|
|
|
/* Sequence of Timer test cases */
|
|
static const SDLTest_TestCaseReference *timerTests[] = {
|
|
&timerTest1, &timerTest2, &timerTest3, &timerTest4, NULL
|
|
};
|
|
|
|
/* Timer test suite (global) */
|
|
SDLTest_TestSuiteReference timerTestSuite = {
|
|
"Timer",
|
|
timerSetUp,
|
|
timerTests,
|
|
NULL
|
|
};
|