all repos — mgba @ a3857c74720acff2a3e13dc7e2b92fb6fd73b57f

mGBA Game Boy Advance Emulator

Wii: Support mgba-perf
Vicki Pfau vi@endrift.com
Sat, 08 Feb 2020 17:47:32 -0800
commit

a3857c74720acff2a3e13dc7e2b92fb6fd73b57f

parent

4f327de2102f47e2641dca2cda94688058497866

3 files changed, 50 insertions(+), 1 deletions(-)

jump to
M src/platform/test/perf-main.csrc/platform/test/perf-main.c

@@ -22,6 +22,14 @@ #endif

#ifdef __SWITCH__ #include <switch.h> #endif +#ifdef GEKKO +#include <fat.h> +#include <gccore.h> +#ifdef FIXED_ROM_BUFFER +uint32_t* romBuffer; +size_t romBufferSize; +#endif +#endif #include <errno.h> #include <fcntl.h>

@@ -83,6 +91,29 @@ }

#elif defined(__SWITCH__) UNUSED(_mPerfShutdown); consoleInit(NULL); +#elif defined(GEKKO) + VIDEO_Init(); + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); + + GXRModeObj* vmode = VIDEO_GetPreferredMode(0); + void* xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode)); + console_init(xfb, 20, 20, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * VI_DISPLAY_PIX_SZ); + + VIDEO_Configure(vmode); + VIDEO_SetNextFramebuffer(xfb); + VIDEO_SetBlack(false); + VIDEO_Flush(); + VIDEO_WaitVSync(); + VIDEO_WaitVSync(); + fatInitDefault(); + +#ifdef FIXED_ROM_BUFFER + romBufferSize = 0x02000000; + romBuffer = SYS_GetArena2Lo(); + SYS_SetArena2Lo((void*)((intptr_t) romBuffer + romBufferSize)); +#endif #else signal(SIGINT, _mPerfShutdown); #endif

@@ -125,6 +156,8 @@ if (perfOpts.csv) {

puts("game_code,frames,duration,renderer"); #ifdef __SWITCH__ consoleUpdate(NULL); +#elif defined(GEKKO) + VIDEO_WaitVSync(); #endif } if (perfOpts.server) {

@@ -145,6 +178,11 @@ gfxExit();

acExit(); #elif defined(__SWITCH__) consoleExit(NULL); +#elif defined(GEKKO) + VIDEO_SetBlack(true); + VIDEO_Flush(); + VIDEO_WaitVSync(); + VIDEO_WaitVSync(); #endif return didFail;
M src/platform/wii/CMakeLists.txtsrc/platform/wii/CMakeLists.txt

@@ -11,6 +11,7 @@

file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/wii/wii-*.c) list(APPEND OS_LIB wiiuse bte fat ogc) set(OS_SRC ${OS_SRC} PARENT_SCOPE) +set(OS_LIB ${OS_LIB} PARENT_SCOPE) source_group("Wii-specific code" FILES ${OS_SRC}) set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE) set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)

@@ -38,6 +39,16 @@ DEPENDS ${BINARY_NAME}.elf)

add_custom_target(run ${WIILOAD} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol DEPENDS ${BINARY_NAME}.dol) + +if(BUILD_PERF) + add_custom_target(${BINARY_NAME}-perf.dol ALL + ${ELF2DOL} ../${BINARY_NAME}-perf ${BINARY_NAME}-perf.dol + DEPENDS ${BINARY_NAME}-perf) + + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}-perf.dol + DESTINATION . COMPONENT ${BINARY_NAME}-perf) +endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/meta.xml.in ${CMAKE_CURRENT_BINARY_DIR}/meta.xml)
M src/platform/wii/main.csrc/platform/wii/main.c

@@ -262,7 +262,7 @@ memset(audioBuffer, 0, sizeof(audioBuffer));

#ifdef FIXED_ROM_BUFFER romBufferSize = SIZE_CART0; romBuffer = SYS_GetArena2Lo(); - SYS_SetArena2Lo((void*)((intptr_t) romBuffer + SIZE_CART0)); + SYS_SetArena2Lo((void*)((intptr_t) romBuffer + romBufferSize)); #endif #if !defined(COLOR_16_BIT) && !defined(COLOR_5_6_5)