Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
1.6.0-bacon21
Added TG5040 and TG5050 targets for TrimUI handhelds running NextUI
* TG5040 covers the Brick, Brick Pro and Smart Pro; TG5050 is its own
platform with a separate toolchain and sysroot
* Both reuse the existing SDL2 adapter set; no new adapter code
* SDL2 window now takes the panel's full mode on these platforms,
so the scaled grid is centred in the real screen

1.6.0-bacon20
Fixed MIDI muting
Added MIDI chord command (MCHD)
Expand Down
1 change: 1 addition & 0 deletions docs/wiki/What-is-LittlePiggyTracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Getting lgpt to run depends on your platform:
- **gp32:** place LGPT.fxe, lgptNew, and lgpt10k in \GPMM
- **gp2x/caanoo:** place LGPT.gpe, lgptNew, and lgpt10k in the same folder (anywhere on your SD card)
- **win/mac/\*nix :** everything should be in the right spot, just run the executable in \install\bin\ (for fullscreen run “lgpt.exe -fullscreen”)
- **trimui (Brick / Brick Pro / Smart Pro / tg5050, NextUI firmware):** NextUI organises add-ons as "paks". Put the files in a folder called LGPT.pak under Tools/tg5040/ (or Tools/tg5050/) at the root of the SD card, alongside a launch.sh that runs the binary, then start it from the Tools menu. The package's INSTALL_HOW_TO.txt has a working launch.sh, including the LD_LIBRARY_PATH line these devices need to find their own SDL2.

## Importing Samples

