Skip to content

Commit

Permalink
vita: updates and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scribam committed Oct 9, 2023
1 parent 13e55d9 commit 48857d8
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 23 deletions.
46 changes: 26 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,17 @@ if(VITA)
set(USE_GLES2 ON)
enable_language(ASM)

add_executable(${PROJECT_NAME} core/emulator.cpp)
target_compile_definitions(${PROJECT_NAME} PRIVATE EGL_NO_PLATFORM_SPECIFIC_TYPES)
# target_compile_definitions(${PROJECT_NAME} PRIVATE TARGET_NO_EXCEPTIONS)
target_compile_definitions(${PROJECT_NAME} PRIVATE VITA _GNU_SOURCE)
target_compile_definitions(${PROJECT_NAME} PRIVATE GLES)

# For proper fseek/ftell definition in external dependency "libchdr", doesn't impact anything else:
target_compile_definitions(${PROJECT_NAME} PRIVATE __PS3__)
if(LIBRETRO)
add_library(${PROJECT_NAME} STATIC core/emulator.cpp)
target_compile_definitions(${PROJECT_NAME} PRIVATE LIBRETRO VITA)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "flycast_libretro_vita")
else()
add_executable(${PROJECT_NAME} core/emulator.cpp)
target_compile_definitions(${PROJECT_NAME} PRIVATE EGL_NO_PLATFORM_SPECIFIC_TYPES)
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE _GNU_SOURCE)
target_compile_definitions(${PROJECT_NAME} PRIVATE GLES)
elseif(NINTENDO_SWITCH)
set(USE_VULKAN OFF)
enable_language(ASM)
Expand Down Expand Up @@ -638,7 +640,7 @@ target_sources(${PROJECT_NAME} PRIVATE
core/deps/chdpsr/cdipsr.h)

add_subdirectory(core/deps/nowide EXCLUDE_FROM_ALL)
target_compile_definitions(nowide PRIVATE $<$<BOOL:${NINTENDO_SWITCH}>:_DEFAULT_SOURCE>)
target_compile_definitions(nowide PRIVATE $<$<BOOL:${NINTENDO_SWITCH}>:_DEFAULT_SOURCE> $<$<BOOL:${VITA}>:_GNU_SOURCE>)
target_link_libraries(${PROJECT_NAME} PRIVATE nowide::nowide)

if(NOT MINIUPNP_FOUND)
Expand All @@ -659,7 +661,7 @@ if(NOT MINIUPNP_FOUND)
endif()
endif()

if(NOT LIBZIP_FOUND OR NINTENDO_SWITCH OR VITA)
if(NOT LIBZIP_FOUND OR NINTENDO_SWITCH)
option(ENABLE_COMMONCRYPTO "Enable use of CommonCrypto" OFF)
option(ENABLE_GNUTLS "Enable use of GnuTLS" OFF)
option(ENABLE_MBEDTLS "Enable use of mbed TLS" OFF)
Expand Down Expand Up @@ -1867,16 +1869,20 @@ if(NINTENDO_SWITCH)
endif()

if(VITA)
vita_create_self(eboot.bin ${PROJECT_NAME} UNSAFE STRIPPED NOASLR)
vita_create_vpk(${VITA_VPKNAME}.vpk ${VITA_TITLEID} eboot.bin
VERSION ${VITA_VERSION}
NAME ${VITA_APP_NAME}
FILE ${CMAKE_SOURCE_DIR}/shell/vita/icon0.png sce_sys/icon0.png
${CMAKE_SOURCE_DIR}/shell/vita/startup.png sce_sys/livearea/contents/startup.png
${CMAKE_SOURCE_DIR}/shell/vita/bg.png sce_sys/livearea/contents/bg.png
${CMAKE_SOURCE_DIR}/shell/vita/template.xml sce_sys/livearea/contents/template.xml
${VPK_INCLUDES}
)
if(LIBRETRO)
# TODO?
else()
vita_create_self(eboot.bin ${PROJECT_NAME} UNSAFE STRIPPED NOASLR)
vita_create_vpk(${VITA_VPKNAME}.vpk ${VITA_TITLEID} eboot.bin
VERSION ${VITA_VERSION}
NAME ${VITA_APP_NAME}
FILE ${CMAKE_SOURCE_DIR}/shell/vita/icon0.png sce_sys/icon0.png
${CMAKE_SOURCE_DIR}/shell/vita/startup.png sce_sys/livearea/contents/startup.png
${CMAKE_SOURCE_DIR}/shell/vita/bg.png sce_sys/livearea/contents/bg.png
${CMAKE_SOURCE_DIR}/shell/vita/template.xml sce_sys/livearea/contents/template.xml
${VPK_INCLUDES}
)
endif()
endif()

if(IOS)
Expand Down
2 changes: 2 additions & 0 deletions core/deps/imgui/backends/imgui_impl_opengl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ static bool ImGui_ImplOpenGL3_CreateDeviceObjects()
glLinkProgram(g_ShaderHandle);
CheckProgram(g_ShaderHandle, "shader program");

#ifndef __vita__
glDetachShader(g_ShaderHandle, vert_handle);
glDetachShader(g_ShaderHandle, frag_handle);
#endif
glDeleteShader(vert_handle);
glDeleteShader(frag_handle);

Expand Down
2 changes: 0 additions & 2 deletions core/deps/vixl/code-buffer-vixl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#ifdef VIXL_CODE_BUFFER_MMAP
#ifndef __vita__
extern "C" {
#include <sys/mman.h>
}
#endif
#endif

#include "code-buffer-vixl.h"
#include "utils-vixl.h"
Expand Down
2 changes: 1 addition & 1 deletion core/linux-dist/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ std::string find_user_data_dir()
#endif
}

#ifndef __SWITCH__
#if !defined(__SWITCH__) && !defined(__vita__)
static void addDirectoriesFromPath(std::vector<std::string>& dirs, const std::string& path, const std::string& suffix)
{
std::string::size_type pos = 0;
Expand Down
2 changes: 2 additions & 0 deletions core/rend/gles/gles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,10 @@ GLuint gl_CompileAndLink(const char *vertexShader, const char *fragmentShader)
INFO_LOG(RENDERER, "// FRAGMENT SHADER\n%s\n// END", fragmentShader);
die("shader compile fail\n");
}
#ifndef __vita__
glDetachShader(program, vs);
glDetachShader(program, ps);
#endif
glDeleteShader(vs);
glDeleteShader(ps);

Expand Down
4 changes: 4 additions & 0 deletions shell/libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include "nswitch.h"
#endif

#ifdef __vita__
#include <sys/syslimits.h> // for PATH_MAX
#endif

#include <sys/stat.h>
#include <file/file_path.h>

Expand Down
4 changes: 4 additions & 0 deletions shell/libretro/oslib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "stdclass.h"
#include "file/file_path.h"

#ifdef __vita__
#include <sys/syslimits.h> // for PATH_MAX
#endif

const char *retro_get_system_directory();

extern char game_dir_no_slash[1024];
Expand Down

0 comments on commit 48857d8

Please sign in to comment.