Moved most things to RGB565

This commit is contained in:
Wolfvak 2019-05-21 00:39:40 +02:00 committed by d0k3
parent 73d8d14bd5
commit 50e97d2dab
8 changed files with 123 additions and 155 deletions

View File

@ -90,6 +90,15 @@ void PXI_RX_Handler(u32 __attribute__((unused)) irqn)
break;
}
case PXI_SET_VMODE:
{
int mode = args[0] ? PDC_RGB24 : PDC_RGB565;
GPU_SetFramebufferMode(0, mode);
GPU_SetFramebufferMode(1, mode);
ret = 0;
break;
}
case PXI_I2C_READ:
{
ARM_InvDC_Range((void*)args[2], args[3]);

View File

@ -1,7 +1,9 @@
#pragma once
#define RGB(r,g,b) ((int) ((b)<<16|(g)<<8|(r)))
#define RGB(r,g,b) \
(((u32)(r) >> 3) << 11 | \
((u32)(g) >> 2) << 5 | \
((u32)(b) >> 3))
// a base set of colors below
#define COLOR_BLACK RGB(0x00, 0x00, 0x00)

View File

@ -131,62 +131,52 @@ bool SetFontFromPbm(const void* pbm, u32 pbm_size) {
return true;
}
void ClearScreen(u8* screen, int color)
void ClearScreen(u16* screen, u32 color)
{
u32 *screen_wide = (u32*)(void*)screen;
int width = (screen == TOP_SCREEN) ? SCREEN_WIDTH_TOP : SCREEN_WIDTH_BOT;
if (color == COLOR_TRANSPARENT) color = COLOR_BLACK;
if (!color) memset(screen, 0x00, (width * SCREEN_HEIGHT * 3));
else for (int i = 0; i < (width * SCREEN_HEIGHT); i++) {
*(screen++) = color >> 16; // B
*(screen++) = color >> 8; // G
*(screen++) = color & 0xFF; // R
}
if (color == COLOR_TRANSPARENT)
color = COLOR_BLACK;
color |= color << 16;
for (int i = 0; i < (width * SCREEN_HEIGHT / 2); i++)
*(screen_wide++) = color;
}
void ClearScreenF(bool clear_main, bool clear_alt, int color)
void ClearScreenF(bool clear_main, bool clear_alt, u32 color)
{
if (clear_main) ClearScreen(MAIN_SCREEN, color);
if (clear_alt) ClearScreen(ALT_SCREEN, color);
}
u32 GetColor(u8* screen, int x, int y)
u16 GetColor(u16 *screen, int x, int y)
{
u32 color = 0;
int xDisplacement = (x * BYTES_PER_PIXEL * SCREEN_HEIGHT);
int yDisplacement = ((SCREEN_HEIGHT - y - 1) * BYTES_PER_PIXEL);
u8* screenPos = screen + xDisplacement + yDisplacement;
color |= (*(screenPos + 0) << 16 ); // B
color |= (*(screenPos + 1) << 8 ); // G
color |= (*(screenPos + 2) << 0 ); // R
return color;
int xDisplacement = x * SCREEN_HEIGHT;
int yDisplacement = SCREEN_HEIGHT - y - 1;
return screen[xDisplacement + yDisplacement];
}
void DrawPixel(u8* screen, int x, int y, int color)
void DrawPixel(u16 *screen, int x, int y, int color)
{
int xDisplacement = (x * BYTES_PER_PIXEL * SCREEN_HEIGHT);
int yDisplacement = ((SCREEN_HEIGHT - y - 1) * BYTES_PER_PIXEL);
u8* screenPos = screen + xDisplacement + yDisplacement;
*(screenPos + 0) = color >> 16; // B
*(screenPos + 1) = color >> 8; // G
*(screenPos + 2) = color & 0xFF; // R
int xDisplacement = x * SCREEN_HEIGHT;
int yDisplacement = SCREEN_HEIGHT - y - 1;
screen[xDisplacement + yDisplacement] = color;
}
void DrawRectangle(u8* screen, int x, int y, int width, int height, int color)
void DrawRectangle(u16 *screen, int x, int y, int width, int height, int color)
{
for (int yy = 0; yy < height; yy++) {
int xDisplacement = (x * BYTES_PER_PIXEL * SCREEN_HEIGHT);
int yDisplacement = ((SCREEN_HEIGHT - (y + yy) - 1) * BYTES_PER_PIXEL);
u8* screenPos = screen + xDisplacement + yDisplacement;
int xDisplacement = x * SCREEN_HEIGHT;
int yDisplacement = (SCREEN_HEIGHT - (y + yy) - 1);
u16* screenPos = screen + xDisplacement + yDisplacement;
for (int xx = width - 1; xx >= 0; xx--) {
*(screenPos + 0) = color >> 16; // B
*(screenPos + 1) = color >> 8; // G
*(screenPos + 2) = color & 0xFF; // R
screenPos += BYTES_PER_PIXEL * SCREEN_HEIGHT;
*screenPos = color;
screenPos += SCREEN_HEIGHT;
}
}
}
void DrawBitmap(u8* screen, int x, int y, int w, int h, u8* bitmap)
void DrawBitmap(u16 *screen, int x, int y, int w, int h, const u8* bitmap)
{
// on negative values: center the bitmap
if (x < 0) x = (SCREEN_WIDTH(screen) - w) >> 1;
@ -196,20 +186,19 @@ void DrawBitmap(u8* screen, int x, int y, int w, int h, u8* bitmap)
if ((x < 0) || (y < 0) || (w > SCREEN_WIDTH(screen)) || (h > SCREEN_HEIGHT))
return;
u8* bitmapPos = bitmap;
for (int yy = 0; yy < h; yy++) {
int xDisplacement = (x * BYTES_PER_PIXEL * SCREEN_HEIGHT);
int yDisplacement = ((SCREEN_HEIGHT - (y + yy) - 1) * BYTES_PER_PIXEL);
u8* screenPos = screen + xDisplacement + yDisplacement;
int xDisplacement = x * SCREEN_HEIGHT;
int yDisplacement = SCREEN_HEIGHT - (y + yy) - 1;
u16 *screenPos = screen + xDisplacement + yDisplacement;
for (int xx = 0; xx < w; xx++) {
memcpy(screenPos, bitmapPos, BYTES_PER_PIXEL);
bitmapPos += BYTES_PER_PIXEL;
screenPos += BYTES_PER_PIXEL * SCREEN_HEIGHT;
*(screenPos) = RGB(bitmap[2], bitmap[1], bitmap[0]);
bitmap += 3;
screenPos += SCREEN_HEIGHT;
}
}
}
void DrawQrCode(u8* screen, u8* qrcode)
void DrawQrCode(u16 *screen, const u8* qrcode)
{
const u32 size_qr = qrcodegen_getSize(qrcode);
u32 size_qr_s = size_qr;
@ -230,42 +219,38 @@ void DrawQrCode(u8* screen, u8* qrcode)
// draw the QR code
u32 x_qr = (SCREEN_WIDTH(screen) - size_qr_s) / 2;
u32 y_qr = (SCREEN_HEIGHT - size_qr_s) / 2;
int xDisplacement = (x_qr * BYTES_PER_PIXEL * SCREEN_HEIGHT);
int xDisplacement = x_qr * SCREEN_HEIGHT;
for (u32 y = 0; y < size_qr_s; y++) {
int yDisplacement = ((SCREEN_HEIGHT - (y_qr + y) - 1) * BYTES_PER_PIXEL);
u8* screenPos = screen + xDisplacement + yDisplacement;
int yDisplacement = SCREEN_HEIGHT - (y_qr + y) - 1;
u16* screenPos = screen + xDisplacement + yDisplacement;
for (u32 x = 0; x < size_qr_s; x++) {
u8 c = qrcodegen_getModule(qrcode, x/scale, y/scale) ? 0x00 : 0xFF;
memset(screenPos, c, BYTES_PER_PIXEL);
screenPos += BYTES_PER_PIXEL * SCREEN_HEIGHT;
u16 c = qrcodegen_getModule(qrcode, x/scale, y/scale) ? COLOR_BLACK : COLOR_WHITE;
*(screenPos) = c;
screenPos += SCREEN_HEIGHT;
}
}
}
void DrawCharacter(u8* screen, int character, int x, int y, int color, int bgcolor)
void DrawCharacter(u16 *screen, int character, int x, int y, int color, int bgcolor)
{
for (int yy = 0; yy < (int) font_height; yy++) {
int xDisplacement = (x * BYTES_PER_PIXEL * SCREEN_HEIGHT);
int yDisplacement = ((SCREEN_HEIGHT - (y + yy) - 1) * BYTES_PER_PIXEL);
u8* screenPos = screen + xDisplacement + yDisplacement;
int xDisplacement = x * SCREEN_HEIGHT;
int yDisplacement = SCREEN_HEIGHT - (y + yy) - 1;
u16* screenPos = screen + xDisplacement + yDisplacement;
u8 charPos = font_bin[character * font_height + yy];
for (int xx = 7; xx >= (8 - (int) font_width); xx--) {
if ((charPos >> xx) & 1) {
*(screenPos + 0) = color >> 16; // B
*(screenPos + 1) = color >> 8; // G
*(screenPos + 2) = color & 0xFF; // R
*screenPos = color;
} else if (bgcolor != COLOR_TRANSPARENT) {
*(screenPos + 0) = bgcolor >> 16; // B
*(screenPos + 1) = bgcolor >> 8; // G
*(screenPos + 2) = bgcolor & 0xFF; // R
*screenPos = bgcolor;
}
screenPos += BYTES_PER_PIXEL * SCREEN_HEIGHT;
screenPos += SCREEN_HEIGHT;
}
}
}
void DrawString(u8* screen, const char *str, int x, int y, int color, int bgcolor, bool fix_utf8)
void DrawString(u16 *screen, const char *str, int x, int y, int color, int bgcolor, bool fix_utf8)
{
size_t max_len = (((screen == TOP_SCREEN) ? SCREEN_WIDTH_TOP : SCREEN_WIDTH_BOT) - x) / font_width;
size_t len = (strlen(str) > max_len) ? max_len : strlen(str);
@ -275,7 +260,7 @@ void DrawString(u8* screen, const char *str, int x, int y, int color, int bgcolo
}
}
void DrawStringF(u8* screen, int x, int y, int color, int bgcolor, const char *format, ...)
void DrawStringF(u16 *screen, int x, int y, int color, int bgcolor, const char *format, ...)
{
char str[STRBUF_SIZE] = { 0 };
va_list va;
@ -287,7 +272,7 @@ void DrawStringF(u8* screen, int x, int y, int color, int bgcolor, const char *f
DrawString(screen, text, x, y, color, bgcolor, true);
}
void DrawStringCenter(u8* screen, int color, int bgcolor, const char *format, ...)
void DrawStringCenter(u16 *screen, int color, int bgcolor, const char *format, ...)
{
char str[STRBUF_SIZE] = { 0 };
va_list va;
@ -471,12 +456,11 @@ bool ShowPrompt(bool ask, const char *format, ...)
#ifndef AUTO_UNLOCK
#define PRNG (*(volatile u32*)0x10011000)
bool ShowUnlockSequence(u32 seqlvl, const char *format, ...) {
const int seqcolors[7] = { COLOR_STD_FONT, COLOR_BRIGHTGREEN, COLOR_BRIGHTYELLOW,
COLOR_ORANGE, COLOR_BRIGHTBLUE, COLOR_RED, COLOR_DARKRED };
static const int seqcolors[7] = { COLOR_STD_FONT, COLOR_BRIGHTGREEN,
COLOR_BRIGHTYELLOW, COLOR_ORANGE, COLOR_BRIGHTBLUE, COLOR_RED, COLOR_DARKRED };
const u32 seqlen_max = 7;
const u32 seqlen = seqlen_max - ((seqlvl < 3) ? 2 : (seqlvl < 4) ? 1 : 0);
u32 color_bg = COLOR_STD_BG;
u32 color_font = COLOR_STD_FONT;
u32 color_off = COLOR_GREY;

View File

@ -10,7 +10,7 @@
#include "fsdir.h" // only required for ShowFileScrollPrompt
#define BYTES_PER_PIXEL 3
#define BYTES_PER_PIXEL 2
#define SCREEN_HEIGHT 240
#define SCREEN_WIDTH(s) ((s == TOP_SCREEN) ? SCREEN_WIDTH_TOP : SCREEN_WIDTH_BOT)
#define SCREEN_WIDTH_TOP 400
@ -21,8 +21,8 @@
#define FONT_WIDTH_EXT GetFontWidth()
#define FONT_HEIGHT_EXT GetFontHeight()
#define TOP_SCREEN ((u8*)VRAM_TOP_LA)
#define BOT_SCREEN ((u8*)VRAM_BOT_A)
#define TOP_SCREEN ((u16*)VRAM_TOP_LA)
#define BOT_SCREEN ((u16*)VRAM_BOT_A)
#ifdef SWITCH_SCREENS
#define MAIN_SCREEN TOP_SCREEN
@ -48,19 +48,19 @@ bool ShowUnlockSequence(u32 seqlvl, const char *format, ...);
u8* GetFontFromPbm(const void* pbm, const u32 pbm_size, u32* w, u32* h);
bool SetFontFromPbm(const void* pbm, const u32 pbm_size);
u32 GetColor(u8* screen, int x, int y);
u16 GetColor(u16 *screen, int x, int y);
void ClearScreen(unsigned char *screen, int color);
void ClearScreenF(bool clear_main, bool clear_alt, int color);
void DrawPixel(u8* screen, int x, int y, int color);
void DrawRectangle(u8* screen, int x, int y, int width, int height, int color);
void DrawBitmap(u8* screen, int x, int y, int w, int h, u8* bitmap);
void DrawQrCode(u8* screen, u8* qrcode);
void ClearScreen(u16 *screen, u32 color);
void ClearScreenF(bool clear_main, bool clear_alt, u32 color);
void DrawPixel(u16 *screen, int x, int y, int color);
void DrawRectangle(u16 *screen, int x, int y, int width, int height, int color);
void DrawBitmap(u16 *screen, int x, int y, int w, int h, const u8* bitmap);
void DrawQrCode(u16 *screen, const u8* qrcode);
void DrawCharacter(unsigned char *screen, int character, int x, int y, int color, int bgcolor);
void DrawString(unsigned char *screen, const char *str, int x, int y, int color, int bgcolor, bool fix_utf8);
void DrawStringF(unsigned char *screen, int x, int y, int color, int bgcolor, const char *format, ...);
void DrawStringCenter(u8* screen, int color, int bgcolor, const char *format, ...);
void DrawCharacter(u16 *screen, int character, int x, int y, int color, int bgcolor);
void DrawString(u16 *screen, const char *str, int x, int y, int color, int bgcolor, bool fix_utf8);
void DrawStringF(u16 *screen, int x, int y, int color, int bgcolor, const char *format, ...);
void DrawStringCenter(u16 *screen, int color, int bgcolor, const char *format, ...);
u32 GetDrawStringHeight(const char* str);
u32 GetDrawStringWidth(const char* str);

View File

@ -103,6 +103,7 @@ u32 BootFirmHandler(const char* bootpath, bool verbose, bool delete) {
// boot the FIRM (if we got a proper fixpath)
if (*fixpath) {
if (delete) PathDelete(bootpath);
PXI_DoCMD(PXI_SET_VMODE, (u32[]){1}, 1);
PXI_DoCMD(PXI_LEGACY_MODE, NULL, 0);
BootFirm((FirmHeader*) firm, fixpath);
while(1);
@ -185,10 +186,11 @@ void CheckBattery(u32* battery, bool* is_charging) {
}
}
void GenerateBatteryBitmap(u8* bitmap, u32 width, u32 height, u32 color_bg) {
const u32 color_outline = COLOR_BLACK;
const u32 color_inline = COLOR_LIGHTGREY;
const u32 color_inside = COLOR_LIGHTERGREY;
void DrawBatteryBitmap(u16* screen, u32 b_x, u32 b_y, u32 width, u32 height) {
const u16 color_outline = COLOR_BLACK;
const u16 color_inline = COLOR_LIGHTGREY;
const u16 color_inside = COLOR_LIGHTERGREY;
const u16 color_bg = COLOR_TRANSPARENT;
if ((width < 8) || (height < 6)) return;
@ -196,7 +198,7 @@ void GenerateBatteryBitmap(u8* bitmap, u32 width, u32 height, u32 color_bg) {
bool is_charging;
CheckBattery(&battery, &is_charging);
u32 color_battery = (is_charging) ? COLOR_BATTERY_CHARGING :
u16 color_battery = (is_charging) ? COLOR_BATTERY_CHARGING :
(battery > 70) ? COLOR_BATTERY_FULL : (battery > 30) ? COLOR_BATTERY_MEDIUM : COLOR_BATTERY_LOW;
u32 nub_size = (height < 12) ? 1 : 2;
u32 width_inside = width - 4 - nub_size;
@ -206,15 +208,13 @@ void GenerateBatteryBitmap(u8* bitmap, u32 width, u32 height, u32 color_bg) {
const u32 mirror_y = (y >= (height+1) / 2) ? height - 1 - y : y;
for (u32 x = 0; x < width; x++) {
const u32 rev_x = width - x - 1;
u32 color = 0;
u16 color = 0;
if (mirror_y == 0) color = (rev_x >= nub_size) ? color_outline : color_bg;
else if (mirror_y == 1) color = ((x == 0) || (rev_x == nub_size)) ? color_outline : (rev_x < nub_size) ? color_bg : color_inline;
else if (mirror_y == 2) color = ((x == 0) || (rev_x <= nub_size)) ? color_outline : ((x == 1) || (rev_x == (nub_size+1))) ? color_inline : color_inside;
else color = ((x == 0) || (rev_x == 0)) ? color_outline : ((x == 1) || (rev_x <= (nub_size+1))) ? color_inline : color_inside;
if ((color == color_inside) && (x < (2 + width_battery))) color = color_battery;
*(bitmap++) = color >> 16; // B
*(bitmap++) = color >> 8; // G
*(bitmap++) = color & 0xFF; // R
if (color != color_bg) DrawPixel(screen, b_x + x, b_y + y, color);
}
}
}
@ -264,10 +264,7 @@ void DrawTopBar(const char* curr_path) {
char timestr[32];
GetTimeString(timestr, false, false);
DrawStringF(TOP_SCREEN, clock_x, bartxt_start, COLOR_STD_BG, COLOR_TOP_BAR, "%14.14s", timestr);
u8 bitmap[battery_width * battery_height * BYTES_PER_PIXEL];
GenerateBatteryBitmap(bitmap, battery_width, battery_height, COLOR_TOP_BAR);
DrawBitmap(TOP_SCREEN, battery_x, battery_y, battery_width, battery_height, bitmap);
DrawBatteryBitmap(TOP_SCREEN, battery_x, battery_y, battery_width, battery_height);
}
}
@ -674,7 +671,7 @@ u32 FileHexViewer(const char* path) {
u32 y = row * (FONT_HEIGHT_EXT + (2*vpad)) + vpad;
u32 curr_pos = row * cols;
u32 cutoff = (curr_pos >= total_data) ? 0 : (total_data >= curr_pos + cols) ? cols : total_data - curr_pos;
u8* screen = TOP_SCREEN;
u16* screen = TOP_SCREEN;
u32 x0 = 0;
// marked offsets handling

View File

@ -19,6 +19,9 @@ void main(int argc, char** argv, int entrypoint)
// ARM11 says it's ready
PXI_Barrier(ARM11_READY_BARRIER);
// Set screens to RGB16 mode
PXI_DoCMD(PXI_SET_VMODE, (u32[]){0}, 1);
// A pointer to the shared memory region is
// stored in the thread ID register in the ARM9
ARM_InitSHMEM();

View File

@ -26,61 +26,34 @@ static const TouchBox paint9_boxes[] = {
};
static const u8 color_picker_tmp[PAINT9_COLSEL_HEIGHT * BYTES_PER_PIXEL] = {
0xFD, 0x01, 0x00,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_N_BRUSHES][PAINT9_BRUSH_SIZE] = {
@ -146,10 +119,9 @@ u32 Paint9(void) {
u32 pick_x = paint9_boxes[1].x;
u32 pick_y = paint9_boxes[1].y;
for (u32 y = 0; y < PAINT9_COLSEL_HEIGHT; y++) {
const u8* rgb = color_picker_tmp + (y * BYTES_PER_PIXEL);
color = RGB(rgb[0], rgb[1], rgb[2]);
const u16* color = (u16*)(void*) (color_picker_tmp + (y * BYTES_PER_PIXEL));
for (u32 x = 0; x < PAINT9_COLSEL_WIDTH; x++)
DrawPixel(BOT_SCREEN, pick_x + x, pick_y + y, color);
DrawPixel(BOT_SCREEN, pick_x + x, pick_y + y, *color);
}
// draw brushes

View File

@ -30,6 +30,7 @@
enum {
PXI_LEGACY_MODE = 0,
PXI_GET_SHMEM,
PXI_SET_VMODE,
PXI_I2C_READ,
PXI_I2C_WRITE,