Fix tW2R and tR2W patch and multiple ram freqs

This commit is contained in:
souldbminersmwc
2025-09-24 15:38:08 -04:00
parent 8845dc862d
commit 49f3e73b10
19 changed files with 47 additions and 46 deletions

View File

@@ -4,7 +4,7 @@
- Tinymembench is under MIT license, which is compatible with GPL v2. - Tinymembench is under MIT license, which is compatible with GPL v2.
- Although "sys-clk" uses permissive license, all modifications towards it in this repo ("sys-clk-OC") are licensed under GPL v2. - Although "sys-clk" uses permissive license, all modifications towards it in this repo ("Horizon OC") are licensed under GPL v2.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
@@ -40,7 +40,7 @@ volatile CustomizeTable C = {
* Value should be divided evenly by 12'500. * Value should be divided evenly by 12'500.
* Not enabled by default. * Not enabled by default.
*/ */
.commonEmcMemVolt = 1237500, .commonEmcMemVolt = 1175000,
/* Erista CPU: /* Erista CPU:
* - Max Voltage in mV * - Max Voltage in mV
@@ -57,11 +57,11 @@ volatile CustomizeTable C = {
* - NAND corruption * - NAND corruption
*/ */
.eristaEmcClock1 = 1862400, // Lowest .eristaEmcClock1 = 1996800, // Lowest
.eristaEmcClock2 = 1996800, // Middle .eristaEmcClock2 = 2032640, // Middle
.eristaEmcClock3 = 2132640, // Highest .eristaEmcClock3 = 2232640, // Highest
/* Mariko CPU: /* Mariko CPU:

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
@@ -161,8 +161,8 @@
table->burst_mc_regs.mc_emem_arb_timing_rrd = CEIL(GET_CYCLE_CEIL(tRRD) / MC_ARB_DIV) - 1; table->burst_mc_regs.mc_emem_arb_timing_rrd = CEIL(GET_CYCLE_CEIL(tRRD) / MC_ARB_DIV) - 1;
table->burst_mc_regs.mc_emem_arb_timing_rap2pre = CEIL(GET_CYCLE_CEIL(tRTP) / MC_ARB_DIV); table->burst_mc_regs.mc_emem_arb_timing_rap2pre = CEIL(GET_CYCLE_CEIL(tRTP) / MC_ARB_DIV);
table->burst_mc_regs.mc_emem_arb_timing_wap2pre = CEIL(WTP / MC_ARB_DIV); table->burst_mc_regs.mc_emem_arb_timing_wap2pre = CEIL(WTP / MC_ARB_DIV);
// table->burst_mc_regs.mc_emem_arb_timing_r2r = CEIL(table->burst_regs.emc_rext / MC_ARB_DIV) - 1 + MC_ARB_SFA; table->burst_mc_regs.mc_emem_arb_timing_r2r = CEIL(table->burst_regs.emc_rext / MC_ARB_DIV) - 1 + MC_ARB_SFA; // ocs does not patch this
// table->burst_mc_regs.mc_emem_arb_timing_w2w = CEIL(table->burst_regs.emc_wext / MC_ARB_DIV) - 1 + MC_ARB_SFA; table->burst_mc_regs.mc_emem_arb_timing_w2w = CEIL(table->burst_regs.emc_wext / MC_ARB_DIV) - 1 + MC_ARB_SFA;
table->burst_mc_regs.mc_emem_arb_timing_r2w = CEIL(R2W / MC_ARB_DIV) - 1 + MC_ARB_SFA; table->burst_mc_regs.mc_emem_arb_timing_r2w = CEIL(R2W / MC_ARB_DIV) - 1 + MC_ARB_SFA;
table->burst_mc_regs.mc_emem_arb_timing_w2r = CEIL(W2R / MC_ARB_DIV) - 1 + MC_ARB_SFA; table->burst_mc_regs.mc_emem_arb_timing_w2r = CEIL(W2R / MC_ARB_DIV) - 1 + MC_ARB_SFA;
table->burst_mc_regs.mc_emem_arb_timing_rfcpb = CEIL(GET_CYCLE_CEIL(tRFCpb) / MC_ARB_DIV); table->burst_mc_regs.mc_emem_arb_timing_rfcpb = CEIL(GET_CYCLE_CEIL(tRFCpb) / MC_ARB_DIV);
@@ -257,9 +257,9 @@
R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable()); R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable());
} }
if (C.eristaEmcClock1 <= EmcClkOSLimit || if (C.eristaEmcClock1 >= EmcClkOSLimit ||
C.eristaEmcClock2 <= EmcClkOSLimit || C.eristaEmcClock2 >= EmcClkOSLimit ||
C.eristaEmcClock3 <= EmcClkOSLimit) C.eristaEmcClock3 >= EmcClkOSLimit)
R_SKIP(); R_SKIP();
// Make room for three new mtc tables, discarding useless 40.8, 68.0, and 102 MHz tables // Make room for three new mtc tables, discarding useless 40.8, 68.0, and 102 MHz tables
@@ -278,11 +278,11 @@
u32 *patch_ptr2 = ptr - sizeof(EristaMtcTable) / sizeof(u32); u32 *patch_ptr2 = ptr - sizeof(EristaMtcTable) / sizeof(u32);
u32 *patch_ptr3 = ptr - 2 * (sizeof(EristaMtcTable) / sizeof(u32)); u32 *patch_ptr3 = ptr - 2 * (sizeof(EristaMtcTable) / sizeof(u32));
if (C.eristaEmcClock3 > EmcClkOSLimit) if (C.eristaEmcClock3 < EmcClkOSLimit)
PATCH_OFFSET(patch_ptr1, C.eristaEmcClock3); PATCH_OFFSET(patch_ptr1, C.eristaEmcClock3);
if (C.eristaEmcClock2 > EmcClkOSLimit) if (C.eristaEmcClock2 < EmcClkOSLimit)
PATCH_OFFSET(patch_ptr2, C.eristaEmcClock2); PATCH_OFFSET(patch_ptr2, C.eristaEmcClock2);
if (C.eristaEmcClock3 > EmcClkOSLimit) if (C.eristaEmcClock3 < EmcClkOSLimit)
PATCH_OFFSET(patch_ptr3, C.eristaEmcClock1); PATCH_OFFSET(patch_ptr3, C.eristaEmcClock1);
// Handle customize table replacement // Handle customize table replacement

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (c) Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -33,7 +33,7 @@ AboutTab::AboutTab()
// Subtitle // Subtitle
brls::Label *subTitle = new brls::Label( brls::Label *subTitle = new brls::Label(
brls::LabelStyle::REGULAR, brls::LabelStyle::REGULAR,
"Nintendo Switch overclocking / underclocking system module and frontend app by the RetroNX Team", "Nittendo Switch Overclocking tool by Souldbminer based on sys-clk by RetroNX",
true true
); );
subTitle->setHorizontalAlign(NVG_ALIGN_CENTER); subTitle->setHorizontalAlign(NVG_ALIGN_CENTER);
@@ -42,9 +42,9 @@ AboutTab::AboutTab()
// Copyright // Copyright
brls::Label *copyright = new brls::Label( brls::Label *copyright = new brls::Label(
brls::LabelStyle::DESCRIPTION, brls::LabelStyle::DESCRIPTION,
"System module licensed under the Beerware license\n" \ "System module licensed under the GPLv2\n" \
"Frontend app licensed under GPL-3.0\n" \ "Frontend app licensed under GPL-3.0\n" \
"\u00A9 2019 - 2020 natinusala, p-sam, m4xw", "\u00A9 2019 - 2020 natinusala, p-sam, m4xw, \u00A9 2025 Souldbminer",
true true
); );
copyright->setHorizontalAlign(NVG_ALIGN_CENTER); copyright->setHorizontalAlign(NVG_ALIGN_CENTER);
@@ -54,9 +54,9 @@ AboutTab::AboutTab()
this->addView(new brls::Header("Links and Resources")); this->addView(new brls::Header("Links and Resources"));
brls::Label *links = new brls::Label( brls::Label *links = new brls::Label(
brls::LabelStyle::SMALL, brls::LabelStyle::SMALL,
"\uE016 User guide and code source can be found on our GitHub repository\n" \ "\uE016 User guide and code source can be found on my GitHub repository (souldbminersmwc/horizon-oc)\n" \
"\uE016 The sys-clk manager is powered by Borealis, an hardware accelerated UI library\n" \ "\uE016 The Horizon OC manager is powered by Borealis, an hardware accelerated UI library\n" \
"\uE016 Join the RetroNX Discord server for support, to request features or just hang out!", "\uE016 Join the OC Discord server for support, to request features or just hang out!",
true true
); );
this->addView(links); this->addView(links);

View File

@@ -54,24 +54,24 @@ int main(int argc, char* argv[])
// Check that sys-clk is running // Check that sys-clk is running
if (!sysclkIpcRunning()) if (!sysclkIpcRunning())
{ {
brls::Logger::error("sys-clk is not running"); brls::Logger::error("Horizon OC is not running");
brls::Application::crash("sys-clk does not seem to be running, please check that it is correctly installed and enabled."); brls::Application::crash("Horizon OC does not seem to be running, please check that it is correctly installed and enabled.");
} }
// Initialize sys-clk IPC client // Initialize sys-clk IPC client
else if (R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion))) else if (R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion)))
{ {
brls::Logger::error("Unable to initialize sys-clk IPC client"); brls::Logger::error("Unable to initialize Horizon OC IPC client");
brls::Application::crash("Could not connect to sys-clk, please check that it is correctly installed and enabled."); brls::Application::crash("Could not connect to Horizon OC, please check that it is correctly installed and enabled.");
} }
else if (SYSCLK_IPC_API_VERSION != apiVersion) else if (SYSCLK_IPC_API_VERSION != apiVersion)
{ {
brls::Logger::error("sys-clk IPC API version mismatch (expected: %u; actual: %u)", SYSCLK_IPC_API_VERSION, apiVersion); brls::Logger::error("Horizon OC IPC API version mismatch (expected: %u; actual: %u)", SYSCLK_IPC_API_VERSION, apiVersion);
brls::Application::crash("The manager is not compatible with the currently running sysmodule of sys-clk, please check that you have correctly installed the latest version (reboot?)."); brls::Application::crash("The manager is not compatible with the currently running sysmodule of Horizon OC, please check that you have correctly installed the latest version (reboot?).");
} }
else if (R_FAILED(cacheFreqList())) else if (R_FAILED(cacheFreqList()))
{ {
brls::Logger::error("Failed to get the freq list from sys-clk"); brls::Logger::error("Failed to get the freq list from Horizon OC");
brls::Application::crash("Failed to get the freq list from sys-clk, please check that you have correctly installed the latest version (reboot?)."); brls::Application::crash("Failed to get the freq list from Horizon OC, please check that you have correctly installed the latest version (reboot?).");
} }
else else
{ {
@@ -84,7 +84,7 @@ int main(int argc, char* argv[])
} }
else else
{ {
brls::Logger::error("Unable to get sys-clk version string"); brls::Logger::error("Unable to get Horizon OC version string");
brls::Application::setCommonFooter("[unknown]"); brls::Application::setCommonFooter("[unknown]");
} }

View File

@@ -40,7 +40,7 @@ class AppOverlay : public tsl::Overlay
if(!sysclkIpcRunning()) if(!sysclkIpcRunning())
{ {
return initially<FatalGui>( return initially<FatalGui>(
"sys-clk is not running.\n\n" "Horizon OC is not running.\n\n"
"\n" "\n"
"Please make sure it is correctly\n\n" "Please make sure it is correctly\n\n"
"installed and enabled.", "installed and enabled.",
@@ -51,7 +51,7 @@ class AppOverlay : public tsl::Overlay
if(R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion))) if(R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion)))
{ {
return initially<FatalGui>( return initially<FatalGui>(
"Could not connect to sys-clk.\n\n" "Could not connect to Horizon OC.\n\n"
"\n" "\n"
"Please make sure it is correctly\n\n" "Please make sure it is correctly\n\n"
"installed and enabled.", "installed and enabled.",
@@ -63,7 +63,7 @@ class AppOverlay : public tsl::Overlay
{ {
return initially<FatalGui>( return initially<FatalGui>(
"Overlay not compatible with\n\n" "Overlay not compatible with\n\n"
"the running sys-clk version.\n\n" "the running Horizon OC version.\n\n"
"\n" "\n"
"Please make sure everything is\n\n" "Please make sure everything is\n\n"
"installed and up to date.", "installed and up to date.",

View File

@@ -80,6 +80,7 @@
uint32_t unsafe_gpu; uint32_t unsafe_gpu;
uint32_t danger_cpu; uint32_t danger_cpu;
uint32_t danger_gpu; uint32_t danger_gpu;
if (IsMariko()) if (IsMariko())
{ {
unsafe_cpu = 1964; unsafe_cpu = 1964;
@@ -92,7 +93,7 @@
unsafe_cpu = 1786; unsafe_cpu = 1786;
unsafe_gpu = 922; unsafe_gpu = 922;
danger_cpu = 2092; danger_cpu = 2092;
danger_gpu = 999; danger_gpu = 1076;
} }
if (moduleName == "cpu") { if (moduleName == "cpu") {

View File

@@ -80,7 +80,7 @@ void MainGui::listUI()
return false; return false;
}); });
this->listElement->addItem(miscItem); // this->listElement->addItem(miscItem);
} }
void MainGui::refresh() void MainGui::refresh()