Skip to content

Commit 12eebed

Browse files
authored
webOS: fix logging, pass mouse buttons, gamepad, function keys to RetroArch (#18419)
* webOS: fix logging crash on startup * webOS: fix for webOS 8.3 - 10+ to receive all mouse/pad/keyboard keys
1 parent fbc972b commit 12eebed

2 files changed

Lines changed: 30 additions & 28 deletions

File tree

Makefile.webos

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ define APPINFO
224224
"main": "retroarch",
225225
"iconColor": "#333333",
226226
"type": "native",
227-
"appDescription": "Emulation frontend"
227+
"appDescription": "Emulation frontend",
228+
"cloudgame_active": true,
229+
"useAllMouseButtons": true,
230+
"useAllKeyboardKeys": true
228231
}
229232
endef
230233
export APPINFO

libretro-common/features/features_cpu.c

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ void cpu_features_get_model_name(char *s, int len)
870870
if (pipe)
871871
{
872872
char buf[256];
873+
873874
while (fgets(buf, sizeof(buf), pipe))
874875
{
875876
if (strncmp(buf, "Model name:", 11) == 0)
@@ -881,46 +882,44 @@ void cpu_features_get_model_name(char *s, int len)
881882
while (*p == ' ' || *p == '\t') p++;
882883
size_t len2 = strcspn(p, "\r\n");
883884

884-
char *tmp = (char *)malloc(len2 + 1);
885-
if (tmp)
885+
if (len2 > 0)
886886
{
887-
memcpy(tmp, p, len2);
888-
tmp[len2] = '\0';
889-
890-
if (model_name && *model_name)
887+
char *tmp = malloc(len2 + 1);
888+
if (tmp)
891889
{
892-
size_t oldlen = strlen(model_name);
893-
char *combined = (char *)malloc(oldlen + len2 + 4);
894-
if (combined)
890+
memcpy(tmp, p, len2);
891+
tmp[len2] = '\0';
892+
893+
if (s[0] != '\0')
895894
{
896-
memcpy(combined, model_name, oldlen);
897-
combined[oldlen] = ' ';
898-
combined[oldlen + 1] = '(';
899-
memcpy(combined + oldlen + 2, tmp, len2);
900-
combined[oldlen + 2 + len2] = ')';
901-
combined[oldlen + 2 + len2 + 1] = '\0';
902-
free(model_name);
903-
model_name = combined;
895+
size_t oldlen = strlen(s);
896+
char *combined = malloc(oldlen + len2 + 4);
897+
if (combined)
898+
{
899+
memcpy(combined, s, oldlen);
900+
combined[oldlen] = ' ';
901+
combined[oldlen + 1] = '(';
902+
memcpy(combined + oldlen + 2, tmp, len2);
903+
combined[oldlen + 2 + len2] = ')';
904+
combined[oldlen + 2 + len2 + 1] = '\0';
905+
906+
strlcpy(s, combined, len);
907+
free(combined);
908+
}
909+
}
910+
else
911+
{
912+
strlcpy(s, tmp, len);
904913
}
905914
free(tmp);
906915
}
907-
else
908-
{
909-
free(model_name);
910-
model_name = tmp;
911-
}
912916
}
913917
}
914918
break;
915919
}
916920
}
917921
pclose(pipe);
918922
}
919-
920-
if (model_name)
921-
{
922-
strlcpy(s, model_name, len);
923-
}
924923
}
925924
#endif
926925
}

0 commit comments

Comments
 (0)