Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
88192cb
switch: first commit
Cpasjuste May 3, 2020
ada8a29
switch: minor cleanup
Cpasjuste May 3, 2020
95f1401
switch: enable opengl, increase available ram, add icon
Cpasjuste May 3, 2020
ab86129
switch: use 720p by default, add nxlink debug
Cpasjuste May 3, 2020
a95ff67
switch: fix default inputs
Cpasjuste May 3, 2020
a2ee492
sdl/menu: fix getPreview crash on 32 bits previews
Cpasjuste May 3, 2020
d081601
switch: define joystick button names
Cpasjuste May 3, 2020
25d1042
switch: use wide screen setting in menu
Cpasjuste May 3, 2020
5acc502
switch: invert x/y and l/r buttons
Cpasjuste May 3, 2020
4f57d27
switch: prevent joystick disabling
Cpasjuste May 3, 2020
e9817bb
switch: do not try to load 32 bits previews (too slow)
Cpasjuste May 4, 2020
b0c3f20
switch: use 2x hw scaling by default, disable fullscreen
Cpasjuste May 4, 2020
a9585c2
switch: refactor inputs, add single joycons mode option
Cpasjuste May 5, 2020
7913b9b
switch: update cmakelist
Cpasjuste May 6, 2020
865852b
switch: update cmakelist
Cpasjuste May 6, 2020
267f94e
switch: don't load sdl gl library (since it's not needed, and not unl…
Cpasjuste May 7, 2020
62ae076
sdl/haptic: try joystick rumble if no haptic
Cpasjuste May 7, 2020
1d99f21
switch: fix merge
Cpasjuste Jun 25, 2021
f79c0b3
cmake: add cmake support (linux and switch)
Cpasjuste Jun 25, 2021
9889a5e
switch: minor cleanup
Cpasjuste Jun 25, 2021
88b25cf
merge switch port (todo: inputs, single joycon mode)
Cpasjuste Mar 7, 2022
7a93eaf
common: remove sdl2_gfx deps
Cpasjuste Mar 7, 2022
3acca5a
ps4: first commit
Cpasjuste Mar 7, 2022
463ea2f
ps4: change pkg title
Cpasjuste Mar 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ tools/bin/.wget-hsts
tools/win-sdk/*
tools/psp-sdk/*
tools/devkitpro/*
# switch port
.idea
cmake-build*
134 changes: 134 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
cmake_minimum_required(VERSION 3.1)
#set(CMAKE_VERBOSE_MAKEFILE ON)

project(OpenBOR)
set(OPENBOR_VERSION "3.0.7162")

#####################
# OPTIONS
#####################
option(BUILD_GFX "Build with GFX support" ON)
option(BUILD_VORBIS "Build with BUILD_VORBIS support" ON)

##############
# COMMON
##############
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
pkg_search_module(VPX REQUIRED vpx)
pkg_search_module(PNG REQUIRED libpng)
pkg_search_module(ZLIB REQUIRED zlib)

set(BOR_INC
engine
engine/sdl
engine/source
engine/source/adpcmlib
engine/source/gamelib
engine/source/openborscript
engine/source/pnglib
engine/source/preprocessorlib
engine/source/ramlib
engine/source/randlib
engine/source/scriptlib
engine/source/webmlib
engine/source/webmlib/halloc
engine/source/webmlib/nestegg
${SDL2_INCLUDE_DIRS}
${VPX_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)

file(GLOB BOR_SRC
engine/*.c
engine/sdl/*.c
engine/source/*.c
engine/source/adpcmlib/*.c
engine/source/gamelib/*.c
engine/source/openborscript/*.c
engine/source/pnglib/*.c
engine/source/preprocessorlib/*.c
engine/source/ramlib/*.c
engine/source/randlib/*.c
engine/source/scriptlib/*.c
engine/source/webmlib/*.c
engine/source/webmlib/halloc/*.c
engine/source/webmlib/nestegg/*.c
)

set(BOR_CFLAGS -g -Wall -fsigned-char -fomit-frame-pointer -DSDL -DSDL2 -DWEBM -D__CMAKE__)
set(BOR_LDFLAGS ${SDL2_LIBRARIES} ${VPX_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} m)

##############
# VERSION.SH
##############
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/engine/version.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/engine
COMMAND bash version.sh)
list(APPEND BOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/engine/version.h)

#####################
# OPTIONS
#####################
if (BUILD_GFX)
list(APPEND BOR_INC engine/source/gfxlib)
file(GLOB GFX_SRC engine/source/gfxlib/*.c)
list(APPEND BOR_SRC ${GFX_SRC})
endif ()
if (BUILD_VORBIS)
pkg_search_module(VORBIS REQUIRED vorbis)
pkg_search_module(VORBISFILE REQUIRED vorbisfile)
pkg_search_module(OGG REQUIRED ogg)
list(APPEND BOR_INC ${VORBIS_INCLUDE_DIRS} ${VORBISFILE_INCLUDE_DIRS} ${OGG_INCLUDE_DIRS})
list(APPEND BOR_CFLAGS -DOV_EXCLUDE_STATIC_CALLBACKS)
list(APPEND BOR_LDFLAGS ${VORBIS_LIBRARIES} ${VORBISFILE_LIBRARIES} ${OGG_LIBRARIES} m)
endif ()

#####################
# PLATORM SPECIFIC
#####################
if (NINTENDO_SWITCH)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND BOR_CFLAGS -D__NXLINK__)
endif ()
list(APPEND BOR_CFLAGS -DOPENGL -DLOADGL)
list(APPEND BOR_LDFLAGS stdc++)
elseif (PS4)
list(APPEND BOR_CFLAGS -D__CLANG_MAX_ALIGN_T_DEFINED)
add_self(${PROJECT_NAME})
add_pkg(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/engine/resources/ps4 "OBOR00001" "OpenBor @ cpasjuste" "03.71")
else ()
list(APPEND BOR_CFLAGS -D__LINUX__ -DLINUX -DOPENGL -DLOADGL)
endif ()

#####################
# OpenBOR executable
#####################
add_executable(${CMAKE_PROJECT_NAME} ${BOR_SRC})
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${BOR_INC})
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE ${BOR_CFLAGS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${BOR_LDFLAGS})

#####################
# SWITCH target
#####################
if (NINTENDO_SWITCH)
nx_generate_nacp(${CMAKE_PROJECT_NAME}.nacp
NAME "${CMAKE_PROJECT_NAME}"
AUTHOR "cpasjuste"
VERSION "${OPENBOR_VERSION}"
)
nx_create_nro(${CMAKE_PROJECT_NAME}
NACP ${CMAKE_PROJECT_NAME}.nacp
ICON "${CMAKE_SOURCE_DIR}/engine/resources/switch_icon.jpg"
)
add_custom_target(${PROJECT_NAME}_switch_release
DEPENDS ${PROJECT_NAME}.nro
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-${OPENBOR_VERSION}_switch.zip
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/release/${PROJECT_NAME}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.nro ${CMAKE_BINARY_DIR}/release/${PROJECT_NAME}/
COMMAND cd ${CMAKE_BINARY_DIR}/release && zip -r ../${PROJECT_NAME}-${OPENBOR_VERSION}_switch.zip ${PROJECT_NAME}
)
endif ()
12 changes: 12 additions & 0 deletions engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2455,6 +2455,10 @@ void clearsettings()
savedata.hwfilter = 1;
#ifdef ANDROID
savedata.hwscale = 0.0;
#elif __SWITCH__
savedata.hwscale = 2.0f;
#elif __PS4__
savedata.hwscale = 2.0f;
#else
savedata.hwscale = 1.0;
#endif
Expand Down Expand Up @@ -37830,6 +37834,12 @@ void init_videomodes(int log)
#elif VITA
tryfile("data/videovita.txt");
tryfile("data/video169.txt");
#elif __SWITCH__
tryfile("data/videoswitch.txt");
tryfile("data/video169.txt");
#elif __PS4__
tryfile("data/videops4.txt");
tryfile("data/video169.txt");
#endif
#undef tryfile

Expand Down Expand Up @@ -39489,7 +39499,9 @@ void menu_options_video()

#if SDL
#if !defined(GP2X) && !defined(OPENDINGUX)
#if !defined(__SWITCH__) && !defined(__PS4__)
video_fullscreen_flip();
#endif
break;
case 4:
savedata.usegl = !savedata.usegl;
Expand Down
3 changes: 2 additions & 1 deletion engine/openbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ typedef enum
PORTING_WINDOWS,
PORTING_WIZ,
PORTING_XBOX,
PORTING_VITA
PORTING_VITA,
PORTING_PS4
} e_porting;

// Caskey, Damon V.
Expand Down
Loading