diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2025-02-21 18:02:19 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-21 18:02:19 -0800 |
| commit | 61961fb938fa2ff9a6b2391be09ad19d46b7b3d5 (patch) | |
| tree | 7ef814f477dc8cbf5c48d5c52997ef83ffcd604f /include | |
| parent | a96c93d9363c72010eace4e32c053e012afe5b9a (diff) | |
Remove asm-processor in favor of preprocess.sh (#1760)
* Remove asm-processor in favor of preprocess.sh
* Remove duplicate CMD_F
* preprocess_pragmas gitignore
* Mac fixes
* Macos + clang as cc check fixes
* Need quotes for paths with spaces
* Fix bss
Diffstat (limited to 'include')
| -rw-r--r-- | include/prevent_bss_reordering.h | 83 | ||||
| -rw-r--r-- | include/prevent_bss_reordering2.h | 44 | ||||
| -rw-r--r-- | include/z64cutscene_commands.h | 28 |
3 files changed, 27 insertions, 128 deletions
diff --git a/include/prevent_bss_reordering.h b/include/prevent_bss_reordering.h deleted file mode 100644 index 604e45b8d..000000000 --- a/include/prevent_bss_reordering.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef PREVENT_BSS_REORDERING_H -#define PREVENT_BSS_REORDERING_H - -/** - * To determine variable order for .bss, the compiler sorts variables by their - * "name index" mod 256, where name index is something that, with -g, gets - * incremented by struct and variable declarations, typedefs, and file markers, - * among else. (Without -g, only variable declarations affects the index.) - * This file contains enough dummy declarations to bump the index by 128. - * Including it, or removing the include, should fix bss reordering problems - * for a file, assuming the name index distance between its first and last bss - * variable is at most 128. - * Note that if a variable is declared "extern" within a header file, the name - * index is taken at that point of the extern declaration. Thus, this include - * must come before any such header. - */ - -struct Dummy0 { int x; }; -struct Dummy1 { int x; }; -struct Dummy2 { int x; }; -struct Dummy3 { int x; }; -struct Dummy4 { int x; }; -struct Dummy5 { int x; }; -struct Dummy6 { int x; }; -struct Dummy7 { int x; }; -struct Dummy8 { int x; }; -struct Dummy9 { int x; }; -struct Dummy10 { int x; }; -struct Dummy11 { int x; }; -struct Dummy12 { int x; }; -struct Dummy13 { int x; }; -struct Dummy14 { int x; }; -struct Dummy15 { int x; }; -struct Dummy16 { int x; }; -struct Dummy17 { int x; }; -struct Dummy18 { int x; }; -struct Dummy19 { int x; }; -struct Dummy20 { int x; }; -struct Dummy21 { int x; }; -struct Dummy22 { int x; }; -struct Dummy23 { int x; }; -struct Dummy24 { int x; }; -struct Dummy25 { int x; }; -struct Dummy26 { int x; }; -struct Dummy27 { int x; }; -struct Dummy28 { int x; }; -struct Dummy29 { int x; }; -struct Dummy30 { int x; }; -struct Dummy31 { int x; }; -struct Dummy32 { int x; }; -struct Dummy33 { int x; }; -struct Dummy34 { int x; }; -struct Dummy35 { int x; }; -struct Dummy36 { int x; }; -struct Dummy37 { int x; }; -struct Dummy38 { int x; }; -struct Dummy39 { int x; }; -struct Dummy40 { int x; }; -struct Dummy41 { int x; }; -struct Dummy42 { int x; }; -struct Dummy43 { int x; }; -struct Dummy44 { int x; }; -struct Dummy45 { int x; }; -struct Dummy46 { int x; }; -struct Dummy47 { int x; }; -struct Dummy48 { int x; }; -struct Dummy49 { int x; }; -struct Dummy50 { int x; }; -struct Dummy51 { int x; }; -struct Dummy52 { int x; }; -struct Dummy53 { int x; }; -struct Dummy54 { int x; }; -struct Dummy55 { int x; }; -struct Dummy56 { int x; }; -struct Dummy57 { int x; }; -struct Dummy58 { int x; }; -struct Dummy59 { int x; }; -struct Dummy60 { int x; }; -struct Dummy61 { int x; }; -struct Dummy62 { int x; }; -typedef int Dummy63; - -#endif diff --git a/include/prevent_bss_reordering2.h b/include/prevent_bss_reordering2.h deleted file mode 100644 index c0a4820d7..000000000 --- a/include/prevent_bss_reordering2.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef PREVENT_BSS_REORDERING2_H -#define PREVENT_BSS_REORDERING2_H - -/** - * See the explanation at prevent_bss_reordering.h - * - * Instead of producing 64 dummy declarations, this header only produces 32 - * dummy declarations - */ - -struct Dummy100 { int x; }; -struct Dummy101 { int x; }; -struct Dummy102 { int x; }; -struct Dummy103 { int x; }; -struct Dummy104 { int x; }; -struct Dummy105 { int x; }; -struct Dummy106 { int x; }; -struct Dummy107 { int x; }; -struct Dummy108 { int x; }; -struct Dummy109 { int x; }; -struct Dummy110 { int x; }; -struct Dummy111 { int x; }; -struct Dummy112 { int x; }; -struct Dummy113 { int x; }; -struct Dummy114 { int x; }; -struct Dummy115 { int x; }; -struct Dummy116 { int x; }; -struct Dummy117 { int x; }; -struct Dummy118 { int x; }; -struct Dummy119 { int x; }; -struct Dummy120 { int x; }; -struct Dummy121 { int x; }; -struct Dummy122 { int x; }; -struct Dummy123 { int x; }; -struct Dummy124 { int x; }; -struct Dummy125 { int x; }; -struct Dummy126 { int x; }; -struct Dummy127 { int x; }; -struct Dummy128 { int x; }; -struct Dummy129 { int x; }; -struct Dummy130 { int x; }; -struct Dummy131 { int x; }; - -#endif diff --git a/include/z64cutscene_commands.h b/include/z64cutscene_commands.h index 1bc350af7..2bcb8f6a4 100644 --- a/include/z64cutscene_commands.h +++ b/include/z64cutscene_commands.h @@ -6,7 +6,33 @@ /** * Cutscene scripts are arrays of `CutsceneData` words, including bit-packed integers and floats. - */ + * + * Most command macros have unused arguments. This is to account for the vanilla assets setting specific values + * that don't end up being used by any code. They can safely be set to anything, as they aren't used in the + * implementation. + * + * It is believed the original tool used for cutscenes handled most commands the same way, using similar + * fields, and the code would have accessed them using common structs. Given this, the unused values observed in vanilla + * assets may appear to map to a variable that makes sense, even if it doesn't end up being used in the code. It + * probably isn't garbage data. + * + * This codebase goes with specialized structs and macros to make it easier to follow the code. + * Note this common struct design is still partially reflected in all commands having a `startFrame` and `endFrame`, + * when sometimes only the `startFrame` matters (as documented). + */ + +/** + * CMD_F expects an (IEEE 754) encoded float (colloquially "in hex", such as `0x42280000`), + * rather than a C float literal (such as `42.0f`). + * Float literals cannot be used because cutscenes are arrays of union type CutsceneData, which may contain integers and floats. + * Regardless of CutsceneData having a float member, initializing with a float will cast the float to s32. + * Designated initializers (added in C99) would solve this problem but are not supported by IDO (C89 and some extensions). + */ +#ifdef __GNUC__ +#define CS_FLOAT(ieee754bin, f) (f) +#else +#define CS_FLOAT(ieee754bin, f) (ieee754bin) +#endif /** * Marks the beginning of a cutscene script. |
