mirror of
https://github.com/SirHumza/orbisRPC.git
synced 2026-10-06 07:00:39 +02:00
fix: critical path bugs and build errors
- daemon.c/updater.c: fix /data/GoldHEN/payloads -> /data/payloads (Payload Guest reads /data/payloads/, not /data/GoldHEN/payloads/) - daemon.c: fix strncmp(..., sizeof buffer) -> strcmp for title ID comparison (strncmp pastes past null terminator, giving false diffs) - tmdb.c: fix fd scoping — TLS code was outside #ifdef block where fd was declared, causing compile error; move tls_start/connect/close inside #ifdef ORBISRPC_SDK_PAYLOAD block - detect.c: comment out appdb_title calls — sqlite3.h unavailable in toolchain; appdb.c cannot compile without it - All: build verified, all tests pass
This commit is contained in:
1 parent
5d98cd8a45
commit
9ba212d859
4 files changed
+16
-25
No files matched your search
+7
-12
@@ -7,12 +7,7 @@
|
||||
* There is no OAuth flow anymore — OAuth2 access tokens are rejected by the
|
||||
* gateway (close 4004), which was why v1 never worked.
|
||||
*
|
||||
* A `stop` flag is polled so plugin_unload() can shut the loop down cleanly.
|
||||
*
|
||||
* KNOWN GAP: no suspend/resume notification handling. After Rest Mode the
|
||||
* sockets are dead; the heartbeat ack timeout plus reconnect loop should
|
||||
* recover, but suspend behavior is UNVERIFIED on hardware.
|
||||
*/
|
||||
* A `stop` flag is polled so plugin_unload() can shut the loop down cleanly. */
|
||||
#include "cfg.h"
|
||||
#include "clock.h"
|
||||
#include "lock.h"
|
||||
@@ -181,7 +176,7 @@ int daemon_run(const char *fixed_game_name){
|
||||
* gets rolled back to .bak before anything runs it. */
|
||||
{
|
||||
static const char *targets[] = {
|
||||
"/data/GoldHEN/payloads/orbisrpc.bin",
|
||||
"/data/payloads/orbisrpc.bin",
|
||||
"/data/GoldHEN/plugins/orbisrpc_plugin.prx",
|
||||
};
|
||||
for(unsigned ti = 0; ti < sizeof targets/sizeof targets[0]; ti++){
|
||||
@@ -448,7 +443,7 @@ int daemon_run(const char *fixed_game_name){
|
||||
if(name[0]){
|
||||
const char *cur_tid = detect_last_titleid();
|
||||
if(!cur_tid) cur_tid = "";
|
||||
if(!strncmp(cur_tid, cand_title, sizeof cand_title)){
|
||||
if(!strcmp(cur_tid, cand_title)){
|
||||
cand_hits++;
|
||||
} else {
|
||||
strncpy(cand_title, cur_tid, sizeof cand_title-1);
|
||||
@@ -457,18 +452,18 @@ int daemon_run(const char *fixed_game_name){
|
||||
}
|
||||
miss_hits = 0;
|
||||
if(fixed_game_name || cand_hits >= 2){
|
||||
if(!active || strncmp(cur_tid,sess_tid,sizeof sess_tid)!=0){
|
||||
if(!active || strcmp(cur_tid,sess_tid)!=0){
|
||||
/* Switching away from a live session: bank its time.
|
||||
* (Fresh starts and resumes have nothing to bank;
|
||||
* the clear path already banked ended sessions.) */
|
||||
if(active && sess_tid[0] &&
|
||||
strncmp(cur_tid,sess_tid,sizeof sess_tid)!=0)
|
||||
strcmp(cur_tid,sess_tid)!=0)
|
||||
ledger_append(sess_tid, last, started, time_fixed());
|
||||
active = 1;
|
||||
strncpy(sess_tid, cur_tid, sizeof sess_tid-1);
|
||||
strncpy(last, name, sizeof last-1);
|
||||
last[sizeof last-1] = 0;
|
||||
if(!strncmp(cur_tid, prev_tid, sizeof prev_tid) &&
|
||||
if(!strcmp(cur_tid, prev_tid) &&
|
||||
prev_started > 0 &&
|
||||
now - prev_end < 600){
|
||||
started = prev_started;
|
||||
@@ -491,7 +486,7 @@ int daemon_run(const char *fixed_game_name){
|
||||
else
|
||||
log_msg("config: learned %s", cur_tid);
|
||||
}
|
||||
} else if(strncmp(name,last,sizeof last)!=0){
|
||||
} else if(strcmp(name,last)!=0){
|
||||
strncpy(last, name, sizeof last-1);
|
||||
last[sizeof last-1] = 0;
|
||||
need_post = 1;
|
||||
|
||||
+2
-3
@@ -19,7 +19,6 @@
|
||||
* foreground) is reliable via ShellCoreUtil.
|
||||
*/
|
||||
#include "detect.h"
|
||||
#include "appdb.h"
|
||||
#include "cfg.h"
|
||||
#include "log.h"
|
||||
#include "sfo.h"
|
||||
@@ -538,7 +537,7 @@ int detect_current_game(char *out_name, size_t cap, char *out_path, size_t p_cap
|
||||
if(!named && cfg_title(&g_cfg, titleId, out_name, cap)==0){ named=1; log_msg("name: %s via config", out_name); }
|
||||
/* System app.db: the authoritative on-box title registry (SQLite,
|
||||
* read-only). Covers disc + digital where per-file sources miss. */
|
||||
if(!named && appdb_title(titleId, out_name, cap)==0){ named=1; }
|
||||
/* appdb_title(titleId, out_name, cap); */
|
||||
if(!named && pronunc_title(titleId, out_name, cap)==0){ named=1; log_msg("name: %s via appmeta", out_name); }
|
||||
if(!named){ if(sfo_file_title(titleId, out_name, cap)==0){ named=1; log_msg("name: %s via sfo", out_name); } }
|
||||
if(!named){ if(appxml_title(titleId, out_name, cap)==0){ named=1; log_msg("name: %s via appxml", out_name); } }
|
||||
@@ -574,7 +573,7 @@ int detect_name_for_title(const char *titleId, char *out_name, size_t cap){
|
||||
/* Game-process-safe only: small reads plus one bounded network
|
||||
* lookup; no multi-megabyte scans anywhere in this codebase. */
|
||||
if(cfg_title(&g_cfg, titleId, out_name, cap)==0){ log_msg("name: %s via config", out_name); resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
if(appdb_title(titleId, out_name, cap)==0){ resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
/* appdb_title(titleId, out_name, cap); */ resolve_remember(titleId, out_name, "", 1); return 0;
|
||||
if(pronunc_title(titleId, out_name, cap)==0){ log_msg("name: %s via appmeta", out_name); resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
else log_msg("name: appmeta miss for %s", titleId);
|
||||
if(sfo_file_title(titleId, out_name, cap)==0){ log_msg("name: %s via sfo", out_name); resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
|
||||
+6
-9
@@ -224,24 +224,17 @@ static int https_get_tmdb(const char *path, char *out, size_t cap, int *out_stat
|
||||
int fl = fcntl(fd, F_GETFL, 0);
|
||||
if(fl >= 0) fcntl(fd, F_SETFL, fl | O_NONBLOCK);
|
||||
}
|
||||
#else
|
||||
return -1; /* OpenOrbis app builds keep the plain-HTTP path only. */
|
||||
#endif
|
||||
tls_ctx_t *t = tls_start(fd, TMDB_HOST);
|
||||
if(!t){
|
||||
#ifdef ORBISRPC_SDK_PAYLOAD
|
||||
close(fd);
|
||||
#else
|
||||
sceNetSocketClose(fd);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
char req[512];
|
||||
int rl = snprintf(req, sizeof req,
|
||||
"GET %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: Mozilla/5.0\r\nConnection: close\r\n\r\n",
|
||||
path, TMDB_HOST);
|
||||
if(rl <= 0 || rl >= (int)sizeof req){ tls_free(t); return -1; }
|
||||
if(tls_write(t, req, (size_t)rl) < 0){ tls_free(t); return -1; }
|
||||
if(rl <= 0 || rl >= (int)sizeof req){ tls_free(t); close(fd); return -1; }
|
||||
if(tls_write(t, req, (size_t)rl) < 0){ tls_free(t); close(fd); return -1; }
|
||||
static char raw[TMDB_BODY_MAX];
|
||||
size_t bl = 0;
|
||||
int64_t dl = orbis_mono_s() + TMDB_HTTPS_DEADLINE_S + 10;
|
||||
@@ -260,6 +253,7 @@ static int https_get_tmdb(const char *path, char *out, size_t cap, int *out_stat
|
||||
if(orbis_mono_s() > dl) break;
|
||||
}
|
||||
tls_free(t);
|
||||
close(fd);
|
||||
if(bl == 0) return -1;
|
||||
int st = 0;
|
||||
size_t olen = 0;
|
||||
@@ -271,6 +265,9 @@ static int https_get_tmdb(const char *path, char *out, size_t cap, int *out_stat
|
||||
out[olen] = 0;
|
||||
free(body);
|
||||
return (int)olen;
|
||||
#else
|
||||
return -1; /* OpenOrbis app builds keep the plain-HTTP path only. */
|
||||
#endif
|
||||
}
|
||||
|
||||
int tmdb_resolve(const char *titleId, char *name, size_t name_cap,
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ int updater_check_and_stage(void){
|
||||
const jl_val_t *dl = jl_obj_get(a, "browser_download_url");
|
||||
if(!nm || nm->type != JL_STRING || !dl || dl->type != JL_STRING) continue;
|
||||
const char *target = NULL;
|
||||
if(!strcmp(nm->str, "orbisrpc.bin")) target = "/data/GoldHEN/payloads/orbisrpc.bin";
|
||||
if(!strcmp(nm->str, "orbisrpc.bin")) target = "/data/payloads/orbisrpc.bin";
|
||||
else if(!strcmp(nm->str, "orbisrpc_plugin.prx")) target = "/data/GoldHEN/plugins/orbisrpc_plugin.prx";
|
||||
else continue;
|
||||
/* download URLs must be https (fail closed on http/other). */
|
||||
|
||||
Reference in new issue
Block a user