allow video capture in the main menu

This commit is contained in:
Lephenixnoir 2022-05-04 19:15:41 +01:00
parent d63cbce869
commit e87e228926
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 20 additions and 5 deletions

View File

@ -36,6 +36,9 @@
#include <libprof.h>
/* Record USB frames (used by main menu and game loop) */
bool rogue_life_video_capture = false;
int main(void)
{
/* Enable %f etc. in printf()-like functions */
@ -266,19 +269,18 @@ int main(void)
fkey_button(6, "PAUSE", debug.paused ? fg : C_WHITE);
}
static bool record = false;
if(keydown(KEY_F6) && keydown(KEY_ALPHA) && !keydown(KEY_VARS)
&& usb_is_open()) {
record = !record;
rogue_life_video_capture = !rogue_life_video_capture;
}
if(record) {
if(rogue_life_video_capture) {
usb_fxlink_videocapture(false);
}
/* Instead of dupdate(); for accurate performance measurements. Leaving
the DMA running during the simulation affects the results in extreme
proportions (can turn 1 ms of simulation into 11 ms measured) */
r61524_display(gint_vram, 0, 224, R61524_DMA_WAIT);
r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);
prof_leave(perf_render);
time_render = prof_time(perf_render);

View File

@ -5,6 +5,9 @@
#include <gint/cpu.h>
#include <gint/keyboard.h>
#include <gint/defs/util.h>
#include <gint/usb.h>
#include <gint/usb-ff-bulk.h>
#include <gint/drivers/r61524.h>
#include <stdlib.h>
typedef struct {
@ -122,12 +125,22 @@ int menu_level_select(int start)
dsubimage(ARROW2_X, 93, &img_menu_arrows, 35, 0, 35, 42,
DIMAGE_NONE);
dupdate();
r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);
for(int i = 0; i < OPTION_COUNT; i++)
menu_update_animations(options[i], dt);
int key = getkey_opt(GETKEY_MENU, &frame_tick).key;
extern bool rogue_life_video_capture;
if(key == KEY_F6 && keydown(KEY_ALPHA) && !keydown(KEY_VARS)
&& usb_is_open()) {
rogue_life_video_capture = !rogue_life_video_capture;
}
if(rogue_life_video_capture) {
usb_fxlink_videocapture(false);
}
if(transition_time <= fix(0.0)
&& key == KEY_LEFT && selection > 0) {
selection--;