misc: refactor compilation system

This commit is contained in:
souldbminersmwc
2025-12-27 17:35:00 -05:00
parent ddf1bf835e
commit 9d0e110997
13 changed files with 135 additions and 31 deletions

View File

@@ -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

View File

@@ -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

61
Source/sys-clk/build.bat Normal file
View File

@@ -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

View File

@@ -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

50
build.bat Normal file
View File

@@ -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

View File

@@ -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 ../../
make -j"$(nproc)"
cd out/nintendo_nx_arm64_armv8a/release
cp "exosphere.bin" "../../../../../dist/"

17
dist/README.md vendored
View File

@@ -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

Binary file not shown.