forked from kmeps4/PSFree900
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.mjs
More file actions
70 lines (56 loc) · 2.07 KB
/
Copy pathconfig.mjs
File metadata and controls
70 lines (56 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Copyright (C) 2023-2024 anonymous
This file is part of PSFree.
PSFree is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
PSFree 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
// webkitgtk 2.34.4 was used to develop the portable parts of the exploit
// before moving on to ps4 8.03
//
// webkitgtk 2.34.4 was built with cmake variable ENABLE_JIT=OFF, that variable
// can affect the size of SerializedScriptValue
//
// this target is no longer supported
// target firmware format used by PSFree
//
// 0xC_MM_mm
//
// * C console - PS4 (0) or PS5 (1) (1 bit)
// * MM major version - integer part of the firmware version (8 bits)
// * mm minor version - fractional part of the firmware version (8 bits)
//
// examples:
// * PS4 10.00 -> C = 0 MM = 10 mm = 0 -> 0x0_10_00
// * PS5 4.51 -> C = 1 MM = 4 mm = 51 -> 0x1_04_51
// check if value is in Binary Coded Decimal format
// assumes integer and is in the range [0, 0xffff]
function check_bcd(value) {
for (let i = 0; i <= 12; i += 4) {
const nibble = (value >>> i) & 0xf;
if (nibble > 9) {
return false;
}
}
return true;
}
export function set_target(value) {
if (!Number.isInteger(value)) {
throw TypeError(`value not an integer: ${value}`);
}
if (value >= 0x20000 || value < 0) {
throw RangeError(`value >= 0x20000 or value < 0: ${value}`);
}
const version = value & 0xffff;
if (!check_bcd(version)) {
throw RangeError(`value & 0xffff not in BCD format ${version}`);
}
target = value;
}
export let target = null;
set_target(0x900);