test automation clean up

less #ifdef
force mute audio
don't force vsync
This commit is contained in:
Flyinghead 2021-10-10 16:26:36 +02:00
parent c2caef4ad5
commit 19bd6d0bca
11 changed files with 5 additions and 46 deletions

View File

@ -613,10 +613,6 @@ std::string Cartridge::GetGameId() {
}
while (!game_id.empty() && game_id.back() == ' ')
game_id.pop_back();
if (RomSize < 0x138)
printf("GAME EEPROM ID: (ROM too small)\n");
else
printf("GAME EEPROM ID: %c%c%c%c\n", RomPtr[0x134], RomPtr[0x135], RomPtr[0x136], RomPtr[0x137]);
return game_id;
}
@ -927,10 +923,6 @@ std::string M2Cartridge::GetGameId()
game_id = std::string((char *)RomPtr + 0x800030, 0x20);
while (!game_id.empty() && game_id.back() == ' ')
game_id.pop_back();
if (RomSize < 0x800138)
printf("m2 GAME EEPROM ID: (ROM too small)\n");
else
printf("m2 GAME EEPROM ID: %c%c%c%c\n", RomPtr[0x800134], RomPtr[0x800135], RomPtr[0x800136], RomPtr[0x800137]);
}
return game_id;
}

View File

@ -18,6 +18,7 @@ int flycast_init(int argc, char* argv[])
#if defined(TEST_AUTOMATION)
setbuf(stdout, 0);
setbuf(stderr, 0);
settings.aica.muteAudio = true;
#endif
if (!_vmem_reserve())
{

View File

@ -44,14 +44,10 @@ bool DXContext::Init(bool keepCurrentWindow)
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.EnableAutoDepthStencil = FALSE; // No need for depth/stencil buffer for the backbuffer
#ifndef TEST_AUTOMATION
swapOnVSync = !settings.input.fastForwardMode && config::VSync;
d3dpp.PresentationInterval = swapOnVSync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
// TODO should be 0 in windowed mode
//d3dpp.FullScreen_RefreshRateInHz = swapOnVSync ? 60 : 0;
#else
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // Present without vsync, maximum unthrottled framerate
#endif
if (FAILED(pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &pDevice.get())))
return false;
@ -83,7 +79,6 @@ void DXContext::Present()
WARN_LOG(RENDERER, "Present failed %x", result);
else
{
#ifndef TEST_AUTOMATION
if (swapOnVSync != (!settings.input.fastForwardMode && config::VSync))
{
DEBUG_LOG(RENDERER, "Switch vsync %d", !swapOnVSync);
@ -101,7 +96,6 @@ void DXContext::Present()
rend_resize_renderer();
}
}
#endif
}
}

View File

@ -764,13 +764,11 @@ void VulkanContext::Present() noexcept
}
renderDone = false;
}
#ifndef TEST_AUTOMATION
if (swapOnVSync == (settings.input.fastForwardMode || !config::VSync))
{
swapOnVSync = (!settings.input.fastForwardMode && config::VSync);
resized = true;
}
#endif
if (resized)
try {
CreateSwapChain();

View File

@ -152,11 +152,7 @@ private:
u32 width = 0;
u32 height = 0;
bool resized = false;
#ifndef TEST_AUTOMATION
bool swapOnVSync = true;
#else
bool swapOnVSync = false;
#endif
vk::UniqueInstance instance;
vk::PhysicalDevice physicalDevice;

View File

@ -175,11 +175,7 @@ bool EGLGraphicsContext::Init()
#ifdef TARGET_PANDORA
fbdev = open("/dev/fb0", O_RDONLY);
#else
#ifndef TEST_AUTOMATION
swapOnVSync = config::VSync;
#else
swapOnVSync = false;
#endif
eglSwapInterval(display, (int)swapOnVSync);
#endif
@ -212,15 +208,12 @@ void EGLGraphicsContext::Term()
void EGLGraphicsContext::Swap()
{
#ifdef TEST_AUTOMATION
do_swap_automation();
#else
if (swapOnVSync == (settings.input.fastForwardMode || !config::VSync))
{
swapOnVSync = (!settings.input.fastForwardMode && config::VSync);
eglSwapInterval(display, (int)swapOnVSync);
}
#endif
eglSwapBuffers(display, surface);
}
#endif // USE_EGL

View File

@ -21,7 +21,11 @@
#pragma once
#include "types.h"
#ifdef TEST_AUTOMATION
void do_swap_automation();
#else
static inline void do_swap_automation() {}
#endif
class GLGraphicsContext
{

View File

@ -25,9 +25,7 @@ OSXGraphicsContext theGLContext;
void OSXGraphicsContext::Swap()
{
#ifdef TEST_AUTOMATION
do_swap_automation();
#endif
}
#endif

View File

@ -78,13 +78,8 @@ bool SDLGLGraphicsContext::Init()
INFO_LOG(RENDERER, "Created SDL Window and GL Context successfully");
SDL_GL_MakeCurrent(window, glcontext);
#ifndef TEST_AUTOMATION
// Swap at vsync
swapOnVSync = config::VSync;
#else
// Swap immediately
swapOnVSync = false;
#endif
swapInterval = 1;
int displayIndex = SDL_GetWindowDisplayIndex(window);
if (displayIndex < 0)
@ -117,15 +112,12 @@ bool SDLGLGraphicsContext::Init()
void SDLGLGraphicsContext::Swap()
{
#ifdef TEST_AUTOMATION
do_swap_automation();
#else
if (swapOnVSync == (settings.input.fastForwardMode || !config::VSync))
{
swapOnVSync = (!settings.input.fastForwardMode && config::VSync);
SDL_GL_SetSwapInterval(swapOnVSync ? swapInterval : 0);
}
#endif
SDL_GL_SwapWindow(window);
// Check if drawable has been resized

View File

@ -122,9 +122,7 @@ bool WGLGraphicsContext::Init()
void WGLGraphicsContext::Swap()
{
#ifdef TEST_AUTOMATION
do_swap_automation();
#endif
wglSwapLayerBuffers(ourWindowHandleToDeviceContext, WGL_SWAP_MAIN_PLANE);
}

View File

@ -83,11 +83,7 @@ bool XGLGraphicsContext::Init()
unsigned int tempu;
XGetGeometry(display, window, &win, &temp, &temp, (u32 *)&settings.display.width, (u32 *)&settings.display.height, &tempu, &tempu);
#ifndef TEST_AUTOMATION
swapOnVSync = config::VSync;
#else
swapOnVSync = false;
#endif
glXSwapIntervalMESA = (int (*)(unsigned))glXGetProcAddress((const GLubyte*)"glXSwapIntervalMESA");
if (glXSwapIntervalMESA != nullptr)
glXSwapIntervalMESA((unsigned)swapOnVSync);
@ -156,9 +152,7 @@ bool XGLGraphicsContext::ChooseVisual(Display* x11Display, XVisualInfo** visual,
void XGLGraphicsContext::Swap()
{
#ifdef TEST_AUTOMATION
do_swap_automation();
#else
if (swapOnVSync == (settings.input.fastForwardMode || !config::VSync))
{
swapOnVSync = (!settings.input.fastForwardMode && config::VSync);
@ -167,7 +161,6 @@ void XGLGraphicsContext::Swap()
else if (glXSwapIntervalEXT != nullptr)
glXSwapIntervalEXT(display, window, (int)swapOnVSync);
}
#endif
glXSwapBuffers(display, window);
Window win;