Skip to content

Add tree-style recursive directory listing to CLI, directory navigation to GUI, and fix icon rendering issues.#25

Open
adityakrgupta24 wants to merge 5 commits into
Adubbz:masterfrom
adityakrgupta24:master
Open

Add tree-style recursive directory listing to CLI, directory navigation to GUI, and fix icon rendering issues.#25
adityakrgupta24 wants to merge 5 commits into
Adubbz:masterfrom
adityakrgupta24:master

Conversation

@adityakrgupta24

Copy link
Copy Markdown

Changes

CLI: Tree-style recursive listing (mymcplusplus/mymc.py)

  • Add -R flag to ls command that displays directory structure with box-drawing characters
  • Add -l (--long-recursive) flag to show mode bits, file size, and timestamps in tree mode
  • Columns are aligned to the widest entry across all depths using a two-pass approach
  • Works with existing -c flag for creation times

GUI: Directory navigation (mymcplusplus/gui/dirlist_control.py, mymcplusplus/gui/gui.py)

  • Double-click a directory to navigate into it; .. entry navigates back to parent
  • Files are shown when inside a subdirectory with export and delete support
  • Import is disabled when not at root level
  • Window title shows current path when navigated into a subdirectory
  • Clicking icon.sys inside a save directory renders the 3D icon preview
  • Suppress stale focus events during list updates using _updating flag
  • Use unsigned sentinel (0x7FFFFFFE) for .. entry ItemData to avoid platform issues with negative values (Safe change as PS2 memory card specs don't allow tree depth of more than 1 - where depth of root folder is 0)

Icon rendering fixes (mymcplusplus/ps2icon.py, mymcplusplus/gui/icon_renderer.py, mymcplusplus/gui/icon_window.py)

  • Fix texture type detection to use bit flags (bit 2 = present, bit 3 = compressed)
  • Fix RLE decompression: change high-bit check from 30xff00 to 0x8000, add zero-repeat guard
  • Catch FileTooSmall in Icon constructor to allow partial rendering instead of failing entirely
  • Fix Retina display: scale glViewport with GetContentScaleFactor() so icon renders at full size
  • Fix canvas sizer proportion from wx.EXPAND to 1 so canvas fills available space

Test fixes (test/)

  • Update imports from mymcplus to mymcplusplus to match package rename
  • Update export test assertions to match longname default (PR Update mymc.py #22) and "Exporting" typo fix
  • Add filter="data" to tar.extractall for Python 3.14 compatibility

Documentation (README.md)

  • Add usage examples for ls -R, ls -R -l, and ls -R -l -c with sample output

Testing

  • All 36 existing tests pass

  • Manually tested CLI with SCEVMC0.mc2, MemoryCard1-1.mc2, MemoryCard1-2.mc2, SCEVMC0_ecc.ps2 and SCEVMC0_ecc_jpn.ps2::
    test_memcards.zip

  • Manually tested GUI navigation, export, delete, and icon rendering on cards in above attachment.

NOTE: I don't have an exhaustive way of testing all existing functionalities before this PR. I have just run tests in the tests folder and verified the feature in this PR. I have done basic testing of existing functionalities.

Add -R flag to the ls command that displays the memory card directory
structure in a tree format with box-drawing characters. Add -l flag
(--long-recursive) to show mode bits, file size, and timestamps
alongside the tree output, with columns aligned to the deepest entry.
Add double-click navigation into save directories with '..' support
to return to parent. Show files when inside a subdirectory. Enable
export and delete for individual files. Disable import when not at
root. Show current path in window title.

Fix icon texture type detection to use bit flags
(bit 2 = texture present, bit 3 = compressed). Fix RLE decompression
high-bit check from 0xff00 to 0x8000 and add zero-repeat guard.
Catch FileTooSmall in icon constructor to allow partial rendering.

Fix Retina display rendering by scaling glViewport with content scale
factor. Fix canvas sizer proportion to fill available space.

Suppress stale focus events during list updates to prevent erroneous
icon load attempts on navigation.
In existing tests, rename module imports from mymcplus to mymcplusplus
to match the package rename. Fix expected export output to account for
"Exporing" typo corrected to "Exporting" in commit 48c1065 and longname
default behavior introduced in the same commit (PR Adubbz#22). Add filter="data"
to tar.extractall to resolve Python 3.14 deprecation warning.
Document the new ls -R, ls -R -l, and ls -R -l -c flags with
example output showing tree structure and aligned column display.
Add minor version bump for new tree-style recursive directory listing
and GUI directory navigation features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant