Monthly Archives: December 2015

Images

I found a solution for the imported images.

There are a lot of image types, which the FormBuilder can import into the FMX. To re-implement all readers, I have not enough time. So the best way is the ImageIO class of Java. There are a lot of plugins, which implement additional readers on GitHub. So it should be possible to enhance the application later. Currently the application can read BMP, JPEG, GIF, TIF, PICT, TARGA, PCT and PCX. The formats RAS, CALS and OIF cannot be read at the moment.

The binary content of the images are stored completely within the FMX. There is a reference to an image content list within the Canvas structure. The list contains a lot of pointers to the binary content of the images. But the length of the list doesn’t match to the number of imported images. So there are are more pointers as images. And I don’t see any length information of the content.

I have spent 4 nights to find a solution. Large images are split up into pieces of 0xFA00 bytes (64000 bytes). The last chunk is smaller. But the question is: how many chunks (and how many pointers to these chunks) belong to each image content?

A coincidence helped me a lot. I have found a pointer to an additional list in front of the image content reference list. The second list contains some numeric values. The number of values matches the number of imported images. The values match also to the image content length. So I found the image content length list.

I can now divide the length of each image by 0xFA00, which returns the number of chunks (if length mod 0xFA00 > 0, we will have one more chunk) of the image. The chunks of an image can now be copied into one byte array and read by the ImageIO class.

The images are ordered within the FMX file, so I can use an index between 1..n. These indices I have found within the Image description structure, which holds the coordinates and also the name of the image within the FMX.

The last step is the mapping between the image descriptors and its image content part by the image index.

Within the viewer I can display the image within the attribute table as thumbnail image.

Screenshot_Viewer

FMX.6.Viewer

I have written a lot of code to display the decompiled information in a graphical viewer instead of an endless list. The FMX.6.Viewer is now part of the decompiler JAR, so I can decompile FMX on the command line and also open a graphical UI to get an Oracle FormBuilder 6-like interface. Some information I did not extract from the FMX, but I hope, that I’ll find them.

Currently the viewer displays windows, visual attributes, record groups, parameters, editors, canvases and their sub-elements like rectangle, text, line, arc, frame, and group (images are still part of the re-engineering), data blocks (only the names at the moment) and alerts. For all these elements I can open a property palette. For canvases the viewer opens a test graphic, but it should be possible to redraw the elements on an JavaFX canvas.

FMX.6.Viewer

Data Blocks!

Yesterday I found the ordered list of data block references. So I can extract the name of every data block. There must be a tree underneath the data block structure, which contains the references to the item objects. This point I still have to find out.

In the meantime, the output of the decompiler is already very huge, so I should write a graphical representation of the content, like FormBuilder Object Navigator. A simple approach to JavaFX and MVC you can find here.