Closed john-breton closed 4 years ago
My thoughts on getting an output JSON was to have the classes in code have the appropriate properties and then to serialize the patch classes into JSON format using the json module or similar functionality. So that way there's not double work (writing a standalone JSON encoder), and it builds the framwork for being able to save out changes to patches in BIN format as well as read from JSON.
My main motivation for porting the C# code to Python was for distribution purposes. In order to minimize the number of files we package with each release, it's better to stick to a single language rather than calling externals executables/apps in different languages that may require their own libraries to operate properly on different platforms.
The current progress of the Python binary analyzer in beta-3 is incomplete as it stands, but I've managed to mimic some of the functionality of the C# code into a self-contained single class. It comprises only 4 methods, with 3 being simple lookup tables. This early Python implementation was a quick test to see if I could port the C# code and doesn't actually deal with JSON but rather passes a string (because I just wanted to see if I could get something displayed quickly). It doesn't follow many OOP principles, so it will be reworked later. I'll most likely create additional classes and serialize each so a JSON object can be quickly created and passed to the frontend for display purposes, but it may not be needed if the formatted string would be enough for display purposes without reducing the speed of the application.
I'm still hesitant of the visualizer being used for patch editing purposes since that's not technically in the spirit of what the Librarian was meant to accomplish. I'm not knowledgable on other projects Empress may be working on, but I do know that a patch editor would be a good project for a future co-op student (which is why I would hate to remove that as a project option for them).
Current progress on this:
Things left to do/investigate:
Building off of the work started by apparent1/djigneo, adding a patch visualizer to the ZOIA Librarian will allow users to quickly analyze a patch to determine how it may work. This process will involve porting the existing C# code into native Python, extending it to output a JSON, and finally using said JSON to display graphical information about a patch to the user. It is proposed that the patch visualizer output to a graphical representation of a ZOIA. Users can hover over buttons on the grid to see connections, module types, etc. Patch pages can also be cycled through via button clicks.
It is proposed this visualizer be outputted to the Local Storage View and Banks tabs. Unfortunately, as it stands it isn't possible to have a proper display on the PatchStorage View tab as there is no simple way to analyze zipped uploads without downloading the zip, unpacking them, and creating an analysis for each patch contained within. This process is too slow to be practical, as such it is better to have direct access to the .bins, hence the decision to use the Local Storage View and Banks tab.
If you are a ZOIA patch contributor and have an interest in analyzing the binary content of ZOIA patches, this is a great issue to contribute to. Please mention your interest in the official ZOIA discord server.