Merge pull request #5927 from Malkierian/copper-dev-2

Copper -> Develop 11/6
This commit is contained in:
Malkierian
2025-11-06 18:29:25 -07:00
committed by GitHub
11 changed files with 54 additions and 17 deletions

20
CMake/logging.cmake Normal file
View File

@@ -0,0 +1,20 @@
set(SPDLOG_LEVEL_TRACE 0)
set(SPDLOG_LEVEL_DEBUG 1)
set(SPDLOG_LEVEL_INFO 2)
set(SPDLOG_LEVEL_WARN 3)
set(SPDLOG_LEVEL_ERROR 4)
set(SPDLOG_LEVEL_CRITICAL 5)
set(SPDLOG_LEVEL_OFF 6)
set(LOG_LEVELS "SPDLOG_LEVEL_TRACE;SPDLOG_LEVEL_DEBUG;SPDLOG_LEVEL_INFO;SPDLOG_LEVEL_WARN;SPDLOG_LEVEL_ERROR;SPDLOG_LEVEL_CRITICAL;SPDLOG_LEVEL_OFF")
set(LOG_LEVEL SPDLOG_LEVEL_TRACE CACHE STRING "The spdlog level that prints will be logged out. Overridden to SPDLOG_LEVEL_ERROR on Release builds.")
set_property(CACHE LOG_LEVEL PROPERTY STRINGS ${LOG_LEVELS})
if(NOT LOG_LEVEL IN_LIST LOG_LEVELS)
message(FATAL_ERROR "LOG_LEVEL must be one of ${LOG_LEVELS}")
endif()
set(SPDLOG_ACTIVE_LEVEL ${${LOG_LEVEL}})
set(LOG_LEVEL_GAME_PRINTS ${SPDLOG_LEVEL_OFF})
add_compile_definitions(
LOG_LEVEL_GAME_PRINTS=${LOG_LEVEL_GAME_PRINTS}
SPDLOG_ACTIVE_LEVEL=${SPDLOG_ACTIVE_LEVEL}
)

View File

@@ -6,9 +6,10 @@ set(CMAKE_C_STANDARD 23 CACHE STRING "The C standard to use")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")
project(Ship VERSION 9.1.0 LANGUAGES C CXX)
project(Ship VERSION 9.1.1 LANGUAGES C CXX)
include(CMake/soh-cvars.cmake)
include(CMake/lus-cvars.cmake)
include(CMake/logging.cmake)
option(SUPPRESS_WARNINGS "Suppress warnings in LUS and src (decomp)" ON)
if(SUPPRESS_WARNINGS)

View File

@@ -16,6 +16,7 @@
"ClimbSpeed": 3,
"CrawlSpeed": 2,
"CreditsFix": 1,
"CuccosToReturn": 1,
"CustomizeFishing": 1,
"CustomizeFrogsOcarinaGame": 1,
"CustomizeOcarinaGame": 1,

View File

@@ -13,8 +13,8 @@ extern "C"
#include <libultraship/log/luslog.h>
#include <soh/Enhancements/item-tables/ItemTableTypes.h>
#if defined(INCLUDE_GAME_PRINTF) && defined(_DEBUG)
#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, ##__VA_ARGS__)
#if (LOG_LEVEL_GAME_PRINTS >= SPDLOG_ACTIVE_LEVEL) && !(LOG_LEVEL_GAME_PRINTS >= 6)
#define osSyncPrintf(...) lusprintf(__FILE__, __LINE__, LOG_LEVEL_GAME_PRINTS , __VA_ARGS__)
#else
#define osSyncPrintf(fmt, ...) osSyncPrintfUnused(fmt, ##__VA_ARGS__)
#endif

View File

@@ -55,6 +55,7 @@ void SetEnabledModsCVarValue() {
}
CVarSetString(CVAR_ENABLED_MODS_NAME, s.c_str());
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
}
void AfterModChange() {
@@ -128,8 +129,9 @@ void UpdateModFiles(bool init = false, bool reset = false) {
disabledModFiles.clear();
unsupportedFiles.clear();
filePaths.clear();
std::string modsPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName);
bool changed = false;
std::string modsPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName);
std::map<std::string, std::string> tempMods;
if (modsPath.length() > 0 && std::filesystem::exists(modsPath)) {
std::vector<std::filesystem::path> enabledFiles;
if (std::filesystem::is_directory(modsPath)) {
@@ -147,11 +149,17 @@ void UpdateModFiles(bool init = false, bool reset = false) {
bool enabled =
std::find(enabledModFiles.begin(), enabledModFiles.end(), filename) != enabledModFiles.end();
if (!enabled) {
enabledModFiles.push_back(filename);
changed = true;
tempMods.emplace(p.path().lexically_normal().generic_string(), filename);
}
filePaths.emplace(filename, p.path());
}
if (tempMods.size() > 0) {
changed = true;
for (auto [path, name] : tempMods) {
enabledModFiles.push_back(name);
}
tempMods.clear();
}
if (init) {
std::vector<std::string> enabledTemp(enabledModFiles);
for (std::string mod : enabledTemp) {
@@ -159,13 +167,14 @@ void UpdateModFiles(bool init = false, bool reset = false) {
GetArchiveManager()->AddArchive(filePaths.at(mod).generic_string());
} else {
enabledModFiles.erase(std::find(enabledModFiles.begin(), enabledModFiles.end(), mod));
changed = true;
}
}
}
}
}
if (changed) {
SetEnabledModsCVarValue();
if (changed) {
SetEnabledModsCVarValue();
}
}
}

