Skip to content

armgit / PS5LM

Public Imported from GitHub
0

llama.cpp on a jailbroken PS5: run any GGUF model natively on the console, starting with Qwen 3.8

App: floats in requests no longer stop the server

Mert Cobanov4f57e0e275ba
diff --git a/ps5/app/compat_app.c b/ps5/app/compat_app.c
index 32da530..4662b09 100644
--- a/ps5/app/compat_app.c
+++ b/ps5/app/compat_app.c
@@ -6,6 +6,8 @@
*/
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
+#include <locale.h>
#include <pwd.h>
#include <stddef.h>
#include <time.h>
@@ -263,3 +265,21 @@ int accept4(int s, struct sockaddr *restrict addr, socklen_t *restrict addrlen,
/* ps5-homebrew-ui's system.cpp calls this before hiding the splash, for apps
* whose runtime holds the request back; PS5LM's does not. */
void hui_release_splash(void) {}
+
+/* The console reports an empty decimal point while its strtod reads '.'
+ * (PS5_Vulkan docs/RADV_PHASE.md). nlohmann::json puts the reported point into
+ * a number before strtod, so a float in any request ("temperature": 0.7) failed
+ * its assertion and took the server down. This is the C locale's. */
+struct lconv *localeconv(void) {
+ static struct lconv c = {
+ .decimal_point = ".", .thousands_sep = "", .grouping = "",
+ .int_curr_symbol = "", .currency_symbol = "", .mon_decimal_point = "",
+ .mon_thousands_sep = "", .mon_grouping = "", .positive_sign = "", .negative_sign = "",
+ .int_frac_digits = CHAR_MAX, .frac_digits = CHAR_MAX, .p_cs_precedes = CHAR_MAX,
+ .p_sep_by_space = CHAR_MAX, .n_cs_precedes = CHAR_MAX, .n_sep_by_space = CHAR_MAX,
+ .p_sign_posn = CHAR_MAX, .n_sign_posn = CHAR_MAX, .int_p_cs_precedes = CHAR_MAX,
+ .int_n_cs_precedes = CHAR_MAX, .int_p_sep_by_space = CHAR_MAX, .int_n_sep_by_space = CHAR_MAX,
+ .int_p_sign_posn = CHAR_MAX, .int_n_sign_posn = CHAR_MAX,
+ };
+ return &c;
+}