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/configs/Pico/BoardConfig.h b/configs/Pico/BoardConfig.h index 5ee60526..b45fe39b 100644 --- a/configs/Pico/BoardConfig.h +++ b/configs/Pico/BoardConfig.h @@ -32,6 +32,9 @@ #define DEFAULT_SOCD_MODE SOCD_MODE_NEUTRAL #define BUTTON_LAYOUT BUTTON_LAYOUT_ARCADE +#define BUTTON_LAYOUT_RIGHT BUTTON_LAYOUT_VEWLIX + +#define SPLASH_MODE STATICSPLASH #define TURBO_LED_PIN 15 diff --git a/include/addons/i2cdisplay.h b/include/addons/i2cdisplay.h index 5f5e1849..92a8442c 100644 --- a/include/addons/i2cdisplay.h +++ b/include/addons/i2cdisplay.h @@ -71,6 +71,24 @@ class I2CDisplayAddon : public GPAddon void drawStatusBar(); void drawText(int startX, int startY, std::string text); void initMenu(char**); + //Adding my stuff here, remember to sort before PR + void drawDiamond(int cx, int cy, int size, uint8_t colour, uint8_t filled); + void drawUDLR(int startX, int startY, int buttonRadius, int buttonPadding); + void drawMAMEA(int startX, int startY, int buttonSize, int buttonPadding); + void drawMAMEB(int startX, int startY, int buttonSize, int buttonPadding); + void drawMixBox(int startX, int startY, int buttonRadius, int buttonPadding); + void drawVewlix(int startX, int startY, int buttonRadius, int buttonPadding); + void drawVewlix7(int startX, int startY, int buttonRadius, int buttonPadding); + void drawSega2p(int startX, int startY, int buttonRadius, int buttonPadding); + void drawNoir8(int startX, int startY, int buttonRadius, int buttonPadding); + void drawCapcom(int startX, int startY, int buttonRadius, int buttonPadding); + void drawCapcom6(int startX, int startY, int buttonRadius, int buttonPadding); + void drawHitboxButtons(int startX, int startY, int buttonRadius, int buttonPadding); + void drawWasdButtons(int startX, int startY, int buttonRadius, int buttonPadding); + void drawArcadeButtons(int startX, int startY, int buttonRadius, int buttonPadding); + void drawSplashScreen(int splashMode, int splashSpeed); + void drawDancepadA(int startX, int startY, int buttonSize, int buttonPadding); + void drawDancepadB(int startX, int startY, int buttonSize, int buttonPadding); uint8_t ucBackBuffer[1024]; OBDISP obd; std::string statusBar; diff --git a/include/bitmaps.h b/include/bitmaps.h new file mode 100644 index 00000000..d73f2c63 --- /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. Uncomment to test. +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 4b001785..84411f0c 100644 --- a/include/enums.h +++ b/include/enums.h @@ -6,8 +6,35 @@ typedef enum BUTTON_LAYOUT_ARCADE, BUTTON_LAYOUT_HITBOX, BUTTON_LAYOUT_WASD, + BUTTON_LAYOUT_UDLR, + BUTTON_LAYOUT_MIXBOX, + BUTTON_LAYOUT_MAMEA, + BUTTON_LAYOUT_DANCEPADA, } 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, + BUTTON_LAYOUT_DANCEPADB, +} ButtonLayoutRight; + +typedef enum +{ + STATICSPLASH, + CLOSEIN, + CLOSEINCUSTOM, + NOSPLASH, +} SplashMode; + typedef enum { CONFIG_TYPE_WEB = 0, diff --git a/src/addons/i2cdisplay.cpp b/src/addons/i2cdisplay.cpp index 3d5b27c2..70b83112 100644 --- a/src/addons/i2cdisplay.cpp +++ b/src/addons/i2cdisplay.cpp @@ -8,6 +8,7 @@ #include "helper.h" #include "storagemanager.h" #include "pico/stdlib.h" +#include "bitmaps.h" bool I2CDisplayAddon::available() { BoardOptions boardOptions = Storage::getInstance().getBoardOptions(); @@ -39,6 +40,8 @@ void I2CDisplayAddon::process() { drawStatusBar(); drawText(0, 3, "[Web Config Mode]"); drawText(0, 4, std::string("GP2040-CE : ") + std::string(GP2040VERSION)); + } else if (getMillis() < 7500 && SPLASH_MODE != NOSPLASH) { + drawSplashScreen(SPLASH_MODE, 90); } else { drawStatusBar(); switch (BUTTON_LAYOUT) @@ -54,6 +57,55 @@ void I2CDisplayAddon::process() { case BUTTON_LAYOUT_WASD: drawWasdBox(8, 28, 7, 3); break; + case BUTTON_LAYOUT_UDLR: + drawUDLR(8, 28, 8, 2); + break; + case BUTTON_LAYOUT_MIXBOX: + drawMixBox(18, 28, 5, 2); + break; + case BUTTON_LAYOUT_MAMEA: + drawMAMEA(8, 28, 10, 1); + break; + case BUTTON_LAYOUT_DANCEPADA: + drawDancepadA(39, 12, 15, 2); + break; + } + + switch (BUTTON_LAYOUT_RIGHT) + { + case BUTTON_LAYOUT_ARCADEB: + drawArcadeButtons(8, 28, 8, 2); + break; + case BUTTON_LAYOUT_HITBOXB: + drawHitboxButtons(8, 20, 8, 2); + break; + case BUTTON_LAYOUT_WASDB: + drawWasdButtons(8, 28, 7, 3); + break; + case BUTTON_LAYOUT_VEWLIX: + drawVewlix(8, 28, 8, 2); + break; + case BUTTON_LAYOUT_VEWLIX7: + drawVewlix7(8, 28, 8, 2); + break; + case BUTTON_LAYOUT_CAPCOM: + drawCapcom(6, 28, 8, 2); + break; + case BUTTON_LAYOUT_CAPCOM6: + drawCapcom6(16, 28, 8, 2); + break; + case BUTTON_LAYOUT_SEGA2P: + drawSega2p(8, 28, 8, 2); + break; + case BUTTON_LAYOUT_NOIR8: + drawNoir8(8, 28, 8, 2); + break; + case BUTTON_LAYOUT_MAMEB: + drawMAMEB(68, 28, 10, 1); + break; + case BUTTON_LAYOUT_DANCEPADB: + drawDancepadB(39, 12, 15, 2); + break; } } @@ -64,15 +116,235 @@ void I2CDisplayAddon::clearScreen(int render) { obdFill(&obd, 0, render); } -void I2CDisplayAddon::drawHitbox(int startX, int startY, int buttonRadius, int buttonPadding) { +void I2CDisplayAddon::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); +} + +void I2CDisplayAddon::drawHitbox(int startX, int startY, int buttonRadius, int buttonPadding) +{ Gamepad * gamepad = Storage::getInstance().GetGamepad(); 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()); +} + +void I2CDisplayAddon::drawWasdBox(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawUDLR(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawArcadeStick(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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); + } +} + +void I2CDisplayAddon::drawMAMEA(int startX, int startY, int buttonSize, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawMAMEB(int startX, int startY, int buttonSize, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); + +} + +void I2CDisplayAddon::drawMixBox(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawVewlix(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawVewlix7(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawSega2p(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawNoir8(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawCapcom(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawCapcom6(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + 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()); +} + +void I2CDisplayAddon::drawHitboxButtons(int startX, int startY, int buttonRadius, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + const int buttonMargin = buttonPadding + (buttonRadius * 2); // 8-button obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY, buttonRadius, buttonRadius, 1, gamepad->pressedB3()); @@ -86,17 +358,11 @@ void I2CDisplayAddon::drawHitbox(int startX, int startY, int buttonRadius, int b obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); } -void I2CDisplayAddon::drawWasdBox(int startX, int startY, int buttonRadius, int buttonPadding) +void I2CDisplayAddon::drawWasdButtons(int startX, int startY, int buttonRadius, int buttonPadding) { Gamepad * gamepad = Storage::getInstance().GetGamepad(); 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()); @@ -109,17 +375,11 @@ void I2CDisplayAddon::drawWasdBox(int startX, int startY, int buttonRadius, int obdPreciseEllipse(&obd, startX + buttonMargin * 6.25, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); } -void I2CDisplayAddon::drawArcadeStick(int startX, int startY, int buttonRadius, int buttonPadding) +void I2CDisplayAddon::drawArcadeButtons(int startX, int startY, int buttonRadius, int buttonPadding) { Gamepad * gamepad = Storage::getInstance().GetGamepad(); 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()); @@ -132,6 +392,62 @@ void I2CDisplayAddon::drawArcadeStick(int startX, int startY, int buttonRadius, obdPreciseEllipse(&obd, startX + buttonMargin * 5.875, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2()); } +// I pulled this out of my PR, brought it back because of recent talks re: SOCD and rhythm games +// Enjoy! + +void I2CDisplayAddon::drawDancepadA(int startX, int startY, int buttonSize, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + const int buttonMargin = buttonPadding + buttonSize; + + obdRectangle(&obd, startX, startY + buttonMargin, startX + buttonSize, startY + buttonSize + buttonMargin, 1, gamepad->pressedLeft()); + obdRectangle(&obd, startX + buttonMargin, startY + buttonMargin * 2, startX + buttonSize + buttonMargin, startY + buttonSize + buttonMargin * 2, 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()); +} + +void I2CDisplayAddon::drawDancepadB(int startX, int startY, int buttonSize, int buttonPadding) +{ + Gamepad * gamepad = Storage::getInstance().GetGamepad(); + const int buttonMargin = buttonPadding + buttonSize; + + obdRectangle(&obd, startX, startY, startX + buttonSize, startY + buttonSize, 1, gamepad->pressedB2()); // Up/Left + obdRectangle(&obd, startX, startY + buttonMargin * 2, startX + buttonSize, startY + buttonSize + buttonMargin * 2, 1, gamepad->pressedB4()); // Down/Left + obdRectangle(&obd, startX + buttonMargin * 2, startY, startX + buttonSize + buttonMargin * 2, startY + buttonSize, 1, gamepad->pressedB1()); // Up/Right + obdRectangle(&obd, startX + buttonMargin * 2, startY + buttonMargin * 2, startX + buttonSize + buttonMargin * 2, startY + buttonSize + buttonMargin * 2, 1, gamepad->pressedB3()); // Down/Right +} + +void I2CDisplayAddon::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; + } +} + void I2CDisplayAddon::drawText(int x, int y, std::string text) { obdWriteString(&obd, 0, x, y, (char*)text.c_str(), FONT_6x8, 0, 0); }