diff --git a/src/main.c b/src/main.c index 50fca21..0bb17cd 100644 --- a/src/main.c +++ b/src/main.c @@ -36,6 +36,9 @@ #include +/* 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); diff --git a/src/menu.c b/src/menu.c index 41af394..e468ea5 100644 --- a/src/menu.c +++ b/src/menu.c @@ -5,6 +5,9 @@ #include #include #include +#include +#include +#include #include 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--;