Skip to content

Commit

Permalink
games fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueMaster committed Sep 18, 2022
1 parent d27a0b7 commit bf964ff
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 24 deletions.
42 changes: 41 additions & 1 deletion applications/services/desktop/scenes/desktop_scene_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,54 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
}
break;
}
case DesktopMainEventOpenGameMenu: {
case DesktopMainEventOpenSnake: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/GAME_Snake.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
break;
}
case DesktopMainEventOpen2048: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/GAME_2048.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
break;
}
case DesktopMainEventOpenZombiez: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/GAME_Zombiez.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
break;
}
case DesktopMainEventOpenTetris: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/GAME_Tetris.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
break;
}
case DesktopMainEventOpenDOOM: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/GAME_DOOM.fap"));
if(status != LoaderStatusOk) {
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
break;
}
case DesktopMainEventOpenDice: {
LoaderStatus status = loader_start(
desktop->loader, "Applications", EXT_PATH("/apps/Games/GAME_Dice.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;
Expand Down
7 changes: 6 additions & 1 deletion applications/services/desktop/views/desktop_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ typedef enum {
DesktopMainEventOpenPassport,
DesktopMainEventOpenPowerOff,

DesktopMainEventOpenGameMenu,
DesktopMainEventOpenSnake,
DesktopMainEventOpen2048,
DesktopMainEventOpenZombiez,
DesktopMainEventOpenTetris,
DesktopMainEventOpenDOOM,
DesktopMainEventOpenDice,

DesktopLockedEventUnlocked,
DesktopLockedEventUpdate,
Expand Down
45 changes: 23 additions & 22 deletions applications/services/desktop/views/desktop_view_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,65 +71,66 @@ bool desktop_main_input_callback(InputEvent* event, void* context) {
} else if(event->key == InputKeyLeft) {
main_view->callback(DesktopMainEventOpenFavoritePrimary, main_view->context);
} else if(event->key == InputKeyRight) {
// Right key is handled by animation manager
// GOES TO PASSPORT NO MATTER WHAT
// THIS DOESNT WORK, PASSPORT WILL ONLY OPEN ON REGULAR RIGHT, NOTHING CAN GET ASSIGNED HERE
main_view->callback(DesktopMainEventOpenPassport, main_view->context);
}
} else if(event->type == InputTypeLong) {
if(event->key == InputKeyOk) {
main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context);
} else if(event->key == InputKeyUp) {
// main_view->callback(DesktopMainEventOpenFavoriteGame, main_view->context);
main_view->callback(DesktopMainEventOpenDOOM, main_view->context); // OPENS DOOM
} else if(event->key == InputKeyDown) {
// main_view->callback(DesktopMainEventOpenGames, main_view->context);
main_view->callback(DesktopMainEventOpenDebug, main_view->context);
main_view->callback(DesktopMainEventOpenZombiez, main_view->context); // OPENS Zombiez
} else if(event->key == InputKeyLeft) {
main_view->callback(DesktopMainEventOpenFavoriteSecondary, main_view->context);
} else if(event->key == InputKeyRight) {
// THIS DOESNT WORK
}
}
} else if(main_view->is_gamemode == true) {
if(event->type == InputTypeShort) {
if(event->key == InputKeyOk) {
// main_view->callback(DesktopMainEventOpenGames, main_view->context);
main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS SNAKE
main_view->callback(DesktopMainEventOpenDice, main_view->context); // OPENS Dice
} else if(event->key == InputKeyUp) {
// main_view->callback(DesktopMainEventOpenFavoriteGame, main_view->context);
main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS SNAKE
main_view->callback(DesktopMainEventOpenSnake, main_view->context); // OPENS SNAKE
} else if(event->key == InputKeyDown) {
// PREFER TO OPEN GAMES MENU
main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS SNAKE
main_view->callback(DesktopMainEventOpen2048, main_view->context); // OPENS 2048
} else if(event->key == InputKeyLeft) {
main_view->callback(DesktopMainEventOpenClock, main_view->context);
} else if(event->key == InputKeyRight) {
// GOES TO PASSPORT NO MATTER WHAT
}
} else if(event->type == InputTypeLong) {
if(event->key == InputKeyOk) {
main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context);
} else if(event->key == InputKeyUp) {
// main_view->callback(DesktopMainEventOpenFavoriteGame, main_view->context);
main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS SNAKE
main_view->callback(DesktopMainEventOpenDOOM, main_view->context); // OPENS DOOM
} else if(event->key == InputKeyDown) {
// main_view->callback(DesktopMainEventOpenGames, main_view->context);
main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS SNAKE
main_view->callback(DesktopMainEventOpenZombiez, main_view->context); // OPENS Zombiez
} else if(event->key == InputKeyLeft) {
main_view->callback(DesktopMainEventOpenClock, main_view->context);
} else if(event->key == InputKeyRight) {
// THIS DOESNT WORK, PASSPORT WILL ONLY OPEN ON REGULAR RIGHT, NOTHING CAN GET ASSIGNED HERE
main_view->callback(DesktopMainEventOpenTetris, main_view->context); // OPENS TETRIS
}
}
} else {
if(event->type == InputTypeShort) {
if(event->key == InputKeyOk) {
main_view->callback(DesktopMainEventOpenGameMenu, main_view->context); // OPENS SNAKE
main_view->callback(DesktopMainEventOpenDice, main_view->context); // OPENS Dice
} 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(DesktopMainEventOpen2048, main_view->context); // OPENS 2048
} else if(event->key == InputKeyLeft) {
main_view->callback(DesktopMainEventOpenPassport, main_view->context);
}
// 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(DesktopMainEventOpenSnake, main_view->context); // OPENS SNAKE
} else if(event->key == InputKeyDown) {
main_view->callback(DesktopMainEventOpenTetris, main_view->context); // OPENS TETRIS
} else if(event->key == InputKeyLeft) {
main_view->callback(DesktopMainEventOpenClock, main_view->context);
}
}
}

Expand Down

0 comments on commit bf964ff

Please sign in to comment.