Skip to content

Commit 2e82e02

Browse files
committed
stash
1 parent c896edb commit 2e82e02

34 files changed

Lines changed: 1125 additions & 227 deletions

.zed/debug.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Project-local debug tasks
2+
//
3+
// For more documentation on how to configure debug tasks,
4+
// see: https://zed.dev/docs/debugger
5+
[
6+
{
7+
"request": "launch",
8+
"adapter": "CodeLLDB",
9+
"label": "mp-relwithdebinfo",
10+
"program": "build/mp-relwithdebinfo/easyrpg-player",
11+
"build": {
12+
"command": "cmake",
13+
"args": ["--build", "--preset=mp-relwithdebinfo"]
14+
}
15+
}
16+
]

CMakeLists.txt

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,6 @@ add_library(${PROJECT_NAME} OBJECT
253253
src/image_png.h
254254
src/image_xyz.cpp
255255
src/image_xyz.h
256-
src/image_webp.cpp
257-
src/image_webp.h
258-
src/image_gif.cpp
259-
src/image_gif.h
260256
src/input_buttons_desktop.cpp
261257
src/input_buttons.h
262258
src/input.cpp
@@ -529,25 +525,6 @@ target_sources(${PROJECT_NAME} PRIVATE
529525
src/window_stringinput.cpp
530526
)
531527

532-
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
533-
target_sources(${PROJECT_NAME} PRIVATE
534-
src/multiplayer/chat_overlay.h
535-
src/multiplayer/chat_overlay.cpp
536-
src/multiplayer/status_overlay.h
537-
src/multiplayer/status_overlay.cpp
538-
src/multiplayer/scene_overlay.h
539-
src/multiplayer/scene_overlay.cpp
540-
src/multiplayer/scene_online.h
541-
src/multiplayer/scene_online.cpp
542-
src/multiplayer/scene_nexus.h
543-
src/multiplayer/scene_nexus.cpp
544-
src/multiplayer/webview.h
545-
)
546-
if(WIN32)
547-
target_link_libraries(${PROJECT_NAME} synchronization) # provides WaitOnAddress
548-
endif()
549-
endif()
550-
551528
include(CMakeDependentOption)
552529

553530
# Include directories
@@ -613,11 +590,12 @@ endif()
613590
set(PLAYER_BUILD_EXECUTABLE ON)
614591
set(PLAYER_TEST_LIBRARIES ${PROJECT_NAME})
615592

616-
set(PLAYER_SHELL "none" CACHE STRING "Optional UI shell, options: none yno")
617-
set_property(CACHE PLAYER_SHELL PROPERTY STRINGS none yno)
593+
set(PLAYER_SHELL "none" CACHE STRING "Optional UI shell, options: none yno mp")
594+
set_property(CACHE PLAYER_SHELL PROPERTY STRINGS none yno generic)
618595

619596
if(${PLAYER_SHELL} STREQUAL "yno")
620-
set(PLAYER_YNO TRUE)
597+
set(PLAYER_MP TRUE)
598+
target_compile_definitions(${PROJECT_NAME} PUBLIC PLAYER_MP)
621599
target_compile_definitions(${PROJECT_NAME} PUBLIC PLAYER_YNO)
622600

623601
#player_find_package(NAME wxWidgets REQUIRED)
@@ -634,12 +612,49 @@ if(${PLAYER_SHELL} STREQUAL "yno")
634612
find_package(WebP CONFIG REQUIRED)
635613
target_link_libraries(${PROJECT_NAME} WebP::webp WebP::webpdecoder WebP::webpdemux)
636614

615+
elseif(${PLAYER_SHELL} STREQUAL "mp")
616+
set(PLAYER_MP TRUE)
617+
target_compile_definitions(${PROJECT_NAME} PUBLIC PLAYER_MP)
637618
elseif(${PLAYER_SHELL} STREQUAL "none")
638619
# do nothing
639620
else()
640621
message(FATAL_ERROR "Invalid shell ${PLAYER_SHELL}")
641622
endif()
642623

624+
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
625+
if(PLAYER_MP)
626+
target_sources(${PROJECT_NAME} PRIVATE
627+
src/multiplayer/chat_overlay.h
628+
src/multiplayer/chat_overlay.cpp
629+
src/multiplayer/status_overlay.h
630+
src/multiplayer/status_overlay.cpp
631+
src/multiplayer/scene_overlay.h
632+
src/multiplayer/scene_overlay.cpp
633+
src/multiplayer/scene_online.h
634+
src/multiplayer/scene_online.cpp
635+
)
636+
if(PLAYER_YNO)
637+
target_sources(${PROJECT_NAME} PRIVATE
638+
src/multiplayer/scene_nexus.h
639+
src/multiplayer/scene_nexus.cpp
640+
src/multiplayer/webview.h
641+
src/image_webp.cpp
642+
src/image_webp.h
643+
src/image_gif.cpp
644+
src/image_gif.h
645+
)
646+
else()
647+
target_sources(${PROJECT_NAME} PRIVATE
648+
src/multiplayer/scene_serverbrowser.h
649+
src/multiplayer/scene_serverbrowser.cpp
650+
)
651+
endif()
652+
endif()
653+
if(WIN32)
654+
target_link_libraries(${PROJECT_NAME} synchronization) # provides WaitOnAddress
655+
endif()
656+
endif()
657+
643658
if(ANDROID AND PLAYER_GRADLE_BUILD)
644659
# Build invoked by Gradle
645660
# Ugly: Gradle has no way to branch based on the ABI
@@ -1056,7 +1071,7 @@ player_find_package(NAME lhasa
10561071
)
10571072

10581073
# json support
1059-
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
1074+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR PLAYER_MP)
10601075
player_find_package(NAME nlohmann_json
10611076
VERSION 3.9.1
10621077
DEFINITION HAVE_NLOHMANN_JSON
@@ -1071,7 +1086,9 @@ else()
10711086
TARGET nlohmann_json::nlohmann_json
10721087
ONLY_CONFIG
10731088
)
1089+
endif()
10741090

