Compare commits

..

1 Commits

Author SHA1 Message Date
Jake Kenneally
bdecf1071e
Merge be10b90a71 into 21277e03eb 2026-01-17 23:35:58 +00:00
2 changed files with 17 additions and 29 deletions

View File

@ -203,7 +203,7 @@ bool Xtc::generateCoverBmp() const {
coverBmp.write(reinterpret_cast<const uint8_t*>(&colorsImportant), 4); coverBmp.write(reinterpret_cast<const uint8_t*>(&colorsImportant), 4);
// Color palette (2 colors for 1-bit) // Color palette (2 colors for 1-bit)
// XTC 1-bit polarity: 0 = black, 1 = white (standard BMP palette order) // XTC uses inverted polarity: 0 = black, 1 = white
// Color 0: Black (text/foreground in XTC) // Color 0: Black (text/foreground in XTC)
uint8_t black[4] = {0x00, 0x00, 0x00, 0x00}; uint8_t black[4] = {0x00, 0x00, 0x00, 0x00};
coverBmp.write(black, 4); coverBmp.write(black, 4);
@ -506,8 +506,8 @@ bool Xtc::generateThumbBmp() const {
// Bounds check for buffer access // Bounds check for buffer access
if (byteIdx < bitmapSize) { if (byteIdx < bitmapSize) {
const uint8_t pixelBit = (pageBuffer[byteIdx] >> bitIdx) & 1; const uint8_t pixelBit = (pageBuffer[byteIdx] >> bitIdx) & 1;
// XTC 1-bit polarity: 0=black, 1=white (same as BMP palette) // XTC polarity: 1=black, 0=white
grayValue = pixelBit ? 255 : 0; grayValue = pixelBit ? 0 : 255;
} }
} }

View File

@ -73,7 +73,7 @@ int KeyboardEntryActivity::getRowLength(const int row) const {
case 3: case 3:
return 10; // zxcvbnm,./ return 10; // zxcvbnm,./
case 4: case 4:
return 10; // shift (2 wide), space (5 wide), backspace (2 wide), OK return 10; // caps (2 wide), space (5 wide), backspace (2 wide), OK
default: default:
return 0; return 0;
} }
@ -145,11 +145,6 @@ void KeyboardEntryActivity::loop() {
// Clamp column to valid range for new row // Clamp column to valid range for new row
const int maxCol = getRowLength(selectedRow) - 1; const int maxCol = getRowLength(selectedRow) - 1;
if (selectedCol > maxCol) selectedCol = maxCol; if (selectedCol > maxCol) selectedCol = maxCol;
} else {
// Wrap to bottom row
selectedRow = NUM_ROWS - 1;
const int maxCol = getRowLength(selectedRow) - 1;
if (selectedCol > maxCol) selectedCol = maxCol;
} }
updateRequired = true; updateRequired = true;
} }
@ -159,24 +154,16 @@ void KeyboardEntryActivity::loop() {
selectedRow++; selectedRow++;
const int maxCol = getRowLength(selectedRow) - 1; const int maxCol = getRowLength(selectedRow) - 1;
if (selectedCol > maxCol) selectedCol = maxCol; if (selectedCol > maxCol) selectedCol = maxCol;
} else {
// Wrap to top row
selectedRow = 0;
const int maxCol = getRowLength(selectedRow) - 1;
if (selectedCol > maxCol) selectedCol = maxCol;
} }
updateRequired = true; updateRequired = true;
} }
if (mappedInput.wasPressed(MappedInputManager::Button::Left)) { if (mappedInput.wasPressed(MappedInputManager::Button::Left)) {
const int maxCol = getRowLength(selectedRow) - 1;
// Special bottom row case // Special bottom row case
if (selectedRow == SPECIAL_ROW) { if (selectedRow == SPECIAL_ROW) {
// Bottom row has special key widths // Bottom row has special key widths
if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) { if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) {
// In shift key, wrap to end of row // In shift key, do nothing
selectedCol = maxCol;
} else if (selectedCol >= SPACE_COL && selectedCol < BACKSPACE_COL) { } else if (selectedCol >= SPACE_COL && selectedCol < BACKSPACE_COL) {
// In space bar, move to shift // In space bar, move to shift
selectedCol = SHIFT_COL; selectedCol = SHIFT_COL;
@ -193,9 +180,10 @@ void KeyboardEntryActivity::loop() {
if (selectedCol > 0) { if (selectedCol > 0) {
selectedCol--; selectedCol--;
} else { } else if (selectedRow > 0) {
// Wrap to end of current row // Wrap to previous row
selectedCol = maxCol; selectedRow--;
selectedCol = getRowLength(selectedRow) - 1;
} }
updateRequired = true; updateRequired = true;
} }
@ -216,8 +204,7 @@ void KeyboardEntryActivity::loop() {
// In backspace, move to done // In backspace, move to done
selectedCol = DONE_COL; selectedCol = DONE_COL;
} else if (selectedCol >= DONE_COL) { } else if (selectedCol >= DONE_COL) {
// At done button, wrap to beginning of row // At done button, do nothing
selectedCol = SHIFT_COL;
} }
updateRequired = true; updateRequired = true;
return; return;
@ -225,8 +212,9 @@ void KeyboardEntryActivity::loop() {
if (selectedCol < maxCol) { if (selectedCol < maxCol) {
selectedCol++; selectedCol++;
} else { } else if (selectedRow < NUM_ROWS - 1) {
// Wrap to beginning of current row // Wrap to next row
selectedRow++;
selectedCol = 0; selectedCol = 0;
} }
updateRequired = true; updateRequired = true;
@ -300,14 +288,14 @@ void KeyboardEntryActivity::render() const {
// Handle bottom row (row 4) specially with proper multi-column keys // Handle bottom row (row 4) specially with proper multi-column keys
if (row == 4) { if (row == 4) {
// Bottom row layout: SHIFT (2 cols) | SPACE (5 cols) | <- (2 cols) | OK (2 cols) // Bottom row layout: CAPS (2 cols) | SPACE (5 cols) | <- (2 cols) | OK (2 cols)
// Total: 11 visual columns, but we use logical positions for selection // Total: 11 visual columns, but we use logical positions for selection
int currentX = startX; int currentX = startX;
// SHIFT key (logical col 0, spans 2 key widths) // CAPS key (logical col 0, spans 2 key widths)
const bool shiftSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL); const bool capsSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL);
renderItemWithSelector(currentX + 2, rowY, shiftActive ? "SHIFT" : "shift", shiftSelected); renderItemWithSelector(currentX + 2, rowY, shiftActive ? "CAPS" : "caps", capsSelected);
currentX += 2 * (keyWidth + keySpacing); currentX += 2 * (keyWidth + keySpacing);
// Space bar (logical cols 2-6, spans 5 key widths) // Space bar (logical cols 2-6, spans 5 key widths)