Add arguments support to Daybreak

This commit is contained in:
flb 2021-08-08 17:28:06 +02:00
commit d159b54f6b
3 changed files with 15 additions and 1 deletions

View file

@ -261,7 +261,10 @@ class Daybreak : public CApplication {
int main(int argc, char **argv) {
/* Initialize the menu. */
dbk::InitializeMenu(FramebufferWidth, FramebufferHeight);
if (argc > 1)
dbk::InitializeMenu(FramebufferWidth, FramebufferHeight, argv[1]);
else
dbk::InitializeMenu(FramebufferWidth, FramebufferHeight);
Daybreak daybreak;
daybreak.run();

View file

@ -1265,6 +1265,16 @@ namespace dbk {
g_current_menu = std::make_shared<MainMenu>();
}
void InitializeMenu(u32 screen_width, u32 screen_height, const char *update_path) {
InitializeMenu(screen_width, screen_height);
/* Set the update path. */
snprintf(g_update_path, sizeof(g_update_path), "%s", update_path);
/* Change the menu. */
ChangeMenu(std::make_shared<ValidateUpdateMenu>(g_current_menu));
}
void UpdateMenu(u64 ns) {
DBK_ABORT_UNLESS(g_initialized);
DBK_ABORT_UNLESS(g_current_menu != nullptr);

View file

@ -264,6 +264,7 @@ namespace dbk {
};
void InitializeMenu(u32 screen_width, u32 screen_height);
void InitializeMenu(u32 screen_width, u32 screen_height, const char *update_path);
void UpdateMenu(u64 ns);
void RenderMenu(NVGcontext *vg, u64 ns);
bool IsExitRequested();