Help for BAFFLE - Browse a pair of Files with Limited Editing

BAFFLE - Browse a pair of Files with Limited Editing - is not a proper editor. You can't create new files or add or delete bytes from existing files - merely patch or alter selected bytes. This document is designed to help you understand how to use it - you can read more about its 30-year history here.

BAFFLE's features include:

This help document is divided into the following sections:

Here's a picture of it running on my iMac:


Downloading and Installing

BAFFLE is a Java program - to run it you must have Java installed. If you don't have Java installed, here is the official download site (for Mac OSX, Windows and Linux).

Download the BAFFLE zip file. You'll get a folder called "baffle" which you can relocate anywhere you fancy. The folder contains:

Running BAFFLE

To run BAFFLE simply double-click baffle.bat (on Windows) or baffle.sh (on OSX or Linux). You can also run BAFFLE in a CMD (Windows) or Terminal (OSX or Linux) window by typing the word "baffle" (Windows) or "./baffle.sh" (OSX or Linux) and pressing Enter.

The Windows command:

   baffle file1 file2 
or the OSX/Linux command
   ./baffle.sh file1 file2

will start BAFFLE displaying 'file1' in the top window and 'file2' in the bottom one.

The Windows

BAFFLE consists of two windows:

Loading Files

At the top and bottom right of the main BAFFLE window there are Browse and Save buttons:

If the current file in a window has been modified and the changes not already saved then the 'Save' button will be enabled (otherwise it will be grayed out). Clicking the save button will save the changes back to the file and the Save button will then be disabled.

Clicking the 'Browse' button brings up an Open dialog which lets you select a file to load into the appropriate window. If the current file in that window has been modified and the changes not already saved then BAFFLE will ask if you want to ave the changes before the new file is loaded.

Note: if you load a read-only file, BAFFLE will warn you that editing it has been disabled since it would not be possible to write changes back to the file.

Note: instead of using the Browse button, you can drag and drop a file onto the appropriate area to load it.

Setting Options for Searching, Comparing and Input

The upper left of the main BAFFLE window has three choice controls:

Each choice has two options:

  • the 'Case' choice can be either "Respect", in which case searching and comparing require matching case, or "Ignore" in which either upper or lower case characters will match.
  • the 'Input' choice determines how input strings and characters (for searching, editing and the +, - and = commands) are handled. If "ASCII" is selected then input is treated as ASCII characters whereas "HEX" will treat the input as pairs of hexadecimal characters (blanks are ignored).
  • the 'Direction' choice determines where searching and comparing moves "Forward" towards the end of the files or "Backward" towards the beginning.

Scrolling

The Control window has two choice controls which affect scrolling:

  • the 'Active Window' choice lets you select either the "Top" or the "Bottom" window as the active window - the one that is the target of searches, altered by editing and whose position is controlled by the +, - and = commands. It also scrolls when the scroll buttons or cursor keys are used.

    Note: you can also switch the active window by clicking in the appropriate file area with the mouse or by pressing the Tab key as with CABLE.

  • the 'Scrolling' choice lets you select either "Active" or "Both". When "Active" is selected the scrolling buttons and cursor keys merely scroll the active window. When "Both" is selected, both windows scroll by the same amount.

Below these choices, the control window has an array of buttons which let you scroll the active window (or both windows if the Scrolling choice is set to "Both").

Note: these buttons are active during editing.

The keyboard cursor keys perform the same function. The images below show the active keys on a Mac and PC keyboard (your layout may vary!):

Searching

Clicking the 'Search' button moves the focus to the input area to the right of the 'Search' button. BAFFLE will use any text you enter as the target of a search when you press the Enter/Return key. If the 'Input' choice is set to "ASCII" the search will be for a matching ASCII string while if the choice is set to "HEX" BAFFLE will treat the input as a set of pairs of hexadecimal digits (ignoring any blanks) and convert each pair to the corresponding ASCII character.

