refactor: remove kill disc player on startup functionality

- Remove disc player termination call from daemon startup in main.c
- Remove ps5_kill_disc_player, get_pid_by_name, and unused LncUtil externs
- Remove KILL_DISC_PLAYER_ON_STARTUP from config storage and HTTP endpoints
- Remove Kill Disc Player toggle row from SettingsView
This commit is contained in:
najdek committed 2026-10-12 01:40:09 +02:00
1 parent 265c827e7f
commit ba529e8917
7 files changed
+6 -140

No files matched your search

@@ -160,24 +160,6 @@ const SettingsView = ({ config, onSaveConfig, setShowLogs, onNavigate }) => {
</button>
</SettingRow>
<SettingRow
title={t("settings.kill_disc_title", "Kill Disc Player")}
description={t("settings.kill_disc_desc", "Automatically terminate the Disc Player application on startup (for BD-JB users).")}
>
<button
onClick={() => onSaveConfig({ KILL_DISC_PLAYER_ON_STARTUP: !config.KILL_DISC_PLAYER_ON_STARTUP })}
className={cn(
"w-14 h-7 md:w-20 md:h-10 rounded-full transition-all relative p-1 md:p-1.5",
config.KILL_DISC_PLAYER_ON_STARTUP !== false ? "bg-ps-blue" : "bg-white/10"
)}
>
<div className={cn(
"w-5 h-5 md:w-7 md:h-7 bg-white rounded-full transition-all",
config.KILL_DISC_PLAYER_ON_STARTUP !== false ? "translate-x-7 md:translate-x-10" : "translate-x-0"
)} />
</button>
</SettingRow>
<SettingRow
title={t("settings.scan_usb_title", "Scan USB Payloads")}
description={t("settings.scan_usb_desc", "Enable scanning for .elf and .bin files in the root directory of USB drives (/mnt/usb0-7).")}
+1 -3
View File
@@ -9,7 +9,6 @@ typedef struct PldmgrConfig {
long last_repository_update; /* Default: 0 */
int auto_browser_open; /* Default: 1 (on) */
int autoload_delay; /* Default: 5 (seconds) */
int kill_disc_player; /* Default: 1 (on) */
int scan_usb_payloads; /* Default: 0 (off) */
int auto_install_app; /* Default: 1 (on) */
int multi_sources_enabled; /* Default: 0 (off) */
@@ -29,8 +28,7 @@ int config_read_bool(const char *key, int default_val);
/* Apply a JSON config update sent from the frontend /set_config route.
* Handles AUTOLOAD_ENABLED, AUTO_BROWSER_OPEN, AUTOLOAD_DELAY,
* KILL_DISC_PLAYER_ON_STARTUP, SCAN_USB_PAYLOADS, AUTO_INSTALL_APP,
* MULTI_SOURCES_ENABLED, and AUTOLOAD_LIST.
* SCAN_USB_PAYLOADS, AUTO_INSTALL_APP, MULTI_SOURCES_ENABLED, and AUTOLOAD_LIST.
* Returns 0 on success, -1 on error. */
int config_handle_set_json(const char *json_data);
-5
View File
@@ -17,9 +17,4 @@ int ps5_launch_elf(const char* path);
*/
int ps5_launch_browser(const char* uri);
/**
* Kill the "Disc Player" app (NPXS40140) if it is running.
* @return 0 if not running or successfully killed, -1 on error.
*/
int ps5_kill_disc_player();
-5
View File
@@ -19,7 +19,6 @@ void config_read(PldmgrConfig *cfg) {
cfg->last_repository_update = 0;
cfg->auto_browser_open = 1;
cfg->autoload_delay = 5;
cfg->kill_disc_player = 1;
cfg->scan_usb_payloads = 0;
cfg->auto_install_app = 1;
cfg->multi_sources_enabled = 0;
@@ -37,8 +36,6 @@ void config_read(PldmgrConfig *cfg) {
cfg->auto_browser_open = atoi(line + 18);
else if (strncmp(line, "AUTOLOAD_DELAY=", 15) == 0)
cfg->autoload_delay = atoi(line + 15);
else if (strncmp(line, "KILL_DISC_PLAYER_ON_STARTUP=", 28) == 0)
cfg->kill_disc_player = atoi(line + 28);
else if (strncmp(line, "SCAN_USB_PAYLOADS=", 18) == 0)
cfg->scan_usb_payloads = atoi(line + 18);
else if (strncmp(line, "AUTO_INSTALL_APP=", 17) == 0)
@@ -61,7 +58,6 @@ int config_write(const PldmgrConfig *cfg) {
fprintf(f, "LAST_REPOSITORY_UPDATE=%ld\n", cfg->last_repository_update);
fprintf(f, "AUTO_BROWSER_OPEN=%d\n", cfg->auto_browser_open ? 1 : 0);
fprintf(f, "AUTOLOAD_DELAY=%d\n", cfg->autoload_delay);
fprintf(f, "KILL_DISC_PLAYER_ON_STARTUP=%d\n", cfg->kill_disc_player ? 1 : 0);
fprintf(f, "SCAN_USB_PAYLOADS=%d\n", cfg->scan_usb_payloads ? 1 : 0);
fprintf(f, "AUTO_INSTALL_APP=%d\n", cfg->auto_install_app ? 1 : 0);
fprintf(f, "MULTI_SOURCES_ENABLED=%d\n", cfg->multi_sources_enabled ? 1 : 0);
@@ -201,7 +197,6 @@ int config_handle_set_json(const char *json_data) {
cfg.autoload_enabled = enabled;
cfg.auto_browser_open = extract_json_bool(json_data, "AUTO_BROWSER_OPEN", cfg.auto_browser_open);
cfg.autoload_delay = extract_json_int(json_data, "AUTOLOAD_DELAY", cfg.autoload_delay);
cfg.kill_disc_player = extract_json_bool(json_data, "KILL_DISC_PLAYER_ON_STARTUP", cfg.kill_disc_player);
cfg.scan_usb_payloads = extract_json_bool(json_data, "SCAN_USB_PAYLOADS", cfg.scan_usb_payloads);
cfg.auto_install_app = extract_json_bool(json_data, "AUTO_INSTALL_APP", cfg.auto_install_app);
cfg.multi_sources_enabled = extract_json_bool(json_data, "MULTI_SOURCES_ENABLED", cfg.multi_sources_enabled);
+5 -5
View File
@@ -812,9 +812,9 @@ enum MHD_Result http_on_request(void *cls, struct MHD_Connection *conn,
if (!resp) {
snprintf(resp_buf, SMALL_RESPONSE_BUFFER_SIZE,
"{\"remaining\":%d,\"remaining_ms\":%lld,\"total\":%d,\"done\":%d,\"current\":\"%s\","
"\"list\":\"%s\",\"delay\":%d,\"KILL_DISC_PLAYER_ON_STARTUP\":%s,\"SCAN_USB_PAYLOADS\":%s}",
"\"list\":\"%s\",\"delay\":%d,\"SCAN_USB_PAYLOADS\":%s}",
remaining, remaining_ms, total, done, current_escaped, list_escaped, cfg.autoload_delay,
cfg.kill_disc_player ? "true" : "false", cfg.scan_usb_payloads ? "true" : "false");
cfg.scan_usb_payloads ? "true" : "false");
resp = MHD_create_response_from_buffer(strlen(resp_buf),
(void *)resp_buf,
MHD_RESPMEM_MUST_FREE);
@@ -877,12 +877,12 @@ enum MHD_Result http_on_request(void *cls, struct MHD_Connection *conn,
snprintf(resp_buf, SMALL_RESPONSE_BUFFER_SIZE,
"{\"AUTOLOAD_ENABLED\":%s,\"AUTOLOAD_LIST\":\"%s\",\"LAST_"
"REPOSITORY_UPDATE\":%ld,"
"\"AUTO_BROWSER_OPEN\":%s,\"AUTOLOAD_DELAY\":%d,\"KILL_DISC_"
"PLAYER_ON_STARTUP\":%s,\"SCAN_USB_PAYLOADS\":%s,\"AUTO_INSTALL_APP\":%s,"
"\"AUTO_BROWSER_OPEN\":%s,\"AUTOLOAD_DELAY\":%d,"
"\"SCAN_USB_PAYLOADS\":%s,\"AUTO_INSTALL_APP\":%s,"
"\"MULTI_SOURCES_ENABLED\":%s,\"FAVORITES\":\"%s\",\"FAVORITES_INITIALIZED\":%s}",
cfg.autoload_enabled ? "true" : "false", list_escaped, cfg.last_repository_update,
cfg.auto_browser_open ? "true" : "false", cfg.autoload_delay,
cfg.kill_disc_player ? "true" : "false", cfg.scan_usb_payloads ? "true" : "false",
cfg.scan_usb_payloads ? "true" : "false",
cfg.auto_install_app ? "true" : "false",
cfg.multi_sources_enabled ? "true" : "false",
fav_escaped, fav_exists ? "true" : "false");
-5
View File
@@ -120,11 +120,6 @@ int main(int argc, char *argv[]) {
pldmgr_install_app_if_needed();
}
/* Kill Disc Player if running (BD-JB host) and enabled in config */
if (cfg.kill_disc_player) {
ps5_kill_disc_player();
}
/* Signal Resilience */
signal(SIGPIPE, SIG_IGN);
signal(SIGHUP, SIG_IGN);
-99
View File
@@ -11,10 +11,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <stdint.h>
#include <sys/sysctl.h>
#include <sys/user.h>
int ps5_launch_elf(const char *path) {
pldmgr_log("[PLDMGR] Sending ELF to local loader: %s\n", path);
@@ -97,99 +94,3 @@ int ps5_launch_browser(const char *uri) {
}
return 0;
}
/* LncUtil Externs */
extern int sceLncUtilGetAppIdOfRunningBigApp();
extern int sceLncUtilGetAppTitleId(uint32_t app_id, char *title_id);
extern int sceLncUtilSuspendApp(uint32_t app_id);
extern int sceLncUtilKillApp(uint32_t app_id);
static pid_t get_pid_by_name(const char *process_name) {
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PROC, 0};
size_t buf_size;
if (sysctl(mib, 4, NULL, &buf_size, NULL, 0))
return -1;
void *buf = malloc(buf_size);
if (!buf)
return -1;
if (sysctl(mib, 4, buf, &buf_size, NULL, 0)) {
free(buf);
return -1;
}
pid_t pid = -1;
for (void *ptr = buf; ptr < (buf + buf_size);
ptr += ((struct kinfo_proc *)ptr)->ki_structsize) {
struct kinfo_proc *ki = (struct kinfo_proc *)ptr;
if (ki->ki_structsize < sizeof(struct kinfo_proc))
break;
if (strncmp(ki->ki_comm, process_name, sizeof(ki->ki_comm)) == 0) {
pid = ki->ki_pid;
break;
}
}
free(buf);
return pid;
}
int ps5_kill_disc_player() {
const char *target_process = "SceDiscPlayer";
const char *target_title_id = "NPXS40140";
uint32_t app_id = sceLncUtilGetAppIdOfRunningBigApp();
if (app_id == 0xffffffff) {
return 0; /* No app running */
}
char title_id[16] = {0};
if (sceLncUtilGetAppTitleId(app_id, title_id) != 0) {
return 0; /* Could not get title ID */
}
if (strcmp(title_id, target_title_id) != 0) {
return 0; /* Not the disc player */
}
pldmgr_notify("Disc Player detected. Terminating...\n");
/* 1. Suspend */
if (sceLncUtilSuspendApp(app_id) != 0) {
pldmgr_notify("Failed to suspend Disc Player");
return -1;
}
/* Wait for home screen transition stability */
sleep(2);
/* 2. SIGKILL */
pid_t pid = get_pid_by_name(target_process);
if (pid != -1) {
pldmgr_log("Sending SIGKILL to %s (PID: %d)\n", target_process, pid);
if (kill(pid, SIGKILL) == 0) {
pldmgr_log("SIGKILL Sent to Disc Player");
} else {
pldmgr_notify("Warning: SIGKILL Failed");
}
sleep(1);
}
/* 3. LncUtil Kill */
int result = sceLncUtilKillApp(app_id);
if (result == 0) {
pldmgr_log("Disc Player Fully Closed");
} else {
/* Check if it's already gone (crashed/closed) */
if (sceLncUtilGetAppIdOfRunningBigApp() == 0xffffffff) {
pldmgr_log("Disc Player Closed");
} else {
pldmgr_notify("!!! Failed to kill Disc Player (result: %d)", result);
return -1;
}
}
return 0;
}