Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewer should support hex mode for binary files #320

Open
radius75 opened this issue Apr 20, 2023 · 8 comments
Open

Viewer should support hex mode for binary files #320

radius75 opened this issue Apr 20, 2023 · 8 comments

Comments

@radius75
Copy link

radius75 commented Apr 20, 2023

Related to #30

It depends on the file on which we are doing VIEW.
Shows fragments of text that is "under" the window.
I attach elv1.d64 on which it occurs.
Probably some symbol causes that the content of the window is not cleared with spaces in the text line.

obraz
obraz
elv1.zip

@GideonZ
Copy link
Owner

GideonZ commented Apr 20, 2023 via email

@radius75 radius75 changed the title The VIEW file option sometimes displays mixed file names and sizes. SOLVED: The viewer should switch to binary mode when it is not text. Apr 20, 2023
@radius75 radius75 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2023
@radius75 radius75 changed the title SOLVED: The viewer should switch to binary mode when it is not text. SOLVED, Duplicated #30: The viewer should switch to binary mode when it is not text. Apr 20, 2023
@radius75
Copy link
Author

Then the problem is solved.

Now I updated u2+ to fw3.10f and it doesn't show binary values. I choose View on elv1.d64. It's the same as it was.
Did I misunderstand "solved"?

@GideonZ
Copy link
Owner

GideonZ commented Apr 24, 2023 via email

@radius75
Copy link
Author

I understood that Solved means Fixed on master branch :)
obraz

@GideonZ
Copy link
Owner

GideonZ commented Apr 24, 2023

No, the problem that you are seeing old data from the file browser will be solved, once / when the file viewer will support hex mode. It doesn't at this point. This is why I mentioned: change the ticket to: "Viewer should support hex mode for binary files."

@radius75
Copy link
Author

I reopen the issue, my mistake.

@radius75 radius75 reopened this Apr 24, 2023
@radius75 radius75 changed the title SOLVED, Duplicated #30: The viewer should switch to binary mode when it is not text. Viewer should support hex mode for binary files Apr 24, 2023
@chrisgleissner
Copy link

chrisgleissner commented Jun 26, 2023

I would also find this feature very useful as I noticed its absence frequently when browsing my file collection.

When displaying the hex content, it would be great to use the format used by many C64 machine code monitors such as SMON:

<16 bit offset from start of file, in hex> ' '
<8 bytes of file data in hex, each byte followed by a space> ' '
<same 8 bytes rendered as PETSCII or '.' if not printable>

Example:

0000 00 00 41 42 43 44 45 46    ..ABCDEF
0008 00 00 00 00 00 00 00 47    .......G

The benefit of not just showing hex code, but also PETSCII, is to have the best of both worlds in the same view, e.g. when trying to find text in binary files.

Btw, issue #151 is closely related to this and could be viewed as an extension. The hex viewer idea is mentioned there, as well.

@chrisgleissner
Copy link

chrisgleissner commented Jul 8, 2023

@radius75 This is now fixed as part of #357

I added a new "Hex View" context-sensitive menu option rather than some magic which automatically infers whether to open the file using the existing (Text) viewer or the new hex viewer.

We could infer it using the file suffix (.prg || .d64 || .g64 || .d71 || .g71 || .t64 || -> hex viewer, else text viewer), but there are various edge cases which may be hard to understand for every user without additional documentation. For example, it is a perfectly valid use case to open a text file (.txt or .cfg suffix) in the hex viewer in order to check non-printable chars, such as Windows vs Unix line endings. Also, some users may have become accustomed to the current behaviour of the "View" option and even use it for binary files. One may decide to browse binary files not typical for a C64, such as .exe, .out, .c, .yaml, etc. It's hard to come up with a good generic logic that is both intuitive for every user without requiring lengthy documentation plus doesn't rely on an every increasing list of "suffix to editor" mappings. Thus, I found it cleaner to just introduce a dedicated new option to let the user be in control.

If you'd like to start using it, just checkout the branch in which I performed the change, build it as per Gideon's instructions, and flash your device. Please note that I only tested this using the Ultimate 64 Elite 1.4, however the changes are very high level (user interface tier only) and should work with other devices, as well.

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

No branches or pull requests

3 participants