Skip to content

Commit

Permalink
Revert the revert
Browse files Browse the repository at this point in the history
  • Loading branch information
SlawekNowy committed Sep 26, 2024
1 parent 769dae8 commit 060e7a4
Show file tree
Hide file tree
Showing 34 changed files with 228 additions and 134 deletions.
36 changes: 16 additions & 20 deletions build_scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@
update = args["update"]
modules_prebuilt = []

root = normalize_path(os.getcwd())
build_dir = normalize_path(build_directory)
deps_dir = normalize_path(deps_directory)
install_dir = install_directory
tools = root +"/tools"

if not os.path.isabs(build_dir):
build_dir = os.getcwd() +"/" +build_dir

if not os.path.isabs(deps_dir):
deps_dir = os.getcwd() +"/" +deps_dir
deps_dir_fs = deps_dir.replace("\\", "/")

if not os.path.isabs(install_dir):
install_dir = build_dir +"/" +install_dir

print("Inputs:")
if platform == "linux":
print("cxx_compiler: " +cxx_compiler)
Expand Down Expand Up @@ -145,26 +161,6 @@
print("cmake_args: " +', '.join(additional_cmake_args))
print("modules: " +', '.join(modules))

if platform == "linux":
os.environ["CC"] = c_compiler
os.environ["CXX"] = cxx_compiler

root = normalize_path(os.getcwd())
build_dir = normalize_path(build_directory)
deps_dir = normalize_path(deps_directory)
install_dir = install_directory
tools = root +"/tools"

if not os.path.isabs(build_dir):
build_dir = os.getcwd() +"/" +build_dir

if not os.path.isabs(deps_dir):
deps_dir = os.getcwd() +"/" +deps_dir
deps_dir_fs = deps_dir.replace("\\", "/")

if not os.path.isabs(install_dir):
install_dir = build_dir +"/" +install_dir

if update:
os.chdir(root)

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/scripts/external_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
get_submodule("util_image","https://github.com/SlawekNowy/util_image.git","903338d21c0aba9895adb97af197e1a12537f225")
get_submodule("util_pad","https://github.com/Silverlan/util_pad.git","49d78bd7725cc320fae67c6eff5c25524d1363c0")
get_submodule("util_pragma_doc","https://github.com/Silverlan/util_pragma_doc.git","71b9593872633adafa8dada0797bdf4fabf74c4f")
get_submodule("util_smdmodel","https://github.com/Silverlan/util_smdmodel.git","1fae16eb43b1f403be7a5f6dce646fbfa84de8c0")
get_submodule("util_smdmodel","https://github.com/Silverlan/util_smdmodel.git","10fb2d10eb62188c8b9639a62da646152277a748")
get_submodule("util_sound","https://github.com/Silverlan/util_sound.git","dcc284ca1affd33c9964ff1646e7aa7cf902eb96")
get_submodule("util_source2","https://github.com/Silverlan/util_source2.git","2d45b2c76921475b61647ea63aeb180b37a17d44")
get_submodule("util_source_script","https://github.com/Silverlan/util_source_script.git","eb71bb79736ccc693832c98d69069f3ffbbcb897")
Expand Down
4 changes: 4 additions & 0 deletions build_scripts/scripts/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def extract(zipName,removeZip=True,format="zip"):
tar = tarfile.open(zipName, "r:xz")
tar.extractall()
tar.close()
elif format == "tar.xz":
tar = tarfile.open(zipName, "r:xz")
tar.extractall()
tar.close()
if removeZip:
os.remove(zipName)

