Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:38:08 +02:00
commit c737a37f71
531 files changed
+119270

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
// System State Controls
let pendingSystemAction = null;
const systemStateLabels = {
shutdown: 'Shutdown', reboot: 'Reboot', restmode: 'Enter Rest Mode', eject: 'Eject Disc',
};
function systemStateStatus(text, error = false) {
const el = $('system-state-status');
el.textContent = text;
el.style.color = error ? 'var(--red)' : '';
}
async function refreshSystemStateStatus() {
systemStateStatus('Checking service...');
const result = await window.pork.systemStateStatus();
systemStateStatus(result.connected ? `Service ready: ${result.response || 'port 9112'}` : (result.error || result.response || 'Service unavailable.'), !result.connected);
}
$('btn-system-state-status').addEventListener('click', () => refreshSystemStateStatus().catch(error => systemStateStatus(error.message, true)));
$('btn-system-state-deploy').addEventListener('click', async () => {
const button = $('btn-system-state-deploy');
button.disabled = true;
systemStateStatus('Sending payload to loader port 9021...');
try {
const result = await window.pork.systemStateDeploy();
systemStateStatus(`${result.message} (${result.bytes} bytes)`);
} catch (error) {
systemStateStatus(error.message, true);
} finally {
button.disabled = false;
}
});
document.querySelectorAll('.system-state-action').forEach((button) => button.addEventListener('click', () => {
pendingSystemAction = button.dataset.systemAction;
const command = pendingSystemAction === 'restmode' ? 'RESTMODE' : pendingSystemAction.toUpperCase();
$('system-state-confirm-title').textContent = `Confirm: ${systemStateLabels[pendingSystemAction]}`;
const shutdownWarning = pendingSystemAction === 'shutdown'
? ' The upstream SystemStateManager project still marks shutdown as in testing; use it only if you accept that risk.'
: '';
$('system-state-confirm-copy').textContent = `This sends ${command} to SystemStateManager on your PS5. Type "CONFIRM ${command}" exactly to enable the action.${shutdownWarning}`;
$('system-state-confirm-input').value = '';
$('system-state-confirm').hidden = false;
$('system-state-confirm-input').focus();
}));
$('system-state-confirm-input').addEventListener('input', () => {
if (!pendingSystemAction) return;
const command = pendingSystemAction === 'restmode' ? 'RESTMODE' : pendingSystemAction.toUpperCase();
$('btn-system-state-confirm').disabled = $('system-state-confirm-input').value !== `CONFIRM ${command}`;
});
$('btn-system-state-cancel').addEventListener('click', () => {
pendingSystemAction = null;
$('system-state-confirm').hidden = true;
});
$('btn-system-state-confirm').addEventListener('click', async () => {
if (!pendingSystemAction) return;
const action = pendingSystemAction;
const command = action === 'restmode' ? 'RESTMODE' : action.toUpperCase();
const button = $('btn-system-state-confirm');
button.disabled = true;
systemStateStatus(`Sending ${command}...`);
try {
const result = await window.pork.systemStateCommand({ action, confirmation: `CONFIRM ${command}` });
systemStateStatus(`${systemStateLabels[action]} command accepted: ${result.response || 'OK'}`);
$('system-state-confirm').hidden = true;
pendingSystemAction = null;
} catch (error) {
systemStateStatus(error.message, true);
button.disabled = false;
}
});