Skip to content

Commit 7a29a21

Browse files
committed
Removed UltraLight. Added CEF integration for 32 and 64 bits systems with cmake subsystem download
1 parent 43fefb5 commit 7a29a21

File tree

1,612 files changed

+1321
-349961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,612 files changed

+1321
-349961
lines changed

.cursor/memory-bank/techContext.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ lua - Scripting
6161
sdl2 - Window management
6262
sentry - Error reporting
6363
imgui - GUI
64-
ultralight - Web-based UI
64+
cef - Web-based UI (Chromium Embedded Framework)
6565
steamworks/galaxy - Platform integration
6666
discord - Discord integration
6767
```

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Or use Visual Studio 2022 with CMake tools installed and open the repository fol
4242
2. **World Engine** (`world/engine.h`) - ECS-based world management using Flecs with streaming support
4343
3. **Networking** (`networking/network_peer.h`) - Client-server communication via SlikeNet
4444
4. **Scripting** (`scripting/`) - JavaScript/TypeScript scripting for game logic (Server: libnode, Client: V8)
45-
5. **GUI Manager** (`gui/manager.h`) - UI using Ultralight and Dear ImGui
45+
5. **GUI Manager** (`gui/manager.h`) - UI using CEF and Dear ImGui
4646
6. **Job System** (`jobs/job_system.h`) - Opt-in fiber-based task scheduling using FTL
4747

4848
### Integration Layer
@@ -87,7 +87,7 @@ Format: `Module: Brief commit description`
8787
- **FTL** - Fiber Tasking Library for job system (v2.1.0)
8888
- **libnode/V8** - JavaScript scripting (Server uses libnode for full Node.js APIs, Client uses V8 for sandboxed execution)
8989
- **SlikeNet** - Networking
90-
- **Ultralight** - Web-based UI
90+
- **CEF** - Web-based UI (Chromium Embedded Framework)
9191
- **Dear ImGui** - Immediate mode GUI
9292
- **spdlog** - Logging
9393
- **nlohmann/json** - JSON parsing

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ This codebase also depends on the following third-party libraries:
4545
protobuf - https://github.com/protocolbuffers/protobuf/blob/master/LICENSE
4646
curl - https://curl.se/docs/copyright.html
4747
udis86 - https://github.com/vmt/udis86
48-
ultralight - https://ultralig.ht/
48+
cef - https://bitbucket.org/chromiumembedded/cef/
4949
flecs - https://github.com/SanderMertens/flecs/
5050
fmt - https://fmt.dev/latest/index.html
5151
cxxopts - https://github.com/jarro2783/cxxopts

cmake/DownloadCEF.cmake

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# DownloadCEF.cmake
2+
#
3+
# Downloads and extracts a CEF binary distribution at CMake configure time.
4+
# Based on the official chromiumembedded/cef-project approach.
5+
#
6+
# Usage:
7+
# DownloadCEF(<platform> <version> <download_dir>)
8+
#
9+
# Where:
10+
# platform - "windows32" or "windows64"
11+
# version - CEF version string (e.g. "144.0.6+g5f7e671+chromium-144.0.7559.59")
12+
# download_dir - Directory to download and extract into
13+
#
14+
# Sets the following cache variable:
15+
# CEF_ROOT - Path to the extracted CEF distribution directory
16+
17+
function(DownloadCEF platform version download_dir)
18+
# Use minimal distribution (no sample apps, significantly smaller download)
19+
set(CEF_DISTRIBUTION "cef_binary_${version}_${platform}_minimal")
20+
set(CEF_DOWNLOAD_DIR "${download_dir}")
21+
22+
# The location where we expect the extracted binary distribution
23+
set(CEF_ROOT "${CEF_DOWNLOAD_DIR}/${CEF_DISTRIBUTION}" CACHE INTERNAL "CEF_ROOT")
24+
25+
# Skip if already extracted
26+
if(IS_DIRECTORY "${CEF_ROOT}")
27+
message(STATUS "CEF: Using existing distribution at ${CEF_ROOT}")
28+
return()
29+
endif()
30+
31+
set(CEF_DOWNLOAD_FILENAME "${CEF_DISTRIBUTION}.tar.bz2")
32+
set(CEF_DOWNLOAD_PATH "${CEF_DOWNLOAD_DIR}/${CEF_DOWNLOAD_FILENAME}")
33+
34+
# Build URL with '+' encoded as '%2B'
35+
set(CEF_DOWNLOAD_URL "https://cef-builds.spotifycdn.com/${CEF_DOWNLOAD_FILENAME}")
36+
string(REPLACE "+" "%2B" CEF_DOWNLOAD_URL_ESCAPED "${CEF_DOWNLOAD_URL}")
37+
38+
if(NOT EXISTS "${CEF_DOWNLOAD_PATH}")
39+
# Download SHA1 hash for verification
40+
message(STATUS "CEF: Downloading checksum ...")
41+
file(DOWNLOAD "${CEF_DOWNLOAD_URL_ESCAPED}.sha1" "${CEF_DOWNLOAD_PATH}.sha1"
42+
STATUS DOWNLOAD_SHA1_STATUS
43+
)
44+
list(GET DOWNLOAD_SHA1_STATUS 0 SHA1_STATUS_CODE)
45+
if(NOT SHA1_STATUS_CODE EQUAL 0)
46+
list(GET DOWNLOAD_SHA1_STATUS 1 SHA1_ERROR_MSG)
47+
file(REMOVE "${CEF_DOWNLOAD_PATH}.sha1")
48+
message(FATAL_ERROR
49+
"CEF: Failed to download SHA1 checksum: ${SHA1_ERROR_MSG}\n"
50+
" URL: ${CEF_DOWNLOAD_URL_ESCAPED}.sha1\n"
51+
" Check that CEF_VERSION is valid at https://cef-builds.spotifycdn.com/index.html"
52+
)
53+
endif()
54+
55+
file(READ "${CEF_DOWNLOAD_PATH}.sha1" CEF_SHA1)
56+
string(STRIP "${CEF_SHA1}" CEF_SHA1)
57+
58+
# Validate SHA1 looks like a 40-char hex string
59+
string(LENGTH "${CEF_SHA1}" SHA1_LEN)
60+
if(NOT SHA1_LEN EQUAL 40)
61+
file(REMOVE "${CEF_DOWNLOAD_PATH}.sha1")
62+
message(FATAL_ERROR
63+
"CEF: Downloaded SHA1 checksum is invalid (length ${SHA1_LEN}, expected 40).\n"
64+
" URL: ${CEF_DOWNLOAD_URL_ESCAPED}.sha1\n"
65+
" Check that CEF_VERSION is valid at https://cef-builds.spotifycdn.com/index.html"
66+
)
67+
endif()
68+
69+
# Download the binary distribution with hash verification
70+
message(STATUS "CEF: Downloading ${CEF_DOWNLOAD_FILENAME} (~100MB, this may take a while) ...")
71+
file(DOWNLOAD "${CEF_DOWNLOAD_URL_ESCAPED}" "${CEF_DOWNLOAD_PATH}"
72+
EXPECTED_HASH SHA1=${CEF_SHA1}
73+
SHOW_PROGRESS
74+
STATUS DOWNLOAD_STATUS
75+
)
76+
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
77+
if(NOT STATUS_CODE EQUAL 0)
78+
list(GET DOWNLOAD_STATUS 1 ERROR_MSG)
79+
file(REMOVE "${CEF_DOWNLOAD_PATH}")
80+
message(FATAL_ERROR "CEF: Download failed: ${ERROR_MSG}\n URL: ${CEF_DOWNLOAD_URL_ESCAPED}")
81+
endif()
82+
83+
message(STATUS "CEF: Download complete.")
84+
else()
85+
message(STATUS "CEF: Using cached archive ${CEF_DOWNLOAD_PATH}")
86+
endif()
87+
88+
# Extract the binary distribution
89+
message(STATUS "CEF: Extracting ${CEF_DOWNLOAD_FILENAME} ...")
90+
execute_process(
91+
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CEF_DOWNLOAD_PATH}"
92+
WORKING_DIRECTORY "${CEF_DOWNLOAD_DIR}"
93+
RESULT_VARIABLE EXTRACT_RESULT
94+
)
95+
if(NOT EXTRACT_RESULT EQUAL 0)
96+
message(FATAL_ERROR "CEF: Extraction failed (exit code ${EXTRACT_RESULT})")
97+
endif()
98+
99+
# Verify extraction succeeded
100+
if(NOT IS_DIRECTORY "${CEF_ROOT}")
101+
message(FATAL_ERROR "CEF: Extraction completed but expected directory not found: ${CEF_ROOT}")
102+
endif()
103+
104+
message(STATUS "CEF: Ready at ${CEF_ROOT}")
105+
endfunction()

code/framework/CMakeLists.txt

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,20 @@ set(FRAMEWORK_CLIENT_SRC
8282
src/integrations/client/scripting/module.cpp
8383
)
8484

85-
# GUI (Ultralight) only available for 64-bit builds
86-
if(CMAKE_CL_64)
87-
list(APPEND FRAMEWORK_CLIENT_SRC
88-
src/gui/manager.cpp
89-
src/gui/clipboard.cpp
90-
src/gui/view.cpp
91-
src/gui/sdk.cpp
92-
src/gui/backend/renderer_d3d11.cpp
93-
src/gui/backend/view_d3d11.cpp
94-
)
95-
endif()
85+
# GUI (CEF-based)
86+
list(APPEND FRAMEWORK_CLIENT_SRC
87+
src/gui/manager.cpp
88+
src/gui/clipboard.cpp
89+
src/gui/view.cpp
90+
src/gui/sdk.cpp
91+
src/gui/backend/view_d3d11.cpp
92+
src/gui/cef/app.cpp
93+
src/gui/cef/client.cpp
94+
src/gui/cef/render_handler.cpp
95+
src/gui/cef/life_span_handler.cpp
96+
src/gui/cef/load_handler.cpp
97+
src/gui/cef/display_handler.cpp
98+
)
9699

97100
# Append the platform-dependent files to the related lists
98101
if(WIN32)
@@ -334,15 +337,27 @@ if(WIN32)
334337
if(NOT CMAKE_CL_64)
335338
target_link_options(FrameworkServer PUBLIC "-SAFESEH:NO")
336339
else()
337-
target_link_libraries(FrameworkClient UltralightSDK JavaScriptCorePP)
338340
target_link_options(FrameworkClient PUBLIC "-SAFESEH:NO")
341+
endif()
339342

340-
# Ultralight GUI includes (64-bit only)
341-
target_include_directories(FrameworkClient PRIVATE
342-
${CMAKE_SOURCE_DIR}/vendors/ultralight/include
343-
${CMAKE_SOURCE_DIR}/vendors/directxtk
344-
${CMAKE_SOURCE_DIR}/vendors/javascriptcorepp/include
345-
)
343+
# CEF GUI integration (CEF target provides include dirs via INTERFACE)
344+
target_link_libraries(FrameworkClient CEF)
345+
target_include_directories(FrameworkClient PRIVATE
346+
${CMAKE_SOURCE_DIR}/vendors/directxtk
347+
)
348+
349+
# CEF subprocess executable
350+
add_executable(cef_subprocess
351+
src/gui/cef/subprocess_main.cpp
352+
src/gui/cef/renderer_app.cpp
353+
)
354+
target_link_libraries(cef_subprocess CEF)
355+
set_target_properties(cef_subprocess PROPERTIES
356+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
357+
)
358+
if(TARGET CEFCopyDlls)
359+
add_dependencies(FrameworkClient CEFCopyDlls)
360+
add_dependencies(cef_subprocess CEFCopyDlls)
346361
endif()
347362

348363
# Ensure runtime DLLs are copied to bin directory for all client/server targets

code/framework/src/graphics/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Framework::Graphics {
2020

2121
enum class RendererAPI {
2222
IMGUI,
23-
ULTRALIGHT
23+
CEF
2424
};
2525

2626
enum class PlatformBackend {

0 commit comments

Comments
 (0)