mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-24 11:39:17 +01:00
Moved RTC update function outside of draw procedure
Previous implementation caused increased drawing time when RTC datetime needed update every second
This commit is contained in:
parent
57dff16ec7
commit
65a7775964
@ -1,4 +1,5 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include <libdragon.h>
|
#include <libdragon.h>
|
||||||
|
|
||||||
@ -162,6 +163,8 @@ void menu_run (boot_params_t *boot_params) {
|
|||||||
boot_pending = true;
|
boot_pending = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time(&menu->current_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (audio_can_write()) {
|
while (audio_can_write()) {
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#define MENU_STRUCT_H__
|
#define MENU_STRUCT_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
#include "boot/boot.h"
|
#include "boot/boot.h"
|
||||||
#include "flashcart/flashcart.h"
|
#include "flashcart/flashcart.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
@ -64,6 +65,8 @@ typedef struct {
|
|||||||
|
|
||||||
char *error_message;
|
char *error_message;
|
||||||
|
|
||||||
|
time_t current_time;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool go_up;
|
bool go_up;
|
||||||
bool go_down;
|
bool go_down;
|
||||||
|
@ -262,14 +262,12 @@ static void draw (menu_t *menu, surface_t *d) {
|
|||||||
menu->browser.entries == 0 ? "" : "R: Info"
|
menu->browser.entries == 0 ? "" : "R: Info"
|
||||||
);
|
);
|
||||||
|
|
||||||
time_t current_time = time(NULL);
|
if (menu->current_time >= 0) {
|
||||||
|
|
||||||
if (current_time >= 0) {
|
|
||||||
component_actions_bar_text_draw(
|
component_actions_bar_text_draw(
|
||||||
ALIGN_CENTER, VALIGN_TOP,
|
ALIGN_CENTER, VALIGN_TOP,
|
||||||
"\n"
|
"\n"
|
||||||
"%s",
|
"%s",
|
||||||
ctime(¤t_time)
|
ctime(&menu->current_time)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user