FIB
From S1MP3 Wiki
FIB is a public domain program written by Fran that can search certain (ASCII and also hexa) patterns within an AFI file following the structure of its internal files. It scans the full .BIN internal tree-structure and informs you gradually of the relative position of the searched pattern from the beginning of each node/file, no matter its depth.
You can download the latest version here : Fib1.01-src.7z.
Source files are provided both for C and Java. Any kind of
problem/suggestion/improvement is welcome.
Along with the sources, there is a readme.txt with further info about FIB.
Simple example of usage
For example, if string "ST" is found in your FIRMWARE.BIN file, you'll get this sort of output:
C:\> fib FIRMWARE.BIN "ST" FIRMWARE.BIN[pos1]/FWIMAGE.FW[pos2]/UI30.RES[pos3]/RSAVING[pos4]
Practical example of usage
The main idea behind this program was making it simple finding pieces of code within an AFI file and knowing in which internal file(s) they are located, that's why I haven't removed the hexa finder: it's the program core and aim!
For example, I missed such an application when I was trying to keep my backlight changing colour with each keypress. I supposed the piece of code should be something like:
INC A ; A = present backlight colour CP 07H ; only 7 colours
that is, in hexa: 3CFE07. I searched for it within my AFI firmware file and found it 3 times, but by inspecting the surrounding hexa values none of the occurrences lead to what I was looking for.
Then I thought the second instruction could be as well probably AND 07H, so I searched for 3CE607 and it was there, just 1 time, and surrounded by promising code, which finally turned out to be what I wanted. Anyway: no guess which .AP, .DRV or other subfile contained it. Even though possible, finding it out turned out to be quite tedious, so that's why I planned to develop this Fib app.
See how simple it is right now doing this very same work:
C:\> fib FIRMWARE.BIN '3CFE07' FIRMWARE.BIN[2443249] / FWIMAGE.FW[2422769] / MUSIC.AP[44529] FIRMWARE.BIN[2446321] / FWIMAGE.FW[2425841] / MUSIC.AP[47601] FIRMWARE.BIN[2509809] / FWIMAGE.FW[2489329] / VOICE.AP[23025] > Occurrences in file [FIRMWARE.BIN]: 3 C:\> fib FIRMWARE.BIN '3CE607' FIRMWARE.BIN[2310181] / FWIMAGE.FW[2289701] / KY_HARD.DRV[1061] > Occurrences in file [FIRMWARE.BIN]: 1
Just by the name of the .AP and .DRV files, it's easy to find out the last search (and occurrence) is the good one! You just have to disassemble that single KY_HARD.DRV and... there you are!

