en:guide:febuildergba:rebuild.en

FEBuilderGBA - REBUILD -

The problem with FEBuilderGBA is fragments of ROM.
If you are doing data repotting many times, you will end up with a lot of shredded areas, squeezing the capacity of the ROM.
This is a problem if you make very big remodeling.
REBUILD is a feature that automatically solves this problem.
For example, it is like defragmentation.

Algorithm

The algorithm is as follows.

 Write the all data of the area known by FEBuilderGBA to the file.
 ↓
 Imports that data to unmodified ROM.
 ↓
 Create a cleaned-up ROM.

In other words, it may be easier to understand if you think that you are automatically generating something like Buildfile from the existing ROM.
However, since the data to be generated is assumed to be read by the machine, the readability is lower than that of the buildfile.

Even data structures that FEBuilder GBA does not know will keep track of LDR references and will work.
FE 8 works most correctly.
FE 7, FE 6, there are still many unknown data structures, so it is highly likely to fail.


Moreover, it does not correspond to the code which is executed complicated from the middle as follows.
If you write in EA it is a patch like the following.


 org 1234
 jmpToHack (my_program + $ 50)
 
 my_program:
 #incbin “my_program.dmp”
 
 my_program.asm
 .thumb
 MyLib:
 push {lr}
 
 pop {pc}
 
 
 .org 0x50
 Main:
 bl MyLib
 bl MyLib
 bl MyLib

In other words, it is a code that is jumping relative to BL with respect to the relative address above the specified pointer.
There are rare such codes, but in FE 8 J, the old two patches were written in this writing style.
If this code is in the address 0x01000000 which is the target of the rebuild, the rebuild fails.

There are newly rewritten versions of FE 8 J's old two patches, so please use it when using rebuild.

Data sharing

When rebuilding, you may share existing BIN data and reduce its size.
For example, it is a waste of capacity to add the same violin instrument data even though the violin instrument data is in the ROM.
In REBUILD, if you have such a data structure, it will be shared automatically. (The log shows SHARE!)

Improve compression efficiency

It seems that it has about 2 MB - 11 MB compression effect.
This is because remodeling made in the past did not share musical instrument data.

 Kaitou
 31MB
 ↓
 19MB
 
 Yugdra
 28MB
 ↓
 21MB
 
 zyouou no ken
 21MB
 ↓
 18MB

The old zalhman's song editor could not share instruments.
Currently, I expanded version and FEBuilderGBA will automatically share instruments.
Therefore, it is better not to expect much for 10 MB capacity reduction.
I think that it is about 2-5 MB.

Although there are slight modifications to the modification made by Buildfile, there are times when there is compression effect.
However, the effect is small, so you do not have to worry.

Usage scene

Normally you do not need to use REBUILD.
It is good to consider when the ROM capacity is near the limit of 32 MB.
Do not abuse it if you use it unnecessarily because it will cause a bug.

When you rebuild ROM.GBA, a file called ROM.R.GBA is created.
ROM.R.GBA is the rebuilt ROM.

After rebuilding, please be sure to perform a clear test.
If something goes wrong, it is dangerous, please discard the rebuilt ROM.
It is because it is very difficult to repair broken ROM as a result of rebuilding.
Therefore, a full test on whether to adopt the rebuild result is absolutely necessary.

File structure

 ROM.gba// target ROM
 ROM.R.gba// rebuilt ROM (R mark enters)
 ROM.R.rebuild.log.txt// Rebuild result log file
 
 ROM.R.rebuild// rebuild script
 rebuild_bin// Directory to store binary data that does not contain pointers Image or instrument data etc.
 rebuild_ifr// directory storing tabular data such as units and classes
 rebuild_mix// directory to store the data that contains the pointer

About dumped formats

This format is assumed to be read by machine.
You should not handwrite.
However, except @ BIN, it is stored in text format.

All numbers are in hexadecimal notation.
A space is one space.
Unless it is a pointer, it is one byte unit.
The pointer is fixed to 4 bytes.

@pointer

It corresponds to POIN label in EA.
Example:@08123456

When expressed in EA it becomes as follows.
POIN _08123456

`pointer

It is an anti Huffman pointer.
It is used when text data is stored in anti Huffman format.

Example:`08123456

+Self reference pointer

Record the relative position from the start address.
It is often used for musical scores etc.

Example:+123

&Pointer to ASM function

Unless there is a special reason, write the pointer with an even number.
For a pointer to an ASM function, it also searches for a +1 area.

Unless there is a special reason, write the pointer with an even number.
For a pointer to an ASM function, it also searches for a +1 area.

Example:&08123456
It matches both 08123456 and & 08123457.

Items in ROM.R.rebuild

@IFR

Represents form data.
The INDEX th is always inserted at the beginning.
After that, the data follows in hexadecimal notation.

@BIN

Binary data that does not contain any pointers
Image etc.

@MIX

It is data that the pointer mixes.

@MIXLZ77

Compressed into data LZ77 in which the pointer is mixed for use.
It is frame data of battle animation.

@DEF 123456

Definition only Used with unchanged addresses.
If you write in EA, it is a label that does not define anything.

org $123456
_123456:

Other

@_CRC32

It is a hash of CRC32 of the corresponding unmodified ROM.
Based on this hash, unmodified ROM is specified.

@ _ REBUILDADDRESS

Rebuild this address and later.
Usually it will be 0x01000000.

en/guide/febuildergba/rebuild.en.txt · 最終更新: 2018/09/09 19:45 by aera