diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp index 06f36687..e67f5a30 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp @@ -337,7 +337,7 @@ volatile CustomizeTable C = { { 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40 } }, { 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110 } }, { 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313 } }, - { 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559 } }, + // { 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559 } }, // Appending table //{ 1305600, {}, { 1374130, -13725, -859, 0, 4442, 576 } }, }, diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp index a0834890..7a960a65 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp @@ -95,7 +95,9 @@ namespace ams::ldr::oc::pcv {}, }; - constexpr u32 GpuClkPllLimit = 1300'000'000; + constexpr u32 GpuClkPllLimit = 2600'000; + + constexpr u32 GpuClkMax = 1300'000'000; /* GPU Max Clock asm Pattern: * diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp index e4817fa4..1166776b 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp @@ -293,6 +293,7 @@ void MemMtcTableAutoAdjust(EristaMtcTable *table) { {"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0xFFEAD0FF }, {"GPU Freq Table", GpuFreqCvbTable, 1, nullptr, GpuCvbDefaultMaxFreq}, {"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn}, + {"GPU Volt Thermal", &GpuFreqMaxAsm, 1, &GpuMaxClockPatternFn}, {"GPU Freq PLL", &GpuFreqPllLimit, 1, nullptr, GpuClkPllLimit}, {"MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit}, {"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit}, diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp index fc182f7b..0c40dc66 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp @@ -140,12 +140,12 @@ namespace ams::ldr::oc::pcv::mariko PATCH_OFFSET(&(entry->tune1_low), 0x021107FF); PATCH_OFFSET(&(entry->tune1_high), 0x026617FF); break; - case 8: - PATCH_OFFSET(&(entry->tune0_low), 0x0000FFFF); // EOS UV6 - PATCH_OFFSET(&(entry->tune0_high), 0x0000FFFF); - PATCH_OFFSET(&(entry->tune1_low), 0x021107FF); - PATCH_OFFSET(&(entry->tune1_high), 0x028817FF); - break; + // case 8: + // PATCH_OFFSET(&(entry->tune0_low), 0x0000FFFF); // EOS UV6 + // PATCH_OFFSET(&(entry->tune0_high), 0x0000FFFF); + // PATCH_OFFSET(&(entry->tune1_low), 0x021107FF); + // PATCH_OFFSET(&(entry->tune1_high), 0x028817FF); + // break; default: break; } @@ -191,16 +191,13 @@ namespace ams::ldr::oc::pcv::mariko } Result GpuFreqPllLimit(u32 *ptr) { - clk_pll_param *entry = reinterpret_cast(ptr); + int UPPER_GPU_FREQ = -1; // uncap the gpu frequency + PATCH_OFFSET(ptr, UPPER_GPU_FREQ); + R_SUCCEED(); + } - // All zero except for freq - for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) { - R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry()); - } - - // Double the max clk simply - u32 max_clk = entry->freq * 2; - entry->freq = max_clk; + Result GpuFreqMax(u32 *ptr) { + PATCH_OFFSET(ptr, 3600000); R_SUCCEED(); } @@ -531,7 +528,8 @@ namespace ams::ldr::oc::pcv::mariko {"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0x0000FFCF}, {"GPU Freq Table", GpuFreqCvbTable, 1, nullptr, GpuCvbDefaultMaxFreq}, {"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn}, - {"GPU Freq PLL", &GpuFreqPllLimit, 0, nullptr, GpuClkPllLimit}, + {"GPU Freq Max (Patch 1)", &GpuFreqMax, 1, nullptr, GpuClkMax}, + {"GPU Freq PLL (Patch 2)", &GpuFreqPllLimit, 0, nullptr, GpuClkPllLimit}, {"MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit}, {"MEM Freq Dvb", &MemFreqDvbTable, 1, nullptr, EmcClkOSLimit}, {"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit}, diff --git a/Source/sys-clk/build.sh b/Source/sys-clk/build.sh index e429231b..9b4a2df5 100644 --- a/Source/sys-clk/build.sh +++ b/Source/sys-clk/build.sh @@ -20,7 +20,7 @@ make -j$CORES popd > /dev/null mkdir -p "$DIST_DIR/atmosphere/contents/$TITLE_ID/flags" -cp -vf "$ROOT_DIR/sysmodule/out/sys-clk.nsp" "$DIST_DIR/atmosphere/contents/$TITLE_ID/exefs.nsp" +cp -vf "$ROOT_DIR/sysmodule/out/horizon-oc.nsp" "$DIST_DIR/atmosphere/contents/$TITLE_ID/exefs.nsp" >"$DIST_DIR/atmosphere/contents/$TITLE_ID/flags/boot2.flag" cp -vf "$ROOT_DIR/sysmodule/toolbox.json" "$DIST_DIR/atmosphere/contents/$TITLE_ID/toolbox.json" echo "*** manager ***" diff --git a/Source/sys-clk/common/include/sysclk/clock_manager.h b/Source/sys-clk/common/include/sysclk/clock_manager.h index bbbab8ec..d3ba7b51 100644 --- a/Source/sys-clk/common/include/sysclk/clock_manager.h +++ b/Source/sys-clk/common/include/sysclk/clock_manager.h @@ -41,7 +41,7 @@ typedef struct uint32_t temps[SysClkThermalSensor_EnumMax]; int32_t power[SysClkPowerSensor_EnumMax]; uint32_t ramLoad[SysClkRamLoad_EnumMax]; - uint32_t perfConfId; +// uint32_t perfConfId; } SysClkContext; typedef struct @@ -52,6 +52,4 @@ typedef struct }; } SysClkTitleProfileList; -#define SYSCLK_FREQ_LIST_MAX 32 -#define SYSCLK_GPU_BOOST_HZ 76800000 -#define SYSCLK_CPU_BOOST_HZ 1785000000 \ No newline at end of file +#define SYSCLK_FREQ_LIST_MAX 32 \ No newline at end of file diff --git a/Source/sys-clk/manager/src/cheat_sheet_tab.cpp b/Source/sys-clk/manager/src/cheat_sheet_tab.cpp index 7e492770..c3a91f40 100644 --- a/Source/sys-clk/manager/src/cheat_sheet_tab.cpp +++ b/Source/sys-clk/manager/src/cheat_sheet_tab.cpp @@ -27,9 +27,17 @@ CheatSheetTab::CheatSheetTab() // CPU this->addView(new brls::Header("CPU Clocks")); brls::Table *cpuTable = new brls::Table(); + + cpuTable->addRow(brls::TableRowType::BODY, "Mariko Absolute Max", "2601 MHz"); + cpuTable->addRow(brls::TableRowType::BODY, "Mariko Unsafe Max", "2397 MHz"); - cpuTable->addRow(brls::TableRowType::BODY, "Maximum", "1785 MHz"); + cpuTable->addRow(brls::TableRowType::BODY, "Erista Absolute Max", "2295 MHz"); + + cpuTable->addRow(brls::TableRowType::BODY, "Erista Unsafe Max", "2091 MHz"); + cpuTable->addRow(brls::TableRowType::BODY, "Mariko Safe Max", "1963 MHz"); + cpuTable->addRow(brls::TableRowType::BODY, "Erista Safe Max", "1785 MHz"); cpuTable->addRow(brls::TableRowType::BODY, "Official Docked and Handheld", "1020 MHz"); + cpuTable->addRow(brls::TableRowType::BODY, "Sleep mode", "612 MHz"); this->addView(cpuTable); @@ -37,11 +45,22 @@ CheatSheetTab::CheatSheetTab() this->addView(new brls::Header("GPU Clocks")); brls::Table *gpuTable = new brls::Table(); - gpuTable->addRow(brls::TableRowType::BODY, "Maximum", "921 MHz"); + gpuTable->addRow(brls::TableRowType::BODY, "Mariko Absolute Max", "1536 MHz"); + + gpuTable->addRow(brls::TableRowType::BODY, "Mariko Unsafe Max", "1267 MHz"); + + gpuTable->addRow(brls::TableRowType::BODY, "Mariko Safe Max", "1152 MHz"); + gpuTable->addRow(brls::TableRowType::BODY, "Erista Absolute Max", "1075 MHz"); + + gpuTable->addRow(brls::TableRowType::BODY, "Erista Safe Max", "860 MHz"); + gpuTable->addRow(brls::TableRowType::BODY, "Official Docked", "768 MHz"); + gpuTable->addRow(brls::TableRowType::BODY, "Maximum Mariko Handheld", "614 MHz"); gpuTable->addRow(brls::TableRowType::BODY, "Maximum Erista Handheld", "460 MHz"); - gpuTable->addRow(brls::TableRowType::BODY, "Official Handheld", "384 MHz"); + + gpuTable->addRow(brls::TableRowType::BODY, "Official Handheld", "307-460 MHz"); + gpuTable->addRow(brls::TableRowType::BODY, "Boost Mode", "76 MHz"); this->addView(gpuTable); @@ -49,10 +68,48 @@ CheatSheetTab::CheatSheetTab() this->addView(new brls::Header("MEM Clocks")); brls::Table *memTable = new brls::Table(); - memTable->addRow(brls::TableRowType::BODY, "Maximum, Official Docked", "1600 MHz"); + memTable->addRow(brls::TableRowType::BODY, "Mariko 2133BL Max", "3500 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Mariko 1866BL Max", "3200 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Mariko 1600BL Max", "2900 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Mariko 1331BL Max", "2500 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Erista 2133BL Max", "2360 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Erista 1600BL Max", "2227 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Mariko 4266MT/s Safe Max", "2133 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Mariko 3766MT/s Safe Max", "1866 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Erista Unsafe Max", "1862 MHz"); + + memTable->addRow(brls::TableRowType::BODY, "Erista Safe Max", "1600 MHz"); + memTable->addRow(brls::TableRowType::BODY, "Official Handheld", "1331 MHz"); + memTable->addRow(brls::TableRowType::BODY, "Sleep Mode", "204 MHz"); + this->addView(memTable); + + this->addView(new brls::Header("Display Freqs")); + brls::Table *lcdTable = new brls::Table(); + + lcdTable->addRow(brls::TableRowType::BODY, "External Display (720P) Max", "240 HZ"); + + lcdTable->addRow(brls::TableRowType::BODY, "External Display (1080P) Max", "120 HZ"); + + lcdTable->addRow(brls::TableRowType::BODY, "OLED Max", "90 HZ"); + + lcdTable->addRow(brls::TableRowType::BODY, "LCD Max", "72 HZ"); + + lcdTable->addRow(brls::TableRowType::BODY, "Default", "60 HZ"); + + lcdTable->addRow(brls::TableRowType::BODY, "Minimum", "40 HZ"); + + this->addView(lcdTable); } void CheatSheetTab::customSpacing(brls::View* current, brls::View* next, int* spacing) diff --git a/Source/sys-clk/manager/src/logo.cpp b/Source/sys-clk/manager/src/logo.cpp index 5f4e0c02..e0b02d5c 100644 --- a/Source/sys-clk/manager/src/logo.cpp +++ b/Source/sys-clk/manager/src/logo.cpp @@ -21,7 +21,7 @@ #include "logo.h" Logo::Logo(LogoStyle style) { - this->logoLabel = new brls::Label(brls::LabelStyle::LIST_ITEM, "sys-clk", style == LogoStyle::ABOUT); + this->logoLabel = new brls::Label(brls::LabelStyle::LIST_ITEM, "Horizon OC", style == LogoStyle::ABOUT); this->logoLabel->setParent(this); int logoFont = brls::Application::findFont(LOGO_FONT_NAME); diff --git a/Source/sys-clk/overlay/Makefile b/Source/sys-clk/overlay/Makefile index 346cc0d5..901a7b5c 100644 --- a/Source/sys-clk/overlay/Makefile +++ b/Source/sys-clk/overlay/Makefile @@ -53,7 +53,7 @@ CFLAGS := -Os -Wall -flto -fdata-sections -ffunction-sections -fno-rtti -fno-com CFLAGS += $(INCLUDE) -D__SWITCH__ # Enable appearance overriding -UI_OVERRIDE_PATH := /config/sys-clk/ +UI_OVERRIDE_PATH := /config/horizon-oc/ CFLAGS += -DUI_OVERRIDE_PATH="\"$(UI_OVERRIDE_PATH)\"" # Disable fstream diff --git a/Source/sys-clk/sysmodule/Makefile b/Source/sys-clk/sysmodule/Makefile index cc97fab7..c5bd564a 100644 --- a/Source/sys-clk/sysmodule/Makefile +++ b/Source/sys-clk/sysmodule/Makefile @@ -17,7 +17,7 @@ include $(DEVKITPRO)/libnx/switch_rules # INCLUDES is a list of directories containing header files # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm". #--------------------------------------------------------------------------------- -TARGET := sys-clk +TARGET := horizon-oc BUILD := build OUTDIR := out RESOURCES := res diff --git a/Source/sys-clk/sysmodule/src/board.cpp b/Source/sys-clk/sysmodule/src/board.cpp index f7b92991..be51247d 100644 --- a/Source/sys-clk/sysmodule/src/board.cpp +++ b/Source/sys-clk/sysmodule/src/board.cpp @@ -496,14 +496,9 @@ void Board::FetchHardwareInfos() switch(sku) { - case 2: - case 3: - case 5: + case 2 ... 5: g_socType = SysClkSocType_Mariko; break; - case 4: - g_socType = SysClkSocType_MarikoLite; - break; default: g_socType = SysClkSocType_Erista; } diff --git a/Source/sys-clk/sysmodule/src/config.cpp b/Source/sys-clk/sysmodule/src/config.cpp index 301515e3..7faa4f2d 100644 --- a/Source/sys-clk/sysmodule/src/config.cpp +++ b/Source/sys-clk/sysmodule/src/config.cpp @@ -15,7 +15,8 @@ * */ -/* -------------------------------------------------------------------------- +/* + * -------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * , , * wrote this file. As long as you retain this notice you can do whatever you @@ -24,7 +25,6 @@ * -------------------------------------------------------------------------- */ - #include "config.h" #include #include @@ -197,17 +197,24 @@ bool Config::SetProfiles(std::uint64_t tid, SysClkTitleProfileList* profiles, bo std::scoped_lock lock{this->configMutex}; uint8_t numProfiles = 0; + // String pointer array passed to ini + char* iniKeys[SysClkProfile_EnumMax * SysClkModule_EnumMax + 1]; + char* iniValues[SysClkProfile_EnumMax * SysClkModule_EnumMax + 1]; + + // Char arrays to build strings + char keysStr[SysClkProfile_EnumMax * SysClkModule_EnumMax * 0x40]; + char valuesStr[SysClkProfile_EnumMax * SysClkModule_EnumMax * 0x10]; char section[17] = {0}; - snprintf(section, sizeof(section), "%016lX", tid); - - // Use dynamic allocation - std::vector keys; - std::vector values; - keys.reserve(SysClkProfile_EnumMax * SysClkModule_EnumMax); - values.reserve(SysClkProfile_EnumMax * SysClkModule_EnumMax); + // Iteration pointers + char** ik = &iniKeys[0]; + char** iv = &iniValues[0]; + char* sk = &keysStr[0]; + char* sv = &valuesStr[0]; std::uint32_t* mhz = &profiles->mhz[0]; + snprintf(section, sizeof(section), "%016lX", tid); + for(unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) { for(unsigned int module = 0; module < SysClkModule_EnumMax; module++) @@ -216,38 +223,34 @@ bool Config::SetProfiles(std::uint64_t tid, SysClkTitleProfileList* profiles, bo { numProfiles++; - // Build key and value strings - std::string key = std::string(Board::GetProfileName((SysClkProfile)profile, false)) + - "_" + - Board::GetModuleName((SysClkModule)module, false); - std::string value = std::to_string(*mhz); + // Put key and value as string + snprintf(sk, 0x40, "%s_%s", Board::GetProfileName((SysClkProfile)profile, false), Board::GetModuleName((SysClkModule)module, false)); + snprintf(sv, 0x10, "%d", *mhz); - keys.push_back(key); - values.push_back(value); + // Add them to the ini key/value str arrays + *ik = sk; + *iv = sv; + ik++; + iv++; + + // We used those chars, get to the next ones + sk += 0x40; + sv += 0x10; } + mhz++; } } - // Build pointer arrays - std::vector keyPointers; - std::vector valuePointers; - keyPointers.reserve(keys.size() + 1); - valuePointers.reserve(values.size() + 1); + *ik = NULL; + *iv = NULL; - for(size_t i = 0; i < keys.size(); i++) { - keyPointers.push_back(keys[i].c_str()); - valuePointers.push_back(values[i].c_str()); - } - keyPointers.push_back(NULL); - valuePointers.push_back(NULL); - - if(!ini_putsection(section, keyPointers.data(), valuePointers.data(), this->path.c_str())) + if(!ini_putsection(section, (const char**)iniKeys, (const char**)iniValues, this->path.c_str())) { return false; } - // Only actually apply changes in memory after a successful save + // Only actually apply changes in memory after a succesful save if(immediate) { mhz = &profiles->mhz[0]; @@ -428,43 +431,46 @@ bool Config::SetConfigValues(SysClkConfigValueList* configValues, bool immediate { std::scoped_lock lock{this->configMutex}; - // Use dynamic allocation instead of fixed stack buffers - std::vector iniKeys; - std::vector iniValues; - - iniKeys.reserve(SysClkConfigValue_EnumMax + 1); - iniValues.reserve(SysClkConfigValue_EnumMax); + // String pointer array passed to ini + const char* iniKeys[SysClkConfigValue_EnumMax + 1]; + char* iniValues[SysClkConfigValue_EnumMax + 1]; + + // char arrays to build strings + char valuesStr[SysClkConfigValue_EnumMax * 0x20]; + + // Iteration pointers + char* sv = &valuesStr[0]; + const char** ik = &iniKeys[0]; + char** iv = &iniValues[0]; for(unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) { - if(!sysclkValidConfigValue((SysClkConfigValue)kval, configValues->values[kval]) || - configValues->values[kval] == sysclkDefaultConfigValue((SysClkConfigValue)kval)) + if(!sysclkValidConfigValue((SysClkConfigValue)kval, configValues->values[kval]) || configValues->values[kval] == sysclkDefaultConfigValue((SysClkConfigValue)kval)) { continue; } - // Store as string in vector (automatically managed memory) - iniValues.push_back(std::to_string(configValues->values[kval])); - iniKeys.push_back(sysclkFormatConfigValue((SysClkConfigValue)kval, false)); + // Put key and value as string + // And add them to the ini key/value str arrays + snprintf(sv, 0x20, "%ld", configValues->values[kval]); + *ik = sysclkFormatConfigValue((SysClkConfigValue)kval, false); + *iv = sv; + + // We used those chars, get to the next ones + sv += 0x20; + ik++; + iv++; } - // Null terminate - iniKeys.push_back(NULL); + *ik = NULL; + *iv = NULL; - // Build pointer array for ini function - std::vector valuePointers; - valuePointers.reserve(iniValues.size() + 1); - for(const auto& val : iniValues) { - valuePointers.push_back(val.c_str()); - } - valuePointers.push_back(NULL); - - if(!ini_putsection(CONFIG_VAL_SECTION, iniKeys.data(), valuePointers.data(), this->path.c_str())) + if(!ini_putsection(CONFIG_VAL_SECTION, (const char**)iniKeys, (const char**)iniValues, this->path.c_str())) { return false; } - // Only actually apply changes in memory after a successful save + // Only actually apply changes in memory after a succesful save if(immediate) { for(unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) diff --git a/Source/sys-clk/sysmodule/src/emc.cpp b/Source/sys-clk/sysmodule/src/emc.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/Source/sys-clk/sysmodule/src/emc.h b/Source/sys-clk/sysmodule/src/emc.h deleted file mode 100644 index e69de29b..00000000 diff --git a/Source/sys-clk/sysmodule/src/emc_patcher.h b/Source/sys-clk/sysmodule/src/emc_patcher.h index 6c288333..f2f13935 100644 --- a/Source/sys-clk/sysmodule/src/emc_patcher.h +++ b/Source/sys-clk/sysmodule/src/emc_patcher.h @@ -48,6 +48,9 @@ const std::array tRTW_values = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; /* const std::array tWTR_values = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const std::array tREFpb_values = {488, 732, 488 * 2, 488 * 3, 488 * 4, 488 * 6, 488 * 8}; /* TODO: Figure out if it's actually 8 and if this is even right. */ +struct SOC_THERM_THERMCTL_LEVEL0_GROUP_CPU_0 { + +}; class EMCpatcher { diff --git a/Source/sys-clk/sysmodule/src/ipc_service.cpp b/Source/sys-clk/sysmodule/src/ipc_service.cpp index 3d3dfcb7..c1ae6183 100644 --- a/Source/sys-clk/sysmodule/src/ipc_service.cpp +++ b/Source/sys-clk/sysmodule/src/ipc_service.cpp @@ -269,7 +269,7 @@ Result IpcService::SetProfiles(SysClkIpc_SetProfiles_Args* args) if(!config->SetProfiles(args->tid, &profiles, true)) { - return SYSCLK_ERROR(ConfigSaveFailed); + return SYSCLK_ERROR(ConfigSaveFailed); // 0x584 } return 0; diff --git a/Source/sys-clk/sysmodule/src/main.cpp b/Source/sys-clk/sysmodule/src/main.cpp index 5c10a49f..44d89fc7 100644 --- a/Source/sys-clk/sysmodule/src/main.cpp +++ b/Source/sys-clk/sysmodule/src/main.cpp @@ -38,7 +38,9 @@ #include "clock_manager.h" #include "ipc_service.h" #include "fancontrol.h" -#define INNER_HEAP_SIZE 0x30000 +#include "emc_patcher.h" + +#define INNER_HEAP_SIZE 0xFFFFF extern "C" { @@ -66,12 +68,22 @@ extern "C" void __appInit(void) { + Result rc; if (R_FAILED(smInitialize())) { fatalThrow(MAKERESULT(Module_Libnx, LibnxError_InitFail_SM)); } - Result rc = setsysInitialize(); + rc = fanInitialize(); + if (R_FAILED(rc)) + diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen)); + + rc = i2cInitialize(); + if (R_FAILED(rc)) + diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen)); + + + rc = setsysInitialize(); if (R_SUCCEEDED(rc)) { SetSysFirmwareVersion fw; @@ -81,13 +93,6 @@ extern "C" setsysExit(); } - rc = fanInitialize(); - if (R_FAILED(rc)) - diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen)); - - rc = i2cInitialize(); - if (R_FAILED(rc)) - diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen)); } void __appExit(void) @@ -96,7 +101,8 @@ extern "C" fanExit(); i2cExit(); fsExit(); - fsdevUnmountAll(); + fsdevUnmountAll(); + smExit(); } } @@ -118,8 +124,8 @@ int main(int argc, char** argv) ClockManager* clockMgr = new ClockManager(); IpcService* ipcSrv = new IpcService(clockMgr); - - FileUtils::LogLine("Ready"); + + FileUtils::LogLine("Starting Horizon OC Sysmodule"); clockMgr->SetRunning(true); clockMgr->GetConfig()->SetEnabled(true);