diff --git a/.gitignore b/.gitignore index 68e28d35..4cae0cff 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .vscode/settings.json node_modules/ configs/MyBoard +.vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e80666bf..080e70d0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,5 +3,8 @@ // for the documentation about the extensions.json format "recommendations": [ "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" ] } diff --git a/include/bitmaps.h b/include/bitmaps.h new file mode 100644 index 00000000..ee57db7a --- /dev/null +++ b/include/bitmaps.h @@ -0,0 +1,176 @@ +// Hard coded default +const unsigned char splashImage[] = { + // 'canvas', 128x64px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xdf, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xcc, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x81, 0x98, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x3d, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xbf, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xdb, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc1, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7f, 0xf7, 0xff, 0x0f, 0xfc, 0x0f, 0x83, 0xc3, 0xc1, 0xf0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xf7, 0xff, 0x9f, 0xfe, 0x3f, 0xe3, 0xc3, 0xc7, 0xfc, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xf7, 0xff, 0x9f, 0xfe, 0x7f, 0xf3, 0xc3, 0xcf, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xf7, 0xff, 0xdf, 0xfe, 0x7f, 0xf3, 0xc3, 0xcf, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x87, 0xde, 0x1e, 0xf8, 0xf3, 0xc3, 0xcf, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x87, 0xde, 0x1e, 0xf8, 0xfb, 0xc3, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0x07, 0x87, 0xde, 0x1e, 0xf0, 0x7b, 0xc3, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0x07, 0x87, 0xc0, 0x3e, 0xf0, 0x7b, 0xc3, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf3, 0xf7, 0xff, 0xc0, 0x7e, 0xf0, 0x7b, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf3, 0xf7, 0xff, 0x81, 0xfc, 0xf0, 0x7b, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf3, 0xf7, 0xff, 0x83, 0xf8, 0xf0, 0x7b, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf3, 0xf7, 0xff, 0x0f, 0xe0, 0xf0, 0x79, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x80, 0x1f, 0xc0, 0xf0, 0x78, 0x03, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x80, 0x1f, 0x80, 0xf0, 0x78, 0x03, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x80, 0x1e, 0x1e, 0xf0, 0x78, 0x03, 0xdf, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x80, 0x1e, 0x1e, 0xf8, 0xf8, 0x03, 0xdf, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x80, 0x1f, 0xfe, 0x7f, 0xf0, 0x03, 0xcf, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xf7, 0x80, 0x1f, 0xfe, 0x7f, 0xf0, 0x03, 0xcf, 0xfe, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xf7, 0x80, 0x1f, 0xfe, 0x3f, 0xe0, 0x03, 0xc7, 0xfc, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7f, 0xe7, 0x80, 0x1f, 0xfe, 0x1f, 0xc0, 0x03, 0xc3, 0xf8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3f, 0x87, 0x80, 0x1f, 0xfe, 0x0f, 0x80, 0x03, 0xc0, 0xf0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +// Split up images for boot animation without a huge byte array. +const unsigned char bootLogoTop[] = { + // 'gp2040logot', 43x39px + 0x00, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x01, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfc, + 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xc0, 0x00, 0x0f, 0xff, + 0xff, 0xff, 0xfe, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, + 0x00, 0x00, 0x06, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x7f, 0xb0, 0x00, 0x00, 0x1c, 0x0f, 0x33, + 0x78, 0x00, 0x00, 0x3e, 0x06, 0x60, 0x78, 0x00, 0x00, 0x3e, 0x00, 0xf6, 0x30, 0x00, 0x00, 0x1c, + 0x06, 0xff, 0x60, 0x00, 0x00, 0x00, 0x0f, 0x6f, 0xf0, 0x00, 0x00, 0x00, 0x0f, 0x06, 0xf0, 0x00, + 0x00, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x30, 0x00, 0x00, 0x00, 0x01, 0x80, + 0x1f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x7f, 0xff, 0xff, + 0xc0, 0x00, 0x00, 0x1f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x01, + 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00 +}; +const unsigned char bootLogoBottom[] = { + // 'gp2040logotb', 80x21px + 0x7f, 0xf7, 0xff, 0x0f, 0xfc, 0x0f, 0x83, 0xc3, 0xc1, 0xf0, 0xff, 0xf7, 0xff, 0x9f, 0xfe, 0x3f, + 0xe3, 0xc3, 0xc7, 0xfc, 0xff, 0xf7, 0xff, 0x9f, 0xfe, 0x7f, 0xf3, 0xc3, 0xcf, 0xfe, 0xff, 0xf7, + 0xff, 0xdf, 0xfe, 0x7f, 0xf3, 0xc3, 0xcf, 0xfe, 0xf0, 0xf7, 0x87, 0xde, 0x1e, 0xf8, 0xf3, 0xc3, + 0xcf, 0x1f, 0xf0, 0xf7, 0x87, 0xde, 0x1e, 0xf8, 0xfb, 0xc3, 0xdf, 0x0f, 0xf0, 0x07, 0x87, 0xde, + 0x1e, 0xf0, 0x7b, 0xc3, 0xdf, 0x0f, 0xf0, 0x07, 0x87, 0xc0, 0x3e, 0xf0, 0x7b, 0xc3, 0xdf, 0x0f, + 0xf3, 0xf7, 0xff, 0xc0, 0x7e, 0xf0, 0x7b, 0xff, 0xdf, 0x0f, 0xf3, 0xf7, 0xff, 0x81, 0xfc, 0xf0, + 0x7b, 0xff, 0xdf, 0x0f, 0xf3, 0xf7, 0xff, 0x83, 0xf8, 0xf0, 0x7b, 0xff, 0xdf, 0x0f, 0xf3, 0xf7, + 0xff, 0x0f, 0xe0, 0xf0, 0x79, 0xff, 0xdf, 0x0f, 0xf0, 0xf7, 0x80, 0x1f, 0xc0, 0xf0, 0x78, 0x03, + 0xdf, 0x0f, 0xf0, 0xf7, 0x80, 0x1f, 0x80, 0xf0, 0x78, 0x03, 0xdf, 0x0f, 0xf0, 0xf7, 0x80, 0x1e, + 0x1e, 0xf0, 0x78, 0x03, 0xdf, 0x0f, 0xf0, 0xf7, 0x80, 0x1e, 0x1e, 0xf8, 0xf8, 0x03, 0xdf, 0x1f, + 0xf0, 0xf7, 0x80, 0x1f, 0xfe, 0x7f, 0xf0, 0x03, 0xcf, 0xfe, 0xff, 0xf7, 0x80, 0x1f, 0xfe, 0x7f, + 0xf0, 0x03, 0xcf, 0xfe, 0xff, 0xf7, 0x80, 0x1f, 0xfe, 0x3f, 0xe0, 0x03, 0xc7, 0xfc, 0x7f, 0xe7, + 0x80, 0x1f, 0xfe, 0x1f, 0xc0, 0x03, 0xc3, 0xf8, 0x3f, 0x87, 0x80, 0x1f, 0xfe, 0x0f, 0x80, 0x03, + 0xc0, 0xf0 +}; + +// Replicating user uploaded image. +const unsigned char splashCustom[] = { + /* + // 'im numbah 1', 128x64px + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x67, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x86, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0xbe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xf0, 0x03, 0x6d, 0xbf, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xc3, 0x08, 0x7d, 0xf7, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x10, 0x02, 0x00, 0xfb, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xfc, 0x40, 0x00, 0x1e, 0x3b, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf9, 0x00, 0x00, 0x1f, 0xbb, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, + 0xff, 0xff, 0xfc, 0x00, 0x00, 0x78, 0x1f, 0x8b, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, + 0xff, 0xff, 0xc0, 0xc8, 0x01, 0xec, 0x1f, 0x37, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, + 0xff, 0xff, 0x1f, 0x80, 0x03, 0xda, 0x0c, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xce, 0x0f, 0xff, + 0xff, 0xfc, 0x7f, 0x00, 0x03, 0xfd, 0x0f, 0x7f, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xc6, 0x0f, 0xff, + 0xff, 0xf1, 0xfe, 0x00, 0x03, 0xb7, 0x0f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x0f, 0xff, + 0xff, 0xe7, 0xc0, 0x00, 0x07, 0xe9, 0x0f, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xe3, 0xe3, 0x0f, 0xff, + 0xff, 0xc8, 0x00, 0x00, 0x03, 0x6f, 0x0f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xe3, 0x0f, 0xff, + 0xff, 0x9b, 0x80, 0x00, 0x03, 0x5f, 0x13, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xe3, 0xc1, 0x8f, 0xff, + 0xff, 0x7b, 0xc0, 0x00, 0x00, 0x1e, 0x17, 0xff, 0x7f, 0xff, 0xff, 0xf0, 0xe3, 0x00, 0xff, 0xff, + 0xfe, 0xfb, 0xe0, 0x00, 0x00, 0x00, 0x17, 0xff, 0x7f, 0xff, 0xff, 0xe0, 0x32, 0x18, 0x67, 0xff, + 0xfc, 0xfb, 0xf0, 0x00, 0x00, 0x00, 0x33, 0xfc, 0xff, 0xff, 0xff, 0xc7, 0x10, 0x7c, 0x47, 0xff, + 0xf9, 0xfb, 0x78, 0x2e, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xe7, 0x8f, 0x98, 0xfe, 0x2f, 0xff, + 0xfb, 0xf9, 0x78, 0x27, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xe3, 0x9f, 0x88, 0xff, 0x3f, 0xff, + 0xf3, 0xfd, 0xb4, 0x77, 0x8f, 0x00, 0x00, 0x01, 0xff, 0xff, 0xe3, 0x9f, 0x04, 0x7f, 0xff, 0xff, + 0xf0, 0x05, 0xc8, 0x5f, 0xcf, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x9c, 0x06, 0x3f, 0xff, 0xff, + 0xe0, 0x02, 0xc8, 0xdf, 0xcf, 0xe0, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x98, 0x62, 0x3f, 0xff, 0xff, + 0xe0, 0x00, 0xe8, 0x1f, 0xed, 0xe0, 0x00, 0x00, 0xff, 0xc7, 0xf8, 0x81, 0xf3, 0xff, 0xff, 0xff, + 0xc0, 0x01, 0x70, 0x1e, 0x65, 0x9c, 0x5c, 0x00, 0xff, 0xc7, 0xf8, 0xc3, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x01, 0x50, 0x36, 0x73, 0x33, 0xcc, 0x00, 0xff, 0xc7, 0xcc, 0x47, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x00, 0xf0, 0x7d, 0xc2, 0x7b, 0xec, 0x00, 0xff, 0xc7, 0x84, 0x67, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x00, 0xf0, 0xfb, 0xd8, 0x27, 0xac, 0x00, 0xff, 0xc3, 0x80, 0x67, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x7a, 0x1f, 0xd7, 0x57, 0xec, 0x01, 0xff, 0xe3, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x76, 0x6f, 0xbb, 0xa7, 0xe4, 0x01, 0xff, 0xe1, 0x18, 0x7f, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x36, 0x37, 0x7f, 0x97, 0x64, 0x01, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x0e, 0x37, 0x7f, 0xc7, 0xf6, 0x01, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xb8, 0x00, 0x0c, 0x00, 0x3f, 0xfe, 0xf6, 0x01, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xb0, 0x00, 0x08, 0x00, 0x07, 0xfc, 0xf6, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xa0, 0x00, 0x18, 0x3f, 0x7b, 0xe0, 0x06, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xa0, 0x00, 0x18, 0x07, 0x8b, 0xe0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x16, 0x03, 0xf1, 0xe0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x80, 0x00, 0x17, 0x00, 0xfd, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x00, 0x17, 0xe0, 0x18, 0xc0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x00, 0x1b, 0xf8, 0x00, 0xc0, 0x00, 0x03, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x00, 0x1c, 0x7c, 0x00, 0x00, 0x00, 0x03, 0xec, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc0, 0x80, 0x0f, 0x87, 0x00, 0x00, 0x00, 0x07, 0xed, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe0, 0xc0, 0x07, 0xf8, 0xe0, 0x00, 0x01, 0x8f, 0xed, 0x87, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe1, 0xc0, 0x01, 0xff, 0x20, 0x1f, 0x9f, 0xff, 0xed, 0xb6, 0x3d, 0xdf, 0xff, 0xff, 0xff, 0xff, + 0xf3, 0xc0, 0x01, 0xff, 0xcf, 0xff, 0xbf, 0xff, 0xed, 0xf6, 0xd5, 0xda, 0x61, 0xff, 0xff, 0xff, + 0xf3, 0x80, 0x00, 0xf9, 0xe7, 0xff, 0x3f, 0xff, 0x85, 0xee, 0xd5, 0xd0, 0x5d, 0xef, 0xff, 0xff, + 0xfb, 0x00, 0x00, 0xff, 0x8f, 0xff, 0x7f, 0xff, 0xff, 0xee, 0xd5, 0xad, 0x5d, 0x86, 0xef, 0xff, + 0xf8, 0x00, 0x00, 0x7f, 0xbf, 0xfe, 0xff, 0xff, 0xff, 0xee, 0xc5, 0xab, 0x43, 0x35, 0xcf, 0xbf, + 0xfc, 0x00, 0x00, 0x7f, 0xbf, 0xfc, 0xff, 0xff, 0xff, 0xfe, 0xec, 0x2b, 0x5d, 0x75, 0xdf, 0xbf, + 0xfe, 0x00, 0x00, 0x3f, 0x9f, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x6f, 0x5d, 0x44, 0x1f, 0xbf, + 0xff, 0x00, 0x00, 0xbf, 0x9f, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x41, 0x75, 0xdf, 0x3f, + 0xff, 0x80, 0x01, 0xdf, 0x9f, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0x75, 0xdf, 0x7f, + 0xff, 0xc0, 0x39, 0xdf, 0x9f, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xde, 0x7f, + 0xff, 0xe0, 0x1b, 0xef, 0xbf, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xde, 0xff, + 0xff, 0xf0, 0x33, 0xf0, 0x3e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, + 0xff, 0xfc, 0x27, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xe0, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xfc, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + */ +}; \ No newline at end of file diff --git a/include/enums.h b/include/enums.h index c39c392a..77082aa4 100644 --- a/include/enums.h +++ b/include/enums.h @@ -11,6 +11,31 @@ typedef enum BUTTON_LAYOUT_ARCADE, BUTTON_LAYOUT_HITBOX, BUTTON_LAYOUT_WASD, + BUTTON_LAYOUT_UDLR, + BUTTON_LAYOUT_MIXBOX, + BUTTON_LAYOUT_MAMEA, } ButtonLayout; +typedef enum +{ + BUTTON_LAYOUT_ARCADEB, + BUTTON_LAYOUT_HITBOXB, + BUTTON_LAYOUT_WASDB, + BUTTON_LAYOUT_VEWLIX, + BUTTON_LAYOUT_VEWLIX7, + BUTTON_LAYOUT_CAPCOM, + BUTTON_LAYOUT_CAPCOM6, + BUTTON_LAYOUT_SEGA2P, + BUTTON_LAYOUT_NOIR8, + BUTTON_LAYOUT_MAMEB, +} ButtonLayoutRight; + +typedef enum +{ + STATICSPLASH, + CLOSEIN, + CLOSEINCUSTOM, + NOSPLASH, +} SplashMode; + #endif diff --git a/src/display.cpp b/src/display.cpp index 5c6a8cac..9679bbaa 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -8,6 +8,7 @@ #include "storage.h" #include "pico/stdlib.h" #include "OneBitDisplay.h" +#include "bitmaps.h" uint8_t ucBackBuffer[1024]; OBDISP obd; @@ -18,15 +19,221 @@ inline void clearScreen(int render = 0) obdFill(&obd, 0, render); } +inline void drawDiamond(int cx, int cy, int size, uint8_t colour, uint8_t filled) +{ + if (filled) { + int i; + for (i = 0; i < size; i++) { + obdDrawLine(&obd, cx - i, cy - size + i, cx + i, cy - size + i, colour, 0); + obdDrawLine(&obd, cx - i, cy + size - i, cx + i, cy + size - i, colour, 0); + } + obdDrawLine(&obd, cx - size, cy, cx + size, cy, colour, 0); // Fill in the middle + } + obdDrawLine(&obd, cx - size, cy, cx, cy - size, colour, 0); + obdDrawLine(&obd, cx, cy - size, cx + size, cy, colour, 0); + obdDrawLine(&obd, cx + size, cy, cx, cy + size, colour, 0); + obdDrawLine(&obd, cx, cy + size, cx - size, cy, colour, 0); +} + inline void drawHitbox(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) { const int buttonMargin = buttonPadding + (buttonRadius * 2); - // UDLR + // Hitbox obdPreciseEllipse(&obd, startX, startY, buttonRadius, buttonRadius, 1, gamepad->pressedLeft()); obdPreciseEllipse(&obd, startX + buttonMargin, startY, buttonRadius, buttonRadius, 1, gamepad->pressedDown()); obdPreciseEllipse(&obd, startX + (buttonMargin * 1.875), startY + (buttonMargin / 2), buttonRadius, buttonRadius, 1, gamepad->pressedRight()); obdPreciseEllipse(&obd, startX + (buttonMargin * 2.25), startY + buttonMargin * 1.875, buttonRadius, buttonRadius, 1, gamepad->pressedUp()); +} + +inline void drawWasdBox(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // WASD + obdPreciseEllipse(&obd, startX, startY + buttonMargin * 0.5, buttonRadius, buttonRadius, 1, gamepad->pressedLeft()); + obdPreciseEllipse(&obd, startX + buttonMargin, startY + buttonMargin * 0.875, buttonRadius, buttonRadius, 1, gamepad->pressedDown()); + obdPreciseEllipse(&obd, startX + buttonMargin * 1.5, startY - buttonMargin * 0.125, buttonRadius, buttonRadius, 1, gamepad->pressedUp()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 2), startY + buttonMargin * 1.25, buttonRadius, buttonRadius, 1, gamepad->pressedRight()); +} + +inline void drawUDLR(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // UDLR + obdPreciseEllipse(&obd, startX, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, gamepad->pressedLeft()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedUp()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY + buttonMargin * 1.25, buttonRadius, buttonRadius, 1, gamepad->pressedDown()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 1.625), startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, gamepad->pressedRight()); +} + +inline void drawArcadeStick(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // Stick + obdPreciseEllipse(&obd, startX + (buttonMargin / 2), startY + (buttonMargin / 2), buttonRadius * 1.25, buttonRadius * 1.25, 1, 0); + + if (gamepad->pressedUp()) { + if (gamepad->pressedLeft()) { + obdPreciseEllipse(&obd, startX + (buttonMargin / 5), startY + (buttonMargin / 5), buttonRadius, buttonRadius, 1, 1); + } else if (gamepad->pressedRight()) { + obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY + (buttonMargin / 5), buttonRadius, buttonRadius, 1, 1); + } else { + obdPreciseEllipse(&obd, startX + (buttonMargin / 2), startY, buttonRadius, buttonRadius, 1, 1); + } + } else if (gamepad->pressedDown()) { + if (gamepad->pressedLeft()) { + obdPreciseEllipse(&obd, startX + (buttonMargin / 5), startY + (buttonMargin * 0.875), buttonRadius, buttonRadius, 1, 1); + } else if (gamepad->pressedRight()) { + obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY + (buttonMargin * 0.875), buttonRadius, buttonRadius, 1, 1); + } else { + obdPreciseEllipse(&obd, startX + buttonMargin / 2, startY + buttonMargin, buttonRadius, buttonRadius, 1, 1); + } + } else if (gamepad->pressedLeft()) { + obdPreciseEllipse(&obd, startX, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, 1); + } else if (gamepad->pressedRight()) { + obdPreciseEllipse(&obd, startX + buttonMargin, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, 1); + } else { + obdPreciseEllipse(&obd, startX + buttonMargin / 2, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, 1); + } +} + +inline void drawMAMEA(int startX, int startY, int buttonSize, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + buttonSize; + + // MAME + obdRectangle(&obd, startX, startY + buttonMargin, startX + buttonSize, startY + buttonSize + buttonMargin, 1, gamepad->pressedLeft()); + obdRectangle(&obd, startX + buttonMargin, startY + buttonMargin, startX + buttonSize + buttonMargin, startY + buttonSize + buttonMargin, 1, gamepad->pressedDown()); + obdRectangle(&obd, startX + buttonMargin, startY, startX + buttonSize + buttonMargin, startY + buttonSize, 1, gamepad->pressedUp()); + obdRectangle(&obd, startX + buttonMargin * 2, startY + buttonMargin, startX + buttonSize + buttonMargin * 2, startY + buttonSize + buttonMargin, 1, gamepad->pressedRight()); +} + +inline void drawMAMEB(int startX, int startY, int buttonSize, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + buttonSize; + + // 6-button MAME Style + obdRectangle(&obd, startX, startY, startX + buttonSize, startY + buttonSize, 1, gamepad->pressedB3()); + obdRectangle(&obd, startX + buttonMargin, startY, startX + buttonSize + buttonMargin, startY + buttonSize, 1, gamepad->pressedB4()); + obdRectangle(&obd, startX + buttonMargin * 2, startY, startX + buttonSize + buttonMargin * 2, startY + buttonSize, 1, gamepad->pressedR1()); + + obdRectangle(&obd, startX, startY + buttonMargin, startX + buttonSize, startY + buttonMargin + buttonSize, 1, gamepad->pressedB1()); + obdRectangle(&obd, startX + buttonMargin, startY + buttonMargin, startX + buttonSize + buttonMargin, startY + buttonMargin + buttonSize, 1, gamepad->pressedB2()); + obdRectangle(&obd, startX + buttonMargin * 2, startY + buttonMargin, startX + buttonSize + buttonMargin * 2, startY + buttonMargin + buttonSize, 1, gamepad->pressedR2()); + +} + +inline void drawMixBox(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // MixBox + drawDiamond(startX, startY, buttonRadius, 1, gamepad->pressedLeft()); + drawDiamond(startX + buttonMargin / 2, startY + buttonMargin / 2, buttonRadius, 1, gamepad->pressedDown()); + drawDiamond(startX + buttonMargin, startY, buttonRadius, 1, gamepad->pressedUp()); + drawDiamond(startX + buttonMargin, startY + buttonMargin, buttonRadius, 1, gamepad->pressedRight()); +} + +inline void drawVewlix(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // 8-button Vewlix + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + (buttonMargin * 0.2), buttonRadius, buttonRadius, 1, gamepad->pressedB3()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB4()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedL1()); + + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75) - (buttonMargin / 3), startY + buttonMargin + (buttonMargin * 0.2), buttonRadius, buttonRadius, 1, gamepad->pressedB1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedL2()); +} + +inline void drawVewlix7(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // 8-button Vewlix + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + (buttonMargin * 0.2), buttonRadius, buttonRadius, 1, gamepad->pressedB3()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB4()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedL1()); + + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75) - (buttonMargin / 3), startY + buttonMargin + (buttonMargin * 0.2), buttonRadius, buttonRadius, 1, gamepad->pressedB1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR2()); + //obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedL2()); +} + +inline void drawSega2p(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // 8-button Sega2P + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + (buttonMargin / 3), buttonRadius, buttonRadius, 1, gamepad->pressedB3()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB4()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY, buttonRadius, buttonRadius, 1, gamepad->pressedL1()); + + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + buttonMargin + (buttonMargin / 3), buttonRadius, buttonRadius, 1, gamepad->pressedB1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); +} + +inline void drawNoir8(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // 8-button Noir8 + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + (buttonMargin / 3.5), buttonRadius, buttonRadius, 1, gamepad->pressedB3()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB4()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY, buttonRadius, buttonRadius, 1, gamepad->pressedL1()); + + obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + buttonMargin + (buttonMargin / 3.5), buttonRadius, buttonRadius, 1, gamepad->pressedB1()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedR2()); + obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); +} + +inline void drawCapcom(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // 8-button Capcom + obdPreciseEllipse(&obd, startX + buttonMargin * 3.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedB3()); + obdPreciseEllipse(&obd, startX + buttonMargin * 4.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedB4()); + obdPreciseEllipse(&obd, startX + buttonMargin * 5.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedR1()); + obdPreciseEllipse(&obd, startX + buttonMargin * 6.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedL1()); + + obdPreciseEllipse(&obd, startX + buttonMargin * 3.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedB1()); + obdPreciseEllipse(&obd, startX + buttonMargin * 4.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedB2()); + obdPreciseEllipse(&obd, startX + buttonMargin * 5.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedR2()); + obdPreciseEllipse(&obd, startX + buttonMargin * 6.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); +} + +inline void drawCapcom6(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); + + // 6-button Capcom + obdPreciseEllipse(&obd, startX + buttonMargin * 3.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedB3()); + obdPreciseEllipse(&obd, startX + buttonMargin * 4.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedB4()); + obdPreciseEllipse(&obd, startX + buttonMargin * 5.25, startY, buttonRadius, buttonRadius, 1, gamepad->pressedR1()); + + obdPreciseEllipse(&obd, startX + buttonMargin * 3.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedB1()); + obdPreciseEllipse(&obd, startX + buttonMargin * 4.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedB2()); + obdPreciseEllipse(&obd, startX + buttonMargin * 5.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedR2()); +} + +inline void drawHitboxButtons(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +{ + const int buttonMargin = buttonPadding + (buttonRadius * 2); // 8-button obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY, buttonRadius, buttonRadius, 1, gamepad->pressedB3()); @@ -40,16 +247,10 @@ inline void drawHitbox(int startX, int startY, int buttonRadius, int buttonPaddi obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); } -inline void drawWasdBox(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +inline void drawWasdButtons(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) { const int buttonMargin = buttonPadding + (buttonRadius * 2); - // UDLR - obdPreciseEllipse(&obd, startX, startY + buttonMargin * 0.5, buttonRadius, buttonRadius, 1, gamepad->pressedLeft()); - obdPreciseEllipse(&obd, startX + buttonMargin, startY + buttonMargin * 0.875, buttonRadius, buttonRadius, 1, gamepad->pressedDown()); - obdPreciseEllipse(&obd, startX + buttonMargin * 1.5, startY - buttonMargin * 0.125, buttonRadius, buttonRadius, 1, gamepad->pressedUp()); - obdPreciseEllipse(&obd, startX + (buttonMargin * 2), startY + buttonMargin * 1.25, buttonRadius, buttonRadius, 1, gamepad->pressedRight()); - // 8-button obdPreciseEllipse(&obd, startX + buttonMargin * 3.625, startY, buttonRadius, buttonRadius, 1, gamepad->pressedB3()); obdPreciseEllipse(&obd, startX + buttonMargin * 4.625, startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB4()); @@ -62,16 +263,10 @@ inline void drawWasdBox(int startX, int startY, int buttonRadius, int buttonPadd obdPreciseEllipse(&obd, startX + buttonMargin * 6.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); } -inline void drawArcadeStick(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) +inline void drawArcadeButtons(int startX, int startY, int buttonRadius, int buttonPadding, Gamepad *gamepad) { const int buttonMargin = buttonPadding + (buttonRadius * 2); - // UDLR - obdPreciseEllipse(&obd, startX, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, gamepad->pressedLeft()); - obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedUp()); - obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY + buttonMargin * 1.25, buttonRadius, buttonRadius, 1, gamepad->pressedDown()); - obdPreciseEllipse(&obd, startX + (buttonMargin * 1.625), startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, gamepad->pressedRight()); - // 8-button obdPreciseEllipse(&obd, startX + buttonMargin * 3.125, startY, buttonRadius, buttonRadius, 1, gamepad->pressedB3()); obdPreciseEllipse(&obd, startX + buttonMargin * 4.125, startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, gamepad->pressedB4()); @@ -84,6 +279,37 @@ inline void drawArcadeStick(int startX, int startY, int buttonRadius, int button obdPreciseEllipse(&obd, startX + buttonMargin * 5.875, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); } +inline void drawSplashScreen(int splashMode, int splashSpeed) +{ + int mils = getMillis(); + switch (splashMode) + { + case STATICSPLASH: // Default, display static or custom image + if ((sizeof(splashCustom) / sizeof(*splashCustom)) > 0) { + obdDrawSprite(&obd, (uint8_t *)splashCustom, 128, 64, 16, 0, 0, 1); + } else { + obdDrawSprite(&obd, (uint8_t *)splashImage, 128, 64, 16, 0, 0, 1); + } + break; + case CLOSEIN: // Close-in. Animate the GP2040 logo + obdDrawSprite(&obd, (uint8_t *)bootLogoTop, 43, 39, 6, 43, std::min((mils / splashSpeed) - 39, 0), 1); + obdDrawSprite(&obd, (uint8_t *)bootLogoBottom, 80, 21, 10, 24, std::max(64 - (mils / (splashSpeed * 2)), 44), 1); + break; + case CLOSEINCUSTOM: // Close-in on custom image or delayed close-in if custom image does not exist + if ((sizeof(splashCustom) / sizeof(*splashCustom)) > 0) { + obdDrawSprite(&obd, (uint8_t *)splashCustom, 128, 64, 16, 0, 0, 1); + } + if (mils > 2500) { + int milss = mils - 2500; + obdRectangle(&obd, 0, 0, 127, 1 + (milss / splashSpeed), 0, 1); + obdRectangle(&obd, 0, 63, 127, 62 - (milss / (splashSpeed * 2)), 0, 1); + obdDrawSprite(&obd, (uint8_t *)bootLogoTop, 43, 39, 6, 43, std::min((milss / splashSpeed) - 39, 0), 1); + obdDrawSprite(&obd, (uint8_t *)bootLogoBottom, 80, 21, 10, 24, std::max(64 - (milss / (splashSpeed * 2)), 44), 1); + } + break; + } +} + inline void drawStatusBar() { obdWriteString(&obd, 0, 0, 0, (char *)statusBar.c_str(), FONT_6x8, 0, 0); @@ -149,24 +375,72 @@ void DisplayModule::loop() void DisplayModule::process(Gamepad *gamepad) { - clearScreen(); + // Check timer for splash + if (getMillis() < 7500 && SPLASH_MODE != NOSPLASH) { + clearScreen(); + drawSplashScreen(SPLASH_MODE, 90); + } else { + clearScreen(); - setStatusBar(gamepad); + setStatusBar(gamepad); - drawStatusBar(); - switch (BUTTON_LAYOUT) - { - case BUTTON_LAYOUT_ARCADE: - drawArcadeStick(8, 28, 8, 2, gamepad); - break; + drawStatusBar(); - case BUTTON_LAYOUT_HITBOX: - drawHitbox(8, 20, 8, 2, gamepad); - break; + switch (BUTTON_LAYOUT) + { + case BUTTON_LAYOUT_ARCADE: + drawArcadeStick(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_HITBOX: + drawHitbox(8, 20, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_WASD: + drawWasdBox(8, 28, 7, 3, gamepad); + break; + case BUTTON_LAYOUT_UDLR: + drawUDLR(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_MIXBOX: + drawMixBox(18, 28, 5, 2, gamepad); + break; + case BUTTON_LAYOUT_MAMEA: + drawMAMEA(8, 28, 10, 1, gamepad); + break; + } - case BUTTON_LAYOUT_WASD: - drawWasdBox(8, 28, 7, 3, gamepad); - break; + switch (BUTTON_LAYOUT_RIGHT) + { + case BUTTON_LAYOUT_ARCADEB: + drawArcadeButtons(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_HITBOXB: + drawHitboxButtons(8, 20, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_WASDB: + drawWasdButtons(8, 28, 7, 3, gamepad); + break; + case BUTTON_LAYOUT_VEWLIX: + drawVewlix(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_VEWLIX7: + drawVewlix7(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_CAPCOM: + drawCapcom(6, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_CAPCOM6: + drawCapcom6(16, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_SEGA2P: + drawSega2p(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_NOIR8: + drawNoir8(8, 28, 8, 2, gamepad); + break; + case BUTTON_LAYOUT_MAMEB: + drawMAMEB(68, 28, 10, 1, gamepad); + break; + } } obdDumpBuffer(&obd, NULL); diff --git a/src/leds.cpp b/src/leds.cpp index 14ba96be..38559a9a 100644 --- a/src/leds.cpp +++ b/src/leds.cpp @@ -192,7 +192,7 @@ vector> createLedButtonLayout(ButtonLayout layout, vector> createLedButtonLayout(ButtonLayout layout, vector