Files
onionHEN/source/include/msg.hpp
T
Hexwell 072361c53f refactor: remove online kstuff and cheats downloads
Drop GitHub-based download UI, IPC, and the util HTTP/curl stack. Keep
local cheats under /data/OnionHEN/cheats and optional external kstuff.elf.
2026-07-15 18:42:54 +08:00

88 lines
2.8 KiB
C++

#pragma once
#include <stdint.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <string>
#include <sys/param.h>
#define INVAIL -1
#define CRIT_IPC_SOC "/system_tmp/OnionHEN_crit_service"
#define UTIL_IPC_SOC "/system_tmp/OnionHEN_util_service"
#define DAEMON_BUFF_MAX 0x1000
enum class IPC_Ret : int {
NO_ERROR = 0,
INVALID = -1,
// Distinct from INVALID so callers can tell "wrong daemon" from "op failed".
OPERATION_FAILED = -2,
DEFAULT_RET = -1337
};
/* Underlying type is unsigned: several stable opcodes use the high bit set. */
enum DaemonCommands : unsigned int {
BREW_TEST_CONNECTION = 0x9000000u,
BREW_RETURN_VALUE = 0x9000002u,
BREW_REMOUNT_FOLDER,
BREW_STAT_CMD,
BREW_CALC_DIR_SIZE,
BREW_COPY_FILE,
BREW_COPY_DIR,
BREW_DELETE_DIR,
BREW_UNUSED_1,// not used anymore but kept fopr backwards compatibility for now
BREW_TEST_SB_FILE,
BREW_DAEMON_PID,
BREW_UNUSED_STORE_INSTALLER,
BREW_UNUSED_DECRYPT_DIR, // was BREW_DECRYPT_DIR (SELF directory decrypt removed)
BREW_LAST_RET,
BREW_UNUSED_TESTKIT_CHECK, // was BREW_TESTKIT_CHECK (local probe used instead)
BREW_ENABLE_TOOLBOX,
BREW_CHMOD_DIR,
BREW_ADJUST_FAN_SPEED,
BREW_UTIL_TEST_CONNECTION = 0x8000000u,
BREW_UTIL_RETURN_VALUE = 0x8000002u,
BREW_UTIL_DAEMON_PID,
BREW_UTIL_UNUSED_FTP, // was BREW_UTIL_TOGGLE_FTP (service removed)
BREW_UTIL_UNUSED_KLOG, // was BREW_UTIL_TOGGLE_KLOG (service removed)
BREW_UTIL_UNUSED_DPI, // was TOGGLE_DPI (DirectPKGInstaller removed)
BREW_UTIL_LAUNCH_PAYLOAD,
BREW_UTIL_SHELLUI_ON_STANDBY,
BREW_UTIL_GET_GAME_VER,
BREW_UTIL_GET_GAME_CHEAT,
BREW_UTIL_TOGGLE_CHEAT,
BREW_UTIL_UNUSED_DOWNLOAD_CHEATS, // was DOWNLOAD_CHEATS (online repo download removed)
BREW_UTIL_UNUSED_RELOAD_CHEATS, // was RELOAD_CHEATS (index cache removed; file-sig hot-reload)
BREW_UTIL_UNUSED_DOWNLOAD_KSTUFF, // was DOWNLOAD_KSTUFF (online kstuff download removed)
BREW_UTIL_TOGGLE_LEGACY_CMD_SERVER,
BREW_UTIL_UNUSED_2,
BREW_UTIL_UNUSED_3,
// Legacy: 9021 elfldr auto-launch removed (command kept for IPC compatibility)
BREW_UTIL_LAUNCH_ELFLDR = 0xE1F1D8u,
BREW_RELOAD_SETTINGS = 0xC0FFEEu,
// BREW_TOGGLE_PS5DEBUG removed (ps5debug no longer embedded)
//KILL MAIN DAEMOM
BREW_KILL_DAEMON = 0xDEAD0001u,
/** Crit: kill util.elf → SceShellUI → exit daemon (PC TCP :9048 also). */
BREW_SHUTDOWN_STACK = 0xDEAD0002u,
BREW_FORCE_KILL_PID = 0xDEADCAFEu,
};
/** TCP control port on crit daemon (LAN). Same wire as scripts/shutdown_onion.py. */
#define ONION_CTRL_TCP_PORT 9048
/** TCP control frame magic: ASCII 'ONIO' as BE u32. */
#define ONION_CTRL_TCP_MAGIC 0x4F4E494Fu
/** TCP cmd: full stack shutdown (util + ShellUI + daemon). */
#define ONION_CTRL_TCP_CMD_SHUTDOWN 1u
struct IPCMessage {
int magic = 0xDEADBABE;
enum DaemonCommands cmd;
int error = 0;
char msg[DAEMON_BUFF_MAX];
};