This repository was archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
99 lines (79 loc) · 4.61 KB
/
Copy pathindex.js
File metadata and controls
99 lines (79 loc) · 4.61 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
(async () => {
const fs = require('fs');
const ini = require('ini');
const chalk = require('chalk');
const readline = require('readline');
const { execSync } = require('child_process');
const run = async () => {
console.log(chalk.yellow('⚠️ This application is not associated with Pico 4 or any other related application. It is a third-party application. ⚠️'));
console.log(chalk.blue('🎥 Streaming Assistant Configurator - Made by Migu 🎬'));
let isAdmin = false;
try {
execSync('net session >nul 2>&1');
isAdmin = true;
} catch (error) {
console.clear();
console.log(chalk.red('❌ This application requires administrator privileges to modify the configuration file.'));
console.log(chalk.red('❌ Please run the application as administrator.'));
console.log(chalk.yellow('💻 To run the application as administrator, right-click on the application and select "Run as administrator". 💻'));
setTimeout(() => {
process.exit(1);
}, 4000);
}
if (isAdmin === true) {
setTimeout(() => {
console.clear();
// Load the INI file
const config = ini.parse(fs.readFileSync('C:/Program Files/Streaming Assistant/driver/bin/win64/RVRPlugin.ini', 'utf-8'));
// Create a command line interface to ask the user
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// Ask the user for the values to modify
rl.question(chalk.yellow('🔧 Enter the bitrate (default 100000000): '), (bitrate) => {
if (!config.codec) config.codec = {};
config.codec.bitrate = validateNumberInput(bitrate, '100000000');
rl.question(chalk.yellow('🔧 Enter the sharper value (default 0.4): '), (sharper) => {
if (!config.PICTURE) config.PICTURE = {};
config.PICTURE.sharper = validateNumberInput(sharper, '0.4');
rl.question(chalk.yellow('🔧 Enter the bright value (default 1.2): '), (bright) => {
config.PICTURE.bright = validateNumberInput(bright, '1.2');
rl.question(chalk.yellow('🔧 Enter the saturation value (default 1.1): '), (saturation) => {
config.PICTURE.saturation = validateNumberInput(saturation, '1.1');
rl.question(chalk.yellow('🔧 Enter the gamma value (default 1.1): '), (gamma) => {
config.PICTURE.gamma = validateNumberInput(gamma, '1.1');
rl.question(chalk.yellow('🔧 Enter the eye resolution (default 2160): '), (eyeWidth) => {
config.session.eyeWidth = validateNumberInput(eyeWidth, '2160');
config.session.eyeHeight = validateNumberInput(eyeWidth, '2160');
rl.question(chalk.yellow('🔧 Enter the fov value (default 105): '), (fov) => {
config.session.fov = validateNumberInput(fov, '105');
// Write the changes to the INI file
fs.writeFileSync('C:/Program Files/Streaming Assistant/driver/bin/win64/RVRPlugin.ini', ini.stringify(config));
console.log(chalk.green('✅ File updated successfully'));
setTimeout(() => {
rl.close();
}, 4000);
});
});
});
});
});
});
});
function validateNumberInput(input, defaultValue) {
if (!input) return defaultValue;
const value = parseFloat(input);
if (isNaN(value)) {
console.error(chalk.red(`❌ Invalid input: ${input} is not a number`));
setTimeout(() => {
process.exit(1);
}, 4000);
}
return input;
}
}, 2000);
}
};
run();
})();