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:
- two file windows let you examine a pair of files of any size up to 4Gb (BAFFLE uses 8 buffers, each 64Kb in size for each file)
- the two windows can be scrolled independently or locked together. As well as a useful key pad to scroll forward or backward 1, 16 or 256 bytes, or go to the start or end, BAFFLE reacts to the cursor keys
- you can search for ASCII or HEX strings forwards or backwards
- you can compare the two files (forward or backward) - BAFFLE will stop when it finds a difference
- BAFFLE can respect or ignore case when searching or comparing
- you can jump forward or backwards or to a given position using the "+", "-" and "=" commands - numbers can be entered in decimal or hex
- you can edit or patch arbitrary bytes within the files, entering new bytes in either ASCII or as two HEX digits
- any time a file has been changed the SAVE button is enabled, allowing you to save changes
- if all the buffers have had changes made to them, then if an attempt is made to scroll to a new section of the file BAFFLE will ask if the oldest buffer is to be saved
- there's on-line help available by pressing the Help button
This help document is divided into the following sections:
- Downloading and Installing
- Running BAFFLE
- The Windows
- Loading Files
- Setting Options for Searching, Comparing and Input
- Repeating Searches or Compares
- Jumping about using +, - and =
- Customising BAFFLE
Here's a picture of it running on my iMac:
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:
- 'baffle.jar' - the java executable
- 'baffle.bat' - a bat file for Windows
- 'baffle.sh' - a shell script for OSX or Linux
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 file2or the OSX/Linux command
./baffle.sh file1 file2
will start BAFFLE displaying 'file1' in the top window and 'file2' in the bottom one.
BAFFLE consists of two windows:
- the main window showing the content of the two files in HEX and ASCII. Each file is displayed as lines of 16 bytes, displayed as 32 HEX digits on the left and 16 ASCII characters on the right. By default there are 16 lines for each file, but BAFFLE can display 24 or 32 lines if the display is large enough (see the lines property in the Customisation section below ).
- a small scroll control window which lets you set the scrolling choices as well as scrolling by clicking buttons or pressing the cursor keys
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.
The upper left of the main BAFFLE window has three choice controls:
Each choice has two options:
The Control window has two choice controls which affect scrolling:
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!):
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:
- 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.
- 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.
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.
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".
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.
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).
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:
The properties are:
- lines which determines the size of the file areas. By default these are 16 lines deep, but lines can be set to 24 or 32, though only on large displays (bigger than 1280)
- font properties for the areas displaying file content in HEX and ASCII:
- fixfontname which by default is set to "Courier" - a monospaced font. The hex display will not be aligned properly unless a monospaced font is used.
- fixfontsize (in points) which by default is 12
- fixfontbold which can be set to true or false. By default it is false, so a bold font is not used.
- font properties for the areas displaying information about files, titles, buttons etc
- varfontname which by default is set to "Arial" - a sans serif font.
- varfontsize (in points) which by default is 12
- varfontbold which can be set to true or false. By default it is false, so a bold font is not used.
- the colours of various areas can be set to:
black, white, red, cyan, blue, yellow, pink, gray, lightgray, darkgray, green, magenta or orangethe various areas are:
- the background of the main and control windows - windowbg sets the background colour (by default this is lightgray)
- the two windows displaying the content of a file - textbg sets the background colour (by default this is blue) and textfg sets the foreground colour (by default this is yellow). These colours are reversed in the text line of the active window.
- the various fields displaying information about a file - its name, creation date and size - for the active window activebg sets the background colour (by default this is cyan) and activefg sets the foreground colour (by default this is black) while for the inactive window normalbg sets the background colour (by default this is white) and normalfg sets the foreground colour (by default this is black)
- the lines and boxes highlighting the current position in each file - boxfg sets the colour of these (by default this is magenta)
- upincr sets the number of bytes the current position must be moved by during a search or compare before the position indicators are updated. By default this is 4096. Making it smaller will slow down searching and comparing. For example, on my iMac it takes less than 5 seconds to compare two copies of the same 22MB file if upincr is set to its default, 22 seconds if upincr is set to 512 but nearly 2 minutes if it is set to 80!
- 1.03 - 7 November 2014 - fix hex search bug
- 1.02 - 14 March 2014 - disable most buttons during search and compare
- 1.01 - 20 February 2014 - minor tweaks (Tab key now toggles Active file, colours properly set on Windows machines)
- 1.00 - 13 February 2014 - initial release
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