Expand Down
2 changes: 1 addition & 1 deletion build_scripts/scripts/third_party_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
get_submodule("tinygltf","https://github.com/syoyo/tinygltf.git","f51243da480806032cfb6f8d6799a7493397cb86","release")
get_submodule("vorbis","https://github.com/xiph/vorbis.git","9eadeccdc4247127d91ac70555074239f5ce3529")
get_submodule("vtflib","https://github.com/Silverlan/VTFLib.git","3e6b80bcd6dacf6bd4a35666869464fac55051cc")
get_submodule("zlib","https://github.com/Silverlan/zlib.git","0dcc7471231d72376d592f80f06c2e2246c2b3c4")
get_submodule("zlib","https://github.com/Silverlan/zlib.git","3bbd3b3c24516840ea46d192fcf4a80e7b3eeffd")
get_submodule("fmt","https://github.com/fmtlib/fmt.git","a337011")
get_submodule("mpaheader","https://github.com/SlawekNowy/mpaheader.git","275d9d9")
get_submodule("vkvparser","https://github.com/Silverlan/VKVParser.git","5ffec9da2fc51288d0d77a99fcf173d6e9b91cdb")
Expand Down
6 changes: 3 additions & 3 deletions cmake/pr_modules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ function(pr_init_module TARGET_NAME)
set(multiValueArgs)
cmake_parse_arguments(PARSE_ARGV 1 PA "${options}" "${oneValueArgs}" "${multiValueArgs}")

set(SRC_PATH "src/")
set(SRC_PATH "src")
if(DEFINED PA_SRC_PATH)
set(SRC_PATH "src/" "${PA_SRC_PATH}")
set(SRC_PATH "src" "${PA_SRC_PATH}")
endif()

pr_add_headers(${TARGET_NAME} "${SRC_PATH}" PRIVATE)
pr_add_headers(${TARGET_NAME} "${SRC_PATH}/implementation" PRIVATE)
pr_add_sources(${TARGET_NAME} "${SRC_PATH}")
pr_add_modules(${TARGET_NAME} "${SRC_PATH}")

Expand Down
1 change: 1 addition & 0 deletions cmake/pr_project.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function(pr_setup_default_project_settings TARGET_NAME)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${TARGET_NAME} PRIVATE -Wno-c++11-narrowing)
target_compile_options(${TARGET_NAME} PUBLIC -Wno-missing-template-arg-list-after-template-kw)
endif()

target_compile_features(${TARGET_NAME} PRIVATE cxx_std_20)
Expand Down
41 changes: 25 additions & 16 deletions cmake/pr_sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ function(pr_add_headers TARGET_NAME HEADER_LOCATION)
pr_add_header_list(${TARGET_NAME} "${HEADER_LIST}" "${BASE_DIRS}" BASE_DIRS "${PA_BASE_DIRS}")
endfunction()

function(pr_add_module_list TARGET_NAME MODULE_LIST)
foreach(source IN LISTS MODULE_LIST)
get_filename_component(source_path "${source}" PATH)
string(REPLACE "${CMAKE_CURRENT_LIST_DIR}" "" source_path_relative "${source_path}")
string(REPLACE "/" "\\" source_path_msvc "${source_path_relative}")
source_group("${source_path_msvc}" FILES "${source}")
endforeach()
function(pr_add_module_list TARGET_NAME FILE_SET_NAME)
set(options LINK_ONLY PRIVATE PUBLIC)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(PARSE_ARGV 3 PA "${options}" "${oneValueArgs}" "${multiValueArgs}")

target_sources(${TARGET_NAME} PRIVATE FILE_SET cxx_modules TYPE CXX_MODULES FILES ${MODULE_LIST})
set(VISIBILITY PUBLIC)
if(PA_PRIVATE)
set(VISIBILITY PRIVATE)
endif()

target_sources(${TARGET_NAME} ${VISIBILITY} FILE_SET ${FILE_SET_NAME} TYPE CXX_MODULES FILES ${PA_UNPARSED_ARGUMENTS})
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${PA_UNPARSED_ARGUMENTS})
endfunction()

function(pr_add_modules TARGET_NAME MODULE_LOCATION)
Expand Down Expand Up @@ -94,15 +98,20 @@ function(pr_add_modules TARGET_NAME MODULE_LOCATION)
endif()
endfunction()

