1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 05:06:30 +04:00
This commit is contained in:
r3df0xx
2022-05-17 15:54:09 +03:00
parent 2c5fc9ea44
commit 7fbf49d377
76 changed files with 2239 additions and 63 deletions

View File

@@ -3,40 +3,17 @@
#include <stdlib.h>
#include <stdbool.h>
#include <furi.h>
#include <furi_hal.h>
void set_random_name(char* name, uint8_t max_name_size) {
static bool rand_generator_inited = false;
if(!rand_generator_inited) {
srand(DWT->CYCCNT);
rand_generator_inited = true;
}
const char* prefix[] = {
"ancient",
"hollow",
"strange",
"disappeared",
"unknown",
"unthinkable",
"unnamable",
"nameless",
"my",
};
const char* suffix[] = {
"door",
"entrance",
"doorway",
"entry",
"portal",
"entree",
"opening",
"crack",
};
uint8_t prefix_i = rand() % COUNT_OF(prefix);
uint8_t suffix_i = rand() % COUNT_OF(suffix);
sniprintf(name, max_name_size, "%s_%s", prefix[prefix_i], suffix[suffix_i]);
FuriHalRtcDateTime datetime;
furi_hal_rtc_get_datetime(&datetime);
char strings[1][25];
sprintf(strings[0], "%s%.4d%.2d%.2d%.2d%.2d", "s"
, datetime.year, datetime.month, datetime.day
, datetime.hour, datetime.minute
);
sniprintf(name, max_name_size, "%s", strings[0]);
// Set first symbol to upper case
name[0] = name[0] - 0x20;
}