Rename char array def for xfw app

This commit is contained in:
Willy-JL
2023-03-15 01:03:02 +00:00
parent 8e7ca0fca2
commit f5fcc87368
3 changed files with 14 additions and 14 deletions

View File

@@ -16,10 +16,10 @@ static void xtreme_app_scene_graphics_asset_pack_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item); XtremeApp* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item); uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text( variable_item_set_current_value_text(
item, index == 0 ? "SFW" : *asset_packs_get(app->asset_packs, index - 1)); item, index == 0 ? "SFW" : *CharList_get(app->asset_packs, index - 1));
strlcpy( strlcpy(
XTREME_SETTINGS()->asset_pack, XTREME_SETTINGS()->asset_pack,
index == 0 ? "" : *asset_packs_get(app->asset_packs, index - 1), index == 0 ? "" : *CharList_get(app->asset_packs, index - 1),
MAX_PACK_NAME_LEN); MAX_PACK_NAME_LEN);
app->asset_pack = index; app->asset_pack = index;
app->save_settings = true; app->save_settings = true;
@@ -80,13 +80,13 @@ void xtreme_app_scene_graphics_on_enter(void* context) {
item = variable_item_list_add( item = variable_item_list_add(
var_item_list, var_item_list,
"Asset Pack", "Asset Pack",
asset_packs_size(app->asset_packs) + 1, CharList_size(app->asset_packs) + 1,
xtreme_app_scene_graphics_asset_pack_changed, xtreme_app_scene_graphics_asset_pack_changed,
app); app);
variable_item_set_current_value_index(item, app->asset_pack); variable_item_set_current_value_index(item, app->asset_pack);
variable_item_set_current_value_text( variable_item_set_current_value_text(
item, item,
app->asset_pack == 0 ? "SFW" : *asset_packs_get(app->asset_packs, app->asset_pack - 1)); app->asset_pack == 0 ? "SFW" : *CharList_get(app->asset_packs, app->asset_pack - 1));
item = variable_item_list_add( item = variable_item_list_add(
var_item_list, var_item_list,

View File

@@ -194,7 +194,7 @@ XtremeApp* xtreme_app_alloc() {
strlcpy(app->device_name, furi_hal_version_get_name_ptr(), NAMECHANGER_TEXT_STORE_SIZE); strlcpy(app->device_name, furi_hal_version_get_name_ptr(), NAMECHANGER_TEXT_STORE_SIZE);
app->asset_pack = 0; app->asset_pack = 0;
asset_packs_init(app->asset_packs); CharList_init(app->asset_packs);
File* folder = storage_file_alloc(storage); File* folder = storage_file_alloc(storage);
FileInfo info; FileInfo info;
char* name = malloc(MAX_PACK_NAME_LEN); char* name = malloc(MAX_PACK_NAME_LEN);
@@ -205,14 +205,14 @@ XtremeApp* xtreme_app_alloc() {
strlcpy(copy, name, MAX_PACK_NAME_LEN); strlcpy(copy, name, MAX_PACK_NAME_LEN);
uint idx = 0; uint idx = 0;
if(strcmp(copy, "NSFW") != 0) { if(strcmp(copy, "NSFW") != 0) {
for(; idx < asset_packs_size(app->asset_packs); idx++) { for(; idx < CharList_size(app->asset_packs); idx++) {
char* comp = *asset_packs_get(app->asset_packs, idx); char* comp = *CharList_get(app->asset_packs, idx);
if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) { if(strcasecmp(copy, comp) < 0 && strcmp(comp, "NSFW") != 0) {
break; break;
} }
} }
} }
asset_packs_push_at(app->asset_packs, idx, copy); CharList_push_at(app->asset_packs, idx, copy);
if(app->asset_pack != 0) { if(app->asset_pack != 0) {
if(idx < app->asset_pack) app->asset_pack++; if(idx < app->asset_pack) app->asset_pack++;
} else { } else {
@@ -251,11 +251,11 @@ void xtreme_app_free(XtremeApp* app) {
FrequencyList_clear(app->subghz_static_frequencies); FrequencyList_clear(app->subghz_static_frequencies);
FrequencyList_clear(app->subghz_hopper_frequencies); FrequencyList_clear(app->subghz_hopper_frequencies);
asset_packs_it_t it; CharList_it_t it;
for(asset_packs_it(it, app->asset_packs); !asset_packs_end_p(it); asset_packs_next(it)) { for(CharList_it(it, app->asset_packs); !CharList_end_p(it); CharList_next(it)) {
free(*asset_packs_cref(it)); free(*CharList_cref(it));
} }
asset_packs_clear(app->asset_packs); CharList_clear(app->asset_packs);
furi_string_free(app->version_tag); furi_string_free(app->version_tag);

View File

@@ -23,7 +23,7 @@
#define XTREME_SUBGHZ_FREQ_BUFFER_SIZE 6 #define XTREME_SUBGHZ_FREQ_BUFFER_SIZE 6
ARRAY_DEF(asset_packs, char*) ARRAY_DEF(CharList, char*)
typedef struct { typedef struct {
Gui* gui; Gui* gui;
@@ -43,7 +43,7 @@ typedef struct {
int dolphin_level; int dolphin_level;
char device_name[NAMECHANGER_TEXT_STORE_SIZE]; char device_name[NAMECHANGER_TEXT_STORE_SIZE];
uint asset_pack; uint asset_pack;
asset_packs_t asset_packs; CharList_t asset_packs;
FuriString* version_tag; FuriString* version_tag;
bool save_subghz; bool save_subghz;
bool save_subghz_frequencies; bool save_subghz_frequencies;