Compare commits

...

4 Commits
ald ... ascii

Author SHA1 Message Date
Dr-Noob
ae53d97a47 Add AMD txt 2021-03-31 09:25:52 +02:00
Dr-Noob
eeeaec3ba9 Small changes to art. Back to previous algorithm 2021-03-30 22:43:28 +02:00
Dr-Noob
7c5a0c3280 Testing white background for Intel art 2021-03-30 22:22:22 +02:00
Dr-Noob
d4ad5a58f0 Add new Intel ASCII art made with unicode characters 2021-03-30 21:41:59 +02:00
5 changed files with 79 additions and 43 deletions

File diff suppressed because one or more lines are too long

19
src/common/ascii/amd.txt Normal file
View File

@@ -0,0 +1,19 @@
████ ███ ███ ████████ ▜███████████
██████ █████ █████ ███ ███ ▗▀▀▀▀▀▀▜███
███ ███ █████████████ ███ ██ ▐█ ▐███
███ ███ ███ ███ ███ ███ ██ ▟██ ▐███
████████████ ███ ███ ███ ███ ████▄▄▄▄▄▄▝▜██
███ ███ ███ ███ █████████ ████████▛ ██

3
src/common/ascii/convert.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
cat intel.txt | hexdump -vC | head -n-1 | cut -d' ' -f2- | cut -d'|' -f1 | tr '\n' ' ' | tr -s ' ' | tr ' ' ',' | sed "s/,/,0x/g"

View File

@@ -0,0 +1,19 @@
▁▂▃▄▅▆▆▇▇███████▇▇▆▅▅▄▂▁
▁▃▄▆▇▛▀▀▀▀▔▔▔ ▔▔▔▀▀▀██▇▅▃
▂▄▆█▀▀▔ ▝▜██▅▁
▀▀▔ ▔▜██▖
▅▅▅ ▆▆▆ ▜██▖
▁▅ ▀▀▀ ▐██▌ ███ ██▉
▄▛▘ ▄▄▄ ▗▄▄▄▄▄▄▃▁ ▐██▙▄▖ ▁▃▄▅▄▃ ███ ███
▗▟▛ ███ ▐██▀▀▀▜██▖ ▐██▛▀▘ ▟██▀▀▀██▖ ███ ▗██▊
█▛ ███ ▐██ ▕██▌ ▐██▌ ▐██▂▂▂▂▂██ ███ ▗███▘
▐█▍ ███ ▐██ ▕██▌ ▐██▌ ▐██▛▀▀▀▀▀▀ ███ ▄██▛▘
██▏ ███ ▐██ ▕██▌ ▐██▌ ▝██▙▁ ▁▂▃ ███ ▅███▀
██▍ ▝██ ▐██ ▕██▌ ▀███▋ ▝▀█████▛ ▝▜█ █▀▔
▐█▙ ▔▔▔
▜█▙▖ ▁▂▄▖
▜██▆▃▁ ▁▂▄▅▇███▌
▝▜███▇▅▄▃▂▁ ▁▁▂▃▄▅▆▇███████▀▀
▔▀▀████████▇▇▇▇▇▇▇▇▇▇███████████▛▀▀▔▔
▔▔▀▀▀▀█████████████▀▀▀▀▀▔▔▔

View File

