mirror of
https://github.com/redstrate/Novus.git
synced 2025-06-07 13:47:45 +00:00
Remove fmt dependency
It's no longer used, and replaced with physis functions where formatting was needed.
This commit is contained in:
parent
633e283abd
commit
2eccb10eda
12 changed files with 23 additions and 102 deletions
|
@ -5,35 +5,16 @@ cmake_minimum_required(VERSION 3.25)
|
|||
project(Novus)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
find_package(Qt5 COMPONENTS Core Widgets Concurrent CONFIG REQUIRED)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
add_subdirectory(extern)
|
||||
|
||||
find_package(fmt QUIET)
|
||||
|
||||
if(TARGET fmt::fmt)
|
||||
message("Using system library for fmt")
|
||||
|
||||
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
||||
else()
|
||||
message("Using built-in fmt")
|
||||
|
||||
FetchContent_Declare(
|
||||
fmt
|
||||
GIT_REPOSITORY https://github.com/fmtlib/fmt
|
||||
GIT_TAG master
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(fmt)
|
||||
|
||||
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
||||
endif()
|
||||
|
||||
# macos
|
||||
if(APPLE)
|
||||
set(USE_STANDALONE_WINDOW TRUE)
|
||||
|
@ -44,7 +25,7 @@ add_subdirectory(exdviewer)
|
|||
add_subdirectory(armoury)
|
||||
add_subdirectory(argcracker)
|
||||
add_subdirectory(explorer)
|
||||
add_subdirectory(bonedecomp)
|
||||
#add_subdirectory(bonedecomp) # not yet ported to physis
|
||||
add_subdirectory(parts)
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(mdlviewer)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <QString>
|
||||
#include <fmt/core.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include <physis.hpp>
|
||||
|
||||
|
@ -74,13 +74,13 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
uint32_t bottom = TickCount() - tickRange;
|
||||
|
||||
fmt::print("Beginning to crack {}...\n", toCrack);
|
||||
qInfo() << "Beginning to crack" << toCrack << "...";
|
||||
|
||||
for(uint32_t i = bottom; i < TickCount(); i++) {
|
||||
QString decrypted = decryptGameArg(i, toCrack);
|
||||
|
||||
if(decrypted.contains(knownArg)) {
|
||||
fmt::print("Decrypted successfully: {}\n", decrypted.toStdString());
|
||||
qInfo() << "Decrypted successfully:" << decrypted;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "mdlpart.h"
|
||||
#include <QComboBox>
|
||||
#include <QWidget>
|
||||
#include <fmt/format.h>
|
||||
#include <physis.hpp>
|
||||
|
||||
struct ModelInfo {
|
||||
|
@ -20,13 +19,8 @@ struct GearInfo {
|
|||
Slot slot;
|
||||
ModelInfo modelInfo;
|
||||
|
||||
std::string getMtrlPath(int raceID) {
|
||||
return fmt::format(
|
||||
"chara/equipment/e{gearId:04d}/material/v{gearVersion:04d}/mt_c{raceId:04d}e{gearId:04d}_{slot}_a.mtrl",
|
||||
fmt::arg("gearId", modelInfo.primaryID),
|
||||
fmt::arg("gearVersion", modelInfo.gearVersion),
|
||||
fmt::arg("raceId", raceID),
|
||||
fmt::arg("slot", physis_get_slot_name(slot)));
|
||||
std::string getMtrlPath(const std::string_view material_name) const {
|
||||
return physis_build_gear_material_path(modelInfo.primaryID, modelInfo.gearVersion, material_name.data());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include <QComboBox>
|
||||
#include <QMainWindow>
|
||||
#include <fmt/format.h>
|
||||
#include <physis.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
|
@ -227,24 +227,8 @@ void GearView::reloadModel() {
|
|||
for (int i = 0; i < mdl.num_material_names; i++) {
|
||||
const char* material_name = mdl.material_names[i];
|
||||
|
||||
// std::string mtrl_path =
|
||||
// loadedGear.gearInfo->getMtrlPath(201);
|
||||
std::string mtrl_path = fmt::format(
|
||||
"chara/equipment/e{gearId:04d}/material/"
|
||||
"v{gearVersion:04d}{}",
|
||||
material_name,
|
||||
fmt::arg("gearId", gear.modelInfo.primaryID),
|
||||
fmt::arg("gearVersion", gear.modelInfo.gearVersion));
|
||||
|
||||
int bodyCode = 1;
|
||||
|
||||
// skin path
|
||||
std::string skinmtrl_path = fmt::format(
|
||||
"chara/human/c{raceCode:04d}/obj/body/b{bodyCode:04d}/"
|
||||
"material/v0001{}",
|
||||
material_name,
|
||||
fmt::arg("raceCode", physis_get_race_code(fallbackRace, fallbackSubrace, currentGender)),
|
||||
fmt::arg("bodyCode", bodyCode));
|
||||
const std::string mtrl_path = gear.getMtrlPath(material_name);
|
||||
const std::string skinmtrl_path = physis_build_skin_material_path(physis_get_race_code(fallbackRace, fallbackSubrace, currentGender), 1, material_name);
|
||||
|
||||
if (physis_gamedata_exists(data, mtrl_path.c_str())) {
|
||||
auto mat = physis_material_parse(cache.lookupFile(mtrl_path.c_str()));
|
||||
|
@ -273,15 +257,7 @@ void GearView::reloadModel() {
|
|||
std::vector<physis_Material> materials;
|
||||
for (int i = 0; i < mdl.num_material_names; i++) {
|
||||
const char* material_name = mdl.material_names[i];
|
||||
|
||||
std::string skinmtrl_path = fmt::format(
|
||||
"chara/human/c{raceCode:04d}/obj/face/f{bodyCode:04d}/"
|
||||
"material{}",
|
||||
material_name,
|
||||
fmt::arg("raceCode", physis_get_race_code(currentRace, currentSubrace, currentGender)),
|
||||
fmt::arg("bodyCode", *face));
|
||||
|
||||
fmt::print("oops: {}", skinmtrl_path);
|
||||
const std::string skinmtrl_path = physis_build_face_material_path(physis_get_race_code(currentRace, currentSubrace, currentGender), *face, material_name);
|
||||
|
||||
if (physis_gamedata_exists(data, skinmtrl_path.c_str())) {
|
||||
auto mat = physis_material_parse(cache.lookupFile(skinmtrl_path.c_str()));
|
||||
|
@ -303,15 +279,7 @@ void GearView::reloadModel() {
|
|||
std::vector<physis_Material> materials;
|
||||
for (int i = 0; i < mdl.num_material_names; i++) {
|
||||
const char* material_name = mdl.material_names[i];
|
||||
|
||||
std::string skinmtrl_path = fmt::format(
|
||||
"chara/human/c{raceCode:04d}/obj/hair/h{bodyCode:04d}/"
|
||||
"material/v0001{}",
|
||||
material_name,
|
||||
fmt::arg("raceCode", physis_get_race_code(currentRace, currentSubrace, currentGender)),
|
||||
fmt::arg("bodyCode", *hair));
|
||||
|
||||
fmt::print("oops: {}", skinmtrl_path);
|
||||
const std::string skinmtrl_path = physis_build_hair_material_path(physis_get_race_code(currentRace, currentSubrace, currentGender), *hair, material_name);
|
||||
|
||||
if (physis_gamedata_exists(data, skinmtrl_path.c_str())) {
|
||||
auto mat = physis_material_parse(cache.lookupFile(skinmtrl_path.c_str()));
|
||||
|
@ -333,15 +301,7 @@ void GearView::reloadModel() {
|
|||
std::vector<physis_Material> materials;
|
||||
for (int i = 0; i < mdl.num_material_names; i++) {
|
||||
const char* material_name = mdl.material_names[i];
|
||||
|
||||
std::string skinmtrl_path = fmt::format(
|
||||
"chara/human/c{raceCode:04d}/obj/ear/e{bodyCode:04d}/"
|
||||
"material/v0001{}",
|
||||
material_name,
|
||||
fmt::arg("raceCode", physis_get_race_code(currentRace, currentSubrace, currentGender)),
|
||||
fmt::arg("bodyCode", *ear));
|
||||
|
||||
fmt::print("oops: {}", skinmtrl_path);
|
||||
const std::string skinmtrl_path = physis_build_ear_material_path(physis_get_race_code(currentRace, currentSubrace, currentGender), *ear, material_name);
|
||||
|
||||
if (physis_gamedata_exists(data, skinmtrl_path.c_str())) {
|
||||
auto mat = physis_material_parse(cache.lookupFile(skinmtrl_path.c_str()));
|
||||
|
@ -361,13 +321,7 @@ void GearView::reloadModel() {
|
|||
auto mdl = physis_mdl_parse(mdl_data.size, mdl_data.data);
|
||||
|
||||
const char* material_name = mdl.material_names[0];
|
||||
|
||||
std::string skinmtrl_path = fmt::format(
|
||||
"chara/human/c{raceCode:04d}/obj/tail/t{bodyCode:04d}/"
|
||||
"material/v0001{}",
|
||||
material_name,
|
||||
fmt::arg("raceCode", physis_get_race_code(currentRace, currentSubrace, currentGender)),
|
||||
fmt::arg("bodyCode", *tail));
|
||||
const std::string skinmtrl_path = physis_build_tail_material_path(physis_get_race_code(currentRace, currentSubrace, currentGender), *tail, material_name);
|
||||
|
||||
if (physis_gamedata_exists(data, skinmtrl_path.c_str())) {
|
||||
auto mat = physis_material_parse(cache.lookupFile(skinmtrl_path.c_str()));
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QProcess>
|
||||
#include <fmt/format.h>
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
#include "gamedata.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <QMenuBar>
|
||||
#include <QTableWidget>
|
||||
#include <QUrl>
|
||||
#include <fmt/core.h>
|
||||
#include <physis.hpp>
|
||||
|
||||
#include "exdpart.h"
|
||||
|
|
|
@ -31,9 +31,9 @@ FileTreeWindow::FileTreeWindow(GameData* data, QWidget* parent) : QWidget(parent
|
|||
addPath("exd/" + QString(nameLowercase.c_str()) + ".exh");
|
||||
|
||||
auto exh = physis_gamedata_read_excel_sheet_header(data, sheetName);
|
||||
for (int j = 0; j < exh.page_count; j++) {
|
||||
for (int z = 0; z < exh.language_count; z++) {
|
||||
std::string path = physis_gamedata_get_exd_filename(nameLowercase.c_str(), &exh, exh.languages[z], j);
|
||||
for (int j = 0; j < exh->page_count; j++) {
|
||||
for (int z = 0; z < exh->language_count; z++) {
|
||||
std::string path = physis_gamedata_get_exd_filename(nameLowercase.c_str(), exh, exh->languages[z], j);
|
||||
|
||||
addPath(("exd/" + path).c_str());
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <QMenuBar>
|
||||
#include <QTableWidget>
|
||||
#include <QUrl>
|
||||
#include <fmt/core.h>
|
||||
#include <physis.hpp>
|
||||
|
||||
#include "aboutwindow.h"
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <QVulkanInstance>
|
||||
#include <QVulkanWindow>
|
||||
#include <QWindow>
|
||||
#include <fmt/core.h>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtc/type_ptr.inl>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ endif()
|
|||
|
||||
add_library(renderer src/renderer.cpp ${EXTRA_SRC})
|
||||
target_include_directories(renderer PUBLIC include)
|
||||
target_link_libraries(renderer PUBLIC Vulkan::Vulkan fmt::fmt physis z glm::glm ${EXTRA_LIBRARIES})
|
||||
target_link_libraries(renderer PUBLIC Qt5::Core Vulkan::Vulkan physis z ${EXTRA_LIBRARIES})
|
||||
target_compile_definitions(renderer PUBLIC GLM_FORCE_RADIANS GLM_FORCE_DEPTH_ZERO_TO_ONE)
|
||||
|
||||
if(USE_STANDALONE_WINDOW)
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "renderer.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <array>
|
||||
#include <fmt/core.h>
|
||||
#include <fstream>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtx/transform.hpp>
|
||||
|
@ -33,8 +33,7 @@ DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
|||
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
||||
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
|
||||
void* pUserData) {
|
||||
|
||||
fmt::print("{}\n", pCallbackData->pMessage);
|
||||
qInfo() << pCallbackData->pMessage;
|
||||
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
@ -199,7 +198,7 @@ Renderer::Renderer() {
|
|||
|
||||
createDummyTexture();
|
||||
|
||||
fmt::print("Initialized renderer!\n");
|
||||
qInfo() << "Initialized renderer!";
|
||||
}
|
||||
|
||||
bool Renderer::initSwapchain(VkSurfaceKHR surface, int width, int height) {
|
||||
|
@ -437,7 +436,6 @@ void Renderer::render(std::vector<RenderModel> models) {
|
|||
VK_NULL_HANDLE, &imageIndex);
|
||||
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
fmt::print("error out of date\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -499,7 +497,6 @@ void Renderer::render(std::vector<RenderModel> models) {
|
|||
|
||||
const auto h = hash(model, material);
|
||||
if(!cachedDescriptors.count(h)) {
|
||||
fmt::print("Caching descriptor for hash {}\n", h);
|
||||
if (auto descriptor = createDescriptorFor(model, material); descriptor != VK_NULL_HANDLE) {
|
||||
cachedDescriptors[h] = descriptor;
|
||||
} else {
|
||||
|
@ -840,7 +837,7 @@ VkShaderModule Renderer::loadShaderFromDisk(const std::string_view path) {
|
|||
std::ifstream file(path.data(), std::ios::ate | std::ios::binary);
|
||||
|
||||
if (!file.is_open()) {
|
||||
throw std::runtime_error(fmt::format("failed to open shader file {}", path));
|
||||
qFatal("Failed to open shader file: %s", path.data());
|
||||
}
|
||||
|
||||
size_t fileSize = (size_t) file.tellg();
|
||||
|
@ -1187,7 +1184,7 @@ VkDescriptorSet Renderer::createDescriptorFor(const RenderModel& model, const Re
|
|||
|
||||
vkAllocateDescriptorSets(device, &allocateInfo, &set);
|
||||
if (set == VK_NULL_HANDLE) {
|
||||
fmt::print("Failed to create descriptor set!");
|
||||
qFatal("Failed to create descriptor set!");
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue