mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
Fuzzers App: gui start
This commit is contained in:
30
applications/external/pacs_fuzzer/scenes/fuzzer_scene.c
vendored
Normal file
30
applications/external/pacs_fuzzer/scenes/fuzzer_scene.c
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "fuzzer_scene.h"
|
||||
|
||||
// Generate scene on_enter handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
|
||||
void (*const fuzzer_scene_on_enter_handlers[])(void*) = {
|
||||
#include "fuzzer_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_event handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
|
||||
bool (*const fuzzer_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = {
|
||||
#include "fuzzer_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_exit handlers array
|
||||
#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
|
||||
void (*const fuzzer_scene_on_exit_handlers[])(void* context) = {
|
||||
#include "fuzzer_scene_config.h"
|
||||
};
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Initialize scene handlers configuration structure
|
||||
const SceneManagerHandlers fuzzer_scene_handlers = {
|
||||
.on_enter_handlers = fuzzer_scene_on_enter_handlers,
|
||||
.on_event_handlers = fuzzer_scene_on_event_handlers,
|
||||
.on_exit_handlers = fuzzer_scene_on_exit_handlers,
|
||||
.scene_num = FuzzerSceneNum,
|
||||
};
|
||||
29
applications/external/pacs_fuzzer/scenes/fuzzer_scene.h
vendored
Normal file
29
applications/external/pacs_fuzzer/scenes/fuzzer_scene.h
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <gui/scene_manager.h>
|
||||
|
||||
// Generate scene id and total number
|
||||
#define ADD_SCENE(prefix, name, id) FuzzerScene##id,
|
||||
typedef enum {
|
||||
#include "fuzzer_scene_config.h"
|
||||
FuzzerSceneNum,
|
||||
} FuzzerScene;
|
||||
#undef ADD_SCENE
|
||||
|
||||
extern const SceneManagerHandlers fuzzer_scene_handlers;
|
||||
|
||||
// Generate scene on_enter handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*);
|
||||
#include "fuzzer_scene_config.h"
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_event handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) \
|
||||
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event);
|
||||
#include "fuzzer_scene_config.h"
|
||||
#undef ADD_SCENE
|
||||
|
||||
// Generate scene on_exit handlers declaration
|
||||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context);
|
||||
#include "fuzzer_scene_config.h"
|
||||
#undef ADD_SCENE
|
||||
1
applications/external/pacs_fuzzer/scenes/fuzzer_scene_config.h
vendored
Normal file
1
applications/external/pacs_fuzzer/scenes/fuzzer_scene_config.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ADD_SCENE(fuzzer, main, Main)
|
||||
41
applications/external/pacs_fuzzer/scenes/fuzzer_scene_main.c
vendored
Normal file
41
applications/external/pacs_fuzzer/scenes/fuzzer_scene_main.c
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "../fuzzer_i.h"
|
||||
#include "../helpers/fuzzer_custom_event.h"
|
||||
|
||||
void fuzzer_scene_main_callback(FuzzerCustomEvent event, void* context) {
|
||||
furi_assert(context);
|
||||
PacsFuzzerApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
||||
}
|
||||
|
||||
void fuzzer_scene_main_on_enter(void* context) {
|
||||
furi_assert(context);
|
||||
PacsFuzzerApp* app = context;
|
||||
|
||||
fuzzer_view_main_set_callback(app->main_view, fuzzer_scene_main_callback, app);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, FuzzerViewIDMain);
|
||||
}
|
||||
|
||||
bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
furi_assert(context);
|
||||
PacsFuzzerApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == FuzzerCustomEventViewMainBack) {
|
||||
if(!scene_manager_previous_scene(app->scene_manager)) {
|
||||
scene_manager_stop(app->scene_manager);
|
||||
view_dispatcher_stop(app->view_dispatcher);
|
||||
}
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void fuzzer_scene_main_on_exit(void* context) {
|
||||
// furi_assert(context);
|
||||
// PacsFuzzerApp* app = context;
|
||||
UNUSED(context);
|
||||
}
|
||||
Reference in New Issue
Block a user