more debug feature

This commit is contained in:
souldbminersmwc committed 2026-08-13 20:03:53 -04:00
1 parent 539cd58464
commit 836e24c82e
12 files changed
+111 -23

No files matched your search

@@ -222,7 +222,7 @@ volatile CustomizeTable C = {
/* Debugging options */
/* PCV Log Verbosity */
/* -1: Nothing */
/* 0xFF: Nothing */
/* 0: Basic logging */
/* 1: More advanced logging */
/* 2: All logging excluding MMIO */
@@ -31,8 +31,6 @@
#define HOC_UART_LOG 0
#endif
#define HOC_PCV_NVLOG_PATCH 1
#include "customize.hpp"
#include "oc_log.hpp"
@@ -219,8 +219,10 @@ namespace ams::ldr::hoc::pcv::mariko {
#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>(C.pcvLogVerbosity))); /* movz w0,#level */
PATCH_OFFSET(&ptr[1], RetIns); /* ret */
if(C.pcvLogVerbosity != 0xff) {
PATCH_OFFSET(&ptr[0], AsmMakeMovzW(0, static_cast<u16>(C.pcvLogVerbosity))); /* movz w0,#level */
PATCH_OFFSET(&ptr[1], RetIns); /* ret */
}
R_SUCCEED();
}
#endif
+14 -4
View File
@@ -4,10 +4,20 @@ set -e
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIST_DIR="$ROOT_DIR/dist"
CORES="$(nproc --all)"
OVERLAY_DEBUG=0
if [[ -n "$1" ]]; then
DIST_DIR="$1"
fi
for arg in "$@"; do
case "$arg" in
-d|--debug)
OVERLAY_DEBUG=1
;;
"")
;;
*)
DIST_DIR="$arg"
;;
esac
done
echo
echo "*** Compiling hoc-clk ***"
@@ -25,7 +35,7 @@ cp -vf "$ROOT_DIR/sysmodule/toolbox.json" "$DIST_DIR/atmosphere/contents/$TITLE_
echo
echo "*** Compiling hoc-clk-overlay ***"
pushd "$ROOT_DIR/overlay"
make -j$CORES
make -j$CORES OVERLAY_DEBUG=$OVERLAY_DEBUG
popd > /dev/null
mkdir -p "$DIST_DIR/switch/.overlays"
@@ -228,6 +228,8 @@ typedef enum {
KipConfigValue_t6_tRTW_fine_tune,
KipConfigValue_t7_tWTR_fine_tune,
KipConfigValue_PcvDebugVerbosity,
KipCrc32,
HocClkConfigValue_EnumMax,
} HocClkConfigValue;
@@ -512,7 +514,7 @@ static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pr
case KipConfigValue_g_volt_e_1075200: return pretty ? "Erista GPU Volt 1075 MHz" : "g_volt_e_1075200";
case KipConfigValue_t6_tRTW_fine_tune: return pretty ? "t6 - tRTW Fine Tune" : "t6_tRTW_fine_tune";
case KipConfigValue_t7_tWTR_fine_tune: return pretty ? "t7 - tWTR Fine Tune" : "t7_tWTR_fine_tune";
case KipConfigValue_PcvDebugVerbosity: return pretty ? "Pcv Debug Verbosity" : "debug_verbosity";
case KipConfigValue_g_soc_volt_1866000: return pretty ? "Mariko SOC Volt 1866 MHz" : "g_soc_volt_1866000";
case KipConfigValue_g_soc_volt_2000000: return pretty ? "Mariko SOC Volt 2000 MHz" : "g_soc_volt_2000000";
case KipConfigValue_g_soc_volt_2133000: return pretty ? "Mariko SOC Volt 2133 MHz" : "g_soc_volt_2133000";
@@ -780,6 +782,7 @@ static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t in
case HocClkConfigValue_AulaDisplayColorPreset:
case HocClkConfigValue_AutoRamCpuCpuOCFreq:
case HocClkConfigValue_AutoRamCpuRamOCThreshold:
case KipConfigValue_PcvDebugVerbosity:
return true;
case HocClkConfigValue_BatteryChargeCurrent:
return ((input >= 1024) && (input <= 3072)) || !input;
+5
View File
@@ -26,6 +26,8 @@ DATA := data ../assets
INCLUDES := ../common/include
EXEFS_SRC := exefs_src
IS_MINIMAL := 0
OVERLAY_DEBUG ?= 0
APP_TITLE := Horizon OC
NO_ICON := 1
@@ -46,6 +48,9 @@ TARGET_VERSION := $(APP_VERSION)
# options for code generation
#---------------------------------------------------------------------------------
DEFINES := -DDISABLE_IPC -DTARGET="\"$(TARGET)\"" -DTARGET_VERSION="\"$(TARGET_VERSION)\"" -DIS_MINIMAL=$(IS_MINIMAL)
ifeq ($(OVERLAY_DEBUG),1)
DEFINES += -DOVERLAY_DEBUG
endif
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
+3 -1
View File
@@ -96,6 +96,7 @@ class AppOverlay : public tsl::Overlay {
"");
}
#ifndef OVERLAY_DEBUG
HocClkContext context = {};
if (R_SUCCEEDED(hocclkIpcGetCurrentContext(&context)) && context.rebootRequired) {
return initially<FatalGui>("Horizon OC has been updated.\n\n"
@@ -104,7 +105,8 @@ class AppOverlay : public tsl::Overlay {
"to finish applying the update.",
"");
}
#endif
return initially<MainGui>();
}
};
@@ -71,6 +71,7 @@ std::string getVersionString() {
static constexpr tsl::Color dynamicLogoRGB1 = tsl::Color(7, 15, 15, 15);
static constexpr tsl::Color dynamicLogoRGB2 = tsl::Color(2, 8, 11, 15);
static constexpr tsl::Color STATIC_TEAL = tsl::Color(7, 15, 15, 15);
const std::string name = " Horizon OC";
static s32 drawDynamicUltraText(tsl::gfx::Renderer *renderer, s32 startX, s32 y, u32 fontSize, const tsl::Color &staticColor,
@@ -131,8 +132,11 @@ void BaseGui::preDraw(tsl::gfx::Renderer *renderer) {
renderer->drawBitmap(LOGO_X, LOGO_Y_REAL - LOGO_LABEL_FONT_SIZE, LOGO_IMG_W, LOGO_IMG_H, hoc_rgba);
drawDynamicUltraText(renderer, LOGO_TEXT_X, TEXT_Y, LOGO_LABEL_FONT_SIZE, STATIC_TEAL, false);
#ifdef OVERLAY_DEBUG
static const std::string versionStr = "Version " + getVersionString() + " \"Athena (debug)\"";
#else
static const std::string versionStr = "Version " + getVersionString() + " \"Athena\"";
#endif
static constexpr tsl::Color versionColor(9, 9, 9, 15);
static constexpr s32 vx = LOGO_TEXT_X + 15;
static constexpr s32 vy = TEXT_Y + 18;
+53 -2
View File
@@ -66,7 +66,9 @@ class CpuSubmenuGui;
class GpuSubmenuGui;
class GpuCustomTableSubmenuGui;
class ExperimentalSettingsSubMenuGui;
#ifdef OVERLAY_DEBUG
class DebugSettingsSubMenuGui;
#endif
MiscGui::MiscGui() {
this->configList = new HocClkConfigValueList{};
}
@@ -735,7 +737,18 @@ void MiscGui::listUI() {
experimentalSubMenu->setValue(R_ARROW);
this->listElement->addItem(experimentalSubMenu);
}
#ifdef OVERLAY_DEBUG
tsl::elm::ListItem *debugSubMenu = new tsl::elm::ListItem("Debug Settings");
debugSubMenu->setClickListener([](u64 keys) {
if (keys & HidNpadButton_A) {
tsl::swapTo<DebugSettingsSubMenuGui>();
return true;
}
return false;
});
debugSubMenu->setValue(R_ARROW);
this->listElement->addItem(debugSubMenu);
#endif
if (!lastItemName.empty()) {
this->listElement->jumpToItem(lastItemName);
}
@@ -928,6 +941,44 @@ class ExperimentalSettingsSubMenuGui : public MiscGui {
}
};
#ifdef OVERLAY_DEBUG
class DebugSettingsSubMenuGui : public MiscGui {
public:
DebugSettingsSubMenuGui() {
}
bool handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState leftJoyStick,
HidAnalogStickState rightJoyStick) override {
if (keysDown & KEY_B) {
triggerExitFeedback();
lastItemName = "Debug Settings";
tsl::swapTo<MiscGui>();
return true;
}
return false;
}
protected:
void listUI() override {
Result rc = hocclkIpcGetConfigValues(this->configList);
if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return;
}
this->listElement->addItem(new CompactCategoryHeader("Debug Settings"));
ValueThresholds thresholdsDisabled(0, 0);
std::vector<NamedValue> VerbosityList = {
NamedValue("Disabled", 0xff), NamedValue("0", 0), NamedValue("1", 1),
NamedValue("2", 2), NamedValue("3", 3),
};
addConfigButton(KipConfigValue_PcvDebugVerbosity, "PCV Log Verbosity", ValueRange(0, 0, 1, "", 0),
"Verbosity", &thresholdsDisabled, {}, VerbosityList, false, true);
}
};
#endif
class GovernorSettingsSubMenuGui : public MiscGui {
public:
GovernorSettingsSubMenuGui() {
@@ -145,6 +145,7 @@ namespace kip {
CUST_WRITE_FIELD_BATCH(&table, t6_tRTW_fine_tune, config::GetConfigValue(KipConfigValue_t6_tRTW_fine_tune));
CUST_WRITE_FIELD_BATCH(&table, t7_tWTR_fine_tune, config::GetConfigValue(KipConfigValue_t7_tWTR_fine_tune));
CUST_WRITE_FIELD_BATCH(&table, pcvLogVerbosity, config::GetConfigValue(KipConfigValue_PcvDebugVerbosity));
if (!cust_write_table_f(fp, &table)) {
fclose(fp);
@@ -329,6 +330,8 @@ namespace kip {
configValues.values[KipConfigValue_t7_tWTR_fine_tune] = cust_get_tWTR_fine_tune(&table);
configValues.values[KipConfigValue_t6_tRTW_fine_tune] = cust_get_tRTW_fine_tune(&table);
configValues.values[KipConfigValue_PcvDebugVerbosity] = cust_get_log_verbosity(&table);
if (sizeof(HocClkConfigValueList) <= sizeof(configValues)) {
if (config::SetConfigValues(&configValues, true)) {
fileUtils::LogLine("[kip] KIP loaded. CRC32: %ld (Cust Rev %ld)", configValues.values[KipCrc32],
+7 -1
View File
@@ -99,8 +99,10 @@ namespace kip {
u32 t6_tRTW_fine_tune;
u32 t7_tWTR_fine_tune;
u32 pcvLogVerbosity;
u32 reserved[60];
u32 reserved[58];
} CustomizeTable;
#define CUST_MAGIC "CUST"
@@ -505,6 +507,10 @@ namespace kip {
return CUST_GET_FIELD(t, t7_tWTR_fine_tune);
}
static inline u32 cust_get_log_verbosity(const CustomizeTable *t) {
return CUST_GET_FIELD(t, pcvLogVerbosity);
}
static inline u32 cust_get_read_latency_1333(const CustomizeTable *t) {
return CUST_GET_FIELD(t, readLatency1333);
}