This commit is contained in:
Willy-JL
2023-06-09 16:16:33 +01:00
20 changed files with 85 additions and 13 deletions

View File

@@ -397,6 +397,9 @@ int32_t arkanoid_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
GameEvent event;
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@@ -275,6 +275,7 @@ void dealer_tick(GameState* game_state) {
if(dealer_score >= DEALER_MAX) {
if(dealer_score > 21 || dealer_score < player_score) {
// dolphin_deed(DolphinDeedPluginGameWin);
enqueue(
&(game_state->queue_state),
game_state,
@@ -568,6 +569,9 @@ int32_t blackjack_app(void* p) {
AppEvent event;
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
furi_mutex_acquire(game_state->mutex, FuriWaitForever);

View File

@@ -382,6 +382,7 @@ int32_t bomberduck_app(void* p) {
return 255;
}
// dolphin_deed(DolphinDeedPluginGameStart);
// Создаем новый view port
ViewPort* view_port = view_port_alloc();
// Создаем callback отрисовки, без контекста
@@ -455,6 +456,9 @@ int32_t bomberduck_app(void* p) {
notification_message(notification, &end);
world.running = 0;
world.level += 1;
// if(world.level % 5 == 0) {
// dolphin_deed(DolphinDeedPluginGameWin);
// }
}
for(int i = 0; i < world.bombs_count; i++) {
if(furi_get_tick() - world.bombs[i].planted >

View File

@@ -995,6 +995,9 @@ int32_t doom_app() {
music_player_worker_load_rtttl_from_string(plugin_state->music_instance->worker, dsintro);
music_player_worker_start(plugin_state->music_instance->worker);
#endif
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);

View File

@@ -307,6 +307,9 @@ int32_t flappy_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
GameEvent event;
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@@ -462,6 +462,9 @@ int32_t game15_app() {
sandbox_init(
FPS, (SandboxRenderCallback)render_callback, (SandboxEventHandler)game_event_handler);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
sandbox_loop();
sandbox_free();
game_free();

View File

@@ -399,6 +399,9 @@ int32_t game_2048_app() {
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
bool is_finished = false;
while(!is_finished) {
FuriStatus event_status = furi_message_queue_get(event_queue, &input, FuriWaitForever);

View File

@@ -533,6 +533,9 @@ int32_t heap_defence_app(void* p) {
game->game_status = 0;
game->animation = AnimationPause;
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
GameEvent event = {0};
while(event.input.key != InputKeyBack) {
if(furi_message_queue_get(event_queue, &event, 100) != FuriStatusOk) {

View File

@@ -237,6 +237,9 @@ static bool game_won(Minesweeper* minesweeper_state) {
message, furi_string_get_cstr(tempStr), 64, 32, AlignCenter, AlignCenter);
dialog_message_set_buttons(message, NULL, "Play again", NULL);
// Call dolphin deed when we win the game
// dolphin_deed(DolphinDeedPluginGameWin);
DialogMessageButton choice = dialog_message_show(minesweeper_state->dialogs, message);
dialog_message_free(message);
furi_string_free(tempStr);
@@ -391,6 +394,9 @@ int32_t minesweeper_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
PluginEvent event;
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@@ -275,6 +275,7 @@ void tick(GameState* game_state, NotificationApp* notification) {
if(game_state->state == GameStatePlay) {
if(game_state->top_cards[0].character == 11 && game_state->top_cards[1].character == 11 &&
game_state->top_cards[2].character == 11 && game_state->top_cards[3].character == 11) {
// dolphin_deed(DolphinDeedPluginGameWin);
game_state->state = GameStateAnimate;
return;
}
@@ -489,6 +490,9 @@ int32_t solitaire_app(void* p) {
AppEvent event;
// Call Dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 150);
furi_mutex_acquire(game_state->mutex, FuriWaitForever);

View File

@@ -3130,6 +3130,8 @@ int32_t swd_probe_app_main(void* p) {
DBGS("swd_execute_script");
swd_execute_script(app, ANY_PATH("swd_scripts/startup.swd"));
// dolphin_deed(DolphinDeedPluginGameStart);
DBGS("processing");
for(bool processing = true; processing;) {
swd_main_loop(app);

View File

@@ -387,6 +387,9 @@ int32_t tetris_game_app() {
Piece* newPiece = malloc(sizeof(Piece));
uint8_t downRepeatCounter = 0;
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) {
// This 10U implicitly sets the game loop speed. downRepeatCounter relies on this value
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 10U);

View File

@@ -331,6 +331,9 @@ int32_t tictactoe_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
GameEvent event;
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@@ -171,6 +171,9 @@ int32_t totp_app() {
return 253;
}
// Affecting dolphin level
// dolphin_deed(DolphinDeedPluginStart);
// Set system callbacks
ViewPort* view_port = view_port_alloc();
view_port_draw_callback_set(view_port, render_callback, plugin_state);

View File

@@ -313,6 +313,9 @@ int32_t zombiez_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
// dolphin_deed(DolphinDeedPluginGameStart);
PluginEvent event;
bool isRunning = true;
while(isRunning) {

View File

@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,30.0,,
Version,+,30.1,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
1 entry status name type params
2 Version + 30.0 30.1
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h

View File

@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,30.0,,
Version,+,30.1,,
Header,+,applications/main/archive/helpers/favorite_timeout.h,,
Header,+,applications/main/fap_loader/fap_loader_app.h,,
Header,+,applications/main/subghz/helpers/subghz_txrx.h,,
@@ -2052,7 +2052,7 @@ Function,-,mf_classic_dict_get_total_keys,uint32_t,MfClassicDict*
Function,-,mf_classic_dict_is_key_present,_Bool,"MfClassicDict*, uint8_t*"
Function,-,mf_classic_dict_is_key_present_str,_Bool,"MfClassicDict*, FuriString*"
Function,-,mf_classic_dict_rewind,_Bool,MfClassicDict*
Function,-,mf_classic_emulator,_Bool,"MfClassicEmulator*, FuriHalNfcTxRxContext*"
Function,-,mf_classic_emulator,_Bool,"MfClassicEmulator*, FuriHalNfcTxRxContext*, _Bool"
Function,-,mf_classic_get_classic_type,MfClassicType,FuriHalNfcADevData*
Function,-,mf_classic_get_read_sectors_and_keys,void,"MfClassicData*, uint8_t*, uint8_t*"
Function,-,mf_classic_get_sector_by_block,uint8_t,uint8_t
1 entry status name type params
2 Version + 30.0 30.1
3 Header + applications/main/archive/helpers/favorite_timeout.h
4 Header + applications/main/fap_loader/fap_loader_app.h
5 Header + applications/main/subghz/helpers/subghz_txrx.h
2052 Function - mf_classic_dict_is_key_present _Bool MfClassicDict*, uint8_t*
2053 Function - mf_classic_dict_is_key_present_str _Bool MfClassicDict*, FuriString*
2054 Function - mf_classic_dict_rewind _Bool MfClassicDict*
2055 Function - mf_classic_emulator _Bool MfClassicEmulator*, FuriHalNfcTxRxContext* MfClassicEmulator*, FuriHalNfcTxRxContext*, _Bool
2056 Function - mf_classic_get_classic_type MfClassicType FuriHalNfcADevData*
2057 Function - mf_classic_get_read_sectors_and_keys void MfClassicData*, uint8_t*, uint8_t*
2058 Function - mf_classic_get_sector_by_block uint8_t uint8_t

View File

@@ -1092,7 +1092,7 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
memcpy(current_key, &key, 6);
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
found_key == current_key) {
memcmp(found_key, current_key, 6) == 0) {
mf_classic_set_key_not_found(data, i, MfClassicKeyA);
is_key_a_found = false;
FURI_LOG_D(TAG, "Key %dA not found in attack", i);
@@ -1118,7 +1118,7 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
memcpy(current_key, &key, 6);
if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
found_key == current_key) {
memcmp(found_key, current_key, 6) == 0) {
mf_classic_set_key_not_found(data, i, MfClassicKeyB);
is_key_b_found = false;
FURI_LOG_D(TAG, "Key %dB not found in attack", i);
@@ -1163,7 +1163,7 @@ void nfc_worker_emulate_mf_classic(NfcWorker* nfc_worker) {
furi_hal_nfc_listen_start(nfc_data);
while(nfc_worker->state == NfcWorkerStateMfClassicEmulate) { //-V1044
if(furi_hal_nfc_listen_rx(&tx_rx, 300)) {
mf_classic_emulator(&emulator, &tx_rx);
mf_classic_emulator(&emulator, &tx_rx, false);
}
}
if(emulator.data_changed) {
@@ -1448,7 +1448,7 @@ void nfc_worker_analyze_reader(NfcWorker* nfc_worker) {
NfcProtocol protocol =
reader_analyzer_guess_protocol(reader_analyzer, tx_rx.rx_data, tx_rx.rx_bits / 8);
if(protocol == NfcDeviceProtocolMifareClassic) {
mf_classic_emulator(&emulator, &tx_rx);
mf_classic_emulator(&emulator, &tx_rx, true);
}
} else {
reader_no_data_received_cnt++;

View File

@@ -850,7 +850,10 @@ uint8_t mf_classic_update_card(FuriHalNfcTxRxContext* tx_rx, MfClassicData* data
return sectors_read;
}
bool mf_classic_emulator(MfClassicEmulator* emulator, FuriHalNfcTxRxContext* tx_rx) {
bool mf_classic_emulator(
MfClassicEmulator* emulator,
FuriHalNfcTxRxContext* tx_rx,
bool is_reader_analyzer) {
furi_assert(emulator);
furi_assert(tx_rx);
bool command_processed = false;
@@ -897,11 +900,27 @@ bool mf_classic_emulator(MfClassicEmulator* emulator, FuriHalNfcTxRxContext* tx_
MfClassicSectorTrailer* sector_trailer =
(MfClassicSectorTrailer*)emulator->data.block[sector_trailer_block].value;
if(cmd == MF_CLASSIC_AUTH_KEY_A_CMD) {
key = nfc_util_bytes2num(sector_trailer->key_a, 6);
access_key = MfClassicKeyA;
if(mf_classic_is_key_found(
&emulator->data, mf_classic_get_sector_by_block(block), MfClassicKeyA) ||
is_reader_analyzer) {
key = nfc_util_bytes2num(sector_trailer->key_a, 6);
access_key = MfClassicKeyA;
} else {
FURI_LOG_D(TAG, "Key not known");
command_processed = true;
break;
}
} else {
key = nfc_util_bytes2num(sector_trailer->key_b, 6);
access_key = MfClassicKeyB;
if(mf_classic_is_key_found(
&emulator->data, mf_classic_get_sector_by_block(block), MfClassicKeyB) ||
is_reader_analyzer) {
key = nfc_util_bytes2num(sector_trailer->key_b, 6);
access_key = MfClassicKeyB;
} else {
FURI_LOG_D(TAG, "Key not known");
command_processed = true;
break;
}
}
uint32_t nonce = prng_successor(DWT->CYCCNT, 32) ^ 0xAA;

View File

@@ -199,7 +199,10 @@ uint8_t mf_classic_read_card(
uint8_t mf_classic_update_card(FuriHalNfcTxRxContext* tx_rx, MfClassicData* data);
bool mf_classic_emulator(MfClassicEmulator* emulator, FuriHalNfcTxRxContext* tx_rx);
bool mf_classic_emulator(
MfClassicEmulator* emulator,
FuriHalNfcTxRxContext* tx_rx,
bool is_reader_analyzer);
void mf_classic_halt(FuriHalNfcTxRxContext* tx_rx, Crypto1* crypto);