Expand Down
4 changes: 4 additions & 0 deletions projects/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ BEAGLEBOARDDIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(RTAUDIODIRS) $(SDLDIRS)
DEBDIRS := $(DBDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RASPIDIRS := $(DBDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RG35XXPLUSDIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
TG5040DIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
TG5050DIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
STEAMDIRS := $(LINUXDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
X64DIRS := $(LINUXDIRS) $(RTMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
X86DIRS := $(LINUXDIRS) $(RTMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
Expand Down Expand Up @@ -327,6 +329,8 @@ DEBFILES := $(DBFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
BEAGLEBOARDFILES := $(LINUXFILES) $(DUMMYMIDIFILES)
RASPIFILES := $(DBFILES) $(RTAUDIOFILES) $(RTMIDIFILES)
RG35XXPLUSFILES := $(LINUXFILES) $(SDLAUDIOFILES) $(DUMMYMIDIFILES)
TG5040FILES := $(LINUXFILES) $(SDLAUDIOFILES) $(DUMMYMIDIFILES)
TG5050FILES := $(LINUXFILES) $(SDLAUDIOFILES) $(DUMMYMIDIFILES)
STEAMFILES := $(LINUXFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
X64FILES := $(LINUXFILES) $(RTMIDIFILES) $(SDLAUDIOFILES)
X86FILES := $(LINUXFILES) $(RTMIDIFILES) $(SDLAUDIOFILES)
Expand Down
68 changes: 68 additions & 0 deletions projects/Makefile.TG5040
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
-include $(PWD)/rules_base

#---------------------------------------------------------------------------------
# TrimUI handhelds running NextUI: "tg5040".
#
# tg5040 is NextUI's platform name for the whole Allwinner A133p family - the
# Brick, the Brick Pro and the Smart Pro all build and ship as tg5040, and all
# install to Tools/tg5040/ on the SD card. There is deliberately no separate
# Brick target: NextUI tells the devices apart at runtime, exporting
# DEVICE=brick / brickpro / smartpro, and the display code below just takes
# whatever mode the panel reports (1024x768 on a Brick, 1280x720 on a Smart
# Pro). tg5050 is a different platform with its own toolchain; see
# Makefile.TG5050.
#
# Built against the NextUI cross toolchain plus the TrimUI SDK sysroot, the
# same pair NextUI's own container image uses. Unpack them into DEVKIT (see
# the header comment in the other TrimUI makefile for the archive URLs), or
# point DEVKIT at your own copy:
#
# make PLATFORM=TG5040 DEVKIT=/path/to/aarch64-nextui-linux-gnu
#---------------------------------------------------------------------------------

DEFINES := \
-DPLATFORM_$(PLATFORM) \
-D_64BIT \
-DBUFFERED \
-DCPP_MEMORY \
-DHAVE_STDINT_H \
-D_NDEBUG \
-D_NO_JACK_ \
-DSDL2 \
-DSDLAUDIO \
-DDUMMYMIDI

DEVKIT ?= /opt/tg5040-nextui-toolchain
TRIPLET := aarch64-nextui-linux-gnu
CROSS_COMPILE := $(DEVKIT)/bin/$(TRIPLET)-

# The shared Makefile prepends $(DEVKITARM)/bin to PATH. Left unset that
# becomes a bare "/bin", which on an FHS-compat host (NixOS) shadows the
# build shell's python3 with one that has no Pillow, breaking mkfont.py.
DEVKITARM := $(DEVKIT)

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
TOOLPATH = $(DEVKIT)/bin

# The crosstool-NG compiler already resolves its own sysroot, so a bare -lSDL2
# links; the explicit include path is only so <SDL.h> style includes also work.
SYSROOT := $(shell $(CC) -print-sysroot)
SDL_CFLAGS := -D_REENTRANT -I$(SYSROOT)/usr/include/SDL2
SDL_LIBS := -lSDL2

OPT_FLAGS = -O3 -march=armv8-a+crypto+crc -fasynchronous-unwind-tables \
-fstack-protector-strong -Wformat -Wformat-security

INCLUDES = -Iinclude $(SDL_CFLAGS) -I$(PWD)/../sources
CFLAGS := $(DEFINES) $(INCLUDES) $(OPT_FLAGS) -Wall
CXXFLAGS := $(CFLAGS) -std=gnu++03
LIBS := $(SDL_LIBS) -lpthread

OUTPUT = ../lgpt-tg5040
EXTENSION := elf

%.elf: $(OFILES)
$(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
@$(STRIP) $@
58 changes: 58 additions & 0 deletions projects/Makefile.TG5050
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
-include $(PWD)/rules_base

#---------------------------------------------------------------------------------
# TrimUI "tg5050" (1280x720) running NextUI.
#
# Same adapter set and flags as TG5040; only the toolchain and the output name
# differ. NextUI ships tg5050 as its own platform with its own cross toolchain
# (gcc 10.3) and SDK sysroot, so the tg5040 binary is not reusable here.
#
# Unpack the tg5050 toolchain and sysroot into DEVKIT, or point it elsewhere:
#
# make PLATFORM=TG5050 DEVKIT=/path/to/tg5050/aarch64-nextui-linux-gnu
#---------------------------------------------------------------------------------

DEFINES := \
-DPLATFORM_$(PLATFORM) \
-D_64BIT \
-DBUFFERED \
-DCPP_MEMORY \
-DHAVE_STDINT_H \
-D_NDEBUG \
-D_NO_JACK_ \
-DSDL2 \
-DSDLAUDIO \
-DDUMMYMIDI

DEVKIT ?= /opt/tg5050-nextui-toolchain
TRIPLET := aarch64-nextui-linux-gnu
CROSS_COMPILE := $(DEVKIT)/bin/$(TRIPLET)-

# The shared Makefile prepends $(DEVKITARM)/bin to PATH. Left unset that
# becomes a bare "/bin", which on an FHS-compat host (NixOS) shadows the
# build shell's python3 with one that has no Pillow, breaking mkfont.py.
DEVKITARM := $(DEVKIT)

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
TOOLPATH = $(DEVKIT)/bin

SYSROOT := $(shell $(CC) -print-sysroot)
SDL_CFLAGS := -D_REENTRANT -I$(SYSROOT)/usr/include/SDL2
SDL_LIBS := -lSDL2

OPT_FLAGS = -O3 -march=armv8-a+crypto+crc -fasynchronous-unwind-tables \
-fstack-protector-strong -Wformat -Wformat-security

INCLUDES = -Iinclude $(SDL_CFLAGS) -I$(PWD)/../sources
CFLAGS := $(DEFINES) $(INCLUDES) $(OPT_FLAGS) -Wall
CXXFLAGS := $(CFLAGS) -std=gnu++03
LIBS := $(SDL_LIBS) -lpthread

OUTPUT = ../lgpt-tg5050
EXTENSION := elf

%.elf: $(OFILES)
$(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
@$(STRIP) $@
36 changes: 36 additions & 0 deletions projects/resources/TG5040/INSTALL_HOW_TO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Installation (TrimUI Brick / Brick Pro / Smart Pro, NextUI firmware)
===================================================================

NextUI organises add-ons as "paks": a folder ending in .pak containing a
launch.sh. Tools live in Tools/<platform>/ at the root of the SD card, and
this build's platform is "tg5040".

1. Make a folder on the SD card: /Tools/tg5040/LGPT.pak/
2. Copy into it: lgpt-tg5040.elf, config.xml, mapping.xml, custom_font.xml
3. Add a launch.sh in the same folder:

#!/bin/sh
cd "$(dirname "$0")"
chmod +x ./lgpt-tg5040.elf
export LD_LIBRARY_PATH="/usr/trimui/lib:$LD_LIBRARY_PATH"
exec ./lgpt-tg5040.elf

The LD_LIBRARY_PATH line is required. /etc/ld.so.conf is empty on these
devices and /usr/trimui/lib is not on the default search path, so without
it SDL2 either resolves to whatever another pak happened to leave behind
or is not found at all. It must be the device's own SDL2: other builds
are known to fail on the Brick's unsupported SDL_GetDisplayDPI query.

4. Put your samplelib/ and lgpt_* project folders next to the binary, or set
ROOTFOLDER in config.xml to keep them elsewhere on the card.
5. Launch LGPT from the Tools menu.

Controls
--------
D-pad navigate, A edit, B back, L/R modifiers, START play. SELECT and the
menu button are deliberately unmapped.

Notes
-----
Renders at a 3x integer scale: 960x720, centred on a 1024x768 Brick and
exactly full height on a 1280x720 Smart Pro.
17 changes: 17 additions & 0 deletions projects/resources/TG5040/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<CONFIG>
<AUTO_LOAD_LAST value="YES"/>

<!-- The UI grid is 320x240; SCREENMULT is the integer scale applied to it.
3 is the largest whole scale that fits every TrimUI panel NextUI runs
on: 960x720 centred on a 1024x768 Brick / Brick Pro, and exactly full
height on a 1280x720 Smart Pro or tg5050. -->
<SCREENMULT value="3"/>

<!-- ALSA dmix on these devices is unhappy with very small periods; 1024 is
a safe starting point. Drop to 512 for tighter timing if it holds. -->
<AUDIOBUFFERSIZE value="1024"/>

<KEYDELAY value="200"/>
<KEYREPEAT value="100"/>
<FONTTYPE value="0"/>
</CONFIG>
39 changes: 39 additions & 0 deletions projects/resources/TG5040/mapping.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
TrimUI Brick / Smart Pro built-in gamepad ("TRIMUI Player1", js0).

Raw SDL joystick indices, taken from the device's own SDL2
gamecontroller string:
a:b0 b:b1 x:b2 y:b3 leftshoulder:b4 rightshoulder:b5
back:b6 start:b7 guide:b8 leftstick:b9 rightstick:b10
dpup:h0.1 dpright:h0.2 dpdown:h0.4 dpleft:h0.8

SDL's "a" is the BOTTOM face button and "b" the RIGHT one, but the Brick
is labelled Nintendo-style (B bottom, A right), so the physical A is b1
and the physical B is b0 - deliberately crossed over below so that
LGPT's A (edit/enter) sits on the button actually printed "A".

hat direction index is LGPT's own, not SDL's bitmask:
0=up 1=right 2=down 3=left (see HatControllerSource::SetHat).

SELECT (b6) and the menu/guide button (b8) are intentionally left
unmapped - LGPT has no /event/select, and NextUI wants the menu button.

Set <DUMPEVENT value="YES"/> in config.xml to log raw events if you
want to re-derive these.
-->
<MAPPINGS>

<MAP src="hat:0:0:0" dst="/event/up" />
<MAP src="hat:0:0:1" dst="/event/right" />
<MAP src="hat:0:0:2" dst="/event/down" />
<MAP src="hat:0:0:3" dst="/event/left" />

<MAP src="but:0:1" dst="/event/a" />
<MAP src="but:0:0" dst="/event/b" />

<MAP src="but:0:4" dst="/event/lshoulder" />
<MAP src="but:0:5" dst="/event/rshoulder" />

<MAP src="but:0:7" dst="/event/start" />

</MAPPINGS>
36 changes: 36 additions & 0 deletions projects/resources/TG5050/INSTALL_HOW_TO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Installation (TrimUI tg5050, NextUI firmware)
===================================================================

NextUI organises add-ons as "paks": a folder ending in .pak containing a
launch.sh. Tools live in Tools/<platform>/ at the root of the SD card, and
this build's platform is "tg5050".

1. Make a folder on the SD card: /Tools/tg5050/LGPT.pak/
2. Copy into it: lgpt-tg5050.elf, config.xml, mapping.xml, custom_font.xml
3. Add a launch.sh in the same folder:

#!/bin/sh
cd "$(dirname "$0")"
chmod +x ./lgpt-tg5050.elf
export LD_LIBRARY_PATH="/usr/trimui/lib:$LD_LIBRARY_PATH"
exec ./lgpt-tg5050.elf

The LD_LIBRARY_PATH line is required. /etc/ld.so.conf is empty on these
devices and /usr/trimui/lib is not on the default search path, so without
it SDL2 either resolves to whatever another pak happened to leave behind
or is not found at all. It must be the device's own SDL2: other builds
are known to fail on the Brick's unsupported SDL_GetDisplayDPI query.

4. Put your samplelib/ and lgpt_* project folders next to the binary, or set
ROOTFOLDER in config.xml to keep them elsewhere on the card.
5. Launch LGPT from the Tools menu.

Controls
--------
D-pad navigate, A edit, B back, L/R modifiers, START play. SELECT and the
menu button are deliberately unmapped.

Notes
-----
Renders at a 3x integer scale: 960x720, centred on a 1024x768 Brick and
exactly full height on a 1280x720 Smart Pro.
17 changes: 17 additions & 0 deletions projects/resources/TG5050/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<CONFIG>
<AUTO_LOAD_LAST value="YES"/>

<!-- The UI grid is 320x240; SCREENMULT is the integer scale applied to it.
3 is the largest whole scale that fits every TrimUI panel NextUI runs
on: 960x720 centred on a 1024x768 Brick / Brick Pro, and exactly full
height on a 1280x720 Smart Pro or tg5050. -->
<SCREENMULT value="3"/>

<!-- ALSA dmix on these devices is unhappy with very small periods; 1024 is
a safe starting point. Drop to 512 for tighter timing if it holds. -->
<AUDIOBUFFERSIZE value="1024"/>

<KEYDELAY value="200"/>
<KEYREPEAT value="100"/>
<FONTTYPE value="0"/>
</CONFIG>
39 changes: 39 additions & 0 deletions projects/resources/TG5050/mapping.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
TrimUI Brick / Smart Pro built-in gamepad ("TRIMUI Player1", js0).

Raw SDL joystick indices, taken from the device's own SDL2
gamecontroller string:
a:b0 b:b1 x:b2 y:b3 leftshoulder:b4 rightshoulder:b5
back:b6 start:b7 guide:b8 leftstick:b9 rightstick:b10
dpup:h0.1 dpright:h0.2 dpdown:h0.4 dpleft:h0.8

SDL's "a" is the BOTTOM face button and "b" the RIGHT one, but the Brick
is labelled Nintendo-style (B bottom, A right), so the physical A is b1
and the physical B is b0 - deliberately crossed over below so that
LGPT's A (edit/enter) sits on the button actually printed "A".

hat direction index is LGPT's own, not SDL's bitmask:
0=up 1=right 2=down 3=left (see HatControllerSource::SetHat).

SELECT (b6) and the menu/guide button (b8) are intentionally left
unmapped - LGPT has no /event/select, and NextUI wants the menu button.

Set <DUMPEVENT value="YES"/> in config.xml to log raw events if you
want to re-derive these.
-->
<MAPPINGS>

<MAP src="hat:0:0:0" dst="/event/up" />
<MAP src="hat:0:0:1" dst="/event/right" />
<MAP src="hat:0:0:2" dst="/event/down" />
<MAP src="hat:0:0:3" dst="/event/left" />

<MAP src="but:0:1" dst="/event/a" />
<MAP src="but:0:0" dst="/event/b" />

<MAP src="but:0:4" dst="/event/lshoulder" />
<MAP src="but:0:5" dst="/event/rshoulder" />

<MAP src="but:0:7" dst="/event/start" />

</MAPPINGS>
4 changes: 4 additions & 0 deletions projects/resources/packaging/lgpt_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ collect_resources() { #1PLATFORM #2lgpt.*-exe
if [ "$1" == "PSP" ] ||
[ "$1" == "GARLIC" ] ||
[ "$1" == "RG35XXPLUS" ] ||
[ "$1" == "TG5040" ] ||
[ "$1" == "TG5050" ] ||
[ "$1" == "BITTBOY" ]; then # All files go in the root folder
zip -9 $PACKAGE -j $CONTENTS
elif [ "$1" == "MACOS" ]; then # .app is a folder
Expand Down Expand Up @@ -54,6 +56,8 @@ collect_resources CHIP lgpt.chip-exe
collect_resources BITTBOY lgpt-bittboy.elf
collect_resources GARLICPLUS lgpt-garlicplus.elf
collect_resources RG35XXPLUS lgpt-rg35xxplus.elf
collect_resources TG5040 lgpt-tg5040.elf
collect_resources TG5050 lgpt-tg5050.elf
collect_resources MACOS LittleGPTracker.app
# collect_resources RS97 lgpt.dge
# collect_resources STEAM lgpt.steam-exe
8 changes: 8 additions & 0 deletions sources/Adapters/SDL2/GUI/SDLGUIWindowImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ SDLGUIWindowImp::SDLGUIWindowImp(GUICreateWindowParams &p)
int screenWidth = displayMode.w;
int screenHeight = displayMode.h;
#endif

#if defined(PLATFORM_TG5040) || defined(PLATFORM_TG5050)
/* TrimUI handhelds under NextUI (Brick and Brick Pro at 1024x768, Smart Pro
and tg5050 at 1280x720) have no window manager, so keep the panel's full
mode taken above and let appAnchorX_/Y_ centre the scaled grid inside it.
Left windowed, SDL opens a 960x720 window on a 1024x768 panel. */
windowed_ = false;
#endif

#if defined(RS97)
/* Pick the best bitdepth for the RS97 as it will select 32 as its default, even though that's slow */
Expand Down
2 changes: 1 addition & 1 deletion sources/Application/Model/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#define PROJECT_NUMBER "1"
#define PROJECT_RELEASE "6"
#define BUILD_COUNT "0-bacon20"
#define BUILD_COUNT "0-bacon21"

#define MAX_TAP 3

Expand Down