Embed Feature Flag Data
This commit is contained in:
parent
0e32fd36c8
commit
010aaa89e3
@ -8,7 +8,14 @@ add_executable(launcher src/bootstrap.c src/patchelf.c src/crash-report.c)
|
||||
if(MCPI_SERVER_MODE)
|
||||
target_sources(launcher PRIVATE src/server/launcher.c)
|
||||
else()
|
||||
target_sources(launcher PRIVATE src/client/launcher.cpp)
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/available-feature-flags.c"
|
||||
COMMAND xxd -i available-feature-flags "${CMAKE_CURRENT_BINARY_DIR}/available-feature-flags.c"
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/client/available-feature-flags"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/client"
|
||||
VERBATIM
|
||||
)
|
||||
target_sources(launcher PRIVATE src/client/launcher.cpp "${CMAKE_CURRENT_BINARY_DIR}/available-feature-flags.c")
|
||||
endif()
|
||||
target_link_libraries(launcher reborn-util)
|
||||
# RPath
|
||||
@ -18,11 +25,6 @@ set_target_properties(launcher PROPERTIES INSTALL_RPATH "$ORIGIN/lib/native")
|
||||
install(TARGETS launcher DESTINATION "${MCPI_INSTALL_DIR}")
|
||||
install_symlink("../${MCPI_INSTALL_DIR}/launcher" "bin/${MCPI_VARIANT_NAME}")
|
||||
|
||||
# Install Available Feature Flags List
|
||||
if(NOT MCPI_SERVER_MODE)
|
||||
install(FILES "src/client/available-feature-flags" DESTINATION "${MCPI_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
# Install Desktop Entry
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop"
|
||||
"[Desktop Entry]\n"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <sys/wait.h>
|
||||
@ -36,14 +36,17 @@ static std::string strip_feature_flag_default(std::string flag, bool *default_re
|
||||
}
|
||||
|
||||
// Load Available Feature Flags
|
||||
extern unsigned char available_feature_flags[];
|
||||
extern unsigned int available_feature_flags_len;
|
||||
static void load_available_feature_flags(std::function<void(std::string)> callback) {
|
||||
// Get Path
|
||||
char *binary_directory = get_binary_directory();
|
||||
std::string path = std::string(binary_directory) + "/available-feature-flags";
|
||||
free(binary_directory);
|
||||
// Load File
|
||||
std::ifstream stream(path);
|
||||
if (stream && stream.good()) {
|
||||
std::string data(available_feature_flags, available_feature_flags + available_feature_flags_len);
|
||||
std::stringstream stream(data);
|
||||
// Store Lines
|
||||
std::vector<std::string> lines;
|
||||
// Read File
|
||||
{
|
||||
@ -69,14 +72,9 @@ static void load_available_feature_flags(std::function<void(std::string)> callba
|
||||
return stripped_a < stripped_b;
|
||||
});
|
||||
// Run Callbacks
|
||||
for (std::string line : lines) {
|
||||
for (std::string &line : lines) {
|
||||
callback(line);
|
||||
}
|
||||
// Close File
|
||||
stream.close();
|
||||
} else {
|
||||
ERR("Unable To Load Available Feature Flags");
|
||||
}
|
||||
}
|
||||
|
||||
// Run Command And Set Environmental Variable
|
||||
|
@ -229,7 +229,7 @@ ALuint _media_audio_get_buffer(const char *source, const char *name) {
|
||||
// Delete Buffers
|
||||
void _media_audio_delete_buffers() {
|
||||
if (_media_audio_is_loaded()) {
|
||||
for (auto it : buffers) {
|
||||
for (auto &it : buffers) {
|
||||
if (it.second && alIsBuffer(it.second)) {
|
||||
alDeleteBuffers(1, &it.second);
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ static bool is_ip_in_blacklist(const char *ip) {
|
||||
return false;
|
||||
} else {
|
||||
// Check List
|
||||
for (std::string x : ips) {
|
||||
for (std::string &x : ips) {
|
||||
if (x.compare(ip) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -370,8 +370,8 @@ std::string _sound_pick(std::string sound) {
|
||||
void _sound_resolve_all() {
|
||||
std::string source = _sound_get_source_file();
|
||||
if (source.size() > 0) {
|
||||
for (auto it : repository) {
|
||||
for (std::string name : it.second) {
|
||||
for (auto &it : repository) {
|
||||
for (std::string &name : it.second) {
|
||||
// Zero Volume Prevents An OpenAL Source From Being Allocated While Still Resolving The Sound
|
||||
media_audio_play(source.c_str(), name.c_str(), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ run() {
|
||||
|
||||
# Host Dependencies Needed For Compile
|
||||
queue_pkg \
|
||||
libwayland-bin
|
||||
libwayland-bin \
|
||||
xxd
|
||||
|
||||
# Host Dependencies Needed For Running
|
||||
queue_pkg \
|
||||
|
Loading…
Reference in New Issue
Block a user