From d0793bf71ef367e41b8dbd03a0ccbc11417f7415 Mon Sep 17 00:00:00 2001 From: djdiskmachine <110535302+djdiskmachine@users.noreply.github.com> Date: Thu, 13 Nov 2025 18:49:26 +0000 Subject: [PATCH 1/9] QWERTY keyboard on new project Pressing A + up on character selection in new project enters qwerty keyboard mode. --- CHANGELOG | 3 + docs/wiki/What-is-LittlePiggyTracker.md | 2 +- sources/Application/Model/Project.h | 4 +- .../Views/ModalDialogs/NewProjectDialog.cpp | 205 ++++++++++++++++-- .../Views/ModalDialogs/NewProjectDialog.h | 6 + 5 files changed, 201 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2be5d1f0..6e9dda89 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +1.6.0-bacon4 + QWERTY keyboard name entry for new projects + 1.5.0-bacon3 Contributions: purelygrey diff --git a/docs/wiki/What-is-LittlePiggyTracker.md b/docs/wiki/What-is-LittlePiggyTracker.md index 13641f55..93ee7edc 100644 --- a/docs/wiki/What-is-LittlePiggyTracker.md +++ b/docs/wiki/What-is-LittlePiggyTracker.md @@ -51,7 +51,7 @@ After that you can copy additional wavs to the lgptRoot/lgptProject/samples dire ## New project -When creating a new project, use the regen button to generate a random name. Generate a new name with Regen or edit it manually selecting characters with A and pressing up/down +When creating a new project, use the regen button to generate a random name. Generate a new name with Regen or edit it manually selecting characters with A and pressing up/down to enter the QWERTY keyboard. Exit QWERTY mode with B ## Multiple Projects diff --git a/sources/Application/Model/Project.h b/sources/Application/Model/Project.h index f4bb4410..1de5f2e9 100644 --- a/sources/Application/Model/Project.h +++ b/sources/Application/Model/Project.h @@ -19,8 +19,8 @@ #define VAR_SCALE MAKE_FOURCC('S', 'C', 'A', 'L') #define PROJECT_NUMBER "1" -#define PROJECT_RELEASE "5" -#define BUILD_COUNT "0-bacon3" +#define PROJECT_RELEASE "6" +#define BUILD_COUNT "0-bacon4" #define MAX_TAP 3 diff --git a/sources/Application/Views/ModalDialogs/NewProjectDialog.cpp b/sources/Application/Views/ModalDialogs/NewProjectDialog.cpp index 3be2afcc..6551a32d 100644 --- a/sources/Application/Views/ModalDialogs/NewProjectDialog.cpp +++ b/sources/Application/Views/ModalDialogs/NewProjectDialog.cpp @@ -10,18 +10,69 @@ static char *buttonText[BUTTONS_LENGTH] = { #define DIALOG_WIDTH 20 +// QWERTY keyboard layout (5 rows) +static const char* keyboardLayout[] = { + "1234567890", + "QWERTYUIOP", + "ASDFGHJKL", + "qwertyuiop", + "asdfghjkl", + "zxcvbnm.-_", + "[____] <-" +}; + +static const int keyboardRows = 7; + NewProjectDialog::NewProjectDialog(View &view):ModalView(view) {} NewProjectDialog::~NewProjectDialog() { } +char NewProjectDialog::getKeyAtPosition(int row, int col) { + if (row < 0 || row >= keyboardRows) return '\0'; + const char* rowStr = keyboardLayout[row]; + + // Handle special row with [____] and <- + if (row == 6) { + if (col >= 0 && col < 7) return ' '; // [____] (space) + if (col >= 8 && col < 12) return '\b'; // <- (backspace) + return '\0'; + } + + int len = strlen(rowStr); + if (col < 0 || col >= len) return '\0'; + return rowStr[col]; +} + +void NewProjectDialog::findCharacterInKeyboard(char ch, int &outRow, int &outCol) { + // Search for character in keyboard layout + for (int row = 0; row < keyboardRows - 1; row++) { // Exclude special row + const char* rowStr = keyboardLayout[row]; + int len = strlen(rowStr); + for (int col = 0; col < len; col++) { + if (rowStr[col] == ch) { + outRow = row; + outCol = col; + return; + } + } + } + // Handle space specially + if (ch == ' ') { + outRow = 6; + outCol = 0; + return; + } + // Character not found, don't change position +} + void NewProjectDialog::DrawView() { - SetWindow(DIALOG_WIDTH,5) ; + SetWindow(DIALOG_WIDTH, keyboardMode_ ? 12 : 5); - GUITextProperties props ; + GUITextProperties props; - SetColor(CD_NORMAL) ; + SetColor(CD_NORMAL); // Draw string @@ -30,11 +81,43 @@ void NewProjectDialog::DrawView() { char buffer[2]; buffer[1]=0 ; for (int i=0;i= 8); + DrawString(startX + 8, 4 + row, "<-", props); + } else { + for (int col = 0; col < len; col++) { + props.invert_ = (row == keyboardRow_ && col == keyboardCol_); + buffer[0] = rowStr[col]; + DrawString(startX + col, 4 + row, buffer, props); + } + } + } + // Draw cursor indicator when in keyboard mode + DrawString(x + currentChar_, 3, "-", props); + props.invert_ = false; + return; // Don't draw buttons in keyboard mode + } + // Draw buttons SetColor(CD_NORMAL) ; @@ -57,13 +140,99 @@ void NewProjectDialog::OnPlayerUpdate(PlayerEventType ,unsigned int currentTick) void NewProjectDialog::OnFocus() { selected_=currentChar_=0; memset(name_,' ',MAX_NAME_LENGTH+1) ; - lastChar_ = 'A'; + lastChar_ = 'A'; + keyboardMode_ = false; + keyboardRow_ = 1; // Start on QWERTY row + keyboardCol_ = 0; }; void NewProjectDialog::ProcessButtonMask(unsigned short mask,bool pressed) { if (!pressed) return ; + // Handle keyboard mode navigation first + if (keyboardMode_) { + if (mask == EPBM_A) { + // Insert character at current position + char ch = getKeyAtPosition(keyboardRow_, keyboardCol_); + if (ch == '\b') { + // Backspace: delete character and move cursor left + if (currentChar_ > 0) { + currentChar_--; + name_[currentChar_] = ' '; + } + } else if (ch != '\0') { + name_[currentChar_] = ch; + lastChar_ = ch; + if (currentChar_ < MAX_NAME_LENGTH - 1) { + currentChar_++; + // Jump keyboard cursor to the character at new position + char nextChar = name_[currentChar_]; + if (nextChar != ' ') { + findCharacterInKeyboard(nextChar, keyboardRow_, keyboardCol_); + } + } + } + isDirty_ = true; + return; + } + if (mask == EPBM_UP) { + keyboardRow_ = (keyboardRow_ - 1 + keyboardRows) % keyboardRows; + // Clamp column to valid range for new row + if (keyboardRow_ == 6) { + // Special row: [____] is 0-6, <- is 8-11 + if (keyboardCol_ >= 7) keyboardCol_ = 8; // Move to <- + } else { + int maxCol = strlen(keyboardLayout[keyboardRow_]) - 1; + if (keyboardCol_ > maxCol) keyboardCol_ = maxCol; + } + isDirty_ = true; + return; + } + if (mask == EPBM_DOWN) { + keyboardRow_ = (keyboardRow_ + 1) % keyboardRows; + // Clamp column to valid range for new row + if (keyboardRow_ == 6) { + // Special row: [____] is 0-6, <- is 8-11 + if (keyboardCol_ >= 7) keyboardCol_ = 8; // Move to <- + } else { + int maxCol = strlen(keyboardLayout[keyboardRow_]) - 1; + if (keyboardCol_ > maxCol) keyboardCol_ = maxCol; + } + isDirty_ = true; + return; + } + if (mask == EPBM_LEFT) { + if (keyboardRow_ == 6) { + // Special row: toggle between [____] and <- + keyboardCol_ = (keyboardCol_ < 8) ? 8 : 0; + } else { + int maxCol = strlen(keyboardLayout[keyboardRow_]) - 1; + keyboardCol_ = (keyboardCol_ - 1 + maxCol + 1) % (maxCol + 1); + } + isDirty_ = true; + return; + } + if (mask == EPBM_RIGHT) { + if (keyboardRow_ == 6) { + // Special row: toggle between [____] and <- + keyboardCol_ = (keyboardCol_ < 8) ? 8 : 0; + } else { + int maxCol = strlen(keyboardLayout[keyboardRow_]) - 1; + keyboardCol_ = (keyboardCol_ + 1) % (maxCol + 1); + } + isDirty_ = true; + return; + } + // Exit keyboard mode with B + if (mask == EPBM_B) { + keyboardMode_ = false; + isDirty_ = true; + return; + } + return; + } + if (mask&EPBM_B) { } else { @@ -94,16 +263,20 @@ void NewProjectDialog::ProcessButtonMask(unsigned short mask,bool pressed) { break; } } - if (mask&EPBM_UP) { - name_[currentChar_]+=1; - lastChar_=name_[currentChar_] ; - isDirty_=true ; - } - if (mask&EPBM_DOWN) { - name_[currentChar_]-=1; - lastChar_=name_[currentChar_] ; - isDirty_=true ; - } + if ((mask & EPBM_UP) || (mask & EPBM_DOWN)) { + // Toggle keyboard mode with A+UP or A+DOWN + if (selected_ == 0) { + keyboardMode_ = !keyboardMode_; + // When entering keyboard mode, jump to current character + if (keyboardMode_) { + char currentCh = name_[currentChar_]; + if (currentCh != ' ') { + findCharacterInKeyboard(currentCh, keyboardRow_, keyboardCol_); + } + } + isDirty_ = true; + } + } } else { // R Modifier diff --git a/sources/Application/Views/ModalDialogs/NewProjectDialog.h b/sources/Application/Views/ModalDialogs/NewProjectDialog.h index ba1aa9c7..a6c573ba 100644 --- a/sources/Application/Views/ModalDialogs/NewProjectDialog.h +++ b/sources/Application/Views/ModalDialogs/NewProjectDialog.h @@ -23,6 +23,12 @@ class NewProjectDialog:public ModalView { int lastChar_ ; char name_[MAX_NAME_LENGTH+1] ; int currentChar_ ; + bool keyboardMode_; + int keyboardRow_ ; + int keyboardCol_ ; + + char getKeyAtPosition(int row, int col) ; + void findCharacterInKeyboard(char ch, int &outRow, int &outCol) ; } ; #endif From d349020e35b40ec3c0005b1b4a681f51f92fd3dc Mon Sep 17 00:00:00 2001 From: djdiskmachine <110535302+djdiskmachine@users.noreply.github.com> Date: Fri, 21 Nov 2025 21:50:23 +0000 Subject: [PATCH 2/9] Auto load project on start Configurable auto load feature Turn off by modifying config.xml --- CHANGELOG | 5 +- docs/LittlePiggyTrackerConf.md | 55 ++++++++++++------- docs/wiki/What-is-LittlePiggyTracker.md | 7 ++- projects/resources/BITTBOY/config.xml | 1 + projects/resources/CHIP/config.xml | 1 + projects/resources/DEB/config.xml | 1 + projects/resources/GARLIC/config.xml | 1 + projects/resources/GARLICPLUS/config.xml | 1 + projects/resources/MACOS/config.xml | 1 + projects/resources/MIYOO/config.xml | 1 + projects/resources/PSP/config.xml | 1 + projects/resources/RG35XXPLUS/config.xml | 1 + projects/resources/X64/config.xml | 1 + projects/resources/X86/config.xml | 1 + sources/Application/AppWindow.cpp | 70 +++++++++++++++++++++++- sources/Application/AppWindow.h | 5 ++ sources/Application/Model/Project.h | 2 +- 17 files changed, 129 insertions(+), 26 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6e9dda89..93297520 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ -1.6.0-bacon4 +1.6.0-bacon5 QWERTY keyboard name entry for new projects + Auto-load last project on startup + * Application can now load the last project automatically on startup + * Disable by setting AUTO_LOAD_LAST=NO in config.xml 1.5.0-bacon3 Contributions: diff --git a/docs/LittlePiggyTrackerConf.md b/docs/LittlePiggyTrackerConf.md index 6f6acfd1..c66cb35c 100644 --- a/docs/LittlePiggyTrackerConf.md +++ b/docs/LittlePiggyTrackerConf.md @@ -9,27 +9,28 @@ 02. [`config.xml` Example](#configxml-example) 03. [Config Values](#config-values) 04. [Screen Size](#screen-size) -05. [Screen Colors](#screen-colors) -06. [Key and Button Mapping](#key-and-button-mapping) -07. [Auto Repeat](#auto-repeat) -08. [Path](#path) -09. [Rendering](#rendering) -10. [Volume](#volume) -11. [Audio Configuration](#audio-configuration) -12. [MIDI Configuration](#midi-configuration) -13. [Log Dumping](#log-dumping) +05. [Auto-Load Last Project](#auto-load-last-project) +06. [Screen Colors](#screen-colors) +07. [Key and Button Mapping](#key-and-button-mapping) +08. [Auto Repeat](#auto-repeat) +09. [Path](#path) +10. [Rendering](#rendering) +11. [Volume](#volume) +12. [Audio Configuration](#audio-configuration) +13. [MIDI Configuration](#midi-configuration) +14. [Log Dumping](#log-dumping) ---------- -14. [`mapping.xml` Guide](#mappingxml-guide) -15. [Mapping a Joystick](#mapping-a-joystick) -16. [`mapping.xml` Example](#mappingxml-example) -17. [Checking Your Work](#checking-your-work) -18. [Recovering X,Y to work on GP2X.](#recovering-xy-to-work-on-gp2x) -19. [MAC OSX mapping](#mac-osx-mapping-howto) -20. [PSP key mapping](#psp-key-mapping) -21. [GP2X key mapping](#gp2x-key-mapping) -22. [Dingoo key mapping](#dingoo-key-mapping) -23. [Caanoo key mapping](#caanoo-key-mapping) -24. [Mapping a Midi Controller](#mapping-a-midi-controller) +15. [`mapping.xml` Guide](#mappingxml-guide) +16. [Mapping a Joystick](#mapping-a-joystick) +17. [`mapping.xml` Example](#mappingxml-example) +18. [Checking Your Work](#checking-your-work) +19. [Recovering X,Y to work on GP2X.](#recovering-xy-to-work-on-gp2x) +20. [MAC OSX mapping](#mac-osx-mapping-howto) +21. [PSP key mapping](#psp-key-mapping) +22. [GP2X key mapping](#gp2x-key-mapping) +23. [Dingoo key mapping](#dingoo-key-mapping) +24. [Caanoo key mapping](#caanoo-key-mapping) +25. [Mapping a Midi Controller](#mapping-a-midi-controller) ---------- @@ -94,6 +95,20 @@ To have the screen bigger than the original GP2X resolution, use **SCREEMULT** t Be careful as large values take a lot of juice and interfere with sound playback. +### Auto-Load Last Project + +By default, LittleGPTracker will automatically load the last project that was open on the previous session. To disable this behavior and show the project selection dialog instead, set: + +```xml + +``` + +To explicitly enable (default behavior): + +```xml + +``` + ## Screen Colors LittleGPTracker uses 6 colours to do all the drawing. If you want, you can redefine them using the following parameters: diff --git a/docs/wiki/What-is-LittlePiggyTracker.md b/docs/wiki/What-is-LittlePiggyTracker.md index 93ee7edc..4a7a7b27 100644 --- a/docs/wiki/What-is-LittlePiggyTracker.md +++ b/docs/wiki/What-is-LittlePiggyTracker.md @@ -55,13 +55,16 @@ When creating a new project, use the regen button to generate a random name. Gen ## Multiple Projects -The Piggy supports multiple projects! Just create multiple directories in the root folder (where lgptNew and lgpt10k were found). Examples: “lgptProject1”, “lgpt*Author*Name”, “lgptSomethingElse”, “lgptWhatever”, etc. Each project directory must contain its own samples which must be stored in a sub-directory called “samples”. Lgpt will prompt you to choose one of the projects found in the root (lgpt- directories) when starting up. +The Piggy supports multiple projects! Just create multiple directories in the root folder (where lgptNew and lgpt10k were found). Examples: "lgptProject1", "lgpt*Author*Name", "lgptSomethingElse", "lgptWhatever", etc. Each project directory must contain its own samples which must be stored in a sub-directory called "samples". + +By default, Lgpt will automatically load the last project that was open on the previous session. If you prefer to see the project selection screen on startup, you can disable this behavior by setting `AUTO_LOAD_LAST=NO` in your `config.xml`. + Important Points to Remember: - Project directories **must** start with “lgpt”. - Project directories **must** go in the root folder. - You can reuse a previously made lgptsav.dat file. -- Lgpt will list all the projects available on startup. +- Lgpt will list all the projects available on startup if autoloading is disabled in config.xml - The lgptsav.dat file is created automatically the project's folder using the piggy's save function (see Controls & Moves). You should not create tah file manually. - Save often :) diff --git a/projects/resources/BITTBOY/config.xml b/projects/resources/BITTBOY/config.xml index e568d860..b7b6543b 100755 --- a/projects/resources/BITTBOY/config.xml +++ b/projects/resources/BITTBOY/config.xml @@ -3,6 +3,7 @@ Bittboy config Re-assigned layout since no shoulder buttons --> + + diff --git a/projects/resources/DEB/config.xml b/projects/resources/DEB/config.xml index b9f429cb..80869529 100644 --- a/projects/resources/DEB/config.xml +++ b/projects/resources/DEB/config.xml @@ -1,5 +1,6 @@ + diff --git a/projects/resources/GARLICPLUS/config.xml b/projects/resources/GARLICPLUS/config.xml index dd9e3aef..c60a9420 100644 --- a/projects/resources/GARLICPLUS/config.xml +++ b/projects/resources/GARLICPLUS/config.xml @@ -1,4 +1,5 @@ + diff --git a/projects/resources/MACOS/config.xml b/projects/resources/MACOS/config.xml index 270e8cf5..6314c305 100644 --- a/projects/resources/MACOS/config.xml +++ b/projects/resources/MACOS/config.xml @@ -1,5 +1,6 @@ + diff --git a/projects/resources/MIYOO/config.xml b/projects/resources/MIYOO/config.xml index ff6ebcc4..aadee5a3 100644 --- a/projects/resources/MIYOO/config.xml +++ b/projects/resources/MIYOO/config.xml @@ -4,6 +4,7 @@ create folders for your tracks and samples on the root of your sd card. --> + diff --git a/projects/resources/PSP/config.xml b/projects/resources/PSP/config.xml index 97c3986d..e1d288cc 100644 --- a/projects/resources/PSP/config.xml +++ b/projects/resources/PSP/config.xml @@ -1,5 +1,6 @@ > + diff --git a/projects/resources/RG35XXPLUS/config.xml b/projects/resources/RG35XXPLUS/config.xml index 09f4a9b9..15ae4d37 100644 --- a/projects/resources/RG35XXPLUS/config.xml +++ b/projects/resources/RG35XXPLUS/config.xml @@ -1,4 +1,5 @@ + diff --git a/projects/resources/X64/config.xml b/projects/resources/X64/config.xml index 048575cc..c1f87b03 100644 --- a/projects/resources/X64/config.xml +++ b/projects/resources/X64/config.xml @@ -1,5 +1,6 @@ +