Note: like the original CABLE, BAFFLE remembers previously entered text strings which can be recalled by pressing the Up and Down cursor keys.

Two other options affect the search:

  1. if the 'Case' option is set to "Respect" the match must be exact, while if it is set to "Ignore" upper and lower case are treated as equal. Note BAFFLE uses default Java uppercasing that is not locale-dependent so characters outside the 26 upper and lower case ASCII alphabet may not be treated correctly.
  2. if the 'Direction' choice is set to "Forward" searching proceeds towards the end of the file whereas if it is set to "Backward" searching proceeds towards the start of the file. Searching ends when the target is found or the end (or start, for backward searches) is reached. The current position in the file is set to the point at which the search ends.

While searching is in progress, the position indicator is occasionally updated (depending on the upincr property in the baffle.properties file. Searching can be interrupted at any time by pressing the Escape key.

Comparing

Pressing the 'Compare' button causes BAFFLE to compare the two files, staring at their current positions. The 'Case' and 'Direction' choices are used in the same way as in searches. The compare will stop when a difference is found, or when the end or start of file is reached.

While comparing is in progress, both position indicators are occasionally updated (depending on the upincr property in the baffle.properties file. Comparing can be interrupted at any time by pressing the Escape key.

Repeating Searches or Compares

Clicking the 'Next' button will repeat a Search or Compare whichever was last. Before the command is repeated the current position(s) will be moved one byte forwards or backwards depending on the 'Direction' setting.

Note: currently BAFFLE does not cope properly with a 'Next' command if the 'Input' choice has been switched since the 'Search' or 'Compare' was issued. Thus if a "HEX" search was done for the hex string '3031323334' (which has the ASCII equivalent "01234"), the 'Input' choice is switched to "ASCII" and the 'Next' button is then clicked, BAFFLE will not search for "ASCII" 01234 but for ASCII "3031323334".

Jumping about using +, - and =

The '+', '-' and '=' buttons all work in a similar way, they move the focus to the input area to the right of the buttons and when Enter/Return is pressed treat the input as a decimal or hexadecimal integer depending on the 'Input' choice. The resulting number is added to, subtracted from or used as the new value for the current position.

If the resulting position is negative or larger than the file's size the current position is set to the start or end of the file respectively.

Editing

Clicking the 'Edit' button causes BAFFLE to treat keystrokes as bytes to be replaced in the Active file at the current position. If the 'Input' option is set to "ASCII" keystrokes are treated as characters while if it is set to "HEX" then hexadecimal digits are expected. In ASCII mode, non-character keys such as the Ctrl and Alt keys are ignored, while in HEX mode, characters except 0-9 and 'a-f' are treated as errors (blanks are ignored). Editing can be ended at any time by pressing the Escape key.

Note: in 'Edit' mode, the keypad buttons and cursor keys are active, so it's possible to edit one byte, then skip elsewhere and edit another without leaving 'Edit' mode.

Once a byte in the file has been altered the 'Save' button is enabled and pressing 'Browse' or 'Exit' will cause BAFFLE to ask if the change(s) should be saved. The same thing will happen if bytes have been altered and searching, comparing or jumping results in BAFFLE having to discard a changed buffer in order to load a new segment of the file (BAFFLE has 8 buffers, each 64Kb in size, for each file, so quite a bit of editing typically is required before this happens).

Customising BAFFLE

Some Baffle features can customised by changing the properties file, "baffle.properties", (which you will find in the same folder as the app once you've run it). This file is a simple text file that you can edit with any text editor (NotePad, TextEdit etc). Lines have the form:

   property=value

The properties are:

Version History:

Feedback

Comments, suggestions and bug reports welcome. Dave@zenoshrdlu.com.

All my apps are freeware, but if you've found them useful and would like to thank the author, you can make a donation (for example £1, €1 or $1) to show your appreciation for the many hours spent working on them!

For other free software of mine, see here