Skip to content

Commit

Permalink
Fix theta character
Browse files Browse the repository at this point in the history
- Fix displaying of theta character in program names
- Fix an issue with alpha searching
  • Loading branch information
TIny-Hacker committed Dec 18, 2022
1 parent 92bc38d commit d821bca
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
NAME = CEaShell
APP_NAME = CEaShell
APP_VERSION = 5.0.0.0000
CEASHELL_VERSION = 0.81.1
CEASHELL_VERSION = 0.81.2
ICON = icon.png
DESCRIPTION = (C) 2022 RoccoLox + TIny_Hacker
COMPRESSED = NO
Expand Down
31 changes: 30 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright 2022
* License: GPL-3.0
* Last Build: December 18, 2022
* Version: 0.81.1
* Version: 0.81.2
*
* --------------------------------------
**/
Expand Down Expand Up @@ -69,6 +69,20 @@ int main(void) {

// Graphics setup
gfx_Begin();
uint8_t defaultSpacing[160] = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
3, 4, 6, 8, 8, 8, 8, 5, 5, 5, 8, 7, 4, 7, 3, 8,
8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 3, 4, 6, 7, 6, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 5, 8, 8,
4, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 5, 8, 8, 8,
8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 7, 3, 7, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};

const uint8_t leftBracket[8] = {0xF0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xF0, 0x00};
const uint8_t thetaChar[8] = {0x7C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x7C, 0x00};

if (colors[3]) {
invertPalette();
Expand Down Expand Up @@ -121,6 +135,10 @@ int main(void) {
showApps, showAppvars, NULL, NULL, NULL, false);
}

defaultSpacing[91] = 8;
gfx_SetFontSpacing(defaultSpacing);
gfx_SetCharData(91, thetaChar);

// Restore lowercase preferences
if (lowercase && !checkLowercase()) {
toggleLowercase(true);
Expand Down Expand Up @@ -384,7 +402,9 @@ int main(void) {
shapes_RoundRectangleFill(colors[1], 15, 220, 192, 50, 38);
gfx_BlitBuffer();
util_WritePrefs(colors, transitionSpeed, is24Hour, displayCEaShell, getCSCHook, editArchivedProg, editLockedProg, showHiddenProg, showFileCount, hideBusyIndicator, lowercase, apdTimer, fileSelected, fileStartLoc, directory, showApps, showAppvars, &programPtrs, &appvarPtrs, fileNumbers, true);

menu_Info(colors, programPtrs, appvarPtrs, infoOps, fileSelected - 1, fileStartLoc, fileNumbers, directory, displayCEaShell, editLockedProg, showHiddenProg, apdTimer, showApps, showAppvars); // This will store some file changes to the infoOps (Info Operations) array

timer_Set(1, 0);

if (infoOps[0]) { // Takes care of deletions
Expand Down Expand Up @@ -455,7 +475,16 @@ int main(void) {
}
}

defaultSpacing[91] = 5;
gfx_SetFontSpacing(defaultSpacing);
gfx_SetCharData(91, leftBracket);

menu_Settings(colors, &getCSCHook, &editArchivedProg, &editLockedProg, &showHiddenProg, &showFileCount, &hideBusyIndicator, &lowercase, &apdTimer);

defaultSpacing[91] = 8;
gfx_SetFontSpacing(defaultSpacing);
gfx_SetCharData(91, thetaChar);

timer_Set(1, 0);
util_FilesInit(fileNumbers, displayCEaShell, showHiddenProg, showApps, showAppvars);

Expand Down
15 changes: 11 additions & 4 deletions src/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool util_AlphaSearch(unsigned int *fileSelected, unsigned int *fileStartLoc, co
if (*fileSelected > *fileStartLoc + 7 || *fileSelected < *fileStartLoc) {
*fileStartLoc = filesSearched;

if (*fileStartLoc > fileCount - 5) {
if (*fileStartLoc > fileCount - 7) {
*fileStartLoc = fileCount - 7;
}

Expand Down Expand Up @@ -315,12 +315,12 @@ bool util_AlphaSearch(unsigned int *fileSelected, unsigned int *fileStartLoc, co
if (*fileSelected > *fileStartLoc + 7 || *fileSelected < *fileStartLoc) {
*fileStartLoc = filesSearched;

if (*fileStartLoc > fileCount - 5) {
if (*fileStartLoc > fileCount - 7) {
*fileStartLoc = fileCount - 7;
}

if (*fileStartLoc % 2) {
*fileStartLoc = *fileStartLoc - 1; // I had to do this instead of fileStartLoc--
*fileStartLoc = *fileStartLoc - 1;
}
}

Expand All @@ -335,7 +335,7 @@ bool util_AlphaSearch(unsigned int *fileSelected, unsigned int *fileStartLoc, co
if (*fileSelected > *fileStartLoc + 7 || *fileSelected < *fileStartLoc) {
*fileStartLoc = filesSearched;

if (*fileStartLoc > fileCount - 5) {
if (*fileStartLoc > fileCount - 7) {
*fileStartLoc = fileCount - 7;
}

Expand All @@ -358,11 +358,14 @@ bool util_AlphaSearch(unsigned int *fileSelected, unsigned int *fileStartLoc, co
if (directory == PROGRAMS_FOLDER) {
filesSearched = (showApps + showAppvars);
}

alpha += 1 + (-2 * reverse); // If the letter is after all existing filenames, go backwards to the last name

if (alpha == 27) {
reverse = true;
}
}

return false;
}

Expand All @@ -382,6 +385,7 @@ bool util_CheckNameExists(const char *name, const bool appvars) {
}
}
}

return false;
}

Expand All @@ -391,6 +395,7 @@ uint8_t util_GetSingleKeyPress(void) {
static uint8_t last_key;
uint8_t only_key = 0;
kb_Scan();

for (uint8_t key = 1, group = 7; group; --group) {
for (uint8_t mask = 1; mask; mask <<= 1, ++key) {
if (kb_Data[group] & mask) {
Expand All @@ -403,9 +408,11 @@ uint8_t util_GetSingleKeyPress(void) {
}
}
}

if (only_key == last_key) {
return false;
}

last_key = only_key;
return only_key;
}
Expand Down

0 comments on commit d821bca

Please sign in to comment.