@@ -105,6 +105,7 @@ struct attribute {
struct ascii { struct ascii {
char art[NUMBER_OF_LINES][LINE_SIZE+1]; char art[NUMBER_OF_LINES][LINE_SIZE+1];
unsigned char* art_unicode;
char color1_ascii[100]; char color1_ascii[100];
char color2_ascii[100]; char color2_ascii[100];
char color1_text[100]; char color1_text[100];
@@ -159,8 +160,8 @@ struct ascii* set_ascii(VENDOR vendor, STYLE style, struct colors* cs) {
#ifdef ARCH_X86 #ifdef ARCH_X86
if(art->vendor == CPU_VENDOR_INTEL) { if(art->vendor == CPU_VENDOR_INTEL) {
COL_FANCY_1 = COLOR_BG_CYAN; COL_FANCY_1 = COLOR_FG_CYAN;
COL_FANCY_2 = COLOR_BG_WHITE; COL_FANCY_2 = COLOR_FG_WHITE;
COL_FANCY_3 = COLOR_FG_CYAN; COL_FANCY_3 = COLOR_FG_CYAN;
COL_FANCY_4 = COLOR_FG_WHITE; COL_FANCY_4 = COLOR_FG_WHITE;
art->ascii_chars[0] = '#'; art->ascii_chars[0] = '#';
@@ -262,6 +263,12 @@ struct ascii* set_ascii(VENDOR vendor, STYLE style, struct colors* cs) {
if(cs != NULL) { if(cs != NULL) {
COL_FANCY_1 = rgb_to_ansi(cs->c1, true, true); COL_FANCY_1 = rgb_to_ansi(cs->c1, true, true);
COL_FANCY_2 = rgb_to_ansi(cs->c2, true, true); COL_FANCY_2 = rgb_to_ansi(cs->c2, true, true);
#ifdef ARCH_X86
if(art->vendor == CPU_VENDOR_INTEL) {
COL_FANCY_1 = rgb_to_ansi(cs->c1, false, true);
COL_FANCY_2 = rgb_to_ansi(cs->c2, false, true);
}
#endif
COL_FANCY_3 = rgb_to_ansi(cs->c3, false, true); COL_FANCY_3 = rgb_to_ansi(cs->c3, false, true);
COL_FANCY_4 = rgb_to_ansi(cs->c4, false, true); COL_FANCY_4 = rgb_to_ansi(cs->c4, false, true);
} }
@@ -303,9 +310,11 @@ struct ascii* set_ascii(VENDOR vendor, STYLE style, struct colors* cs) {
} }
char tmp[NUMBER_OF_LINES * LINE_SIZE + 1]; char tmp[NUMBER_OF_LINES * LINE_SIZE + 1];
art->art_unicode = NULL;
#ifdef ARCH_X86 #ifdef ARCH_X86
if(art->vendor == CPU_VENDOR_INTEL) if(art->vendor == CPU_VENDOR_INTEL)
strcpy(tmp, INTEL_ASCII); art->art_unicode = art_unicode_intel;
else if(art->vendor == CPU_VENDOR_AMD) else if(art->vendor == CPU_VENDOR_AMD)
strcpy(tmp, AMD_ASCII); strcpy(tmp, AMD_ASCII);
else else
@@ -325,8 +334,11 @@ struct ascii* set_ascii(VENDOR vendor, STYLE style, struct colors* cs) {
strcpy(tmp, ARM_ASCII); strcpy(tmp, ARM_ASCII);
#endif #endif
for(int i=0; i < NUMBER_OF_LINES; i++) if(art->art_unicode != NULL) {
memcpy(art->art[i], tmp + i*LINE_SIZE, LINE_SIZE); for(int i=0; i < NUMBER_OF_LINES; i++) {
memcpy(art->art[i], tmp + i*LINE_SIZE, LINE_SIZE);
}
}
return art; return art;
} }
@@ -347,24 +359,26 @@ uint32_t longest_attribute_length(struct ascii* art) {
#ifdef ARCH_X86 #ifdef ARCH_X86
void print_algorithm_intel(struct ascii* art, int n, bool* flag) { void print_algorithm_intel(struct ascii* art, int n, bool* flag) {
for(int i=0; i < LINE_SIZE; i++) { *flag = false;
if(*flag) { int start = -1;
if(art->art[n][i] == ' ') { for(int i=0, newlines=0; newlines < n; i++) {
*flag = false; if(art->art_unicode[i] == '\n') {
printf("%s%c%s", art->color2_ascii, art->ascii_chars[1], art->reset); newlines++;
} start = i;
else { }
printf("%s%c%s", art->color1_ascii, art->ascii_chars[0], art->reset); }
}
for(int i=start+1, x=0; art->art_unicode[i] != '\n'; i++, x++) {
if(art->art_unicode[i] == ' ') {
printf(" ");
} }
else { else {
if(art->art[n][i] != ' ' && art->art[n][i] != '\0') { printf("%s", art->color1_ascii);
*flag = true; printf("%c", art->art_unicode[i]);
printf("%c",' '); printf("%c", art->art_unicode[i + 1]);
} printf("%c", art->art_unicode[i + 2]);
else { printf("%s", COLOR_RESET);
printf("%c",' '); i += 2;
}
} }
} }
} }