ldr: fix pre processor hell

This commit is contained in:
Lightos1
2026-07-26 21:52:24 +02:00
parent 8c54df039f
commit bfb2009dab
3 changed files with 7 additions and 8 deletions

View File

@@ -28,18 +28,17 @@
#include "customize.hpp" #include "customize.hpp"
#include "oc_log.hpp" #include "oc_log.hpp"
#if ((!defined(HOC_UART_LOG)) && (defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING))) #if (!HOC_UART_LOG) && (defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING))
#define HOC_IRAM_LOG 1 #define HOC_IRAM_LOG 1
#else
#define HOC_IRAM_LOG 0
#endif #endif
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING) #if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
#if defined(HOC_IRAM_LOG) #if defined(HOC_IRAM_LOG)
#define LOGGING(...) Log(__VA_ARGS__) #define LOGGING(...) Log(__VA_ARGS__)
#else if defined(HOC_UART_LOG) #elif HOC_UART_LOG
#define LOGGING(...) AMS_LOG(__VA_ARGS__) #define LOGGING(...) AMS_LOG(__VA_ARGS__)
#endif #endif
#else #else
#define LOGGING(...) ((void)0) #define LOGGING(...) ((void)0)
#endif #endif

View File

@@ -70,7 +70,7 @@ namespace ams::ldr::hoc {
return rc; return rc;
} }
#ifdef HOC_UART_LOG #if HOC_UART_LOG
/* Remove this? */ /* Remove this? */
void UartLog(const char *fmt, ...) { void UartLog(const char *fmt, ...) {
char line[256]; char line[256];

View File

@@ -636,7 +636,7 @@ namespace ams::ldr::hoc::pcv::mariko {
return entry; return entry;
} }
#ifdef HOC_UART_LOG #if HOC_UART_LOG
/* Redirect pcv's NvLog() calls to UART */ /* Redirect pcv's NvLog() calls to UART */
Result NvLogUartRedirect(u32 *ptr) { Result NvLogUartRedirect(u32 *ptr) {
const uintptr_t mapped_nso = reinterpret_cast<uintptr_t>(nsoStart); const uintptr_t mapped_nso = reinterpret_cast<uintptr_t>(nsoStart);
@@ -803,7 +803,7 @@ namespace ams::ldr::hoc::pcv::mariko {
R_SUCCEED(); R_SUCCEED();
} }
#ifdef HOC_UART_LOG #if HOC_UART_LOG
/* Force GetEffectiveVerbosityLevel to return a non-zero level so all NvLog runs. */ /* Force GetEffectiveVerbosityLevel to return a non-zero level so all NvLog runs. */
Result ForceVerbosity(u32 *ptr) { Result ForceVerbosity(u32 *ptr) {
PATCH_OFFSET(&ptr[0], AsmMakeMovzW(0, static_cast<u16>(HOC_PCV_FORCE_VERBOSITY))); /* movz w0,#level */ PATCH_OFFSET(&ptr[0], AsmMakeMovzW(0, static_cast<u16>(HOC_PCV_FORCE_VERBOSITY))); /* movz w0,#level */
@@ -1517,7 +1517,7 @@ namespace ams::ldr::hoc::pcv::mariko {
{ "SOC Volt Asm", &SocVoltAsm, 1, &SocVoltPatternFn }, { "SOC Volt Asm", &SocVoltAsm, 1, &SocVoltPatternFn },
{ "SOC Volt Limit", &SocVoltLimit, 1, nullptr, SocVoltLimitOfficial }, { "SOC Volt Limit", &SocVoltLimit, 1, nullptr, SocVoltLimitOfficial },
/* Debugging patches */ /* Debugging patches */
#ifdef HOC_UART_LOG #if HOC_UART_LOG
{ "NvLog Redirect", &NvLogUartRedirect, 1, &NvLogVsnprintfPatternFn, 0, 0, true }, { "NvLog Redirect", &NvLogUartRedirect, 1, &NvLogVsnprintfPatternFn, 0, 0, true },
{ "Force Verbosity", &ForceVerbosity, 3, &ForceVerbosityPatternFn, 0, 0, true }, { "Force Verbosity", &ForceVerbosity, 3, &ForceVerbosityPatternFn, 0, 0, true },
#endif #endif