From 2f1d20210bb855581685e390c8d3e700c3129af5 Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Wed, 26 Oct 2022 19:19:14 -0400 Subject: [PATCH 1/4] Add Dummy Mode Game Shortcuts to Scene & View --- .../desktop/scenes/desktop_scene_main.c | 40 +++++++++++++++++++ .../desktop/views/desktop_view_main.c | 16 ++++++-- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/applications/services/desktop/scenes/desktop_scene_main.c b/applications/services/desktop/scenes/desktop_scene_main.c index 341ad1fb5..8a2147f91 100644 --- a/applications/services/desktop/scenes/desktop_scene_main.c +++ b/applications/services/desktop/scenes/desktop_scene_main.c @@ -195,6 +195,46 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) { } break; } + case DesktopMainEventOpenTetris: { + LoaderStatus status = loader_start( + desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Tetris.fap")); + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } + break; + } + case DesktopMainEventOpenArkanoid: { + LoaderStatus status = loader_start( + desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Arkanoid.fap")); + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } + break; + } + case DesktopMainEventOpenDOOM: { + LoaderStatus status = loader_start( + desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/DOOM.fap")); + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } + break; + } + case DesktopMainEventOpenZombiez: { + LoaderStatus status = loader_start( + desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/Zombiez.fap")); + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } + break; + } + case DesktopMainEventOpenHeap: { + LoaderStatus status = loader_start( + desktop->loader, FAP_LOADER_APP_NAME, EXT_PATH("/apps/Games/heap_defence.fap")); + if(status != LoaderStatusOk) { + FURI_LOG_E(TAG, "loader_start failed: %d", status); + } + break; + } case DesktopLockedEventUpdate: desktop_view_locked_update(desktop->locked_view); consumed = true; diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index f893566fd..b0219cb02 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -74,15 +74,25 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { } else { if(event->type == InputTypeShort) { if(event->key == InputKeyOk) { - main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); + main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS Snake } else if(event->key == InputKeyUp) { main_view->callback(DesktopMainEventOpenLockMenu, main_view->context); } else if(event->key == InputKeyDown) { - main_view->callback(DesktopMainEventOpenPassport, main_view->context); + main_view->callback(DesktopMainEventOpenTetris, main_view->context); // OPENS Tetris } else if(event->key == InputKeyLeft) { - main_view->callback(DesktopMainEventOpenPassport, main_view->context); + main_view->callback(DesktopMainEventOpenArkanoid, main_view->context); // OPENS Arkanoid } // Right key is handled by animation manager + } else if(event->type == InputTypeLong) { + if(event->key == InputKeyOk) { + main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context); + } else if(event->key == InputKeyUp) { + main_view->callback(DesktopMainEventOpenDOOM, main_view->context); // OPENS DOOM + } else if(event->key == InputKeyDown) { + main_view->callback(DesktopMainEventOpenZombiez, main_view->context); // OPENS Zombiez + } else if(event->key == InputKeyLeft) { + main_view->callback(DesktopMainEventOpenHeap, main_view->context); // OPENS Heap Defence + } } } From 1d08a8aaa2882508708fa8f79e69a4f83405d8fb Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Wed, 26 Oct 2022 19:45:53 -0400 Subject: [PATCH 2/4] Added desktop_events entries that are needed --- applications/services/desktop/views/desktop_events.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/applications/services/desktop/views/desktop_events.h b/applications/services/desktop/views/desktop_events.h index 37413da2e..6917dbe73 100644 --- a/applications/services/desktop/views/desktop_events.h +++ b/applications/services/desktop/views/desktop_events.h @@ -12,6 +12,11 @@ typedef enum { DesktopMainEventLock, DesktopMainEventOpenGameMenu, + DesktopMainEventOpenTetris, + DesktopMainEventOpenArkanoid, + DesktopMainEventOpenDOOM, + DesktopMainEventOpenZombiez, + DesktopMainEventOpenHeap, DesktopLockedEventUnlocked, DesktopLockedEventUpdate, From 09fec6115338bce51b28bdfacf14e06c82ece6af Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 28 Oct 2022 17:24:10 +0300 Subject: [PATCH 3/4] ability to switch animations only when debug -> on --- .../desktop/views/desktop_view_main.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index b0219cb02..2b85d9f69 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -74,24 +74,31 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { } else { if(event->type == InputTypeShort) { if(event->key == InputKeyOk) { - main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS Snake + main_view->callback( + DesktopMainEventOpenGameMenu, main_view->context); // OPENS Snake } else if(event->key == InputKeyUp) { main_view->callback(DesktopMainEventOpenLockMenu, main_view->context); } else if(event->key == InputKeyDown) { - main_view->callback(DesktopMainEventOpenTetris, main_view->context); // OPENS Tetris + main_view->callback( + DesktopMainEventOpenTetris, main_view->context); // OPENS Tetris } else if(event->key == InputKeyLeft) { - main_view->callback(DesktopMainEventOpenArkanoid, main_view->context); // OPENS Arkanoid + main_view->callback( + DesktopMainEventOpenArkanoid, main_view->context); // OPENS Arkanoid } // Right key is handled by animation manager } else if(event->type == InputTypeLong) { if(event->key == InputKeyOk) { - main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context); + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { + main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context); + } } else if(event->key == InputKeyUp) { main_view->callback(DesktopMainEventOpenDOOM, main_view->context); // OPENS DOOM } else if(event->key == InputKeyDown) { - main_view->callback(DesktopMainEventOpenZombiez, main_view->context); // OPENS Zombiez + main_view->callback( + DesktopMainEventOpenZombiez, main_view->context); // OPENS Zombiez } else if(event->key == InputKeyLeft) { - main_view->callback(DesktopMainEventOpenHeap, main_view->context); // OPENS Heap Defence + main_view->callback( + DesktopMainEventOpenHeap, main_view->context); // OPENS Heap Defence } } } From fa7aa00f57f7ca3787cf59a1ed9bde28b08867dd Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 28 Oct 2022 17:30:53 +0300 Subject: [PATCH 4/4] also allow to use it not in dummy mode --- applications/services/desktop/views/desktop_view_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/applications/services/desktop/views/desktop_view_main.c b/applications/services/desktop/views/desktop_view_main.c index 2b85d9f69..b2beb538f 100644 --- a/applications/services/desktop/views/desktop_view_main.c +++ b/applications/services/desktop/views/desktop_view_main.c @@ -69,6 +69,10 @@ bool desktop_main_input_callback(InputEvent* event, void* context) { main_view->callback(DesktopMainEventOpenFavoriteSecondary, main_view->context); } else if(event->key == InputKeyUp) { main_view->callback(DesktopMainEventLock, main_view->context); + } else if(event->key == InputKeyOk) { + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { + main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context); + } } } } else {