PSP2: Update for newer vitasdk

This commit is contained in:
Jeffrey Pfau 2015-09-21 00:01:24 -07:00
parent a58458b943
commit 1325da2958
3 changed files with 12 additions and 3 deletions

View File

@ -194,7 +194,11 @@ endif()
include(CheckFunctionExists)
check_function_exists(strdup HAVE_STRDUP)
check_function_exists(strndup HAVE_STRNDUP)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
if(NOT PSP2)
check_function_exists(localtime_r HAVE_LOCALTIME_R)
else()
set(HAVE_LOCALTIME_R OFF)
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
check_function_exists(snprintf_l HAVE_SNPRINTF_L)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

View File

@ -1,6 +1,7 @@
find_program(FIXUP vita-elf-create)
find_program(OBJCOPY ${cross_prefix}objcopy)
find_file(NIDDB db.json PATHS ${VITASDK})
find_file(EXTRADB extra.json PATHS ${VITASDK})
find_program(STRIP ${cross_prefix}strip)
file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/psp2/psp2-*.c)
@ -10,7 +11,7 @@ source_group("PS Vita-specific code" FILES ${OS_SRC})
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c)
set(VFS_SRC ${VFS_SRC} PARENT_SCOPE)
set(OS_LIB -lvita2d -lSceCtrl_stub -lSceRtc_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceMotion_stub -lScePower_stub -lSceTouch_stub -lpng -lz -l${M_LIBRARY})
set(OS_LIB -lvita2d -lSceCtrl_stub -lSceRtc_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lSceMotion_stub -lScePower_stub -lSceTouch_stub -lSceCommonDialog_stub -lpng -lz -l${M_LIBRARY})
set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm)
list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
@ -30,7 +31,7 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/backdrop.o
add_custom_target(${BINARY_NAME}.velf ALL
${STRIP} --strip-unneeded -go ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.elf
COMMAND ${FIXUP} ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.velf ${NIDDB}
COMMAND ${FIXUP} ${BINARY_NAME}-stripped.elf ${BINARY_NAME}.velf ${NIDDB} ${EXTRADB}
DEPENDS ${BINARY_NAME}.elf)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}.velf DESTINATION . COMPONENT ${BINARY_NAME}-psp2)

View File

@ -83,7 +83,11 @@ struct tm* localtime_r(const time_t* t, struct tm* date) {
return date;
#elif defined(PSP2)
SceRtcTime sceRtc;
uint64_t tick, localtick;
sceRtcSetTime_t(&sceRtc, *t);
sceRtcGetTick(&sceRtc, &tick);
sceRtcConvertUtcToLocalTime(&tick, &localtick);
sceRtcSetTick(&sceRtc, &localtick);
date->tm_year = sceRtc.year;
date->tm_mon = sceRtc.month;
date->tm_mday = sceRtc.day;