Skip to content

Commit

Permalink
Merge pull request #2 from christianhaitian/master
Browse files Browse the repository at this point in the history
Adds support for additional RK3326 platforms.
  • Loading branch information
Tardigrade-nx authored Jul 19, 2021
2 parents ae134ee + b997483 commit 1ee7591
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ TARGET = 351Files

# DEVICE ?= RG351P
# DEVICE ?= RG351V
# DEVICE ?= RGB10
# DEVICE ?= RK2020
# DEVICE ?= CHI
DEVICE ?= PC

START_PATH ?= "/"
Expand Down
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,40 @@ Text editor:
* R1/R2: page down
* L1/L2 : page up

# Building
package requirements: SDL2 SDL2_image SDL2_ttf SDL2-dev SDL2_image-dev SDL2_ttf-dev

git clone https://github.com/christianhaitian/351Files.git
cd 351Files

## For 351V and 351ELEC
./build_RG351.sh RG351V 351ELEC /storage/roms ./res

## For 351P and 351ELEC
./build_RG351.sh RG351P 351ELEC /storage/roms ./res

## For 351V and ArkOS
./build_RG351.sh RG351V ArkOS /roms ./res

## For 351P and ArkOS
./build_RG351.sh RG351P ArkOS /roms ./res

## For RGB10/OGA 1.1 (BE) and ArkOS
./build_RG351.sh RGB10 ArkOS /roms ./res

## For RK2020/OGA 1.0 and ArkOS
./build_RG351.sh RK2020 ArkOS /roms ./res

## For CHI and ArkOS
./build_RG351.sh CHI ArkOS /roms ./res

Copy the res folder to your preferred folder location along with the 351Files executable. \
You can also just grab the generated .tgz file and do as instructed in the installation section above in this readme.

# Compilation:
Define the following variables when executing 'make':
* CC
* SDL2_CONFIG
* DEVICE: RG351P / RG351V / PC
* DEVICE: CHI / RG351P / RG351V / RGB10 / RK2020 / PC
* START_PATH
* RES_PATH
26 changes: 19 additions & 7 deletions build_RG351.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/env bash

TOOLCHAIN_DIR="$HOME"/Dev/351ELEC/build.351ELEC-RG351V.aarch64/toolchain
VERSION="$1"
#TOOLCHAIN_DIR="$HOME"/Dev/351ELEC/build.351ELEC-RG351V.aarch64/toolchain
VERSION="1.0"

set -eE

Expand All @@ -15,7 +15,8 @@ build351Files() {
START_PATH="$3"
RES_PATH="$4"
make clean
make CC="$TOOLCHAIN_DIR"/bin/aarch64-libreelec-linux-gnueabi-g++ DEVICE="$DEVICE" SDL2_CONFIG="$TOOLCHAIN_DIR"/aarch64-libreelec-linux-gnueabi/sysroot/usr/bin/sdl2-config START_PATH="$START_PATH" RES_PATH="$RES_PATH"
make CC=g++ DEVICE="$DEVICE" SDL2_CONFIG=sdl2-config START_PATH="$START_PATH" RES_PATH="$RES_PATH"
strip 351Files
mkdir -p build/351Files
cp -r 351Files README.md res build/351Files
cp launchers/"$FIRMWARE"/351Files.sh build
Expand All @@ -29,13 +30,24 @@ build351Files() {
rm -rf build

# Build for 351V, 351ELEC
build351Files RG351V 351ELEC /storage/roms ./res
#build351Files RG351V 351ELEC /storage/roms ./res

# Build for 351P, 351ELEC
build351Files RG351P 351ELEC /storage/roms ./res
#build351Files RG351P 351ELEC /storage/roms ./res

# Build for 351V, ArkOS
build351Files RG351V ArkOS /roms ./res
#build351Files RG351V ArkOS /roms ./res

# Build for 351P, ArkOS
build351Files RG351P ArkOS /roms ./res
#build351Files RG351P ArkOS /roms ./res

# Build for RGB10, ArkOS
#build351Files RGB10 ArkOS /roms ./res

# Build for RK2020, ArkOS
#build351Files RK2020 ArkOS /roms ./res

# Build for CHI, ArkOS
#build351Files CHI ArkOS /roms ./res

build351Files "$1" "$2" "$3" "$4"
101 changes: 100 additions & 1 deletion src/def.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,52 @@
#define KEYBOARD_MARGIN 8
#define KEYBOARD_KEY_SPACING 4

// Paraters for desktop PC
// Parameters for RGB10
#elif defined(DEVICE_RGB10)
#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 320
#define HARDWARE_ACCELERATION 0
#define FULLSCREEN 1
#define FONT_NAME "NotoSans-Regular.ttf"
#define FONT_NAME_MONO "NotoSansMono-Regular.ttf"
#define FONT_SIZE 14
#define LINE_HEIGHT 24
#define ICON_SIZE 24
#define MARGIN_X 8
#define KEYBOARD_MARGIN 3
#define KEYBOARD_KEY_SPACING 3

// Parameters for RK2020
#elif defined(DEVICE_RK2020)
#define SCREEN_WIDTH 480
#define SCREEN_HEIGHT 320
#define HARDWARE_ACCELERATION 0
#define FULLSCREEN 1
#define FONT_NAME "NotoSans-Regular.ttf"
#define FONT_NAME_MONO "NotoSansMono-Regular.ttf"
#define FONT_SIZE 14
#define LINE_HEIGHT 24
#define ICON_SIZE 24
#define MARGIN_X 8
#define KEYBOARD_MARGIN 3
#define KEYBOARD_KEY_SPACING 3

// Parameters for CHI
#elif defined(DEVICE_CHI)
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define HARDWARE_ACCELERATION 0
#define FULLSCREEN 1
#define FONT_NAME "NotoSans-Regular.ttf"
#define FONT_NAME_MONO "NotoSansMono-Regular.ttf"
#define FONT_SIZE 20
#define LINE_HEIGHT 32
#define ICON_SIZE 24
#define MARGIN_X 10
#define KEYBOARD_MARGIN 8
#define KEYBOARD_KEY_SPACING 4

// Paramaters for desktop PC
#else
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
Expand Down Expand Up @@ -115,6 +160,60 @@
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 10)
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 11)
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
#elif defined(DEVICE_RGB10)
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 8
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 9
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 10
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 11
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 14)
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 15)
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 8)
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 9)
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 10)
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 11)
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 14)
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 15)
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 2)
#elif defined(DEVICE_RK2020)
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 6
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 7
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 8
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 9
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 12)
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 13)
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 6)
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 7)
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 8)
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 9)
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 12)
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 13)
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 2)
#elif defined(DEVICE_CHI)
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 10
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 11
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 12
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 13
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 10)
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 11)
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 12)
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 13)
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 2)
#else
#define BUTTON_PRESSED_UP event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_UP
#define BUTTON_PRESSED_DOWN event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_DOWN
Expand Down

0 comments on commit 1ee7591

Please sign in to comment.