PS5NorModifier icon indicating copy to clipboard operation
PS5NorModifier copied to clipboard

CLI application rewrite

Open RJohnsonPGH opened this issue 7 months ago • 3 comments

Okay, there's a lot going on here:

  1. Rather than an interactive prompt/menu driven CLI application, I've changed things to a more traditional argument/option driven CLI application with Spectre.Console. This handles (mostly) automatic generation of help pages, argument and option parsing, and other things. While this is somewhat less user friendly (which I've tried to mitigate as much as possible with help output, documentation, etc.) it significantly reduces the complexity of the code with the various branches, prompting/reading selections, loops, etc.

  2. The code has been moved from a single monolithic source file (Program.cs) into a more standard .NET approach with DI, Services, etc.

  3. UART operations are now in the UartService class which handles serial communication with the UART, clearing and reading error codes. SerialPort usage has been changed to handle more potential error states, as well as closing/disposal. Retrieved error codes have more validation of the retrieved data to validate checksums.

  4. NOR/BIOS operations are now in the BiosService class which handles BIOS reading and modification. Significant validation checks have been added for reading properties from the dump file.

  5. Error code description retrieval is now in the ErrorCodeService class which handles loading the XML from the web and finding the matching description.

  6. All of the above services (as well as the rest of the application) have extensive use of ILogger to assist in troubleshooting failures. The application creates a log.txt file in the directory it is running from that contains logged data.

  7. Unit tests have been created for some common functions used in the application (parsing retrieved error codes, calculating checksums, etc.), BIOS reading/modification (requires a known good BIOS dump for the test to run), and error code description retrieval. Tests for UART reading/clearing need to be written still.

The modified functions should be easily exportable into a cross platform GUI application as well, which I'm going to take a shot at next. 1 2 3 4 5

RJohnsonPGH avatar May 14 '25 21:05 RJohnsonPGH

Great work, and beat me too it! I think it's a good idea to leave the CLI to take parameters and let the GUI do the easy mode bits.

I'd argue that we could the exe could be a little more user friendly without spaces etc. e.g uarl-cli

OliverRC avatar May 15 '25 06:05 OliverRC

Added log parsing directly from the dumps

1

RJohnsonPGH avatar May 16 '25 15:05 RJohnsonPGH

I'd argue that we could the exe could be a little more user friendly without spaces etc. e.g uarl-cli

Definitely agree. I'll get around to it at some point.

RJohnsonPGH avatar May 16 '25 15:05 RJohnsonPGH