<
From version < 26.1 >
edited by Hugo Peters
on 2021/03/04 14:34
To version < 27.1 >
edited by nuggs
on 2021/03/04 22:12
>
Change comment: almost makes sense if you squint hard enough

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.Hugo_Peters
1 +XWiki.nuggs
Content
... ... @@ -4,14 +4,67 @@
4 4  
5 5  There are a total of 796 DLLs in the ROM, which are separated in to 4 banks.
6 6  
7 -Below is a table of the DLLs for each bank and their use.
8 -
9 9  {{toc numbered="true"/}}
10 10  
9 += DLL Format =
11 11  
12 -= Engine DLLs =
11 +(% border="0" %)
12 +|=Offset|=Size|=Description
13 +|0x00|4|Header size
14 +|0x04|4|DATA offset (or 0xFFFFFFFF if section not present)
15 +|0x08|4|RODATA offset (or 0xFFFFFFFF if section not present)
16 +|0x0C|2|Export count
17 +|0x0E|2|Padding
18 +|0x10|4|Constructor offset (relative end of header)
19 +|0x14|4|Destructor offset (relative end of header)
20 +|0x18|4|Unused
21 +|0x1C|4 * count|Export offsets (relative end of header)
22 +|0x1C + 4 * count|*|Body
13 13  
24 +The export count is often checked by the code responsible for loading any specific DLL as a method of determining compatibility. If the DLL does not export enough functions to satisfy the requesting code, it is immediately unloaded.
25 +
26 +== DLL Relocations ==
27 +
28 +The RODATA segment must begin with a DLL relocation table, which has the following structure.
29 +
14 14  (% border="0" %)
31 +|=Value|=Description
32 +|*|(((
33 +Descriptors for RODATA segment.
34 +If the MSB (bit 31) is set, this is an index into DLLSIMPORTTAB to resolve a pointer to the base executable.
35 +If the MSB is not set, this is an offset relative end of header to something within the DLL.
36 +)))
37 +|0xFFFFFFFE|Terminates the above section.
38 +|*|(((
39 +Descriptors for TEXT segment.
40 +These are offsets relative end of header to the start of DLL entrypoints for patching the $gp initializer stub.
41 +)))
42 +|0xFFFFFFFD|Terminates the above section.
43 +|*|(((
44 +Descriptors for DATA segment.
45 +These are offsets relative the start of the DATA segment, to offsets stored in that segment that are to be replaced with pointers.
46 +)))
47 +|0xFFFFFFFF|Terminates the above section.
48 +
49 +If a section within the relocation table is unused, it can be immediately terminated, but the table structure must exist.
50 +
51 +DLL entrypoint functions usually begin with a $gp initializer stub which is patched by the loader to allow the DLL to locate its data segments. The value assigned is a pointer to the start of the RODATA segment.
52 +
53 +{{code language="none"}}
54 +lui gp, 0x0
55 +ori gp, gp, 0x0
56 +nop
57 +{{/code}}
58 +
59 +DLLs may only reference other DLLs that they load themselves, or ones that are loaded by the base executable during startup. The latter are made accessible through global variables which have an entry in the DLLSIMPORTTAB.
60 +
61 += DLLs =
62 +
63 +Below is a table of the DLLs for each bank and their use.
64 +
65 +== Engine DLLs ==
66 +
67 +(% border="0" %)
15 15  |=ID|=Name|=Description
16 16  |1|cmdmenu|?
17 17  |2|camcontrol|?
... ... @@ -120,7 +120,7 @@
120 120  |102|camdrop|?
121 121  |103|?|?
122 122  
123 -= modgfx DLLs =
176 +== modgfx DLLs ==
124 124  
125 125  (% border="0" %)
126 126  |=ID|=Name|=Description
... ... @@ -207,7 +207,7 @@
207 207  |184|?|?
208 208  |185|?|?
209 209  
210 -= projgfx DLLs =
263 +== projgfx DLLs ==
211 211  
212 212  (% border="0" %)
213 213  |=ID|=Name|=Description
... ... @@ -236,7 +236,7 @@
236 236  |208|?|?
237 237  |209|?|?
238 238  
239 -= Object DLLs =
292 +== Object DLLs ==
240 240  
241 241  (% border="0" %)
242 242  |=ID|=Name|=Description