1091+
if(PLAYER_MP)
10751092
find_package(Libwebsockets CONFIG REQUIRED)
10761093
# require_lws_config(LWS_ROLE_H1 1 requirements)
10771094
# require_lws_config(LWS_WITHOUT_CLIENT 0 requirements)
@@ -1102,6 +1119,9 @@ else()
11021119
FetchContent_MakeAvailable(cpr)
11031120
endif()
11041121
target_link_libraries(${PROJECT_NAME} cpr::cpr)
1122+
1123+
player_find_package(NAME LibUV REQUIRED TARGET LibUV::LibUV)
1124+
target_link_libraries(${PROJECT_NAME} LibUV::LibUV)
11051125
endif()
11061126

11071127
# Configure Audio backends
@@ -1370,10 +1390,7 @@ if(PLAYER_BUILD_EXECUTABLE AND ${PLAYER_TARGET_PLATFORM} MATCHES "^SDL.*$" AND N
13701390
"-sALLOW_MEMORY_GROWTH -sMINIFY_HTML=0 -sMODULARIZE -sEXPORT_NAME=createEasyRpgPlayer \
13711391
-sEXIT_RUNTIME=0 --bind --pre-js ${PLAYER_JS_PREJS} --post-js ${PLAYER_JS_POSTJS} \
13721392
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['$autoResumeAudioContext','$dynCall'] \
1373-
-sEXPORTED_FUNCTIONS=_main,_malloc,_free \
1374-
-sEXPORTED_RUNTIME_METHODS=['FS','HEAPU8'] \
1375-
-sGL_ENABLE_GET_PROC_ADDRESS")
1376-
-sEXPORTED_FUNCTIONS=_main,_malloc,_free")
1393+
-sEXPORTED_RUNTIME_METHODS=['FS','HEAPU8']")
13771394
set_source_files_properties("src/platform/sdl/main.cpp" PROPERTIES
13781395
OBJECT_DEPENDS "${PLAYER_JS_PREJS};${PLAYER_JS_POSTJS};${PLAYER_JS_SHELL}")
13791396

0 commit comments

Comments
 (0)