Sort src/ into subsystem folders (engine, game, level, level/grid, entity with player, npc, boss, familiar, effect, pickup and weapon, ui, ui/menu, lua, online), drop each folder's prefix from file names, include by path from src/, glob src/ recursively
This commit is contained in:
1 parent
9254158eef
commit
7d3cf33c20
706 files changed
+5337
-5336
No files matched your search
@@ -19,22 +19,22 @@ Read these before starting:
|
||||
|
||||
|
||||
Conventions added since wave A, which every agent this wave follows:
|
||||
- Manager is taken over (src/manager.h). Reach the subsystems through g_manager by the generated member name without the leading underscore: g_manager->stringTable, g_manager->optionsConfig, g_manager->itemConfig, g_manager->entityConfig, g_manager->modManager ... Read manager.h for the exact names.
|
||||
- Manager is taken over (src/game/manager.h). Reach the subsystems through g_manager by the generated member name without the leading underscore: g_manager->stringTable, g_manager->optionsConfig, g_manager->itemConfig, g_manager->entityConfig, g_manager->modManager ... Read manager.h for the exact names.
|
||||
- A taken-over class gets no generated stubs. Every method your header declares but you do not write yet gets a one-line definition calling reconstruction_missing("Class::Method 00xxxxxx") from src/log.h, so the build keeps linking and stops there with a clear message.
|
||||
- A free function you take over (not a class method) must also be declared in one of your headers: the generator drops it from classes.h once src/ carries its address, so its other callers need your header.
|
||||
- Never delete decompilation write-ups (docs/, *.md with addresses). When you retire an old module, move its notes into notes/systems/ instead.
|
||||
- Running the game: always muted (./build/isaac --mute) and never watch the intro: any input (Space, Enter) skips it, so inject one early.
|
||||
- Comments: a comment starting with an address takes that function over. So does every address in a parenthesised list on a comment, like "(0040b000, 0040b1d0, 00a1a5c0 to 00a1a630)" (ranges included).
|
||||
- src/data.h has resource_path(path) (lowercased, under resources/) for any non-JSON resource, and data_path(path) for converted XML. .anm2 files are Anm2Ed JSON documents, already handled by src/anm2.h.
|
||||
- src/engine/data.h has resource_path(path) (lowercased, under resources/) for any non-JSON resource, and data_path(path) for converted XML. .anm2 files are Anm2Ed JSON documents, already handled by src/engine/anm2.h.
|
||||
|
||||
How the build works:
|
||||
- generated-src/classes.h is generated and declares every class with the original 32-bit layout.
|
||||
- generated-src/stubs.cpp defines every function src/ has not taken over as a stub that prints "Reached X, not reconstructed yet" and exits.
|
||||
- CMake builds src/*.cpp + stubs.cpp into build/isaac. Only curated code ever runs.
|
||||
- CMake builds every .cpp under src/ (sorted into subsystem folders: engine, game, level, level/grid, entity with player, npc, boss, familiar, effect, pickup and weapon, ui, ui/menu, lua, online) + stubs.cpp into build/isaac. Files drop their folder prefix (src/entity/boss/mom.cpp) and include each other by path from src/ ("entity/boss/mom.h"). Only curated code ever runs.
|
||||
- When src/<something>.h defines a struct or class itself, the generator (scripts/source_tree.py) drops that class from classes.h, keeping only a forward declaration, and writes no stubs for it. That is a CLASS TAKEOVER, and this round is about class takeovers.
|
||||
|
||||
How to take over a class:
|
||||
- Write src/<snake_case>.h with the class definition and src/<snake_case>.cpp with its methods. Include "classes.h" for everything else.
|
||||
- Write src/<folder>/<snake_case>.h with the class definition and src/<folder>/<snake_case>.cpp with its methods, in the folder its subsystem belongs to. Include "classes.h" for everything else.
|
||||
- Make it idiomatic C++20 in the smack-a-brother style:
|
||||
- std::string, std::vector, std::map, std::unordered_map, std::array, std::unique_ptr members instead of the MSVC layouts;
|
||||
- real enums, preferably enum class or plain enums as smack-a-brother does, for modes and flags;
|
||||
@@ -48,7 +48,7 @@ How to take over a class:
|
||||
- Take over the WHOLE class you are assigned: every method the class has in the original that the game needs (see generated-src/classes.h for the list and generated-src/<class>.cpp, ./decompile.sh <address>, ./decompile.sh --asm <address> N for bodies).
|
||||
- Collapse compiler-generated ones (copy constructors, operator_assign, destructors that only free members) into the language defaults where std members make them unnecessary, and still list their addresses in a comment above the class so the generator drops them: "// Copies, assignment and destruction (0040b000, 0040b1d0, 0040ae70) are the defaults."
|
||||
- Behaviour must match the original exactly: same results, same order of effects, same edge cases. Where the original crashes or has undefined behaviour, pick a safe behaviour and say so in one comment line.
|
||||
- Data: XML is converted by the import tool into JSON under resources/ (lowercase paths, ".json" appended). Read it through src/data.h: data_load, node_children, node_tag, node_attr, node_text. Element order is preserved and attribute values are the original strings. A file with several roots becomes {"tag":"#document","children":[...]}. Convert values exactly as the original did. resources/ holds the real converted game files: look at them.
|
||||
- Data: XML is converted by the import tool into JSON under resources/ (lowercase paths, ".json" appended). Read it through src/engine/data.h: data_load, node_children, node_tag, node_attr, node_text. Element order is preserved and attribute values are the original strings. A file with several roots becomes {"tag":"#document","children":[...]}. Convert values exactly as the original did. resources/ holds the real converted game files: look at them.
|
||||
- Other classes: call whatever classes.h declares for classes nobody has taken over (they are stubs for now). Do NOT edit src/ files other than your own: other agents are rewriting other classes at the same time. If a round 1 file outside your assignment calls something you changed, list the needed call-site change in your report.
|
||||
- Every file you write must compile with no warnings: clang++ -std=c++20 -fsyntax-only -Wall -Wextra -I src -isystem ${R}/gen_\${i} -isystem external/simdjson/singleheader -isystem external/sdl/include -isystem external/lua -isystem external/stb src/<file>.cpp
|
||||
- First regenerate your private header with python3 -I scripts/source_tree.py ${R}/gen_\${i} classes.tsv dump zhl_vtables.tsv. Rerun it after creating your .h, because the generator drops the classes your header defines.
|
||||
|
||||
Reference in new issue
Block a user