Help:Text modding: Difference between revisions

修改了raw这一control的相关内容
Ginger (talk | contribs)
Gave a definite explanation of the Raw format
Line 13: Line 13:


Read about [[message archives]] for more information on what the subfolders are for.
Read about [[message archives]] for more information on what the subfolders are for.
==== MSYT ====
MSYT is community-driven code library for reading the MSBT format.
MSBT is Message Studio Binary Text, or "a binary representation of text as used by Message Studio." (which is a Nintendo tool)
MSYT is Message Studio YAML Text, or "a YAML representation of Message Studio Binary Text." (since Message Studio doesn't actually use MSYT)


==Editing the files==
==Editing the files==
Line 265: Line 272:
'''Raw'''
'''Raw'''


The exact purpose of it remains unclear, but it can be confirmed that under certain circumstances, the following two formats are equivalent. Sometimes text with `choice` may incorrectly load part of the next paragraph; using `raw` instead of `choice` can prevent this from happening.
Raw controls are those which MSYT doesn't have the knowledge to convert to something human-readable. In essence, a Raw control is a collection of raw binary data that has not been meaningfully converted to a different format. Instead, the original bytes are collected into the Raw control, allowing you to edit them directly, if you understand the format.


          {
This is, understandably, unlikely, and in most cases you shouldn't bother trying to edit a Raw control.


            "control": {
In the time since MSYT was last updated, more progress has been made on reverse engineering the format, so we now understand more about the structure. For example, the following code snippet...<syntaxhighlight lang="yaml">
 
      - control:
              "kind": "raw",
          kind: raw
 
          two_hundred_one:
              "one": {
            dynamic:
 
              - 0
                "eight": {
              - len: 4
 
                field_2:
                  "unknown_1": [],
                  - 2
 
                  - 1
                  "field_1": [
                  - 1
 
                  - 0
                    0,
</syntaxhighlight>...can be explained as follows:
 
                    0,
 
                    1,
 
                    0,
 
                    2,
 
                    0,
 
                    3
 
                  ],
 
                  "field_2": [
 
                    0,
 
                    0,
 
                    0,
 
                    4
 
                  ]
 
                }
 
              }
 
            }
 
          }
 
        ]
 
      },
 
          {
 
            "control": {
 
              "kind": "choice",
 
              "choice_labels": [
 
                0,
 
                1,
 
                2,
 
                3
 
              ],
 
              "selected_index": 0,
 
              "cancel_index": 4,
 
              "unknown": 18


            }
<code>two_hundred_one</code>: The text form of the number 201, whose binary form (<code>0x00C9</code>) is what MSBT uses to represent the GrammarTag<ref>https://github.com/GingerAvalanche/MsbtLib/blob/master/MSBT/Controls/GrammarTag.cs</ref> structure (which is a "TagGroup").


          }
<code>dynamic</code>: The amount of data in a 201 (GrammarTag) can change, depending on which specific Tag is used.


        ]
<code>- 0</code>: The number directly under the "dynamic" (the 0, in this case) is the actual Tag. In the case of GrammarTag, the 0 Tag is Info<ref>https://github.com/GingerAvalanche/MsbtLib/blob/master/MSBT/Controls/GrammarTags/Info.cs</ref>. An Info Tag contains 4 bytes, as can be seen by the 4 values inside <code>field_2</code>. (In the binary, the Info Tag - and all tags - are terminated by the <code>0xCD</code> byte, as mentioned earlier, so that byte is not represented in a Raw control)


      },
The missing formats that have been implemented in MSYT (and, by extension, WildBits and Hyrule Builder) as Raw controls are now understood (at least, their data layout is - not all of what they are used for is understood) and can be found by looking through [https://github.com/GingerAvalanche/MsbtLib/tree/master/MSBT/Controls the Control namespace in MsbtLib]. (MsbtLib is a different library that converts controls into inlined XML-like tags, and was used in the creation of a different tool that is, as of yet, unfinished, and as such, MsbtLib and that other tool are outside the scope of this article, except for the documentation they provide on the MSBT format)


==Saving the files==
==Saving the files==