rgnano: UI simulator support

Change-Id: Id488d16e01ef49a9d1b57641bc1c22ed2fef4931
This commit is contained in:
Hairo R. Carela 2025-08-04 19:52:01 -04:00 committed by Solomon Peachy
parent b52bf1bf65
commit 7b0f408c71
7 changed files with 102 additions and 3 deletions

View file

@ -74,7 +74,7 @@ target/hosted/sdl/lcd-bitmap.c
target/hosted/sdl/lcd-remote-bitmap.c
#endif
target/hosted/sdl/lcd-sdl.c
#ifndef RG_NANO
#if !defined(RG_NANO) || defined(SIMULATOR)
target/hosted/sdl/window-sdl.c
#endif
target/hosted/sdl/system-sdl.c
@ -226,7 +226,7 @@ target/hosted/samsungypr/ypr1/wmcodec-ypr1.c
target/hosted/maemo/maemo-thread.c
#endif
#ifdef RG_NANO
#if defined(RG_NANO) && !defined(SIMULATOR)
target/hosted/sysfs.c
target/hosted/power-linux.c
target/hosted/backlight-unix.c

View file

@ -3,8 +3,11 @@
*/
/* We don't run on hardware directly */
#ifndef SIMULATOR
#define CONFIG_PLATFORM (PLATFORM_HOSTED)
#define PIVOT_ROOT "/mnt"
#endif
#define HAVE_FPU
/* For Rolo and boot loader */
@ -12,7 +15,9 @@
#define MODEL_NAME "RG Nano"
#ifndef SIMULATOR
#define USB_NONE
#endif
/* define this if you have a colour LCD */
#define HAVE_LCD_COLOR

View file

@ -536,6 +536,13 @@
#define UI_LCD_POSX 46
#define UI_LCD_POSY 61
#elif defined(RG_NANO)
#define UI_TITLE "Anbernic RG Nano"
#define UI_WIDTH 370
#define UI_HEIGHT 604
#define UI_LCD_POSX 64
#define UI_LCD_POSY 78
#elif defined(SIMULATOR)
#error no UI defines

6
tools/configure vendored
View file

@ -283,6 +283,11 @@ simcc () {
LDOPTS="$LDOPTS -fsanitize=undefined"
fi
# Clear FUNKEY_SDK SDL1.2 path from LDOPTS
if [ "$modelname" = "rgnano" ]; then
LDOPTS=""
fi
# Some linux setups like to warn about unused results. They are correct,
# but cleaning this up is a lot of work.
GCCOPTS="$GCCOPTS -Wno-unused-result"
@ -3667,7 +3672,6 @@ fi
t_cpu="hosted"
t_manufacturer="anbernic"
t_model="rgnano"
extradefines="$extradefines -DOS_USE_BYTESWAP_H"
;;
210|hifietma9)

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 KiB

View file

@ -89,5 +89,7 @@ erosq.c
fiio-m3k.c
#elif CONFIG_KEYPAD == SHANLING_Q1_PAD
shanling-q1.c
#elif CONFIG_KEYPAD == RG_NANO_PAD
rg-nano.c
#endif
#endif /* SIMULATOR */

View file

@ -0,0 +1,81 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 Szymon Dziok
*
* 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 <SDL.h>
#include "button.h"
#include "buttonmap.h"
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_KP_5:
case SDLK_RETURN:
case SDLK_x:
new_btn = BUTTON_A;
break;
case SDLK_ESCAPE:
case SDLK_z:
new_btn = BUTTON_B;
break;
case SDLK_s:
new_btn = BUTTON_X;
break;
case SDLK_a:
new_btn = BUTTON_Y;
break;
case SDLK_q:
new_btn = BUTTON_L;
break;
case SDLK_w:
new_btn = BUTTON_R;
break;
case SDLK_n:
new_btn = BUTTON_FN;
break;
case SDLK_m:
new_btn = BUTTON_START;
break;
}
return new_btn;
}
struct button_map bm[] = {
{ 0, 0, 0, 0, "None" }
};