175 Commits
1.0.1 ... 1.2.1

Author SHA1 Message Date
Lightos1
24eb3b1208 recover alignment improvement commit changes 2026-04-07 19:32:37 +02:00
Lightos1
9a6282af9c bump version 2026-04-07 19:20:52 +02:00
Lightos1
5de030c4e9 rename globals 2026-04-06 23:23:04 +02:00
souldbminersmwc
dc63dfdca2 hocclk: add support for FW <10.0.0 2026-04-06 16:52:18 -04:00
souldbminersmwc
803a838b35 Update Utils.hpp 2026-04-06 16:10:02 -04:00
souldbminersmwc
5b284db5ae hocmon: lower default font size 2026-04-06 16:09:59 -04:00
souldbminersmwc
861ee85289 Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-04-06 15:57:12 -04:00
souldbminersmwc
521e3c22dd hocclk: reduce ram usage and add display undervolt 2026-04-06 15:57:10 -04:00
Lightos1
78798a1cce actually fix cpu max 2026-04-06 12:58:54 +02:00
Lightos1
44d417fb89 fix cpu max clock, remove below 1963 caps on mariko 2026-04-06 12:56:06 +02:00
Lightos1
8faaaa58d9 mini: fix garbage temp reading 2026-04-04 12:15:09 +02:00
Lightos1
df0969ba6f update readme 2026-04-04 11:59:10 +02:00
Lightos1
646f8b8d69 update readme 2026-04-04 11:58:44 +02:00
Lightos1
456684152a more accurate Italian translation by miki 2026-04-04 11:56:10 +02:00
souldbminersmwc
a606a878ee hocclk: fix lightos z 2026-04-03 20:02:36 -04:00
souldbminersmwc
75531e6c4f add ldr patches for older atmosphere versions (in case anyone still uses them) 2026-04-03 19:42:29 -04:00
souldbminersmwc
fa7313c495 remove real temp decimals 2026-04-03 19:29:57 -04:00
souldbminersmwc
5816d49f68 Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-04-03 19:25:22 -04:00
souldbminersmwc
589c41d8e5 hocmon: fix vdd2/vddq order 2026-04-03 19:25:14 -04:00
Lightos1
b35971e265 bump ams version 2026-04-04 01:24:51 +02:00
Lightos1
1d3836fcbb ams 1.11 is now the latest version 2026-04-04 01:22:41 +02:00
Lightos1
e515df84a5 prepare ldr_process_creation for ams 1.11.0 2026-04-04 01:17:09 +02:00
souldbminersmwc
901cb15191 hocclk: fix nvcheck sched 2026-04-03 15:12:33 -04:00
souldbminersmwc
aaa00ca3d0 hocclk: add negatives before gpu offset 2026-04-03 12:39:49 -04:00
souldbminersmwc
1f449af24f hocclk: rename gpu uv options 2026-04-03 12:37:07 -04:00
souldbminersmwc
cb810367b8 hocclk: remove 800mv vmin option 2026-04-03 12:35:22 -04:00
souldbminersmwc
27cd40a7e8 Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-04-03 12:34:17 -04:00
souldbminersmwc
75480ffdb5 hocclk: fix vrr out of focus 2026-04-03 12:34:15 -04:00
Lightos1
d3ee7c2976 remove auto vmin from configurator 2026-04-03 15:34:21 +02:00
Lightos1
3e5cec375d ldr: remove unused structs 2026-04-03 14:55:22 +02:00
Lightos1
280392158e ldr: deprecate auto vmin, it was incorrectly implemente, proper implementation is inferior to pcv hijack 2026-04-03 14:52:40 +02:00
Lightos1
a8d47ae8c8 Fix garbage temp reading 2026-04-03 13:55:31 +02:00
Lightos1
eb6364f994 add decimal config 2026-04-03 13:39:46 +02:00
Lightos1
59ba05332f micro mode: fix padding 2026-04-03 13:15:01 +02:00
souldbminersmwc
fc203c723c Update MIGRATION.md 2026-04-02 22:10:24 -04:00
souldbminersmwc
5f427ec24d Update MIGRATION.md 2026-04-02 22:10:00 -04:00
souldbminersmwc
cf891190cd hocmon: fix VDD2/VDDQ reversal 2026-04-02 22:09:11 -04:00
souldbminersmwc
3411959537 hocclk: add migration guide 2026-04-02 17:13:44 -04:00
souldbminersmwc
cce2069a32 hocclk: build system changes
- update C++ version to GNU23, change how build scripts behave and more
2026-04-02 16:59:11 -04:00
souldbminersmwc
485aa83de5 hocclk: remove sysclk licensing from hocclk code 2026-04-02 16:51:43 -04:00
souldbminersmwc
52e8f5c584 sysclk: rename to hocclk
idc about compatability when the programs are structured very differently, work very differently, and send/get data in very different ways
2026-04-02 16:48:10 -04:00
souldbminersmwc
234fb1655c hocmon: fix hocmon 2026-04-02 16:32:50 -04:00
souldbminersmwc
78a52df596 hocclk: fix gpu load 2026-04-01 20:11:06 -04:00
souldbminersmwc
8bffe2dfc1 sysclk: add SOCTHERM to UI 2026-04-01 16:39:11 -04:00
souldbminersmwc
064ecc6d25 i hate submodules i hate submodules i hate submodules 2026-04-01 16:13:16 -04:00
souldbminersmwc
2d5ba3a841 more submodule stuff 2026-04-01 16:09:49 -04:00
souldbminersmwc
3b2de89d2f fix submodules again 2026-04-01 16:08:42 -04:00
souldbminersmwc
b959ee864b re-add libultrahand submodule 2026-04-01 16:01:26 -04:00
souldbminersmwc
5f2d7a68a9 sysclk: remove sysclk old and libultrahand old 2026-04-01 16:00:54 -04:00
souldbminersmwc
554b66e25f Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-04-01 15:58:44 -04:00
souldbminersmwc
e20bafd6ab sysclk: remove old hocclk, bump version 2026-04-01 15:58:40 -04:00
Lightos1
dc2252a7c6 add pllx to sysclkFormatThermalSensor 2026-04-01 21:58:04 +02:00
Lightos1
80fa802e88 fix typo 2026-04-01 17:18:31 +02:00
Lightos1
944c1ef1f2 Always get pllx 2026-04-01 17:17:25 +02:00
Lightos1
da0806df5d Chinese translation by q1332348216-glitch 2026-04-01 16:00:33 +02:00
Lightos1
eda88210a9 remove commented out code 2026-04-01 15:40:01 +02:00
Lightos1
bb1ae1d816 Fix sleep 2026-04-01 15:38:45 +02:00
Lightos1
0a2a4cbd6b Revert "Update board.cpp"
This reverts commit 46d7b4e5fe.
2026-04-01 15:36:29 +02:00
Lightos1
2607034b7a Revert "Rename files"
This reverts commit 5da2ec11db.
2026-04-01 13:07:03 +02:00
Lightos1
5da2ec11db Rename files 2026-04-01 13:04:48 +02:00
souldbminersmwc
46d7b4e5fe Update board.cpp 2026-03-31 19:35:37 -04:00
souldbminersmwc
4358df0308 wip sleep fix 2026-03-31 19:34:54 -04:00
Lightos1
4103777f48 add gym goat to startup log 2026-03-31 23:40:35 +02:00
Lightos1
bf17e53c8f add soctherm 2026-03-31 23:26:18 +02:00
souldbminersmwc
8f6a5eee28 finish rewrite (for old version) 2026-03-31 16:50:16 -04:00
souldbminersmwc
6d0de115eb Revert "bump version"
This reverts commit 91c12b9128.
2026-03-29 14:45:13 -04:00
souldbminersmwc
1f2999df2f Revert "sysclk: add PWM dimming"
This reverts commit ec661ac1c0.
2026-03-29 14:45:09 -04:00
souldbminersmwc
1f2b3848e4 Revert "sysclk: refinements to pwm dimming"
This reverts commit ce99462081.
2026-03-29 14:45:07 -04:00
souldbminersmwc
955d009f54 Revert "sysclk: remove stray e"
This reverts commit 6607c287db.
2026-03-29 14:45:05 -04:00
souldbminersmwc
6607c287db sysclk: remove stray e 2026-03-28 18:53:39 -04:00
souldbminersmwc
ce99462081 sysclk: refinements to pwm dimming 2026-03-28 18:49:36 -04:00
souldbminersmwc
91c12b9128 bump version 2026-03-28 16:22:58 -04:00
souldbminersmwc
99e5cfc97e Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-03-28 16:20:44 -04:00
souldbminersmwc
ec661ac1c0 sysclk: add PWM dimming 2026-03-28 16:20:42 -04:00
Souldbminer
1de73c4b74 Merge pull request #55 from Angelblaster/patch-7
Update ko.json
2026-03-27 16:09:36 -04:00
Angelblaster
8a3b6f9775 Update ko.json
Before →After



   "Governor Settings": "주지사 설정", 

→

   "Governor Settings": "거버너 설정",

--------------------------------------------------------------------------------------------------

    "refresh rates may cause stress": "새로 고침 빈도는 스트레스를 유발할 수 있습니다",
    "or damage to your display! ": "또는 디스플레이가 손상되었습니다!",
    "Proceed at your own risk!": "자신의 책임하에 진행하십시오!",

→

   "refresh rates may cause stress": "디스플레이 주사율 빈도 변경은",
   "or damage to your display! ": " 기기에 손상이 발생될 수 있습니다!",
   "Proceed at your own risk!": "책임하에 주의해서 사용하십시오!",

--------------------------------------------------------------------------------------------------


    "RAM Timing Reductions": "RAM 타이밍 감소",

→

    "RAM Timing Reductions": "RAM 타이밍 편집기",

--------------------------------------------------------------------------------------------------

    "CPU UV": "CPU UV",

→

    "CPU UV": "CPU 언더볼트",

--------------------------------------------------------------------------------------------------

    "Extreme UV Table": "극자외선 테이블",

→

    "Extreme UV Table": "익스트림 테이블",

--------------------------------------------------------------------------------------------------

    "GPU Voltage Table": "GPU 전압 표",

→

    "GPU Voltage Table": "GPU 전압 테이블",

--------------------------------------------------------------------------------------------------

    "1075MHz without UV, 1152MHz on SLT": "UV 없이 1075MHz, SLT에서 1152MHz",
    "or 1228MHz on HiOPT can cause ": "또는 HiOPT에서 1228MHz를 사용하면",
    "permanent damage to your Switch!": "스위치가 영구적으로 손상되었습니다!",

→

    "1075MHz without UV, 1152MHz on SLT": "UV 없이 1075MHz, SLT에서 1152MHz",
    "or 1228MHz on HiOPT can cause ": "또는 HiOPT에서 1228MHz를 사용하면",
    "permanent damage to your Switch!": "스위치가 영구적으로 손상될 수 있습니다!",
2026-03-26 10:06:28 +09:00
Lightos1
7f0f743f47 remove old files 2026-03-25 18:09:22 +01:00
Lightos1
5a0ae8da5b Recover changes 2026-03-25 18:06:22 +01:00
Souldbminer
77fddda8a9 Merge pull request #54 from Angelblaster/patch-6
Update ko.json
2026-03-24 18:19:04 -04:00
souldbminersmwc
2828687a18 Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-03-24 18:18:24 -04:00
souldbminersmwc
0c1f9e661c Delete dist.zip 2026-03-24 18:18:18 -04:00
Angelblaster
52aa25b212 Update ko.json
38)
"Boost Mode": "부스트 모드",  →     "Overwrite Boost Mode": "부스트 모드 덮어쓰기",

Other partial Korean corrections
2026-03-25 01:23:17 +09:00
Lightos1
3e98704a93 Merge pull request #52 from Angelblaster/patch-4
Update ko.json
2026-03-24 12:00:21 +01:00
Angelblaster
4a7277d8bd Update ko.json
I have corrected some of the Korean.
2026-03-24 19:57:55 +09:00
Lightos1
143de18f3a Merge pull request #51 from Angelblaster/patch-3
Update ko.json
2026-03-24 11:08:39 +01:00
Angelblaster
8626854d10 Update ko.json
I have corrected some of the Korean.
2026-03-24 19:06:23 +09:00
souldbminersmwc
6bd3ba7b3d final changes 2026-03-22 19:25:47 -04:00
souldbminersmwc
bc06d65b72 sysclk: update translations 2026-03-22 19:14:52 -04:00
souldbminersmwc
7045332ef2 sysclk: fix build script 2026-03-22 19:07:30 -04:00
souldbminersmwc
35bc76074c sysclk: add merged manual translations 2026-03-22 19:03:38 -04:00
souldbminersmwc
cdb725dc86 sysclk: update translation 2026-03-22 18:57:17 -04:00
souldbminersmwc
215ccf9001 sysclk: add machine translations for all languages supported by ultrahand 2026-03-22 18:51:23 -04:00
souldbminersmwc
ec21e47b53 sysclk: rework selection method and fix translation bugs 2026-03-22 18:22:38 -04:00
souldbminersmwc
17e27ad6e9 sysclk: fix default text in temporary overrides for display 2026-03-22 16:55:36 -04:00
souldbminersmwc
7489a861f6 sysclk: fix translation bug 2026-03-22 16:52:22 -04:00
souldbminersmwc
ef65b4dea9 Update all submodules to latest upstream commits 2026-03-22 15:41:10 -04:00
souldbminersmwc
0829cc8545 fix commit stuff 2026-03-22 15:19:19 -04:00
souldbminersmwc
5fb0899bb8 sysclk: fix label 2026-03-21 18:18:21 -04:00
souldbminersmwc
c17d5a3999 sysclk: add missing line, new binaries 2026-03-21 18:15:52 -04:00
souldbminersmwc
42045c5c88 sysclk: more minor changes 2026-03-21 17:52:56 -04:00
souldbminersmwc
6e6f7b4f9f sysclk: display max clock rework 2026-03-21 17:51:01 -04:00
souldbminersmwc
0496839500 sysclk: remove redundant profile options 2026-03-21 17:42:57 -04:00
souldbminersmwc
87911b8b9e sysclk: small TDP rework 2026-03-21 17:38:52 -04:00
souldbminersmwc
d3c441f8ca sysclk: change cpu bugfix wait duration
should fix on 2703mhz
2026-03-21 17:33:02 -04:00
souldbminersmwc
af6b347762 sysclk: fix iddq multiplication 2026-03-21 17:11:26 -04:00
souldbminersmwc
96b6459282 sysclk: read wafer cord 2026-03-21 17:09:10 -04:00
souldbminersmwc
371577954b Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-03-21 16:04:19 -04:00
souldbminersmwc
6bdb79fc15 sysclk: remove unused value 2026-03-21 16:04:13 -04:00
Lightos1
e625e4251a add sched off code to rewrite 2026-03-21 18:02:05 +01:00
Lightos1
5d7a77074b actually add uv tuning values... clean this code up 2026-03-21 17:44:01 +01:00
Lightos1
3b907d3ca0 Add live tuning adjustment to rewrite 2026-03-21 17:37:52 +01:00
Lightos1
a697cac43c Add message to assertion 2026-03-21 17:03:46 +01:00
Lightos1
3d5147a6e2 merge pcv hijacking into voltage code 2026-03-21 17:01:50 +01:00
Lightos1
f46d0a714b actually fix the typo 2026-03-21 16:56:10 +01:00
Lightos1
3896c89a5c Revert "Fix typo"
This reverts commit 9afd3d44bd, reversing
changes made to 95930746d2.
2026-03-21 16:54:07 +01:00
Lightos1
dd645bb352 fix typo.
:Merge branch 'main' of https://github.com/horizon-oc/Horizon-OC
2026-03-21 16:48:20 +01:00
Lightos1
9afd3d44bd Fix typo 2026-03-21 16:48:13 +01:00
Lightos1
5db6ac9f25 Lol, we tried pushing code at the same time
Merge branch 'main' of https://github.com/horizon-oc/Horizon-OC
2026-03-21 16:45:00 +01:00
Lightos1
95930746d2 Merge temp and power into sensor 2026-03-21 16:44:32 +01:00
souldbminersmwc
81e6fb9699 sysclk: fix vrr delay
this is unfixable unfortunately due to quirks
2026-03-21 11:44:17 -04:00
souldbminersmwc
8b9fbdf13d sysclk: fix governor min hz 2026-03-21 11:39:50 -04:00
souldbminersmwc
901ab93e58 sysclk: reorder governor trackbars 2026-03-21 11:28:00 -04:00
souldbminersmwc
eb75fb2274 sysclk: fix haschanged logic 2026-03-21 11:02:05 -04:00
souldbminersmwc
dab17f527e sysclk: fix another logic error 2026-03-21 10:59:52 -04:00
souldbminersmwc
aabff0e948 sysclk: fix VRR issues 2026-03-21 10:58:35 -04:00
souldbminersmwc
610bf9ad82 sysclk: fix logic errors 2026-03-21 10:51:03 -04:00
souldbminersmwc
1a42ad1a67 sysclk: RETRO super timings till 60hz, improve support 2026-03-20 20:57:41 -04:00
souldbminersmwc
71f31e8f6a fix check in RETRO SUPER detection code 2026-03-20 20:45:06 -04:00
souldbminersmwc
d6bf10d113 sysclk: retro super support 2026-03-20 20:43:27 -04:00
souldbminersmwc
decd02b564 change display max to 75hz
some good displays can hit 75hz
2026-03-20 20:05:51 -04:00
souldbminersmwc
3b681f8c90 Merge branch 'main' of https://github.com/Horizon-OC/Horizon-OC 2026-03-20 20:03:38 -04:00
souldbminersmwc
95e68bd27e sysclk: fix refresh rate on lite
also increase heap size due to larger ipc packets
2026-03-20 20:03:36 -04:00
Lightos1
dfd5af7e80 add display func, todo: put into different file 2026-03-20 21:31:34 +01:00
Lightos1
0afef60198 add power 2026-03-20 21:24:55 +01:00
Lightos1
714eebb889 add temps 2026-03-20 21:22:02 +01:00
Lightos1
a5f58bfb3a add profile stuff 2026-03-20 21:16:49 +01:00
Lightos1
c29d6244a4 Fix typo 2026-03-20 21:09:43 +01:00
Lightos1
130f9101a2 Add dram id functions 2026-03-20 21:08:55 +01:00
Lightos1
308f39694c Add back misc thread 2026-03-20 21:02:24 +01:00
Lightos1
9e916b5d0f more formating 2026-03-20 20:47:35 +01:00
Lightos1
c2610472ce rewrite: formating 2026-03-20 20:45:59 +01:00
Lightos1
2dbd436307 rewrite: add freq functions 2026-03-20 20:43:08 +01:00
Lightos1
d525991beb Add info about power domains 2026-03-20 19:30:17 +01:00
Lightos1
b3ff426bfe GpuLoadThread: use proper types edition 2 2026-03-20 19:28:17 +01:00
Lightos1
958ca0530d GpuLoadThread: use proper types 2026-03-20 19:27:42 +01:00
Lightos1
981874a450 Change Result * to void * 2026-03-20 19:26:23 +01:00
Lightos1
4502dc6fdb Rewrite: full load 2026-03-20 19:24:45 +01:00
Lightos1
cc78b6193a Rename board_init.cpp -> board.cpp 2026-03-20 19:07:23 +01:00
Lightos1
327d64f22d Rewrite: Add real volts 2026-03-20 19:06:46 +01:00
Lightos1
c36052d477 remove new lines 2026-03-20 18:55:58 +01:00
Lightos1
bc9c30de56 rewrite: add Regulator type to ram oc dvfs 2026-03-20 18:54:48 +01:00
Lightos1
e1c3a7d018 Rewrite: add dvfs 2026-03-20 18:42:52 +01:00
Lightos1
179aee88af *actually* remove it for real 2026-03-20 18:09:42 +01:00
Lightos1
df4a59c269 fully uncomment miscThreadFunc 2026-03-20 18:05:56 +01:00
Lightos1
4d389cda63 what even is miscThreadFunc? 2026-03-20 18:05:00 +01:00
Lightos1
ae56a85811 Hoc-clk rewrite: More load implementation 2026-03-20 18:01:50 +01:00
Lightos1
3e75bd5b95 Start hoc-clk rewrite 2026-03-20 17:46:42 +01:00
souldbminersmwc
2454afd58f sysclk: fix resolution driver again 2026-03-19 19:57:03 -04:00
souldbminersmwc
7244093f21 sysclk: fix resolution 2026-03-19 19:50:20 -04:00
souldbminersmwc
52894e4c93 add resolution 2026-03-19 19:44:33 -04:00
souldbminersmwc
4e0b54c1a8 sysclk: refactor governor settings gui 2026-03-19 19:13:39 -04:00
souldbminersmwc
b5876ede0e sysclk: rework labels and warnings, bump version 2026-03-19 16:50:21 -04:00
souldbminersmwc
9558fd67bb update binaries 2026-03-17 20:33:19 -04:00
souldbminersmwc
59b62a835b misc: fix config bug 2026-03-17 20:30:33 -04:00
souldbminersmwc
ad6847ec59 Update zh-tw.json 2026-03-16 18:38:04 -04:00
Lightos1
061c255978 Change eristaCpuDvfsTable max to 2091, this is fine because vmax exists 2026-03-16 20:04:23 +01:00
Lightos1
bb44d0907d Fix dvfs yet again, todo make this not shit 2026-03-16 20:01:52 +01:00
Lightos1
2215b17a54 Merge pull request #45 from nangongjing1/main
Incorporate Traditional Chinese into Horizon-oc-overlay.
2026-03-16 16:18:46 +01:00
南宫镜
cc52eab3f6 Add files via upload 2026-03-16 23:13:15 +08:00
Lightos1
155a4ce50a Remove redundant else 2026-03-15 21:24:35 +01:00
Lightos1
17739377bd Fix Typo, add todo and ordering cleanup 2026-03-15 21:14:52 +01:00
Lightos1
782fae1624 minimum vmax = 800 2026-03-15 20:49:56 +01:00
Lightos1
59ca1f18d6 Add modified secmon_smc_handler.cpp for panic codes in loader 2026-03-15 20:44:25 +01:00
Lightos1
c6cda6eb30 Remove soctherm region unlock 2026-03-15 20:43:31 +01:00
Lightos1
9f3c5d8de6 Add debug panic codes 2026-03-15 20:35:45 +01:00
266 changed files with 19385 additions and 10126 deletions

9
.gitmodules vendored
View File

@@ -1,9 +1,12 @@
[submodule "Source/Horizon-OC-Monitor/lib/Atmosphere-libs"]
path = Source/Horizon-OC-Monitor/lib/Atmosphere-libs
url = https://github.com/Atmosphere-NX/Atmosphere-libs
branch = master
[submodule "Source/Horizon-OC-Monitor/lib/libultrahand"]
path = Source/Horizon-OC-Monitor/lib/libultrahand
url = https://github.com/ppkantorski/libultrahand
[submodule "Source/sys-clk/overlay/lib/libultrahand"]
path = Source/sys-clk/overlay/lib/libultrahand
url = https://github.com/ppkantorski/libultrahand
branch = main
[submodule "Source/hoc-clk/overlay/lib/libultrahand"]
path = Source/hoc-clk/overlay/lib/libultrahand
url = https://github.com/ppkantorski/libultrahand
branch = main

View File

@@ -32,7 +32,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
---
## Features
## Default clocks
* **CPU:** Up to 1963MHz (Mariko) / 1785MHz (Erista)
* **GPU:** Up to 1075MHz (Mariko) / 921MHz (Erista)
@@ -93,7 +93,8 @@ Refer to COMPILATION.md
* 665
### CPU clocks
* 2601 → mariko absolute max, very dangerous
* 2703 → mariko absolute max, dangerous
* 2601 → unsafe
* 2499
* 2397 → mariko safe max with UV (low speedo)
* 2295
@@ -113,9 +114,6 @@ Refer to COMPILATION.md
* 816
* 714
* 612 → sleep mode
**Notes:**
1. On Erista, CPU in handheld is capped to 1581MHz
### GPU clocks
* 1536 → absolute max clock on mariko. very dangerous
@@ -142,27 +140,33 @@ Refer to COMPILATION.md
* 76 → boost mode
**Notes:**
1. GPU overclock is capped at 460MHz on erista in handheld
2. On Mariko, cap with No uv is 614MHz, with SLT it is 691MHz and with HiOPT it's 768MHz
3. Clocks higher than 768MHz on erista need the official charger is plugged in.
4. On Mariko, cap with No uv is 844MHz, with SLT it is 921MHz and with HiOPT it's 998MHz
1. On Erista, CPU in handheld is capped to 1581MHz
2. GPU overclock is capped at 460MHz on erista in handheld
3. On Mariko, cap with No uv is 614MHz, with SLT it is 691MHz and with HiOPT it's 768MHz
4. Clocks higher than 768MHz on erista need the official charger is plugged in.
5. On Mariko, cap with No uv is 844MHz, with SLT it is 921MHz and with HiOPT it's 998MHz
---
## Credits
* **Lightos's Cat** - Cat
* **Souldbminer** hoc-clk and loader development
* **Lightos** loader patches development
* **Souldbminer** - hoc-clk and loader development
* **Lightos** - Loader patches development, hoc-clk development, guides
* **SciresM** - Atmosphere CFW
* **CTCaer** - L4T, Hekate, perfect ram timings
* **KazushiMe** Switch OC Suite
* **hanai3bi (meha)** Switch OC Suite, EOS, sys-clk-eos
* **NaGaa95** L4T-OC-kernel
* **B3711 (halop)** EOS
* **sys-clk team (m4xw, p-sam, natinusala)** sys-clk
* **b0rd2death** Ultrahand sys-clk & Status Monitor fork
* **CTCaer** - L4T, Hekate, proper RAM timings
* **KazushiMe** - Switch OC Suite
* **Hanai3bi (Meha)** - Switch OC Suite, EOS, sys-clk-eos
* **NaGaa95** - L4T-OC kernel, Status Monitor fork
* **B3711 (halop)** - EOS
* **sys-clk team (m4xw, p-sam, natinusala)** - sys-clk
* **Dominatorul** - Soctherm driver, guides, general help
* **b0rd2death** - Ultrahand sys-clk & Status Monitor fork
* **MasaGratoR and ZachyCatGames** - General help
* **MasaGratoR** - Status Monitor & Display Refresh Rate Driver
* **Dom, Samybigio, Arcdelta, Miki, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TDRR, agjeococh, frost, letum00 and Xenshen** - Testing
* **Samybigio2011** - Italian translations
* **MasaGratoR** - Status Monitor & Display Refresh Rate driver
* **Dominatorul, Samybigio, Arcdelta, Miki, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TDRR, agjeococh, frost, letum00, and Xenshen** - Testing
* **Samybigio2011, Miki** - Italian translations
* **angelblaster** - Korean translations
* **q1332348216-glitch** - Chinese translations
* **Nvidia** - [Tegra X1 Technical Reference Manual](https://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual), soctherm driver, L4T

View File

@@ -123,7 +123,7 @@ namespace ams::secmon {
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCode = MemoryRegion(UINT64_C(0x40020000), 0x20000);
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramBootCode));
constexpr inline const MemoryRegion MemoryRegionVirtualDevice = MemoryRegion(UINT64_C(0x1F0040000), UINT64_C(0x40000 + 0x2000));
constexpr inline const MemoryRegion MemoryRegionVirtualDevice = MemoryRegion(UINT64_C(0x1F0040000), UINT64_C(0x40000));
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDevice));
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceEmpty = MemoryRegion(MemoryRegionVirtualDevice.GetStartAddress(), 0);
@@ -155,9 +155,6 @@ namespace ams::secmon {
HANDLER(Disp1, Sdmmc, UINT64_C(0x54200000), UINT64_C(0x3000), true, ## __VA_ARGS__) \
HANDLER(Dsi, Disp1, UINT64_C(0x54300000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(MipiCal, Dsi, UINT64_C(0x700E3000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(Soctherm, MipiCal, UINT64_C(0x700E2000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(ExternalMemoryController1, Soctherm, UINT64_C(0x7001e000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
HANDLER(ExternalMemoryController2, ExternalMemoryController1, UINT64_C(0x7001f000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
#define DEFINE_DEVICE_REGION(_NAME_, _PREV_, _ADDRESS_, _SIZE_, _SECURE_) \
constexpr inline const MemoryRegion MemoryRegionVirtualDevice##_NAME_ = MemoryRegion(MemoryRegionVirtualDevice##_PREV_.GetEndAddress() + 0x1000, _SIZE_); \

View File

@@ -0,0 +1,268 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <exosphere.hpp>
#include "../secmon_error.hpp"
#include "../secmon_misc.hpp"
#include "secmon_smc_common.hpp"
#include "secmon_smc_handler.hpp"
#include "secmon_smc_aes.hpp"
#include "secmon_smc_carveout.hpp"
#include "secmon_smc_device_unique_data.hpp"
#include "secmon_smc_error.hpp"
#include "secmon_smc_info.hpp"
#include "secmon_smc_memory_access.hpp"
#include "secmon_smc_power_management.hpp"
#include "secmon_smc_random.hpp"
#include "secmon_smc_register_access.hpp"
#include "secmon_smc_result.hpp"
#include "secmon_smc_rsa.hpp"
namespace ams::secmon::smc {
namespace {
struct HandlerInfo {
u32 function_id;
u32 restriction_mask;
SmcHandler handler;
};
struct HandlerTable {
const HandlerInfo *entries;
size_t count;
};
enum HandlerType : int {
HandlerType_User = 0,
HandlerType_Kern = 1,
HandlerType_Count = 2,
};
enum Restriction {
Restriction_None = (0 << 0),
Restriction_Normal = (1 << 0),
Restriction_DeviceUniqueDataNotAllowed = (1 << 1),
Restriction_SafeModeNotAllowed = (1 << 2),
};
enum SmcCallRange {
SmcCallRange_ArmArch = 0,
SmcCallRange_Cpu = 1,
SmcCallRange_Sip = 2,
SmcCallRange_Oem = 3,
SmcCallRange_Standard = 4,
SmcCallRange_TrustedApp = 0x30,
};
enum SmcArgumentType {
ArgumentType_Integer = 0,
ArgumentType_Pointer = 1,
};
enum SmcConvention {
Convention_Smc32 = 0,
Convention_Smc64 = 1,
};
enum SmcCallType {
SmcCallType_YieldingCall = 0,
SmcCallType_FastCall = 1,
};
struct SmcFunctionId {
using FunctionId = util::BitPack64::Field< 0, 8, u32>;
using ArgumentType0 = util::BitPack64::Field< 8, 1, SmcArgumentType>;
using ArgumentType1 = util::BitPack64::Field< 9, 1, SmcArgumentType>;
using ArgumentType2 = util::BitPack64::Field<10, 1, SmcArgumentType>;
using ArgumentType3 = util::BitPack64::Field<11, 1, SmcArgumentType>;
using ArgumentType4 = util::BitPack64::Field<12, 1, SmcArgumentType>;
using ArgumentType5 = util::BitPack64::Field<13, 1, SmcArgumentType>;
using ArgumentType6 = util::BitPack64::Field<14, 1, SmcArgumentType>;
using ArgumentType7 = util::BitPack64::Field<15, 1, SmcArgumentType>;
using Reserved = util::BitPack64::Field<16, 8, u32>;
using CallRange = util::BitPack64::Field<24, 6, SmcCallRange>;
using Convention = util::BitPack64::Field<30, 1, SmcConvention>;
using CallType = util::BitPack64::Field<31, 1, SmcCallType>;
using Reserved2 = util::BitPack64::Field<32, 32, u32>;
};
constinit HandlerInfo g_user_handlers[] = {
{ 0x00000000, Restriction_SafeModeNotAllowed, nullptr },
{ 0xC3000401, Restriction_SafeModeNotAllowed, SmcSetConfig },
{ 0xC3000002, Restriction_Normal, SmcGetConfigUser },
{ 0xC3000003, Restriction_Normal, SmcGetResult },
{ 0xC3000404, Restriction_Normal, SmcGetResultData },
{ 0xC3000E05, Restriction_SafeModeNotAllowed, SmcModularExponentiate },
{ 0xC3000006, Restriction_Normal, SmcGenerateRandomBytes },
{ 0xC3000007, Restriction_Normal, SmcGenerateAesKek },
{ 0xC3000008, Restriction_Normal, SmcLoadAesKey },
{ 0xC3000009, Restriction_Normal, SmcComputeAes },
{ 0xC300000A, Restriction_Normal, SmcGenerateSpecificAesKey },
{ 0xC300040B, Restriction_Normal, SmcComputeCmac },
{ 0xC300D60C, Restriction_Normal, SmcReencryptDeviceUniqueData },
{ 0xC300100D, Restriction_DeviceUniqueDataNotAllowed, SmcDecryptDeviceUniqueData },
{ 0xC300000E, Restriction_SafeModeNotAllowed, nullptr },
{ 0xC300060F, Restriction_DeviceUniqueDataNotAllowed, SmcModularExponentiateByStorageKey },
{ 0xC3000610, Restriction_SafeModeNotAllowed, SmcPrepareEsDeviceUniqueKey },
{ 0xC3000011, Restriction_SafeModeNotAllowed, SmcLoadPreparedAesKey },
{ 0xC3000012, Restriction_SafeModeNotAllowed, SmcPrepareEsCommonTitleKey }
};
/* Deprecated handlerss. */
constexpr inline const HandlerInfo DecryptAndImportEsDeviceKeyHandlerInfo = {
0xC300100C, Restriction_Normal, SmcDecryptAndImportEsDeviceKey
};
constexpr inline const HandlerInfo DecryptAndImportLotusKeyHandlerInfo = {
0xC300100E, Restriction_SafeModeNotAllowed, SmcDecryptAndImportLotusKey
};
constinit HandlerInfo g_kern_handlers[] = {
{ 0x00000000, Restriction_SafeModeNotAllowed, nullptr },
{ 0xC4000001, Restriction_SafeModeNotAllowed, SmcSuspendCpu },
{ 0x84000002, Restriction_SafeModeNotAllowed, SmcPowerOffCpu },
{ 0xC4000003, Restriction_SafeModeNotAllowed, SmcPowerOnCpu },
{ 0xC3000004, Restriction_Normal, SmcGetConfigKern },
{ 0xC3000005, Restriction_Normal, SmcGenerateRandomBytesNonBlocking },
{ 0xC3000006, Restriction_Normal, SmcShowError },
{ 0xC3000007, Restriction_Normal, SmcSetKernelCarveoutRegion },
{ 0xC3000008, Restriction_Normal, SmcReadWriteRegister },
/* NOTE: Atmosphere extension for mesosphere. This ID is subject to change at any time. */
{ 0xC3000409, Restriction_Normal, SmcSetConfig },
};
constinit HandlerInfo g_ams_handlers[] = {
{ 0x00000000, Restriction_SafeModeNotAllowed, nullptr },
{ 0xF0000201, Restriction_None, SmcIramCopy },
{ 0xF0000002, Restriction_None, SmcReadWriteRegister },
{ 0xF0000003, Restriction_None, SmcWriteAddress },
{ 0xF0000404, Restriction_None, SmcGetEmummcConfig },
{ 0xF0000005, Restriction_None, SmcShowError },
};
constexpr const HandlerInfo GetSecureDataHandlerInfo = {
0x67891234, Restriction_None, SmcGetSecureData
};
constinit HandlerTable g_handler_tables[] = {
{ g_user_handlers, util::size(g_user_handlers) },
{ g_kern_handlers, util::size(g_kern_handlers) },
};
constinit HandlerTable g_ams_handler_table = {
g_ams_handlers, util::size(g_ams_handlers)
};
NORETURN void InvalidSmcError(u64 id) {
SetError(pkg1::ErrorInfo_UnknownSmc);
AMS_ABORT("Invalid SMC: %lx", id);
}
const HandlerTable &GetHandlerTable(HandlerType type, u64 id) {
/* Ensure we have a valid handler type. */
if (AMS_UNLIKELY(!(0 <= type && type < HandlerType_Count))) {
InvalidSmcError(id);
}
/* Provide support for legacy SmcGetSecureData. */
if (id == GetSecureDataHandlerInfo.function_id) {
return g_handler_tables[HandlerType_User];
}
/* Check if we're a user SMC. */
if (type == HandlerType_User) {
/* Nintendo uses OEM SMCs. */
/* We will assign Atmosphere extension SMCs the TrustedApplication range. */
if (util::BitPack64{id}.Get<SmcFunctionId::CallRange>() == SmcCallRange_TrustedApp) {
return g_ams_handler_table;
}
/* If we're not performing an atmosphere extension smc, require that we're being invoked by spl on core 3. */
if (AMS_UNLIKELY(hw::GetCurrentCoreId() != 3)) {
InvalidSmcError(id);
}
}
return g_handler_tables[type];
}
const HandlerInfo &GetHandlerInfo(const HandlerTable &table, u64 id) {
/* Provide support for legacy SmcGetSecureData. */
if (id == GetSecureDataHandlerInfo.function_id) {
return GetSecureDataHandlerInfo;
}
/* Get and check the index. */
const auto index = util::BitPack64{id}.Get<SmcFunctionId::FunctionId>();
if (AMS_UNLIKELY(index >= table.count)) {
InvalidSmcError(id);
}
/* Get and check the handler info. */
const auto &handler_info = table.entries[index];
/* Check that the handler isn't null. */
if (AMS_UNLIKELY(handler_info.handler == nullptr)) {
InvalidSmcError(id);
}
/* Check that the handler's id matches. */
if (AMS_UNLIKELY(handler_info.function_id != id)) {
InvalidSmcError(id);
}
return handler_info;
}
bool IsHandlerRestricted(const HandlerInfo &info) {
return (info.restriction_mask & secmon::GetRestrictedSmcMask()) != 0;
}
SmcResult InvokeSmcHandler(const HandlerInfo &info, SmcArguments &args) {
/* Check if the smc is restricted. */
if (GetTargetFirmware() >= TargetFirmware_8_0_0 && AMS_UNLIKELY(IsHandlerRestricted(info))) {
return SmcResult::NotPermitted;
}
/* Invoke the smc. */
return info.handler(args);
}
}
void ConfigureSmcHandlersForTargetFirmware() {
const auto target_fw = GetTargetFirmware();
if (target_fw < TargetFirmware_5_0_0) {
g_user_handlers[DecryptAndImportEsDeviceKeyHandlerInfo.function_id & 0xFF] = DecryptAndImportEsDeviceKeyHandlerInfo;
g_user_handlers[DecryptAndImportLotusKeyHandlerInfo.function_id & 0xFF] = DecryptAndImportLotusKeyHandlerInfo;
}
}
void HandleSmc(int type, SmcArguments &args) {
/* Get the table. */
const auto &table = GetHandlerTable(static_cast<HandlerType>(type), args.r[0]);
/* Get the handler info. */
const auto &info = GetHandlerInfo(table, args.r[0]);
/* Set the invocation result. */
args.r[0] = static_cast<u64>(InvokeSmcHandler(info, args));
}
}

View File

@@ -101,7 +101,6 @@ namespace ams::secmon::smc {
#include "secmon_define_emc_access_table.inc"
#include "secmon_define_emc1_access_table.inc"
#include "secmon_define_emc2_access_table.inc"
#include "secmon_define_soctherm_access_table.inc"
#include "secmon_define_mc01_access_table.inc"
constexpr const AccessTableEntry AccessTables[] = {
@@ -110,7 +109,6 @@ namespace ams::secmon::smc {
{ EmcAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController.GetAddress(), EmcAccessTable::Address, EmcAccessTable::Size, },
{ EmcAccessTable1::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController1.GetAddress(), EmcAccessTable1::Address, EmcAccessTable1::Size, },
{ EmcAccessTable2::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController2.GetAddress(), EmcAccessTable2::Address, EmcAccessTable2::Size, },
{ SocthermAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceSoctherm.GetAddress(), SocthermAccessTable::Address, SocthermAccessTable::Size, },
{ Mc01AccessTable::ReducedAccessTable.data(), Mc01AccessTable::Address + MemoryRegionVirtualDeviceMemoryController0.GetAddress(), Mc01AccessTable::Address + MemoryRegionPhysicalDeviceMemoryController0.GetAddress(), Mc01AccessTable::Size, },
{ Mc01AccessTable::ReducedAccessTable.data(), Mc01AccessTable::Address + MemoryRegionVirtualDeviceMemoryController1.GetAddress(), Mc01AccessTable::Address + MemoryRegionPhysicalDeviceMemoryController1.GetAddress(), Mc01AccessTable::Size, },
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,6 @@
/*
* Copyright (c) Atmosphère-NX
*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
@@ -95,6 +93,8 @@ namespace ams::ldr {
struct ProcessInfo {
os::NativeHandle process_handle;
uintptr_t code_address;
size_t total_size;
uintptr_t args_address;
size_t args_size;
uintptr_t nso_address[Nso_Count];
@@ -106,7 +106,16 @@ namespace ams::ldr {
bool has_main;
bool has_sdk;
bool has_subsdk;
bool has_nso[Nso_Count];
s8 nso_indices[Nso_Count];
};
struct AutoLoadModuleContext {
NsoHeader *headers;
int nso_count;
int rtld_idx;
int main_nso_idx;
int sdk_nso_idx;
AutoLoadModuleInfo ali;
};
/* Global NSO header cache. */
@@ -116,6 +125,10 @@ namespace ams::ldr {
bool g_is_pcv;
bool g_is_ptm;
/* Global Zstd decompression context. */
constexpr size_t ZstdDctxWorkspaceSize = 0x176E8;
alignas(8) u8 g_zstd_dctx_workspace[ZstdDctxWorkspaceSize];
Result ValidateProgramVersion(ncm::ProgramId program_id, u32 version) {
/* No version verification is done before 8.1.0. */
R_SUCCEED_IF(hos::GetVersion() < hos::Version_8_1_0);
@@ -176,10 +189,15 @@ namespace ams::ldr {
return static_cast<Acid::PoolPartition>((meta->acid->flags & Acid::AcidFlag_PoolPartitionMask) >> Acid::AcidFlag_PoolPartitionShift);
}
Result LoadAutoLoadHeaders(NsoHeader *nso_headers, AutoLoadModuleInfo *ali, u32 acid_flags) {
Result LoadAutoLoadHeaders(AutoLoadModuleContext &ctx, u32 acid_flags) {
/* Clear NSOs. */
std::memset(nso_headers, 0, sizeof(*nso_headers) * Nso_Count);
*ali = {};
std::memset(g_nso_headers, 0, sizeof(g_nso_headers));
ctx.headers = g_nso_headers;
ctx.nso_count = 0;
ctx.rtld_idx = -1;
ctx.main_nso_idx = -1;
ctx.sdk_nso_idx = -1;
ctx.ali = {};
for (size_t i = 0; i < Nso_Count; i++) {
/* Only load browser DLLs if acid flags say to do so. */
@@ -206,16 +224,18 @@ namespace ams::ldr {
/* Read NSO header. */
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, 0, nso_headers + i, sizeof(*nso_headers)));
R_UNLESS(read_size == sizeof(*nso_headers), ldr::ResultInvalidNso());
R_TRY(fs::ReadFile(std::addressof(read_size), file, 0, g_nso_headers + ctx.nso_count, sizeof(NsoHeader)));
R_UNLESS(read_size == sizeof(NsoHeader), ldr::ResultInvalidNso());
/* Note nso is present. */
switch (i) {
case Nso_Rtld:
ali->has_rtld = true;
ctx.rtld_idx = ctx.nso_count;
ctx.ali.has_rtld = true;
break;
case Nso_Main:
ali->has_main = true;
ctx.main_nso_idx = ctx.nso_count;
ctx.ali.has_main = true;
break;
case Nso_SubSdk0:
case Nso_SubSdk1:
@@ -227,64 +247,65 @@ namespace ams::ldr {
case Nso_SubSdk7:
case Nso_SubSdk8:
case Nso_SubSdk9:
ali->has_subsdk = true;
ctx.ali.has_subsdk = true;
break;
case Nso_Sdk:
ali->has_sdk = true;
ctx.sdk_nso_idx = ctx.nso_count;
ctx.ali.has_sdk = true;
break;
}
ali->has_nso[i] = true;
ctx.ali.nso_indices[ctx.nso_count] = static_cast<s8>(i);
ctx.nso_count++;
}
}
R_SUCCEED();
}
Result CheckAutoLoad(const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, u32 acid_flags) {
Result CheckAutoLoad(const AutoLoadModuleContext &ctx, u32 acid_flags) {
/* We must always have a main. */
R_UNLESS(ali->has_main, ldr::ResultInvalidNso());
R_UNLESS(ctx.ali.has_main, ldr::ResultInvalidNso());
/* All NSOs must not be --X. */
/* This is "probably" not checked on Ounce? */
for (size_t i = 0; i < Nso_Count; ++i) {
R_UNLESS((nso_headers[i].flags & NsoHeader::Flag_PreventCodeReads) == 0, ldr::ResultInvalidNso());
}
/* Validate flags and extents for all present NSOs. */
for (int i = 0; i < ctx.nso_count; ++i) {
const auto &hdr = ctx.headers[i];
/* If we don't have an RTLD, we must only have a main. */
const bool has_browser_dll = (acid_flags & Acid::AcidFlag_LoadBrowserCoreDll) != 0;
if (!ali->has_rtld) {
/* If don't have rtld, we must also not have sdk. */
R_UNLESS(!ali->has_sdk, ldr::ResultInvalidNso());
/* All NSOs must not be --X. */
/* This is "probably" not checked on Ounce? */
R_UNLESS((hdr.flags & NsoHeader::Flag_PreventCodeReads) == 0, ldr::ResultInvalidNso());
/* We must also not have both subsdk and browser dll. */
R_UNLESS(!(ali->has_subsdk && has_browser_dll), ldr::ResultInvalidNso());
} else {
/* If we have rtld, we must not have browser core dll. */
R_UNLESS(!has_browser_dll, ldr::ResultInvalidNso());
}
/* Check NSO extents. */
for (size_t i = 0; i < Nso_Count; i++) {
/* Only validate the nsos we have. */
if (!ali->has_nso[i]) {
continue;
/* Zstd compression only allowed on main, and only when both rtld+sdk are present. */
if (i != ctx.main_nso_idx || ctx.rtld_idx < 0 || ctx.sdk_nso_idx < 0) {
R_UNLESS((hdr.flags & NsoHeader::Flag_UseZbicCompression) == 0, ldr::ResultInvalidNso());
}
/* NSOs must have page-aligned segments. */
R_UNLESS(util::IsAligned(nso_headers[i].text_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(nso_headers[i].ro_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(nso_headers[i].rw_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(hdr.text_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(hdr.ro_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(hdr.rw_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
/* NSOs must have zero text offset. */
R_UNLESS(nso_headers[i].text_dst_offset == 0, ldr::ResultInvalidNso());
R_UNLESS(hdr.text_dst_offset == 0, ldr::ResultInvalidNso());
/* NSO .text must precede .rodata. */
const size_t text_end = static_cast<size_t>(nso_headers[i].text_dst_offset) + static_cast<size_t>(nso_headers[i].text_size);
R_UNLESS(text_end <= static_cast<size_t>(nso_headers[i].ro_dst_offset), ldr::ResultInvalidNso());
const size_t text_end = static_cast<size_t>(hdr.text_dst_offset) + static_cast<size_t>(hdr.text_size);
R_UNLESS(text_end <= static_cast<size_t>(hdr.ro_dst_offset), ldr::ResultInvalidNso());
/* NSO .rodata must precede .rwdata. */
const size_t ro_end = static_cast<size_t>(nso_headers[i].ro_dst_offset) + static_cast<size_t>(nso_headers[i].ro_size);
R_UNLESS(ro_end <= static_cast<size_t>(nso_headers[i].rw_dst_offset), ldr::ResultInvalidNso());
const size_t ro_end = static_cast<size_t>(hdr.ro_dst_offset) + static_cast<size_t>(hdr.ro_size);
R_UNLESS(ro_end <= static_cast<size_t>(hdr.rw_dst_offset), ldr::ResultInvalidNso());
}
const bool has_browser_dll = (acid_flags & Acid::AcidFlag_LoadBrowserCoreDll) != 0;
if (ctx.ali.has_rtld || ctx.ali.has_sdk) {
/* If we have sdk we must have rtld. */
R_UNLESS(ctx.ali.has_rtld, ldr::ResultInvalidNso());
/* If we have rtld, we must not have browser core dll. */
R_UNLESS(!has_browser_dll, ldr::ResultInvalidNso());
} else {
/* We must not have both subsdk and browser dll. */
R_UNLESS(!(ctx.ali.has_subsdk && has_browser_dll), ldr::ResultInvalidNso());
}
R_SUCCEED();
@@ -300,8 +321,8 @@ namespace ams::ldr {
{ 0x010049900F546001 }, /* Super Mario 3D All-Stars: Super Mario 64 */
{ 0x010057D00ECE4000 }, /* Nintendo Switch Online (Nintendo 64) [for Japan] */
{ 0x01006F8002326000 }, /* Animal Crossing: New Horizons */
{ 0x01006FB00F50E000 }, /* [???] */
{ 0x010070300F50C000 }, /* [???] */
{ 0x01006FB00F50E000 }, /* 宝可梦 走吧!伊布 [Pokemon: Let's Go, Eevee! for China] */
{ 0x010070300F50C000 }, /* 宝可梦 走吧!皮卡丘 [Pokemon: Let's Go, Pikachu! for China] */
{ 0x010075100E8EC000 }, /* 马力欧卡丁车8 豪华版 [Mario Kart 8 Deluxe for China] */
{ 0x01008DB008C2C000 }, /* Pokemon Shield */
{ 0x01009AD008C4C000 }, /* Pokemon: Let's Go, Pikachu! [Kiosk] */
@@ -525,7 +546,7 @@ namespace ams::ldr {
return rand % (max + 1);
}
Result DecideAddressSpaceLayout(ProcessInfo *out, svc::CreateProcessParameter *out_param, const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, const ArgumentStore::Entry *argument) {
Result DecideAddressSpaceLayout(ProcessInfo *out, svc::CreateProcessParameter *out_param, const AutoLoadModuleContext &ctx, const ArgumentStore::Entry *argument) {
/* Clear output. */
out->args_address = 0;
out->args_size = 0;
@@ -536,35 +557,33 @@ namespace ams::ldr {
bool argument_allocated = false;
/* Calculate base offsets. */
for (size_t i = 0; i < Nso_Count; i++) {
if (ali->has_nso[i]) {
out->nso_address[i] = total_size;
const size_t text_end = static_cast<size_t>(nso_headers[i].text_dst_offset) + static_cast<size_t>(nso_headers[i].text_size);
const size_t ro_end = static_cast<size_t>(nso_headers[i].ro_dst_offset) + static_cast<size_t>(nso_headers[i].ro_size);
const size_t rw_end = static_cast<size_t>(nso_headers[i].rw_dst_offset) + static_cast<size_t>(nso_headers[i].rw_size);
out->nso_size[i] = text_end;
out->nso_size[i] = std::max(out->nso_size[i], ro_end);
out->nso_size[i] = std::max(out->nso_size[i], rw_end);
out->nso_size[i] += static_cast<size_t>(nso_headers[i].bss_size);
for (int i = 0; i < ctx.nso_count; i++) {
out->nso_address[i] = total_size;
const size_t text_end = static_cast<size_t>(ctx.headers[i].text_dst_offset) + static_cast<size_t>(ctx.headers[i].text_size);
const size_t ro_end = static_cast<size_t>(ctx.headers[i].ro_dst_offset) + static_cast<size_t>(ctx.headers[i].ro_size);
const size_t rw_end = static_cast<size_t>(ctx.headers[i].rw_dst_offset) + static_cast<size_t>(ctx.headers[i].rw_size);
out->nso_size[i] = text_end;
out->nso_size[i] = std::max(out->nso_size[i], ro_end);
out->nso_size[i] = std::max(out->nso_size[i], rw_end);
out->nso_size[i] += static_cast<size_t>(ctx.headers[i].bss_size);
const size_t aligned_up_size = util::AlignUp(out->nso_size[i], os::MemoryPageSize) & (AutoLoadModuleSizeMax - 1);
R_UNLESS(out->nso_size[i] <= aligned_up_size, ldr::ResultInvalidNso());
R_UNLESS(aligned_up_size > 0, ldr::ResultInvalidNso());
const size_t aligned_up_size = util::AlignUp(out->nso_size[i], os::MemoryPageSize) & (AutoLoadModuleSizeMax - 1);
R_UNLESS(out->nso_size[i] <= aligned_up_size, ldr::ResultInvalidNso());
R_UNLESS(aligned_up_size > 0, ldr::ResultInvalidNso());
out->nso_size[i] = aligned_up_size;
out->nso_size[i] = aligned_up_size;
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->nso_size[i]), ldr::ResultInvalidNso());
total_size += out->nso_size[i];
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->nso_size[i]), ldr::ResultInvalidNso());
total_size += out->nso_size[i];
if (!argument_allocated && argument != nullptr) {
out->args_address = total_size;
out->args_size = util::AlignUp(2 * sizeof(u32) + argument->argument_size * 2 + ArgumentStore::ArgumentBufferSize, os::MemoryPageSize);
if (!argument_allocated && argument != nullptr) {
out->args_address = total_size;
out->args_size = util::AlignUp(2 * sizeof(u32) + argument->argument_size * 2 + ArgumentStore::ArgumentBufferSize, os::MemoryPageSize);
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->args_size), ldr::ResultInvalidNso());
total_size += out->args_size;
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->args_size), ldr::ResultInvalidNso());
total_size += out->args_size;
argument_allocated = true;
}
argument_allocated = true;
}
}
@@ -609,11 +628,9 @@ namespace ams::ldr {
/* Set out. */
aslr_start += aslr_slide;
for (size_t i = 0; i < Nso_Count; i++) {
if (ali->has_nso[i]) {
R_UNLESS(util::CanAddWithoutOverflow(out->nso_address[i], aslr_start), ldr::ResultInvalidNso());
out->nso_address[i] += aslr_start;
}
for (int i = 0; i < ctx.nso_count; i++) {
R_UNLESS(util::CanAddWithoutOverflow(out->nso_address[i], aslr_start), ldr::ResultInvalidNso());
out->nso_address[i] += aslr_start;
}
if (out->args_address) {
R_UNLESS(util::CanAddWithoutOverflow(out->args_address, aslr_start), ldr::ResultInvalidNso());
@@ -622,69 +639,88 @@ namespace ams::ldr {
out_param->code_address = aslr_start;
out_param->code_num_pages = total_size >> 12;
out->total_size = total_size;
R_SUCCEED();
}
Result LoadAutoLoadModuleSegment(fs::FileHandle file, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) {
Result LoadAutoLoadModuleSegment(fs::FileHandle file, size_t file_offset, size_t compressed_size, size_t segment_size, bool is_compressed, bool is_zstd, uintptr_t map_base, uintptr_t map_end) {
/* Select read size based on compression. */
if (!is_compressed) {
file_size = segment->size;
}
size_t file_size = is_compressed ? compressed_size : segment_size;
/* Validate size. */
R_UNLESS(file_size <= segment->size, ldr::ResultInvalidNso());
R_UNLESS(segment->size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
R_UNLESS(file_size <= segment_size, ldr::ResultInvalidNso());
R_UNLESS(file_size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
R_UNLESS(segment_size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
/* Load data from file. */
uintptr_t load_address = is_compressed ? map_end - file_size : map_base;
uintptr_t load_address = is_compressed ? map_end - compressed_size : map_base;
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, segment->file_offset, reinterpret_cast<void *>(load_address), file_size));
R_TRY(fs::ReadFile(std::addressof(read_size), file, file_offset, reinterpret_cast<void *>(load_address), file_size));
R_UNLESS(read_size == file_size, ldr::ResultInvalidNso());
/* Uncompress if necessary. */
if (is_compressed) {
bool decompressed = (util::DecompressLZ4(reinterpret_cast<void *>(map_base), segment->size, reinterpret_cast<const void *>(load_address), file_size) == static_cast<int>(segment->size));
R_SUCCEED_IF(!is_compressed);
auto compressed_data_buf = reinterpret_cast<const void *>(load_address);
if (is_zstd) {
bool decompressed = util::DecompressZstdForLoader(reinterpret_cast<void *>(g_zstd_dctx_workspace), ZstdDctxWorkspaceSize, reinterpret_cast<void *>(map_base), static_cast<size_t>(map_end - map_base), segment_size, compressed_data_buf, file_size);
R_UNLESS(decompressed, ldr::ResultInvalidNso());
} else {
bool decompressed = (util::DecompressLZ4(reinterpret_cast<void *>(map_base), segment_size, compressed_data_buf, file_size) == static_cast<int>(segment_size));
R_UNLESS(decompressed, ldr::ResultInvalidNso());
}
/* Check hash if necessary. */
if (check_hash) {
u8 hash[crypto::Sha256Generator::HashSize];
crypto::GenerateSha256(hash, sizeof(hash), reinterpret_cast<void *>(map_base), segment->size);
R_UNLESS(std::memcmp(hash, file_hash, sizeof(hash)) == 0, ldr::ResultInvalidNso());
}
R_SUCCEED();
}
Result LoadAutoLoadModule(os::NativeHandle process_handle, fs::FileHandle file, const NsoHeader *nso_header, uintptr_t nso_address, size_t nso_size) {
Result CheckSegmentHash(const NsoHeader *nso_header, uintptr_t map_address, NsoHeader::Segment segment) {
if ((nso_header->flags & (NsoHeader::Flag_CheckHashText << segment)) == 0) {
R_SUCCEED();
}
u8 hash[crypto::Sha256Generator::HashSize];
crypto::GenerateSha256(hash, sizeof(hash),
reinterpret_cast<void *>(map_address + nso_header->segments[segment].dst_offset),
nso_header->segments[segment].size);
R_UNLESS(std::memcmp(hash, nso_header->segment_hashes[segment], sizeof(hash)) == 0, ldr::ResultInvalidNso());
R_SUCCEED();
}
Result LoadAutoLoadModule(os::NativeHandle process_handle, fs::FileHandle file, const NsoHeader *nso_header, uintptr_t nso_address, size_t nso_size, size_t map_size) {
const bool is_zstd = (nso_header->flags & NsoHeader::Flag_UseZbicCompression) != 0;
/* Map and read data from file. */
{
/* Map the process memory. */
void *mapped_memory = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(mapped_memory), process_handle, nso_address, nso_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(mapped_memory, process_handle, nso_address, nso_size); };
R_TRY(os::MapProcessMemory(std::addressof(mapped_memory), process_handle, nso_address, map_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(mapped_memory, process_handle, nso_address, map_size); };
const uintptr_t map_address = reinterpret_cast<uintptr_t>(mapped_memory);
const uintptr_t map_end = map_address + map_size;
/* Load NSO segments. */
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Text]), nso_header->text_compressed_size, nso_header->text_hash, (nso_header->flags & NsoHeader::Flag_CompressedText) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashText) != 0, map_address + nso_header->text_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Ro]), nso_header->ro_compressed_size, nso_header->ro_hash, (nso_header->flags & NsoHeader::Flag_CompressedRo) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashRo) != 0, map_address + nso_header->ro_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Rw]), nso_header->rw_compressed_size, nso_header->rw_hash, (nso_header->flags & NsoHeader::Flag_CompressedRw) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashRw) != 0, map_address + nso_header->rw_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, nso_header->segments[NsoHeader::Segment_Text].file_offset, nso_header->text_compressed_size, nso_header->text_size,
(nso_header->flags & NsoHeader::Flag_CompressedText) != 0, is_zstd, map_address + nso_header->text_dst_offset, map_end));
R_TRY(LoadAutoLoadModuleSegment(file, nso_header->segments[NsoHeader::Segment_Ro].file_offset, nso_header->ro_compressed_size, nso_header->ro_size,
(nso_header->flags & NsoHeader::Flag_CompressedRo) != 0, is_zstd, map_address + nso_header->ro_dst_offset, map_end));
R_TRY(LoadAutoLoadModuleSegment(file, nso_header->segments[NsoHeader::Segment_Rw].file_offset, nso_header->rw_compressed_size, nso_header->rw_size,
(nso_header->flags & NsoHeader::Flag_CompressedRw) != 0, is_zstd, map_address + nso_header->rw_dst_offset, map_end));
/* Clear unused space to zero. */
const size_t text_end = static_cast<size_t>(nso_header->text_dst_offset) + static_cast<size_t>(nso_header->text_size);
const size_t ro_end = static_cast<size_t>(nso_header->ro_dst_offset) + static_cast<size_t>(nso_header->ro_size);
const size_t rw_end = static_cast<size_t>(nso_header->rw_dst_offset) + static_cast<size_t>(nso_header->rw_size);
std::memset(reinterpret_cast<void *>(map_address + 0), 0, nso_header->text_dst_offset);
std::memset(reinterpret_cast<void *>(map_address + text_end), 0, nso_header->ro_dst_offset - text_end);
std::memset(reinterpret_cast<void *>(map_address + ro_end), 0, nso_header->rw_dst_offset - ro_end);
std::memset(reinterpret_cast<void *>(map_address + rw_end), 0, nso_header->bss_size);
std::memset(reinterpret_cast<void *>(map_address + rw_end), 0, nso_size - rw_end);
/* Check segment hashes. */
R_TRY(CheckSegmentHash(nso_header, map_address, NsoHeader::Segment_Text));
R_TRY(CheckSegmentHash(nso_header, map_address, NsoHeader::Segment_Ro));
R_TRY(CheckSegmentHash(nso_header, map_address, NsoHeader::Segment_Rw));
/* Apply embedded patches. */
ApplyEmbeddedPatchesToModule(nso_header->module_id, map_address, nso_size);
@@ -711,25 +747,31 @@ namespace ams::ldr {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->text_dst_offset, text_size, prevent_code_reads ? os::MemoryPermission_ExecuteOnly : os::MemoryPermission_ReadExecute));
}
if (ro_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->ro_dst_offset, ro_size, os::MemoryPermission_ReadOnly));
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->ro_dst_offset, ro_size, os::MemoryPermission_ReadOnly));
}
if (rw_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->rw_dst_offset, rw_size, os::MemoryPermission_ReadWrite));
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->rw_dst_offset, rw_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result LoadAutoLoadModules(const ProcessInfo *process_info, const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, const ArgumentStore::Entry *argument) {
Result LoadAutoLoadModules(const ProcessInfo *process_info, const AutoLoadModuleContext &ctx, const ArgumentStore::Entry *argument) {
/* Load each NSO. */
for (size_t i = 0; i < Nso_Count; i++) {
if (ali->has_nso[i]) {
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), GetNsoPath(i), fs::OpenMode_Read));
ON_SCOPE_EXIT { fs::CloseFile(file); };
const uintptr_t total_end = process_info->code_address + process_info->total_size;
R_TRY(LoadAutoLoadModule(process_info->process_handle, file, nso_headers + i, process_info->nso_address[i], process_info->nso_size[i]));
}
for (int i = 0; i < ctx.nso_count; i++) {
const NsoIndex nso_idx = static_cast<NsoIndex>(ctx.ali.nso_indices[i]);
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), GetNsoPath(nso_idx), fs::OpenMode_Read));
ON_SCOPE_EXIT { fs::CloseFile(file); };
const bool is_zstd = (ctx.headers[i].flags & NsoHeader::Flag_UseZbicCompression) != 0;
const size_t map_size = is_zstd ? (total_end - process_info->nso_address[i]) : process_info->nso_size[i];
R_TRY(LoadAutoLoadModule(process_info->process_handle, file, ctx.headers + i,
process_info->nso_address[i], process_info->nso_size[i], map_size));
}
/* Load arguments, if present. */
@@ -755,13 +797,13 @@ namespace ams::ldr {
R_SUCCEED();
}
Result CreateProcessAndLoadAutoLoadModules(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit) {
Result CreateProcessAndLoadAutoLoadModules(ProcessInfo *out, const Meta *meta, const AutoLoadModuleContext &ctx, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit) {
/* Get CreateProcessParameter. */
svc::CreateProcessParameter param;
R_TRY(GetCreateProcessParameter(std::addressof(param), meta, flags, resource_limit));
/* Decide on an NSO layout. */
R_TRY(DecideAddressSpaceLayout(out, std::addressof(param), nso_headers, ali, argument));
R_TRY(DecideAddressSpaceLayout(out, std::addressof(param), ctx, argument));
/* Actually create process. */
svc::Handle process_handle;
@@ -769,10 +811,11 @@ namespace ams::ldr {
/* Set the output handle, and ensure that if we fail after this point we clean it up. */
out->process_handle = process_handle;
out->code_address = param.code_address;
ON_RESULT_FAILURE { svc::CloseHandle(process_handle); };
/* Load all auto load modules. */
R_RETURN(LoadAutoLoadModules(out, nso_headers, ali, argument));
R_RETURN(LoadAutoLoadModules(out, ctx, argument));
}
}
@@ -813,13 +856,13 @@ namespace ams::ldr {
}
/* Load, validate NSO headers. */
AutoLoadModuleInfo auto_load_info = {};
R_TRY(LoadAutoLoadHeaders(g_nso_headers, std::addressof(auto_load_info), meta.acid->flags));
R_TRY(CheckAutoLoad(g_nso_headers, std::addressof(auto_load_info), meta.acid->flags));
AutoLoadModuleContext ctx;
R_TRY(LoadAutoLoadHeaders(ctx, meta.acid->flags));
R_TRY(CheckAutoLoad(ctx, meta.acid->flags));
/* Actually create the process and load NSOs into process memory. */
ProcessInfo info;
R_TRY(CreateProcessAndLoadAutoLoadModules(std::addressof(info), std::addressof(meta), g_nso_headers, std::addressof(auto_load_info), argument, flags, resource_limit));
R_TRY(CreateProcessAndLoadAutoLoadModules(std::addressof(info), std::addressof(meta), ctx, argument, flags, resource_limit));
/* Register NSOs with the RoManager. */
{
@@ -831,10 +874,8 @@ namespace ams::ldr {
RoManager::GetInstance().RegisterProcess(pin_id, process_id, meta.aci->program_id, as_type == Npdm::AddressSpaceType_64Bit || as_type == Npdm::AddressSpaceType_64BitDeprecated);
/* Register all NSOs. */
for (size_t i = 0; i < Nso_Count; i++) {
if (auto_load_info.has_nso[i]) {
RoManager::GetInstance().AddNso(pin_id, g_nso_headers[i].module_id, info.nso_address[i], info.nso_size[i]);
}
for (int i = 0; i < ctx.nso_count; i++) {
RoManager::GetInstance().AddNso(pin_id, ctx.headers[i].module_id, info.nso_address[i], info.nso_size[i]);
}
}

View File

@@ -34,7 +34,7 @@ volatile CustomizeTable C = {
/* Disables RAM powerdown */
.hpMode = DISABLED,
.commonEmcMemVolt = 1175000, /* LPDDR4X JEDEC Specification */
.commonEmcMemVolt = 1175000, /* LPDDR4(X) JEDEC Specification */
.eristaEmcMaxClock = 1600000, /* Maximum HB-MGCH ram rating */
.eristaEmcMaxClock1 = 1600000,
.eristaEmcMaxClock2 = 1600000,
@@ -86,27 +86,25 @@ volatile CustomizeTable C = {
/* 1120mV is NVIDIA rating */
.marikoCpuMaxVolt = 1120,
/* Supported values: 1963000, 2091000, 2193000, 2295000, 2397000, 2499000, 2601000, 2703000. */
/* 1963000 is official rating of T214/Mariko, fully safe. */
/* Supported values: 1963500, 2091000, 2193000, 2295000, 2397000, 2499000, 2601000, 2703000. */
/* 1963500 is official rating of T214/Mariko, fully safe. */
/* 2091000-2295000 is a slight OC which should work on all units, but no guarantees. */
/* 2397000 is the max safe OC for most average units with tuned undervolt. */
/* 2499000 should be used with caution. */
/* 2601000 exceeds pmic limit on most consoles. */
/* 2703000 is potentially dangerous and not advised. */
.marikoCpuMaxClock = 1963000,
.marikoCpuMaxClock = 1963500,
.eristaCpuBoostClock = 1785000, // Default boost clock
.marikoCpuBoostClock = 1963000, // Default boost clock
.marikoCpuBoostClock = 1963500, // Default boost clock
.eristaGpuUV = 0,
.eristaGpuVmin = 810,
.marikoGpuUV = 0,
/* For automatic vmin detection, set this to AUTO. */
/* vmin past 795mV won't work due to HOS limitation */
/* Vmin is automatically set to 800mV when SoC temperature is below 20C */
.marikoGpuVmin = AUTO,
/* Vmin past 795mV won't work due boot voltage being 800mV. */
.marikoGpuVmin = 610,
.marikoGpuVmax = 800,
@@ -199,9 +197,9 @@ volatile CustomizeTable C = {
{ 1581000, { 1130000, }, { 2889664, -122173, 1834, } },
{ 1683000, { 1168000, }, { 5100873, -279186, 4747, } },
{ 1785000, { 1225000, }, { 5100873, -279186, 4747, } },
// { 1887000, { 1225000, }, { 5100873, -279186, 4747, } },
// { 1989000, { 1227500, }, { 5100873, -279186, 4747, } },
// { 2091000, { 1256250, }, { 5100873, -279186, 4747, } },
{ 1887000, { 1225000, }, { 5100873, -279186, 4747, } },
{ 1989000, { 1227500, }, { 5100873, -279186, 4747, } },
{ 2091000, { 1256250, }, { 5100873, -279186, 4747, } },
},
.eristaCpuDvfsTableSLT = {
@@ -222,7 +220,7 @@ volatile CustomizeTable C = {
{ 1683000, { 1168000, }, { 5100873, -279186, 4747, } },
{ 1785000, { 1225000, }, { 5100873, -279186, 4747, } },
{ 1887000, { 1225000, }, { 5100873, -279186, 4747, } },
{ 1963500, { 1227500, }, { 5100873, -279186, 4747, } },
{ 1989000, { 1227500, }, { 5100873, -279186, 4747, } },
{ 2091000, { 1227500, }, { 5100873, -279186, 4747, } },
{ 2193000, { 1227500, }, { 5100873, -279186, 4747, } },
{ 2295000, { 1256250, }, { 5100873, -279186, 4747, } },

View File

@@ -99,4 +99,25 @@ namespace ams::ldr::hoc {
R_SUCCEED();
}
};
namespace panic {
/* Requires modifying g_ams_handlers in secmon_smc_handler.cpp */
constexpr inline void SmcError(u32 rgb) {
SecmonArgs args = {};
constexpr u32 SmcShowErrorID = 0xF0000005;
args.X[0] = SmcShowErrorID;
args.X[1] = rgb;
svcCallSecureMonitor(&args);
}
constexpr inline u32 PackCode(u32 r, u32 g, u32 b) {
return ((r & 0xF) << 8) | ((g & 0xF) << 4) | ((b & 0xF) << 0);
}
constexpr u32 Gpu = PackCode(0xF, 0x7, 0x0);
constexpr u32 Cpu = PackCode(0xF, 0x0, 0x0);
constexpr u32 Emc = PackCode(0x0, 0xF, 0xF);
constexpr u32 Patch = PackCode(0x8, 0x0, 0xF);
}
}

View File

@@ -84,6 +84,7 @@ namespace ams::ldr::hoc::pcv {
u32 min;
u32 max;
bool value_required = false;
u32 panic;
Result check() {
if (!value_required && !value)
@@ -143,22 +144,27 @@ namespace ams::ldr::hoc::pcv {
using namespace ams::ldr::hoc::pcv;
sValidator validators[] = {
{ C.eristaCpuBoostClock, 1020'000, 2295'000, true },
{ C.marikoCpuBoostClock, 1020'000, 2703'000, true },
{ C.commonEmcMemVolt, 912'500, 1350'000 }, // Official burst vmax for the RAMs is 1500mV
{ C.eristaCpuMaxVolt, 1000, 1260 },
{ GET_MAX_OF_ARR(erista::maxEmcClocks), 1600'000, 2600'000 },
{ C.marikoCpuMaxVolt, 1000, 1200 },
{ C.marikoEmcMaxClock, 1600'000, 3500'000 },
{ C.marikoEmcVddqVolt, 250'000, 700'000 },
{ eristaCpuDvfsMaxFreq, 1785'000, 2295'000 },
{ marikoCpuDvfsMaxFreq, 1785'000, 2703'000 },
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000 },
{ marikoGpuDvfsMaxFreq, 768'000, 1536'000 },
{ C.eristaCpuBoostClock, 1020'000, 2397'000, true, panic::Cpu },
{ C.marikoCpuBoostClock, 1020'000, 2703'000, true, panic::Cpu },
{ C.eristaCpuMaxVolt, 1000, 1260, false, panic::Cpu },
{ C.marikoCpuMaxVolt, 1000, 1200, false, panic::Cpu },
{ eristaCpuDvfsMaxFreq, 1785'000, 2397'000, false, panic::Cpu },
{ marikoCpuDvfsMaxFreq, 1785'000, 2703'000, false, panic::Cpu },
{ C.commonEmcMemVolt, 912'500, 1350'000, false, panic::Emc }, // Official burst vmax for the RAMs is 1500mV
{ GET_MAX_OF_ARR(erista::maxEmcClocks), 1600'000, 2600'000, false, panic::Emc },
{ C.marikoEmcMaxClock, 1600'000, 3500'000, false, panic::Emc },
{ C.marikoEmcVddqVolt, 250'000, 700'000, false, panic::Emc },
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000, false, panic::Gpu },
{ marikoGpuDvfsMaxFreq, 768'000, 1536'000, false, panic::Gpu },
{ C.marikoGpuVmax, 800, 960, false, panic::Gpu },
};
for (auto& i : validators) {
if (R_FAILED(i.check())) {
for (auto &v : validators) {
if (R_FAILED(v.check())) {
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
panic::SmcError(v.panic);
#endif
CRASH("Validation FAIL");
}
}

View File

@@ -58,7 +58,7 @@ namespace ams::ldr::hoc::pcv {
static const u32 cpuVoltThermalData[] = { 620, 1120, 20000, 620, 1120, 70000, 950, 1132, 0, 950, 1227, 0 };
static const u32 allowedCpuMaxFrequencies[] = { 1'963'000, 2'091'000, 2'193'000, 2'295'000, 2'397'000, 2'499'000, 2'601'000, 2'703'000, };
static const u32 allowedCpuMaxFrequencies[] = { 1'963'500, 2'091'000, 2'193'000, 2'295'000, 2'397'000, 2'499'000, 2'601'000, 2'703'000, };
constexpr cvb_entry_t GpuCvbTableDefault[] = {
// GPUB01_NA_CVB_TABLE
@@ -90,38 +90,6 @@ namespace ams::ldr::hoc::pcv {
static const u32 gpuVoltThermalPattern[] = { 800, 1120, 0, 610, 1120, 20000, 610, 1120, 30000, 610, 1120, 50000, 610, 1120, 70000, 610, 1120, 90000, };
static_assert(sizeof(gpuVoltThermalPattern) == 72, "Invalid gpuVoltThermalPattern");
struct SpeedoVminTable {
u32 speedo;
u32 voltage;
};
struct RamVminOffsetTable {
u32 maxClock;
u32 offset;
};
static const SpeedoVminTable vminTable[] {
{1400, 610}, // LOW SPEEDO -> use stock vmin
{1560, 590},
{1583, 570},
{1620, 565},
{1670, 560},
{1694, 555},
{1731, 550},
{1750, 540},
{0xFFFFFFFF, 530},
};
static const RamVminOffsetTable ramOffset[] {
{2400000, 5},
{2533000, 10},
{2666000, 15},
{2800000, 20},
{2933000, 25},
{3200000, 30},
{0xFFFFFFFF, 35},
};
/* GPU Max Clock asm Pattern:
*
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)

View File

@@ -474,6 +474,10 @@ namespace ams::ldr::hoc::pcv::erista {
for (auto &entry : patches) {
LOGGING("%s Count: %zu", entry.description, entry.patched_count);
if (R_FAILED(entry.CheckResult())) {
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
panic::SmcError(panic::Patch);
#endif
CRASH(entry.description);
}
}

View File

@@ -24,46 +24,6 @@
namespace ams::ldr::hoc::pcv::mariko {
u32 GetGpuVminVoltage() {
for (auto e : vminTable) {
if (C.gpuSpeedo <= e.speedo) {
return e.voltage;
}
}
return 530;
}
u32 GetRamVminAdjustment(u32 vmin) {
if (C.marikoEmcMaxClock < 2133000) {
return vmin;
}
const u32 ramScale = (((C.marikoEmcMaxClock / 1000) - 2133) / 33) * 5 + vmin;
for (auto r : ramOffset) {
if (C.marikoEmcMaxClock < r.maxClock) {
return ramScale + r.offset;
}
}
return ramScale;
}
/* Note: EOS (probably?) has a bug in this function that always results in high vmin, this is fixed here. */
u32 GetAutoVoltage() {
u32 voltage = GetGpuVminVoltage();
voltage = GetRamVminAdjustment(voltage);
u32 voltageOffset = 590 - C.commonGpuVoltOffset;
if (voltageOffset < voltage) {
voltage = voltageOffset;
}
return voltage;
}
Result GpuVoltDVFS(u32 *ptr) {
/* Check for valid pattern. */
for (size_t i = 0; i < std::size(gpuDVFSPattern); ++i) {
@@ -77,15 +37,10 @@ namespace ams::ldr::hoc::pcv::mariko {
PATCH_OFFSET(ptr + 1, C.marikoGpuVmax);
}
/* C.marikoGpuVmin is non zero, user sets manual voltage. */
if (C.marikoGpuVmin) {
PATCH_OFFSET(ptr, C.marikoGpuVmin);
R_SUCCEED();
}
/* C.marikoGpuVmin is zero, auto voltage is applied. */
u32 autoVmin = GetAutoVoltage();
PATCH_OFFSET(ptr, autoVmin);
R_SUCCEED();
}
@@ -94,24 +49,15 @@ namespace ams::ldr::hoc::pcv::mariko {
R_THROW(ldr::ResultInvalidGpuDvfs());
}
u32 vmin = C.marikoGpuVmin;
/* Automatic voltage. */
if (!C.marikoGpuVmin) {
vmin = GetAutoVoltage();
PATCH_OFFSET(ptr, vmin);
PATCH_OFFSET(ptr + 3, vmin);
PATCH_OFFSET(ptr + 6, vmin);
PATCH_OFFSET(ptr + 9, vmin);
} else {
/* Manual voltage. */
PATCH_OFFSET(ptr, vmin);
PATCH_OFFSET(ptr + 3, vmin);
PATCH_OFFSET(ptr + 6, vmin);
PATCH_OFFSET(ptr + 9, vmin);
R_SKIP();
}
PATCH_OFFSET(ptr + 12, vmin);
PATCH_OFFSET(ptr + 0, C.marikoGpuVmin);
PATCH_OFFSET(ptr + 3, C.marikoGpuVmin);
PATCH_OFFSET(ptr + 6, C.marikoGpuVmin);
PATCH_OFFSET(ptr + 9, C.marikoGpuVmin);
PATCH_OFFSET(ptr + 12, C.marikoGpuVmin);
R_SUCCEED();
}
@@ -415,6 +361,8 @@ namespace ams::ldr::hoc::pcv::mariko {
u32 trefbw = refresh_raw + 0x40;
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
const u32 dyn_self_ref_control = (static_cast<u32>(7605.0 / tCK_avg) + 260) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000);
CalculateTimings();
WRITE_PARAM_ALL_REG(table, emc_rd_rcd, GET_CYCLE_CEIL(tRCD));
@@ -446,7 +394,6 @@ namespace ams::ldr::hoc::pcv::mariko {
WRITE_PARAM_ALL_REG(table, emc_refresh, refresh_raw);
WRITE_PARAM_ALL_REG(table, emc_pre_refresh_req_cnt, refresh_raw / 4);
WRITE_PARAM_ALL_REG(table, emc_trefbw, trefbw);
const u32 dyn_self_ref_control = (static_cast<u32>(7605.0 / tCK_avg) + 260) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000);
WRITE_PARAM_ALL_REG(table, emc_dyn_self_ref_control, dyn_self_ref_control);
WRITE_PARAM_ALL_REG(table, emc_pdex2wr, pdex2rw);
WRITE_PARAM_ALL_REG(table, emc_pdex2rd, pdex2rw);
@@ -479,8 +426,9 @@ namespace ams::ldr::hoc::pcv::mariko {
WRITE_PARAM_ALL_REG(table, emc_rdv_early_mask, rdv);
WRITE_PARAM_ALL_REG(table, emc_rdv_mask, rdv + 2);
WRITE_PARAM_ALL_REG(table, emc_tr_rdv, rdv);
WRITE_PARAM_ALL_REG(table, emc_cmd_brlshft_2, 0x24)
WRITE_PARAM_ALL_REG(table, emc_cmd_brlshft_3, 0x24)
/* TODO: Check this out again at some point. */
WRITE_PARAM_ALL_REG(table, emc_cmd_brlshft_2, 0x24);
WRITE_PARAM_ALL_REG(table, emc_cmd_brlshft_3, 0x24);
/* This needs some clean up. */
constexpr double MC_ARB_DIV = 4.0;
@@ -498,7 +446,7 @@ namespace ams::ldr::hoc::pcv::mariko {
table->burst_mc_regs.mc_emem_arb_timing_wap2pre = CEIL(tW2P / MC_ARB_DIV) + MC_ARB_SFA;
/* Two consecutive reads between two different dram modules. */
/* Only be above 1 for 8gb ram. */
/* Only above 1 for 8gb ram. */
if (table->burst_mc_regs.mc_emem_arb_timing_r2r > 1) {
table->burst_mc_regs.mc_emem_arb_timing_r2r = CEIL(table->burst_regs.emc_rext / 4) - 1 + MC_ARB_SFA;
}
@@ -652,7 +600,7 @@ namespace ams::ldr::hoc::pcv::mariko {
// Copy unmodified 1600000 table to tmp
std::memcpy(reinterpret_cast<void *>(tmp), reinterpret_cast<void *>(table_max), sizeof(MarikoMtcTable));
/* Adjust timings properly according to the new frequency. */
MemMtcTableAutoAdjust(table_max);
@@ -810,6 +758,10 @@ namespace ams::ldr::hoc::pcv::mariko {
for (auto &entry : patches) {
LOGGING("%s Count: %zu", entry.description, entry.patched_count);
if (R_FAILED(entry.CheckResult())) {
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
panic::SmcError(panic::Patch);
#endif
CRASH(entry.description);
}
}

View File

@@ -0,0 +1,2 @@
-CSn
/home/sould/Documents/GitHub/Horizon-OC/Source/Horizon-OC-Monitor/Horizon-OC-Monitor.elf

View File

@@ -38,11 +38,11 @@ include $(DEVKITPRO)/libnx/switch_rules
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
APP_TITLE := Horizon OC Monitor
APP_VERSION := 1.3.2+r4-hoc
APP_VERSION := 1.3.2+r4-hoc-r3
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include lib/Atmosphere-libs/libstratosphere/source/dmnt lib/Atmosphere-libs/libstratosphere/source ../sys-clk/common/include/
INCLUDES := include lib/Atmosphere-libs/libstratosphere/source/dmnt lib/Atmosphere-libs/libstratosphere/source ../hoc-clk/common/include/
NO_ICON := 1
#ROMFS := romfs

View File

@@ -0,0 +1 @@
Thanks to NaGa for Status Monitor Pro!

File diff suppressed because it is too large Load Diff

View File

@@ -129,10 +129,8 @@ public:
//}
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", "Modes");
if (!lastSelectedItem.empty()) {
if (!lastSelectedItem.empty())
list->jumpToItem(lastSelectedItem);
}
lastSelectedItem = "Other";
rootFrame->setContent(list);
@@ -158,7 +156,7 @@ public:
}
if (keysDown & KEY_B) {
lastSelectedItem = "Other";
tsl::swapTo<MainMenu>();
triggerRumbleDoubleClick.store(true, std::memory_order_release);
triggerExitSound.store(true, std::memory_order_release);
@@ -369,11 +367,8 @@ public:
});
list->addItem(Other);
if (!lastSelectedItem.empty()) {
if (!lastSelectedItem.empty())
list->jumpToItem(lastSelectedItem);
lastSelectedItem = "";
}
//list->disableCaching();
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION);
@@ -446,6 +441,14 @@ public:
if (SaltySD) {
LoadSharedMemoryAndRefreshRate();
}
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t hocClkApiVer = 0;
hocclkIpcGetAPIVersion(&hocClkApiVer);
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
hocclkIpcExit();
}
else hocclkCheck = 0;
}
if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0;
splGetConfig(SplConfigItem_HardwareType, &sku);
@@ -458,14 +461,16 @@ public:
}
}
splExit();
sysclkIpcInitialize();
});
Hinted = envIsSyscallHinted(0x6F);
}
virtual void exitServices() override {
CloseThreads();
sysclkIpcExit();
if (R_SUCCEEDED(hocclkCheck)) {
hocclkIpcExit();
}
shmemClose(&_sharedmemory);
//Exit services
clkrstExit();
@@ -520,6 +525,14 @@ public:
if (SaltySD) {
LoadSharedMemory();
}
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t hocClkApiVer = 0;
hocclkIpcGetAPIVersion(&hocClkApiVer);
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
hocclkIpcExit();
}
else hocclkCheck = 0;
}
if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0;
splGetConfig(SplConfigItem_HardwareType, &sku);
@@ -532,7 +545,6 @@ public:
}
}
splExit();
sysclkIpcInitialize();
});
Hinted = envIsSyscallHinted(0x6F);
}
@@ -540,7 +552,9 @@ public:
virtual void exitServices() override {
CloseThreads();
shmemClose(&_sharedmemory);
sysclkIpcExit();
if (R_SUCCEEDED(hocclkCheck)) {
hocclkIpcExit();
}
//Exit services
clkrstExit();
pcvExit();
@@ -598,6 +612,14 @@ public:
if (SaltySD) {
LoadSharedMemory();
}
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t hocClkApiVer = 0;
hocclkIpcGetAPIVersion(&hocClkApiVer);
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
hocclkIpcExit();
}
else hocclkCheck = 0;
}
if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0;
splGetConfig(SplConfigItem_HardwareType, &sku);
@@ -610,7 +632,6 @@ public:
}
}
splExit();
sysclkIpcInitialize();
});
Hinted = envIsSyscallHinted(0x6F);
@@ -619,7 +640,9 @@ public:
virtual void exitServices() override {
CloseThreads();
shmemClose(&_sharedmemory);
sysclkIpcExit();
if (R_SUCCEEDED(hocclkCheck)) {
hocclkIpcExit();
}
// Exit services
clkrstExit();
pcvExit();
@@ -679,6 +702,14 @@ public:
if (SaltySD) {
LoadSharedMemoryAndRefreshRate();
}
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t hocClkApiVer = 0;
hocclkIpcGetAPIVersion(&hocClkApiVer);
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
hocclkIpcExit();
}
else hocclkCheck = 0;
}
if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0;
splGetConfig(SplConfigItem_HardwareType, &sku);
@@ -691,7 +722,6 @@ public:
}
}
splExit();
sysclkIpcInitialize();
});
Hinted = envIsSyscallHinted(0x6F);
}
@@ -699,7 +729,9 @@ public:
virtual void exitServices() override {
CloseThreads();
shmemClose(&_sharedmemory);
sysclkIpcExit();
if (R_SUCCEEDED(hocclkCheck)) {
hocclkIpcExit();
}
clkrstExit();
pcvExit();
tsExit();
@@ -753,6 +785,14 @@ public:
if (SaltySD) {
LoadSharedMemoryAndRefreshRate();
}
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t hocClkApiVer = 0;
hocclkIpcGetAPIVersion(&hocClkApiVer);
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
hocclkIpcExit();
}
else hocclkCheck = 0;
}
if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0;
splGetConfig(SplConfigItem_HardwareType, &sku);
@@ -765,7 +805,6 @@ public:
}
}
splExit();
sysclkIpcInitialize();
});
Hinted = envIsSyscallHinted(0x6F);
}
@@ -773,7 +812,9 @@ public:
virtual void exitServices() override {
CloseThreads();
shmemClose(&_sharedmemory);
sysclkIpcExit();
if (R_SUCCEEDED(hocclkCheck)) {
hocclkIpcExit();
}
clkrstExit();
pcvExit();
tsExit();
@@ -827,6 +868,14 @@ public:
if (SaltySD) {
LoadSharedMemoryAndRefreshRate();
}
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t hocClkApiVer = 0;
hocclkIpcGetAPIVersion(&hocClkApiVer);
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
hocclkIpcExit();
}
else hocclkCheck = 0;
}
if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0;
splGetConfig(SplConfigItem_HardwareType, &sku);
@@ -839,7 +888,6 @@ public:
}
}
splExit();
sysclkIpcInitialize();
});
Hinted = envIsSyscallHinted(0x6F);
}
@@ -847,7 +895,9 @@ public:
virtual void exitServices() override {
CloseThreads();
shmemClose(&_sharedmemory);
sysclkIpcExit();
if (R_SUCCEEDED(hocclkCheck)) {
hocclkIpcExit();
}
clkrstExit();
pcvExit();
tsExit();
@@ -931,7 +981,7 @@ inline void setupMode(const std::string& modeType = "") {
// This function gets called on startup to create a new Overlay object
int main(int argc, char **argv) {
// load heap settings outside of loop (only Horizon OC Monitor directive)
// load heap settings outside of loop (only Status Monitor directive)
ult::currentHeapSize = ult::getCurrentHeapSize();
ult::expandedMemory = ult::currentHeapSize >= ult::OverlayHeapSize::Size_8MB;
ult::limitedMemory = ult::currentHeapSize == ult::OverlayHeapSize::Size_4MB;

View File

@@ -30,7 +30,7 @@ public:
disableJumpTo = true;
mutexInit(&mutex_BatteryChecker);
StartBatteryThread();
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
// tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
}
~BatteryOverlay() {
CloseBatteryThread();
@@ -141,8 +141,8 @@ public:
}
});
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION, true);
// tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor Pro", APP_VERSION, true);
rootFrame->setContent(Status);
return rootFrame;

View File

@@ -315,6 +315,12 @@ public:
});
list->addItem(showInfo);
auto* realTemps = new tsl::elm::ToggleListItem("Real Temperatures", getCurrentFPSGraphRealTemps());
realTemps->setStateChangedListener([this](bool state) {
ult::setIniFileValue(configIniPath, "fps-graph", "real_temps", state ? "true" : "false");
});
list->addItem(realTemps);
auto* dynamicColors = new tsl::elm::ToggleListItem("Use Dynamic Colors", getCurrentUseDynamicColors());
dynamicColors->setStateChangedListener([this](bool state) {
ult::setIniFileValue(configIniPath, "fps-graph", "use_dynamic_colors", state ? "true" : "false");
@@ -335,6 +341,12 @@ public:
});
list->addItem(realFreqs);
auto* realTemps = new tsl::elm::ToggleListItem("Real Temperatures", getCurrentFullRealTemps());
realTemps->setStateChangedListener([this](bool state) {
ult::setIniFileValue(configIniPath, "full", "real_temps", state ? "true" : "false");
});
list->addItem(realTemps);
auto* showDeltas = new tsl::elm::ToggleListItem("Deltas", getCurrentShowDeltas());
showDeltas->setStateChangedListener([this](bool state) {
ult::setIniFileValue(configIniPath, "full", "show_deltas", state ? "true" : "false");
@@ -393,19 +405,25 @@ public:
});
list->addItem(realVolts);
auto* realTemps = new tsl::elm::ToggleListItem("Real Temperatures", getCurrentRealTemps());
realTemps->setStateChangedListener([this, section](bool state) {
ult::setIniFileValue(configIniPath, section, "real_temps", state ? "true" : "false");
});
list->addItem(realTemps);
auto* showFullCPU = new tsl::elm::ToggleListItem("Full CPU", getCurrentShowFullCPU());
showFullCPU->setStateChangedListener([this, section](bool state) {
ult::setIniFileValue(configIniPath, section, "show_full_cpu", state ? "true" : "false");
});
list->addItem(showFullCPU);
auto* showVDDQ = new tsl::elm::ToggleListItem("VDDQ", getCurrentShowVDDQ());
auto* showVDDQ = new tsl::elm::ToggleListItem("VDD2", getCurrentShowVDDQ());
showVDDQ->setStateChangedListener([this, section](bool state) {
ult::setIniFileValue(configIniPath, section, "show_vddq", state ? "true" : "false");
});
list->addItem(showVDDQ);
auto* showVDD2 = new tsl::elm::ToggleListItem("VDD2", getCurrentShowVDD2());
auto* showVDD2 = new tsl::elm::ToggleListItem("VDDQ", getCurrentShowVDD2());
showVDD2->setStateChangedListener([this, section](bool state) {
ult::setIniFileValue(configIniPath, section, "show_vdd2", state ? "true" : "false");
});
@@ -424,11 +442,11 @@ public:
list->addItem(socVoltage);
if (isMiniMode) {
auto* PartLoadCPUGPU = new tsl::elm::ToggleListItem("RAM Load CPU/GPU", getCurrentShowRAMLoadCPUGPU());
PartLoadCPUGPU->setStateChangedListener([this, section](bool state) {
auto* partLoadCPUGPU = new tsl::elm::ToggleListItem("RAM Load CPU/GPU", getCurrentShowpartLoadCPUGPU());
partLoadCPUGPU->setStateChangedListener([this, section](bool state) {
ult::setIniFileValue(configIniPath, section, "show_RAM_load_CPU_GPU", state ? "true" : "false");
});
list->addItem(PartLoadCPUGPU);
list->addItem(partLoadCPUGPU);
}
if (isMiniMode || isMicroMode) {
@@ -518,6 +536,13 @@ private:
return value == "TRUE";
}
bool getCurrentFPSGraphRealTemps() {
std::string value = ult::parseValueFromIniSection(configIniPath, "fps-graph", "real_temps");
if (value.empty()) return false;
convertToUpper(value);
return value == "TRUE";
}
bool getCurrentRealFreqs() {
const std::string section = isMiniMode ? "mini" : "micro";
std::string value = ult::parseValueFromIniSection(configIniPath, section, "real_freqs");
@@ -534,6 +559,14 @@ private:
return value == "TRUE";
}
bool getCurrentRealTemps() {
const std::string section = isMiniMode ? "mini" : "micro";
std::string value = ult::parseValueFromIniSection(configIniPath, section, "real_temps");
if (value.empty()) return true;
convertToUpper(value);
return value == "TRUE";
}
bool getCurrentShowFullCPU() {
const std::string section = isMiniMode ? "mini" : "micro";
std::string value = ult::parseValueFromIniSection(configIniPath, section, "show_full_cpu");
@@ -575,7 +608,7 @@ private:
return value != "FALSE";
}
bool getCurrentShowRAMLoadCPUGPU() {
bool getCurrentShowpartLoadCPUGPU() {
const std::string section = isMiniMode ? "mini" : "micro";
std::string value = ult::parseValueFromIniSection(configIniPath, section, "show_RAM_load_CPU_GPU");
if (value.empty()) return false; // Default: false for mini, true for micro
@@ -636,6 +669,13 @@ private:
return value != "FALSE";
}
bool getCurrentFullRealTemps() {
std::string value = ult::parseValueFromIniSection(configIniPath, "full", "real_temps");
if (value.empty()) return false;
convertToUpper(value);
return value == "TRUE";
}
bool getCurrentShowDeltas() {
std::string value = ult::parseValueFromIniSection(configIniPath, "full", "show_deltas");
if (value.empty()) return true;
@@ -769,27 +809,12 @@ public:
class FramePaddingConfig : public tsl::Gui {
private:
std::string modeName;
bool isMiniMode;
bool isGameResolutionsMode;
bool isFPSCounterMode;
bool isFPSGraphMode;
int currentPadding;
public:
FramePaddingConfig(const std::string& mode) : modeName(mode) {
isMiniMode = (mode == "Mini");
isGameResolutionsMode = (mode == "Game Resolutions");
isFPSCounterMode = (mode == "FPS Counter");
isFPSGraphMode = (mode == "FPS Graph");
std::string section;
if (isMiniMode) section = "mini";
else if (isGameResolutionsMode) section = "game_resolutions";
else if (isFPSCounterMode) section = "fps-counter";
else if (isFPSGraphMode) section = "fps-graph";
const std::string value = ult::parseValueFromIniSection(configIniPath, section, "frame_padding");
currentPadding = value.empty() ? 10 : std::clamp(atoi(value.c_str()), 0, 14);
const std::string value = ult::parseValueFromIniSection(configIniPath, "mini", "frame_padding");
currentPadding = value.empty() ? 10 : std::clamp(atoi(value.c_str()), 0, 14); // max value 14
}
~FramePaddingConfig() {
@@ -800,12 +825,6 @@ public:
auto* list = new tsl::elm::List();
list->addItem(new tsl::elm::CategoryHeader("Frame Padding"));
std::string section;
if (isMiniMode) section = "mini";
else if (isGameResolutionsMode) section = "game_resolutions";
else if (isFPSCounterMode) section = "fps-counter";
else if (isFPSGraphMode) section = "fps-graph";
static const std::vector<int> paddingValues = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
for (int padding : paddingValues) {
auto* paddingItem = new tsl::elm::ListItem(std::to_string(padding) + " px");
@@ -813,9 +832,9 @@ public:
paddingItem->setValue(ult::CHECKMARK_SYMBOL);
lastSelectedListItem = paddingItem;
}
paddingItem->setClickListener([this, paddingItem, padding, section](uint64_t keys) {
paddingItem->setClickListener([this, paddingItem, padding](uint64_t keys) {
if (keys & KEY_A) {
ult::setIniFileValue(configIniPath, section, "frame_padding", std::to_string(padding));
ult::setIniFileValue(configIniPath, "mini", "frame_padding", std::to_string(padding));
paddingItem->setValue(ult::CHECKMARK_SYMBOL);
if (lastSelectedListItem && paddingItem != lastSelectedListItem)
lastSelectedListItem->setValue("");
@@ -2105,15 +2124,11 @@ private:
}
int getCurrentFramePadding() {
std::string section;
if (isMiniMode) section = "mini";
else if (isGameResolutionsMode) section = "game_resolutions";
else if (isFPSCounterMode) section = "fps-counter";
else if (isFPSGraphMode) section = "fps-graph";
else return 10;
std::string value = ult::parseValueFromIniSection(configIniPath, section, "frame_padding");
return value.empty() ? 10 : atoi(value.c_str());
if (isMiniMode) {
std::string value = ult::parseValueFromIniSection(configIniPath, "mini", "frame_padding");
return value.empty() ? 10 : atoi(value.c_str());
}
return 10;
}
std::string getCurrentTextAlign() {

View File

@@ -13,6 +13,9 @@ private:
char SOC_TEMP_c[12] = " -";
char PCB_TEMP_c[12] = " -";
char SKIN_TEMP_c[12] = " -";
char CPU_TEMP_c[12] = " -";
char GPU_TEMP_c[12] = " -";
char RAM_TEMP_c[12] = " -";
bool skipOnce = true;
bool runOnce = true;
@@ -402,19 +405,37 @@ public:
renderer->drawString("RAM", false, info_x, startY + lineHeight * 2+2*SPACING, fontSize, settings.catColor);
renderer->drawString(RAM_Load_c, false, value_x, startY + lineHeight * 2+2*SPACING, fontSize, settings.textColor);
// Line 3: SOC (with gradient color)
renderer->drawString("SOC", false, info_x, startY + lineHeight * 3+3*SPACING, fontSize, settings.catColor);
renderer->drawString(SOC_TEMP_c, false, value_x, startY + lineHeight * 3+3*SPACING, fontSize, socColor);
// Line 4: PCB (with gradient color)
renderer->drawString("PCB", false, info_x, startY + lineHeight * 4+4*SPACING, fontSize, settings.catColor);
renderer->drawString(PCB_TEMP_c, false, value_x, startY + lineHeight * 4+4*SPACING, fontSize, pcbColor);
// Line 5: SKIN (with gradient color)
renderer->drawString("Skin", false, info_x, startY + lineHeight * 5+5*SPACING, fontSize, settings.catColor);
renderer->drawString(SKIN_TEMP_c, false, value_x, startY + lineHeight * 5+5*SPACING, fontSize, skinColor);
}
});
// Line 3: CPU or SOC (with gradient color)
if (settings.realTemps && realCPU_Temp != 0) {
const tsl::Color cpuTempColor = settings.useDynamicColors ? tsl::GradientColor(realCPU_Temp / 1000.0f) : settings.textColor;
renderer->drawString("CPU", false, info_x, startY + lineHeight * 3+3*SPACING, fontSize, settings.catColor);
renderer->drawString(CPU_TEMP_c, false, value_x, startY + lineHeight * 3+3*SPACING, fontSize, cpuTempColor);
} else {
renderer->drawString("SOC", false, info_x, startY + lineHeight * 3+3*SPACING, fontSize, settings.catColor);
renderer->drawString(SOC_TEMP_c, false, value_x, startY + lineHeight * 3+3*SPACING, fontSize, socColor);
}
// Line 4: GPU or PCB (with gradient color)
if (settings.realTemps && realGPU_Temp != 0) {
const tsl::Color gpuTempColor = settings.useDynamicColors ? tsl::GradientColor(realGPU_Temp / 1000.0f) : settings.textColor;
renderer->drawString("GPU", false, info_x, startY + lineHeight * 4+4*SPACING, fontSize, settings.catColor);
renderer->drawString(GPU_TEMP_c, false, value_x, startY + lineHeight * 4+4*SPACING, fontSize, gpuTempColor);
} else {
renderer->drawString("PCB", false, info_x, startY + lineHeight * 4+4*SPACING, fontSize, settings.catColor);
renderer->drawString(PCB_TEMP_c, false, value_x, startY + lineHeight * 4+4*SPACING, fontSize, pcbColor);
}
// Line 5: RAM or SKIN (with gradient color)
if (settings.realTemps && realRAM_Temp != 0) {
const tsl::Color ramTempColor = settings.useDynamicColors ? tsl::GradientColor(realRAM_Temp / 1000.0f) : settings.textColor;
renderer->drawString("RAM", false, info_x, startY + lineHeight * 5+5*SPACING, fontSize, settings.catColor);
renderer->drawString(RAM_TEMP_c, false, value_x, startY + lineHeight * 5+5*SPACING, fontSize, ramTempColor);
} else {
renderer->drawString("Skin", false, info_x, startY + lineHeight * 5+5*SPACING, fontSize, settings.catColor);
renderer->drawString(SKIN_TEMP_c, false, value_x, startY + lineHeight * 5+5*SPACING, fontSize, skinColor);
}
}
});
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("", "");
rootFrame->setContent(Status);
@@ -470,6 +491,16 @@ public:
snprintf(PCB_TEMP_c, sizeof PCB_TEMP_c, "%2.1f\u00B0C", PCB_temperatureF);
snprintf(SKIN_TEMP_c, sizeof SKIN_TEMP_c, "%2d.%d\u00B0C",
skin_temperaturemiliC / 1000, (skin_temperaturemiliC / 100) % 10);
if (realCPU_Temp != 0) {
snprintf(CPU_TEMP_c, sizeof(CPU_TEMP_c), "%.1f\u00B0C", realCPU_Temp / 1000.0f);
}
if (realGPU_Temp != 0) {
snprintf(GPU_TEMP_c, sizeof(GPU_TEMP_c), "%.1f\u00B0C", realGPU_Temp / 1000.0f);
}
if (realRAM_Temp != 0) {
snprintf(RAM_TEMP_c, sizeof(RAM_TEMP_c), "%.1f\u00B0C", realRAM_Temp / 1000.0f);
}
// Atomically snapshot each idle tick once
const uint64_t idle0 = idletick0.load(std::memory_order_acquire);
@@ -496,8 +527,8 @@ public:
snprintf(CPU_Load_c, sizeof(CPU_Load_c), "%.1f%%", cpu_usageM);
snprintf(GPU_Load_c, sizeof(GPU_Load_c), "%d.%d%%", GPU_Load_u / 10, GPU_Load_u % 10);
snprintf(RAM_Load_c, sizeof(RAM_Load_c), "%hu.%hhu%%",
partLoad[SysClkPartLoad_EMC] / 10,
partLoad[SysClkPartLoad_EMC] % 10);
partLoad[HocClkPartLoad_EMC] / 10,
partLoad[HocClkPartLoad_EMC] % 10);
mutexUnlock(&mutex_Misc);

View File

@@ -20,6 +20,9 @@ private:
char SOC_temperature_c[32] = "";
char PCB_temperature_c[32] = "";
char skin_temperature_c[32] = "";
char CPU_temp_c[32] = "";
char GPU_temp_c[32] = "";
char RAM_temp_c[32] = "";
char BatteryDraw_c[64] = "";
char FPS_var_compressed_c[64] = "";
char RAM_load_c[64] = "";
@@ -233,10 +236,12 @@ public:
else if (realRAM_Hz && settings.showDeltas && (settings.showRealFreqs || settings.showTargetFreqs)) {
renderer->drawString(DeltaRAM_c, false, COMMON_MARGIN + deltaOffset, height_offset, 15, (settings.textColor));
}
static std::vector<std::string> PartLoadColoredChars = {"CPU", "GPU"};
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
renderer->drawStringWithColoredSections(RAM_load_c, false, PartLoadColoredChars, COMMON_MARGIN + valueOffset, height_offset+15, 15, (settings.textColor), settings.catColor2);
if (R_SUCCEEDED(hocclkCheck)) {
static std::vector<std::string> partLoadColoredChars = {"CPU", "GPU"};
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
renderer->drawStringWithColoredSections(RAM_load_c, false, partLoadColoredChars, COMMON_MARGIN + valueOffset, height_offset+15, 15, (settings.textColor), settings.catColor2);
}
}
if (R_SUCCEEDED(Hinted)) {
//static auto textWidth = renderer->getTextDimensions("Total \nApplication \nApplet \nSystem \nSystem Unsafe ", false, 15).first;
@@ -289,6 +294,41 @@ public:
renderer->drawString(PCB_temperature_c, false, current_x, 620+2, 15, pcbColor);
}
}
// Real temps - CPU, GPU, RAM
if (settings.realTemps && (realCPU_Temp != 0 || realGPU_Temp != 0 || realRAM_Temp != 0)) {
static auto cpuTempLabelWidth = renderer->getTextDimensions("CPU ", false, 15).first;
static auto gpuTempLabelWidth = renderer->getTextDimensions("GPU ", false, 15).first;
static auto ramTempLabelWidth = renderer->getTextDimensions("RAM ", false, 15).first;
uint32_t current_x = COMMON_MARGIN + 58;;
// CPU temp
if (realCPU_Temp != 0) {
const tsl::Color cpuTempColor = settings.useDynamicColors ? tsl::GradientColor(realCPU_Temp / 1000.0f) : settings.textColor;
renderer->drawString("CPU ", false, current_x, 635+2, 15, (settings.catColor2));
current_x += cpuTempLabelWidth;
renderer->drawString(CPU_temp_c, false, current_x, 635+2, 15, cpuTempColor);
current_x += renderer->getTextDimensions(CPU_temp_c, false, 15).first + 15;
}
// GPU temp
if (realGPU_Temp != 0) {
const tsl::Color gpuTempColor = settings.useDynamicColors ? tsl::GradientColor(realGPU_Temp / 1000.0f) : settings.textColor;
renderer->drawString("GPU ", false, current_x, 635+2, 15, (settings.catColor2));
current_x += gpuTempLabelWidth;
renderer->drawString(GPU_temp_c, false, current_x, 635+2, 15, gpuTempColor);
current_x += renderer->getTextDimensions(GPU_temp_c, false, 15).first + 15;
}
// RAM temp
if (realRAM_Temp != 0) {
const tsl::Color ramTempColor = settings.useDynamicColors ? tsl::GradientColor(realRAM_Temp / 1000.0f) : settings.textColor;
renderer->drawString("RAM ", false, current_x, 635+2, 15, (settings.catColor2));
current_x += ramTempLabelWidth;
renderer->drawString(RAM_temp_c, false, current_x, 635+2, 15, ramTempColor);
}
}
///FPS
if (GameRunning) {
@@ -443,12 +483,12 @@ public:
RAMPct_systemunsafe
);
if (R_SUCCEEDED(sysclkCheck)) {
const int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu];
if (R_SUCCEEDED(hocclkCheck)) {
const int RAM_GPU_Load = partLoad[HocClkPartLoad_EMC] - partLoad[HocClkPartLoad_EMCCpu];
snprintf(RAM_load_c, sizeof RAM_load_c,
"%u.%u%% CPU %u.%u%% GPU %u.%u%%",
partLoad[SysClkPartLoad_EMC] / 10, partLoad[SysClkPartLoad_EMC] % 10,
partLoad[SysClkPartLoad_EMCCpu] / 10, partLoad[SysClkPartLoad_EMCCpu] % 10,
partLoad[HocClkPartLoad_EMC] / 10, partLoad[HocClkPartLoad_EMC] % 10,
partLoad[HocClkPartLoad_EMCCpu] / 10, partLoad[HocClkPartLoad_EMCCpu] % 10,
RAM_GPU_Load / 10, RAM_GPU_Load % 10);
}
///Thermal
@@ -458,6 +498,17 @@ public:
snprintf(Rotation_SpeedLevel_c, sizeof Rotation_SpeedLevel_c, "%.1f%%", Rotation_Duty);
if (settings.realTemps) {
if (realCPU_Temp != 0) {
snprintf(CPU_temp_c, sizeof(CPU_temp_c), "%.1f°C", realCPU_Temp / 1000.0f);
}
if (realGPU_Temp != 0) {
snprintf(GPU_temp_c, sizeof(GPU_temp_c), "%.1f°C", realGPU_Temp / 1000.0f);
}
if (realRAM_Temp != 0) {
snprintf(RAM_temp_c, sizeof(RAM_temp_c), "%.1f°C", realRAM_Temp / 1000.0f);
}
}
///FPS
if (settings.showFPS == true) {
snprintf(PFPS_value_c, sizeof PFPS_value_c, "%1u", FPS);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -50,7 +50,7 @@ public:
smExit();
StartMiscThread();
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
// tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
}
~MiscOverlay() {
@@ -121,8 +121,8 @@ public:
});
//tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Horizon OC Monitor", APP_VERSION, true);
// tsl::elm::g_disableMenuCacheOnReturn.store(true, std::memory_order_release);
tsl::elm::HeaderOverlayFrame* rootFrame = new tsl::elm::HeaderOverlayFrame("Status Monitor Pro", APP_VERSION, true);
rootFrame->setContent(Status);
return rootFrame;

View File

@@ -29,125 +29,128 @@
#include <switch.h>
#include <string.h>
#include <stdatomic.h>
#include <sysclk/client/ipc.h>
#include <hocclk/client/ipc.h>
static Service g_sysclkSrv;
static Service g_hocclkSrv;
static atomic_size_t g_refCnt;
bool sysclkIpcRunning()
bool hocclkIpcRunning()
{
Handle handle;
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(HOCCLK_IPC_SERVICE_NAME), false, 1));
if (!running)
{
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME));
smUnregisterService(smEncodeName(HOCCLK_IPC_SERVICE_NAME));
}
return running;
}
Result sysclkIpcInitialize(void)
Result hocclkIpcInitialize(void)
{
Result rc = 0;
g_refCnt++;
if (serviceIsActive(&g_sysclkSrv))
if (serviceIsActive(&g_hocclkSrv))
return 0;
rc = smGetService(&g_sysclkSrv, SYSCLK_IPC_SERVICE_NAME);
rc = smGetService(&g_hocclkSrv, HOCCLK_IPC_SERVICE_NAME);
if (R_FAILED(rc)) sysclkIpcExit();
if (R_FAILED(rc)) hocclkIpcExit();
return rc;
}
void sysclkIpcExit(void)
void hocclkIpcExit(void)
{
if (--g_refCnt == 0)
{
serviceClose(&g_sysclkSrv);
serviceClose(&g_hocclkSrv);
}
}
Result sysclkIpcGetAPIVersion(u32* out_ver)
Result hocclkIpcGetAPIVersion(u32* out_ver)
{
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetApiVersion, *out_ver);
return serviceDispatchOut(&g_hocclkSrv, HocClkIpcCmd_GetApiVersion, *out_ver);
}
Result sysclkIpcGetVersionString(char* out, size_t len)
Result hocclkIpcGetVersionString(char* out, size_t len)
{
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetVersionString,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetVersionString,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out, len}},
);
}
Result sysclkIpcGetCurrentContext(SysClkContext* out_context)
Result hocclkIpcGetCurrentContext(HocClkContext* out_context)
{
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetCurrentContext, *out_context);
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetCurrentContext,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out_context, sizeof(HocClkContext)}},
);
}
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count)
Result hocclkIpcGetProfileCount(u64 tid, u8* out_count)
{
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfileCount, tid, *out_count);
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetProfileCount, tid, *out_count);
}
Result sysclkIpcSetEnabled(bool enabled)
Result hocclkIpcSetEnabled(bool enabled)
{
u8 enabledRaw = (u8)enabled;
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetEnabled, enabledRaw);
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetEnabled, enabledRaw);
}
Result sysclkIpcSetOverride(SysClkModule module, u32 hz)
Result hocclkIpcSetOverride(HocClkModule module, u32 hz)
{
SysClkIpc_SetOverride_Args args = {
HocClkIpc_SetOverride_Args args = {
.module = module,
.hz = hz
};
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetOverride, args);
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetOverride, args);
}
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles)
Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles)
{
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = {{out_profiles, sizeof(SysClkTitleProfileList)}},
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetProfiles, tid,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out_profiles, sizeof(HocClkTitleProfileList)}},
);
}
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles)
{
SysClkIpc_SetProfiles_Args args;
HocClkIpc_SetProfiles_Args args;
args.tid = tid;
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList));
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args);
memcpy(&args.profiles, profiles, sizeof(HocClkTitleProfileList));
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetProfiles, args);
}
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues)
Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues)
{
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = {{out_configValues, sizeof(SysClkConfigValueList)}},
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetConfigValues,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out_configValues, sizeof(HocClkConfigValueList)}},
);
}
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues)
Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues)
{
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
.buffers = {{configValues, sizeof(SysClkConfigValueList)}},
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_SetConfigValues,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_In },
.buffers = {{configValues, sizeof(HocClkConfigValueList)}},
);
}
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount)
Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount)
{
SysClkIpc_GetFreqList_Args args = {
HocClkIpc_GetFreqList_Args args = {
.module = module,
.maxCount = maxCount
};
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount,
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetFreqList, args, *outCount,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{list, maxCount * sizeof(u32)}},
);
@@ -156,11 +159,11 @@ Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* o
Result hocClkIpcSetKipData()
{
u32 temp = 0;
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp);
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetKipData, temp);
}
Result hocClkIpcGetKipData()
{
u32 temp = 0;
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp);
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetKipData, temp);
}

View File

@@ -0,0 +1,897 @@
/*
* Copyright (c) Atmosphère-NX
*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "ldr_capabilities.hpp"
#include "ldr_content_management.hpp"
#include "ldr_development_manager.hpp"
#include "ldr_launch_record.hpp"
#include "ldr_meta.hpp"
#include "ldr_patcher.hpp"
#include "ldr_process_creation.hpp"
#include "ldr_ro_manager.hpp"
#include "oc/oc_loader.hpp"
namespace ams::ldr {
namespace {
/* Convenience defines. */
constexpr size_t SystemResourceSizeMax = 0x1FE00000;
constexpr size_t AutoLoadModuleSizeMax = 0x800000000;
/* Types. */
enum NsoIndex {
Nso_Rtld = 0,
Nso_Main = 1,
Nso_Wkc0 = 2,
Nso_Wkc1 = 3,
Nso_Wkc2 = 4,
Nso_Wkc3 = 5,
Nso_Wkc4 = 6,
Nso_Wkc5 = 7,
Nso_Wkc6 = 8,
Nso_Wkc7 = 9,
Nso_Wkc8 = 10,
Nso_Wkc9 = 11,
Nso_SubSdk0 = 12,
Nso_SubSdk1 = 13,
Nso_SubSdk2 = 14,
Nso_SubSdk3 = 15,
Nso_SubSdk4 = 16,
Nso_SubSdk5 = 17,
Nso_SubSdk6 = 18,
Nso_SubSdk7 = 19,
Nso_SubSdk8 = 20,
Nso_SubSdk9 = 21,
Nso_Sdk = 22,
Nso_Count,
};
constexpr inline const char *NsoPaths[Nso_Count] = {
ENCODE_ATMOSPHERE_CODE_PATH("/rtld"),
ENCODE_ATMOSPHERE_CODE_PATH("/main"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc0"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc1"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc2"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc3"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc4"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc5"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc6"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc7"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc8"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc9"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk0"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk1"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk2"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk3"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk4"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk5"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk6"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk7"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk8"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk9"),
ENCODE_ATMOSPHERE_CODE_PATH("/sdk"),
};
constexpr const char *GetNsoPath(size_t idx) {
AMS_ABORT_UNLESS(idx < Nso_Count);
return NsoPaths[idx];
}
struct ProcessInfo {
os::NativeHandle process_handle;
uintptr_t args_address;
size_t args_size;
uintptr_t nso_address[Nso_Count];
size_t nso_size[Nso_Count];
};
struct AutoLoadModuleInfo {
bool has_rtld;
bool has_main;
bool has_sdk;
bool has_subsdk;
bool has_nso[Nso_Count];
};
/* Global NSO header cache. */
NsoHeader g_nso_headers[Nso_Count];
/* Pcv/Ptm check cache */
bool g_is_pcv;
bool g_is_ptm;
Result ValidateProgramVersion(ncm::ProgramId program_id, u32 version) {
/* No version verification is done before 8.1.0. */
R_SUCCEED_IF(hos::GetVersion() < hos::Version_8_1_0);
/* No verification is done if development. */
R_SUCCEED_IF(IsDevelopmentForAntiDowngradeCheck());
/* TODO: Anti-downgrade checking does not make very much sense for us. Should we do anything? */
AMS_UNUSED(program_id, version);
R_SUCCEED();
}
/* Helpers. */
Result GetProgramInfoFromMeta(ProgramInfo *out, const Meta *meta) {
/* Copy basic info. */
out->main_thread_priority = meta->npdm->main_thread_priority;
out->default_cpu_id = meta->npdm->default_cpu_id;
out->main_thread_stack_size = meta->npdm->main_thread_stack_size;
out->program_id = meta->aci->program_id;
/* Copy access controls. */
size_t offset = 0;
#define COPY_ACCESS_CONTROL(source, which) \
({ \
const size_t size = meta->source->which##_size; \
R_UNLESS(offset + size <= sizeof(out->ac_buffer), ldr::ResultInternalError()); \
out->source##_##which##_size = size; \
std::memcpy(out->ac_buffer + offset, meta->source##_##which, size); \
offset += size; \
})
/* Copy all access controls to buffer. */
COPY_ACCESS_CONTROL(acid, sac);
COPY_ACCESS_CONTROL(aci, sac);
COPY_ACCESS_CONTROL(acid, fac);
COPY_ACCESS_CONTROL(aci, fah);
#undef COPY_ACCESS_CONTROL
/* Copy flags. */
out->flags = MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32));
R_SUCCEED();
}
bool IsApplet(const Meta *meta) {
return (MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Applet;
}
bool IsApplication(const Meta *meta) {
return (MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Application;
}
Npdm::AddressSpaceType GetAddressSpaceType(const Meta *meta) {
return static_cast<Npdm::AddressSpaceType>((meta->npdm->flags & Npdm::MetaFlag_AddressSpaceTypeMask) >> Npdm::MetaFlag_AddressSpaceTypeShift);
}
Acid::PoolPartition GetPoolPartition(const Meta *meta) {
return static_cast<Acid::PoolPartition>((meta->acid->flags & Acid::AcidFlag_PoolPartitionMask) >> Acid::AcidFlag_PoolPartitionShift);
}
Result LoadAutoLoadHeaders(NsoHeader *nso_headers, AutoLoadModuleInfo *ali, u32 acid_flags) {
/* Clear NSOs. */
std::memset(nso_headers, 0, sizeof(*nso_headers) * Nso_Count);
*ali = {};
for (size_t i = 0; i < Nso_Count; i++) {
/* Only load browser DLLs if acid flags say to do so. */
switch (i) {
case Nso_Wkc0:
case Nso_Wkc1:
case Nso_Wkc2:
case Nso_Wkc3:
case Nso_Wkc4:
case Nso_Wkc5:
case Nso_Wkc6:
case Nso_Wkc7:
case Nso_Wkc8:
case Nso_Wkc9:
if ((acid_flags & Acid::AcidFlag_LoadBrowserCoreDll) == 0) {
continue;
}
break;
}
fs::FileHandle file;
if (R_SUCCEEDED(fs::OpenFile(std::addressof(file), GetNsoPath(i), fs::OpenMode_Read))) {
ON_SCOPE_EXIT { fs::CloseFile(file); };
/* Read NSO header. */
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, 0, nso_headers + i, sizeof(*nso_headers)));
R_UNLESS(read_size == sizeof(*nso_headers), ldr::ResultInvalidNso());
/* Note nso is present. */
switch (i) {
case Nso_Rtld:
ali->has_rtld = true;
break;
case Nso_Main:
ali->has_main = true;
break;
case Nso_SubSdk0:
case Nso_SubSdk1:
case Nso_SubSdk2:
case Nso_SubSdk3:
case Nso_SubSdk4:
case Nso_SubSdk5:
case Nso_SubSdk6:
case Nso_SubSdk7:
case Nso_SubSdk8:
case Nso_SubSdk9:
ali->has_subsdk = true;
break;
case Nso_Sdk:
ali->has_sdk = true;
break;
}
ali->has_nso[i] = true;
}
}
R_SUCCEED();
}
Result CheckAutoLoad(const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, u32 acid_flags) {
/* We must always have a main. */
R_UNLESS(ali->has_main, ldr::ResultInvalidNso());
/* All NSOs must not be --X. */
/* This is "probably" not checked on Ounce? */
for (size_t i = 0; i < Nso_Count; ++i) {
R_UNLESS((nso_headers[i].flags & NsoHeader::Flag_PreventCodeReads) == 0, ldr::ResultInvalidNso());
}
/* If we don't have an RTLD, we must only have a main. */
const bool has_browser_dll = (acid_flags & Acid::AcidFlag_LoadBrowserCoreDll) != 0;
if (!ali->has_rtld) {
/* If don't have rtld, we must also not have sdk. */
R_UNLESS(!ali->has_sdk, ldr::ResultInvalidNso());
/* We must also not have both subsdk and browser dll. */
R_UNLESS(!(ali->has_subsdk && has_browser_dll), ldr::ResultInvalidNso());
} else {
/* If we have rtld, we must not have browser core dll. */
R_UNLESS(!has_browser_dll, ldr::ResultInvalidNso());
}
/* Check NSO extents. */
for (size_t i = 0; i < Nso_Count; i++) {
/* Only validate the nsos we have. */
if (!ali->has_nso[i]) {
continue;
}
/* NSOs must have page-aligned segments. */
R_UNLESS(util::IsAligned(nso_headers[i].text_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(nso_headers[i].ro_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(nso_headers[i].rw_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
/* NSOs must have zero text offset. */
R_UNLESS(nso_headers[i].text_dst_offset == 0, ldr::ResultInvalidNso());
/* NSO .text must precede .rodata. */
const size_t text_end = static_cast<size_t>(nso_headers[i].text_dst_offset) + static_cast<size_t>(nso_headers[i].text_size);
R_UNLESS(text_end <= static_cast<size_t>(nso_headers[i].ro_dst_offset), ldr::ResultInvalidNso());
/* NSO .rodata must precede .rwdata. */
const size_t ro_end = static_cast<size_t>(nso_headers[i].ro_dst_offset) + static_cast<size_t>(nso_headers[i].ro_size);
R_UNLESS(ro_end <= static_cast<size_t>(nso_headers[i].rw_dst_offset), ldr::ResultInvalidNso());
}
R_SUCCEED();
}
constexpr const ncm::ProgramId UnqualifiedApprovalProgramIds[] = {
{ 0x010003F003A34000 }, /* Pokemon: Let's Go, Pikachu! */
{ 0x0100152000022000 }, /* Mario Kart 8 Deluxe */
{ 0x0100165003504000 }, /* Nintendo Labo Toy-Con 04: VR Kit */
{ 0x0100187003A36000 }, /* Pokemon: Let's Go, Eevee! */
{ 0x01002E5008C56000 }, /* Pokemon Sword [Live Tournament] */
{ 0x01002FF008C24000 }, /* Ring Fit Adventure */
{ 0x010049900F546001 }, /* Super Mario 3D All-Stars: Super Mario 64 */
{ 0x010057D00ECE4000 }, /* Nintendo Switch Online (Nintendo 64) [for Japan] */
{ 0x01006F8002326000 }, /* Animal Crossing: New Horizons */
{ 0x01006FB00F50E000 }, /* [???] */
{ 0x010070300F50C000 }, /* [???] */
{ 0x010075100E8EC000 }, /* 马力欧卡丁车8 豪华版 [Mario Kart 8 Deluxe for China] */
{ 0x01008DB008C2C000 }, /* Pokemon Shield */
{ 0x01009AD008C4C000 }, /* Pokemon: Let's Go, Pikachu! [Kiosk] */
{ 0x0100A66003384000 }, /* Hulu */
{ 0x0100ABF008968000 }, /* Pokemon Sword */
{ 0x0100C9A00ECE6000 }, /* Nintendo Switch Online (Nintendo 64) [for America] */
{ 0x0100ED100BA3A000 }, /* Mario Kart Live: Home Circuit */
{ 0x0100F38011CFE000 }, /* Animal Crossing: New Horizons Island Transfer Tool */
{ 0x0100F6B011028000 }, /* 健身环大冒险 [Ring Fit Adventure for China] */
};
/* Check that the unqualified approval programs are sorted. */
static_assert([]() -> bool {
for (size_t i = 0; i < util::size(UnqualifiedApprovalProgramIds) - 1; ++i) {
if (UnqualifiedApprovalProgramIds[i].value >= UnqualifiedApprovalProgramIds[i + 1].value) {
return false;
}
}
return true;
}());
bool IsUnqualifiedApprovalProgramId(ncm::ProgramId program_id) {
/* Check if the program id is one with unqualified approval. */
return std::binary_search(std::begin(UnqualifiedApprovalProgramIds), std::end(UnqualifiedApprovalProgramIds), program_id);
}
bool IsUnqualifiedApproval(const Meta *meta) {
/* If the meta has unqualified approval flag, it's unqualified approval. */
if (meta->acid->flags & ldr::Acid::AcidFlag_UnqualifiedApproval) {
return true;
}
/* If the unqualified approval flag is not set, the program must be an application. */
if (!IsApplication(meta)) {
return false;
}
/* The program id must be a force unqualified approval program id. */
return IsUnqualifiedApprovalProgramId(meta->acid->program_id_min) && meta->acid->program_id_min == meta->acid->program_id_max;
}
Result ValidateMeta(const Meta *meta, const ncm::ProgramLocation &loc, const fs::CodeVerificationData &code_verification_data) {
/* Validate version. */
R_TRY(ValidateProgramVersion(loc.program_id, meta->npdm->version));
/* Validate program id. */
R_UNLESS(meta->aci->program_id >= meta->acid->program_id_min, ldr::ResultInvalidProgramId());
R_UNLESS(meta->aci->program_id <= meta->acid->program_id_max, ldr::ResultInvalidProgramId());
/* Validate the kernel capabilities. */
R_TRY(TestCapability(static_cast<const util::BitPack32 *>(meta->acid_kac), meta->acid->kac_size / sizeof(util::BitPack32), static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)));
/* Check if NCA is PCV or PTM */
g_is_pcv = meta->aci->program_id == ncm::SystemProgramId::Pcv;
g_is_ptm = meta->aci->program_id == ncm::SystemProgramId::Ptm;
/* If we have data to validate, validate it. */
if (meta->check_verification_data) {
const u8 *sig = code_verification_data.signature;
const size_t sig_size = sizeof(code_verification_data.signature);
const u8 *mod = static_cast<u8 *>(meta->modulus);
const size_t mod_size = crypto::Rsa2048PssSha256Verifier::ModulusSize;
const u8 *exp = fssystem::GetAcidSignatureKeyPublicExponent();
const size_t exp_size = fssystem::AcidSignatureKeyPublicExponentSize;
const u8 *hsh = code_verification_data.target_hash;
const size_t hsh_size = sizeof(code_verification_data.target_hash);
const bool is_signature_valid = crypto::VerifyRsa2048PssSha256WithHash(sig, sig_size, mod, mod_size, exp, exp_size, hsh, hsh_size);
/* If the signature check fails, we need to check if this is allowable. */
if (!is_signature_valid) {
/* We have to enforce signature checks on prod and when we have a signature to check on dev. */
R_UNLESS(IsDevelopmentForAcidProductionCheck(), ldr::ResultInvalidNcaSignature());
R_UNLESS(!code_verification_data.has_data, ldr::ResultInvalidNcaSignature());
/* There was no signature to check on dev. Check if this is acceptable. */
R_UNLESS(IsUnqualifiedApproval(meta), ldr::ResultInvalidNcaSignature());
}
}
/* All good. */
R_SUCCEED();
}
Result GetCreateProcessFlags(u32 *out, const Meta *meta, const u32 ldr_flags) {
const u8 meta_flags = meta->npdm->flags;
u32 flags = 0;
/* Set Is64Bit. */
if (meta_flags & Npdm::MetaFlag_Is64Bit) {
flags |= svc::CreateProcessFlag_Is64Bit;
}
/* Set AddressSpaceType. */
switch (GetAddressSpaceType(meta)) {
case Npdm::AddressSpaceType_32Bit:
flags |= svc::CreateProcessFlag_AddressSpace32Bit;
break;
case Npdm::AddressSpaceType_64BitDeprecated:
flags |= svc::CreateProcessFlag_AddressSpace64BitDeprecated;
break;
case Npdm::AddressSpaceType_32BitWithoutAlias:
flags |= svc::CreateProcessFlag_AddressSpace32BitWithoutAlias;
break;
case Npdm::AddressSpaceType_64Bit:
flags |= svc::CreateProcessFlag_AddressSpace64Bit;
break;
default:
R_THROW(ldr::ResultInvalidMeta());
}
/* Set Enable Debug. */
if (ldr_flags & CreateProcessFlag_EnableDebug) {
flags |= svc::CreateProcessFlag_EnableDebug;
}
/* Set Enable ASLR. */
if (!(ldr_flags & CreateProcessFlag_DisableAslr)) {
flags |= svc::CreateProcessFlag_EnableAslr;
}
/* Set Is Application. */
if (IsApplication(meta)) {
flags |= svc::CreateProcessFlag_IsApplication;
/* 7.0.0+: Set OptimizeMemoryAllocation if relevant. */
if (hos::GetVersion() >= hos::Version_7_0_0) {
if (meta_flags & Npdm::MetaFlag_OptimizeMemoryAllocation) {
flags |= svc::CreateProcessFlag_OptimizeMemoryAllocation;
}
}
}
/* 5.0.0+ Set Pool Partition. */
if (hos::GetVersion() >= hos::Version_5_0_0) {
/* TODO: Nintendo no longer accepts Applet when pool partition == application. Would this break hbl/anything else in the hb ecosystem? */
/* TODO: Nintendo uses a helper bool MakeSvcPoolPartitionFlag(u32 *out, Acid::PoolPartition partition); */
switch (GetPoolPartition(meta)) {
case Acid::PoolPartition_Application:
if (IsApplet(meta)) {
flags |= svc::CreateProcessFlag_PoolPartitionApplet;
} else {
flags |= svc::CreateProcessFlag_PoolPartitionApplication;
}
break;
case Acid::PoolPartition_Applet:
flags |= svc::CreateProcessFlag_PoolPartitionApplet;
break;
case Acid::PoolPartition_System:
flags |= svc::CreateProcessFlag_PoolPartitionSystem;
break;
case Acid::PoolPartition_SystemNonSecure:
flags |= svc::CreateProcessFlag_PoolPartitionSystemNonSecure;
break;
default:
R_THROW(ldr::ResultInvalidMeta());
}
} else if (hos::GetVersion() >= hos::Version_4_0_0) {
/* On 4.0.0+, the corresponding bit was simply "UseSecureMemory". */
if (meta->acid->flags & Acid::AcidFlag_DeprecatedUseSecureMemory) {
flags |= svc::CreateProcessFlag_DeprecatedUseSecureMemory;
}
}
/* 11.0.0+/meso Set Disable DAS merge. */
if (meta_flags & Npdm::MetaFlag_DisableDeviceAddressSpaceMerge) {
flags |= svc::CreateProcessFlag_DisableDeviceAddressSpaceMerge;
}
/* 18.0.0+/meso Set Alias region extra size. */
if (meta_flags & Npdm::MetaFlag_EnableAliasRegionExtraSize) {
flags |= svc::CreateProcessFlag_EnableAliasRegionExtraSize;
}
*out = flags;
R_SUCCEED();
}
Result GetCreateProcessParameter(svc::CreateProcessParameter *out, const Meta *meta, u32 flags, os::NativeHandle resource_limit) {
/* Clear output. */
std::memset(out, 0, sizeof(*out));
/* Set name, version, program id, resource limit handle. */
std::memcpy(out->name, meta->npdm->program_name, sizeof(out->name) - 1);
out->version = meta->npdm->version;
out->program_id = meta->aci->program_id.value;
out->reslimit = resource_limit;
/* Set flags. */
R_TRY(GetCreateProcessFlags(std::addressof(out->flags), meta, flags));
/* 3.0.0+ System Resource Size. */
if (hos::GetVersion() >= hos::Version_3_0_0) {
/* Validate size is aligned. */
R_UNLESS(util::IsAligned(meta->npdm->system_resource_size, os::MemoryBlockUnitSize), ldr::ResultInvalidSize());
/* Validate system resource usage. */
if (meta->npdm->system_resource_size) {
/* Process must be 64-bit. */
R_UNLESS((out->flags & svc::CreateProcessFlag_AddressSpace64Bit), ldr::ResultInvalidMeta());
/* Process must be application or applet. */
R_UNLESS(IsApplication(meta) || IsApplet(meta), ldr::ResultInvalidMeta());
/* Size must be less than or equal to max. */
R_UNLESS(meta->npdm->system_resource_size <= SystemResourceSizeMax, ldr::ResultInvalidMeta());
}
out->system_resource_num_pages = meta->npdm->system_resource_size >> 12;
}
R_SUCCEED();
}
u64 GenerateSecureRandom(u64 max) {
/* Generate a cryptographically random number. */
u64 rand;
crypto::GenerateCryptographicallyRandomBytes(std::addressof(rand), sizeof(rand));
/* Coerce into range. */
return rand % (max + 1);
}
Result DecideAddressSpaceLayout(ProcessInfo *out, svc::CreateProcessParameter *out_param, const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, const ArgumentStore::Entry *argument) {
/* Clear output. */
out->args_address = 0;
out->args_size = 0;
std::memset(out->nso_address, 0, sizeof(out->nso_address));
std::memset(out->nso_size, 0, sizeof(out->nso_size));
size_t total_size = 0;
bool argument_allocated = false;
/* Calculate base offsets. */
for (size_t i = 0; i < Nso_Count; i++) {
if (ali->has_nso[i]) {
out->nso_address[i] = total_size;
const size_t text_end = static_cast<size_t>(nso_headers[i].text_dst_offset) + static_cast<size_t>(nso_headers[i].text_size);
const size_t ro_end = static_cast<size_t>(nso_headers[i].ro_dst_offset) + static_cast<size_t>(nso_headers[i].ro_size);
const size_t rw_end = static_cast<size_t>(nso_headers[i].rw_dst_offset) + static_cast<size_t>(nso_headers[i].rw_size);
out->nso_size[i] = text_end;
out->nso_size[i] = std::max(out->nso_size[i], ro_end);
out->nso_size[i] = std::max(out->nso_size[i], rw_end);
out->nso_size[i] += static_cast<size_t>(nso_headers[i].bss_size);
const size_t aligned_up_size = util::AlignUp(out->nso_size[i], os::MemoryPageSize) & (AutoLoadModuleSizeMax - 1);
R_UNLESS(out->nso_size[i] <= aligned_up_size, ldr::ResultInvalidNso());
R_UNLESS(aligned_up_size > 0, ldr::ResultInvalidNso());
out->nso_size[i] = aligned_up_size;
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->nso_size[i]), ldr::ResultInvalidNso());
total_size += out->nso_size[i];
if (!argument_allocated && argument != nullptr) {
out->args_address = total_size;
out->args_size = util::AlignUp(2 * sizeof(u32) + argument->argument_size * 2 + ArgumentStore::ArgumentBufferSize, os::MemoryPageSize);
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->args_size), ldr::ResultInvalidNso());
total_size += out->args_size;
argument_allocated = true;
}
}
}
/* Calculate ASLR. */
uintptr_t aslr_start = 0;
size_t aslr_size = 0;
if (hos::GetVersion() >= hos::Version_2_0_0) {
switch (out_param->flags & svc::CreateProcessFlag_AddressSpaceMask) {
case svc::CreateProcessFlag_AddressSpace32Bit:
case svc::CreateProcessFlag_AddressSpace32BitWithoutAlias:
aslr_start = svc::AddressSmallMap32Start;
aslr_size = svc::AddressSmallMap32Size;
break;
case svc::CreateProcessFlag_AddressSpace64BitDeprecated:
aslr_start = svc::AddressSmallMap36Start;
aslr_size = svc::AddressSmallMap36Size;
break;
case svc::CreateProcessFlag_AddressSpace64Bit:
aslr_start = svc::AddressMap39Start;
aslr_size = svc::AddressMap39Size;
break;
AMS_UNREACHABLE_DEFAULT_CASE();
}
} else {
/* On 1.0.0, only 2 address space types existed. */
if (out_param->flags & svc::CreateProcessFlag_AddressSpace64BitDeprecated) {
aslr_start = svc::AddressSmallMap36Start;
aslr_size = svc::AddressSmallMap36Size;
} else {
aslr_start = svc::AddressSmallMap32Start;
aslr_size = svc::AddressSmallMap32Size;
}
}
R_UNLESS(total_size <= aslr_size, svc::ResultOutOfMemory());
/* Set Create Process output. */
uintptr_t aslr_slide = 0;
size_t free_size = (aslr_size - total_size);
if (out_param->flags & svc::CreateProcessFlag_EnableAslr) {
aslr_slide = GenerateSecureRandom(free_size / os::MemoryBlockUnitSize) * os::MemoryBlockUnitSize;
}
/* Set out. */
aslr_start += aslr_slide;
for (size_t i = 0; i < Nso_Count; i++) {
if (ali->has_nso[i]) {
R_UNLESS(util::CanAddWithoutOverflow(out->nso_address[i], aslr_start), ldr::ResultInvalidNso());
out->nso_address[i] += aslr_start;
}
}
if (out->args_address) {
R_UNLESS(util::CanAddWithoutOverflow(out->args_address, aslr_start), ldr::ResultInvalidNso());
out->args_address += aslr_start;
}
out_param->code_address = aslr_start;
out_param->code_num_pages = total_size >> 12;
R_SUCCEED();
}
Result LoadAutoLoadModuleSegment(fs::FileHandle file, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) {
/* Select read size based on compression. */
if (!is_compressed) {
file_size = segment->size;
}
/* Validate size. */
R_UNLESS(file_size <= segment->size, ldr::ResultInvalidNso());
R_UNLESS(segment->size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
/* Load data from file. */
uintptr_t load_address = is_compressed ? map_end - file_size : map_base;
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, segment->file_offset, reinterpret_cast<void *>(load_address), file_size));
R_UNLESS(read_size == file_size, ldr::ResultInvalidNso());
/* Uncompress if necessary. */
if (is_compressed) {
bool decompressed = (util::DecompressLZ4(reinterpret_cast<void *>(map_base), segment->size, reinterpret_cast<const void *>(load_address), file_size) == static_cast<int>(segment->size));
R_UNLESS(decompressed, ldr::ResultInvalidNso());
}
/* Check hash if necessary. */
if (check_hash) {
u8 hash[crypto::Sha256Generator::HashSize];
crypto::GenerateSha256(hash, sizeof(hash), reinterpret_cast<void *>(map_base), segment->size);
R_UNLESS(std::memcmp(hash, file_hash, sizeof(hash)) == 0, ldr::ResultInvalidNso());
}
R_SUCCEED();
}
Result LoadAutoLoadModule(os::NativeHandle process_handle, fs::FileHandle file, const NsoHeader *nso_header, uintptr_t nso_address, size_t nso_size) {
/* Map and read data from file. */
{
/* Map the process memory. */
void *mapped_memory = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(mapped_memory), process_handle, nso_address, nso_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(mapped_memory, process_handle, nso_address, nso_size); };
const uintptr_t map_address = reinterpret_cast<uintptr_t>(mapped_memory);
/* Load NSO segments. */
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Text]), nso_header->text_compressed_size, nso_header->text_hash, (nso_header->flags & NsoHeader::Flag_CompressedText) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashText) != 0, map_address + nso_header->text_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Ro]), nso_header->ro_compressed_size, nso_header->ro_hash, (nso_header->flags & NsoHeader::Flag_CompressedRo) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashRo) != 0, map_address + nso_header->ro_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Rw]), nso_header->rw_compressed_size, nso_header->rw_hash, (nso_header->flags & NsoHeader::Flag_CompressedRw) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashRw) != 0, map_address + nso_header->rw_dst_offset, map_address + nso_size));
/* Clear unused space to zero. */
const size_t text_end = static_cast<size_t>(nso_header->text_dst_offset) + static_cast<size_t>(nso_header->text_size);
const size_t ro_end = static_cast<size_t>(nso_header->ro_dst_offset) + static_cast<size_t>(nso_header->ro_size);
const size_t rw_end = static_cast<size_t>(nso_header->rw_dst_offset) + static_cast<size_t>(nso_header->rw_size);
std::memset(reinterpret_cast<void *>(map_address + 0), 0, nso_header->text_dst_offset);
std::memset(reinterpret_cast<void *>(map_address + text_end), 0, nso_header->ro_dst_offset - text_end);
std::memset(reinterpret_cast<void *>(map_address + ro_end), 0, nso_header->rw_dst_offset - ro_end);
std::memset(reinterpret_cast<void *>(map_address + rw_end), 0, nso_header->bss_size);
/* Apply embedded patches. */
ApplyEmbeddedPatchesToModule(nso_header->module_id, map_address, nso_size);
/* Apply IPS patches. */
LocateAndApplyIpsPatchesToModule(nso_header->module_id, map_address, nso_size);
/* Apply PCV and PTM patches */
if (g_is_pcv) {
hoc::pcv::Patch(map_address, nso_size);
}
if (g_is_ptm) {
hoc::ptm::Patch(map_address, nso_size);
}
}
/* Set permissions. */
const size_t text_size = util::AlignUp(nso_header->text_size, os::MemoryPageSize);
const size_t ro_size = util::AlignUp(nso_header->ro_size, os::MemoryPageSize);
const size_t rw_size = util::AlignUp(nso_header->rw_size + nso_header->bss_size, os::MemoryPageSize);
if (text_size) {
const bool prevent_code_reads = (nso_header->flags & NsoHeader::Flag_PreventCodeReads);
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->text_dst_offset, text_size, prevent_code_reads ? os::MemoryPermission_ExecuteOnly : os::MemoryPermission_ReadExecute));
}
if (ro_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->ro_dst_offset, ro_size, os::MemoryPermission_ReadOnly));
}
if (rw_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->rw_dst_offset, rw_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result LoadAutoLoadModules(const ProcessInfo *process_info, const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, const ArgumentStore::Entry *argument) {
/* Load each NSO. */
for (size_t i = 0; i < Nso_Count; i++) {
if (ali->has_nso[i]) {
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), GetNsoPath(i), fs::OpenMode_Read));
ON_SCOPE_EXIT { fs::CloseFile(file); };
R_TRY(LoadAutoLoadModule(process_info->process_handle, file, nso_headers + i, process_info->nso_address[i], process_info->nso_size[i]));
}
}
/* Load arguments, if present. */
if (argument != nullptr) {
/* Write argument data into memory. */
{
void *map_address = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(map_address), process_info->process_handle, process_info->args_address, process_info->args_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(map_address, process_info->process_handle, process_info->args_address, process_info->args_size); };
ProgramArguments *args = static_cast<ProgramArguments *>(map_address);
std::memset(args, 0, sizeof(*args));
args->allocated_size = process_info->args_size;
args->arguments_size = argument->argument_size;
std::memcpy(args->arguments, argument->argument, argument->argument_size);
}
/* Set argument region permissions. */
/* NOTE: Nintendo uses svc::SetProcessMemoryPermission directly here. */
R_TRY(os::SetProcessMemoryPermission(process_info->process_handle, process_info->args_address, process_info->args_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result CreateProcessAndLoadAutoLoadModules(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const AutoLoadModuleInfo *ali, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit) {
/* Get CreateProcessParameter. */
svc::CreateProcessParameter param;
R_TRY(GetCreateProcessParameter(std::addressof(param), meta, flags, resource_limit));
/* Decide on an NSO layout. */
R_TRY(DecideAddressSpaceLayout(out, std::addressof(param), nso_headers, ali, argument));
/* Actually create process. */
svc::Handle process_handle;
R_TRY(svc::CreateProcess(std::addressof(process_handle), std::addressof(param), static_cast<const u32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(u32)));
/* Set the output handle, and ensure that if we fail after this point we clean it up. */
out->process_handle = process_handle;
ON_RESULT_FAILURE { svc::CloseHandle(process_handle); };
/* Load all auto load modules. */
R_RETURN(LoadAutoLoadModules(out, nso_headers, ali, argument));
}
}
/* Process Creation API. */
Result CreateProcess(os::NativeHandle *out, PinId pin_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status, const char *path, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit, const ldr::ProgramAttributes &attrs) {
/* Mount code. */
AMS_UNUSED(path);
ScopedCodeMountForCode mount(loc, override_status, attrs);
R_TRY(mount.GetResult());
/* Load meta, possibly from cache. */
Meta meta;
R_TRY(LoadMetaFromCache(std::addressof(meta), loc, override_status, attrs.platform));
/* Validate meta. */
R_TRY(ValidateMeta(std::addressof(meta), loc, mount.GetCodeVerificationData()));
/* If we should, load/validate the browser core dll. */
util::optional<ScopedCodeMountForBrowserCoreDll> bdll_mount;
if ((meta.acid->flags & Acid::AcidFlag_LoadBrowserCoreDll)) {
/* NOTE: I'm unsure whether we should be getting a fresh override status (allowing for different override between main and bdll?) */
/* or whether we should be using the main override status. Going to go with main, for sanity's sake. */
/* Also noting that Nintendo always passes ProgramAttributes=0 here, but this "should" be different on Ounce? */
/* Kind of unclear how to handle this without knowing what exactly is being ifdef'd. */
const ncm::ProgramLocation bdll_loc = ncm::ProgramLocation::Make(ncm::SystemProgramId::BrowserCoreDll, ncm::StorageId::BuiltInSystem);
const cfg::OverrideStatus bdll_override_status = override_status;
const ldr::ProgramAttributes bdll_attrs = attrs;
bdll_mount.emplace(bdll_loc, bdll_override_status, bdll_attrs);
R_TRY(bdll_mount->GetResult());
/* Load browser dll meta, possibly from cache. */
Meta bdll_meta;
R_TRY(LoadMetaFromCacheForBrowserCoreDll(std::addressof(bdll_meta), bdll_loc, bdll_override_status, bdll_attrs.platform));
/* Validate browser dll meta. */
R_TRY(ValidateMeta(std::addressof(bdll_meta), loc, mount.GetCodeVerificationData()));
}
/* Load, validate NSO headers. */
AutoLoadModuleInfo auto_load_info = {};
R_TRY(LoadAutoLoadHeaders(g_nso_headers, std::addressof(auto_load_info), meta.acid->flags));
R_TRY(CheckAutoLoad(g_nso_headers, std::addressof(auto_load_info), meta.acid->flags));
/* Actually create the process and load NSOs into process memory. */
ProcessInfo info;
R_TRY(CreateProcessAndLoadAutoLoadModules(std::addressof(info), std::addressof(meta), g_nso_headers, std::addressof(auto_load_info), argument, flags, resource_limit));
/* Register NSOs with the RoManager. */
{
/* Nintendo doesn't validate this get, but we do. */
os::ProcessId process_id = os::GetProcessId(info.process_handle);
/* Register new process. */
const auto as_type = GetAddressSpaceType(std::addressof(meta));
RoManager::GetInstance().RegisterProcess(pin_id, process_id, meta.aci->program_id, as_type == Npdm::AddressSpaceType_64Bit || as_type == Npdm::AddressSpaceType_64BitDeprecated);
/* Register all NSOs. */
for (size_t i = 0; i < Nso_Count; i++) {
if (auto_load_info.has_nso[i]) {
RoManager::GetInstance().AddNso(pin_id, g_nso_headers[i].module_id, info.nso_address[i], info.nso_size[i]);
}
}
}
/* If we're overriding for HBL, perform HTML document redirection. */
if (override_status.IsHbl()) {
/* Don't validate result, failure is okay. */
RedirectHtmlDocumentPathForHbl(loc);
}
/* Clear the external code for the program. */
fssystem::DestroyExternalCode(loc.program_id);
/* Note that we've created the program. */
SetLaunchedBootProgram(loc.program_id);
/* Move the process handle to output. */
*out = info.process_handle;
R_SUCCEED();
}
Result GetProgramInfo(ProgramInfo *out, cfg::OverrideStatus *out_status, const ncm::ProgramLocation &loc, const char *path, const ldr::ProgramAttributes &attrs) {
Meta meta;
/* Load Meta. */
{
AMS_UNUSED(path);
ScopedCodeMountForCode mount(loc, attrs);
R_TRY(mount.GetResult());
R_TRY(LoadMeta(std::addressof(meta), loc, mount.GetOverrideStatus(), attrs.platform, false));
if (out_status != nullptr) {
*out_status = mount.GetOverrideStatus();
}
}
return GetProgramInfoFromMeta(out, std::addressof(meta));
}
Result PinProgram(PinId *out_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status) {
R_UNLESS(RoManager::GetInstance().Allocate(out_id, loc, override_status), ldr::ResultMaxProcess());
R_SUCCEED();
}
Result UnpinProgram(PinId id) {
R_UNLESS(RoManager::GetInstance().Free(id), ldr::ResultNotPinned());
R_SUCCEED();
}
Result GetProcessModuleInfo(u32 *out_count, ldr::ModuleInfo *out, size_t max_out_count, os::ProcessId process_id) {
R_UNLESS(RoManager::GetInstance().GetProcessModuleInfo(out_count, out, max_out_count, process_id), ldr::ResultNotPinned());
R_SUCCEED();
}
Result GetProgramLocationAndOverrideStatusFromPinId(ncm::ProgramLocation *out, cfg::OverrideStatus *out_status, PinId pin_id) {
R_UNLESS(RoManager::GetInstance().GetProgramLocationAndStatus(out, out_status, pin_id), ldr::ResultNotPinned());
R_SUCCEED();
}
}

View File

@@ -0,0 +1,938 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "ldr_capabilities.hpp"
#include "ldr_content_management.hpp"
#include "ldr_development_manager.hpp"
#include "ldr_launch_record.hpp"
#include "ldr_meta.hpp"
#include "ldr_patcher.hpp"
#include "ldr_process_creation.hpp"
#include "ldr_ro_manager.hpp"
#include "oc/oc_loader.hpp"
namespace ams::ldr {
namespace {
/* Convenience defines. */
constexpr size_t SystemResourceSizeMax = 0x1FE00000;
constexpr size_t AutoLoadModuleSizeMax = 0x800000000;
/* Types. */
enum NsoIndex {
Nso_Rtld = 0,
Nso_Main = 1,
Nso_Wkc0 = 2,
Nso_Wkc1 = 3,
Nso_Wkc2 = 4,
Nso_Wkc3 = 5,
Nso_Wkc4 = 6,
Nso_Wkc5 = 7,
Nso_Wkc6 = 8,
Nso_Wkc7 = 9,
Nso_Wkc8 = 10,
Nso_Wkc9 = 11,
Nso_SubSdk0 = 12,
Nso_SubSdk1 = 13,
Nso_SubSdk2 = 14,
Nso_SubSdk3 = 15,
Nso_SubSdk4 = 16,
Nso_SubSdk5 = 17,
Nso_SubSdk6 = 18,
Nso_SubSdk7 = 19,
Nso_SubSdk8 = 20,
Nso_SubSdk9 = 21,
Nso_Sdk = 22,
Nso_Count,
};
constexpr inline const char *NsoPaths[Nso_Count] = {
ENCODE_ATMOSPHERE_CODE_PATH("/rtld"),
ENCODE_ATMOSPHERE_CODE_PATH("/main"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc0"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc1"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc2"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc3"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc4"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc5"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc6"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc7"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc8"),
ENCODE_ATMOSPHERE_BDLL_PATH("/wkc9"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk0"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk1"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk2"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk3"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk4"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk5"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk6"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk7"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk8"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk9"),
ENCODE_ATMOSPHERE_CODE_PATH("/sdk"),
};
constexpr const char *GetNsoPath(size_t idx) {
AMS_ABORT_UNLESS(idx < Nso_Count);
return NsoPaths[idx];
}
struct ProcessInfo {
os::NativeHandle process_handle;
uintptr_t code_address;
size_t total_size;
uintptr_t args_address;
size_t args_size;
uintptr_t nso_address[Nso_Count];
size_t nso_size[Nso_Count];
};
struct AutoLoadModuleInfo {
bool has_rtld;
bool has_main;
bool has_sdk;
bool has_subsdk;
s8 nso_indices[Nso_Count];
};
struct AutoLoadModuleContext {
NsoHeader *headers;
int nso_count;
int rtld_idx;
int main_nso_idx;
int sdk_nso_idx;
AutoLoadModuleInfo ali;
};
/* Global NSO header cache. */
NsoHeader g_nso_headers[Nso_Count];
/* Pcv/Ptm check cache */
bool g_is_pcv;
bool g_is_ptm;
/* Global Zstd decompression context. */
constexpr size_t ZstdDctxWorkspaceSize = 0x176E8;
alignas(8) u8 g_zstd_dctx_workspace[ZstdDctxWorkspaceSize];
Result ValidateProgramVersion(ncm::ProgramId program_id, u32 version) {
/* No version verification is done before 8.1.0. */
R_SUCCEED_IF(hos::GetVersion() < hos::Version_8_1_0);
/* No verification is done if development. */
R_SUCCEED_IF(IsDevelopmentForAntiDowngradeCheck());
/* TODO: Anti-downgrade checking does not make very much sense for us. Should we do anything? */
AMS_UNUSED(program_id, version);
R_SUCCEED();
}
/* Helpers. */
Result GetProgramInfoFromMeta(ProgramInfo *out, const Meta *meta) {
/* Copy basic info. */
out->main_thread_priority = meta->npdm->main_thread_priority;
out->default_cpu_id = meta->npdm->default_cpu_id;
out->main_thread_stack_size = meta->npdm->main_thread_stack_size;
out->program_id = meta->aci->program_id;
/* Copy access controls. */
size_t offset = 0;
#define COPY_ACCESS_CONTROL(source, which) \
({ \
const size_t size = meta->source->which##_size; \
R_UNLESS(offset + size <= sizeof(out->ac_buffer), ldr::ResultInternalError()); \
out->source##_##which##_size = size; \
std::memcpy(out->ac_buffer + offset, meta->source##_##which, size); \
offset += size; \
})
/* Copy all access controls to buffer. */
COPY_ACCESS_CONTROL(acid, sac);
COPY_ACCESS_CONTROL(aci, sac);
COPY_ACCESS_CONTROL(acid, fac);
COPY_ACCESS_CONTROL(aci, fah);
#undef COPY_ACCESS_CONTROL
/* Copy flags. */
out->flags = MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32));
R_SUCCEED();
}
bool IsApplet(const Meta *meta) {
return (MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Applet;
}
bool IsApplication(const Meta *meta) {
return (MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Application;
}
Npdm::AddressSpaceType GetAddressSpaceType(const Meta *meta) {
return static_cast<Npdm::AddressSpaceType>((meta->npdm->flags & Npdm::MetaFlag_AddressSpaceTypeMask) >> Npdm::MetaFlag_AddressSpaceTypeShift);
}
Acid::PoolPartition GetPoolPartition(const Meta *meta) {
return static_cast<Acid::PoolPartition>((meta->acid->flags & Acid::AcidFlag_PoolPartitionMask) >> Acid::AcidFlag_PoolPartitionShift);
}
Result LoadAutoLoadHeaders(AutoLoadModuleContext &ctx, u32 acid_flags) {
/* Clear NSOs. */
std::memset(g_nso_headers, 0, sizeof(g_nso_headers));
ctx.headers = g_nso_headers;
ctx.nso_count = 0;
ctx.rtld_idx = -1;
ctx.main_nso_idx = -1;
ctx.sdk_nso_idx = -1;
ctx.ali = {};
for (size_t i = 0; i < Nso_Count; i++) {
/* Only load browser DLLs if acid flags say to do so. */
switch (i) {
case Nso_Wkc0:
case Nso_Wkc1:
case Nso_Wkc2:
case Nso_Wkc3:
case Nso_Wkc4:
case Nso_Wkc5:
case Nso_Wkc6:
case Nso_Wkc7:
case Nso_Wkc8:
case Nso_Wkc9:
if ((acid_flags & Acid::AcidFlag_LoadBrowserCoreDll) == 0) {
continue;
}
break;
}
fs::FileHandle file;
if (R_SUCCEEDED(fs::OpenFile(std::addressof(file), GetNsoPath(i), fs::OpenMode_Read))) {
ON_SCOPE_EXIT { fs::CloseFile(file); };
/* Read NSO header. */
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, 0, g_nso_headers + ctx.nso_count, sizeof(NsoHeader)));
R_UNLESS(read_size == sizeof(NsoHeader), ldr::ResultInvalidNso());
/* Note nso is present. */
switch (i) {
case Nso_Rtld:
ctx.rtld_idx = ctx.nso_count;
ctx.ali.has_rtld = true;
break;
case Nso_Main:
ctx.main_nso_idx = ctx.nso_count;
ctx.ali.has_main = true;
break;
case Nso_SubSdk0:
case Nso_SubSdk1:
case Nso_SubSdk2:
case Nso_SubSdk3:
case Nso_SubSdk4:
case Nso_SubSdk5:
case Nso_SubSdk6:
case Nso_SubSdk7:
case Nso_SubSdk8:
case Nso_SubSdk9:
ctx.ali.has_subsdk = true;
break;
case Nso_Sdk:
ctx.sdk_nso_idx = ctx.nso_count;
ctx.ali.has_sdk = true;
break;
}
ctx.ali.nso_indices[ctx.nso_count] = static_cast<s8>(i);
ctx.nso_count++;
}
}
R_SUCCEED();
}
Result CheckAutoLoad(const AutoLoadModuleContext &ctx, u32 acid_flags) {
/* We must always have a main. */
R_UNLESS(ctx.ali.has_main, ldr::ResultInvalidNso());
/* Validate flags and extents for all present NSOs. */
for (int i = 0; i < ctx.nso_count; ++i) {
const auto &hdr = ctx.headers[i];
/* All NSOs must not be --X. */
/* This is "probably" not checked on Ounce? */
R_UNLESS((hdr.flags & NsoHeader::Flag_PreventCodeReads) == 0, ldr::ResultInvalidNso());
/* Zstd compression only allowed on main, and only when both rtld+sdk are present. */
if (i != ctx.main_nso_idx || ctx.rtld_idx < 0 || ctx.sdk_nso_idx < 0) {
R_UNLESS((hdr.flags & NsoHeader::Flag_UseZbicCompression) == 0, ldr::ResultInvalidNso());
}
/* NSOs must have page-aligned segments. */
R_UNLESS(util::IsAligned(hdr.text_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(hdr.ro_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
R_UNLESS(util::IsAligned(hdr.rw_dst_offset, os::MemoryPageSize), ldr::ResultInvalidNso());
/* NSOs must have zero text offset. */
R_UNLESS(hdr.text_dst_offset == 0, ldr::ResultInvalidNso());
/* NSO .text must precede .rodata. */
const size_t text_end = static_cast<size_t>(hdr.text_dst_offset) + static_cast<size_t>(hdr.text_size);
R_UNLESS(text_end <= static_cast<size_t>(hdr.ro_dst_offset), ldr::ResultInvalidNso());
/* NSO .rodata must precede .rwdata. */
const size_t ro_end = static_cast<size_t>(hdr.ro_dst_offset) + static_cast<size_t>(hdr.ro_size);
R_UNLESS(ro_end <= static_cast<size_t>(hdr.rw_dst_offset), ldr::ResultInvalidNso());
}
const bool has_browser_dll = (acid_flags & Acid::AcidFlag_LoadBrowserCoreDll) != 0;
if (ctx.ali.has_rtld || ctx.ali.has_sdk) {
/* If we have sdk we must have rtld. */
R_UNLESS(ctx.ali.has_rtld, ldr::ResultInvalidNso());
/* If we have rtld, we must not have browser core dll. */
R_UNLESS(!has_browser_dll, ldr::ResultInvalidNso());
} else {
/* We must not have both subsdk and browser dll. */
R_UNLESS(!(ctx.ali.has_subsdk && has_browser_dll), ldr::ResultInvalidNso());
}
R_SUCCEED();
}
constexpr const ncm::ProgramId UnqualifiedApprovalProgramIds[] = {
{ 0x010003F003A34000 }, /* Pokemon: Let's Go, Pikachu! */
{ 0x0100152000022000 }, /* Mario Kart 8 Deluxe */
{ 0x0100165003504000 }, /* Nintendo Labo Toy-Con 04: VR Kit */
{ 0x0100187003A36000 }, /* Pokemon: Let's Go, Eevee! */
{ 0x01002E5008C56000 }, /* Pokemon Sword [Live Tournament] */
{ 0x01002FF008C24000 }, /* Ring Fit Adventure */
{ 0x010049900F546001 }, /* Super Mario 3D All-Stars: Super Mario 64 */
{ 0x010057D00ECE4000 }, /* Nintendo Switch Online (Nintendo 64) [for Japan] */
{ 0x01006F8002326000 }, /* Animal Crossing: New Horizons */
{ 0x01006FB00F50E000 }, /* 宝可梦 走吧!伊布 [Pokemon: Let's Go, Eevee! for China] */
{ 0x010070300F50C000 }, /* 宝可梦 走吧!皮卡丘 [Pokemon: Let's Go, Pikachu! for China] */
{ 0x010075100E8EC000 }, /* 马力欧卡丁车8 豪华版 [Mario Kart 8 Deluxe for China] */
{ 0x01008DB008C2C000 }, /* Pokemon Shield */
{ 0x01009AD008C4C000 }, /* Pokemon: Let's Go, Pikachu! [Kiosk] */
{ 0x0100A66003384000 }, /* Hulu */
{ 0x0100ABF008968000 }, /* Pokemon Sword */
{ 0x0100C9A00ECE6000 }, /* Nintendo Switch Online (Nintendo 64) [for America] */
{ 0x0100ED100BA3A000 }, /* Mario Kart Live: Home Circuit */
{ 0x0100F38011CFE000 }, /* Animal Crossing: New Horizons Island Transfer Tool */
{ 0x0100F6B011028000 }, /* 健身环大冒险 [Ring Fit Adventure for China] */
};
/* Check that the unqualified approval programs are sorted. */
static_assert([]() -> bool {
for (size_t i = 0; i < util::size(UnqualifiedApprovalProgramIds) - 1; ++i) {
if (UnqualifiedApprovalProgramIds[i].value >= UnqualifiedApprovalProgramIds[i + 1].value) {
return false;
}
}
return true;
}());
bool IsUnqualifiedApprovalProgramId(ncm::ProgramId program_id) {
/* Check if the program id is one with unqualified approval. */
return std::binary_search(std::begin(UnqualifiedApprovalProgramIds), std::end(UnqualifiedApprovalProgramIds), program_id);
}
bool IsUnqualifiedApproval(const Meta *meta) {
/* If the meta has unqualified approval flag, it's unqualified approval. */
if (meta->acid->flags & ldr::Acid::AcidFlag_UnqualifiedApproval) {
return true;
}
/* If the unqualified approval flag is not set, the program must be an application. */
if (!IsApplication(meta)) {
return false;
}
/* The program id must be a force unqualified approval program id. */
return IsUnqualifiedApprovalProgramId(meta->acid->program_id_min) && meta->acid->program_id_min == meta->acid->program_id_max;
}
Result ValidateMeta(const Meta *meta, const ncm::ProgramLocation &loc, const fs::CodeVerificationData &code_verification_data) {
/* Validate version. */
R_TRY(ValidateProgramVersion(loc.program_id, meta->npdm->version));
/* Validate program id. */
R_UNLESS(meta->aci->program_id >= meta->acid->program_id_min, ldr::ResultInvalidProgramId());
R_UNLESS(meta->aci->program_id <= meta->acid->program_id_max, ldr::ResultInvalidProgramId());
/* Validate the kernel capabilities. */
R_TRY(TestCapability(static_cast<const util::BitPack32 *>(meta->acid_kac), meta->acid->kac_size / sizeof(util::BitPack32), static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)));
/* Check if NCA is PCV or PTM */
g_is_pcv = meta->aci->program_id == ncm::SystemProgramId::Pcv;
g_is_ptm = meta->aci->program_id == ncm::SystemProgramId::Ptm;
/* If we have data to validate, validate it. */
if (meta->check_verification_data) {
const u8 *sig = code_verification_data.signature;
const size_t sig_size = sizeof(code_verification_data.signature);
const u8 *mod = static_cast<u8 *>(meta->modulus);
const size_t mod_size = crypto::Rsa2048PssSha256Verifier::ModulusSize;
const u8 *exp = fssystem::GetAcidSignatureKeyPublicExponent();
const size_t exp_size = fssystem::AcidSignatureKeyPublicExponentSize;
const u8 *hsh = code_verification_data.target_hash;
const size_t hsh_size = sizeof(code_verification_data.target_hash);
const bool is_signature_valid = crypto::VerifyRsa2048PssSha256WithHash(sig, sig_size, mod, mod_size, exp, exp_size, hsh, hsh_size);
/* If the signature check fails, we need to check if this is allowable. */
if (!is_signature_valid) {
/* We have to enforce signature checks on prod and when we have a signature to check on dev. */
R_UNLESS(IsDevelopmentForAcidProductionCheck(), ldr::ResultInvalidNcaSignature());
R_UNLESS(!code_verification_data.has_data, ldr::ResultInvalidNcaSignature());
/* There was no signature to check on dev. Check if this is acceptable. */
R_UNLESS(IsUnqualifiedApproval(meta), ldr::ResultInvalidNcaSignature());
}
}
/* All good. */
R_SUCCEED();
}
Result GetCreateProcessFlags(u32 *out, const Meta *meta, const u32 ldr_flags) {
const u8 meta_flags = meta->npdm->flags;
u32 flags = 0;
/* Set Is64Bit. */
if (meta_flags & Npdm::MetaFlag_Is64Bit) {
flags |= svc::CreateProcessFlag_Is64Bit;
}
/* Set AddressSpaceType. */
switch (GetAddressSpaceType(meta)) {
case Npdm::AddressSpaceType_32Bit:
flags |= svc::CreateProcessFlag_AddressSpace32Bit;
break;
case Npdm::AddressSpaceType_64BitDeprecated:
flags |= svc::CreateProcessFlag_AddressSpace64BitDeprecated;
break;
case Npdm::AddressSpaceType_32BitWithoutAlias:
flags |= svc::CreateProcessFlag_AddressSpace32BitWithoutAlias;
break;
case Npdm::AddressSpaceType_64Bit:
flags |= svc::CreateProcessFlag_AddressSpace64Bit;
break;
default:
R_THROW(ldr::ResultInvalidMeta());
}
/* Set Enable Debug. */
if (ldr_flags & CreateProcessFlag_EnableDebug) {
flags |= svc::CreateProcessFlag_EnableDebug;
}
/* Set Enable ASLR. */
if (!(ldr_flags & CreateProcessFlag_DisableAslr)) {
flags |= svc::CreateProcessFlag_EnableAslr;
}
/* Set Is Application. */
if (IsApplication(meta)) {
flags |= svc::CreateProcessFlag_IsApplication;
/* 7.0.0+: Set OptimizeMemoryAllocation if relevant. */
if (hos::GetVersion() >= hos::Version_7_0_0) {
if (meta_flags & Npdm::MetaFlag_OptimizeMemoryAllocation) {
flags |= svc::CreateProcessFlag_OptimizeMemoryAllocation;
}
}
}
/* 5.0.0+ Set Pool Partition. */
if (hos::GetVersion() >= hos::Version_5_0_0) {
/* TODO: Nintendo no longer accepts Applet when pool partition == application. Would this break hbl/anything else in the hb ecosystem? */
/* TODO: Nintendo uses a helper bool MakeSvcPoolPartitionFlag(u32 *out, Acid::PoolPartition partition); */
switch (GetPoolPartition(meta)) {
case Acid::PoolPartition_Application:
if (IsApplet(meta)) {
flags |= svc::CreateProcessFlag_PoolPartitionApplet;
} else {
flags |= svc::CreateProcessFlag_PoolPartitionApplication;
}
break;
case Acid::PoolPartition_Applet:
flags |= svc::CreateProcessFlag_PoolPartitionApplet;
break;
case Acid::PoolPartition_System:
flags |= svc::CreateProcessFlag_PoolPartitionSystem;
break;
case Acid::PoolPartition_SystemNonSecure:
flags |= svc::CreateProcessFlag_PoolPartitionSystemNonSecure;
break;
default:
R_THROW(ldr::ResultInvalidMeta());
}
} else if (hos::GetVersion() >= hos::Version_4_0_0) {
/* On 4.0.0+, the corresponding bit was simply "UseSecureMemory". */
if (meta->acid->flags & Acid::AcidFlag_DeprecatedUseSecureMemory) {
flags |= svc::CreateProcessFlag_DeprecatedUseSecureMemory;
}
}
/* 11.0.0+/meso Set Disable DAS merge. */
if (meta_flags & Npdm::MetaFlag_DisableDeviceAddressSpaceMerge) {
flags |= svc::CreateProcessFlag_DisableDeviceAddressSpaceMerge;
}
/* 18.0.0+/meso Set Alias region extra size. */
if (meta_flags & Npdm::MetaFlag_EnableAliasRegionExtraSize) {
flags |= svc::CreateProcessFlag_EnableAliasRegionExtraSize;
}
*out = flags;
R_SUCCEED();
}
Result GetCreateProcessParameter(svc::CreateProcessParameter *out, const Meta *meta, u32 flags, os::NativeHandle resource_limit) {
/* Clear output. */
std::memset(out, 0, sizeof(*out));
/* Set name, version, program id, resource limit handle. */
std::memcpy(out->name, meta->npdm->program_name, sizeof(out->name) - 1);
out->version = meta->npdm->version;
out->program_id = meta->aci->program_id.value;
out->reslimit = resource_limit;
/* Set flags. */
R_TRY(GetCreateProcessFlags(std::addressof(out->flags), meta, flags));
/* 3.0.0+ System Resource Size. */
if (hos::GetVersion() >= hos::Version_3_0_0) {
/* Validate size is aligned. */
R_UNLESS(util::IsAligned(meta->npdm->system_resource_size, os::MemoryBlockUnitSize), ldr::ResultInvalidSize());
/* Validate system resource usage. */
if (meta->npdm->system_resource_size) {
/* Process must be 64-bit. */
R_UNLESS((out->flags & svc::CreateProcessFlag_AddressSpace64Bit), ldr::ResultInvalidMeta());
/* Process must be application or applet. */
R_UNLESS(IsApplication(meta) || IsApplet(meta), ldr::ResultInvalidMeta());
/* Size must be less than or equal to max. */
R_UNLESS(meta->npdm->system_resource_size <= SystemResourceSizeMax, ldr::ResultInvalidMeta());
}
out->system_resource_num_pages = meta->npdm->system_resource_size >> 12;
}
R_SUCCEED();
}
u64 GenerateSecureRandom(u64 max) {
/* Generate a cryptographically random number. */
u64 rand;
crypto::GenerateCryptographicallyRandomBytes(std::addressof(rand), sizeof(rand));
/* Coerce into range. */
return rand % (max + 1);
}
Result DecideAddressSpaceLayout(ProcessInfo *out, svc::CreateProcessParameter *out_param, const AutoLoadModuleContext &ctx, const ArgumentStore::Entry *argument) {
/* Clear output. */
out->args_address = 0;
out->args_size = 0;
std::memset(out->nso_address, 0, sizeof(out->nso_address));
std::memset(out->nso_size, 0, sizeof(out->nso_size));
size_t total_size = 0;
bool argument_allocated = false;
/* Calculate base offsets. */
for (int i = 0; i < ctx.nso_count; i++) {
out->nso_address[i] = total_size;
const size_t text_end = static_cast<size_t>(ctx.headers[i].text_dst_offset) + static_cast<size_t>(ctx.headers[i].text_size);
const size_t ro_end = static_cast<size_t>(ctx.headers[i].ro_dst_offset) + static_cast<size_t>(ctx.headers[i].ro_size);
const size_t rw_end = static_cast<size_t>(ctx.headers[i].rw_dst_offset) + static_cast<size_t>(ctx.headers[i].rw_size);
out->nso_size[i] = text_end;
out->nso_size[i] = std::max(out->nso_size[i], ro_end);
out->nso_size[i] = std::max(out->nso_size[i], rw_end);
out->nso_size[i] += static_cast<size_t>(ctx.headers[i].bss_size);
const size_t aligned_up_size = util::AlignUp(out->nso_size[i], os::MemoryPageSize) & (AutoLoadModuleSizeMax - 1);
R_UNLESS(out->nso_size[i] <= aligned_up_size, ldr::ResultInvalidNso());
R_UNLESS(aligned_up_size > 0, ldr::ResultInvalidNso());
out->nso_size[i] = aligned_up_size;
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->nso_size[i]), ldr::ResultInvalidNso());
total_size += out->nso_size[i];
if (!argument_allocated && argument != nullptr) {
out->args_address = total_size;
out->args_size = util::AlignUp(2 * sizeof(u32) + argument->argument_size * 2 + ArgumentStore::ArgumentBufferSize, os::MemoryPageSize);
R_UNLESS(util::CanAddWithoutOverflow(total_size, out->args_size), ldr::ResultInvalidNso());
total_size += out->args_size;
argument_allocated = true;
}
}
/* Calculate ASLR. */
uintptr_t aslr_start = 0;
size_t aslr_size = 0;
if (hos::GetVersion() >= hos::Version_2_0_0) {
switch (out_param->flags & svc::CreateProcessFlag_AddressSpaceMask) {
case svc::CreateProcessFlag_AddressSpace32Bit:
case svc::CreateProcessFlag_AddressSpace32BitWithoutAlias:
aslr_start = svc::AddressSmallMap32Start;
aslr_size = svc::AddressSmallMap32Size;
break;
case svc::CreateProcessFlag_AddressSpace64BitDeprecated:
aslr_start = svc::AddressSmallMap36Start;
aslr_size = svc::AddressSmallMap36Size;
break;
case svc::CreateProcessFlag_AddressSpace64Bit:
aslr_start = svc::AddressMap39Start;
aslr_size = svc::AddressMap39Size;
break;
AMS_UNREACHABLE_DEFAULT_CASE();
}
} else {
/* On 1.0.0, only 2 address space types existed. */
if (out_param->flags & svc::CreateProcessFlag_AddressSpace64BitDeprecated) {
aslr_start = svc::AddressSmallMap36Start;
aslr_size = svc::AddressSmallMap36Size;
} else {
aslr_start = svc::AddressSmallMap32Start;
aslr_size = svc::AddressSmallMap32Size;
}
}
R_UNLESS(total_size <= aslr_size, svc::ResultOutOfMemory());
/* Set Create Process output. */
uintptr_t aslr_slide = 0;
size_t free_size = (aslr_size - total_size);
if (out_param->flags & svc::CreateProcessFlag_EnableAslr) {
aslr_slide = GenerateSecureRandom(free_size / os::MemoryBlockUnitSize) * os::MemoryBlockUnitSize;
}
/* Set out. */
aslr_start += aslr_slide;
for (int i = 0; i < ctx.nso_count; i++) {
R_UNLESS(util::CanAddWithoutOverflow(out->nso_address[i], aslr_start), ldr::ResultInvalidNso());
out->nso_address[i] += aslr_start;
}
if (out->args_address) {
R_UNLESS(util::CanAddWithoutOverflow(out->args_address, aslr_start), ldr::ResultInvalidNso());
out->args_address += aslr_start;
}
out_param->code_address = aslr_start;
out_param->code_num_pages = total_size >> 12;
out->total_size = total_size;
R_SUCCEED();
}
Result LoadAutoLoadModuleSegment(fs::FileHandle file, size_t file_offset, size_t compressed_size, size_t segment_size, bool is_compressed, bool is_zstd, uintptr_t map_base, uintptr_t map_end) {
/* Select read size based on compression. */
size_t file_size = is_compressed ? compressed_size : segment_size;
/* Validate size. */
R_UNLESS(file_size <= segment_size, ldr::ResultInvalidNso());
R_UNLESS(file_size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
R_UNLESS(segment_size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
/* Load data from file. */
uintptr_t load_address = is_compressed ? map_end - compressed_size : map_base;
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, file_offset, reinterpret_cast<void *>(load_address), file_size));
R_UNLESS(read_size == file_size, ldr::ResultInvalidNso());
/* Uncompress if necessary. */
R_SUCCEED_IF(!is_compressed);
auto compressed_data_buf = reinterpret_cast<const void *>(load_address);
if (is_zstd) {
bool decompressed = util::DecompressZstdForLoader(reinterpret_cast<void *>(g_zstd_dctx_workspace), ZstdDctxWorkspaceSize, reinterpret_cast<void *>(map_base), static_cast<size_t>(map_end - map_base), segment_size, compressed_data_buf, file_size);
R_UNLESS(decompressed, ldr::ResultInvalidNso());
} else {
bool decompressed = (util::DecompressLZ4(reinterpret_cast<void *>(map_base), segment_size, compressed_data_buf, file_size) == static_cast<int>(segment_size));
R_UNLESS(decompressed, ldr::ResultInvalidNso());
}
R_SUCCEED();
}
Result CheckSegmentHash(const NsoHeader *nso_header, uintptr_t map_address, NsoHeader::Segment segment) {
if ((nso_header->flags & (NsoHeader::Flag_CheckHashText << segment)) == 0) {
R_SUCCEED();
}
u8 hash[crypto::Sha256Generator::HashSize];
crypto::GenerateSha256(hash, sizeof(hash),
reinterpret_cast<void *>(map_address + nso_header->segments[segment].dst_offset),
nso_header->segments[segment].size);
R_UNLESS(std::memcmp(hash, nso_header->segment_hashes[segment], sizeof(hash)) == 0, ldr::ResultInvalidNso());
R_SUCCEED();
}
Result LoadAutoLoadModule(os::NativeHandle process_handle, fs::FileHandle file, const NsoHeader *nso_header, uintptr_t nso_address, size_t nso_size, size_t map_size) {
const bool is_zstd = (nso_header->flags & NsoHeader::Flag_UseZbicCompression) != 0;
/* Map and read data from file. */
{
/* Map the process memory. */
void *mapped_memory = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(mapped_memory), process_handle, nso_address, map_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(mapped_memory, process_handle, nso_address, map_size); };
const uintptr_t map_address = reinterpret_cast<uintptr_t>(mapped_memory);
const uintptr_t map_end = map_address + map_size;
/* Load NSO segments. */
R_TRY(LoadAutoLoadModuleSegment(file, nso_header->segments[NsoHeader::Segment_Text].file_offset, nso_header->text_compressed_size, nso_header->text_size,
(nso_header->flags & NsoHeader::Flag_CompressedText) != 0, is_zstd, map_address + nso_header->text_dst_offset, map_end));
R_TRY(LoadAutoLoadModuleSegment(file, nso_header->segments[NsoHeader::Segment_Ro].file_offset, nso_header->ro_compressed_size, nso_header->ro_size,
(nso_header->flags & NsoHeader::Flag_CompressedRo) != 0, is_zstd, map_address + nso_header->ro_dst_offset, map_end));
R_TRY(LoadAutoLoadModuleSegment(file, nso_header->segments[NsoHeader::Segment_Rw].file_offset, nso_header->rw_compressed_size, nso_header->rw_size,
(nso_header->flags & NsoHeader::Flag_CompressedRw) != 0, is_zstd, map_address + nso_header->rw_dst_offset, map_end));
/* Clear unused space to zero. */
const size_t text_end = static_cast<size_t>(nso_header->text_dst_offset) + static_cast<size_t>(nso_header->text_size);
const size_t ro_end = static_cast<size_t>(nso_header->ro_dst_offset) + static_cast<size_t>(nso_header->ro_size);
const size_t rw_end = static_cast<size_t>(nso_header->rw_dst_offset) + static_cast<size_t>(nso_header->rw_size);
std::memset(reinterpret_cast<void *>(map_address + text_end), 0, nso_header->ro_dst_offset - text_end);
std::memset(reinterpret_cast<void *>(map_address + ro_end), 0, nso_header->rw_dst_offset - ro_end);
std::memset(reinterpret_cast<void *>(map_address + rw_end), 0, nso_size - rw_end);
/* Check segment hashes. */
R_TRY(CheckSegmentHash(nso_header, map_address, NsoHeader::Segment_Text));
R_TRY(CheckSegmentHash(nso_header, map_address, NsoHeader::Segment_Ro));
R_TRY(CheckSegmentHash(nso_header, map_address, NsoHeader::Segment_Rw));
/* Apply embedded patches. */
ApplyEmbeddedPatchesToModule(nso_header->module_id, map_address, nso_size);
/* Apply IPS patches. */
LocateAndApplyIpsPatchesToModule(nso_header->module_id, map_address, nso_size);
/* Apply PCV and PTM patches */
if (g_is_pcv) {
hoc::pcv::Patch(map_address, nso_size);
}
if (g_is_ptm) {
hoc::ptm::Patch(map_address, nso_size);
}
}
/* Set permissions. */
const size_t text_size = util::AlignUp(nso_header->text_size, os::MemoryPageSize);
const size_t ro_size = util::AlignUp(nso_header->ro_size, os::MemoryPageSize);
const size_t rw_size = util::AlignUp(nso_header->rw_size + nso_header->bss_size, os::MemoryPageSize);
if (text_size) {
const bool prevent_code_reads = (nso_header->flags & NsoHeader::Flag_PreventCodeReads);
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->text_dst_offset, text_size, prevent_code_reads ? os::MemoryPermission_ExecuteOnly : os::MemoryPermission_ReadExecute));
}
if (ro_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->ro_dst_offset, ro_size, os::MemoryPermission_ReadOnly));
}
if (rw_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->rw_dst_offset, rw_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result LoadAutoLoadModules(const ProcessInfo *process_info, const AutoLoadModuleContext &ctx, const ArgumentStore::Entry *argument) {
/* Load each NSO. */
const uintptr_t total_end = process_info->code_address + process_info->total_size;
for (int i = 0; i < ctx.nso_count; i++) {
const NsoIndex nso_idx = static_cast<NsoIndex>(ctx.ali.nso_indices[i]);
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), GetNsoPath(nso_idx), fs::OpenMode_Read));
ON_SCOPE_EXIT { fs::CloseFile(file); };
const bool is_zstd = (ctx.headers[i].flags & NsoHeader::Flag_UseZbicCompression) != 0;
const size_t map_size = is_zstd ? (total_end - process_info->nso_address[i]) : process_info->nso_size[i];
R_TRY(LoadAutoLoadModule(process_info->process_handle, file, ctx.headers + i,
process_info->nso_address[i], process_info->nso_size[i], map_size));
}
/* Load arguments, if present. */
if (argument != nullptr) {
/* Write argument data into memory. */
{
void *map_address = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(map_address), process_info->process_handle, process_info->args_address, process_info->args_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(map_address, process_info->process_handle, process_info->args_address, process_info->args_size); };
ProgramArguments *args = static_cast<ProgramArguments *>(map_address);
std::memset(args, 0, sizeof(*args));
args->allocated_size = process_info->args_size;
args->arguments_size = argument->argument_size;
std::memcpy(args->arguments, argument->argument, argument->argument_size);
}
/* Set argument region permissions. */
/* NOTE: Nintendo uses svc::SetProcessMemoryPermission directly here. */
R_TRY(os::SetProcessMemoryPermission(process_info->process_handle, process_info->args_address, process_info->args_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result CreateProcessAndLoadAutoLoadModules(ProcessInfo *out, const Meta *meta, const AutoLoadModuleContext &ctx, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit) {
/* Get CreateProcessParameter. */
svc::CreateProcessParameter param;
R_TRY(GetCreateProcessParameter(std::addressof(param), meta, flags, resource_limit));
/* Decide on an NSO layout. */
R_TRY(DecideAddressSpaceLayout(out, std::addressof(param), ctx, argument));
/* Actually create process. */
svc::Handle process_handle;
R_TRY(svc::CreateProcess(std::addressof(process_handle), std::addressof(param), static_cast<const u32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(u32)));
/* Set the output handle, and ensure that if we fail after this point we clean it up. */
out->process_handle = process_handle;
out->code_address = param.code_address;
ON_RESULT_FAILURE { svc::CloseHandle(process_handle); };
/* Load all auto load modules. */
R_RETURN(LoadAutoLoadModules(out, ctx, argument));
}
}
/* Process Creation API. */
Result CreateProcess(os::NativeHandle *out, PinId pin_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status, const char *path, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit, const ldr::ProgramAttributes &attrs) {
/* Mount code. */
AMS_UNUSED(path);
ScopedCodeMountForCode mount(loc, override_status, attrs);
R_TRY(mount.GetResult());
/* Load meta, possibly from cache. */
Meta meta;
R_TRY(LoadMetaFromCache(std::addressof(meta), loc, override_status, attrs.platform));
/* Validate meta. */
R_TRY(ValidateMeta(std::addressof(meta), loc, mount.GetCodeVerificationData()));
/* If we should, load/validate the browser core dll. */
util::optional<ScopedCodeMountForBrowserCoreDll> bdll_mount;
if ((meta.acid->flags & Acid::AcidFlag_LoadBrowserCoreDll)) {
/* NOTE: I'm unsure whether we should be getting a fresh override status (allowing for different override between main and bdll?) */
/* or whether we should be using the main override status. Going to go with main, for sanity's sake. */
/* Also noting that Nintendo always passes ProgramAttributes=0 here, but this "should" be different on Ounce? */
/* Kind of unclear how to handle this without knowing what exactly is being ifdef'd. */
const ncm::ProgramLocation bdll_loc = ncm::ProgramLocation::Make(ncm::SystemProgramId::BrowserCoreDll, ncm::StorageId::BuiltInSystem);
const cfg::OverrideStatus bdll_override_status = override_status;
const ldr::ProgramAttributes bdll_attrs = attrs;
bdll_mount.emplace(bdll_loc, bdll_override_status, bdll_attrs);
R_TRY(bdll_mount->GetResult());
/* Load browser dll meta, possibly from cache. */
Meta bdll_meta;
R_TRY(LoadMetaFromCacheForBrowserCoreDll(std::addressof(bdll_meta), bdll_loc, bdll_override_status, bdll_attrs.platform));
/* Validate browser dll meta. */
R_TRY(ValidateMeta(std::addressof(bdll_meta), loc, mount.GetCodeVerificationData()));
}
/* Load, validate NSO headers. */
AutoLoadModuleContext ctx;
R_TRY(LoadAutoLoadHeaders(ctx, meta.acid->flags));
R_TRY(CheckAutoLoad(ctx, meta.acid->flags));
/* Actually create the process and load NSOs into process memory. */
ProcessInfo info;
R_TRY(CreateProcessAndLoadAutoLoadModules(std::addressof(info), std::addressof(meta), ctx, argument, flags, resource_limit));
/* Register NSOs with the RoManager. */
{
/* Nintendo doesn't validate this get, but we do. */
os::ProcessId process_id = os::GetProcessId(info.process_handle);
/* Register new process. */
const auto as_type = GetAddressSpaceType(std::addressof(meta));
RoManager::GetInstance().RegisterProcess(pin_id, process_id, meta.aci->program_id, as_type == Npdm::AddressSpaceType_64Bit || as_type == Npdm::AddressSpaceType_64BitDeprecated);
/* Register all NSOs. */
for (int i = 0; i < ctx.nso_count; i++) {
RoManager::GetInstance().AddNso(pin_id, ctx.headers[i].module_id, info.nso_address[i], info.nso_size[i]);
}
}
/* If we're overriding for HBL, perform HTML document redirection. */
if (override_status.IsHbl()) {
/* Don't validate result, failure is okay. */
RedirectHtmlDocumentPathForHbl(loc);
}
/* Clear the external code for the program. */
fssystem::DestroyExternalCode(loc.program_id);
/* Note that we've created the program. */
SetLaunchedBootProgram(loc.program_id);
/* Move the process handle to output. */
*out = info.process_handle;
R_SUCCEED();
}
Result GetProgramInfo(ProgramInfo *out, cfg::OverrideStatus *out_status, const ncm::ProgramLocation &loc, const char *path, const ldr::ProgramAttributes &attrs) {
Meta meta;
/* Load Meta. */
{
AMS_UNUSED(path);
ScopedCodeMountForCode mount(loc, attrs);
R_TRY(mount.GetResult());
R_TRY(LoadMeta(std::addressof(meta), loc, mount.GetOverrideStatus(), attrs.platform, false));
if (out_status != nullptr) {
*out_status = mount.GetOverrideStatus();
}
}
return GetProgramInfoFromMeta(out, std::addressof(meta));
}
Result PinProgram(PinId *out_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status) {
R_UNLESS(RoManager::GetInstance().Allocate(out_id, loc, override_status), ldr::ResultMaxProcess());
R_SUCCEED();
}
Result UnpinProgram(PinId id) {
R_UNLESS(RoManager::GetInstance().Free(id), ldr::ResultNotPinned());
R_SUCCEED();
}
Result GetProcessModuleInfo(u32 *out_count, ldr::ModuleInfo *out, size_t max_out_count, os::ProcessId process_id) {
R_UNLESS(RoManager::GetInstance().GetProcessModuleInfo(out_count, out, max_out_count, process_id), ldr::ResultNotPinned());
R_SUCCEED();
}
Result GetProgramLocationAndOverrideStatusFromPinId(ncm::ProgramLocation *out, cfg::OverrideStatus *out_status, PinId pin_id) {
R_UNLESS(RoManager::GetInstance().GetProgramLocationAndStatus(out, out_status, pin_id), ldr::ResultNotPinned());
R_SUCCEED();
}
}

View File

@@ -0,0 +1,780 @@
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "ldr_capabilities.hpp"
#include "ldr_content_management.hpp"
#include "ldr_development_manager.hpp"
#include "ldr_launch_record.hpp"
#include "ldr_meta.hpp"
#include "ldr_patcher.hpp"
#include "ldr_process_creation.hpp"
#include "ldr_ro_manager.hpp"
#include "ldr_ro_manager.hpp"
#include "oc/oc_loader.hpp"
namespace ams::ldr {
namespace {
/* Convenience defines. */
constexpr size_t SystemResourceSizeMax = 0x1FE00000;
/* Types. */
enum NsoIndex {
Nso_Rtld = 0,
Nso_Main = 1,
Nso_Compat0 = 2,
Nso_Compat1 = 3,
Nso_Compat2 = 4,
Nso_Compat3 = 5,
Nso_Compat4 = 6,
Nso_Compat5 = 7,
Nso_Compat6 = 8,
Nso_Compat7 = 9,
Nso_Compat8 = 10,
Nso_Compat9 = 11,
Nso_SubSdk0 = 12,
Nso_SubSdk1 = 13,
Nso_SubSdk2 = 14,
Nso_SubSdk3 = 15,
Nso_SubSdk4 = 16,
Nso_SubSdk5 = 17,
Nso_SubSdk6 = 18,
Nso_SubSdk7 = 19,
Nso_SubSdk8 = 20,
Nso_SubSdk9 = 21,
Nso_Sdk = 22,
Nso_Count,
};
constexpr inline const char *NsoPaths[Nso_Count] = {
ENCODE_ATMOSPHERE_CODE_PATH("/rtld"),
ENCODE_ATMOSPHERE_CODE_PATH("/main"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat0"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat1"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat2"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat3"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat4"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat5"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat6"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat7"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat8"),
ENCODE_ATMOSPHERE_CMPT_PATH("/compat9"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk0"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk1"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk2"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk3"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk4"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk5"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk6"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk7"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk8"),
ENCODE_ATMOSPHERE_CODE_PATH("/subsdk9"),
ENCODE_ATMOSPHERE_CODE_PATH("/sdk"),
};
constexpr const char *GetNsoPath(size_t idx) {
AMS_ABORT_UNLESS(idx < Nso_Count);
return NsoPaths[idx];
}
struct ProcessInfo {
os::NativeHandle process_handle;
uintptr_t args_address;
size_t args_size;
uintptr_t nso_address[Nso_Count];
size_t nso_size[Nso_Count];
};
/* Global NSO header cache. */
bool g_has_nso[Nso_Count];
NsoHeader g_nso_headers[Nso_Count];
/* Pcv/Ptm check cache */
bool g_is_pcv;
bool g_is_ptm;
Result ValidateProgramVersion(ncm::ProgramId program_id, u32 version) {
/* No version verification is done before 8.1.0. */
R_SUCCEED_IF(hos::GetVersion() < hos::Version_8_1_0);
/* No verification is done if development. */
R_SUCCEED_IF(IsDevelopmentForAntiDowngradeCheck());
/* TODO: Anti-downgrade checking does not make very much sense for us. Should we do anything? */
AMS_UNUSED(program_id, version);
R_SUCCEED();
}
/* Helpers. */
Result GetProgramInfoFromMeta(ProgramInfo *out, const Meta *meta) {
/* Copy basic info. */
out->main_thread_priority = meta->npdm->main_thread_priority;
out->default_cpu_id = meta->npdm->default_cpu_id;
out->main_thread_stack_size = meta->npdm->main_thread_stack_size;
out->program_id = meta->aci->program_id;
/* Copy access controls. */
size_t offset = 0;
#define COPY_ACCESS_CONTROL(source, which) \
({ \
const size_t size = meta->source->which##_size; \
R_UNLESS(offset + size <= sizeof(out->ac_buffer), ldr::ResultInternalError()); \
out->source##_##which##_size = size; \
std::memcpy(out->ac_buffer + offset, meta->source##_##which, size); \
offset += size; \
})
/* Copy all access controls to buffer. */
COPY_ACCESS_CONTROL(acid, sac);
COPY_ACCESS_CONTROL(aci, sac);
COPY_ACCESS_CONTROL(acid, fac);
COPY_ACCESS_CONTROL(aci, fah);
#undef COPY_ACCESS_CONTROL
/* Copy flags. */
out->flags = MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32));
R_SUCCEED();
}
bool IsApplet(const Meta *meta) {
return (MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Applet;
}
bool IsApplication(const Meta *meta) {
return (MakeProgramInfoFlag(static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)) & ProgramInfoFlag_ApplicationTypeMask) == ProgramInfoFlag_Application;
}
Npdm::AddressSpaceType GetAddressSpaceType(const Meta *meta) {
return static_cast<Npdm::AddressSpaceType>((meta->npdm->flags & Npdm::MetaFlag_AddressSpaceTypeMask) >> Npdm::MetaFlag_AddressSpaceTypeShift);
}
Acid::PoolPartition GetPoolPartition(const Meta *meta) {
return static_cast<Acid::PoolPartition>((meta->acid->flags & Acid::AcidFlag_PoolPartitionMask) >> Acid::AcidFlag_PoolPartitionShift);
}
Result LoadAutoLoadHeaders(NsoHeader *nso_headers, bool *has_nso) {
/* Clear NSOs. */
std::memset(nso_headers, 0, sizeof(*nso_headers) * Nso_Count);
std::memset(has_nso, 0, sizeof(*has_nso) * Nso_Count);
for (size_t i = 0; i < Nso_Count; i++) {
fs::FileHandle file;
if (R_SUCCEEDED(fs::OpenFile(std::addressof(file), GetNsoPath(i), fs::OpenMode_Read))) {
ON_SCOPE_EXIT { fs::CloseFile(file); };
/* Read NSO header. */
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, 0, nso_headers + i, sizeof(*nso_headers)));
R_UNLESS(read_size == sizeof(*nso_headers), ldr::ResultInvalidNso());
has_nso[i] = true;
}
}
R_SUCCEED();
}
Result CheckAutoLoad(const NsoHeader *nso_headers, const bool *has_nso) {
/* We must always have a main. */
R_UNLESS(has_nso[Nso_Main], ldr::ResultInvalidNso());
/* If we don't have an RTLD, we must only have a main. */
if (!has_nso[Nso_Rtld]) {
for (size_t i = Nso_Main + 1; i < Nso_Count; i++) {
R_UNLESS(!has_nso[i], ldr::ResultInvalidNso());
}
}
/* All NSOs must have zero text offset. */
for (size_t i = 0; i < Nso_Count; i++) {
R_UNLESS(nso_headers[i].text_dst_offset == 0, ldr::ResultInvalidNso());
}
R_SUCCEED();
}
constexpr const ncm::ProgramId UnqualifiedApprovalProgramIds[] = {
{ 0x010003F003A34000 }, /* Pokemon: Let's Go, Pikachu! */
{ 0x0100152000022000 }, /* Mario Kart 8 Deluxe */
{ 0x0100165003504000 }, /* Nintendo Labo Toy-Con 04: VR Kit */
{ 0x0100187003A36000 }, /* Pokemon: Let's Go, Eevee! */
{ 0x01002E5008C56000 }, /* Pokemon Sword [Live Tournament] */
{ 0x01002FF008C24000 }, /* Ring Fit Adventure */
{ 0x010049900F546001 }, /* Super Mario 3D All-Stars: Super Mario 64 */
{ 0x010057D00ECE4000 }, /* Nintendo Switch Online (Nintendo 64) [for Japan] */
{ 0x01006F8002326000 }, /* Animal Crossing: New Horizons */
{ 0x01006FB00F50E000 }, /* [???] */
{ 0x010070300F50C000 }, /* [???] */
{ 0x010075100E8EC000 }, /* 马力欧卡丁车8 豪华版 [Mario Kart 8 Deluxe for China] */
{ 0x01008DB008C2C000 }, /* Pokemon Shield */
{ 0x01009AD008C4C000 }, /* Pokemon: Let's Go, Pikachu! [Kiosk] */
{ 0x0100A66003384000 }, /* Hulu */
{ 0x0100ABF008968000 }, /* Pokemon Sword */
{ 0x0100C9A00ECE6000 }, /* Nintendo Switch Online (Nintendo 64) [for America] */
{ 0x0100ED100BA3A000 }, /* Mario Kart Live: Home Circuit */
{ 0x0100F38011CFE000 }, /* Animal Crossing: New Horizons Island Transfer Tool */
{ 0x0100F6B011028000 }, /* 健身环大冒险 [Ring Fit Adventure for China] */
};
/* Check that the unqualified approval programs are sorted. */
static_assert([]() -> bool {
for (size_t i = 0; i < util::size(UnqualifiedApprovalProgramIds) - 1; ++i) {
if (UnqualifiedApprovalProgramIds[i].value >= UnqualifiedApprovalProgramIds[i + 1].value) {
return false;
}
}
return true;
}());
bool IsUnqualifiedApprovalProgramId(ncm::ProgramId program_id) {
/* Check if the program id is one with unqualified approval. */
return std::binary_search(std::begin(UnqualifiedApprovalProgramIds), std::end(UnqualifiedApprovalProgramIds), program_id);
}
bool IsUnqualifiedApproval(const Meta *meta) {
/* If the meta has unqualified approval flag, it's unqualified approval. */
if (meta->acid->flags & ldr::Acid::AcidFlag_UnqualifiedApproval) {
return true;
}
/* If the unqualified approval flag is not set, the program must be an application. */
if (!IsApplication(meta)) {
return false;
}
/* The program id must be a force unqualified approval program id. */
return IsUnqualifiedApprovalProgramId(meta->acid->program_id_min) && meta->acid->program_id_min == meta->acid->program_id_max;
}
Result ValidateMeta(const Meta *meta, const ncm::ProgramLocation &loc, const fs::CodeVerificationData &code_verification_data) {
/* Validate version. */
R_TRY(ValidateProgramVersion(loc.program_id, meta->npdm->version));
/* Validate program id. */
R_UNLESS(meta->aci->program_id >= meta->acid->program_id_min, ldr::ResultInvalidProgramId());
R_UNLESS(meta->aci->program_id <= meta->acid->program_id_max, ldr::ResultInvalidProgramId());
/* Validate the kernel capabilities. */
R_TRY(TestCapability(static_cast<const util::BitPack32 *>(meta->acid_kac), meta->acid->kac_size / sizeof(util::BitPack32), static_cast<const util::BitPack32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(util::BitPack32)));
/* Check if NCA is PCV or PTM */
g_is_pcv = meta->aci->program_id == ncm::SystemProgramId::Pcv;
g_is_ptm = meta->aci->program_id == ncm::SystemProgramId::Ptm;
/* If we have data to validate, validate it. */
if (meta->check_verification_data) {
const u8 *sig = code_verification_data.signature;
const size_t sig_size = sizeof(code_verification_data.signature);
const u8 *mod = static_cast<u8 *>(meta->modulus);
const size_t mod_size = crypto::Rsa2048PssSha256Verifier::ModulusSize;
const u8 *exp = fssystem::GetAcidSignatureKeyPublicExponent();
const size_t exp_size = fssystem::AcidSignatureKeyPublicExponentSize;
const u8 *hsh = code_verification_data.target_hash;
const size_t hsh_size = sizeof(code_verification_data.target_hash);
const bool is_signature_valid = crypto::VerifyRsa2048PssSha256WithHash(sig, sig_size, mod, mod_size, exp, exp_size, hsh, hsh_size);
/* If the signature check fails, we need to check if this is allowable. */
if (!is_signature_valid) {
/* We have to enforce signature checks on prod and when we have a signature to check on dev. */
R_UNLESS(IsDevelopmentForAcidProductionCheck(), ldr::ResultInvalidNcaSignature());
R_UNLESS(!code_verification_data.has_data, ldr::ResultInvalidNcaSignature());
/* There was no signature to check on dev. Check if this is acceptable. */
R_UNLESS(IsUnqualifiedApproval(meta), ldr::ResultInvalidNcaSignature());
}
}
/* All good. */
R_SUCCEED();
}
Result GetCreateProcessFlags(u32 *out, const Meta *meta, const u32 ldr_flags) {
const u8 meta_flags = meta->npdm->flags;
u32 flags = 0;
/* Set Is64Bit. */
if (meta_flags & Npdm::MetaFlag_Is64Bit) {
flags |= svc::CreateProcessFlag_Is64Bit;
}
/* Set AddressSpaceType. */
switch (GetAddressSpaceType(meta)) {
case Npdm::AddressSpaceType_32Bit:
flags |= svc::CreateProcessFlag_AddressSpace32Bit;
break;
case Npdm::AddressSpaceType_64BitDeprecated:
flags |= svc::CreateProcessFlag_AddressSpace64BitDeprecated;
break;
case Npdm::AddressSpaceType_32BitWithoutAlias:
flags |= svc::CreateProcessFlag_AddressSpace32BitWithoutAlias;
break;
case Npdm::AddressSpaceType_64Bit:
flags |= svc::CreateProcessFlag_AddressSpace64Bit;
break;
default:
R_THROW(ldr::ResultInvalidMeta());
}
/* Set Enable Debug. */
if (ldr_flags & CreateProcessFlag_EnableDebug) {
flags |= svc::CreateProcessFlag_EnableDebug;
}
/* Set Enable ASLR. */
if (!(ldr_flags & CreateProcessFlag_DisableAslr)) {
flags |= svc::CreateProcessFlag_EnableAslr;
}
/* Set Is Application. */
if (IsApplication(meta)) {
flags |= svc::CreateProcessFlag_IsApplication;
/* 7.0.0+: Set OptimizeMemoryAllocation if relevant. */
if (hos::GetVersion() >= hos::Version_7_0_0) {
if (meta_flags & Npdm::MetaFlag_OptimizeMemoryAllocation) {
flags |= svc::CreateProcessFlag_OptimizeMemoryAllocation;
}
}
}
/* 5.0.0+ Set Pool Partition. */
if (hos::GetVersion() >= hos::Version_5_0_0) {
/* TODO: Nintendo no longer accepts Applet when pool partition == application. Would this break hbl/anything else in the hb ecosystem? */
/* TODO: Nintendo uses a helper bool MakeSvcPoolPartitionFlag(u32 *out, Acid::PoolPartition partition); */
switch (GetPoolPartition(meta)) {
case Acid::PoolPartition_Application:
if (IsApplet(meta)) {
flags |= svc::CreateProcessFlag_PoolPartitionApplet;
} else {
flags |= svc::CreateProcessFlag_PoolPartitionApplication;
}
break;
case Acid::PoolPartition_Applet:
flags |= svc::CreateProcessFlag_PoolPartitionApplet;
break;
case Acid::PoolPartition_System:
flags |= svc::CreateProcessFlag_PoolPartitionSystem;
break;
case Acid::PoolPartition_SystemNonSecure:
flags |= svc::CreateProcessFlag_PoolPartitionSystemNonSecure;
break;
default:
R_THROW(ldr::ResultInvalidMeta());
}
} else if (hos::GetVersion() >= hos::Version_4_0_0) {
/* On 4.0.0+, the corresponding bit was simply "UseSecureMemory". */
if (meta->acid->flags & Acid::AcidFlag_DeprecatedUseSecureMemory) {
flags |= svc::CreateProcessFlag_DeprecatedUseSecureMemory;
}
}
/* 11.0.0+/meso Set Disable DAS merge. */
if (meta_flags & Npdm::MetaFlag_DisableDeviceAddressSpaceMerge) {
flags |= svc::CreateProcessFlag_DisableDeviceAddressSpaceMerge;
}
/* 18.0.0+/meso Set Alias region extra size. */
if (meta_flags & Npdm::MetaFlag_EnableAliasRegionExtraSize) {
flags |= svc::CreateProcessFlag_EnableAliasRegionExtraSize;
}
*out = flags;
R_SUCCEED();
}
Result GetCreateProcessParameter(svc::CreateProcessParameter *out, const Meta *meta, u32 flags, os::NativeHandle resource_limit) {
/* Clear output. */
std::memset(out, 0, sizeof(*out));
/* Set name, version, program id, resource limit handle. */
std::memcpy(out->name, meta->npdm->program_name, sizeof(out->name) - 1);
out->version = meta->npdm->version;
out->program_id = meta->aci->program_id.value;
out->reslimit = resource_limit;
/* Set flags. */
R_TRY(GetCreateProcessFlags(std::addressof(out->flags), meta, flags));
/* 3.0.0+ System Resource Size. */
if (hos::GetVersion() >= hos::Version_3_0_0) {
/* Validate size is aligned. */
R_UNLESS(util::IsAligned(meta->npdm->system_resource_size, os::MemoryBlockUnitSize), ldr::ResultInvalidSize());
/* Validate system resource usage. */
if (meta->npdm->system_resource_size) {
/* Process must be 64-bit. */
R_UNLESS((out->flags & svc::CreateProcessFlag_AddressSpace64Bit), ldr::ResultInvalidMeta());
/* Process must be application or applet. */
R_UNLESS(IsApplication(meta) || IsApplet(meta), ldr::ResultInvalidMeta());
/* Size must be less than or equal to max. */
R_UNLESS(meta->npdm->system_resource_size <= SystemResourceSizeMax, ldr::ResultInvalidMeta());
}
out->system_resource_num_pages = meta->npdm->system_resource_size >> 12;
}
R_SUCCEED();
}
u64 GenerateSecureRandom(u64 max) {
/* Generate a cryptographically random number. */
u64 rand;
crypto::GenerateCryptographicallyRandomBytes(std::addressof(rand), sizeof(rand));
/* Coerce into range. */
return rand % (max + 1);
}
Result DecideAddressSpaceLayout(ProcessInfo *out, svc::CreateProcessParameter *out_param, const NsoHeader *nso_headers, const bool *has_nso, const ArgumentStore::Entry *argument) {
/* Clear output. */
out->args_address = 0;
out->args_size = 0;
std::memset(out->nso_address, 0, sizeof(out->nso_address));
std::memset(out->nso_size, 0, sizeof(out->nso_size));
size_t total_size = 0;
bool argument_allocated = false;
/* Calculate base offsets. */
for (size_t i = 0; i < Nso_Count; i++) {
if (has_nso[i]) {
out->nso_address[i] = total_size;
const size_t text_end = nso_headers[i].text_dst_offset + nso_headers[i].text_size;
const size_t ro_end = nso_headers[i].ro_dst_offset + nso_headers[i].ro_size;
const size_t rw_end = nso_headers[i].rw_dst_offset + nso_headers[i].rw_size + nso_headers[i].bss_size;
out->nso_size[i] = text_end;
out->nso_size[i] = std::max(out->nso_size[i], ro_end);
out->nso_size[i] = std::max(out->nso_size[i], rw_end);
out->nso_size[i] = util::AlignUp(out->nso_size[i], os::MemoryPageSize);
total_size += out->nso_size[i];
if (!argument_allocated && argument != nullptr) {
out->args_address = total_size;
out->args_size = util::AlignUp(2 * sizeof(u32) + argument->argument_size * 2 + ArgumentStore::ArgumentBufferSize, os::MemoryPageSize);
total_size += out->args_size;
argument_allocated = true;
}
}
}
/* Calculate ASLR. */
uintptr_t aslr_start = 0;
size_t aslr_size = 0;
if (hos::GetVersion() >= hos::Version_2_0_0) {
switch (out_param->flags & svc::CreateProcessFlag_AddressSpaceMask) {
case svc::CreateProcessFlag_AddressSpace32Bit:
case svc::CreateProcessFlag_AddressSpace32BitWithoutAlias:
aslr_start = svc::AddressSmallMap32Start;
aslr_size = svc::AddressSmallMap32Size;
break;
case svc::CreateProcessFlag_AddressSpace64BitDeprecated:
aslr_start = svc::AddressSmallMap36Start;
aslr_size = svc::AddressSmallMap36Size;
break;
case svc::CreateProcessFlag_AddressSpace64Bit:
aslr_start = svc::AddressMap39Start;
aslr_size = svc::AddressMap39Size;
break;
AMS_UNREACHABLE_DEFAULT_CASE();
}
} else {
/* On 1.0.0, only 2 address space types existed. */
if (out_param->flags & svc::CreateProcessFlag_AddressSpace64BitDeprecated) {
aslr_start = svc::AddressSmallMap36Start;
aslr_size = svc::AddressSmallMap36Size;
} else {
aslr_start = svc::AddressSmallMap32Start;
aslr_size = svc::AddressSmallMap32Size;
}
}
R_UNLESS(total_size <= aslr_size, svc::ResultOutOfMemory());
/* Set Create Process output. */
uintptr_t aslr_slide = 0;
size_t free_size = (aslr_size - total_size);
if (out_param->flags & svc::CreateProcessFlag_EnableAslr) {
aslr_slide = GenerateSecureRandom(free_size / os::MemoryBlockUnitSize) * os::MemoryBlockUnitSize;
}
/* Set out. */
aslr_start += aslr_slide;
for (size_t i = 0; i < Nso_Count; i++) {
if (has_nso[i]) {
out->nso_address[i] += aslr_start;
}
}
if (out->args_address) {
out->args_address += aslr_start;
}
out_param->code_address = aslr_start;
out_param->code_num_pages = total_size >> 12;
R_SUCCEED();
}
Result LoadAutoLoadModuleSegment(fs::FileHandle file, const NsoHeader::SegmentInfo *segment, size_t file_size, const u8 *file_hash, bool is_compressed, bool check_hash, uintptr_t map_base, uintptr_t map_end) {
/* Select read size based on compression. */
if (!is_compressed) {
file_size = segment->size;
}
/* Validate size. */
R_UNLESS(file_size <= segment->size, ldr::ResultInvalidNso());
R_UNLESS(segment->size <= std::numeric_limits<s32>::max(), ldr::ResultInvalidNso());
/* Load data from file. */
uintptr_t load_address = is_compressed ? map_end - file_size : map_base;
size_t read_size;
R_TRY(fs::ReadFile(std::addressof(read_size), file, segment->file_offset, reinterpret_cast<void *>(load_address), file_size));
R_UNLESS(read_size == file_size, ldr::ResultInvalidNso());
/* Uncompress if necessary. */
if (is_compressed) {
bool decompressed = (util::DecompressLZ4(reinterpret_cast<void *>(map_base), segment->size, reinterpret_cast<const void *>(load_address), file_size) == static_cast<int>(segment->size));
R_UNLESS(decompressed, ldr::ResultInvalidNso());
}
/* Check hash if necessary. */
if (check_hash) {
u8 hash[crypto::Sha256Generator::HashSize];
crypto::GenerateSha256(hash, sizeof(hash), reinterpret_cast<void *>(map_base), segment->size);
R_UNLESS(std::memcmp(hash, file_hash, sizeof(hash)) == 0, ldr::ResultInvalidNso());
}
R_SUCCEED();
}
Result LoadAutoLoadModule(os::NativeHandle process_handle, fs::FileHandle file, const NsoHeader *nso_header, uintptr_t nso_address, size_t nso_size, bool prevent_code_reads) {
/* Map and read data from file. */
{
/* Map the process memory. */
void *mapped_memory = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(mapped_memory), process_handle, nso_address, nso_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(mapped_memory, process_handle, nso_address, nso_size); };
const uintptr_t map_address = reinterpret_cast<uintptr_t>(mapped_memory);
/* Load NSO segments. */
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Text]), nso_header->text_compressed_size, nso_header->text_hash, (nso_header->flags & NsoHeader::Flag_CompressedText) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashText) != 0, map_address + nso_header->text_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Ro]), nso_header->ro_compressed_size, nso_header->ro_hash, (nso_header->flags & NsoHeader::Flag_CompressedRo) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashRo) != 0, map_address + nso_header->ro_dst_offset, map_address + nso_size));
R_TRY(LoadAutoLoadModuleSegment(file, std::addressof(nso_header->segments[NsoHeader::Segment_Rw]), nso_header->rw_compressed_size, nso_header->rw_hash, (nso_header->flags & NsoHeader::Flag_CompressedRw) != 0,
(nso_header->flags & NsoHeader::Flag_CheckHashRw) != 0, map_address + nso_header->rw_dst_offset, map_address + nso_size));
/* Clear unused space to zero. */
const size_t text_end = nso_header->text_dst_offset + nso_header->text_size;
const size_t ro_end = nso_header->ro_dst_offset + nso_header->ro_size;
const size_t rw_end = nso_header->rw_dst_offset + nso_header->rw_size;
std::memset(reinterpret_cast<void *>(map_address + 0), 0, nso_header->text_dst_offset);
std::memset(reinterpret_cast<void *>(map_address + text_end), 0, nso_header->ro_dst_offset - text_end);
std::memset(reinterpret_cast<void *>(map_address + ro_end), 0, nso_header->rw_dst_offset - ro_end);
std::memset(reinterpret_cast<void *>(map_address + rw_end), 0, nso_header->bss_size);
/* Apply embedded patches. */
ApplyEmbeddedPatchesToModule(nso_header->module_id, map_address, nso_size);
/* Apply IPS patches. */
LocateAndApplyIpsPatchesToModule(nso_header->module_id, map_address, nso_size);
/* Apply PCV and PTM patches */
if (g_is_pcv)
hoc::pcv::Patch(map_address, nso_size);
if (g_is_ptm)
hoc::ptm::Patch(map_address, nso_size);
}
/* Set permissions. */
const size_t text_size = util::AlignUp(nso_header->text_size, os::MemoryPageSize);
const size_t ro_size = util::AlignUp(nso_header->ro_size, os::MemoryPageSize);
const size_t rw_size = util::AlignUp(nso_header->rw_size + nso_header->bss_size, os::MemoryPageSize);
if (text_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->text_dst_offset, text_size, prevent_code_reads ? os::MemoryPermission_ExecuteOnly : os::MemoryPermission_ReadExecute));
}
if (ro_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->ro_dst_offset, ro_size, os::MemoryPermission_ReadOnly));
}
if (rw_size) {
R_TRY(os::SetProcessMemoryPermission(process_handle, nso_address + nso_header->rw_dst_offset, rw_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result LoadAutoLoadModules(const ProcessInfo *process_info, const NsoHeader *nso_headers, const bool *has_nso, const ArgumentStore::Entry *argument, bool prevent_code_reads) {
/* Load each NSO. */
for (size_t i = 0; i < Nso_Count; i++) {
if (has_nso[i]) {
fs::FileHandle file;
R_TRY(fs::OpenFile(std::addressof(file), GetNsoPath(i), fs::OpenMode_Read));
ON_SCOPE_EXIT { fs::CloseFile(file); };
R_TRY(LoadAutoLoadModule(process_info->process_handle, file, nso_headers + i, process_info->nso_address[i], process_info->nso_size[i], prevent_code_reads));
}
}
/* Load arguments, if present. */
if (argument != nullptr) {
/* Write argument data into memory. */
{
void *map_address = nullptr;
R_TRY(os::MapProcessMemory(std::addressof(map_address), process_info->process_handle, process_info->args_address, process_info->args_size, GenerateSecureRandom));
ON_SCOPE_EXIT { os::UnmapProcessMemory(map_address, process_info->process_handle, process_info->args_address, process_info->args_size); };
ProgramArguments *args = static_cast<ProgramArguments *>(map_address);
std::memset(args, 0, sizeof(*args));
args->allocated_size = process_info->args_size;
args->arguments_size = argument->argument_size;
std::memcpy(args->arguments, argument->argument, argument->argument_size);
}
/* Set argument region permissions. */
/* NOTE: Nintendo uses svc::SetProcessMemoryPermission directly here. */
R_TRY(os::SetProcessMemoryPermission(process_info->process_handle, process_info->args_address, process_info->args_size, os::MemoryPermission_ReadWrite));
}
R_SUCCEED();
}
Result CreateProcessAndLoadAutoLoadModules(ProcessInfo *out, const Meta *meta, const NsoHeader *nso_headers, const bool *has_nso, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit) {
/* Get CreateProcessParameter. */
svc::CreateProcessParameter param;
R_TRY(GetCreateProcessParameter(std::addressof(param), meta, flags, resource_limit));
/* Decide on an NSO layout. */
R_TRY(DecideAddressSpaceLayout(out, std::addressof(param), nso_headers, has_nso, argument));
/* Actually create process. */
svc::Handle process_handle;
R_TRY(svc::CreateProcess(std::addressof(process_handle), std::addressof(param), static_cast<const u32 *>(meta->aci_kac), meta->aci->kac_size / sizeof(u32)));
/* Set the output handle, and ensure that if we fail after this point we clean it up. */
out->process_handle = process_handle;
ON_RESULT_FAILURE { svc::CloseHandle(process_handle); };
/* Load all auto load modules. */
R_RETURN(LoadAutoLoadModules(out, nso_headers, has_nso, argument, (meta->npdm->flags & ldr::Npdm::MetaFlag_PreventCodeReads) != 0));
}
}
/* Process Creation API. */
Result CreateProcess(os::NativeHandle *out, PinId pin_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status, const char *path, const ArgumentStore::Entry *argument, u32 flags, os::NativeHandle resource_limit, const ldr::ProgramAttributes &attrs) {
/* Mount code. */
AMS_UNUSED(path);
ScopedCodeMount mount(loc, override_status, attrs);
R_TRY(mount.GetResult());
/* Load meta, possibly from cache. */
Meta meta;
R_TRY(LoadMetaFromCache(std::addressof(meta), loc, override_status, attrs.platform));
/* Validate meta. */
R_TRY(ValidateMeta(std::addressof(meta), loc, mount.GetCodeVerificationData()));
/* Load, validate NSO headers. */
R_TRY(LoadAutoLoadHeaders(g_nso_headers, g_has_nso));
R_TRY(CheckAutoLoad(g_nso_headers, g_has_nso));
/* Actually create the process and load NSOs into process memory. */
ProcessInfo info;
R_TRY(CreateProcessAndLoadAutoLoadModules(std::addressof(info), std::addressof(meta), g_nso_headers, g_has_nso, argument, flags, resource_limit));
/* Register NSOs with the RoManager. */
{
/* Nintendo doesn't validate this get, but we do. */
os::ProcessId process_id = os::GetProcessId(info.process_handle);
/* Register new process. */
const auto as_type = GetAddressSpaceType(std::addressof(meta));
RoManager::GetInstance().RegisterProcess(pin_id, process_id, meta.aci->program_id, as_type == Npdm::AddressSpaceType_64Bit || as_type == Npdm::AddressSpaceType_64BitDeprecated);
/* Register all NSOs. */
for (size_t i = 0; i < Nso_Count; i++) {
if (g_has_nso[i]) {
RoManager::GetInstance().AddNso(pin_id, g_nso_headers[i].module_id, info.nso_address[i], info.nso_size[i]);
}
}
}
/* If we're overriding for HBL, perform HTML document redirection. */
if (override_status.IsHbl()) {
/* Don't validate result, failure is okay. */
RedirectHtmlDocumentPathForHbl(loc);
}
/* Clear the external code for the program. */
fssystem::DestroyExternalCode(loc.program_id);
/* Note that we've created the program. */
SetLaunchedBootProgram(loc.program_id);
/* Move the process handle to output. */
*out = info.process_handle;
R_SUCCEED();
}
Result GetProgramInfo(ProgramInfo *out, cfg::OverrideStatus *out_status, const ncm::ProgramLocation &loc, const char *path, const ldr::ProgramAttributes &attrs) {
Meta meta;
/* Load Meta. */
{
AMS_UNUSED(path);
ScopedCodeMount mount(loc, attrs);
R_TRY(mount.GetResult());
R_TRY(LoadMeta(std::addressof(meta), loc, mount.GetOverrideStatus(), attrs.platform, false));
if (out_status != nullptr) {
*out_status = mount.GetOverrideStatus();
}
}
return GetProgramInfoFromMeta(out, std::addressof(meta));
}
Result PinProgram(PinId *out_id, const ncm::ProgramLocation &loc, const cfg::OverrideStatus &override_status) {
R_UNLESS(RoManager::GetInstance().Allocate(out_id, loc, override_status), ldr::ResultMaxProcess());
R_SUCCEED();
}
Result UnpinProgram(PinId id) {
R_UNLESS(RoManager::GetInstance().Free(id), ldr::ResultNotPinned());
R_SUCCEED();
}
Result GetProcessModuleInfo(u32 *out_count, ldr::ModuleInfo *out, size_t max_out_count, os::ProcessId process_id) {
R_UNLESS(RoManager::GetInstance().GetProcessModuleInfo(out_count, out, max_out_count, process_id), ldr::ResultNotPinned());
R_SUCCEED();
}
Result GetProgramLocationAndOverrideStatusFromPinId(ncm::ProgramLocation *out, cfg::OverrideStatus *out_status, PinId pin_id) {
R_UNLESS(RoManager::GetInstance().GetProgramLocationAndStatus(out, out_status, pin_id), ldr::ResultNotPinned());
R_SUCCEED();
}
}

View File

@@ -0,0 +1,22 @@
** FOR DEVELOPERS UTILIZING SYSCLK API ONLY **
Ensure you include the latest hoc-clk ipc and header files in your project before proceeding
Before running migration replacements, change every reference to sys-clk's ramload api to this
ramLoad -> partLoad
SysClkRamLoad_All -> HocClkPartLoad_EMC
SysClkRamLoad_Cpu -> HocClkPartLoad_EMCCpu
API version reference must be changed. compare to HOCCLK_IPC_API_VERSION
If you use the service name, use HOCCLK_IPC_SERVICE_NAME
Remove checks for the u8 enabled in sysclk clockmanager struct. Check if hocclk is enabled by listening to IPC results
Run the following replace commands (case sensitive):
sysclk -> hocclk
SysClk -> HocClk
SYSCLK -> HOCCLK
sysClk -> hocClk
Your project is now migrated to run with HOC

View File

@@ -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/horizon-oc.nsp" "$DIST_DIR/atmosphere/contents/$TITLE_ID/exefs.nsp"
cp -vf "$ROOT_DIR/sysmodule/out/hoc-clk.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"
@@ -38,5 +38,4 @@ cp -vf "$ROOT_DIR/config.ini.template" "$DIST_DIR/config/horizon-oc/config.ini.t
cp -vf "$ROOT_DIR/../../README.md" "$DIST_DIR/README.md"
echo "*** lang ***"
cp -r "$ROOT_DIR/overlay/lang/" "$DIST_DIR/config/horizon-oc/lang/"

View File

@@ -0,0 +1,101 @@
/*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <switch.h>
#include <inttypes.h>
#include <string.h>
typedef enum {
BatteryFlag_NoHub = BIT(0), // Hub is disconnected
BatteryFlag_Rail = BIT(8), // At least one Joy-con is charging from rail
BatteryFlag_SPDSRC = BIT(12), // OTG
BatteryFlag_ACC = BIT(16) // Accessory
} BatteryChargeFlags;
typedef enum {
PDState_NewPDO = 1, // Received new Power Data Object
PDState_NoPD = 2, // No Power Delivery source is detected
PDState_AcceptedRDO = 3 // Received and accepted Request Data Object
} BatteryPDControllerState;
// Charger type detection
typedef enum {
ChargerType_None = 0,
ChargerType_PD = 1,
ChargerType_TypeC_1500mA = 2,
ChargerType_TypeC_3000mA = 3,
ChargerType_DCP = 4, // Dedicated Charging Port
ChargerType_CDP = 5, // Charging Downstream Port
ChargerType_SDP = 6, // Standard Downstream Port
ChargerType_Apple_500mA = 7,
ChargerType_Apple_1000mA = 8,
ChargerType_Apple_2000mA = 9
} BatteryChargerType;
typedef enum {
PowerRole_Sink = 1, // Device is receiving power
PowerRole_Source = 2 // Device is providing power
} BatteryPowerRole;
typedef struct {
int32_t InputCurrentLimit; // Input (Sink) current limit in mA
int32_t VBUSCurrentLimit; // Output (Source/VBUS/OTG) current limit in mA
int32_t ChargeCurrentLimit; // Battery charging current limit in mA
int32_t ChargeVoltageLimit; // Battery charging voltage limit in mV
int32_t unk_x10; // Unknown field (possibly enum)
int32_t unk_x14; // Unknown field (possibly flags)
BatteryPDControllerState PDControllerState; // PD Controller State
int32_t BatteryTemperature; // Battery temperature in milli-Celsius
int32_t RawBatteryCharge; // Battery charge in percentmille
int32_t VoltageAvg; // Average voltage in mV
int32_t BatteryAge; // Battery health (capacity full/design) in pcm
BatteryPowerRole PowerRole; // Current power role
BatteryChargerType ChargerType; // Type of charger connected
int32_t ChargerVoltageLimit; // Charger voltage limit in mV
int32_t ChargerCurrentLimit; // Charger current limit in mA
BatteryChargeFlags Flags; // Various status flags
} BatteryChargeInfo;
#define IS_BATTERY_CHARGING_ENABLED(info) (((info)->unk_x14 >> 8) & 1)
static inline int batteryInfoGetTemperatureMiliCelsius(BatteryChargeInfo *info) {
return info->BatteryTemperature;
}
static inline float batteryInfoGetChargePercent(BatteryChargeInfo *info) {
return (float)info->RawBatteryCharge / 1000.0f;
}
static inline float batteryInfoGetBatteryHealthPercent(BatteryChargeInfo *info) {
return (float)info->BatteryAge / 1000.0f;
}
static inline bool batteryInfoIsCharging(BatteryChargeInfo *info) {
return IS_BATTERY_CHARGING_ENABLED(info);
}
Result batteryInfoInitialize(void);
void batteryInfoExit(void);
Result batteryInfoGetChargeInfo(BatteryChargeInfo *out);
Result batteryInfoGetChargePercentage(u32 *out);
Result batteryInfoIsEnoughPowerSupplied(bool *out);
Result batteryInfoEnableCharging(void);
Result batteryInfoDisableCharging(void);
Result batteryInfoEnableFastCharging(void);
Result batteryInfoDisableFastCharging(void);
const char* batteryInfoGetChargerTypeString(BatteryChargerType type);
const char* batteryInfoGetPowerRoleString(BatteryPowerRole role);
const char* batteryInfoGetPDStateString(BatteryPDControllerState state);

View File

@@ -16,11 +16,9 @@
*/
#pragma once
#include <map>
#include <cstdint>
#include <string>
extern std::map<uint32_t, std::string> cpu_freq_label_m;
extern std::map<uint32_t, std::string> cpu_freq_label_e;
extern std::map<uint32_t, std::string> gpu_freq_label_m;
extern std::map<uint32_t, std::string> gpu_freq_label_e;
#include <stdio.h>
#include <stdint.h>
namespace crc32 {
uint32_t crc32(const uint8_t *data, size_t length);
uint32_t checksum_file(const char *filename);
}

View File

@@ -0,0 +1,314 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018 shuffle2
* Copyright (c) 2018 balika011
* Copyright (c) 2019-2025 CTCaer
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _FUSE_H_
#define _FUSE_H_
#ifndef BIT
#define BIT(n) (1U<<(n))
#endif
/*! Fuse registers. */
#define FUSE_CTRL 0x0
#define FUSE_ADDR 0x4
#define FUSE_RDATA 0x8
#define FUSE_WDATA 0xC
#define FUSE_TIME_RD1 0x10
#define FUSE_TIME_RD2 0x14
#define FUSE_TIME_PGM1 0x18
#define FUSE_TIME_PGM2 0x1C
#define FUSE_PRIV2INTFC 0x20
#define FUSE_PRIV2INTFC_START_DATA BIT(0)
#define FUSE_PRIV2INTFC_SKIP_RECORDS BIT(1)
#define FUSE_FUSEBYPASS 0x24
#define FUSE_PRIVATEKEYDISABLE 0x28
#define FUSE_PRIVKEY_DISABLE BIT(0)
#define FUSE_PRIVKEY_TZ_STICKY_BIT BIT(4)
#define FUSE_DISABLEREGPROGRAM 0x2C
#define FUSE_WRITE_ACCESS_SW 0x30
#define FUSE_PWR_GOOD_SW 0x34
#define FUSE_PRIV2RESHIFT 0x3C
#define FUSE_FUSETIME_RD0 0x40
#define FUSE_FUSETIME_RD1 0x44
#define FUSE_FUSETIME_RD2 0x48
#define FUSE_FUSETIME_RD3 0x4C
#define FUSE_PRIVATE_KEY0_NONZERO 0x80
#define FUSE_PRIVATE_KEY1_NONZERO 0x84
#define FUSE_PRIVATE_KEY2_NONZERO 0x88
#define FUSE_PRIVATE_KEY3_NONZERO 0x8C
#define FUSE_PRIVATE_KEY4_NONZERO 0x90
/*! Fuse Cached registers */
#define FUSE_RESERVED_ODM8_B01 0x98 // FUSE_READ_TZ Group 0.
#define FUSE_RESERVED_ODM9_B01 0x9C // FUSE_READ_TZ Group 0.
#define FUSE_RESERVED_ODM10_B01 0xA0 // FUSE_READ_TZ Group 0.
#define FUSE_RESERVED_ODM11_B01 0xA4 // FUSE_READ_TZ Group 0.
#define FUSE_RESERVED_ODM12_B01 0xA8 // FUSE_READ_TZ Group 1? Is value -1?
#define FUSE_RESERVED_ODM13_B01 0xAC // FUSE_READ_TZ Group 1? Is value -1?
#define FUSE_RESERVED_ODM14_B01 0xB0 // FUSE_READ_TZ Group 1? Is value -1?
#define FUSE_RESERVED_ODM15_B01 0xB4 // FUSE_READ_TZ Group 1? Is value -1?
#define FUSE_RESERVED_ODM16_B01 0xB8 // FUSE_READ_TZ Group 2? Is value -1?
#define FUSE_RESERVED_ODM17_B01 0xBC // FUSE_READ_TZ Group 2? Is value -1?
#define FUSE_RESERVED_ODM18_B01 0xC0 // FUSE_READ_TZ Group 2.
#define FUSE_RESERVED_ODM19_B01 0xC4 // FUSE_READ_TZ Group 2.
#define FUSE_RESERVED_ODM20_B01 0xC8 // FUSE_READ_TZ Group 3.
#define FUSE_RESERVED_ODM21_B01 0xCC // FUSE_READ_TZ Group 3.
#define FUSE_KEK00_B01 0xD0
#define FUSE_KEK01_B01 0xD4
#define FUSE_KEK02_B01 0xD8
#define FUSE_KEK03_B01 0xDC
#define FUSE_BEK00_B01 0xE0
#define FUSE_BEK01_B01 0xE4
#define FUSE_BEK02_B01 0xE8
#define FUSE_BEK03_B01 0xEC
#define FUSE_OPT_RAM_RTSEL_TSMCSP_PO4SVT_B01 0xF0
#define FUSE_OPT_RAM_WTSEL_TSMCSP_PO4SVT_B01 0xF4
#define FUSE_OPT_RAM_RTSEL_TSMCPDP_PO4SVT_B01 0xF8
#define FUSE_OPT_RAM_MTSEL_TSMCPDP_PO4SVT_B01 0xFC
#define FUSE_PRODUCTION_MODE 0x100
#define FUSE_JTAG_SECUREID_VALID 0x104
#define FUSE_ODM_LOCK 0x108
#define FUSE_OPT_OPENGL_EN 0x10C
#define FUSE_SKU_INFO 0x110
#define FUSE_CPU_SPEEDO_0_CALIB 0x114
#define FUSE_CPU_IDDQ_CALIB 0x118
#define FUSE_RESERVED_ODM22_B01 0x11C // FUSE_READ_TZ Group 3.
#define FUSE_RESERVED_ODM23_B01 0x120 // FUSE_READ_TZ Group 3.
#define FUSE_RESERVED_ODM24_B01 0x124 // FUSE_READ_TZ Group 4.
#define FUSE_OPT_FT_REV 0x128
#define FUSE_CPU_SPEEDO_1_CALIB 0x12C
#define FUSE_CPU_SPEEDO_2_CALIB 0x130
#define FUSE_SOC_SPEEDO_0_CALIB 0x134
#define FUSE_SOC_SPEEDO_1_CALIB 0x138
#define FUSE_SOC_SPEEDO_2_CALIB 0x13C
#define FUSE_SOC_IDDQ_CALIB 0x140
#define FUSE_RESERVED_ODM25_B01 0x144 // FUSE_READ_TZ Group 4.
#define FUSE_FA 0x148
#define FUSE_RESERVED_PRODUCTION 0x14C
#define FUSE_HDMI_LANE0_CALIB 0x150
#define FUSE_HDMI_LANE1_CALIB 0x154
#define FUSE_HDMI_LANE2_CALIB 0x158
#define FUSE_HDMI_LANE3_CALIB 0x15C
#define FUSE_ENCRYPTION_RATE 0x160
#define FUSE_PUBLIC_KEY0 0x164
#define FUSE_PUBLIC_KEY1 0x168
#define FUSE_PUBLIC_KEY2 0x16C
#define FUSE_PUBLIC_KEY3 0x170
#define FUSE_PUBLIC_KEY4 0x174
#define FUSE_PUBLIC_KEY5 0x178
#define FUSE_PUBLIC_KEY6 0x17C
#define FUSE_PUBLIC_KEY7 0x180
#define FUSE_TSENSOR1_CALIB 0x184 // CPU1.
#define FUSE_TSENSOR2_CALIB 0x188 // CPU2.
#define FUSE_OPT_SECURE_SCC_DIS_B01 0x18C
#define FUSE_OPT_CP_REV 0x190 // FUSE style revision - ATE. 0x101 0x100
#define FUSE_OPT_PFG 0x194
#define FUSE_TSENSOR0_CALIB 0x198 // CPU0.
#define FUSE_FIRST_BOOTROM_PATCH_SIZE 0x19C
#define FUSE_SECURITY_MODE 0x1A0
#define FUSE_PRIVATE_KEY0 0x1A4
#define FUSE_PRIVATE_KEY1 0x1A8
#define FUSE_PRIVATE_KEY2 0x1AC
#define FUSE_PRIVATE_KEY3 0x1B0
#define FUSE_PRIVATE_KEY4 0x1B4
#define FUSE_ARM_JTAG_DIS 0x1B8
#define FUSE_BOOT_DEVICE_INFO 0x1BC
#define FUSE_RESERVED_SW 0x1C0
#define FUSE_OPT_VP9_DISABLE 0x1C4
#define FUSE_RESERVED_ODM0 0x1C8
#define FUSE_RESERVED_ODM1 0x1CC
#define FUSE_RESERVED_ODM2 0x1D0
#define FUSE_RESERVED_ODM3 0x1D4
#define FUSE_RESERVED_ODM4 0x1D8
#define FUSE_RESERVED_ODM5 0x1DC
#define FUSE_RESERVED_ODM6 0x1E0
#define FUSE_RESERVED_ODM7 0x1E4
#define FUSE_OBS_DIS 0x1E8
#define FUSE_OPT_NVJTAG_PROTECTION_ENABLE_B01 0x1EC
#define FUSE_USB_CALIB 0x1F0
#define FUSE_SKU_DIRECT_CONFIG 0x1F4
#define FUSE_KFUSE_PRIVKEY_CTRL 0x1F8
#define FUSE_PACKAGE_INFO 0x1FC // 1: MID, 2: DSC.
#define FUSE_OPT_VENDOR_CODE 0x200
#define FUSE_OPT_FAB_CODE 0x204
#define FUSE_OPT_LOT_CODE_0 0x208
#define FUSE_OPT_LOT_CODE_1 0x20C
#define FUSE_OPT_WAFER_ID 0x210
#define FUSE_OPT_X_COORDINATE 0x214
#define FUSE_OPT_Y_COORDINATE 0x218
#define FUSE_OPT_SEC_DEBUG_EN 0x21C
#define FUSE_OPT_OPS_RESERVED 0x220
#define FUSE_SATA_CALIB 0x224
#define FUSE_SPARE_REGISTER_ODM_B01 0x224
#define FUSE_GPU_IDDQ_CALIB 0x228
#define FUSE_TSENSOR3_CALIB 0x22C // CPU3.
#define FUSE_CLOCK_BONDOUT0 0x230
#define FUSE_CLOCK_BONDOUT1 0x234
#define FUSE_RESERVED_ODM26_B01 0x238 // FUSE_READ_TZ Group 4.
#define FUSE_RESERVED_ODM27_B01 0x23C // FUSE_READ_TZ Group 4.
#define FUSE_RESERVED_ODM28_B01 0x240 // MAX77812 phase configuration. FUSE_READ_TZ Group 5.
#define FUSE_OPT_SAMPLE_TYPE 0x244
#define FUSE_OPT_SUBREVISION 0x248 // "", "p", "q", "r". e.g: A01p.
#define FUSE_OPT_SW_RESERVED_0 0x24C
#define FUSE_OPT_SW_RESERVED_1 0x250
#define FUSE_TSENSOR4_CALIB 0x254 // GPU.
#define FUSE_TSENSOR5_CALIB 0x258 // MEM0.
#define FUSE_TSENSOR6_CALIB 0x25C // MEM1.
#define FUSE_TSENSOR7_CALIB 0x260 // PLLX.
#define FUSE_OPT_PRIV_SEC_DIS 0x264
#define FUSE_PKC_DISABLE 0x268
#define FUSE_BOOT_SECURITY_INFO_B01 0x268
#define FUSE_OPT_RAM_RTSEL_TSMCSP_PO4HVT_B01 0x26C
#define FUSE_OPT_RAM_WTSEL_TSMCSP_PO4HVT_B01 0x270
#define FUSE_OPT_RAM_RTSEL_TSMCPDP_PO4HVT_B01 0x274
#define FUSE_OPT_RAM_MTSEL_TSMCPDP_PO4HVT_B01 0x278
#define FUSE_FUSE2TSEC_DEBUG_DISABLE 0x27C
#define FUSE_TSENSOR_COMMON 0x280
#define FUSE_OPT_CP_BIN 0x284
#define FUSE_OPT_GPU_DISABLE 0x288
#define FUSE_OPT_FT_BIN 0x28C
#define FUSE_OPT_DONE_MAP 0x290
#define FUSE_RESERVED_ODM29_B01 0x294 // FUSE_READ_TZ Group 5? Is value -1?
#define FUSE_APB2JTAG_DISABLE 0x298
#define FUSE_ODM_INFO 0x29C // Debug features disable.
#define FUSE_ARM_CRYPT_DE_FEATURE 0x2A8
#define FUSE_OPT_RAM_WTSEL_TSMCPDP_PO4SVT_B01 0x2B0
#define FUSE_OPT_RAM_RCT_TSMCDP_PO4SVT_B01 0x2B4
#define FUSE_OPT_RAM_WCT_TSMCDP_PO4SVT_B01 0x2B8
#define FUSE_OPT_RAM_KP_TSMCDP_PO4SVT_B01 0x2BC
#define FUSE_WOA_SKU_FLAG 0x2C0
#define FUSE_ECO_RESERVE_1 0x2C4
#define FUSE_GCPLEX_CONFIG_FUSE 0x2C8
#define FUSE_GPU_VPR_AUTO_FETCH_DIS BIT(0)
#define FUSE_GPU_VPR_ENABLED BIT(1)
#define FUSE_GPU_WPR_ENABLED BIT(2)
#define FUSE_PRODUCTION_MONTH 0x2CC
#define FUSE_RAM_REPAIR_INDICATOR 0x2D0
#define FUSE_TSENSOR9_CALIB 0x2D4 // AOTAG.
#define FUSE_VMIN_CALIBRATION 0x2DC
#define FUSE_AGING_SENSOR_CALIBRATION 0x2E0
#define FUSE_DEBUG_AUTHENTICATION 0x2E4
#define FUSE_SECURE_PROVISION_INDEX 0x2E8
#define FUSE_SECURE_PROVISION_INFO 0x2EC
#define FUSE_OPT_GPU_DISABLE_CP1 0x2F0
#define FUSE_SPARE_ENDIS 0x2F4
#define FUSE_ECO_RESERVE_0 0x2F8 // AID.
#define FUSE_RESERVED_CALIB0 0x304 // GPCPLL ADC Calibration.
#define FUSE_RESERVED_CALIB1 0x308
#define FUSE_OPT_GPU_TPC0_DISABLE 0x30C
#define FUSE_OPT_GPU_TPC0_DISABLE_CP1 0x310
#define FUSE_OPT_CPU_DISABLE 0x314
#define FUSE_OPT_CPU_DISABLE_CP1 0x318
#define FUSE_TSENSOR10_CALIB 0x31C
#define FUSE_TSENSOR10_CALIB_AUX 0x320
#define FUSE_OPT_RAM_SVOP_DP 0x324
#define FUSE_OPT_RAM_SVOP_PDP 0x328
#define FUSE_OPT_RAM_SVOP_REG 0x32C
#define FUSE_OPT_RAM_SVOP_SP 0x330
#define FUSE_OPT_RAM_SVOP_SMPDP 0x334
#define FUSE_OPT_RAM_WTSEL_TSMCPDP_PO4HVT_B01 0x324
#define FUSE_OPT_RAM_RCT_TSMCDP_PO4HVT_B01 0x328
#define FUSE_OPT_RAM_WCT_TSMCDP_PO4HVT_B01 0x32c
#define FUSE_OPT_RAM_KP_TSMCDP_PO4HVT_B01 0x330
#define FUSE_OPT_RAM_SVOP_SP_B01 0x334
#define FUSE_OPT_GPU_TPC0_DISABLE_CP2 0x338
#define FUSE_OPT_GPU_TPC1_DISABLE 0x33C
#define FUSE_OPT_GPU_TPC1_DISABLE_CP1 0x340
#define FUSE_OPT_GPU_TPC1_DISABLE_CP2 0x344
#define FUSE_OPT_CPU_DISABLE_CP2 0x348
#define FUSE_OPT_GPU_DISABLE_CP2 0x34C
#define FUSE_USB_CALIB_EXT 0x350
#define FUSE_RESERVED_FIELD 0x354 // RMA.
#define FUSE_SPARE_REALIGNMENT_REG 0x37C
#define FUSE_SPARE_BIT_0 0x380
//...
#define FUSE_SPARE_BIT_31 0x3FC
/*! Fuse commands. */
#define FUSE_IDLE 0x0
#define FUSE_READ 0x1
#define FUSE_WRITE 0x2
#define FUSE_SENSE 0x3
#define FUSE_CMD_MASK 0x3
/*! Fuse status. */
#define FUSE_STATUS_RESET 0
#define FUSE_STATUS_POST_RESET 1
#define FUSE_STATUS_LOAD_ROW0 2
#define FUSE_STATUS_LOAD_ROW1 3
#define FUSE_STATUS_IDLE 4
#define FUSE_STATUS_READ_SETUP 5
#define FUSE_STATUS_READ_STROBE 6
#define FUSE_STATUS_SAMPLE_FUSES 7
#define FUSE_STATUS_READ_HOLD 8
#define FUSE_STATUS_FUSE_SRC_SETUP 9
#define FUSE_STATUS_WRITE_SETUP 10
#define FUSE_STATUS_WRITE_ADDR_SETUP 11
#define FUSE_STATUS_WRITE_PROGRAM 12
#define FUSE_STATUS_WRITE_ADDR_HOLD 13
#define FUSE_STATUS_FUSE_SRC_HOLD 14
#define FUSE_STATUS_LOAD_RIR 15
#define FUSE_STATUS_READ_BEFORE_WRITE_SETUP 16
#define FUSE_STATUS_READ_DEASSERT_PD 17
/*! Fuse cache registers. */
#define FUSE_RESERVED_ODMX(x) (0x1C8 + 4 * (x))
#define FUSE_ARRAY_WORDS_NUM 192
#define FUSE_ARRAY_WORDS_NUM_B01 256
enum
{
FUSE_NX_HW_TYPE_ICOSA,
FUSE_NX_HW_TYPE_IOWA,
FUSE_NX_HW_TYPE_HOAG,
FUSE_NX_HW_TYPE_AULA
};
enum
{
FUSE_NX_HW_STATE_PROD,
FUSE_NX_HW_STATE_DEV
};
#endif

View File

@@ -12,9 +12,9 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
@@ -42,13 +42,13 @@ extern "C" {
// typedef std::int16_t s16;
// typedef std::uint16_t u16;
#include "sysclk/ipc.h"
#include "sysclk/board.h"
#include "sysclk/clock_manager.h"
#include "sysclk/apm.h"
#include "sysclk/config.h"
#include "sysclk/errors.h"
#include "sysclk/psm_ext.h"
#include "hocclk/ipc.h"
#include "hocclk/board.h"
#include "hocclk/clock_manager.h"
#include "hocclk/apm.h"
#include "hocclk/config.h"
#include "hocclk/errors.h"
#include "hocclk/psm_ext.h"
#ifdef __cplusplus
}

View File

@@ -34,6 +34,6 @@ typedef struct {
uint32_t cpu_hz;
uint32_t gpu_hz;
uint32_t mem_hz;
} SysClkApmConfiguration;
} HocClkApmConfiguration;
extern SysClkApmConfiguration sysclk_g_apm_configurations[];
extern HocClkApmConfiguration hocclk_g_apm_configurations[];

View File

@@ -30,31 +30,31 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <switch/types.h>
typedef enum
{
HocClkSocType_Erista = 0,
HocClkSocType_Mariko,
HocClkSocType_EnumMax
} HocClkSocType;
typedef enum
{
SysClkSocType_Erista = 0,
SysClkSocType_Mariko,
SysClkSocType_EnumMax
} SysClkSocType;
typedef enum
{
HorizonOCConsoleType_Icosa = 0,
HorizonOCConsoleType_Copper,
HorizonOCConsoleType_Hoag,
HorizonOCConsoleType_Iowa,
HorizonOCConsoleType_Calcio,
HorizonOCConsoleType_Aula,
HorizonOCConsoleType_EnumMax,
} HorizonOCConsoleType;
HocClkConsoleType_Icosa = 0,
HocClkConsoleType_Copper,
HocClkConsoleType_Hoag,
HocClkConsoleType_Iowa,
HocClkConsoleType_Calcio,
HocClkConsoleType_Aula,
HocClkConsoleType_EnumMax,
} HocClkConsoleType;
typedef enum {
HocClkVoltage_SOC = 0,
HocClkVoltage_EMCVDD2,
HocClkVoltage_CPU,
HocClkVoltage_GPU,
HocClkVoltage_EMCVDDQ_MarikoOnly,
HocClkVoltage_EMCVDDQ,
HocClkVoltage_Display,
HocClkVoltage_Battery,
HocClkVoltage_EnumMax,
@@ -62,58 +62,62 @@ typedef enum {
typedef enum
{
SysClkProfile_Handheld = 0,
SysClkProfile_HandheldCharging,
SysClkProfile_HandheldChargingUSB,
SysClkProfile_HandheldChargingOfficial,
SysClkProfile_Docked,
SysClkProfile_EnumMax
} SysClkProfile;
HocClkProfile_Handheld = 0,
HocClkProfile_HandheldCharging,
HocClkProfile_HandheldChargingUSB,
HocClkProfile_HandheldChargingOfficial,
HocClkProfile_Docked,
HocClkProfile_EnumMax
} HocClkProfile;
typedef enum
{
SysClkModule_CPU = 0,
SysClkModule_GPU,
SysClkModule_MEM,
HorizonOCModule_Governor,
HorizonOCModule_Display,
SysClkModule_EnumMax,
} SysClkModule;
HocClkModule_CPU = 0,
HocClkModule_GPU,
HocClkModule_MEM,
HocClkModule_Governor,
HocClkModule_Display,
HocClkModule_EnumMax,
} HocClkModule;
typedef enum
{
SysClkThermalSensor_SOC = 0,
SysClkThermalSensor_PCB,
SysClkThermalSensor_Skin,
HorizonOCThermalSensor_Battery,
HorizonOCThermalSensor_PMIC,
SysClkThermalSensor_EnumMax
} SysClkThermalSensor;
HocClkThermalSensor_SOC = 0,
HocClkThermalSensor_PCB,
HocClkThermalSensor_Skin,
HocClkThermalSensor_Battery,
HocClkThermalSensor_PMIC,
HocClkThermalSensor_CPU,
HocClkThermalSensor_GPU,
HocClkThermalSensor_MEM,
HocClkThermalSensor_PLLX,
HocClkThermalSensor_EnumMax
} HocClkThermalSensor;
typedef enum
{
SysClkPowerSensor_Now = 0,
SysClkPowerSensor_Avg,
SysClkPowerSensor_EnumMax
} SysClkPowerSensor;
HocClkPowerSensor_Now = 0,
HocClkPowerSensor_Avg,
HocClkPowerSensor_EnumMax
} HocClkPowerSensor;
typedef enum
{
SysClkPartLoad_EMC = 0,
SysClkPartLoad_EMCCpu,
HocClkPartLoad_EMC = 0,
HocClkPartLoad_EMCCpu,
HocClkPartLoad_GPU,
HocClkPartLoad_CPUMax,
HocClkPartLoad_BAT,
HocClkPartLoad_FAN,
SysClkPartLoad_EnumMax
} SysClkPartLoad;
HocClkPartLoad_EnumMax
} HocClkPartLoad;
typedef enum {
HorizonOCSpeedo_CPU = 0,
HorizonOCSpeedo_GPU,
HorizonOCSpeedo_SOC,
HorizonOCSpeedo_EnumMax,
} HorizonOCSpeedo;
HocClkSpeedo_CPU = 0,
HocClkSpeedo_GPU,
HocClkSpeedo_SOC,
HocClkSpeedo_EnumMax,
} HocClkSpeedo;
typedef enum {
GPUUVLevel_NoUV = 0,
@@ -142,93 +146,110 @@ typedef enum {
GpuSchedulingOverrideMethod_NvService,
GpuSchedulingOverrideMethod_EnumMax,
} GpuSchedulingOverrideMethod;
typedef enum {
GovernorState_DoNotOverride = 0,
GovernorState_Disabled,
GovernorState_Enabled_CpuGpuVrr,
GovernorState_Enabled_CpuVrr,
GovernorState_Enabled_GpuVrr,
GovernorState_Enabled_CpuGpu,
GovernorState_Enabled_Cpu,
GovernorState_Enabled_Gpu,
GovernorState_Enabled_Vrr,
GovernorState_EnumMax,
} GovernorState;
ComponentGovernor_DoNotOverride = 0,
ComponentGovernor_Disabled = 1,
ComponentGovernor_Enabled = 2,
ComponentGovernor_EnumMax,
} ComponentGovernorState;
typedef enum {
RamDisplayMode_VDD2VDDQ = 0,
RamDisplayMode_VDD2Usage,
RamDisplayMode_VDDQUsage,
RamDisplayMode_VDD2 = 0,
RamDisplayMode_VDDQ,
RamDisplayMode_EnumMax,
} RamDisplayMode;
#define SYSCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
#define HOCCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
static inline const char* sysclkFormatModule(SysClkModule module, bool pretty)
// Packed u32
// Bits 0-7 - CPU
// Bits 8-15 - GPU
// Bits 16-23 - VRR
// Bits 24-32 - unused
inline u32 GovernorStatePack(u8 cpu, u8 gpu, u8 vrr) {
return (u32)cpu | ((u32)gpu << 8) | ((u32)vrr << 16);
}
inline u8 GovernorStateCpu(u32 p) {
return (u8)(p & 0xFF);
}
inline u8 GovernorStateGpu(u32 p) {
return (u8)((p >> 8) & 0xFF);
}
inline u8 GovernorStateVrr(u32 p) {
return (u8)((p >> 16) & 0xFF);
}
static inline const char* hocclkFormatModule(HocClkModule module, bool pretty)
{
switch(module)
{
case SysClkModule_CPU:
case HocClkModule_CPU:
return pretty ? "CPU" : "cpu";
case SysClkModule_GPU:
case HocClkModule_GPU:
return pretty ? "GPU" : "gpu";
case SysClkModule_MEM:
case HocClkModule_MEM:
return pretty ? "Memory" : "mem";
case HorizonOCModule_Display:
case HocClkModule_Display:
return pretty ? "Display" : "display";
case HorizonOCModule_Governor:
return pretty ? "Governor" : "gov";
case HocClkModule_Governor:
return pretty ? "Governor" : "governor";
default:
return "null";
}
}
static inline const char* sysclkFormatThermalSensor(SysClkThermalSensor thermSensor, bool pretty)
static inline const char* hocclkFormatThermalSensor(HocClkThermalSensor thermSensor, bool pretty)
{
switch(thermSensor)
{
case SysClkThermalSensor_SOC:
switch(thermSensor) {
case HocClkThermalSensor_SOC:
return pretty ? "SOC" : "soc";
case SysClkThermalSensor_PCB:
case HocClkThermalSensor_PCB:
return pretty ? "PCB" : "pcb";
case SysClkThermalSensor_Skin:
case HocClkThermalSensor_Skin:
return pretty ? "Skin" : "skin";
case HorizonOCThermalSensor_Battery:
case HocClkThermalSensor_Battery:
return pretty ? "BAT" : "battery";
case HorizonOCThermalSensor_PMIC:
case HocClkThermalSensor_PMIC:
return pretty ? "PMIC" : "pmic";
case HocClkThermalSensor_CPU:
return pretty ? "CPU" : "cpu";
case HocClkThermalSensor_GPU:
return pretty ? "GPU" : "gpu";
case HocClkThermalSensor_MEM:
return pretty ? "MEM" : "mem";
case HocClkThermalSensor_PLLX:
return pretty ? "PLLX" : "pllx";
default:
return NULL;
}
}
static inline const char* sysclkFormatPowerSensor(SysClkPowerSensor powSensor, bool pretty)
static inline const char* hocclkFormatPowerSensor(HocClkPowerSensor powSensor, bool pretty)
{
switch(powSensor)
{
case SysClkPowerSensor_Now:
case HocClkPowerSensor_Now:
return pretty ? "Now" : "now";
case SysClkPowerSensor_Avg:
case HocClkPowerSensor_Avg:
return pretty ? "Avg" : "avg";
default:
return NULL;
}
}
static inline const char* sysclkFormatProfile(SysClkProfile profile, bool pretty)
static inline const char* hocclkFormatProfile(HocClkProfile profile, bool pretty)
{
switch(profile)
{
case SysClkProfile_Docked:
case HocClkProfile_Docked:
return pretty ? "Docked" : "docked";
case SysClkProfile_Handheld:
case HocClkProfile_Handheld:
return pretty ? "Handheld" : "handheld";
case SysClkProfile_HandheldCharging:
case HocClkProfile_HandheldCharging:
return pretty ? "Charging" : "handheld_charging";
case SysClkProfile_HandheldChargingUSB:
case HocClkProfile_HandheldChargingUSB:
return pretty ? "USB Charger" : "handheld_charging_usb";
case SysClkProfile_HandheldChargingOfficial:
case HocClkProfile_HandheldChargingOfficial:
return pretty ? "PD Charger" : "handheld_charging_official";
default:
return NULL;
@@ -246,7 +267,7 @@ static inline const char* hocClkFormatVoltage(HocClkVoltage voltage, bool pretty
return pretty ? "GPU" : "gpu";
case HocClkVoltage_EMCVDD2:
return pretty ? "VDD2" : "emcvdd2";
case HocClkVoltage_EMCVDDQ_MarikoOnly:
case HocClkVoltage_EMCVDDQ:
return pretty ? "VDDQ" : "vddq";
case HocClkVoltage_SOC:
return pretty ? "SOC" : "soc";
@@ -255,4 +276,4 @@ static inline const char* hocClkFormatVoltage(HocClkVoltage voltage, bool pretty
default:
return NULL;
}
}
}

View File

@@ -32,26 +32,26 @@
#include "../board.h"
#include "../ipc.h"
bool sysclkIpcRunning();
Result sysclkIpcInitialize(void);
void sysclkIpcExit(void);
bool hocclkIpcRunning();
Result hocclkIpcInitialize(void);
void hocclkIpcExit(void);
Result sysclkIpcGetAPIVersion(u32* out_ver);
Result sysclkIpcGetVersionString(char* out, size_t len);
Result sysclkIpcGetCurrentContext(SysClkContext* out_context);
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count);
Result sysclkIpcSetEnabled(bool enabled);
Result sysclkIpcExitCmd();
Result sysclkIpcSetOverride(SysClkModule module, u32 hz);
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles);
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles);
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues);
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues);
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount);
Result hocclkIpcGetAPIVersion(u32* out_ver);
Result hocclkIpcGetVersionString(char* out, size_t len);
Result hocclkIpcGetCurrentContext(HocClkContext* out_context);
Result hocclkIpcGetProfileCount(u64 tid, u8* out_count);
Result hocclkIpcSetEnabled(bool enabled);
Result hocclkIpcExitCmd();
Result hocclkIpcSetOverride(HocClkModule module, u32 hz);
Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles);
Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles);
Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues);
Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues);
Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount);
Result hocClkIpcSetKipData();
Result hocClkIpcGetKipData();
static inline Result sysclkIpcRemoveOverride(SysClkModule module)
static inline Result hocclkIpcRemoveOverride(HocClkModule module)
{
return sysclkIpcSetOverride(module, 0);
return hocclkIpcSetOverride(module, 0);
}

View File

@@ -33,33 +33,41 @@
typedef struct
{
uint64_t applicationId;
SysClkProfile profile;
uint32_t freqs[SysClkModule_EnumMax];
uint32_t realFreqs[SysClkModule_EnumMax];
uint32_t overrideFreqs[SysClkModule_EnumMax];
uint32_t temps[SysClkThermalSensor_EnumMax];
int32_t power[SysClkPowerSensor_EnumMax];
uint32_t partLoad[SysClkPartLoad_EnumMax];
HocClkProfile profile;
uint32_t freqs[HocClkModule_EnumMax];
uint32_t realFreqs[HocClkModule_EnumMax];
uint32_t overrideFreqs[HocClkModule_EnumMax];
uint32_t temps[HocClkThermalSensor_EnumMax];
int32_t power[HocClkPowerSensor_EnumMax];
uint32_t partLoad[HocClkPartLoad_EnumMax];
uint32_t voltages[HocClkVoltage_EnumMax];
u16 speedos[HorizonOCSpeedo_EnumMax];
u16 iddq[HorizonOCSpeedo_EnumMax];
u16 speedos[HocClkSpeedo_EnumMax];
u16 iddq[HocClkSpeedo_EnumMax];
u16 waferX;
u16 waferY;
// Misc stuff
GpuSchedulingMode gpuSchedulingMode;
bool isSysDockInstalled;
bool isSaltyNXInstalled;
bool isUsingRetroSuper;
u8 maxDisplayFreq;
u8 dramID;
bool isDram8GB;
// FPS / Resolution
u8 fps;
} SysClkContext;
u16 resolutionHeight;
} HocClkContext;
typedef struct
{
union {
uint32_t mhz[+SysClkProfile_EnumMax * +SysClkModule_EnumMax];
uint32_t mhzMap[+SysClkProfile_EnumMax][+SysClkModule_EnumMax];
uint32_t mhz[+HocClkProfile_EnumMax * +HocClkModule_EnumMax];
uint32_t mhzMap[+HocClkProfile_EnumMax][+HocClkModule_EnumMax];
};
} SysClkTitleProfileList;
} HocClkTitleProfileList;
#define SYSCLK_FREQ_LIST_MAX 32
#define HOCCLK_FREQ_LIST_MAX 32
#define GLOBAL_PROFILE_ID 0xA111111111111111

View File

@@ -31,11 +31,11 @@
#include <stddef.h>
typedef enum {
SysClkConfigValue_PollingIntervalMs = 0,
SysClkConfigValue_TempLogIntervalMs,
SysClkConfigValue_FreqLogIntervalMs,
SysClkConfigValue_PowerLogIntervalMs,
SysClkConfigValue_CsvWriteIntervalMs,
HocClkConfigValue_PollingIntervalMs = 0,
HocClkConfigValue_TempLogIntervalMs,
HocClkConfigValue_FreqLogIntervalMs,
HocClkConfigValue_PowerLogIntervalMs,
HocClkConfigValue_CsvWriteIntervalMs,
HocClkConfigValue_UncappedClocks,
HocClkConfigValue_OverwriteBoostMode,
@@ -51,21 +51,22 @@ typedef enum {
HocClkConfigValue_LiteTDPLimit,
HorizonOCConfigValue_BatteryChargeCurrent,
HocClkConfigValue_BatteryChargeCurrent,
HorizonOCConfigValue_OverwriteRefreshRate,
HorizonOCConfigValue_EnableUnsafeDisplayFreqs,
HocClkConfigValue_OverwriteRefreshRate,
HocClkConfigValue_MaxDisplayClockH,
HorizonOCConfigValue_DVFSMode,
HorizonOCConfigValue_DVFSOffset,
HorizonOCConfigValue_LiveCpuUv,
HorizonOCConfigValue_EnableExperimentalSettings,
HocClkConfigValue_DVFSMode,
HocClkConfigValue_DVFSOffset,
HocClkConfigValue_LiveCpuUv,
HocClkConfigValue_EnableExperimentalSettings,
HorizonOCConfigValue_GPUScheduling,
HorizonOCConfigValue_GPUSchedulingMethod,
HocClkConfigValue_GPUScheduling,
HocClkConfigValue_GPUSchedulingMethod,
HorizonOCConfigValue_RAMVoltUsageDisplayMode,
HorizonOCConfigValue_CpuGovernorMinimumFreq,
HocClkConfigValue_RAMVoltDisplayMode,
HocClkConfigValue_CpuGovernorMinimumFreq,
HocClkConfigValue_DisplayVoltage,
KipConfigValue_custRev,
// KipConfigValue_mtcConf,
@@ -173,26 +174,26 @@ typedef enum {
KipCrc32,
HocClkConfigValue_IsFirstLoad,
SysClkConfigValue_EnumMax,
} SysClkConfigValue;
HocClkConfigValue_EnumMax,
} HocClkConfigValue;
typedef struct {
uint64_t values[SysClkConfigValue_EnumMax];
} SysClkConfigValueList;
uint64_t values[HocClkConfigValue_EnumMax];
} HocClkConfigValueList;
static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pretty)
static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pretty)
{
switch(val)
{
case SysClkConfigValue_PollingIntervalMs:
case HocClkConfigValue_PollingIntervalMs:
return pretty ? "Polling Interval (ms)" : "poll_interval_ms";
case SysClkConfigValue_TempLogIntervalMs:
case HocClkConfigValue_TempLogIntervalMs:
return pretty ? "Temperature logging interval (ms)" : "temp_log_interval_ms";
case SysClkConfigValue_FreqLogIntervalMs:
case HocClkConfigValue_FreqLogIntervalMs:
return pretty ? "Frequency logging interval (ms)" : "freq_log_interval_ms";
case SysClkConfigValue_PowerLogIntervalMs:
case HocClkConfigValue_PowerLogIntervalMs:
return pretty ? "Power logging interval (ms)" : "power_log_interval_ms";
case SysClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_CsvWriteIntervalMs:
return pretty ? "CSV write interval (ms)" : "csv_write_interval_ms";
case HocClkConfigValue_UncappedClocks:
@@ -221,37 +222,41 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
case HocClkConfigValue_LiteTDPLimit:
return pretty ? "Handheld TDP Limit" : "tdp_limit_l";
case HorizonOCConfigValue_BatteryChargeCurrent:
case HocClkConfigValue_BatteryChargeCurrent:
return pretty ? "Battery Charge Current" : "bat_charge_current";
case HorizonOCConfigValue_OverwriteRefreshRate:
case HocClkConfigValue_OverwriteRefreshRate:
return pretty ? "Display Refresh Rate Changing" : "drr_changing";
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
return pretty ? "Enable Unsafe Display Frequencies" : "drr_unsafe";
case HocClkConfigValue_MaxDisplayClockH:
return pretty ? "Max Display Clock (Handheld)" : "drr_max_clock";
case HorizonOCConfigValue_DVFSMode:
case HocClkConfigValue_DVFSMode:
return pretty ? "DVFS Mode" : "dvfs_mode";
case HorizonOCConfigValue_DVFSOffset:
case HocClkConfigValue_DVFSOffset:
return pretty ? "DVFS Offset" : "dvfs_offset";
case HorizonOCConfigValue_GPUScheduling:
case HocClkConfigValue_GPUScheduling:
return pretty ? "GPU Scheduling" : "gpu_scheduling";
case HorizonOCConfigValue_GPUSchedulingMethod:
case HocClkConfigValue_GPUSchedulingMethod:
return pretty ? "GPU Scheduling Method" : "gpu_sched_method";
case HorizonOCConfigValue_LiveCpuUv:
case HocClkConfigValue_LiveCpuUv:
return pretty ? "Live CPU Undervolt" : "live_cpu_uv";
case HorizonOCConfigValue_EnableExperimentalSettings:
case HocClkConfigValue_EnableExperimentalSettings:
return pretty ? "Enable Experimental Settings" : "enable_experimental_settings";
case HorizonOCConfigValue_RAMVoltUsageDisplayMode:
case HocClkConfigValue_RAMVoltDisplayMode:
return pretty ? "RAM Voltage / Usage Display Mode" : "ram_volt_usage_display_mode";
case HorizonOCConfigValue_CpuGovernorMinimumFreq:
case HocClkConfigValue_CpuGovernorMinimumFreq:
return pretty ? "CPU Governor Minimum Frequency" : "cpu_gov_min_freq";
case HocClkConfigValue_DisplayVoltage:
return pretty ? "Display Voltage" : "display_voltage";
// KIP config values
case KipConfigValue_custRev:
return pretty ? "Custom Revision" : "kip_cust_rev";
@@ -414,24 +419,23 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
}
}
static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
static inline uint64_t hocclkDefaultConfigValue(HocClkConfigValue val)
{
switch(val)
{
case SysClkConfigValue_PollingIntervalMs:
case HocClkConfigValue_PollingIntervalMs:
return 300ULL;
case SysClkConfigValue_TempLogIntervalMs:
case SysClkConfigValue_FreqLogIntervalMs:
case SysClkConfigValue_PowerLogIntervalMs:
case SysClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_TempLogIntervalMs:
case HocClkConfigValue_FreqLogIntervalMs:
case HocClkConfigValue_PowerLogIntervalMs:
case HocClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_UncappedClocks:
case HocClkConfigValue_OverwriteBoostMode:
case HorizonOCConfigValue_BatteryChargeCurrent:
case HorizonOCConfigValue_OverwriteRefreshRate:
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
case HorizonOCConfigValue_GPUScheduling:
case HorizonOCConfigValue_LiveCpuUv:
case HorizonOCConfigValue_GPUSchedulingMethod:
case HocClkConfigValue_BatteryChargeCurrent:
case HocClkConfigValue_OverwriteRefreshRate:
case HocClkConfigValue_GPUScheduling:
case HocClkConfigValue_LiveCpuUv:
case HocClkConfigValue_GPUSchedulingMethod:
return 0ULL;
case HocClkConfigValue_EristaMaxCpuClock:
return 1785ULL;
@@ -442,7 +446,7 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
case HocClkConfigValue_ThermalThrottle:
case HocClkConfigValue_HandheldTDP:
case HocClkConfigValue_IsFirstLoad:
case HorizonOCConfigValue_DVFSMode:
case HocClkConfigValue_DVFSMode:
return 1ULL;
case HocClkConfigValue_ThermalThrottleThreshold:
return 70ULL;
@@ -450,14 +454,18 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
return 9600ULL; // 8600mW will trigger on erista stock, so raise it a bit
case HocClkConfigValue_LiteTDPLimit:
return 6400ULL; // 0.5C
case HorizonOCConfigValue_CpuGovernorMinimumFreq:
return 612ULL; // 612MHz
case HocClkConfigValue_CpuGovernorMinimumFreq:
return 612000000ULL; // 612MHz
case HocClkConfigValue_MaxDisplayClockH:
return 60ULL;
case HocClkConfigValue_DisplayVoltage:
return 1200ULL; // Auto
default:
return 0ULL;
}
}
static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t input)
static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t input)
{
switch(val)
{
@@ -466,23 +474,23 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
case HocClkConfigValue_ThermalThrottleThreshold:
case HocClkConfigValue_HandheldTDPLimit:
case HocClkConfigValue_LiteTDPLimit:
case SysClkConfigValue_PollingIntervalMs:
case HocClkConfigValue_PollingIntervalMs:
case HocClkConfigValue_MaxDisplayClockH:
return input > 0;
case SysClkConfigValue_TempLogIntervalMs:
case SysClkConfigValue_FreqLogIntervalMs:
case SysClkConfigValue_PowerLogIntervalMs:
case SysClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_TempLogIntervalMs:
case HocClkConfigValue_FreqLogIntervalMs:
case HocClkConfigValue_PowerLogIntervalMs:
case HocClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_UncappedClocks:
case HocClkConfigValue_OverwriteBoostMode:
case HocClkConfigValue_ThermalThrottle:
case HocClkConfigValue_HandheldTDP:
case HorizonOCConfigValue_OverwriteRefreshRate:
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
case HocClkConfigValue_OverwriteRefreshRate:
case HocClkConfigValue_IsFirstLoad:
case HorizonOCConfigValue_EnableExperimentalSettings:
case HorizonOCConfigValue_LiveCpuUv:
case HorizonOCConfigValue_GPUSchedulingMethod:
case HocClkConfigValue_EnableExperimentalSettings:
case HocClkConfigValue_LiveCpuUv:
case HocClkConfigValue_GPUSchedulingMethod:
return (input & 0x1) == input;
case KipConfigValue_custRev:
@@ -579,14 +587,17 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
case KipConfigValue_t6_tRTW_fine_tune:
case KipConfigValue_t7_tWTR_fine_tune:
case KipCrc32:
case HorizonOCConfigValue_DVFSMode:
case HorizonOCConfigValue_DVFSOffset:
case HorizonOCConfigValue_GPUScheduling:
case HorizonOCConfigValue_RAMVoltUsageDisplayMode:
case HorizonOCConfigValue_CpuGovernorMinimumFreq:
case HocClkConfigValue_DVFSMode:
case HocClkConfigValue_DVFSOffset:
case HocClkConfigValue_GPUScheduling:
case HocClkConfigValue_RAMVoltDisplayMode:
case HocClkConfigValue_CpuGovernorMinimumFreq:
return true;
case HorizonOCConfigValue_BatteryChargeCurrent:
case HocClkConfigValue_BatteryChargeCurrent:
return ((input >= 1024) && (input <= 3072)) || !input;
case HocClkConfigValue_DisplayVoltage:
return ((input >= 900) && (input <= 1325));
default:
return false;
}

View File

@@ -27,13 +27,13 @@
#pragma once
#define SYSCLK_ERROR_MODULE 388
#define SYSCLK_ERROR(desc) ((SYSCLK_ERROR_MODULE & 0x1FF) | (SysClkError_##desc & 0x1FFF)<<9)
#define HOCCLK_ERROR_MODULE 388
#define HOCCLK_ERROR(desc) ((HOCCLK_ERROR_MODULE & 0x1FF) | (HocClkError_##desc & 0x1FFF)<<9)
typedef enum
{
SysClkError_Generic = 0,
SysClkError_ConfigNotLoaded = 1,
SysClkError_ConfigSaveFailed = 2,
HocClkError_Generic = 0,
HocClkError_ConfigNotLoaded = 1,
HocClkError_ConfigSaveFailed = 2,
// HocClkError_SocThermFail = 3,
} SysClkError;
} HocClkError;

View File

@@ -31,23 +31,23 @@
#include "board.h"
#include "clock_manager.h"
#define SYSCLK_IPC_API_VERSION 1
#define SYSCLK_IPC_SERVICE_NAME "hoc:clk"
#define HOCCLK_IPC_API_VERSION 1
#define HOCCLK_IPC_SERVICE_NAME "hoc:clk"
enum SysClkIpcCmd
enum HocClkIpcCmd
{
SysClkIpcCmd_GetApiVersion = 0,
SysClkIpcCmd_GetVersionString = 1,
SysClkIpcCmd_GetCurrentContext = 2,
SysClkIpcCmd_Exit = 3,
SysClkIpcCmd_GetProfileCount = 4,
SysClkIpcCmd_GetProfiles = 5,
SysClkIpcCmd_SetProfiles = 6,
SysClkIpcCmd_SetEnabled = 7,
SysClkIpcCmd_SetOverride = 8,
SysClkIpcCmd_GetConfigValues = 9,
SysClkIpcCmd_SetConfigValues = 10,
SysClkIpcCmd_GetFreqList = 11,
HocClkIpcCmd_GetApiVersion = 0,
HocClkIpcCmd_GetVersionString = 1,
HocClkIpcCmd_GetCurrentContext = 2,
HocClkIpcCmd_Exit = 3,
HocClkIpcCmd_GetProfileCount = 4,
HocClkIpcCmd_GetProfiles = 5,
HocClkIpcCmd_SetProfiles = 6,
HocClkIpcCmd_SetEnabled = 7,
HocClkIpcCmd_SetOverride = 8,
HocClkIpcCmd_GetConfigValues = 9,
HocClkIpcCmd_SetConfigValues = 10,
HocClkIpcCmd_GetFreqList = 11,
HocClkIpcCmd_SetKipData = 12,
HocClkIpcCmd_GetKipData = 13,
};
@@ -56,17 +56,17 @@ enum SysClkIpcCmd
typedef struct
{
uint64_t tid;
SysClkTitleProfileList profiles;
} SysClkIpc_SetProfiles_Args;
HocClkTitleProfileList profiles;
} HocClkIpc_SetProfiles_Args;
typedef struct
{
SysClkModule module;
HocClkModule module;
uint32_t hz;
} SysClkIpc_SetOverride_Args;
} HocClkIpc_SetOverride_Args;
typedef struct
{
SysClkModule module;
HocClkModule module;
uint32_t maxCount;
} SysClkIpc_GetFreqList_Args;
} HocClkIpc_GetFreqList_Args;

View File

@@ -22,6 +22,7 @@ const u8 MAX17050_CURRENT_REG = 0x0A;
// Buck Converter
typedef enum I2c_BuckConverter_Reg {
I2c_Max77620_SD1VOLT_REG = 0x17, // Used for Erista DDR VDDQ+VDD2 / Mariko VDD2
I2c_Max77620_LDO0VOLT_REG = 0x23, // Used for Erista DDR VDDQ+VDD2 / Mariko VDD2
I2c_Max77621_VOLT_REG = 0x00,
I2c_Max77812_CPUVOLT_REG = 0x26,
I2c_Max77812_GPUVOLT_REG = 0x23,
@@ -40,7 +41,8 @@ typedef struct I2c_BuckConverter_Domain {
const I2c_BuckConverter_Domain I2c_Erista_CPU = { I2cDevice_Max77621Cpu, I2c_Max77621_VOLT_REG, 0x7F, 6250, 606250, 1400000, };
const I2c_BuckConverter_Domain I2c_Erista_GPU = { I2cDevice_Max77621Gpu, I2c_Max77621_VOLT_REG, 0x7F, 6250, 606250, 1400000, };
const I2c_BuckConverter_Domain I2c_Erista_DRAM = { I2cDevice_Max77620Pmic, I2c_Max77620_SD1VOLT_REG, 0x7F, 12500, 600000, 1250000, };
const I2c_BuckConverter_Domain I2c_Erista_DRAM = { I2cDevice_Max77620Pmic, I2c_Max77620_SD1VOLT_REG, 0x3F, 12500, 600000, 1250000, };
const I2c_BuckConverter_Domain I2c_Display = { I2cDevice_Max77620Pmic, I2c_Max77620_LDO0VOLT_REG, 0x7F, 25000, 800000, 1325000, };
const I2c_BuckConverter_Domain I2c_Mariko_CPU = { I2cDevice_Max77812_2, I2c_Max77812_CPUVOLT_REG, 0xFF, 5000, 250000, 1525000, 0x78 };
const I2c_BuckConverter_Domain I2c_Mariko_GPU = { I2cDevice_Max77812_2, I2c_Max77812_GPUVOLT_REG, 0xFF, 5000, 250000, 1525000, 0x78 };
const I2c_BuckConverter_Domain I2c_Mariko_DRAM_VDDQ = { I2cDevice_Max77812_2, I2c_Max77812_MEMVOLT_REG, 0xFF, 5000, 250000, 700000, 0x78 };

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) Atmosphère-NX
* Copyright (c) ppkantorski (bord2death)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -12,14 +12,14 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define __ACCESS_TABLE_NAME__ SocthermAccessTable
#define __ACCESS_TABLE_ADDRESS__ MemoryRegionPhysicalDeviceSoctherm.GetAddress()
#define __ACCESS_TABLE_INC__ "secmon_soctherm_access_table_data.inc"
#pragma once
#include "secmon_define_access_table.inc"
#undef __ACCESS_TABLE_INC__
#undef __ACCESS_TABLE_ADDRESS__
#undef __ACCESS_TABLE_NAME__
#include <string>
#include <ctime>
#include <cstdio>
namespace notification {
void writeNotification(const std::string& message);
}

View File

@@ -25,9 +25,9 @@
*/
#include <sysclk/apm.h>
#include <hocclk/apm.h>
SysClkApmConfiguration sysclk_g_apm_configurations[] = {
HocClkApmConfiguration hocclk_g_apm_configurations[] = {
{0x00010000, 1020000000, 384000000, 1600000000},
{0x00010001, 1020000000, 768000000, 1600000000},
{0x00010002, 1224000000, 691200000, 1600000000},

View File

@@ -12,99 +12,16 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#pragma once
#include <switch.h>
#include <inttypes.h>
#include <string.h>
typedef enum {
BatteryFlag_NoHub = BIT(0), // Hub is disconnected
BatteryFlag_Rail = BIT(8), // At least one Joy-con is charging from rail
BatteryFlag_SPDSRC = BIT(12), // OTG
BatteryFlag_ACC = BIT(16) // Accessory
} BatteryChargeFlags;
#include <cstring>
#include "battery.h"
typedef enum {
PDState_NewPDO = 1, // Received new Power Data Object
PDState_NoPD = 2, // No Power Delivery source is detected
PDState_AcceptedRDO = 3 // Received and accepted Request Data Object
} BatteryPDControllerState;
// Charger type detection
typedef enum {
ChargerType_None = 0,
ChargerType_PD = 1,
ChargerType_TypeC_1500mA = 2,
ChargerType_TypeC_3000mA = 3,
ChargerType_DCP = 4, // Dedicated Charging Port
ChargerType_CDP = 5, // Charging Downstream Port
ChargerType_SDP = 6, // Standard Downstream Port
ChargerType_Apple_500mA = 7,
ChargerType_Apple_1000mA = 8,
ChargerType_Apple_2000mA = 9
} BatteryChargerType;
typedef enum {
PowerRole_Sink = 1, // Device is receiving power
PowerRole_Source = 2 // Device is providing power
} BatteryPowerRole;
typedef struct {
int32_t InputCurrentLimit; // Input (Sink) current limit in mA
int32_t VBUSCurrentLimit; // Output (Source/VBUS/OTG) current limit in mA
int32_t ChargeCurrentLimit; // Battery charging current limit in mA
int32_t ChargeVoltageLimit; // Battery charging voltage limit in mV
int32_t unk_x10; // Unknown field (possibly enum)
int32_t unk_x14; // Unknown field (possibly flags)
BatteryPDControllerState PDControllerState; // PD Controller State
int32_t BatteryTemperature; // Battery temperature in milli-Celsius
int32_t RawBatteryCharge; // Battery charge in percentmille
int32_t VoltageAvg; // Average voltage in mV
int32_t BatteryAge; // Battery health (capacity full/design) in pcm
BatteryPowerRole PowerRole; // Current power role
BatteryChargerType ChargerType; // Type of charger connected
int32_t ChargerVoltageLimit; // Charger voltage limit in mV
int32_t ChargerCurrentLimit; // Charger current limit in mA
BatteryChargeFlags Flags; // Various status flags
} BatteryChargeInfo;
#define IS_BATTERY_CHARGING_ENABLED(info) (((info)->unk_x14 >> 8) & 1)
Result batteryInfoInitialize(void);
void batteryInfoExit(void);
Result batteryInfoGetChargeInfo(BatteryChargeInfo *out);
Result batteryInfoGetChargePercentage(u32 *out);
Result batteryInfoIsEnoughPowerSupplied(bool *out);
Result batteryInfoEnableCharging(void);
Result batteryInfoDisableCharging(void);
Result batteryInfoEnableFastCharging(void);
Result batteryInfoDisableFastCharging(void);
const char* batteryInfoGetChargerTypeString(BatteryChargerType type);
const char* batteryInfoGetPowerRoleString(BatteryPowerRole role);
const char* batteryInfoGetPDStateString(BatteryPDControllerState state);
static inline int batteryInfoGetTemperatureMiliCelsius(BatteryChargeInfo *info) {
return info->BatteryTemperature;
}
static inline float batteryInfoGetChargePercent(BatteryChargeInfo *info) {
return (float)info->RawBatteryCharge / 1000.0f;
}
static inline float batteryInfoGetBatteryHealthPercent(BatteryChargeInfo *info) {
return (float)info->BatteryAge / 1000.0f;
}
static inline bool batteryInfoIsCharging(BatteryChargeInfo *info) {
return IS_BATTERY_CHARGING_ENABLED(info);
}
// Internal PSM service handle
static Service g_psmService = {0};
static bool g_batteryInfoInitialized = false;
static const char* s_chargerTypeStrings[] = {
"None",
@@ -132,56 +49,52 @@ static const char* s_pdStateStrings[] = {
"RDO Accepted"
};
// Internal PSM service handle
static Service g_psmService = {0};
static bool g_batteryInfoInitialized = false;
// Internal PSM command implementations
static Result psmGetBatteryChargeInfoFields(BatteryChargeInfo *out) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return serviceDispatchOut(&g_psmService, 17, *out);
}
static Result psmEnableBatteryCharging_internal(void) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return serviceDispatch(&g_psmService, 2);
}
static Result psmDisableBatteryCharging_internal(void) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return serviceDispatch(&g_psmService, 3);
}
static Result psmEnableFastBatteryCharging_internal(void) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return serviceDispatch(&g_psmService, 10);
}
static Result psmDisableFastBatteryCharging_internal(void) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return serviceDispatch(&g_psmService, 11);
}
Result batteryInfoInitialize(void) {
if (g_batteryInfoInitialized)
return 0;
Result rc = psmInitialize();
if (R_SUCCEEDED(rc)) {
memcpy(&g_psmService, psmGetServiceSession(), sizeof(Service));
g_batteryInfoInitialized = true;
}
return rc;
}
@@ -196,21 +109,21 @@ void batteryInfoExit(void) {
Result batteryInfoGetChargeInfo(BatteryChargeInfo *out) {
if (!out)
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
return psmGetBatteryChargeInfoFields(out);
}
Result batteryInfoGetChargePercentage(u32 *out) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return psmGetBatteryChargePercentage(out);
}
Result batteryInfoIsEnoughPowerSupplied(bool *out) {
if (!g_batteryInfoInitialized)
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return psmIsEnoughPowerSupplied(out);
}
@@ -233,20 +146,20 @@ Result batteryInfoDisableFastCharging(void) {
const char* batteryInfoGetChargerTypeString(BatteryChargerType type) {
if (type < 0 || type > ChargerType_Apple_2000mA)
return "Unknown";
return s_chargerTypeStrings[type];
}
const char* batteryInfoGetPowerRoleString(BatteryPowerRole role) {
if (role < PowerRole_Sink || role > PowerRole_Source)
return s_powerRoleStrings[0];
return s_powerRoleStrings[role];
}
const char* batteryInfoGetPDStateString(BatteryPDControllerState state) {
if (state < PDState_NewPDO || state > PDState_AcceptedRDO)
return s_pdStateStrings[0];
return s_pdStateStrings[state];
}

View File

@@ -0,0 +1,169 @@
/*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
#define NX_SERVICE_ASSUME_NON_DOMAIN
#include <switch.h>
#include <string.h>
#include <stdatomic.h>
#include <hocclk/client/ipc.h>
static Service g_hocclkSrv;
static atomic_size_t g_refCnt;
bool hocclkIpcRunning()
{
Handle handle;
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(HOCCLK_IPC_SERVICE_NAME), false, 1));
if (!running)
{
smUnregisterService(smEncodeName(HOCCLK_IPC_SERVICE_NAME));
}
return running;
}
Result hocclkIpcInitialize(void)
{
Result rc = 0;
g_refCnt++;
if (serviceIsActive(&g_hocclkSrv))
return 0;
rc = smGetService(&g_hocclkSrv, HOCCLK_IPC_SERVICE_NAME);
if (R_FAILED(rc)) hocclkIpcExit();
return rc;
}
void hocclkIpcExit(void)
{
if (--g_refCnt == 0)
{
serviceClose(&g_hocclkSrv);
}
}
Result hocclkIpcGetAPIVersion(u32* out_ver)
{
return serviceDispatchOut(&g_hocclkSrv, HocClkIpcCmd_GetApiVersion, *out_ver);
}
Result hocclkIpcGetVersionString(char* out, size_t len)
{
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetVersionString,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out, len}},
);
}
Result hocclkIpcGetCurrentContext(HocClkContext* out_context)
{
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetCurrentContext,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out_context, sizeof(HocClkContext)}},
);
}
Result hocclkIpcGetProfileCount(u64 tid, u8* out_count)
{
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetProfileCount, tid, *out_count);
}
Result hocclkIpcSetEnabled(bool enabled)
{
u8 enabledRaw = (u8)enabled;
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetEnabled, enabledRaw);
}
Result hocclkIpcSetOverride(HocClkModule module, u32 hz)
{
HocClkIpc_SetOverride_Args args = {
.module = module,
.hz = hz
};
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetOverride, args);
}
Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles)
{
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetProfiles, tid,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out_profiles, sizeof(HocClkTitleProfileList)}},
);
}
Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles)
{
HocClkIpc_SetProfiles_Args args;
args.tid = tid;
memcpy(&args.profiles, profiles, sizeof(HocClkTitleProfileList));
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetProfiles, args);
}
Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues)
{
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetConfigValues,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out_configValues, sizeof(HocClkConfigValueList)}},
);
}
Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues)
{
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_SetConfigValues,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_In },
.buffers = {{configValues, sizeof(HocClkConfigValueList)}},
);
}
Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount)
{
HocClkIpc_GetFreqList_Args args = {
.module = module,
.maxCount = maxCount
};
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetFreqList, args, *outCount,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{list, maxCount * sizeof(u32)}},
);
}
Result hocClkIpcSetKipData()
{
u32 temp = 0;
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetKipData, temp);
}
Result hocClkIpcGetKipData()
{
u32 temp = 0;
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetKipData, temp);
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <crc32.h>
namespace crc32 {
uint32_t crc32(const uint8_t *data, size_t length) {
uint32_t crc = 0xFFFFFFFF;
for (size_t i = 0; i < length; i++) {
crc ^= data[i];
for (int j = 0; j < 8; j++) {
crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
}
}
return ~crc;
}
uint32_t checksum_file(const char *filename) {
FILE *file = fopen(filename, "rb");
if (!file) {
perror("[crc32] Error opening file");
return 0;
}
uint8_t buffer[1024];
uint32_t crc = 0xFFFFFFFF;
size_t bytes_read;
while ((bytes_read = fread(buffer, 1, sizeof(buffer), file)) > 0) {
for (size_t i = 0; i < bytes_read; i++) {
crc ^= buffer[i];
for (int j = 0; j < 8; j++) {
crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
}
}
}
fclose(file);
return ~crc;
}
}

View File

@@ -15,13 +15,11 @@
*
*/
#pragma once
#include <string>
#include <ctime>
#include <cstdio>
#include "notification.h"
static void writeNotification(const std::string& message) {
namespace notification {
void writeNotification(const std::string& message) {
static const char* flagPath = "sdmc:/config/ultrahand/flags/NOTIFICATIONS.flag";
FILE* flagFile = fopen(flagPath, "r");
@@ -42,3 +40,4 @@ static void writeNotification(const std::string& message) {
fclose(file);
}
}
}

View File

@@ -15,7 +15,7 @@
*
*/
#include <sysclk/psm_ext.h>
#include <hocclk/psm_ext.h>
const char* PsmPowerRoleToStr(PsmPowerRole role) {
switch (role) {

View File

@@ -39,7 +39,7 @@ include ${TOPDIR}/lib/libultrahand/ultrahand.mk
# version control constants
#---------------------------------------------------------------------------------
#TARGET_VERSION := $(shell git describe --dirty --always --tags)
APP_VERSION := 1.0.1
APP_VERSION := 1.2.1
TARGET_VERSION := $(APP_VERSION)
#---------------------------------------------------------------------------------
@@ -55,6 +55,7 @@ CFLAGS := -O2 -Wall -flto -fdata-sections -ffunction-sections -fno-rtti -fno-com
CFLAGS += $(INCLUDE) -D__SWITCH__
# Enable appearance overriding
export MSYS2_ARG_CONV_EXCL := -DUI_OVERRIDE_PATH
UI_OVERRIDE_PATH := /config/horizon-oc/
CFLAGS += -DUI_OVERRIDE_PATH="\"$(UI_OVERRIDE_PATH)\""
@@ -63,7 +64,7 @@ CFLAGS += -DUI_OVERRIDE_PATH="\"$(UI_OVERRIDE_PATH)\""
#CFLAGS += -DNO_FSTREAM_DIRECTIVE=$(NO_FSTREAM_DIRECTIVE)
CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++20
CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++23
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

View File

@@ -0,0 +1,141 @@
{
"Information": "Informationen",
"IDDQ:": "IDDQ:",
"Module: ": "Modul:",
"sys-dock status:": "Sys-Dock-Status:",
"SaltyNX status:": "SaltyNX-Status:",
"RR Display status:": "RR Anzeigestatus:",
"Wafer Position:": "Waferposition:",
"Credits": "Credits",
"Developers": "Entwickler",
"Contributors": "Mitwirkende",
"Testers": "Tester",
"Special Thanks": "Besonderer Dank",
"Unknown": "Unbekannt",
"Installed": "Installiert",
"Not Installed": "Nicht installiert",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "DIE BIERWAREN-LIZENZ",
"Default": "Standard",
"Do Not Override": "Nicht überschreiben",
"Disabled": "Deaktiviert",
"Enabled": "Aktiviert",
" \\ue0e3 Reset": "\\ue0e3 Zurücksetzen",
"Display": "Anzeige",
"Application changed\\n\\n": "Anwendung geändert\\n\\n",
"The running application changed\\n\\n": "Die laufende Anwendung hat sich geändert\\n\\n",
"while editing was going on.": "während die Bearbeitung im Gange war.",
"Board": "Vorstand",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Es konnte keine Verbindung zum hoc-clk-Systemmodul hergestellt werden.\\n\\n",
"Please make sure everything is\\n\\n": "Bitte stellen Sie sicher, dass alles in Ordnung ist\\n\\n",
"correctly installed and enabled.": "korrekt installiert und aktiviert.",
"Fatal error": "Fataler Fehler",
"Temporary Overrides ": "Temporäre Überschreibungen",
"Sleep Mode": "Schlafmodus",
"Stock": "Lager",
"Dev OC": "Entwickler OC",
"Boost Mode": "Boost-Modus",
"Safe Max": "Sicher max",
"Unsafe Max": "Unsicher max",
"Absolute Max": "Absolutes Maximum",
"Handheld Safe Max": "Handsafe max",
"Enable": "Aktivieren",
"Edit App Profile": "App-Profil bearbeiten",
"Edit Global Profile": "Globales Profil bearbeiten",
"Temporary Overrides": "Temporäre Überschreibungen",
"Settings": "Einstellungen",
"About": "Über",
"Compiling with minimal features": "Kompilieren mit minimalen Funktionen",
"General Settings": "Allgemeine Einstellungen",
"Governor Settings": "Gouverneurseinstellungen",
"Safety Settings": "Sicherheitseinstellungen",
"Save KIP Settings": "Speichern Sie die KIP-Einstellungen",
"RAM Settings": "RAM-Einstellungen",
"CPU Settings": "CPU-Einstellungen",
"GPU Settings": "GPU-Einstellungen",
"Display Settings": "Anzeigeeinstellungen",
"Experimental": "Experimentell",
"GPU Scheduling Override Method": "GPU-Planungsüberschreibungsmethode",
"can be dangerous and may cause": "kann gefährlich sein und verursachen",
"damage to your battery or charger!": "Schäden an Ihrem Akku oder Ladegerät!",
"Charge Current Override": "Ladestrom-Überbrückung",
"RAM Voltage Display Mode": "RAM-Spannungsanzeigemodus",
"Polling Interval": "Abfrageintervall",
"CPU Governor Minimum Frequency": "Mindestfrequenz des CPU-Reglers",
"refresh rates may cause stress": "Bildwiederholraten können Stress verursachen",
"or damage to your display! ": "oder Schäden an Ihrem Display!",
"Proceed at your own risk!": "Das Vorgehen erfolgt auf eigene Gefahr!",
"Max Handheld Display": "Max Handheld-Display",
"Display Clock": "Uhr anzeigen",
"Official Rating": "Offizielle Bewertung",
"TDP Threshold": "TDP-Schwellenwert",
"Power": "Macht",
"Thermal Throttle Limit": "Thermische Drosselgrenze",
"HP Mode": "HP-Modus",
"Default (Mariko)": "Standard (Mariko)",
"Default (Erista)": "Standard (Erista)",
"Rating": "Bewertung",
"Safe Max (Mariko)": "Safe Max (Mariko)",
"Safe Max (Erista)": "Safe Max (Erista)",
"RAM VDD2 Voltage": "RAM VDD2 Spannung",
"Voltage": "Spannung",
"RAM VDDQ Voltage": "RAM-VDDQ-Spannung",
"RAM Frequency Editor": "RAM-Frequenzeditor",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Hoher Tacho erforderlich!",
"3333MHz (Needs extreme Speedo/PLL)": "3333 MHz (Benötigt extremen Tacho/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 MHz (Benötigt extremen Tacho/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 MHz (Benötigt extremen Tacho/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433 MHz (Benötigt lächerlichen Tacho/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 MHz (Benötigt lächerlichen Tacho/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 MHz (Benötigt lächerlichen Tacho/PLL)",
"Ram Max Clock": "Ram Max Uhr",
"RAM Latency Editor": "RAM-Latenz-Editor",
"RAM Timing Reductions": "Reduzierung des RAM-Timings",
"Memory Timings": "Speicherzeiten",
"Advanced": "Fortgeschritten",
"t6 tRTW Fine Tune": "t6 tRTW Feinabstimmung",
"tRTW Fine Tune": "tRTW-Feinabstimmung",
"t7 tWTR Fine Tune": "t7 tWTR Feinabstimmung",
"tWTR Fine Tune": "tWTR-Feinabstimmung",
"Memory Latencies": "Speicherlatenzen",
"Read Latency": "Leselatenz",
"Write Latency": "Schreiblatenz",
"CPU Boost Clock": "CPU-Boost-Takt",
"CPU UV": "CPU-UV",
"CPU Unlock": "CPU-Entsperrung",
"CPU VMIN": "CPU-VMIN",
"CPU Max Voltage": "Maximale CPU-Spannung",
"CPU Max Clock": "Maximaler CPU-Takt",
"Extreme UV Table": "Extremer UV-Tisch",
"CPU UV Table": "CPU-UV-Tisch",
"CPU Low UV": "CPU-niedrige UV-Strahlung",
"CPU High UV": "CPU Hohe UV-Strahlung",
"CPU Low VMIN": "CPU niedrig VMIN",
"CPU High VMIN": "CPU hoch VMIN",
"No Undervolt": "Kein Undervolt",
"SLT Table": "SLT-Tisch",
"HiOPT Table": "HiOPT-Tabelle",
"GPU Undervolt Table": "GPU-Unterspannungstabelle",
"GPU Minimum Voltage": "GPU-Mindestspannung",
"Calculate GPU Vmin": "Berechnen Sie die GPU-Vmin",
"GPU VMIN": "GPU-VMIN",
"GPU Maximum Voltage": "Maximale GPU-Spannung",
"GPU Voltage Offset": "GPU-Spannungsoffset",
"Do not override": "Nicht überschreiben",
"Enabled (Default)": "Aktiviert (Standard)",
"96.6% limit": "96,6 %-Grenze",
"99.7% limit": "99,7 %-Grenze",
"GPU Scheduling Override": "GPU-Planungsüberschreibung",
"Official Service": "Offizieller Dienst",
"GPU DVFS Mode": "GPU-DVFS-Modus",
"GPU DVFS Offset": "GPU-DVFS-Offset",
"GPU Voltage Table": "GPU-Spannungstabelle",
"GPU Custom Table (mV)": "Benutzerdefinierte GPU-Tabelle (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075 MHz ohne UV, 1152 MHz auf SLT",
"or 1228MHz on HiOPT can cause ": "oder 1228 MHz auf HiOPT kann dazu führen",
"permanent damage to your Switch!": "Dauerhafter Schaden an Ihrem Switch!",
"921MHz without UV and 960MHz on": "921 MHz ohne UV und 960 MHz eingeschaltet",
"SLT or HiOPT can cause ": "SLT oder HiOPT können dazu führen"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Information",
"IDDQ:": "IDDQ:",
"Module: ": "Module: ",
"sys-dock status:": "sys-dock status:",
"SaltyNX status:": "SaltyNX status:",
"RR Display status:": "RR Display status:",
"Wafer Position:": "Wafer Position:",
"Credits": "Credits",
"Developers": "Developers",
"Contributors": "Contributors",
"Testers": "Testers",
"Special Thanks": "Special Thanks",
"Unknown": "Unknown",
"Installed": "Installed",
"Not Installed": "Not Installed",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "THE BEER-WARE LICENSE",
"Default": "Default",
"Do Not Override": "Do Not Override",
"Disabled": "Disabled",
"Enabled": "Enabled",
" \\ue0e3 Reset": " \\ue0e3 Reset",
"Display": "Display",
"Application changed\\n\\n": "Application changed\\n\\n",
"The running application changed\\n\\n": "The running application changed\\n\\n",
"while editing was going on.": "while editing was going on.",
"Board": "Board",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Could not connect to hoc-clk sysmodule.\\n\\n",
"Please make sure everything is\\n\\n": "Please make sure everything is\\n\\n",
"correctly installed and enabled.": "correctly installed and enabled.",
"Fatal error": "Fatal error",
"Temporary Overrides ": "Temporary Overrides ",
"Sleep Mode": "Sleep Mode",
"Stock": "Stock",
"Dev OC": "Dev OC",
"Boost Mode": "Boost Mode",
"Safe Max": "Safe Max",
"Unsafe Max": "Unsafe Max",
"Absolute Max": "Absolute Max",
"Handheld Safe Max": "Handheld Safe Max",
"Enable": "Enable",
"Edit App Profile": "Edit App Profile",
"Edit Global Profile": "Edit Global Profile",
"Temporary Overrides": "Temporary Overrides",
"Settings": "Settings",
"About": "About",
"Compiling with minimal features": "Compiling with minimal features",
"General Settings": "General Settings",
"Governor Settings": "Governor Settings",
"Safety Settings": "Safety Settings",
"Save KIP Settings": "Save KIP Settings",
"RAM Settings": "RAM Settings",
"CPU Settings": "CPU Settings",
"GPU Settings": "GPU Settings",
"Display Settings": "Display Settings",
"Experimental": "Experimental",
"GPU Scheduling Override Method": "GPU Scheduling Override Method",
"can be dangerous and may cause": "can be dangerous and may cause",
"damage to your battery or charger!": "damage to your battery or charger!",
"Charge Current Override": "Charge Current Override",
"RAM Voltage Display Mode": "RAM Voltage Display Mode",
"Polling Interval": "Polling Interval",
"CPU Governor Minimum Frequency": "CPU Governor Minimum Frequency",
"refresh rates may cause stress": "refresh rates may cause stress",
"or damage to your display! ": "or damage to your display! ",
"Proceed at your own risk!": "Proceed at your own risk!",
"Max Handheld Display": "Max Handheld Display",
"Display Clock": "Display Clock",
"Official Rating": "Official Rating",
"TDP Threshold": "TDP Threshold",
"Power": "Power",
"Thermal Throttle Limit": "Thermal Throttle Limit",
"HP Mode": "HP Mode",
"Default (Mariko)": "Default (Mariko)",
"Default (Erista)": "Default (Erista)",
"Rating": "Rating",
"Safe Max (Mariko)": "Safe Max (Mariko)",
"Safe Max (Erista)": "Safe Max (Erista)",
"RAM VDD2 Voltage": "RAM VDD2 Voltage",
"Voltage": "Voltage",
"RAM VDDQ Voltage": "RAM VDDQ Voltage",
"RAM Frequency Editor": "RAM Frequency Editor",
"JEDEC.": "JEDEC.",
"High speedo needed!": "High speedo needed!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz (Needs extreme Speedo/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz (Needs extreme Speedo/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz (Needs extreme Speedo/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (Needs ridiculous Speedo/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz (Needs ridiculous Speedo/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz (Needs ridiculous Speedo/PLL)",
"Ram Max Clock": "Ram Max Clock",
"RAM Latency Editor": "RAM Latency Editor",
"RAM Timing Reductions": "RAM Timing Reductions",
"Memory Timings": "Memory Timings",
"Advanced": "Advanced",
"t6 tRTW Fine Tune": "t6 tRTW Fine Tune",
"tRTW Fine Tune": "tRTW Fine Tune",
"t7 tWTR Fine Tune": "t7 tWTR Fine Tune",
"tWTR Fine Tune": "tWTR Fine Tune",
"Memory Latencies": "Memory Latencies",
"Read Latency": "Read Latency",
"Write Latency": "Write Latency",
"CPU Boost Clock": "CPU Boost Clock",
"CPU UV": "CPU UV",
"CPU Unlock": "CPU Unlock",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "CPU Max Voltage",
"CPU Max Clock": "CPU Max Clock",
"Extreme UV Table": "Extreme UV Table",
"CPU UV Table": "CPU UV Table",
"CPU Low UV": "CPU Low UV",
"CPU High UV": "CPU High UV",
"CPU Low VMIN": "CPU Low VMIN",
"CPU High VMIN": "CPU High VMIN",
"No Undervolt": "No Undervolt",
"SLT Table": "SLT Table",
"HiOPT Table": "HiOPT Table",
"GPU Undervolt Table": "GPU Undervolt Table",
"GPU Minimum Voltage": "GPU Minimum Voltage",
"Calculate GPU Vmin": "Calculate GPU Vmin",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "GPU Maximum Voltage",
"GPU Voltage Offset": "GPU Voltage Offset",
"Do not override": "Do not override",
"Enabled (Default)": "Enabled (Default)",
"96.6% limit": "96.6% limit",
"99.7% limit": "99.7% limit",
"GPU Scheduling Override": "GPU Scheduling Override",
"Official Service": "Official Service",
"GPU DVFS Mode": "GPU DVFS Mode",
"GPU DVFS Offset": "GPU DVFS Offset",
"GPU Voltage Table": "GPU Voltage Table",
"GPU Custom Table (mV)": "GPU Custom Table (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075MHz without UV, 1152MHz on SLT",
"or 1228MHz on HiOPT can cause ": "or 1228MHz on HiOPT can cause ",
"permanent damage to your Switch!": "permanent damage to your Switch!",
"921MHz without UV and 960MHz on": "921MHz without UV and 960MHz on",
"SLT or HiOPT can cause ": "SLT or HiOPT can cause "
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Información",
"IDDQ:": "IDDQ:",
"Module: ": "Módulo:",
"sys-dock status:": "estado del sys-dock:",
"SaltyNX status:": "Estado de SaltyNX:",
"RR Display status:": "Estado de visualización RR:",
"Wafer Position:": "Posición de la oblea:",
"Credits": "Créditos",
"Developers": "Desarrolladores",
"Contributors": "Colaboradores",
"Testers": "Probadores",
"Special Thanks": "agradecimiento especial",
"Unknown": "Desconocido",
"Installed": "Instalado",
"Not Installed": "No instalado",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "LA LICENCIA DE CERVEZA",
"Default": "Predeterminado",
"Do Not Override": "No anular",
"Disabled": "Discapacitado",
"Enabled": "Habilitado",
" \\ue0e3 Reset": "\\ue0e3 Restablecer",
"Display": "Pantalla",
"Application changed\\n\\n": "Aplicación modificada\\n\\n",
"The running application changed\\n\\n": "La aplicación en ejecución cambió\\n\\n",
"while editing was going on.": "mientras se realizaba la edición.",
"Board": "tablero",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "No se pudo conectar al módulo del sistema hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Por favor asegúrese de que todo esté\\n\\n",
"correctly installed and enabled.": "correctamente instalado y habilitado.",
"Fatal error": "error fatal",
"Temporary Overrides ": "Anulaciones temporales",
"Sleep Mode": "Modo de suspensión",
"Stock": "Valores",
"Dev OC": "Desarrollador OC",
"Boost Mode": "Modo de impulso",
"Safe Max": "Máximo seguro",
"Unsafe Max": "Máximo inseguro",
"Absolute Max": "Máximo absoluto",
"Handheld Safe Max": "Caja fuerte de mano máx.",
"Enable": "Habilitar",
"Edit App Profile": "Editar perfil de aplicación",
"Edit Global Profile": "Editar perfil global",
"Temporary Overrides": "Anulaciones temporales",
"Settings": "Configuración",
"About": "Acerca de",
"Compiling with minimal features": "Compilando con características mínimas",
"General Settings": "Configuraciones generales",
"Governor Settings": "Configuración del gobernador",
"Safety Settings": "Configuraciones de seguridad",
"Save KIP Settings": "Guardar configuración de KIP",
"RAM Settings": "Configuración de RAM",
"CPU Settings": "Configuración de la CPU",
"GPU Settings": "Configuración de GPU",
"Display Settings": "Configuración de pantalla",
"Experimental": "Experimental",
"GPU Scheduling Override Method": "Método de anulación de programación de GPU",
"can be dangerous and may cause": "puede ser peligroso y puede causar",
"damage to your battery or charger!": "¡Daños a su batería o cargador!",
"Charge Current Override": "Anulación de corriente de carga",
"RAM Voltage Display Mode": "Modo de visualización de voltaje de RAM",
"Polling Interval": "Intervalo de sondeo",
"CPU Governor Minimum Frequency": "Frecuencia mínima del gobernador de CPU",
"refresh rates may cause stress": "Las frecuencias de actualización pueden causar estrés.",
"or damage to your display! ": "o daños a su pantalla!",
"Proceed at your own risk!": "¡Continúe bajo su propio riesgo!",
"Max Handheld Display": "Pantalla portátil máxima",
"Display Clock": "Reloj de pantalla",
"Official Rating": "Calificación oficial",
"TDP Threshold": "Umbral de TDP",
"Power": "poder",
"Thermal Throttle Limit": "Límite del acelerador térmico",
"HP Mode": "Modo HP",
"Default (Mariko)": "Predeterminado (Mariko)",
"Default (Erista)": "Predeterminado (Erista)",
"Rating": "Calificación",
"Safe Max (Mariko)": "Max seguro (Mariko)",
"Safe Max (Erista)": "Safe Max (Erista)",
"RAM VDD2 Voltage": "Voltaje RAM VDD2",
"Voltage": "voltaje",
"RAM VDDQ Voltage": "Voltaje RAM VDDQ",
"RAM Frequency Editor": "Editor de frecuencia RAM",
"JEDEC.": "JEDEC.",
"High speedo needed!": "¡Se necesita alta velocidad!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz (Necesita Speedo/PLL extremo)",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz (Necesita Speedo/PLL extremo)",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz (Necesita Speedo/PLL extremo)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (Necesita Speedo/PLL ridículo)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz (Necesita Speedo/PLL ridículo)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz (Necesita Speedo/PLL ridículo)",
"Ram Max Clock": "Ram Max Reloj",
"RAM Latency Editor": "Editor de latencia de RAM",
"RAM Timing Reductions": "Reducciones de tiempo de RAM",
"Memory Timings": "Tiempos de memoria",
"Advanced": "Avanzado",
"t6 tRTW Fine Tune": "t6 tRTW Ajuste fino",
"tRTW Fine Tune": "Ajuste fino tRTW",
"t7 tWTR Fine Tune": "t7 tWTR Ajuste fino",
"tWTR Fine Tune": "Ajuste fino de tWTR",
"Memory Latencies": "Latencias de la memoria",
"Read Latency": "Leer latencia",
"Write Latency": "Latencia de escritura",
"CPU Boost Clock": "Reloj de aumento de CPU",
"CPU UV": "procesador ultravioleta",
"CPU Unlock": "Desbloqueo de CPU",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "Voltaje máximo de la CPU",
"CPU Max Clock": "Reloj máximo de CPU",
"Extreme UV Table": "Mesa UV extrema",
"CPU UV Table": "Tabla UV de CPU",
"CPU Low UV": "CPU baja radiación ultravioleta",
"CPU High UV": "CPU alta UV",
"CPU Low VMIN": "VMIN bajo de CPU",
"CPU High VMIN": "VMIN alto de CPU",
"No Undervolt": "Sin subvoltaje",
"SLT Table": "Mesa TR",
"HiOPT Table": "Tabla HiOPT",
"GPU Undervolt Table": "Tabla de subvoltaje de GPU",
"GPU Minimum Voltage": "Voltaje mínimo de GPU",
"Calculate GPU Vmin": "Calcular GPU Vmin",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "Voltaje máximo de GPU",
"GPU Voltage Offset": "Compensación de voltaje de GPU",
"Do not override": "no anular",
"Enabled (Default)": "Habilitado (predeterminado)",
"96.6% limit": "límite del 96,6%",
"99.7% limit": "límite del 99,7%",
"GPU Scheduling Override": "Anulación de programación de GPU",
"Official Service": "Servicio Oficial",
"GPU DVFS Mode": "Modo GPU DVFS",
"GPU DVFS Offset": "Compensación DVFS de GPU",
"GPU Voltage Table": "Tabla de voltaje de GPU",
"GPU Custom Table (mV)": "Tabla personalizada de GPU (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075MHz sin UV, 1152MHz en SLT",
"or 1228MHz on HiOPT can cause ": "o 1228MHz en HiOPT pueden causar",
"permanent damage to your Switch!": "¡Daño permanente a tu Switch!",
"921MHz without UV and 960MHz on": "921MHz sin UV y 960MHz encendido",
"SLT or HiOPT can cause ": "SLT o HiOPT pueden causar"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Informations",
"IDDQ:": "IDDQ :",
"Module: ": "Module :",
"sys-dock status:": "état du dock système :",
"SaltyNX status:": "Statut SaltyNX :",
"RR Display status:": "Etat d'affichage RR :",
"Wafer Position:": "Position de la plaquette :",
"Credits": "Crédits",
"Developers": "Développeurs",
"Contributors": "Contributeurs",
"Testers": "Testeurs",
"Special Thanks": "Remerciements spéciaux",
"Unknown": "Inconnu",
"Installed": "Installé",
"Not Installed": "Non installé",
"X: %u Y: %u": "X : %u Y : %u",
"THE BEER-WARE LICENSE": "LA LICENCE DE LA BIÈRE",
"Default": "Par défaut",
"Do Not Override": "Ne pas remplacer",
"Disabled": "Désactivé",
"Enabled": "Activé",
" \\ue0e3 Reset": "\\ue0e3 Réinitialiser",
"Display": "Affichage",
"Application changed\\n\\n": "Application modifiée\\n\\n",
"The running application changed\\n\\n": "L'application en cours d'exécution a changé\\n\\n",
"while editing was going on.": "pendant le montage.",
"Board": "Conseil",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Impossible de se connecter au module système hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Veuillez vous assurer que tout est\\n\\n",
"correctly installed and enabled.": "correctement installé et activé.",
"Fatal error": "Erreur fatale",
"Temporary Overrides ": "Remplacements temporaires",
"Sleep Mode": "Mode veille",
"Stock": "Actions",
"Dev OC": "Développeur OC",
"Boost Mode": "Mode Boost",
"Safe Max": "Coffre-fort maximum",
"Unsafe Max": "Dangereux Max",
"Absolute Max": "Max absolu",
"Handheld Safe Max": "Coffre-fort portatif Max",
"Enable": "Activer",
"Edit App Profile": "Modifier le profil de l'application",
"Edit Global Profile": "Modifier le profil global",
"Temporary Overrides": "Remplacements temporaires",
"Settings": "Paramètres",
"About": "À propos",
"Compiling with minimal features": "Compilation avec des fonctionnalités minimales",
"General Settings": "Paramètres généraux",
"Governor Settings": "Paramètres du gouverneur",
"Safety Settings": "Paramètres de sécurité",
"Save KIP Settings": "Enregistrer les paramètres KIP",
"RAM Settings": "Paramètres de la RAM",
"CPU Settings": "Paramètres du processeur",
"GPU Settings": "Paramètres du processeur graphique",
"Display Settings": "Paramètres d'affichage",
"Experimental": "Expérimental",
"GPU Scheduling Override Method": "Méthode de remplacement de la planification GPU",
"can be dangerous and may cause": "peut être dangereux et provoquer",
"damage to your battery or charger!": "dommages à votre batterie ou à votre chargeur !",
"Charge Current Override": "Remplacement du courant de charge",
"RAM Voltage Display Mode": "Mode d'affichage de la tension de la RAM",
"Polling Interval": "Intervalle d'interrogation",
"CPU Governor Minimum Frequency": "Fréquence minimale du gouverneur du processeur",
"refresh rates may cause stress": "les taux de rafraîchissement peuvent causer du stress",
"or damage to your display! ": "ou endommager votre écran !",
"Proceed at your own risk!": "Procédez à vos propres risques !",
"Max Handheld Display": "Affichage portable maximum",
"Display Clock": "Affichage de l'horloge",
"Official Rating": "Classement officiel",
"TDP Threshold": "Seuil TDP",
"Power": "Puissance",
"Thermal Throttle Limit": "Limite d'accélérateur thermique",
"HP Mode": "Mode HP",
"Default (Mariko)": "Par défaut (Mariko)",
"Default (Erista)": "Par défaut (Erista)",
"Rating": "Note",
"Safe Max (Mariko)": "Coffre-fort Max (Mariko)",
"Safe Max (Erista)": "Coffre-fort Max (Erista)",
"RAM VDD2 Voltage": "Tension de la RAM VDD2",
"Voltage": "Tension",
"RAM VDDQ Voltage": "Tension VDDQ de la RAM",
"RAM Frequency Editor": "Éditeur de fréquence RAM",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Besoin d'un speedo haut !",
"3333MHz (Needs extreme Speedo/PLL)": "3333 MHz (nécessite un Speedo/PLL extrême)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 MHz (nécessite un Speedo/PLL extrême)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 MHz (nécessite un Speedo/PLL extrême)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433 MHz (nécessite un Speedo/PLL ridicule)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 MHz (nécessite un Speedo/PLL ridicule)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 MHz (nécessite un Speedo/PLL ridicule)",
"Ram Max Clock": "Ram Max Horloge",
"RAM Latency Editor": "Éditeur de latence RAM",
"RAM Timing Reductions": "Réductions de synchronisation de la RAM",
"Memory Timings": "Horaires de mémoire",
"Advanced": "Avancé",
"t6 tRTW Fine Tune": "t6 tRTW réglage fin",
"tRTW Fine Tune": "tRTW Réglage fin",
"t7 tWTR Fine Tune": "t7 tWTR réglage fin",
"tWTR Fine Tune": "Réglage fin du tWTR",
"Memory Latencies": "Latences de mémoire",
"Read Latency": "Latence de lecture",
"Write Latency": "Latence d'écriture",
"CPU Boost Clock": "Horloge d'augmentation du processeur",
"CPU UV": "UV du processeur",
"CPU Unlock": "Déverrouillage du processeur",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "Tension maximale du processeur",
"CPU Max Clock": "Horloge maximale du processeur",
"Extreme UV Table": "Table UV Extrême",
"CPU UV Table": "Tableau UV du processeur",
"CPU Low UV": "CPU faible UV",
"CPU High UV": "CPU UV élevé",
"CPU Low VMIN": "CPU faible VMIN",
"CPU High VMIN": "Processeur VMIN élevé",
"No Undervolt": "Pas de sous-tension",
"SLT Table": "Tableau SLT",
"HiOPT Table": "Tableau HiOPT",
"GPU Undervolt Table": "Tableau de sous-tension GPU",
"GPU Minimum Voltage": "Tension minimale du GPU",
"Calculate GPU Vmin": "Calculer la Vmin du GPU",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "Tension maximale du GPU",
"GPU Voltage Offset": "Décalage de tension du GPU",
"Do not override": "Ne remplacez pas",
"Enabled (Default)": "Activé (par défaut)",
"96.6% limit": "Limite de 96,6 %",
"99.7% limit": "Limite de 99,7 %",
"GPU Scheduling Override": "Remplacement de la planification GPU",
"Official Service": "Service officiel",
"GPU DVFS Mode": "Mode GPU DVFS",
"GPU DVFS Offset": "Décalage GPU DVFS",
"GPU Voltage Table": "Tableau de tension du GPU",
"GPU Custom Table (mV)": "Tableau personnalisé GPU (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075 MHz sans UV, 1152 MHz sur SLT",
"or 1228MHz on HiOPT can cause ": "ou 1228 MHz sur HiOPT peut provoquer",
"permanent damage to your Switch!": "dommages permanents à votre Switch !",
"921MHz without UV and 960MHz on": "921 MHz sans UV et 960 MHz activé",
"SLT or HiOPT can cause ": "SLT ou HiOPT peuvent provoquer"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Informazioni",
"IDDQ:": "IDDQ:",
"Module: ": "Modulo:",
"sys-dock status:": "stato di sys-dock",
"SaltyNX status:": "Stato di SaltyNX:",
"RR Display status:": "Stato del RR:",
"Wafer Position:": "Posizione nel Wafer:",
"Credits": "Crediti",
"Developers": "Sviluppatori",
"Contributors": "Collaboratori",
"Testers": "Tester",
"Special Thanks": "Un Ringraziamento Speciale",
"Unknown": "Sconosciuto",
"Installed": "Installato",
"Not Installed": "Non installato",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "THE BEER-WARE LICENSE",
"Default": "Predefinito",
"Do Not Override": "Non Sovrascrivere",
"Disabled": "Disabilitato",
"Enabled": "Abilitato",
" \\ue0e3 Reset": "\\ue0e3 Ripristina",
"Display": "Schermo",
"Application changed\\n\\n": "Applicazione modificata\\n\\n",
"The running application changed\\n\\n": "L'applicazione in esecuzione è cambiata\\n\\n",
"while editing was going on.": "mentre era in corso la modifica.",
"Board": "Scheda",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Impossibile connettersi al sysmodule hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Assicurati che tutto sia\\n\\n",
"correctly installed and enabled.": "correttamente installato e abilitato.",
"Fatal error": "Errore fatale",
"Temporary Overrides ": "Sostituzioni Temporanee",
"Sleep Mode": "Modalità di Sospensione",
"Stock": "Originale",
"Dev OC": "OC dev",
"Boost Mode": "Modalità Boost",
"Safe Max": "Massimo Sicuro",
"Unsafe Max": "Massimo Non Sicuro",
"Absolute Max": "Massimo Assoluto",
"Handheld Safe Max": "Massimo Sicuro Modalità Portatile",
"Enable": "Abilita",
"Edit App Profile": "Modifica Profilo Dell'App",
"Edit Global Profile": "Modifica Profilo Globale",
"Temporary Overrides": "Sostituzioni Temporanee",
"Settings": "Impostazioni",
"About": "A Riguardo Di",
"Compiling with minimal features": "Compilazione con funzionalità minime",
"General Settings": "Impostazioni Generali",
"Governor Settings": "Impostazioni Del Governor",
"Safety Settings": "Impostazioni Di Sicurezza",
"Save KIP Settings": "Salva le impostazioni del KIP",
"RAM Settings": "Impostazioni della RAM",
"CPU Settings": "Impostazioni della CPU",
"GPU Settings": "Impostazioni della GPU",
"Display Settings": "Impostazioni dello Schermo",
"Experimental": "Sperimentale",
"GPU Scheduling Override Method": "Metodo di override dello scheduling GPU",
"can be dangerous and may cause": "può essere pericoloso e può causare",
"damage to your battery or charger!": "danni alla batteria o al caricabatterie!",
"Charge Current Override": "Override della Corrente di Carica",
"RAM Voltage Display Mode": "Modalità di Visualizzazione della Tensione RAM",
"Polling Interval": "Intervallo di polling",
"CPU Governor Minimum Frequency": "Frequenza minima del Governor della CPU",
"refresh rates may cause stress": "le frequenze di aggiornamento possono causare stress",
"or damage to your display! ": "o danni al display!",
"Proceed at your own risk!": "Procedi a tuo rischio e pericolo!",
"Max Handheld Display": "Display Massimo in Modalità Portatile",
"Display Clock": "Frequenza del Display",
"Official Rating": "Rating Ufficiale",
"TDP Threshold": "Soglia TDP",
"Power": "Potenza",
"Thermal Throttle Limit": "Limite Termico",
"HP Mode": "Modalità HP",
"Default (Mariko)": "Predefinito (Mariko)",
"Default (Erista)": "Predefinito (Erista)",
"Rating": "Valutazione",
"Safe Max (Mariko)": "Massimo Sicuro (Mariko)",
"Safe Max (Erista)": "Massimo Sicuro (Erista)",
"RAM VDD2 Voltage": "Tensione RAM VDD2",
"Voltage": "Voltaggio",
"RAM VDDQ Voltage": "Voltaggio VDDQ della RAM",
"RAM Frequency Editor": "Editor della frequenza RAM",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Alto Valore Speedo Necessario!",
"3333MHz (Needs extreme Speedo/PLL)": "3333 MHz (richiede Speedo/PLL altissimo)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 MHz (richiede Speedo/PLL altissimo)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 MHz (richiede Speedo/PLL altissimo)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433 MHz (richiede Speedo/PLL estremo)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 MHz (richiede Speedo/PLL estremo)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 MHz (richiede Speedo/PLL estremo)",
"Ram Max Clock": "Frequenza Massima Ram",
"RAM Latency Editor": "Editor della Latenza RAM",
"RAM Timing Reductions": "Riduzioni dei Timing della RAM",
"Memory Timings": "Timing di Memoria",
"Advanced": "Avanzato",
"t6 tRTW Fine Tune": "Regolazione Fine t6 tRTW",
"tRTW Fine Tune": "Regolazione Fine tRTW",
"t7 tWTR Fine Tune": "Regolazione Fine t7 tWTR",
"tWTR Fine Tune": "Regolazione Fine tWTR",
"Memory Latencies": "Latenza della Memoria",
"Read Latency": "Latenza di Lettura",
"Write Latency": "Latenza di Scrittura",
"CPU Boost Clock": "Frequenza CPU in Boost",
"CPU UV": "Undervolt CPU",
"CPU Unlock": "Sblocco della CPU",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "Voltaggio massimo della CPU",
"CPU Max Clock": "Frequenza massima della CPU",
"Extreme UV Table": "Tabella UV estremo",
"CPU UV Table": "Tabella UV della CPU",
"CPU Low UV": "CPU UV Bassa Frequenza",
"CPU High UV": "CPU UV Alta Frequenza",
"CPU Low VMIN": "CPU VMIN Bassa Frequenza",
"CPU High VMIN": "CPU VMIN Alta Frequenza",
"No Undervolt": "Nessun Undervolt",
"SLT Table": "Tabella SLT",
"HiOPT Table": "Tabella HiOPT",
"GPU Undervolt Table": "Tabella di Undervolt GPU",
"GPU Minimum Voltage": "Voltaggio Minimo della GPU",
"Calculate GPU Vmin": "Calcola GPU Vmin",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "Voltaggio massimo della GPU",
"GPU Voltage Offset": "Offset di Voltaggio della GPU",
"Do not override": "Non sovrascrivere",
"Enabled (Default)": "Abilitato (impostazione predefinita)",
"96.6% limit": "Limite del 96,6%.",
"99.7% limit": "Limite del 99,7%.",
"GPU Scheduling Override": "Override dello Scheduling GPU",
"Official Service": "Servizio ufficiale",
"GPU DVFS Mode": "Modalità DVFS GPU",
"GPU DVFS Offset": "Offset DVFS della GPU",
"GPU Voltage Table": "Tabella delle Tensioni della GPU",
"GPU Custom Table (mV)": "Tabella GPU Personalizzata (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075 MHz senza UV, 1152 MHz su SLT",
"or 1228MHz on HiOPT can cause ": "o 1228 MHz su HiOPT possono causare",
"permanent damage to your Switch!": "danni permanenti alla tua Switch!",
"921MHz without UV and 960MHz on": "921 MHz senza UV e 960 MHz su",
"SLT or HiOPT can cause ": "SLT o HiOPT possono causare"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "情報",
"IDDQ:": "IDQ:",
"Module: ": "モジュール:",
"sys-dock status:": "システムドックのステータス:",
"SaltyNX status:": "SaltyNX ステータス:",
"RR Display status:": "RR 表示ステータス:",
"Wafer Position:": "ウェーハの位置:",
"Credits": "クレジット",
"Developers": "開発者",
"Contributors": "貢献者",
"Testers": "テスター",
"Special Thanks": "特別な感謝の気持ち",
"Unknown": "不明",
"Installed": "インストール済み",
"Not Installed": "インストールされていません",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "ビール製品ライセンス",
"Default": "デフォルト",
"Do Not Override": "上書きしないでください",
"Disabled": "障害者",
"Enabled": "有効",
" \\ue0e3 Reset": "\\ue0e3 リセット",
"Display": "ディスプレイ",
"Application changed\\n\\n": "アプリケーションが変更されました\\n\\n",
"The running application changed\\n\\n": "実行中のアプリケーションが変更されました\\n\\n",
"while editing was going on.": "編集を進めている最中でした。",
"Board": "理事会",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "hoc-clk sysmodule に接続できませんでした。\\n\\n",
"Please make sure everything is\\n\\n": "すべてが正しいことを確認してください\\n\\n",
"correctly installed and enabled.": "正しくインストールされ、有効になっています。",
"Fatal error": "致命的なエラー",
"Temporary Overrides ": "一時的なオーバーライド",
"Sleep Mode": "スリープモード",
"Stock": "在庫",
"Dev OC": "開発OC",
"Boost Mode": "ブーストモード",
"Safe Max": "セーフマックス",
"Unsafe Max": "危険なマックス",
"Absolute Max": "絶対最大値",
"Handheld Safe Max": "手持ち金庫マックス",
"Enable": "有効にする",
"Edit App Profile": "アプリプロファイルの編集",
"Edit Global Profile": "グローバルプロファイルの編集",
"Temporary Overrides": "一時的なオーバーライド",
"Settings": "設定",
"About": "について",
"Compiling with minimal features": "最小限の機能でコンパイルする",
"General Settings": "一般設定",
"Governor Settings": "ガバナーの設定",
"Safety Settings": "安全設定",
"Save KIP Settings": "KIP 設定の保存",
"RAM Settings": "RAM設定",
"CPU Settings": "CPUの設定",
"GPU Settings": "GPU設定",
"Display Settings": "表示設定",
"Experimental": "実験的",
"GPU Scheduling Override Method": "GPU スケジューリング オーバーライド メソッド",
"can be dangerous and may cause": "危険であり、原因となる可能性があります",
"damage to your battery or charger!": "バッテリーまたは充電器が損傷します。",
"Charge Current Override": "充電電流オーバーライド",
"RAM Voltage Display Mode": "RAM電圧表示モード",
"Polling Interval": "ポーリング間隔",
"CPU Governor Minimum Frequency": "CPU ガバナの最小周波数",
"refresh rates may cause stress": "リフレッシュレートがストレスを引き起こす可能性がある",
"or damage to your display! ": "ディスプレイに損傷を与えてしまいます。",
"Proceed at your own risk!": "自己責任で進めてください!",
"Max Handheld Display": "最大ハンドヘルドディスプレイ",
"Display Clock": "時計の表示",
"Official Rating": "公式評価",
"TDP Threshold": "TDP しきい値",
"Power": "パワー",
"Thermal Throttle Limit": "サーマルスロットル制限",
"HP Mode": "HPモード",
"Default (Mariko)": "デフォルト(マリコ)",
"Default (Erista)": "デフォルト(エリスタ)",
"Rating": "評価",
"Safe Max (Mariko)": "セーフマックス(マリコ)",
"Safe Max (Erista)": "セーフマックス(エリスタ)",
"RAM VDD2 Voltage": "RAM VDD2 電圧",
"Voltage": "電圧",
"RAM VDDQ Voltage": "RAM VDDQ 電圧",
"RAM Frequency Editor": "RAM周波数エディター",
"JEDEC.": "JEDEC。",
"High speedo needed!": "ハイスピードが必要です!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz (エクストリーム Speedo/PLL が必要)",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz (エクストリーム Speedo/PLL が必要)",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz (エクストリーム Speedo/PLL が必要)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (とんでもない Speedo/PLL が必要)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz (とんでもない Speedo/PLL が必要)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz (とんでもない Speedo/PLL が必要)",
"Ram Max Clock": "ラムマックスクロック",
"RAM Latency Editor": "RAM レイテンシ エディター",
"RAM Timing Reductions": "RAM タイミングの削減",
"Memory Timings": "メモリタイミング",
"Advanced": "上級者向け",
"t6 tRTW Fine Tune": "t6 tRTW 微調整",
"tRTW Fine Tune": "tRTW 微調整",
"t7 tWTR Fine Tune": "t7 tWTR ファインチューン",
"tWTR Fine Tune": "tWTR ファインチューン",
"Memory Latencies": "メモリレイテンシ",
"Read Latency": "読み取りレイテンシー",
"Write Latency": "書き込みレイテンシ",
"CPU Boost Clock": "CPUブーストクロック",
"CPU UV": "CPU UV",
"CPU Unlock": "CPUロック解除",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "CPU最大電圧",
"CPU Max Clock": "CPU最大クロック",
"Extreme UV Table": "エクストリーム UV テーブル",
"CPU UV Table": "CPU UV テーブル",
"CPU Low UV": "CPU 低 UV",
"CPU High UV": "CPU 高紫外線",
"CPU Low VMIN": "CPU 低 VMIN",
"CPU High VMIN": "CPU の高い VMIN",
"No Undervolt": "不足電圧なし",
"SLT Table": "SLTテーブル",
"HiOPT Table": "HiOPT テーブル",
"GPU Undervolt Table": "GPUアンダーボルトテーブル",
"GPU Minimum Voltage": "GPUの最小電圧",
"Calculate GPU Vmin": "GPU Vmin を計算する",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "GPU最大電圧",
"GPU Voltage Offset": "GPU電圧オフセット",
"Do not override": "上書きしないでください",
"Enabled (Default)": "有効 (デフォルト)",
"96.6% limit": "96.6%制限",
"99.7% limit": "99.7%制限",
"GPU Scheduling Override": "GPU スケジュールのオーバーライド",
"Official Service": "正式サービス",
"GPU DVFS Mode": "GPU DVFS モード",
"GPU DVFS Offset": "GPU DVFS オフセット",
"GPU Voltage Table": "GPU電圧テーブル",
"GPU Custom Table (mV)": "GPUカスタムテーブル(mV)",
"1075MHz without UV, 1152MHz on SLT": "UVなしで1075MHz、SLTで1152MHz",
"or 1228MHz on HiOPT can cause ": "HiOPT で 1228MHz を使用すると、次のような問題が発生する可能性があります。",
"permanent damage to your Switch!": "Switch に永久的なダメージを与えます!",
"921MHz without UV and 960MHz on": "921MHzUVなし、960MHzUVあり",
"SLT or HiOPT can cause ": "SLT または HiOPT が原因となる可能性があります"
}

View File

@@ -0,0 +1,146 @@
{
"Information": "Information",
"IDDQ:": "IDDQ:",
"Module: ": "Module:",
"sys-dock status:": "sys-dock status:",
"SaltyNX status:": "SaltyNX status:",
"RR Display status:": "RR Display status:",
"Wafer Position:": "Wafer Position:",
"Credits": "Credits",
"Developers": "Developers",
"Contributors": "Contributors",
"Testers": "Testers",
"Special Thanks": "Special Thanks",
"Unknown": "Unknown",
"Installed": "Installed",
"Not Installed": "Not Installed",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "THE BEER-WARE LICENSE",
"Default": "Default",
"Do Not Override": "Do Not Override",
"Disabled": "Disabled",
"Enabled": "Enabled",
" \\ue0e3 Reset": "\\ue0e3 Reset",
"Display": "Display",
"Application changed\\n\\n": "Application changed\\n\\n",
"The running application changed\\n\\n": "The running application changed\\n\\n",
"while editing was going on.": "while editing was going on.",
"App ID": "App ID",
"Profile": "Profile",
"Board": "Board",
"USB Charger": "USB Charger",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Could not connect to hoc-clk sysmodule.\\n\\n",
"Please make sure everything is\\n\\n": "Please make sure everything is\\n\\n",
"correctly installed and enabled.": "correctly installed and enabled.",
"Fatal error": "Fatal error",
"Temporary Overrides ": "Temporary Overrides",
"Sleep Mode": "Sleep Mode",
"Stock": "Stock",
"Dev OC": "Dev OC",
"Boost Mode": "Boost Mode",
"Safe Max": "Safe Max",
"Unsafe Max": "Unsafe Max",
"Absolute Max": "Absolute Max",
"Handheld": "Handheld",
"Handheld Safe Max": "Handheld Safe Max",
"Docked": "Docked",
"Enable": "Enable",
"Edit App Profile": "Edit App Profile",
"Edit Global Profile": "Edit Global Profile",
"Temporary Overrides": "Temporary Overrides",
"Settings": "Settings",
"About": "About",
"Compiling with minimal features": "Compiling with minimal features",
"General Settings": "General Settings",
"Governor Settings": "Governor Settings",
"Safety Settings": "Safety Settings",
"Save KIP Settings": "Save KIP Settings",
"RAM Settings": "RAM Settings",
"CPU Settings": "CPU Settings",
"GPU Settings": "GPU Settings",
"Display Settings": "Display Settings",
"Experimental": "Experimental",
"GPU Scheduling Override Method": "GPU Scheduling Override Method",
"can be dangerous and may cause": "can be dangerous and may cause",
"damage to your battery or charger!": "damage to your battery or charger!",
"Charge Current Override": "Charge Current Override",
"RAM Voltage Display Mode": "RAM Voltage Display Mode",
"Polling Interval": "Polling Interval",
"CPU Governor Minimum Frequency": "CPU Governor Minimum Frequency",
"refresh rates may cause stress": "refresh rates may cause stress",
"or damage to your display! ": "or damage to your display!",
"Proceed at your own risk!": "Proceed at your own risk!",
"Max Handheld Display": "Max Handheld Display",
"Display Clock": "Display Clock",
"Official Rating": "Official Rating",
"TDP Threshold": "TDP Threshold",
"Power": "Power",
"Thermal Throttle Limit": "Thermal Throttle Limit",
"HP Mode": "HP Mode",
"Default (Mariko)": "Default (Mariko)",
"Default (Erista)": "Default (Erista)",
"Rating": "Rating",
"Safe Max (Mariko)": "Safe Max (Mariko)",
"Safe Max (Erista)": "Safe Max (Erista)",
"RAM VDD2 Voltage": "RAM VDD2 Voltage",
"Voltage": "Voltage",
"RAM VDDQ Voltage": "RAM VDDQ Voltage",
"RAM Frequency Editor": "RAM Frequency Editor",
"JEDEC.": "JEDEC.",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz (Needs extreme Speedo/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz (Needs extreme Speedo/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz (Needs extreme Speedo/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (Needs ridiculous Speedo/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz (Needs ridiculous Speedo/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz (Needs ridiculous Speedo/PLL)",
"Ram Max Clock": "Ram Max Clock",
"RAM Latency Editor": "RAM Latency Editor",
"RAM Timing Reductions": "RAM Timing Reductions",
"Memory Timings": "Memory Timings",
"tREFI": "tREFI",
"Advanced": "Advanced",
"t6 tRTW Fine Tune": "t6 tRTW Fine Tune",
"tRTW Fine Tune": "tRTW Fine Tune",
"t7 tWTR Fine Tune": "t7 tWTR Fine Tune",
"tWTR Fine Tune": "tWTR Fine Tune",
"Memory Latencies": "Memory Latencies",
"Read Latency": "Read Latency",
"Write Latency": "Write Latency",
"CPU Boost Clock": "CPU Boost Clock",
"CPU UV": "CPU UV",
"CPU Unlock": "CPU Unlock",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "CPU Max Voltage",
"CPU Max Clock": "CPU Max Clock",
"Extreme UV Table": "Extreme UV Table",
"CPU UV Table": "CPU UV Table",
"CPU Low UV": "CPU Low UV",
"CPU High UV": "CPU High UV",
"CPU Low VMIN": "CPU Low VMIN",
"CPU High VMIN": "CPU High VMIN",
"No Undervolt": "No Undervolt",
"SLT Table": "SLT Table",
"HiOPT Table": "HiOPT Table",
"GPU Undervolt Table": "GPU Undervolt Table",
"GPU Minimum Voltage": "GPU Minimum Voltage",
"Calculate GPU Vmin": "Calculate GPU Vmin",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "GPU Maximum Voltage",
"GPU Voltage Offset": "GPU Voltage Offset",
"Do not override": "Do not override",
"Enabled (Default)": "Enabled (Default)",
"96.6% limit": "96.6% limit",
"99.7% limit": "99.7% limit",
"GPU Scheduling Override": "GPU Scheduling Override",
"Official Service": "Official Service",
"GPU DVFS Mode": "GPU DVFS Mode",
"GPU DVFS Offset": "GPU DVFS Offset",
"GPU Voltage Table": "GPU Voltage Table",
"GPU Custom Table (mV)": "GPU Custom Table (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075MHz without UV, 1152MHz on SLT",
"or 1228MHz on HiOPT can cause ": "or 1228MHz on HiOPT can cause",
"permanent damage to your Switch!": "permanent damage to your Switch!",
"921MHz without UV and 960MHz on": "921MHz without UV and 960MHz on",
"SLT or HiOPT can cause ": "SLT or HiOPT can cause"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "정보",
"IDDQ:": "IDDQ:",
"Module: ": "모듈:",
"sys-dock status:": "sys-dock 상태:",
"SaltyNX status:": "SaltyNX 상태:",
"RR Display status:": "RR 표시 상태:",
"Wafer Position:": "웨이퍼 위치:",
"Credits": "크레딧",
"Developers": "개발자",
"Contributors": "기여자",
"Testers": "테스터",
"Special Thanks": "특별한 분",
"Unknown": "알 수 없음",
"Installed": "설치됨",
"Not Installed": "설치되지 않음",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "맥주 제품 라이센스",
"Default": "기본값",
"Do Not Override": "재정의하지 마십시오",
"Disabled": "비활성화",
"Enabled": "활성화됨",
" \\ue0e3 Reset": "\\ue0e3 재설정",
"Display": "디스플레이",
"Application changed\\n\\n": "애플리케이션이 변경되었습니다.\\n\\n",
"The running application changed\\n\\n": "실행 중인 애플리케이션이 변경되었습니다.\\n\\n",
"while editing was going on.": "편집이 진행되는 동안.",
"Board": "보드",
"%u.%u%u mV": "%u.%u%umV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "hoc-clk 시스템 모듈에 연결할 수 없습니다.\\n\\n",
"Please make sure everything is\\n\\n": "모든 것이 올바른지 확인하십시오.\\n\\n",
"correctly installed and enabled.": "올바르게 설치되고 활성화되었습니다.",
"Fatal error": "치명적인 오류",
"Temporary Overrides ": "임시 재정의",
"Sleep Mode": "절전 모드",
"Stock": "주식",
"Dev OC": "개발 OC",
"Overwrite Boost Mode": "부스트 모드 덮어쓰기",
"Safe Max": "안전함 최대값",
"Unsafe Max": "불안정 최대값",
"Absolute Max": "절대 최대값",
"Handheld Safe Max": "휴대모드 안전함 최대값",
"Enable": "활성화",
"Edit App Profile": "앱 프로필 편집",
"Edit Global Profile": "글로벌 프로필 편집",
"Temporary Overrides": "임시 재정의",
"Settings": "설정",
"About": "소개",
"Compiling with minimal features": "최소한의 기능으로 컴파일하기",
"General Settings": "일반 설정",
"Governor Settings": "거버너 설정",
"Safety Settings": "안전 설정",
"Save KIP Settings": "KIP 설정 저장",
"RAM Settings": "RAM 설정",
"CPU Settings": "CPU 설정",
"GPU Settings": "GPU 설정",
"Display Settings": "디스플레이 설정",
"Experimental": "실험적",
"GPU Scheduling Override Method": "GPU 스케줄링 재정의 방법",
"can be dangerous and may cause": "위험할 수 있고 원인이 될 수 있습니다.",
"damage to your battery or charger!": "배터리나 충전기가 손상되었습니다!",
"Charge Current Override": "충전 전류 오버라이드",
"RAM Voltage Display Mode": "RAM 전압 표시 모드",
"Polling Interval": "폴링 간격",
"CPU Governor Minimum Frequency": "CPU 거버너 최소 주파수",
"refresh rates may cause stress": "디스플레이 주사율 빈도 변경은",
"or damage to your display! ": "기기에 손상이 발생될 수 있습니다!",
"Proceed at your own risk!": "책임하에 주의해서 사용하십시오!",
"Max Handheld Display": "최대 휴대용 디스플레이",
"Display Clock": "디스플레이 클럭",
"Official Rating": "공식 등급",
"TDP Threshold": "TDP 임계값",
"Power": "힘",
"Thermal Throttle Limit": "열 스로틀 한계",
"HP Mode": "HP 모드",
"Default (Mariko)": "기본값(마리코)",
"Default (Erista)": "기본값(에리스타)",
"Rating": "표준값",
"Safe Max (Mariko)": "안전함 최대치(마리코)",
"Safe Max (Erista)": "안전함 최대치(에리스타)",
"RAM VDD2 Voltage": "RAM VDD2 전압",
"Voltage": "전압",
"RAM VDDQ Voltage": "RAM VDDQ 전압",
"RAM Frequency Editor": "RAM 주파수 편집기",
"JEDEC.": "JEDEC.",
"High speedo needed!": "높은 스피도값이 필요합니다!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz(극단적인 Speedo/PLL 필요)",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz(극단적인 Speedo/PLL 필요)",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz(극단적인 Speedo/PLL 필요)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (말도 안 되는 Speedo/PLL 필요)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz(터무니없는 Speedo/PLL 필요)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz(터무니없는 Speedo/PLL 필요)",
"Ram Max Clock": "RAM 최대 클럭",
"RAM Latency Editor": "RAM 지연 시간 편집기",
"RAM Timing Reductions": "RAM 타이밍 편집기",
"Memory Timings": "메모리 타이밍",
"Advanced": "고급",
"t6 tRTW Fine Tune": "t6 tRTW 미세 조정",
"tRTW Fine Tune": "tRTW 미세 조정",
"t7 tWTR Fine Tune": "t7 tWTR 미세 조정",
"tWTR Fine Tune": "tWTR 미세 조정",
"Memory Latencies": "메모리 지연 시간",
"Read Latency": "읽기 지연 시간",
"Write Latency": "쓰기 지연 시간",
"CPU Boost Clock": "CPU 부스트 클럭",
"CPU UV": "CPU 언더볼트",
"CPU Unlock": "CPU 잠금 해제",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "CPU 최대 전압",
"CPU Max Clock": "CPU 최대 클럭",
"Extreme UV Table": "익스트림 테이블",
"CPU UV Table": "CPU 언더볼트 테이블",
"CPU Low UV": "CPU 저주파 언더볼트",
"CPU High UV": "CPU 고주파 언더볼트",
"CPU Low VMIN": "CPU 저주파 최소 전압",
"CPU High VMIN": "CPU 고주파 최소 전압",
"No Undervolt": "언더볼트 없음",
"SLT Table": "SLT 테이블",
"HiOPT Table": "HiOPT 테이블",
"GPU Undervolt Table": "GPU 언더볼트 테이블",
"GPU Minimum Voltage": "GPU 최소 전압",
"Calculate GPU Vmin": "GPU Vmin 계산",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "GPU 최대 전압",
"GPU Voltage Offset": "GPU 전압 오프셋",
"Do not override": "재정의하지 않음",
"Enabled (Default)": "활성화됨(기본값)",
"96.6% limit": "96.6% 한도",
"99.7% limit": "99.7% 한도",
"GPU Scheduling Override": "GPU 스케줄링 재정의",
"Official Service": "공식 서비스",
"GPU DVFS Mode": "GPU DVFS 모드",
"GPU DVFS Offset": "GPU DVFS 오프셋",
"GPU Voltage Table": "GPU 전압 테이블",
"GPU Custom Table (mV)": "GPU 사용자 정의 테이블(mV)",
"1075MHz without UV, 1152MHz on SLT": "UV 없이 1075MHz, SLT에서 1152MHz",
"or 1228MHz on HiOPT can cause ": "또는 HiOPT에서 1228MHz를 사용하면",
"permanent damage to your Switch!": "스위치가 영구적으로 손상될 수 있습니다!",
"921MHz without UV and 960MHz on": "UV가 없는 경우 921MHz, 켜진 경우에는 960MHz",
"SLT or HiOPT can cause ": "SLT 또는 HiOPT는 다음을 유발할 수 있습니다."
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Informatie",
"IDDQ:": "IDDQ:",
"Module: ": "module:",
"sys-dock status:": "sys-dock-status:",
"SaltyNX status:": "SaltyNX-status:",
"RR Display status:": "RR Weergavestatus:",
"Wafer Position:": "Waferpositie:",
"Credits": "Kredieten",
"Developers": "Ontwikkelaars",
"Contributors": "Bijdragers",
"Testers": "Testers",
"Special Thanks": "Speciale dank",
"Unknown": "Onbekend",
"Installed": "Geïnstalleerd",
"Not Installed": "Niet geïnstalleerd",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "DE LICENTIE VOOR BIERWAREN",
"Default": "Standaard",
"Do Not Override": "Niet overschrijven",
"Disabled": "Uitgeschakeld",
"Enabled": "Ingeschakeld",
" \\ue0e3 Reset": "\\ue0e3 Opnieuw instellen",
"Display": "Weergave",
"Application changed\\n\\n": "Applicatie gewijzigd\\n\\n",
"The running application changed\\n\\n": "De actieve applicatie is gewijzigd\\n\\n",
"while editing was going on.": "terwijl er werd bewerkt.",
"Board": "Bord",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Kan geen verbinding maken met hoc-clk sysmodule.\\n\\n",
"Please make sure everything is\\n\\n": "Zorg ervoor dat alles in orde is\\n\\n",
"correctly installed and enabled.": "correct geïnstalleerd en ingeschakeld.",
"Fatal error": "Fatale fout",
"Temporary Overrides ": "Tijdelijke overschrijvingen",
"Sleep Mode": "Slaapmodus",
"Stock": "Voorraad",
"Dev OC": "Ontwikkelaar OC",
"Boost Mode": "Boost-modus",
"Safe Max": "Veilig Max",
"Unsafe Max": "OnveiligMax",
"Absolute Max": "Absoluut Max",
"Handheld Safe Max": "Handkluis Max",
"Enable": "Inschakelen",
"Edit App Profile": "App-profiel bewerken",
"Edit Global Profile": "Globaal profiel bewerken",
"Temporary Overrides": "Tijdelijke overschrijvingen",
"Settings": "Instellingen",
"About": "Over",
"Compiling with minimal features": "Compileren met minimale functies",
"General Settings": "Algemene instellingen",
"Governor Settings": "Gouverneur instellingen",
"Safety Settings": "Veiligheidsinstellingen",
"Save KIP Settings": "Sla KIP-instellingen op",
"RAM Settings": "RAM-instellingen",
"CPU Settings": "CPU-instellingen",
"GPU Settings": "GPU-instellingen",
"Display Settings": "Weergave-instellingen",
"Experimental": "Experimenteel",
"GPU Scheduling Override Method": "Methode voor het overschrijven van GPU-planning",
"can be dangerous and may cause": "kan gevaarlijk zijn en kan veroorzaken",
"damage to your battery or charger!": "schade aan uw accu of lader!",
"Charge Current Override": "Laadstroom overschrijven",
"RAM Voltage Display Mode": "Weergavemodus RAM-spanning",
"Polling Interval": "Polling-interval",
"CPU Governor Minimum Frequency": "Minimale frequentie CPU-regelaar",
"refresh rates may cause stress": "vernieuwingsfrequenties kunnen stress veroorzaken",
"or damage to your display! ": "of schade aan uw display!",
"Proceed at your own risk!": "Ga verder op eigen risico!",
"Max Handheld Display": "Maximaal handheld-display",
"Display Clock": "Klok weergeven",
"Official Rating": "Officiële beoordeling",
"TDP Threshold": "TDP-drempel",
"Power": "Macht",
"Thermal Throttle Limit": "Thermische gaslimiet",
"HP Mode": "HP-modus",
"Default (Mariko)": "Standaard (Mariko)",
"Default (Erista)": "Standaard (Erista)",
"Rating": "Beoordeling",
"Safe Max (Mariko)": "Veilig Max (Mariko)",
"Safe Max (Erista)": "Veilige Max (Erista)",
"RAM VDD2 Voltage": "RAM VDD2-spanning",
"Voltage": "Spanning",
"RAM VDDQ Voltage": "RAM VDDQ-spanning",
"RAM Frequency Editor": "RAM-frequentie-editor",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Hoge snelheid nodig!",
"3333MHz (Needs extreme Speedo/PLL)": "3333 MHz (vereist extreme snelheidsmeter/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 MHz (vereist extreme snelheidsmeter/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 MHz (vereist extreme snelheidsmeter/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (heeft een belachelijke snelheidsmeter/PLL nodig)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz (heeft een belachelijke snelheidsmeter/PLL nodig)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 MHz (heeft een belachelijke snelheidsmeter/PLL nodig)",
"Ram Max Clock": "Ram Max-klok",
"RAM Latency Editor": "RAM-latentie-editor",
"RAM Timing Reductions": "RAM-timingreducties",
"Memory Timings": "Geheugentijden",
"Advanced": "Geavanceerd",
"t6 tRTW Fine Tune": "t6 tRTW Fijnafstemming",
"tRTW Fine Tune": "tRTW Fijnafstemming",
"t7 tWTR Fine Tune": "t7 tWTR Fijnafstemming",
"tWTR Fine Tune": "tWTR Fijnafstemming",
"Memory Latencies": "Geheugenlatenties",
"Read Latency": "Lees Latentie",
"Write Latency": "Schrijf latentie",
"CPU Boost Clock": "CPU-boostklok",
"CPU UV": "CPU-UV",
"CPU Unlock": "CPU-ontgrendeling",
"CPU VMIN": "CPU-VMIN",
"CPU Max Voltage": "Maximale CPU-spanning",
"CPU Max Clock": "CPU maximale klok",
"Extreme UV Table": "Extreme UV-tafel",
"CPU UV Table": "CPU UV-tabel",
"CPU Low UV": "CPU Lage UV",
"CPU High UV": "CPU Hoge UV",
"CPU Low VMIN": "CPU Lage VMIN",
"CPU High VMIN": "CPU Hoge VMIN",
"No Undervolt": "Geen ondervolt",
"SLT Table": "SLT-tabel",
"HiOPT Table": "HiOPT-tabel",
"GPU Undervolt Table": "GPU-undervolttabel",
"GPU Minimum Voltage": "GPU-minimale spanning",
"Calculate GPU Vmin": "Bereken GPU Vmin",
"GPU VMIN": "GPU-VMIN",
"GPU Maximum Voltage": "GPU maximale spanning",
"GPU Voltage Offset": "GPU-spanningsoffset",
"Do not override": "Niet overschrijven",
"Enabled (Default)": "Ingeschakeld (standaard)",
"96.6% limit": "96,6% limiet",
"99.7% limit": "99,7% limiet",
"GPU Scheduling Override": "GPU-planning negeren",
"Official Service": "Officiële dienst",
"GPU DVFS Mode": "GPU DVFS-modus",
"GPU DVFS Offset": "GPU DVFS-offset",
"GPU Voltage Table": "GPU-spanningstabel",
"GPU Custom Table (mV)": "Aangepaste GPU-tabel (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075MHz zonder UV, 1152MHz op SLT",
"or 1228MHz on HiOPT can cause ": "of 1228MHz op HiOPT kan dit veroorzaken",
"permanent damage to your Switch!": "blijvende schade aan uw Switch!",
"921MHz without UV and 960MHz on": "921MHz zonder UV en 960MHz aan",
"SLT or HiOPT can cause ": "SLT of HiOPT kunnen dit veroorzaken"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Informacje",
"IDDQ:": "IDDQ:",
"Module: ": "Moduł:",
"sys-dock status:": "stan sys-dock:",
"SaltyNX status:": "Stan SaltyNX:",
"RR Display status:": "Stan wyświetlacza:",
"Wafer Position:": "Pozycja wafla:",
"Credits": "Kredyty",
"Developers": "Deweloperzy",
"Contributors": "Współautorzy",
"Testers": "Testery",
"Special Thanks": "Specjalne podziękowania",
"Unknown": "Nieznany",
"Installed": "Zainstalowany",
"Not Installed": "Nie zainstalowano",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "LICENCJA NA WYROBY PIWNE",
"Default": "Domyślne",
"Do Not Override": "Nie zastępuj",
"Disabled": "Niepełnosprawny",
"Enabled": "Włączone",
" \\ue0e3 Reset": "\\ue0e3 Zresetuj",
"Display": "Wyświetlacz",
"Application changed\\n\\n": "Aplikacja została zmieniona\\n\\n",
"The running application changed\\n\\n": "Działająca aplikacja została zmieniona\\n\\n",
"while editing was going on.": "podczas gdy edycja była w toku.",
"Board": "Deska",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Nie można połączyć się z modułem sysmodule hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Upewnij się, że wszystko jest\\n\\n",
"correctly installed and enabled.": "poprawnie zainstalowany i włączony.",
"Fatal error": "Fatalny błąd",
"Temporary Overrides ": "Tymczasowe nadpisania",
"Sleep Mode": "Tryb uśpienia",
"Stock": "Zapas",
"Dev OC": "Dev OC",
"Boost Mode": "Tryb wzmocnienia",
"Safe Max": "Bezpieczny maks",
"Unsafe Max": "Niebezpieczny maks",
"Absolute Max": "Absolutny maks",
"Handheld Safe Max": "Sejf ręczny Max",
"Enable": "Włącz",
"Edit App Profile": "Edytuj profil aplikacji",
"Edit Global Profile": "Edytuj profil globalny",
"Temporary Overrides": "Tymczasowe nadpisania",
"Settings": "Ustawienia",
"About": "O",
"Compiling with minimal features": "Kompilacja z minimalnymi funkcjami",
"General Settings": "Ustawienia ogólne",
"Governor Settings": "Ustawienia gubernatora",
"Safety Settings": "Ustawienia bezpieczeństwa",
"Save KIP Settings": "Zapisz ustawienia KIP",
"RAM Settings": "Ustawienia pamięci RAM",
"CPU Settings": "Ustawienia procesora",
"GPU Settings": "Ustawienia GPU",
"Display Settings": "Ustawienia wyświetlania",
"Experimental": "Eksperymentalny",
"GPU Scheduling Override Method": "Metoda obejścia harmonogramu GPU",
"can be dangerous and may cause": "może być niebezpieczne i powodować",
"damage to your battery or charger!": "uszkodzenie akumulatora lub ładowarki!",
"Charge Current Override": "Obejście prądu ładowania",
"RAM Voltage Display Mode": "Tryb wyświetlania napięcia RAM",
"Polling Interval": "Interwał odpytywania",
"CPU Governor Minimum Frequency": "Minimalna częstotliwość regulatora procesora",
"refresh rates may cause stress": "częstotliwości odświeżania mogą powodować stres",
"or damage to your display! ": "lub uszkodzenie wyświetlacza!",
"Proceed at your own risk!": "Postępuj na własne ryzyko!",
"Max Handheld Display": "Maksymalny wyświetlacz ręczny",
"Display Clock": "Wyświetl zegar",
"Official Rating": "Oficjalna ocena",
"TDP Threshold": "Próg TDP",
"Power": "Moc",
"Thermal Throttle Limit": "Limit przepustnicy termicznej",
"HP Mode": "Tryb HP",
"Default (Mariko)": "Domyślny (Mariko)",
"Default (Erista)": "Domyślny (Erista)",
"Rating": "Ocena",
"Safe Max (Mariko)": "Bezpieczny Max (Mariko)",
"Safe Max (Erista)": "Bezpieczny Max (Erista)",
"RAM VDD2 Voltage": "Napięcie pamięci RAM VDD2",
"Voltage": "Napięcie",
"RAM VDDQ Voltage": "Napięcie RAM VDDQ",
"RAM Frequency Editor": "Edytor częstotliwości RAM",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Potrzebna duża prędkość!",
"3333MHz (Needs extreme Speedo/PLL)": "3333 MHz (wymaga ekstremalnego Speedo/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 MHz (wymaga ekstremalnego Speedo/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 MHz (wymaga ekstremalnego Speedo/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433 MHz (potrzebuje śmiesznego Speedo/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 MHz (potrzebuje śmiesznego Speedo/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 MHz (potrzebuje śmiesznego Speedo/PLL)",
"Ram Max Clock": "Zegar Ram Max",
"RAM Latency Editor": "Edytor opóźnień pamięci RAM",
"RAM Timing Reductions": "Zmniejszenie taktowania pamięci RAM",
"Memory Timings": "Taktowanie pamięci",
"Advanced": "Zaawansowane",
"t6 tRTW Fine Tune": "t6 tRTW Dostrój",
"tRTW Fine Tune": "tRTW Dostosuj",
"t7 tWTR Fine Tune": "t7 tWTR Dostosuj",
"tWTR Fine Tune": "tWTR Dostosuj",
"Memory Latencies": "Opóźnienia pamięci",
"Read Latency": "Przeczytaj Opóźnienie",
"Write Latency": "Opóźnienie zapisu",
"CPU Boost Clock": "Zegar wzmocnienia procesora",
"CPU UV": "Procesor UV",
"CPU Unlock": "Odblokowanie procesora",
"CPU VMIN": "Procesor VMIN",
"CPU Max Voltage": "Maksymalne napięcie procesora",
"CPU Max Clock": "Maks. zegar procesora",
"Extreme UV Table": "Ekstremalny stół UV",
"CPU UV Table": "Tabela UV procesora",
"CPU Low UV": "Niskie promieniowanie UV procesora",
"CPU High UV": "Wysokie promieniowanie UV procesora",
"CPU Low VMIN": "Niski poziom VMIN procesora",
"CPU High VMIN": "Wysoki poziom VMIN procesora",
"No Undervolt": "Brak Undervolta",
"SLT Table": "Stół SLT",
"HiOPT Table": "Stół HiOPT",
"GPU Undervolt Table": "Tabela niedoboru napięcia GPU",
"GPU Minimum Voltage": "Minimalne napięcie procesora graficznego",
"Calculate GPU Vmin": "Oblicz Vmin GPU",
"GPU VMIN": "VMIN GPU",
"GPU Maximum Voltage": "Maksymalne napięcie procesora graficznego",
"GPU Voltage Offset": "Przesunięcie napięcia GPU",
"Do not override": "Nie zastępuj",
"Enabled (Default)": "Włączone (domyślnie)",
"96.6% limit": "Limit 96,6%.",
"99.7% limit": "Limit 99,7%.",
"GPU Scheduling Override": "Zastąpienie harmonogramu GPU",
"Official Service": "Oficjalny serwis",
"GPU DVFS Mode": "Tryb DVFS procesora graficznego",
"GPU DVFS Offset": "Przesunięcie DVFS GPU",
"GPU Voltage Table": "Tabela napięć GPU",
"GPU Custom Table (mV)": "Tabela niestandardowa GPU (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075 MHz bez UV, 1152 MHz na SLT",
"or 1228MHz on HiOPT can cause ": "lub 1228 MHz na HiOPT może powodować",
"permanent damage to your Switch!": "trwałe uszkodzenie Switcha!",
"921MHz without UV and 960MHz on": "921 MHz bez UV i 960 MHz włączone",
"SLT or HiOPT can cause ": "Przyczyną mogą być SLT lub HiOPT"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Informação",
"IDDQ:": "IDDQ:",
"Module: ": "Módulo:",
"sys-dock status:": "status do dock do sistema:",
"SaltyNX status:": "Status do SaltyNX:",
"RR Display status:": "Status de exibição do RR:",
"Wafer Position:": "Posição da bolacha:",
"Credits": "Créditos",
"Developers": "Desenvolvedores",
"Contributors": "Colaboradores",
"Testers": "Testadores",
"Special Thanks": "Agradecimentos especiais",
"Unknown": "Desconhecido",
"Installed": "Instalado",
"Not Installed": "Não instalado",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "A LICENÇA DE CERVEJA",
"Default": "Padrão",
"Do Not Override": "Não substituir",
"Disabled": "Desativado",
"Enabled": "Habilitado",
" \\ue0e3 Reset": "\\ue0e3 Redefinir",
"Display": "Exibição",
"Application changed\\n\\n": "Aplicativo alterado\\n\\n",
"The running application changed\\n\\n": "O aplicativo em execução foi alterado\\n\\n",
"while editing was going on.": "enquanto a edição estava acontecendo.",
"Board": "Conselho",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Não foi possível conectar-se ao sysmodule hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Verifique se tudo está\\n\\n",
"correctly installed and enabled.": "corretamente instalado e ativado.",
"Fatal error": "Erro fatal",
"Temporary Overrides ": "Substituições temporárias",
"Sleep Mode": "Modo de suspensão",
"Stock": "Estoque",
"Dev OC": "Desenvolvedor OC",
"Boost Mode": "Modo de reforço",
"Safe Max": "Máx. Seguro",
"Unsafe Max": "Máximo inseguro",
"Absolute Max": "Máximo absoluto",
"Handheld Safe Max": "Portátil Seguro Máx.",
"Enable": "Habilitar",
"Edit App Profile": "Editar perfil do aplicativo",
"Edit Global Profile": "Editar perfil global",
"Temporary Overrides": "Substituições temporárias",
"Settings": "Configurações",
"About": "Sobre",
"Compiling with minimal features": "Compilando com recursos mínimos",
"General Settings": "Configurações Gerais",
"Governor Settings": "Configurações do Governador",
"Safety Settings": "Configurações de segurança",
"Save KIP Settings": "Salvar configurações KIP",
"RAM Settings": "Configurações de RAM",
"CPU Settings": "Configurações de CPU",
"GPU Settings": "Configurações de GPU",
"Display Settings": "Configurações de exibição",
"Experimental": "Experimental",
"GPU Scheduling Override Method": "Método de substituição de agendamento de GPU",
"can be dangerous and may cause": "pode ser perigoso e causar",
"damage to your battery or charger!": "danos à sua bateria ou carregador!",
"Charge Current Override": "Substituição de corrente de carga",
"RAM Voltage Display Mode": "Modo de exibição de tensão RAM",
"Polling Interval": "Intervalo de votação",
"CPU Governor Minimum Frequency": "Frequência Mínima do Governador da CPU",
"refresh rates may cause stress": "taxas de atualização podem causar estresse",
"or damage to your display! ": "ou danos ao seu monitor!",
"Proceed at your own risk!": "Prossiga por sua conta e risco!",
"Max Handheld Display": "Visor portátil máximo",
"Display Clock": "Exibir relógio",
"Official Rating": "Classificação Oficial",
"TDP Threshold": "Limite de TDP",
"Power": "Poder",
"Thermal Throttle Limit": "Limite de aceleração térmica",
"HP Mode": "Modo HP",
"Default (Mariko)": "Padrão (Mariko)",
"Default (Erista)": "Padrão (Erista)",
"Rating": "Avaliação",
"Safe Max (Mariko)": "Máximo Seguro (Mariko)",
"Safe Max (Erista)": "Seguro Max (Erista)",
"RAM VDD2 Voltage": "Tensão RAM VDD2",
"Voltage": "Tensão",
"RAM VDDQ Voltage": "Tensão RAM VDDQ",
"RAM Frequency Editor": "Editor de frequência RAM",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Alta velocidade necessária!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz (precisa de Speedo/PLL extremo)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 MHz (precisa de Speedo/PLL extremo)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 MHz (precisa de Speedo/PLL extremo)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (precisa de Speedo/PLL ridículo)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 MHz (precisa de Speedo/PLL ridículo)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 MHz (precisa de Speedo/PLL ridículo)",
"Ram Max Clock": "Relógio máximo de Ram",
"RAM Latency Editor": "Editor de latência de RAM",
"RAM Timing Reductions": "Reduções de tempo de RAM",
"Memory Timings": "Tempos de memória",
"Advanced": "Avançado",
"t6 tRTW Fine Tune": "t6 tRTW Ajuste fino",
"tRTW Fine Tune": "Ajuste fino tRTW",
"t7 tWTR Fine Tune": "t7 tWTR Ajuste fino",
"tWTR Fine Tune": "Ajuste fino tWTR",
"Memory Latencies": "Latências de memória",
"Read Latency": "Latência de leitura",
"Write Latency": "Latência de gravação",
"CPU Boost Clock": "Relógio de aumento da CPU",
"CPU UV": "UV da CPU",
"CPU Unlock": "Desbloqueio da CPU",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "Tensão máxima da CPU",
"CPU Max Clock": "Relógio máximo da CPU",
"Extreme UV Table": "Mesa UV Extrema",
"CPU UV Table": "Tabela UV da CPU",
"CPU Low UV": "UV baixo da CPU",
"CPU High UV": "CPU alta UV",
"CPU Low VMIN": "CPU baixa VMIN",
"CPU High VMIN": "VMIN alto da CPU",
"No Undervolt": "Sem subtensão",
"SLT Table": "Tabela SLT",
"HiOPT Table": "Tabela HiOPT",
"GPU Undervolt Table": "Tabela de subtensão da GPU",
"GPU Minimum Voltage": "Tensão mínima da GPU",
"Calculate GPU Vmin": "Calcular Vmin da GPU",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "Tensão máxima da GPU",
"GPU Voltage Offset": "Compensação de tensão da GPU",
"Do not override": "Não substitua",
"Enabled (Default)": "Habilitado (padrão)",
"96.6% limit": "Limite de 96,6%",
"99.7% limit": "Limite de 99,7%",
"GPU Scheduling Override": "Substituição de agendamento de GPU",
"Official Service": "Serviço Oficial",
"GPU DVFS Mode": "Modo GPU DVFS",
"GPU DVFS Offset": "Deslocamento DVFS da GPU",
"GPU Voltage Table": "Tabela de tensão da GPU",
"GPU Custom Table (mV)": "Tabela personalizada de GPU (mV)",
"1075MHz without UV, 1152MHz on SLT": "1075 MHz sem UV, 1152 MHz em SLT",
"or 1228MHz on HiOPT can cause ": "ou 1228 MHz em HiOPT pode causar",
"permanent damage to your Switch!": "danos permanentes ao seu Switch!",
"921MHz without UV and 960MHz on": "921 MHz sem UV e 960 MHz ativado",
"SLT or HiOPT can cause ": "SLT ou HiOPT podem causar"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Информация",
"IDDQ:": "ИДДК:",
"Module: ": "Модуль:",
"sys-dock status:": "Статус системной док-станции:",
"SaltyNX status:": "Статус SaltyNX:",
"RR Display status:": "Статус отображения RR:",
"Wafer Position:": "Позиция вафли:",
"Credits": "Кредиты",
"Developers": "Разработчики",
"Contributors": "Авторы",
"Testers": "Тестеры",
"Special Thanks": "Особая благодарность",
"Unknown": "Неизвестно",
"Installed": "Установлено",
"Not Installed": "Не установлено",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "ЛИЦЕНЗИЯ НА ПРОДАЖУ ПИВА",
"Default": "По умолчанию",
"Do Not Override": "Не переопределять",
"Disabled": "Отключено",
"Enabled": "Включено",
" \\ue0e3 Reset": "\\ue0e3 Сброс",
"Display": "Дисплей",
"Application changed\\n\\n": "Приложение изменено\\n\\n",
"The running application changed\\n\\n": "Запущенное приложение изменилось\\n\\n",
"while editing was going on.": "пока шло редактирование.",
"Board": "Совет",
"%u.%u%u mV": "%u.%u%u мВ",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Не удалось подключиться к системному модулю hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Пожалуйста, убедитесь, что все в порядке\\n\\n",
"correctly installed and enabled.": "правильно установлен и включен.",
"Fatal error": "Неустранимая ошибка",
"Temporary Overrides ": "Временные переопределения",
"Sleep Mode": "Спящий режим",
"Stock": "Акции",
"Dev OC": "Разработчик OC",
"Boost Mode": "Режим повышения",
"Safe Max": "Сейф Макс",
"Unsafe Max": "Небезопасный Макс",
"Absolute Max": "Абсолютный Макс",
"Handheld Safe Max": "Ручной сейф Макс",
"Enable": "Включить",
"Edit App Profile": "Редактировать профиль приложения",
"Edit Global Profile": "Редактировать глобальный профиль",
"Temporary Overrides": "Временные переопределения",
"Settings": "Настройки",
"About": "О",
"Compiling with minimal features": "Компиляция с минимальными возможностями",
"General Settings": "Общие настройки",
"Governor Settings": "Настройки губернатора",
"Safety Settings": "Настройки безопасности",
"Save KIP Settings": "Сохранить настройки КИП",
"RAM Settings": "Настройки ОЗУ",
"CPU Settings": "Настройки процессора",
"GPU Settings": "Настройки графического процессора",
"Display Settings": "Настройки дисплея",
"Experimental": "Экспериментальный",
"GPU Scheduling Override Method": "Метод переопределения планирования графического процессора",
"can be dangerous and may cause": "может быть опасным и может вызвать",
"damage to your battery or charger!": "повреждение аккумулятора или зарядного устройства!",
"Charge Current Override": "Блокировка зарядного тока",
"RAM Voltage Display Mode": "Режим отображения напряжения ОЗУ",
"Polling Interval": "Интервал опроса",
"CPU Governor Minimum Frequency": "Минимальная частота регулятора ЦП",
"refresh rates may cause stress": "частота обновления может вызвать стресс",
"or damage to your display! ": "или повреждение дисплея!",
"Proceed at your own risk!": "Действуйте на свой страх и риск!",
"Max Handheld Display": "Макс. портативный дисплей",
"Display Clock": "Дисплей Часы",
"Official Rating": "Официальный рейтинг",
"TDP Threshold": "Порог TDP",
"Power": "Мощность",
"Thermal Throttle Limit": "Температурный предел дроссельной заслонки",
"HP Mode": "Режим HP",
"Default (Mariko)": "По умолчанию (Марико)",
"Default (Erista)": "По умолчанию (Эриста)",
"Rating": "Рейтинг",
"Safe Max (Mariko)": "Сейф Макс (Марико)",
"Safe Max (Erista)": "Сейф Макс (Эриста)",
"RAM VDD2 Voltage": "Напряжение ОЗУ VDD2",
"Voltage": "Напряжение",
"RAM VDDQ Voltage": "Напряжение ОЗУ VDDQ",
"RAM Frequency Editor": "Редактор частоты оперативной памяти",
"JEDEC.": "ДЖЕДЕК.",
"High speedo needed!": "Нужен высокий спидометр!",
"3333MHz (Needs extreme Speedo/PLL)": "3333 МГц (требуется экстремальный спидометр/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 МГц (требуется экстремальный спидометр/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 МГц (требуется экстремальный спидометр/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433 МГц (нужен нелепый спидометр/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 МГц (нужен нелепый спидометр/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 МГц (нужен нелепый спидометр/PLL)",
"Ram Max Clock": "Рам Макс Часы",
"RAM Latency Editor": "Редактор задержки оперативной памяти",
"RAM Timing Reductions": "Сокращение таймингов ОЗУ",
"Memory Timings": "Тайминги памяти",
"Advanced": "Расширенный",
"t6 tRTW Fine Tune": "t6 tRTW Точная настройка",
"tRTW Fine Tune": "tRTW Точная настройка",
"t7 tWTR Fine Tune": "t7 tWTR Тонкая настройка",
"tWTR Fine Tune": "tWTR Тонкая настройка",
"Memory Latencies": "Задержки памяти",
"Read Latency": "Задержка чтения",
"Write Latency": "Задержка записи",
"CPU Boost Clock": "Тактовая частота процессора",
"CPU UV": "УФ процессора",
"CPU Unlock": "Разблокировка процессора",
"CPU VMIN": "ЦП VMIN",
"CPU Max Voltage": "Максимальное напряжение процессора",
"CPU Max Clock": "Максимальная частота процессора",
"Extreme UV Table": "Стол для экстремального УФ-излучения",
"CPU UV Table": "UV-таблица процессора",
"CPU Low UV": "ЦП с низким УФ-излучением",
"CPU High UV": "Процессор с высоким УФ",
"CPU Low VMIN": "Низкий VMIN процессора",
"CPU High VMIN": "Высокий VMIN процессора",
"No Undervolt": "Нет Андервольта",
"SLT Table": "Таблица ТА",
"HiOPT Table": "Таблица HiOPT",
"GPU Undervolt Table": "Таблица пониженного напряжения графического процессора",
"GPU Minimum Voltage": "Минимальное напряжение графического процессора",
"Calculate GPU Vmin": "Рассчитать Vmin графического процессора",
"GPU VMIN": "Вмин графического процессора",
"GPU Maximum Voltage": "Максимальное напряжение графического процессора",
"GPU Voltage Offset": "Смещение напряжения графического процессора",
"Do not override": "Не переопределять",
"Enabled (Default)": "Включено (по умолчанию)",
"96.6% limit": "Предел 96,6%",
"99.7% limit": "лимит 99,7%",
"GPU Scheduling Override": "Переопределение планирования графического процессора",
"Official Service": "Официальная служба",
"GPU DVFS Mode": "Режим графического процессора DVFS",
"GPU DVFS Offset": "Смещение DVFS графического процессора",
"GPU Voltage Table": "Таблица напряжений графического процессора",
"GPU Custom Table (mV)": "Пользовательская таблица графического процессора (мВ)",
"1075MHz without UV, 1152MHz on SLT": "1075 МГц без УФ, 1152 МГц на SLT",
"or 1228MHz on HiOPT can cause ": "или 1228 МГц на HiOPT может привести к",
"permanent damage to your Switch!": "необратимое повреждение вашего коммутатора!",
"921MHz without UV and 960MHz on": "921 МГц без УФ и 960 МГц с включенным",
"SLT or HiOPT can cause ": "SLT или HiOPT могут вызвать"
}

View File

@@ -0,0 +1,141 @@
{
"Information": "Інформація",
"IDDQ:": "IDDQ:",
"Module: ": "Модуль:",
"sys-dock status:": "стан sys-dock:",
"SaltyNX status:": "Статус SaltyNX:",
"RR Display status:": "Статус дисплея RR:",
"Wafer Position:": "Позиція пластини:",
"Credits": "Кредити",
"Developers": "Розробники",
"Contributors": "Дописувачі",
"Testers": "Тестери",
"Special Thanks": "Особлива подяка",
"Unknown": "Невідомий",
"Installed": "встановлено",
"Not Installed": "Не встановлено",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "ЛІЦЕНЗІЯ НА ПИВНИЙ ПОСУД",
"Default": "За замовчуванням",
"Do Not Override": "Не перевизначати",
"Disabled": "Вимкнено",
"Enabled": "Увімкнено",
" \\ue0e3 Reset": "\\ue0e3 Скидання",
"Display": "Дисплей",
"Application changed\\n\\n": "Додаток змінено\\n\\n",
"The running application changed\\n\\n": "Запущена програма змінена\\n\\n",
"while editing was going on.": "поки йшло редагування.",
"Board": "дошка",
"%u.%u%u mV": "%u.%u%u мВ",
"Could not connect to hoc-clk sysmodule.\\n\\n": "Не вдалося підключитися до системного модуля hoc-clk.\\n\\n",
"Please make sure everything is\\n\\n": "Переконайтеся, що все\\n\\n",
"correctly installed and enabled.": "правильно встановлено та включено.",
"Fatal error": "Фатальна помилка",
"Temporary Overrides ": "Тимчасові перевизначення",
"Sleep Mode": "Режим сну",
"Stock": "Запас",
"Dev OC": "Розробник OC",
"Boost Mode": "Режим посилення",
"Safe Max": "Безпечний макс",
"Unsafe Max": "Небезпечний макс",
"Absolute Max": "Абсолютний макс",
"Handheld Safe Max": "Портативний сейф Макс",
"Enable": "Увімкнути",
"Edit App Profile": "Редагувати профіль програми",
"Edit Global Profile": "Редагувати глобальний профіль",
"Temporary Overrides": "Тимчасові перевизначення",
"Settings": "Налаштування",
"About": "про",
"Compiling with minimal features": "Компіляція з мінімальними можливостями",
"General Settings": "Загальні налаштування",
"Governor Settings": "Налаштування губернатора",
"Safety Settings": "Налаштування безпеки",
"Save KIP Settings": "Зберегти налаштування KIP",
"RAM Settings": "Налаштування оперативної пам'яті",
"CPU Settings": "Налаштування ЦП",
"GPU Settings": "Налаштування GPU",
"Display Settings": "Налаштування дисплея",
"Experimental": "Експериментальний",
"GPU Scheduling Override Method": "Метод перевизначення планування GPU",
"can be dangerous and may cause": "може бути небезпечним і може спричинити",
"damage to your battery or charger!": "пошкодження акумулятора або зарядного пристрою!",
"Charge Current Override": "Перевизначення струму заряду",
"RAM Voltage Display Mode": "Режим відображення напруги RAM",
"Polling Interval": "Інтервал опитування",
"CPU Governor Minimum Frequency": "Мінімальна частота регулятора ЦП",
"refresh rates may cause stress": "частоти оновлення можуть викликати стрес",
"or damage to your display! ": "або пошкодження дисплея!",
"Proceed at your own risk!": "Продовжуйте на свій страх і ризик!",
"Max Handheld Display": "Максимальний портативний дисплей",
"Display Clock": "Відображення годинника",
"Official Rating": "Офіційний рейтинг",
"TDP Threshold": "Поріг TDP",
"Power": "потужність",
"Thermal Throttle Limit": "Термічний дросельний ліміт",
"HP Mode": "Режим HP",
"Default (Mariko)": "За замовчуванням (Маріко)",
"Default (Erista)": "За замовчуванням (Erista)",
"Rating": "Рейтинг",
"Safe Max (Mariko)": "Сейф Макс (Маріко)",
"Safe Max (Erista)": "Сейф Макс (Еріста)",
"RAM VDD2 Voltage": "Напруга RAM VDD2",
"Voltage": "Напруга",
"RAM VDDQ Voltage": "Напруга RAM VDDQ",
"RAM Frequency Editor": "Редактор частоти оперативної пам'яті",
"JEDEC.": "JEDEC.",
"High speedo needed!": "Потрібна висока швидкість!",
"3333MHz (Needs extreme Speedo/PLL)": "3333 МГц (потрібна екстремальна швидкість/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366 МГц (потрібна екстремальна швидкість/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400 МГц (потрібна екстремальна швидкість/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433 МГц (потрібен смішний Speedo/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466 МГц (потрібен смішний Speedo/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500 МГц (потрібен смішний Speedo/PLL)",
"Ram Max Clock": "Годинник Ram Max",
"RAM Latency Editor": "Редактор затримки оперативної пам'яті",
"RAM Timing Reductions": "Скорочення оперативної пам'яті",
"Memory Timings": "Таймінг пам'яті",
"Advanced": "Просунутий",
"t6 tRTW Fine Tune": "t6 tRTW Точне налаштування",
"tRTW Fine Tune": "Точне налаштування tRTW",
"t7 tWTR Fine Tune": "t7 tWTR Точне налаштування",
"tWTR Fine Tune": "Точна настройка tWTR",
"Memory Latencies": "Затримки пам'яті",
"Read Latency": "Прочитати затримку",
"Write Latency": "Затримка запису",
"CPU Boost Clock": "CPU Boost Clock",
"CPU UV": "CPU UV",
"CPU Unlock": "Розблокування ЦП",
"CPU VMIN": "CPU VMIN",
"CPU Max Voltage": "Максимальна напруга ЦП",
"CPU Max Clock": "Максимальна частота ЦП",
"Extreme UV Table": "Екстремальний ультрафіолетовий стіл",
"CPU UV Table": "CPU UV Таблиця",
"CPU Low UV": "CPU Low UV",
"CPU High UV": "CPU High UV",
"CPU Low VMIN": "CPU Low VMIN",
"CPU High VMIN": "CPU High VMIN",
"No Undervolt": "Без андервольта",
"SLT Table": "Таблиця SLT",
"HiOPT Table": "Таблиця HiOPT",
"GPU Undervolt Table": "Таблиця зниження напруги GPU",
"GPU Minimum Voltage": "Мінімальна напруга GPU",
"Calculate GPU Vmin": "Розрахувати GPU Vmin",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "Максимальна напруга GPU",
"GPU Voltage Offset": "Зсув напруги GPU",
"Do not override": "Не перевизначати",
"Enabled (Default)": "Увімкнено (за замовчуванням)",
"96.6% limit": "96,6% обмеження",
"99.7% limit": "Обмеження 99,7%.",
"GPU Scheduling Override": "Перевизначення планування GPU",
"Official Service": "Офіційний сервіс",
"GPU DVFS Mode": "Режим GPU DVFS",
"GPU DVFS Offset": "GPU DVFS Offset",
"GPU Voltage Table": "Таблиця напруги GPU",
"GPU Custom Table (mV)": "Спеціальна таблиця GPU (мВ)",
"1075MHz without UV, 1152MHz on SLT": "1075 МГц без УФ, 1152 МГц на SLT",
"or 1228MHz on HiOPT can cause ": "або 1228 МГц на HiOPT може спричинити",
"permanent damage to your Switch!": "незворотне пошкодження вашого комутатора!",
"921MHz without UV and 960MHz on": "921 МГц без УФ і 960 МГц увімкнено",
"SLT or HiOPT can cause ": "SLT або HiOPT можуть спричинити"
}

View File

@@ -0,0 +1,157 @@
{
"Information": "信息",
"IDDQ:": "IDDQ:",
"Module: ": "模块: ",
"sys-dock status:": "sys-dock 状态:",
"SaltyNX status:": "SaltyNX 状态:",
"RR Display status:": "RR 显示状态:",
"Wafer Position:": "晶圆位置:",
"Credits": "致谢",
"Developers": "开发者",
"Contributors": "贡献者",
"Testers": "测试者",
"Special Thanks": "特别感谢",
"Unknown": "未知",
"Installed": "已安装",
"Not Installed": "未安装",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "啤酒软件许可协议",
"Default": "默认",
"Do Not Override": "不修改",
"Disabled": "已禁用",
"Enabled": "已启用",
" \\ue0e3 Reset": " \\ue0e3 重置",
"Display": "显示",
"Application changed\\n\\n": "应用已变更\\n\\n",
"The running application changed\\n\\n": "正在运行的应用已变更\\n\\n",
"while editing was going on.": "编辑过程中发生变更。",
"Board": "主板",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "无法连接到 hoc-clk 系统模块。\\n\\n",
"Please make sure everything is\\n\\n": "请确保所有内容均已\\n\\n",
"correctly installed and enabled.": "正确安装并启用。",
"Fatal error": "致命错误",
"Temporary Overrides ": "临时配置 ",
"Sleep Mode": "睡眠模式",
"Stock": "原厂默认",
"Dev OC": "开发者超频",
"Boost Mode": "加速模式",
"Safe Max": "安全最大值",
"Unsafe Max": "危险最大值",
"Absolute Max": "绝对最大值",
"Handheld Safe Max": "掌机模式安全最大值",
"Enable": "启用",
"Edit App Profile": "编辑应用配置",
"Edit Global Profile": "编辑全局配置",
"Temporary Overrides": "临时配置",
"Settings": "设置",
"About": "关于",
"Compiling with minimal features": "以最小功能编译",
"General Settings": "通用设置",
"Governor Settings": "调频器设置",
"Safety Settings": "安全设置",
"Save KIP Settings": "保存 KIP 设置",
"RAM Settings": "内存设置",
"CPU Settings": "CPU 设置",
"GPU Settings": "GPU 设置",
"Display Settings": "显示设置",
"Experimental": "实验性功能",
"GPU Scheduling Override Method": "GPU 调度覆盖方式",
"can be dangerous and may cause": "存在风险,可能导致",
"damage to your battery or charger!": "电池或充电器损坏!",
"Charge Current Override": "充电电流修改",
"RAM Voltage Display Mode": "内存电压显示模式",
"Polling Interval": "刷新间隔",
"CPU Governor Minimum Frequency": "CPU 调频器最低频率",
"\uE150 Usage of unsafe display": "\uE150 不安全的显示屏",
"refresh rates may cause stress": "刷新率可能会对",
"or damage to your display! ": "显示屏造成压力或损坏! ",
"Proceed at your own risk!": "操作风险自负!",
"Max Handheld Display": "掌机模式最大显示率",
"Display Clock": "显示时钟",
"Official Rating": "官方额定值",
"TDP Threshold": "TDP 阈值",
"Power": "电源",
"Thermal Throttle Limit": "温控设置",
"HP Mode": "高性能模式",
"Default (Mariko)": "默认 (Mariko)",
"Default (Erista)": "默认 (Erista)",
"Rating": "额定值",
"Safe Max (Mariko)": "安全最大值 (Mariko)",
"Safe Max (Erista)": "安全最大值 (Erista)",
"RAM VDD2 Voltage": "内存 VDD2 电压",
"Voltage": "电压",
"RAM VDDQ Voltage": "内存 VDDQ 电压",
"RAM Frequency Editor": "内存频率编辑器",
"JEDEC.": "JEDEC 标准。",
"High speedo needed!": "需要高 Speedo 配置!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz (需要极限 Speedo/PLL)",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz (需要极限 Speedo/PLL)",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz (需要极限 Speedo/PLL)",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz (需要极端 Speedo/PLL)",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz (需要极端 Speedo/PLL)",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz (需要极端 Speedo/PLL)",
"Ram Max Clock": "内存最大频率",
"RAM Latency Editor": "内存延迟编辑器",
"RAM Timing Reductions": "内存时序优化",
"Memory Timings": "内存时序",
"Memory": "内存",
"mem": "内存",
"Governor": "调频器",
"Advanced": "高级",
"Docked": "底座模式",
"Handheld": "掌机模式",
"Charging": "充电中",
"USB Charger": "USB 充电器",
"PD Charger": "PD 充电器",
"Handheld TDP": "掌机模式功耗限制",
"Thermal Throttle": "温度控制",
"Uncapped Clocks": "解除频率上限",
"Soc DVB Shift": "SoC DVB偏移",
"Overwrite Boost Mode": "接管官方CPU调度",
"Display Refresh Rate Changing": "显示刷新率变更",
"t6 tRTW Fine Tune": "t6 tRTW 微调",
"tRTW Fine Tune": "tRTW 微调",
"t7 tWTR Fine Tune": "t7 tWTR 微调",
"tWTR Fine Tune": "tWTR 微调",
"Memory Latencies": "内存延迟",
"Read Latency": "读取延迟",
"Write Latency": "写入延迟",
"CPU Boost Clock": "CPU 超频频率",
"CPU UV": "CPU 降压",
"CPU Unlock": "CPU 解锁",
"CPU VMIN": "CPU 最低电压",
"CPU Max Voltage": "CPU 最大电压",
"CPU Max Clock": "CPU 最大频率",
"Extreme UV Table": "极限降压表",
"CPU UV Table": "CPU 降压表",
"CPU Low UV": "CPU 低压降压",
"CPU High UV": "CPU 高压降压",
"CPU Low VMIN": "CPU 低压最低电压",
"CPU High VMIN": "CPU 高压最低电压",
"No Undervolt": "不降压",
"SLT Table": "SLT 表",
"HiOPT Table": "HiOPT 表",
"GPU Undervolt Table": "GPU 降压表",
"GPU Minimum Voltage": "GPU 最低电压",
"Calculate GPU Vmin": "计算 GPU 最低电压",
"GPU VMIN": "GPU 最低电压",
"GPU Maximum Voltage": "GPU 最大电压",
"GPU Voltage Offset": "GPU 电压偏移",
"Do not override": "不修改",
"Enabled (Default)": "已启用 (默认)",
"96.6% limit": "96.6% 限制",
"99.7% limit": "99.7% 限制",
"GPU Scheduling Override": "GPU 调度修改",
"Official Service": "官方服务",
"GPU DVFS Mode": "GPU DVFS 模式",
"GPU DVFS Offset": "GPU DVFS 偏移",
"GPU Voltage Table": "GPU 电压表",
"GPU Custom Table (mV)": "GPU 自定义表 (mV)",
"\uE150 Setting GPU Clocks past": "\uE150 将 GPU 频率设置超过",
"1075MHz without UV, 1152MHz on SLT": "1075MHz 无降压SLT 表下 1152MHz",
"or 1228MHz on HiOPT can cause ": "或 HiOPT 表下 1228MHz 可能导致 ",
"permanent damage to your Switch!": "Switch 永久损坏!",
"921MHz without UV and 960MHz on": "921MHz 无降压SLT/HiOPT 表下 960MHz",
"SLT or HiOPT can cause ": "可能导致 "
}

View File

@@ -0,0 +1,141 @@
{
"Information": "資訊",
"IDDQ:": "國際電話號碼:",
"Module: ": "模組:",
"sys-dock status:": "系統塢站狀態:",
"SaltyNX status:": "SaltyNX 狀態:",
"RR Display status:": "RR 顯示狀態:",
"Wafer Position:": "晶圓位置:",
"Credits": "製作人員",
"Developers": "開發商",
"Contributors": "貢獻者",
"Testers": "測試人員",
"Special Thanks": "特別感謝",
"Unknown": "未知",
"Installed": "已安裝",
"Not Installed": "未安裝",
"X: %u Y: %u": "X: %u Y: %u",
"THE BEER-WARE LICENSE": "啤酒製品許可證",
"Default": "預設",
"Do Not Override": "不要覆蓋",
"Disabled": "殘障人士",
"Enabled": "啟用",
" \\ue0e3 Reset": "\\ue0e3 重設",
"Display": "顯示",
"Application changed\\n\\n": "應用程式已更改\\n\\n",
"The running application changed\\n\\n": "正在運行的應用程式已更改\\n\\n",
"while editing was going on.": "當編輯正在進行時。",
"Board": "董事會",
"%u.%u%u mV": "%u.%u%u mV",
"Could not connect to hoc-clk sysmodule.\\n\\n": "無法連接到 hoc-clk 系統模組。 \\n\\n",
"Please make sure everything is\\n\\n": "請確保一切正常\\n\\n",
"correctly installed and enabled.": "正確安裝並啟用。",
"Fatal error": "致命錯誤",
"Temporary Overrides ": "臨時覆蓋",
"Sleep Mode": "睡眠模式",
"Stock": "庫存",
"Dev OC": "開發OC",
"Boost Mode": "升壓模式",
"Safe Max": "安全最大值",
"Unsafe Max": "不安全最大值",
"Absolute Max": "絕對最大值",
"Handheld Safe Max": "手持式安全最大",
"Enable": "啟用",
"Edit App Profile": "編輯應用程式設定檔",
"Edit Global Profile": "編輯全域設定檔",
"Temporary Overrides": "臨時覆蓋",
"Settings": "設定",
"About": "關於",
"Compiling with minimal features": "使用最少的功能進行編譯",
"General Settings": "常規設定",
"Governor Settings": "調速器設定",
"Safety Settings": "安全設定",
"Save KIP Settings": "儲存 KIP 設定",
"RAM Settings": "記憶體設定",
"CPU Settings": "中央處理器設定",
"GPU Settings": "GPU設定",
"Display Settings": "顯示設定",
"Experimental": "實驗性的",
"GPU Scheduling Override Method": "GPU調度覆蓋方法",
"can be dangerous and may cause": "可能很危險並可能導致",
"damage to your battery or charger!": "損壞電池或充電器!",
"Charge Current Override": "充電電流覆蓋",
"RAM Voltage Display Mode": "RAM電壓顯示模式",
"Polling Interval": "輪詢間隔",
"CPU Governor Minimum Frequency": "CPU調速器最低頻率",
"refresh rates may cause stress": "刷新率可能會造成壓力",
"or damage to your display! ": "或損壞您的顯示器!",
"Proceed at your own risk!": "請自行承擔風險!",
"Max Handheld Display": "最大手持顯示器",
"Display Clock": "顯示時鐘",
"Official Rating": "官方評級",
"TDP Threshold": "TDP閾值",
"Power": "電源",
"Thermal Throttle Limit": "熱油門限制",
"HP Mode": "惠普模式",
"Default (Mariko)": "預設(真理子)",
"Default (Erista)": "預設(埃里斯塔)",
"Rating": "評級",
"Safe Max (Mariko)": "安全最大(真理子)",
"Safe Max (Erista)": "安全最大(埃里斯塔)",
"RAM VDD2 Voltage": "RAM VDD2 電壓",
"Voltage": "電壓",
"RAM VDDQ Voltage": "RAM VDDQ 電壓",
"RAM Frequency Editor": "RAM頻率編輯器",
"JEDEC.": "JEDEC。",
"High speedo needed!": "需要高速!",
"3333MHz (Needs extreme Speedo/PLL)": "3333MHz需要極高的 Speedo/PLL",
"3366MHz (Needs extreme Speedo/PLL)": "3366MHz需要極高的 Speedo/PLL",
"3400MHz (Needs extreme Speedo/PLL)": "3400MHz需要極高的 Speedo/PLL",
"3433MHz (Needs ridiculous Speedo/PLL)": "3433MHz需要荒謬的 Speedo/PLL",
"3466MHz (Needs ridiculous Speedo/PLL)": "3466MHz需要荒謬的 Speedo/PLL",
"3500MHz (Needs ridiculous Speedo/PLL)": "3500MHz需要荒謬的 Speedo/PLL",
"Ram Max Clock": "記憶體最大時鐘",
"RAM Latency Editor": "RAM 延遲編輯器",
"RAM Timing Reductions": "RAM 時序減少",
"Memory Timings": "記憶體時序",
"Advanced": "進階",
"t6 tRTW Fine Tune": "t6 tRTW 微調",
"tRTW Fine Tune": "tRTW 微調",
"t7 tWTR Fine Tune": "t7 tWTR 微調",
"tWTR Fine Tune": "tWTR 微調",
"Memory Latencies": "記憶體延遲",
"Read Latency": "讀取延遲",
"Write Latency": "寫入延遲",
"CPU Boost Clock": "CPU 升壓時鐘",
"CPU UV": "中央處理器紫外線",
"CPU Unlock": "CPU解鎖",
"CPU VMIN": "CPU最低電壓",
"CPU Max Voltage": "CPU最大電壓",
"CPU Max Clock": "CPU 最大時脈",
"Extreme UV Table": "極端紫外線表",
"CPU UV Table": "CPU UV表",
"CPU Low UV": "CPU低紫外線",
"CPU High UV": "CPU高紫外線",
"CPU Low VMIN": "CPU 低 VMIN",
"CPU High VMIN": "CPU 高 VMIN",
"No Undervolt": "無欠壓",
"SLT Table": "SLT表",
"HiOPT Table": "HiOPT表",
"GPU Undervolt Table": "GPU 欠壓表",
"GPU Minimum Voltage": "GPU最低電壓",
"Calculate GPU Vmin": "計算 GPU Vmin",
"GPU VMIN": "GPU VMIN",
"GPU Maximum Voltage": "GPU最大電壓",
"GPU Voltage Offset": "GPU電壓偏移",
"Do not override": "不要覆蓋",
"Enabled (Default)": "啟用(預設)",
"96.6% limit": "96.6%限制",
"99.7% limit": "99.7%限制",
"GPU Scheduling Override": "GPU 調度覆蓋",
"Official Service": "官方服務",
"GPU DVFS Mode": "GPU DVFS 模式",
"GPU DVFS Offset": "GPU DVFS 偏移",
"GPU Voltage Table": "GPU電壓表",
"GPU Custom Table (mV)": "GPU 自訂表 (mV)",
"1075MHz without UV, 1152MHz on SLT": "無 UV 時為 1075MHzSLT 時為 1152MHz",
"or 1228MHz on HiOPT can cause ": "或 HiOPT 上的 1228MHz 可能會導致",
"permanent damage to your Switch!": "對您的 Switch 造成永久性損壞!",
"921MHz without UV and 960MHz on": "無 UV 時為 921MHz開啟時為 960MHz",
"SLT or HiOPT can cause ": "SLT 或 HiOPT 可能會導致"
}

View File

@@ -34,8 +34,8 @@ extern "C"
{
#endif
#include <sysclk.h>
#include <sysclk/client/ipc.h>
#include <hocclk.h>
#include <hocclk/client/ipc.h>
#if defined(__cplusplus)
}

View File

@@ -43,7 +43,7 @@ class AppOverlay : public tsl::Overlay
virtual void exitServices() override {
rgltrExit();
sysclkIpcExit();
hocclkIpcExit();
}
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override
@@ -53,7 +53,7 @@ class AppOverlay : public tsl::Overlay
tsl::hlp::ScopeGuard smGuard([] { smExit(); });
if(!sysclkIpcRunning())
if(!hocclkIpcRunning())
{
return initially<FatalGui>(
"hoc-clk is not running.\n\n"
@@ -64,7 +64,7 @@ class AppOverlay : public tsl::Overlay
);
}
if(R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion)))
if(R_FAILED(hocclkIpcInitialize()) || R_FAILED(hocclkIpcGetAPIVersion(&apiVersion)))
{
return initially<FatalGui>(
"Could not connect to hoc-clk.\n\n"
@@ -75,7 +75,7 @@ class AppOverlay : public tsl::Overlay
);
}
if(SYSCLK_IPC_API_VERSION != apiVersion)
if(HOCCLK_IPC_API_VERSION != apiVersion)
{
return initially<FatalGui>(
"Overlay not compatible with\n\n"

View File

@@ -27,6 +27,11 @@ tsl::elm::ListItem* IddqItem = NULL;
tsl::elm::ListItem* DramModule = NULL;
tsl::elm::ListItem* sysdockStatusItem = NULL;
tsl::elm::ListItem* saltyNXStatusItem = NULL;
tsl::elm::ListItem* RETROStatusItem = NULL;
tsl::elm::ListItem* waferCordsItem = NULL;
tsl::elm::ListItem* ramVoltItem = NULL;
tsl::elm::ListItem* eristaPLLXItem = NULL;
tsl::elm::ListItem* dispVoltItem = NULL;
ImageElement* CatImage = NULL;
HideableCategoryHeader* CatHeader = NULL;
@@ -48,6 +53,20 @@ void AboutGui::listUI()
new tsl::elm::CategoryHeader("Information")
);
ramVoltItem =
new tsl::elm::ListItem("RAM Voltage:");
this->listElement->addItem(ramVoltItem);
dispVoltItem =
new tsl::elm::ListItem("Display Voltage:");
this->listElement->addItem(dispVoltItem);
eristaPLLXItem =
new tsl::elm::ListItem("PLLX Temp:");
if(IsErista()) {
this->listElement->addItem(eristaPLLXItem);
}
SpeedoItem =
new tsl::elm::ListItem("Speedo:");
this->listElement->addItem(SpeedoItem);
@@ -60,13 +79,25 @@ void AboutGui::listUI()
new tsl::elm::ListItem("Module: ");
this->listElement->addItem(DramModule);
sysdockStatusItem =
new tsl::elm::ListItem("sys-dock status:");
this->listElement->addItem(sysdockStatusItem);
if(!IsHoag()) {
sysdockStatusItem =
new tsl::elm::ListItem("sys-dock status:");
this->listElement->addItem(sysdockStatusItem);
}
saltyNXStatusItem =
new tsl::elm::ListItem("SaltyNX status:");
this->listElement->addItem(saltyNXStatusItem);
if(IsHoag()) {
RETROStatusItem =
new tsl::elm::ListItem("RR Display status:");
this->listElement->addItem(RETROStatusItem);
}
waferCordsItem =
new tsl::elm::ListItem("Wafer Position:");
this->listElement->addItem(waferCordsItem);
this->listElement->addItem(
new tsl::elm::CategoryHeader("Credits")
@@ -227,11 +258,11 @@ std::string AboutGui::formatRamModule() {
case 4: return "HM-MGCH 6GB";
case 7: return "HM-MGXX 8GB";
case 1: return "NLE";
case 2: return "WT:C";
case 1: return "NLE 4GB";
case 2: return "WT:C 4GB";
case 3:
case 5 ... 6: return "NEE";
case 5 ... 6: return "NEE 4GB";
case 8:
case 12: return "AM-MGCJ 4GB";
@@ -239,10 +270,10 @@ std::string AboutGui::formatRamModule() {
case 13: return "AM-MGCJ 8GB";
case 10:
case 14: return "NME";
case 14: return "NME 4GB";
case 11:
case 15: return "WT:E";
case 15: return "WT:E 4GB";
case 17:
case 19:
@@ -254,11 +285,11 @@ std::string AboutGui::formatRamModule() {
case 20 ... 22: return "AB-MGCL 4GB";
case 25 ... 27: return "WT:F";
case 25 ... 27: return "WT:F 4GB";
case 29 ... 31: return "x267";
case 29 ... 31: return "x267 4GB";
case 32 ... 34: return "WT:B";
case 32 ... 34: return "WT:B 4GB";
default: return "Unknown";
}
@@ -272,16 +303,37 @@ void AboutGui::update()
void AboutGui::refresh()
{
BaseMenuGui::refresh();
std::string ramModule = formatRamModule();
if (!this->context)
return;
// Format strings once per refresh
sprintf(strings[0], "%u/%u/%u", this->context->speedos[HorizonOCSpeedo_CPU], this->context->speedos[HorizonOCSpeedo_GPU], this->context->speedos[HorizonOCSpeedo_SOC]);
sprintf(strings[1], "%u/%u/%u", this->context->iddq[HorizonOCSpeedo_CPU], this->context->iddq[HorizonOCSpeedo_GPU], this->context->iddq[HorizonOCSpeedo_SOC]);
sprintf(strings[0], "%u/%u/%u", this->context->speedos[HocClkSpeedo_CPU], this->context->speedos[HocClkSpeedo_GPU], this->context->speedos[HocClkSpeedo_SOC]);
// This is how hekate does it
sprintf(strings[1], "%u/%u/%u", this->context->iddq[HocClkSpeedo_CPU], this->context->iddq[HocClkSpeedo_GPU], this->context->iddq[HocClkSpeedo_SOC]);
SpeedoItem->setValue(strings[0]);
IddqItem->setValue(strings[1]);
DramModule->setValue(formatRamModule());
sysdockStatusItem->setValue(this->context->isSysDockInstalled ? "Installed" : "Not Installed");
if(!IsHoag())
sysdockStatusItem->setValue(this->context->isSysDockInstalled ? "Installed" : "Not Installed");
saltyNXStatusItem->setValue(this->context->isSaltyNXInstalled ? "Installed" : "Not Installed");
if(IsHoag())
RETROStatusItem->setValue(this->context->isUsingRetroSuper ? "Installed" : "Not Installed");
sprintf(strings[2], "X: %u Y: %u", this->context->waferX, this->context->waferY);
waferCordsItem->setValue(strings[2]);
if(IsErista()) {
u32 millis = context->temps[HocClkThermalSensor_PLLX];
sprintf(strings[3], "%u.%u", millis / 1000U, (millis % 1000U) / 100U);
eristaPLLXItem->setValue(strings[3]);
}
sprintf(strings[4], "%u.%u / %u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U, context->voltages[HocClkVoltage_EMCVDDQ] / 1000);
ramVoltItem->setValue(strings[4]);
sprintf(strings[5], "%u.%u mV", context->voltages[HocClkVoltage_Display] / 1000U, (context->voltages[HocClkVoltage_Display] % 1000U) / 100U);
dispVoltItem->setValue(strings[5]);
}

Some files were not shown because too many files have changed in this diff Show More