diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h index 5a08b27adf..f6686ca619 100644 --- a/firmware/target/hosted/sdl/sim-ui-defines.h +++ b/firmware/target/hosted/sdl/sim-ui-defines.h @@ -390,6 +390,13 @@ #define UI_WIDTH LCD_WIDTH #define UI_HEIGHT LCD_HEIGHT +#elif defined(SAMSUNG_YPCP3) +#define UI_TITLE "Samsung YP-CP3" +#define UI_WIDTH 614 /* width of GUI window */ +#define UI_HEIGHT 324 /* height of GUI window */ +#define UI_LCD_POSX 40 +#define UI_LCD_POSY 37 + #elif defined(SAMSUNG_YPR0) #define UI_TITLE "Samsung YP-R0" #define UI_WIDTH 313 /* width of GUI window */ diff --git a/uisimulator/bitmaps/UI-samsungypcp3.bmp b/uisimulator/bitmaps/UI-samsungypcp3.bmp new file mode 100644 index 0000000000..caea28a9f6 Binary files /dev/null and b/uisimulator/bitmaps/UI-samsungypcp3.bmp differ diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES index b9fa3b64ac..8dc2ccc7d5 100644 --- a/uisimulator/buttonmap/SOURCES +++ b/uisimulator/buttonmap/SOURCES @@ -62,7 +62,11 @@ sansa-connect.c #elif CONFIG_KEYPAD == SONY_NWZ_PAD sony-nwz.c #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD +#ifdef SAMSUNG_YPCP3 +samsung-ypcp3.c +#else samsung-ypr0.c +#endif #elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD creative-zen.c #elif CONFIG_KEYPAD == SONY_NWZA860_PAD diff --git a/uisimulator/buttonmap/samsung-ypcp3.c b/uisimulator/buttonmap/samsung-ypcp3.c new file mode 100644 index 0000000000..b678a95722 --- /dev/null +++ b/uisimulator/buttonmap/samsung-ypcp3.c @@ -0,0 +1,85 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2026 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#include +#include "button.h" +#include "buttonmap.h" + +/* The YP-CP3 has the YP-R0's keys, and the same keyboard layout here */ +int key_to_button(int keyboard_button) +{ + int new_btn = BUTTON_NONE; + switch (keyboard_button) + { + case SDLK_KP_4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP_6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP_8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP_2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_PAGEUP: + case SDLK_KP_9: + new_btn = BUTTON_MENU; + break; + case SDLK_KP_7: + new_btn = BUTTON_BACK; + break; + case SDLK_KP_5: + case SDLK_SPACE: + case SDLK_KP_ENTER: + case SDLK_RETURN: + new_btn = BUTTON_SELECT; + break; + case SDLK_KP_3: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_1: + new_btn = BUTTON_USER; + break; + } + return new_btn; +} + +/* The face carries the joystick and, below it, Back and Menu; User (Rec) + * and Power sit on the top edge, above them. Select comes first: the first + * area a click falls in wins. */ +struct button_map bm[] = { + { SDLK_KP_5, 517, 90, 11, "Select" }, + { SDLK_KP_8, 517, 66, 13, "Up" }, + { SDLK_KP_2, 517, 114, 13, "Down" }, + { SDLK_KP_4, 493, 90, 13, "Left" }, + { SDLK_KP_6, 541, 90, 13, "Right" }, + { SDLK_KP_7, 519, 159, 11, "Back" }, + { SDLK_KP_9, 519, 193, 11, "Menu" }, + { SDLK_KP_1, 480, 8, 12, "User" }, + { SDLK_KP_3, 531, 8, 12, "Power" }, + { 0, 0, 0, 0, "None" } +};