Ideas to build common C-Lib

Hello guys, I wanna talking about posibility to construct a common C-Lib for us FE-Hack community.

C-Lib is a set of basic support libraries for C language programming, including various structures, variables, and function declarations and their reference. There has been 3 sets of different function libraries formed till now, I wanna call the Lib-A, B, and C:

A and B is the commonly used Lib for now, both of which hold its advantages and disadvantages:

It is @Vesly 's forking on CLib-A reminding me that it’s worth a discussion on issue which C-Lib to use and whether shall we build a common C-Lib. I would like to recommend you to try plan B here, but it seems that plan A is currently used by the majority for now.

2 Likes

I have been wondering the same thing myself. I’ve also noticed that febuilder has many labels that fe-clib is missing entirely.

If B or C have many different names for functions, then it is going to make it a real pain to start using over A. I am using A for many things already :pensive:

I forked fe-clib because I have a few things to document that have nothing there yet, and I feel guilty making notes for myself that will inevitably be lost in my C files if I don’t get in the habit of sharing the info as I go.

1 Like

Feel free to use anything that FEBuilderGBA has.
Conversely, if there is something that is not in FEBuilderGBA, we would be glad to know.
The shaky notation of function and variable names is a very troubling problem.
Various people name them appropriately, so a single thing can be called by multiple names.

I think that in C, even if you define externs with multiple names, the linker will merge them well as long as the names do not overlap.

FEBuilderGBA’s ASMMAP also has a pseudostruct-like function.
It would be nice if we could create C headers from these data, but the story is not that simple.
If we can do that, we should be able to make headers not only for FE8U but also for FE8J, FE6, etc.
There are many issues that need to be solved and untouched in order to make it something that can be used properly.

5 Likes

The final goal of decomp project is to rebuild the whole source code. Then hacking projects can start from it directly. As a reference, Pokemon hacking community has already reached that state.

As usual, the completion of decomp project can be divided into 2 phases:

  • Phase 1: disasm
    All pointers should be dumped in this phase. The milestone is to make the ROM shiftable, which makes hacking possible.

  • Phase 2: decomp
    All source code should be decompiled in this phase. Then the project is completed.

The decomp project of the Pokemon has already completed Phase 2, so it can be used as a template of hacking project. Obviously Fire Emblem hacking community has much less active contributors working on it than popular game series like Pokemon or Zelda. The decomp project of Fire Emblem is still in Phase 1, so it cannot be used as the start point of hacking project yet. Therefore, you may want to copy and paste source code from decomp project as a temporary workaround. However, I still suggest to use definitions compatible with decomp project considering the final goal, and you can add a compatible layer for old codes to work.

2 Likes