Merge branch 'Flipper-XFW:dev' into honeywell

This commit is contained in:
Totoo
2023-10-29 21:34:53 +01:00
committed by GitHub
137 changed files with 3034 additions and 709 deletions
+45 -10
View File
@@ -613,10 +613,31 @@ static Elf32_Addr elf_address_of_by_hash(ELFFile* elf, uint32_t hash) {
return ELF_INVALID_ADDRESS;
}
static bool elf_file_find_string_by_hash(ELFFile* elf, uint32_t hash, FuriString* out) {
bool result = false;
FuriString* symbol_name = furi_string_alloc();
Elf32_Sym sym;
for(size_t i = 0; i < elf->symbol_count; i++) {
furi_string_reset(symbol_name);
if(elf_read_symbol(elf, i, &sym, symbol_name)) {
if(elf_symbolname_hash(furi_string_get_cstr(symbol_name)) == hash) {
furi_string_set(out, symbol_name);
result = true;
break;
}
}
}
furi_string_free(symbol_name);
return result;
}
static bool elf_relocate_fast(ELFFile* elf, ELFSection* s) {
UNUSED(elf);
const uint8_t* start = s->fast_rel->data;
const uint8_t version = *start;
bool no_errors = true;
if(version != FAST_RELOCATION_VERSION) {
FURI_LOG_E(TAG, "Unsupported fast relocation version %d", version);
@@ -664,16 +685,30 @@ static bool elf_relocate_fast(ELFFile* elf, ELFSection* s) {
}
if(address == ELF_INVALID_ADDRESS) {
FURI_LOG_E(TAG, "Failed to resolve address for hash %lX", hash_or_section_index);
return false;
}
FuriString* symbol_name = furi_string_alloc();
if(elf_file_find_string_by_hash(elf, hash_or_section_index, symbol_name)) {
FURI_LOG_E(
TAG,
"Failed to resolve address for symbol %s (hash %lX)",
furi_string_get_cstr(symbol_name),
hash_or_section_index);
} else {
FURI_LOG_E(
TAG,
"Failed to resolve address for hash %lX (string not found)",
hash_or_section_index);
}
furi_string_free(symbol_name);
for(uint32_t j = 0; j < offsets_count; j++) {
uint32_t offset = *((uint32_t*)start) & 0x00FFFFFF;
start += 3;
// FURI_LOG_I(TAG, " Fast relocation offset %ld: %ld", j, offset);
Elf32_Addr relAddr = ((Elf32_Addr)s->data) + offset;
elf_relocate_symbol(elf, relAddr, type, address);
no_errors = false;
start += 3 * offsets_count;
} else {
for(uint32_t j = 0; j < offsets_count; j++) {
uint32_t offset = *((uint32_t*)start) & 0x00FFFFFF;
start += 3;
Elf32_Addr relAddr = ((Elf32_Addr)s->data) + offset;
elf_relocate_symbol(elf, relAddr, type, address);
}
}
}
@@ -681,7 +716,7 @@ static bool elf_relocate_fast(ELFFile* elf, ELFSection* s) {
free(s->fast_rel);
s->fast_rel = NULL;
return true;
return no_errors;
}
static bool elf_relocate_section(ELFFile* elf, ELFSection* section) {
+2 -2
View File
@@ -86,8 +86,8 @@ const SubGhzProtocol ws_protocol_acurite_592txr = {
.name = WS_PROTOCOL_ACURITE_592TXR_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
.decoder = &ws_protocol_acurite_592txr_decoder,
.encoder = &ws_protocol_acurite_592txr_encoder,
+2 -2
View File
@@ -69,8 +69,8 @@ const SubGhzProtocol ws_protocol_acurite_606tx = {
.name = WS_PROTOCOL_ACURITE_606TX_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_acurite_606tx_decoder,
.encoder = &ws_protocol_acurite_606tx_encoder,
+2 -2
View File
@@ -70,8 +70,8 @@ const SubGhzProtocol ws_protocol_acurite_609txc = {
.name = WS_PROTOCOL_ACURITE_609TXC_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_acurite_609txc_decoder,
.encoder = &ws_protocol_acurite_609txc_encoder,
+2 -2
View File
@@ -84,8 +84,8 @@ const SubGhzProtocol ws_protocol_ambient_weather = {
.name = WS_PROTOCOL_AMBIENT_WEATHER_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_ambient_weather_decoder,
.encoder = &ws_protocol_ambient_weather_encoder,
+2 -2
View File
@@ -81,8 +81,8 @@ const SubGhzProtocol ws_protocol_auriol_ahfl = {
.name = WS_PROTOCOL_AURIOL_AHFL_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_auriol_ahfl_decoder,
.encoder = &ws_protocol_auriol_ahfl_encoder,
+2 -2
View File
@@ -80,8 +80,8 @@ const SubGhzProtocol ws_protocol_auriol_th = {
.name = WS_PROTOCOL_AURIOL_TH_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_auriol_th_decoder,
.encoder = &ws_protocol_auriol_th_encoder,
+2 -2
View File
@@ -83,8 +83,8 @@ const SubGhzProtocol ws_protocol_gt_wt_02 = {
.name = WS_PROTOCOL_GT_WT_02_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_gt_wt_02_decoder,
.encoder = &ws_protocol_gt_wt_02_encoder,
+2 -2
View File
@@ -109,8 +109,8 @@ const SubGhzProtocol ws_protocol_gt_wt_03 = {
.name = WS_PROTOCOL_GT_WT_03_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_gt_wt_03_decoder,
.encoder = &ws_protocol_gt_wt_03_encoder,
+2 -2
View File
@@ -94,8 +94,8 @@ const SubGhzProtocol ws_protocol_infactory = {
.name = WS_PROTOCOL_INFACTORY_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_infactory_decoder,
.encoder = &ws_protocol_infactory_encoder,
+2 -2
View File
@@ -76,8 +76,8 @@ const SubGhzProtocol ws_protocol_lacrosse_tx141thbv2 = {
.name = WS_PROTOCOL_LACROSSE_TX141THBV2_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_lacrosse_tx141thbv2_decoder,
.encoder = &ws_protocol_lacrosse_tx141thbv2_encoder,
+2 -2
View File
@@ -356,8 +356,8 @@ const SubGhzProtocol ws_protocol_nexus_th = {
.name = WS_PROTOCOL_NEXUS_TH_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save | SubGhzProtocolFlag_Send,
.decoder = &ws_protocol_nexus_th_decoder,
.encoder = &ws_protocol_nexus_th_encoder,
+2 -2
View File
@@ -95,8 +95,8 @@ const SubGhzProtocol ws_protocol_oregon_v1 = {
.name = WS_PROTOCOL_OREGON_V1_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_oregon_v1_decoder,
.encoder = &ws_protocol_oregon_v1_encoder,
+2 -2
View File
@@ -79,8 +79,8 @@ const SubGhzProtocol ws_protocol_thermopro_tx4 = {
.name = WS_PROTOCOL_THERMOPRO_TX4_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_thermopro_tx4_decoder,
.encoder = &ws_protocol_thermopro_tx4_encoder,
+2 -2
View File
@@ -90,8 +90,8 @@ const SubGhzProtocol ws_protocol_tx_8300 = {
.name = WS_PROTOCOL_TX_8300_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_tx_8300_decoder,
.encoder = &ws_protocol_tx_8300_encoder,
+2 -2
View File
@@ -84,8 +84,8 @@ const SubGhzProtocol ws_protocol_wendox_w6726 = {
.name = WS_PROTOCOL_WENDOX_W6726_NAME,
.type = SubGhzProtocolTypeStatic,
.flag = SubGhzProtocolFlag_433 | SubGhzProtocolFlag_315 | SubGhzProtocolFlag_868 |
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable |
SubGhzProtocolFlag_Load | SubGhzProtocolFlag_Save,
SubGhzProtocolFlag_AM | SubGhzProtocolFlag_Decodable | SubGhzProtocolFlag_Load |
SubGhzProtocolFlag_Save,
.decoder = &ws_protocol_wendox_w6726_decoder,
.encoder = &ws_protocol_wendox_w6726_encoder,
+4 -4
View File
@@ -10,7 +10,7 @@
#define ICONS_FMT XTREME_ASSETS_PATH "/%s/Icons/%s"
void load_icon_animated(const Icon* replace, const char* name, FuriString* path, File* file) {
const char* pack = XTREME_SETTINGS()->asset_pack;
const char* pack = xtreme_settings.asset_pack;
furi_string_printf(path, ICONS_FMT "/meta", pack, name);
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
int32_t icon_width, icon_height, frame_rate, frame_count;
@@ -61,7 +61,7 @@ void load_icon_animated(const Icon* replace, const char* name, FuriString* path,
}
void load_icon_static(const Icon* replace, const char* name, FuriString* path, File* file) {
furi_string_printf(path, ICONS_FMT ".bmx", XTREME_SETTINGS()->asset_pack, name);
furi_string_printf(path, ICONS_FMT ".bmx", xtreme_settings.asset_pack, name);
if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
uint64_t size = storage_file_size(file) - 8;
uint8_t* frame = malloc(size);
@@ -102,8 +102,8 @@ void free_icon(const Icon* icon) {
}
void XTREME_ASSETS_LOAD() {
const char* pack = XTREME_SETTINGS()->asset_pack;
XTREME_SETTINGS()->is_nsfw = !strncmp(pack, "NSFW", strlen("NSFW"));
const char* pack = xtreme_settings.asset_pack;
xtreme_settings.is_nsfw = !strncmp(pack, "NSFW", strlen("NSFW"));
if(pack[0] == '\0') return;
Storage* storage = furi_record_open(RECORD_STORAGE);
-4
View File
@@ -252,7 +252,3 @@ void XTREME_SETTINGS_SAVE() {
flipper_format_free(file);
furi_record_close(RECORD_STORAGE);
}
XtremeSettings* XTREME_SETTINGS() {
return &xtreme_settings;
}
+1 -1
View File
@@ -92,7 +92,7 @@ typedef struct {
void XTREME_SETTINGS_LOAD();
void XTREME_SETTINGS_SAVE();
XtremeSettings* XTREME_SETTINGS();
extern XtremeSettings xtreme_settings;
void XTREME_ASSETS_LOAD();
void XTREME_ASSETS_FREE();