just straight cleanup

This commit is contained in:
Polprzewodnikowy 2022-01-16 22:52:45 +01:00
parent be4705da79
commit 3a75e1240f
3 changed files with 47 additions and 27 deletions

View File

@ -40,7 +40,12 @@ build_n64 () {
if [ "$FORCE_CLEAN" = true ]; then if [ "$FORCE_CLEAN" = true ]; then
make clean make clean
fi fi
make all -j USER_FLAGS="$USER_FLAGS -DGIT_BRANCH='$GIT_BRANCH' -DGIT_TAG='$GIT_TAG' -DGIT_SHA='$GIT_SHA' -DGIT_MESSAGE='$GIT_MESSAGE'" N64_FLAGS="$USER_FLAGS"
if [ ! -z "${GIT_BRANCH+x}" ]; then N64_FLAGS+=" -DGIT_BRANCH='\"$GIT_BRANCH\"'"; fi
if [ ! -z "${GIT_TAG+x}" ]; then N64_FLAGS+=" -DGIT_TAG='\"$GIT_TAG\"'"; fi
if [ ! -z "${GIT_SHA+x}" ]; then N64_FLAGS+=" -DGIT_SHA='\"$GIT_SHA\"'"; fi
if [ ! -z "${GIT_MESSAGE+x}" ]; then N64_FLAGS+=" -DGIT_MESSAGE='\"$GIT_MESSAGE\"'"; fi
make all -j USER_FLAGS="$N64_FLAGS"
popd > /dev/null popd > /dev/null
BUILT_N64=true BUILT_N64=true

View File

@ -145,9 +145,23 @@ static void exception_init_screen (void) {
io_write(&VI->CR, cfg->CR); io_write(&VI->CR, cfg->CR);
} }
static void exception_draw_character (int x, int y, char c) { static void exception_draw_character (char c) {
static int x = BORDER_WIDTH + (START_X_OFFSET * FONT_WIDTH);
static int y = BORDER_HEIGHT;
if (c == '\n') {
x = BORDER_WIDTH;
y += LINE_HEIGHT;
return;
}
if ((x + FONT_WIDTH) > (SCREEN_WIDTH - BORDER_WIDTH)) {
x = BORDER_WIDTH;
y += LINE_HEIGHT;
}
if ((c < ' ') || (c > '~')) { if ((c < ' ') || (c > '~')) {
c = 127; c = '\x7F';
} }
for (int i = 0; i < (FONT_WIDTH * FONT_HEIGHT); i++) { for (int i = 0; i < (FONT_WIDTH * FONT_HEIGHT); i++) {
@ -163,25 +177,13 @@ static void exception_draw_character (int x, int y, char c) {
io_write(&exception_framebuffer[screen_offset], FOREGROUND_COLOR); io_write(&exception_framebuffer[screen_offset], FOREGROUND_COLOR);
} }
} }
x += FONT_WIDTH;
} }
static void exception_print_string (const char *s) { static void exception_print_string (const char *s) {
static int x = BORDER_WIDTH + (START_X_OFFSET * FONT_WIDTH);
static int y = BORDER_HEIGHT;
while (*s != '\0') { while (*s != '\0') {
if (*s == '\n') { exception_draw_character(*s++);
x = BORDER_WIDTH;
y += LINE_HEIGHT;
s++;
} else {
if (x + FONT_WIDTH > (SCREEN_WIDTH - BORDER_WIDTH)) {
x = BORDER_WIDTH;
y += LINE_HEIGHT;
}
exception_draw_character(x, y, *s++);
x += FONT_WIDTH;
}
} }
} }
@ -233,7 +235,8 @@ void exception_fatal_handler (uint32_t exception_code, uint32_t interrupt_mask,
exception_init_screen(); exception_init_screen();
exception_print("----- SummerCart64 n64boot -----\n"); exception_print("----- SummerCart64 n64boot -----\n");
exception_print("branch: %s | tag: %s\n", version->git_branch, version->git_tag); exception_print("branch: %s\n", version->git_branch);
exception_print("tag: %s\n", version->git_tag);
exception_print("sha: %s\n", version->git_sha); exception_print("sha: %s\n", version->git_sha);
exception_print("msg: %s\n\n", version->git_message); exception_print("msg: %s\n\n", version->git_message);
exception_print("%s at pc: 0x%08lX\n", exception_get_description(exception_code), e->epc.u32); exception_print("%s at pc: 0x%08lX\n", exception_get_description(exception_code), e->epc.u32);

View File

@ -1,15 +1,27 @@
#include "version.h" #include "version.h"
#define STR(x...) #x
#define XSTR(s) STR(s)
version_t version = { version_t version = {
.git_branch = XSTR(GIT_BRANCH), #ifdef GIT_BRANCH
.git_tag = XSTR(GIT_TAG), .git_branch = GIT_BRANCH,
.git_sha = XSTR(GIT_SHA), #else
.git_message = XSTR(GIT_MESSAGE), #warning "No GIT_BRANCH provided"
#endif
#ifdef GIT_TAG
.git_tag = GIT_TAG,
#else
#warning "No GIT_TAG provided"
#endif
#ifdef GIT_SHA
.git_sha = GIT_SHA,
#else
#warning "No GIT_SHA provided"
#endif
#ifdef GIT_MESSAGE
.git_message = GIT_MESSAGE,
#else
#warning "No GIT_MESSAGE provided"
#endif
}; };