Great Geode cleanup project

- fix filesystem and fmt paths
 - replace uses of CCString::createWithFormat with fmt::format
This commit is contained in:
HJfod 2022-11-28 18:32:25 +02:00
parent e1b6b97baf
commit 09ae7ec942
7 changed files with 19 additions and 15 deletions

View file

@ -4,8 +4,8 @@ project(Codegen LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
add_subdirectory(Broma)
add_subdirectory(../fmt ${CMAKE_CURRENT_BINARY_DIR}/fmt)
add_subdirectory(../filesystem ${CMAKE_CURRENT_BINARY_DIR}/fs)
add_subdirectory(../loader/include/Geode/external/fmt ${CMAKE_CURRENT_BINARY_DIR}/fmt)
add_subdirectory(../loader/include/Geode/external/filesystem ${CMAKE_CURRENT_BINARY_DIR}/fs)
file(GLOB SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp

View file

@ -1,6 +1,6 @@
#include <Windows.h>
#include <iostream>
#include "../../../filesystem/fs/filesystem.hpp"
#include <fs/filesystem.hpp>
void showError(std::string const& error) {
MessageBoxA(nullptr, error.c_str(), "Error Loading Geode", MB_ICONERROR);

View file

@ -39,3 +39,4 @@ set_target_properties(Bootstrapper PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
ARCHIVE_OUTPUT_DIRECTORY "${GEODE_BIN_PATH}/nightly"
)
target_link_libraries(Bootstrapper PUBLIC filesystem)

View file

@ -4,6 +4,7 @@
USE_GEODE_NAMESPACE();
#include <Geode/modify/LoadingLayer.hpp>
#include <fmt/format.h>
struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
bool m_updatingResources;
@ -18,8 +19,7 @@ struct CustomLoadingLayer : Modify<CustomLoadingLayer, LoadingLayer> {
auto count = Loader::get()->getAllMods().size();
auto label = CCLabelBMFont::create(
CCString::createWithFormat("Geode: Loaded %lu mods", static_cast<unsigned long>(count))
->getCString(),
fmt::format("Geode: Loaded {} mods", count).c_str(),
"goldFont.fnt"
);
label->setPosition(winSize.width / 2, 30.f);

View file

@ -1,6 +1,10 @@
#include <Geode/DefaultInclude.hpp>
#ifdef GEODE_IS_WINDOWS
#include <Geode/loader/Mod.hpp>
#include <Geode/modify/InternalMacros.hpp>
#include <Geode/modify/InternalMacros.hpp>
#include <Geode/loader/Mod.hpp>
USE_GEODE_NAMESPACE();
using geode::core::meta::x86::Thiscall;
@ -15,12 +19,11 @@ static void __cdecl fixedErrorHandler(int code, char const* description) {
log::critical("GLFW Error {}: {}", code, description);
MessageBoxA(
nullptr,
CCString::createWithFormat(
"GLFWError #%d: %s\nPlease contact the "
fmt::format(
"GLFWError #{}: {}\nPlease contact the "
"Geode Development Team for more information.",
code, description
)
->getCString(),
).c_str(),
"OpenGL Error", MB_ICONERROR
);
}

View file

@ -758,7 +758,7 @@ CCNode* ModInfoLayer::createLogoSpr(Mod* mod, CCSize const& size) {
}
else {
spr = CCSprite::create(
CCString::createWithFormat("%s/logo.png", mod->getID().c_str())->getCString()
fmt::format("{}/logo.png", mod->getID()).c_str()
);
}
if (!spr) spr = CCSprite::createWithSpriteFrameName("no-logo.png"_spr);

View file

@ -1,12 +1,12 @@
#include <Geode/ui/BasedButtonSprite.hpp>
#include <Geode/loader/Mod.hpp>
USE_GEODE_NAMESPACE();
bool BasedButtonSprite::init(CCNode* ontop, int type, int size, int color) {
if (!CCSprite::initWithSpriteFrameName(Mod::get()->expandSpriteName(
CCString::createWithFormat("GEODE_blank%02d_%02d_%02d.png", type, size, color)
->getCString()
)))
fmt::format("GEODE_blank%02d_%02d_%02d.png", type, size, color).c_str()
)))
return false;
m_type = type;