mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-23 01:18:12 -07:00
Namespoof also spoof serial number
This commit is contained in:
@@ -4669,6 +4669,7 @@ Function,+,version_get_gitbranchnum,const char*,const Version*
|
||||
Function,+,version_get_githash,const char*,const Version*
|
||||
Function,+,version_get_target,uint8_t,const Version*
|
||||
Function,+,version_get_version,const char*,const Version*
|
||||
Function,-,version_set_custom_name,void,"Version*, const char*"
|
||||
Function,-,vfiprintf,int,"FILE*, const char*, __gnuc_va_list"
|
||||
Function,-,vfiscanf,int,"FILE*, const char*, __gnuc_va_list"
|
||||
Function,-,vfprintf,int,"FILE*, const char*, __gnuc_va_list"
|
||||
|
||||
|
@@ -24,7 +24,7 @@ struct Version {
|
||||
};
|
||||
|
||||
/* version of current running firmware (bootloader/flipper) */
|
||||
static const Version version = {
|
||||
static Version version = {
|
||||
.magic = VERSION_MAGIC,
|
||||
.major = VERSION_MAJOR,
|
||||
.minor = VERSION_MINOR,
|
||||
@@ -74,6 +74,12 @@ const char* version_get_custom_name(const Version* v) {
|
||||
return v ? v->custom_flipper_name : version.custom_flipper_name;
|
||||
}
|
||||
|
||||
void version_set_custom_name(Version* v, const char* name) {
|
||||
Version* ver = v ? v : &version;
|
||||
ver->custom_flipper_name = name;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t version_get_target(const Version* v) {
|
||||
return v ? v->target : version.target;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,14 @@ const char* version_get_version(const Version* v);
|
||||
*/
|
||||
const char* version_get_custom_name(const Version* v);
|
||||
|
||||
/** Get custom flipper name if set in ENV
|
||||
*
|
||||
* @param v pointer to Version data. NULL for currently running
|
||||
* software.
|
||||
* @param custom name or NULL
|
||||
*/
|
||||
void version_set_custom_name(Version* v, const char* name);
|
||||
|
||||
/** Get hardware target this firmware was built for
|
||||
*
|
||||
* @param v pointer to Version data. NULL for currently running
|
||||
|
||||
@@ -17,7 +17,8 @@ void NAMESPOOF_INIT() {
|
||||
if(version != NAMESPOOF_VERSION) break;
|
||||
|
||||
if(!flipper_format_read_string(file, "Name", str)) break;
|
||||
furi_hal_version_set_name(furi_string_get_cstr(str));
|
||||
version_set_custom_name(NULL, strdup(furi_string_get_cstr(str)));
|
||||
furi_hal_version_set_name(version_get_custom_name(NULL));
|
||||
} while(false);
|
||||
|
||||
flipper_format_free(file);
|
||||
|
||||
Reference in New Issue
Block a user