fixed some correctness issues

This commit is contained in:
itsmattkc committed 2026-08-26 14:25:07 -07:00
1 parent 1b2c4fa86c
commit 0681459cc8
6 files changed
+36 -14

No files matched your search

+3
View File
@@ -22,6 +22,9 @@ typedef uint32_t in_addr_t;
#include "menu_settings.h"
#include "pipemgmt.h"
#include "platform.h"
#ifdef ANDROID
#include "platform_android.h"
#endif
#include "ui/ui_anim.h"
#include "ui/ui_util.h"
+1 -1
View File
@@ -1119,8 +1119,8 @@ void vpi_display_update(vui_context_t *vui, int64_t time, void *v)
break;
default:
// Something went wrong, assume we must fail and report to user
pthread_join(vpi_event_thread, 0);
vanilla_stop();
pthread_join(vpi_event_thread, 0);
if (vpi_game_queued_error != VANILLA_ERR_SHUTDOWN) {
show_error(vui, (void*)(intptr_t) vpi_game_queued_error);
} else {
+3 -3
View File
@@ -459,14 +459,14 @@ int vpi_start_pipe()
Dl_info info;
if (!dladdr((void *) &vpi_start_pipe, &info) || !info.dli_fname) {
vpilog("Could not get running path of current Android executable\n");
return VANILLA_ERR_GENERIC;
_exit(1);
}
// Copy path into our own string
char our_path[PATH_MAX];
if (snprintf(our_path, sizeof(our_path), "%s", info.dli_fname) >= sizeof(our_path)) {
vpilog("Android library path too long - this is a bug, tell maintainers\n");
return VANILLA_ERR_GENERIC;
_exit(1);
}
// Get dirname of string and add libvanilla_pipe.so
@@ -474,7 +474,7 @@ int vpi_start_pipe()
char pipe_path[PATH_MAX];
if (snprintf(pipe_path, sizeof(pipe_path), "%s/libvanilla_pipe.so", library_dir) >= sizeof(pipe_path)) {
vpilog("Android pipe path too long - this is a bug, tell maintainers\n");
return VANILLA_ERR_GENERIC;
_exit(1);
}
char command[PATH_MAX + 256];
+1
View File
@@ -3,6 +3,7 @@
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
// Check for whether we have root access on Android (required to run vanilla-pipe)
+14 -1
View File
@@ -1682,6 +1682,15 @@ void vui_draw_sdl(vui_context_t *ctx, SDL_Renderer *renderer)
int get_texture_from_cpu_frame(vui_sdl_context_t *sdl_ctx, AVFrame *f)
{
#ifdef ANDROID
// If we were using the Android texture, but for some reason switched to
// software decoding, ensure our game_tex gets correctly recreated
if (sdl_ctx->game_tex == sdl_ctx->android_video_tex) {
sdl_ctx->game_tex = NULL;
sdl_ctx->android_video_ready = 0;
}
#endif
if (!sdl_ctx->game_tex) {
sdl_ctx->game_tex = SDL_CreateTexture(
sdl_ctx->renderer,
@@ -2158,11 +2167,15 @@ int vui_update_sdl(vui_context_t *vui)
vpilog("MediaCodec produced a frame without an Android video surface\n");
break;
}
if (sdl_ctx->game_tex && sdl_ctx->game_tex != sdl_ctx->android_video_tex) {
SDL_DestroyTexture(sdl_ctx->game_tex);
}
sdl_ctx->game_tex = sdl_ctx->android_video_tex;
sdl_ctx->android_video_ready = 0;
if (av_mediacodec_release_buffer(buffer, 1) < 0) {
vpilog("Failed to render MediaCodec output buffer\n");
break;
}
sdl_ctx->game_tex = sdl_ctx->android_video_tex;
break;
}
#endif
+14 -9
View File
@@ -159,17 +159,22 @@ int send_pipe_cc(int skt, vanilla_pipe_command_t *cmd, size_t cmd_size, int wait
}
read_size = recv(skt, &recv_cc, sizeof(recv_cc), 0);
if (recv_cc == VANILLA_PIPE_CC_BIND_ACK) {
return 1;
}
if (recv_cc == VANILLA_PIPE_CC_BUSY) {
return -1;
}
if (read_size < 0) {
if (read_size == sizeof(recv_cc)) {
if (recv_cc == VANILLA_PIPE_CC_BIND_ACK) {
return 1;
}
if (recv_cc == VANILLA_PIPE_CC_BUSY) {
if (retries == MAX_PIPE_RETRY - 1) {
return -1;
}
vanilla_log("PIPE BUSY, RETRYING");
} else {
vanilla_log("UNEXPECTED PIPE REPLY: 0x%02x", recv_cc);
}
} else if (read_size < 0) {
vanilla_log("STILL WAITING FOR REPLY: %i", skterr());
} else {
vanilla_log("UNEXPECTED PIPE REPLY: 0x%02x", recv_cc);
vanilla_log("UNEXPECTED PIPE REPLY SIZE: %zi", read_size);
}
sleep(1);