function(pr_add_source_list TARGET_NAME SOURCE_LIST)
foreach(source IN LISTS SOURCE_LIST)
get_filename_component(source_path "${source}" PATH)
string(REPLACE "${CMAKE_CURRENT_LIST_DIR}" "" source_path_relative "${source_path}")
string(REPLACE "/" "\\" source_path_msvc "${source_path_relative}")
source_group("${source_path_msvc}" FILES "${source}")
endforeach()

target_sources(${TARGET_NAME} PRIVATE ${SOURCE_LIST})
function(pr_add_module_list TARGET_NAME FILE_SET_NAME)
set(options LINK_ONLY PRIVATE PUBLIC)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(PARSE_ARGV 3 PA "${options}" "${oneValueArgs}" "${multiValueArgs}")

set(VISIBILITY PUBLIC)
if(PA_PRIVATE)
set(VISIBILITY PRIVATE)
endif()

target_sources(${TARGET_NAME} ${VISIBILITY} FILE_SET ${FILE_SET_NAME} TYPE CXX_MODULES FILES ${PA_UNPARSED_ARGUMENTS})
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${PA_UNPARSED_ARGUMENTS})
endfunction()

function(pr_add_sources TARGET_NAME SOURCE_LOCATION)
Expand Down
2 changes: 1 addition & 1 deletion core/client/include/pragma/c_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class DLLCLIENT CEngine : public Engine, public pragma::RenderContext {
virtual void SetAssetMultiThreadedLoadingEnabled(bool enabled) override;

// Debug
virtual void DumpDebugInformation(ZIPFile &zip) const override;
virtual void DumpDebugInformation(uzip::ZIPFile &zip) const override;
pragma::debug::ProfilingStageManager<pragma::debug::GPUProfilingStage> *GetGPUProfilingStageManager();
pragma::debug::ProfilingStageManager<pragma::debug::ProfilingStage> *GetProfilingStageManager();
bool StartProfilingStage(const char *stage);
Expand Down
5 changes: 2 additions & 3 deletions core/client/include/pragma/cinematic/choreographic_scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
#ifndef __CHOREOGRAPHIC_SCENE_HPP__
#define __CHOREOGRAPHIC_SCENE_HPP__

#include <util_timeline_scene.hpp>
#include <util_timeline_channel.hpp>
#include <util_timeline_event.hpp>
#include <pragma/entities/baseentity_handle.h>

import timeline_scene;

class CBaseEntity;
namespace choreography {
class Event : public uts::Event {
Expand Down
17 changes: 11 additions & 6 deletions core/client/src/asset/c_util_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,20 @@ static bool load_image(tinygltf::Image *image, const int imageIdx, std::string *
}
auto &inputData = *static_cast<GLTFInputData *>(userData);
auto imgPath = inputData.path + image->uri;
auto f = FileManager::OpenSystemFile(imgPath.c_str(), "rb");
if(f == nullptr)
return false;
auto relImgPath = util::Path::CreateFile(imgPath);
relImgPath.MakeRelative(util::get_program_path());
auto &texManager = static_cast<msys::CMaterialManager &>(client->GetMaterialManager()).GetTextureManager();
auto texture = texManager.LoadAsset(image->uri, util::AssetLoadFlags::DontCache);
if(texture == nullptr)
auto texture = texManager.LoadAsset(relImgPath.GetString(), util::AssetLoadFlags::AbsolutePath | util::AssetLoadFlags::DontCache);
if(texture == nullptr) {
if(outErr)
*outErr = "Failed to load texture '" + relImgPath.GetString() + "'!";
return false;
if(texture->HasValidVkTexture() == false)
}
if(texture->HasValidVkTexture() == false) {
if(outErr)
*outErr = "Texture '" + relImgPath.GetString() + "' has no valid VK texture!";
return false;
}
if(imageIdx >= inputData.textures.size())
inputData.textures.resize(imageIdx + 1);
inputData.textures.at(imageIdx) = std::static_pointer_cast<Texture>(texture)->GetVkTexture();
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/audio/c_engine_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ std::string pragma::audio::get_audio_api_module_location(const std::string &audi

al::ISoundSystem *CEngine::InitializeSoundEngine()
{
Con::cout << "Initializing sound engine..." << Con::endl;
spdlog::info("Initializing sound engine...");

auto &audioAPI = GetAudioAPI();
auto getAudioApiPath = [](const std::string &audioAPI, std::string &outLocation, std::string &outModulePath) {
Expand Down
8 changes: 5 additions & 3 deletions core/client/src/audio/c_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#include <pragma/audio/sound_util.hpp>
#include <util_sound.hpp>
#include <sharedutils/util_file.h>
#include <se_scene.hpp>
#include <steam_audio/alsound_steam_audio.hpp>
#include <pragma/entities/components/base_transform_component.hpp>
#include <pragma/logging.hpp>
#include <sharedutils/util_markup_file.hpp>

import se_script;

extern DLLCLIENT CEngine *c_engine;
extern DLLCLIENT ClientState *client;
Expand Down Expand Up @@ -174,8 +176,8 @@ bool ClientState::PrecacheSound(std::string snd, std::pair<al::ISoundBuffer *, a
if(ufile::get_extension(path, &ext) == true && ustring::compare<std::string>(ext, "wav", false) == true) {
auto f = FileManager::OpenFile(path.c_str(), "rb");
if(f != nullptr) {
auto phonemeData = std::make_shared<se::SoundPhonemeData>();
if(se::read_wav_phonemes(f, *phonemeData) == util::MarkupFile::ResultCode::Ok) {
auto phonemeData = std::make_shared<source_engine::script::SoundPhonemeData>();
if(source_engine::script::read_wav_phonemes(f, *phonemeData) == util::MarkupFile::ResultCode::Ok) {
if(tgtBuffers->first != nullptr)
tgtBuffers->first->SetUserData(phonemeData);
if(tgtBuffers->second != nullptr)
Expand Down
5 changes: 3 additions & 2 deletions core/client/src/c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <pragma/model/c_modelmesh.h>
#include <cctype>
#include <sharedutils/util_debug.h>
#include <util_zip.h>
#include <pragma/input/inputhelper.h>
#include <fsys/directory_watcher.h>
#include <pragma/game/game_resources.hpp>
Expand Down Expand Up @@ -73,6 +72,8 @@

#endif

import util_zip;

extern "C" {
void DLLCLIENT RunCEngine(int argc, char *argv[])
{
Expand Down Expand Up @@ -165,7 +166,7 @@ pragma::debug::ProfilingStageManager<pragma::debug::ProfilingStage> *CEngine::Ge
static auto cvGPUProfiling = GetClientConVar("cl_gpu_timer_queries_enabled");
bool CEngine::IsGPUProfilingEnabled() const { return cvGPUProfiling->GetBool(); }

void CEngine::DumpDebugInformation(ZIPFile &zip) const
void CEngine::DumpDebugInformation(uzip::ZIPFile &zip) const
{
Engine::DumpDebugInformation(zip);

Expand Down
7 changes: 4 additions & 3 deletions core/client/src/entities/components/c_flex_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
#include "pragma/lua/c_lentity_handles.hpp"
#include <stack>
#include <pragma/model/model.h>
#include <se_scene.hpp>
#include <alsound_buffer.hpp>
#include <pragma/entities/entity_component_system_t.hpp>
#include <pragma/lua/converters/game_type_converters_t.hpp>

import se_script;

using namespace pragma;

extern DLLCLIENT CGame *c_game;
Expand Down Expand Up @@ -303,7 +304,7 @@ void CFlexComponent::UpdateSoundPhonemes(CALSound &snd)
if(mdl == nullptr)
return;
auto &phonemeMap = mdl->GetPhonemeMap();
auto &phonemeData = *static_cast<se::SoundPhonemeData *>(userData.get());
auto &phonemeData = *static_cast<source_engine::script::SoundPhonemeData *>(userData.get());
auto t = snd.GetTimeOffset();
for(auto itWord = phonemeData.words.begin(); itWord != phonemeData.words.end(); ++itWord) {
auto &word = *itWord;
Expand All @@ -316,7 +317,7 @@ void CFlexComponent::UpdateSoundPhonemes(CALSound &snd)
auto it = phonemeMap.phonemes.find(phoneme.phoneme);
if(it != phonemeMap.phonemes.end()) {
// Find next phoneme to interpolate
se::SoundPhonemeData::PhonemeData *nextPhoneme = nullptr;
source_engine::script::SoundPhonemeData::PhonemeData *nextPhoneme = nullptr;
PhonemeInfo *nextPhonemeInfo = nullptr;
auto itPhonemeNext = itPhoneme + 1;
if(itPhonemeNext != word.phonemes.end())
Expand Down
5 changes: 3 additions & 2 deletions core/client/src/lua/classes/c_lalsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#include "pragma/audio/c_lalsound.hpp"
#include <pragma/lua/policies/pair_policy.hpp>
#include <pragma/lua/converters/pair_converter_t.hpp>
#include <se_scene.hpp>

import se_script;

namespace Lua {
namespace ALSound {
Expand Down Expand Up @@ -57,7 +58,7 @@ Lua::opt<luabind::tableT<void>> Lua::ALBuffer::GetPhonemeData(lua_State *l, al::
auto pUserData = buffer.GetUserData();
if(pUserData == nullptr)
return nil;
auto &phonemeData = *static_cast<se::SoundPhonemeData *>(pUserData.get());
auto &phonemeData = *static_cast<source_engine::script::SoundPhonemeData *>(pUserData.get());

auto t = luabind::newtable(l);
t["plainText"] = phonemeData.plainText;
Expand Down
3 changes: 2 additions & 1 deletion core/client/src/lua/libraries/c_lengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
#include <pragma/lua/converters/game_type_converters_t.hpp>
#include <image/prosper_render_target.hpp>
#include <pragma/entities/environment/effects/particlesystemdata.h>
#include <util_zip.h>
#include <prosper_window.hpp>
#include <fsys/ifile.hpp>

import util_zip;

extern DLLCLIENT CEngine *c_engine;
extern DLLCLIENT ClientState *client;
extern DLLCLIENT CGame *c_game;
Expand Down
8 changes: 3 additions & 5 deletions core/client/src/lua/libraries/c_lgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <buffers/prosper_buffer.hpp>
#include <prosper_descriptor_set_group.hpp>
#include <prosper_util.hpp>
#include <util_timeline_impl.hpp>
#include <pragma/entities/entity_iterator.hpp>
#include <pragma/lua/converters/game_type_converters_t.hpp>
#include <cmaterial.h>
Expand Down Expand Up @@ -64,7 +63,6 @@ static btSoftBody *createSoftBody(btSoftRigidDynamicsWorld *world, btSoftBodyWor
}
#endif
#include "pragma/cinematic/choreographic_scene.hpp"
#include <se_scene.hpp>

#ifdef ENABLE_DEPRECATED_PHYSICS
#include <pragma/buss_ik/Node.h>
Expand Down Expand Up @@ -631,11 +629,11 @@ int Lua::game::Client::test(lua_State *l)
auto scene = choreography::Scene::Create<choreography::Scene>();
auto channel = scene->AddChannel<choreography::Channel>("Test");

se::SceneScriptValue ssv {};
se_script::SceneScriptValue ssv {};
auto f = FileManager::OpenFile("scenes/sdk_barney1.vcd","r");//sdk_barney1.vcd","r");
if(f != nullptr)
{
if(se::read_scene(f,ssv) == se::ResultCode::Ok)
if(se_script::read_scene(f,ssv) == se_script::ResultCode::Ok)
{
for(auto &child : ssv.subValues)
{
Expand Down Expand Up @@ -761,7 +759,7 @@ int Lua::game::Client::test(lua_State *l)
}
f = nullptr;
}
//se::
//se_script::

scene->Play();
c_game->AddCallback("Think",FunctionCallback<void>::Create([scene,channel]() {
Expand Down
Loading

0 comments on commit 060e7a4

Please sign in to comment.