mirror of
https://github.com/MoHadiShibli/Control4Free.git
synced 2026-10-06 10:00:28 +02:00
Let Cross retry a failed start instead of asking for a restart
When Control4Free was sent but did not answer, the app locked itself until
the PS4 restarted, so two copies could never run. The payload already takes
care of that: a second copy finds the instance lock and quits at once. So
the app now says to press Cross to try again, and a restart never helped a
payload that cannot start anyway. The lock stays only for the app itself
failing to start ("Reopen the app").
This commit is contained in:
1 parent
745c16decf
commit
056a32f6c9
7 files changed
+17
-14
No files matched your search
@@ -34,8 +34,8 @@ Open **Control4Free** and press **Cross**. The app:
|
||||
1. copies the service to `/data/payloads/control4free.elf`;
|
||||
2. adds it to GoldHEN's AutoRun list, `/data/GoldHEN/payloads.ini`, so GoldHEN starts it every time it
|
||||
loads;
|
||||
3. starts it straight away if GoldHEN's **PayLoader** is on. If it isn't, restart the PS4 and run the
|
||||
jailbreak: AutoRun starts Control4Free from then on.
|
||||
3. starts it straight away if GoldHEN's **PayLoader** is on. If it isn't, turn PayLoader on in GoldHEN's
|
||||
settings and press **Cross** again. AutoRun also starts Control4Free each time GoldHEN loads.
|
||||
|
||||
Once it's running, the app shows the address to open, for example `http://192.168.1.20:4264`, and a QR code
|
||||
for your phone's camera. The PS4 also shows the address in a notification when the service starts.
|
||||
|
||||
@@ -91,8 +91,9 @@ run the jailbreak: with auto-start on, Control4Free starts by itself.
|
||||
**"Control4Free is not responding."** Wait a few seconds after the PS4 wakes from rest mode, then press
|
||||
**Cross** again. If it stays stuck, restart the PS4 and run the jailbreak.
|
||||
|
||||
**"Sent, but Control4Free never answered."** or **"The transfer to PayLoader broke off."** Restart the PS4
|
||||
before trying again. The app won't send a second copy until then, so two can't end up running.
|
||||
**"Sent, but Control4Free did not start."** or **"The transfer to PayLoader broke off."** Press **Cross** to
|
||||
try again. Two copies can't end up running: a second one quits at once. If it never starts, open an issue
|
||||
with your firmware and GoldHEN versions.
|
||||
|
||||
**"Something answers on port 4264 but not the way this app expects."** or **"No answer the app
|
||||
understands."** Something else is answering on port 4264, often an older version of Control4Free. Stop it
|
||||
|
||||
+1
-2
@@ -57,7 +57,7 @@ static void *c4fWorker(void *)
|
||||
if (quit) return NULL;
|
||||
if (command || c4fLauncherTimeMs() >= nextCheck) {
|
||||
char message[160] = {0}, address[64] = {0};
|
||||
int result = 0;
|
||||
[[maybe_unused]] int result = 0; /* read by the diagnostic build */
|
||||
/* The console's own address: shown for the phone or PC, and the
|
||||
* app's second way to reach Control4Free from its sandbox. */
|
||||
OrbisNetCtlInfo info;
|
||||
@@ -89,7 +89,6 @@ static void *c4fWorker(void *)
|
||||
int running = c4fLauncherProbe(&status);
|
||||
const char *problem = c4fLauncherProblem();
|
||||
pthread_mutex_lock(&c4fMutex);
|
||||
if (result == -2) c4fScreen.locked = 1;
|
||||
if (command) {
|
||||
snprintf(c4fScreen.message, sizeof(c4fScreen.message), "%s", message);
|
||||
} else if (!c4fScreen.locked &&
|
||||
|
||||
+4
-4
@@ -428,10 +428,10 @@ static C4fLook c4fLookFor(const C4fLauncherScreen *s, char *meta, size_t metaSiz
|
||||
"is running, stop it on its controller page or restart the PS4.",
|
||||
"Not responding", C4F_BAD, C4F_BAD, 0 };
|
||||
if (s->locked) {
|
||||
look.pill = look.meta = "Restart needed";
|
||||
look.title = "Restart the PS4";
|
||||
look.subtitle = "Control4Free was sent but never answered. Restart the console before you try again, so "
|
||||
"two copies never run at once.";
|
||||
look.pill = look.meta = "App error";
|
||||
look.title = "Reopen the app";
|
||||
look.subtitle = "The app could not start properly. Close it with the PS button and open it again. "
|
||||
"Control4Free itself is not affected.";
|
||||
} else if (s->busy) {
|
||||
look = (C4fLook){ "Working", "Please wait", s->message, "Checking", C4F_WARN, C4F_ACCENT, 0 };
|
||||
} else if (s->running == 1) {
|
||||
|
||||
+5
-3
@@ -242,7 +242,7 @@ int c4fLauncherStart(const unsigned char *payload, size_t payloadSize, char *mes
|
||||
if (fd < 0) { snprintf(message, size, "PayLoader did not answer (errno %d). Turn it on in GoldHEN, then press Cross again.", errno); return -1; }
|
||||
int failed = c4fSendAll(fd, payload, payloadSize, c4fLauncherTimeMs() + 10000);
|
||||
shutdown(fd, SHUT_WR); close(fd);
|
||||
if (failed) { snprintf(message, size, "The transfer to PayLoader broke off. Restart the PS4 before you try again."); return -2; }
|
||||
if (failed) { snprintf(message, size, "The transfer to PayLoader broke off. Press Cross to try again."); return -2; }
|
||||
uint64_t deadline;
|
||||
deadline = c4fLauncherTimeMs() + 20000;
|
||||
while (c4fLauncherTimeMs() < deadline) {
|
||||
@@ -251,8 +251,10 @@ int c4fLauncherStart(const unsigned char *payload, size_t payloadSize, char *mes
|
||||
}
|
||||
usleep(250000);
|
||||
}
|
||||
snprintf(message, size, "Sent, but Control4Free never answered (%s). Restart the PS4 before you try again.", c4fProblem);
|
||||
return -2; /* Caller locks further sends until restart, avoiding duplicates. */
|
||||
snprintf(message, size, "Sent, but Control4Free did not start (%s). Press Cross to try again.", c4fProblem);
|
||||
/* Sending again is safe: a copy that did start holds the payload's
|
||||
* instance lock, so a second one quits at once. */
|
||||
return -2;
|
||||
}
|
||||
|
||||
int c4fLauncherStop(char *message, size_t size)
|
||||
|
||||
@@ -21,6 +21,7 @@ int c4fLauncherProbe(C4fServiceStatus *status);
|
||||
/* Whether the last probe connected anywhere, so "no answer" can be told apart
|
||||
* from "cannot reach". */
|
||||
int c4fLauncherReached(void);
|
||||
/* 0 running, -1 not sent, -2 sent but Control4Free did not answer. */
|
||||
int c4fLauncherStart(const unsigned char *payload, size_t payloadSize, char *message, size_t size);
|
||||
int c4fLauncherStop(char *message, size_t size);
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
|
||||
s.running = -1; s.busy = 1; s.autorun = C4F_AUTORUN_UNKNOWN; message = "Setting up Control4Free. Please wait...";
|
||||
} else if (!strcmp(state, "locked")) {
|
||||
s.running = -1; s.locked = 1;
|
||||
message = "Sent, but Control4Free never answered (127.0.0.1 no reply). Restart the PS4 before you try again.";
|
||||
message = "Could not initialize launcher. Close with PS and retry.";
|
||||
} else if (!strcmp(state, "unknown")) {
|
||||
s.running = -1; s.autorun = C4F_AUTORUN_UNKNOWN;
|
||||
snprintf(s.autorunNote, sizeof(s.autorunNote), "GoldHEN did not let the app check (errno 78)");
|
||||
|
||||
Reference in new issue
Block a user