mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
mlib updates
This commit is contained in:
@@ -239,8 +239,8 @@ static uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool
|
||||
|
||||
static int32_t
|
||||
ducky_parse_line(BadUsbScript* bad_usb, FuriString* line, char* error, size_t error_len) {
|
||||
uint32_t line_len = string_size(line);
|
||||
const char* line_tmp = string_get_cstr(line);
|
||||
uint32_t line_len = furi_string_size(line);
|
||||
const char* line_tmp = furi_string_get_cstr(line);
|
||||
bool state = false;
|
||||
|
||||
for(uint32_t i = 0; i < line_len; i++) {
|
||||
|
||||
@@ -29,13 +29,13 @@ bool nfc_mf_ultralight_emulate_worker_callback(NfcWorkerEvent event, void* conte
|
||||
// text box right here
|
||||
MfUltralightAuth* auth = nfc_worker_get_event_data(nfc->worker);
|
||||
if(auth != NULL &&
|
||||
string_size(nfc->text_box_store) < NFC_SCENE_MF_ULTRALIGHT_EMULATE_LOG_SIZE_MAX) {
|
||||
string_cat(nfc->text_box_store, "PWD:");
|
||||
furi_string_size(nfc->text_box_store) < NFC_SCENE_MF_ULTRALIGHT_EMULATE_LOG_SIZE_MAX) {
|
||||
furi_string_cat(nfc->text_box_store, "PWD:");
|
||||
for(size_t i = 0; i < sizeof(auth->pwd.raw); ++i) {
|
||||
string_cat_printf(nfc->text_box_store, " %02X", auth->pwd.raw[i]);
|
||||
furi_string_cat_printf(nfc->text_box_store, " %02X", auth->pwd.raw[i]);
|
||||
}
|
||||
string_push_back(nfc->text_box_store, '\n');
|
||||
text_box_set_text(nfc->text_box, string_get_cstr(nfc->text_box_store));
|
||||
furi_string_push_back(nfc->text_box_store, '\n');
|
||||
text_box_set_text(nfc->text_box, furi_string_get_cstr(nfc->text_box_store));
|
||||
}
|
||||
state |= NfcSceneMfUltralightEmulateStateAuthAttempted;
|
||||
}
|
||||
@@ -60,18 +60,18 @@ void nfc_scene_mf_ultralight_emulate_widget_callback(
|
||||
void nfc_scene_mf_ultralight_emulate_widget_config(Nfc* nfc, bool auth_attempted) {
|
||||
Widget* widget = nfc->widget;
|
||||
widget_reset(widget);
|
||||
string_t info_str;
|
||||
string_init(info_str);
|
||||
FuriString* info_str;
|
||||
info_str = furi_string_alloc();
|
||||
|
||||
widget_add_icon_element(widget, 0, 3, &I_RFIDDolphinSend_97x61);
|
||||
if(strcmp(nfc->dev->dev_name, "")) {
|
||||
string_printf(info_str, "Emulating\n%s", nfc->dev->dev_name);
|
||||
furi_string_printf(info_str, "Emulating\n%s", nfc->dev->dev_name);
|
||||
} else {
|
||||
string_printf(info_str, "Emulating\nMf Ultralight");
|
||||
furi_string_printf(info_str, "Emulating\nMf Ultralight");
|
||||
}
|
||||
|
||||
widget_add_string_multiline_element(
|
||||
widget, 56, 31, AlignLeft, AlignTop, FontPrimary, string_get_cstr(info_str));
|
||||
widget, 56, 31, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(info_str));
|
||||
string_clear(info_str);
|
||||
if(auth_attempted) {
|
||||
widget_add_button_element(
|
||||
@@ -96,7 +96,7 @@ void nfc_scene_mf_ultralight_emulate_on_enter(void* context) {
|
||||
TextBox* text_box = nfc->text_box;
|
||||
text_box_set_font(text_box, TextBoxFontHex);
|
||||
text_box_set_focus(text_box, TextBoxFocusEnd);
|
||||
string_reset(nfc->text_box_store);
|
||||
furi_string_reset(nfc->text_box_store);
|
||||
|
||||
// Set Widget state and view
|
||||
state = (state & ~NfcSceneMfUltralightEmulateStateMax) |
|
||||
@@ -172,7 +172,7 @@ void nfc_scene_mf_ultralight_emulate_on_exit(void* context) {
|
||||
// Clear view
|
||||
widget_reset(nfc->widget);
|
||||
text_box_reset(nfc->text_box);
|
||||
string_reset(nfc->text_box_store);
|
||||
furi_string_reset(nfc->text_box_store);
|
||||
|
||||
nfc_blink_stop(nfc);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
||||
__LL_RTC_CONVERT_BCD2BIN((time >> 8) & 0xFF) // DAY
|
||||
);
|
||||
|
||||
string_printf(
|
||||
furi_string_printf(
|
||||
temp_str, "%s/%s%s", SUBGHZ_RAW_FOLDER, strings[0], SUBGHZ_APP_EXTENSION);
|
||||
subghz_protocol_raw_gen_fff_data(subghz->txrx->fff_data, furi_string_get_cstr(temp_str));
|
||||
furi_string_free(temp_str);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <gui/gui.h>
|
||||
#include <input/input.h>
|
||||
#include <m-string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum {
|
||||
@@ -126,7 +125,7 @@ static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queu
|
||||
}
|
||||
|
||||
static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
string_t tempStr;
|
||||
FuriString* tempStr;
|
||||
|
||||
const BPMTapper* bpm_state = acquire_mutex((ValueMutex*)ctx, 25);
|
||||
if(bpm_state == NULL) {
|
||||
@@ -136,28 +135,28 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
//canvas_draw_frame(canvas, 0, 0, 128, 64);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
|
||||
string_init(tempStr);
|
||||
tempStr = furi_string_alloc();
|
||||
|
||||
string_printf(tempStr, "Taps: %d", bpm_state->taps);
|
||||
canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignBottom, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
furi_string_printf(tempStr, "Taps: %d", bpm_state->taps);
|
||||
canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignBottom, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
string_printf(tempStr, "Queue: %d", bpm_state->tap_queue->size);
|
||||
canvas_draw_str_aligned(canvas, 70, 10, AlignLeft, AlignBottom, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
furi_string_printf(tempStr, "Queue: %d", bpm_state->tap_queue->size);
|
||||
canvas_draw_str_aligned(canvas, 70, 10, AlignLeft, AlignBottom, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
string_printf(tempStr, "Interval: %dms", bpm_state->interval);
|
||||
canvas_draw_str_aligned(canvas, 5, 20, AlignLeft, AlignBottom, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
furi_string_printf(tempStr, "Interval: %dms", bpm_state->interval);
|
||||
canvas_draw_str_aligned(canvas, 5, 20, AlignLeft, AlignBottom, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
string_printf(tempStr, "x2 %.2f /2 %.2f", bpm_state->bpm * 2, bpm_state->bpm / 2);
|
||||
canvas_draw_str_aligned(canvas, 64, 60, AlignCenter, AlignCenter, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
furi_string_printf(tempStr, "x2 %.2f /2 %.2f", bpm_state->bpm * 2, bpm_state->bpm / 2);
|
||||
canvas_draw_str_aligned(canvas, 64, 60, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
string_printf(tempStr, "%.2f", bpm_state->bpm);
|
||||
furi_string_printf(tempStr, "%.2f", bpm_state->bpm);
|
||||
canvas_set_font(canvas, FontBigNumbers);
|
||||
canvas_draw_str_aligned(canvas, 64, 40, AlignCenter, AlignCenter, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
canvas_draw_str_aligned(canvas, 64, 40, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
string_clear(tempStr);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ typedef enum {
|
||||
|
||||
struct Chip8Emulator {
|
||||
Chip8State st;
|
||||
string_t file_path;
|
||||
FuriString* file_path;
|
||||
FuriThread* thread;
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ static int32_t chip8_worker(void* context) {
|
||||
FURI_LOG_I(WORKER_TAG, "Start storage file alloc");
|
||||
File* rom_file = storage_file_alloc(furi_storage_record);
|
||||
FURI_LOG_I(
|
||||
WORKER_TAG, "Start storage file open, path = %s", string_get_cstr(chip8->file_path));
|
||||
WORKER_TAG, "Start storage file open, path = %s", furi_string_get_cstr(chip8->file_path));
|
||||
|
||||
uint8_t* rom_data = malloc(4096);
|
||||
FURI_LOG_I(WORKER_TAG, "4096 array gotten");
|
||||
@@ -45,7 +45,7 @@ static int32_t chip8_worker(void* context) {
|
||||
|
||||
if(chip8->st.worker_state == WorkerStateLoadingRom) {
|
||||
bool is_file_opened = storage_file_open(
|
||||
rom_file, string_get_cstr(chip8->file_path), FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
rom_file, furi_string_get_cstr(chip8->file_path), FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
|
||||
if(!is_file_opened) {
|
||||
FURI_LOG_I(WORKER_TAG, "Cannot open storage");
|
||||
@@ -103,10 +103,10 @@ static int32_t chip8_worker(void* context) {
|
||||
|
||||
Chip8Emulator* chip8_make_emulator(string_t file_path) {
|
||||
furi_assert(file_path);
|
||||
FURI_LOG_I("CHIP8", "make emulator, file_path=", string_get_cstr(file_path));
|
||||
FURI_LOG_I("CHIP8", "make emulator, file_path=", furi_string_get_cstr(file_path));
|
||||
|
||||
Chip8Emulator* chip8 = malloc(sizeof(Chip8Emulator));
|
||||
string_init(chip8->file_path);
|
||||
chip8->file_path = furi_string_alloc();
|
||||
string_set(chip8->file_path, file_path);
|
||||
chip8->st.worker_state = WorkerStateLoadingRom;
|
||||
chip8->st.t_chip8_state = t_chip8_init(malloc);
|
||||
|
||||
@@ -5,7 +5,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <furi.h>
|
||||
#include <m-string.h>
|
||||
#include <storage/storage.h>
|
||||
#include "emulator_core/flipper_chip.h"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ struct Chip8App {
|
||||
SceneManager* scene_manager;
|
||||
DialogsApp* dialogs;
|
||||
|
||||
string_t file_name;
|
||||
FuriString* file_name;
|
||||
uint8_t** backup_screen;
|
||||
Chip8View* chip8_view;
|
||||
Chip8Emulator* chip8;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
static bool chip8_file_select(Chip8App* chip8) {
|
||||
furi_assert(chip8);
|
||||
string_init(chip8->file_name);
|
||||
string_set_str(chip8->file_name, CHIP8_APP_PATH_FOLDER);
|
||||
// string_set_str(file_path, chip8->file_name);
|
||||
chip8->file_name = furi_string_alloc();
|
||||
furi_string_set(chip8->file_name, CHIP8_APP_PATH_FOLDER);
|
||||
// furi_string_set(file_path, chip8->file_name);
|
||||
|
||||
bool res = dialog_file_browser_show(
|
||||
chip8->dialogs,
|
||||
@@ -17,7 +17,7 @@ static bool chip8_file_select(Chip8App* chip8) {
|
||||
false);
|
||||
|
||||
FURI_LOG_I(
|
||||
"Chip8_file_browser_show", "chip8->file_name: %s", string_get_cstr(chip8->file_name));
|
||||
"Chip8_file_browser_show", "chip8->file_name: %s", furi_string_get_cstr(chip8->file_name));
|
||||
FURI_LOG_I("Chip8_file_browser_show", "res: %d", res);
|
||||
return res;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ void chip8_scene_file_select_on_enter(void* context) {
|
||||
|
||||
if(chip8_file_select(chip8)) {
|
||||
FURI_LOG_I(
|
||||
"Chip8", "chip8_file_select, file_name = %s", string_get_cstr(chip8->file_name));
|
||||
"Chip8", "chip8_file_select, file_name = %s", furi_string_get_cstr(chip8->file_name));
|
||||
scene_manager_next_scene(chip8->scene_manager, Chip8WorkView);
|
||||
} else {
|
||||
view_dispatcher_stop(chip8->view_dispatcher);
|
||||
|
||||
@@ -58,12 +58,12 @@ void chip8_scene_work_on_enter(void* context) {
|
||||
|
||||
chip8_set_file_name(app->chip8_view, app->file_name);
|
||||
|
||||
string_t file_tmp;
|
||||
string_init(file_tmp);
|
||||
FuriString* file_tmp;
|
||||
file_tmp = furi_string_alloc();
|
||||
|
||||
string_printf(file_tmp, "%s", string_get_cstr(app->file_name));
|
||||
furi_string_printf(file_tmp, "%s", furi_string_get_cstr(app->file_name));
|
||||
|
||||
FURI_LOG_I("chip8_scene_work_on_enter", "file_name: %s", string_get_cstr(file_tmp));
|
||||
FURI_LOG_I("chip8_scene_work_on_enter", "file_name: %s", furi_string_get_cstr(file_tmp));
|
||||
|
||||
FURI_LOG_I("chip8_scene_work_on_enter", "START SET BACKUP SCREEN");
|
||||
chip8_set_backup_screen(app->chip8_view, app->backup_screen);
|
||||
|
||||
@@ -14,7 +14,7 @@ struct Chip8View {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
string_t file_name;
|
||||
FuriString* file_name;
|
||||
Chip8State state;
|
||||
uint8_t** backup_screen;
|
||||
} Chip8Model;
|
||||
@@ -168,7 +168,7 @@ void chip8_set_down_callback(Chip8View* chip8, Chip8ViewKeyDownCallback callback
|
||||
});
|
||||
}
|
||||
|
||||
void chip8_set_file_name(Chip8View* chip8, string_t name) {
|
||||
void chip8_set_file_name(Chip8View* chip8, FuriString* name) {
|
||||
furi_assert(name);
|
||||
with_view_model(
|
||||
chip8->view, (Chip8Model * model) {
|
||||
|
||||
@@ -24,6 +24,6 @@ void chip8_set_release_callback(Chip8View* chip8, Chip8ViewReleaseCallback callb
|
||||
|
||||
void chip8_set_backup_screen(Chip8View* chip8, uint8_t** screen);
|
||||
|
||||
void chip8_set_file_name(Chip8View* chip8, string_t name);
|
||||
void chip8_set_file_name(Chip8View* chip8, FuriString* name);
|
||||
|
||||
void chip8_set_state(Chip8View* chip8, Chip8State* st);
|
||||
|
||||
@@ -27,27 +27,27 @@ static const char* app_dirsDolphinBackup[] = {
|
||||
|
||||
bool storage_DolphinBackup_perform(void) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
string_t path_src;
|
||||
string_t path_dst;
|
||||
string_t new_path;
|
||||
string_init(path_src);
|
||||
string_init(path_dst);
|
||||
string_init(new_path);
|
||||
FuriString* path_src;
|
||||
FuriString* path_dst;
|
||||
FuriString* new_path;
|
||||
path_src = furi_string_alloc();
|
||||
path_dst = furi_string_alloc();
|
||||
new_path = furi_string_alloc();
|
||||
|
||||
string_printf(new_path, "%s/dolphin_restorer", MOVE_DST);
|
||||
storage_common_mkdir(storage, string_get_cstr(new_path));
|
||||
furi_string_printf(new_path, "%s/dolphin_restorer", MOVE_DST);
|
||||
storage_common_mkdir(storage, furi_string_get_cstr(new_path));
|
||||
string_clear(new_path);
|
||||
for(uint32_t i = 0; i < COUNT_OF(app_dirsDolphinBackup); i++) {
|
||||
if(i > 5) {
|
||||
string_printf(path_src, "%s/%s", MOVE_SRC, app_dirsDolphinBackup[i]);
|
||||
string_printf(path_dst, "%s/dolphin_restorer/%s", MOVE_DST, app_dirsDolphinBackup[i]);
|
||||
storage_simply_remove_recursive(storage, string_get_cstr(path_dst));
|
||||
storage_common_copy(storage, string_get_cstr(path_src), string_get_cstr(path_dst));
|
||||
furi_string_printf(path_src, "%s/%s", MOVE_SRC, app_dirsDolphinBackup[i]);
|
||||
furi_string_printf(path_dst, "%s/dolphin_restorer/%s", MOVE_DST, app_dirsDolphinBackup[i]);
|
||||
storage_simply_remove_recursive(storage, furi_string_get_cstr(path_dst));
|
||||
storage_common_copy(storage, furi_string_get_cstr(path_src), furi_string_get_cstr(path_dst));
|
||||
} else {
|
||||
string_printf(path_src, "%s/%s", MOVE_SRC, app_dirsDolphinBackup[i]);
|
||||
string_printf(path_dst, "%s/%s", MOVE_DST, app_dirsDolphinBackup[i]);
|
||||
storage_common_merge(storage, string_get_cstr(path_src), string_get_cstr(path_dst));
|
||||
storage_simply_remove_recursive(storage, string_get_cstr(path_src));
|
||||
furi_string_printf(path_src, "%s/%s", MOVE_SRC, app_dirsDolphinBackup[i]);
|
||||
furi_string_printf(path_dst, "%s/%s", MOVE_DST, app_dirsDolphinBackup[i]);
|
||||
storage_common_merge(storage, furi_string_get_cstr(path_src), furi_string_get_cstr(path_dst));
|
||||
storage_simply_remove_recursive(storage, furi_string_get_cstr(path_src));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,12 @@ static bool storage_DolphinBackup_check(void) {
|
||||
|
||||
FileInfo file_info;
|
||||
bool state = false;
|
||||
string_t path;
|
||||
string_init(path);
|
||||
FuriString* path;
|
||||
path = furi_string_alloc();
|
||||
|
||||
for(uint32_t i = 0; i < COUNT_OF(app_dirsDolphinBackup); i++) {
|
||||
string_printf(path, "%s/%s", MOVE_SRC, app_dirsDolphinBackup[i]);
|
||||
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
|
||||
furi_string_printf(path, "%s/%s", MOVE_SRC, app_dirsDolphinBackup[i]);
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(path), &file_info) == FSE_OK) {
|
||||
// if((file_info.flags & FSF_DIRECTORY) != 0) {
|
||||
state = true;
|
||||
break;
|
||||
|
||||
@@ -21,16 +21,16 @@ static const char* app_dirs[] = {
|
||||
|
||||
bool drestorer_perform(void) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
string_t path_src;
|
||||
string_t path_dst;
|
||||
string_init(path_src);
|
||||
string_init(path_dst);
|
||||
FuriString* path_src;
|
||||
FuriString* path_dst;
|
||||
path_src = furi_string_alloc();
|
||||
path_dst = furi_string_alloc();
|
||||
|
||||
for(uint32_t i = 0; i < COUNT_OF(app_dirs); i++) {
|
||||
string_printf(path_src, "%s/%s", MOVE_SRC, app_dirs[i]);
|
||||
string_printf(path_dst, "%s/%s", MOVE_DST, app_dirs[i]);
|
||||
storage_simply_remove_recursive(storage, string_get_cstr(path_dst));
|
||||
storage_common_copy(storage, string_get_cstr(path_src), string_get_cstr(path_dst));
|
||||
furi_string_printf(path_src, "%s/%s", MOVE_SRC, app_dirs[i]);
|
||||
furi_string_printf(path_dst, "%s/%s", MOVE_DST, app_dirs[i]);
|
||||
storage_simply_remove_recursive(storage, furi_string_get_cstr(path_dst));
|
||||
storage_common_copy(storage, furi_string_get_cstr(path_src), furi_string_get_cstr(path_dst));
|
||||
}
|
||||
|
||||
string_clear(path_src);
|
||||
@@ -46,12 +46,12 @@ static bool drestorer_check(void) {
|
||||
|
||||
FileInfo file_info;
|
||||
bool state = false;
|
||||
string_t path;
|
||||
string_init(path);
|
||||
FuriString* path;
|
||||
path = furi_string_alloc();
|
||||
|
||||
for(uint32_t i = 0; i < COUNT_OF(app_dirs); i++) {
|
||||
string_printf(path, "%s/%s", MOVE_SRC, app_dirs[i]);
|
||||
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
|
||||
furi_string_printf(path, "%s/%s", MOVE_SRC, app_dirs[i]);
|
||||
if(storage_common_stat(storage, furi_string_get_cstr(path), &file_info) == FSE_OK) {
|
||||
// if((file_info.flags & FSF_DIRECTORY) != 0) {
|
||||
state = true;
|
||||
break;
|
||||
|
||||
@@ -133,23 +133,23 @@ static void dtmf_dolphin_dialer_draw_callback(Canvas* canvas, void* _model) {
|
||||
|
||||
draw_dialer(canvas, model);
|
||||
|
||||
string_t output;
|
||||
string_init(output);
|
||||
FuriString* output;
|
||||
output = furi_string_alloc();
|
||||
|
||||
if(model->freq1 && model->freq2) {
|
||||
string_cat_printf(
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
"Dual Tone\nF1: %u Hz\nF2: %u Hz\n",
|
||||
(unsigned int)model->freq1,
|
||||
(unsigned int)model->freq2);
|
||||
} else if(model->freq1) {
|
||||
string_cat_printf(output, "Single Tone\nF: %u Hz\n", (unsigned int)model->freq1);
|
||||
furi_string_cat_printf(output, "Single Tone\nF: %u Hz\n", (unsigned int)model->freq1);
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
elements_multiline_text(
|
||||
canvas, (max_span * DTMF_DOLPHIN_BUTTON_WIDTH) + 4, 21, string_get_cstr(output));
|
||||
canvas, (max_span * DTMF_DOLPHIN_BUTTON_WIDTH) + 4, 21, furi_string_get_cstr(output));
|
||||
|
||||
string_clear(output);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <input/input.h>
|
||||
#include <m-string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gui/gui.h>
|
||||
@@ -58,23 +57,23 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
return;
|
||||
}
|
||||
|
||||
string_t tempStr;
|
||||
string_init(tempStr);
|
||||
FuriString* tempStr;
|
||||
tempStr = furi_string_alloc();
|
||||
|
||||
canvas_draw_frame(canvas, 0, 0, 128, 64);
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
|
||||
// draw bars/beat
|
||||
string_printf(tempStr, "%d/%d", metronome_state->beats_per_bar, metronome_state->note_length);
|
||||
canvas_draw_str_aligned(canvas, 64, 8, AlignCenter, AlignCenter, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
furi_string_printf(tempStr, "%d/%d", metronome_state->beats_per_bar, metronome_state->note_length);
|
||||
canvas_draw_str_aligned(canvas, 64, 8, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
// draw BPM value
|
||||
string_printf(tempStr, "%.2f", metronome_state->bpm);
|
||||
furi_string_printf(tempStr, "%.2f", metronome_state->bpm);
|
||||
canvas_set_font(canvas, FontBigNumbers);
|
||||
canvas_draw_str_aligned(canvas, 64, 24, AlignCenter, AlignCenter, string_get_cstr(tempStr));
|
||||
string_reset(tempStr);
|
||||
canvas_draw_str_aligned(canvas, 64, 24, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
|
||||
furi_string_reset(tempStr);
|
||||
|
||||
// draw volume indicator
|
||||
// always draw first waves
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <m-string.h>
|
||||
|
||||
#include "assets.h"
|
||||
|
||||
@@ -79,11 +78,11 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
if (minesweeper_state == NULL) {
|
||||
return;
|
||||
}
|
||||
string_t tempStr;
|
||||
string_init(tempStr);
|
||||
string_printf(tempStr, "Mines: %d", MINECOUNT - minesweeper_state->flags_set);
|
||||
FuriString* tempStr;
|
||||
tempStr = furi_string_alloc();
|
||||
furi_string_printf(tempStr, "Mines: %d", MINECOUNT - minesweeper_state->flags_set);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, string_get_cstr(tempStr));
|
||||
canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, furi_string_get_cstr(tempStr));
|
||||
string_clear(tempStr);
|
||||
int seconds = 0;
|
||||
int minutes = 0;
|
||||
@@ -93,8 +92,8 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||
minutes = (int) seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
}
|
||||
string_printf(tempStr, "%01d:%02d", minutes, seconds);
|
||||
canvas_draw_str_aligned(canvas, 128, 0, AlignRight, AlignTop, string_get_cstr(tempStr));
|
||||
furi_string_printf(tempStr, "%01d:%02d", minutes, seconds);
|
||||
canvas_draw_str_aligned(canvas, 128, 0, AlignRight, AlignTop, furi_string_get_cstr(tempStr));
|
||||
string_clear(tempStr);
|
||||
|
||||
for (int y = 0; y < PLAYFIELD_HEIGHT; y++) {
|
||||
@@ -285,8 +284,8 @@ static bool game_lost(Minesweeper* minesweeper_state) {
|
||||
static bool game_won(Minesweeper* minesweeper_state) {
|
||||
DialogsApp *dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
|
||||
string_t tempStr;
|
||||
string_init(tempStr);
|
||||
FuriString* tempStr;
|
||||
tempStr = furi_string_alloc();
|
||||
|
||||
int seconds = 0;
|
||||
int minutes = 0;
|
||||
@@ -297,9 +296,9 @@ static bool game_won(Minesweeper* minesweeper_state) {
|
||||
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
const char* header_text = "Game won!";
|
||||
string_printf(tempStr, "Minefield cleared in %01d:%02d", minutes, seconds);
|
||||
furi_string_printf(tempStr, "Minefield cleared in %01d:%02d", minutes, seconds);
|
||||
dialog_message_set_header(message, header_text, 64, 3, AlignCenter, AlignTop);
|
||||
dialog_message_set_text(message, string_get_cstr(tempStr), 64, 32, AlignCenter, AlignCenter);
|
||||
dialog_message_set_text(message, furi_string_get_cstr(tempStr), 64, 32, AlignCenter, AlignCenter);
|
||||
dialog_message_set_buttons(message, NULL, "Play again", NULL);
|
||||
// TODO: create icon
|
||||
dialog_message_set_icon(message, NULL, 72, 17);
|
||||
@@ -307,7 +306,7 @@ static bool game_won(Minesweeper* minesweeper_state) {
|
||||
DialogMessageButton choice = dialog_message_show(dialogs, message);
|
||||
dialog_message_free(message);
|
||||
string_clear(tempStr);
|
||||
string_reset(tempStr);
|
||||
furi_string_reset(tempStr);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
return choice == DialogMessageButtonCenter;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <stdlib.h>
|
||||
#include <m-string.h>
|
||||
#include <stm32wbxx_ll_tim.h>
|
||||
#include "tama.h"
|
||||
|
||||
@@ -37,7 +36,7 @@ static bool_t tama_p1_hal_is_log_enabled(log_level_t level) {
|
||||
static void tama_p1_hal_log(log_level_t level, char* buff, ...) {
|
||||
if(!tama_p1_hal_is_log_enabled(level)) return;
|
||||
|
||||
string_t string;
|
||||
FuriString* string;
|
||||
va_list args;
|
||||
va_start(args, buff);
|
||||
string_init_vprintf(string, buff, args);
|
||||
@@ -45,15 +44,15 @@ static void tama_p1_hal_log(log_level_t level, char* buff, ...) {
|
||||
|
||||
switch(level) {
|
||||
case LOG_ERROR:
|
||||
FURI_LOG_E(TAG_HAL, "%s", string_get_cstr(string));
|
||||
FURI_LOG_E(TAG_HAL, "%s", furi_string_get_cstr(string));
|
||||
break;
|
||||
case LOG_INFO:
|
||||
FURI_LOG_I(TAG_HAL, "%s", string_get_cstr(string));
|
||||
FURI_LOG_I(TAG_HAL, "%s", furi_string_get_cstr(string));
|
||||
break;
|
||||
case LOG_MEMORY:
|
||||
case LOG_CPU:
|
||||
default:
|
||||
FURI_LOG_D(TAG_HAL, "%s", string_get_cstr(string));
|
||||
FURI_LOG_D(TAG_HAL, "%s", furi_string_get_cstr(string));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1591,7 +1591,7 @@ int32_t tanks_game_app(void* p) {
|
||||
tanks_state->menu_state = MenuStateCooperativeServerMode;
|
||||
}
|
||||
} else if(tanks_state->state == GameStateCooperativeClient) {
|
||||
string_t goesUp;
|
||||
FuriString* goesUp;
|
||||
char arr[2];
|
||||
arr[0] = GoesUp;
|
||||
arr[1] = 0;
|
||||
@@ -1615,7 +1615,7 @@ int32_t tanks_game_app(void* p) {
|
||||
tanks_state->menu_state = MenuStateCooperativeClientMode;
|
||||
}
|
||||
} else if(tanks_state->state == GameStateCooperativeClient) {
|
||||
string_t goesDown;
|
||||
FuriString* goesDown;
|
||||
char arr[2];
|
||||
arr[0] = GoesDown;
|
||||
arr[1] = 0;
|
||||
@@ -1632,7 +1632,7 @@ int32_t tanks_game_app(void* p) {
|
||||
break;
|
||||
case InputKeyRight:
|
||||
if(tanks_state->state == GameStateCooperativeClient) {
|
||||
string_t goesRight;
|
||||
FuriString* goesRight;
|
||||
char arr[2];
|
||||
arr[0] = GoesRight;
|
||||
arr[1] = 0;
|
||||
@@ -1649,7 +1649,7 @@ int32_t tanks_game_app(void* p) {
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
if(tanks_state->state == GameStateCooperativeClient) {
|
||||
string_t goesLeft;
|
||||
FuriString* goesLeft;
|
||||
char arr[2];
|
||||
arr[0] = GoesLeft;
|
||||
arr[1] = 0;
|
||||
@@ -1682,7 +1682,7 @@ int32_t tanks_game_app(void* p) {
|
||||
} else if(tanks_state->state == GameStateGameOver) {
|
||||
tanks_game_init_game(tanks_state, tanks_state->state);
|
||||
} else if(tanks_state->state == GameStateCooperativeClient) {
|
||||
string_t shoots;
|
||||
FuriString* shoots;
|
||||
char arr[2];
|
||||
arr[0] = Shoots;
|
||||
arr[1] = 0;
|
||||
@@ -1738,7 +1738,7 @@ int32_t tanks_game_app(void* p) {
|
||||
|
||||
tanks_game_process_game_step(tanks_state);
|
||||
|
||||
string_t serializedData;
|
||||
FuriString* serializedData;
|
||||
unsigned char* data = tanks_game_serialize(tanks_state);
|
||||
char arr[11 * 16 + 1];
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ void totp_config_file_load_base(PluginState* const plugin_state) {
|
||||
|
||||
plugin_state->timezone_offset = 0;
|
||||
|
||||
string_t temp_str;
|
||||
FuriString* temp_str;
|
||||
uint32_t temp_data32;
|
||||
string_init(temp_str);
|
||||
temp_str = furi_string_alloc();
|
||||
|
||||
if(!flipper_format_read_header(fff_data_file, temp_str, &temp_data32)) {
|
||||
FURI_LOG_E(LOGGING_TAG, "Missing or incorrect header");
|
||||
@@ -124,9 +124,9 @@ void totp_config_file_load_tokens(PluginState* const plugin_state) {
|
||||
Storage* storage = totp_open_storage();
|
||||
FlipperFormat* fff_data_file = totp_open_config_file(storage);
|
||||
|
||||
string_t temp_str;
|
||||
FuriString* temp_str;
|
||||
uint32_t temp_data32;
|
||||
string_init(temp_str);
|
||||
temp_str = furi_string_alloc();
|
||||
|
||||
if(!flipper_format_read_header(fff_data_file, temp_str, &temp_data32)) {
|
||||
FURI_LOG_E(LOGGING_TAG, "Missing or incorrect header");
|
||||
@@ -142,7 +142,7 @@ void totp_config_file_load_tokens(PluginState* const plugin_state) {
|
||||
|
||||
TokenInfo* tokenInfo = malloc(sizeof(TokenInfo));
|
||||
|
||||
const char* temp_cstr = string_get_cstr(temp_str);
|
||||
const char* temp_cstr = furi_string_get_cstr(temp_str);
|
||||
tokenInfo->name = (char *)malloc(strlen(temp_cstr) + 1);
|
||||
strcpy(tokenInfo->name, temp_cstr);
|
||||
|
||||
@@ -156,7 +156,7 @@ void totp_config_file_load_tokens(PluginState* const plugin_state) {
|
||||
continue;
|
||||
}
|
||||
|
||||
temp_cstr = string_get_cstr(temp_str);
|
||||
temp_cstr = furi_string_get_cstr(temp_str);
|
||||
token_info_set_secret(tokenInfo, temp_cstr, strlen(temp_cstr), &plugin_state->iv[0]);
|
||||
has_any_plain_secret = true;
|
||||
FURI_LOG_W(LOGGING_TAG, "Found token with plain secret");
|
||||
|
||||
@@ -11,7 +11,7 @@ void totp_cli_print_usage() {
|
||||
printf("\reset\t - Reset app to default (reset PIN and removes all tokens)\r\n");
|
||||
};
|
||||
|
||||
static void totp_cli(Cli* cli, string_t args, void* context) {
|
||||
static void totp_cli(Cli* cli, FuriString* args, void* context) {
|
||||
UNUSED(cli);
|
||||
UNUSED(args);
|
||||
UNUSED(context);
|
||||
|
||||
@@ -7,13 +7,13 @@ void wifi_deauther_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
|
||||
// If text box store gets too big, then truncate it
|
||||
app->text_box_store_strlen += len;
|
||||
if(app->text_box_store_strlen >= WIFI_deauther_TEXT_BOX_STORE_SIZE - 1) {
|
||||
string_right(app->text_box_store, app->text_box_store_strlen / 2);
|
||||
app->text_box_store_strlen = string_size(app->text_box_store);
|
||||
furi_string_right(app->text_box_store, app->text_box_store_strlen / 2);
|
||||
app->text_box_store_strlen = furi_string_size(app->text_box_store);
|
||||
}
|
||||
|
||||
// Null-terminate buf and append to text box store
|
||||
buf[len] = '\0';
|
||||
string_cat_printf(app->text_box_store, "%s", buf);
|
||||
furi_string_cat_printf(app->text_box_store, "%s", buf);
|
||||
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifideautherEventRefreshConsoleOutput);
|
||||
}
|
||||
@@ -30,22 +30,22 @@ void wifi_deauther_scene_console_output_on_enter(void* context) {
|
||||
text_box_set_focus(text_box, TextBoxFocusEnd);
|
||||
}
|
||||
if(app->is_command) {
|
||||
string_reset(app->text_box_store);
|
||||
furi_string_reset(app->text_box_store);
|
||||
app->text_box_store_strlen = 0;
|
||||
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
||||
const char* help_msg =
|
||||
"For app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
|
||||
string_cat_str(app->text_box_store, help_msg);
|
||||
furi_string_cat_str(app->text_box_store, help_msg);
|
||||
app->text_box_store_strlen += strlen(help_msg);
|
||||
}
|
||||
|
||||
if(app->show_stopscan_tip) {
|
||||
const char* help_msg = "Press BACK to send stopscan\n";
|
||||
string_cat_str(app->text_box_store, help_msg);
|
||||
furi_string_cat_str(app->text_box_store, help_msg);
|
||||
app->text_box_store_strlen += strlen(help_msg);
|
||||
}
|
||||
} else { // "View Log" menu action
|
||||
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
|
||||
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
|
||||
}
|
||||
|
||||
scene_manager_set_scene_state(app->scene_manager, WifideautherSceneConsoleOutput, 0);
|
||||
@@ -69,7 +69,7 @@ bool wifi_deauther_scene_console_output_on_event(void* context, SceneManagerEven
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
|
||||
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
|
||||
consumed = true;
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
consumed = true;
|
||||
|
||||
@@ -54,7 +54,7 @@ WifideautherApp* wifi_deauther_app_alloc() {
|
||||
app->text_box = text_box_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, WifideautherAppViewConsoleOutput, text_box_get_view(app->text_box));
|
||||
string_init(app->text_box_store);
|
||||
app->text_box_store = furi_string_alloc();
|
||||
string_reserve(app->text_box_store, WIFI_deauther_TEXT_BOX_STORE_SIZE);
|
||||
|
||||
app->text_input = text_input_alloc();
|
||||
|
||||
@@ -23,7 +23,7 @@ struct WifideautherApp {
|
||||
SceneManager* scene_manager;
|
||||
|
||||
char text_input_store[WIFI_deauther_TEXT_INPUT_STORE_SIZE + 1];
|
||||
string_t text_box_store;
|
||||
FuriString* text_box_store;
|
||||
size_t text_box_store_strlen;
|
||||
TextBox* text_box;
|
||||
TextInput* text_input;
|
||||
|
||||
@@ -7,24 +7,24 @@ void namechanger_on_system_start() {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
string_t NAMEHEADER;
|
||||
string_init_set_str(NAMEHEADER, "Flipper Name File");
|
||||
FuriString* NAMEHEADER;
|
||||
NAMEHEADER = furi_string_alloc_set( "Flipper Name File");
|
||||
|
||||
string_t folderpath;
|
||||
string_init_set_str(folderpath, "/ext/dolphin");
|
||||
FuriString* folderpath;
|
||||
folderpath = furi_string_alloc_set( "/ext/dolphin");
|
||||
|
||||
string_t filepath;
|
||||
string_init_set_str(filepath, "/ext/dolphin/name.txt");
|
||||
FuriString* filepath;
|
||||
filepath = furi_string_alloc_set( "/ext/dolphin/name.txt");
|
||||
|
||||
//Make dir if doesn't exist
|
||||
if(storage_simply_mkdir(storage, string_get_cstr(folderpath))) {
|
||||
if(storage_simply_mkdir(storage, furi_string_get_cstr(folderpath))) {
|
||||
bool result = false;
|
||||
|
||||
string_t data;
|
||||
string_init(data);
|
||||
FuriString* data;
|
||||
data = furi_string_alloc();
|
||||
|
||||
do {
|
||||
if(!flipper_format_file_open_existing(file, string_get_cstr(filepath))) {
|
||||
if(!flipper_format_file_open_existing(file, furi_string_get_cstr(filepath))) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void namechanger_on_system_start() {
|
||||
break;
|
||||
}
|
||||
|
||||
if(string_cmp_str(data, string_get_cstr(NAMEHEADER)) != 0) {
|
||||
if(furi_string_cmp_strdata, furi_string_get_cstr(NAMEHEADER)) != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -59,17 +59,17 @@ void namechanger_on_system_start() {
|
||||
|
||||
bool res = false;
|
||||
|
||||
string_t name;
|
||||
string_init_set_str(name, furi_hal_version_get_name_ptr());
|
||||
FuriString* name;
|
||||
name = furi_string_alloc_set( furi_hal_version_get_name_ptr());
|
||||
|
||||
do {
|
||||
// Open file for write
|
||||
if(!flipper_format_file_open_always(file, string_get_cstr(filepath))) {
|
||||
if(!flipper_format_file_open_always(file, furi_string_get_cstr(filepath))) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Write header
|
||||
if(!flipper_format_write_header_cstr(file, string_get_cstr(NAMEHEADER), 1)) {
|
||||
if(!flipper_format_write_header_cstr(file, furi_string_get_cstr(NAMEHEADER), 1)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void namechanger_on_system_start() {
|
||||
}
|
||||
|
||||
//Write name
|
||||
if(!flipper_format_write_string_cstr(file, "Name", string_get_cstr(name))) {
|
||||
if(!flipper_format_write_string_cstr(file, "Name", furi_string_get_cstr(name))) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -116,17 +116,17 @@ void namechanger_on_system_start() {
|
||||
|
||||
bool res = false;
|
||||
|
||||
string_t name;
|
||||
string_init_set_str(name, furi_hal_version_get_name_ptr());
|
||||
FuriString* name;
|
||||
name = furi_string_alloc_set( furi_hal_version_get_name_ptr());
|
||||
|
||||
do {
|
||||
// Open file for write
|
||||
if(!flipper_format_file_open_always(file, string_get_cstr(filepath))) {
|
||||
if(!flipper_format_file_open_always(file, furi_string_get_cstr(filepath))) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Write header
|
||||
if(!flipper_format_write_header_cstr(file, string_get_cstr(NAMEHEADER), 1)) {
|
||||
if(!flipper_format_write_header_cstr(file, furi_string_get_cstr(NAMEHEADER), 1)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void namechanger_on_system_start() {
|
||||
}
|
||||
|
||||
//Write name
|
||||
if(!flipper_format_write_string_cstr(file, "Name", string_get_cstr(name))) {
|
||||
if(!flipper_format_write_string_cstr(file, "Name", furi_string_get_cstr(name))) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void storage_settings_scene_sd_info_on_enter(void* context) {
|
||||
sd_free_unit = unit_gb;
|
||||
}
|
||||
|
||||
string_printf(
|
||||
furi_string_printf(
|
||||
app->text_string,
|
||||
"Label: %s\nType: %s\n%.2f %s total\n%.2f %s free\n%.2f%% free",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user