Wii: Support mgba-perf

This commit is contained in:
Vicki Pfau 2020-02-08 17:47:32 -08:00
parent 4f327de210
commit a3857c7472
3 changed files with 50 additions and 1 deletions

View File

@ -22,6 +22,14 @@
#ifdef __SWITCH__ #ifdef __SWITCH__
#include <switch.h> #include <switch.h>
#endif #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 <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -83,6 +91,29 @@ int main(int argc, char** argv) {
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
UNUSED(_mPerfShutdown); UNUSED(_mPerfShutdown);
consoleInit(NULL); 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 #else
signal(SIGINT, _mPerfShutdown); signal(SIGINT, _mPerfShutdown);
#endif #endif
@ -125,6 +156,8 @@ int main(int argc, char** argv) {
puts("game_code,frames,duration,renderer"); puts("game_code,frames,duration,renderer");
#ifdef __SWITCH__ #ifdef __SWITCH__
consoleUpdate(NULL); consoleUpdate(NULL);
#elif defined(GEKKO)
VIDEO_WaitVSync();
#endif #endif
} }
if (perfOpts.server) { if (perfOpts.server) {
@ -145,6 +178,11 @@ int main(int argc, char** argv) {
acExit(); acExit();
#elif defined(__SWITCH__) #elif defined(__SWITCH__)
consoleExit(NULL); consoleExit(NULL);
#elif defined(GEKKO)
VIDEO_SetBlack(true);
VIDEO_Flush();
VIDEO_WaitVSync();
VIDEO_WaitVSync();
#endif #endif
return didFail; return didFail;

View File

@ -11,6 +11,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/wii/wii-*.c) file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/wii/wii-*.c)
list(APPEND OS_LIB wiiuse bte fat ogc) list(APPEND OS_LIB wiiuse bte fat ogc)
set(OS_SRC ${OS_SRC} PARENT_SCOPE) set(OS_SRC ${OS_SRC} PARENT_SCOPE)
set(OS_LIB ${OS_LIB} PARENT_SCOPE)
source_group("Wii-specific code" FILES ${OS_SRC}) source_group("Wii-specific code" FILES ${OS_SRC})
set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE) set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE)
set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE) set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
@ -39,6 +40,16 @@ add_custom_target(${BINARY_NAME}.dol ALL
add_custom_target(run ${WIILOAD} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol add_custom_target(run ${WIILOAD} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.dol
DEPENDS ${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) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/meta.xml.in ${CMAKE_CURRENT_BINARY_DIR}/meta.xml)
install(TARGETS ${BINARY_NAME}.elf DESTINATION . COMPONENT ${BINARY_NAME}-dbg) install(TARGETS ${BINARY_NAME}.elf DESTINATION . COMPONENT ${BINARY_NAME}-dbg)

View File

@ -262,7 +262,7 @@ int main(int argc, char* argv[]) {
#ifdef FIXED_ROM_BUFFER #ifdef FIXED_ROM_BUFFER
romBufferSize = SIZE_CART0; romBufferSize = SIZE_CART0;
romBuffer = SYS_GetArena2Lo(); romBuffer = SYS_GetArena2Lo();
SYS_SetArena2Lo((void*)((intptr_t) romBuffer + SIZE_CART0)); SYS_SetArena2Lo((void*)((intptr_t) romBuffer + romBufferSize));
#endif #endif
#if !defined(COLOR_16_BIT) && !defined(COLOR_5_6_5) #if !defined(COLOR_16_BIT) && !defined(COLOR_5_6_5)