diff --git a/Source/Atmosphere-Patches/secmon_define_emc_access_table.inc b/Atmosphere-Patches/secmon_define_emc_access_table.inc similarity index 100% rename from Source/Atmosphere-Patches/secmon_define_emc_access_table.inc rename to Atmosphere-Patches/secmon_define_emc_access_table.inc diff --git a/Source/Atmosphere-Patches/secmon_emc_access_table_data.inc b/Atmosphere-Patches/secmon_emc_access_table_data.inc similarity index 100% rename from Source/Atmosphere-Patches/secmon_emc_access_table_data.inc rename to Atmosphere-Patches/secmon_emc_access_table_data.inc diff --git a/Source/Atmosphere-Patches/secmon_memory_layout.hpp b/Atmosphere-Patches/secmon_memory_layout.hpp similarity index 100% rename from Source/Atmosphere-Patches/secmon_memory_layout.hpp rename to Atmosphere-Patches/secmon_memory_layout.hpp diff --git a/Source/Atmosphere-Patches/secmon_smc_register_access.cpp b/Atmosphere-Patches/secmon_smc_register_access.cpp similarity index 100% rename from Source/Atmosphere-Patches/secmon_smc_register_access.cpp rename to Atmosphere-Patches/secmon_smc_register_access.cpp diff --git a/COMPILING.md b/COMPILING.md index d823bebb..0ae8c6ca 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -9,13 +9,4 @@ Horizon OC Zeus Compilation Instructions 7. Copy atmosphere files into that build folder 8. Copy Source/Atmosphere/stratosphere/loader/source/ldr_process_creation.cpp to build/stratosphere/loader/source/ldr_process_creation.cpp, replacing any files if prompted 9. Grab a copy of libultrahand (https://github.com/ppkantorski/libultrahand) and place it into Source/sys-clk/overlay/lib/libultrahand -10. Run ./build.sh in the root directory - - -The files from the build are in the dist directory - -To build the secmon patch -1. Extract atmosphere source into Source/Atmosphere-MTC-Unlock -2. cd into Source -3. Run ams_patch.bat -4. Compile Atmosphere +10. Run ./build.sh in the root directory \ No newline at end of file diff --git a/README.md b/README.md index f106a8b0..21a498c3 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to * [Atmosphere](https://github.com/Atmosphere-NX/Atmosphere) * [Ultrahand Overlay](https://github.com/ppkantorski/Ultrahand-Overlay) 2. Download and extract the **Horizon OC Package** to the root of your SD card. -3. Download and extract the **Secmon Patch** to the root of your sd card. -4. If using **Hekate**, edit `hekate_ipl.ini` to include: +3. If using **Hekate**, edit `hekate_ipl.ini` to include: ``` kip1=atmosphere/kips/hoc.kip diff --git a/Source/sys-clk/build.bat b/Source/sys-clk/build.bat new file mode 100644 index 00000000..0b273727 --- /dev/null +++ b/Source/sys-clk/build.bat @@ -0,0 +1,61 @@ +@echo off +setlocal enabledelayedexpansion + +REM --- Root directory --- +set ROOT_DIR=%~dp0 +set DIST_DIR=%ROOT_DIR%dist + +REM --- Number of CPU cores --- +set CORES=%NUMBER_OF_PROCESSORS% + +REM --- Optional first argument as DIST_DIR --- +if not "%~1"=="" set DIST_DIR=%~1 + +echo DIST_DIR: %DIST_DIR% +echo CORES: %CORES% + +REM ======================== +REM sysmodule +REM ======================== +echo *** sysmodule *** + +REM Extract TITLE_ID from perms.json using findstr (rough approximation) +for /f "tokens=2 delims=: " %%A in ('findstr /i "title_id" "%ROOT_DIR%sysmodule\perms.json"') do ( + set TITLE_ID=%%A +) + +REM Remove quotes and 0x prefix +set TITLE_ID=!TITLE_ID:"=! +set TITLE_ID=!TITLE_ID:0x=! + +REM Build sysmodule +pushd "%ROOT_DIR%sysmodule" +make -j %CORES% +popd + +REM Copy sysmodule files to dist +if not exist "%DIST_DIR%\atmosphere\contents\%TITLE_ID%\flags" mkdir "%DIST_DIR%\atmosphere\contents\%TITLE_ID%\flags" +copy /Y "%ROOT_DIR%sysmodule\out\horizon-oc.nsp" "%DIST_DIR%\atmosphere\contents\%TITLE_ID%\exefs.nsp" +type nul > "%DIST_DIR%\atmosphere\contents\%TITLE_ID%\flags\boot2.flag" +copy /Y "%ROOT_DIR%sysmodule\toolbox.json" "%DIST_DIR%\atmosphere\contents\%TITLE_ID%\toolbox.json" + +REM ======================== +REM overlay +REM ======================== +echo *** overlay *** +pushd "%ROOT_DIR%overlay" +make -j %CORES% +popd + +if not exist "%DIST_DIR%\switch\.overlays" mkdir "%DIST_DIR%\switch\.overlays" +copy /Y "%ROOT_DIR%overlay\out\horizon-oc-overlay.ovl" "%DIST_DIR%\switch\.overlays\horizon-oc-overlay.ovl" + +REM ======================== +REM assets +REM ======================== +echo *** assets *** +if not exist "%DIST_DIR%\config\horizon-oc" mkdir "%DIST_DIR%\config\horizon-oc" +copy /Y "%ROOT_DIR%config.ini.template" "%DIST_DIR%\config\horizon-oc\config.ini.template" +copy /Y "%ROOT_DIR%..\..\README.md" "%DIST_DIR%\README.md" + +endlocal diff --git a/Source/ams_patch.bat b/ams_patch.bat similarity index 93% rename from Source/ams_patch.bat rename to ams_patch.bat index 02428619..a8c3a202 100644 --- a/Source/ams_patch.bat +++ b/ams_patch.bat @@ -1,5 +1,5 @@ @echo off -set ROOT=Atmosphere-MTC-Unlock +set ROOT=build set PATCHES=Atmosphere-Patches copy "%PATCHES%\secmon_memory_layout.hpp" "%ROOT%\libraries\libexosphere/include/exosphere/secmon/" /Y copy "%PATCHES%\secmon_emc_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y diff --git a/build.bat b/build.bat new file mode 100644 index 00000000..aa909ca7 --- /dev/null +++ b/build.bat @@ -0,0 +1,50 @@ +@echo off +setlocal + +if not exist dist mkdir dist +set SRC=Source\Atmosphere\stratosphere\loader\source\oc +set DEST=build\stratosphere\loader\source\oc + +if not exist dist\atmosphere\kips mkdir dist\atmosphere\kips +if not exist %DEST% mkdir %DEST% + +xcopy /E /I /Y "%SRC%\*" "%DEST%\" + +cd build\stratosphere\loader || exit /b 1 +make -j %NUMBER_OF_PROCESSORS% +hactool -t kip1 out\nintendo_nx_arm64_armv8a\release\loader.kip --uncompress=hoc.kip +cd ..\..\..\ + +if not exist dist\atmosphere\kips mkdir dist\atmosphere\kips +copy /Y build\stratosphere\loader\hoc.kip dist\atmosphere\kips\hoc.kip + +cd Source\sys-clk +if not exist dist mkdir dist +build.bat +xcopy /E /I /Y dist\* ..\..\dist\ + +cd ..\.. + +cd Source\Horizon-OC-Monitor +make -j %NUMBER_OF_PROCESSORS% +if not exist ..\..\dist\switch\.overlays mkdir ..\..\dist\switch\.overlays +copy /Y Horizon-OC-Monitor.ovl ..\..\dist\switch\.overlays\Horizon-OC-Monitor.ovl + +cd ..\.. + +set ROOT=build +set PATCHES=Atmosphere-Patches + +copy /Y "%PATCHES%\secmon_memory_layout.hpp" "%ROOT%\libraries\libexosphere\include\exosphere\secmon\" +copy /Y "%PATCHES%\secmon_emc_access_table_data.inc" "%ROOT%\exosphere\program\source\smc\" +copy /Y "%PATCHES%\secmon_define_emc_access_table.inc" "%ROOT%\exosphere\program\source\smc\" +copy /Y "%PATCHES%\secmon_smc_register_access.cpp" "%ROOT%\exosphere\program\source\smc\" + +cd build\exosphere +make -j %NUMBER_OF_PROCESSORS% + +cd out\nintendo_nx_arm64_armv8a\release +if not exist ..\..\..\..\..\dist mkdir ..\..\..\..\..\dist +copy /Y exosphere.bin ..\..\..\..\..\dist\secmon_emc_patch.bin + +endlocal diff --git a/build.sh b/build.sh index cbaef33a..5546e356 100644 --- a/build.sh +++ b/build.sh @@ -23,16 +23,18 @@ cd Source/Horizon-OC-Monitor/ make -j"$(nproc)" cp Horizon-OC-Monitor.ovl ../../dist/switch/.overlays/Horizon-OC-Monitor.ovl -# cd ../../Source/configurator +cd ../../ -# pip install -U pyinstaller -# pip install dpg -# pip install numpy -# pip install psutil -# pip install pillow -# pip install pathlib +ROOT="build" +PATCHES="Atmosphere-Patches" -# python3 -m PyInstaller --onefile --add-data "assets:assets" --icon=assets/icon.ico --noconsole src/main.py +cp "$PATCHES/secmon_memory_layout.hpp" "$ROOT/libraries/libexosphere/include/exosphere/secmon/" +cp "$PATCHES/secmon_emc_access_table_data.inc" "$ROOT/exosphere/program/source/smc/" +cp "$PATCHES/secmon_define_emc_access_table.inc" "$ROOT/exosphere/program/source/smc/" +cp "$PATCHES/secmon_smc_register_access.cpp" "$ROOT/exosphere/program/source/smc/" +cd build/exosphere -# mv dist/main dist/hocconfig -# cp dist/hocconfig ../../ \ No newline at end of file +make -j"$(nproc)" + +cd out/nintendo_nx_arm64_armv8a/release +cp "exosphere.bin" "../../../../../dist/" diff --git a/dist/README.md b/dist/README.md index f78fc017..21a498c3 100644 --- a/dist/README.md +++ b/dist/README.md @@ -52,16 +52,15 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to * [Atmosphere](https://github.com/Atmosphere-NX/Atmosphere) * [Ultrahand Overlay](https://github.com/ppkantorski/Ultrahand-Overlay) -2. Download the latest **hoc.kip** file from the [Releases](../../releases) tab. +2. Download and extract the **Horizon OC Package** to the root of your SD card. 3. If using **Hekate**, edit `hekate_ipl.ini` to include: ``` kip1=atmosphere/kips/hoc.kip + secmon=secmon_patch_ams_x_xx_x.bin ``` *(No changes needed if using fusee.)* -4. Download and extract the **Horizon OC sysmodule** to the root of your SD card. -5. Alternatively, use the **Configurator** and click the **Install** buttons for automatic setup. --- @@ -84,12 +83,14 @@ Refer to COMPILATION.md ## Credits * **Lightos** – loader patches development +* **Lightos's Cat** - Cat * **SciresM** - Atmosphere CFW * **KazushiMe** – Switch OC Suite -* **Meha** – Switch OC Suite, EOS, sys-clk-eos -* **Naga** – OC-kernel -* **B3711** – EOS +* **hanai3bi** – Switch OC Suite, EOS, sys-clk-eos +* **NaGaa95** – L4T-OC-kernel +* **B3711 (halop)** – EOS * **sys-clk team** – sys-clk -* **b0rd2death** – Ultrahand sys-clk fork +* **b0rd2death** – Ultrahand sys-clk & Status Monitor fork * **MasaGratoR and ZachyCatGames** - General help -* **Dom, Samybigio, Arcdelta, Miki, Algie, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TDRR, agjeococh and Xenshen** - Testing +* **MasaGratoR** - Status Monitor & Display Refresh Rate Driver +* **Dom, Samybigio, Arcdelta, Miki, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TDRR, agjeococh and Xenshen** - Testing diff --git a/dist/atmosphere/contents/00FF0000636C6BFF/exefs.nsp b/dist/atmosphere/contents/00FF0000636C6BFF/exefs.nsp index 0d1aad89..9ec82d49 100644 Binary files a/dist/atmosphere/contents/00FF0000636C6BFF/exefs.nsp and b/dist/atmosphere/contents/00FF0000636C6BFF/exefs.nsp differ diff --git a/secmon_patch_ams_1_10_1.bin b/secmon_patch_ams_1_10_1.bin deleted file mode 100644 index f5bc20ff..00000000 Binary files a/secmon_patch_ams_1_10_1.bin and /dev/null differ