Skip to content

Commit

Permalink
Optimizations, show file type in program menu hook
Browse files Browse the repository at this point in the history
Co-Authored-By: RoccoLox Programs <[email protected]>
  • Loading branch information
TIny-Hacker and RoccoLoxPrograms committed Sep 11, 2024
1 parent f3aa63a commit f286c09
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

All notable changes to CEaShell will be documented in this file.

## [2.0.1] - 2024-09-08
## [2.0.1] - 2024-09-11

### Added
- Pressing <kbd>vars</kbd> in the file info menu opens the editor.
- Show file type in program menu hook for programs without descriptions.

### Changed
- Modify behavior for moving the cursor down in the file info menu.
Expand Down
4 changes: 4 additions & 0 deletions src/asm/hooks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ include 'include/equates.inc'
extern _asm_fileSystem_sortVAT
extern _asm_labelJumper_showLabels
extern _asm_prgmMenuHook_showDescription
extern _asm_prgmMenuHook_showType
extern _asm_prgmMenuHook_icons
extern _asm_prgmMenuHook_showAppInfo
extern _asm_runProgram_main
Expand Down Expand Up @@ -212,6 +213,9 @@ hooks_iconHook:
jp z, _asm_prgmMenuHook_showAppInfo
call _asm_prgmMenuHook_icons
call _asm_prgmMenuHook_showDescription
ld a, (description)
or a, a
call z, _asm_prgmMenuHook_showType
set updateProgInfo, (iy + shellFlags)
ret

Expand Down
16 changes: 16 additions & 0 deletions src/asm/prgmMenuHook.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
include 'include/equates.inc'

public _asm_prgmMenuHook_showDescription
public _asm_prgmMenuHook_showType
public _asm_prgmMenuHook_icons
public _asm_prgmMenuHook_showAppInfo

Expand All @@ -28,8 +29,11 @@ include 'include/equates.inc'
extern _asm_utils_getEOF
extern _asm_utils_findVar
extern _asm_utils_dispTextToolbar
extern _rodata_fileTypes

_asm_prgmMenuHook_showDescription:
xor a, a
ld (description), a
ld hl, ti.progCurrent
call ti.Mov9ToOP1
call prgmMenuHook_eraseRect
Expand Down Expand Up @@ -191,6 +195,18 @@ _asm_prgmMenuHook_showDescription:
ld hl, description
jp _asm_utils_dispTextToolbar

_asm_prgmMenuHook_showType:
ld hl, ti.progCurrent
call ti.Mov9ToOP1
call _asm_utils_findVar + 4
call _asm_fileOps_getPrgmType.check
ld e, a
ld d, 11
mlt de
ld hl, _rodata_fileTypes
add hl, de
jp _asm_utils_dispTextToolbar

_asm_prgmMenuHook_icons:
ld hl, .finishDrawing
push hl
Expand Down
22 changes: 22 additions & 0 deletions src/asm/rodata.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ include 'include/equates.inc'
public _rodata_characters
public _rodata_sizeOfCharsLUT
public _rodata_numberKeysLUT
public _rodata_fileTypes
public _rodata_fileTypeASM
public _rodata_fileTypeBASIC
public _rodata_fileTypeC
public _rodata_fileTypeICE
public _rodata_fileTypeICESrc

_rodata_celticAppVarHeader:
db ti.tColon, ti.tC, ti.tE, ti.tL, ti.tEnter
Expand Down Expand Up @@ -117,3 +123,19 @@ _rodata_sizeOfCharsLUT := $ - _rodata_characters

_rodata_numberKeysLUT:
db ti.sk0, ti.sk1, ti.sk2, ti.sk3, ti.sk4, ti.sk5, ti.sk6, ti.sk7, ti.sk8, ti.sk9

_rodata_fileTypes:
_rodata_fileTypeASM:
db "ASM", 8 dup 0

_rodata_fileTypeC:
db "C", 10 dup 0

_rodata_fileTypeBASIC:
db "TI-BASIC", 0, 0, 0

_rodata_fileTypeICE:
db "ICE", 8 dup 0

_rodata_fileTypeICESrc:
db "ICE Source", 0
9 changes: 9 additions & 0 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@ extern gfx_sprite_t *tempSprite;
*/
extern char rodata_appName;

/**
* File type strings.
*/
extern char rodata_fileTypeASM; /** ASM file type string. */
extern char rodata_fileTypeBASIC; /** TI-BASIC file type string. */
extern char rodata_fileTypeC; /** C file type string. */
extern char rodata_fileTypeICE; /** ICE file type string. */
extern char rodata_fileTypeICESrc; /** ICE Source file type string. */

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ static void info_Redraw(struct preferences_t *shellPrefs, struct file_t *fileInf


#ifdef FR
static const char *fileTypeStrings[11] = {"ASM", "C", "TI-BASIC", "ICE", "ICE Source", "Annuaire", "AppVar", NULL, "Var Celtic", "Appli", "Inconnu"};
static const char *fileTypeStrings[11] = {&rodata_fileTypeASM, &rodata_fileTypeC, &rodata_fileTypeBASIC, &rodata_fileTypeICE, &rodata_fileTypeICESrc, "Annuaire", "AppVar", NULL, "Var Celtic", "Appli", "Inconnu"};
gfx_PrintStringXY("Type : ", 64, 74);
#else
static const char *fileTypeStrings[11] = {"ASM", "C", "TI-BASIC", "ICE", "ICE Source", "Directory", "AppVar", NULL, "Celtic Var", "App", "Unknown"};
static const char *fileTypeStrings[11] = {&rodata_fileTypeASM, &rodata_fileTypeC, &rodata_fileTypeBASIC, &rodata_fileTypeICE, &rodata_fileTypeICESrc, "Directory", "AppVar", NULL, "Celtic Var", "App", "Unknown"};
gfx_PrintStringXY("Type: ", 64, 74);
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* By RoccoLox Programs and TIny_Hacker
* Copyright 2022 - 2024
* License: GPL-3.0
* Last Build: September 8, 2024
* Last Build: September 11, 2024
* Version: 2.0.1
*
* --------------------------------------
Expand Down

0 comments on commit f286c09

Please sign in to comment.