Play your Steam library's Windows games on a jailbroken PS5.
C++
# Turns the web page and its fonts into byte arrays: cmake -DOUTPUT=<file.cpp> -DASSETS=<path|kind|file;...> -P this.
# kind: html, ttf or text (a content type would bring its own ";" into the list).
cmake_minimum_required(VERSION 3.24)
set(body "")
set(table "")
set(index 0)
foreach(asset IN LISTS ASSETS)
string(REPLACE "|" ";" parts "${asset}")
list(GET parts 0 served)
list(GET parts 1 kind)
if(kind STREQUAL "html")
set(type "text/html; charset=utf-8")
elseif(kind STREQUAL "ttf")
set(type "font/ttf")
elseif(kind STREQUAL "text")
set(type "text/plain; charset=utf-8")
else()
message(FATAL_ERROR "Unknown web asset kind: ${kind}")
endif()
list(GET parts 2 source)
file(READ "${source}" hex HEX)
string(LENGTH "${hex}" hex_length)
math(EXPR size "${hex_length} / 2")
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," bytes "${hex}")
string(APPEND body "const unsigned char kAsset${index}[] = {${bytes}0x00};\n")
string(APPEND table " {\"${served}\", \"${type}\", kAsset${index}, ${size}},\n")
math(EXPR index "${index} + 1")
endforeach()
file(WRITE "${OUTPUT}.tmp" "// Generated by cmake/EmbedWebAssets.cmake; do not edit.\n#include \"web/assets.h\"\n\nnamespace playden::web {\nnamespace {\n${body}} // namespace\n\nconst EmbeddedAsset kEmbeddedAssets[] = {\n${table}};\nconst std::size_t kEmbeddedAssetCount = ${index};\n\n} // namespace playden::web\n")
file(COPY_FILE "${OUTPUT}.tmp" "${OUTPUT}" ONLY_IF_DIFFERENT)
file(REMOVE "${OUTPUT}.tmp")