From dcfb8d33ef45ada03f76d30b67e2759d312c64dc Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 22 Aug 2015 23:38:38 -0700 Subject: [PATCH] PSP2: Use raw2c instead of objcopy --- src/platform/psp2/CMakeLists.txt | 5 +++-- src/platform/psp2/CMakeToolchain.txt | 1 + src/platform/psp2/gui-font.c | 11 +++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/platform/psp2/CMakeLists.txt b/src/platform/psp2/CMakeLists.txt index 605cffd83..64f2b9201 100644 --- a/src/platform/psp2/CMakeLists.txt +++ b/src/platform/psp2/CMakeLists.txt @@ -1,10 +1,11 @@ file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/src/platform/psp2/*.c) +include_directories(${CMAKE_BINARY_DIR}) -execute_process(COMMAND ${DEVKITARM}/bin/arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm font.png ${CMAKE_BINARY_DIR}/font.o WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res) +execute_process(COMMAND ${RAW2C} ${CMAKE_SOURCE_DIR}/res/font.png) set(PLATFORM_LIBRARY -lvita2d -lSceCtrl_stub -lSceRtc_stub -lSceGxm_stub -lSceDisplay_stub -lSceAudio_stub -lpng -lz -lm_stub) -add_executable(${BINARY_NAME}.elf ${PLATFORM_SRC} ${GUI_SRC} ${CMAKE_BINARY_DIR}/font.o) +add_executable(${BINARY_NAME}.elf ${PLATFORM_SRC} ${GUI_SRC} ${CMAKE_BINARY_DIR}/font.c) target_link_libraries(${BINARY_NAME}.elf ${BINARY_NAME} ${PLATFORM_LIBRARY}) set_target_properties(${BINARY_NAME}.elf PROPERTIES OUTPUT_NAME ${BINARY_NAME}.elf) add_custom_command(TARGET ${BINARY_NAME}.elf POST_BUILD COMMAND ${FIXUP} -q -S ${BINARY_NAME}.elf ${BINARY_NAME}.velf MAIN_DEPENDENCY ${BINARY_NAME}.elf) diff --git a/src/platform/psp2/CMakeToolchain.txt b/src/platform/psp2/CMakeToolchain.txt index 66ed97823..2d6196ae4 100644 --- a/src/platform/psp2/CMakeToolchain.txt +++ b/src/platform/psp2/CMakeToolchain.txt @@ -45,6 +45,7 @@ set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared link flags") set(PKG_CONFIG_EXECUTABLE "/dev/null" CACHE INTERNAL "" FORCE) set(FIXUP ${toolchain_bin_dir}/psp2-fixup) +set(RAW2C ${DEVKITARM}/bin/raw2c) set(PSP2 ON) add_definitions(-DPSP2) diff --git a/src/platform/psp2/gui-font.c b/src/platform/psp2/gui-font.c index 6dd6619d1..7936a0e17 100644 --- a/src/platform/psp2/gui-font.c +++ b/src/platform/psp2/gui-font.c @@ -4,6 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "util/gui/font.h" +#include "font.h" #include @@ -13,19 +14,17 @@ #define CELL_HEIGHT 16 #define CELL_WIDTH 16 -extern const uint8_t _binary_font_png_start[]; - struct GUIFont { vita2d_texture* tex; }; struct GUIFont* GUIFontCreate(void) { - struct GUIFont* font = malloc(sizeof(struct GUIFont)); - if (!font) { + struct GUIFont* guiFont = malloc(sizeof(struct GUIFont)); + if (!guiFont) { return 0; } - font->tex = vita2d_load_PNG_buffer(_binary_font_png_start); - return font; + guiFont->tex = vita2d_load_PNG_buffer(font); + return guiFont; } void GUIFontDestroy(struct GUIFont* font) {