Improve display of title and version.

This commit is contained in:
Jacob Young 2021-04-18 07:25:44 -04:00
commit 908e208529
4 changed files with 47 additions and 14 deletions

View file

@ -2,16 +2,23 @@
# Makefile Options
# ----------------------------
CC = clang
CC ?= clang
NAME ?= TRANSFER
MAJOR_VERSION ?= 0
MINOR_VERSION ?= 0
PATCH_VERSION ?= 3
KIND_VERSION ?= n
BUILD_VERSION ?= -$(shell git rev-parse --short HEAD)
FULL_VERSION ?= v$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)$(KIND_VERSION)$(BUILD_VERSION)
ICON ?= transfer.png
DESCRIPTION ?= "Variable Transfer Program"
DESCRIPTION ?= "Variable Transfer Program $(FULL_VERSION)"
COMPRESSED ?= YES
ARCHIVED ?= YES
CFLAGS ?= -Wall -Wextra -Oz
CXXFLAGS ?= -Wall -Wextra -Oz
FLAGS ?= -Wall -Wextra -Oz -DVERSION='"$(FULL_VERSION)"'
CFLAGS ?= $(FLAGS)
CXXFLAGS ?= $(FLAGS)
EXTRA_CSOURCES ?= src/font.c
EXTRA_USERHEADERS ?= src/ti84pceg.inc src/font.h
@ -25,10 +32,21 @@ endif
include $(CEDEV)/meta/makefile.mk
src/font.h src/font.c: font/genfont
all:
$(Q)echo [done] prgm$(NAME) $(FULL_VERSION)
beta: KIND_VERSION = b
beta: BUILD_VERSION =
beta: all
release: BUILD_VERSION =
release: REV_VERSION =
release: all
src/font.h src/font.c: font/genfont makefile
$(Q)echo [running] $<
$(Q)$<
font/genfont: font/genfont.c
font/genfont: font/genfont.c makefile
$(Q)echo [compiling] $<
$(Q)$(CC) -O3 -flto $< `pkg-config --cflags --libs freetype2` -o $@

View file

@ -14,6 +14,7 @@ typedef struct mtp_global mtp_global_t;
#define usb_transfer_data_t mtp_global_t
/* Includes */
#include "font.h"
#include "ui.h"
#include "var.h"
@ -36,6 +37,8 @@ typedef struct mtp_global mtp_global_t;
#define lengthof(array) (sizeof(array) / sizeof(*(array)))
#define charsof(literal) (lengthof(literal) - 1)
#define COUNT_EACH(...) +1
#define OBJECT_BUFFER \
@ -2266,10 +2269,19 @@ int main(void) {
static mtp_global_t global;
usb_error_t error;
ui_Init();
printf(" TRANSFER v0.0.2b\n"
" Connect USB to PC.\n"
" Press [clear] to exit.\n"
"--------------------------------");
#define CENTER(string) \
printf("%*s%.*s", \
(LCD_WIDTH / FONT_WIDTH + \
charsof(string)) / 2, \
string, \
charsof(string) % \
(LCD_WIDTH / FONT_WIDTH) != 0, \
"\n");
CENTER("TRANSFER " VERSION);
CENTER("Connect USB to PC.");
CENTER("Press [clear] to exit.");
CENTER("--------------------------------");
ui_Lock();
static mtp_device_info_t device_info = {
.standard_version = 100, /* 1.00 */
.mtp_vendor_extension_id = 6,

View file

@ -8,9 +8,7 @@
#include <string.h>
#include <tice.h>
#define STATIC_ROWS 4
static uint8_t row, col, swap;
static uint8_t static_rows, row, col, swap;
#define buffer(n) (*(uint8_t (*)[4][LCD_WIDTH][LCD_HEIGHT >> 1])lcd_Ram)[(n) ^ swap]
void ui_Init(void) {
@ -31,6 +29,10 @@ void ui_Init(void) {
*(volatile uint8_t *volatile *)&lcd_UpBase = &buffer(0)[0][0];
}
void ui_Lock(void) {
static_rows = row;
}
void ui_Cleanup(void) {
boot_ClearVRAM();
boot_TurnOn();
@ -56,7 +58,7 @@ void outchar(char c) {
sizeof(buffer(1)) - FONT_HEIGHT_BYTES);
for (unsigned x = 0; x != LCD_WIDTH; ++x) {
memcpy(&buffer(0)[x][0], &buffer(1)[x][0],
FONT_HEIGHT_BYTES * STATIC_ROWS);
FONT_HEIGHT_BYTES * static_rows);
memset(&buffer(0)[x][((LCD_HEIGHT / FONT_HEIGHT - 1) *
FONT_HEIGHT) >> 1], 0xFF, FONT_HEIGHT_BYTES);
}

View file

@ -2,6 +2,7 @@
#define UI_H
void ui_Init(void);
void ui_Lock(void);
void ui_Cleanup(void);
#endif