Compare commits
577 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
530588a818 | ||
|
|
a6402bd5d5 | ||
|
|
cd3d29ce88 | ||
|
|
192b70dae4 | ||
|
|
aaa9f90794 | ||
|
|
d5e38b0eb3 | ||
|
|
3704d46136 | ||
|
|
b374117c37 | ||
|
|
c9c5d08919 | ||
|
|
c963dd8369 | ||
|
|
7fc9682de0 | ||
|
|
0c555f34c3 | ||
|
|
fb37d5f0e7 | ||
|
|
a7619c39d2 | ||
|
|
55b97156ce | ||
|
|
37ad65e768 | ||
|
|
3b4877b287 | ||
|
|
01d79aab30 | ||
|
|
3bb7b4cbd5 | ||
|
|
9c16f8b2b8 | ||
|
|
78112547b6 | ||
|
|
3c7a42b033 | ||
|
|
203587523a | ||
|
|
07d0824c55 | ||
|
|
f1eab00ce1 | ||
|
|
6a851d4095 | ||
|
|
822e9f2817 | ||
|
|
55b3a4230c | ||
|
|
be61b9df0e | ||
|
|
6c8d429c64 | ||
|
|
aa95f526b8 | ||
|
|
638ddb499c | ||
|
|
c95b6fde88 | ||
|
|
2dd726723e | ||
|
|
119f49a3a4 | ||
|
|
51f935c252 | ||
|
|
e1003520eb | ||
|
|
3b5185df8d | ||
|
|
26c1dd1f99 | ||
|
|
819913ffd9 | ||
|
|
923bd0c0ba | ||
|
|
185e5bcf31 | ||
|
|
d1ef905ac5 | ||
|
|
fad9b5be50 | ||
|
|
c6424403b3 | ||
|
|
2b23498285 | ||
|
|
c7db7a7632 | ||
|
|
985ecdc980 | ||
|
|
e1d75f0084 | ||
|
|
f276ca0187 | ||
|
|
ae39b1b1bd | ||
|
|
9321aed1d1 | ||
|
|
756c44ba82 | ||
|
|
037f011c9b | ||
|
|
d2a46e1202 | ||
|
|
976f133c97 | ||
|
|
accdf6dc34 | ||
|
|
b417099a4a | ||
|
|
b7440a38a5 | ||
|
|
6369382de1 | ||
|
|
65db0b4989 | ||
|
|
19b29b97e1 | ||
|
|
ec230e35d0 | ||
|
|
5942cfd68d | ||
|
|
66d0109a9a | ||
|
|
6334603f9e | ||
|
|
5d12c1721a | ||
|
|
7e42394894 | ||
|
|
07dd65eebf | ||
|
|
ca8bb25660 | ||
|
|
90e53b52b2 | ||
|
|
c6cd863526 | ||
|
|
24eb3b1208 | ||
|
|
9a6282af9c | ||
|
|
5de030c4e9 | ||
|
|
dc63dfdca2 | ||
|
|
803a838b35 | ||
|
|
5b284db5ae | ||
|
|
861ee85289 | ||
|
|
521e3c22dd | ||
|
|
78798a1cce | ||
|
|
44d417fb89 | ||
|
|
8faaaa58d9 | ||
|
|
df0969ba6f | ||
|
|
646f8b8d69 | ||
|
|
456684152a | ||
|
|
a606a878ee | ||
|
|
75531e6c4f | ||
|
|
fa7313c495 | ||
|
|
5816d49f68 | ||
|
|
589c41d8e5 | ||
|
|
b35971e265 | ||
|
|
1d3836fcbb | ||
|
|
e515df84a5 | ||
|
|
901cb15191 | ||
|
|
aaa00ca3d0 | ||
|
|
1f449af24f | ||
|
|
cb810367b8 | ||
|
|
27cd40a7e8 | ||
|
|
75480ffdb5 | ||
|
|
d3ee7c2976 | ||
|
|
3e5cec375d | ||
|
|
280392158e | ||
|
|
a8d47ae8c8 | ||
|
|
eb6364f994 | ||
|
|
59ba05332f | ||
|
|
fc203c723c | ||
|
|
5f427ec24d | ||
|
|
cf891190cd | ||
|
|
3411959537 | ||
|
|
cce2069a32 | ||
|
|
485aa83de5 | ||
|
|
52e8f5c584 | ||
|
|
234fb1655c | ||
|
|
78a52df596 | ||
|
|
8bffe2dfc1 | ||
|
|
064ecc6d25 | ||
|
|
2d5ba3a841 | ||
|
|
3b2de89d2f | ||
|
|
b959ee864b | ||
|
|
5f2d7a68a9 | ||
|
|
554b66e25f | ||
|
|
e20bafd6ab | ||
|
|
dc2252a7c6 | ||
|
|
80fa802e88 | ||
|
|
944c1ef1f2 | ||
|
|
da0806df5d | ||
|
|
eda88210a9 | ||
|
|
bb1ae1d816 | ||
|
|
0a2a4cbd6b | ||
|
|
2607034b7a | ||
|
|
5da2ec11db | ||
|
|
46d7b4e5fe | ||
|
|
4358df0308 | ||
|
|
4103777f48 | ||
|
|
bf17e53c8f | ||
|
|
8f6a5eee28 | ||
|
|
6d0de115eb | ||
|
|
1f2999df2f | ||
|
|
1f2b3848e4 | ||
|
|
955d009f54 | ||
|
|
6607c287db | ||
|
|
ce99462081 | ||
|
|
91c12b9128 | ||
|
|
99e5cfc97e | ||
|
|
ec661ac1c0 | ||
|
|
1de73c4b74 | ||
|
|
8a3b6f9775 | ||
|
|
7f0f743f47 | ||
|
|
5a0ae8da5b | ||
|
|
77fddda8a9 | ||
|
|
2828687a18 | ||
|
|
0c1f9e661c | ||
|
|
52aa25b212 | ||
|
|
3e98704a93 | ||
|
|
4a7277d8bd | ||
|
|
143de18f3a | ||
|
|
8626854d10 | ||
|
|
6bd3ba7b3d | ||
|
|
bc06d65b72 | ||
|
|
7045332ef2 | ||
|
|
35bc76074c | ||
|
|
cdb725dc86 | ||
|
|
215ccf9001 | ||
|
|
ec21e47b53 | ||
|
|
17e27ad6e9 | ||
|
|
7489a861f6 | ||
|
|
ef65b4dea9 | ||
|
|
0829cc8545 | ||
|
|
5fb0899bb8 | ||
|
|
c17d5a3999 | ||
|
|
42045c5c88 | ||
|
|
6e6f7b4f9f | ||
|
|
0496839500 | ||
|
|
87911b8b9e | ||
|
|
d3c441f8ca | ||
|
|
af6b347762 | ||
|
|
96b6459282 | ||
|
|
371577954b | ||
|
|
6bdb79fc15 | ||
|
|
e625e4251a | ||
|
|
5d7a77074b | ||
|
|
3b907d3ca0 | ||
|
|
a697cac43c | ||
|
|
3d5147a6e2 | ||
|
|
f46d0a714b | ||
|
|
3896c89a5c | ||
|
|
dd645bb352 | ||
|
|
9afd3d44bd | ||
|
|
5db6ac9f25 | ||
|
|
95930746d2 | ||
|
|
81e6fb9699 | ||
|
|
8b9fbdf13d | ||
|
|
901ab93e58 | ||
|
|
eb75fb2274 | ||
|
|
dab17f527e | ||
|
|
aabff0e948 | ||
|
|
610bf9ad82 | ||
|
|
1a42ad1a67 | ||
|
|
71f31e8f6a | ||
|
|
d6bf10d113 | ||
|
|
decd02b564 | ||
|
|
3b681f8c90 | ||
|
|
95e68bd27e | ||
|
|
dfd5af7e80 | ||
|
|
0afef60198 | ||
|
|
714eebb889 | ||
|
|
a5f58bfb3a | ||
|
|
c29d6244a4 | ||
|
|
130f9101a2 | ||
|
|
308f39694c | ||
|
|
9e916b5d0f | ||
|
|
c2610472ce | ||
|
|
2dbd436307 | ||
|
|
d525991beb | ||
|
|
b3ff426bfe | ||
|
|
958ca0530d | ||
|
|
981874a450 | ||
|
|
4502dc6fdb | ||
|
|
cc78b6193a | ||
|
|
327d64f22d | ||
|
|
c36052d477 | ||
|
|
bc9c30de56 | ||
|
|
e1c3a7d018 | ||
|
|
179aee88af | ||
|
|
df4a59c269 | ||
|
|
4d389cda63 | ||
|
|
ae56a85811 | ||
|
|
3e75bd5b95 | ||
|
|
2454afd58f | ||
|
|
7244093f21 | ||
|
|
52894e4c93 | ||
|
|
4e0b54c1a8 | ||
|
|
b5876ede0e | ||
|
|
9558fd67bb | ||
|
|
59b62a835b | ||
|
|
ad6847ec59 | ||
|
|
061c255978 | ||
|
|
bb44d0907d | ||
|
|
2215b17a54 | ||
|
|
cc52eab3f6 | ||
|
|
155a4ce50a | ||
|
|
17739377bd | ||
|
|
782fae1624 | ||
|
|
59ca1f18d6 | ||
|
|
c6cda6eb30 | ||
|
|
9f3c5d8de6 | ||
|
|
e4c9ac6ee3 | ||
|
|
5d6500523b | ||
|
|
b111ccabb5 | ||
|
|
b90a67aa43 | ||
|
|
9ed72839f4 | ||
|
|
b8f50da45f | ||
|
|
1e4dada672 | ||
|
|
a943d14807 | ||
|
|
2cf437ff34 | ||
|
|
7cbccbbb5b | ||
|
|
f79af5b6f7 | ||
|
|
05af1d04ff | ||
|
|
2753646f06 | ||
|
|
2b3889c897 | ||
|
|
e01e346dea | ||
|
|
7735037ad9 | ||
|
|
b2bcd5fc3a | ||
|
|
a40ea357db | ||
|
|
7434c22772 | ||
|
|
f0eb25b88c | ||
|
|
7ec9827db5 | ||
|
|
eeca31c92e | ||
|
|
2cd736035c | ||
|
|
bc99616e43 | ||
|
|
732f27fcf6 | ||
|
|
54e8465e47 | ||
|
|
7ceb02c001 | ||
|
|
2450a348f1 | ||
|
|
7bd469939e | ||
|
|
89180359c0 | ||
|
|
4259ace5c4 | ||
|
|
d7e5c38a62 | ||
|
|
b601105998 | ||
|
|
ca07d0716f | ||
|
|
eb16df3450 | ||
|
|
b44684760d | ||
|
|
be3fc1bb84 | ||
|
|
e781e67b43 | ||
|
|
40800ffe4b | ||
|
|
4e704e59e8 | ||
|
|
06e5d5e3d1 | ||
|
|
06010d7cd6 | ||
|
|
2549cd9a71 | ||
|
|
e89e35436e | ||
|
|
f5029ee3e9 | ||
|
|
08a84e0a8b | ||
|
|
36c819de04 | ||
|
|
f62987af4b | ||
|
|
8d9b44d6ec | ||
|
|
a5babb722d | ||
|
|
bde65f094d | ||
|
|
3fa2cfabd3 | ||
|
|
b8f4d02e4f | ||
|
|
436b7feb8e | ||
|
|
8bab4dd6ee | ||
|
|
99dfea631b | ||
|
|
16501bd6a8 | ||
|
|
88201b7308 | ||
|
|
2fb680b06a | ||
|
|
fb8116107b | ||
|
|
e6b83a1db5 | ||
|
|
607a19048b | ||
|
|
0db831e0c3 | ||
|
|
863cca507d | ||
|
|
3916a252d4 | ||
|
|
1594b76851 | ||
|
|
9e14fc5241 | ||
|
|
54fd3e2fd1 | ||
|
|
2348f8dba2 | ||
|
|
f0a3dc48f9 | ||
|
|
58ad43213b | ||
|
|
4a505b7238 | ||
|
|
7c6c0e68d2 | ||
|
|
1c5b22710d | ||
|
|
75755528b1 | ||
|
|
4dadcaf574 | ||
|
|
5a88d53443 | ||
|
|
2bd5faa7d9 | ||
|
|
29cb868f50 | ||
|
|
4eb222f5aa | ||
|
|
eca6ab2297 | ||
|
|
749e5147df | ||
|
|
55e84d0051 | ||
|
|
8cd9727429 | ||
|
|
660e839bed | ||
|
|
afb16d2045 | ||
|
|
f4b025f33c | ||
|
|
e03c3b7be0 | ||
|
|
5a2ba5f785 | ||
|
|
e1463dca05 | ||
|
|
82972127a1 | ||
|
|
272eaed351 | ||
|
|
989e67daac | ||
|
|
dcec618ae9 | ||
|
|
bc12388b6d | ||
|
|
6625488180 | ||
|
|
1209337af6 | ||
|
|
0f608b1702 | ||
|
|
cf547d517b | ||
|
|
8c75c68dca | ||
|
|
ab020c0a90 | ||
|
|
44dc402b54 | ||
|
|
a1d047f48d | ||
|
|
cbed5e11ab | ||
|
|
1ad3f6c441 | ||
|
|
820a26ba2a | ||
|
|
f0952119b6 | ||
|
|
ca5ddbd779 | ||
|
|
be49a27118 | ||
|
|
190353dc11 | ||
|
|
4a1772df77 | ||
|
|
460d1b8471 | ||
|
|
2493c798bc | ||
|
|
7525baf567 | ||
|
|
3f9a5f61fb | ||
|
|
b9156d6861 | ||
|
|
5d59be7b77 | ||
|
|
dd4c5a8732 | ||
|
|
837543fb0f | ||
|
|
03ede8f171 | ||
|
|
078d8164fc | ||
|
|
ceff8a083e | ||
|
|
b32efcc177 | ||
|
|
d57fccc463 | ||
|
|
26cf028f2d | ||
|
|
6e80c9a75f | ||
|
|
42bdfb55f2 | ||
|
|
e0967a9fd6 | ||
|
|
2406ce4f86 | ||
|
|
3b40a4a3e5 | ||
|
|
38c408dde6 | ||
|
|
5e62eb3f5d | ||
|
|
b4b5599ed2 | ||
|
|
b4917f3e1a | ||
|
|
e6b4cb6612 | ||
|
|
b1ca62ce61 | ||
|
|
243f614887 | ||
|
|
a8577378f6 | ||
|
|
564703b7c5 | ||
|
|
5ef56bed25 | ||
|
|
afddb963a9 | ||
|
|
aa72176196 | ||
|
|
7af0721847 | ||
|
|
2a6320e646 | ||
|
|
fc212bb419 | ||
|
|
14e0053335 | ||
|
|
8f28daceef | ||
|
|
f1044673d0 | ||
|
|
61a0ebffee | ||
|
|
8de8f4013e | ||
|
|
dd447553d4 | ||
|
|
11c456e00c | ||
|
|
5efb4bdd6b | ||
|
|
e331f1249b | ||
|
|
786467d7ea | ||
|
|
496e77301b | ||
|
|
d657f1d156 | ||
|
|
7ab5c2f540 | ||
|
|
71900721cf | ||
|
|
0bc9547701 | ||
|
|
96ac254022 | ||
|
|
92f378a80f | ||
|
|
589af01ad8 | ||
|
|
e7f14b88e5 | ||
|
|
35a269e4a7 | ||
|
|
ff95ca527f | ||
|
|
550e4e5204 | ||
|
|
a088c4795a | ||
|
|
e8a264fa11 | ||
|
|
de681c20a0 | ||
|
|
22aef264ab | ||
|
|
309717c468 | ||
|
|
9b91d7487c | ||
|
|
c0b458243c | ||
|
|
7d9c60cdfe | ||
|
|
12c9effec2 | ||
|
|
6eeab63075 | ||
|
|
2d81c5e127 | ||
|
|
b1739cea74 | ||
|
|
aa607ab1a7 | ||
|
|
d1242a17d4 | ||
|
|
80701c2891 | ||
|
|
cfd0d84ac8 | ||
|
|
c33aabdc84 | ||
|
|
c70fd82e60 | ||
|
|
574c248d68 | ||
|
|
ebcf07dab8 | ||
|
|
d170ca92ad | ||
|
|
cab8a14b99 | ||
|
|
b623dabce5 | ||
|
|
e5eb49f2e5 | ||
|
|
9f0a609735 | ||
|
|
19a2e562bc | ||
|
|
73c3311251 | ||
|
|
eb7fca1c1a | ||
|
|
ad1f070a6b | ||
|
|
0ae65c8740 | ||
|
|
39fbe25afc | ||
|
|
3bad144280 | ||
|
|
123d4b6080 | ||
|
|
2f6ed69b92 | ||
|
|
337f7e6ac0 | ||
|
|
a5efa7ae72 | ||
|
|
a8ee389681 | ||
|
|
54554bacea | ||
|
|
3da2fc4b6d | ||
|
|
83287b1f5c | ||
|
|
4f6756c609 | ||
|
|
ef2434c457 | ||
|
|
b0237a2042 | ||
|
|
c6275eb977 | ||
|
|
72961aa2f1 | ||
|
|
9c60697344 | ||
|
|
f786d97de1 | ||
|
|
20389043ac | ||
|
|
00b9d8550e | ||
|
|
0c0a4b3d6b | ||
|
|
61fd9d74d3 | ||
|
|
f36383d0e7 | ||
|
|
606cafbaad | ||
|
|
cff4267a68 | ||
|
|
65e7d83972 | ||
|
|
e2533e2bb0 | ||
|
|
0d4ca24538 | ||
|
|
6c94f5754c | ||
|
|
aaf77997e1 | ||
|
|
c933e02aed | ||
|
|
770c25dbcb | ||
|
|
bf8a6c4785 | ||
|
|
dbb4d698a0 | ||
|
|
6ae084433f | ||
|
|
32f19c4f0e | ||
|
|
05cf2ab4dd | ||
|
|
13a4ea4ca0 | ||
|
|
e2ef52e095 | ||
|
|
bbd3b1a0fc | ||
|
|
8dcfb55646 | ||
|
|
ae0f4c7963 | ||
|
|
222db76200 | ||
|
|
2376b85d3a | ||
|
|
26fb76e448 | ||
|
|
159c7567c0 | ||
|
|
39366ce238 | ||
|
|
da631ad268 | ||
|
|
d508177d4b | ||
|
|
d8527410de | ||
|
|
bae7216de0 | ||
|
|
b3ddf172e8 | ||
|
|
cdaea8f729 | ||
|
|
918ca5757c | ||
|
|
93cb0e99c4 | ||
|
|
4692529346 | ||
|
|
8de1191ed5 | ||
|
|
1c21187f73 | ||
|
|
2646995b72 | ||
|
|
cf21342b2e | ||
|
|
3709fb3fba | ||
|
|
ea754707ee | ||
|
|
bb96267d6c | ||
|
|
a1fa16da3c | ||
|
|
aad126d611 | ||
|
|
835189febc | ||
|
|
a9cf59fe28 | ||
|
|
7708e4bae6 | ||
|
|
8c71227c63 | ||
|
|
627732326b | ||
|
|
f5d9761853 | ||
|
|
1d219e9425 | ||
|
|
2c14ddad5c | ||
|
|
fee7e7a4f4 | ||
|
|
caeee5920b | ||
|
|
71fbeef32a | ||
|
|
86fce20b27 | ||
|
|
5012836c7e | ||
|
|
af1c36d00a | ||
|
|
5dca0a9d9b | ||
|
|
d3b1e9d31d | ||
|
|
64301c6d33 | ||
|
|
9b4544856e | ||
|
|
d8104bfc6f | ||
|
|
39e666599d | ||
|
|
d3ff7857e7 | ||
|
|
662473b2c0 | ||
|
|
051c637dd8 | ||
|
|
28a772c546 | ||
|
|
4a06176897 | ||
|
|
7325905476 | ||
|
|
ed8eed2c57 | ||
|
|
9723fdc2e0 | ||
|
|
2856f6f778 | ||
|
|
4187daf029 | ||
|
|
c479f9c53c | ||
|
|
a5357e298a | ||
|
|
045bd81887 | ||
|
|
ae22e70602 | ||
|
|
12e6f114a8 | ||
|
|
d6fec8bdaa | ||
|
|
5a8a9ae79d | ||
|
|
6d0399f352 | ||
|
|
382f6d5834 | ||
|
|
679fd4fd79 | ||
|
|
c4a59d72b7 | ||
|
|
cc2f58f1d7 | ||
|
|
9b1d2aecbb | ||
|
|
b08dd6c60d | ||
|
|
2508cbfd16 | ||
|
|
f1a5804b6c | ||
|
|
e928eda703 | ||
|
|
cb75e79607 | ||
|
|
66d3347771 | ||
|
|
1e6d080361 | ||
|
|
0ddb5bb828 | ||
|
|
abcf11dc51 | ||
|
|
1606b0af11 | ||
|
|
2060fbe86d | ||
|
|
2f8cc92e43 | ||
|
|
b51b8dbbcd | ||
|
|
ccb446b1ab | ||
|
|
62b77e4a82 | ||
|
|
e078bdb2f8 | ||
|
|
a23db6e63d | ||
|
|
b8faa12495 | ||
|
|
1cb739ccdc | ||
|
|
5bf85f7e86 | ||
|
|
73498b871e | ||
|
|
94c8a0fd00 | ||
|
|
26979fdd43 | ||
|
|
b446ba5d80 | ||
|
|
c4a450e58d | ||
|
|
b7b6153f6e |
176
.github/workflows/build.yml
vendored
Normal file
176
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
name: Build Horizon OC Zeus
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop, main, master ]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Minimal devkitA64 container
|
||||
container:
|
||||
image: devkitpro/devkita64:20251231
|
||||
|
||||
steps:
|
||||
- name: Checkout repository and submodules # needed for hoc-clk
|
||||
uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Fix PATH for devkitA64 and devkitARM
|
||||
# -------------------------------------------------
|
||||
- name: Set devkitPro PATH
|
||||
run: |
|
||||
echo "DEVKITPRO=/opt/devkitpro" >> $GITHUB_ENV
|
||||
echo "DEVKITA64=/opt/devkitpro/devkitA64" >> $GITHUB_ENV
|
||||
echo "DEVKITARM=/opt/devkitpro/devkitARM" >> $GITHUB_ENV
|
||||
echo "PATH=/opt/devkitpro/devkitA64/bin:/opt/devkitpro/devkitARM/bin:$PATH" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Check devkitPro gcc and g++ versions
|
||||
run: |
|
||||
aarch64-none-elf-gcc --version
|
||||
aarch64-none-elf-g++ --version
|
||||
shell: bash # is this even needed? but for consistency let's keep using it
|
||||
|
||||
- name: Install ccache
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y ccache
|
||||
shell: bash
|
||||
|
||||
# -------------------------------------------------
|
||||
# Get short commit SHA
|
||||
# -------------------------------------------------
|
||||
- name: Set commit SHA & dist
|
||||
id: vars
|
||||
run: |
|
||||
echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
|
||||
echo $SHORT_SHA > dist/.commit
|
||||
echo $GITHUB_SHA >> dist/.commit
|
||||
|
||||
- name: Clone Libnx
|
||||
run: git clone https://github.com/switchbrew/libnx.git
|
||||
|
||||
- name: Clone Atmosphere
|
||||
run: git clone --depth=1 --single-branch https://github.com/Atmosphere-NX/Atmosphere.git atmosphere -b $(cat ams_ver.txt)
|
||||
|
||||
- name: Prepare build folder
|
||||
run: |
|
||||
mkdir -p build
|
||||
cp -r atmosphere/* build/
|
||||
|
||||
- name: Override ldr_process_creation.cpp
|
||||
run: |
|
||||
cp -rf Source/Atmosphere/stratosphere/loader/source/* build/stratosphere/loader/source/
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v5.0.3
|
||||
with:
|
||||
path: /root/.cache/ccache
|
||||
key: ccache-${{ runner.os }}-devkitpro-ams-${{ hashFiles('ams_ver.txt') }} # last key was utter garbage, stick to ams versions,
|
||||
restore-keys: |
|
||||
ccache-${{ runner.os }}-devkitpro-
|
||||
|
||||
- name: Configure ccache
|
||||
run: |
|
||||
export CCACHE_DIR=/root/.cache/ccache
|
||||
echo "CCACHE_DIR=/root/.cache/ccache" >> $GITHUB_ENV
|
||||
ccache --set-config=max_size=10G
|
||||
ccache --set-config=compiler_check=content
|
||||
ccache --zero-stats
|
||||
|
||||
- name: Build Libnx
|
||||
shell: bash
|
||||
run: |
|
||||
export CC="ccache aarch64-none-elf-gcc"
|
||||
export CXX="ccache aarch64-none-elf-g++"
|
||||
pushd libnx
|
||||
make -j$(($(nproc) * 4)) install CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
popd
|
||||
|
||||
- name: Build hoc-clk sysmodule and overlay
|
||||
shell: bash
|
||||
run: |
|
||||
export CC="ccache aarch64-none-elf-gcc"
|
||||
export CXX="ccache aarch64-none-elf-g++"
|
||||
|
||||
ROOT_DIR="$GITHUB_WORKSPACE/Source/hoc-clk"
|
||||
DIST_DIR="$ROOT_DIR/dist"
|
||||
|
||||
mkdir -p "$DIST_DIR"
|
||||
|
||||
echo "*** sysmodule ***"
|
||||
|
||||
TITLE_ID="$(grep -oP '"title_id":\s*"0x\K(\w+)' \
|
||||
"$ROOT_DIR/sysmodule/perms.json")"
|
||||
|
||||
echo "TITLE_ID: $TITLE_ID"
|
||||
|
||||
pushd "$ROOT_DIR/sysmodule"
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
make -j$(($(nproc) * 2)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
popd
|
||||
|
||||
mkdir -p "$DIST_DIR/atmosphere/contents/$TITLE_ID/flags"
|
||||
|
||||
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"
|
||||
|
||||
echo "*** overlay ***"
|
||||
|
||||
pushd "$ROOT_DIR/overlay"
|
||||
make -j$(($(nproc) * 2)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
popd
|
||||
|
||||
mkdir -p "$DIST_DIR/switch/.overlays"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/overlay/out/horizon-oc-overlay.ovl" \
|
||||
"$DIST_DIR/switch/.overlays/horizon-oc-overlay.ovl"
|
||||
|
||||
echo "*** assets ***"
|
||||
|
||||
mkdir -p "$DIST_DIR/config/horizon-oc"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/config.ini.template" \
|
||||
"$DIST_DIR/config/horizon-oc/config.ini.template"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/README.md" \
|
||||
"$DIST_DIR/README.md"
|
||||
|
||||
- name: Build kip
|
||||
working-directory: build/stratosphere/loader
|
||||
run: |
|
||||
export CC="ccache aarch64-none-elf-gcc"
|
||||
export CXX="ccache aarch64-none-elf-g++"
|
||||
make -j$(($(nproc) * 4)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
hactool -t kip1 out/nintendo_nx_arm64_armv8a/release/loader.kip --uncompress=hoc.kip
|
||||
cp hoc.kip ../../../dist/atmosphere/kips/hoc.kip
|
||||
|
||||
- name: ccache stats
|
||||
run: ccache --show-stats
|
||||
|
||||
# -------------------------------------------------
|
||||
# Upload ZIP artifact
|
||||
# -------------------------------------------------
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: horizon-oc-zeus-dist
|
||||
path: dist/
|
||||
compression-level: 3
|
||||
42
.github/workflows/static.yml
vendored
Normal file
42
.github/workflows/static.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# Simple workflow for deploying static content to GitHub Pages
|
||||
name: Deploy static content to Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["master"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow one concurrent deployment
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v2
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
# Upload entire repository
|
||||
path: './pages/dist'
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
*.DS_Store
|
||||
.vscode/
|
||||
dist/
|
||||
.pyc
|
||||
build/
|
||||
__pycache__/
|
||||
|
||||
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,6 +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
|
||||
branch = main
|
||||
[submodule "Source/hoc-clk/overlay/lib/libultrahand"]
|
||||
path = Source/hoc-clk/overlay/lib/libultrahand
|
||||
url = https://github.com/ppkantorski/libultrahand
|
||||
branch = main
|
||||
|
||||
@@ -1,967 +0,0 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
SetRegisterAllowed(0x0);
|
||||
SetRegisterAllowed(0x4);
|
||||
SetRegisterAllowed(0x8);
|
||||
SetRegisterAllowed(0xC);
|
||||
SetRegisterAllowed(0x10);
|
||||
SetRegisterAllowed(0x14);
|
||||
SetRegisterAllowed(0x18);
|
||||
SetRegisterAllowed(0x1C);
|
||||
SetRegisterAllowed(0x20);
|
||||
SetRegisterAllowed(0x24);
|
||||
SetRegisterAllowed(0x28);
|
||||
SetRegisterAllowed(0x2C);
|
||||
SetRegisterAllowed(0x30);
|
||||
SetRegisterAllowed(0x34);
|
||||
SetRegisterAllowed(0x38);
|
||||
SetRegisterAllowed(0x3C);
|
||||
SetRegisterAllowed(0x40);
|
||||
SetRegisterAllowed(0x44);
|
||||
SetRegisterAllowed(0x48);
|
||||
SetRegisterAllowed(0x4C);
|
||||
SetRegisterAllowed(0x50);
|
||||
SetRegisterAllowed(0x54);
|
||||
SetRegisterAllowed(0x58);
|
||||
SetRegisterAllowed(0x5C);
|
||||
SetRegisterAllowed(0x60);
|
||||
SetRegisterAllowed(0x64);
|
||||
SetRegisterAllowed(0x68);
|
||||
SetRegisterAllowed(0x6C);
|
||||
SetRegisterAllowed(0x70);
|
||||
SetRegisterAllowed(0x74);
|
||||
SetRegisterAllowed(0x78);
|
||||
SetRegisterAllowed(0x7C);
|
||||
SetRegisterAllowed(0x80);
|
||||
SetRegisterAllowed(0x84);
|
||||
SetRegisterAllowed(0x88);
|
||||
SetRegisterAllowed(0x8C);
|
||||
SetRegisterAllowed(0x90);
|
||||
SetRegisterAllowed(0x94);
|
||||
SetRegisterAllowed(0x98);
|
||||
SetRegisterAllowed(0x9C);
|
||||
SetRegisterAllowed(0xA0);
|
||||
SetRegisterAllowed(0xA4);
|
||||
SetRegisterAllowed(0xA8);
|
||||
SetRegisterAllowed(0xAC);
|
||||
SetRegisterAllowed(0xB0);
|
||||
SetRegisterAllowed(0xB4);
|
||||
SetRegisterAllowed(0xB8);
|
||||
SetRegisterAllowed(0xBC);
|
||||
SetRegisterAllowed(0xC0);
|
||||
SetRegisterAllowed(0xC4);
|
||||
SetRegisterAllowed(0xC8);
|
||||
SetRegisterAllowed(0xCC);
|
||||
SetRegisterAllowed(0xD0);
|
||||
SetRegisterAllowed(0xD4);
|
||||
SetRegisterAllowed(0xD8);
|
||||
SetRegisterAllowed(0xDC);
|
||||
SetRegisterAllowed(0xE0);
|
||||
SetRegisterAllowed(0xE4);
|
||||
SetRegisterAllowed(0xE8);
|
||||
SetRegisterAllowed(0xEC);
|
||||
SetRegisterAllowed(0xF0);
|
||||
SetRegisterAllowed(0xF4);
|
||||
SetRegisterAllowed(0xF8);
|
||||
SetRegisterAllowed(0xFC);
|
||||
SetRegisterAllowed(0x100);
|
||||
SetRegisterAllowed(0x104);
|
||||
SetRegisterAllowed(0x108);
|
||||
SetRegisterAllowed(0x10C);
|
||||
SetRegisterAllowed(0x110);
|
||||
SetRegisterAllowed(0x114);
|
||||
SetRegisterAllowed(0x118);
|
||||
SetRegisterAllowed(0x11C);
|
||||
SetRegisterAllowed(0x120);
|
||||
SetRegisterAllowed(0x124);
|
||||
SetRegisterAllowed(0x128);
|
||||
SetRegisterAllowed(0x12C);
|
||||
SetRegisterAllowed(0x130);
|
||||
SetRegisterAllowed(0x134);
|
||||
SetRegisterAllowed(0x138);
|
||||
SetRegisterAllowed(0x13C);
|
||||
SetRegisterAllowed(0x140);
|
||||
SetRegisterAllowed(0x144);
|
||||
SetRegisterAllowed(0x148);
|
||||
SetRegisterAllowed(0x14C);
|
||||
SetRegisterAllowed(0x150);
|
||||
SetRegisterAllowed(0x154);
|
||||
SetRegisterAllowed(0x158);
|
||||
SetRegisterAllowed(0x15C);
|
||||
SetRegisterAllowed(0x160);
|
||||
SetRegisterAllowed(0x164);
|
||||
SetRegisterAllowed(0x168);
|
||||
SetRegisterAllowed(0x16C);
|
||||
SetRegisterAllowed(0x170);
|
||||
SetRegisterAllowed(0x174);
|
||||
SetRegisterAllowed(0x178);
|
||||
SetRegisterAllowed(0x17C);
|
||||
SetRegisterAllowed(0x180);
|
||||
SetRegisterAllowed(0x184);
|
||||
SetRegisterAllowed(0x188);
|
||||
SetRegisterAllowed(0x18C);
|
||||
SetRegisterAllowed(0x190);
|
||||
SetRegisterAllowed(0x194);
|
||||
SetRegisterAllowed(0x198);
|
||||
SetRegisterAllowed(0x19C);
|
||||
SetRegisterAllowed(0x1A0);
|
||||
SetRegisterAllowed(0x1A4);
|
||||
SetRegisterAllowed(0x1A8);
|
||||
SetRegisterAllowed(0x1AC);
|
||||
SetRegisterAllowed(0x1B0);
|
||||
SetRegisterAllowed(0x1B4);
|
||||
SetRegisterAllowed(0x1B8);
|
||||
SetRegisterAllowed(0x1BC);
|
||||
SetRegisterAllowed(0x1C0);
|
||||
SetRegisterAllowed(0x1C4);
|
||||
SetRegisterAllowed(0x1C8);
|
||||
SetRegisterAllowed(0x1CC);
|
||||
SetRegisterAllowed(0x1D0);
|
||||
SetRegisterAllowed(0x1D4);
|
||||
SetRegisterAllowed(0x1D8);
|
||||
SetRegisterAllowed(0x1DC);
|
||||
SetRegisterAllowed(0x1E0);
|
||||
SetRegisterAllowed(0x1E4);
|
||||
SetRegisterAllowed(0x1E8);
|
||||
SetRegisterAllowed(0x1EC);
|
||||
SetRegisterAllowed(0x1F0);
|
||||
SetRegisterAllowed(0x1F4);
|
||||
SetRegisterAllowed(0x1F8);
|
||||
SetRegisterAllowed(0x1FC);
|
||||
SetRegisterAllowed(0x200);
|
||||
SetRegisterAllowed(0x204);
|
||||
SetRegisterAllowed(0x208);
|
||||
SetRegisterAllowed(0x20C);
|
||||
SetRegisterAllowed(0x210);
|
||||
SetRegisterAllowed(0x214);
|
||||
SetRegisterAllowed(0x218);
|
||||
SetRegisterAllowed(0x21C);
|
||||
SetRegisterAllowed(0x220);
|
||||
SetRegisterAllowed(0x224);
|
||||
SetRegisterAllowed(0x228);
|
||||
SetRegisterAllowed(0x22C);
|
||||
SetRegisterAllowed(0x230);
|
||||
SetRegisterAllowed(0x234);
|
||||
SetRegisterAllowed(0x238);
|
||||
SetRegisterAllowed(0x23C);
|
||||
SetRegisterAllowed(0x240);
|
||||
SetRegisterAllowed(0x244);
|
||||
SetRegisterAllowed(0x248);
|
||||
SetRegisterAllowed(0x24C);
|
||||
SetRegisterAllowed(0x250);
|
||||
SetRegisterAllowed(0x254);
|
||||
SetRegisterAllowed(0x258);
|
||||
SetRegisterAllowed(0x25C);
|
||||
SetRegisterAllowed(0x260);
|
||||
SetRegisterAllowed(0x264);
|
||||
SetRegisterAllowed(0x268);
|
||||
SetRegisterAllowed(0x26C);
|
||||
SetRegisterAllowed(0x270);
|
||||
SetRegisterAllowed(0x274);
|
||||
SetRegisterAllowed(0x278);
|
||||
SetRegisterAllowed(0x27C);
|
||||
SetRegisterAllowed(0x280);
|
||||
SetRegisterAllowed(0x284);
|
||||
SetRegisterAllowed(0x288);
|
||||
SetRegisterAllowed(0x28C);
|
||||
SetRegisterAllowed(0x290);
|
||||
SetRegisterAllowed(0x294);
|
||||
SetRegisterAllowed(0x298);
|
||||
SetRegisterAllowed(0x29C);
|
||||
SetRegisterAllowed(0x2A0);
|
||||
SetRegisterAllowed(0x2A4);
|
||||
SetRegisterAllowed(0x2A8);
|
||||
SetRegisterAllowed(0x2AC);
|
||||
SetRegisterAllowed(0x2B0);
|
||||
SetRegisterAllowed(0x2B4);
|
||||
SetRegisterAllowed(0x2B8);
|
||||
SetRegisterAllowed(0x2BC);
|
||||
SetRegisterAllowed(0x2C0);
|
||||
SetRegisterAllowed(0x2C4);
|
||||
SetRegisterAllowed(0x2C8);
|
||||
SetRegisterAllowed(0x2CC);
|
||||
SetRegisterAllowed(0x2D0);
|
||||
SetRegisterAllowed(0x2D4);
|
||||
SetRegisterAllowed(0x2D8);
|
||||
SetRegisterAllowed(0x2DC);
|
||||
SetRegisterAllowed(0x2E0);
|
||||
SetRegisterAllowed(0x2E4);
|
||||
SetRegisterAllowed(0x2E8);
|
||||
SetRegisterAllowed(0x2EC);
|
||||
SetRegisterAllowed(0x2F0);
|
||||
SetRegisterAllowed(0x2F4);
|
||||
SetRegisterAllowed(0x2F8);
|
||||
SetRegisterAllowed(0x2FC);
|
||||
SetRegisterAllowed(0x300);
|
||||
SetRegisterAllowed(0x304);
|
||||
SetRegisterAllowed(0x308);
|
||||
SetRegisterAllowed(0x30C);
|
||||
SetRegisterAllowed(0x310);
|
||||
SetRegisterAllowed(0x314);
|
||||
SetRegisterAllowed(0x318);
|
||||
SetRegisterAllowed(0x31C);
|
||||
SetRegisterAllowed(0x320);
|
||||
SetRegisterAllowed(0x324);
|
||||
SetRegisterAllowed(0x328);
|
||||
SetRegisterAllowed(0x32C);
|
||||
SetRegisterAllowed(0x330);
|
||||
SetRegisterAllowed(0x334);
|
||||
SetRegisterAllowed(0x338);
|
||||
SetRegisterAllowed(0x33C);
|
||||
SetRegisterAllowed(0x340);
|
||||
SetRegisterAllowed(0x344);
|
||||
SetRegisterAllowed(0x348);
|
||||
SetRegisterAllowed(0x34C);
|
||||
SetRegisterAllowed(0x350);
|
||||
SetRegisterAllowed(0x354);
|
||||
SetRegisterAllowed(0x358);
|
||||
SetRegisterAllowed(0x35C);
|
||||
SetRegisterAllowed(0x360);
|
||||
SetRegisterAllowed(0x364);
|
||||
SetRegisterAllowed(0x368);
|
||||
SetRegisterAllowed(0x36C);
|
||||
SetRegisterAllowed(0x370);
|
||||
SetRegisterAllowed(0x374);
|
||||
SetRegisterAllowed(0x378);
|
||||
SetRegisterAllowed(0x37C);
|
||||
SetRegisterAllowed(0x380);
|
||||
SetRegisterAllowed(0x384);
|
||||
SetRegisterAllowed(0x388);
|
||||
SetRegisterAllowed(0x38C);
|
||||
SetRegisterAllowed(0x390);
|
||||
SetRegisterAllowed(0x394);
|
||||
SetRegisterAllowed(0x398);
|
||||
SetRegisterAllowed(0x39C);
|
||||
SetRegisterAllowed(0x3A0);
|
||||
SetRegisterAllowed(0x3A4);
|
||||
SetRegisterAllowed(0x3A8);
|
||||
SetRegisterAllowed(0x3AC);
|
||||
SetRegisterAllowed(0x3B0);
|
||||
SetRegisterAllowed(0x3B4);
|
||||
SetRegisterAllowed(0x3B8);
|
||||
SetRegisterAllowed(0x3BC);
|
||||
SetRegisterAllowed(0x3C0);
|
||||
SetRegisterAllowed(0x3C4);
|
||||
SetRegisterAllowed(0x3C8);
|
||||
SetRegisterAllowed(0x3CC);
|
||||
SetRegisterAllowed(0x3D0);
|
||||
SetRegisterAllowed(0x3D4);
|
||||
SetRegisterAllowed(0x3D8);
|
||||
SetRegisterAllowed(0x3DC);
|
||||
SetRegisterAllowed(0x3E0);
|
||||
SetRegisterAllowed(0x3E4);
|
||||
SetRegisterAllowed(0x3E8);
|
||||
SetRegisterAllowed(0x3EC);
|
||||
SetRegisterAllowed(0x3F0);
|
||||
SetRegisterAllowed(0x3F4);
|
||||
SetRegisterAllowed(0x3F8);
|
||||
SetRegisterAllowed(0x3FC);
|
||||
SetRegisterAllowed(0x400);
|
||||
SetRegisterAllowed(0x404);
|
||||
SetRegisterAllowed(0x408);
|
||||
SetRegisterAllowed(0x40C);
|
||||
SetRegisterAllowed(0x410);
|
||||
SetRegisterAllowed(0x414);
|
||||
SetRegisterAllowed(0x418);
|
||||
SetRegisterAllowed(0x41C);
|
||||
SetRegisterAllowed(0x420);
|
||||
SetRegisterAllowed(0x424);
|
||||
SetRegisterAllowed(0x428);
|
||||
SetRegisterAllowed(0x42C);
|
||||
SetRegisterAllowed(0x430);
|
||||
SetRegisterAllowed(0x434);
|
||||
SetRegisterAllowed(0x438);
|
||||
SetRegisterAllowed(0x43C);
|
||||
SetRegisterAllowed(0x440);
|
||||
SetRegisterAllowed(0x444);
|
||||
SetRegisterAllowed(0x448);
|
||||
SetRegisterAllowed(0x44C);
|
||||
SetRegisterAllowed(0x450);
|
||||
SetRegisterAllowed(0x454);
|
||||
SetRegisterAllowed(0x458);
|
||||
SetRegisterAllowed(0x45C);
|
||||
SetRegisterAllowed(0x460);
|
||||
SetRegisterAllowed(0x464);
|
||||
SetRegisterAllowed(0x468);
|
||||
SetRegisterAllowed(0x46C);
|
||||
SetRegisterAllowed(0x470);
|
||||
SetRegisterAllowed(0x474);
|
||||
SetRegisterAllowed(0x478);
|
||||
SetRegisterAllowed(0x47C);
|
||||
SetRegisterAllowed(0x480);
|
||||
SetRegisterAllowed(0x484);
|
||||
SetRegisterAllowed(0x488);
|
||||
SetRegisterAllowed(0x48C);
|
||||
SetRegisterAllowed(0x490);
|
||||
SetRegisterAllowed(0x494);
|
||||
SetRegisterAllowed(0x498);
|
||||
SetRegisterAllowed(0x49C);
|
||||
SetRegisterAllowed(0x4A0);
|
||||
SetRegisterAllowed(0x4A4);
|
||||
SetRegisterAllowed(0x4A8);
|
||||
SetRegisterAllowed(0x4AC);
|
||||
SetRegisterAllowed(0x4B0);
|
||||
SetRegisterAllowed(0x4B4);
|
||||
SetRegisterAllowed(0x4B8);
|
||||
SetRegisterAllowed(0x4BC);
|
||||
SetRegisterAllowed(0x4C0);
|
||||
SetRegisterAllowed(0x4C4);
|
||||
SetRegisterAllowed(0x4C8);
|
||||
SetRegisterAllowed(0x4CC);
|
||||
SetRegisterAllowed(0x4D0);
|
||||
SetRegisterAllowed(0x4D4);
|
||||
SetRegisterAllowed(0x4D8);
|
||||
SetRegisterAllowed(0x4DC);
|
||||
SetRegisterAllowed(0x4E0);
|
||||
SetRegisterAllowed(0x4E4);
|
||||
SetRegisterAllowed(0x4E8);
|
||||
SetRegisterAllowed(0x4EC);
|
||||
SetRegisterAllowed(0x4F0);
|
||||
SetRegisterAllowed(0x4F4);
|
||||
SetRegisterAllowed(0x4F8);
|
||||
SetRegisterAllowed(0x4FC);
|
||||
SetRegisterAllowed(0x500);
|
||||
SetRegisterAllowed(0x504);
|
||||
SetRegisterAllowed(0x508);
|
||||
SetRegisterAllowed(0x50C);
|
||||
SetRegisterAllowed(0x510);
|
||||
SetRegisterAllowed(0x514);
|
||||
SetRegisterAllowed(0x518);
|
||||
SetRegisterAllowed(0x51C);
|
||||
SetRegisterAllowed(0x520);
|
||||
SetRegisterAllowed(0x524);
|
||||
SetRegisterAllowed(0x528);
|
||||
SetRegisterAllowed(0x52C);
|
||||
SetRegisterAllowed(0x530);
|
||||
SetRegisterAllowed(0x534);
|
||||
SetRegisterAllowed(0x538);
|
||||
SetRegisterAllowed(0x53C);
|
||||
SetRegisterAllowed(0x540);
|
||||
SetRegisterAllowed(0x544);
|
||||
SetRegisterAllowed(0x548);
|
||||
SetRegisterAllowed(0x54C);
|
||||
SetRegisterAllowed(0x550);
|
||||
SetRegisterAllowed(0x554);
|
||||
SetRegisterAllowed(0x558);
|
||||
SetRegisterAllowed(0x55C);
|
||||
SetRegisterAllowed(0x560);
|
||||
SetRegisterAllowed(0x564);
|
||||
SetRegisterAllowed(0x568);
|
||||
SetRegisterAllowed(0x56C);
|
||||
SetRegisterAllowed(0x570);
|
||||
SetRegisterAllowed(0x574);
|
||||
SetRegisterAllowed(0x578);
|
||||
SetRegisterAllowed(0x57C);
|
||||
SetRegisterAllowed(0x580);
|
||||
SetRegisterAllowed(0x584);
|
||||
SetRegisterAllowed(0x588);
|
||||
SetRegisterAllowed(0x58C);
|
||||
SetRegisterAllowed(0x590);
|
||||
SetRegisterAllowed(0x594);
|
||||
SetRegisterAllowed(0x598);
|
||||
SetRegisterAllowed(0x59C);
|
||||
SetRegisterAllowed(0x5A0);
|
||||
SetRegisterAllowed(0x5A4);
|
||||
SetRegisterAllowed(0x5A8);
|
||||
SetRegisterAllowed(0x5AC);
|
||||
SetRegisterAllowed(0x5B0);
|
||||
SetRegisterAllowed(0x5B4);
|
||||
SetRegisterAllowed(0x5B8);
|
||||
SetRegisterAllowed(0x5BC);
|
||||
SetRegisterAllowed(0x5C0);
|
||||
SetRegisterAllowed(0x5C4);
|
||||
SetRegisterAllowed(0x5C8);
|
||||
SetRegisterAllowed(0x5CC);
|
||||
SetRegisterAllowed(0x5D0);
|
||||
SetRegisterAllowed(0x5D4);
|
||||
SetRegisterAllowed(0x5D8);
|
||||
SetRegisterAllowed(0x5DC);
|
||||
SetRegisterAllowed(0x5E0);
|
||||
SetRegisterAllowed(0x5E4);
|
||||
SetRegisterAllowed(0x5E8);
|
||||
SetRegisterAllowed(0x5EC);
|
||||
SetRegisterAllowed(0x5F0);
|
||||
SetRegisterAllowed(0x5F4);
|
||||
SetRegisterAllowed(0x5F8);
|
||||
SetRegisterAllowed(0x5FC);
|
||||
SetRegisterAllowed(0x600);
|
||||
SetRegisterAllowed(0x604);
|
||||
SetRegisterAllowed(0x608);
|
||||
SetRegisterAllowed(0x60C);
|
||||
SetRegisterAllowed(0x610);
|
||||
SetRegisterAllowed(0x614);
|
||||
SetRegisterAllowed(0x618);
|
||||
SetRegisterAllowed(0x61C);
|
||||
SetRegisterAllowed(0x620);
|
||||
SetRegisterAllowed(0x624);
|
||||
SetRegisterAllowed(0x628);
|
||||
SetRegisterAllowed(0x62C);
|
||||
SetRegisterAllowed(0x630);
|
||||
SetRegisterAllowed(0x634);
|
||||
SetRegisterAllowed(0x638);
|
||||
SetRegisterAllowed(0x63C);
|
||||
SetRegisterAllowed(0x640);
|
||||
SetRegisterAllowed(0x644);
|
||||
SetRegisterAllowed(0x648);
|
||||
SetRegisterAllowed(0x64C);
|
||||
SetRegisterAllowed(0x650);
|
||||
SetRegisterAllowed(0x654);
|
||||
SetRegisterAllowed(0x658);
|
||||
SetRegisterAllowed(0x65C);
|
||||
SetRegisterAllowed(0x660);
|
||||
SetRegisterAllowed(0x664);
|
||||
SetRegisterAllowed(0x668);
|
||||
SetRegisterAllowed(0x66C);
|
||||
SetRegisterAllowed(0x670);
|
||||
SetRegisterAllowed(0x674);
|
||||
SetRegisterAllowed(0x678);
|
||||
SetRegisterAllowed(0x67C);
|
||||
SetRegisterAllowed(0x680);
|
||||
SetRegisterAllowed(0x684);
|
||||
SetRegisterAllowed(0x688);
|
||||
SetRegisterAllowed(0x68C);
|
||||
SetRegisterAllowed(0x690);
|
||||
SetRegisterAllowed(0x694);
|
||||
SetRegisterAllowed(0x698);
|
||||
SetRegisterAllowed(0x69C);
|
||||
SetRegisterAllowed(0x6A0);
|
||||
SetRegisterAllowed(0x6A4);
|
||||
SetRegisterAllowed(0x6A8);
|
||||
SetRegisterAllowed(0x6AC);
|
||||
SetRegisterAllowed(0x6B0);
|
||||
SetRegisterAllowed(0x6B4);
|
||||
SetRegisterAllowed(0x6B8);
|
||||
SetRegisterAllowed(0x6BC);
|
||||
SetRegisterAllowed(0x6C0);
|
||||
SetRegisterAllowed(0x6C4);
|
||||
SetRegisterAllowed(0x6C8);
|
||||
SetRegisterAllowed(0x6CC);
|
||||
SetRegisterAllowed(0x6D0);
|
||||
SetRegisterAllowed(0x6D4);
|
||||
SetRegisterAllowed(0x6D8);
|
||||
SetRegisterAllowed(0x6DC);
|
||||
SetRegisterAllowed(0x6E0);
|
||||
SetRegisterAllowed(0x6E4);
|
||||
SetRegisterAllowed(0x6E8);
|
||||
SetRegisterAllowed(0x6EC);
|
||||
SetRegisterAllowed(0x6F0);
|
||||
SetRegisterAllowed(0x6F4);
|
||||
SetRegisterAllowed(0x6F8);
|
||||
SetRegisterAllowed(0x6FC);
|
||||
SetRegisterAllowed(0x700);
|
||||
SetRegisterAllowed(0x704);
|
||||
SetRegisterAllowed(0x708);
|
||||
SetRegisterAllowed(0x70C);
|
||||
SetRegisterAllowed(0x710);
|
||||
SetRegisterAllowed(0x714);
|
||||
SetRegisterAllowed(0x718);
|
||||
SetRegisterAllowed(0x71C);
|
||||
SetRegisterAllowed(0x720);
|
||||
SetRegisterAllowed(0x724);
|
||||
SetRegisterAllowed(0x728);
|
||||
SetRegisterAllowed(0x72C);
|
||||
SetRegisterAllowed(0x730);
|
||||
SetRegisterAllowed(0x734);
|
||||
SetRegisterAllowed(0x738);
|
||||
SetRegisterAllowed(0x73C);
|
||||
SetRegisterAllowed(0x740);
|
||||
SetRegisterAllowed(0x744);
|
||||
SetRegisterAllowed(0x748);
|
||||
SetRegisterAllowed(0x74C);
|
||||
SetRegisterAllowed(0x750);
|
||||
SetRegisterAllowed(0x754);
|
||||
SetRegisterAllowed(0x758);
|
||||
SetRegisterAllowed(0x75C);
|
||||
SetRegisterAllowed(0x760);
|
||||
SetRegisterAllowed(0x764);
|
||||
SetRegisterAllowed(0x768);
|
||||
SetRegisterAllowed(0x76C);
|
||||
SetRegisterAllowed(0x770);
|
||||
SetRegisterAllowed(0x774);
|
||||
SetRegisterAllowed(0x778);
|
||||
SetRegisterAllowed(0x77C);
|
||||
SetRegisterAllowed(0x780);
|
||||
SetRegisterAllowed(0x784);
|
||||
SetRegisterAllowed(0x788);
|
||||
SetRegisterAllowed(0x78C);
|
||||
SetRegisterAllowed(0x790);
|
||||
SetRegisterAllowed(0x794);
|
||||
SetRegisterAllowed(0x798);
|
||||
SetRegisterAllowed(0x79C);
|
||||
SetRegisterAllowed(0x7A0);
|
||||
SetRegisterAllowed(0x7A4);
|
||||
SetRegisterAllowed(0x7A8);
|
||||
SetRegisterAllowed(0x7AC);
|
||||
SetRegisterAllowed(0x7B0);
|
||||
SetRegisterAllowed(0x7B4);
|
||||
SetRegisterAllowed(0x7B8);
|
||||
SetRegisterAllowed(0x7BC);
|
||||
SetRegisterAllowed(0x7C0);
|
||||
SetRegisterAllowed(0x7C4);
|
||||
SetRegisterAllowed(0x7C8);
|
||||
SetRegisterAllowed(0x7CC);
|
||||
SetRegisterAllowed(0x7D0);
|
||||
SetRegisterAllowed(0x7D4);
|
||||
SetRegisterAllowed(0x7D8);
|
||||
SetRegisterAllowed(0x7DC);
|
||||
SetRegisterAllowed(0x7E0);
|
||||
SetRegisterAllowed(0x7E4);
|
||||
SetRegisterAllowed(0x7E8);
|
||||
SetRegisterAllowed(0x7EC);
|
||||
SetRegisterAllowed(0x7F0);
|
||||
SetRegisterAllowed(0x7F4);
|
||||
SetRegisterAllowed(0x7F8);
|
||||
SetRegisterAllowed(0x7FC);
|
||||
SetRegisterAllowed(0x800);
|
||||
SetRegisterAllowed(0x804);
|
||||
SetRegisterAllowed(0x808);
|
||||
SetRegisterAllowed(0x80C);
|
||||
SetRegisterAllowed(0x810);
|
||||
SetRegisterAllowed(0x814);
|
||||
SetRegisterAllowed(0x818);
|
||||
SetRegisterAllowed(0x81C);
|
||||
SetRegisterAllowed(0x820);
|
||||
SetRegisterAllowed(0x824);
|
||||
SetRegisterAllowed(0x828);
|
||||
SetRegisterAllowed(0x82C);
|
||||
SetRegisterAllowed(0x830);
|
||||
SetRegisterAllowed(0x834);
|
||||
SetRegisterAllowed(0x838);
|
||||
SetRegisterAllowed(0x83C);
|
||||
SetRegisterAllowed(0x840);
|
||||
SetRegisterAllowed(0x844);
|
||||
SetRegisterAllowed(0x848);
|
||||
SetRegisterAllowed(0x84C);
|
||||
SetRegisterAllowed(0x850);
|
||||
SetRegisterAllowed(0x854);
|
||||
SetRegisterAllowed(0x858);
|
||||
SetRegisterAllowed(0x85C);
|
||||
SetRegisterAllowed(0x860);
|
||||
SetRegisterAllowed(0x864);
|
||||
SetRegisterAllowed(0x868);
|
||||
SetRegisterAllowed(0x86C);
|
||||
SetRegisterAllowed(0x870);
|
||||
SetRegisterAllowed(0x874);
|
||||
SetRegisterAllowed(0x878);
|
||||
SetRegisterAllowed(0x87C);
|
||||
SetRegisterAllowed(0x880);
|
||||
SetRegisterAllowed(0x884);
|
||||
SetRegisterAllowed(0x888);
|
||||
SetRegisterAllowed(0x88C);
|
||||
SetRegisterAllowed(0x890);
|
||||
SetRegisterAllowed(0x894);
|
||||
SetRegisterAllowed(0x898);
|
||||
SetRegisterAllowed(0x89C);
|
||||
SetRegisterAllowed(0x8A0);
|
||||
SetRegisterAllowed(0x8A4);
|
||||
SetRegisterAllowed(0x8A8);
|
||||
SetRegisterAllowed(0x8AC);
|
||||
SetRegisterAllowed(0x8B0);
|
||||
SetRegisterAllowed(0x8B4);
|
||||
SetRegisterAllowed(0x8B8);
|
||||
SetRegisterAllowed(0x8BC);
|
||||
SetRegisterAllowed(0x8C0);
|
||||
SetRegisterAllowed(0x8C4);
|
||||
SetRegisterAllowed(0x8C8);
|
||||
SetRegisterAllowed(0x8CC);
|
||||
SetRegisterAllowed(0x8D0);
|
||||
SetRegisterAllowed(0x8D4);
|
||||
SetRegisterAllowed(0x8D8);
|
||||
SetRegisterAllowed(0x8DC);
|
||||
SetRegisterAllowed(0x8E0);
|
||||
SetRegisterAllowed(0x8E4);
|
||||
SetRegisterAllowed(0x8E8);
|
||||
SetRegisterAllowed(0x8EC);
|
||||
SetRegisterAllowed(0x8F0);
|
||||
SetRegisterAllowed(0x8F4);
|
||||
SetRegisterAllowed(0x8F8);
|
||||
SetRegisterAllowed(0x8FC);
|
||||
SetRegisterAllowed(0x900);
|
||||
SetRegisterAllowed(0x904);
|
||||
SetRegisterAllowed(0x908);
|
||||
SetRegisterAllowed(0x90C);
|
||||
SetRegisterAllowed(0x910);
|
||||
SetRegisterAllowed(0x914);
|
||||
SetRegisterAllowed(0x918);
|
||||
SetRegisterAllowed(0x91C);
|
||||
SetRegisterAllowed(0x920);
|
||||
SetRegisterAllowed(0x924);
|
||||
SetRegisterAllowed(0x928);
|
||||
SetRegisterAllowed(0x92C);
|
||||
SetRegisterAllowed(0x930);
|
||||
SetRegisterAllowed(0x934);
|
||||
SetRegisterAllowed(0x938);
|
||||
SetRegisterAllowed(0x93C);
|
||||
SetRegisterAllowed(0x940);
|
||||
SetRegisterAllowed(0x944);
|
||||
SetRegisterAllowed(0x948);
|
||||
SetRegisterAllowed(0x94C);
|
||||
SetRegisterAllowed(0x950);
|
||||
SetRegisterAllowed(0x954);
|
||||
SetRegisterAllowed(0x958);
|
||||
SetRegisterAllowed(0x95C);
|
||||
SetRegisterAllowed(0x960);
|
||||
SetRegisterAllowed(0x964);
|
||||
SetRegisterAllowed(0x968);
|
||||
SetRegisterAllowed(0x96C);
|
||||
SetRegisterAllowed(0x970);
|
||||
SetRegisterAllowed(0x974);
|
||||
SetRegisterAllowed(0x978);
|
||||
SetRegisterAllowed(0x97C);
|
||||
SetRegisterAllowed(0x980);
|
||||
SetRegisterAllowed(0x984);
|
||||
SetRegisterAllowed(0x988);
|
||||
SetRegisterAllowed(0x98C);
|
||||
SetRegisterAllowed(0x990);
|
||||
SetRegisterAllowed(0x994);
|
||||
SetRegisterAllowed(0x998);
|
||||
SetRegisterAllowed(0x99C);
|
||||
SetRegisterAllowed(0x9A0);
|
||||
SetRegisterAllowed(0x9A4);
|
||||
SetRegisterAllowed(0x9A8);
|
||||
SetRegisterAllowed(0x9AC);
|
||||
SetRegisterAllowed(0x9B0);
|
||||
SetRegisterAllowed(0x9B4);
|
||||
SetRegisterAllowed(0x9B8);
|
||||
SetRegisterAllowed(0x9BC);
|
||||
SetRegisterAllowed(0x9C0);
|
||||
SetRegisterAllowed(0x9C4);
|
||||
SetRegisterAllowed(0x9C8);
|
||||
SetRegisterAllowed(0x9CC);
|
||||
SetRegisterAllowed(0x9D0);
|
||||
SetRegisterAllowed(0x9D4);
|
||||
SetRegisterAllowed(0x9D8);
|
||||
SetRegisterAllowed(0x9DC);
|
||||
SetRegisterAllowed(0x9E0);
|
||||
SetRegisterAllowed(0x9E4);
|
||||
SetRegisterAllowed(0x9E8);
|
||||
SetRegisterAllowed(0x9EC);
|
||||
SetRegisterAllowed(0x9F0);
|
||||
SetRegisterAllowed(0x9F4);
|
||||
SetRegisterAllowed(0x9F8);
|
||||
SetRegisterAllowed(0x9FC);
|
||||
SetRegisterAllowed(0xA00);
|
||||
SetRegisterAllowed(0xA04);
|
||||
SetRegisterAllowed(0xA08);
|
||||
SetRegisterAllowed(0xA0C);
|
||||
SetRegisterAllowed(0xA10);
|
||||
SetRegisterAllowed(0xA14);
|
||||
SetRegisterAllowed(0xA18);
|
||||
SetRegisterAllowed(0xA1C);
|
||||
SetRegisterAllowed(0xA20);
|
||||
SetRegisterAllowed(0xA24);
|
||||
SetRegisterAllowed(0xA28);
|
||||
SetRegisterAllowed(0xA2C);
|
||||
SetRegisterAllowed(0xA30);
|
||||
SetRegisterAllowed(0xA34);
|
||||
SetRegisterAllowed(0xA38);
|
||||
SetRegisterAllowed(0xA3C);
|
||||
SetRegisterAllowed(0xA40);
|
||||
SetRegisterAllowed(0xA44);
|
||||
SetRegisterAllowed(0xA48);
|
||||
SetRegisterAllowed(0xA4C);
|
||||
SetRegisterAllowed(0xA50);
|
||||
SetRegisterAllowed(0xA54);
|
||||
SetRegisterAllowed(0xA58);
|
||||
SetRegisterAllowed(0xA5C);
|
||||
SetRegisterAllowed(0xA60);
|
||||
SetRegisterAllowed(0xA64);
|
||||
SetRegisterAllowed(0xA68);
|
||||
SetRegisterAllowed(0xA6C);
|
||||
SetRegisterAllowed(0xA70);
|
||||
SetRegisterAllowed(0xA74);
|
||||
SetRegisterAllowed(0xA78);
|
||||
SetRegisterAllowed(0xA7C);
|
||||
SetRegisterAllowed(0xA80);
|
||||
SetRegisterAllowed(0xA84);
|
||||
SetRegisterAllowed(0xA88);
|
||||
SetRegisterAllowed(0xA8C);
|
||||
SetRegisterAllowed(0xA90);
|
||||
SetRegisterAllowed(0xA94);
|
||||
SetRegisterAllowed(0xA98);
|
||||
SetRegisterAllowed(0xA9C);
|
||||
SetRegisterAllowed(0xAA0);
|
||||
SetRegisterAllowed(0xAA4);
|
||||
SetRegisterAllowed(0xAA8);
|
||||
SetRegisterAllowed(0xAAC);
|
||||
SetRegisterAllowed(0xAB0);
|
||||
SetRegisterAllowed(0xAB4);
|
||||
SetRegisterAllowed(0xAB8);
|
||||
SetRegisterAllowed(0xABC);
|
||||
SetRegisterAllowed(0xAC0);
|
||||
SetRegisterAllowed(0xAC4);
|
||||
SetRegisterAllowed(0xAC8);
|
||||
SetRegisterAllowed(0xACC);
|
||||
SetRegisterAllowed(0xAD0);
|
||||
SetRegisterAllowed(0xAD4);
|
||||
SetRegisterAllowed(0xAD8);
|
||||
SetRegisterAllowed(0xADC);
|
||||
SetRegisterAllowed(0xAE0);
|
||||
SetRegisterAllowed(0xAE4);
|
||||
SetRegisterAllowed(0xAE8);
|
||||
SetRegisterAllowed(0xAEC);
|
||||
SetRegisterAllowed(0xAF0);
|
||||
SetRegisterAllowed(0xAF4);
|
||||
SetRegisterAllowed(0xAF8);
|
||||
SetRegisterAllowed(0xAFC);
|
||||
SetRegisterAllowed(0xB00);
|
||||
SetRegisterAllowed(0xB04);
|
||||
SetRegisterAllowed(0xB08);
|
||||
SetRegisterAllowed(0xB0C);
|
||||
SetRegisterAllowed(0xB10);
|
||||
SetRegisterAllowed(0xB14);
|
||||
SetRegisterAllowed(0xB18);
|
||||
SetRegisterAllowed(0xB1C);
|
||||
SetRegisterAllowed(0xB20);
|
||||
SetRegisterAllowed(0xB24);
|
||||
SetRegisterAllowed(0xB28);
|
||||
SetRegisterAllowed(0xB2C);
|
||||
SetRegisterAllowed(0xB30);
|
||||
SetRegisterAllowed(0xB34);
|
||||
SetRegisterAllowed(0xB38);
|
||||
SetRegisterAllowed(0xB3C);
|
||||
SetRegisterAllowed(0xB40);
|
||||
SetRegisterAllowed(0xB44);
|
||||
SetRegisterAllowed(0xB48);
|
||||
SetRegisterAllowed(0xB4C);
|
||||
SetRegisterAllowed(0xB50);
|
||||
SetRegisterAllowed(0xB54);
|
||||
SetRegisterAllowed(0xB58);
|
||||
SetRegisterAllowed(0xB5C);
|
||||
SetRegisterAllowed(0xB60);
|
||||
SetRegisterAllowed(0xB64);
|
||||
SetRegisterAllowed(0xB68);
|
||||
SetRegisterAllowed(0xB6C);
|
||||
SetRegisterAllowed(0xB70);
|
||||
SetRegisterAllowed(0xB74);
|
||||
SetRegisterAllowed(0xB78);
|
||||
SetRegisterAllowed(0xB7C);
|
||||
SetRegisterAllowed(0xB80);
|
||||
SetRegisterAllowed(0xB84);
|
||||
SetRegisterAllowed(0xB88);
|
||||
SetRegisterAllowed(0xB8C);
|
||||
SetRegisterAllowed(0xB90);
|
||||
SetRegisterAllowed(0xB94);
|
||||
SetRegisterAllowed(0xB98);
|
||||
SetRegisterAllowed(0xB9C);
|
||||
SetRegisterAllowed(0xBA0);
|
||||
SetRegisterAllowed(0xBA4);
|
||||
SetRegisterAllowed(0xBA8);
|
||||
SetRegisterAllowed(0xBAC);
|
||||
SetRegisterAllowed(0xBB0);
|
||||
SetRegisterAllowed(0xBB4);
|
||||
SetRegisterAllowed(0xBB8);
|
||||
SetRegisterAllowed(0xBBC);
|
||||
SetRegisterAllowed(0xBC0);
|
||||
SetRegisterAllowed(0xBC4);
|
||||
SetRegisterAllowed(0xBC8);
|
||||
SetRegisterAllowed(0xBCC);
|
||||
SetRegisterAllowed(0xBD0);
|
||||
SetRegisterAllowed(0xBD4);
|
||||
SetRegisterAllowed(0xBD8);
|
||||
SetRegisterAllowed(0xBDC);
|
||||
SetRegisterAllowed(0xBE0);
|
||||
SetRegisterAllowed(0xBE4);
|
||||
SetRegisterAllowed(0xBE8);
|
||||
SetRegisterAllowed(0xBEC);
|
||||
SetRegisterAllowed(0xBF0);
|
||||
SetRegisterAllowed(0xBF4);
|
||||
SetRegisterAllowed(0xBF8);
|
||||
SetRegisterAllowed(0xBFC);
|
||||
SetRegisterAllowed(0xC00);
|
||||
SetRegisterAllowed(0xC04);
|
||||
SetRegisterAllowed(0xC08);
|
||||
SetRegisterAllowed(0xC0C);
|
||||
SetRegisterAllowed(0xC10);
|
||||
SetRegisterAllowed(0xC14);
|
||||
SetRegisterAllowed(0xC18);
|
||||
SetRegisterAllowed(0xC1C);
|
||||
SetRegisterAllowed(0xC20);
|
||||
SetRegisterAllowed(0xC24);
|
||||
SetRegisterAllowed(0xC28);
|
||||
SetRegisterAllowed(0xC2C);
|
||||
SetRegisterAllowed(0xC30);
|
||||
SetRegisterAllowed(0xC34);
|
||||
SetRegisterAllowed(0xC38);
|
||||
SetRegisterAllowed(0xC3C);
|
||||
SetRegisterAllowed(0xC40);
|
||||
SetRegisterAllowed(0xC44);
|
||||
SetRegisterAllowed(0xC48);
|
||||
SetRegisterAllowed(0xC4C);
|
||||
SetRegisterAllowed(0xC50);
|
||||
SetRegisterAllowed(0xC54);
|
||||
SetRegisterAllowed(0xC58);
|
||||
SetRegisterAllowed(0xC5C);
|
||||
SetRegisterAllowed(0xC60);
|
||||
SetRegisterAllowed(0xC64);
|
||||
SetRegisterAllowed(0xC68);
|
||||
SetRegisterAllowed(0xC6C);
|
||||
SetRegisterAllowed(0xC70);
|
||||
SetRegisterAllowed(0xC74);
|
||||
SetRegisterAllowed(0xC78);
|
||||
SetRegisterAllowed(0xC7C);
|
||||
SetRegisterAllowed(0xC80);
|
||||
SetRegisterAllowed(0xC84);
|
||||
SetRegisterAllowed(0xC88);
|
||||
SetRegisterAllowed(0xC8C);
|
||||
SetRegisterAllowed(0xC90);
|
||||
SetRegisterAllowed(0xC94);
|
||||
SetRegisterAllowed(0xC98);
|
||||
SetRegisterAllowed(0xC9C);
|
||||
SetRegisterAllowed(0xCA0);
|
||||
SetRegisterAllowed(0xCA4);
|
||||
SetRegisterAllowed(0xCA8);
|
||||
SetRegisterAllowed(0xCAC);
|
||||
SetRegisterAllowed(0xCB0);
|
||||
SetRegisterAllowed(0xCB4);
|
||||
SetRegisterAllowed(0xCB8);
|
||||
SetRegisterAllowed(0xCBC);
|
||||
SetRegisterAllowed(0xCC0);
|
||||
SetRegisterAllowed(0xCC4);
|
||||
SetRegisterAllowed(0xCC8);
|
||||
SetRegisterAllowed(0xCCC);
|
||||
SetRegisterAllowed(0xCD0);
|
||||
SetRegisterAllowed(0xCD4);
|
||||
SetRegisterAllowed(0xCD8);
|
||||
SetRegisterAllowed(0xCDC);
|
||||
SetRegisterAllowed(0xCE0);
|
||||
SetRegisterAllowed(0xCE4);
|
||||
SetRegisterAllowed(0xCE8);
|
||||
SetRegisterAllowed(0xCEC);
|
||||
SetRegisterAllowed(0xCF0);
|
||||
SetRegisterAllowed(0xCF4);
|
||||
SetRegisterAllowed(0xCF8);
|
||||
SetRegisterAllowed(0xCFC);
|
||||
SetRegisterAllowed(0xD00);
|
||||
SetRegisterAllowed(0xD04);
|
||||
SetRegisterAllowed(0xD08);
|
||||
SetRegisterAllowed(0xD0C);
|
||||
SetRegisterAllowed(0xD10);
|
||||
SetRegisterAllowed(0xD14);
|
||||
SetRegisterAllowed(0xD18);
|
||||
SetRegisterAllowed(0xD1C);
|
||||
SetRegisterAllowed(0xD20);
|
||||
SetRegisterAllowed(0xD24);
|
||||
SetRegisterAllowed(0xD28);
|
||||
SetRegisterAllowed(0xD2C);
|
||||
SetRegisterAllowed(0xD30);
|
||||
SetRegisterAllowed(0xD34);
|
||||
SetRegisterAllowed(0xD38);
|
||||
SetRegisterAllowed(0xD3C);
|
||||
SetRegisterAllowed(0xD40);
|
||||
SetRegisterAllowed(0xD44);
|
||||
SetRegisterAllowed(0xD48);
|
||||
SetRegisterAllowed(0xD4C);
|
||||
SetRegisterAllowed(0xD50);
|
||||
SetRegisterAllowed(0xD54);
|
||||
SetRegisterAllowed(0xD58);
|
||||
SetRegisterAllowed(0xD5C);
|
||||
SetRegisterAllowed(0xD60);
|
||||
SetRegisterAllowed(0xD64);
|
||||
SetRegisterAllowed(0xD68);
|
||||
SetRegisterAllowed(0xD6C);
|
||||
SetRegisterAllowed(0xD70);
|
||||
SetRegisterAllowed(0xD74);
|
||||
SetRegisterAllowed(0xD78);
|
||||
SetRegisterAllowed(0xD7C);
|
||||
SetRegisterAllowed(0xD80);
|
||||
SetRegisterAllowed(0xD84);
|
||||
SetRegisterAllowed(0xD88);
|
||||
SetRegisterAllowed(0xD8C);
|
||||
SetRegisterAllowed(0xD90);
|
||||
SetRegisterAllowed(0xD94);
|
||||
SetRegisterAllowed(0xD98);
|
||||
SetRegisterAllowed(0xD9C);
|
||||
SetRegisterAllowed(0xDA0);
|
||||
SetRegisterAllowed(0xDA4);
|
||||
SetRegisterAllowed(0xDA8);
|
||||
SetRegisterAllowed(0xDAC);
|
||||
SetRegisterAllowed(0xDB0);
|
||||
SetRegisterAllowed(0xDB4);
|
||||
SetRegisterAllowed(0xDB8);
|
||||
SetRegisterAllowed(0xDBC);
|
||||
SetRegisterAllowed(0xDC0);
|
||||
SetRegisterAllowed(0xDC4);
|
||||
SetRegisterAllowed(0xDC8);
|
||||
SetRegisterAllowed(0xDCC);
|
||||
SetRegisterAllowed(0xDD0);
|
||||
SetRegisterAllowed(0xDD4);
|
||||
SetRegisterAllowed(0xDD8);
|
||||
SetRegisterAllowed(0xDDC);
|
||||
SetRegisterAllowed(0xDE0);
|
||||
SetRegisterAllowed(0xDE4);
|
||||
SetRegisterAllowed(0xDE8);
|
||||
SetRegisterAllowed(0xDEC);
|
||||
SetRegisterAllowed(0xDF0);
|
||||
SetRegisterAllowed(0xDF4);
|
||||
SetRegisterAllowed(0xDF8);
|
||||
SetRegisterAllowed(0xDFC);
|
||||
SetRegisterAllowed(0xE00);
|
||||
SetRegisterAllowed(0xE04);
|
||||
SetRegisterAllowed(0xE08);
|
||||
SetRegisterAllowed(0xE0C);
|
||||
SetRegisterAllowed(0xE10);
|
||||
SetRegisterAllowed(0xE14);
|
||||
SetRegisterAllowed(0xE18);
|
||||
SetRegisterAllowed(0xE1C);
|
||||
SetRegisterAllowed(0xE20);
|
||||
SetRegisterAllowed(0xE24);
|
||||
SetRegisterAllowed(0xE28);
|
||||
SetRegisterAllowed(0xE2C);
|
||||
SetRegisterAllowed(0xE30);
|
||||
SetRegisterAllowed(0xE34);
|
||||
SetRegisterAllowed(0xE38);
|
||||
SetRegisterAllowed(0xE3C);
|
||||
SetRegisterAllowed(0xE40);
|
||||
SetRegisterAllowed(0xE44);
|
||||
SetRegisterAllowed(0xE48);
|
||||
SetRegisterAllowed(0xE4C);
|
||||
SetRegisterAllowed(0xE50);
|
||||
SetRegisterAllowed(0xE54);
|
||||
SetRegisterAllowed(0xE58);
|
||||
SetRegisterAllowed(0xE5C);
|
||||
SetRegisterAllowed(0xE60);
|
||||
SetRegisterAllowed(0xE64);
|
||||
SetRegisterAllowed(0xE68);
|
||||
SetRegisterAllowed(0xE6C);
|
||||
SetRegisterAllowed(0xE70);
|
||||
SetRegisterAllowed(0xE74);
|
||||
SetRegisterAllowed(0xE78);
|
||||
SetRegisterAllowed(0xE7C);
|
||||
SetRegisterAllowed(0xE80);
|
||||
SetRegisterAllowed(0xE84);
|
||||
SetRegisterAllowed(0xE88);
|
||||
SetRegisterAllowed(0xE8C);
|
||||
SetRegisterAllowed(0xE90);
|
||||
SetRegisterAllowed(0xE94);
|
||||
SetRegisterAllowed(0xE98);
|
||||
SetRegisterAllowed(0xE9C);
|
||||
SetRegisterAllowed(0xEA0);
|
||||
SetRegisterAllowed(0xEA4);
|
||||
SetRegisterAllowed(0xEA8);
|
||||
SetRegisterAllowed(0xEAC);
|
||||
SetRegisterAllowed(0xEB0);
|
||||
SetRegisterAllowed(0xEB4);
|
||||
SetRegisterAllowed(0xEB8);
|
||||
SetRegisterAllowed(0xEBC);
|
||||
SetRegisterAllowed(0xEC0);
|
||||
SetRegisterAllowed(0xEC4);
|
||||
SetRegisterAllowed(0xEC8);
|
||||
SetRegisterAllowed(0xECC);
|
||||
SetRegisterAllowed(0xED0);
|
||||
SetRegisterAllowed(0xED4);
|
||||
SetRegisterAllowed(0xED8);
|
||||
3
LICENSE
3
LICENSE
@@ -4,8 +4,9 @@
|
||||
|
||||
- Tinymembench is under MIT license, which is compatible with GPL v2.
|
||||
|
||||
- Although "sys-clk" uses permissive license, all modifications towards it in this repo ("hoc-sys") are licensed under GPL v2.
|
||||
- Although "sys-clk" uses permissive license, all modifications towards it in this repo ("hoc-clk") are licensed under GPL v2.
|
||||
|
||||
- Status-Monitor is licensed under the GPLv2
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
115
README.md
115
README.md
@@ -1,13 +1,13 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="assets/logo.png" alt="logo" width="350"/>
|
||||
<img src="assets/logo.png" alt="logo" width="768"/>
|
||||
|
||||
---
|
||||
|
||||

|
||||

|
||||
[](https://discord.com/invite/S3eX47dHsB)
|
||||
[](https://dsc.gg/horizonoc)
|
||||

|
||||

|
||||

|
||||
@@ -32,17 +32,16 @@ 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) / 998MHz (Erista)
|
||||
* **RAM:** Up to 1866MHz (Mariko) / 1600MHz (Erista)
|
||||
* **GPU:** Up to 1075MHz (Mariko) / 921MHz (Erista)
|
||||
* **RAM:** Up to 1866/2133MHz (Mariko) / 1600MHz (Erista)
|
||||
* Over/undervolting support
|
||||
* Built-in configurator
|
||||
* Compatible with most homebrew
|
||||
|
||||
> *Higher (potentially dangerous) frequencies are unlockable via configuration.*
|
||||
> *The exact maximum overclock possible varies per console, although most consoles should be able to do this safely.*
|
||||
> It is recommended to read the [guide](https://rentry.co/howtoget60fps) before proceeding, as this can help you get a *significant* performance boost over the default settings, often times with less power draw and heat output
|
||||
|
||||
---
|
||||
|
||||
@@ -57,7 +56,6 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
```
|
||||
kip1=atmosphere/kips/hoc.kip
|
||||
secmon=exosphere.bin
|
||||
```
|
||||
|
||||
*(No changes needed if using fusee.)*
|
||||
@@ -68,7 +66,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
1. Open the Horizon OC Overlay
|
||||
2. Open the settings menu
|
||||
3. Adjust your overclocking settings as desired.
|
||||
3. Adjust your overclocking settings as desired. A helpful guide can be found [here.](https://rentry.co/mariko#oc-settings-for-horizon-oc)
|
||||
4. Click **Save KIP Settings** to apply your configuration.
|
||||
|
||||
---
|
||||
@@ -77,21 +75,98 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
Refer to COMPILATION.md
|
||||
|
||||
---
|
||||
## Clock table
|
||||
|
||||
### MEM clocks
|
||||
* 3200 → max on mariko, JEDEC.
|
||||
* 2933 → JEDEC.
|
||||
* 2666 → JEDEC.
|
||||
* 2400 → max on erista, JEDEC.
|
||||
* 2133 → mariko safe max (4266 Modules), JEDEC.
|
||||
* 1996 → JEDEC.
|
||||
* 1866 → mariko safe max (3733 Modules), JEDEC.
|
||||
* 1600 → official docked, boost mode, erista safe max, JEDEC.
|
||||
* 1331 → official handheld, JEDEC.
|
||||
* 1065
|
||||
* 800
|
||||
* 665
|
||||
|
||||
### CPU clocks
|
||||
* 2703 → mariko absolute max, dangerous
|
||||
* 2601 → unsafe
|
||||
* 2499
|
||||
* 2397 → mariko safe max with UV (low speedo)
|
||||
* 2295
|
||||
* 2193
|
||||
* 2091
|
||||
* 1963 → mariko no UV max clock
|
||||
* 1887
|
||||
* 1785 → erista no UV max clock, boost mode
|
||||
* 1683
|
||||
* 1581
|
||||
* 1428
|
||||
* 1326
|
||||
* 1224 → sdev oc
|
||||
* 1122
|
||||
* 1020 → official docked & handheld
|
||||
* 918
|
||||
* 816
|
||||
* 714
|
||||
* 612 → sleep mode
|
||||
|
||||
### GPU clocks
|
||||
* 1536 → absolute max clock on mariko. very dangerous
|
||||
* 1459
|
||||
* 1382
|
||||
* 1305
|
||||
* 1267 → NVIDIA T214 rating
|
||||
* 1228 → mariko HiOPT safe clock
|
||||
* 1152 → mariko SLT max clock
|
||||
* 1075 → mariko no UV max clock. absolute max clock on erista. very dangerous
|
||||
* 998 → NVIDIA T210 rating
|
||||
* 960 (erista only) → erista slt/hiopt safe max clock
|
||||
* 921 → erista no UV max clock
|
||||
* 844
|
||||
* 768 → official docked
|
||||
* 691
|
||||
* 614
|
||||
* 537
|
||||
* 460 → max handheld
|
||||
* 384 → official handheld
|
||||
* 307 → official handheld
|
||||
* 230
|
||||
* 153
|
||||
* 76 → boost mode
|
||||
|
||||
**Notes:**
|
||||
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
|
||||
* **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, nautalis)** – 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 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
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 0.x | :white_check_mark: |
|
||||
| 2.x.x | :white_check_mark: |
|
||||
| 1.x.x | Not supported |
|
||||
| 0.x.x | Not supported |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Contact me on discord (soul_9017) or email me (souldbminer@gmail.com)
|
||||
Contact Souldbminer or Lightos_ on discord (souldbminer, lightos_)
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* 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"
|
||||
#define __ACCESS_TABLE_NAME__ EmcAccessTable1
|
||||
#define __ACCESS_TABLE_ADDRESS__ MemoryRegionPhysicalDeviceExternalMemoryController1.GetAddress()
|
||||
#define __ACCESS_TABLE_INC__ "secmon_emc_access_table_data.inc"
|
||||
|
||||
#include "secmon_define_access_table.inc"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#define __ACCESS_TABLE_NAME__ EmcAccessTable2
|
||||
#define __ACCESS_TABLE_ADDRESS__ MemoryRegionPhysicalDeviceExternalMemoryController2.GetAddress()
|
||||
#define __ACCESS_TABLE_INC__ "secmon_emc_access_table_data.inc"
|
||||
|
||||
#include "secmon_define_access_table.inc"
|
||||
|
||||
#undef __ACCESS_TABLE_INC__
|
||||
#undef __ACCESS_TABLE_ADDRESS__
|
||||
#undef __ACCESS_TABLE_NAME__
|
||||
@@ -129,33 +129,32 @@ namespace ams::secmon {
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceEmpty = MemoryRegion(MemoryRegionVirtualDevice.GetStartAddress(), 0);
|
||||
|
||||
#define AMS_SECMON_FOREACH_DEVICE_REGION(HANDLER, ...) \
|
||||
HANDLER(GicDistributor, Empty, UINT64_C(0x50041000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(GicCpuInterface, GicDistributor, UINT64_C(0x50042000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Uart, GicCpuInterface, UINT64_C(0x70006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
|
||||
HANDLER(ClkRst, Uart, UINT64_C(0x60006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
|
||||
HANDLER(RtcPmc, ClkRst, UINT64_C(0x7000E000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Timer, RtcPmc, UINT64_C(0x60005000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(System, Timer, UINT64_C(0x6000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SecurityEngine, System, UINT64_C(0x70012000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SecurityEngine2, SecurityEngine, UINT64_C(0x70412000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SysCtr0, SecurityEngine2, UINT64_C(0x700F0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController, SysCtr0, UINT64_C(0x70019000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ExternalMemoryController, MemoryController, UINT64_C(0x7001b000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(FuseKFuse, ExternalMemoryController, UINT64_C(0x7000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ApbMisc, FuseKFuse, UINT64_C(0x70000000), UINT64_C(0x4000), true, ## __VA_ARGS__) \
|
||||
HANDLER(FlowController, ApbMisc, UINT64_C(0x60007000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(BootloaderParams, FlowController, UINT64_C(0x40000000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(I2c5, BootloaderParams, UINT64_C(0x7000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Gpio, I2c5, UINT64_C(0x6000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(I2c1, Gpio, UINT64_C(0x7000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ExceptionVectors, I2c1, UINT64_C(0x6000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController0, ExceptionVectors, UINT64_C(0x7001C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController1, MemoryController0, UINT64_C(0x7001D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Sdmmc, MemoryController1, UINT64_C(0x700B0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
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(GicDistributor, Empty, UINT64_C(0x50041000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(GicCpuInterface, GicDistributor, UINT64_C(0x50042000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Uart, GicCpuInterface, UINT64_C(0x70006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
|
||||
HANDLER(ClkRst, Uart, UINT64_C(0x60006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
|
||||
HANDLER(RtcPmc, ClkRst, UINT64_C(0x7000E000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Timer, RtcPmc, UINT64_C(0x60005000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(System, Timer, UINT64_C(0x6000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SecurityEngine, System, UINT64_C(0x70012000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SecurityEngine2, SecurityEngine, UINT64_C(0x70412000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SysCtr0, SecurityEngine2, UINT64_C(0x700F0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController, SysCtr0, UINT64_C(0x70019000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ExternalMemoryController, MemoryController, UINT64_C(0x7001b000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(FuseKFuse, ExternalMemoryController, UINT64_C(0x7000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ApbMisc, FuseKFuse, UINT64_C(0x70000000), UINT64_C(0x4000), true, ## __VA_ARGS__) \
|
||||
HANDLER(FlowController, ApbMisc, UINT64_C(0x60007000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(BootloaderParams, FlowController, UINT64_C(0x40000000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(I2c5, BootloaderParams, UINT64_C(0x7000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Gpio, I2c5, UINT64_C(0x6000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(I2c1, Gpio, UINT64_C(0x7000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ExceptionVectors, I2c1, UINT64_C(0x6000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController0, ExceptionVectors, UINT64_C(0x7001C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController1, MemoryController0, UINT64_C(0x7001D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Sdmmc, MemoryController1, UINT64_C(0x700B0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
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__) \
|
||||
|
||||
#define DEFINE_DEVICE_REGION(_NAME_, _PREV_, _ADDRESS_, _SIZE_, _SECURE_) \
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDevice##_NAME_ = MemoryRegion(MemoryRegionVirtualDevice##_PREV_.GetEndAddress() + 0x1000, _SIZE_); \
|
||||
268
Source/Atmosphere-Patches/secmon_smc_handler.cpp
Normal file
268
Source/Atmosphere-Patches/secmon_smc_handler.cpp
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,14 +99,16 @@ namespace ams::secmon::smc {
|
||||
#include "secmon_define_pmc_access_table.inc"
|
||||
#include "secmon_define_mc_access_table.inc"
|
||||
#include "secmon_define_emc_access_table.inc"
|
||||
#include "secmon_define_soctherm_access_table.inc"
|
||||
#include "secmon_define_emc1_access_table.inc"
|
||||
#include "secmon_define_emc2_access_table.inc"
|
||||
#include "secmon_define_mc01_access_table.inc"
|
||||
|
||||
constexpr const AccessTableEntry AccessTables[] = {
|
||||
{ PmcAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDevicePmc.GetAddress(), PmcAccessTable::Address, PmcAccessTable::Size, },
|
||||
{ McAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceMemoryController.GetAddress(), McAccessTable::Address, McAccessTable::Size, },
|
||||
{ EmcAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController.GetAddress(), EmcAccessTable::Address, EmcAccessTable::Size, },
|
||||
{ SocthermAccessTable::ReducedAccessTable.data(), MemoryRegionVirtualDeviceSoctherm.GetAddress(), SocthermAccessTable::Address, SocthermAccessTable::Size, },
|
||||
{ EmcAccessTable1::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController1.GetAddress(), EmcAccessTable1::Address, EmcAccessTable1::Size, },
|
||||
{ EmcAccessTable2::ReducedAccessTable.data(), MemoryRegionVirtualDeviceExternalMemoryController2.GetAddress(), EmcAccessTable2::Address, EmcAccessTable2::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, },
|
||||
};
|
||||
@@ -93,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];
|
||||
@@ -104,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. */
|
||||
@@ -114,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);
|
||||
@@ -174,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. */
|
||||
@@ -204,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:
|
||||
@@ -225,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();
|
||||
@@ -298,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] */
|
||||
@@ -523,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;
|
||||
@@ -534,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,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());
|
||||
@@ -620,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);
|
||||
@@ -692,11 +730,11 @@ namespace ams::ldr {
|
||||
|
||||
/* Apply PCV and PTM patches */
|
||||
if (g_is_pcv) {
|
||||
oc::pcv::Patch(map_address, nso_size);
|
||||
hoc::pcv::Patch(map_address, nso_size);
|
||||
}
|
||||
|
||||
if (g_is_ptm) {
|
||||
oc::ptm::Patch(map_address, nso_size);
|
||||
hoc::ptm::Patch(map_address, nso_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,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. */
|
||||
@@ -753,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;
|
||||
@@ -767,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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -811,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. */
|
||||
{
|
||||
@@ -829,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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -26,18 +26,25 @@
|
||||
#define DISABLED 0
|
||||
#define DEACTIVATED_GPU_FREQ 2000
|
||||
#define GPU_MIN_MIN_VOLT 480000
|
||||
#define CPU_MAX_MAX_VOLT 1235000
|
||||
#define CPU_MAX_MAX_VOLT 1200000
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
volatile CustomizeTable C = {
|
||||
|
||||
/* Disables RAM powerdown */
|
||||
.hpMode = DISABLED,
|
||||
|
||||
.commonEmcMemVolt = 1175000, // LPDDR4X JEDEC Specification
|
||||
.eristaEmcMaxClock = 1600000, // Maximum HB-MGCH ram rating
|
||||
.commonEmcMemVolt = 1175000, /* LPDDR4(X) JEDEC Specification */
|
||||
.eristaEmcMaxClock = 1600000, /* Maximum HB-MGCH ram rating */
|
||||
.eristaEmcMaxClock1 = 1600000,
|
||||
.eristaEmcMaxClock2 = 1600000,
|
||||
|
||||
.marikoEmcMaxClock = 2133000,
|
||||
/* Available: 66MHz step rate, 100MHz step rate and jedec. */
|
||||
/* Jedec freqs are 1333MHz, 1600MHz, 1866MHz, 2133MHz, 2400MHz, 2666MHz, 2933MHz, 3200MHz. */
|
||||
.stepMode = StepMode_66MHz,
|
||||
|
||||
.marikoEmcMaxClock = 2133000, /* 1866MHz @ 1866tWRL is guaranteed to work on all Mariko units */
|
||||
.marikoEmcVddqVolt = 600000,
|
||||
.emcDvbShift = 0,
|
||||
|
||||
@@ -52,51 +59,93 @@ volatile CustomizeTable C = {
|
||||
.t7_tWTR = 0,
|
||||
.t8_tREFI = 0,
|
||||
|
||||
/* Set to 4 read and 2 write for 1866b tWRL. */
|
||||
/* For 2133 tWRL: 8 read and 4 write. */
|
||||
.mem_burst_read_latency = 8,
|
||||
.mem_burst_write_latency = 4,
|
||||
/* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */
|
||||
/* This is a lazy workaround until I find the issue... */
|
||||
.t2_tRP_cap = 2,
|
||||
|
||||
/* Frequency where non low timings gets used. */
|
||||
.timingEmcTbreak = DISABLED,
|
||||
.low_t6_tRTW = DISABLED,
|
||||
.low_t7_tWTR = DISABLED,
|
||||
|
||||
.readLatency = {
|
||||
DISABLED,
|
||||
DISABLED,
|
||||
DISABLED,
|
||||
DISABLED,
|
||||
},
|
||||
|
||||
.writeLatency = {
|
||||
DISABLED,
|
||||
DISABLED,
|
||||
DISABLED,
|
||||
DISABLED,
|
||||
},
|
||||
|
||||
/* You can mix and match different latencies if needed */
|
||||
/*
|
||||
* Read:
|
||||
* 2133RL = 40
|
||||
* 1866RL = 36
|
||||
* 1600RL = 32
|
||||
* 1331RL = 28
|
||||
* Write:
|
||||
* 2133WL = 18
|
||||
* 1866WL = 16
|
||||
* 1600WL = 14
|
||||
* 1331WL = 12
|
||||
*/
|
||||
|
||||
.mem_burst_read_latency = RL_1600,
|
||||
.mem_burst_write_latency = WL_1600,
|
||||
|
||||
.eristaCpuUV = 0,
|
||||
.eristaCpuVmin = 800,
|
||||
.eristaCpuMaxVolt = 1200,
|
||||
/* Unlocks up to 2295 Mhz CPU, usage is not recommended. */
|
||||
/* Unlocks up to 2397 Mhz CPU, usage is not recommended. */
|
||||
.eristaCpuUnlock = DISABLED,
|
||||
|
||||
.marikoCpuUVLow = 0, // No undervolt
|
||||
.marikoCpuUVHigh = 0, // No undervolt
|
||||
.tableConf = DEFAULT_TABLE, /* TODO: Add AUTO */
|
||||
|
||||
.tableConf = TBREAK_1683,
|
||||
.marikoCpuLowVmin = 620,
|
||||
.marikoCpuHighVmin = 750,
|
||||
/* 1120mV is NVIDIA rating */
|
||||
.marikoCpuMaxVolt = 1120,
|
||||
|
||||
/* Supported values: 2397000, 2499000, 2601000, 2703000. */
|
||||
/* 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 = 2397000,
|
||||
.marikoCpuMaxClock = 1963500,
|
||||
|
||||
.eristaCpuBoostClock = 1785000, // Default boost clock
|
||||
.marikoCpuBoostClock = 1963000, // Default boost clock
|
||||
.marikoCpuBoostClock = 1963500, // Default boost clock
|
||||
|
||||
.eristaGpuUV = 0,
|
||||
.eristaGpuVmin = 800,
|
||||
.eristaGpuVmin = 810,
|
||||
|
||||
.marikoGpuUV = 0,
|
||||
/* For automatic vmin detection, set this to AUTO. */
|
||||
|
||||
/* Vmin past 795mV won't work due boot voltage being 800mV. */
|
||||
.marikoGpuVmin = 610,
|
||||
|
||||
.marikoGpuVmax = 800,
|
||||
|
||||
.commonGpuVoltOffset = 0,
|
||||
|
||||
/* Speedo is automatically set by hoc-clk on first boot */
|
||||
.gpuSpeedo = 1450,
|
||||
|
||||
/* This table is used with a gpu uv mode of 2. */
|
||||
/* Setting DEACTIVATED_GPU_FREQ on any freq will disable it and all freqs greater than it. (the latter is a bug :/) */
|
||||
/* AUTO: Voltage is optimally chosen; with commonGpuVoltOffset applied. */
|
||||
/* AUTO only works up to 1305 GPU */
|
||||
/* AUTO only works up to 1305 GPU on Mariko and 998 GPU on Erista (it is reccomended to manually set your 998MHz voltage though) */
|
||||
/* You can overwrite auto with any voltage (in mv) of your choice - offset will not be applied. */
|
||||
|
||||
.eristaGpuVoltArray = {
|
||||
AUTO /* 76 */,
|
||||
AUTO /* 115 */,
|
||||
@@ -142,9 +191,9 @@ volatile CustomizeTable C = {
|
||||
AUTO /* 921 */,
|
||||
AUTO /* 998 */,
|
||||
AUTO /* 1075 */,
|
||||
AUTO /* 1152 */,
|
||||
AUTO /* 1228 */,
|
||||
AUTO /* 1267 (Disabled by default) */,
|
||||
AUTO /* 1152 (SLT / HiOPT Only!) */,
|
||||
AUTO /* 1228 (HiOPT Only!) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1267 (Disabled by default) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1305 (Disabled by default) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1344 (Disabled by default) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1382 (Disabled by default) */,
|
||||
@@ -154,6 +203,10 @@ volatile CustomizeTable C = {
|
||||
DEACTIVATED_GPU_FREQ /* 1536 (Disabled by default) */,
|
||||
},
|
||||
|
||||
/* Advanced. */
|
||||
.fineTune_t6_tRTW = 0,
|
||||
.fineTune_t7_tWTR = 0,
|
||||
|
||||
/* You shouldn't have to anything past here. */
|
||||
.eristaCpuDvfsTable = {
|
||||
{ 204000, { 721094, }, { } },
|
||||
@@ -172,9 +225,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 = {
|
||||
@@ -196,9 +249,10 @@ volatile CustomizeTable C = {
|
||||
{ 1785000, { 1225000, }, { 5100873, -279186, 4747, } },
|
||||
{ 1887000, { 1225000, }, { 5100873, -279186, 4747, } },
|
||||
{ 1989000, { 1227500, }, { 5100873, -279186, 4747, } },
|
||||
{ 2091000, { 1256250, }, { 5100873, -279186, 4747, } },
|
||||
{ 2193000, { 1256250, }, { 5100873, -279186, 4747, } },
|
||||
{ 2091000, { 1227500, }, { 5100873, -279186, 4747, } },
|
||||
{ 2193000, { 1227500, }, { 5100873, -279186, 4747, } },
|
||||
{ 2295000, { 1256250, }, { 5100873, -279186, 4747, } },
|
||||
{ 2397000, { 1256250, }, { 5100873, -279186, 4747, } }, // Only for god speedo!
|
||||
},
|
||||
|
||||
.marikoCpuDvfsTable = {
|
||||
@@ -310,7 +364,7 @@ volatile CustomizeTable C = {
|
||||
{ 2703000, { 1838820, -36648, 113, }, { CPU_MAX_MAX_VOLT, } },
|
||||
},
|
||||
|
||||
.marikoCpuDvfsTableHelios {
|
||||
.marikoCpuDvfsTableExtreme {
|
||||
{ 204000, { 732856, -17335, 113, }, { } },
|
||||
{ 306000, { 760024, -18195, 113, }, { } },
|
||||
{ 408000, { 789258, -19055, 113, }, { } },
|
||||
@@ -438,7 +492,7 @@ volatile CustomizeTable C = {
|
||||
{ 921600, { }, { 970060,-10108, -614,-179, 1508, -13 } },
|
||||
{ 998400, { }, { 1065665,-16075, -497,-179, 3213, 9 } },
|
||||
{ 1075200, { }, { 1132576,-16093, -648, 0, 1077, 40 } },
|
||||
{ 1152000, { }, { 1180029,-14534, -830, 0, 1469, 110 } },
|
||||
// { 1152000, { }, { 1180029,-14534, -830, 0, 1469, 110 } },
|
||||
// { 1228800, { }, { 1248293,-16383, -859, 0, 3722, 313 } },
|
||||
// { 1267200, { }, { 1286399,-17475, -867, 0, 3681, 559 } },
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -20,25 +20,53 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CUST_REV 11
|
||||
#define CUST_REV 2
|
||||
|
||||
#include "oc_common.hpp"
|
||||
#include "pcv/pcv_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
#include "mtc_timing_table.hpp"
|
||||
|
||||
enum MtcConfig: u32 {
|
||||
AUTO_ADJ = 0,
|
||||
AUTO_ADJ_BL = 1,
|
||||
};
|
||||
|
||||
enum TableConfig: u32 {
|
||||
DEFAULT_TABLE = 1,
|
||||
TBREAK_1581 = 2,
|
||||
TBREAK_1683 = 3,
|
||||
HELIOS_TABLE = 4,
|
||||
EXTREME_TABLE = 4,
|
||||
};
|
||||
|
||||
enum StepMode: u32 {
|
||||
StepMode_66MHz = 0,
|
||||
StepMode_100MHz = 1,
|
||||
StepMode_Jedec = 2,
|
||||
};
|
||||
|
||||
/*
|
||||
* Read:
|
||||
* 2133RL = 40
|
||||
* 1866RL = 36
|
||||
* 1600RL = 32
|
||||
* 1331RL = 28
|
||||
* Write:
|
||||
* 2133WL = 18
|
||||
* 1866WL = 16
|
||||
* 1600WL = 14
|
||||
* 1331WL = 12
|
||||
*/
|
||||
|
||||
enum ReadLatency: u32 {
|
||||
RL_2133 = 40,
|
||||
RL_1866 = 36,
|
||||
RL_1600 = 32,
|
||||
RL_1331 = 28,
|
||||
};
|
||||
|
||||
enum WriteLatency: u32 {
|
||||
WL_2133 = 18,
|
||||
WL_1866 = 16,
|
||||
WL_1600 = 14,
|
||||
WL_1331 = 12,
|
||||
};
|
||||
|
||||
using CustomizeCpuDvfsTable = pcv::cvb_entry_t[pcv::DvfsTableEntryLimit];
|
||||
@@ -53,16 +81,18 @@ typedef struct CustomizeTable {
|
||||
u8 cust[4] = {'C', 'U', 'S', 'T'};
|
||||
u32 custRev = CUST_REV;
|
||||
|
||||
u32 mtcConf;
|
||||
u32 placeholder;
|
||||
u32 hpMode;
|
||||
|
||||
u32 commonEmcMemVolt;
|
||||
u32 eristaEmcMaxClock;
|
||||
u32 eristaEmcMaxClock1;
|
||||
u32 eristaEmcMaxClock2;
|
||||
|
||||
StepMode stepMode;
|
||||
u32 marikoEmcMaxClock;
|
||||
u32 marikoEmcVddqVolt;
|
||||
u32 emcDvbShift;
|
||||
|
||||
// advanced config
|
||||
u32 t1_tRCD;
|
||||
u32 t2_tRP;
|
||||
@@ -73,6 +103,15 @@ typedef struct CustomizeTable {
|
||||
u32 t7_tWTR;
|
||||
u32 t8_tREFI;
|
||||
|
||||
u32 t2_tRP_cap;
|
||||
|
||||
u32 timingEmcTbreak;
|
||||
u32 low_t6_tRTW;
|
||||
u32 low_t7_tWTR;
|
||||
|
||||
u32 readLatency[4];
|
||||
u32 writeLatency[4];
|
||||
|
||||
u32 mem_burst_read_latency;
|
||||
u32 mem_burst_write_latency;
|
||||
|
||||
@@ -101,12 +140,16 @@ typedef struct CustomizeTable {
|
||||
|
||||
u32 commonGpuVoltOffset;
|
||||
|
||||
/* TODO: Automatically detect speedo. */
|
||||
u32 gpuSpeedo;
|
||||
|
||||
u32 eristaGpuVoltArray[27];
|
||||
u32 marikoGpuVoltArray[24];
|
||||
|
||||
u32 fineTune_t6_tRTW;
|
||||
u32 fineTune_t7_tWTR;
|
||||
|
||||
u32 reserved[60];
|
||||
|
||||
CustomizeCpuDvfsTable eristaCpuDvfsTable;
|
||||
CustomizeCpuDvfsTable eristaCpuDvfsTableSLT;
|
||||
|
||||
@@ -114,7 +157,7 @@ typedef struct CustomizeTable {
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTableSLT;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTable1581Tbreak;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTable1683Tbreak;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTableHelios;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTableExtreme;
|
||||
|
||||
CustomizeGpuDvfsTable eristaGpuDvfsTable;
|
||||
CustomizeGpuDvfsTable eristaGpuDvfsTableSLT;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) Lightos_
|
||||
*
|
||||
* 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 "../mtc_timing_value.hpp"
|
||||
|
||||
namespace ams::ldr::hoc::pcv::erista {
|
||||
|
||||
void CalculateTimings(double tCK_avg) {
|
||||
tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL - (C.t6_tRTW * 3) + finetRTW;
|
||||
tWTPDEN = CEIL(((1.803 / tCK_avg) + MAX(RL + (2.694 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
||||
tW2R = FLOOR(MAX((5.020 / tCK_avg) + 1.130, WL - MAX(-CEIL(0.258 * (WL - RL)), 1.964)) * 1.964) + WL - CEIL(tWTR / tCK_avg) + finetWTR;
|
||||
|
||||
pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
||||
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
||||
|
||||
const double tMMRI = tRCD + (tCK_avg * 3);
|
||||
pdex2mrr = tMMRI + 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Lightos_
|
||||
*
|
||||
* 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
|
||||
|
||||
namespace ams::ldr::hoc::pcv::erista {
|
||||
|
||||
void CalculateTimings(double tCK_avg);
|
||||
|
||||
}
|
||||
@@ -14,132 +14,190 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../oc_common.hpp"
|
||||
#include <stratosphere.hpp>
|
||||
#include "../mtc_timing_value.hpp"
|
||||
#include "timing_tables.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
u32 GetRext() {
|
||||
void GetRext() {
|
||||
if (auto r = FindRext()) {
|
||||
return r->correct;
|
||||
rext = r->rext;
|
||||
return;
|
||||
}
|
||||
return 0x1A;
|
||||
|
||||
/* Fallback. */
|
||||
rext = 0x1A;
|
||||
}
|
||||
|
||||
/* TODO: This function is quite uggly, refactor! */
|
||||
void CalculateMiscTimings() {
|
||||
rdv = 0x39 + C.mem_burst_read_latency;
|
||||
einput_duration = 0x1C;
|
||||
quse_width = 0x8;
|
||||
void SwitchLatency(volatile u32 &latency, u32 index, u32 latencyStep) {
|
||||
latency += index * latencyStep;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < g_misc_table_size; i++) {
|
||||
const auto& e = g_misc_table[i];
|
||||
if (C.marikoEmcMaxClock >= e.min_freq) {
|
||||
rdv += e.rdv_inc;
|
||||
if (e.einput) einput_duration = e.einput;
|
||||
if (e.quse_width) quse_width = e.quse_width;
|
||||
static u32 GetMaxLatencyIndex(volatile u32 *latencyArray, u32 latencySize) {
|
||||
u32 maxIndex = 0;
|
||||
for (u32 i = 0; i < latencySize; ++i) {
|
||||
if (latencyArray[i]) {
|
||||
maxIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
rext = GetRext();
|
||||
return maxIndex;
|
||||
}
|
||||
|
||||
void CalculateIbdly() {
|
||||
/* Ibdly is so inconsistent, I am using the most common value and then checking with a lookup table. */
|
||||
ibdly = 0x1000001D + C.mem_burst_read_latency;
|
||||
|
||||
if (auto patch = FindIbdlyPatch()) {
|
||||
ibdly += patch->adjust;
|
||||
void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) {
|
||||
if (freq > 1600'000 && freq <= 1866'000) { /* 1866tRWL */
|
||||
latency += latencyStep * 2;
|
||||
} else { /* 2133tRWL */
|
||||
latency += latencyStep * 3;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateObdly() {
|
||||
obdly = 0x10000002 + C.mem_burst_write_latency;
|
||||
void HandleLatency(u32 freq, volatile u32 &latency, volatile u32 *latencyArray, u32 indexMax, u32 latencyStep) {
|
||||
for (u32 i = 0; i <= indexMax; ++i) {
|
||||
if (latencyArray[i] != 0 && freq <= latencyArray[i]) {
|
||||
SwitchLatency(latency, i, latencyStep);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto patch = FindObdlyPatch()) {
|
||||
obdly += patch->adjust;
|
||||
SwitchLatency(latency, indexMax, latencyStep);
|
||||
}
|
||||
|
||||
void HandleLatency(u32 freq) {
|
||||
static u32 rlIndexMax = GetMaxLatencyIndex(C.readLatency, std::size(C.readLatency));
|
||||
static u32 wlIndexMax = GetMaxLatencyIndex(C.writeLatency, std::size(C.writeLatency));
|
||||
constexpr u32 ReadLatencyStep = 4;
|
||||
constexpr u32 WriteLatencyStep = 2;
|
||||
bool autoLatencyRead = false, autoLatencyWrite = false;
|
||||
|
||||
if (rlIndexMax == 0) {
|
||||
AutoLatency(RL, freq, ReadLatencyStep);
|
||||
autoLatencyRead = true;
|
||||
}
|
||||
|
||||
if (wlIndexMax == 0) {
|
||||
AutoLatency(WL, freq, WriteLatencyStep);
|
||||
autoLatencyWrite = true;
|
||||
}
|
||||
|
||||
if (autoLatencyRead && autoLatencyWrite) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoLatencyRead) {
|
||||
HandleLatency(freq, RL, C.readLatency, rlIndexMax, ReadLatencyStep);
|
||||
}
|
||||
|
||||
if (!autoLatencyWrite) {
|
||||
HandleLatency(freq, WL, C.writeLatency, wlIndexMax, WriteLatencyStep);
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateTWTPDEN() {
|
||||
tWTPDEN = tW2P + 1 + CEIL(tDQSS_max / tCK_avg) + CEIL(tDQS2DQ_max / tCK_avg) + 6;
|
||||
if (C.marikoEmcMaxClock >= 2'233'000 && C.marikoEmcMaxClock < 2'533'000) tWTPDEN++;
|
||||
if (C.marikoEmcMaxClock >= 2'433'000 && C.marikoEmcMaxClock < 2'800'000) tWTPDEN--;
|
||||
}
|
||||
void CalculateMrw2() {
|
||||
static const u8 rlMapDBI[8] = {
|
||||
6, 12, 16, 22, 28, 32, 36, 40
|
||||
};
|
||||
|
||||
void CalculateTR2W() {
|
||||
tR2W = CEIL(RL_DBI + (tDQSCK_max / tCK_avg) + (BL / 2) - WL + tWPRE + FLOOR(tRPST) + 9.0) - (C.t6_tRTW * 3);
|
||||
static const u8 wlMapSetA[8] = {
|
||||
4, 6, 8, 10, 12, 14, 16, 18
|
||||
};
|
||||
|
||||
if (auto patch = FindTR2WPatch()) {
|
||||
tR2W += patch->adjust;
|
||||
}
|
||||
}
|
||||
u32 rlIndex = 0;
|
||||
u32 wlIndex = 0;
|
||||
|
||||
void CalculateQrst() {
|
||||
qrst = 0x00070000;
|
||||
u32 qrst_calc = ROUND(22.1 - (C.marikoEmcMaxClock / 1000000.0) * 8.0) + C.mem_burst_read_latency;
|
||||
u32 qrst_low = MAX(static_cast<u32>(0), qrst_calc);
|
||||
|
||||
if (C.marikoEmcMaxClock >= 2'533'000) {
|
||||
qrst = INCREMENT_HIGH_BYTES_BY(qrst, 1);
|
||||
} else if (C.marikoEmcMaxClock == 2'800'000) {
|
||||
qrst = SET_HIGH_BYTES(qrst, 6);
|
||||
for (u32 i = 0; i < std::size(rlMapDBI); ++i) {
|
||||
if (rlMapDBI[i] == RL) {
|
||||
rlIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qrst = SET_LOW_BYTES(qrst, qrst_low);
|
||||
|
||||
if (auto patch = FindQrstPatch()) {
|
||||
qrst = INCREMENT_LOW_BYTES_BY(qrst, patch->adjust);
|
||||
for (u32 i = 0; i < std::size(wlMapSetA); ++i) {
|
||||
if (wlMapSetA[i] == WL) {
|
||||
wlIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mrw2 = static_cast<u8>(((rlIndex & 0x7) | ((wlIndex & 0x7) << 3) | ((0 & 0x1) << 6)));
|
||||
}
|
||||
|
||||
void CalculateQsafe() {
|
||||
qsafe = ROUND((C.marikoEmcMaxClock / 1000.0) / 138.0 + 37.4) + C.mem_burst_read_latency;
|
||||
if (auto patch = FindQsafePatch()) {
|
||||
qsafe += patch->adjust;
|
||||
void CalculateTimings(double tCK_avg, u32 freq) {
|
||||
RL = RL_1331;
|
||||
WL = WL_1331;
|
||||
|
||||
HandleLatency(freq);
|
||||
|
||||
GetRext();
|
||||
|
||||
/* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */
|
||||
/* This is a lazy workaround until I find the issue... */
|
||||
u32 tRPpbIndex = C.t2_tRP;
|
||||
if (WL == WL_1331) {
|
||||
tRPpbIndex = MIN(C.t2_tRP_cap, C.t2_tRP);
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateQpop() {
|
||||
qpop = FLOOR(((C.marikoEmcMaxClock / 1000.0) - 2133 + 167) / 200.0) + 0x2D + C.mem_burst_read_latency;
|
||||
tRCD = tRCD_values[C.t1_tRCD];
|
||||
tRPpb = tRP_values[tRPpbIndex];
|
||||
tRAS = tRAS_values[C.t3_tRAS];
|
||||
tRRD = tRRD_values[C.t4_tRRD];
|
||||
tRFCpb = tRFC_values[C.t5_tRFC];
|
||||
u32 tRTW = C.t6_tRTW;
|
||||
u32 tWTR = 10 - tWTR_values[C.t7_tWTR];
|
||||
|
||||
if (C.marikoEmcMaxClock >= 3'133'000) qpop++;
|
||||
}
|
||||
|
||||
void CalculatePdex2rw() {
|
||||
double freq_mhz = C.marikoEmcMaxClock / 1000.0;
|
||||
|
||||
double pdex_local = (0.011 * freq_mhz) - 1.443;
|
||||
pdex2rw = static_cast<u32>(ROUND(pdex_local));
|
||||
|
||||
if (pdex2rw < 22) pdex2rw = 22;
|
||||
if (pdex2rw > 33) pdex2rw = 33;
|
||||
|
||||
if (auto patch = FindPdex2rwPatch()) {
|
||||
pdex2rw += patch->adjust;
|
||||
if (freq < C.timingEmcTbreak) {
|
||||
tRTW = C.low_t6_tRTW;
|
||||
tWTR = 10 - tWTR_values[C.low_t7_tWTR];
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateCke2pden() {
|
||||
cke2pden = (static_cast<double>((C.marikoEmcMaxClock / 1000.0) * 0.00875) - 0.65);
|
||||
s32 finetRTW = C.fineTune_t6_tRTW;
|
||||
s32 finetWTR = C.fineTune_t7_tWTR;
|
||||
|
||||
if (auto patch = FindCke2pdenPatch()) {
|
||||
cke2pden += patch->adjust;
|
||||
}
|
||||
}
|
||||
tRC = tRAS + tRPpb;
|
||||
tRFCab = tRFCpb * 2;
|
||||
tXSR = static_cast<double>(tRFCab + 7.5);
|
||||
tFAW = static_cast<u32>(tRRD * 4.0);
|
||||
tRPab = tRPpb + 3;
|
||||
|
||||
void CalculateTimings() {
|
||||
CalculateMiscTimings();
|
||||
CalculateIbdly();
|
||||
CalculateObdly();
|
||||
CalculateTWTPDEN();
|
||||
CalculateTR2W();
|
||||
CalculateQrst();
|
||||
CalculateQsafe();
|
||||
CalculateQpop();
|
||||
CalculatePdex2rw();
|
||||
CalculateCke2pden();
|
||||
tR2P = CEIL((RL * 0.426) - 2.0);
|
||||
tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL - (tRTW * 3) + finetRTW;
|
||||
tRTM = FLOOR((10.0 + RL) + (3.502 / tCK_avg)) + FLOOR(7.489 / tCK_avg);
|
||||
tRATM = CEIL((tRTM - 10.0) + (RL * 0.426));
|
||||
|
||||
rdv = RL + FLOOR((5.105 / tCK_avg) + 17.017);
|
||||
qpop = rdv - 14;
|
||||
quse_width = CEIL(((4.897 / tCK_avg) - FLOOR(2.538 / tCK_avg)) + 3.782);
|
||||
quse = FLOOR(RL + ((5.082 / tCK_avg) + FLOOR(2.560 / tCK_avg))) - CEIL(4.820 / tCK_avg);
|
||||
einput_duration = FLOOR(9.936 / tCK_avg) + 5.0 + quse_width;
|
||||
einput = quse - CEIL(9.928 / tCK_avg);
|
||||
u32 qrst_duration = FLOOR(8.399 - tCK_avg);
|
||||
u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
||||
qrst = PACK_U32(qrst_duration, qrstLow);
|
||||
ibdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(1, quse - qrst_duration - 2.0);
|
||||
qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput);
|
||||
tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||
tWTPDEN = CEIL(((1.803 / tCK_avg) + MAX(RL + (2.694 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
||||
tW2R = FLOOR(MAX((5.020 / tCK_avg) + 1.130, WL - MAX(-CEIL(0.258 * (WL - RL)), 1.964)) * 1.964) + WL - CEIL(tWTR / tCK_avg) + finetWTR;
|
||||
tWTM = CEIL(WL + ((7.570 / tCK_avg) + 8.753));
|
||||
tWATM = (tWTM + (FLOOR(WL / 0.816) * 2.0)) - 4.0;
|
||||
|
||||
wdv = WL;
|
||||
wsv = WL - 2;
|
||||
wev = 0xA + (WL - 14);
|
||||
|
||||
u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
||||
u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
||||
obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
||||
|
||||
pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
||||
|
||||
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
||||
|
||||
u32 tMMRI = tRCD + (tCK_avg * 3);
|
||||
pdex2mrr = tMMRI + 10;
|
||||
|
||||
CalculateMrw2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
void CalculateTimings();
|
||||
void CalculateTimings(double tCK_avg, u32 freq);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,35 +17,7 @@
|
||||
#include "../mtc_timing_value.hpp"
|
||||
#include "timing_tables.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
|
||||
const MiscTimings g_misc_table[] = {
|
||||
{1'866'000, 1, 0x20, 0x9, },
|
||||
{2'133'000, 1, 0x24, 0xA, },
|
||||
{2'166'000, 1, 0, 0, },
|
||||
{2'233'000, 0, 0x25, 0, },
|
||||
{2'300'000, 0, 0x26, 0xB, },
|
||||
{2'333'000, 0, 0x27, 0, },
|
||||
{2'366'000, 1, 0x26, 0xA, },
|
||||
{2'433'000, 0, 0x27, 0, },
|
||||
{2'466'000, 0, 0x2A, 0, },
|
||||
{2'500'000, 0, 0x28, 0xB, },
|
||||
{2'533'000, 0, 0x29, 0, },
|
||||
{2'566'000, 1, 0, 0, },
|
||||
{2'633'000, 0, 0x2A, 0, },
|
||||
{2'700'000, 0, 0x2B, 0xC, },
|
||||
{2'733'000, 0, 0x2C, 0, },
|
||||
{2'766'000, 1, 0x2B, 0xB, },
|
||||
{2'833'000, 0, 0x2C, 0, },
|
||||
{2'866'000, 0, 0, 0, },
|
||||
{2'900'000, 0, 0, 0, },
|
||||
{2'933'000, 0, 0x2E, 0xC, },
|
||||
{2'966'000, 1, 0, 0, },
|
||||
{3'033'000, 0, 0x2F, 0, },
|
||||
{3'133'000, 1, 0x31, 0xD, },
|
||||
};
|
||||
|
||||
const u32 g_misc_table_size = sizeof(g_misc_table) / sizeof(g_misc_table[0]);
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
const ReplacePatch g_rext_table[] = {
|
||||
{2'133'000, 0x1A}, {2'166'000, 0x19}, {2'200'000, 0x19},
|
||||
@@ -64,206 +36,11 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
const u32 g_rext_table_size = sizeof(g_rext_table) / sizeof(g_rext_table[0]);
|
||||
|
||||
const ReplacePatch *FindRext() {
|
||||
for (u32 i = 0; i < g_rext_table_size; i++)
|
||||
if (g_rext_table[i].freq == C.marikoEmcMaxClock)
|
||||
for (u32 i = 0; i < g_rext_table_size; i++) {
|
||||
if (g_rext_table[i].freq >= C.marikoEmcMaxClock) {
|
||||
return &g_rext_table[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_ibdly_patches[] = {
|
||||
{2'133'000, -2},
|
||||
{2'166'000, -1},
|
||||
{2'200'000, -1},
|
||||
{2'233'000, -1},
|
||||
{2'266'000, -1},
|
||||
{2'300'000, -2},
|
||||
{2'333'000, -2},
|
||||
{2'500'000, -1},
|
||||
{2'533'000, -2},
|
||||
{2'566'000, -1},
|
||||
{2'600'000, -1},
|
||||
{2'633'000, -1},
|
||||
{2'666'000, -1},
|
||||
{2'700'000, -2},
|
||||
{2'733'000, -2},
|
||||
{2'933'000, -1},
|
||||
};
|
||||
|
||||
const u32 g_ibdly_table_size = sizeof(g_ibdly_patches) / sizeof(g_ibdly_patches[0]);
|
||||
|
||||
const AdjustPatch *FindIbdlyPatch() {
|
||||
for (u32 i = 0; i < g_ibdly_table_size; i++)
|
||||
if (g_ibdly_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_ibdly_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_obdly_patches[] = {
|
||||
{2'533'000, -2},
|
||||
{2'566'000, -2},
|
||||
{2'600'000, -2},
|
||||
{2'633'000, -2},
|
||||
{2'666'000, -2},
|
||||
{2'700'000, -2},
|
||||
{2'733'000, -2},
|
||||
{2'766'000, -2},
|
||||
{2'800'000, -2},
|
||||
{2'833'000, -2},
|
||||
{2'866'000, -2},
|
||||
{2'900'000, -2},
|
||||
{2'933'000, -2},
|
||||
{2'966'000, -2},
|
||||
{3'000'000, -2},
|
||||
{3'033'000, -2},
|
||||
{3'066'000, -2},
|
||||
{3'100'000, -2},
|
||||
{3'133'000, -2},
|
||||
{3'166'000, -2},
|
||||
{3'200'000, -2},
|
||||
};
|
||||
|
||||
const u32 g_obdly_table_size = sizeof(g_obdly_patches) / sizeof(g_obdly_patches[0]);
|
||||
|
||||
const AdjustPatch *FindObdlyPatch() {
|
||||
for (u32 i = 0; i < g_obdly_table_size; i++)
|
||||
if (g_obdly_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_obdly_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_tr2w_patches[] = {
|
||||
{2'500'000, 1},
|
||||
{2'533'000, 1},
|
||||
{2'566'000, 1},
|
||||
{2'866'000, -1},
|
||||
{3'100'000, 1},
|
||||
{3'133'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_tr2w_table_size = sizeof(g_tr2w_patches) / sizeof(g_tr2w_patches[0]);
|
||||
|
||||
const AdjustPatch *FindTR2WPatch() {
|
||||
for (u32 i = 0; i < g_tr2w_table_size; i++)
|
||||
if (g_tr2w_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_tr2w_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_qrst_patches[] = {
|
||||
{2'166'000, 1},
|
||||
{2'200'000, 1},
|
||||
{2'233'000, 1},
|
||||
{2'266'000, 1},
|
||||
{2'366'000, 2},
|
||||
{2'400'000, 2},
|
||||
{2'433'000, 1},
|
||||
{2'466'000, 2},
|
||||
{2'500'000, 1},
|
||||
{2'533'000, -1},
|
||||
{2'600'000, 1},
|
||||
{2'700'000, -1},
|
||||
{2'733'000, -1},
|
||||
{2'766'000, 1},
|
||||
{2'800'000, 1},
|
||||
{2'833'000, 1},
|
||||
{2'866'000, 1},
|
||||
{2'900'000, 1},
|
||||
{2'933'000, -1},
|
||||
{2'966'000, 1},
|
||||
{3'000'000, 1},
|
||||
{3'100'000, 1},
|
||||
{3'166'000, 1},
|
||||
{3'200'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_qrst_table_size = sizeof(g_qrst_patches) / sizeof(g_qrst_patches[0]);
|
||||
|
||||
const AdjustPatch *FindQrstPatch() {
|
||||
for (u32 i = 0; i < g_qrst_table_size; i++)
|
||||
if (g_qrst_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_qrst_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_qsafe_patches[] = {
|
||||
{2'166'000, 1},
|
||||
{2'200'000, 1},
|
||||
{2'500'000, -1},
|
||||
{2'533'000, -1},
|
||||
{2'666'000, -1},
|
||||
{2'700'000, -1},
|
||||
{2'733'000, -1},
|
||||
{2'800'000, -1},
|
||||
{2'833'000, -1},
|
||||
{2'866'000, -1},
|
||||
{2'900'000, -1},
|
||||
{2'933'000, -2},
|
||||
{2'966'000, -1},
|
||||
{3'000'000, -1},
|
||||
{3'033'000, -1},
|
||||
{3'066'000, -2},
|
||||
{3'100'000, -2},
|
||||
{3'166'000, -1},
|
||||
{3'200'000, -1},
|
||||
};
|
||||
|
||||
const u32 g_qsafe_table_size = sizeof(g_qsafe_patches) / sizeof(g_qsafe_patches[0]);
|
||||
|
||||
const AdjustPatch *FindQsafePatch() {
|
||||
for (u32 i = 0; i < g_qsafe_table_size; i++)
|
||||
if (g_qsafe_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_qsafe_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_pdex2rw_patches[] = {
|
||||
{2'166'000, 1},
|
||||
{2'300'000, 1},
|
||||
{2'333'000, 1},
|
||||
{2'433'000, 1},
|
||||
{2'533'000, 0},
|
||||
{2'633'000, -1},
|
||||
{2'666'000, -1},
|
||||
{2'733'000, -1},
|
||||
{2'766'000, -1},
|
||||
{2'800'000, -1},
|
||||
{2'833'000, -1},
|
||||
{2'933'000, -1},
|
||||
{3'066'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_pdex2rw_table_size = sizeof(g_pdex2rw_patches) / sizeof(g_pdex2rw_patches[0]);
|
||||
|
||||
const AdjustPatch *FindPdex2rwPatch() {
|
||||
for (u32 i = 0; i < g_pdex2rw_table_size; i++)
|
||||
if (g_pdex2rw_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_pdex2rw_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_cke2pden_patches[] = {
|
||||
{2'133'000, 1},
|
||||
{2'166'000, 1},
|
||||
{2'266'000, 1},
|
||||
{2'300'000, 1},
|
||||
{2'366'000, 1},
|
||||
{2'400'000, 1},
|
||||
{2'500'000, 1},
|
||||
{2'633'000, 1},
|
||||
{2'733'000, 1},
|
||||
{2'833'000, 1},
|
||||
{2'866'000, 1},
|
||||
{2'966'000, 1},
|
||||
{3'066'000, 1},
|
||||
{3'100'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_cke2pden_table_size = sizeof(g_cke2pden_patches) / sizeof(g_cke2pden_patches[0]);
|
||||
|
||||
const AdjustPatch *FindCke2pdenPatch() {
|
||||
for (u32 i = 0; i < g_cke2pden_table_size; i++)
|
||||
if (g_cke2pden_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_cke2pden_patches[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,58 +17,15 @@
|
||||
#pragma once
|
||||
#include "../mtc_timing_value.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
struct ReplacePatch {
|
||||
u32 freq;
|
||||
u32 correct;
|
||||
u32 rext;
|
||||
};
|
||||
|
||||
extern const ReplacePatch g_rext_table[];
|
||||
extern const u32 g_rext_table_size;
|
||||
const ReplacePatch *FindRext();
|
||||
|
||||
struct AdjustPatch {
|
||||
u32 freq;
|
||||
s32 adjust;
|
||||
};
|
||||
|
||||
extern const AdjustPatch g_ibdly_patches[];
|
||||
extern const u32 g_ibdly_table_size;
|
||||
const AdjustPatch *FindIbdlyPatch();
|
||||
|
||||
extern const AdjustPatch g_obdly_patches[];
|
||||
extern const u32 g_obdly_table_size;
|
||||
const AdjustPatch *FindObdlyPatch();
|
||||
|
||||
extern const AdjustPatch g_tr2w_patches[];
|
||||
extern const u32 g_tr2w_table_size;
|
||||
const AdjustPatch *FindTR2WPatch();
|
||||
|
||||
extern const AdjustPatch g_qrst_patches[];
|
||||
extern const u32 q_qrst_table_size;
|
||||
const AdjustPatch *FindQrstPatch();
|
||||
|
||||
extern const AdjustPatch g_qsafe_patches[];
|
||||
extern const u32 g_qsafe_table_size;
|
||||
const AdjustPatch *FindQsafePatch();
|
||||
|
||||
extern const AdjustPatch g_pdex2rw_patches[];
|
||||
extern const u32 g_pdex2rw_table_size;
|
||||
const AdjustPatch *FindPdex2rwPatch();
|
||||
|
||||
extern const AdjustPatch g_cke2pden_patches[];
|
||||
extern const u32 g_cke2pden_table_size;
|
||||
const AdjustPatch *FindCke2pdenPatch();
|
||||
|
||||
struct MiscTimings {
|
||||
u32 min_freq;
|
||||
u32 rdv_inc;
|
||||
u32 einput;
|
||||
u32 quse_width;
|
||||
};
|
||||
|
||||
extern const MiscTimings g_misc_table[];
|
||||
extern const u32 g_misc_table_size;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,44 +20,32 @@
|
||||
|
||||
#include "oc_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
#define MAX(A, B) std::max(A, B)
|
||||
#define MIN(A, B) std::min(A, B)
|
||||
#define CEIL(A) std::ceil(A)
|
||||
#define FLOOR(A) std::floor(A)
|
||||
#define ROUND(A) std::lround(A)
|
||||
namespace ams::ldr::hoc {
|
||||
#define MAX(A, B) std::max(A, B)
|
||||
#define MIN(A, B) std::min(A, B)
|
||||
#define CEIL(A) std::ceil(A)
|
||||
#define FLOOR(A) std::floor(A)
|
||||
#define ROUND(A) std::lround(A)
|
||||
|
||||
#define GET_LOW_BYTES(x) ((u16)((x) & 0xFFFF))
|
||||
#define SET_LOW_BYTES(x, val) (((x) & 0xFFFF0000) | ((u32)(val) & 0xFFFF))
|
||||
#define INCREMENT_LOW_BYTES_BY(x, n) SET_LOW_BYTES((x), (GET_LOW_BYTES(x) + (n)))
|
||||
#define GET_HIGH_BYTES(x) ((u16)(((x) >> 16) & 0xFFFF))
|
||||
#define SET_HIGH_BYTES(x, val) (((x) & 0x0000FFFF) | (((u32)(val) & 0xFFFF) << 16))
|
||||
#define INCREMENT_HIGH_BYTES_BY(x, n) SET_HIGH_BYTES((x), (GET_HIGH_BYTES(x) + (n)))
|
||||
|
||||
/* Primary timings. */
|
||||
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||
const std::array<double, 7> tRRD_values = { /*10.0,*/ 7.5, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 }; /* 10.0 is used for <2133mhz; do we care? */
|
||||
const std::array<u32, 11> tRFC_values = { 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40 };
|
||||
const std::array<u32, 10> tWTR_values = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
const std::array<u32, 6> tREFpb_values = { 3900, 5850, 7800, 11700, 15600, 99999 };
|
||||
#define PACK_U32(high, low) ((static_cast<u32>(high) << 16) | (static_cast<u32>(low) & 0xFFFF))
|
||||
#define PACK_U32_NIBBLE_HIGH_BYTE_LOW(high, low) ((static_cast<u32>(high & 0xF) << 28) | (static_cast<u32>(low) & 0xFF))
|
||||
|
||||
/* Burst latency, not to be confused with base latency (tWRL). */
|
||||
const u32 BL = 16;
|
||||
|
||||
const u32 RL = 28 + C.mem_burst_read_latency;
|
||||
const u32 WL = 14 + C.mem_burst_write_latency;
|
||||
/* Base latency for read and write (tWRL). */
|
||||
const u32 RL = C.mem_burst_read_latency;
|
||||
const u32 WL = C.mem_burst_write_latency;
|
||||
|
||||
const u32 RL_DBI = RL + 4;
|
||||
|
||||
/* Precharge to Precharge Delay. (Cycles) */
|
||||
/* Precharge to Precharge Delay. (tCK) */
|
||||
const u32 tPPD = 4;
|
||||
|
||||
/* DQS output access time from CK_t/CK_c. */
|
||||
const double tDQSCK_max = 3.5;
|
||||
/* Write preamble. (tCK) */
|
||||
const u32 tWPRE = 2;
|
||||
|
||||
/* tCK Read postamble. */
|
||||
/* Read postamble. (tCK) */
|
||||
const double tRPST = 0.5;
|
||||
|
||||
/* Minimum Self-Refresh Time. (Entry to Exit) */
|
||||
@@ -66,99 +54,115 @@ namespace ams::ldr::oc {
|
||||
/* Exit power down to next valid command delay. */
|
||||
const double tXP = 7.5;
|
||||
|
||||
/* Write command to first DQS transition (max) (tCK) */
|
||||
const double tDQSS_max = 1.25;
|
||||
|
||||
/* DQ-to-DQS offset(max) (ns) */
|
||||
const double tDQS2DQ_max = 0.8;
|
||||
|
||||
/* Write recovery time. */
|
||||
const u32 tWR = 18;
|
||||
|
||||
/* TOOD: Fix erista */
|
||||
namespace pcv::erista {
|
||||
// const double tCK_avg = 1000'000.0 / C.eristaEmcMaxClock;
|
||||
//
|
||||
// /* Primary timings. */
|
||||
// const u32 tRCD = tRCD_values[C.t1_tRCD];
|
||||
// const u32 tRPpb = tRP_values[C.t2_tRP];
|
||||
// const u32 tRAS = tRAS_values[C.t3_tRAS];
|
||||
//
|
||||
// /* Secondary timings. */
|
||||
// const double tRRD = tRRD_values[C.t4_tRRD];
|
||||
// const u32 tRFCpb = tRFC_values[C.t5_tRFC];
|
||||
// const u32 tWTR = tWTR_values[C.t7_tWTR];
|
||||
// const u32 tREFpb = tREFpb_values[C.t8_tREFI];
|
||||
//
|
||||
// /* Four-bank ACTIVATE Window */
|
||||
// const u32 tFAW = (u32) (tRRD * 4.0);
|
||||
//
|
||||
// /* Latency stuff. */
|
||||
// const int tR2W = (int)((3.5 / tCK_avg) + 32 + (BL / 2) - 14 - 6 + tWPRE + 12 - (C.t6_tRTW * 3));
|
||||
// const int tW2R = (int)((tWTR / tCK_avg) + 18 - (BL / 2));
|
||||
// const int tRW2PDEN = (int)((tDQSS_max / tCK_avg) + 46 + (tDQS2DQ_max / tCK_avg) + 6);
|
||||
//
|
||||
// /* Refresh Cycle time. (All Banks) */
|
||||
// const u32 tRFCab = tRFCpb * 2;
|
||||
//
|
||||
// /* ACTIVATE-to-ACTIVATE command period. (same bank) */
|
||||
// const u32 tRC = tRAS + tRPpb;
|
||||
//
|
||||
// /* SELF REFRESH exit to next valid command delay. */
|
||||
// const double tXSR = (double) (tRFCab + 7.5);
|
||||
//
|
||||
// /* u32ernal READ to PRECHARGE command delay. */
|
||||
// const int pdex2mrr = (tCK_avg * 3.0) + tRCD_values[C.t1_tRCD] + 1;
|
||||
//
|
||||
// /* Row Precharge Time. (all banks) */
|
||||
// const u32 tRPab = tRPpb + 3;
|
||||
}
|
||||
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||
const std::array<double, 8> tRRD_values = { 10.0, 7.5, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 };
|
||||
const std::array<u32, 6> tRFC_values = { 90, 80, 70, 60, 50, 40 };
|
||||
const std::array<u32, 10> tWTR_values = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
const std::array<u32, 6> tREFpb_values = { 3900, 5850, 7800, 11700, 15600, 99999 };
|
||||
|
||||
namespace pcv::mariko {
|
||||
const double tCK_avg = 1000'000.0 / C.marikoEmcMaxClock;
|
||||
|
||||
const u32 tRCD = tRCD_values[C.t1_tRCD];
|
||||
const u32 tRPpb = tRP_values[C.t2_tRP];
|
||||
const u32 tRAS = tRAS_values[C.t3_tRAS];
|
||||
const u32 tRCD = tRCD_values[C.t1_tRCD];
|
||||
const u32 tRPpb = tRP_values[C.t2_tRP];
|
||||
const u32 tRAS = tRAS_values[C.t3_tRAS];
|
||||
const double tRRD = tRRD_values[C.t4_tRRD];
|
||||
const u32 tRFCpb = tRFC_values[C.t5_tRFC];
|
||||
const u32 tWTR = 10 - tWTR_values[C.t7_tWTR];
|
||||
const u32 tRFCpb = tRFC_values[C.t5_tRFC];
|
||||
const u32 tWTR = 10 - tWTR_values[C.t7_tWTR];
|
||||
const s32 finetRTW = C.fineTune_t6_tRTW;
|
||||
const s32 finetWTR = C.fineTune_t7_tWTR;
|
||||
|
||||
const u32 tRC = tRAS + tRPpb;
|
||||
const u32 tRFCab = tRFCpb * 2;
|
||||
const double tXSR = (double) (tRFCab + 7.5);
|
||||
const u32 tFAW = static_cast<u32>(tRRD * 4.0);
|
||||
const u32 tRC = tRAS + tRPpb;
|
||||
const u32 tRFCab = tRFCpb * 2;
|
||||
const double tXSR = static_cast<double>(tRFCab + 7.5);
|
||||
const u32 tFAW = static_cast<u32>(tRRD * 4.0);
|
||||
const double tRPab = tRPpb + 3;
|
||||
|
||||
const u32 tR2P = 12 + (C.mem_burst_read_latency / 2);
|
||||
const u32 tR2P = CEIL((RL * 0.426) - 2.0);
|
||||
inline u32 tR2W;
|
||||
const u32 tRTM = RL + 9 + (tDQSCK_max / tCK_avg) + FLOOR(tRPST) + CEIL(10 / tCK_avg); // Fix?
|
||||
const u32 tRATM = tRTM + CEIL(10 / tCK_avg) - 12; // Fix?
|
||||
inline u32 rdv;
|
||||
const u32 quse = FLOOR((-0.0048159 * (C.marikoEmcMaxClock / 1000.0)) + RL_DBI) + (FLOOR((C.marikoEmcMaxClock / 1000.0) * 0.0050997) * 1.5134);
|
||||
const u32 einput = quse - ((C.marikoEmcMaxClock / 1000.0) * 0.01);
|
||||
inline u32 einput_duration;
|
||||
inline u32 ibdly;
|
||||
inline u32 obdly;
|
||||
inline u32 quse_width;
|
||||
inline u32 rext;
|
||||
inline u32 qrst;
|
||||
inline u32 qsafe;
|
||||
inline u32 qpop;
|
||||
|
||||
const u32 tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||
inline u32 tWTPDEN;
|
||||
const u32 tW2R = CEIL(MAX(WL + (0.010322547033278747 * (C.marikoEmcMaxClock / 1000.0)), (WL * -0.2067922202979121) + FLOOR(((RL_DBI * -0.1331159971685554) + WL) * 3.654131957826108)) - (tWTR / tCK_avg));
|
||||
const u32 tWTM = WL + (BL / 2) + 1 + CEIL(7.5 / tCK_avg);
|
||||
const u32 tWATM = tWTM + CEIL(tWR / tCK_avg);
|
||||
|
||||
const u32 wdv = WL;
|
||||
const u32 wsv = WL - 2;
|
||||
const u32 wev = 0xA + C.mem_burst_write_latency;
|
||||
inline u32 tW2R;
|
||||
|
||||
inline u32 pdex2rw;
|
||||
inline u32 cke2pden;
|
||||
|
||||
const u32 tCKE = CEIL(1.0795 * CEIL(0.0074472 * (C.marikoEmcMaxClock / 1000.0)));
|
||||
inline u32 tCLKSTOP;
|
||||
|
||||
const double tMMRI = tRCD + (tCK_avg * 3);
|
||||
const double pdex2mrr = tMMRI + 10; /* Do this properly? */
|
||||
inline double pdex2mrr;
|
||||
}
|
||||
|
||||
namespace pcv::mariko {
|
||||
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||
const std::array<double, 7> tRRD_values = { /*10.0,*/ 7.5, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 }; /* 10.0 is used for <2133mhz; do we care? 8gb uses 7.5 tRRD on >=1331. */
|
||||
const std::array<u32, 11> tRFC_values = { 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40 };
|
||||
const std::array<u32, 10> tWTR_values = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
const std::array<u32, 6> tREFpb_values = { 3900, 5850, 7800, 11700, 15600, 99999 };
|
||||
|
||||
inline u32 tRCD;
|
||||
inline u32 tRPpb;
|
||||
inline u32 tRAS;
|
||||
inline double tRRD;
|
||||
inline u32 tRFCpb;
|
||||
|
||||
inline u32 tRC;
|
||||
inline u32 tRFCab;
|
||||
inline double tXSR;
|
||||
inline u32 tFAW;
|
||||
inline double tRPab;
|
||||
|
||||
inline u32 RL;
|
||||
inline u32 WL;
|
||||
|
||||
inline u32 tR2P;
|
||||
inline u32 tR2W;
|
||||
inline u32 tRTM;
|
||||
inline u32 tRATM;
|
||||
inline u32 rext;
|
||||
|
||||
inline u32 rdv;
|
||||
inline u32 qpop;
|
||||
inline u32 quse_width;
|
||||
inline u32 quse;
|
||||
inline u32 einput_duration;
|
||||
inline u32 einput;
|
||||
inline u32 qrst;
|
||||
inline u32 ibdly;
|
||||
inline u32 qsafe;
|
||||
|
||||
inline u32 tW2P;
|
||||
inline u32 tWTPDEN;
|
||||
inline u32 tW2R;
|
||||
inline u32 tWTM;
|
||||
inline u32 tWATM;
|
||||
|
||||
inline u32 wdv;
|
||||
inline u32 wsv;
|
||||
inline u32 wev;
|
||||
|
||||
inline u32 obdly;
|
||||
|
||||
inline u32 pdex2rw;
|
||||
|
||||
inline u32 tCLKSTOP;
|
||||
|
||||
inline u32 pdex2mrr;
|
||||
|
||||
inline u8 mrw2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#include "customize.hpp"
|
||||
#include "oc_log.hpp"
|
||||
|
||||
#define PATCH_OFFSET(offset, value) \
|
||||
static_assert(sizeof(__typeof__(offset)) <= sizeof(u64)); \
|
||||
@@ -50,9 +51,10 @@ namespace ams::ldr {
|
||||
R_DEFINE_ERROR_RESULT(UninitializedPatcher, 1013);
|
||||
R_DEFINE_ERROR_RESULT(UnsuccessfulPatcher, 1014);
|
||||
R_DEFINE_ERROR_RESULT(SafetyCheckFailure, 1015);
|
||||
R_DEFINE_ERROR_RESULT(InvalidMtcTablePattern, 1016);
|
||||
}
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
namespace ams::ldr::hoc {
|
||||
template<typename Pointer>
|
||||
struct PatcherEntry {
|
||||
using patternFn = bool(*)(Pointer* ptr);
|
||||
@@ -99,4 +101,25 @@ namespace ams::ldr::oc {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
|
||||
128
Source/Atmosphere/stratosphere/loader/source/oc/oc_log.cpp
Normal file
128
Source/Atmosphere/stratosphere/loader/source/oc/oc_log.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||
* Copyright (c) 2019 Atmosphere-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/>.
|
||||
*/
|
||||
|
||||
/* See https://github.com/lulle2007200/emuMMC/blob/internal-emummc/source/ */
|
||||
|
||||
#include "oc_common.hpp"
|
||||
|
||||
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||
#include "fatal_handler_bin.h"
|
||||
#endif
|
||||
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
#define ATMOSPHERE_REBOOT_TO_FATAL_MAGIC 0x32454641
|
||||
#define ATMOSPHERE_IRAM_PAYLOAD_BASE 0x40010000
|
||||
#define ATMOSPHERE_FATAL_ERROR_ADDR 0x4003E000
|
||||
|
||||
_Alignas(4096) u8 working_buf[4096];
|
||||
|
||||
void SmcRebootToIramPayload() {
|
||||
SecmonArgs args;
|
||||
args.X[0] = 0xC3000401;
|
||||
args.X[1] = 65001;
|
||||
args.X[2] = 0;
|
||||
args.X[3] = 2;
|
||||
svcCallSecureMonitor(&args);
|
||||
}
|
||||
|
||||
Result SmcCopyToIram(uintptr_t dest, const void *src, u32 size) {
|
||||
SecmonArgs args;
|
||||
args.X[0] = 0xF0000201;
|
||||
args.X[1] = (u64)src;
|
||||
args.X[2] = (u64)dest;
|
||||
args.X[3] = size;
|
||||
args.X[4] = 1;
|
||||
svcCallSecureMonitor(&args);
|
||||
Result rc = 0;
|
||||
if (args.X[0] != 0) {
|
||||
rc = (26u | ((u32)args.X[0] << 9u));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result SmcCopyFromIram(void *dest, uintptr_t src, u32 size) {
|
||||
SecmonArgs args;
|
||||
args.X[0] = 0xF0000201;
|
||||
args.X[1] = (u64)dest;
|
||||
args.X[2] = (u64)src;
|
||||
args.X[3] = size;
|
||||
args.X[4] = 0;
|
||||
svcCallSecureMonitor(&args);
|
||||
Result rc = 0;
|
||||
if (args.X[0] != 0) {
|
||||
rc = (26u | ((u32)args.X[0] << 9u));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
struct log_ctx_t {
|
||||
u32 magic;
|
||||
u32 sz;
|
||||
u32 start;
|
||||
u32 end;
|
||||
char buf[];
|
||||
};
|
||||
|
||||
#define IRAM_LOG_CTX_ADDR 0x4003C000
|
||||
#define IRAM_LOG_MAX_SZ 4096
|
||||
|
||||
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||
void Log(const char *data, ...) {
|
||||
static const u32 max_log_sz = sizeof(working_buf) - sizeof(log_ctx_t);
|
||||
static bool initDone = false;
|
||||
log_ctx_t *log_ctx = (log_ctx_t*)working_buf;
|
||||
|
||||
SmcCopyFromIram(working_buf, IRAM_LOG_CTX_ADDR, sizeof(working_buf));
|
||||
|
||||
if (!initDone) {
|
||||
initDone = true;
|
||||
log_ctx->buf[0] = '\0';
|
||||
log_ctx->magic = 0xaabbccdd;
|
||||
log_ctx->start = 0;
|
||||
log_ctx->end = 0;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, data);
|
||||
s32 res = vsnprintf(log_ctx->buf + log_ctx->end, max_log_sz - log_ctx->end, data, args);
|
||||
va_end(args);
|
||||
|
||||
if (res < 0 || res >= (static_cast<s32>(max_log_sz - log_ctx->end))) {
|
||||
SmcCopyToIram(IRAM_LOG_CTX_ADDR, working_buf, sizeof(working_buf));
|
||||
return;
|
||||
}
|
||||
|
||||
log_ctx->end += res;
|
||||
SmcCopyToIram(IRAM_LOG_CTX_ADDR, working_buf, sizeof(working_buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||
void ViewLog() {
|
||||
constexpr size_t PageSize = 4096;
|
||||
for (size_t ofs = 0; ofs < fatal_handler_bin_size; ofs += PageSize) {
|
||||
memcpy(&working_buf, fatal_handler_bin + ofs, std::min(fatal_handler_bin_size - ofs, PageSize));
|
||||
SmcCopyToIram(ATMOSPHERE_IRAM_PAYLOAD_BASE + ofs, &working_buf, std::min(fatal_handler_bin_size - ofs, PageSize));
|
||||
}
|
||||
|
||||
SmcRebootToIramPayload();
|
||||
|
||||
while(true){}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
27
Source/Atmosphere/stratosphere/loader/source/oc/oc_log.hpp
Normal file
27
Source/Atmosphere/stratosphere/loader/source/oc/oc_log.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||
* Copyright (c) 2019 Atmosphere-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/>.
|
||||
*/
|
||||
|
||||
/* See https://github.com/lulle2007200/emuMMC/blob/internal-emummc/source/ */
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
void Log(const char *data, ...);
|
||||
void ViewLog();
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -65,7 +65,7 @@ void saveExec(const char* file_loc, const void* buf, size_t size) {
|
||||
}
|
||||
|
||||
Result Test_PcvDvfsTable() {
|
||||
using namespace ams::ldr::oc::pcv;
|
||||
using namespace ams::ldr::hoc::pcv;
|
||||
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&mariko::CpuCvbTableDefault)) == 18);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&erista::CpuCvbTableDefault)) == 16);
|
||||
@@ -76,19 +76,19 @@ Result Test_PcvDvfsTable() {
|
||||
cvb_entry_t last_mariko_cpu_cvb_entry_default = { 1963500, { 1675751, -38635, 27 }, { 1120000 } };
|
||||
assert(memcmp(GetDvfsTableLastEntry((cvb_entry_t *)(&mariko::CpuCvbTableDefault)), (void *)&last_mariko_cpu_cvb_entry_default, sizeof(last_mariko_cpu_cvb_entry_default)) == 0);
|
||||
assert(GetDvfsTableLastEntry((cvb_entry_t *)(&erista::GpuCvbTableDefault))->freq == 921600);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoCpuDvfsTableSLT)) == 25);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoCpuDvfsTableSLT)) == 25);
|
||||
|
||||
// Customized table default
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.eristaCpuDvfsTable)) == 19);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoCpuDvfsTable)) == 21);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoCpuDvfsTableSLT)) == 22);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.eristaCpuDvfsTable)) == 19);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoCpuDvfsTable)) == 21);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoCpuDvfsTableSLT)) == 22);
|
||||
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.eristaGpuDvfsTable)) == 12);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoGpuDvfsTable)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoGpuDvfsTableSLT)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoGpuDvfsTableHiOPT)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.eristaGpuDvfsTable)) == 12);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoGpuDvfsTable)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoGpuDvfsTableSLT)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoGpuDvfsTableHiOPT)) == 17);
|
||||
|
||||
constexpr size_t limit = ams::ldr::oc::pcv::DvfsTableEntryLimit;
|
||||
constexpr size_t limit = ams::ldr::hoc::pcv::DvfsTableEntryLimit;
|
||||
cvb_entry_t customized_table[limit] = {};
|
||||
for (size_t i = 0; i < limit; i++) {
|
||||
assert(GetDvfsTableEntryCount(customized_table) == i);
|
||||
@@ -156,14 +156,14 @@ int main(int argc, char** argv) {
|
||||
size_t exec_path_patched_len = exec_path_len + std::max(strlen(mariko_ext), strlen(erista_ext)) + 1;
|
||||
|
||||
if (exe_opt == EXE_PCV) {
|
||||
ams::ldr::oc::pcv::SafetyCheck();
|
||||
ams::ldr::hoc::pcv::SafetyCheck();
|
||||
|
||||
{
|
||||
void* erista_buf = malloc(file_size);
|
||||
std::memcpy(erista_buf, file_buffer, file_size);
|
||||
|
||||
printf("Patching %s for Erista...\n", pcv_opt);
|
||||
ams::ldr::oc::pcv::erista::Patch(reinterpret_cast<uintptr_t>(erista_buf), file_size);
|
||||
ams::ldr::hoc::pcv::erista::Patch(reinterpret_cast<uintptr_t>(erista_buf), file_size);
|
||||
if (save_patched) {
|
||||
char* exec_path_erista = reinterpret_cast<char *>(malloc(exec_path_patched_len));
|
||||
strncpy(exec_path_erista, exec_path, exec_path_patched_len);
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char** argv) {
|
||||
std::memcpy(mariko_buf, file_buffer, file_size);
|
||||
|
||||
printf("Patching %s for Mariko...\n", pcv_opt);
|
||||
ams::ldr::oc::pcv::mariko::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
ams::ldr::hoc::pcv::mariko::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
if (save_patched) {
|
||||
char* exec_path_mariko = reinterpret_cast<char *>(malloc(exec_path_patched_len));
|
||||
strncpy(exec_path_mariko, exec_path, exec_path_patched_len);
|
||||
@@ -196,7 +196,7 @@ int main(int argc, char** argv) {
|
||||
std::memcpy(mariko_buf, file_buffer, file_size);
|
||||
|
||||
printf("Patching %s (Mariko Only)...\n", ptm_opt);
|
||||
ams::ldr::oc::ptm::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
ams::ldr::hoc::ptm::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
if (save_patched) {
|
||||
char* exec_path_mariko = reinterpret_cast<char *>(malloc(exec_path_patched_len));
|
||||
strncpy(exec_path_mariko, exec_path, exec_path_patched_len);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -20,156 +20,168 @@
|
||||
|
||||
#include "pcv.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv {
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
Result MemFreqPllmLimit(u32* ptr) {
|
||||
clk_pll_param* entry = reinterpret_cast<clk_pll_param *>(ptr);
|
||||
R_UNLESS(entry->freq == entry->vco_max, ldr::ResultInvalidMemPllmEntry());
|
||||
Result MemFreqPllmLimit(u32* ptr) {
|
||||
clk_pll_param* entry = reinterpret_cast<clk_pll_param *>(ptr);
|
||||
R_UNLESS(entry->freq == entry->vco_max, ldr::ResultInvalidMemPllmEntry());
|
||||
|
||||
// Double the max clk simply
|
||||
u32 max_clk = entry->freq * 2;
|
||||
entry->freq = max_clk;
|
||||
entry->vco_max = max_clk;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result MemVoltHandler(u32* ptr) {
|
||||
// ptr value might be default_uv or max_uv
|
||||
regulator* entries[2] = {
|
||||
reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_1.default_uv)),
|
||||
reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_1.max_uv)),
|
||||
};
|
||||
|
||||
constexpr u32 uv_step = 12'500;
|
||||
constexpr u32 uv_min = 600'000;
|
||||
|
||||
auto validator = [](regulator* entry) {
|
||||
R_UNLESS(entry->id == 1, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type == 1, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type_1.volt_reg == 0x17, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type_1.step_uv == uv_step, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type_1.min_uv == uv_min, ldr::ResultInvalidRegulatorEntry());
|
||||
// Double the max clk simply
|
||||
u32 max_clk = entry->freq * 2;
|
||||
entry->freq = max_clk;
|
||||
entry->vco_max = max_clk;
|
||||
R_SUCCEED();
|
||||
};
|
||||
|
||||
regulator* entry = nullptr;
|
||||
for (auto& i : entries) {
|
||||
if (R_SUCCEEDED(validator(i)))
|
||||
entry = i;
|
||||
}
|
||||
|
||||
R_UNLESS(entry, ldr::ResultInvalidRegulatorEntry());
|
||||
Result MemVoltHandler(u32* ptr) {
|
||||
// ptr value might be default_uv or max_uv
|
||||
regulator* entries[2] = {
|
||||
reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_1.default_uv)),
|
||||
reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_1.max_uv)),
|
||||
};
|
||||
|
||||
u32 emc_uv = C.commonEmcMemVolt;
|
||||
if (!emc_uv)
|
||||
R_SKIP();
|
||||
|
||||
if (emc_uv % uv_step)
|
||||
emc_uv = emc_uv / uv_step * uv_step; // rounding
|
||||
|
||||
PATCH_OFFSET(ptr, emc_uv);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void SafetyCheck() {
|
||||
// if (C.custRev != CUST_REV)
|
||||
// CRASH("Triggered");
|
||||
|
||||
struct sValidator {
|
||||
volatile u32 value;
|
||||
u32 min;
|
||||
u32 max;
|
||||
bool value_required = false;
|
||||
|
||||
Result check() {
|
||||
if (!value_required && !value)
|
||||
R_SUCCEED();
|
||||
|
||||
if (min && value < min)
|
||||
R_THROW(ldr::ResultSafetyCheckFailure());
|
||||
if (max && value > max)
|
||||
R_THROW(ldr::ResultSafetyCheckFailure());
|
||||
constexpr u32 uv_step = 12'500;
|
||||
constexpr u32 uv_min = 600'000;
|
||||
|
||||
auto validator = [](regulator* entry) {
|
||||
R_UNLESS(entry->id == 1, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type == 1, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type_1.volt_reg == 0x17, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type_1.step_uv == uv_step, ldr::ResultInvalidRegulatorEntry());
|
||||
R_UNLESS(entry->type_1.min_uv == uv_min, ldr::ResultInvalidRegulatorEntry());
|
||||
R_SUCCEED();
|
||||
};
|
||||
|
||||
regulator* entry = nullptr;
|
||||
for (auto& i : entries) {
|
||||
if (R_SUCCEEDED(validator(i))) {
|
||||
entry = i;
|
||||
}
|
||||
}
|
||||
};
|
||||
u32 eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq);
|
||||
u32 marikoCpuDvfsMaxFreq;
|
||||
if (C.marikoCpuUVHigh) {
|
||||
marikoCpuDvfsMaxFreq = static_cast<u32>(
|
||||
GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq
|
||||
);
|
||||
} else {
|
||||
marikoCpuDvfsMaxFreq = static_cast<u32>(
|
||||
GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq
|
||||
);
|
||||
|
||||
R_UNLESS(entry, ldr::ResultInvalidRegulatorEntry());
|
||||
|
||||
u32 emc_uv = C.commonEmcMemVolt;
|
||||
if (!emc_uv) {
|
||||
R_SKIP();
|
||||
}
|
||||
u32 eristaGpuDvfsMaxFreq;
|
||||
switch (C.eristaGpuUV)
|
||||
{
|
||||
case 0:
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
|
||||
break;
|
||||
case 1:
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq);
|
||||
break;
|
||||
default:
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
|
||||
break;
|
||||
|
||||
if (emc_uv % uv_step) {
|
||||
emc_uv = emc_uv / uv_step * uv_step; // rounding
|
||||
}
|
||||
|
||||
PATCH_OFFSET(ptr, emc_uv);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
u32 marikoGpuDvfsMaxFreq;
|
||||
switch (C.marikoGpuUV) {
|
||||
void SafetyCheck() {
|
||||
// if (C.custRev != CUST_REV)
|
||||
// CRASH("Triggered");
|
||||
|
||||
struct sValidator {
|
||||
volatile u32 value;
|
||||
u32 min;
|
||||
u32 max;
|
||||
bool value_required = false;
|
||||
u32 panic;
|
||||
|
||||
Result check() {
|
||||
if (!value_required && !value)
|
||||
R_SUCCEED();
|
||||
|
||||
if (min && value < min)
|
||||
R_THROW(ldr::ResultSafetyCheckFailure());
|
||||
if (max && value > max)
|
||||
R_THROW(ldr::ResultSafetyCheckFailure());
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
};
|
||||
|
||||
u32 eristaCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaCpuDvfsTable)->freq);
|
||||
u32 marikoCpuDvfsMaxFreq;
|
||||
if (C.marikoCpuUVHigh) {
|
||||
marikoCpuDvfsMaxFreq = static_cast<u32>(
|
||||
GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq
|
||||
);
|
||||
} else {
|
||||
marikoCpuDvfsMaxFreq = static_cast<u32>(
|
||||
GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq
|
||||
);
|
||||
}
|
||||
u32 eristaGpuDvfsMaxFreq;
|
||||
switch (C.eristaGpuUV) {
|
||||
case 0:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
|
||||
break;
|
||||
case 1:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq);
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq);
|
||||
break;
|
||||
default:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq);
|
||||
break;
|
||||
}
|
||||
|
||||
u32 marikoGpuDvfsMaxFreq;
|
||||
switch (C.marikoGpuUV) {
|
||||
case 0:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);
|
||||
break;
|
||||
case 1:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq);
|
||||
break;
|
||||
case 2:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
|
||||
break;
|
||||
default:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);
|
||||
break;
|
||||
}
|
||||
|
||||
using namespace ams::ldr::hoc::pcv;
|
||||
sValidator validators[] = {
|
||||
{ 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 &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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sValidator validators[] = {
|
||||
{ C.eristaCpuBoostClock, 1020'000, 2295'000, true },
|
||||
{ C.marikoCpuBoostClock, 1020'000, 2703'000, true },
|
||||
{ C.commonEmcMemVolt, 1100'000, 1350'000 }, // Official burst vmax for the RAMs is 1500mV
|
||||
{ C.eristaCpuMaxVolt, 1100, 1257 },
|
||||
{ C.eristaEmcMaxClock, 1600'000, 2600'200 },
|
||||
{ C.marikoCpuMaxVolt, 1100, 1235 },
|
||||
{ C.marikoEmcMaxClock, 1600'000, 3500'000 },
|
||||
{ C.marikoEmcVddqVolt, 550'000, 700'000 },
|
||||
{ eristaCpuDvfsMaxFreq, 1785'000, 2295'000 },
|
||||
{ marikoCpuDvfsMaxFreq, 1785'000, 2703'000 },
|
||||
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000 },
|
||||
{ marikoGpuDvfsMaxFreq, 768'000, 1536'000 },
|
||||
};
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
SafetyCheck();
|
||||
|
||||
for (auto& i : validators) {
|
||||
if (R_FAILED(i.check()))
|
||||
CRASH("Validation FAIL");
|
||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||
if (isMariko) {
|
||||
mariko::Patch(mapped_nso, nso_size);
|
||||
} else {
|
||||
erista::Patch(mapped_nso, nso_size);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
SafetyCheck();
|
||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||
if (isMariko)
|
||||
mariko::Patch(mapped_nso, nso_size);
|
||||
else
|
||||
mariko::Patch(mapped_nso, nso_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -22,267 +22,11 @@
|
||||
|
||||
#include "../oc_common.hpp"
|
||||
#include "pcv_common.hpp"
|
||||
#include "pcv_erista.hpp"
|
||||
#include "pcv_mariko.hpp"
|
||||
#include "pcv_asm.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv {
|
||||
|
||||
namespace mariko {
|
||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||
{ 204000, { 721589, -12695, 27 }, { } },
|
||||
{ 306000, { 747134, -14195, 27 }, { } },
|
||||
{ 408000, { 776324, -15705, 27 }, { } },
|
||||
{ 510000, { 809160, -17205, 27 }, { } },
|
||||
{ 612000, { 845641, -18715, 27 }, { } },
|
||||
{ 714000, { 885768, -20215, 27 }, { } },
|
||||
{ 816000, { 929540, -21725, 27 }, { } },
|
||||
{ 918000, { 976958, -23225, 27 }, { } },
|
||||
{ 1020000, { 1028021, -24725, 27 }, { 1120000 } },
|
||||
{ 1122000, { 1082730, -26235, 27 }, { 1120000 } },
|
||||
{ 1224000, { 1141084, -27735, 27 }, { 1120000 } },
|
||||
{ 1326000, { 1203084, -29245, 27 }, { 1120000 } },
|
||||
{ 1428000, { 1268729, -30745, 27 }, { 1120000 } },
|
||||
{ 1581000, { 1374032, -33005, 27 }, { 1120000 } },
|
||||
{ 1683000, { 1448791, -34505, 27 }, { 1120000 } },
|
||||
{ 1785000, { 1527196, -36015, 27 }, { 1120000 } },
|
||||
{ 1887000, { 1609246, -37515, 27 }, { 1120000 } },
|
||||
{ 1963500, { 1675751, -38635, 27 }, { 1120000 } },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 CpuClkOfficial = 1963'500;
|
||||
constexpr u32 CpuVoltOfficial = 1120;
|
||||
constexpr u32 CpuVminOfficial = 620;
|
||||
|
||||
static const u32 cpuVoltagePatchValues[] = { 850, 38, 1120, 1000, 100, 1000, 0 };
|
||||
static const s32 cpuVoltagePatchOffsets[] = { -2, -1, 5, 6, 7, 8, 9 };
|
||||
static_assert(sizeof(cpuVoltagePatchValues) == sizeof(cpuVoltagePatchOffsets), "Invalid cpuVoltagePatch size");
|
||||
|
||||
static const u32 cpuVoltThermalData[] = { 620, 1120, 20000, 620, 1120, 70000, 950, 1132, 0, 950, 1227, 0 };
|
||||
|
||||
static const u32 allowedCpuMaxFrequencies[] = { 2'397'000, 2'499'000, 2'601'000, 2'703'000, };
|
||||
|
||||
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
||||
// GPUB01_NA_CVB_TABLE
|
||||
{ 76800, {}, { 610000, } },
|
||||
{ 153600, {}, { 610000, } },
|
||||
{ 230400, {}, { 610000, } },
|
||||
{ 307200, {}, { 610000, } },
|
||||
{ 384000, {}, { 610000, } },
|
||||
{ 460800, {}, { 610000, } },
|
||||
{ 537600, {}, { 801688, -10900, -163, 298, -10599, 162, } },
|
||||
{ 614400, {}, { 824214, -5743, -452, 238, -6325, 81, } },
|
||||
{ 691200, {}, { 848830, -3903, -552, 119, -4030, -2, } },
|
||||
{ 768000, {}, { 891575, -4409, -584, 0, -2849, 39, } },
|
||||
{ 844800, {}, { 940071, -5367, -602, -60, -63, -93, } },
|
||||
{ 921600, {}, { 986765, -6637, -614, -179, 1905, -13, } },
|
||||
{ 998400, {}, { 1098475, -13529, -497, -179, 3626, 9, } },
|
||||
{ 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40, } },
|
||||
{ 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110, } },
|
||||
{ 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313, } },
|
||||
{ 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559, } },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 GpuClkPllMax = 1300'000'000;
|
||||
constexpr u32 GpuClkPllLimit = 2'600'000;
|
||||
constexpr u32 GpuVminOfficial = 610;
|
||||
|
||||
static const u32 gpuDVFSPattern[] = { 1050, 1000, 100, 1000, 10, };
|
||||
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[] {
|
||||
{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)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
||||
*
|
||||
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
||||
*/
|
||||
|
||||
inline constexpr u32 asm_pattern[] = {0x52820000, 0x72A001C0};
|
||||
|
||||
inline auto asm_compare_no_rd = [](u32 ins1, u32 ins2) {
|
||||
return ((ins1 ^ ins2) >> 5) == 0;
|
||||
};
|
||||
|
||||
inline auto asm_get_rd = [](u32 ins) {
|
||||
return ins & ((1 << 5) - 1);
|
||||
};
|
||||
|
||||
inline auto asm_set_rd = [](u32 ins, u8 rd) {
|
||||
return (ins & 0xFFFFFFE0) | (rd & 0x1F);
|
||||
};
|
||||
|
||||
inline auto asm_set_imm16 = [](u32 ins, u16 imm) {
|
||||
return (ins & 0xFFE0001F) | ((imm & 0xFFFF) << 5);
|
||||
};
|
||||
|
||||
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
||||
return asm_compare_no_rd(*ptr32, asm_pattern[0]);
|
||||
}
|
||||
|
||||
constexpr emc_dvb_dvfs_table_t EmcDvbTableDefault[] = {
|
||||
{ 204000, { 637, 637, 637, } },
|
||||
{ 408000, { 637, 637, 637, } },
|
||||
{ 800000, { 637, 637, 637, } },
|
||||
{ 1065600, { 637, 637, 637, } },
|
||||
{ 1331200, { 650, 637, 637, } },
|
||||
{ 1600000, { 675, 650, 637, } },
|
||||
};
|
||||
|
||||
constexpr u32 EmcClkOSAlt = 1331'200;
|
||||
constexpr u32 EmcClkPllmLimit = 2133'000'000;
|
||||
constexpr u32 EmcVddqDefault = 600'000;
|
||||
constexpr u32 MemVdd2Default = 1100'000;
|
||||
|
||||
constexpr u32 MTC_TABLE_REV = 3;
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||
|
||||
}
|
||||
|
||||
namespace erista {
|
||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||
// CPU_PLL_CVB_TABLE_ODN
|
||||
{ 204000, {721094}, { } },
|
||||
{ 306000, {754040}, { } },
|
||||
{ 408000, {786986}, { } },
|
||||
{ 510000, {819932}, { } },
|
||||
{ 612000, {852878}, { } },
|
||||
{ 714000, {885824}, { } },
|
||||
{ 816000, {918770}, { } },
|
||||
{ 918000, {951716}, { } },
|
||||
{ 1020000, {984662}, { -2875621, 358099, -8585} },
|
||||
{ 1122000, {1017608}, { -52225, 104159, -2816} },
|
||||
{ 1224000, {1050554}, { 1076868, 8356, -727} },
|
||||
{ 1326000, {1083500}, { 2208191, -84659, 1240} },
|
||||
{ 1428000, {1116446}, { 2519460, -105063, 1611} },
|
||||
{ 1581000, {1130000}, { 2889664, -122173, 1834} },
|
||||
{ 1683000, {1168000}, { 5100873, -279186, 4747} },
|
||||
{ 1785000, {1227500}, { 5100873, -279186, 4747} },
|
||||
{ },
|
||||
};
|
||||
|
||||
|
||||
constexpr u32 CpuVoltOfficial = 1235;
|
||||
|
||||
constexpr u32 CpuVminOfficial = 825;
|
||||
|
||||
constexpr u32 CpuVoltL4T = 1235'000;
|
||||
|
||||
static const u32 cpuVoltDvfsPattern[] = { 1227, 1000, 100, 1000, 0 };
|
||||
static const u32 cpuVoltDvfsOffsets[] = { 5, 6, 7, 9, 8 };
|
||||
static_assert(sizeof(cpuVoltDvfsPattern) == sizeof(cpuVoltDvfsOffsets), "Invalid cpuVoltDvfsPattern");
|
||||
|
||||
static const u32 cpuVoltageThermalPattern[] = { 950, 1132, 0, 950, 1227, 0, 825, 1227, 15000, 825, 1170, 60000, 825, 1132, 80000 };
|
||||
static_assert(sizeof(cpuVoltageThermalPattern) == 0x3c, "invalid cpuVoltageThermalPattern size");
|
||||
|
||||
constexpr u32 GpuClkPllLimit = 921'600'000;
|
||||
constexpr u32 GpuVminOfficial = 810;
|
||||
|
||||
static const u32 gpuVoltDvfsPattern[] = { 1150, 1000, 100, 1000, 10, };
|
||||
static const u32 gpuVoltDvfsOffsets[] = { 1, 2, 3, 4, 5, };
|
||||
static_assert(sizeof(gpuVoltDvfsPattern) == sizeof(gpuVoltDvfsOffsets), "Invalid gpuVoltDvfsPattern");
|
||||
|
||||
static const u32 gpuVoltThermalPattern[] = { 950, 1132, 0, 810, 1132, 15000, 810, 1132, 30000, 810, 1132, 50000, 810, 1132, 70000, 810, 1132, 105000 };
|
||||
static_assert(sizeof(gpuVoltThermalPattern) == 0x48, "invalid gpuVoltageThermalPattern size");
|
||||
|
||||
|
||||
/* GPU Max Clock asm Pattern:
|
||||
*
|
||||
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
||||
*
|
||||
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
||||
*/
|
||||
inline constexpr u32 asm_pattern[] = {
|
||||
0x52820000, 0x72A001C0
|
||||
};
|
||||
|
||||
inline auto asm_compare_no_rd = [](u32 ins1, u32 ins2) {
|
||||
return ((ins1 ^ ins2) >> 5) == 0;
|
||||
};
|
||||
|
||||
inline auto asm_get_rd = [](u32 ins) {
|
||||
return ins & ((1 << 5) - 1);
|
||||
};
|
||||
|
||||
inline auto asm_set_rd = [](u32 ins, u8 rd) {
|
||||
return (ins & 0xFFFFFFE0) | (rd & 0x1F);
|
||||
};
|
||||
|
||||
inline auto asm_set_imm16 = [](u32 ins, u16 imm) {
|
||||
return (ins & 0xFFE0001F) | ((imm & 0xFFFF) << 5);
|
||||
};
|
||||
|
||||
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
||||
return asm_compare_no_rd(*ptr32, asm_pattern[0]);
|
||||
};
|
||||
|
||||
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
||||
// NA_FREQ_CVB_TABLE
|
||||
{ 76800, {}, { 814294, 8144, -940, 808, -21583, 226, } },
|
||||
{ 153600, {}, { 856185, 8144, -940, 808, -21583, 226, } },
|
||||
{ 230400, {}, { 898077, 8144, -940, 808, -21583, 226, } },
|
||||
{ 307200, {}, { 939968, 8144, -940, 808, -21583, 226, } },
|
||||
{ 384000, {}, { 981860, 8144, -940, 808, -21583, 226, } },
|
||||
{ 460800, {}, { 1023751, 8144, -940, 808, -21583, 226, } },
|
||||
{ 537600, {}, { 1065642, 8144, -940, 808, -21583, 226, } },
|
||||
{ 614400, {}, { 1107534, 8144, -940, 808, -21583, 226, } },
|
||||
{ 691200, {}, { 1149425, 8144, -940, 808, -21583, 226, } },
|
||||
{ 768000, {}, { 1191317, 8144, -940, 808, -21583, 226, } },
|
||||
{ 844800, {}, { 1233208, 8144, -940, 808, -21583, 226, } },
|
||||
{ 921600, {}, { 1275100, 8144, -940, 808, -21583, 226, } },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 MemVoltHOS = 1125'000;
|
||||
constexpr u32 EmcClkPllmLimit = 1866'000'000;
|
||||
|
||||
constexpr u32 MTC_TABLE_REV = 7;
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||
}
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
inline auto MatchesPattern = [](u32 *base, const auto &offsets, const auto &values) {
|
||||
for (size_t i = 0; i < std::size(values); ++i) {
|
||||
@@ -308,8 +52,8 @@ namespace ams::ldr::oc::pcv {
|
||||
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable1581Tbreak);
|
||||
break;
|
||||
}
|
||||
case HELIOS_TABLE: {
|
||||
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableHelios);
|
||||
case EXTREME_TABLE: {
|
||||
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableExtreme);
|
||||
break;
|
||||
}
|
||||
case DEFAULT_TABLE:
|
||||
@@ -419,27 +163,26 @@ namespace ams::ldr::oc::pcv {
|
||||
std::memcpy(gpu_cvb_table_head, (void *)customize_table, customize_table_size);
|
||||
|
||||
// Patch GPU volt
|
||||
if (C.marikoGpuUV == 2 || C.eristaGpuUV == 2) {
|
||||
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
|
||||
for (size_t i = 0; i < customize_entry_count; ++i) {
|
||||
if (isMariko) {
|
||||
if (C.marikoGpuVoltArray[i] != 0) {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (C.marikoGpuVoltArray[i] * 1000));
|
||||
ClearCvbPllEntry(entry);
|
||||
} else {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
|
||||
}
|
||||
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
|
||||
for (size_t i = 0; i < customize_entry_count; ++i) {
|
||||
if (isMariko) {
|
||||
if (C.marikoGpuVoltArray[i] != 0) {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (C.marikoGpuVoltArray[i] * 1000));
|
||||
ClearCvbPllEntry(entry);
|
||||
} else {
|
||||
if (C.eristaGpuVoltArray[i] != 0) {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (C.eristaGpuVoltArray[i] * 1000));
|
||||
ClearCvbPllEntry(entry);
|
||||
} else {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
|
||||
}
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
|
||||
}
|
||||
} else {
|
||||
if (C.eristaGpuVoltArray[i] != 0) {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (C.eristaGpuVoltArray[i] * 1000));
|
||||
ClearCvbPllEntry(entry);
|
||||
} else {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
|
||||
}
|
||||
++entry;
|
||||
}
|
||||
} else if (C.commonGpuVoltOffset) {
|
||||
++entry;
|
||||
}
|
||||
if (C.commonGpuVoltOffset && !(isMariko ? C.marikoGpuUV : C.eristaGpuUV)) {
|
||||
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
|
||||
for (size_t i = 0; i < customize_entry_count; ++i) {
|
||||
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* 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 <stratosphere.hpp>
|
||||
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
constexpr u32 NopIns = 0x1f2003d5;
|
||||
|
||||
inline auto asm_compare_no_rd = [](u32 ins1, u32 ins2) {
|
||||
return ((ins1 ^ ins2) >> 5) == 0;
|
||||
};
|
||||
|
||||
inline auto asm_get_rd = [](u32 ins) {
|
||||
return ins & ((1 << 5) - 1);
|
||||
};
|
||||
|
||||
inline auto asm_set_rd = [](u32 ins, u8 rd) {
|
||||
return (ins & 0xFFFFFFE0) | (rd & 0x1F);
|
||||
};
|
||||
|
||||
inline auto asm_set_imm16 = [](u32 ins, u16 imm) {
|
||||
return (ins & 0xFFE0001F) | ((imm & 0xFFFF) << 5);
|
||||
};
|
||||
|
||||
inline auto AsmGetImm16 = [](u32 ins) {
|
||||
return static_cast<u16>((ins >> 5) & 0xFFFF);
|
||||
};
|
||||
|
||||
inline auto AsmCompareBrNoRd = [](u32 ins1, u32 ins2) {
|
||||
constexpr u32 RegMask = ~(((1 << 5) - 1) << 5);
|
||||
return ((ins1 & RegMask) ^ (ins2 & RegMask)) == 0;
|
||||
};
|
||||
|
||||
inline auto AsmCompareAddNoImm12 = [](u32 ins1, u32 ins2) {
|
||||
constexpr u32 Imm12Mask = ~(((1 << 12) - 1) << 10);
|
||||
return ((ins1 & Imm12Mask) ^ (ins2 & Imm12Mask)) == 0;
|
||||
};
|
||||
|
||||
inline auto AsmCompareAdrpNoImm = [](u32 ins1, u32 ins2) {
|
||||
constexpr u32 ImmMask = ~((((1 << 2) - 1) << 29) | (((1 << 19) - 1) << 5));
|
||||
return ((ins1 & ImmMask) ^ (ins2 & ImmMask)) == 0;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -16,153 +16,149 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
namespace ams::ldr::oc::pcv {
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
typedef struct cvb_coefficients {
|
||||
s32 c0 = 0;
|
||||
s32 c1 = 0;
|
||||
s32 c2 = 0;
|
||||
s32 c3 = 0;
|
||||
s32 c4 = 0;
|
||||
s32 c5 = 0;
|
||||
} cvb_coefficients;
|
||||
typedef struct cvb_coefficients {
|
||||
s32 c0 = 0;
|
||||
s32 c1 = 0;
|
||||
s32 c2 = 0;
|
||||
s32 c3 = 0;
|
||||
s32 c4 = 0;
|
||||
s32 c5 = 0;
|
||||
} cvb_coefficients;
|
||||
|
||||
typedef struct cvb_entry_t {
|
||||
u64 freq;
|
||||
cvb_coefficients cvb_dfll_param;
|
||||
cvb_coefficients cvb_pll_param;
|
||||
} cvb_entry_t;
|
||||
static_assert(sizeof(cvb_entry_t) == 0x38);
|
||||
typedef struct cvb_entry_t {
|
||||
u64 freq;
|
||||
cvb_coefficients cvb_dfll_param;
|
||||
cvb_coefficients cvb_pll_param;
|
||||
} cvb_entry_t;
|
||||
static_assert(sizeof(cvb_entry_t) == 0x38);
|
||||
|
||||
typedef struct cvb_cpu_dfll_data {
|
||||
u32 tune0_low;
|
||||
u32 tune0_high;
|
||||
u32 tune1_low;
|
||||
u32 tune1_high;
|
||||
unsigned int tune_high_min_millivolts;
|
||||
unsigned int tune_high_margin_millivolts;
|
||||
unsigned long dvco_calibration_max;
|
||||
} cvb_cpu_dfll_data;
|
||||
typedef struct cvb_cpu_dfll_data {
|
||||
u32 tune0_low;
|
||||
u32 tune0_high;
|
||||
u32 tune1_low;
|
||||
u32 tune1_high;
|
||||
unsigned int tune_high_min_millivolts;
|
||||
unsigned int tune_high_margin_millivolts;
|
||||
unsigned long dvco_calibration_max;
|
||||
} cvb_cpu_dfll_data;
|
||||
|
||||
typedef struct emc_dvb_dvfs_table_t {
|
||||
u64 freq;
|
||||
s32 volt[4] = {0};
|
||||
} emc_dvb_dvfs_table_t;
|
||||
typedef struct __attribute__((packed)) div_nmp {
|
||||
u8 divn_shift;
|
||||
u8 divn_width;
|
||||
u8 divm_shift;
|
||||
u8 divm_width;
|
||||
u8 divp_shift;
|
||||
u8 divp_width;
|
||||
u8 override_divn_shift;
|
||||
u8 override_divm_shift;
|
||||
u8 override_divp_shift;
|
||||
} div_nmp;
|
||||
|
||||
typedef struct __attribute__((packed)) div_nmp {
|
||||
u8 divn_shift;
|
||||
u8 divn_width;
|
||||
u8 divm_shift;
|
||||
u8 divm_width;
|
||||
u8 divp_shift;
|
||||
u8 divp_width;
|
||||
u8 override_divn_shift;
|
||||
u8 override_divm_shift;
|
||||
u8 override_divp_shift;
|
||||
} div_nmp;
|
||||
typedef struct __attribute__((packed)) clk_pll_param {
|
||||
u32 freq;
|
||||
u32 input_min;
|
||||
u32 input_max;
|
||||
u32 cf_min;
|
||||
u32 cf_max;
|
||||
u32 vco_min;
|
||||
u32 vco_max;
|
||||
s32 lock_delay;
|
||||
u32 fixed_rate;
|
||||
u32 unk_0;
|
||||
struct div_nmp *div_nmp;
|
||||
u32 unk_1[4];
|
||||
void (*unk_fn)(u64* unk_struct); // set_defaults?
|
||||
} clk_pll_param;
|
||||
|
||||
typedef struct __attribute__((packed)) clk_pll_param {
|
||||
u32 freq;
|
||||
u32 input_min;
|
||||
u32 input_max;
|
||||
u32 cf_min;
|
||||
u32 cf_max;
|
||||
u32 vco_min;
|
||||
u32 vco_max;
|
||||
s32 lock_delay;
|
||||
u32 fixed_rate;
|
||||
u32 unk_0;
|
||||
struct div_nmp *div_nmp;
|
||||
u32 unk_1[4];
|
||||
void (*unk_fn)(u64* unk_struct); // set_defaults?
|
||||
} clk_pll_param;
|
||||
typedef struct __attribute__((packed)) dvfs_rail {
|
||||
u32 id;
|
||||
u32 unk_0[5];
|
||||
u32 freq;
|
||||
u32 unk_1[8];
|
||||
u32 unk_flag;
|
||||
u32 min_mv;
|
||||
u32 step_mv;
|
||||
u32 max_mv;
|
||||
u32 unk_2[11];
|
||||
} dvfs_rail;
|
||||
|
||||
typedef struct __attribute__((packed)) dvfs_rail {
|
||||
u32 id;
|
||||
u32 unk_0[5];
|
||||
u32 freq;
|
||||
u32 unk_1[8];
|
||||
u32 unk_flag;
|
||||
u32 min_mv;
|
||||
u32 step_mv;
|
||||
u32 max_mv;
|
||||
u32 unk_2[11];
|
||||
} dvfs_rail;
|
||||
typedef struct __attribute__((packed)) regulator {
|
||||
u64 id;
|
||||
const char* name;
|
||||
u32 type;
|
||||
union {
|
||||
struct {
|
||||
u32 volt_reg;
|
||||
u32 step_uv;
|
||||
u32 min_uv;
|
||||
u32 default_uv;
|
||||
u32 max_uv;
|
||||
u32 unk_0[2];
|
||||
} type_1;
|
||||
struct {
|
||||
u32 unk_0;
|
||||
u32 step_uv;
|
||||
u32 unk_1;
|
||||
u32 min_uv;
|
||||
u32 max_uv;
|
||||
u32 unk_2;
|
||||
u32 default_uv;
|
||||
} type_2_3;
|
||||
};
|
||||
u32 unk_x[60];
|
||||
} regulator;
|
||||
static_assert(sizeof(regulator) == 0x120);
|
||||
|
||||
typedef struct __attribute__((packed)) regulator {
|
||||
u64 id;
|
||||
const char* name;
|
||||
u32 type;
|
||||
union {
|
||||
struct {
|
||||
u32 volt_reg;
|
||||
u32 step_uv;
|
||||
u32 min_uv;
|
||||
u32 default_uv;
|
||||
u32 max_uv;
|
||||
u32 unk_0[2];
|
||||
} type_1;
|
||||
struct {
|
||||
u32 unk_0;
|
||||
u32 step_uv;
|
||||
u32 unk_1;
|
||||
u32 min_uv;
|
||||
u32 max_uv;
|
||||
u32 unk_2;
|
||||
u32 default_uv;
|
||||
} type_2_3;
|
||||
};
|
||||
u32 unk_x[60];
|
||||
} regulator;
|
||||
static_assert(sizeof(regulator) == 0x120);
|
||||
constexpr u32 CpuClkOSLimit = 1785'000;
|
||||
constexpr u32 GpuClkOsLimit = 921'600;
|
||||
constexpr u32 EmcClkOSLimit = 1600'000;
|
||||
|
||||
constexpr u32 CpuClkOSLimit = 1785'000;
|
||||
#define R_SKIP() R_SUCCEED()
|
||||
|
||||
constexpr u32 EmcClkOSLimit = 1600'000;
|
||||
// Count 32 / Index 31 is reserved to be empty
|
||||
constexpr size_t DvfsTableEntryCount = 32;
|
||||
constexpr size_t DvfsTableEntryLimit = DvfsTableEntryCount - 1;
|
||||
|
||||
#define R_SKIP() R_SUCCEED()
|
||||
template<typename T>
|
||||
size_t GetDvfsTableEntryCount(T* table_head) {
|
||||
using NT = std::remove_const_t<std::remove_volatile_t<T>>;
|
||||
|
||||
// Count 32 / Index 31 is reserved to be empty
|
||||
constexpr size_t DvfsTableEntryCount = 32;
|
||||
constexpr size_t DvfsTableEntryLimit = DvfsTableEntryCount - 1;
|
||||
auto is_empty = [](NT* entry) {
|
||||
uint8_t* m = reinterpret_cast<uint8_t *>(entry);
|
||||
for (size_t i = 0; i < sizeof(NT); i++) {
|
||||
if (*(m + i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
size_t GetDvfsTableEntryCount(T* table_head) {
|
||||
using NT = std::remove_const_t<std::remove_volatile_t<T>>;
|
||||
NT* table = const_cast<NT *>(table_head);
|
||||
size_t count = 0;
|
||||
while (count < DvfsTableEntryLimit) {
|
||||
if (is_empty(table++)) {
|
||||
return count;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return DvfsTableEntryLimit;
|
||||
}
|
||||
|
||||
auto is_empty = [](NT* entry) {
|
||||
uint8_t* m = reinterpret_cast<uint8_t *>(entry);
|
||||
for (size_t i = 0; i < sizeof(NT); i++) {
|
||||
if (*(m + i))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
template<typename T>
|
||||
T* GetDvfsTableLastEntry(T* table_head) {
|
||||
using NT = std::remove_const_t<std::remove_volatile_t<T>>;
|
||||
|
||||
NT* table = const_cast<NT *>(table_head);
|
||||
size_t count = 0;
|
||||
while (count < DvfsTableEntryLimit) {
|
||||
if (is_empty(table++)) {
|
||||
return count;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return DvfsTableEntryLimit;
|
||||
}
|
||||
NT* table = const_cast<NT *>(table_head);
|
||||
size_t count = GetDvfsTableEntryCount(table_head);
|
||||
if (!count) {
|
||||
return nullptr;
|
||||
}
|
||||
size_t index = count - 1;
|
||||
return table + index;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* GetDvfsTableLastEntry(T* table_head) {
|
||||
using NT = std::remove_const_t<std::remove_volatile_t<T>>;
|
||||
|
||||
NT* table = const_cast<NT *>(table_head);
|
||||
size_t count = GetDvfsTableEntryCount(table_head);
|
||||
if (!count) {
|
||||
return nullptr;
|
||||
}
|
||||
size_t index = count - 1;
|
||||
return table + index;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* 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 "../oc_common.hpp"
|
||||
#include "pcv_common.hpp"
|
||||
#include "pcv_asm.hpp"
|
||||
|
||||
namespace ams::ldr::hoc::pcv::erista {
|
||||
|
||||
static u32 maxEmcClocks[] = { C.eristaEmcMaxClock2, C.eristaEmcMaxClock1, C.eristaEmcMaxClock, };
|
||||
#define GET_MAX_OF_ARR(ARR) (*std::max_element(ARR, ARR + std::size(ARR)))
|
||||
|
||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||
// CPU_PLL_CVB_TABLE_ODN
|
||||
{ 204000, {721094}, { } },
|
||||
{ 306000, {754040}, { } },
|
||||
{ 408000, {786986}, { } },
|
||||
{ 510000, {819932}, { } },
|
||||
{ 612000, {852878}, { } },
|
||||
{ 714000, {885824}, { } },
|
||||
{ 816000, {918770}, { } },
|
||||
{ 918000, {951716}, { } },
|
||||
{ 1020000, {984662}, { -2875621, 358099, -8585} },
|
||||
{ 1122000, {1017608}, { -52225, 104159, -2816} },
|
||||
{ 1224000, {1050554}, { 1076868, 8356, -727} },
|
||||
{ 1326000, {1083500}, { 2208191, -84659, 1240} },
|
||||
{ 1428000, {1116446}, { 2519460, -105063, 1611} },
|
||||
{ 1581000, {1130000}, { 2889664, -122173, 1834} },
|
||||
{ 1683000, {1168000}, { 5100873, -279186, 4747} },
|
||||
{ 1785000, {1227500}, { 5100873, -279186, 4747} },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 CpuVoltOfficial = 1227;
|
||||
|
||||
constexpr u32 CpuVminOfficial = 825;
|
||||
|
||||
constexpr u32 CpuVoltL4T = 1257'000;
|
||||
|
||||
static const u32 cpuVoltDvfsPattern[] = { 1227, 1000, 100, 1000, 0 };
|
||||
static_assert(sizeof(cpuVoltDvfsPattern) == 0x14, "invalid cpuVoltDvfsPattern size");
|
||||
|
||||
static const u32 cpuVoltageThermalPattern[] = { 950, 1132, 0, 950, 1227, 0, 825, 1227, 15000, 825, 1170, 60000, 825, 1132, 80000 };
|
||||
static_assert(sizeof(cpuVoltageThermalPattern) == 0x3c, "invalid cpuVoltageThermalPattern size");
|
||||
|
||||
constexpr u32 GpuClkPllLimit = 2'600'000;
|
||||
constexpr u32 GpuClkPllMax = 921'600'000;
|
||||
constexpr u32 GpuVminOfficial = 810;
|
||||
|
||||
constexpr u16 CpuMinVolts[] = { 950, 850, 825, 810 };
|
||||
|
||||
static const u32 gpuVoltDvfsPattern[] = { 810, 1150, 1000, 100, 1000, 10, };
|
||||
static_assert(sizeof(gpuVoltDvfsPattern) == (sizeof(u32) * 6), "Invalid gpuVoltDvfsPattern");
|
||||
|
||||
static const u32 gpuVoltThermalPattern[] = { 950, 1132, 0, 810, 1132, 15000, 810, 1132, 30000, 810, 1132, 50000, 810, 1132, 70000, 810, 1132, 105000 };
|
||||
static_assert(sizeof(gpuVoltThermalPattern) == 0x48, "invalid gpuVoltageThermalPattern size");
|
||||
|
||||
/* GPU Max Clock asm Pattern:
|
||||
*
|
||||
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
||||
*
|
||||
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
||||
*/
|
||||
inline constexpr u32 GpuAsmPattern[] = { 0x52820000, 0x72A001C0 };
|
||||
|
||||
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
||||
return asm_compare_no_rd(*ptr32, GpuAsmPattern[0]);
|
||||
};
|
||||
|
||||
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
||||
// NA_FREQ_CVB_TABLE
|
||||
{ 76800, {}, { 814294, 8144, -940, 808, -21583, 226, } },
|
||||
{ 153600, {}, { 856185, 8144, -940, 808, -21583, 226, } },
|
||||
{ 230400, {}, { 898077, 8144, -940, 808, -21583, 226, } },
|
||||
{ 307200, {}, { 939968, 8144, -940, 808, -21583, 226, } },
|
||||
{ 384000, {}, { 981860, 8144, -940, 808, -21583, 226, } },
|
||||
{ 460800, {}, { 1023751, 8144, -940, 808, -21583, 226, } },
|
||||
{ 537600, {}, { 1065642, 8144, -940, 808, -21583, 226, } },
|
||||
{ 614400, {}, { 1107534, 8144, -940, 808, -21583, 226, } },
|
||||
{ 691200, {}, { 1149425, 8144, -940, 808, -21583, 226, } },
|
||||
{ 768000, {}, { 1191317, 8144, -940, 808, -21583, 226, } },
|
||||
{ 844800, {}, { 1233208, 8144, -940, 808, -21583, 226, } },
|
||||
{ 921600, {}, { 1275100, 8144, -940, 808, -21583, 226, } },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 MemVoltHOS = 1125'000;
|
||||
constexpr u32 EmcClkMinFreq = 40800; /* 40.8 MHz table only exists on erista. */
|
||||
constexpr u32 EmcClkPllmLimit = 1866'000'000;
|
||||
|
||||
constexpr u32 MTC_TABLE_REV = 7;
|
||||
constexpr u32 MtcTableCountDefault = 10;
|
||||
|
||||
constexpr size_t MtcFullTableSize = sizeof(EristaMtcTable) * MtcTableCountDefault;
|
||||
constexpr u32 MtcFullTableCount = 3;
|
||||
|
||||
/* These dramids were copied from Hekate -- see /bdk/mem/sdram.h */
|
||||
enum DramId {
|
||||
ICOSA_4GB_SAMSUNG_K4F6E304HB_MGCH = 0,
|
||||
ICOSA_4GB_HYNIX_H9HCNNNBPUMLHR_NLE = 1,
|
||||
ICOSA_4GB_MICRON_MT53B512M32D2NP_062_WTC = 2, /* This doesn't have a table in pcv? Wtf? */
|
||||
ICOSA_6GB_SAMSUNG_K4FHE3D4HM_MGCH = 4,
|
||||
ICOSA_8GB_SAMSUNG_K4FBE3D4HM_MGXX = 7, /* No table, but expected */
|
||||
};
|
||||
|
||||
enum MtcTableIndex {
|
||||
T210SdevEmcDvfsTableS4gb01 = 0, /* HB-MGCH */
|
||||
T210SdevEmcDvfsTableS6gb01 = 1, /* HM-MGCH */
|
||||
T210SdevEmcDvfsTableH4gb01 = 2, /* HR-NLE */
|
||||
MtcTableIndex_Invalid = 3,
|
||||
};
|
||||
|
||||
struct MtcDramIndex {
|
||||
DramId dramId;
|
||||
MtcTableIndex index;
|
||||
};
|
||||
|
||||
constexpr MtcDramIndex mtcIndexTable[] = {
|
||||
{ ICOSA_4GB_SAMSUNG_K4F6E304HB_MGCH, T210SdevEmcDvfsTableS4gb01, },
|
||||
{ ICOSA_6GB_SAMSUNG_K4FHE3D4HM_MGCH, T210SdevEmcDvfsTableS6gb01, },
|
||||
{ ICOSA_4GB_HYNIX_H9HCNNNBPUMLHR_NLE, T210SdevEmcDvfsTableH4gb01, },
|
||||
};
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* 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 "../oc_common.hpp"
|
||||
#include "pcv_common.hpp"
|
||||
#include "pcv_asm.hpp"
|
||||
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||
{ 204000, { 721589, -12695, 27 }, { } },
|
||||
{ 306000, { 747134, -14195, 27 }, { } },
|
||||
{ 408000, { 776324, -15705, 27 }, { } },
|
||||
{ 510000, { 809160, -17205, 27 }, { } },
|
||||
{ 612000, { 845641, -18715, 27 }, { } },
|
||||
{ 714000, { 885768, -20215, 27 }, { } },
|
||||
{ 816000, { 929540, -21725, 27 }, { } },
|
||||
{ 918000, { 976958, -23225, 27 }, { } },
|
||||
{ 1020000, { 1028021, -24725, 27 }, { 1120000 } },
|
||||
{ 1122000, { 1082730, -26235, 27 }, { 1120000 } },
|
||||
{ 1224000, { 1141084, -27735, 27 }, { 1120000 } },
|
||||
{ 1326000, { 1203084, -29245, 27 }, { 1120000 } },
|
||||
{ 1428000, { 1268729, -30745, 27 }, { 1120000 } },
|
||||
{ 1581000, { 1374032, -33005, 27 }, { 1120000 } },
|
||||
{ 1683000, { 1448791, -34505, 27 }, { 1120000 } },
|
||||
{ 1785000, { 1527196, -36015, 27 }, { 1120000 } },
|
||||
{ 1887000, { 1609246, -37515, 27 }, { 1120000 } },
|
||||
{ 1963500, { 1675751, -38635, 27 }, { 1120000 } },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 CpuClkOfficial = 1963'500;
|
||||
constexpr u32 CpuVoltOfficial = 1120;
|
||||
constexpr u32 CpuVminOfficial = 620;
|
||||
|
||||
constexpr u32 CpuTune0Low = 0xFFCF;
|
||||
|
||||
static const u32 cpuVoltagePatchValues[] = { 850, 38, 1120, 1000, 100, 1000, 0 };
|
||||
static const s32 cpuVoltagePatchOffsets[] = { -2, -1, 5, 6, 7, 8, 9 };
|
||||
static_assert(sizeof(cpuVoltagePatchValues) == sizeof(cpuVoltagePatchOffsets), "Invalid cpuVoltagePatch size");
|
||||
|
||||
static const u32 cpuVoltThermalData[] = { 620, 1120, 20000, 620, 1120, 70000, 950, 1132, 0, 950, 1227, 0 };
|
||||
|
||||
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
|
||||
{ 76800, {}, { 610000, } },
|
||||
{ 153600, {}, { 610000, } },
|
||||
{ 230400, {}, { 610000, } },
|
||||
{ 307200, {}, { 610000, } },
|
||||
{ 384000, {}, { 610000, } },
|
||||
{ 460800, {}, { 610000, } },
|
||||
{ 537600, {}, { 801688, -10900, -163, 298, -10599, 162, } },
|
||||
{ 614400, {}, { 824214, -5743, -452, 238, -6325, 81, } },
|
||||
{ 691200, {}, { 848830, -3903, -552, 119, -4030, -2, } },
|
||||
{ 768000, {}, { 891575, -4409, -584, 0, -2849, 39, } },
|
||||
{ 844800, {}, { 940071, -5367, -602, -60, -63, -93, } },
|
||||
{ 921600, {}, { 986765, -6637, -614, -179, 1905, -13, } },
|
||||
{ 998400, {}, { 1098475, -13529, -497, -179, 3626, 9, } },
|
||||
{ 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40, } },
|
||||
{ 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110, } },
|
||||
{ 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313, } },
|
||||
{ 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559, } },
|
||||
{ },
|
||||
};
|
||||
|
||||
constexpr u32 GpuClkPllMax = 1300'000'000;
|
||||
constexpr u32 GpuClkPllLimit = 2'600'000;
|
||||
constexpr u32 GpuVminOfficial = 610;
|
||||
|
||||
static const u32 gpuDVFSPattern[] = { 1050, 1000, 100, 1000, 10, };
|
||||
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");
|
||||
|
||||
/* GPU Max Clock asm Pattern:
|
||||
*
|
||||
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
||||
*
|
||||
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
||||
* sf | opc | | hw | imm16 | Rd
|
||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
||||
*/
|
||||
inline constexpr u32 GpuAsmPattern[] = { 0x52820000, 0x72A001C0 };
|
||||
|
||||
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
||||
return asm_compare_no_rd(*ptr32, GpuAsmPattern[0]);
|
||||
}
|
||||
|
||||
struct DvbEntry {
|
||||
u64 freq;
|
||||
s32 volt[4] = {};
|
||||
};
|
||||
|
||||
constexpr DvbEntry EmcDvbTableDefault[] = {
|
||||
{ 204000, { 637, 637, 637, } },
|
||||
{ 408000, { 637, 637, 637, } },
|
||||
{ 800000, { 637, 637, 637, } },
|
||||
{ 1065600, { 637, 637, 637, } },
|
||||
{ 1331200, { 650, 637, 637, } },
|
||||
{ 1600000, { 675, 650, 637, } },
|
||||
};
|
||||
|
||||
constexpr u32 EmcListDefault[] = { 204000, 1331200, 1600000, };
|
||||
constexpr u32 EmcListSizeDefault = std::size(EmcListDefault);
|
||||
constexpr u32 EmcListEndDefault = EmcListSizeDefault - 1;
|
||||
constexpr u32 EmcRateStep = 33'000;
|
||||
constexpr u32 EmcRateStepScale = 33'200;
|
||||
|
||||
constexpr u32 EmcClkOSAlt = 1331'200;
|
||||
constexpr u32 EmcClkPllmLimit = 2133'000'000;
|
||||
constexpr u32 EmcVddqDefault = 600'000;
|
||||
constexpr u32 MemVdd2Default = 1100'000;
|
||||
|
||||
constexpr u32 MTC_TABLE_REV = 3;
|
||||
constexpr u32 MtcTableCountDefault = 3;
|
||||
|
||||
constexpr size_t MtcFullTableSize = sizeof(MarikoMtcTable) * MtcTableCountDefault;
|
||||
constexpr u32 MtcFullTableCount = 17;
|
||||
|
||||
/* These dramids were copied from Hekate -- see /bdk/mem/sdram.h */
|
||||
enum DramId : u64 {
|
||||
HOAG_4GB_HYNIX_H9HCNNNBKMMLXR_NEE = 3,
|
||||
AULA_4GB_HYNIX_H9HCNNNBKMMLXR_NEE = 5,
|
||||
IOWA_4GB_HYNIX_H9HCNNNBKMMLXR_NEE = 6,
|
||||
|
||||
IOWA_4GB_SAMSUNG_K4U6E3S4AM_MGCJ = 8,
|
||||
IOWA_8GB_SAMSUNG_K4UBE3D4AM_MGCJ = 9,
|
||||
IOWA_4GB_HYNIX_H9HCNNNBKMMLHR_NME = 10,
|
||||
IOWA_4GB_MICRON_MT53E512M32D2NP_046_WTE = 11,
|
||||
|
||||
HOAG_4GB_SAMSUNG_K4U6E3S4AM_MGCJ = 12,
|
||||
HOAG_8GB_SAMSUNG_K4UBE3D4AM_MGCJ = 13,
|
||||
HOAG_4GB_HYNIX_H9HCNNNBKMMLHR_NME = 14,
|
||||
HOAG_4GB_MICRON_MT53E512M32D2NP_046_WTE = 15,
|
||||
|
||||
IOWA_4GB_SAMSUNG_K4U6E3S4AA_MGCL = 17,
|
||||
IOWA_8GB_SAMSUNG_K4UBE3D4AA_MGCL = 18,
|
||||
HOAG_4GB_SAMSUNG_K4U6E3S4AA_MGCL = 19,
|
||||
|
||||
IOWA_4GB_SAMSUNG_K4U6E3S4AB_MGCL = 20,
|
||||
HOAG_4GB_SAMSUNG_K4U6E3S4AB_MGCL = 21,
|
||||
AULA_4GB_SAMSUNG_K4U6E3S4AB_MGCL = 22,
|
||||
|
||||
HOAG_8GB_SAMSUNG_K4UBE3D4AA_MGCL = 23,
|
||||
AULA_4GB_SAMSUNG_K4U6E3S4AA_MGCL = 24,
|
||||
|
||||
IOWA_4GB_MICRON_MT53E512M32D2NP_046_WTF = 25,
|
||||
HOAG_4GB_MICRON_MT53E512M32D2NP_046_WTF = 26,
|
||||
AULA_4GB_MICRON_MT53E512M32D2NP_046_WTF = 27,
|
||||
|
||||
AULA_8GB_SAMSUNG_K4UBE3D4AA_MGCL = 28,
|
||||
|
||||
IOWA_4GB_HYNIX_H54G46CYRBX267 = 29,
|
||||
HOAG_4GB_HYNIX_H54G46CYRBX267 = 30,
|
||||
AULA_4GB_HYNIX_H54G46CYRBX267 = 31,
|
||||
|
||||
IOWA_4GB_MICRON_MT53E512M32D1NP_046_WTB = 32,
|
||||
HOAG_4GB_MICRON_MT53E512M32D1NP_046_WTB = 33,
|
||||
AULA_4GB_MICRON_MT53E512M32D1NP_046_WTB = 34,
|
||||
};
|
||||
|
||||
enum MtcTableIndex {
|
||||
T210b0SdevEmcDvfsTableS4gb01 = 0, /* (Unused) Samsung 4Gb */
|
||||
T210b0SdevEmcDvfsTableS4gb03 = 1, /* Samsung AM-MGCJ 4Gb */
|
||||
T210b0SdevEmcDvfsTableS8gb03 = 2, /* (Unused) Samsung 4Gb */
|
||||
T210b0SdevEmcDvfsTableH4gb03 = 3, /* Hynix NME 4Gb */
|
||||
T210b0SdevEmcDvfsTableM4gb03 = 4, /* Micron WT:F 4Gb */
|
||||
T210b0SdevEmcDvfsTableS4gbY01 = 5, /* (Unused) Samsung 4Gb */
|
||||
T210b0SdevEmcDvfsTableS1y4gbY01 = 6, /* (Unused) Samsung 4Gb */
|
||||
T210b0SdevEmcDvfsTableS1y8gbY01 = 7, /* (Unused) Samsung 4Gb */
|
||||
T210b0SdevEmcDvfsTableS1y4gbX03 = 8, /* Samsung AA-MGCL 4Gb */
|
||||
T210b0SdevEmcDvfsTableS1y8gbX03 = 9, /* Samsung AA-MGCL 8Gb */
|
||||
T210b0SdevEmcDvfsTableS1y4gb01 = 10, /* (Unused) Samsung 4Gb */
|
||||
T210b0SdevEmcDvfsTableM1y4gb01 = 11, /* Micron WT:E 4Gb */
|
||||
T210b0SdevEmcDvfsTableH1y4gb01 = 12, /* Hynix NEE 4Gb */
|
||||
T210b0SdevEmcDvfsTableS1y8gb04 = 13, /* Samsung AM-MGCJ 8Gb */
|
||||
T210b0SdevEmcDvfsTableS1z4gb01 = 14, /* Samsung AB-MGCL 4Gb */
|
||||
T210b0SdevEmcDvfsTableH1a4gb01 = 15, /* Hynix x267 4Gb */
|
||||
T210b0SdevEmcDvfsTableM1a4gb01 = 16, /* Micron WT:B 8Gb */
|
||||
MtcTableIndex_Invalid = 17,
|
||||
};
|
||||
|
||||
struct MtcDramIndex {
|
||||
DramId dramId;
|
||||
MtcTableIndex index;
|
||||
};
|
||||
|
||||
constexpr MtcDramIndex mtcIndexTable[] = {
|
||||
{ HOAG_4GB_HYNIX_H9HCNNNBKMMLXR_NEE, T210b0SdevEmcDvfsTableH1y4gb01, },
|
||||
{ AULA_4GB_HYNIX_H9HCNNNBKMMLXR_NEE, T210b0SdevEmcDvfsTableH1y4gb01, },
|
||||
{ IOWA_4GB_HYNIX_H9HCNNNBKMMLXR_NEE, T210b0SdevEmcDvfsTableH1y4gb01, },
|
||||
{ IOWA_4GB_SAMSUNG_K4U6E3S4AM_MGCJ, T210b0SdevEmcDvfsTableS4gb03, },
|
||||
{ IOWA_8GB_SAMSUNG_K4UBE3D4AM_MGCJ, T210b0SdevEmcDvfsTableS1y8gb04, },
|
||||
{ IOWA_4GB_HYNIX_H9HCNNNBKMMLHR_NME, T210b0SdevEmcDvfsTableH4gb03, },
|
||||
{ IOWA_4GB_MICRON_MT53E512M32D2NP_046_WTE, T210b0SdevEmcDvfsTableM1y4gb01, },
|
||||
{ HOAG_4GB_SAMSUNG_K4U6E3S4AM_MGCJ, T210b0SdevEmcDvfsTableS4gb03, },
|
||||
{ HOAG_8GB_SAMSUNG_K4UBE3D4AM_MGCJ, T210b0SdevEmcDvfsTableS1y8gb04, },
|
||||
{ HOAG_4GB_HYNIX_H9HCNNNBKMMLHR_NME, T210b0SdevEmcDvfsTableH4gb03, },
|
||||
{ HOAG_4GB_MICRON_MT53E512M32D2NP_046_WTE, T210b0SdevEmcDvfsTableM1y4gb01, },
|
||||
{ IOWA_4GB_SAMSUNG_K4U6E3S4AA_MGCL, T210b0SdevEmcDvfsTableS1y4gbX03, },
|
||||
{ IOWA_8GB_SAMSUNG_K4UBE3D4AA_MGCL, T210b0SdevEmcDvfsTableS1y8gbX03, },
|
||||
{ HOAG_4GB_SAMSUNG_K4U6E3S4AA_MGCL, T210b0SdevEmcDvfsTableS1y4gbX03, },
|
||||
{ IOWA_4GB_SAMSUNG_K4U6E3S4AB_MGCL, T210b0SdevEmcDvfsTableS1z4gb01, },
|
||||
{ HOAG_4GB_SAMSUNG_K4U6E3S4AB_MGCL, T210b0SdevEmcDvfsTableS1y8gb04, },
|
||||
{ AULA_4GB_SAMSUNG_K4U6E3S4AB_MGCL, T210b0SdevEmcDvfsTableS1y8gb04, },
|
||||
{ HOAG_8GB_SAMSUNG_K4UBE3D4AA_MGCL, T210b0SdevEmcDvfsTableS1y8gbX03, },
|
||||
{ AULA_4GB_SAMSUNG_K4U6E3S4AA_MGCL, T210b0SdevEmcDvfsTableS1y4gbX03, },
|
||||
{ IOWA_4GB_MICRON_MT53E512M32D2NP_046_WTF, T210b0SdevEmcDvfsTableM4gb03, },
|
||||
{ HOAG_4GB_MICRON_MT53E512M32D2NP_046_WTF, T210b0SdevEmcDvfsTableM4gb03, },
|
||||
{ AULA_4GB_MICRON_MT53E512M32D2NP_046_WTF, T210b0SdevEmcDvfsTableM4gb03, },
|
||||
{ AULA_8GB_SAMSUNG_K4UBE3D4AA_MGCL, T210b0SdevEmcDvfsTableS1y8gbX03, },
|
||||
{ IOWA_4GB_HYNIX_H54G46CYRBX267, T210b0SdevEmcDvfsTableH1a4gb01, },
|
||||
{ HOAG_4GB_HYNIX_H54G46CYRBX267, T210b0SdevEmcDvfsTableH1a4gb01, },
|
||||
{ AULA_4GB_HYNIX_H54G46CYRBX267, T210b0SdevEmcDvfsTableH1a4gb01, },
|
||||
{ IOWA_4GB_MICRON_MT53E512M32D1NP_046_WTB, T210b0SdevEmcDvfsTableM1a4gb01, },
|
||||
{ HOAG_4GB_MICRON_MT53E512M32D1NP_046_WTB, T210b0SdevEmcDvfsTableM1a4gb01, },
|
||||
{ AULA_4GB_MICRON_MT53E512M32D1NP_046_WTB, T210b0SdevEmcDvfsTableM1a4gb01, },
|
||||
};
|
||||
|
||||
/*
|
||||
710006abfc 40 01 1f d6 br x10
|
||||
*/
|
||||
|
||||
/*
|
||||
710006ac28 a0 03 00 90 adrp x0,0x71000de000
|
||||
710006ac2c 00 80 16 91 add x0=>SdevEmcDvfsTableS4gb01,x0,#0x5a0
|
||||
*/
|
||||
|
||||
/* Br */
|
||||
/*
|
||||
| Z | OP | Fixed | A | M | RN | RM
|
||||
31 30 29 28 27 26 25 | 24 23 | 22 | 21 20 19 18 17 16 15 14 13 12 |11 | 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||
1 1 0 1 0 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 Rn 0 0 0 0 0
|
||||
Z op A M Rm
|
||||
*/
|
||||
|
||||
/* Adrp */
|
||||
/*
|
||||
OP | ImmLow | ImmHigh | RD
|
||||
31 | 30 29 28 27 26 25 24 | 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 | 4 3 2 1 0
|
||||
*/
|
||||
|
||||
/* ADD (immediate) */
|
||||
/*
|
||||
SF | OP | S | Fixed value | Sh | Imm12 | RN | RD
|
||||
31 | 30 | 29 | 28 27 26 25 24 23 | 22 | 21 20 19 18 17 16 15 14 13 12 11 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||
*/
|
||||
|
||||
constexpr u32 MtcBrAsm = 0xD61F0140;
|
||||
constexpr u32 MtcMovAsm = 0x52800068;
|
||||
constexpr u32 MtcAdrpAsm = 0x900003A0;
|
||||
constexpr u32 MtcAddAsm = 0x91168000;
|
||||
|
||||
ALWAYS_INLINE bool MemMtcGetGetTablePatternFn(u32 *ptr) {
|
||||
/* This builds an address that gets returned, so the register must be x0 by convention. */
|
||||
return AsmCompareAddNoImm12(*ptr, MtcAddAsm);
|
||||
}
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -18,118 +18,113 @@
|
||||
|
||||
#include "ptm.hpp"
|
||||
|
||||
namespace ams::ldr::oc::ptm {
|
||||
namespace ams::ldr::hoc::ptm {
|
||||
|
||||
Result CpuPtmBoost(perf_conf_entry* entry) {
|
||||
Result CpuPtmBoost(perf_conf_entry* entry) {
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||
#else
|
||||
bool isMariko = true;
|
||||
#endif
|
||||
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||
#else
|
||||
bool isMariko = true;
|
||||
#endif
|
||||
if (!C.eristaCpuBoostClock || !C.marikoCpuBoostClock) {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
u32 cpuPtmBoostNew = isMariko ? C.marikoCpuBoostClock * 1000 : C.eristaCpuBoostClock * 1000;
|
||||
|
||||
PATCH_OFFSET(&(entry->cpu_freq_1), cpuPtmBoostNew);
|
||||
PATCH_OFFSET(&(entry->cpu_freq_2), cpuPtmBoostNew);
|
||||
|
||||
if (!C.eristaCpuBoostClock || !C.marikoCpuBoostClock)
|
||||
R_SUCCEED();
|
||||
|
||||
u32 cpuPtmBoostNew = isMariko ? C.marikoCpuBoostClock * 1000 : C.eristaCpuBoostClock * 1000;
|
||||
|
||||
PATCH_OFFSET(&(entry->cpu_freq_1), cpuPtmBoostNew);
|
||||
PATCH_OFFSET(&(entry->cpu_freq_2), cpuPtmBoostNew);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result MemPtm(perf_conf_entry* entry) {
|
||||
PATCH_OFFSET(&(entry->emc_freq_1), memPtmLimit);
|
||||
PATCH_OFFSET(&(entry->emc_freq_2), memPtmLimit);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
bool PtmEntryIsValid(perf_conf_entry* entry) {
|
||||
return (entry->cpu_freq_1 == entry->cpu_freq_2 &&
|
||||
entry->gpu_freq_1 == entry->gpu_freq_2 &&
|
||||
entry->emc_freq_1 == entry->emc_freq_2);
|
||||
}
|
||||
|
||||
bool PtmTablePatternFn(u32* ptr) {
|
||||
perf_conf_entry* entry = reinterpret_cast<perf_conf_entry *>(ptr);
|
||||
if (!PtmEntryIsValid(entry))
|
||||
return false;
|
||||
|
||||
return entry->cpu_freq_1 == cpuPtmDefault;
|
||||
}
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
perf_conf_entry* confTable = nullptr;
|
||||
for (uintptr_t ptr = mapped_nso;
|
||||
ptr <= mapped_nso + nso_size - sizeof(perf_conf_entry) * entryCnt;
|
||||
ptr += sizeof(u32))
|
||||
{
|
||||
u32* ptr32 = reinterpret_cast<u32 *>(ptr);
|
||||
if (PtmTablePatternFn(ptr32)) {
|
||||
confTable = reinterpret_cast<perf_conf_entry *>(ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!confTable) {
|
||||
CRASH("confTable not found!");
|
||||
Result MemPtm(perf_conf_entry* entry) {
|
||||
PATCH_OFFSET(&(entry->emc_freq_1), memPtmLimit);
|
||||
PATCH_OFFSET(&(entry->emc_freq_2), memPtmLimit);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
PatcherEntry<perf_conf_entry> cpuPtmBoostPatch = { "CPU Ptm Boost", &CpuPtmBoost, 2, };
|
||||
PatcherEntry<perf_conf_entry> memPtmPatch = { "MEM Ptm", &MemPtm, 16, };
|
||||
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||
#else
|
||||
bool isMariko = true;
|
||||
#endif
|
||||
|
||||
|
||||
for (u32 i = 0; i < entryCnt; i++) {
|
||||
perf_conf_entry* entry = confTable + i;
|
||||
bool PtmEntryIsValid(perf_conf_entry* entry) {
|
||||
return (entry->cpu_freq_1 == entry->cpu_freq_2 && entry->gpu_freq_1 == entry->gpu_freq_2 && entry->emc_freq_1 == entry->emc_freq_2);
|
||||
}
|
||||
|
||||
bool PtmTablePatternFn(u32* ptr) {
|
||||
perf_conf_entry* entry = reinterpret_cast<perf_conf_entry *>(ptr);
|
||||
if (!PtmEntryIsValid(entry)) {
|
||||
LOGGING("@%p", &entry);
|
||||
CRASH("Invalid ptm confTable entry");
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (entry->cpu_freq_1) {
|
||||
case cpuPtmBoost:
|
||||
cpuPtmBoostPatch.Apply(entry);
|
||||
return entry->cpu_freq_1 == cpuPtmDefault;
|
||||
}
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
perf_conf_entry* confTable = nullptr;
|
||||
for (uintptr_t ptr = mapped_nso; ptr <= mapped_nso + nso_size - sizeof(perf_conf_entry) * entryCnt; ptr += sizeof(u32)) {
|
||||
u32* ptr32 = reinterpret_cast<u32 *>(ptr);
|
||||
if (PtmTablePatternFn(ptr32)) {
|
||||
confTable = reinterpret_cast<perf_conf_entry *>(ptr);
|
||||
break;
|
||||
case cpuPtmDefault:
|
||||
case cpuPtmDevOC:
|
||||
break;
|
||||
default:
|
||||
LOGGING("%u (0x%08x) @%p", entry->cpu_freq_1, entry->conf_id, &(entry->cpu_freq_1));
|
||||
CRASH("Unknown CPU Freq");
|
||||
}
|
||||
}
|
||||
|
||||
switch (entry->emc_freq_1) {
|
||||
case memPtmLimit:
|
||||
case memPtmAlt:
|
||||
case memPtmClamp:
|
||||
if (isMariko) {
|
||||
memPtmPatch.Apply(entry);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOGGING("%u (0x%08x) @%p", entry->emc_freq_1, entry->conf_id, &(entry->emc_freq_2));
|
||||
CRASH("Unknown MEM Freq");
|
||||
if (!confTable) {
|
||||
CRASH("confTable not found!");
|
||||
}
|
||||
|
||||
PatcherEntry<perf_conf_entry> cpuPtmBoostPatch = { "CPU Ptm Boost", &CpuPtmBoost, 2, };
|
||||
PatcherEntry<perf_conf_entry> memPtmPatch = { "MEM Ptm", &MemPtm, 16, };
|
||||
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||
#else
|
||||
bool isMariko = true;
|
||||
#endif
|
||||
|
||||
for (u32 i = 0; i < entryCnt; i++) {
|
||||
perf_conf_entry *entry = confTable + i;
|
||||
|
||||
if (!PtmEntryIsValid(entry)) {
|
||||
LOGGING("@%p", &entry);
|
||||
CRASH("Invalid ptm confTable entry");
|
||||
}
|
||||
|
||||
switch (entry->cpu_freq_1) {
|
||||
case cpuPtmBoost:
|
||||
cpuPtmBoostPatch.Apply(entry);
|
||||
break;
|
||||
case cpuPtmDefault:
|
||||
case cpuPtmDevOC:
|
||||
break;
|
||||
default:
|
||||
LOGGING("%u (0x%08x) @%p", entry->cpu_freq_1, entry->conf_id, &(entry->cpu_freq_1));
|
||||
CRASH("Unknown CPU Freq");
|
||||
}
|
||||
|
||||
switch (entry->emc_freq_1) {
|
||||
case memPtmLimit:
|
||||
case memPtmAlt:
|
||||
case memPtmClamp:
|
||||
if (isMariko) {
|
||||
memPtmPatch.Apply(entry);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOGGING("%u (0x%08x) @%p", entry->emc_freq_1, entry->conf_id, &(entry->emc_freq_2));
|
||||
CRASH("Unknown MEM Freq");
|
||||
}
|
||||
}
|
||||
|
||||
LOGGING("%s Count: %zu", cpuPtmBoostPatch.description, cpuPtmBoostPatch.patched_count);
|
||||
if (R_FAILED(cpuPtmBoostPatch.CheckResult()))
|
||||
CRASH(cpuPtmBoostPatch.description);
|
||||
|
||||
if (isMariko) {
|
||||
LOGGING("%s Count: %zu", memPtmPatch.description, memPtmPatch.patched_count);
|
||||
if (R_FAILED(memPtmPatch.CheckResult()))
|
||||
CRASH(memPtmPatch.description);
|
||||
}
|
||||
}
|
||||
|
||||
LOGGING("%s Count: %zu", cpuPtmBoostPatch.description, cpuPtmBoostPatch.patched_count);
|
||||
if (R_FAILED(cpuPtmBoostPatch.CheckResult()))
|
||||
CRASH(cpuPtmBoostPatch.description);
|
||||
|
||||
if (isMariko) {
|
||||
LOGGING("%s Count: %zu", memPtmPatch.description, memPtmPatch.patched_count);
|
||||
if (R_FAILED(memPtmPatch.CheckResult()))
|
||||
CRASH(memPtmPatch.description);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||
* 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,
|
||||
@@ -20,28 +20,28 @@
|
||||
|
||||
#include "../oc_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc::ptm {
|
||||
namespace ams::ldr::hoc::ptm {
|
||||
|
||||
typedef struct {
|
||||
u32 conf_id;
|
||||
u32 cpu_freq_1; // min-max pair?
|
||||
u32 cpu_freq_2;
|
||||
u32 gpu_freq_1;
|
||||
u32 gpu_freq_2;
|
||||
u32 emc_freq_1;
|
||||
u32 emc_freq_2;
|
||||
u32 padding;
|
||||
} perf_conf_entry;
|
||||
typedef struct {
|
||||
u32 conf_id;
|
||||
u32 cpu_freq_1; // min-max pair?
|
||||
u32 cpu_freq_2;
|
||||
u32 gpu_freq_1;
|
||||
u32 gpu_freq_2;
|
||||
u32 emc_freq_1;
|
||||
u32 emc_freq_2;
|
||||
u32 padding;
|
||||
} perf_conf_entry;
|
||||
|
||||
constexpr u32 entryCnt = 16;
|
||||
constexpr u32 cpuPtmDefault = 1020'000'000;
|
||||
constexpr u32 cpuPtmDevOC = 1224'000'000;
|
||||
constexpr u32 cpuPtmBoost = 1785'000'000;
|
||||
constexpr u32 entryCnt = 16;
|
||||
constexpr u32 cpuPtmDefault = 1020'000'000;
|
||||
constexpr u32 cpuPtmDevOC = 1224'000'000;
|
||||
constexpr u32 cpuPtmBoost = 1785'000'000;
|
||||
|
||||
constexpr u32 memPtmLimit = 1600'000'000;
|
||||
constexpr u32 memPtmAlt = 1331'200'000;
|
||||
constexpr u32 memPtmClamp = 1065'600'000;
|
||||
constexpr u32 memPtmLimit = 1600'000'000;
|
||||
constexpr u32 memPtmAlt = 1331'200'000;
|
||||
constexpr u32 memPtmClamp = 1065'600'000;
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
from PyInstaller.utils.hooks import collect_all
|
||||
|
||||
datas = [('C:/Users/sould/Documents/GitHub/Switch-OC-Mansion/Source/Configurator/assets', 'assets')]
|
||||
binaries = []
|
||||
hiddenimports = []
|
||||
tmp_ret = collect_all('psutil')
|
||||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['C:/Users/sould/Documents/GitHub/Switch-OC-Mansion/Source/Configurator/src/main.py'],
|
||||
pathex=[],
|
||||
binaries=binaries,
|
||||
datas=datas,
|
||||
hiddenimports=hiddenimports,
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='Configurator',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon=['C:\\Users\\sould\\Documents\\GitHub\\Switch-OC-Mansion\\Source\\Configurator\\assets\\icon.ico'],
|
||||
)
|
||||
@@ -1,287 +0,0 @@
|
||||
Lexend Font:
|
||||
Copyright 2018 The Lexend Project Authors (https://github.com/googlefonts/lexend), with Reserved Font Name “RevReading Lexend”.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1 . This license is copied below, and is also available with a FAQ at: https://openfontlicense.org
|
||||
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
|
||||
|
||||
Main Program:
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 162 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 650 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 682 KiB |
@@ -1,2 +0,0 @@
|
||||
python -m PyInstaller --onefile --add-data "assets;assets" --icon=assets/icon.ico --noconsole src/main.py --hidden-import=pillow --hidden-import=psutil --hidden-import=dearpygui --hidden-import=numpy --hidden-import=pathlib
|
||||
move "dist\main.exe" "dist\hocconfig.exe"
|
||||
@@ -1 +0,0 @@
|
||||
pip install pyinstaller dearpygui numpy psutil pil
|
||||
BIN
Source/Configurator/dist/hocconfig.exe
vendored
BIN
Source/Configurator/dist/hocconfig.exe
vendored
Binary file not shown.
Binary file not shown.
@@ -1,39 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['src\\main.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[('assets', 'assets')],
|
||||
hiddenimports=['pillow', 'psutil', 'dearpygui', 'numpy', 'pathlib'],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='main',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon=['assets\\icon.ico'],
|
||||
)
|
||||
@@ -1 +0,0 @@
|
||||
python src/main.py
|
||||
@@ -1,52 +0,0 @@
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
import sys
|
||||
import platform
|
||||
import common as c
|
||||
import license
|
||||
|
||||
def populate():
|
||||
dpg.add_text("Horizon OC Configurator")
|
||||
dpg.add_separator(label="Contributors")
|
||||
|
||||
with dpg.group(horizontal=True):
|
||||
dpg.add_image("soul", width=96, height=96)
|
||||
dpg.add_image("lightos", width=96, height=96)
|
||||
dpg.add_image("samy", width=96, height=96)
|
||||
|
||||
dpg.add_separator()
|
||||
|
||||
dpg.add_text("Souldbminer - Main contributor. Wrote the full configurator")
|
||||
dpg.add_text("Lightos - Dumped L4T Timings")
|
||||
dpg.add_text("Lightos, Samybigio, Flopsider - Testers")
|
||||
|
||||
dpg.add_separator(label="Information")
|
||||
|
||||
dpg.add_text(f"Configurator Version {c.version}")
|
||||
dpg.add_text(f"Current Python Version: {sys.version}")
|
||||
dpg.add_text(f"Current DearPyGui Version: {dpg.get_major_version()}.{dpg.get_minor_version()}")
|
||||
dpg.add_text(f"Current OS Version: {platform.system()} {platform.release()} Build {platform.version()}")
|
||||
|
||||
dpg.add_button(label="Debug Mode", callback=lambda: dpg.show_debug())
|
||||
dpg.add_button(label="License", callback=lambda: c.show_popup_big("License (GPLv2-or-later)", license.gplv2_text))
|
||||
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
from defaults import d
|
||||
|
||||
drive = 0
|
||||
|
||||
version = "2.0.0"
|
||||
|
||||
def show_info_window(sender, app_data, user_data):
|
||||
window_tag = "info_window" + user_data
|
||||
if not dpg.does_item_exist(window_tag):
|
||||
with dpg.window(label="Information", tag=window_tag, width=400, height=200):
|
||||
wrap_width = dpg.get_item_width(window_tag) - 10
|
||||
dpg.add_text(user_data, wrap=wrap_width)
|
||||
else:
|
||||
dpg.show_item(window_tag)
|
||||
|
||||
def store_value(sender, app_data, user_data=None):
|
||||
var_name = f"{dpg.get_item_(sender)}_value"
|
||||
globals()[var_name] = app_data
|
||||
print(f"{var_name} = {app_data}")
|
||||
|
||||
def get_value(tag, default=None):
|
||||
var_name = f"{tag}_value"
|
||||
|
||||
return globals().get(var_name, default)
|
||||
def show_popup(title="Popup", content="Message"):
|
||||
if dpg.does_item_exist("popup_window"):
|
||||
dpg.delete_item("popup_window")
|
||||
|
||||
with dpg.window(
|
||||
label=title,
|
||||
tag="popup_window",
|
||||
modal=True,
|
||||
no_close=True,
|
||||
width=150,
|
||||
height=150
|
||||
):
|
||||
dpg.add_text(content, wrap=145)
|
||||
dpg.add_separator()
|
||||
dpg.add_button(label="Close", width=100, callback=lambda: dpg.delete_item("popup_window"))
|
||||
def show_popup_big(title="Popup", content="Message"):
|
||||
if dpg.does_item_exist("big_popup_window"):
|
||||
dpg.delete_item("big_popup_window")
|
||||
|
||||
with dpg.window(
|
||||
label=title,
|
||||
tag="big_popup_window",
|
||||
modal=True,
|
||||
no_close=True,
|
||||
width=500,
|
||||
height=500
|
||||
):
|
||||
dpg.add_text(content, wrap=495)
|
||||
dpg.add_separator()
|
||||
dpg.add_button(label="Close", width=100, callback=lambda: dpg.delete_item("big_popup_window"))
|
||||
|
||||
|
||||
def load_entry_object(var_name, flag=0):
|
||||
if not hasattr(d, var_name):
|
||||
print(f"Variable {var_name} not found in d.")
|
||||
return
|
||||
|
||||
value = getattr(d, var_name)
|
||||
match flag:
|
||||
case 0:
|
||||
value_str = str(value)
|
||||
case 1:
|
||||
value_str = f"{value / 1000:.1f} MHz"
|
||||
case 2:
|
||||
if not value == 0:
|
||||
value_str = f"{value / 1000:.1f} mV"
|
||||
else:
|
||||
value_str = "Disabled"
|
||||
case 3:
|
||||
if not value == 0:
|
||||
value_str = f"{value} mV"
|
||||
else:
|
||||
value_str = "Disabled"
|
||||
case 4:
|
||||
match value:
|
||||
case 0:
|
||||
value_str = "No Table (UV0)"
|
||||
case 1:
|
||||
value_str = "Regular Table (UV1)"
|
||||
case 2:
|
||||
value_str = "High Table (UV2)"
|
||||
case 3:
|
||||
value_str = "Custom Table (UV3)"
|
||||
case 5:
|
||||
value_str = value
|
||||
|
||||
if dpg.does_item_exist(var_name):
|
||||
dpg.set_value(var_name, value_str)
|
||||
else:
|
||||
print(f"Entry tagged '{var_name}' does not exist.")
|
||||
@@ -1,166 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
import common
|
||||
import kip as k
|
||||
import gpu as g
|
||||
import settings as s
|
||||
def populate():
|
||||
|
||||
freqs_mhz_cpu_label = [f"{f} MHz" for f in s.freqs_mhz_cpu]
|
||||
offsets = list(range(0, 101, 5))
|
||||
processed_offsets = ["Disabled" if v == 0 else f"-{v}mV" for v in offsets]
|
||||
voltages = [0] + list(range(1000, 1160 + 1, s.mariko_voltage_step)) # 0 first for Disabled
|
||||
processed_voltages = ["Disabled" if v == 0 else f"{v}mV" for v in voltages]
|
||||
processed_voltages_default = ["Default" if v == 0 else f"{v}mV" for v in voltages]
|
||||
voltages_e = [0] + list(range(1120, 1255 + 1, s.mariko_voltage_step)) + [1257] # 0 first for Disabled
|
||||
processed_voltages_e = ["Disabled" if v == 0 else f"{v}mV" for v in voltages_e]
|
||||
processed_voltages_default_e = ["Default" if v == 0 else f"{v}mV" for v in voltages_e]
|
||||
|
||||
vmin_voltages = list(range(s.mariko_cpu_min_vmin, s.mariko_cpu_max_vmin + 1, s.mariko_voltage_step)) # 0 first for Disabled
|
||||
vmin_processed_voltages = ["Disabled" if v == 0 else f"{v}mV" for v in vmin_voltages]
|
||||
|
||||
dpg.add_separator(label="Frequencies")
|
||||
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="A higher CPU frequency significantly increases power draw. To sustain higher frequencies without exeeding PMIC limit, undervolt your device. \nThe CPU Boost Frequency is used to speed up game loading",
|
||||
width=120,
|
||||
height=64, # height=0 makes it match text
|
||||
small=True,
|
||||
tag="c_freqs_info"
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=freqs_mhz_cpu_label,
|
||||
default_value="1963.0MHz",
|
||||
label="Mariko CPU Boost Frequency",
|
||||
callback=k.grab_kip_storage_values,
|
||||
tag="marikoCpuBoostClock"
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=freqs_mhz_cpu_label,
|
||||
default_value="1785.0MHz",
|
||||
label="Erista CPU Boost Frequency",
|
||||
callback=k.grab_kip_storage_values,
|
||||
tag="eristaCpuBoostClock"
|
||||
)
|
||||
|
||||
dpg.add_separator(label="Voltages")
|
||||
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="Lower voltages reduce power draw and tempratures. Higher voltages can boost available clockspeeds. Choose voltages with caution, as high voltages can cause IRREPERABLE hardware damage",
|
||||
width=120,
|
||||
height=64, # height=0 makes it match text
|
||||
small=True,
|
||||
tag="c_volt_info"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=vmin_processed_voltages,
|
||||
default_value="Default (600mV)",
|
||||
label="CPU High vMin (Mariko)",
|
||||
tag="marikoCpuHighVmin",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=vmin_processed_voltages,
|
||||
default_value="Default (800mV)",
|
||||
label="CPU Low vMin (Mariko)",
|
||||
tag="marikoCpuLowVmin",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=processed_voltages,
|
||||
default_value="Disabled",
|
||||
label="CPU vMax (Mariko)",
|
||||
tag="marikoCpuMaxVolt",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=processed_voltages_e,
|
||||
default_value="Disabled",
|
||||
label="CPU vMax (Erista)",
|
||||
tag="eristaCpuMaxVolt",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
|
||||
dpg.add_separator(label="Undervolt")
|
||||
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="A undervolted device consumes less power, heats up less, which enables higher clocks. \nThe GPU Undervolt mode should be set to Default or High, test which one is suitable to your console. Custom is only meant for ADVANCED USERS, as the values in it could cause HARDWARE DAMAGE! \nThe Offset should be kept at the minumum your GPU requires to function at the high ram clock (high ram clock means more GPU power needed, usually 600mV is sufficient)",
|
||||
width=120,
|
||||
height=64, # height=0 makes it match text
|
||||
small=True,
|
||||
tag="c_uv_info"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=list(range(0, 8 + 1, 1)),
|
||||
default_value="Default Table",
|
||||
label="Mariko CPU Low Undervolt",
|
||||
tag="marikoCpuUVLow",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=list(range(0, 12 + 1, 1)),
|
||||
default_value="Default Table",
|
||||
label="Mariko CPU High Undervolt",
|
||||
tag="marikoCpuUVHigh",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=["Auto (Unimplemented) (0)", "Default (1)", "Tbreak Fifteen Eighty One (2)", "Tbreak Sixteen Eighty Three (3)", "HELIOS (4)"],
|
||||
default_value="Default Table",
|
||||
label="Table Configuration",
|
||||
tag="tableConf",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=list(range(0, 5 + 1, 1)),
|
||||
default_value="Default Table",
|
||||
label="Erista CPU Undervolt",
|
||||
tag="eristaCpuUV",
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
# dpg.add_combo(
|
||||
# items=["0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
|
||||
# default_value="0",
|
||||
# label="High Frequency Undervolt",
|
||||
# tag="m_cpu_huv",
|
||||
# callback=k.grab_kip_storage_values_no_mult
|
||||
# )
|
||||
# dpg.add_combo(
|
||||
# items=processed_offsets,
|
||||
# default_value="Disabled",
|
||||
# label="CPU Volt Offset",
|
||||
# callback=k.grab_kip_storage_values_no_mult,
|
||||
# tag="m_cpu_hv_offset"
|
||||
# )
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class Defaults: # This almost always never needs to be updated as pulling from the kip takes priority
|
||||
def __init__(self):
|
||||
self.autosave = 0
|
||||
pass
|
||||
d = Defaults()
|
||||
@@ -1,230 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
import configparser
|
||||
import dearpygui.dearpygui as dpg
|
||||
import kip as k
|
||||
import common
|
||||
from pathlib import Path
|
||||
import ini
|
||||
import settings as s
|
||||
|
||||
def unimplemented():
|
||||
pass
|
||||
|
||||
def check_gpu_sched():
|
||||
if common.drive == 0:
|
||||
return False
|
||||
|
||||
ini_path = Path(common.drive) / "atmosphere/config/system_settings.ini"
|
||||
if not ini_path.exists():
|
||||
return False
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(ini_path)
|
||||
|
||||
return config.get("am.gpu", "gpu_scheduling_enabled", fallback="0x0").strip() == "0x1"
|
||||
|
||||
def toggle_gpu_sched(sender, app_data):
|
||||
|
||||
ini_path = Path(common.drive) / "atmosphere/config/system_settings.ini"
|
||||
|
||||
# Determine value
|
||||
value = "0x1" if app_data else "0x0"
|
||||
|
||||
# Ensure the parent folder exists
|
||||
ini_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Update using the helper function (requires str path)
|
||||
ini.set_ini_values(str(ini_path), "am.gpu", {"gpu_scheduling_enabled": value})
|
||||
|
||||
common.show_popup("Success", f"Set GPU Scheduling to {app_data}")
|
||||
|
||||
def populate():
|
||||
offsets = list(range(0, s.mariko_gpu_offset_max + 1, s.mariko_voltage_step))
|
||||
processed_offsets = ["Disabled" if v == 0 else f"-{v} mV" for v in offsets]
|
||||
voltages = [0] + list(range(s.mariko_gpu_min_volt, s.mariko_gpu_max_volt + 1, s.mariko_voltage_step)) # 0 first for Disabled
|
||||
processed_voltages = ["Disabled" if v == 0 else f"{v} mV" for v in voltages]
|
||||
voltages_e = [0] + list(range(s.erista_gpu_min_volt, s.erista_gpu_max_volt + 1, s.mariko_voltage_step)) # 0 first for Disabled
|
||||
processed_voltages_e = ["Disabled" if v == 0 else f"{v} mV" for v in voltages_e]
|
||||
processed_voltages_default = ["Default" if v == 0 else f"{v} mV" for v in voltages]
|
||||
voltages_vmin = [0] + list(range(s.mariko_gpu_min_volt, s.mariko_gpu_max_vmin + 1, s.mariko_voltage_step)) # 0 first for Disabled
|
||||
processed_voltages_vmin = ["Disabled" if v == 0 else f"{v} mV" for v in voltages_vmin]
|
||||
voltages_vmin_e = [0] + list(range(s.erista_gpu_min_volt, s.erista_gpu_max_vmin + 1, s.mariko_voltage_step)) # 0 first for Disabled
|
||||
processed_voltages_vmin_e = ["Disabled" if v == 0 else f"{v} mV" for v in voltages_vmin_e]
|
||||
|
||||
freqs_mhz_label = [f"{f} MHz" for f in s.freqs_mhz]
|
||||
|
||||
dpg.add_separator(label="Frequencies")
|
||||
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="A higher GPU frequency significantly increases power draw. To sustain higher frequencies without exeeding PMIC limit, undervolt your device \nDO NOT disable GPU scheduling without a adequate undervolt as it can cause hardware damage due to the high power consumption",
|
||||
width=120,
|
||||
height=64, # height=0 makes it match text
|
||||
small=True,
|
||||
tag="freqs_info"
|
||||
)
|
||||
dpg.add_checkbox(label="GPU Scheduling", default_value=True, tag="gpu_sched", callback=toggle_gpu_sched)
|
||||
|
||||
dpg.add_separator(label="Voltages")
|
||||
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="Lower voltages reduce power draw and tempratures. Higher voltages can boost available clockspeeds. Choose voltages with caution, as high voltages can cause IRREPERABLE hardware damage",
|
||||
width=120,
|
||||
height=64, # height=0 makes it match text
|
||||
small=True,
|
||||
tag="volt_info"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=processed_voltages_vmin_e,
|
||||
default_value="Disabled",
|
||||
label="Erista GPU vMin",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="eristaGpuVmin"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=processed_voltages_vmin,
|
||||
default_value="Disabled",
|
||||
label="Mariko GPU vMin",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="marikoGpuVmin"
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=processed_voltages,
|
||||
default_value="Disabled",
|
||||
label="Mariko GPU vMax",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="marikoGpuVmax"
|
||||
)
|
||||
|
||||
dpg.add_separator(label="Undervolt")
|
||||
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="A undervolted device consumes less power, heats up less, which enables higher clocks. \nThe GPU Undervolt mode should be set to Default or High, test which one is suitable to your console. Custom is only meant for ADVANCED USERS, as the values in it could cause HARDWARE DAMAGE! \nThe Offset should be kept at the minumum your GPU requires to function at the high ram clock (high ram clock means more GPU power needed)",
|
||||
width=120,
|
||||
height=64, # height=0 makes it match text
|
||||
small=True,
|
||||
tag="uv_info"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=["No Table (UV0)", "Regular Table (UV1)", "High Table (UV2)", "Custom Table (UV3)"],
|
||||
default_value="No Table (UV0)",
|
||||
label="Mariko Undervolt Mode",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="marikoGpuUV"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=["No Table (UV0)", "Regular Table (UV1)", "High Table (UV2)", "Custom Table (UV3)"],
|
||||
default_value="No Table (UV0)",
|
||||
label="Erista Undervolt Mode",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="eristaGpuUV"
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=processed_offsets,
|
||||
default_value="Disabled",
|
||||
label="GPU Volt Offset",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="commonGpuVoltOffset"
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=["Disabled (0)", "Enabled (1)"],
|
||||
default_value="Disabled",
|
||||
label="Mariko GPU PLL Unlock",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="marikoGpuFullUnlock"
|
||||
)
|
||||
|
||||
|
||||
dpg.add_separator(label="Custom Table (Mariko)")
|
||||
|
||||
for freq in s.freqs_khz:
|
||||
if(freq > s.mariko_meme_threshold):
|
||||
mhz_color = s.danger_color
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = ""
|
||||
elif(freq > s.mariko_dangerous_gpu_threshold):
|
||||
mhz_color = s.danger_color
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = "(DANGEROUS)"
|
||||
elif(freq > s.mariko_unsafe_gpu_threshold):
|
||||
mhz_color = s.unsafe_color
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = "(UNSAFE)"
|
||||
else:
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = ""
|
||||
mhz_color = s.safe_color
|
||||
|
||||
mhz_tag = f"combo_{freq}"
|
||||
if freq == s.mariko_meme_threshold:
|
||||
with dpg.group(horizontal=True): # align horizontally
|
||||
dpg.add_combo(
|
||||
items=processed_voltages,
|
||||
default_value="Disabled",
|
||||
tag="g_volt_" + str(freq),
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
dpg.add_text(f"{mhz_label} (", color=mhz_color)
|
||||
dpg.add_image("coolerhd", width=20, height=20)
|
||||
dpg.add_text(")", color=mhz_color)
|
||||
else:
|
||||
with dpg.group(horizontal=True):
|
||||
dpg.add_combo(
|
||||
items=processed_voltages,
|
||||
default_value="Disabled",
|
||||
tag="g_volt_" + str(freq),
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
dpg.add_text(default_value=f"{mhz_label} {safety_label}", color=mhz_color)
|
||||
|
||||
dpg.add_separator(label="Custom Table (Erista)")
|
||||
|
||||
for freq in s.freqs_khz_e:
|
||||
if(freq > s.erista_dangerous_gpu_threshold):
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = "(DANGEROUS)"
|
||||
mhz_color = s.danger_color
|
||||
elif(freq > s.erista_unsafe_gpu_threshold):
|
||||
mhz_color = s.unsafe_color
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = "(UNSAFE)"
|
||||
else:
|
||||
mhz_color = s.safe_color
|
||||
mhz_label = f"{freq / 1000:.1f} MHz"
|
||||
safety_label = ""
|
||||
|
||||
with dpg.group(horizontal=True):
|
||||
dpg.add_combo(
|
||||
items=processed_voltages_e,
|
||||
default_value="Disabled",
|
||||
tag="g_volt_e_" + str(freq),
|
||||
callback=k.grab_kip_storage_values_no_mult
|
||||
)
|
||||
dpg.add_text(default_value=f"{mhz_label} {safety_label}", color=mhz_color)
|
||||
@@ -1,101 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
import common as c
|
||||
|
||||
def ensure_dir_exists(path: str):
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
|
||||
def set_ini_values(ini_path, section, entries):
|
||||
if not c.drive:
|
||||
c.show_popup("Error", "This feature requires a valid drive to be selected")
|
||||
return
|
||||
|
||||
ini_path = str(ini_path)
|
||||
|
||||
try:
|
||||
with open(ini_path, "r") as f:
|
||||
lines = f.readlines()
|
||||
except FileNotFoundError:
|
||||
lines = []
|
||||
|
||||
output_lines = []
|
||||
current_section = None
|
||||
section_lines = []
|
||||
section_found = False
|
||||
|
||||
def flush_section():
|
||||
nonlocal section_lines, output_lines
|
||||
if section_lines:
|
||||
output_lines.extend(section_lines)
|
||||
section_lines = []
|
||||
|
||||
for line in lines:
|
||||
section_match = re.match(r"\s*\[([^\]]+)\]", line)
|
||||
if section_match:
|
||||
if current_section == section and entries:
|
||||
new_lines = []
|
||||
keys_handled = set()
|
||||
for l in section_lines[1:]:
|
||||
key_match = re.match(r"\s*([A-Za-z0-9_.]+)\s*=", l)
|
||||
if key_match:
|
||||
key = key_match.group(1)
|
||||
if key in entries:
|
||||
val = entries[key]
|
||||
if val is None:
|
||||
continue
|
||||
new_lines.append(f"{key} = {val}\n")
|
||||
keys_handled.add(key)
|
||||
else:
|
||||
new_lines.append(l)
|
||||
else:
|
||||
new_lines.append(l)
|
||||
for k, v in entries.items():
|
||||
if k not in keys_handled and v is not None:
|
||||
new_lines.append(f"{k} = {v}\n")
|
||||
section_lines = [section_lines[0]] + new_lines
|
||||
flush_section()
|
||||
current_section = section_match.group(1)
|
||||
section_lines = [line]
|
||||
if current_section == section:
|
||||
section_found = True
|
||||
continue
|
||||
section_lines.append(line)
|
||||
|
||||
if current_section == section and entries:
|
||||
new_lines = []
|
||||
keys_handled = set()
|
||||
for l in section_lines[1:]:
|
||||
key_match = re.match(r"\s*([A-Za-z0-9_.]+)\s*=", l)
|
||||
if key_match:
|
||||
key = key_match.group(1)
|
||||
if key in entries:
|
||||
val = entries[key]
|
||||
if val is None:
|
||||
continue
|
||||
new_lines.append(f"{key} = {val}\n")
|
||||
keys_handled.add(key)
|
||||
else:
|
||||
new_lines.append(l)
|
||||
else:
|
||||
new_lines.append(l)
|
||||
for k, v in entries.items():
|
||||
if k not in keys_handled and v is not None:
|
||||
new_lines.append(f"{k} = {v}\n")
|
||||
section_lines = [section_lines[0]] + new_lines
|
||||
|
||||
flush_section()
|
||||
|
||||
if not section_found and entries:
|
||||
output_lines.append(f"\n[{section}]\n")
|
||||
for k, v in entries.items():
|
||||
if v is not None:
|
||||
output_lines.append(f"{k} = {v}\n")
|
||||
|
||||
ensure_dir_exists(ini_path)
|
||||
|
||||
if output_lines:
|
||||
with open(ini_path, "w") as f:
|
||||
f.writelines(output_lines)
|
||||
else:
|
||||
if os.path.exists(ini_path):
|
||||
os.remove(ini_path)
|
||||
@@ -1,172 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
import psutil
|
||||
import os
|
||||
import common as c
|
||||
import urllib.request
|
||||
import zipfile
|
||||
import kip as k
|
||||
from defaults import d
|
||||
import settings as s
|
||||
|
||||
def autosave_toggle(sender, app_data):
|
||||
d.autosave=app_data
|
||||
print(f"Autosave toggled to {d.autosave}")
|
||||
|
||||
|
||||
def get_drives():
|
||||
drives = []
|
||||
for part in psutil.disk_partitions(all=False):
|
||||
drives.append(part.device)
|
||||
return drives
|
||||
|
||||
|
||||
# Change if you plan to fork
|
||||
|
||||
def download_and_extract_zip(c, download_url, zip_filename="temp.zip", success_message="Installed file!"):
|
||||
"""
|
||||
Downloads a zip file from the given URL, extracts it to the selected drive,
|
||||
and cleans up the zip afterwards.
|
||||
|
||||
Args:
|
||||
c: Context object with attributes:
|
||||
- drive (str): Installation path.
|
||||
- show_popup (callable): Function to show popup messages.
|
||||
download_url (str): The URL of the zip file.
|
||||
zip_filename (str, optional): Name for the downloaded zip file. Defaults to "temp.zip".
|
||||
success_message (str, optional): Success popup message. Defaults to "Installed hoc-clk!".
|
||||
"""
|
||||
|
||||
if not c.drive or c.drive == "0" or c.drive == 0:
|
||||
c.show_popup(title="Error", content="Please select an installation drive first!")
|
||||
return False
|
||||
|
||||
zip_path = os.path.join(c.drive, zip_filename)
|
||||
|
||||
try:
|
||||
print(f"Downloading {zip_filename} to {c.drive} ...")
|
||||
urllib.request.urlretrieve(download_url, zip_path)
|
||||
|
||||
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
||||
zip_ref.extractall(c.drive)
|
||||
|
||||
c.show_popup(title="Success", content=success_message)
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
c.show_popup(title="Error", content=f"Download failed:\n{e}")
|
||||
return False
|
||||
|
||||
finally:
|
||||
if os.path.exists(zip_path):
|
||||
os.remove(zip_path)
|
||||
|
||||
def downloadLoader(): # This has to be different as it extracts to a custom location and downloads a FILE, not a zip
|
||||
print("Downloading HOC.kip...")
|
||||
if c.drive==0:
|
||||
print("Drive not selected!")
|
||||
c.show_popup(title="Error:", content="Please select a installation c.drive first!")
|
||||
else:
|
||||
try:
|
||||
directory_make = c.drive + "atmosphere/kips/"
|
||||
urllib.request.urlretrieve(s.kip_download_link, directory_make + "hoc.kip")
|
||||
except Exception as e:
|
||||
c.show_popup(title="Error", content=f"Download failed:\n{e}")
|
||||
finally:
|
||||
c.show_popup(title="Info:", content="Downloaded kip!")
|
||||
|
||||
drive_list = get_drives()
|
||||
|
||||
def check_atmosphere(sender, app_data, user_data):
|
||||
c.drive = app_data
|
||||
atmosphere_path = os.path.join(c.drive, "atmosphere")
|
||||
package3_path = os.path.join(atmosphere_path, "package3")
|
||||
if os.path.isfile(f"{atmosphere_path}/kips/hoc.kip"):
|
||||
dpg.set_value("status_text", "Horizon OC Install Found!")
|
||||
k.kip_file_path = f"{atmosphere_path}/kips/hoc.kip"
|
||||
k.read_kip(c.drive + "atmosphere/kips/hoc.kip")
|
||||
print(f"Reading kip from drive {c.drive}")
|
||||
s.load_all_vars()
|
||||
elif os.path.isdir(atmosphere_path) and os.path.isfile(package3_path):
|
||||
dpg.set_value("status_text", "Atmosphere install found!")
|
||||
else:
|
||||
dpg.set_value("status_text", "Atmosphere not found!")
|
||||
|
||||
def download_and_install(download_url, install_path, c=None,
|
||||
filename=None, success_message="Download complete!"):
|
||||
"""
|
||||
Downloads a file from the given URL, optionally extracts if it's a zip,
|
||||
and deletes the temporary zip afterwards if extracted.
|
||||
|
||||
Args:
|
||||
download_url (str): The URL of the file.
|
||||
install_path (str): Directory where the file will be saved or extracted.
|
||||
c (object, optional): Context object with show_popup(title, content). If given, used for popups.
|
||||
filename (str, optional): Name for the downloaded file. Defaults to inferred name from URL.
|
||||
success_message (str, optional): Message shown on success.
|
||||
"""
|
||||
|
||||
def show_popup(title, content):
|
||||
if c and hasattr(c, "show_popup"):
|
||||
c.show_popup(title=title, content=content)
|
||||
else:
|
||||
print(f"[{title}] {content}")
|
||||
|
||||
if not install_path or not os.path.isdir(install_path):
|
||||
msg = f"Invalid installation path: {install_path}"
|
||||
show_popup("Error", msg)
|
||||
return False
|
||||
|
||||
# Infer filename if not provided
|
||||
if not filename:
|
||||
filename = os.path.basename(download_url) or "downloaded_file"
|
||||
|
||||
file_path = os.path.join(install_path, filename)
|
||||
|
||||
try:
|
||||
print(f"Downloading {filename} to {install_path} ...")
|
||||
urllib.request.urlretrieve(download_url, file_path)
|
||||
|
||||
if filename.lower().endswith(".zip"):
|
||||
try:
|
||||
with zipfile.ZipFile(file_path, 'r') as zip_ref:
|
||||
zip_ref.extractall(install_path)
|
||||
show_popup("Success", success_message)
|
||||
return True
|
||||
except zipfile.BadZipFile:
|
||||
msg = f"Downloaded file '{filename}' is not a valid archive."
|
||||
show_popup("Error", msg)
|
||||
return False
|
||||
finally:
|
||||
if os.path.exists(file_path):
|
||||
os.remove(file_path)
|
||||
else:
|
||||
# Non-zip file: just keep it
|
||||
show_popup("Success", success_message)
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
msg = f"Download failed: {e}"
|
||||
show_popup("Error", msg)
|
||||
return False
|
||||
@@ -1,148 +0,0 @@
|
||||
import dearpygui.dearpygui as dpg
|
||||
import struct
|
||||
from defaults import d
|
||||
import common as c
|
||||
import gpu as g
|
||||
import re
|
||||
import settings as s
|
||||
|
||||
g_freq_str = None
|
||||
kip_file_path = None
|
||||
|
||||
|
||||
def make_struct_format(vars_list):
|
||||
fmt = "="
|
||||
for name, t in vars_list:
|
||||
fmt += s.fmt_map[t]
|
||||
if name == "tFAW":
|
||||
fmt += "4x" # i hate hardcoding but this is what it is
|
||||
return fmt
|
||||
|
||||
|
||||
|
||||
def freq_to_label(freq):
|
||||
if freq > 1382400:
|
||||
return f"{freq / 1000:.1f} MHz (DANGEROUS)"
|
||||
elif freq > 1152000:
|
||||
return f"{freq / 1000:.1f} MHz (UNSAFE)"
|
||||
else:
|
||||
return f"{freq / 1000:.1f} MHz"
|
||||
|
||||
def store(sender, app_data):
|
||||
global kip_file_path
|
||||
kip_file_path = app_data['file_path_name']
|
||||
print("Selected" + kip_file_path)
|
||||
read_kip(kip_file_path)
|
||||
s.load_all_vars()
|
||||
|
||||
def grab_kip_storage_values(sender, app_data):
|
||||
tag = dpg.get_item_alias(sender)
|
||||
if tag and hasattr(d, tag):
|
||||
numeric_str = str(app_data).split(" ")[0]
|
||||
try:
|
||||
value = int(float(numeric_str) * 1000)
|
||||
except (ValueError, TypeError):
|
||||
c.show_popup("Error", f"Invalid numeric value for {tag}: {app_data}")
|
||||
return
|
||||
setattr(d, tag, value)
|
||||
print(tag, app_data, getattr(d, tag))
|
||||
if d.autosave:
|
||||
write_kip()
|
||||
|
||||
def grab_kip_storage_values_no_mult(sender, app_data):
|
||||
tag = dpg.get_item_alias(sender)
|
||||
if not tag or not hasattr(d, tag):
|
||||
return
|
||||
if isinstance(app_data, str):
|
||||
numeric_str = re.sub(r"[^0-9.]", "", app_data)
|
||||
if numeric_str == "":
|
||||
c.show_popup("Error", f"Invalid numeric value for {tag}: {app_data}")
|
||||
return
|
||||
try:
|
||||
value = int(float(numeric_str))
|
||||
except (ValueError, TypeError):
|
||||
c.show_popup("Error", f"Invalid numeric value for {tag}: {app_data}")
|
||||
return
|
||||
else:
|
||||
value = app_data
|
||||
setattr(d, tag, value)
|
||||
print(tag, app_data, getattr(d, tag))
|
||||
if d.autosave:
|
||||
write_kip()
|
||||
|
||||
def grab_value_freq_conversion(sender, app_data):
|
||||
global g_freq_str
|
||||
g_freq_str = app_data
|
||||
try:
|
||||
g_freq_val = int(float(g_freq_str.replace(" MHz", "")) * 1000)
|
||||
except Exception:
|
||||
return
|
||||
print(g_freq_val)
|
||||
|
||||
def write_kip():
|
||||
global kip_file_path
|
||||
MAGIC = b"CUST"
|
||||
struct_fmt = make_struct_format(s.variables)
|
||||
struct_size = struct.calcsize(struct_fmt)
|
||||
if kip_file_path is None:
|
||||
msg = "You need to select a file to use Autosave!" if d.autosave else "You need to select a file to save the KIP!"
|
||||
c.show_popup("Error", msg)
|
||||
return
|
||||
with open(kip_file_path, "r+b") as f:
|
||||
data = f.read()
|
||||
idx = data.find(MAGIC)
|
||||
if idx == -1:
|
||||
c.show_popup("Error", "KIP is invalid!")
|
||||
return
|
||||
pos = idx + len(MAGIC)
|
||||
values = []
|
||||
for attr_name, t in s.variables:
|
||||
val = getattr(d, attr_name)
|
||||
if t == "u32":
|
||||
val = int(val) & 0xFFFFFFFF
|
||||
else:
|
||||
val = float(val)
|
||||
values.append(val)
|
||||
try:
|
||||
packed = struct.pack(struct_fmt, *values)
|
||||
except Exception as e:
|
||||
c.show_popup("Error", f"Packing error: {e}")
|
||||
return
|
||||
f.seek(pos)
|
||||
f.write(packed)
|
||||
if not d.autosave:
|
||||
c.show_popup("Success", "KIP saved successfully!")
|
||||
|
||||
def read_kip(filename):
|
||||
MAGIC = b"CUST"
|
||||
struct_fmt = make_struct_format(s.variables)
|
||||
struct_size = struct.calcsize(struct_fmt)
|
||||
with open(filename, "rb") as f:
|
||||
data = f.read()
|
||||
idx = data.find(MAGIC)
|
||||
if idx == -1:
|
||||
c.show_popup("Fatal Error", "Unable to find CUST header in kip\nTry reinstalling the kip using the install option")
|
||||
pos = idx + len(MAGIC)
|
||||
raw = data[pos:pos + struct_size]
|
||||
values = struct.unpack(struct_fmt, raw)
|
||||
for (attr_name, _), val in zip(s.variables, values):
|
||||
setattr(d, attr_name, val)
|
||||
print("=== value layout ===")
|
||||
offset = 0
|
||||
for (attr_name, t) in s.variables:
|
||||
code = s.fmt_map[t]
|
||||
align = 8 if code == "d" else 4
|
||||
padding = (-offset) % align
|
||||
if padding:
|
||||
offset += padding
|
||||
size = struct.calcsize(code)
|
||||
raw_bytes = raw[offset:offset + size]
|
||||
val = getattr(d, attr_name)
|
||||
print(f"{attr_name:<20} | type={t:<6} | offset={offset:<4} | size={size:<2} | raw=0x{raw_bytes.hex()} | val={val}")
|
||||
offset += size
|
||||
print("========================")
|
||||
dpg.set_value("gpu_sched", g.check_gpu_sched())
|
||||
dpg.show_item("gpu_tab")
|
||||
dpg.show_item("cpu_tab")
|
||||
dpg.show_item("emc_tab")
|
||||
dpg.show_item("misc_tab")
|
||||
@@ -1,302 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
gplv2_text = """\
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
"""
|
||||
@@ -1,155 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
|
||||
# This prevents the window from reopening when closed
|
||||
dpg.create_context()
|
||||
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
import common as c
|
||||
import sys
|
||||
import os
|
||||
import webbrowser
|
||||
import ctypes
|
||||
|
||||
import kip as k
|
||||
import gpu
|
||||
import cpu
|
||||
import ram
|
||||
from defaults import d
|
||||
import installer as ins
|
||||
import about
|
||||
import misc
|
||||
|
||||
true = True
|
||||
false = False
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
assets_path = os.path.join(sys._MEIPASS, 'assets/')
|
||||
else:
|
||||
assets_path = os.path.join(os.path.dirname(__file__), '../assets/')
|
||||
|
||||
cooler_image_path = assets_path + "coolerhd.png" # coolerHD Emoji from OC server
|
||||
cooler_image = Image.open(cooler_image_path).convert("RGBA")
|
||||
cooler_width, cooler_height = cooler_image.size
|
||||
|
||||
cooler_image_data = np.array(cooler_image) / 255.0
|
||||
cooler_image_data = cooler_image_data.flatten()
|
||||
|
||||
lightos_image_path = assets_path + "lightos_c.png"
|
||||
lightos_image = Image.open(lightos_image_path).convert("RGBA")
|
||||
lightos_width, lightos_height = lightos_image.size
|
||||
|
||||
lightos_image_data = np.array(lightos_image) / 255.0
|
||||
lightos_image_data = lightos_image_data.flatten()
|
||||
|
||||
samy_image_path = assets_path + "samy_c.png"
|
||||
samy_image = Image.open(samy_image_path).convert("RGBA")
|
||||
samy_width, samy_height = samy_image.size
|
||||
|
||||
samy_image_data = np.array(samy_image) / 255.0
|
||||
samy_image_data = samy_image_data.flatten()
|
||||
|
||||
soul_image_path = assets_path + "soul_c.png"
|
||||
soul_image = Image.open(soul_image_path).convert("RGBA")
|
||||
soul_width, soul_height = soul_image.size
|
||||
|
||||
soul_image_data = np.array(soul_image) / 255.0
|
||||
soul_image_data = soul_image_data.flatten()
|
||||
|
||||
with dpg.font_registry():
|
||||
lexend = dpg.add_font(assets_path + "Lexend.ttf", 16)
|
||||
|
||||
with dpg.texture_registry(show=False):
|
||||
dpg.add_static_texture(width=cooler_width, height=cooler_height, default_value=cooler_image_data, tag="coolerhd")
|
||||
|
||||
dpg.add_static_texture(width=lightos_width, height=lightos_height, default_value=lightos_image_data, tag="lightos")
|
||||
|
||||
dpg.add_static_texture(width=samy_width, height=samy_height, default_value=samy_image_data, tag="samy")
|
||||
|
||||
dpg.add_static_texture(width=soul_width, height=soul_height, default_value=soul_image_data, tag="soul")
|
||||
|
||||
with dpg.file_dialog(directory_selector=False, show=False, tag="file_dialog", width=500, height=300, modal=True, callback=k.store):
|
||||
dpg.add_file_extension(".kip")
|
||||
def refresh_drives():
|
||||
setattr(ins, "drive_list", ins.get_drives())
|
||||
dpg.configure_item("drive_select", items=ins.drive_list)
|
||||
with dpg.window(label="Configurator", width=400, height=300,id="main_window"):
|
||||
with dpg.tab_bar():
|
||||
with dpg.tab(label="File"):
|
||||
dpg.add_separator(label="Information")
|
||||
dpg.add_text("Horizon OC is an open source overclocking tool for the Nintendo Switch Horizon OS")
|
||||
dpg.add_text("For more information read the README on GitHub")
|
||||
dpg.add_button(
|
||||
label="Open GitHub",
|
||||
callback=lambda: webbrowser.open("https://github.com/souldbminersmwc/Horizon-OC")
|
||||
)
|
||||
dpg.add_separator(label="Installation")
|
||||
dpg.add_button(label="Refresh Drive List", callback=refresh_drives)
|
||||
dpg.add_combo(
|
||||
items=ins.drive_list,
|
||||
default_value="Select a drive!",
|
||||
tag="drive_select",
|
||||
callback=ins.check_atmosphere
|
||||
)
|
||||
dpg.add_checkbox(label="Autosave", default_value=false, callback=ins.autosave_toggle)
|
||||
dpg.add_text("", tag="status_text")
|
||||
dpg.add_button(label="Save settings", callback=k.write_kip)
|
||||
dpg.add_separator(label="Downloads")
|
||||
dpg.add_button(label="Install Horizon OC Loader", callback=ins.downloadLoader)
|
||||
dpg.add_button(label="Install Horizon OC Clock Manager", callback=lambda: ins.download_and_extract_zip(c, ins.hoc_clk_download_link, zip_filename="hoc_clk_temp.zip", success_message="Installed hoc-clk!"))
|
||||
dpg.add_separator(label="Advanced")
|
||||
dpg.add_button(label="Manually Select hoc.kip", callback=lambda: dpg.show_item("file_dialog"))
|
||||
with dpg.tab(label="GPU", tag="gpu_tab"):
|
||||
gpu.populate()
|
||||
|
||||
with dpg.tab(label="CPU", tag="cpu_tab"):
|
||||
cpu.populate()
|
||||
|
||||
with dpg.tab(label="RAM", tag="emc_tab"):
|
||||
ram.populate()
|
||||
|
||||
with dpg.tab(label="Misc", tag="misc_tab"):
|
||||
misc.populate()
|
||||
|
||||
with dpg.tab(label="About", tag="about_tab"):
|
||||
about.populate()
|
||||
|
||||
dpg.hide_item("gpu_tab")
|
||||
dpg.hide_item("cpu_tab")
|
||||
dpg.hide_item("emc_tab")
|
||||
dpg.hide_item("misc_tab")
|
||||
|
||||
dpg.bind_font(lexend)
|
||||
|
||||
dpg.create_viewport(title="Horizon OC Configurator", width=854, height=480)
|
||||
dpg.set_viewport_large_icon(assets_path + "icon.ico")
|
||||
dpg.set_viewport_title("Horizon OC Configurator")
|
||||
dpg.set_primary_window("main_window", True)
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
|
||||
dpg.start_dearpygui()
|
||||
|
||||
dpg.destroy_context()
|
||||
@@ -1,211 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import dearpygui.dearpygui as dpg
|
||||
import common
|
||||
import ini
|
||||
import re
|
||||
import installer as ins
|
||||
from defaults import d
|
||||
import ram as r
|
||||
import settings as s
|
||||
|
||||
def get_ini_path():
|
||||
if not common.drive or common.drive == 0:
|
||||
common.show_popup("Error", "This feature requires a valid drive")
|
||||
return None
|
||||
return Path(str(common.drive)) / "atmosphere/config/system_settings.ini"
|
||||
|
||||
|
||||
def set_psm_value(sender, app_data):
|
||||
ini_path = get_ini_path()
|
||||
if not ini_path:
|
||||
return
|
||||
value = next((x["value"] for x in s.PSM_OPTIONS if x["name"] == app_data), None)
|
||||
if value:
|
||||
ini.set_ini_values(str(ini_path), "psm", {"current_psm_mA": value})
|
||||
common.show_popup("Success", f"Charge Limit set to {app_data}")
|
||||
|
||||
def remove_tc_entries():
|
||||
ini_path = get_ini_path()
|
||||
if not ini_path:
|
||||
return
|
||||
|
||||
try:
|
||||
with open(ini_path, "r") as f:
|
||||
lines = f.readlines()
|
||||
except FileNotFoundError:
|
||||
return
|
||||
|
||||
output_lines = []
|
||||
current_section = None
|
||||
|
||||
for line in lines:
|
||||
section_match = re.match(r"\s*\[([^\]]+)\]", line)
|
||||
if section_match:
|
||||
current_section = section_match.group(1)
|
||||
if current_section == "tc":
|
||||
current_section = "skip"
|
||||
continue
|
||||
else:
|
||||
output_lines.append(line)
|
||||
continue
|
||||
|
||||
if current_section != "skip":
|
||||
output_lines.append(line)
|
||||
|
||||
with open(ini_path, "w") as f:
|
||||
f.writelines(output_lines)
|
||||
common.show_popup("Success", "Reset to default fan curve")
|
||||
|
||||
|
||||
def set_ini_from_profile(sender, app_data, user_data):
|
||||
profile_name = user_data
|
||||
if profile_name not in s.PROFILES:
|
||||
print(f"Profile '{profile_name}' not found.")
|
||||
return
|
||||
|
||||
entries = s.PROFILES[profile_name]
|
||||
ini_path = get_ini_path()
|
||||
if not ini_path:
|
||||
return
|
||||
ini.set_ini_values(str(ini_path), "tc", entries)
|
||||
common.show_popup("Success", "Profile has been applied")
|
||||
print(f"Applied profile {profile_name} under [tc]")
|
||||
|
||||
def update_skin_target(sender, app_data):
|
||||
s.skinTarget = app_data
|
||||
print("skinTarget =", s.skinTarget)
|
||||
|
||||
ini_path = get_ini_path()
|
||||
if not ini_path:
|
||||
return
|
||||
|
||||
ini.set_ini_values(str(ini_path), "tc", s.skin_t_entries)
|
||||
|
||||
def toggle_battery_save(sender, user_data):
|
||||
|
||||
if not common.drive:
|
||||
common.show_popup("Error", "No drive selected")
|
||||
return
|
||||
|
||||
ini_path = Path(common.drive) / "atmosphere/config/system_settings.ini"
|
||||
|
||||
for section, entries in s.BATTERY_SAVE_OPTIONS.items():
|
||||
if dpg.get_item_alias(sender) == "enable_battery_fix": # hardcoded but otherwise it doesnt work :(
|
||||
ini.set_ini_values(str(ini_path), section, entries)
|
||||
else:
|
||||
remove_entries = {k: None for k in entries}
|
||||
ini.set_ini_values(str(ini_path), section, remove_entries)
|
||||
|
||||
common.show_popup("Info", f"Sleep Mode Battery Fix {'enabled' if dpg.get_item_alias(sender) == "enable_battery_fix" else 'disabled'}")
|
||||
def populate():
|
||||
dpg.add_separator(label="Fan")
|
||||
dpg.add_button(label="Optimize Fan Curve for V1", user_data="V1_Erista", callback=set_ini_from_profile)
|
||||
dpg.add_button(label="Optimize Fan Curve for V2", user_data="V2_Mariko", callback=set_ini_from_profile)
|
||||
dpg.add_button(label="Optimize Fan Curve for Lite", user_data="Lite_Mariko", callback=set_ini_from_profile)
|
||||
dpg.add_button(label="Optimize Fan Curve for OLED", user_data="OLED_Mariko", callback=set_ini_from_profile)
|
||||
|
||||
dpg.add_slider_int(
|
||||
label="Skin Target (Recommended - 54°C)",
|
||||
min_value=50, max_value=60,
|
||||
default_value=s.skinTarget,
|
||||
callback=update_skin_target
|
||||
)
|
||||
dpg.add_button(label="Reset Fan Curve", callback=remove_tc_entries)
|
||||
|
||||
dpg.add_separator(label="Battery")
|
||||
dpg.add_button(
|
||||
label="What is this?",
|
||||
callback=common.show_info_window,
|
||||
user_data="This option fixes battery life drain in sleep mode\nDO NOT use this if you are using online services",
|
||||
tag="battery_fix_info"
|
||||
)
|
||||
dpg.add_button(label="Enable sleep mode battery fix", tag="enable_battery_fix", callback=toggle_battery_save, user_data=1)
|
||||
dpg.add_button(label="Disable sleep mode battery fix", tag="disable_battery_fix",callback=toggle_battery_save, user_data=0)
|
||||
|
||||
dpg.add_separator(label="Downloads")
|
||||
|
||||
|
||||
|
||||
nx_ovlloader_link = "https://github.com/ppkantorski/nx-ovlloader/releases/latest/download/nx-ovlloader+.zip"
|
||||
dpg.add_button(label="Install nx-ovlloader", callback=lambda: ins.download_and_extract_zip(common, nx_ovlloader_link, zip_filename="ovll_temp.zip", success_message="Installed nx-ovlloader!"))
|
||||
|
||||
ultrahand_link = "https://github.com/ppkantorski/Ultrahand-Overlay/releases/latest/download/ovlmenu.ovl"
|
||||
dpg.add_button(label="Install Ultrahand Overlay", callback=lambda: ins.download_and_install(c=common, install_path=common.drive + "switch/.overlays/", download_url=ultrahand_link, filename="ovlMenu.ovl", success_message="Installed Ultrahand!"))
|
||||
|
||||
status_monitor_link = "https://github.com/ppkantorski/Status-Monitor-Overlay/releases/latest/download/ Status-Monitor-Overlay.ovl "
|
||||
dpg.add_button(label="Install Status Monitor", callback=lambda: ins.download_and_install(c=common, install_path=common.drive + "switch/.overlays/", download_url=status_monitor_link, filename=" Status-Monitor-Overlay.ovl", success_message="Installed Status Monitor!"))
|
||||
|
||||
saltynx_link = "https://github.com/masagrator/SaltyNX/releases/latest/download/SaltyNX.zip"
|
||||
dpg.add_button(label="Install SaltyNX", callback=lambda: ins.download_and_extract_zip(common, saltynx_link, zip_filename="saltynx_temp.zip", success_message="Installed SaltyNX!"))
|
||||
|
||||
reversenx_link = "https://github.com/masagrator/ReverseNX-RT/releases/latest/download/ReverseNX-RT-ovl.ovl"
|
||||
dpg.add_button(label="Install ReverseNX-RT", callback=lambda: ins.download_and_install(c=common, install_path=common.drive + "switch/.overlays/", download_url=reversenx_link, filename="ReverseNX-RT-ovl.ovl", success_message="Installed ReverseNX-RT!"))
|
||||
|
||||
dpg.add_separator(label="Danger Zone")
|
||||
|
||||
dpg.add_text("These options are known to cause hardware issues, PMIC issues or overheating.\nUse with extreme caution!", color=(255, 165, 0, 255))
|
||||
|
||||
dpg.add_separator()
|
||||
|
||||
dpg.add_spacer(height=10)
|
||||
|
||||
psm_items = [x["name"] for x in s.PSM_OPTIONS]
|
||||
dpg.add_combo(items=psm_items, label="Battery Charge Limit", callback=set_psm_value, tag="psm_dropdown", default_value="2048mA (Default)")
|
||||
dpg.add_spacer(height=5)
|
||||
|
||||
dpg.add_separator(label="EXTREME DANGER ZONE")
|
||||
dpg.add_text("THESE OPTIONS ARE KNOWN TO CAUSE IRREPARABLE HARDWARE DAMAGE THAT CAN AND WILL KILL YOUR CONSOLE\nUSE ONLY IF YOU ARE AN ADVANCED USER AND ARE AWARE OF THE RISKS AND POTENTIAL CONCEQUENCES", color=(255, 0, 0, 255))
|
||||
dpg.add_spacer(height=10)
|
||||
with dpg.group(horizontal=True):
|
||||
dpg.add_checkbox(
|
||||
label="",
|
||||
callback=set_white_tiger_clocks
|
||||
)
|
||||
dpg.add_image("coolerhd", width=20, height=20)
|
||||
|
||||
def set_white_tiger_clocks(app_data):
|
||||
# cooler aah clocks
|
||||
# 1400mv emc max
|
||||
# 1375mv cpu max
|
||||
# 750mv vdd2 mariko max
|
||||
base_vddq_uv = list(range(550000, 650001, 5000))
|
||||
|
||||
vddq_uv = [0] + list(range(250000, 750001, 5000)) if app_data else base_vddq_uv
|
||||
vddq_mv = [v // 1000 for v in vddq_uv]
|
||||
vddq_mv_label = ["Default (600 mV)" if f == 0 else f"{f} mV" for f in vddq_mv]
|
||||
dpg.configure_item("marikoEmcVddqVolt", items=vddq_mv_label)
|
||||
|
||||
base_voltages_uv = list(range(1050000, 1212500 + 1, 12500))
|
||||
voltages_uv = base_voltages_uv + list(range(1225000, 1400000 + 1, 12500)) if app_data else base_voltages_uv
|
||||
voltages_mv = [v / 1000 for v in voltages_uv]
|
||||
voltages_mv_label = ["Default (1175 mV)" if f == 0 else f"{f} mV" for f in voltages_mv]
|
||||
dpg.configure_item("commonEmcMemVolt", items=voltages_mv_label)
|
||||
|
||||
voltages = [0] + list(range(1130, 1375 + 1, 5)) if app_data else [0] + list(range(1000, 1160 + 1, 5))
|
||||
voltages_e = [0] + list(range(1180, 1375 + 1, 5)) if app_data else [0] + list(range(1120, 1255 + 1, 5)) + [1257]
|
||||
processed_voltages_e = ["Disabled" if v == 0 else f"{v}mV" for v in voltages_e]
|
||||
processed_voltages = ["Disabled" if v == 0 else f"{v}mV" for v in voltages]
|
||||
dpg.configure_item("marikoCpuMaxVolt", items=processed_voltages)
|
||||
dpg.configure_item("eristaCpuMaxVolt", items=processed_voltages_e)
|
||||
@@ -1,100 +0,0 @@
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
import dearpygui.dearpygui as dpg
|
||||
from defaults import d
|
||||
import common as c
|
||||
import settings as s
|
||||
|
||||
def load_defaults():
|
||||
apply_timing_preset(s.timing_preset_default)
|
||||
|
||||
def temporary_presets_unavailable():
|
||||
c.show_popup_big("We need your help!", "This timing preset currently unavailable due to lack of data. If you have a ram module and want to contribute your data, reach out to me (soul_9017) on the OC discord")
|
||||
|
||||
def apply_timing_preset(preset):
|
||||
|
||||
if len(preset) != len(s.timing_vars):
|
||||
raise ValueError("Preset invalid!")
|
||||
|
||||
for var_name, value in zip(s.timing_vars, preset):
|
||||
setattr(d, var_name.split('.')[-1], value)
|
||||
|
||||
flag = 0 if var_name.endswith("tBL") else 5
|
||||
|
||||
c.load_entry_object(var_name.split('.')[-1], flag)
|
||||
c.show_popup("Sucess", "Preset Applied!")
|
||||
|
||||
def apply_reg_timings(sender, app_data):
|
||||
ram_selected = dpg.get_value("ram_type")
|
||||
print(ram_selected)
|
||||
match(ram_selected):
|
||||
case "Choose your RAM Type!":
|
||||
c.show_popup("Error", "You must select a ram type to apply a preset")
|
||||
case "Samsung AA-MGCL/MGCR":
|
||||
apply_timing_preset(s.timing_preset_aamgcl_c)
|
||||
case "SK Hynix NEI/NEE/x267":
|
||||
apply_timing_preset(s.timing_preset_nee_c)
|
||||
case "Micron WT:B":
|
||||
apply_timing_preset(s.timing_preset_wtb_c)
|
||||
case "Micron AUT:B":
|
||||
apply_timing_preset(s.timing_preset_wtb_c)
|
||||
case "Micron WT:F":
|
||||
apply_timing_preset(s.timing_preset_wtf_c)
|
||||
case "Samsung AM-MGCJ":
|
||||
apply_timing_preset(s.timing_preset_mgcj_c)
|
||||
case "Micron WT:E":
|
||||
apply_timing_preset(s.timing_preset_wte_c)
|
||||
case "Samsung AB-MGCL":
|
||||
apply_timing_preset(s.timing_preset_ab_mgcl_c)
|
||||
case "SK Hynix NME":
|
||||
apply_timing_preset(s.timing_preset_nme_c)
|
||||
case "Samsung HB-MGCH":
|
||||
apply_timing_preset(s.timing_preset_hb_mgch_c)
|
||||
case _:
|
||||
temporary_presets_unavailable()
|
||||
|
||||
def apply_st_timings(sender, app_data):
|
||||
ram_selected = dpg.get_value("ram_type")
|
||||
match(ram_selected):
|
||||
case "Choose your RAM Type!":
|
||||
c.show_popup("Error", "You must select a ram type to apply a preset")
|
||||
case "Samsung AA-MGCL/MGCR":
|
||||
apply_timing_preset(s.timing_preset_aamgcl_st)
|
||||
case "SK Hynix NEI/NEE/x267":
|
||||
apply_timing_preset(s.timing_preset_nee_st)
|
||||
case "Micron WT:B":
|
||||
apply_timing_preset(s.timing_preset_wtb_st)
|
||||
case "Micron AUT:B":
|
||||
apply_timing_preset(s.timing_preset_wtb_st)
|
||||
case "Micron WT:F":
|
||||
apply_timing_preset(s.timing_preset_wtf_st)
|
||||
case "Samsung AM-MGCJ":
|
||||
apply_timing_preset(s.timing_preset_mgcj_st)
|
||||
case "Micron WT:E":
|
||||
apply_timing_preset(s.timing_preset_wte_st)
|
||||
case "Samsung AB-MGCL":
|
||||
apply_timing_preset(s.timing_preset_ab_mgcl_st)
|
||||
case "SK Hynix NME":
|
||||
apply_timing_preset(s.timing_preset_nme_st)
|
||||
case "Samsung HB-MGCH":
|
||||
apply_timing_preset(s.timing_preset_hb_mgch_st)
|
||||
case _:
|
||||
temporary_presets_unavailable()
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
|
||||
"""
|
||||
|
||||
HOC Configurator
|
||||
|
||||
Copyright (C) Souldbminer
|
||||
|
||||
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 that 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/>.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import dearpygui.dearpygui as dpg
|
||||
import common
|
||||
import kip as k
|
||||
import preset
|
||||
from defaults import d
|
||||
import settings as s
|
||||
|
||||
def populate():
|
||||
|
||||
# Values in kHz
|
||||
voltages_mv = [v / 1000 for v in s.voltages_uv]
|
||||
voltages_mv_label = ["Default (1175 mV)" if f == 0 else f"{f} mV" for f in voltages_mv]
|
||||
vddq_mv = [v / 1000 for v in s.vddq_uv]
|
||||
vddq_mv_label = ["Default (600 mV)" if f == 0 else f"{f} mV" for f in vddq_mv]
|
||||
# Values in MHz (converted)
|
||||
values_mhz = [v / 1000 for v in s.adjusted_freqs_khz]
|
||||
values_mhz_label_m = ["Default (1996.8 MHz)" if f == 0 else f"{f} MHz" for f in values_mhz]
|
||||
values_mhz_label_e = ["Default (1862.4 MHz)" if f == 0 else f"{f} MHz" for f in values_mhz]
|
||||
dvb = [i for i in range(10)]
|
||||
dpg.add_separator(label="RAM Types")
|
||||
dpg.add_combo(
|
||||
items=["Samsung AA-MGCL/MGCR", "SK Hynix NEI/NEE/x267", "Micron WT:B", "Micron AUT:B", "Micron WT:F", "Samsung AM-MGCJ", "Micron WT:E", "Samsung AB-MGCL", "SK Hynix NME", "Samsung HB-MGCH"],
|
||||
default_value="Choose your RAM Type!",
|
||||
label="RAM Type",
|
||||
tag="ram_type"
|
||||
)
|
||||
dpg.add_button(label="Apply Regular Preset", callback=preset.apply_reg_timings)
|
||||
dpg.add_button(label="Apply Tight Preset", callback=preset.apply_st_timings)
|
||||
dpg.add_button(label="Load Default Preset", callback=preset.load_defaults)
|
||||
|
||||
dpg.add_combo(
|
||||
items=["0", "1"],
|
||||
default_value="0",
|
||||
label="MTC Configuraton",
|
||||
tag="mtcConf",
|
||||
callback=k.grab_kip_storage_values
|
||||
)
|
||||
|
||||
|
||||
dpg.add_combo(
|
||||
items=["0", "1"],
|
||||
default_value="0",
|
||||
label="HP Mode",
|
||||
tag="hpMode",
|
||||
callback=k.grab_kip_storage_values
|
||||
)
|
||||
|
||||
dpg.add_separator(label="Frequencies (Mariko)")
|
||||
dpg.add_text("Multiple Ram Frequencies on Mariko is in development")
|
||||
dpg.add_combo(
|
||||
items=values_mhz_label_m,
|
||||
default_value="Default (1996.8 MHz)",
|
||||
label="RAM Max Frequency (Mariko)",
|
||||
tag="marikoEmcMaxClock",
|
||||
callback=k.grab_kip_storage_values
|
||||
|
||||
)
|
||||
|
||||
dpg.add_separator(label="Frequencies (Erista)")
|
||||
dpg.add_text("Multiple Ram Frequencies on Erista is in development")
|
||||
|
||||
# dpg.add_combo(
|
||||
# items=values_mhz_label_e,
|
||||
# default_value="Default (2132.64 MHz)",
|
||||
# label="RAM Max Frequency (Erista)",
|
||||
# tag="e_emc_clock_1",
|
||||
# callback=k.grab_kip_storage_values
|
||||
# )
|
||||
# dpg.add_combo(
|
||||
# items=values_mhz_label_e,
|
||||
# default_value="Default (1996.8 MHz)",
|
||||
# label="RAM Second Frequency (Erista)",
|
||||
# tag="e_emc_clock_2",
|
||||
# callback=k.grab_kip_storage_values
|
||||
# )
|
||||
dpg.add_combo(
|
||||
items=values_mhz_label_e,
|
||||
default_value="Default (1862.4 MHz)",
|
||||
label="RAM Max Frequency (Erista)",
|
||||
tag="eristaEmcMaxClock",
|
||||
callback=k.grab_kip_storage_values
|
||||
)
|
||||
dpg.add_separator(label="Voltages")
|
||||
|
||||
dpg.add_combo(
|
||||
items=voltages_mv_label,
|
||||
default_value="Default (1175 mV)",
|
||||
label="RAM Primary Voltage (VDD2)",
|
||||
tag="commonEmcMemVolt",
|
||||
callback=k.grab_kip_storage_values
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=vddq_mv_label,
|
||||
default_value="Default (600 mV)",
|
||||
label="RAM Secondary Voltage (VDDQ, Mariko ONLY)",
|
||||
tag="marikoEmcVddqVolt",
|
||||
callback=k.grab_kip_storage_values
|
||||
)
|
||||
dpg.add_combo(
|
||||
items=dvb,
|
||||
default_value="0",
|
||||
label="SoC DVB Shift",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="marikoEmcDvbShift"
|
||||
)
|
||||
|
||||
dpg.add_separator(label="Primary Timings")
|
||||
|
||||
dpg.add_combo(
|
||||
items=list(range(0, 12)),
|
||||
default_value="0",
|
||||
label="Burst Latency (read)",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="mem_burst_read_latency"
|
||||
)
|
||||
|
||||
dpg.add_combo(
|
||||
items=list(range(0, 12)),
|
||||
default_value="0",
|
||||
label="Burst Latency (write)",
|
||||
callback=k.grab_kip_storage_values_no_mult,
|
||||
tag="mem_burst_write_latency"
|
||||
)
|
||||
|
||||
dpg.add_slider_int(label="t1 tRCD", min_value=0, max_value=7, tag="t1_tRCD", callback=k.grab_kip_storage_values_no_mult)
|
||||
dpg.add_slider_int(label="t2 tRP", min_value=0, max_value=7, tag="t2_tRP", callback=k.grab_kip_storage_values_no_mult)
|
||||
dpg.add_slider_int(label="t3 tRAS", min_value=0, max_value=9, tag="t3_tRAS", callback=k.grab_kip_storage_values_no_mult)
|
||||
|
||||
dpg.add_separator(label="Secondary Timings")
|
||||
|
||||
dpg.add_slider_int(label="t4 tRRD", min_value=0, max_value=7, tag="t4_tRRD", callback=k.grab_kip_storage_values_no_mult)
|
||||
dpg.add_slider_int(label="t5 tRFC", min_value=0, max_value=5, tag="t5_tRFC", callback=k.grab_kip_storage_values_no_mult)
|
||||
dpg.add_slider_int(label="t6 tRTW", min_value=0, max_value=9, tag="t6_tRTW", callback=k.grab_kip_storage_values_no_mult)
|
||||
dpg.add_slider_int(label="t7 tWTR", min_value=0, max_value=9, tag="t7_tWTR", callback=k.grab_kip_storage_values_no_mult)
|
||||
dpg.add_slider_int(label="t8 tREFI", min_value=0, max_value=5, tag="t8_tREFI", callback=k.grab_kip_storage_values_no_mult)
|
||||
@@ -1,647 +0,0 @@
|
||||
import common as c
|
||||
|
||||
# Links
|
||||
|
||||
kip_download_link="https://github.com/souldbminersmwc/Horizon-OC/releases/latest/download/loader.kip"
|
||||
hoc_clk_download_link="https://github.com/souldbminersmwc/Horizon-OC/releases/latest/download/hoc-clk.zip"
|
||||
nx_ovlloader_link = "https://github.com/ppkantorski/nx-ovlloader/releases/latest/download/nx-ovlloader+.zip"
|
||||
ultrahand_link = "https://github.com/ppkantorski/Ultrahand-Overlay/releases/latest/download/ovlmenu.ovl"
|
||||
status_monitor_link = "https://github.com/ppkantorski/Status-Monitor-Overlay/releases/latest/download/Status-Monitor-Overlay.ovl "
|
||||
saltynx_link = "https://github.com/masagrator/SaltyNX/releases/latest/download/SaltyNX.zip"
|
||||
reversenx_link = "https://github.com/masagrator/ReverseNX-RT/releases/latest/download/ReverseNX-RT-ovl.ovl"
|
||||
|
||||
# Frequencies
|
||||
|
||||
freqs_khz = [
|
||||
76800, 153600, 230400, 307200, 384000, 460800, 537600, 614400, 691200, 768000,
|
||||
844800, 921600, 998400, 1075200, 1152000, 1228800, 1267200, 1305600, 1344000, 1382400, 1420800,
|
||||
1459200, 1497600, 1536000
|
||||
]
|
||||
freqs_khz_e = [
|
||||
76800, 115200, 153600, 192000, 230400, 268800, 307200, 345600, 384000, 422400, 460800, 499200, 537600,
|
||||
576000,614400, 652800,691200,729600, 768000,806400, 844800,883200, 921600,960000, 998400,1036800, 1075200# ,
|
||||
]
|
||||
|
||||
freqs_mhz = [
|
||||
76.8, 153.6, 230.4, 307.2, 384.0, 460.8, 537.6, 614.4, 691.2, 768.0,
|
||||
844.8, 921.6, 998.4, 1075.2, 1152.0, 1228.8, 1267.2, 1305.6, 1344.0, 1382.4,
|
||||
1420.8, 1459.2, 1497.6, 1536.0
|
||||
]
|
||||
|
||||
adjusted_freqs_khz = [
|
||||
0, 1600000, 1633000, 1666000, 1700000, 1733000, 1766000, 1800000, 1833000, 1866000, 1900000,
|
||||
1933000, 1966000, 2000000, 2033000, 2066000, 2100000, 2133000, 2166000, 2200000, 2233000,
|
||||
2266000, 2300000, 2333000, 2366000, 2400000, 2433000, 2466000, 2500000, 2533000, 2566000,
|
||||
2600000, 2633000, 2666000, 2700000, 2733000, 2766000, 2800000, 2833000, 2866000, 2900000,
|
||||
2933000, 2966000, 3000000, 3033000, 3066000, 3100000, 3133000, 3166000, 3200000, 3233000,
|
||||
3266000, 3300000, 3333000, 3366000, 3400000, 3433000, 3466000, 3500000
|
||||
]
|
||||
voltages_uv = [
|
||||
0, 1050000, 1062500, 1075000, 1087500, 1100000, 1112500, 1125000,
|
||||
1137500, 1150000, 1162500, 1175000, 1187500, 1200000, 1212500, 1237500
|
||||
]
|
||||
vddq_uv = [
|
||||
0, 550000, 555000, 560000, 565000, 570000, 575000, 580000, 585000, 590000, 595000,
|
||||
600000, 605000, 610000, 615000, 620000, 625000, 630000, 635000, 640000, 645000,
|
||||
650000
|
||||
]
|
||||
freqs_hz_cpu = [
|
||||
1020000, 1122000, 1224000, 1326000, 1428000, 1581000, 1683000,
|
||||
1785000, 1887000, 1963500, 2091000, 2193000, 2295000, 2397000,
|
||||
2499000, 2601000, 2703000, 2805000, 2907000
|
||||
]
|
||||
freqs_mhz_cpu = [
|
||||
1020.0, 1122.0, 1224.0, 1326.0, 1428.0, 1581.0, 1683.0,
|
||||
1785.0, 1887.0, 1963.5, 2091.0, 2193.0, 2295.0, 2397.0,
|
||||
2499.0, 2601.0, 2703.0, 2805.0, 2907.0
|
||||
]
|
||||
# Loading/saving
|
||||
|
||||
variables = [
|
||||
("custRev", "u32"),
|
||||
("mtcConf", "u32"),
|
||||
("hpMode", "u32"),
|
||||
|
||||
("commonEmcMemVolt", "u32"),
|
||||
("eristaEmcMaxClock", "u32"),
|
||||
("marikoEmcMaxClock", "u32"),
|
||||
("marikoEmcVddqVolt", "u32"),
|
||||
("marikoEmcDvbShift", "u32"),
|
||||
|
||||
("t1_tRCD", "u32"),
|
||||
("t2_tRP", "u32"),
|
||||
("t3_tRAS", "u32"),
|
||||
("t4_tRRD", "u32"),
|
||||
("t5_tRFC", "u32"),
|
||||
("t6_tRTW", "u32"),
|
||||
("t7_tWTR", "u32"),
|
||||
("t8_tREFI", "u32"),
|
||||
|
||||
("mem_burst_read_latency", "u32"),
|
||||
("mem_burst_write_latency", "u32"),
|
||||
|
||||
("eristaCpuUV", "u32"),
|
||||
("eristaCpuMaxVolt", "u32"),
|
||||
|
||||
("marikoCpuUVLow", "u32"),
|
||||
("marikoCpuUVHigh", "u32"),
|
||||
("tableConf", "u32"),
|
||||
("marikoCpuLowVmin", "u32"),
|
||||
("marikoCpuHighVmin", "u32"),
|
||||
("marikoCpuMaxVolt", "u32"),
|
||||
|
||||
("marikoCpuBoostClock", "u32"),
|
||||
("eristaCpuBoostClock", "u32"),
|
||||
|
||||
("eristaGpuUV", "u32"),
|
||||
("eristaGpuVmin", "u32"),
|
||||
|
||||
("marikoGpuUV", "u32"),
|
||||
("marikoGpuVmin", "u32"),
|
||||
("marikoGpuVmax", "u32"),
|
||||
|
||||
("commonGpuVoltOffset", "u32"),
|
||||
# advanced config
|
||||
("gpuSpeedo", "u32"),
|
||||
|
||||
|
||||
("marikoGpuFullUnlock", "u32"),
|
||||
|
||||
|
||||
|
||||
("g_volt_e_76800", "u32"),
|
||||
("g_volt_e_115200", "u32"),
|
||||
("g_volt_e_153600", "u32"),
|
||||
("g_volt_e_192000", "u32"),
|
||||
("g_volt_e_230400", "u32"),
|
||||
("g_volt_e_268800", "u32"),
|
||||
("g_volt_e_307200", "u32"),
|
||||
("g_volt_e_345600", "u32"),
|
||||
("g_volt_e_384000", "u32"),
|
||||
("g_volt_e_422400", "u32"),
|
||||
("g_volt_e_460800", "u32"),
|
||||
("g_volt_e_499200", "u32"),
|
||||
("g_volt_e_537600", "u32"),
|
||||
("g_volt_e_576000", "u32"),
|
||||
("g_volt_e_614400", "u32"),
|
||||
("g_volt_e_652800", "u32"),
|
||||
("g_volt_e_691200", "u32"),
|
||||
("g_volt_e_729600", "u32"),
|
||||
("g_volt_e_768000", "u32"),
|
||||
("g_volt_e_806400", "u32"),
|
||||
("g_volt_e_844800", "u32"),
|
||||
("g_volt_e_883200", "u32"),
|
||||
("g_volt_e_921600", "u32"),
|
||||
("g_volt_e_960000", "u32"),
|
||||
("g_volt_e_998400", "u32"),
|
||||
("g_volt_e_1036800", "u32"),
|
||||
("g_volt_e_1075200", "u32"),
|
||||
# ("g_volt_e_1152000", "u32"),
|
||||
# ("g_volt_e_1228800", "u32"),
|
||||
|
||||
("g_volt_76800", "u32"),
|
||||
("g_volt_153600", "u32"),
|
||||
("g_volt_230400", "u32"),
|
||||
("g_volt_307200", "u32"),
|
||||
("g_volt_384000", "u32"),
|
||||
("g_volt_460800", "u32"),
|
||||
("g_volt_537600", "u32"),
|
||||
("g_volt_614400", "u32"),
|
||||
("g_volt_691200", "u32"),
|
||||
("g_volt_768000", "u32"),
|
||||
("g_volt_844800", "u32"),
|
||||
("g_volt_921600", "u32"),
|
||||
("g_volt_998400", "u32"),
|
||||
("g_volt_1075200", "u32"),
|
||||
("g_volt_1152000", "u32"),
|
||||
("g_volt_1228800", "u32"),
|
||||
("g_volt_1267200", "u32"),
|
||||
("g_volt_1305600", "u32"),
|
||||
("g_volt_1344000", "u32"),
|
||||
("g_volt_1382400", "u32"),
|
||||
("g_volt_1420800", "u32"),
|
||||
("g_volt_1459200", "u32"),
|
||||
("g_volt_1497600", "u32"),
|
||||
("g_volt_1536000", "u32"),
|
||||
|
||||
]
|
||||
|
||||
fmt_map = {
|
||||
"u32": "I",
|
||||
"double": "d",
|
||||
}
|
||||
def load_all_vars():
|
||||
c.load_entry_object("custRev", 0)
|
||||
c.load_entry_object("mtcConf", 0)
|
||||
c.load_entry_object("hpMode", 0)
|
||||
|
||||
c.load_entry_object("commonEmcMemVolt", 2)
|
||||
c.load_entry_object("eristaEmcMaxClock", 1)
|
||||
c.load_entry_object("marikoEmcMaxClock", 1)
|
||||
c.load_entry_object("marikoEmcVddqVolt", 2)
|
||||
c.load_entry_object("marikoEmcDvbShift", 0)
|
||||
|
||||
# === Advanced memory config ===
|
||||
c.load_entry_object("t1_tRCD", 5)
|
||||
c.load_entry_object("t2_tRP", 5)
|
||||
c.load_entry_object("t3_tRAS", 5)
|
||||
c.load_entry_object("t4_tRRD", 5)
|
||||
c.load_entry_object("t5_tRFC", 5)
|
||||
c.load_entry_object("t6_tRTW", 5)
|
||||
c.load_entry_object("t7_tWTR", 5)
|
||||
c.load_entry_object("t8_tREFI", 5)
|
||||
|
||||
c.load_entry_object("mem_burst_read_latency", 5)
|
||||
c.load_entry_object("mem_burst_write_latency", 5)
|
||||
# === CPU Voltages ===
|
||||
c.load_entry_object("eristaCpuUV", 5)
|
||||
c.load_entry_object("eristaCpuMaxVolt", 3)
|
||||
|
||||
c.load_entry_object("marikoCpuUVLow", 5)
|
||||
c.load_entry_object("marikoCpuUVHigh", 5)
|
||||
c.load_entry_object("tableConf", 5)
|
||||
c.load_entry_object("marikoCpuLowVmin", 3)
|
||||
c.load_entry_object("marikoCpuHighVmin", 3)
|
||||
c.load_entry_object("marikoCpuMaxVolt", 3)
|
||||
|
||||
c.load_entry_object("marikoCpuBoostClock", 1)
|
||||
c.load_entry_object("eristaCpuBoostClock", 1)
|
||||
|
||||
# === GPU Voltages ===
|
||||
c.load_entry_object("eristaGpuUV", 4)
|
||||
c.load_entry_object("eristaGpuVmin", 3)
|
||||
|
||||
c.load_entry_object("marikoGpuUV", 4)
|
||||
c.load_entry_object("marikoGpuVmin", 3)
|
||||
c.load_entry_object("marikoGpuVmax", 3)
|
||||
|
||||
c.load_entry_object("commonGpuVoltOffset", 3)
|
||||
c.load_entry_object("gpuSpeedo", 3)
|
||||
|
||||
c.load_entry_object("marikoGpuFullUnlock", 3)
|
||||
|
||||
erista_freqs = [
|
||||
"76800", "115200", "153600", "192000", "230400", "268800", "307200",
|
||||
"345600", "384000", "422400", "460800", "499200", "537600", "576000",
|
||||
"614400", "652800", "691200", "729600", "768000", "806400", "844800",
|
||||
"883200", "921600", "960000", "998400", "1036800", "1075200"
|
||||
]
|
||||
for freq in erista_freqs:
|
||||
c.load_entry_object(f"g_volt_e_{freq}", 3)
|
||||
|
||||
mariko_freqs = [
|
||||
"76800", "153600", "230400", "307200", "384000", "460800", "537600",
|
||||
"614400", "691200", "768000", "844800", "921600", "998400", "1075200",
|
||||
"1152000", "1228800", "1267200", "1305600", "1344000", "1382400",
|
||||
"1420800", "1459200", "1497600", "1536000"
|
||||
]
|
||||
for freq in mariko_freqs:
|
||||
c.load_entry_object(f"g_volt_{freq}", 3)
|
||||
|
||||
# Timings
|
||||
|
||||
timing_vars = [
|
||||
"d.t1_tRCD",
|
||||
"d.t2_tRP",
|
||||
"d.t3_tRAS",
|
||||
"d.t4_tRRD",
|
||||
"d.t5_tRFC",
|
||||
"d.t6_tRTW",
|
||||
"d.t7_tWTR",
|
||||
"d.t8_tREFI"
|
||||
]
|
||||
|
||||
timing_preset_default = [
|
||||
0, # tRCD
|
||||
0, # tRP
|
||||
0, # tRAS
|
||||
0, # tRRD
|
||||
0, # tRFC
|
||||
0, # tRTW
|
||||
0, # tWTR
|
||||
0, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_aamgcl_c = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
5, # tRAS
|
||||
5, # tRRD
|
||||
5, # tRFC
|
||||
5, # tRTW
|
||||
7, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_aamgcl_st = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
8, # tRAS
|
||||
6, # tRRD
|
||||
5, # tRFC
|
||||
7, # tRTW
|
||||
8, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_mgcj_c = [
|
||||
3, # tRCD
|
||||
2, # tRP
|
||||
4, # tRAS
|
||||
2, # tRRD
|
||||
4, # tRFC
|
||||
4, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_mgcj_st = [
|
||||
4, # tRCD
|
||||
3, # tRP
|
||||
8, # tRAS
|
||||
2, # tRRD
|
||||
5, # tRFC
|
||||
4, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_ab_mgcl_c = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
4, # tRAS
|
||||
4, # tRRD
|
||||
4, # tRFC
|
||||
5, # tRTW
|
||||
6, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_ab_mgcl_st = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
8, # tRAS
|
||||
5, # tRRD
|
||||
5, # tRFC
|
||||
6, # tRTW
|
||||
8, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
timing_preset_hb_mgch_c = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
4, # tRAS
|
||||
0, # tRRD
|
||||
1, # tRFC
|
||||
5, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
timing_preset_hb_mgch_st = [
|
||||
4, # tRCD
|
||||
5, # tRP
|
||||
9, # tRAS
|
||||
1, # tRRD
|
||||
2, # tRFC
|
||||
6, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_wtf_c = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
2, # tRAS
|
||||
5, # tRRD
|
||||
4, # tRFC
|
||||
6, # tRTW
|
||||
3, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_wtf_st = [
|
||||
5, # tRCD
|
||||
5, # tRP
|
||||
4, # tRAS
|
||||
5, # tRRD
|
||||
5, # tRFC
|
||||
6, # tRTW
|
||||
5, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_wte_c = [
|
||||
2, # tRCD
|
||||
2, # tRP
|
||||
2, # tRAS
|
||||
2, # tRRD
|
||||
4, # tRFC
|
||||
4, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_wte_st = [
|
||||
3, # tRCD
|
||||
5, # tRP
|
||||
3, # tRAS
|
||||
3, # tRRD
|
||||
5, # tRFC
|
||||
4, # tRTW
|
||||
5, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_wtb_c = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
5, # tRAS
|
||||
5, # tRRD
|
||||
2, # tRFC
|
||||
6, # tRTW
|
||||
5, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_wtb_st = [
|
||||
6, # tRCD
|
||||
6, # tRP
|
||||
7, # tRAS
|
||||
7, # tRRD
|
||||
2, # tRFC
|
||||
6, # tRTW
|
||||
5, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_nee_c = [
|
||||
3, # tRCD
|
||||
3, # tRP
|
||||
2, # tRAS
|
||||
2, # tRRD
|
||||
5, # tRFC
|
||||
5, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_nee_st = [
|
||||
4, # tRCD
|
||||
4, # tRP
|
||||
4, # tRAS
|
||||
3, # tRRD
|
||||
7, # tRFC
|
||||
6, # tRTW
|
||||
5, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_nme_c = [
|
||||
2, # tRCD
|
||||
2, # tRP
|
||||
1, # tRAS
|
||||
0, # tRRD
|
||||
1, # tRFC
|
||||
4, # tRTW
|
||||
3, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
timing_preset_nme_st = [
|
||||
3, # tRCD
|
||||
3, # tRP
|
||||
4, # tRAS
|
||||
0, # tRRD
|
||||
1, # tRFC
|
||||
4, # tRTW
|
||||
4, # tWTR
|
||||
6, # tREFI
|
||||
]
|
||||
|
||||
|
||||
# INI
|
||||
|
||||
skinTarget = 54 # default value
|
||||
|
||||
|
||||
PROFILES = {
|
||||
"V1_Erista": {
|
||||
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[6396, 119440]"',
|
||||
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[5817, 129580]"',
|
||||
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6182, 112480]"',
|
||||
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5464, 174190]"',
|
||||
},
|
||||
"V2_Mariko": {
|
||||
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[7338, 112161]"',
|
||||
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[6357, 168124]"',
|
||||
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6728, 129810]"',
|
||||
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5675, 203453]"',
|
||||
},
|
||||
"Lite_Mariko": {
|
||||
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[7338, 112161]"',
|
||||
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[5594, 209601]"',
|
||||
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[6728, 129810]"',
|
||||
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[5235, 199759]"',
|
||||
},
|
||||
"OLED_Mariko": {
|
||||
"tskin_pcb_coefficients_console_on_fwdbg": 'str!"[8051, -45213]"',
|
||||
"tskin_pcb_coefficients_handheld_on_fwdbg": 'str!"[7176, -33954]"',
|
||||
"tskin_soc_coefficients_console_on_fwdbg": 'str!"[7831, 57590]"',
|
||||
"tskin_soc_coefficients_handheld_on_fwdbg": 'str!"[9029, 4274]"',
|
||||
},
|
||||
}
|
||||
|
||||
BATTERY_SAVE_OPTIONS = {
|
||||
"bgtc": {
|
||||
"enable_halfawake": "u32!0x0",
|
||||
"minimum_interval_normal": "u32!0x7FFFFFFF",
|
||||
"minimum_interval_save": "u32!0x7FFFFFFF",
|
||||
"battery_threshold_save": "u32!0x64",
|
||||
"battery_threshold_stop": "u32!0x64",
|
||||
},
|
||||
"npns": {
|
||||
"background_processing": "u8!0x0",
|
||||
"sleep_periodic_interval": "u32!0x7FFFFFFF",
|
||||
"sleep_processing_timeout": "u32!0x0",
|
||||
"sleep_max_try_count": "u32!0x0",
|
||||
},
|
||||
"ns.notification": {
|
||||
"enable_download_task_list": "u8!0x0",
|
||||
"enable_download_ticket": "u8!0x0",
|
||||
"enable_network_update": "u8!0x0",
|
||||
"enable_random_wait": "u8!0x0",
|
||||
"enable_request_on_cold_boot": "u8!0x0",
|
||||
"enable_send_rights_usage_status_request": "u8!0x0",
|
||||
"enable_sync_elicense_request": "u8!0x0",
|
||||
"enable_version_list": "u8!0x0",
|
||||
"retry_interval_min": "u32!0x7FFFFFFF",
|
||||
"retry_interval_max": "u32!0x7FFFFFFF",
|
||||
"version_list_waiting_limit_bias": "u32!0x7FFFFFFF",
|
||||
"version_list_waiting_limit_min": "u32!0x7FFFFFFF",
|
||||
},
|
||||
"account": {
|
||||
"na_required_for_network_service": "u8!0x0",
|
||||
"na_license_verification_enabled": "u8!0x0",
|
||||
},
|
||||
"account.daemon": {
|
||||
"background_awaking_periodicity": "u32!0x7FFFFFFF",
|
||||
"initial_schedule_delay": "u32!0x7FFFFFFF",
|
||||
"profile_sync_interval": "u32!0x7FFFFFFF",
|
||||
"na_info_refresh_interval": "u32!0x7FFFFFFF",
|
||||
},
|
||||
"capsrv": {
|
||||
"enable_album_screenshot_filedata_verification": "u8!0x0",
|
||||
"enable_album_movie_filehash_verification": "u8!0x0",
|
||||
"enable_album_movie_filesign_verification": "u8!0x0",
|
||||
},
|
||||
"friends": {
|
||||
"background_processing": "u8!0x0",
|
||||
},
|
||||
"notification.presenter": {
|
||||
"snooze_interval_in_seconds": "u32!0x7FFFFFFF",
|
||||
"connection_retry_count": "u32!0x0",
|
||||
"alarm_pattern_total_repeat_count": "u32!0x0",
|
||||
"alarm_pattern_with_vibration_repeat_count": "u32!0x0",
|
||||
},
|
||||
"prepo": {
|
||||
"transmission_interval_min": "u32!0x7FFFFFFF",
|
||||
"transmission_retry_interval_min": "u32!0x7FFFFFFF",
|
||||
"transmission_retry_interval_max": "u32!0x7FFFFFFF",
|
||||
"transmission_interval_in_sleep": "u32!0x7FFFFFFF",
|
||||
"statistics_save_interval_min": "u32!0x7FFFFFFF",
|
||||
"statistics_post_interval": "u32!0x7FFFFFFF",
|
||||
"save_system_report": "u8!0x0",
|
||||
},
|
||||
"olsc": {
|
||||
"default_auto_upload_global_setting": "u8!0x0",
|
||||
"default_auto_download_global_setting": "u8!0x0",
|
||||
"autonomy_registration_interval_seconds": "u32!0x7FFFFFFF",
|
||||
"network_service_license_info_cache_expiration_seconds": "u32!0x7FFFFFFF",
|
||||
"postponed_transfer_task_processing_interval_seconds": "u32!0x7FFFFFFF",
|
||||
"retry_offset_seconds": "u32!0x7FFFFFFF",
|
||||
"network_trouble_detection_span_seconds": "u32!0x7FFFFFFF",
|
||||
"network_connection_polling_interval_seconds": "u32!0x7FFFFFFF",
|
||||
"is_save_data_backup_policy_check_required": "u8!0x0",
|
||||
"is_global_transfer_task_autonomy_registration_enabled": "u8!0x0",
|
||||
"is_on_event_transfer_task_registration_enabled": "u8!0x0",
|
||||
"is_periodic_transfer_task_registration_enabled": "u8!0x0",
|
||||
},
|
||||
"ntc": {
|
||||
"is_autonomic_correction_enabled": "u8!0x0",
|
||||
"autonomic_correction_interval_seconds": "u32!0x7FFFFFFF",
|
||||
"autonomic_correction_failed_retry_interval_seconds": "u32!0x7FFFFFFF",
|
||||
"autonomic_correction_immediate_try_count_max": "u32!0x0",
|
||||
"autonomic_correction_immediate_try_interval_milliseconds": "u32!0x7FFFFFFF",
|
||||
},
|
||||
"systemupdate": {
|
||||
"bgnup_retry_seconds": "u32!0x7FFFFFFF",
|
||||
},
|
||||
"ns.rights": {
|
||||
"skip_account_validation_on_rights_check": "u8!0x1",
|
||||
"next_available_time_of_unexpected_error": "u32!0x7FFFFFFF",
|
||||
},
|
||||
"pctl": {
|
||||
"intermittent_task_interval_seconds": "u32!0x7FFFFFFF",
|
||||
},
|
||||
"sprofile": {
|
||||
"adjust_polling_interval_by_profile": "u8!0x0",
|
||||
"polling_interval_sec_max": "u32!0x7FFFFFFF",
|
||||
"polling_interval_sec_min": "u32!0x7FFFFFFF",
|
||||
},
|
||||
}
|
||||
|
||||
PSM_OPTIONS = [
|
||||
{"name": "1024mA", "value": "u32!0x400"},
|
||||
{"name": "1280mA", "value": "u32!0x500"},
|
||||
{"name": "1536mA", "value": "u32!0x600"},
|
||||
{"name": "1660mA (Lite Default)", "value": "u32!0x67C"},
|
||||
{"name": "1792mA", "value": "u32!0x700"},
|
||||
{"name": "2048mA (Default)", "value": "u32!0x800"},
|
||||
{"name": "2304mA (UNSAFE)", "value": "u32!0x900"},
|
||||
{"name": "2560mA (UNSAFE)", "value": "u32!0xA00"},
|
||||
{"name": "2816mA (DANGEROUS)", "value": "u32!0xB00"},
|
||||
{"name": "3072mA (DANGEROUS)", "value": "u32!0xC00"},
|
||||
]
|
||||
|
||||
skin_t_entries = {
|
||||
"use_configurations_on_fwdbg": "u8!0x1",
|
||||
"tskin_rate_table_console_on_fwdbg": f'str!"[[-1000000,40000,0,0],[36000,43000,51,51],[43000,49000,51,128],[49000,{skinTarget}000,128,255],[{skinTarget}000,1000000,255,255]]"',
|
||||
"tskin_rate_table_handheld_on_fwdbg": f'str!"[[-1000000,40000,0,0],[36000,43000,51,51],[43000,49000,51,128],[49000,{skinTarget}000,128,255],[{skinTarget}000,1000000,255,255]]"',
|
||||
"holdable_tskin": "u32!0xEA60",
|
||||
"touchable_tskin": "u32!0xEA60"
|
||||
}
|
||||
# Thresholds
|
||||
|
||||
mariko_meme_threshold = 1536000
|
||||
|
||||
mariko_dangerous_gpu_threshold = 1305600
|
||||
mariko_unsafe_gpu_threshold = 998000
|
||||
|
||||
erista_dangerous_gpu_threshold = 1076000
|
||||
erista_unsafe_gpu_threshold = 884000
|
||||
|
||||
mariko_voltage_step = 5
|
||||
erista_voltage_step = 5
|
||||
|
||||
mariko_gpu_offset_max = 50
|
||||
|
||||
mariko_gpu_min_volt = 480
|
||||
erista_gpu_min_volt = 700
|
||||
|
||||
|
||||
mariko_gpu_max_volt = 960
|
||||
erista_gpu_max_volt = 1000
|
||||
|
||||
mariko_gpu_max_vmin = 700
|
||||
erista_gpu_max_vmin = 850
|
||||
|
||||
mariko_cpu_min_vmin = 700
|
||||
mariko_cpu_max_vmin = 750
|
||||
|
||||
# TODO: Make more stuff configurable
|
||||
|
||||
|
||||
# COLORS
|
||||
danger_color = (255, 0, 0, 255)
|
||||
unsafe_color = (255, 165, 0, 255)
|
||||
safe_color = (255, 255, 255, 255)
|
||||
@@ -1 +0,0 @@
|
||||
python -m PyInstaller --onefile --noconsole eostimingutil.py
|
||||
BIN
Source/Configurator/util/dist/eostimingutil.exe
vendored
BIN
Source/Configurator/util/dist/eostimingutil.exe
vendored
Binary file not shown.
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "42",
|
||||
"label": "(42) 0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "36",
|
||||
"label": "(36) 1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "34",
|
||||
"label": "(34) 2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "32",
|
||||
"label": "(32) 3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "30",
|
||||
"label": "(30) 4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "28",
|
||||
"label": "(28) 5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "26",
|
||||
"label": "(26) 6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "24",
|
||||
"label": "(24) 7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": "22",
|
||||
"label": "(22) 8",
|
||||
"hex": "08"
|
||||
},
|
||||
{
|
||||
"name": "20",
|
||||
"label": "(20) 9",
|
||||
"hex": "09"
|
||||
}
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "18 - (0)",
|
||||
"label": "(18) 0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "17 - (1)",
|
||||
"label": "(17) 1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "16 - (2)",
|
||||
"label": "(16) 2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "15 - (3)",
|
||||
"label": "(15) 3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "14 - (4)",
|
||||
"label": "(14) 4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "13 - (5)",
|
||||
"label": "(13) 5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "12 - (6)",
|
||||
"label": "(12) 6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "11 - (7)",
|
||||
"label": "(11) 7",
|
||||
"hex": "07"
|
||||
}
|
||||
]
|
||||
@@ -1,37 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(1x REFI) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(1.5x REFI) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(2x REFI) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(3x REFI) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(4x REFI) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(6x REFI) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(MAX REFI) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
}
|
||||
]
|
||||
@@ -1,47 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(140) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(120) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(100) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(90) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(80) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(70) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(60) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "(50) 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": "(40) 8",
|
||||
"label": "8",
|
||||
"hex": "08"
|
||||
}
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "18 - (0)",
|
||||
"label": " (18) 0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "17 - (1)",
|
||||
"label": " (17) 1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "16 - (2)",
|
||||
"label": " (16) 2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "15 - (3)",
|
||||
"label": " (15) 3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "14 - (4)",
|
||||
"label": " (14) 4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "13 - (5)",
|
||||
"label": " (13) 5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "12 - (6)",
|
||||
"label": " (12) 6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "11 - (7)",
|
||||
"label": " (11) 7",
|
||||
"hex": "07"
|
||||
}
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(10) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(7.5) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(6) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(5) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(4) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(3) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(2) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "(1) 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
}
|
||||
]
|
||||
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": " 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": " 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": " 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": " 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": " 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": " 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": " 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": " 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": " 8",
|
||||
"label": "8",
|
||||
"hex": "08"
|
||||
},
|
||||
{
|
||||
"name": " 9",
|
||||
"label": "9",
|
||||
"hex": "09"
|
||||
}
|
||||
]
|
||||
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(10) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(9) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(8) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(7) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(6) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(5) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(4) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "(3) 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": "(2) 8",
|
||||
"label": "8",
|
||||
"hex": "08"
|
||||
},
|
||||
{
|
||||
"name": "(1) 9",
|
||||
"label": "9",
|
||||
"hex": "09"
|
||||
}
|
||||
]
|
||||
BIN
Source/Configurator/util/dist/timings.zip
vendored
BIN
Source/Configurator/util/dist/timings.zip
vendored
Binary file not shown.
@@ -1,78 +0,0 @@
|
||||
import json
|
||||
import dearpygui.dearpygui as dpg
|
||||
import os
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
timings = {
|
||||
"tRCD": "mariko/ram_trcd.json",
|
||||
"tRP": "mariko/ram_trp.json",
|
||||
"tRAS": "mariko/ram_tras.json",
|
||||
"tRRD": "mariko/ram_trrd.json",
|
||||
"tRFC": "mariko/ram_trfc.json",
|
||||
"tRTW": "mariko/ram_trtw.json",
|
||||
"tWTR": "mariko/ram_twtr.json",
|
||||
"tREFI": "mariko/ram_trefi.json"
|
||||
}
|
||||
|
||||
timing_data = {}
|
||||
for timing_name, rel_path in timings.items():
|
||||
path = os.path.join(BASE_DIR, rel_path)
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
raw = json.load(f)
|
||||
steps = {}
|
||||
if isinstance(raw, list):
|
||||
for i, entry in enumerate(raw):
|
||||
if isinstance(entry, dict) and "name" in entry:
|
||||
steps[i] = entry["name"].strip()
|
||||
else:
|
||||
steps[i] = str(entry)
|
||||
elif isinstance(raw, dict):
|
||||
for k, entry in raw.items():
|
||||
if isinstance(entry, dict) and "name" in entry:
|
||||
steps[int(k)] = entry["name"].strip()
|
||||
else:
|
||||
steps[int(k)] = str(entry)
|
||||
timing_data[timing_name] = steps
|
||||
except Exception as e:
|
||||
print(f"Error loading {path}: {e}")
|
||||
timing_data[timing_name] = {}
|
||||
else:
|
||||
print(f"Missing file: {path}")
|
||||
timing_data[timing_name] = {}
|
||||
|
||||
def update_slider_label(sender, app_data, user_data):
|
||||
timing_name = user_data
|
||||
step = int(app_data)
|
||||
name_value = timing_data[timing_name].get(step, "(no name)")
|
||||
new_label = f"{timing_name}: {name_value}"
|
||||
dpg.set_item_label(sender, new_label)
|
||||
|
||||
# --- GUI ---
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="EOS Real Timings", width=600, height=500)
|
||||
|
||||
with dpg.window(label="Timings", width=580, height=480, tag="main"):
|
||||
dpg.add_text("Select timings")
|
||||
for timing_name, steps in timing_data.items():
|
||||
if steps:
|
||||
max_step = max(steps.keys())
|
||||
current_name = steps.get(0, "")
|
||||
dpg.add_slider_int(
|
||||
label=f"{timing_name}: {current_name}",
|
||||
min_value=0,
|
||||
max_value=max_step,
|
||||
default_value=0,
|
||||
callback=update_slider_label,
|
||||
user_data=timing_name,
|
||||
width=400
|
||||
)
|
||||
else:
|
||||
dpg.add_text(f"{timing_name}: (JSON not found or invalid)")
|
||||
dpg.set_primary_window("main", True)
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
@@ -1,38 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['eostimingutil.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='eostimingutil',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "42",
|
||||
"label": "(42) 0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "36",
|
||||
"label": "(36) 1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "34",
|
||||
"label": "(34) 2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "32",
|
||||
"label": "(32) 3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "30",
|
||||
"label": "(30) 4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "28",
|
||||
"label": "(28) 5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "26",
|
||||
"label": "(26) 6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "24",
|
||||
"label": "(24) 7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": "22",
|
||||
"label": "(22) 8",
|
||||
"hex": "08"
|
||||
},
|
||||
{
|
||||
"name": "20",
|
||||
"label": "(20) 9",
|
||||
"hex": "09"
|
||||
}
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "18 - (0)",
|
||||
"label": "(18) 0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "17 - (1)",
|
||||
"label": "(17) 1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "16 - (2)",
|
||||
"label": "(16) 2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "15 - (3)",
|
||||
"label": "(15) 3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "14 - (4)",
|
||||
"label": "(14) 4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "13 - (5)",
|
||||
"label": "(13) 5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "12 - (6)",
|
||||
"label": "(12) 6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "11 - (7)",
|
||||
"label": "(11) 7",
|
||||
"hex": "07"
|
||||
}
|
||||
]
|
||||
@@ -1,37 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(1x REFI) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(1.5x REFI) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(2x REFI) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(3x REFI) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(4x REFI) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(6x REFI) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(MAX REFI) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
}
|
||||
]
|
||||
@@ -1,47 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(140) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(120) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(100) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(90) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(80) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(70) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(60) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "(50) 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": "(40) 8",
|
||||
"label": "8",
|
||||
"hex": "08"
|
||||
}
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "18 - (0)",
|
||||
"label": " (18) 0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "17 - (1)",
|
||||
"label": " (17) 1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "16 - (2)",
|
||||
"label": " (16) 2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "15 - (3)",
|
||||
"label": " (15) 3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "14 - (4)",
|
||||
"label": " (14) 4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "13 - (5)",
|
||||
"label": " (13) 5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "12 - (6)",
|
||||
"label": " (12) 6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "11 - (7)",
|
||||
"label": " (11) 7",
|
||||
"hex": "07"
|
||||
}
|
||||
]
|
||||
@@ -1,42 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(10) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(7.5) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(6) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(5) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(4) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(3) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(2) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "(1) 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
}
|
||||
]
|
||||
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": " 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": " 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": " 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": " 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": " 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": " 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": " 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": " 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": " 8",
|
||||
"label": "8",
|
||||
"hex": "08"
|
||||
},
|
||||
{
|
||||
"name": " 9",
|
||||
"label": "9",
|
||||
"hex": "09"
|
||||
}
|
||||
]
|
||||
@@ -1,52 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "(10) 0",
|
||||
"label": "0",
|
||||
"hex": "00"
|
||||
},
|
||||
{
|
||||
"name": "(9) 1",
|
||||
"label": "1",
|
||||
"hex": "01"
|
||||
},
|
||||
{
|
||||
"name": "(8) 2",
|
||||
"label": "2",
|
||||
"hex": "02"
|
||||
},
|
||||
{
|
||||
"name": "(7) 3",
|
||||
"label": "3",
|
||||
"hex": "03"
|
||||
},
|
||||
{
|
||||
"name": "(6) 4",
|
||||
"label": "4",
|
||||
"hex": "04"
|
||||
},
|
||||
{
|
||||
"name": "(5) 5",
|
||||
"label": "5",
|
||||
"hex": "05"
|
||||
},
|
||||
{
|
||||
"name": "(4) 6",
|
||||
"label": "6",
|
||||
"hex": "06"
|
||||
},
|
||||
{
|
||||
"name": "(3) 7",
|
||||
"label": "7",
|
||||
"hex": "07"
|
||||
},
|
||||
{
|
||||
"name": "(2) 8",
|
||||
"label": "8",
|
||||
"hex": "08"
|
||||
},
|
||||
{
|
||||
"name": "(1) 9",
|
||||
"label": "9",
|
||||
"hex": "09"
|
||||
}
|
||||
]
|
||||
@@ -1,2 +0,0 @@
|
||||
python eostimingutil.py
|
||||
|
||||
2
Source/Horizon-OC-Monitor/Horizon-OC-Monitor.lst
Normal file
2
Source/Horizon-OC-Monitor/Horizon-OC-Monitor.lst
Normal file
@@ -0,0 +1,2 @@
|
||||
-CSn
|
||||
/home/sould/Documents/GitHub/Horizon-OC/Source/Horizon-OC-Monitor/Horizon-OC-Monitor.elf
|
||||
@@ -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-r4
|
||||
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
|
||||
|
||||
@@ -65,6 +65,7 @@ IS_STATUS_MONITOR_DIRECTIVE := 1
|
||||
CFLAGS += -DIS_STATUS_MONITOR_DIRECTIVE=$(IS_STATUS_MONITOR_DIRECTIVE)
|
||||
|
||||
# Enable appearance overriding
|
||||
export MSYS2_ARG_CONV_EXCL := -DUI_OVERRIDE_PATH
|
||||
UI_OVERRIDE_PATH := /config/status-monitor/
|
||||
CFLAGS += -DUI_OVERRIDE_PATH="\"$(UI_OVERRIDE_PATH)\""
|
||||
|
||||
|
||||
1
Source/Horizon-OC-Monitor/README.md
Normal file
1
Source/Horizon-OC-Monitor/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Thanks to NaGa for Status Monitor Pro!
|
||||
Submodule Source/Horizon-OC-Monitor/lib/Atmosphere-libs updated: 6cc765fcaa...82f1553c4c
Submodule Source/Horizon-OC-Monitor/lib/libultrahand updated: 8541ecbe95...3e54f2a1ad
File diff suppressed because it is too large
Load Diff
@@ -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,13 +441,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -473,8 +468,8 @@ public:
|
||||
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
shmemClose(&_sharedmemory);
|
||||
//Exit services
|
||||
@@ -530,13 +525,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemory();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -557,8 +552,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
//Exit services
|
||||
clkrstExit();
|
||||
@@ -617,13 +612,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemory();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -645,8 +640,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
// Exit services
|
||||
clkrstExit();
|
||||
@@ -707,13 +702,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -734,8 +729,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -790,13 +785,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -817,8 +812,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -873,13 +868,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -900,8 +895,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -986,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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user