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 "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
#else
#define HOC_IRAM_LOG 0
#endif
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
#if defined(HOC_IRAM_LOG)
#define LOGGING(...) Log(__VA_ARGS__)
#else if defined(HOC_UART_LOG)
#elif HOC_UART_LOG
#define LOGGING(...) AMS_LOG(__VA_ARGS__)
#endif
#else
#define LOGGING(...) ((void)0)
#endif

View File

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

View File

@@ -636,7 +636,7 @@ namespace ams::ldr::hoc::pcv::mariko {
return entry;
}
#ifdef HOC_UART_LOG
#if HOC_UART_LOG
/* Redirect pcv's NvLog() calls to UART */
Result NvLogUartRedirect(u32 *ptr) {
const uintptr_t mapped_nso = reinterpret_cast<uintptr_t>(nsoStart);
@@ -803,7 +803,7 @@ namespace ams::ldr::hoc::pcv::mariko {
R_SUCCEED();
}
#ifdef HOC_UART_LOG
#if HOC_UART_LOG
/* Force GetEffectiveVerbosityLevel to return a non-zero level so all NvLog runs. */
Result ForceVerbosity(u32 *ptr) {
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 Limit", &SocVoltLimit, 1, nullptr, SocVoltLimitOfficial },
/* Debugging patches */
#ifdef HOC_UART_LOG
#if HOC_UART_LOG
{ "NvLog Redirect", &NvLogUartRedirect, 1, &NvLogVsnprintfPatternFn, 0, 0, true },
{ "Force Verbosity", &ForceVerbosity, 3, &ForceVerbosityPatternFn, 0, 0, true },
#endif