mirror of
https://github.com/ApfelTeeSaft/vanilla.git
synced 2026-09-01 19:26:47 +00:00
* optimizations * Update menu_game.h * try new code * use cached EGLImages * try drm cache on pi * nani? * huh? * require opengl egl * find EGL * find EGL separately * logging * add support for versions of ffmpeg less than 6.0 * disable drm cache for now * Update ui_sdl.c * use old code for now * disable avcc hdr for now * restore error message * try disabling format modifiers? * tell me what the layer is * pi decoder actually produces frames in yuv420p * print more debug info * try this * switch to faster decode path * switch to old code * Update ui_sdl.c * add more timing profiling * more printing * enable some optimizations * draw menus when not in game mode * call render present * Update ui_sdl.c * Update ui_sdl.c * remove unused code * Update CMakeLists.txt * incorporate direct DRM code * Update CMakeLists.txt * free drm context and test old decoding code * move SDL event loop to separate thread so controls are not limited by display rate * add a wait to reduce CPU thrashing * fix double free * separate video into recv and consume threads * Update ui_sdl_drm.c * Update ui_sdl_drm.c * Update gamepad.c * further optimizations * anti-alias buttons more * fix some compiler errors * only include DRM on linux * fix windows compile issues * fix includes * Update CMakeLists.txt * add htobe32 define for macOS * Update video.c * Update gamepad.c
75 lines
1.7 KiB
C
75 lines
1.7 KiB
C
#include "menu.h"
|
|
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
#include <vanilla.h>
|
|
|
|
#include "menu_common.h"
|
|
#include "menu_game.h"
|
|
#include "menu_main.h"
|
|
#include "platform.h"
|
|
|
|
void vpi_mic_callback(void *userdata, const uint8_t *data, size_t len)
|
|
{
|
|
vanilla_send_audio(data, len);
|
|
}
|
|
|
|
void vpi_menu_init(vui_context_t *vui)
|
|
{
|
|
// Set microphone callback
|
|
vui_mic_callback_set(vui, vpi_mic_callback, 0);
|
|
|
|
// Start with main menu
|
|
vpi_menu_main(vui, 0);
|
|
}
|
|
|
|
void get_valid_filename(const char *fmt, char *abs_buf, size_t size_abs_buf)
|
|
{
|
|
char buf[100];
|
|
int index = 0;
|
|
do {
|
|
index++;
|
|
snprintf(buf, sizeof(buf), fmt, index);
|
|
vpi_get_data_filename(abs_buf, size_abs_buf, buf);
|
|
} while (access(abs_buf, F_OK) == 0);
|
|
}
|
|
|
|
void vpi_menu_action(vui_context_t *vui, vpi_extra_action_t action)
|
|
{
|
|
switch (action) {
|
|
case VPI_ACTION_SCREENSHOT:
|
|
{
|
|
char ss_fn[4096];
|
|
get_valid_filename("Screenshot-%04i.png", ss_fn, sizeof(ss_fn));
|
|
vpi_decode_screenshot(ss_fn);
|
|
break;
|
|
}
|
|
case VPI_ACTION_TOGGLE_RECORDING:
|
|
{
|
|
int recording = vpi_decode_is_recording();
|
|
if (!recording) {
|
|
char mov_fn[4096];
|
|
get_valid_filename("Recording-%04i.mp4", mov_fn, sizeof(mov_fn));
|
|
vpi_decode_record(mov_fn);
|
|
} else {
|
|
vpi_decode_record_stop();
|
|
}
|
|
break;
|
|
}
|
|
case VPI_ACTION_DISCONNECT:
|
|
{
|
|
if (vui_game_mode_get(vui)) {
|
|
// Send shutdown signal
|
|
vpi_game_shutdown();
|
|
} else {
|
|
// Quit Vanilla entirely
|
|
vpi_menu_quit_vanilla(vui);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|