View File

@@ -186,7 +186,6 @@ void Context::GenerateLocationPool() {
location.GetRandomizerCheck() == RC_LW_DEKU_SCRUB_NEAR_BRIDGE ||
location.GetRandomizerCheck() == RC_HF_DEKU_SCRUB_GROTTO)) ||
(location.GetRCType() == RCTYPE_ADULT_TRADE && mOptions[RSK_SHUFFLE_ADULT_TRADE].Is(RO_GENERIC_OFF)) ||
(location.GetRCType() == RCTYPE_SONG_LOCATION && mOptions[RSK_SHUFFLE_SONGS].Is(RO_SONG_SHUFFLE_OFF)) ||
(location.GetRCType() == RCTYPE_COW && mOptions[RSK_SHUFFLE_COWS].Is(RO_GENERIC_OFF)) ||
(location.GetRandomizerCheck() == RC_LH_HYRULE_LOACH &&
mOptions[RSK_FISHSANITY].IsNot(RO_FISHSANITY_HYRULE_LOACH)) ||

View File

@@ -2187,7 +2187,8 @@ void RandomizerOnActorInitHandler(void* actorRef) {
}
// Turn MQ switch into toggle
if (actor->id == ACTOR_OBJ_SWITCH && gPlayState->sceneNum == SCENE_BOTTOM_OF_THE_WELL && (actor->params & 7) == 3) {
if (actor->id == ACTOR_OBJ_SWITCH && gPlayState->sceneNum == SCENE_BOTTOM_OF_THE_WELL &&
(actor->params & 0x3f07) == 0x303) {
auto dungeon =
OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(SCENE_BOTTOM_OF_THE_WELL);
if (dungeon->IsMQ()) {

View File

@@ -32,7 +32,7 @@ void RegionTable_Init_ZoraRiver() {
EventAccess(LOGIC_GOSSIP_STONE_FAIRY, []{return logic->CallGossipFairy();}),
EventAccess(LOGIC_BEAN_PLANT_FAIRY, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}),
EventAccess(LOGIC_BUTTERFLY_FAIRY, []{return logic->CanUse(RG_STICKS);}),
EventAccess(LOGIC_BUG_SHRUB, []{return logic->CanCutShrubs();}),
EventAccess(LOGIC_BUG_SHRUB, []{return logic->CanCutShrubs() && (logic->IsChild || logic->CanUse(RG_HOVER_BOOTS) || ctx->GetTrickOption(RT_ZR_LOWER));}),
}, {
//Locations
LOCATION(RC_ZR_MAGIC_BEAN_SALESMAN, logic->IsChild),
@@ -61,7 +61,7 @@ void RegionTable_Init_ZoraRiver() {
LOCATION(RC_ZR_BENEATH_WATERFALL_RIGHT_RUPEE, logic->IsAdult && (logic->HasItem(RG_BRONZE_SCALE) || logic->CanUse(RG_IRON_BOOTS) || logic->CanUse(RG_BOOMERANG))),
LOCATION(RC_ZR_NEAR_GROTTOS_GOSSIP_STONE, true),
LOCATION(RC_ZR_NEAR_DOMAIN_GOSSIP_STONE, true),
LOCATION(RC_ZR_NEAR_FREESTANDING_POH_GRASS, logic->CanCutShrubs()),
LOCATION(RC_ZR_NEAR_FREESTANDING_POH_GRASS, (logic->CanCutShrubs() && (logic->IsChild || logic->CanUse(RG_HOVER_BOOTS) || ctx->GetTrickOption(RT_ZR_LOWER))) || logic->CanUse(RG_BOOMERANG)),
}, {
//Exits
Entrance(RR_ZR_FRONT, []{return true;}),

View File

@@ -225,7 +225,7 @@ StaticData::PopulateTranslationMap(std::unordered_map<uint32_t, CustomMessage> i
if (output.contains(string)) {
if (output[string] != key) {
// RANDOTODO should this cause an error of some kind?
SPDLOG_DEBUG("\tREPEATED STRING IN " + message.GetEnglish(MF_CLEAN) + "\n\n");
SPDLOG_DEBUG("REPEATED STRING IN " + message.GetEnglish(MF_CLEAN));
}
} else {
output[string] = key;
@@ -244,7 +244,7 @@ StaticData::PopulateTranslationMap(std::unordered_map<uint32_t, RandomizerHintTe
if (output.contains(string)) {
if (output[string] != key) {
// RANDOTODO should this cause an error of some kind?
SPDLOG_DEBUG("\tREPEATED STRING WITH " + string + "\n\n");
SPDLOG_DEBUG("REPEATED STRING WITH " + string);
}
} else {
output[string] = key;

View File

@@ -12,6 +12,7 @@
#include <fast/resource/type/DisplayList.h>
#include <ship/window/Window.h>
#include <soh/GameVersions.h>
#include <spdlog/sinks/rotating_file_sink.h>
#include "Enhancements/gameconsole.h"
#ifdef _WIN32
@@ -319,8 +320,13 @@ void OTRGlobals::Initialize() {
context->InitCrashHandler();
context->InitConsole();
#if (_DEBUG)
int defaultLogLevel = 0;
#else
int defaultLogLevel = 2;
#endif
Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), 1));
(spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), defaultLogLevel));
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
auto sohInputEditorWindow =