diff --git a/OpenKh.Command.AnbMaker/OpenKh.Command.AnbMaker.csproj b/OpenKh.Command.AnbMaker/OpenKh.Command.AnbMaker.csproj
index ea90b4b38..90a441327 100644
--- a/OpenKh.Command.AnbMaker/OpenKh.Command.AnbMaker.csproj
+++ b/OpenKh.Command.AnbMaker/OpenKh.Command.AnbMaker.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/OpenKh.Command.Bdxio/Antlr4/.gitignore b/OpenKh.Command.Bdxio/Antlr4/.gitignore
deleted file mode 100644
index 6161d9e8a..000000000
--- a/OpenKh.Command.Bdxio/Antlr4/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-/.antlr
-/.vscode
-/BdxScript.interp
-/BdxScript.tokens
-/BdxScriptLexer.interp
-/BdxScriptLexer.tokens
-/test.bdxa
diff --git a/OpenKh.Command.Bdxio/Commands/DecodeCommand.cs b/OpenKh.Command.Bdxio/Commands/DecodeCommand.cs
index 2a3217590..84731e7d8 100644
--- a/OpenKh.Command.Bdxio/Commands/DecodeCommand.cs
+++ b/OpenKh.Command.Bdxio/Commands/DecodeCommand.cs
@@ -1,6 +1,6 @@
using McMaster.Extensions.CommandLineUtils;
using NLog;
-using OpenKh.Command.Bdxio.Utils;
+using OpenKh.Kh2.Bdx.Utils;
using System.ComponentModel.DataAnnotations;
namespace OpenKh.Command.Bdxio.Commands
diff --git a/OpenKh.Command.Bdxio/Commands/EncodeCommand.cs b/OpenKh.Command.Bdxio/Commands/EncodeCommand.cs
index 40ee6230e..7a92963cf 100644
--- a/OpenKh.Command.Bdxio/Commands/EncodeCommand.cs
+++ b/OpenKh.Command.Bdxio/Commands/EncodeCommand.cs
@@ -1,7 +1,7 @@
using McMaster.Extensions.CommandLineUtils;
using NLog;
-using OpenKh.Command.Bdxio.Models;
-using OpenKh.Command.Bdxio.Utils;
+using OpenKh.Kh2.Bdx.Models;
+using OpenKh.Kh2.Bdx.Utils;
using System.ComponentModel.DataAnnotations;
namespace OpenKh.Command.Bdxio.Commands
diff --git a/OpenKh.Command.Bdxio/OpenKh.Command.Bdxio.csproj b/OpenKh.Command.Bdxio/OpenKh.Command.Bdxio.csproj
index f517bf759..6e7675814 100644
--- a/OpenKh.Command.Bdxio/OpenKh.Command.Bdxio.csproj
+++ b/OpenKh.Command.Bdxio/OpenKh.Command.Bdxio.csproj
@@ -9,12 +9,13 @@
-
+
+
diff --git a/OpenKh.Command.IdxImg/EpicGamesAssets.cs b/OpenKh.Command.IdxImg/EpicGamesAssets.cs
index 642fbb8ff..88ed18b8f 100644
--- a/OpenKh.Command.IdxImg/EpicGamesAssets.cs
+++ b/OpenKh.Command.IdxImg/EpicGamesAssets.cs
@@ -130,6 +130,8 @@ private class BuildCommand
protected int OnExecute(CommandLineApplication app)
{
+ List _gameMap = new List() { "kh1", "kh2", "Recom", "bbs", "kh3d" };
+
var enabled = File.ReadAllLines(ModsFile);
if (Directory.Exists(OutputFolder))
@@ -141,9 +143,9 @@ protected int OnExecute(CommandLineApplication app)
foreach (var mod_name in enabled.AsEnumerable().Reverse())
{
var mod_folder = Path.Combine(ModsFolder, mod_name);
- var metadata = File.OpenRead(Path.Combine(mod_folder, "mod.yml")).Using(Metadata.Read);
+ var metadata = Metadata.Read(Path.Combine(mod_folder, "mod.yml"));
Console.WriteLine($"Patching {mod_name}");
- patcher.Patch(DataFolder, OutputFolder, metadata, mod_folder, platform: 2, packageMap: map, LaunchGame: GameId);
+ patcher.Patch(DataFolder, OutputFolder, metadata, mod_folder, targetPlatform: 1, packageMap: map, targetGame: _gameMap.IndexOf(GameId));
}
using (var packageMapWriter = new StreamWriter(Path.Combine(OutputFolder, "patch-package-map.txt")))
diff --git a/OpenKh.Command.MapGen/OpenKh.Command.MapGen.csproj b/OpenKh.Command.MapGen/OpenKh.Command.MapGen.csproj
index 21f7c9247..85396ee7a 100644
--- a/OpenKh.Command.MapGen/OpenKh.Command.MapGen.csproj
+++ b/OpenKh.Command.MapGen/OpenKh.Command.MapGen.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/OpenKh.Command.Bdxio/Antlr4/BdxScript.g4 b/OpenKh.Kh2/Bdx/Antlr/BdxScript.g4
similarity index 95%
rename from OpenKh.Command.Bdxio/Antlr4/BdxScript.g4
rename to OpenKh.Kh2/Bdx/Antlr/BdxScript.g4
index de02fc9d4..8241372bd 100644
--- a/OpenKh.Command.Bdxio/Antlr4/BdxScript.g4
+++ b/OpenKh.Kh2/Bdx/Antlr/BdxScript.g4
@@ -1,49 +1,49 @@
-grammar BdxScript;
-
-prog: NL* (statement NL*)* EOF;
-statement:
- section
- | equ
- | label ':' NL
- | label ':' order
- | order;
-
-label: name = id;
-
-equ: name = id 'equ' numberdata;
-
-order: db | resb | dw | resw | instruction | include;
-
-dw: 'dw' worddata (',' worddata)* NL;
-db: 'db' bytedata (',' bytedata)* NL;
-resb: 'resb' (numberdata | id) NL;
-resw: 'resw' (numberdata | id) NL;
-
-instruction: id (arg (',' arg)*)? NL;
-
-arg: (numberdata | id);
-offset: 'offset' id;
-bytedata: numberdata | id | StringData;
-worddata: numberdata | id;
-numberdata:
- decimalnumber = DEC
- | '0x' hexnumber = (DEC | HEX)
- | floatnumber = FLOATNUM;
-hexbody: DEC | HEX;
-id: DEC | HEX | ID;
-include: '%include' FileName NL;
-section: 'section' section_id NL;
-section_id: '.text' | '.bss';
-
-StringData: '\'' ~[']* '\'';
-DEC: [-+]? [0-9]+;
-HEX: [0-9a-fA-F]+;
-FLOATNUM:
- [-+]? ([0-9]* '.' [0-9]+)
- | ([0-9]+ [eE] [-+]? [0-9]+);
-ID: [a-zA-Z_][a-zA-Z0-9_]* ('.' [a-zA-Z0-9_]+)*;
-WS: [ \t] -> skip;
-NL: '\r'? '\n' | '\r';
-FileName: '"' ~["]* '"';
-
-LINE_COMMENT: ';' ~[\r\n]* -> skip;
+grammar BdxScript;
+
+prog: NL* (statement NL*)* EOF;
+statement:
+ section
+ | equ
+ | label ':' NL
+ | label ':' order
+ | order;
+
+label: name = id;
+
+equ: name = id 'equ' numberdata;
+
+order: db | resb | dw | resw | instruction | include;
+
+dw: 'dw' worddata (',' worddata)* NL;
+db: 'db' bytedata (',' bytedata)* NL;
+resb: 'resb' (numberdata | id) NL;
+resw: 'resw' (numberdata | id) NL;
+
+instruction: id (arg (',' arg)*)? NL;
+
+arg: (numberdata | id);
+offset: 'offset' id;
+bytedata: numberdata | id | StringData;
+worddata: numberdata | id;
+numberdata:
+ decimalnumber = DEC
+ | '0x' hexnumber = (DEC | HEX)
+ | floatnumber = FLOATNUM;
+hexbody: DEC | HEX;
+id: DEC | HEX | ID;
+include: '%include' FileName NL;
+section: 'section' section_id NL;
+section_id: '.text' | '.bss';
+
+StringData: '\'' ~[']* '\'';
+DEC: [-+]? [0-9]+;
+HEX: [0-9a-fA-F]+;
+FLOATNUM:
+ [-+]? ([0-9]* '.' [0-9]+)
+ | ([0-9]+ [eE] [-+]? [0-9]+);
+ID: [a-zA-Z_][a-zA-Z0-9_]* ('.' [a-zA-Z0-9_]+)*;
+WS: [ \t] -> skip;
+NL: '\r'? '\n' | '\r';
+FileName: '"' ~["]* '"';
+
+LINE_COMMENT: ';' ~[\r\n]* -> skip;
diff --git a/OpenKh.Command.Bdxio/Antlr4/BdxScriptLexer.cs b/OpenKh.Kh2/Bdx/Antlr/BdxScriptLexer.cs
similarity index 96%
rename from OpenKh.Command.Bdxio/Antlr4/BdxScriptLexer.cs
rename to OpenKh.Kh2/Bdx/Antlr/BdxScriptLexer.cs
index aebe4593b..f242237c9 100644
--- a/OpenKh.Command.Bdxio/Antlr4/BdxScriptLexer.cs
+++ b/OpenKh.Kh2/Bdx/Antlr/BdxScriptLexer.cs
@@ -1,177 +1,177 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// ANTLR Version: 4.11.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-// Generated from BdxScript.g4 by ANTLR 4.11.1
-
-// Unreachable code detected
-#pragma warning disable 0162
-// The variable '...' is assigned but its value is never used
-#pragma warning disable 0219
-// Missing XML comment for publicly visible type or member '...'
-#pragma warning disable 1591
-// Ambiguous reference in cref attribute
-#pragma warning disable 419
-
-using System;
-using System.IO;
-using System.Text;
-using Antlr4.Runtime;
-using Antlr4.Runtime.Atn;
-using Antlr4.Runtime.Misc;
-using DFA = Antlr4.Runtime.Dfa.DFA;
-
-[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.11.1")]
-[System.CLSCompliant(false)]
-public partial class BdxScriptLexer : Lexer {
- protected static DFA[] decisionToDFA;
- protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
- public const int
- T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
- T__9=10, T__10=11, T__11=12, T__12=13, StringData=14, DEC=15, HEX=16,
- FLOATNUM=17, ID=18, WS=19, NL=20, FileName=21, LINE_COMMENT=22;
- public static string[] channelNames = {
- "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
- };
-
- public static string[] modeNames = {
- "DEFAULT_MODE"
- };
-
- public static readonly string[] ruleNames = {
- "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
- "T__9", "T__10", "T__11", "T__12", "StringData", "DEC", "HEX", "FLOATNUM",
- "ID", "WS", "NL", "FileName", "LINE_COMMENT"
- };
-
-
- public BdxScriptLexer(ICharStream input)
- : this(input, Console.Out, Console.Error) { }
-
- public BdxScriptLexer(ICharStream input, TextWriter output, TextWriter errorOutput)
- : base(input, output, errorOutput)
- {
- Interpreter = new LexerATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
- }
-
- private static readonly string[] _LiteralNames = {
- null, "':'", "'equ'", "'dw'", "','", "'db'", "'resb'", "'resw'", "'offset'",
- "'0x'", "'%include'", "'section'", "'.text'", "'.bss'"
- };
- private static readonly string[] _SymbolicNames = {
- null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, "StringData", "DEC", "HEX", "FLOATNUM", "ID", "WS", "NL",
- "FileName", "LINE_COMMENT"
- };
- public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
-
- [NotNull]
- public override IVocabulary Vocabulary
- {
- get
- {
- return DefaultVocabulary;
- }
- }
-
- public override string GrammarFileName { get { return "BdxScript.g4"; } }
-
- public override string[] RuleNames { get { return ruleNames; } }
-
- public override string[] ChannelNames { get { return channelNames; } }
-
- public override string[] ModeNames { get { return modeNames; } }
-
- public override int[] SerializedAtn { get { return _serializedATN; } }
-
- static BdxScriptLexer() {
- decisionToDFA = new DFA[_ATN.NumberOfDecisions];
- for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
- decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
- }
- }
- private static int[] _serializedATN = {
- 4,0,22,207,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
- 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,
- 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,
- 7,21,1,0,1,0,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,
- 5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,
- 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,
- 1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,13,1,13,
- 5,13,110,8,13,10,13,12,13,113,9,13,1,13,1,13,1,14,3,14,118,8,14,1,14,4,
- 14,121,8,14,11,14,12,14,122,1,15,4,15,126,8,15,11,15,12,15,127,1,16,3,
- 16,131,8,16,1,16,5,16,134,8,16,10,16,12,16,137,9,16,1,16,1,16,4,16,141,
- 8,16,11,16,12,16,142,1,16,4,16,146,8,16,11,16,12,16,147,1,16,1,16,3,16,
- 152,8,16,1,16,4,16,155,8,16,11,16,12,16,156,3,16,159,8,16,1,17,1,17,5,
- 17,163,8,17,10,17,12,17,166,9,17,1,17,1,17,4,17,170,8,17,11,17,12,17,171,
- 5,17,174,8,17,10,17,12,17,177,9,17,1,18,1,18,1,18,1,18,1,19,3,19,184,8,
- 19,1,19,1,19,3,19,188,8,19,1,20,1,20,5,20,192,8,20,10,20,12,20,195,9,20,
- 1,20,1,20,1,21,1,21,5,21,201,8,21,10,21,12,21,204,9,21,1,21,1,21,0,0,22,
- 1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,
- 29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,1,0,10,1,0,39,39,2,0,43,
- 43,45,45,1,0,48,57,3,0,48,57,65,70,97,102,2,0,69,69,101,101,3,0,65,90,
- 95,95,97,122,4,0,48,57,65,90,95,95,97,122,2,0,9,9,32,32,1,0,34,34,2,0,
- 10,10,13,13,224,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,
- 0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,
- 0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,
- 1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,
- 0,0,43,1,0,0,0,1,45,1,0,0,0,3,47,1,0,0,0,5,51,1,0,0,0,7,54,1,0,0,0,9,56,
- 1,0,0,0,11,59,1,0,0,0,13,64,1,0,0,0,15,69,1,0,0,0,17,76,1,0,0,0,19,79,
- 1,0,0,0,21,88,1,0,0,0,23,96,1,0,0,0,25,102,1,0,0,0,27,107,1,0,0,0,29,117,
- 1,0,0,0,31,125,1,0,0,0,33,158,1,0,0,0,35,160,1,0,0,0,37,178,1,0,0,0,39,
- 187,1,0,0,0,41,189,1,0,0,0,43,198,1,0,0,0,45,46,5,58,0,0,46,2,1,0,0,0,
- 47,48,5,101,0,0,48,49,5,113,0,0,49,50,5,117,0,0,50,4,1,0,0,0,51,52,5,100,
- 0,0,52,53,5,119,0,0,53,6,1,0,0,0,54,55,5,44,0,0,55,8,1,0,0,0,56,57,5,100,
- 0,0,57,58,5,98,0,0,58,10,1,0,0,0,59,60,5,114,0,0,60,61,5,101,0,0,61,62,
- 5,115,0,0,62,63,5,98,0,0,63,12,1,0,0,0,64,65,5,114,0,0,65,66,5,101,0,0,
- 66,67,5,115,0,0,67,68,5,119,0,0,68,14,1,0,0,0,69,70,5,111,0,0,70,71,5,
- 102,0,0,71,72,5,102,0,0,72,73,5,115,0,0,73,74,5,101,0,0,74,75,5,116,0,
- 0,75,16,1,0,0,0,76,77,5,48,0,0,77,78,5,120,0,0,78,18,1,0,0,0,79,80,5,37,
- 0,0,80,81,5,105,0,0,81,82,5,110,0,0,82,83,5,99,0,0,83,84,5,108,0,0,84,
- 85,5,117,0,0,85,86,5,100,0,0,86,87,5,101,0,0,87,20,1,0,0,0,88,89,5,115,
- 0,0,89,90,5,101,0,0,90,91,5,99,0,0,91,92,5,116,0,0,92,93,5,105,0,0,93,
- 94,5,111,0,0,94,95,5,110,0,0,95,22,1,0,0,0,96,97,5,46,0,0,97,98,5,116,
- 0,0,98,99,5,101,0,0,99,100,5,120,0,0,100,101,5,116,0,0,101,24,1,0,0,0,
- 102,103,5,46,0,0,103,104,5,98,0,0,104,105,5,115,0,0,105,106,5,115,0,0,
- 106,26,1,0,0,0,107,111,5,39,0,0,108,110,8,0,0,0,109,108,1,0,0,0,110,113,
- 1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,114,1,0,0,0,113,111,1,0,0,
- 0,114,115,5,39,0,0,115,28,1,0,0,0,116,118,7,1,0,0,117,116,1,0,0,0,117,
- 118,1,0,0,0,118,120,1,0,0,0,119,121,7,2,0,0,120,119,1,0,0,0,121,122,1,
- 0,0,0,122,120,1,0,0,0,122,123,1,0,0,0,123,30,1,0,0,0,124,126,7,3,0,0,125,
- 124,1,0,0,0,126,127,1,0,0,0,127,125,1,0,0,0,127,128,1,0,0,0,128,32,1,0,
- 0,0,129,131,7,1,0,0,130,129,1,0,0,0,130,131,1,0,0,0,131,135,1,0,0,0,132,
- 134,7,2,0,0,133,132,1,0,0,0,134,137,1,0,0,0,135,133,1,0,0,0,135,136,1,
- 0,0,0,136,138,1,0,0,0,137,135,1,0,0,0,138,140,5,46,0,0,139,141,7,2,0,0,
- 140,139,1,0,0,0,141,142,1,0,0,0,142,140,1,0,0,0,142,143,1,0,0,0,143,159,
- 1,0,0,0,144,146,7,2,0,0,145,144,1,0,0,0,146,147,1,0,0,0,147,145,1,0,0,
- 0,147,148,1,0,0,0,148,149,1,0,0,0,149,151,7,4,0,0,150,152,7,1,0,0,151,
- 150,1,0,0,0,151,152,1,0,0,0,152,154,1,0,0,0,153,155,7,2,0,0,154,153,1,
- 0,0,0,155,156,1,0,0,0,156,154,1,0,0,0,156,157,1,0,0,0,157,159,1,0,0,0,
- 158,130,1,0,0,0,158,145,1,0,0,0,159,34,1,0,0,0,160,164,7,5,0,0,161,163,
- 7,6,0,0,162,161,1,0,0,0,163,166,1,0,0,0,164,162,1,0,0,0,164,165,1,0,0,
- 0,165,175,1,0,0,0,166,164,1,0,0,0,167,169,5,46,0,0,168,170,7,6,0,0,169,
- 168,1,0,0,0,170,171,1,0,0,0,171,169,1,0,0,0,171,172,1,0,0,0,172,174,1,
- 0,0,0,173,167,1,0,0,0,174,177,1,0,0,0,175,173,1,0,0,0,175,176,1,0,0,0,
- 176,36,1,0,0,0,177,175,1,0,0,0,178,179,7,7,0,0,179,180,1,0,0,0,180,181,
- 6,18,0,0,181,38,1,0,0,0,182,184,5,13,0,0,183,182,1,0,0,0,183,184,1,0,0,
- 0,184,185,1,0,0,0,185,188,5,10,0,0,186,188,5,13,0,0,187,183,1,0,0,0,187,
- 186,1,0,0,0,188,40,1,0,0,0,189,193,5,34,0,0,190,192,8,8,0,0,191,190,1,
- 0,0,0,192,195,1,0,0,0,193,191,1,0,0,0,193,194,1,0,0,0,194,196,1,0,0,0,
- 195,193,1,0,0,0,196,197,5,34,0,0,197,42,1,0,0,0,198,202,5,59,0,0,199,201,
- 8,9,0,0,200,199,1,0,0,0,201,204,1,0,0,0,202,200,1,0,0,0,202,203,1,0,0,
- 0,203,205,1,0,0,0,204,202,1,0,0,0,205,206,6,21,0,0,206,44,1,0,0,0,19,0,
- 111,117,122,127,130,135,142,147,151,156,158,164,171,175,183,187,193,202,
- 1,6,0,0
- };
-
- public static readonly ATN _ATN =
- new ATNDeserializer().Deserialize(_serializedATN);
-
-
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from BdxScript.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+using System;
+using System.IO;
+using System.Text;
+using Antlr4.Runtime;
+using Antlr4.Runtime.Atn;
+using Antlr4.Runtime.Misc;
+using DFA = Antlr4.Runtime.Dfa.DFA;
+
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.CLSCompliant(false)]
+public partial class BdxScriptLexer : Lexer {
+ protected static DFA[] decisionToDFA;
+ protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
+ public const int
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
+ T__9=10, T__10=11, T__11=12, T__12=13, StringData=14, DEC=15, HEX=16,
+ FLOATNUM=17, ID=18, WS=19, NL=20, FileName=21, LINE_COMMENT=22;
+ public static string[] channelNames = {
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN"
+ };
+
+ public static string[] modeNames = {
+ "DEFAULT_MODE"
+ };
+
+ public static readonly string[] ruleNames = {
+ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
+ "T__9", "T__10", "T__11", "T__12", "StringData", "DEC", "HEX", "FLOATNUM",
+ "ID", "WS", "NL", "FileName", "LINE_COMMENT"
+ };
+
+
+ public BdxScriptLexer(ICharStream input)
+ : this(input, Console.Out, Console.Error) { }
+
+ public BdxScriptLexer(ICharStream input, TextWriter output, TextWriter errorOutput)
+ : base(input, output, errorOutput)
+ {
+ Interpreter = new LexerATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
+ }
+
+ private static readonly string[] _LiteralNames = {
+ null, "':'", "'equ'", "'dw'", "','", "'db'", "'resb'", "'resw'", "'offset'",
+ "'0x'", "'%include'", "'section'", "'.text'", "'.bss'"
+ };
+ private static readonly string[] _SymbolicNames = {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, "StringData", "DEC", "HEX", "FLOATNUM", "ID", "WS", "NL",
+ "FileName", "LINE_COMMENT"
+ };
+ public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
+
+ [NotNull]
+ public override IVocabulary Vocabulary
+ {
+ get
+ {
+ return DefaultVocabulary;
+ }
+ }
+
+ public override string GrammarFileName { get { return "BdxScript.g4"; } }
+
+ public override string[] RuleNames { get { return ruleNames; } }
+
+ public override string[] ChannelNames { get { return channelNames; } }
+
+ public override string[] ModeNames { get { return modeNames; } }
+
+ public override int[] SerializedAtn { get { return _serializedATN; } }
+
+ static BdxScriptLexer() {
+ decisionToDFA = new DFA[_ATN.NumberOfDecisions];
+ for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
+ decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
+ }
+ }
+ private static int[] _serializedATN = {
+ 4,0,22,207,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,
+ 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,
+ 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,
+ 7,21,1,0,1,0,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,
+ 5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,
+ 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,
+ 1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,13,1,13,
+ 5,13,110,8,13,10,13,12,13,113,9,13,1,13,1,13,1,14,3,14,118,8,14,1,14,4,
+ 14,121,8,14,11,14,12,14,122,1,15,4,15,126,8,15,11,15,12,15,127,1,16,3,
+ 16,131,8,16,1,16,5,16,134,8,16,10,16,12,16,137,9,16,1,16,1,16,4,16,141,
+ 8,16,11,16,12,16,142,1,16,4,16,146,8,16,11,16,12,16,147,1,16,1,16,3,16,
+ 152,8,16,1,16,4,16,155,8,16,11,16,12,16,156,3,16,159,8,16,1,17,1,17,5,
+ 17,163,8,17,10,17,12,17,166,9,17,1,17,1,17,4,17,170,8,17,11,17,12,17,171,
+ 5,17,174,8,17,10,17,12,17,177,9,17,1,18,1,18,1,18,1,18,1,19,3,19,184,8,
+ 19,1,19,1,19,3,19,188,8,19,1,20,1,20,5,20,192,8,20,10,20,12,20,195,9,20,
+ 1,20,1,20,1,21,1,21,5,21,201,8,21,10,21,12,21,204,9,21,1,21,1,21,0,0,22,
+ 1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,
+ 29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,1,0,10,1,0,39,39,2,0,43,
+ 43,45,45,1,0,48,57,3,0,48,57,65,70,97,102,2,0,69,69,101,101,3,0,65,90,
+ 95,95,97,122,4,0,48,57,65,90,95,95,97,122,2,0,9,9,32,32,1,0,34,34,2,0,
+ 10,10,13,13,224,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,
+ 0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,
+ 0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,
+ 1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,
+ 0,0,43,1,0,0,0,1,45,1,0,0,0,3,47,1,0,0,0,5,51,1,0,0,0,7,54,1,0,0,0,9,56,
+ 1,0,0,0,11,59,1,0,0,0,13,64,1,0,0,0,15,69,1,0,0,0,17,76,1,0,0,0,19,79,
+ 1,0,0,0,21,88,1,0,0,0,23,96,1,0,0,0,25,102,1,0,0,0,27,107,1,0,0,0,29,117,
+ 1,0,0,0,31,125,1,0,0,0,33,158,1,0,0,0,35,160,1,0,0,0,37,178,1,0,0,0,39,
+ 187,1,0,0,0,41,189,1,0,0,0,43,198,1,0,0,0,45,46,5,58,0,0,46,2,1,0,0,0,
+ 47,48,5,101,0,0,48,49,5,113,0,0,49,50,5,117,0,0,50,4,1,0,0,0,51,52,5,100,
+ 0,0,52,53,5,119,0,0,53,6,1,0,0,0,54,55,5,44,0,0,55,8,1,0,0,0,56,57,5,100,
+ 0,0,57,58,5,98,0,0,58,10,1,0,0,0,59,60,5,114,0,0,60,61,5,101,0,0,61,62,
+ 5,115,0,0,62,63,5,98,0,0,63,12,1,0,0,0,64,65,5,114,0,0,65,66,5,101,0,0,
+ 66,67,5,115,0,0,67,68,5,119,0,0,68,14,1,0,0,0,69,70,5,111,0,0,70,71,5,
+ 102,0,0,71,72,5,102,0,0,72,73,5,115,0,0,73,74,5,101,0,0,74,75,5,116,0,
+ 0,75,16,1,0,0,0,76,77,5,48,0,0,77,78,5,120,0,0,78,18,1,0,0,0,79,80,5,37,
+ 0,0,80,81,5,105,0,0,81,82,5,110,0,0,82,83,5,99,0,0,83,84,5,108,0,0,84,
+ 85,5,117,0,0,85,86,5,100,0,0,86,87,5,101,0,0,87,20,1,0,0,0,88,89,5,115,
+ 0,0,89,90,5,101,0,0,90,91,5,99,0,0,91,92,5,116,0,0,92,93,5,105,0,0,93,
+ 94,5,111,0,0,94,95,5,110,0,0,95,22,1,0,0,0,96,97,5,46,0,0,97,98,5,116,
+ 0,0,98,99,5,101,0,0,99,100,5,120,0,0,100,101,5,116,0,0,101,24,1,0,0,0,
+ 102,103,5,46,0,0,103,104,5,98,0,0,104,105,5,115,0,0,105,106,5,115,0,0,
+ 106,26,1,0,0,0,107,111,5,39,0,0,108,110,8,0,0,0,109,108,1,0,0,0,110,113,
+ 1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,114,1,0,0,0,113,111,1,0,0,
+ 0,114,115,5,39,0,0,115,28,1,0,0,0,116,118,7,1,0,0,117,116,1,0,0,0,117,
+ 118,1,0,0,0,118,120,1,0,0,0,119,121,7,2,0,0,120,119,1,0,0,0,121,122,1,
+ 0,0,0,122,120,1,0,0,0,122,123,1,0,0,0,123,30,1,0,0,0,124,126,7,3,0,0,125,
+ 124,1,0,0,0,126,127,1,0,0,0,127,125,1,0,0,0,127,128,1,0,0,0,128,32,1,0,
+ 0,0,129,131,7,1,0,0,130,129,1,0,0,0,130,131,1,0,0,0,131,135,1,0,0,0,132,
+ 134,7,2,0,0,133,132,1,0,0,0,134,137,1,0,0,0,135,133,1,0,0,0,135,136,1,
+ 0,0,0,136,138,1,0,0,0,137,135,1,0,0,0,138,140,5,46,0,0,139,141,7,2,0,0,
+ 140,139,1,0,0,0,141,142,1,0,0,0,142,140,1,0,0,0,142,143,1,0,0,0,143,159,
+ 1,0,0,0,144,146,7,2,0,0,145,144,1,0,0,0,146,147,1,0,0,0,147,145,1,0,0,
+ 0,147,148,1,0,0,0,148,149,1,0,0,0,149,151,7,4,0,0,150,152,7,1,0,0,151,
+ 150,1,0,0,0,151,152,1,0,0,0,152,154,1,0,0,0,153,155,7,2,0,0,154,153,1,
+ 0,0,0,155,156,1,0,0,0,156,154,1,0,0,0,156,157,1,0,0,0,157,159,1,0,0,0,
+ 158,130,1,0,0,0,158,145,1,0,0,0,159,34,1,0,0,0,160,164,7,5,0,0,161,163,
+ 7,6,0,0,162,161,1,0,0,0,163,166,1,0,0,0,164,162,1,0,0,0,164,165,1,0,0,
+ 0,165,175,1,0,0,0,166,164,1,0,0,0,167,169,5,46,0,0,168,170,7,6,0,0,169,
+ 168,1,0,0,0,170,171,1,0,0,0,171,169,1,0,0,0,171,172,1,0,0,0,172,174,1,
+ 0,0,0,173,167,1,0,0,0,174,177,1,0,0,0,175,173,1,0,0,0,175,176,1,0,0,0,
+ 176,36,1,0,0,0,177,175,1,0,0,0,178,179,7,7,0,0,179,180,1,0,0,0,180,181,
+ 6,18,0,0,181,38,1,0,0,0,182,184,5,13,0,0,183,182,1,0,0,0,183,184,1,0,0,
+ 0,184,185,1,0,0,0,185,188,5,10,0,0,186,188,5,13,0,0,187,183,1,0,0,0,187,
+ 186,1,0,0,0,188,40,1,0,0,0,189,193,5,34,0,0,190,192,8,8,0,0,191,190,1,
+ 0,0,0,192,195,1,0,0,0,193,191,1,0,0,0,193,194,1,0,0,0,194,196,1,0,0,0,
+ 195,193,1,0,0,0,196,197,5,34,0,0,197,42,1,0,0,0,198,202,5,59,0,0,199,201,
+ 8,9,0,0,200,199,1,0,0,0,201,204,1,0,0,0,202,200,1,0,0,0,202,203,1,0,0,
+ 0,203,205,1,0,0,0,204,202,1,0,0,0,205,206,6,21,0,0,206,44,1,0,0,0,19,0,
+ 111,117,122,127,130,135,142,147,151,156,158,164,171,175,183,187,193,202,
+ 1,6,0,0
+ };
+
+ public static readonly ATN _ATN =
+ new ATNDeserializer().Deserialize(_serializedATN);
+
+
+}
diff --git a/OpenKh.Command.Bdxio/Antlr4/BdxScriptParser.cs b/OpenKh.Kh2/Bdx/Antlr/BdxScriptParser.cs
similarity index 95%
rename from OpenKh.Command.Bdxio/Antlr4/BdxScriptParser.cs
rename to OpenKh.Kh2/Bdx/Antlr/BdxScriptParser.cs
index 5ec6fad21..5f65fa505 100644
--- a/OpenKh.Command.Bdxio/Antlr4/BdxScriptParser.cs
+++ b/OpenKh.Kh2/Bdx/Antlr/BdxScriptParser.cs
@@ -1,1240 +1,1240 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// ANTLR Version: 4.11.1
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-// Generated from BdxScript.g4 by ANTLR 4.11.1
-
-// Unreachable code detected
-#pragma warning disable 0162
-// The variable '...' is assigned but its value is never used
-#pragma warning disable 0219
-// Missing XML comment for publicly visible type or member '...'
-#pragma warning disable 1591
-// Ambiguous reference in cref attribute
-#pragma warning disable 419
-
-using System;
-using System.IO;
-using System.Text;
-using System.Diagnostics;
-using System.Collections.Generic;
-using Antlr4.Runtime;
-using Antlr4.Runtime.Atn;
-using Antlr4.Runtime.Misc;
-using Antlr4.Runtime.Tree;
-using DFA = Antlr4.Runtime.Dfa.DFA;
-
-[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.11.1")]
-[System.CLSCompliant(false)]
-public partial class BdxScriptParser : Parser {
- protected static DFA[] decisionToDFA;
- protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
- public const int
- T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
- T__9=10, T__10=11, T__11=12, T__12=13, StringData=14, DEC=15, HEX=16,
- FLOATNUM=17, ID=18, WS=19, NL=20, FileName=21, LINE_COMMENT=22;
- public const int
- RULE_prog = 0, RULE_statement = 1, RULE_label = 2, RULE_equ = 3, RULE_order = 4,
- RULE_dw = 5, RULE_db = 6, RULE_resb = 7, RULE_resw = 8, RULE_instruction = 9,
- RULE_arg = 10, RULE_offset = 11, RULE_bytedata = 12, RULE_worddata = 13,
- RULE_numberdata = 14, RULE_hexbody = 15, RULE_id = 16, RULE_include = 17,
- RULE_section = 18, RULE_section_id = 19;
- public static readonly string[] ruleNames = {
- "prog", "statement", "label", "equ", "order", "dw", "db", "resb", "resw",
- "instruction", "arg", "offset", "bytedata", "worddata", "numberdata",
- "hexbody", "id", "include", "section", "section_id"
- };
-
- private static readonly string[] _LiteralNames = {
- null, "':'", "'equ'", "'dw'", "','", "'db'", "'resb'", "'resw'", "'offset'",
- "'0x'", "'%include'", "'section'", "'.text'", "'.bss'"
- };
- private static readonly string[] _SymbolicNames = {
- null, null, null, null, null, null, null, null, null, null, null, null,
- null, null, "StringData", "DEC", "HEX", "FLOATNUM", "ID", "WS", "NL",
- "FileName", "LINE_COMMENT"
- };
- public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
-
- [NotNull]
- public override IVocabulary Vocabulary
- {
- get
- {
- return DefaultVocabulary;
- }
- }
-
- public override string GrammarFileName { get { return "BdxScript.g4"; } }
-
- public override string[] RuleNames { get { return ruleNames; } }
-
- public override int[] SerializedAtn { get { return _serializedATN; } }
-
- static BdxScriptParser() {
- decisionToDFA = new DFA[_ATN.NumberOfDecisions];
- for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
- decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
- }
- }
-
- public BdxScriptParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
-
- public BdxScriptParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
- : base(input, output, errorOutput)
- {
- Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
- }
-
- public partial class ProgContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Eof() { return GetToken(BdxScriptParser.Eof, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(BdxScriptParser.NL); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
- return GetToken(BdxScriptParser.NL, i);
- }
- [System.Diagnostics.DebuggerNonUserCode] public StatementContext[] statement() {
- return GetRuleContexts();
- }
- [System.Diagnostics.DebuggerNonUserCode] public StatementContext statement(int i) {
- return GetRuleContext(i);
- }
- public ProgContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_prog; } }
- }
-
- [RuleVersion(0)]
- public ProgContext prog() {
- ProgContext _localctx = new ProgContext(Context, State);
- EnterRule(_localctx, 0, RULE_prog);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 43;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- while (_la==NL) {
- {
- {
- State = 40;
- Match(NL);
- }
- }
- State = 45;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- }
- State = 55;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- while (((_la) & ~0x3f) == 0 && ((1L << _la) & 363752L) != 0) {
- {
- {
- State = 46;
- statement();
- State = 50;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- while (_la==NL) {
- {
- {
- State = 47;
- Match(NL);
- }
- }
- State = 52;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- }
- }
- }
- State = 57;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- }
- State = 58;
- Match(Eof);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class StatementContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public SectionContext section() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public EquContext equ() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public LabelContext label() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public OrderContext order() {
- return GetRuleContext(0);
- }
- public StatementContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_statement; } }
- }
-
- [RuleVersion(0)]
- public StatementContext statement() {
- StatementContext _localctx = new StatementContext(Context, State);
- EnterRule(_localctx, 2, RULE_statement);
- try {
- State = 71;
- ErrorHandler.Sync(this);
- switch ( Interpreter.AdaptivePredict(TokenStream,3,Context) ) {
- case 1:
- EnterOuterAlt(_localctx, 1);
- {
- State = 60;
- section();
- }
- break;
- case 2:
- EnterOuterAlt(_localctx, 2);
- {
- State = 61;
- equ();
- }
- break;
- case 3:
- EnterOuterAlt(_localctx, 3);
- {
- State = 62;
- label();
- State = 63;
- Match(T__0);
- State = 64;
- Match(NL);
- }
- break;
- case 4:
- EnterOuterAlt(_localctx, 4);
- {
- State = 66;
- label();
- State = 67;
- Match(T__0);
- State = 68;
- order();
- }
- break;
- case 5:
- EnterOuterAlt(_localctx, 5);
- {
- State = 70;
- order();
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class LabelContext : ParserRuleContext {
- public IdContext name;
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public LabelContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_label; } }
- }
-
- [RuleVersion(0)]
- public LabelContext label() {
- LabelContext _localctx = new LabelContext(Context, State);
- EnterRule(_localctx, 4, RULE_label);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 73;
- _localctx.name = id();
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class EquContext : ParserRuleContext {
- public IdContext name;
- [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public EquContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_equ; } }
- }
-
- [RuleVersion(0)]
- public EquContext equ() {
- EquContext _localctx = new EquContext(Context, State);
- EnterRule(_localctx, 6, RULE_equ);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 75;
- _localctx.name = id();
- State = 76;
- Match(T__1);
- State = 77;
- numberdata();
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class OrderContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public DbContext db() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ResbContext resb() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public DwContext dw() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ReswContext resw() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public InstructionContext instruction() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IncludeContext include() {
- return GetRuleContext(0);
- }
- public OrderContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_order; } }
- }
-
- [RuleVersion(0)]
- public OrderContext order() {
- OrderContext _localctx = new OrderContext(Context, State);
- EnterRule(_localctx, 8, RULE_order);
- try {
- State = 85;
- ErrorHandler.Sync(this);
- switch (TokenStream.LA(1)) {
- case T__4:
- EnterOuterAlt(_localctx, 1);
- {
- State = 79;
- db();
- }
- break;
- case T__5:
- EnterOuterAlt(_localctx, 2);
- {
- State = 80;
- resb();
- }
- break;
- case T__2:
- EnterOuterAlt(_localctx, 3);
- {
- State = 81;
- dw();
- }
- break;
- case T__6:
- EnterOuterAlt(_localctx, 4);
- {
- State = 82;
- resw();
- }
- break;
- case DEC:
- case HEX:
- case ID:
- EnterOuterAlt(_localctx, 5);
- {
- State = 83;
- instruction();
- }
- break;
- case T__9:
- EnterOuterAlt(_localctx, 6);
- {
- State = 84;
- include();
- }
- break;
- default:
- throw new NoViableAltException(this);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class DwContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public WorddataContext[] worddata() {
- return GetRuleContexts();
- }
- [System.Diagnostics.DebuggerNonUserCode] public WorddataContext worddata(int i) {
- return GetRuleContext(i);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- public DwContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_dw; } }
- }
-
- [RuleVersion(0)]
- public DwContext dw() {
- DwContext _localctx = new DwContext(Context, State);
- EnterRule(_localctx, 10, RULE_dw);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 87;
- Match(T__2);
- State = 88;
- worddata();
- State = 93;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- while (_la==T__3) {
- {
- {
- State = 89;
- Match(T__3);
- State = 90;
- worddata();
- }
- }
- State = 95;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- }
- State = 96;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class DbContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public BytedataContext[] bytedata() {
- return GetRuleContexts();
- }
- [System.Diagnostics.DebuggerNonUserCode] public BytedataContext bytedata(int i) {
- return GetRuleContext(i);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- public DbContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_db; } }
- }
-
- [RuleVersion(0)]
- public DbContext db() {
- DbContext _localctx = new DbContext(Context, State);
- EnterRule(_localctx, 12, RULE_db);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 98;
- Match(T__4);
- State = 99;
- bytedata();
- State = 104;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- while (_la==T__3) {
- {
- {
- State = 100;
- Match(T__3);
- State = 101;
- bytedata();
- }
- }
- State = 106;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- }
- State = 107;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class ResbContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public ResbContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_resb; } }
- }
-
- [RuleVersion(0)]
- public ResbContext resb() {
- ResbContext _localctx = new ResbContext(Context, State);
- EnterRule(_localctx, 14, RULE_resb);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 109;
- Match(T__5);
- State = 112;
- ErrorHandler.Sync(this);
- switch ( Interpreter.AdaptivePredict(TokenStream,7,Context) ) {
- case 1:
- {
- State = 110;
- numberdata();
- }
- break;
- case 2:
- {
- State = 111;
- id();
- }
- break;
- }
- State = 114;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class ReswContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public ReswContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_resw; } }
- }
-
- [RuleVersion(0)]
- public ReswContext resw() {
- ReswContext _localctx = new ReswContext(Context, State);
- EnterRule(_localctx, 16, RULE_resw);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 116;
- Match(T__6);
- State = 119;
- ErrorHandler.Sync(this);
- switch ( Interpreter.AdaptivePredict(TokenStream,8,Context) ) {
- case 1:
- {
- State = 117;
- numberdata();
- }
- break;
- case 2:
- {
- State = 118;
- id();
- }
- break;
- }
- State = 121;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class InstructionContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ArgContext[] arg() {
- return GetRuleContexts();
- }
- [System.Diagnostics.DebuggerNonUserCode] public ArgContext arg(int i) {
- return GetRuleContext(i);
- }
- public InstructionContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_instruction; } }
- }
-
- [RuleVersion(0)]
- public InstructionContext instruction() {
- InstructionContext _localctx = new InstructionContext(Context, State);
- EnterRule(_localctx, 18, RULE_instruction);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 123;
- id();
- State = 132;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- if (((_la) & ~0x3f) == 0 && ((1L << _la) & 492032L) != 0) {
- {
- State = 124;
- arg();
- State = 129;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- while (_la==T__3) {
- {
- {
- State = 125;
- Match(T__3);
- State = 126;
- arg();
- }
- }
- State = 131;
- ErrorHandler.Sync(this);
- _la = TokenStream.LA(1);
- }
- }
- }
-
- State = 134;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class ArgContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public ArgContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_arg; } }
- }
-
- [RuleVersion(0)]
- public ArgContext arg() {
- ArgContext _localctx = new ArgContext(Context, State);
- EnterRule(_localctx, 20, RULE_arg);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 138;
- ErrorHandler.Sync(this);
- switch ( Interpreter.AdaptivePredict(TokenStream,11,Context) ) {
- case 1:
- {
- State = 136;
- numberdata();
- }
- break;
- case 2:
- {
- State = 137;
- id();
- }
- break;
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class OffsetContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public OffsetContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_offset; } }
- }
-
- [RuleVersion(0)]
- public OffsetContext offset() {
- OffsetContext _localctx = new OffsetContext(Context, State);
- EnterRule(_localctx, 22, RULE_offset);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 140;
- Match(T__7);
- State = 141;
- id();
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class BytedataContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode StringData() { return GetToken(BdxScriptParser.StringData, 0); }
- public BytedataContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_bytedata; } }
- }
-
- [RuleVersion(0)]
- public BytedataContext bytedata() {
- BytedataContext _localctx = new BytedataContext(Context, State);
- EnterRule(_localctx, 24, RULE_bytedata);
- try {
- State = 146;
- ErrorHandler.Sync(this);
- switch ( Interpreter.AdaptivePredict(TokenStream,12,Context) ) {
- case 1:
- EnterOuterAlt(_localctx, 1);
- {
- State = 143;
- numberdata();
- }
- break;
- case 2:
- EnterOuterAlt(_localctx, 2);
- {
- State = 144;
- id();
- }
- break;
- case 3:
- EnterOuterAlt(_localctx, 3);
- {
- State = 145;
- Match(StringData);
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class WorddataContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
- return GetRuleContext(0);
- }
- public WorddataContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_worddata; } }
- }
-
- [RuleVersion(0)]
- public WorddataContext worddata() {
- WorddataContext _localctx = new WorddataContext(Context, State);
- EnterRule(_localctx, 26, RULE_worddata);
- try {
- State = 150;
- ErrorHandler.Sync(this);
- switch ( Interpreter.AdaptivePredict(TokenStream,13,Context) ) {
- case 1:
- EnterOuterAlt(_localctx, 1);
- {
- State = 148;
- numberdata();
- }
- break;
- case 2:
- EnterOuterAlt(_localctx, 2);
- {
- State = 149;
- id();
- }
- break;
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class NumberdataContext : ParserRuleContext {
- public IToken decimalnumber;
- public IToken hexnumber;
- public IToken floatnumber;
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEC() { return GetToken(BdxScriptParser.DEC, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEX() { return GetToken(BdxScriptParser.HEX, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOATNUM() { return GetToken(BdxScriptParser.FLOATNUM, 0); }
- public NumberdataContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_numberdata; } }
- }
-
- [RuleVersion(0)]
- public NumberdataContext numberdata() {
- NumberdataContext _localctx = new NumberdataContext(Context, State);
- EnterRule(_localctx, 28, RULE_numberdata);
- int _la;
- try {
- State = 156;
- ErrorHandler.Sync(this);
- switch (TokenStream.LA(1)) {
- case DEC:
- EnterOuterAlt(_localctx, 1);
- {
- State = 152;
- _localctx.decimalnumber = Match(DEC);
- }
- break;
- case T__8:
- EnterOuterAlt(_localctx, 2);
- {
- State = 153;
- Match(T__8);
- State = 154;
- _localctx.hexnumber = TokenStream.LT(1);
- _la = TokenStream.LA(1);
- if ( !(_la==DEC || _la==HEX) ) {
- _localctx.hexnumber = ErrorHandler.RecoverInline(this);
- }
- else {
- ErrorHandler.ReportMatch(this);
- Consume();
- }
- }
- break;
- case FLOATNUM:
- EnterOuterAlt(_localctx, 3);
- {
- State = 155;
- _localctx.floatnumber = Match(FLOATNUM);
- }
- break;
- default:
- throw new NoViableAltException(this);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class HexbodyContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEC() { return GetToken(BdxScriptParser.DEC, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEX() { return GetToken(BdxScriptParser.HEX, 0); }
- public HexbodyContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_hexbody; } }
- }
-
- [RuleVersion(0)]
- public HexbodyContext hexbody() {
- HexbodyContext _localctx = new HexbodyContext(Context, State);
- EnterRule(_localctx, 30, RULE_hexbody);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 158;
- _la = TokenStream.LA(1);
- if ( !(_la==DEC || _la==HEX) ) {
- ErrorHandler.RecoverInline(this);
- }
- else {
- ErrorHandler.ReportMatch(this);
- Consume();
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class IdContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEC() { return GetToken(BdxScriptParser.DEC, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEX() { return GetToken(BdxScriptParser.HEX, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID() { return GetToken(BdxScriptParser.ID, 0); }
- public IdContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_id; } }
- }
-
- [RuleVersion(0)]
- public IdContext id() {
- IdContext _localctx = new IdContext(Context, State);
- EnterRule(_localctx, 32, RULE_id);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 160;
- _la = TokenStream.LA(1);
- if ( !(((_la) & ~0x3f) == 0 && ((1L << _la) & 360448L) != 0) ) {
- ErrorHandler.RecoverInline(this);
- }
- else {
- ErrorHandler.ReportMatch(this);
- Consume();
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class IncludeContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FileName() { return GetToken(BdxScriptParser.FileName, 0); }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- public IncludeContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_include; } }
- }
-
- [RuleVersion(0)]
- public IncludeContext include() {
- IncludeContext _localctx = new IncludeContext(Context, State);
- EnterRule(_localctx, 34, RULE_include);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 162;
- Match(T__9);
- State = 163;
- Match(FileName);
- State = 164;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class SectionContext : ParserRuleContext {
- [System.Diagnostics.DebuggerNonUserCode] public Section_idContext section_id() {
- return GetRuleContext(0);
- }
- [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
- public SectionContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_section; } }
- }
-
- [RuleVersion(0)]
- public SectionContext section() {
- SectionContext _localctx = new SectionContext(Context, State);
- EnterRule(_localctx, 36, RULE_section);
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 166;
- Match(T__10);
- State = 167;
- section_id();
- State = 168;
- Match(NL);
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- public partial class Section_idContext : ParserRuleContext {
- public Section_idContext(ParserRuleContext parent, int invokingState)
- : base(parent, invokingState)
- {
- }
- public override int RuleIndex { get { return RULE_section_id; } }
- }
-
- [RuleVersion(0)]
- public Section_idContext section_id() {
- Section_idContext _localctx = new Section_idContext(Context, State);
- EnterRule(_localctx, 38, RULE_section_id);
- int _la;
- try {
- EnterOuterAlt(_localctx, 1);
- {
- State = 170;
- _la = TokenStream.LA(1);
- if ( !(_la==T__11 || _la==T__12) ) {
- ErrorHandler.RecoverInline(this);
- }
- else {
- ErrorHandler.ReportMatch(this);
- Consume();
- }
- }
- }
- catch (RecognitionException re) {
- _localctx.exception = re;
- ErrorHandler.ReportError(this, re);
- ErrorHandler.Recover(this, re);
- }
- finally {
- ExitRule();
- }
- return _localctx;
- }
-
- private static int[] _serializedATN = {
- 4,1,22,173,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,
- 7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,
- 2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,1,0,5,0,42,8,0,10,0,
- 12,0,45,9,0,1,0,1,0,5,0,49,8,0,10,0,12,0,52,9,0,5,0,54,8,0,10,0,12,0,57,
- 9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,72,8,1,1,2,
- 1,2,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,3,4,86,8,4,1,5,1,5,1,5,1,5,
- 5,5,92,8,5,10,5,12,5,95,9,5,1,5,1,5,1,6,1,6,1,6,1,6,5,6,103,8,6,10,6,12,
- 6,106,9,6,1,6,1,6,1,7,1,7,1,7,3,7,113,8,7,1,7,1,7,1,8,1,8,1,8,3,8,120,
- 8,8,1,8,1,8,1,9,1,9,1,9,1,9,5,9,128,8,9,10,9,12,9,131,9,9,3,9,133,8,9,
- 1,9,1,9,1,10,1,10,3,10,139,8,10,1,11,1,11,1,11,1,12,1,12,1,12,3,12,147,
- 8,12,1,13,1,13,3,13,151,8,13,1,14,1,14,1,14,1,14,3,14,157,8,14,1,15,1,
- 15,1,16,1,16,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,0,
- 0,20,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,0,3,1,0,15,
- 16,2,0,15,16,18,18,1,0,12,13,176,0,43,1,0,0,0,2,71,1,0,0,0,4,73,1,0,0,
- 0,6,75,1,0,0,0,8,85,1,0,0,0,10,87,1,0,0,0,12,98,1,0,0,0,14,109,1,0,0,0,
- 16,116,1,0,0,0,18,123,1,0,0,0,20,138,1,0,0,0,22,140,1,0,0,0,24,146,1,0,
- 0,0,26,150,1,0,0,0,28,156,1,0,0,0,30,158,1,0,0,0,32,160,1,0,0,0,34,162,
- 1,0,0,0,36,166,1,0,0,0,38,170,1,0,0,0,40,42,5,20,0,0,41,40,1,0,0,0,42,
- 45,1,0,0,0,43,41,1,0,0,0,43,44,1,0,0,0,44,55,1,0,0,0,45,43,1,0,0,0,46,
- 50,3,2,1,0,47,49,5,20,0,0,48,47,1,0,0,0,49,52,1,0,0,0,50,48,1,0,0,0,50,
- 51,1,0,0,0,51,54,1,0,0,0,52,50,1,0,0,0,53,46,1,0,0,0,54,57,1,0,0,0,55,
- 53,1,0,0,0,55,56,1,0,0,0,56,58,1,0,0,0,57,55,1,0,0,0,58,59,5,0,0,1,59,
- 1,1,0,0,0,60,72,3,36,18,0,61,72,3,6,3,0,62,63,3,4,2,0,63,64,5,1,0,0,64,
- 65,5,20,0,0,65,72,1,0,0,0,66,67,3,4,2,0,67,68,5,1,0,0,68,69,3,8,4,0,69,
- 72,1,0,0,0,70,72,3,8,4,0,71,60,1,0,0,0,71,61,1,0,0,0,71,62,1,0,0,0,71,
- 66,1,0,0,0,71,70,1,0,0,0,72,3,1,0,0,0,73,74,3,32,16,0,74,5,1,0,0,0,75,
- 76,3,32,16,0,76,77,5,2,0,0,77,78,3,28,14,0,78,7,1,0,0,0,79,86,3,12,6,0,
- 80,86,3,14,7,0,81,86,3,10,5,0,82,86,3,16,8,0,83,86,3,18,9,0,84,86,3,34,
- 17,0,85,79,1,0,0,0,85,80,1,0,0,0,85,81,1,0,0,0,85,82,1,0,0,0,85,83,1,0,
- 0,0,85,84,1,0,0,0,86,9,1,0,0,0,87,88,5,3,0,0,88,93,3,26,13,0,89,90,5,4,
- 0,0,90,92,3,26,13,0,91,89,1,0,0,0,92,95,1,0,0,0,93,91,1,0,0,0,93,94,1,
- 0,0,0,94,96,1,0,0,0,95,93,1,0,0,0,96,97,5,20,0,0,97,11,1,0,0,0,98,99,5,
- 5,0,0,99,104,3,24,12,0,100,101,5,4,0,0,101,103,3,24,12,0,102,100,1,0,0,
- 0,103,106,1,0,0,0,104,102,1,0,0,0,104,105,1,0,0,0,105,107,1,0,0,0,106,
- 104,1,0,0,0,107,108,5,20,0,0,108,13,1,0,0,0,109,112,5,6,0,0,110,113,3,
- 28,14,0,111,113,3,32,16,0,112,110,1,0,0,0,112,111,1,0,0,0,113,114,1,0,
- 0,0,114,115,5,20,0,0,115,15,1,0,0,0,116,119,5,7,0,0,117,120,3,28,14,0,
- 118,120,3,32,16,0,119,117,1,0,0,0,119,118,1,0,0,0,120,121,1,0,0,0,121,
- 122,5,20,0,0,122,17,1,0,0,0,123,132,3,32,16,0,124,129,3,20,10,0,125,126,
- 5,4,0,0,126,128,3,20,10,0,127,125,1,0,0,0,128,131,1,0,0,0,129,127,1,0,
- 0,0,129,130,1,0,0,0,130,133,1,0,0,0,131,129,1,0,0,0,132,124,1,0,0,0,132,
- 133,1,0,0,0,133,134,1,0,0,0,134,135,5,20,0,0,135,19,1,0,0,0,136,139,3,
- 28,14,0,137,139,3,32,16,0,138,136,1,0,0,0,138,137,1,0,0,0,139,21,1,0,0,
- 0,140,141,5,8,0,0,141,142,3,32,16,0,142,23,1,0,0,0,143,147,3,28,14,0,144,
- 147,3,32,16,0,145,147,5,14,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,
- 1,0,0,0,147,25,1,0,0,0,148,151,3,28,14,0,149,151,3,32,16,0,150,148,1,0,
- 0,0,150,149,1,0,0,0,151,27,1,0,0,0,152,157,5,15,0,0,153,154,5,9,0,0,154,
- 157,7,0,0,0,155,157,5,17,0,0,156,152,1,0,0,0,156,153,1,0,0,0,156,155,1,
- 0,0,0,157,29,1,0,0,0,158,159,7,0,0,0,159,31,1,0,0,0,160,161,7,1,0,0,161,
- 33,1,0,0,0,162,163,5,10,0,0,163,164,5,21,0,0,164,165,5,20,0,0,165,35,1,
- 0,0,0,166,167,5,11,0,0,167,168,3,38,19,0,168,169,5,20,0,0,169,37,1,0,0,
- 0,170,171,7,2,0,0,171,39,1,0,0,0,15,43,50,55,71,85,93,104,112,119,129,
- 132,138,146,150,156
- };
-
- public static readonly ATN _ATN =
- new ATNDeserializer().Deserialize(_serializedATN);
-
-
-}
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// ANTLR Version: 4.13.2
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+// Generated from BdxScript.g4 by ANTLR 4.13.2
+
+// Unreachable code detected
+#pragma warning disable 0162
+// The variable '...' is assigned but its value is never used
+#pragma warning disable 0219
+// Missing XML comment for publicly visible type or member '...'
+#pragma warning disable 1591
+// Ambiguous reference in cref attribute
+#pragma warning disable 419
+
+using System;
+using System.IO;
+using System.Text;
+using System.Diagnostics;
+using System.Collections.Generic;
+using Antlr4.Runtime;
+using Antlr4.Runtime.Atn;
+using Antlr4.Runtime.Misc;
+using Antlr4.Runtime.Tree;
+using DFA = Antlr4.Runtime.Dfa.DFA;
+
+[System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.13.2")]
+[System.CLSCompliant(false)]
+public partial class BdxScriptParser : Parser {
+ protected static DFA[] decisionToDFA;
+ protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
+ public const int
+ T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
+ T__9=10, T__10=11, T__11=12, T__12=13, StringData=14, DEC=15, HEX=16,
+ FLOATNUM=17, ID=18, WS=19, NL=20, FileName=21, LINE_COMMENT=22;
+ public const int
+ RULE_prog = 0, RULE_statement = 1, RULE_label = 2, RULE_equ = 3, RULE_order = 4,
+ RULE_dw = 5, RULE_db = 6, RULE_resb = 7, RULE_resw = 8, RULE_instruction = 9,
+ RULE_arg = 10, RULE_offset = 11, RULE_bytedata = 12, RULE_worddata = 13,
+ RULE_numberdata = 14, RULE_hexbody = 15, RULE_id = 16, RULE_include = 17,
+ RULE_section = 18, RULE_section_id = 19;
+ public static readonly string[] ruleNames = {
+ "prog", "statement", "label", "equ", "order", "dw", "db", "resb", "resw",
+ "instruction", "arg", "offset", "bytedata", "worddata", "numberdata",
+ "hexbody", "id", "include", "section", "section_id"
+ };
+
+ private static readonly string[] _LiteralNames = {
+ null, "':'", "'equ'", "'dw'", "','", "'db'", "'resb'", "'resw'", "'offset'",
+ "'0x'", "'%include'", "'section'", "'.text'", "'.bss'"
+ };
+ private static readonly string[] _SymbolicNames = {
+ null, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, "StringData", "DEC", "HEX", "FLOATNUM", "ID", "WS", "NL",
+ "FileName", "LINE_COMMENT"
+ };
+ public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
+
+ [NotNull]
+ public override IVocabulary Vocabulary
+ {
+ get
+ {
+ return DefaultVocabulary;
+ }
+ }
+
+ public override string GrammarFileName { get { return "BdxScript.g4"; } }
+
+ public override string[] RuleNames { get { return ruleNames; } }
+
+ public override int[] SerializedAtn { get { return _serializedATN; } }
+
+ static BdxScriptParser() {
+ decisionToDFA = new DFA[_ATN.NumberOfDecisions];
+ for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
+ decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
+ }
+ }
+
+ public BdxScriptParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
+
+ public BdxScriptParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
+ : base(input, output, errorOutput)
+ {
+ Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
+ }
+
+ public partial class ProgContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode Eof() { return GetToken(BdxScriptParser.Eof, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode[] NL() { return GetTokens(BdxScriptParser.NL); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL(int i) {
+ return GetToken(BdxScriptParser.NL, i);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public StatementContext[] statement() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public StatementContext statement(int i) {
+ return GetRuleContext(i);
+ }
+ public ProgContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_prog; } }
+ }
+
+ [RuleVersion(0)]
+ public ProgContext prog() {
+ ProgContext _localctx = new ProgContext(Context, State);
+ EnterRule(_localctx, 0, RULE_prog);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 43;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==NL) {
+ {
+ {
+ State = 40;
+ Match(NL);
+ }
+ }
+ State = 45;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ State = 55;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 363752L) != 0)) {
+ {
+ {
+ State = 46;
+ statement();
+ State = 50;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==NL) {
+ {
+ {
+ State = 47;
+ Match(NL);
+ }
+ }
+ State = 52;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ }
+ }
+ State = 57;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ State = 58;
+ Match(Eof);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class StatementContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public SectionContext section() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public EquContext equ() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public LabelContext label() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public OrderContext order() {
+ return GetRuleContext(0);
+ }
+ public StatementContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_statement; } }
+ }
+
+ [RuleVersion(0)]
+ public StatementContext statement() {
+ StatementContext _localctx = new StatementContext(Context, State);
+ EnterRule(_localctx, 2, RULE_statement);
+ try {
+ State = 71;
+ ErrorHandler.Sync(this);
+ switch ( Interpreter.AdaptivePredict(TokenStream,3,Context) ) {
+ case 1:
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 60;
+ section();
+ }
+ break;
+ case 2:
+ EnterOuterAlt(_localctx, 2);
+ {
+ State = 61;
+ equ();
+ }
+ break;
+ case 3:
+ EnterOuterAlt(_localctx, 3);
+ {
+ State = 62;
+ label();
+ State = 63;
+ Match(T__0);
+ State = 64;
+ Match(NL);
+ }
+ break;
+ case 4:
+ EnterOuterAlt(_localctx, 4);
+ {
+ State = 66;
+ label();
+ State = 67;
+ Match(T__0);
+ State = 68;
+ order();
+ }
+ break;
+ case 5:
+ EnterOuterAlt(_localctx, 5);
+ {
+ State = 70;
+ order();
+ }
+ break;
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class LabelContext : ParserRuleContext {
+ public IdContext name;
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public LabelContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_label; } }
+ }
+
+ [RuleVersion(0)]
+ public LabelContext label() {
+ LabelContext _localctx = new LabelContext(Context, State);
+ EnterRule(_localctx, 4, RULE_label);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 73;
+ _localctx.name = id();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class EquContext : ParserRuleContext {
+ public IdContext name;
+ [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public EquContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_equ; } }
+ }
+
+ [RuleVersion(0)]
+ public EquContext equ() {
+ EquContext _localctx = new EquContext(Context, State);
+ EnterRule(_localctx, 6, RULE_equ);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 75;
+ _localctx.name = id();
+ State = 76;
+ Match(T__1);
+ State = 77;
+ numberdata();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class OrderContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public DbContext db() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ResbContext resb() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public DwContext dw() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ReswContext resw() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public InstructionContext instruction() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IncludeContext include() {
+ return GetRuleContext(0);
+ }
+ public OrderContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_order; } }
+ }
+
+ [RuleVersion(0)]
+ public OrderContext order() {
+ OrderContext _localctx = new OrderContext(Context, State);
+ EnterRule(_localctx, 8, RULE_order);
+ try {
+ State = 85;
+ ErrorHandler.Sync(this);
+ switch (TokenStream.LA(1)) {
+ case T__4:
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 79;
+ db();
+ }
+ break;
+ case T__5:
+ EnterOuterAlt(_localctx, 2);
+ {
+ State = 80;
+ resb();
+ }
+ break;
+ case T__2:
+ EnterOuterAlt(_localctx, 3);
+ {
+ State = 81;
+ dw();
+ }
+ break;
+ case T__6:
+ EnterOuterAlt(_localctx, 4);
+ {
+ State = 82;
+ resw();
+ }
+ break;
+ case DEC:
+ case HEX:
+ case ID:
+ EnterOuterAlt(_localctx, 5);
+ {
+ State = 83;
+ instruction();
+ }
+ break;
+ case T__9:
+ EnterOuterAlt(_localctx, 6);
+ {
+ State = 84;
+ include();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class DwContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public WorddataContext[] worddata() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public WorddataContext worddata(int i) {
+ return GetRuleContext(i);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ public DwContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_dw; } }
+ }
+
+ [RuleVersion(0)]
+ public DwContext dw() {
+ DwContext _localctx = new DwContext(Context, State);
+ EnterRule(_localctx, 10, RULE_dw);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 87;
+ Match(T__2);
+ State = 88;
+ worddata();
+ State = 93;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==T__3) {
+ {
+ {
+ State = 89;
+ Match(T__3);
+ State = 90;
+ worddata();
+ }
+ }
+ State = 95;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ State = 96;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class DbContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public BytedataContext[] bytedata() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public BytedataContext bytedata(int i) {
+ return GetRuleContext(i);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ public DbContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_db; } }
+ }
+
+ [RuleVersion(0)]
+ public DbContext db() {
+ DbContext _localctx = new DbContext(Context, State);
+ EnterRule(_localctx, 12, RULE_db);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 98;
+ Match(T__4);
+ State = 99;
+ bytedata();
+ State = 104;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==T__3) {
+ {
+ {
+ State = 100;
+ Match(T__3);
+ State = 101;
+ bytedata();
+ }
+ }
+ State = 106;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ State = 107;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class ResbContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public ResbContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_resb; } }
+ }
+
+ [RuleVersion(0)]
+ public ResbContext resb() {
+ ResbContext _localctx = new ResbContext(Context, State);
+ EnterRule(_localctx, 14, RULE_resb);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 109;
+ Match(T__5);
+ State = 112;
+ ErrorHandler.Sync(this);
+ switch ( Interpreter.AdaptivePredict(TokenStream,7,Context) ) {
+ case 1:
+ {
+ State = 110;
+ numberdata();
+ }
+ break;
+ case 2:
+ {
+ State = 111;
+ id();
+ }
+ break;
+ }
+ State = 114;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class ReswContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public ReswContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_resw; } }
+ }
+
+ [RuleVersion(0)]
+ public ReswContext resw() {
+ ReswContext _localctx = new ReswContext(Context, State);
+ EnterRule(_localctx, 16, RULE_resw);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 116;
+ Match(T__6);
+ State = 119;
+ ErrorHandler.Sync(this);
+ switch ( Interpreter.AdaptivePredict(TokenStream,8,Context) ) {
+ case 1:
+ {
+ State = 117;
+ numberdata();
+ }
+ break;
+ case 2:
+ {
+ State = 118;
+ id();
+ }
+ break;
+ }
+ State = 121;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class InstructionContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ArgContext[] arg() {
+ return GetRuleContexts();
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ArgContext arg(int i) {
+ return GetRuleContext(i);
+ }
+ public InstructionContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_instruction; } }
+ }
+
+ [RuleVersion(0)]
+ public InstructionContext instruction() {
+ InstructionContext _localctx = new InstructionContext(Context, State);
+ EnterRule(_localctx, 18, RULE_instruction);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 123;
+ id();
+ State = 132;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 492032L) != 0)) {
+ {
+ State = 124;
+ arg();
+ State = 129;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ while (_la==T__3) {
+ {
+ {
+ State = 125;
+ Match(T__3);
+ State = 126;
+ arg();
+ }
+ }
+ State = 131;
+ ErrorHandler.Sync(this);
+ _la = TokenStream.LA(1);
+ }
+ }
+ }
+
+ State = 134;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class ArgContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public ArgContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_arg; } }
+ }
+
+ [RuleVersion(0)]
+ public ArgContext arg() {
+ ArgContext _localctx = new ArgContext(Context, State);
+ EnterRule(_localctx, 20, RULE_arg);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 138;
+ ErrorHandler.Sync(this);
+ switch ( Interpreter.AdaptivePredict(TokenStream,11,Context) ) {
+ case 1:
+ {
+ State = 136;
+ numberdata();
+ }
+ break;
+ case 2:
+ {
+ State = 137;
+ id();
+ }
+ break;
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class OffsetContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public OffsetContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_offset; } }
+ }
+
+ [RuleVersion(0)]
+ public OffsetContext offset() {
+ OffsetContext _localctx = new OffsetContext(Context, State);
+ EnterRule(_localctx, 22, RULE_offset);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 140;
+ Match(T__7);
+ State = 141;
+ id();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class BytedataContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode StringData() { return GetToken(BdxScriptParser.StringData, 0); }
+ public BytedataContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_bytedata; } }
+ }
+
+ [RuleVersion(0)]
+ public BytedataContext bytedata() {
+ BytedataContext _localctx = new BytedataContext(Context, State);
+ EnterRule(_localctx, 24, RULE_bytedata);
+ try {
+ State = 146;
+ ErrorHandler.Sync(this);
+ switch ( Interpreter.AdaptivePredict(TokenStream,12,Context) ) {
+ case 1:
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 143;
+ numberdata();
+ }
+ break;
+ case 2:
+ EnterOuterAlt(_localctx, 2);
+ {
+ State = 144;
+ id();
+ }
+ break;
+ case 3:
+ EnterOuterAlt(_localctx, 3);
+ {
+ State = 145;
+ Match(StringData);
+ }
+ break;
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class WorddataContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public NumberdataContext numberdata() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public IdContext id() {
+ return GetRuleContext(0);
+ }
+ public WorddataContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_worddata; } }
+ }
+
+ [RuleVersion(0)]
+ public WorddataContext worddata() {
+ WorddataContext _localctx = new WorddataContext(Context, State);
+ EnterRule(_localctx, 26, RULE_worddata);
+ try {
+ State = 150;
+ ErrorHandler.Sync(this);
+ switch ( Interpreter.AdaptivePredict(TokenStream,13,Context) ) {
+ case 1:
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 148;
+ numberdata();
+ }
+ break;
+ case 2:
+ EnterOuterAlt(_localctx, 2);
+ {
+ State = 149;
+ id();
+ }
+ break;
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class NumberdataContext : ParserRuleContext {
+ public IToken decimalnumber;
+ public IToken hexnumber;
+ public IToken floatnumber;
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEC() { return GetToken(BdxScriptParser.DEC, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEX() { return GetToken(BdxScriptParser.HEX, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FLOATNUM() { return GetToken(BdxScriptParser.FLOATNUM, 0); }
+ public NumberdataContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_numberdata; } }
+ }
+
+ [RuleVersion(0)]
+ public NumberdataContext numberdata() {
+ NumberdataContext _localctx = new NumberdataContext(Context, State);
+ EnterRule(_localctx, 28, RULE_numberdata);
+ int _la;
+ try {
+ State = 156;
+ ErrorHandler.Sync(this);
+ switch (TokenStream.LA(1)) {
+ case DEC:
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 152;
+ _localctx.decimalnumber = Match(DEC);
+ }
+ break;
+ case T__8:
+ EnterOuterAlt(_localctx, 2);
+ {
+ State = 153;
+ Match(T__8);
+ State = 154;
+ _localctx.hexnumber = TokenStream.LT(1);
+ _la = TokenStream.LA(1);
+ if ( !(_la==DEC || _la==HEX) ) {
+ _localctx.hexnumber = ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ }
+ break;
+ case FLOATNUM:
+ EnterOuterAlt(_localctx, 3);
+ {
+ State = 155;
+ _localctx.floatnumber = Match(FLOATNUM);
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class HexbodyContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEC() { return GetToken(BdxScriptParser.DEC, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEX() { return GetToken(BdxScriptParser.HEX, 0); }
+ public HexbodyContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_hexbody; } }
+ }
+
+ [RuleVersion(0)]
+ public HexbodyContext hexbody() {
+ HexbodyContext _localctx = new HexbodyContext(Context, State);
+ EnterRule(_localctx, 30, RULE_hexbody);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 158;
+ _la = TokenStream.LA(1);
+ if ( !(_la==DEC || _la==HEX) ) {
+ ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class IdContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode DEC() { return GetToken(BdxScriptParser.DEC, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode HEX() { return GetToken(BdxScriptParser.HEX, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode ID() { return GetToken(BdxScriptParser.ID, 0); }
+ public IdContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_id; } }
+ }
+
+ [RuleVersion(0)]
+ public IdContext id() {
+ IdContext _localctx = new IdContext(Context, State);
+ EnterRule(_localctx, 32, RULE_id);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 160;
+ _la = TokenStream.LA(1);
+ if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 360448L) != 0)) ) {
+ ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class IncludeContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode FileName() { return GetToken(BdxScriptParser.FileName, 0); }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ public IncludeContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_include; } }
+ }
+
+ [RuleVersion(0)]
+ public IncludeContext include() {
+ IncludeContext _localctx = new IncludeContext(Context, State);
+ EnterRule(_localctx, 34, RULE_include);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 162;
+ Match(T__9);
+ State = 163;
+ Match(FileName);
+ State = 164;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class SectionContext : ParserRuleContext {
+ [System.Diagnostics.DebuggerNonUserCode] public Section_idContext section_id() {
+ return GetRuleContext(0);
+ }
+ [System.Diagnostics.DebuggerNonUserCode] public ITerminalNode NL() { return GetToken(BdxScriptParser.NL, 0); }
+ public SectionContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_section; } }
+ }
+
+ [RuleVersion(0)]
+ public SectionContext section() {
+ SectionContext _localctx = new SectionContext(Context, State);
+ EnterRule(_localctx, 36, RULE_section);
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 166;
+ Match(T__10);
+ State = 167;
+ section_id();
+ State = 168;
+ Match(NL);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ public partial class Section_idContext : ParserRuleContext {
+ public Section_idContext(ParserRuleContext parent, int invokingState)
+ : base(parent, invokingState)
+ {
+ }
+ public override int RuleIndex { get { return RULE_section_id; } }
+ }
+
+ [RuleVersion(0)]
+ public Section_idContext section_id() {
+ Section_idContext _localctx = new Section_idContext(Context, State);
+ EnterRule(_localctx, 38, RULE_section_id);
+ int _la;
+ try {
+ EnterOuterAlt(_localctx, 1);
+ {
+ State = 170;
+ _la = TokenStream.LA(1);
+ if ( !(_la==T__11 || _la==T__12) ) {
+ ErrorHandler.RecoverInline(this);
+ }
+ else {
+ ErrorHandler.ReportMatch(this);
+ Consume();
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ ErrorHandler.ReportError(this, re);
+ ErrorHandler.Recover(this, re);
+ }
+ finally {
+ ExitRule();
+ }
+ return _localctx;
+ }
+
+ private static int[] _serializedATN = {
+ 4,1,22,173,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,
+ 7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,
+ 2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,1,0,5,0,42,8,0,10,0,
+ 12,0,45,9,0,1,0,1,0,5,0,49,8,0,10,0,12,0,52,9,0,5,0,54,8,0,10,0,12,0,57,
+ 9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,72,8,1,1,2,
+ 1,2,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,3,4,86,8,4,1,5,1,5,1,5,1,5,
+ 5,5,92,8,5,10,5,12,5,95,9,5,1,5,1,5,1,6,1,6,1,6,1,6,5,6,103,8,6,10,6,12,
+ 6,106,9,6,1,6,1,6,1,7,1,7,1,7,3,7,113,8,7,1,7,1,7,1,8,1,8,1,8,3,8,120,
+ 8,8,1,8,1,8,1,9,1,9,1,9,1,9,5,9,128,8,9,10,9,12,9,131,9,9,3,9,133,8,9,
+ 1,9,1,9,1,10,1,10,3,10,139,8,10,1,11,1,11,1,11,1,12,1,12,1,12,3,12,147,
+ 8,12,1,13,1,13,3,13,151,8,13,1,14,1,14,1,14,1,14,3,14,157,8,14,1,15,1,
+ 15,1,16,1,16,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,0,
+ 0,20,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,0,3,1,0,15,
+ 16,2,0,15,16,18,18,1,0,12,13,176,0,43,1,0,0,0,2,71,1,0,0,0,4,73,1,0,0,
+ 0,6,75,1,0,0,0,8,85,1,0,0,0,10,87,1,0,0,0,12,98,1,0,0,0,14,109,1,0,0,0,
+ 16,116,1,0,0,0,18,123,1,0,0,0,20,138,1,0,0,0,22,140,1,0,0,0,24,146,1,0,
+ 0,0,26,150,1,0,0,0,28,156,1,0,0,0,30,158,1,0,0,0,32,160,1,0,0,0,34,162,
+ 1,0,0,0,36,166,1,0,0,0,38,170,1,0,0,0,40,42,5,20,0,0,41,40,1,0,0,0,42,
+ 45,1,0,0,0,43,41,1,0,0,0,43,44,1,0,0,0,44,55,1,0,0,0,45,43,1,0,0,0,46,
+ 50,3,2,1,0,47,49,5,20,0,0,48,47,1,0,0,0,49,52,1,0,0,0,50,48,1,0,0,0,50,
+ 51,1,0,0,0,51,54,1,0,0,0,52,50,1,0,0,0,53,46,1,0,0,0,54,57,1,0,0,0,55,
+ 53,1,0,0,0,55,56,1,0,0,0,56,58,1,0,0,0,57,55,1,0,0,0,58,59,5,0,0,1,59,
+ 1,1,0,0,0,60,72,3,36,18,0,61,72,3,6,3,0,62,63,3,4,2,0,63,64,5,1,0,0,64,
+ 65,5,20,0,0,65,72,1,0,0,0,66,67,3,4,2,0,67,68,5,1,0,0,68,69,3,8,4,0,69,
+ 72,1,0,0,0,70,72,3,8,4,0,71,60,1,0,0,0,71,61,1,0,0,0,71,62,1,0,0,0,71,
+ 66,1,0,0,0,71,70,1,0,0,0,72,3,1,0,0,0,73,74,3,32,16,0,74,5,1,0,0,0,75,
+ 76,3,32,16,0,76,77,5,2,0,0,77,78,3,28,14,0,78,7,1,0,0,0,79,86,3,12,6,0,
+ 80,86,3,14,7,0,81,86,3,10,5,0,82,86,3,16,8,0,83,86,3,18,9,0,84,86,3,34,
+ 17,0,85,79,1,0,0,0,85,80,1,0,0,0,85,81,1,0,0,0,85,82,1,0,0,0,85,83,1,0,
+ 0,0,85,84,1,0,0,0,86,9,1,0,0,0,87,88,5,3,0,0,88,93,3,26,13,0,89,90,5,4,
+ 0,0,90,92,3,26,13,0,91,89,1,0,0,0,92,95,1,0,0,0,93,91,1,0,0,0,93,94,1,
+ 0,0,0,94,96,1,0,0,0,95,93,1,0,0,0,96,97,5,20,0,0,97,11,1,0,0,0,98,99,5,
+ 5,0,0,99,104,3,24,12,0,100,101,5,4,0,0,101,103,3,24,12,0,102,100,1,0,0,
+ 0,103,106,1,0,0,0,104,102,1,0,0,0,104,105,1,0,0,0,105,107,1,0,0,0,106,
+ 104,1,0,0,0,107,108,5,20,0,0,108,13,1,0,0,0,109,112,5,6,0,0,110,113,3,
+ 28,14,0,111,113,3,32,16,0,112,110,1,0,0,0,112,111,1,0,0,0,113,114,1,0,
+ 0,0,114,115,5,20,0,0,115,15,1,0,0,0,116,119,5,7,0,0,117,120,3,28,14,0,
+ 118,120,3,32,16,0,119,117,1,0,0,0,119,118,1,0,0,0,120,121,1,0,0,0,121,
+ 122,5,20,0,0,122,17,1,0,0,0,123,132,3,32,16,0,124,129,3,20,10,0,125,126,
+ 5,4,0,0,126,128,3,20,10,0,127,125,1,0,0,0,128,131,1,0,0,0,129,127,1,0,
+ 0,0,129,130,1,0,0,0,130,133,1,0,0,0,131,129,1,0,0,0,132,124,1,0,0,0,132,
+ 133,1,0,0,0,133,134,1,0,0,0,134,135,5,20,0,0,135,19,1,0,0,0,136,139,3,
+ 28,14,0,137,139,3,32,16,0,138,136,1,0,0,0,138,137,1,0,0,0,139,21,1,0,0,
+ 0,140,141,5,8,0,0,141,142,3,32,16,0,142,23,1,0,0,0,143,147,3,28,14,0,144,
+ 147,3,32,16,0,145,147,5,14,0,0,146,143,1,0,0,0,146,144,1,0,0,0,146,145,
+ 1,0,0,0,147,25,1,0,0,0,148,151,3,28,14,0,149,151,3,32,16,0,150,148,1,0,
+ 0,0,150,149,1,0,0,0,151,27,1,0,0,0,152,157,5,15,0,0,153,154,5,9,0,0,154,
+ 157,7,0,0,0,155,157,5,17,0,0,156,152,1,0,0,0,156,153,1,0,0,0,156,155,1,
+ 0,0,0,157,29,1,0,0,0,158,159,7,0,0,0,159,31,1,0,0,0,160,161,7,1,0,0,161,
+ 33,1,0,0,0,162,163,5,10,0,0,163,164,5,21,0,0,164,165,5,20,0,0,165,35,1,
+ 0,0,0,166,167,5,11,0,0,167,168,3,38,19,0,168,169,5,20,0,0,169,37,1,0,0,
+ 0,170,171,7,2,0,0,171,39,1,0,0,0,15,43,50,55,71,85,93,104,112,119,129,
+ 132,138,146,150,156
+ };
+
+ public static readonly ATN _ATN =
+ new ATNDeserializer().Deserialize(_serializedATN);
+
+
+}
diff --git a/OpenKh.Command.Bdxio/Antlr4/README.md b/OpenKh.Kh2/Bdx/Antlr/README.md
similarity index 95%
rename from OpenKh.Command.Bdxio/Antlr4/README.md
rename to OpenKh.Kh2/Bdx/Antlr/README.md
index 2c1c429ce..a7cb4b06d 100644
--- a/OpenKh.Command.Bdxio/Antlr4/README.md
+++ b/OpenKh.Kh2/Bdx/Antlr/README.md
@@ -1,40 +1,40 @@
-# Using Antlr4
-
-Use Visual Studio Code.
-
-Install vscode plugin `mike-lischke.vscode-antlr4`.
-
-Edit `BdxScript.g4`.
-
-After edit, run this command:
-
-```bat
-java.exe -jar antlr-4.11.1-complete.jar BdxScript.g4 -Dlanguage=CSharp -no-listener -no-visitor
-```
-
-Only `BdxScriptLexer.cs` and `BdxScriptParser.cs` are needed. Others are not needed.
-
-## How bdx text is parsed to tree
-
-Use Visual Studio Code `mike-lischke.vscode-antlr4` plugin.
-
-And write this at `OpenKh/OpenKh.Command.Bdxio/Antlr4/.vscode/launch.json`
-
-```
-{
- "version": "1.0.0",
- "configurations": [
- {
- "name": "Debug ANTLR4 grammar",
- "type": "antlr-debug",
- "request": "launch",
- "input": "test.bdx",
- "grammar": "BdxScript.g4",
- "printParseTree": true,
- "visualParseTree": true
- },
- ]
-}
-```
-
-Write something to `test.bdx` and press `F5` key.
+# Using Antlr4
+
+Use Visual Studio Code.
+
+Install vscode plugin `mike-lischke.vscode-antlr4`.
+
+Edit `BdxScript.g4`.
+
+After edit, run this command:
+
+```bat
+java.exe -jar antlr-4.11.1-complete.jar BdxScript.g4 -Dlanguage=CSharp -no-listener -no-visitor
+```
+
+Only `BdxScriptLexer.cs` and `BdxScriptParser.cs` are needed. Others are not needed.
+
+## How bdx text is parsed to tree
+
+Use Visual Studio Code `mike-lischke.vscode-antlr4` plugin.
+
+And write this at `OpenKh/OpenKh.Command.Bdxio/Antlr4/.vscode/launch.json`
+
+```
+{
+ "version": "1.0.0",
+ "configurations": [
+ {
+ "name": "Debug ANTLR4 grammar",
+ "type": "antlr-debug",
+ "request": "launch",
+ "input": "test.bdx",
+ "grammar": "BdxScript.g4",
+ "printParseTree": true,
+ "visualParseTree": true
+ },
+ ]
+}
+```
+
+Write something to `test.bdx` and press `F5` key.
diff --git a/OpenKh.Command.Bdxio/Models/BdxHeader.cs b/OpenKh.Kh2/Bdx/Models/BdxHeader.cs
similarity index 93%
rename from OpenKh.Command.Bdxio/Models/BdxHeader.cs
rename to OpenKh.Kh2/Bdx/Models/BdxHeader.cs
index 4a8b28f8e..9ececbaf1 100644
--- a/OpenKh.Command.Bdxio/Models/BdxHeader.cs
+++ b/OpenKh.Kh2/Bdx/Models/BdxHeader.cs
@@ -1,35 +1,35 @@
-using System.Text;
-using Xe.BinaryMapper;
-using YamlDotNet.Serialization;
-
-namespace OpenKh.Command.Bdxio.Models
-{
- public class BdxHeader
- {
- [Data(Count = 16), YamlIgnore()] public byte[] RawName { get; set; } = new byte[0];
- [Data] public int WorkSize { get; set; }
- [Data] public int StackSize { get; set; }
- [Data] public int TempSize { get; set; }
- public Trigger[] Triggers { get; set; } = new Trigger[0];
-
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public bool IsEmpty { get; set; }
-
- public string Name
- {
- get => Encoding.ASCII.GetString(RawName).Split('\0')[0];
- set => RawName = Encoding.ASCII.GetBytes((value ?? "").PadRight(16, '\0'), 0, 16);
- }
-
- public class IntTrigger
- {
- [Data] public int Key { get; set; }
- [Data] public int Addr { get; set; }
- }
-
- public class Trigger
- {
- public int Key { get; set; }
- public string Addr { get; set; }
- }
- }
-}
+using System.Text;
+using Xe.BinaryMapper;
+using YamlDotNet.Serialization;
+
+namespace OpenKh.Kh2.Bdx.Models
+{
+ public class BdxHeader
+ {
+ [Data(Count = 16), YamlIgnore()] public byte[] RawName { get; set; } = new byte[0];
+ [Data] public int WorkSize { get; set; }
+ [Data] public int StackSize { get; set; }
+ [Data] public int TempSize { get; set; }
+ public Trigger[] Triggers { get; set; } = new Trigger[0];
+
+ [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public bool IsEmpty { get; set; }
+
+ public string Name
+ {
+ get => Encoding.ASCII.GetString(RawName).Split('\0')[0];
+ set => RawName = Encoding.ASCII.GetBytes((value ?? "").PadRight(16, '\0'), 0, 16);
+ }
+
+ public class IntTrigger
+ {
+ [Data] public int Key { get; set; }
+ [Data] public int Addr { get; set; }
+ }
+
+ public class Trigger
+ {
+ public int Key { get; set; }
+ public string Addr { get; set; }
+ }
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Models/BdxInstruction.cs b/OpenKh.Kh2/Bdx/Models/BdxInstruction.cs
similarity index 91%
rename from OpenKh.Command.Bdxio/Models/BdxInstruction.cs
rename to OpenKh.Kh2/Bdx/Models/BdxInstruction.cs
index 162ee715c..f272df200 100644
--- a/OpenKh.Command.Bdxio/Models/BdxInstruction.cs
+++ b/OpenKh.Kh2/Bdx/Models/BdxInstruction.cs
@@ -1,32 +1,32 @@
-using OpenKh.Common.Utils;
-
-namespace OpenKh.Command.Bdxio.Models
-{
- public class BdxInstruction
- {
- public ushort Code { get; set; }
-
- public BdxInstruction(ushort code)
- {
- Code = code;
- }
-
- public byte Opcode
- {
- get => (byte)BitsUtil.Int.GetBits(Code, 0, 4);
- set => Code = (ushort)BitsUtil.Int.SetBits(Code, 0, 4, value);
- }
-
- public byte Sub
- {
- get => (byte)BitsUtil.Int.GetBits(Code, 4, 2);
- set => Code = (ushort)BitsUtil.Int.SetBits(Code, 4, 2, value);
- }
-
- public ushort Ssub
- {
- get => (ushort)BitsUtil.Int.GetBits(Code, 6, 12);
- set => Code = (ushort)BitsUtil.Int.SetBits(Code, 6, 12, value);
- }
- }
-}
+using OpenKh.Common.Utils;
+
+namespace OpenKh.Kh2.Bdx.Models
+{
+ public class BdxInstruction
+ {
+ public ushort Code { get; set; }
+
+ public BdxInstruction(ushort code)
+ {
+ Code = code;
+ }
+
+ public byte Opcode
+ {
+ get => (byte)BitsUtil.Int.GetBits(Code, 0, 4);
+ set => Code = (ushort)BitsUtil.Int.SetBits(Code, 0, 4, value);
+ }
+
+ public byte Sub
+ {
+ get => (byte)BitsUtil.Int.GetBits(Code, 4, 2);
+ set => Code = (ushort)BitsUtil.Int.SetBits(Code, 4, 2, value);
+ }
+
+ public ushort Ssub
+ {
+ get => (ushort)BitsUtil.Int.GetBits(Code, 6, 12);
+ set => Code = (ushort)BitsUtil.Int.SetBits(Code, 6, 12, value);
+ }
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Models/BdxInstructionDesc.cs b/OpenKh.Kh2/Bdx/Models/BdxInstructionDesc.cs
similarity index 93%
rename from OpenKh.Command.Bdxio/Models/BdxInstructionDesc.cs
rename to OpenKh.Kh2/Bdx/Models/BdxInstructionDesc.cs
index fed0781cc..42d5d4a96 100644
--- a/OpenKh.Command.Bdxio/Models/BdxInstructionDesc.cs
+++ b/OpenKh.Kh2/Bdx/Models/BdxInstructionDesc.cs
@@ -1,43 +1,43 @@
-namespace OpenKh.Command.Bdxio.Models
-{
- public record BdxInstructionDesc
- {
- public ushort Code { get; set; }
- public ushort CodeMask { get; set; }
-
- public string Name { get; set; } = "";
- public bool IsSyscall { get; set; }
- public bool IsGosub { get; set; }
- public bool IsJump { get; set; }
- public bool IsJumpConditional { get; set; }
- public bool NeverReturn { get; set; }
- public bool IsGosubRet { get; set; }
- public bool CodeRevealerLabeling { get; set; }
- public int CodeSize { get; set; }
- public Arg[] Args { get; set; } = new Arg[0];
- public string[] OldNames { get; set; } = new string[0];
-
- public override string ToString() => Name;
-
- public record Arg
- {
- public string Name { get; set; } = "";
- public ArgType Type { get; set; }
-
- ///
- /// Is relative offset to bdx instruction
- ///
- public bool IsRelative { get; set; }
- public bool AiPos { get; set; }
- public bool WorkPos { get; set; }
- }
-
- public enum ArgType
- {
- Ssub,
- Imm16,
- Imm32,
- Float32,
- }
- }
-}
+namespace OpenKh.Kh2.Bdx.Models
+{
+ public record BdxInstructionDesc
+ {
+ public ushort Code { get; set; }
+ public ushort CodeMask { get; set; }
+
+ public string Name { get; set; } = "";
+ public bool IsSyscall { get; set; }
+ public bool IsGosub { get; set; }
+ public bool IsJump { get; set; }
+ public bool IsJumpConditional { get; set; }
+ public bool NeverReturn { get; set; }
+ public bool IsGosubRet { get; set; }
+ public bool CodeRevealerLabeling { get; set; }
+ public int CodeSize { get; set; }
+ public Arg[] Args { get; set; } = new Arg[0];
+ public string[] OldNames { get; set; } = new string[0];
+
+ public override string ToString() => Name;
+
+ public record Arg
+ {
+ public string Name { get; set; } = "";
+ public ArgType Type { get; set; }
+
+ ///
+ /// Is relative offset to bdx instruction
+ ///
+ public bool IsRelative { get; set; }
+ public bool AiPos { get; set; }
+ public bool WorkPos { get; set; }
+ }
+
+ public enum ArgType
+ {
+ Ssub,
+ Imm16,
+ Imm32,
+ Float32,
+ }
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Models/BdxInstructionDescs.cs b/OpenKh.Kh2/Bdx/Models/BdxInstructionDescs.cs
similarity index 98%
rename from OpenKh.Command.Bdxio/Models/BdxInstructionDescs.cs
rename to OpenKh.Kh2/Bdx/Models/BdxInstructionDescs.cs
index e6b41152e..bec1a8164 100644
--- a/OpenKh.Command.Bdxio/Models/BdxInstructionDescs.cs
+++ b/OpenKh.Kh2/Bdx/Models/BdxInstructionDescs.cs
@@ -1,95 +1,97 @@
-using static OpenKh.Command.Bdxio.Models.BdxInstructionDesc;
-
-namespace OpenKh.Command.Bdxio.Models
-{
- public class BdxInstructionDescs
- {
- public static IEnumerable GetDescs() => _descs;
-
- public static BdxInstructionDesc? FindByCode(ushort code)
- {
- return _descs
- .FirstOrDefault(it => (code & it.CodeMask) == it.Code);
- }
-
- private static readonly BdxInstructionDesc[] _descs = new[]
- {
- #region Generated
-
- new BdxInstructionDesc { Code = 0x0000, CodeMask = 0x003F, Name = "push", CodeRevealerLabeling = true, CodeSize = 3, Args = new[] { new Arg { Name = "imm32", Type = ArgType.Imm32 } }, OldNames = new[] { "pushImm" } },
- new BdxInstructionDesc { Code = 0x0010, CodeMask = 0x003F, Name = "push.s", CodeSize = 3, Args = new[] { new Arg { Name = "float32", Type = ArgType.Float32 } }, OldNames = new[] { "pushImmf" } },
- new BdxInstructionDesc { Code = 0x0020, CodeMask = 0xFFFF, Name = "push.sp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromPSp" } },
- new BdxInstructionDesc { Code = 0x0060, CodeMask = 0xFFFF, Name = "push.wp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "pushFromPWp" } },
- new BdxInstructionDesc { Code = 0x00A0, CodeMask = 0xFFFF, Name = "push.sp.d", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromPSpVal" } },
- new BdxInstructionDesc { Code = 0x00E0, CodeMask = 0xFFFF, Name = "push.bd", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "pushFromPAi" } },
- new BdxInstructionDesc { Code = 0x0030, CodeMask = 0xFFFF, Name = "push.d.sp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromFSp" } },
- new BdxInstructionDesc { Code = 0x0070, CodeMask = 0xFFFF, Name = "push.d.wp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "pushFromFWp" } },
- new BdxInstructionDesc { Code = 0x00B0, CodeMask = 0xFFFF, Name = "push.d.sp.d", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromFSpVal" } },
- new BdxInstructionDesc { Code = 0x00F0, CodeMask = 0xFFFF, Name = "push.d.bd", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "pushFromFAi" } },
- new BdxInstructionDesc { Code = 0x0001, CodeMask = 0xFFCF, Name = "pop.sp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "popToSp" } },
- new BdxInstructionDesc { Code = 0x0041, CodeMask = 0xFFCF, Name = "pop.wp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "popToWp" } },
- new BdxInstructionDesc { Code = 0x0081, CodeMask = 0xFFCF, Name = "pop.sp.d", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "popToSpVal" } },
- new BdxInstructionDesc { Code = 0x00C1, CodeMask = 0xFFCF, Name = "pop.bd", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "popToAi" } },
- new BdxInstructionDesc { Code = 0x0002, CodeMask = 0xFFCF, Name = "memcpy.sp", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16 } }, OldNames = new[] { "memcpyToSp" } },
- new BdxInstructionDesc { Code = 0x0042, CodeMask = 0xFFCF, Name = "memcpy.wp", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "memcpyToWp" } },
- new BdxInstructionDesc { Code = 0x0082, CodeMask = 0xFFCF, Name = "memcpy.sp.d", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16 } }, OldNames = new[] { "memcpyToSpVal" } },
- new BdxInstructionDesc { Code = 0x00C2, CodeMask = 0xFFCF, Name = "memcpy.bd", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "memcpyToSpAi" } },
- new BdxInstructionDesc { Code = 0x0003, CodeMask = 0x000F, Name = "push.d.pop", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "fetchValue" } },
- new BdxInstructionDesc { Code = 0x0004, CodeMask = 0x000F, Name = "memcpy", CodeSize = 1, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub } } },
- new BdxInstructionDesc { Code = 0x0005, CodeMask = 0xFFFF, Name = "cvt.w.s", CodeSize = 1, OldNames = new[] { "citf" } },
- new BdxInstructionDesc { Code = 0x0085, CodeMask = 0xFFFF, Name = "neg", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x00C5, CodeMask = 0xFFFF, Name = "not", CodeSize = 1, OldNames = new[] { "inv" } },
- new BdxInstructionDesc { Code = 0x0105, CodeMask = 0xFFFF, Name = "seqz", CodeSize = 1, OldNames = new[] { "eqz" } },
- new BdxInstructionDesc { Code = 0x0145, CodeMask = 0xFFFF, Name = "abs", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0185, CodeMask = 0xFFFF, Name = "sltz", CodeSize = 1, OldNames = new[] { "msb" } },
- new BdxInstructionDesc { Code = 0x01C5, CodeMask = 0xFFFF, Name = "slez", CodeSize = 1, OldNames = new[] { "info" } },
- new BdxInstructionDesc { Code = 0x0205, CodeMask = 0xFFFF, Name = "seqz", CodeSize = 1, OldNames = new[] { "eqz" } },
- new BdxInstructionDesc { Code = 0x0245, CodeMask = 0xFFFF, Name = "snez", CodeSize = 1, OldNames = new[] { "neqz" } },
- new BdxInstructionDesc { Code = 0x0285, CodeMask = 0xFFFF, Name = "sgez", CodeSize = 1, OldNames = new[] { "msbi" } },
- new BdxInstructionDesc { Code = 0x02C5, CodeMask = 0xFFFF, Name = "sgtz", CodeSize = 1, OldNames = new[] { "ipos" } },
- new BdxInstructionDesc { Code = 0x0055, CodeMask = 0xFFFF, Name = "cvt.s.w", CodeSize = 1, OldNames = new[] { "cfti" } },
- new BdxInstructionDesc { Code = 0x0095, CodeMask = 0xFFFF, Name = "neg.s", CodeSize = 1, OldNames = new[] { "negf" } },
- new BdxInstructionDesc { Code = 0x0155, CodeMask = 0xFFFF, Name = "abs.s", CodeSize = 1, OldNames = new[] { "absf" } },
- new BdxInstructionDesc { Code = 0x0195, CodeMask = 0xFFFF, Name = "sltz.s", CodeSize = 1, OldNames = new[] { "infzf" } },
- new BdxInstructionDesc { Code = 0x01D5, CodeMask = 0xFFFF, Name = "slez.s", CodeSize = 1, OldNames = new[] { "infoezf" } },
- new BdxInstructionDesc { Code = 0x0215, CodeMask = 0xFFFF, Name = "seqz.s", CodeSize = 1, OldNames = new[] { "eqzf" } },
- new BdxInstructionDesc { Code = 0x0255, CodeMask = 0xFFFF, Name = "snez.s", CodeSize = 1, OldNames = new[] { "neqzf" } },
- new BdxInstructionDesc { Code = 0x0295, CodeMask = 0xFFFF, Name = "sgez.s", CodeSize = 1, OldNames = new[] { "supoezf" } },
- new BdxInstructionDesc { Code = 0x02D5, CodeMask = 0xFFFF, Name = "sgtz.s", CodeSize = 1, OldNames = new[] { "supzf" } },
- new BdxInstructionDesc { Code = 0x0006, CodeMask = 0xFFFF, Name = "add", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0046, CodeMask = 0xFFFF, Name = "sub", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0086, CodeMask = 0xFFFF, Name = "mul", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x00C6, CodeMask = 0xFFFF, Name = "div", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0106, CodeMask = 0xFFFF, Name = "mod", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0146, CodeMask = 0xFFFF, Name = "and", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0186, CodeMask = 0xFFFF, Name = "or", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x01C6, CodeMask = 0xFFFF, Name = "xor", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0206, CodeMask = 0xFFFF, Name = "sll", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0246, CodeMask = 0xFFFF, Name = "sra", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0286, CodeMask = 0xFFFF, Name = "land", CodeSize = 1, OldNames = new[] { "eqzv" } },
- new BdxInstructionDesc { Code = 0x02C6, CodeMask = 0xFFFF, Name = "lor", CodeSize = 1, OldNames = new[] { "neqzv" } },
- new BdxInstructionDesc { Code = 0x0016, CodeMask = 0xFFFF, Name = "add.s", CodeSize = 1, OldNames = new[] { "addf" } },
- new BdxInstructionDesc { Code = 0x0056, CodeMask = 0xFFFF, Name = "sub.s", CodeSize = 1, OldNames = new[] { "subf" } },
- new BdxInstructionDesc { Code = 0x0096, CodeMask = 0xFFFF, Name = "mul.s", CodeSize = 1, OldNames = new[] { "mulf" } },
- new BdxInstructionDesc { Code = 0x00D6, CodeMask = 0xFFFF, Name = "div.s", CodeSize = 1, OldNames = new[] { "divf" } },
- new BdxInstructionDesc { Code = 0x0116, CodeMask = 0xFFFF, Name = "mod.s", CodeSize = 1, OldNames = new[] { "modf" } },
- new BdxInstructionDesc { Code = 0x0007, CodeMask = 0xFFCF, Name = "b", IsJump = true, CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "jmp" } },
- new BdxInstructionDesc { Code = 0x0047, CodeMask = 0xFFCF, Name = "beqz", IsJump = true, IsJumpConditional = true, CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "jz" } },
- new BdxInstructionDesc { Code = 0x0087, CodeMask = 0xFFCF, Name = "bnez", IsJump = true, IsJumpConditional = true, CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "jnz" } },
- new BdxInstructionDesc { Code = 0x0008, CodeMask = 0x000F, Name = "jal", IsGosub = true, CodeSize = 2, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub }, new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "gosub" } },
- new BdxInstructionDesc { Code = 0x0009, CodeMask = 0xFFCF, Name = "halt", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0049, CodeMask = 0xFFCF, Name = "exit", NeverReturn = true, CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0089, CodeMask = 0xFFCF, Name = "ret", IsGosubRet = true, CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x00C9, CodeMask = 0xFFCF, Name = "drop", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0149, CodeMask = 0xFFCF, Name = "dup", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0189, CodeMask = 0xFFCF, Name = "sin", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x01C9, CodeMask = 0xFFCF, Name = "cos", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0209, CodeMask = 0xFFCF, Name = "degr", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x0249, CodeMask = 0xFFCF, Name = "radd", CodeSize = 1 },
- new BdxInstructionDesc { Code = 0x000A, CodeMask = 0x000F, Name = "syscall", IsSyscall = true, CodeSize = 2, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub }, new Arg { Name = "imm16", Type = ArgType.Imm16 } } },
- new BdxInstructionDesc { Code = 0x000B, CodeMask = 0x000F, Name = "jal32", IsGosub = true, CodeSize = 3, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub }, new Arg { Name = "imm32", Type = ArgType.Imm32, IsRelative = true } }, OldNames = new[] { "gosub32" } },
-
- #endregion
- };
- }
-}
+using System.Collections.Generic;
+using System.Linq;
+using static OpenKh.Kh2.Bdx.Models.BdxInstructionDesc;
+
+namespace OpenKh.Kh2.Bdx.Models
+{
+ public class BdxInstructionDescs
+ {
+ public static IEnumerable GetDescs() => _descs;
+
+ public static BdxInstructionDesc? FindByCode(ushort code)
+ {
+ return _descs
+ .FirstOrDefault(it => (code & it.CodeMask) == it.Code);
+ }
+
+ private static readonly BdxInstructionDesc[] _descs = new[]
+ {
+ #region Generated
+
+ new BdxInstructionDesc { Code = 0x0000, CodeMask = 0x003F, Name = "push", CodeRevealerLabeling = true, CodeSize = 3, Args = new[] { new Arg { Name = "imm32", Type = ArgType.Imm32 } }, OldNames = new[] { "pushImm" } },
+ new BdxInstructionDesc { Code = 0x0010, CodeMask = 0x003F, Name = "push.s", CodeSize = 3, Args = new[] { new Arg { Name = "float32", Type = ArgType.Float32 } }, OldNames = new[] { "pushImmf" } },
+ new BdxInstructionDesc { Code = 0x0020, CodeMask = 0xFFFF, Name = "push.sp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromPSp" } },
+ new BdxInstructionDesc { Code = 0x0060, CodeMask = 0xFFFF, Name = "push.wp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "pushFromPWp" } },
+ new BdxInstructionDesc { Code = 0x00A0, CodeMask = 0xFFFF, Name = "push.sp.d", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromPSpVal" } },
+ new BdxInstructionDesc { Code = 0x00E0, CodeMask = 0xFFFF, Name = "push.bd", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "pushFromPAi" } },
+ new BdxInstructionDesc { Code = 0x0030, CodeMask = 0xFFFF, Name = "push.d.sp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromFSp" } },
+ new BdxInstructionDesc { Code = 0x0070, CodeMask = 0xFFFF, Name = "push.d.wp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "pushFromFWp" } },
+ new BdxInstructionDesc { Code = 0x00B0, CodeMask = 0xFFFF, Name = "push.d.sp.d", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "pushFromFSpVal" } },
+ new BdxInstructionDesc { Code = 0x00F0, CodeMask = 0xFFFF, Name = "push.d.bd", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "pushFromFAi" } },
+ new BdxInstructionDesc { Code = 0x0001, CodeMask = 0xFFCF, Name = "pop.sp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "popToSp" } },
+ new BdxInstructionDesc { Code = 0x0041, CodeMask = 0xFFCF, Name = "pop.wp", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "popToWp" } },
+ new BdxInstructionDesc { Code = 0x0081, CodeMask = 0xFFCF, Name = "pop.sp.d", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "popToSpVal" } },
+ new BdxInstructionDesc { Code = 0x00C1, CodeMask = 0xFFCF, Name = "pop.bd", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "popToAi" } },
+ new BdxInstructionDesc { Code = 0x0002, CodeMask = 0xFFCF, Name = "memcpy.sp", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16 } }, OldNames = new[] { "memcpyToSp" } },
+ new BdxInstructionDesc { Code = 0x0042, CodeMask = 0xFFCF, Name = "memcpy.wp", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16, WorkPos = true } }, OldNames = new[] { "memcpyToWp" } },
+ new BdxInstructionDesc { Code = 0x0082, CodeMask = 0xFFCF, Name = "memcpy.sp.d", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16 } }, OldNames = new[] { "memcpyToSpVal" } },
+ new BdxInstructionDesc { Code = 0x00C2, CodeMask = 0xFFCF, Name = "memcpy.bd", CodeSize = 3, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 }, new Arg { Name = "imm16_2", Type = ArgType.Imm16, AiPos = true } }, OldNames = new[] { "memcpyToSpAi" } },
+ new BdxInstructionDesc { Code = 0x0003, CodeMask = 0x000F, Name = "push.d.pop", CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16 } }, OldNames = new[] { "fetchValue" } },
+ new BdxInstructionDesc { Code = 0x0004, CodeMask = 0x000F, Name = "memcpy", CodeSize = 1, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub } } },
+ new BdxInstructionDesc { Code = 0x0005, CodeMask = 0xFFFF, Name = "cvt.w.s", CodeSize = 1, OldNames = new[] { "citf" } },
+ new BdxInstructionDesc { Code = 0x0085, CodeMask = 0xFFFF, Name = "neg", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x00C5, CodeMask = 0xFFFF, Name = "not", CodeSize = 1, OldNames = new[] { "inv" } },
+ new BdxInstructionDesc { Code = 0x0105, CodeMask = 0xFFFF, Name = "seqz", CodeSize = 1, OldNames = new[] { "eqz" } },
+ new BdxInstructionDesc { Code = 0x0145, CodeMask = 0xFFFF, Name = "abs", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0185, CodeMask = 0xFFFF, Name = "sltz", CodeSize = 1, OldNames = new[] { "msb" } },
+ new BdxInstructionDesc { Code = 0x01C5, CodeMask = 0xFFFF, Name = "slez", CodeSize = 1, OldNames = new[] { "info" } },
+ new BdxInstructionDesc { Code = 0x0205, CodeMask = 0xFFFF, Name = "seqz", CodeSize = 1, OldNames = new[] { "eqz" } },
+ new BdxInstructionDesc { Code = 0x0245, CodeMask = 0xFFFF, Name = "snez", CodeSize = 1, OldNames = new[] { "neqz" } },
+ new BdxInstructionDesc { Code = 0x0285, CodeMask = 0xFFFF, Name = "sgez", CodeSize = 1, OldNames = new[] { "msbi" } },
+ new BdxInstructionDesc { Code = 0x02C5, CodeMask = 0xFFFF, Name = "sgtz", CodeSize = 1, OldNames = new[] { "ipos" } },
+ new BdxInstructionDesc { Code = 0x0055, CodeMask = 0xFFFF, Name = "cvt.s.w", CodeSize = 1, OldNames = new[] { "cfti" } },
+ new BdxInstructionDesc { Code = 0x0095, CodeMask = 0xFFFF, Name = "neg.s", CodeSize = 1, OldNames = new[] { "negf" } },
+ new BdxInstructionDesc { Code = 0x0155, CodeMask = 0xFFFF, Name = "abs.s", CodeSize = 1, OldNames = new[] { "absf" } },
+ new BdxInstructionDesc { Code = 0x0195, CodeMask = 0xFFFF, Name = "sltz.s", CodeSize = 1, OldNames = new[] { "infzf" } },
+ new BdxInstructionDesc { Code = 0x01D5, CodeMask = 0xFFFF, Name = "slez.s", CodeSize = 1, OldNames = new[] { "infoezf" } },
+ new BdxInstructionDesc { Code = 0x0215, CodeMask = 0xFFFF, Name = "seqz.s", CodeSize = 1, OldNames = new[] { "eqzf" } },
+ new BdxInstructionDesc { Code = 0x0255, CodeMask = 0xFFFF, Name = "snez.s", CodeSize = 1, OldNames = new[] { "neqzf" } },
+ new BdxInstructionDesc { Code = 0x0295, CodeMask = 0xFFFF, Name = "sgez.s", CodeSize = 1, OldNames = new[] { "supoezf" } },
+ new BdxInstructionDesc { Code = 0x02D5, CodeMask = 0xFFFF, Name = "sgtz.s", CodeSize = 1, OldNames = new[] { "supzf" } },
+ new BdxInstructionDesc { Code = 0x0006, CodeMask = 0xFFFF, Name = "add", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0046, CodeMask = 0xFFFF, Name = "sub", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0086, CodeMask = 0xFFFF, Name = "mul", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x00C6, CodeMask = 0xFFFF, Name = "div", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0106, CodeMask = 0xFFFF, Name = "mod", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0146, CodeMask = 0xFFFF, Name = "and", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0186, CodeMask = 0xFFFF, Name = "or", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x01C6, CodeMask = 0xFFFF, Name = "xor", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0206, CodeMask = 0xFFFF, Name = "sll", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0246, CodeMask = 0xFFFF, Name = "sra", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0286, CodeMask = 0xFFFF, Name = "land", CodeSize = 1, OldNames = new[] { "eqzv" } },
+ new BdxInstructionDesc { Code = 0x02C6, CodeMask = 0xFFFF, Name = "lor", CodeSize = 1, OldNames = new[] { "neqzv" } },
+ new BdxInstructionDesc { Code = 0x0016, CodeMask = 0xFFFF, Name = "add.s", CodeSize = 1, OldNames = new[] { "addf" } },
+ new BdxInstructionDesc { Code = 0x0056, CodeMask = 0xFFFF, Name = "sub.s", CodeSize = 1, OldNames = new[] { "subf" } },
+ new BdxInstructionDesc { Code = 0x0096, CodeMask = 0xFFFF, Name = "mul.s", CodeSize = 1, OldNames = new[] { "mulf" } },
+ new BdxInstructionDesc { Code = 0x00D6, CodeMask = 0xFFFF, Name = "div.s", CodeSize = 1, OldNames = new[] { "divf" } },
+ new BdxInstructionDesc { Code = 0x0116, CodeMask = 0xFFFF, Name = "mod.s", CodeSize = 1, OldNames = new[] { "modf" } },
+ new BdxInstructionDesc { Code = 0x0007, CodeMask = 0xFFCF, Name = "b", IsJump = true, CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "jmp" } },
+ new BdxInstructionDesc { Code = 0x0047, CodeMask = 0xFFCF, Name = "beqz", IsJump = true, IsJumpConditional = true, CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "jz" } },
+ new BdxInstructionDesc { Code = 0x0087, CodeMask = 0xFFCF, Name = "bnez", IsJump = true, IsJumpConditional = true, CodeSize = 2, Args = new[] { new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "jnz" } },
+ new BdxInstructionDesc { Code = 0x0008, CodeMask = 0x000F, Name = "jal", IsGosub = true, CodeSize = 2, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub }, new Arg { Name = "imm16", Type = ArgType.Imm16, IsRelative = true } }, OldNames = new[] { "gosub" } },
+ new BdxInstructionDesc { Code = 0x0009, CodeMask = 0xFFCF, Name = "halt", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0049, CodeMask = 0xFFCF, Name = "exit", NeverReturn = true, CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0089, CodeMask = 0xFFCF, Name = "ret", IsGosubRet = true, CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x00C9, CodeMask = 0xFFCF, Name = "drop", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0149, CodeMask = 0xFFCF, Name = "dup", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0189, CodeMask = 0xFFCF, Name = "sin", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x01C9, CodeMask = 0xFFCF, Name = "cos", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0209, CodeMask = 0xFFCF, Name = "degr", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x0249, CodeMask = 0xFFCF, Name = "radd", CodeSize = 1 },
+ new BdxInstructionDesc { Code = 0x000A, CodeMask = 0x000F, Name = "syscall", IsSyscall = true, CodeSize = 2, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub }, new Arg { Name = "imm16", Type = ArgType.Imm16 } } },
+ new BdxInstructionDesc { Code = 0x000B, CodeMask = 0x000F, Name = "jal32", IsGosub = true, CodeSize = 3, Args = new[] { new Arg { Name = "ssub", Type = ArgType.Ssub }, new Arg { Name = "imm32", Type = ArgType.Imm32, IsRelative = true } }, OldNames = new[] { "gosub32" } },
+
+ #endregion
+ };
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Models/BdxTrap.cs b/OpenKh.Kh2/Bdx/Models/BdxTrap.cs
similarity index 81%
rename from OpenKh.Command.Bdxio/Models/BdxTrap.cs
rename to OpenKh.Kh2/Bdx/Models/BdxTrap.cs
index b44a23d28..4f9851063 100644
--- a/OpenKh.Command.Bdxio/Models/BdxTrap.cs
+++ b/OpenKh.Kh2/Bdx/Models/BdxTrap.cs
@@ -1,10 +1,10 @@
-namespace OpenKh.Command.Bdxio.Models
-{
- public class BdxTrap
- {
- public int TableIndex { get; set; }
- public int TrapIndex { get; set; }
- public string Name { get; set; }
- public int Flags { get; set; }
- }
-}
+namespace OpenKh.Kh2.Bdx.Models
+{
+ public class BdxTrap
+ {
+ public int TableIndex { get; set; }
+ public int TrapIndex { get; set; }
+ public string Name { get; set; }
+ public int Flags { get; set; }
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Models/BdxTraps.cs b/OpenKh.Kh2/Bdx/Models/BdxTraps.cs
similarity index 99%
rename from OpenKh.Command.Bdxio/Models/BdxTraps.cs
rename to OpenKh.Kh2/Bdx/Models/BdxTraps.cs
index 51a55a3db..f4e8baecf 100644
--- a/OpenKh.Command.Bdxio/Models/BdxTraps.cs
+++ b/OpenKh.Kh2/Bdx/Models/BdxTraps.cs
@@ -1,843 +1,845 @@
-namespace OpenKh.Command.Bdxio.Models
-{
- public class BdxTraps
- {
- public static IEnumerable GetTraps() => _traps;
-
- private static readonly BdxTrap[] _traps = new[]
- {
- #region Generated
-
- new BdxTrap { TableIndex = 0, TrapIndex = 0, Name = "trap_puti", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 1, Name = "trap_putf", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 2, Name = "trap_puts", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 3, Name = "trap_frametime", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 4, Name = "trap_vector_add", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 5, Name = "trap_vector_sub", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 6, Name = "trap_vector_len", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 7, Name = "trap_vector_normalize", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 8, Name = "trap_vector_dump", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 9, Name = "trap_thread_start", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 0, TrapIndex = 11, Name = "trap_file_is_reading", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 12, Name = "trap_file_flush", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 13, Name = "trap_vector_roty", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 14, Name = "trap_progress_set_flag", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 15, Name = "trap_progress_check_flag", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 16, Name = "trap_random_get", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 17, Name = "trap_random_getf", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 18, Name = "trap_random_range", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 19, Name = "trap_worldflag_set", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 20, Name = "trap_worldflag_check", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 21, Name = "trap_vector_get_rot_xz", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 22, Name = "trap_abs", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 23, Name = "trap_absf", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 24, Name = "trap_stputi", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 25, Name = "trap_stputf", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 26, Name = "trap_stputs", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 27, Name = "func_system_set_game_speed", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 28, Name = "method_blur_init", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 29, Name = "method_blur_start", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 30, Name = "method_blur_stop", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 31, Name = "func_screen_whiteout", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 32, Name = "func_screen_whitein", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 35, Name = "method_vector_scale", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 36, Name = "trap_vector_mul", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 37, Name = "trap_vector_div", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 38, Name = "trap_effect_set_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 39, Name = "trap_effect_set_scale", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 40, Name = "trap_effect_set_rot", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 41, Name = "trap_effect_set_dir", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 42, Name = "trap_vector_atan_xz", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 43, Name = "trap_fixrad", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 44, Name = "trap_effect_loop_end", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 45, Name = "trap_vector_addf", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 46, Name = "trap_vector_homing", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 47, Name = "trap_memory_alloc", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 48, Name = "trap_memory_free", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 49, Name = "trap_effect_is_alive", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 50, Name = "trap_effect_is_active", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 51, Name = "trap_effect_kill", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 52, Name = "trap_effect_fadeout", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 53, Name = "trap_effect_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 54, Name = "trap_effect_dir", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 55, Name = "trap_timer_count_down", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 56, Name = "trap_timer_count_up", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 57, Name = "trap_saveflag_set", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 58, Name = "trap_saveflag_reset", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 59, Name = "trap_saveflag_check", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 60, Name = "trap_assert", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 61, Name = "trap_saveram_get_partram", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 62, Name = "trap_partram_set_item_max", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 63, Name = "trap_item_get", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 64, Name = "trap_sound_disable", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 65, Name = "trap_sound_play_system", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 66, Name = "trap_effect_pause", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 67, Name = "trap_effect_set_color", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 68, Name = "trap_vector_rotx", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 69, Name = "trap_menuflag_set", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 70, Name = "trap_progress_is_second", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 73, Name = "trap_menuflag_reset", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 74, Name = "trap_screen_show_picture", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 75, Name = "trap_saveram_set_weapon", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 76, Name = "trap_saveram_set_form_weapon", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 77, Name = "trap_screen_cross_fade", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 78, Name = "trap_vector_inter", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 79, Name = "trap_effect_add_dead_block", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 80, Name = "trap_pad_is_button", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 81, Name = "trap_pad_is_trigger", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 82, Name = "trap_vector_outer_product", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 83, Name = "trap_vector_rot", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 84, Name = "trap_vector_angle", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 85, Name = "trap_effect_loop_end_kill", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 86, Name = "trap_effect_set_type", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 87, Name = "trap_screen_fadeout", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 88, Name = "trap_screen_fadein", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 89, Name = "trap_menuflag_check", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 90, Name = "trap_vector_draw", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 0, TrapIndex = 91, Name = "trap_vector_inner_prodcut", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 92, Name = "trap_partram_add_attack", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 93, Name = "trap_partram_add_wisdom", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 94, Name = "trap_partram_add_defence", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 95, Name = "trap_partram_set_levelup_type", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 96, Name = "trap_partram_add_ap", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 97, Name = "trap_item_reduce", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 98, Name = "trap_saveram_set_form_ability", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 0, TrapIndex = 99, Name = "trap_partram_add_ability", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 0, TrapIndex = 100, Name = "trap_saveram_increment_friend_recov", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 101, Name = "trap_progress_is_secret_movie", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 102, Name = "trap_vector_to_angle", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 0, TrapIndex = 103, Name = "trap_progress_is_fm_secret_movie", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 0, TrapIndex = 104, Name = "trap_sound_set_bgse_volume", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 0, Name = "trap_sysobj_appear", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 1, Name = "trap_obj_set_rot", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 2, Name = "trap_sysobj_moveto", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 3, Name = "trap_sysobj_player", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 4, Name = "trap_obj_wish_dir", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 5, Name = "trap_act_table_init", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 6, Name = "trap_act_table_add", Flags = 0x0000000C },
- new BdxTrap { TableIndex = 1, TrapIndex = 7, Name = "trap_obj_set_act_table", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 8, Name = "trap_obj_act_start", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 9, Name = "trap_obj_act_push", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 10, Name = "trap_obj_is_act_exec", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 11, Name = "trap_sysobj_motion_start", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 12, Name = "trap_sysobj_motion_change", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 13, Name = "trap_sysobj_motion_push", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 14, Name = "trap_sysobj_motion_is_end", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 15, Name = "trap_sysobj_motion_id", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 17, Name = "trap_obj_leave_force", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 18, Name = "trap_obj_attach", Flags = 0x00000006 },
- new BdxTrap { TableIndex = 1, TrapIndex = 19, Name = "trap_sysobj_fadeout", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 20, Name = "trap_sysobj_fadein", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 21, Name = "trap_obj_effect_start", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 22, Name = "trap_obj_effect_start_pos", Flags = 0x40000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 23, Name = "trap_area_world", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 24, Name = "trap_area_area", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 25, Name = "trap_area_map_set", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 26, Name = "trap_area_battle_set", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 27, Name = "trap_area_event_set", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 28, Name = "trap_obj_leave", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 29, Name = "trap_obj_motion_capture", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 30, Name = "trap_area_jump", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 31, Name = "trap_area_setjump", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 32, Name = "trap_message_open", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 33, Name = "trap_message_close", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 34, Name = "trap_event_is_exec", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 35, Name = "trap_area_init", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 36, Name = "trap_bg_hide", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 37, Name = "trap_bg_show", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 38, Name = "trap_obj_set_team", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 39, Name = "trap_obj_unit_arg", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 40, Name = "trap_obj_is_pirate_shade", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 41, Name = "trap_signal_call", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 42, Name = "func_obj_control_off", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 43, Name = "func_obj_control_on", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 44, Name = "func_history_clear_enemy", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 45, Name = "func_area_activate_unit", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 46, Name = "func_bg_barrier_on", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 47, Name = "func_bg_barrier_off", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 48, Name = "method_message_is_end", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 49, Name = "method_obj_enable_reaction_command", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 50, Name = "method_obj_disable_reaction_command", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 51, Name = "method_obj_reset_reaction_command", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 52, Name = "method_obj_enable_collision", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 53, Name = "method_obj_disable_collision", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 54, Name = "method_obj_reset_collision", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 55, Name = "method_obj_jump", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 56, Name = "method_obj_is_culling", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 57, Name = "trap_obj_is_jump", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 58, Name = "trap_obj_fly", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 59, Name = "trap_obj_is_fly", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 60, Name = "trap_obj_is_air", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 61, Name = "trap_sysobj_motion_frame_start", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 62, Name = "trap_obj_get_moved", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 63, Name = "trap_obj_is_motion_in_loop", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 64, Name = "trap_obj_get_wish_movement", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 65, Name = "trap_obj_exec_fall", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 66, Name = "trap_obj_exec_land", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 67, Name = "trap_obj_motion_get_length", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 68, Name = "trap_obj_motion_get_loop_top", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 69, Name = "trap_obj_motion_get_time", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 70, Name = "trap_obj_set_flag", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 71, Name = "trap_obj_reset_flag", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 72, Name = "trap_obj_check_flag", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 73, Name = "trap_obj_hover", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 74, Name = "trap_obj_idle", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 75, Name = "trap_obj_motion_hook", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 76, Name = "trap_obj_motion_unhook", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 77, Name = "trap_obj_motion_is_hook", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 78, Name = "trap_obj_motion_is_no_control", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 79, Name = "trap_obj_set_dir", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 80, Name = "trap_obj_turn_dir", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 81, Name = "trap_obj_act_wedge", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 82, Name = "trap_obj_thread_start", Flags = 0x40000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 83, Name = "trap_obj_apply_bone_matrix", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 84, Name = "trap_obj_sheet", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 85, Name = "trap_obj_texanm_start", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 86, Name = "trap_obj_texanm_stop", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 87, Name = "trap_obj_effect_start_bind", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 88, Name = "trap_obj_target_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 89, Name = "trap_obj_move_request", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 90, Name = "trap_obj_act_shout", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 91, Name = "trap_obj_star", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 92, Name = "trap_obj_scatter_prize", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 93, Name = "trap_sysobj_party", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 94, Name = "trap_sysobj_is_exist", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 95, Name = "trap_obj_fly_to_jump", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 96, Name = "trap_obj_get_action", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 97, Name = "trap_obj_spec", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 98, Name = "trap_obj_step_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 99, Name = "trap_obj_float_height", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 100, Name = "trap_obj_jump_height_to_uptime", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 101, Name = "trap_obj_motion_is_capture", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 102, Name = "trap_obj_detach", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 103, Name = "trap_obj_set_detach_callback", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 104, Name = "trap_obj_shadow_move_start", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 105, Name = "trap_obj_shadow_move_end", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 106, Name = "trap_signal_reserve_hp", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 107, Name = "trap_obj_motion_speed", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 108, Name = "trap_obj_show_part", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 109, Name = "trap_obj_hide_part", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 110, Name = "trap_obj_get_appear_way", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 111, Name = "trap_obj_set_movement", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 112, Name = "trap_obj_hook", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 113, Name = "trap_player_get_movement", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 114, Name = "trap_obj_search_by_entry", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 115, Name = "trap_obj_set_jump_motion", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 117, Name = "trap_command_cage_on", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 118, Name = "trap_command_cage_off", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 119, Name = "trap_obj_check_step", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 120, Name = "trap_target_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 121, Name = "trap_target_search", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 122, Name = "trap_obj_dump", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 123, Name = "trap_obj_tex_fade_set", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 124, Name = "trap_obj_is_entry_fly", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 125, Name = "trap_obj_tex_fade_start", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 126, Name = "trap_obj_motion_sync", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 127, Name = "trap_obj_act_clear", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 128, Name = "trap_obj_sysjump", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 129, Name = "trap_obj_blow", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 130, Name = "trap_obj_cmp", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 131, Name = "trap_target_dup", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 132, Name = "trap_target_free", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 133, Name = "trap_obj_hide", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 134, Name = "trap_obj_show", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 135, Name = "trap_bg_cross_pos", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 136, Name = "trap_bg_is_floor", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 137, Name = "trap_bg_get_normal", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 138, Name = "trap_pax_start", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 139, Name = "trap_pax_start_bind", Flags = 0x40000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 140, Name = "trap_target_is_exist", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 141, Name = "trap_bg_ground_pos", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 142, Name = "trap_signal_reserve_min_hp", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 143, Name = "trap_obj_search_by_serial", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 144, Name = "trap_obj_serial", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 145, Name = "trap_obj_touch_zone", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 146, Name = "trap_obj_hitback", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 147, Name = "trap_obj_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 148, Name = "trap_obj_set_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 149, Name = "trap_obj_effect_start_bind_other", Flags = 0x40000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 150, Name = "trap_obj_motion_check_range", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 151, Name = "trap_obj_motion_check_trigger", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 152, Name = "trap_status_is_mission", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 153, Name = "trap_obj_reset_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 154, Name = "trap_status_secure_mode_start", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 155, Name = "trap_obj_add_hp", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 156, Name = "trap_obj_hop", Flags = 0x00000007 },
- new BdxTrap { TableIndex = 1, TrapIndex = 157, Name = "trap_obj_camera_start", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 158, Name = "trap_bg_set_belt_conveyor", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 159, Name = "trap_bg_set_uvscroll_speed", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 160, Name = "trap_target_set_obj", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 161, Name = "trap_obj_is_attach", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 162, Name = "trap_target_set_before_player", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 163, Name = "trap_target_set_after_player", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 164, Name = "trap_obj_camera_start_global", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 165, Name = "trap_command_override", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 166, Name = "trap_target_attack", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 167, Name = "trap_obj_act_start_pri", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 168, Name = "trap_obj_flyjump", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 169, Name = "trap_obj_effect_unbind", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 170, Name = "trap_obj_unit_group", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 171, Name = "trap_status_no_leave", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 172, Name = "trap_obj_can_look", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 173, Name = "trap_obj_can_look_pos", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 174, Name = "trap_obj_look_start", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 175, Name = "trap_obj_look_start_pos", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 176, Name = "trap_obj_look_end", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 177, Name = "trap_obj_set_path", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 178, Name = "trap_obj_get_path_movement", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 179, Name = "trap_obj_set_fall_motion", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 180, Name = "trap_obj_set_land_motion", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 181, Name = "trap_light_create", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 182, Name = "trap_light_set_flag", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 183, Name = "trap_light_set_color", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 184, Name = "trap_light_fadeout", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 185, Name = "trap_obj_set_parts_color", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 186, Name = "trap_obj_reset_parts_color", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 187, Name = "trap_status_prize_drain_start", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 188, Name = "trap_status_prize_drain_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 189, Name = "trap_obj_history_mark", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 190, Name = "trap_obj_is_history_mark", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 191, Name = "trap_obj_lockon_target", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 192, Name = "trap_obj_is_motion_cancel", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 193, Name = "trap_camera_warp", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 194, Name = "trap_obj_set_stealth", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 195, Name = "trap_obj_reset_stealth", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 196, Name = "trap_area_entrance", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 197, Name = "trap_area_cost_rest", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 198, Name = "trap_obj_set_player_random_pos", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 199, Name = "trap_obj_set_random_pos", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 200, Name = "trap_obj_set_bg_collision_type", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 201, Name = "trap_obj_dir", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 202, Name = "trap_unit_disable", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 203, Name = "trap_unit_enable", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 204, Name = "trap_status_force_leave_start", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 205, Name = "trap_status_force_leave_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 206, Name = "trap_status_is_force_leave", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 207, Name = "trap_camera_watch", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 208, Name = "trap_obj_is_hover", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 209, Name = "trap_obj_dead", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 210, Name = "trap_obj_search_by_part", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 211, Name = "trap_obj_pattern_enable", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 212, Name = "trap_obj_pattern_disable", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 213, Name = "trap_obj_part", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 214, Name = "trap_obj_hook_stop", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 217, Name = "trap_obj_set_pos_trans", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 218, Name = "trap_obj_set_unit_arg", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 219, Name = "trap_obj_camera_start", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 220, Name = "trap_obj_move_to_space", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 221, Name = "trap_obj_can_decide_command", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 222, Name = "trap_obj_get_entry_id", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 223, Name = "trap_camera_cancel", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 224, Name = "trap_obj_is_action_air", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 225, Name = "trap_obj_is_star", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 226, Name = "trap_obj_scatter_prize_mu", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 227, Name = "trap_obj_jump_direct", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 228, Name = "trap_sheet_hp", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 229, Name = "trap_sheet_max_hp", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 230, Name = "trap_sheet_hp_rate", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 231, Name = "trap_sheet_set_min_hp", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 232, Name = "trap_sheet_min_hp", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 233, Name = "trap_sheet_set_hp", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 234, Name = "trap_party_get_weapon", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 235, Name = "trap_party_hand_to_bone", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 236, Name = "trap_obj_motion_unsync", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 237, Name = "trap_command_override_top", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 238, Name = "trap_obj_motion_capture_id", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 239, Name = "trap_obj_is_unit_active", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 240, Name = "trap_obj_scatter_prize_tt", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 241, Name = "trap_act_shout", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 242, Name = "trap_player_capture_form", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 243, Name = "trap_player_capture_form_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 244, Name = "trap_status_is_battle", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 245, Name = "trap_target_clear_before_player", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 246, Name = "trap_target_clear_after_player", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 247, Name = "trap_bg_get_random_pos", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 248, Name = "trap_bg_get_random_pos_air", Flags = 0x40000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 249, Name = "trap_status_set_prize_ratio", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 250, Name = "trap_status_set_lockon_ratio", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 251, Name = "trap_light_fadein", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 252, Name = "trap_camera_apply_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 253, Name = "trap_obj_can_capture_control", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 254, Name = "trap_obj_is_ride", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 255, Name = "trap_obj_disable_occ", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 256, Name = "trap_obj_enable_occ", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 257, Name = "trap_light_set_fog_near", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 258, Name = "trap_light_set_fog_far", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 259, Name = "trap_light_set_fog_min", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 260, Name = "trap_light_set_fog_max", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 261, Name = "trap_sheet_munny", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 262, Name = "trap_obj_voice", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 263, Name = "trap_player_set_exec_rc", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 264, Name = "trap_status_secure_mode_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 265, Name = "trap_obj_set_medal", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 266, Name = "trap_obj_get_medal", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 267, Name = "trap_obj_scatter_medal", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 268, Name = "trap_obj_action_lightcycle", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 269, Name = "trap_obj_get_lightcycle_movement", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 270, Name = "trap_obj_motion_disable_anmatr_effect", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 271, Name = "trap_obj_motion_enable_anmatr_effect", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 272, Name = "trap_obj_is_dead", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 273, Name = "trap_signal_hook", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 274, Name = "trap_event_get_rest_time", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 275, Name = "trap_obj_recov_holylight", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 276, Name = "trap_obj_use_mp", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 277, Name = "trap_obj_reraise", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 278, Name = "trap_obj_scatter_prize_tr", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 279, Name = "trap_prize_appear_tr", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 280, Name = "trap_sheet_add_munny", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 281, Name = "trap_camera_begin_scope", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 283, Name = "trap_camera_end_scope", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 284, Name = "trap_tutorial_pause", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 285, Name = "trap_obj_show_picture", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 286, Name = "trap_status_hide_shadow", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 287, Name = "trap_status_show_shadow", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 288, Name = "trap_status_begin_free_ability", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 289, Name = "trap_status_end_free_ability", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 290, Name = "trap_picture_change", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 291, Name = "trap_obj_levelup_unit", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 292, Name = "trap_obj_search_by_unit_arg", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 293, Name = "trap_event_control_off", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 294, Name = "trap_event_control_on", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 295, Name = "trap_camera_reset", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 296, Name = "trap_tutorial_open", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 297, Name = "trap_player_get_rc", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 298, Name = "trap_worldwork_get", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 299, Name = "trap_area_set_next_entrance", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 300, Name = "trap_prize_num", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 301, Name = "trap_tutorial_is_open", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 302, Name = "trap_obj_set_skateboard_mode", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 303, Name = "trap_area_cost_ratio", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 304, Name = "trap_obj_search_by_glance", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 305, Name = "trap_camera_eye", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 306, Name = "trap_camera_at", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 307, Name = "trap_obj_search_by_camera", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 308, Name = "trap_obj_capture_command", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 309, Name = "trap_sysobj_is_player", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 310, Name = "trap_obj_get_weight", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 311, Name = "trap_sheet_set_element_rate", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 312, Name = "trap_camera_set_scope_zoom", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 313, Name = "trap_camera_set_scope_closeup_distance", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 314, Name = "trap_camera_set_scope_target_pos", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 315, Name = "trap_picture_set_pos", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 316, Name = "trap_camera_get_projection_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 317, Name = "trap_status_no_gameover", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 318, Name = "trap_obj_play_se", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 319, Name = "trap_sysobj_is_sora", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 320, Name = "trap_unit_get_enemy_num", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 321, Name = "trap_player_lockon", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 322, Name = "trap_command_enable_item", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 323, Name = "trap_obj_count_entry", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 324, Name = "trap_obj_pattern_reset", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 325, Name = "trap_obj_reaction_callback", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 326, Name = "trap_bg_set_animation_speed", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 327, Name = "trap_prize_get_all_tr", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 328, Name = "trap_obj_dead_mark", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 329, Name = "trap_sheet_set_prize_range", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 330, Name = "trap_obj_set_cannon_camera_offset", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 331, Name = "trap_obj_each_all", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 332, Name = "trap_sysobj_is_btlnpc", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 333, Name = "trap_obj_set_cannon_param", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 1, TrapIndex = 334, Name = "trap_command_enable", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 335, Name = "trap_obj_disable_occ_bone", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 336, Name = "trap_obj_enable_occ_bone", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 337, Name = "trap_command_set_side_b", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 338, Name = "trap_prize_return_ca", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 339, Name = "trap_prize_vacuum_ca", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 340, Name = "trap_prize_vacuum_range_ca", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 341, Name = "trap_prize_num_ca", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 342, Name = "trap_prize_appear_num", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 1, TrapIndex = 343, Name = "trap_obj_is_equip_ability", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 344, Name = "trap_obj_clear_occ", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 345, Name = "trap_command_override_slot", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 1, TrapIndex = 346, Name = "trap_command_slot_set_status", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 347, Name = "trap_obj_can_see", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 348, Name = "trap_sheet_set_hitback_addition", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 349, Name = "trap_obj_effect_kill_all", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 350, Name = "trap_status_close_pete_curtain", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 351, Name = "trap_status_open_pete_curtain", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 352, Name = "trap_area_set_return_tr", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 353, Name = "trap_obj_start_mpdrive", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 354, Name = "trap_event_layer_off", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 355, Name = "trap_player_can_capture_form", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 356, Name = "trap_event_layer_on", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 1, TrapIndex = 357, Name = "trap_sheet_attack_level", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 358, Name = "trap_sheet_set_attack_level", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 359, Name = "trap_obj_hook_command_image", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 360, Name = "trap_obj_reset_command_image", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 361, Name = "trap_sheet_level", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 362, Name = "trap_treasure_get", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 363, Name = "trap_prize_appear_xaldin", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 364, Name = "trap_jigsaw_get", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 1, TrapIndex = 365, Name = "trap_command_disable_group", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 366, Name = "trap_command_enable_group", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 1, TrapIndex = 367, Name = "trap_obj_get_move_to_space_pos", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 0, Name = "trap_enemy_exec_damage", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 1, Name = "trap_enemy_exec_damage_blow", Flags = 0x00000006 },
- new BdxTrap { TableIndex = 2, TrapIndex = 2, Name = "trap_enemy_exec_damage_small", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 3, Name = "trap_enemy_exec_damage_hitback", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 4, Name = "trap_enemy_each", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 5, Name = "trap_enemy_is_no_control", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 6, Name = "trap_enemy_is_damage_motion", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 7, Name = "trap_damage_reaction", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 8, Name = "trap_damage_is_reaction", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 9, Name = "trap_btlobj_set_sheet", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 10, Name = "trap_attack_new", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 11, Name = "trap_attack_set_radius", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 12, Name = "trap_attack_set_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 13, Name = "trap_attack_free", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 14, Name = "trap_attack_is_hit", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 15, Name = "trap_damage_exec_reaction", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 16, Name = "trap_damage_is_exec_reaction", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 17, Name = "trap_attack_strike", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 18, Name = "trap_attack_is_strike", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 19, Name = "trap_attack_set_line", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 20, Name = "trap_magic_start_thread", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 21, Name = "trap_teamwork_alloc", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 22, Name = "trap_attack_set_obj_pax", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 23, Name = "trap_btlobj_target", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 24, Name = "trap_attack_get_owner", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 25, Name = "trap_attack_get_param_id", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 26, Name = "trap_attack_exec_reflect", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 27, Name = "trap_enemy_exec_reflect", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 2, TrapIndex = 28, Name = "trap_attack_refresh", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 29, Name = "trap_attack_is_hit_bg", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 30, Name = "trap_attack_set_pax", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 31, Name = "trap_attack_dup", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 32, Name = "trap_damage_blow_up", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 33, Name = "trap_damage_blow_speed", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 34, Name = "trap_attack_get_type", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 35, Name = "trap_damage_attack_type", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 36, Name = "trap_enemy_add_damage", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 37, Name = "trap_attack_set_team", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 38, Name = "trap_attack_set_hit_callback", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 39, Name = "trap_attack_is_reflect", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 40, Name = "trap_attack_is_hit_wall", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 41, Name = "trap_attack_is_hit_floor", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 42, Name = "trap_attack_hit_bg_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 43, Name = "trap_attack_get_reflect_vector", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 44, Name = "trap_attack_reflecter", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 45, Name = "trap_damage_attack_param_id", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 46, Name = "trap_damage_damage", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 47, Name = "trap_limit_motion_start", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 48, Name = "trap_limit_player", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 49, Name = "trap_limit_friend", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 50, Name = "trap_limit_camera_start", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 51, Name = "trap_attack_set_rc", Flags = 0x00000005 },
- new BdxTrap { TableIndex = 2, TrapIndex = 52, Name = "trap_attack_rc_receiver", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 53, Name = "trap_enemy_last_dead", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 2, TrapIndex = 54, Name = "trap_limit_start_thread", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 55, Name = "trap_limit_light", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 56, Name = "trap_btlobj_lockon_target", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 57, Name = "trap_limit_effect_start", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 58, Name = "trap_limit_effect_start_pos", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 59, Name = "trap_limit_effect_start_bind", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 60, Name = "trap_limit_time", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 61, Name = "trap_attack_set_effect", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 62, Name = "trap_attack_set_time", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 63, Name = "trap_limit_reference", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 64, Name = "trap_damage_orig_reaction", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 65, Name = "trap_enemy_count_damager", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 2, TrapIndex = 66, Name = "trap_attack_get_reflect_count", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 67, Name = "trap_attack_new_combo_group", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 2, TrapIndex = 68, Name = "trap_magic_set_cost", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 69, Name = "trap_magic_can_add_cost", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 70, Name = "trap_damage_parts", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 71, Name = "trap_attack_set_hitmark_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 72, Name = "trap_damage_is_cure", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 73, Name = "trap_bonuslevel_up", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 74, Name = "trap_attack_set_reflect_callback", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 75, Name = "trap_summon_is_tink_exist", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 2, TrapIndex = 76, Name = "trap_enemy_set_karma_limit", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 77, Name = "trap_vacuum_create", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 78, Name = "trap_vacuum_destroy", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 79, Name = "trap_vacuum_set_ignore_type", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 80, Name = "trap_vacuum_set_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 81, Name = "trap_vacuum_set_speed", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 2, TrapIndex = 82, Name = "trap_vacuum_set_rot_speed", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 83, Name = "trap_vacuum_set_near_range", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 84, Name = "trap_vacuum_set_dist_rate", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 85, Name = "trap_damage_element", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 86, Name = "trap_damage_get_hitback", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 87, Name = "trap_enemy_exec_damage_large", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 2, TrapIndex = 88, Name = "trap_enemy_get_attacker", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 89, Name = "trap_limit_reset_special_command", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 90, Name = "trap_limit_close_gauge", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 91, Name = "trap_damage_get_reaction_type", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 92, Name = "trap_damage_is_finish", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 93, Name = "trap_damage_is_normal", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 94, Name = "trap_attack_set_system_pax", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 95, Name = "trap_btlobj_dup_sheet", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 2, TrapIndex = 96, Name = "trap_attack_is_valid", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 2, TrapIndex = 97, Name = "trap_enemy_set_attacker", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 2, Name = "trap_event_is_exec", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 3, Name = "trap_mission_complete", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 4, Name = "trap_mission_information", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 5, Name = "trap_mission_set_count", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 6, Name = "trap_mission_increment_count", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 7, Name = "trap_mission_restart_timer", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 8, Name = "trap_mission_set_gauge", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 9, Name = "trap_mission_add_gauge", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 10, Name = "trap_mission_set_gauge_ratio", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 11, Name = "trap_mission_failed", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 12, Name = "trap_mission_get_gauge_ratio", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 13, Name = "trap_mission_pause_timer", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 14, Name = "trap_mission_activate2d", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 15, Name = "trap_mission_deactivate2d", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 16, Name = "trap_mission_dead_boss", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 17, Name = "trap_mission_set_timer_param", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 4, TrapIndex = 18, Name = "trap_mission_set_count_param", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 4, TrapIndex = 19, Name = "trap_mission_set_gauge_param", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 4, TrapIndex = 20, Name = "trap_mission_decrement_count", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 21, Name = "trap_mission_is_activate2d", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 22, Name = "trap_mission_exit", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 23, Name = "trap_mission_reset_pause_mode", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 24, Name = "trap_mission_cancel_pause_timer", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 25, Name = "trap_mission_start_combo_counter", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 26, Name = "trap_mission_get_timer", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 27, Name = "trap_mission_stop_combo_counter", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 28, Name = "trap_mission_get_gauge_warning_ratio", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 29, Name = "trap_mission_get_count", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 30, Name = "trap_mission_get_max_combo_counter", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 31, Name = "trap_mission_get_combo_counter", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 32, Name = "trap_mission_return", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 33, Name = "trap_mission_add_combo_counter", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 34, Name = "trap_mission_is_gauge_warning", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 35, Name = "trap_score_type", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 36, Name = "trap_score_score", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 37, Name = "trap_score_update", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 4, TrapIndex = 38, Name = "trap_score_get", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 39, Name = "trap_mission_set_watch", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 40, Name = "trap_mission_get_timer_second", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 41, Name = "trap_mission_add_count", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 42, Name = "trap_struggle_increment", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 43, Name = "trap_mission_set_max_combo_counter", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 44, Name = "trap_mission_disable_count", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 45, Name = "trap_mission_disable_watch", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 46, Name = "trap_mission_set_warning_se", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 47, Name = "trap_mission_warning_timer", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 48, Name = "trap_mission_set_count_figure_num", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 4, TrapIndex = 49, Name = "trap_mission_disable_timer", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 50, Name = "trap_mission_warning_count", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 51, Name = "trap_mission_set_combo_counter_param", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 4, TrapIndex = 52, Name = "trap_mission_warning_combo_counter", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 4, TrapIndex = 53, Name = "trap_mission_set_combo_counter_warning_se", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 54, Name = "trap_mission_lock", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 55, Name = "trap_mission_is_lock", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 56, Name = "trap_event_continue_control_off", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 4, TrapIndex = 57, Name = "trap_mission_warning_gauge", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 4, TrapIndex = 58, Name = "trap_mission_reset_warning_count", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 0, Name = "trap_get_start_rtn_action", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 1, Name = "trap_set_path_way", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 2, Name = "trap_reverse_path_way", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 3, Name = "trap_get_path_dir", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 4, Name = "trap_end_rtn_action", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 5, Name = "trap_get_rtn_action", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 6, Name = "trap_get_rtn_action_dir", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 7, Name = "trap_is_rtn_change_dir", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 8, Name = "trap_create_active_path", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 9, Name = "trap_get_path_dir_from_obj", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 5, TrapIndex = 10, Name = "trap_forward_path_current_pointer", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 11, Name = "trap_is_end_rtn_action", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 12, Name = "trap_reset_active_path", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 13, Name = "trap_set_path_target_point", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 14, Name = "trap_get_path_point_pos", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 15, Name = "trap_clear_active_path", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 16, Name = "trap_reset_leave_way", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 17, Name = "trap_check_rtn_option_flag", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 18, Name = "trap_reset_path_current_pointer", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 19, Name = "trap_get_path_current_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 20, Name = "trap_get_path_current_dir", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 21, Name = "trap_get_path_first_point_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 22, Name = "trap_get_path_last_point_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 23, Name = "trap_set_path_by_id", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 24, Name = "trap_set_path_by_group", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 25, Name = "trap_get_path_dir_r", Flags = 0x40000003 },
- new BdxTrap { TableIndex = 5, TrapIndex = 26, Name = "trap_set_rtn_partner", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 27, Name = "trap_set_rtn_option_flag", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 28, Name = "trap_eh22_path_move_next", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 29, Name = "trap_eh22_path_move_before", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 30, Name = "trap_eh22_path_is_moving", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 31, Name = "trap_eh22_path_get_point", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 5, TrapIndex = 32, Name = "trap_eh22_path_play", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 5, TrapIndex = 33, Name = "trap_set_rtn_time_param", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 5, TrapIndex = 34, Name = "trap_get_obj_head_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 0, Name = "trap_camera_shake", Flags = 0x00000007 },
- new BdxTrap { TableIndex = 6, TrapIndex = 1, Name = "trap_prize_appear", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 2, Name = "trap_player_get_form", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 3, Name = "trap_target_searcher_init", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 4, Name = "trap_target_searcher_reset", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 5, Name = "trap_target_seracher_search", Flags = 0x00000007 },
- new BdxTrap { TableIndex = 6, TrapIndex = 6, Name = "trap_obj_stop", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 6, TrapIndex = 7, Name = "trap_obj_restart", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 8, Name = "trap_target_searcher_add", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 9, Name = "trap_target_dist", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 10, Name = "trap_obj_is_hit_attack", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 11, Name = "trap_target_searcher_search_obj", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 6, TrapIndex = 12, Name = "trap_target_searcher_get_old", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 6, TrapIndex = 13, Name = "trap_friend_force_warp", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 14, Name = "trap_friend_get", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 15, Name = "trap_friend_set_warp_level", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 16, Name = "trap_target_clear", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 17, Name = "trap_lockon_show", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 18, Name = "trap_lockon_hide", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 19, Name = "trap_status_peterpan_prize_drain_start", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 20, Name = "trap_status_peterpan_prize_drain_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 21, Name = "trap_target_searcher_add_target", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 22, Name = "trap_target_searcher_get_target_num", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 23, Name = "trap_obj_near_parts", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 24, Name = "trap_obj_get_bg_press", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 25, Name = "trap_obj_tt_ball_blow", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 26, Name = "trap_obj_limit_hover", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 27, Name = "trap_player_dice", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 28, Name = "trap_dice_set_spec", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 29, Name = "trap_player_card", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 30, Name = "trap_card_set_spec", Flags = 0x00000007 },
- new BdxTrap { TableIndex = 6, TrapIndex = 31, Name = "trap_limit_aladdin_prize_drain", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 6, TrapIndex = 32, Name = "trap_skateboard_ride", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 33, Name = "trap_skateboard_trick", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 6, TrapIndex = 34, Name = "trap_skateboard_trick_motion_push", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 6, TrapIndex = 35, Name = "trap_obj_attach_camera", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 36, Name = "trap_obj_detach_camera", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 37, Name = "trap_obj_is_attach_camera", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 38, Name = "trap_obj_limit_mulan_idle", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 39, Name = "trap_skateboard_ride_edge", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 40, Name = "trap_obj_limit_peterpan_idle", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 41, Name = "trap_skateboard_edge_jump", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 6, TrapIndex = 42, Name = "trap_obj_hop_direct", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 43, Name = "trap_command_limit_trinity_commbo_start", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 44, Name = "trap_obj_limit_riku_idle", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 45, Name = "trap_obj_hide_shadow", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 46, Name = "trap_obj_rc_stop_all", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 47, Name = "trap_obj_stop_end_all", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 48, Name = "trap_skateboardscore_add_count", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 49, Name = "trap_obj_is_stop", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 50, Name = "trap_obj_stop_start", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 51, Name = "trap_bghit_check_line", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 52, Name = "trap_bghit_get_normal", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 53, Name = "trap_bghit_is_hit", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 54, Name = "trap_bghit_get_cross_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 55, Name = "trap_bghit_get_kind", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 56, Name = "trap_target_set_group", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 57, Name = "trap_target_get_group", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 58, Name = "trap_obj_act_child_push", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 59, Name = "trap_xemnas_get_obj", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 60, Name = "trap_obj_set_stealth_color", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 6, TrapIndex = 61, Name = "trap_obj_is_hook", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 62, Name = "trap_obj_carpet_obj_idle", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 63, Name = "trap_obj_is_damage_motion", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 64, Name = "trap_obj_show_shadow", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 65, Name = "trap_obj_set_scissoring", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 66, Name = "trap_obj_clear_hitback", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 67, Name = "trap_obj_party_attack", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 68, Name = "trap_strike_raid_calc_xyzrot", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 69, Name = "trap_larxene_dead", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 6, TrapIndex = 70, Name = "trap_obj_play_se_loop", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 6, TrapIndex = 71, Name = "trap_obj_fadeout_se", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 0, Name = "trap_enemy_stop_all_start", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 1, Name = "trap_enemy_stop_all_end", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 2, Name = "trap_attack_hit_mark_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 3, Name = "trap_flare_init", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 4, Name = "trap_flare_new", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 5, Name = "trap_flare_free", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 6, Name = "trap_flare_set_pos", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 7, Name = "trap_flare_set_radius", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 7, TrapIndex = 8, Name = "trap_flare_set_effect", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 9, Name = "trap_flare_set_target", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 10, Name = "trap_flare_get_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 11, Name = "trap_flare_is_empty", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 12, Name = "trap_limit_aladdin_exclamation_mark_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 13, Name = "trap_magic_calc_speed", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 7, TrapIndex = 14, Name = "trap_attack_set_reaction_offset", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 15, Name = "trap_friend_get_target_size", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 16, Name = "trap_friend_get_current_action", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 17, Name = "trap_friend_set_script_status", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 18, Name = "trap_friend_get_main_status", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 19, Name = "trap_friend_update_target", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 21, Name = "trap_obj_limit_hover_set_spec", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 24, Name = "trap_friend_enable_system_wishdir", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 25, Name = "trap_friend_disable_system_wishdir", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 26, Name = "trap_friend_call", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 27, Name = "trap_limit_start_command", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 28, Name = "trap_trinity_shot_init", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 29, Name = "trap_trinity_shot_start", Flags = 0x40000004 },
- new BdxTrap { TableIndex = 7, TrapIndex = 30, Name = "trap_trinity_shot_ensure", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 31, Name = "trap_trinity_shot_set_effect_id", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 32, Name = "trap_vacuum_set_effective_range", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 33, Name = "trap_enemy_summon_entry", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 7, TrapIndex = 34, Name = "trap_attack_set_rc_owner", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 7, TrapIndex = 35, Name = "trap_summon_is_exec", Flags = 0x40000000 },
- new BdxTrap { TableIndex = 7, TrapIndex = 36, Name = "trap_limit_reset_hit_counter", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 8, TrapIndex = 0, Name = "trap_obj_target_radius", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 8, TrapIndex = 1, Name = "trap_player_push_ability_button", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 8, TrapIndex = 2, Name = "trap_obj_set_xyzrot", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 8, TrapIndex = 3, Name = "trap_special_last_xemnus_laser_start", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 8, TrapIndex = 4, Name = "trap_special_last_xemnus_laser_attack", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 8, TrapIndex = 5, Name = "trap_special_last_xemnus_laser_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 8, TrapIndex = 6, Name = "trap_special_last_xemnus_laser_optimize", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 8, TrapIndex = 7, Name = "trap_special_last_xemnus_laser_optimize_end", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 8, TrapIndex = 8, Name = "trap_camera_apply_inverse_pos", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 0, Name = "trap_empty_func", Flags = 0x00000000 },
- new BdxTrap { TableIndex = 10, TrapIndex = 1, Name = "trap_stitch_set_screen_position", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 2, Name = "trap_stitch_get_screen_position", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 3, Name = "trap_friend_start_limit", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 4, Name = "trap_friend_end_limit", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 5, Name = "trap_chickenlittle_get_shoot_target", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 6, Name = "trap_obj_set_special_command", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 7, Name = "trap_obj_reset_special_command", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 8, Name = "trap_friend_get_target_last_position", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 9, Name = "trap_genie_change_form", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 10, Name = "trap_genie_get_limit_command", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 11, Name = "trap_obj_set_stop_timer", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 10, TrapIndex = 12, Name = "trap_stitch_effect_start", Flags = 0x40000008 },
- new BdxTrap { TableIndex = 10, TrapIndex = 13, Name = "trap_stitch_shot_effect", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 14, Name = "trap_friend_set_target", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 10, TrapIndex = 15, Name = "trap_sysobj_motion_cont_push", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 10, TrapIndex = 16, Name = "trap_stitch_effect_kill", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 17, Name = "trap_sysobj_is_zako", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 18, Name = "trap_sysobj_is_boss", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 19, Name = "trap_sysobj_is_limit", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 20, Name = "trap_friend_follow_player", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 21, Name = "trap_friend_follow_enemy", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 22, Name = "trap_sysobj_is_blow", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 23, Name = "trap_enemy_is_attacked_from", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 24, Name = "tarp_friend_is_equiped_ability", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 25, Name = "trap_peterpan_receive_notify_player_target", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 26, Name = "trap_peterpan_accept_notify_player_target", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 27, Name = "trap_friend_enable_inertia", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 28, Name = "trap_friend_disable_inertia", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 29, Name = "trap_friend_use_item", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 10, TrapIndex = 30, Name = "trap_sysobj_is_finish_blow", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 31, Name = "trap_sysobj_is_summon", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 32, Name = "trap_stitch_move_request", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 33, Name = "trap_friend_get_player_attacker", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 34, Name = "trap_friend_remove_player_attacker", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 35, Name = "trap_friend_get_action_param", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 36, Name = "trap_friend_is_control", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 37, Name = "trap_friend_is_moveonly", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 38, Name = "trap_attack_is_finish", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 39, Name = "trap_friend_action_clear", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 40, Name = "trap_obj_is_motion_sync", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 41, Name = "trap_friend_start_leave", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 42, Name = "trap_friend_is_start_leave", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 43, Name = "trap_obj_set_use_mp", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 44, Name = "trap_obj_is_tornado", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 45, Name = "trap_sheet_get_drive_time", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 46, Name = "trap_friend_disable_follow_enemy", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 47, Name = "trap_friend_enable_follow_enemy", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 48, Name = "trap_friend_disable_follow_player", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 49, Name = "trap_friend_enable_follow_player", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 50, Name = "trap_sheet_get_mp", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 51, Name = "trap_chickenlittle_get_nearest_target", Flags = 0x00000004 },
- new BdxTrap { TableIndex = 10, TrapIndex = 52, Name = "trap_btlobj_is_reflect_motion", Flags = 0x40000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 53, Name = "trap_friend_add_watch_effect", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 54, Name = "trap_friend_is_effect_exist", Flags = 0x40000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 55, Name = "trap_target_searcher_set_check_hide_from_friend", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 56, Name = "trap_friend_invalidate_warp_point", Flags = 0x00000002 },
- new BdxTrap { TableIndex = 10, TrapIndex = 57, Name = "trap_friend_add_warp_point", Flags = 0x00000001 },
- new BdxTrap { TableIndex = 10, TrapIndex = 58, Name = "trap_friend_link_magic", Flags = 0x00000003 },
- new BdxTrap { TableIndex = 10, TrapIndex = 59, Name = "trap_chickenlittle_set_shoot_target", Flags = 0x00000002 },
-
- #endregion
- };
- }
-}
+using System.Collections.Generic;
+
+namespace OpenKh.Kh2.Bdx.Models
+{
+ public class BdxTraps
+ {
+ public static IEnumerable GetTraps() => _traps;
+
+ private static readonly BdxTrap[] _traps = new[]
+ {
+ #region Generated
+
+ new BdxTrap { TableIndex = 0, TrapIndex = 0, Name = "trap_puti", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 1, Name = "trap_putf", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 2, Name = "trap_puts", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 3, Name = "trap_frametime", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 4, Name = "trap_vector_add", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 5, Name = "trap_vector_sub", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 6, Name = "trap_vector_len", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 7, Name = "trap_vector_normalize", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 8, Name = "trap_vector_dump", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 9, Name = "trap_thread_start", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 11, Name = "trap_file_is_reading", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 12, Name = "trap_file_flush", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 13, Name = "trap_vector_roty", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 14, Name = "trap_progress_set_flag", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 15, Name = "trap_progress_check_flag", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 16, Name = "trap_random_get", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 17, Name = "trap_random_getf", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 18, Name = "trap_random_range", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 19, Name = "trap_worldflag_set", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 20, Name = "trap_worldflag_check", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 21, Name = "trap_vector_get_rot_xz", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 22, Name = "trap_abs", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 23, Name = "trap_absf", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 24, Name = "trap_stputi", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 25, Name = "trap_stputf", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 26, Name = "trap_stputs", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 27, Name = "func_system_set_game_speed", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 28, Name = "method_blur_init", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 29, Name = "method_blur_start", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 30, Name = "method_blur_stop", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 31, Name = "func_screen_whiteout", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 32, Name = "func_screen_whitein", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 35, Name = "method_vector_scale", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 36, Name = "trap_vector_mul", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 37, Name = "trap_vector_div", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 38, Name = "trap_effect_set_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 39, Name = "trap_effect_set_scale", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 40, Name = "trap_effect_set_rot", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 41, Name = "trap_effect_set_dir", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 42, Name = "trap_vector_atan_xz", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 43, Name = "trap_fixrad", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 44, Name = "trap_effect_loop_end", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 45, Name = "trap_vector_addf", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 46, Name = "trap_vector_homing", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 47, Name = "trap_memory_alloc", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 48, Name = "trap_memory_free", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 49, Name = "trap_effect_is_alive", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 50, Name = "trap_effect_is_active", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 51, Name = "trap_effect_kill", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 52, Name = "trap_effect_fadeout", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 53, Name = "trap_effect_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 54, Name = "trap_effect_dir", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 55, Name = "trap_timer_count_down", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 56, Name = "trap_timer_count_up", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 57, Name = "trap_saveflag_set", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 58, Name = "trap_saveflag_reset", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 59, Name = "trap_saveflag_check", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 60, Name = "trap_assert", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 61, Name = "trap_saveram_get_partram", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 62, Name = "trap_partram_set_item_max", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 63, Name = "trap_item_get", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 64, Name = "trap_sound_disable", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 65, Name = "trap_sound_play_system", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 66, Name = "trap_effect_pause", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 67, Name = "trap_effect_set_color", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 68, Name = "trap_vector_rotx", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 69, Name = "trap_menuflag_set", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 70, Name = "trap_progress_is_second", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 73, Name = "trap_menuflag_reset", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 74, Name = "trap_screen_show_picture", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 75, Name = "trap_saveram_set_weapon", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 76, Name = "trap_saveram_set_form_weapon", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 77, Name = "trap_screen_cross_fade", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 78, Name = "trap_vector_inter", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 79, Name = "trap_effect_add_dead_block", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 80, Name = "trap_pad_is_button", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 81, Name = "trap_pad_is_trigger", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 82, Name = "trap_vector_outer_product", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 83, Name = "trap_vector_rot", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 84, Name = "trap_vector_angle", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 85, Name = "trap_effect_loop_end_kill", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 86, Name = "trap_effect_set_type", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 87, Name = "trap_screen_fadeout", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 88, Name = "trap_screen_fadein", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 89, Name = "trap_menuflag_check", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 90, Name = "trap_vector_draw", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 91, Name = "trap_vector_inner_prodcut", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 92, Name = "trap_partram_add_attack", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 93, Name = "trap_partram_add_wisdom", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 94, Name = "trap_partram_add_defence", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 95, Name = "trap_partram_set_levelup_type", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 96, Name = "trap_partram_add_ap", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 97, Name = "trap_item_reduce", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 98, Name = "trap_saveram_set_form_ability", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 99, Name = "trap_partram_add_ability", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 100, Name = "trap_saveram_increment_friend_recov", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 101, Name = "trap_progress_is_secret_movie", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 102, Name = "trap_vector_to_angle", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 103, Name = "trap_progress_is_fm_secret_movie", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 0, TrapIndex = 104, Name = "trap_sound_set_bgse_volume", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 0, Name = "trap_sysobj_appear", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 1, Name = "trap_obj_set_rot", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 2, Name = "trap_sysobj_moveto", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 3, Name = "trap_sysobj_player", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 4, Name = "trap_obj_wish_dir", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 5, Name = "trap_act_table_init", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 6, Name = "trap_act_table_add", Flags = 0x0000000C },
+ new BdxTrap { TableIndex = 1, TrapIndex = 7, Name = "trap_obj_set_act_table", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 8, Name = "trap_obj_act_start", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 9, Name = "trap_obj_act_push", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 10, Name = "trap_obj_is_act_exec", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 11, Name = "trap_sysobj_motion_start", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 12, Name = "trap_sysobj_motion_change", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 13, Name = "trap_sysobj_motion_push", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 14, Name = "trap_sysobj_motion_is_end", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 15, Name = "trap_sysobj_motion_id", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 17, Name = "trap_obj_leave_force", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 18, Name = "trap_obj_attach", Flags = 0x00000006 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 19, Name = "trap_sysobj_fadeout", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 20, Name = "trap_sysobj_fadein", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 21, Name = "trap_obj_effect_start", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 22, Name = "trap_obj_effect_start_pos", Flags = 0x40000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 23, Name = "trap_area_world", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 24, Name = "trap_area_area", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 25, Name = "trap_area_map_set", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 26, Name = "trap_area_battle_set", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 27, Name = "trap_area_event_set", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 28, Name = "trap_obj_leave", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 29, Name = "trap_obj_motion_capture", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 30, Name = "trap_area_jump", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 31, Name = "trap_area_setjump", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 32, Name = "trap_message_open", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 33, Name = "trap_message_close", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 34, Name = "trap_event_is_exec", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 35, Name = "trap_area_init", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 36, Name = "trap_bg_hide", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 37, Name = "trap_bg_show", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 38, Name = "trap_obj_set_team", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 39, Name = "trap_obj_unit_arg", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 40, Name = "trap_obj_is_pirate_shade", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 41, Name = "trap_signal_call", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 42, Name = "func_obj_control_off", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 43, Name = "func_obj_control_on", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 44, Name = "func_history_clear_enemy", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 45, Name = "func_area_activate_unit", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 46, Name = "func_bg_barrier_on", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 47, Name = "func_bg_barrier_off", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 48, Name = "method_message_is_end", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 49, Name = "method_obj_enable_reaction_command", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 50, Name = "method_obj_disable_reaction_command", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 51, Name = "method_obj_reset_reaction_command", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 52, Name = "method_obj_enable_collision", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 53, Name = "method_obj_disable_collision", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 54, Name = "method_obj_reset_collision", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 55, Name = "method_obj_jump", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 56, Name = "method_obj_is_culling", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 57, Name = "trap_obj_is_jump", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 58, Name = "trap_obj_fly", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 59, Name = "trap_obj_is_fly", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 60, Name = "trap_obj_is_air", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 61, Name = "trap_sysobj_motion_frame_start", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 62, Name = "trap_obj_get_moved", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 63, Name = "trap_obj_is_motion_in_loop", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 64, Name = "trap_obj_get_wish_movement", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 65, Name = "trap_obj_exec_fall", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 66, Name = "trap_obj_exec_land", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 67, Name = "trap_obj_motion_get_length", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 68, Name = "trap_obj_motion_get_loop_top", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 69, Name = "trap_obj_motion_get_time", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 70, Name = "trap_obj_set_flag", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 71, Name = "trap_obj_reset_flag", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 72, Name = "trap_obj_check_flag", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 73, Name = "trap_obj_hover", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 74, Name = "trap_obj_idle", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 75, Name = "trap_obj_motion_hook", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 76, Name = "trap_obj_motion_unhook", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 77, Name = "trap_obj_motion_is_hook", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 78, Name = "trap_obj_motion_is_no_control", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 79, Name = "trap_obj_set_dir", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 80, Name = "trap_obj_turn_dir", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 81, Name = "trap_obj_act_wedge", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 82, Name = "trap_obj_thread_start", Flags = 0x40000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 83, Name = "trap_obj_apply_bone_matrix", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 84, Name = "trap_obj_sheet", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 85, Name = "trap_obj_texanm_start", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 86, Name = "trap_obj_texanm_stop", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 87, Name = "trap_obj_effect_start_bind", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 88, Name = "trap_obj_target_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 89, Name = "trap_obj_move_request", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 90, Name = "trap_obj_act_shout", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 91, Name = "trap_obj_star", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 92, Name = "trap_obj_scatter_prize", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 93, Name = "trap_sysobj_party", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 94, Name = "trap_sysobj_is_exist", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 95, Name = "trap_obj_fly_to_jump", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 96, Name = "trap_obj_get_action", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 97, Name = "trap_obj_spec", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 98, Name = "trap_obj_step_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 99, Name = "trap_obj_float_height", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 100, Name = "trap_obj_jump_height_to_uptime", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 101, Name = "trap_obj_motion_is_capture", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 102, Name = "trap_obj_detach", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 103, Name = "trap_obj_set_detach_callback", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 104, Name = "trap_obj_shadow_move_start", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 105, Name = "trap_obj_shadow_move_end", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 106, Name = "trap_signal_reserve_hp", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 107, Name = "trap_obj_motion_speed", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 108, Name = "trap_obj_show_part", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 109, Name = "trap_obj_hide_part", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 110, Name = "trap_obj_get_appear_way", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 111, Name = "trap_obj_set_movement", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 112, Name = "trap_obj_hook", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 113, Name = "trap_player_get_movement", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 114, Name = "trap_obj_search_by_entry", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 115, Name = "trap_obj_set_jump_motion", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 117, Name = "trap_command_cage_on", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 118, Name = "trap_command_cage_off", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 119, Name = "trap_obj_check_step", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 120, Name = "trap_target_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 121, Name = "trap_target_search", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 122, Name = "trap_obj_dump", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 123, Name = "trap_obj_tex_fade_set", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 124, Name = "trap_obj_is_entry_fly", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 125, Name = "trap_obj_tex_fade_start", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 126, Name = "trap_obj_motion_sync", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 127, Name = "trap_obj_act_clear", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 128, Name = "trap_obj_sysjump", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 129, Name = "trap_obj_blow", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 130, Name = "trap_obj_cmp", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 131, Name = "trap_target_dup", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 132, Name = "trap_target_free", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 133, Name = "trap_obj_hide", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 134, Name = "trap_obj_show", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 135, Name = "trap_bg_cross_pos", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 136, Name = "trap_bg_is_floor", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 137, Name = "trap_bg_get_normal", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 138, Name = "trap_pax_start", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 139, Name = "trap_pax_start_bind", Flags = 0x40000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 140, Name = "trap_target_is_exist", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 141, Name = "trap_bg_ground_pos", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 142, Name = "trap_signal_reserve_min_hp", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 143, Name = "trap_obj_search_by_serial", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 144, Name = "trap_obj_serial", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 145, Name = "trap_obj_touch_zone", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 146, Name = "trap_obj_hitback", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 147, Name = "trap_obj_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 148, Name = "trap_obj_set_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 149, Name = "trap_obj_effect_start_bind_other", Flags = 0x40000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 150, Name = "trap_obj_motion_check_range", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 151, Name = "trap_obj_motion_check_trigger", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 152, Name = "trap_status_is_mission", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 153, Name = "trap_obj_reset_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 154, Name = "trap_status_secure_mode_start", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 155, Name = "trap_obj_add_hp", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 156, Name = "trap_obj_hop", Flags = 0x00000007 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 157, Name = "trap_obj_camera_start", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 158, Name = "trap_bg_set_belt_conveyor", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 159, Name = "trap_bg_set_uvscroll_speed", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 160, Name = "trap_target_set_obj", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 161, Name = "trap_obj_is_attach", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 162, Name = "trap_target_set_before_player", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 163, Name = "trap_target_set_after_player", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 164, Name = "trap_obj_camera_start_global", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 165, Name = "trap_command_override", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 166, Name = "trap_target_attack", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 167, Name = "trap_obj_act_start_pri", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 168, Name = "trap_obj_flyjump", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 169, Name = "trap_obj_effect_unbind", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 170, Name = "trap_obj_unit_group", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 171, Name = "trap_status_no_leave", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 172, Name = "trap_obj_can_look", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 173, Name = "trap_obj_can_look_pos", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 174, Name = "trap_obj_look_start", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 175, Name = "trap_obj_look_start_pos", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 176, Name = "trap_obj_look_end", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 177, Name = "trap_obj_set_path", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 178, Name = "trap_obj_get_path_movement", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 179, Name = "trap_obj_set_fall_motion", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 180, Name = "trap_obj_set_land_motion", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 181, Name = "trap_light_create", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 182, Name = "trap_light_set_flag", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 183, Name = "trap_light_set_color", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 184, Name = "trap_light_fadeout", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 185, Name = "trap_obj_set_parts_color", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 186, Name = "trap_obj_reset_parts_color", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 187, Name = "trap_status_prize_drain_start", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 188, Name = "trap_status_prize_drain_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 189, Name = "trap_obj_history_mark", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 190, Name = "trap_obj_is_history_mark", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 191, Name = "trap_obj_lockon_target", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 192, Name = "trap_obj_is_motion_cancel", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 193, Name = "trap_camera_warp", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 194, Name = "trap_obj_set_stealth", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 195, Name = "trap_obj_reset_stealth", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 196, Name = "trap_area_entrance", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 197, Name = "trap_area_cost_rest", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 198, Name = "trap_obj_set_player_random_pos", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 199, Name = "trap_obj_set_random_pos", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 200, Name = "trap_obj_set_bg_collision_type", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 201, Name = "trap_obj_dir", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 202, Name = "trap_unit_disable", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 203, Name = "trap_unit_enable", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 204, Name = "trap_status_force_leave_start", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 205, Name = "trap_status_force_leave_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 206, Name = "trap_status_is_force_leave", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 207, Name = "trap_camera_watch", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 208, Name = "trap_obj_is_hover", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 209, Name = "trap_obj_dead", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 210, Name = "trap_obj_search_by_part", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 211, Name = "trap_obj_pattern_enable", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 212, Name = "trap_obj_pattern_disable", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 213, Name = "trap_obj_part", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 214, Name = "trap_obj_hook_stop", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 217, Name = "trap_obj_set_pos_trans", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 218, Name = "trap_obj_set_unit_arg", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 219, Name = "trap_obj_camera_start", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 220, Name = "trap_obj_move_to_space", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 221, Name = "trap_obj_can_decide_command", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 222, Name = "trap_obj_get_entry_id", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 223, Name = "trap_camera_cancel", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 224, Name = "trap_obj_is_action_air", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 225, Name = "trap_obj_is_star", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 226, Name = "trap_obj_scatter_prize_mu", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 227, Name = "trap_obj_jump_direct", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 228, Name = "trap_sheet_hp", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 229, Name = "trap_sheet_max_hp", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 230, Name = "trap_sheet_hp_rate", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 231, Name = "trap_sheet_set_min_hp", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 232, Name = "trap_sheet_min_hp", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 233, Name = "trap_sheet_set_hp", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 234, Name = "trap_party_get_weapon", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 235, Name = "trap_party_hand_to_bone", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 236, Name = "trap_obj_motion_unsync", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 237, Name = "trap_command_override_top", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 238, Name = "trap_obj_motion_capture_id", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 239, Name = "trap_obj_is_unit_active", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 240, Name = "trap_obj_scatter_prize_tt", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 241, Name = "trap_act_shout", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 242, Name = "trap_player_capture_form", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 243, Name = "trap_player_capture_form_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 244, Name = "trap_status_is_battle", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 245, Name = "trap_target_clear_before_player", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 246, Name = "trap_target_clear_after_player", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 247, Name = "trap_bg_get_random_pos", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 248, Name = "trap_bg_get_random_pos_air", Flags = 0x40000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 249, Name = "trap_status_set_prize_ratio", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 250, Name = "trap_status_set_lockon_ratio", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 251, Name = "trap_light_fadein", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 252, Name = "trap_camera_apply_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 253, Name = "trap_obj_can_capture_control", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 254, Name = "trap_obj_is_ride", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 255, Name = "trap_obj_disable_occ", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 256, Name = "trap_obj_enable_occ", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 257, Name = "trap_light_set_fog_near", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 258, Name = "trap_light_set_fog_far", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 259, Name = "trap_light_set_fog_min", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 260, Name = "trap_light_set_fog_max", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 261, Name = "trap_sheet_munny", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 262, Name = "trap_obj_voice", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 263, Name = "trap_player_set_exec_rc", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 264, Name = "trap_status_secure_mode_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 265, Name = "trap_obj_set_medal", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 266, Name = "trap_obj_get_medal", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 267, Name = "trap_obj_scatter_medal", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 268, Name = "trap_obj_action_lightcycle", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 269, Name = "trap_obj_get_lightcycle_movement", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 270, Name = "trap_obj_motion_disable_anmatr_effect", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 271, Name = "trap_obj_motion_enable_anmatr_effect", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 272, Name = "trap_obj_is_dead", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 273, Name = "trap_signal_hook", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 274, Name = "trap_event_get_rest_time", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 275, Name = "trap_obj_recov_holylight", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 276, Name = "trap_obj_use_mp", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 277, Name = "trap_obj_reraise", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 278, Name = "trap_obj_scatter_prize_tr", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 279, Name = "trap_prize_appear_tr", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 280, Name = "trap_sheet_add_munny", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 281, Name = "trap_camera_begin_scope", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 283, Name = "trap_camera_end_scope", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 284, Name = "trap_tutorial_pause", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 285, Name = "trap_obj_show_picture", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 286, Name = "trap_status_hide_shadow", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 287, Name = "trap_status_show_shadow", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 288, Name = "trap_status_begin_free_ability", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 289, Name = "trap_status_end_free_ability", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 290, Name = "trap_picture_change", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 291, Name = "trap_obj_levelup_unit", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 292, Name = "trap_obj_search_by_unit_arg", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 293, Name = "trap_event_control_off", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 294, Name = "trap_event_control_on", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 295, Name = "trap_camera_reset", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 296, Name = "trap_tutorial_open", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 297, Name = "trap_player_get_rc", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 298, Name = "trap_worldwork_get", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 299, Name = "trap_area_set_next_entrance", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 300, Name = "trap_prize_num", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 301, Name = "trap_tutorial_is_open", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 302, Name = "trap_obj_set_skateboard_mode", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 303, Name = "trap_area_cost_ratio", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 304, Name = "trap_obj_search_by_glance", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 305, Name = "trap_camera_eye", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 306, Name = "trap_camera_at", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 307, Name = "trap_obj_search_by_camera", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 308, Name = "trap_obj_capture_command", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 309, Name = "trap_sysobj_is_player", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 310, Name = "trap_obj_get_weight", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 311, Name = "trap_sheet_set_element_rate", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 312, Name = "trap_camera_set_scope_zoom", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 313, Name = "trap_camera_set_scope_closeup_distance", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 314, Name = "trap_camera_set_scope_target_pos", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 315, Name = "trap_picture_set_pos", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 316, Name = "trap_camera_get_projection_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 317, Name = "trap_status_no_gameover", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 318, Name = "trap_obj_play_se", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 319, Name = "trap_sysobj_is_sora", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 320, Name = "trap_unit_get_enemy_num", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 321, Name = "trap_player_lockon", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 322, Name = "trap_command_enable_item", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 323, Name = "trap_obj_count_entry", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 324, Name = "trap_obj_pattern_reset", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 325, Name = "trap_obj_reaction_callback", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 326, Name = "trap_bg_set_animation_speed", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 327, Name = "trap_prize_get_all_tr", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 328, Name = "trap_obj_dead_mark", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 329, Name = "trap_sheet_set_prize_range", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 330, Name = "trap_obj_set_cannon_camera_offset", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 331, Name = "trap_obj_each_all", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 332, Name = "trap_sysobj_is_btlnpc", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 333, Name = "trap_obj_set_cannon_param", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 334, Name = "trap_command_enable", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 335, Name = "trap_obj_disable_occ_bone", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 336, Name = "trap_obj_enable_occ_bone", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 337, Name = "trap_command_set_side_b", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 338, Name = "trap_prize_return_ca", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 339, Name = "trap_prize_vacuum_ca", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 340, Name = "trap_prize_vacuum_range_ca", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 341, Name = "trap_prize_num_ca", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 342, Name = "trap_prize_appear_num", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 343, Name = "trap_obj_is_equip_ability", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 344, Name = "trap_obj_clear_occ", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 345, Name = "trap_command_override_slot", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 346, Name = "trap_command_slot_set_status", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 347, Name = "trap_obj_can_see", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 348, Name = "trap_sheet_set_hitback_addition", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 349, Name = "trap_obj_effect_kill_all", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 350, Name = "trap_status_close_pete_curtain", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 351, Name = "trap_status_open_pete_curtain", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 352, Name = "trap_area_set_return_tr", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 353, Name = "trap_obj_start_mpdrive", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 354, Name = "trap_event_layer_off", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 355, Name = "trap_player_can_capture_form", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 356, Name = "trap_event_layer_on", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 357, Name = "trap_sheet_attack_level", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 358, Name = "trap_sheet_set_attack_level", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 359, Name = "trap_obj_hook_command_image", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 360, Name = "trap_obj_reset_command_image", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 361, Name = "trap_sheet_level", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 362, Name = "trap_treasure_get", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 363, Name = "trap_prize_appear_xaldin", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 364, Name = "trap_jigsaw_get", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 365, Name = "trap_command_disable_group", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 366, Name = "trap_command_enable_group", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 1, TrapIndex = 367, Name = "trap_obj_get_move_to_space_pos", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 0, Name = "trap_enemy_exec_damage", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 1, Name = "trap_enemy_exec_damage_blow", Flags = 0x00000006 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 2, Name = "trap_enemy_exec_damage_small", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 3, Name = "trap_enemy_exec_damage_hitback", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 4, Name = "trap_enemy_each", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 5, Name = "trap_enemy_is_no_control", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 6, Name = "trap_enemy_is_damage_motion", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 7, Name = "trap_damage_reaction", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 8, Name = "trap_damage_is_reaction", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 9, Name = "trap_btlobj_set_sheet", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 10, Name = "trap_attack_new", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 11, Name = "trap_attack_set_radius", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 12, Name = "trap_attack_set_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 13, Name = "trap_attack_free", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 14, Name = "trap_attack_is_hit", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 15, Name = "trap_damage_exec_reaction", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 16, Name = "trap_damage_is_exec_reaction", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 17, Name = "trap_attack_strike", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 18, Name = "trap_attack_is_strike", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 19, Name = "trap_attack_set_line", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 20, Name = "trap_magic_start_thread", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 21, Name = "trap_teamwork_alloc", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 22, Name = "trap_attack_set_obj_pax", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 23, Name = "trap_btlobj_target", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 24, Name = "trap_attack_get_owner", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 25, Name = "trap_attack_get_param_id", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 26, Name = "trap_attack_exec_reflect", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 27, Name = "trap_enemy_exec_reflect", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 28, Name = "trap_attack_refresh", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 29, Name = "trap_attack_is_hit_bg", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 30, Name = "trap_attack_set_pax", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 31, Name = "trap_attack_dup", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 32, Name = "trap_damage_blow_up", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 33, Name = "trap_damage_blow_speed", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 34, Name = "trap_attack_get_type", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 35, Name = "trap_damage_attack_type", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 36, Name = "trap_enemy_add_damage", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 37, Name = "trap_attack_set_team", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 38, Name = "trap_attack_set_hit_callback", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 39, Name = "trap_attack_is_reflect", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 40, Name = "trap_attack_is_hit_wall", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 41, Name = "trap_attack_is_hit_floor", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 42, Name = "trap_attack_hit_bg_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 43, Name = "trap_attack_get_reflect_vector", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 44, Name = "trap_attack_reflecter", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 45, Name = "trap_damage_attack_param_id", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 46, Name = "trap_damage_damage", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 47, Name = "trap_limit_motion_start", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 48, Name = "trap_limit_player", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 49, Name = "trap_limit_friend", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 50, Name = "trap_limit_camera_start", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 51, Name = "trap_attack_set_rc", Flags = 0x00000005 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 52, Name = "trap_attack_rc_receiver", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 53, Name = "trap_enemy_last_dead", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 54, Name = "trap_limit_start_thread", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 55, Name = "trap_limit_light", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 56, Name = "trap_btlobj_lockon_target", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 57, Name = "trap_limit_effect_start", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 58, Name = "trap_limit_effect_start_pos", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 59, Name = "trap_limit_effect_start_bind", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 60, Name = "trap_limit_time", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 61, Name = "trap_attack_set_effect", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 62, Name = "trap_attack_set_time", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 63, Name = "trap_limit_reference", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 64, Name = "trap_damage_orig_reaction", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 65, Name = "trap_enemy_count_damager", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 66, Name = "trap_attack_get_reflect_count", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 67, Name = "trap_attack_new_combo_group", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 68, Name = "trap_magic_set_cost", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 69, Name = "trap_magic_can_add_cost", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 70, Name = "trap_damage_parts", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 71, Name = "trap_attack_set_hitmark_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 72, Name = "trap_damage_is_cure", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 73, Name = "trap_bonuslevel_up", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 74, Name = "trap_attack_set_reflect_callback", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 75, Name = "trap_summon_is_tink_exist", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 76, Name = "trap_enemy_set_karma_limit", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 77, Name = "trap_vacuum_create", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 78, Name = "trap_vacuum_destroy", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 79, Name = "trap_vacuum_set_ignore_type", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 80, Name = "trap_vacuum_set_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 81, Name = "trap_vacuum_set_speed", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 82, Name = "trap_vacuum_set_rot_speed", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 83, Name = "trap_vacuum_set_near_range", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 84, Name = "trap_vacuum_set_dist_rate", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 85, Name = "trap_damage_element", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 86, Name = "trap_damage_get_hitback", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 87, Name = "trap_enemy_exec_damage_large", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 88, Name = "trap_enemy_get_attacker", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 89, Name = "trap_limit_reset_special_command", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 90, Name = "trap_limit_close_gauge", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 91, Name = "trap_damage_get_reaction_type", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 92, Name = "trap_damage_is_finish", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 93, Name = "trap_damage_is_normal", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 94, Name = "trap_attack_set_system_pax", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 95, Name = "trap_btlobj_dup_sheet", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 96, Name = "trap_attack_is_valid", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 2, TrapIndex = 97, Name = "trap_enemy_set_attacker", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 2, Name = "trap_event_is_exec", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 3, Name = "trap_mission_complete", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 4, Name = "trap_mission_information", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 5, Name = "trap_mission_set_count", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 6, Name = "trap_mission_increment_count", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 7, Name = "trap_mission_restart_timer", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 8, Name = "trap_mission_set_gauge", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 9, Name = "trap_mission_add_gauge", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 10, Name = "trap_mission_set_gauge_ratio", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 11, Name = "trap_mission_failed", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 12, Name = "trap_mission_get_gauge_ratio", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 13, Name = "trap_mission_pause_timer", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 14, Name = "trap_mission_activate2d", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 15, Name = "trap_mission_deactivate2d", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 16, Name = "trap_mission_dead_boss", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 17, Name = "trap_mission_set_timer_param", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 18, Name = "trap_mission_set_count_param", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 19, Name = "trap_mission_set_gauge_param", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 20, Name = "trap_mission_decrement_count", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 21, Name = "trap_mission_is_activate2d", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 22, Name = "trap_mission_exit", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 23, Name = "trap_mission_reset_pause_mode", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 24, Name = "trap_mission_cancel_pause_timer", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 25, Name = "trap_mission_start_combo_counter", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 26, Name = "trap_mission_get_timer", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 27, Name = "trap_mission_stop_combo_counter", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 28, Name = "trap_mission_get_gauge_warning_ratio", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 29, Name = "trap_mission_get_count", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 30, Name = "trap_mission_get_max_combo_counter", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 31, Name = "trap_mission_get_combo_counter", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 32, Name = "trap_mission_return", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 33, Name = "trap_mission_add_combo_counter", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 34, Name = "trap_mission_is_gauge_warning", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 35, Name = "trap_score_type", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 36, Name = "trap_score_score", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 37, Name = "trap_score_update", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 38, Name = "trap_score_get", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 39, Name = "trap_mission_set_watch", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 40, Name = "trap_mission_get_timer_second", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 41, Name = "trap_mission_add_count", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 42, Name = "trap_struggle_increment", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 43, Name = "trap_mission_set_max_combo_counter", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 44, Name = "trap_mission_disable_count", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 45, Name = "trap_mission_disable_watch", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 46, Name = "trap_mission_set_warning_se", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 47, Name = "trap_mission_warning_timer", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 48, Name = "trap_mission_set_count_figure_num", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 49, Name = "trap_mission_disable_timer", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 50, Name = "trap_mission_warning_count", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 51, Name = "trap_mission_set_combo_counter_param", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 52, Name = "trap_mission_warning_combo_counter", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 53, Name = "trap_mission_set_combo_counter_warning_se", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 54, Name = "trap_mission_lock", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 55, Name = "trap_mission_is_lock", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 56, Name = "trap_event_continue_control_off", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 57, Name = "trap_mission_warning_gauge", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 4, TrapIndex = 58, Name = "trap_mission_reset_warning_count", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 0, Name = "trap_get_start_rtn_action", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 1, Name = "trap_set_path_way", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 2, Name = "trap_reverse_path_way", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 3, Name = "trap_get_path_dir", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 4, Name = "trap_end_rtn_action", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 5, Name = "trap_get_rtn_action", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 6, Name = "trap_get_rtn_action_dir", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 7, Name = "trap_is_rtn_change_dir", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 8, Name = "trap_create_active_path", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 9, Name = "trap_get_path_dir_from_obj", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 10, Name = "trap_forward_path_current_pointer", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 11, Name = "trap_is_end_rtn_action", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 12, Name = "trap_reset_active_path", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 13, Name = "trap_set_path_target_point", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 14, Name = "trap_get_path_point_pos", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 15, Name = "trap_clear_active_path", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 16, Name = "trap_reset_leave_way", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 17, Name = "trap_check_rtn_option_flag", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 18, Name = "trap_reset_path_current_pointer", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 19, Name = "trap_get_path_current_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 20, Name = "trap_get_path_current_dir", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 21, Name = "trap_get_path_first_point_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 22, Name = "trap_get_path_last_point_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 23, Name = "trap_set_path_by_id", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 24, Name = "trap_set_path_by_group", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 25, Name = "trap_get_path_dir_r", Flags = 0x40000003 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 26, Name = "trap_set_rtn_partner", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 27, Name = "trap_set_rtn_option_flag", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 28, Name = "trap_eh22_path_move_next", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 29, Name = "trap_eh22_path_move_before", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 30, Name = "trap_eh22_path_is_moving", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 31, Name = "trap_eh22_path_get_point", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 32, Name = "trap_eh22_path_play", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 33, Name = "trap_set_rtn_time_param", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 5, TrapIndex = 34, Name = "trap_get_obj_head_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 0, Name = "trap_camera_shake", Flags = 0x00000007 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 1, Name = "trap_prize_appear", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 2, Name = "trap_player_get_form", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 3, Name = "trap_target_searcher_init", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 4, Name = "trap_target_searcher_reset", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 5, Name = "trap_target_seracher_search", Flags = 0x00000007 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 6, Name = "trap_obj_stop", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 7, Name = "trap_obj_restart", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 8, Name = "trap_target_searcher_add", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 9, Name = "trap_target_dist", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 10, Name = "trap_obj_is_hit_attack", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 11, Name = "trap_target_searcher_search_obj", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 12, Name = "trap_target_searcher_get_old", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 13, Name = "trap_friend_force_warp", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 14, Name = "trap_friend_get", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 15, Name = "trap_friend_set_warp_level", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 16, Name = "trap_target_clear", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 17, Name = "trap_lockon_show", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 18, Name = "trap_lockon_hide", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 19, Name = "trap_status_peterpan_prize_drain_start", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 20, Name = "trap_status_peterpan_prize_drain_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 21, Name = "trap_target_searcher_add_target", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 22, Name = "trap_target_searcher_get_target_num", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 23, Name = "trap_obj_near_parts", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 24, Name = "trap_obj_get_bg_press", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 25, Name = "trap_obj_tt_ball_blow", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 26, Name = "trap_obj_limit_hover", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 27, Name = "trap_player_dice", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 28, Name = "trap_dice_set_spec", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 29, Name = "trap_player_card", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 30, Name = "trap_card_set_spec", Flags = 0x00000007 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 31, Name = "trap_limit_aladdin_prize_drain", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 32, Name = "trap_skateboard_ride", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 33, Name = "trap_skateboard_trick", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 34, Name = "trap_skateboard_trick_motion_push", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 35, Name = "trap_obj_attach_camera", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 36, Name = "trap_obj_detach_camera", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 37, Name = "trap_obj_is_attach_camera", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 38, Name = "trap_obj_limit_mulan_idle", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 39, Name = "trap_skateboard_ride_edge", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 40, Name = "trap_obj_limit_peterpan_idle", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 41, Name = "trap_skateboard_edge_jump", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 42, Name = "trap_obj_hop_direct", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 43, Name = "trap_command_limit_trinity_commbo_start", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 44, Name = "trap_obj_limit_riku_idle", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 45, Name = "trap_obj_hide_shadow", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 46, Name = "trap_obj_rc_stop_all", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 47, Name = "trap_obj_stop_end_all", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 48, Name = "trap_skateboardscore_add_count", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 49, Name = "trap_obj_is_stop", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 50, Name = "trap_obj_stop_start", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 51, Name = "trap_bghit_check_line", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 52, Name = "trap_bghit_get_normal", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 53, Name = "trap_bghit_is_hit", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 54, Name = "trap_bghit_get_cross_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 55, Name = "trap_bghit_get_kind", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 56, Name = "trap_target_set_group", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 57, Name = "trap_target_get_group", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 58, Name = "trap_obj_act_child_push", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 59, Name = "trap_xemnas_get_obj", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 60, Name = "trap_obj_set_stealth_color", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 61, Name = "trap_obj_is_hook", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 62, Name = "trap_obj_carpet_obj_idle", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 63, Name = "trap_obj_is_damage_motion", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 64, Name = "trap_obj_show_shadow", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 65, Name = "trap_obj_set_scissoring", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 66, Name = "trap_obj_clear_hitback", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 67, Name = "trap_obj_party_attack", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 68, Name = "trap_strike_raid_calc_xyzrot", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 69, Name = "trap_larxene_dead", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 70, Name = "trap_obj_play_se_loop", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 6, TrapIndex = 71, Name = "trap_obj_fadeout_se", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 0, Name = "trap_enemy_stop_all_start", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 1, Name = "trap_enemy_stop_all_end", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 2, Name = "trap_attack_hit_mark_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 3, Name = "trap_flare_init", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 4, Name = "trap_flare_new", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 5, Name = "trap_flare_free", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 6, Name = "trap_flare_set_pos", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 7, Name = "trap_flare_set_radius", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 8, Name = "trap_flare_set_effect", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 9, Name = "trap_flare_set_target", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 10, Name = "trap_flare_get_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 11, Name = "trap_flare_is_empty", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 12, Name = "trap_limit_aladdin_exclamation_mark_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 13, Name = "trap_magic_calc_speed", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 14, Name = "trap_attack_set_reaction_offset", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 15, Name = "trap_friend_get_target_size", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 16, Name = "trap_friend_get_current_action", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 17, Name = "trap_friend_set_script_status", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 18, Name = "trap_friend_get_main_status", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 19, Name = "trap_friend_update_target", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 21, Name = "trap_obj_limit_hover_set_spec", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 24, Name = "trap_friend_enable_system_wishdir", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 25, Name = "trap_friend_disable_system_wishdir", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 26, Name = "trap_friend_call", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 27, Name = "trap_limit_start_command", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 28, Name = "trap_trinity_shot_init", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 29, Name = "trap_trinity_shot_start", Flags = 0x40000004 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 30, Name = "trap_trinity_shot_ensure", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 31, Name = "trap_trinity_shot_set_effect_id", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 32, Name = "trap_vacuum_set_effective_range", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 33, Name = "trap_enemy_summon_entry", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 34, Name = "trap_attack_set_rc_owner", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 35, Name = "trap_summon_is_exec", Flags = 0x40000000 },
+ new BdxTrap { TableIndex = 7, TrapIndex = 36, Name = "trap_limit_reset_hit_counter", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 0, Name = "trap_obj_target_radius", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 1, Name = "trap_player_push_ability_button", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 2, Name = "trap_obj_set_xyzrot", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 3, Name = "trap_special_last_xemnus_laser_start", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 4, Name = "trap_special_last_xemnus_laser_attack", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 5, Name = "trap_special_last_xemnus_laser_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 6, Name = "trap_special_last_xemnus_laser_optimize", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 7, Name = "trap_special_last_xemnus_laser_optimize_end", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 8, TrapIndex = 8, Name = "trap_camera_apply_inverse_pos", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 0, Name = "trap_empty_func", Flags = 0x00000000 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 1, Name = "trap_stitch_set_screen_position", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 2, Name = "trap_stitch_get_screen_position", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 3, Name = "trap_friend_start_limit", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 4, Name = "trap_friend_end_limit", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 5, Name = "trap_chickenlittle_get_shoot_target", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 6, Name = "trap_obj_set_special_command", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 7, Name = "trap_obj_reset_special_command", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 8, Name = "trap_friend_get_target_last_position", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 9, Name = "trap_genie_change_form", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 10, Name = "trap_genie_get_limit_command", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 11, Name = "trap_obj_set_stop_timer", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 12, Name = "trap_stitch_effect_start", Flags = 0x40000008 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 13, Name = "trap_stitch_shot_effect", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 14, Name = "trap_friend_set_target", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 15, Name = "trap_sysobj_motion_cont_push", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 16, Name = "trap_stitch_effect_kill", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 17, Name = "trap_sysobj_is_zako", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 18, Name = "trap_sysobj_is_boss", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 19, Name = "trap_sysobj_is_limit", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 20, Name = "trap_friend_follow_player", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 21, Name = "trap_friend_follow_enemy", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 22, Name = "trap_sysobj_is_blow", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 23, Name = "trap_enemy_is_attacked_from", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 24, Name = "tarp_friend_is_equiped_ability", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 25, Name = "trap_peterpan_receive_notify_player_target", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 26, Name = "trap_peterpan_accept_notify_player_target", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 27, Name = "trap_friend_enable_inertia", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 28, Name = "trap_friend_disable_inertia", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 29, Name = "trap_friend_use_item", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 30, Name = "trap_sysobj_is_finish_blow", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 31, Name = "trap_sysobj_is_summon", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 32, Name = "trap_stitch_move_request", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 33, Name = "trap_friend_get_player_attacker", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 34, Name = "trap_friend_remove_player_attacker", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 35, Name = "trap_friend_get_action_param", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 36, Name = "trap_friend_is_control", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 37, Name = "trap_friend_is_moveonly", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 38, Name = "trap_attack_is_finish", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 39, Name = "trap_friend_action_clear", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 40, Name = "trap_obj_is_motion_sync", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 41, Name = "trap_friend_start_leave", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 42, Name = "trap_friend_is_start_leave", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 43, Name = "trap_obj_set_use_mp", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 44, Name = "trap_obj_is_tornado", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 45, Name = "trap_sheet_get_drive_time", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 46, Name = "trap_friend_disable_follow_enemy", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 47, Name = "trap_friend_enable_follow_enemy", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 48, Name = "trap_friend_disable_follow_player", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 49, Name = "trap_friend_enable_follow_player", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 50, Name = "trap_sheet_get_mp", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 51, Name = "trap_chickenlittle_get_nearest_target", Flags = 0x00000004 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 52, Name = "trap_btlobj_is_reflect_motion", Flags = 0x40000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 53, Name = "trap_friend_add_watch_effect", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 54, Name = "trap_friend_is_effect_exist", Flags = 0x40000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 55, Name = "trap_target_searcher_set_check_hide_from_friend", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 56, Name = "trap_friend_invalidate_warp_point", Flags = 0x00000002 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 57, Name = "trap_friend_add_warp_point", Flags = 0x00000001 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 58, Name = "trap_friend_link_magic", Flags = 0x00000003 },
+ new BdxTrap { TableIndex = 10, TrapIndex = 59, Name = "trap_chickenlittle_set_shoot_target", Flags = 0x00000002 },
+
+ #endregion
+ };
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Utils/BdxAsciiModel.cs b/OpenKh.Kh2/Bdx/Utils/BdxAsciiModel.cs
similarity index 94%
rename from OpenKh.Command.Bdxio/Utils/BdxAsciiModel.cs
rename to OpenKh.Kh2/Bdx/Utils/BdxAsciiModel.cs
index 6802fae90..9c156cd96 100644
--- a/OpenKh.Command.Bdxio/Utils/BdxAsciiModel.cs
+++ b/OpenKh.Kh2/Bdx/Utils/BdxAsciiModel.cs
@@ -1,42 +1,45 @@
-namespace OpenKh.Command.Bdxio.Utils
-{
- public class BdxAsciiModel
- {
- public bool IsEmpty { get; set; }
-
- public string? Header { get; set; }
- public string? Script { get; set; }
-
- public int FirstHeaderLineNumber { get; set; }
- public int FirstScriptLineNumber { get; set; }
-
- public string GetLineNumberRetainedScriptBody() => new string('\n', FirstScriptLineNumber) + Script;
-
- public static BdxAsciiModel ParseText(string body)
- {
- var lines = body.Replace("\r\n", "\n").Split('\n');
- int separator1 = Array.IndexOf(lines, "---");
- if (separator1 < 0)
- {
- throw new InvalidDataException();
- }
- int separator2 = Array.IndexOf(lines, "---", separator1 + 1);
- if (separator2 < 0)
- {
- throw new InvalidDataException();
- }
-
- var header = string.Join("\n", lines, separator1 + 1, separator2 - separator1 - 1);
- var script = string.Join("\n", lines.Skip(separator2 + 1));
-
- return new BdxAsciiModel
- {
- FirstHeaderLineNumber = 1 + separator1,
- FirstScriptLineNumber = 1 + separator2,
- IsEmpty = header.Trim().Length == 0 && script.Trim().Length == 0,
- Header = header,
- Script = script,
- };
- }
- }
-}
+using System;
+using System.IO;
+
+namespace OpenKh.Kh2.Bdx.Utils
+{
+ public class BdxAsciiModel
+ {
+ public bool IsEmpty { get; set; }
+
+ public string? Header { get; set; }
+ public string? Script { get; set; }
+
+ public int FirstHeaderLineNumber { get; set; }
+ public int FirstScriptLineNumber { get; set; }
+
+ public string GetLineNumberRetainedScriptBody() => new string('\n', FirstScriptLineNumber) + Script;
+
+ public static BdxAsciiModel ParseText(string body)
+ {
+ var lines = body.Replace("\r\n", "\n").Split('\n');
+ int separator1 = Array.IndexOf(lines, "---");
+ if (separator1 < 0)
+ {
+ throw new InvalidDataException();
+ }
+ int separator2 = Array.IndexOf(lines, "---", separator1 + 1);
+ if (separator2 < 0)
+ {
+ throw new InvalidDataException();
+ }
+
+ var header = string.Join("\n", lines, separator1 + 1, separator2 - separator1 - 1);
+ var script = string.Join("\n", lines.Skip(separator2 + 1));
+
+ return new BdxAsciiModel
+ {
+ FirstHeaderLineNumber = 1 + separator1,
+ FirstScriptLineNumber = 1 + separator2,
+ IsEmpty = header.Trim().Length == 0 && script.Trim().Length == 0,
+ Header = header,
+ Script = script,
+ };
+ }
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Utils/BdxDecoder.cs b/OpenKh.Kh2/Bdx/Utils/BdxDecoder.cs
similarity index 96%
rename from OpenKh.Command.Bdxio/Utils/BdxDecoder.cs
rename to OpenKh.Kh2/Bdx/Utils/BdxDecoder.cs
index 7782ab888..af6a22c85 100644
--- a/OpenKh.Command.Bdxio/Utils/BdxDecoder.cs
+++ b/OpenKh.Kh2/Bdx/Utils/BdxDecoder.cs
@@ -1,804 +1,808 @@
-using OpenKh.Command.Bdxio.Models;
-using OpenKh.Common;
-using System.Globalization;
-using System.Text;
-using Xe.BinaryMapper;
-using YamlDotNet.Serialization;
-using static OpenKh.Command.Bdxio.Models.BdxHeader;
-
-namespace OpenKh.Command.Bdxio.Utils
-{
- public class BdxDecoder
- {
- public BdxHeader Header { get; }
-
- public IDictionary AddressAnnotated { get; }
- public IDictionary AddressLabels { get; }
- public IDictionary AddressComments { get; }
- public IDictionary AddressCodeComments { get; }
- public IDictionary WorkLabels { get; }
- public string TopComment { get; set; }
-
- public BdxDecoder(Stream read, int[]? codeLabels = null, bool codeRevealer = false, bool codeRevealerLabeling = false)
- {
- if (read.Length == 0)
- {
- Header = new BdxHeader { IsEmpty = true };
- AddressAnnotated = new Dictionary();
- AddressLabels = new Dictionary();
- AddressComments = new Dictionary();
- AddressCodeComments = new Dictionary();
- WorkLabels = new Dictionary();
- TopComment = "";
- return;
- }
-
- Header = BinaryMapping.ReadObject(read);
-
- var triggers = new List();
- while (true)
- {
- var one = BinaryMapping.ReadObject(read);
- if (one.Key == 0 && one.Addr == 0)
- {
- break;
- }
- triggers.Add(one);
- }
-
- int firstAddr = (12 + 8 * (triggers.Count + 1)) / 2;
-
- var addrAnnotated = new SortedDictionary();
- var addrLabels = new SortedDictionary();
- var addrComments = new SortedDictionary();
- var addrCodeComments = new SortedDictionary();
- var workLabels = new SortedDictionary();
- var topComment = "";
-
- void AddAddr(int entry, string label)
- {
- if (addrLabels.TryGetValue(entry, out string? existing) && existing != null)
- {
- addrLabels[entry] = string.Join(",", existing.Split(',').Append(label).Distinct());
- }
- else
- {
- addrLabels[entry] = label;
- }
- }
-
- void Walk(int entry)
- {
- var topAddr = entry;
-
- while (true)
- {
- var needClearance = false;
-
- if (addrAnnotated.TryGetValue(entry, out var annotHere))
- {
- if (annotHere is IndeterminateContent)
- {
- needClearance = true;
- }
- else
- {
- return;
- }
- }
-
- var newPos = 16 + 2 * entry;
- if (read.Length <= newPos)
- {
- // bug?
- break;
- }
-
- read.Position = newPos;
- var codeWord = read.ReadUInt16();
-
- var desc = BdxInstructionDescs.FindByCode(codeWord);
- if (desc == null)
- {
- break;
- }
-
- var code = new CodeContent(desc);
-
- if (needClearance)
- {
- var overrideDetected = false;
- int x = 1;
- for (; x < desc.CodeSize; x++)
- {
- if (true
- && addrAnnotated.TryGetValue(entry + x, out var codePartHit)
- && codePartHit is not IndeterminateContent
- )
- {
- overrideDetected = true;
- break;
- }
-
- if (addrLabels.TryGetValue(entry + x, out var codePartLabels))
- {
- overrideDetected = true;
- break;
- }
- }
- if (overrideDetected)
- {
- addrComments[entry] = $"Although L{entry + x} is in IndeterminateContent area (L{entry} to L{entry + desc.CodeSize - 1}), there is a collision with text data? Maybe codeRevealer problem. Possibly need more better bottom text pool detection.";
- break;
- }
- }
-
- addrAnnotated[entry] = code;
-
- if (desc.NeverReturn || desc.IsGosubRet)
- {
- break;
- }
-
- if (desc.Args != null)
- {
- var parsedArgs = new List();
-
- foreach (var arg in desc.Args)
- {
- var parsedArg = new ParsedArg();
-
- int argValue;
- if (arg.Type == BdxInstructionDesc.ArgType.Imm16)
- {
- argValue = read.ReadInt16();
- }
- else if (arg.Type == BdxInstructionDesc.ArgType.Imm32)
- {
- argValue = read.ReadInt32();
- }
- else if (arg.Type == BdxInstructionDesc.ArgType.Float32)
- {
- argValue = read.ReadInt32();
- parsedArg.PreferFloat32 = true;
- }
- else
- {
- argValue = new BdxInstruction(codeWord).Ssub;
- }
-
-
- if (arg.IsRelative)
- {
- var nextEntry = (ushort)(entry + (desc.CodeSize) + argValue);
-
- parsedArg.Value = nextEntry;
- parsedArg.AddrRef = nextEntry;
-
- if (desc.IsJump || desc.IsGosub)
- {
- var newLabel = $"L{nextEntry}";
- parsedArg.Label = newLabel;
- AddAddr(nextEntry, newLabel);
- Walk(nextEntry);
- }
- }
- else if (arg.AiPos)
- {
- parsedArg.Value = (ushort)argValue;
-
- var newLabel = $"L{(ushort)argValue}";
- parsedArg.Label = newLabel;
- AddAddr((ushort)argValue, newLabel);
- }
- else if (arg.WorkPos)
- {
- parsedArg.Value = (ushort)argValue;
-
- var newLabel = $"W{(ushort)argValue}";
- parsedArg.Label = newLabel;
- workLabels[(ushort)argValue] = newLabel;
- }
- else
- {
- parsedArg.Value = argValue;
- }
-
- parsedArgs.Add(parsedArg);
- }
-
- if (desc.IsSyscall)
- {
- var tableIdx = new BdxInstruction(codeWord).Ssub;
- var trapIdx = parsedArgs[1].Value;
- var trap = BdxTraps.GetTraps()
- .FirstOrDefault(it => it.TableIndex == tableIdx && it.TrapIndex == trapIdx);
- addrCodeComments[entry] = (trap != null)
- ? $"{trap.Name} ({trap.Flags & 65535} in, {(((trap.Flags & 0x40000000) != 0) ? 1 : 0)} out)"
- : "?";
- }
-
- code.Args = parsedArgs.ToArray();
- }
-
- for (int x = 1; x < desc.CodeSize; x++)
- {
- addrAnnotated[entry + x] = CodeArg.Value;
- }
-
- if (desc.IsJump && !desc.IsJumpConditional)
- {
- break;
- }
-
- entry += desc.CodeSize;
- }
- }
-
- var knownItems = BdxTrigger.GetKnownItems()
- .ToDictionary(
- one => one.Key,
- one => one.Label
- );
-
- string GetTriggerLabelFor(int key)
- {
- if (knownItems.TryGetValue(key, out string? label) && label != null)
- {
- return label;
- }
- else
- {
- return $"TR{key}";
- }
- }
-
- foreach (var trigger in triggers)
- {
- AddAddr(trigger.Addr, GetTriggerLabelFor(trigger.Key));
- Walk(trigger.Addr);
- }
-
- foreach (var codeLabel in codeLabels ?? new int[0])
- {
- AddAddr(codeLabel, $"L{codeLabel}");
- Walk(codeLabel);
- }
-
- Header.Triggers = triggers
- .Select(
- it => new Trigger
- {
- Addr = it.Addr.ToString(),
- Key = it.Key,
- }
- )
- .ToArray();
-
- var revealed = new List();
-
- for (int addr = firstAddr; addr < read.Length / 2 - 8; addr++)
- {
- if (addrAnnotated.ContainsKey(addr))
- {
- continue;
- }
-
- read.Position = 16 + 2 * addr;
- var dataWord = read.ReadUInt16();
-
- addrAnnotated[addr] = new IndeterminateContent(dataWord);
-
- if (addrAnnotated.TryGetValue(addr - 1, out var prevAnnot) && prevAnnot is not IndeterminateContent prevWord)
- {
- AddAddr(addr, $"D{addr}");
- }
- }
-
- var firstTextPoolAddr = FindFirstTextPoolAddr(addrAnnotated);
-
- {
- // resolve strings
-
- var dataList = addrAnnotated
- .Where(pair => pair.Value is IndeterminateContent)
- .ToList();
-
- while (dataList.Any())
- {
- var baseAddr = dataList[0].Key;
-
- if (firstTextPoolAddr <= baseAddr)
- {
- int numContinuous = 1;
- while (true)
- {
- if (true
- && numContinuous < dataList.Count
- && dataList[numContinuous].Value is IndeterminateContent
- && dataList[numContinuous].Key == baseAddr + numContinuous
- )
- {
- numContinuous += 1;
- continue;
- }
- else
- {
- break;
- }
- }
-
- if (numContinuous >= 2)
- {
- var bytes = new byte[2 * numContinuous];
- for (int x = 0; x < numContinuous; x++)
- {
- var word = ((IndeterminateContent)dataList[x].Value).Word;
- bytes[2 * x + 0] = (byte)(word);
- bytes[2 * x + 1] = (byte)(word >> 8);
- }
-
- static (int numValidWords, IAnnotation? annot) TryToDecode(byte[] bytes)
- {
- for (int x = 0; x < bytes.Length; x++)
- {
- if (bytes[x] == 0)
- {
- if (x < 1)
- {
- // The length is not enough to decide this is a text.
- break;
- }
- if ((x & 1) == 0)
- {
- x++;
- }
-
- // This is a valid text
- return (
- (x + 1) / 2,
- new TextContent(Encoding.ASCII.GetString(bytes, 0, x + 1))
- );
- }
- if (IsValidChar(bytes[x]))
- {
- // A valid char
- continue;
- }
- else
- {
- // An invalid char
- break;
- }
- }
-
- // No valid text found
- return (0, null);
- }
-
- var (numValidWords, annot) = TryToDecode(bytes);
-
- if (1 <= numValidWords && annot != null)
- {
- dataList.RemoveRange(0, numValidWords);
- for (int x = 0; x < numValidWords; x++)
- {
- if (x == 0)
- {
- AddAddr(baseAddr + x, $"TXT{baseAddr + x}");
- addrAnnotated[baseAddr + x] = annot;
- }
- else
- {
- addrAnnotated[baseAddr + x] = TextPart.Value;
- }
- }
- continue;
- }
- }
- }
-
- dataList.RemoveAt(0);
- }
- }
-
- if (codeRevealer)
- {
- while (true)
- {
- var firstIndeterminate = addrAnnotated
- .FirstOrDefault(
- pair => true
- && pair.Key < firstTextPoolAddr
- && pair.Value is IndeterminateContent
- );
-
- // KeyValuePair is struct (value) and it cannot be null. While Value is null-able instead.
-
- if (firstIndeterminate.Value == null)
- {
- break;
- }
-
- var addr = firstIndeterminate.Key;
-
- addrAnnotated.Remove(firstIndeterminate.Key);
-
- AddAddr(addr, $"L{addr}");
- Walk(addr);
-
- revealed.Add(addr);
- }
- }
-
- if (codeRevealerLabeling)
- {
- foreach (var pair in addrAnnotated.ToArray())
- {
- if (pair.Value is CodeContent content)
- {
- if (content.Desc.CodeRevealerLabeling
- && content.Args.Length == 1
- && content.Args[0] is ParsedArg arg
- && arg.Label == null
- && arg.Value != 0
- )
- {
- if (revealed.Contains(arg.Value))
- {
- content.Args[0].Label = $"L{arg.Value}";
- content.Args[0].AddrRef = arg.Value;
- }
- }
- }
- }
- }
-
- {
- foreach (var pair in addrAnnotated.ToArray())
- {
- if (pair.Value is IndeterminateContent indeterminate)
- {
- addrAnnotated[pair.Key] = new WordContent(indeterminate.Word);
- }
- }
- }
-
- topComment = string.Join("\n"
- , $"{nameof(codeLabels)}: {((codeLabels != null) ? string.Join(" ", codeLabels.Select(it => $"-l {it}")) : "")}"
- , $"{nameof(codeRevealer)}: {((revealed != null) ? string.Join(" ", revealed.Select(it => $"-l {it}")) : "")}"
- );
-
- AddressAnnotated = addrAnnotated;
- AddressLabels = addrLabels;
- AddressComments = addrComments;
- AddressCodeComments = addrCodeComments;
- WorkLabels = workLabels;
- TopComment = topComment;
- }
-
- private static int FindFirstTextPoolAddr(IDictionary addrAnnotated)
- {
- var firstTextPoolAddr = int.MaxValue;
-
- var dataPairs = addrAnnotated
- .OrderByDescending(pair => pair.Key)
- .Where(pair => pair.Value is IndeterminateContent);
-
- if (dataPairs.Any())
- {
- foreach (var pair in dataPairs)
- {
- var content = (IndeterminateContent)pair.Value;
- var bytes = new byte[] { (byte)(content.Word), (byte)(content.Word >> 8) };
- if (true
- && (bytes[0] == 0 || IsValidChar(bytes[0]))
- && (bytes[1] == 0 || IsValidChar(bytes[1]))
- )
- {
- firstTextPoolAddr = pair.Key;
- continue;
- }
- else
- {
- break;
- }
- }
- }
-
- return firstTextPoolAddr;
- }
-
- private static bool IsValidChar(byte v)
- {
- var chr = (char)v;
- return 32 <= chr && chr <= 126;
- }
-
- public interface IAnnotation
- {
-
- }
-
- public class ParsedArg
- {
- public string? Label { get; set; }
- public int Value { get; set; }
- public int? AddrRef { get; set; }
- public bool PreferFloat32 { get; set; }
- }
-
- public sealed class CodeContent : IAnnotation
- {
- public CodeContent(BdxInstructionDesc desc)
- {
- Desc = desc;
- }
-
- public BdxInstructionDesc Desc { get; set; }
- public ParsedArg[] Args { get; set; } = new ParsedArg[0];
-
- public override string ToString() => Desc?.ToString() ?? "?";
- }
-
- public sealed class CodeArg : IAnnotation
- {
- private CodeArg()
- {
-
- }
-
- public override string ToString() => $"CodeArg";
-
- public static readonly CodeArg Value = new CodeArg();
- }
-
- public sealed class IndeterminateContent : IAnnotation
- {
- public ushort Word { get; set; }
-
- public IndeterminateContent(ushort word)
- {
- Word = word;
- }
-
- public override string ToString() => $"Indeterminate";
- }
-
- public sealed class WordContent : IAnnotation
- {
- public ushort Word { get; set; }
-
- public WordContent(ushort word)
- {
- Word = word;
- }
-
- public override string ToString() => $"Word";
- }
-
- public sealed class TextContent : IAnnotation
- {
- public string Text { get; set; }
-
- public TextContent(string text)
- {
- Text = text;
- }
-
- public override string ToString() => $"Text: {Text}";
- }
-
- public sealed class TextPart : IAnnotation
- {
- private TextPart()
- {
-
- }
-
- public override string ToString() => $"TextPart";
-
- public static readonly TextPart Value = new TextPart();
- }
-
- public static class TextFormatter
- {
- private static ISerializer ser = new SerializerBuilder()
- .Build();
-
- public static string Format(BdxDecoder decoder)
- {
- if (decoder.Header.IsEmpty)
- {
- var empty = new StringWriter();
- empty.WriteLine("---");
- empty.WriteLine("---");
- return empty.ToString();
- }
-
- var writer = new StringWriter();
-
- writer.WriteLine("---");
- writer.WriteLine(
- ser
- .Serialize(
- new BdxHeader
- {
- Name = decoder.Header.Name,
- WorkSize = decoder.Header.WorkSize,
- StackSize = decoder.Header.StackSize,
- TempSize = decoder.Header.TempSize,
- Triggers = decoder.Header.Triggers
- .Select(
- it =>
- {
- if (int.TryParse(it.Addr, out int addr))
- {
- decoder.AddressLabels.TryGetValue(addr, out string? labels);
-
- return new Trigger
- {
- Key = it.Key,
- Addr = ((labels != null) ? labels.Split(',')[0] : it.Addr),
- };
- }
- else
- {
- return new Trigger
- {
- Key = it.Key,
- Addr = it.Addr,
- };
- }
- }
- )
- .ToArray(),
- }
- )
- );
- writer.WriteLine("---");
-
- {
- if (!string.IsNullOrEmpty(decoder.TopComment))
- {
- foreach (var comment in decoder.TopComment.Split('\n'))
- {
- writer.WriteLine($"; {comment}");
- }
- }
- }
-
- writer.WriteLine(" section .text");
-
- foreach (var line in decoder.AddressAnnotated)
- {
- if (decoder.AddressComments.TryGetValue(line.Key, out var commentBody) && commentBody != null)
- {
- foreach (var comment in commentBody.Replace("\r\n", "\n").Split('\n'))
- {
- writer.WriteLine($" ; {comment}");
- }
- }
-
- if (decoder.AddressLabels.TryGetValue(line.Key, out string? labels) && labels != null)
- {
- foreach (var label in labels.Split(','))
- {
- writer.WriteLine($"{label}:");
- }
- }
-
- if (line.Value is CodeContent code)
- {
- if (decoder.AddressCodeComments.TryGetValue(line.Key, out string? commentPart))
- {
- commentPart = " ; " + commentPart;
- }
-
- writer.WriteLine($" {code.Desc.Name} {string.Join(", ", code.Args.Select(FormatArg))}{commentPart}");
- }
- else if (line.Value is WordContent data)
- {
- writer.WriteLine($" dw 0x{data.Word:X4}");
- }
- else if (line.Value is TextContent text)
- {
- writer.WriteLine($" db {MakeDbBody(text.Text)}");
- }
- }
-
- if (decoder.Header.WorkSize != 0)
- {
- writer.WriteLine();
- writer.WriteLine(" section .bss");
- if (decoder.WorkLabels.Any())
- {
- int lastPos = 0;
- foreach (var workLabel in decoder.WorkLabels)
- {
- var thisPos = workLabel.Key;
- if (lastPos < thisPos)
- {
- writer.WriteLine($" resb {thisPos - lastPos}");
- lastPos = thisPos;
- }
- writer.WriteLine($"{workLabel.Value}:");
- }
- {
- var thisPos = decoder.Header.WorkSize;
- if (lastPos < thisPos)
- {
- writer.WriteLine($" resb {thisPos - lastPos}");
- }
- }
- }
- else
- {
- writer.WriteLine($" resb {decoder.Header.WorkSize}");
- }
- }
-
- return writer.ToString();
- }
-
- private static string FormatArg(ParsedArg arg)
- {
- if (arg.Label != null)
- {
- return $"{arg.Label}"; //offset
- }
- else if (arg.PreferFloat32)
- {
- return BitConverter.ToSingle(BitConverter.GetBytes(arg.Value)).ToString("R", invariantNumberFormat);
- }
- else
- {
- return arg.Value.ToString();
- }
- }
-
- private static string MakeDbBody(string text)
- {
- var bytes = Encoding.ASCII.GetBytes(text);
-
- bool IsPrint(byte b) => 0x20 <= b && b <= 0x7E && b != 0x27 && b != 0x5C;
-
- var tokens = new List();
-
- for (int x = 0, cx = bytes.Length; x < cx;)
- {
- {
- int from = x;
- while (x < cx && IsPrint(bytes[x]))
- {
- x++;
- }
- if (from != x)
- {
- tokens.Add("'" + Encoding.ASCII.GetString(bytes, from, x - from) + "'");
- }
- }
-
- {
- int from = x;
- while (x < cx && !IsPrint(bytes[x]))
- {
- x++;
- }
- if (from != x)
- {
- for (; from < x; from++)
- {
- tokens.Add(bytes[from].ToString());
- }
- }
- }
- }
-
- return string.Join(",", tokens);
- }
- }
-
- private static readonly IFormatProvider invariantNumberFormat = CultureInfo.InvariantCulture.NumberFormat;
- }
-}
+using OpenKh.Common;
+using OpenKh.Kh2.Bdx.Models;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Xe.BinaryMapper;
+using YamlDotNet.Serialization;
+using static OpenKh.Kh2.Bdx.Models.BdxHeader;
+
+namespace OpenKh.Kh2.Bdx.Utils
+{
+ public class BdxDecoder
+ {
+ public BdxHeader Header { get; }
+
+ public IDictionary AddressAnnotated { get; }
+ public IDictionary AddressLabels { get; }
+ public IDictionary AddressComments { get; }
+ public IDictionary AddressCodeComments { get; }
+ public IDictionary WorkLabels { get; }
+ public string TopComment { get; set; }
+
+ public BdxDecoder(Stream read, int[]? codeLabels = null, bool codeRevealer = false, bool codeRevealerLabeling = false)
+ {
+ if (read.Length == 0)
+ {
+ Header = new BdxHeader { IsEmpty = true };
+ AddressAnnotated = new Dictionary();
+ AddressLabels = new Dictionary();
+ AddressComments = new Dictionary();
+ AddressCodeComments = new Dictionary();
+ WorkLabels = new Dictionary();
+ TopComment = "";
+ return;
+ }
+
+ Header = BinaryMapping.ReadObject(read);
+
+ var triggers = new List();
+ while (true)
+ {
+ var one = BinaryMapping.ReadObject(read);
+ if (one.Key == 0 && one.Addr == 0)
+ {
+ break;
+ }
+ triggers.Add(one);
+ }
+
+ int firstAddr = (12 + 8 * (triggers.Count + 1)) / 2;
+
+ var addrAnnotated = new SortedDictionary();
+ var addrLabels = new SortedDictionary();
+ var addrComments = new SortedDictionary();
+ var addrCodeComments = new SortedDictionary();
+ var workLabels = new SortedDictionary();
+ var topComment = "";
+
+ void AddAddr(int entry, string label)
+ {
+ if (addrLabels.TryGetValue(entry, out string? existing) && existing != null)
+ {
+ addrLabels[entry] = string.Join(",", existing.Split(',').Append(label).Distinct());
+ }
+ else
+ {
+ addrLabels[entry] = label;
+ }
+ }
+
+ void Walk(int entry)
+ {
+ var topAddr = entry;
+
+ while (true)
+ {
+ var needClearance = false;
+
+ if (addrAnnotated.TryGetValue(entry, out var annotHere))
+ {
+ if (annotHere is IndeterminateContent)
+ {
+ needClearance = true;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ var newPos = 16 + 2 * entry;
+ if (read.Length <= newPos)
+ {
+ // bug?
+ break;
+ }
+
+ read.Position = newPos;
+ var codeWord = read.ReadUInt16();
+
+ var desc = BdxInstructionDescs.FindByCode(codeWord);
+ if (desc == null)
+ {
+ break;
+ }
+
+ var code = new CodeContent(desc);
+
+ if (needClearance)
+ {
+ var overrideDetected = false;
+ int x = 1;
+ for (; x < desc.CodeSize; x++)
+ {
+ if (true
+ && addrAnnotated.TryGetValue(entry + x, out var codePartHit)
+ && codePartHit is not IndeterminateContent
+ )
+ {
+ overrideDetected = true;
+ break;
+ }
+
+ if (addrLabels.TryGetValue(entry + x, out var codePartLabels))
+ {
+ overrideDetected = true;
+ break;
+ }
+ }
+ if (overrideDetected)
+ {
+ addrComments[entry] = $"Although L{entry + x} is in IndeterminateContent area (L{entry} to L{entry + desc.CodeSize - 1}), there is a collision with text data? Maybe codeRevealer problem. Possibly need more better bottom text pool detection.";
+ break;
+ }
+ }
+
+ addrAnnotated[entry] = code;
+
+ if (desc.NeverReturn || desc.IsGosubRet)
+ {
+ break;
+ }
+
+ if (desc.Args != null)
+ {
+ var parsedArgs = new List();
+
+ foreach (var arg in desc.Args)
+ {
+ var parsedArg = new ParsedArg();
+
+ int argValue;
+ if (arg.Type == BdxInstructionDesc.ArgType.Imm16)
+ {
+ argValue = read.ReadInt16();
+ }
+ else if (arg.Type == BdxInstructionDesc.ArgType.Imm32)
+ {
+ argValue = read.ReadInt32();
+ }
+ else if (arg.Type == BdxInstructionDesc.ArgType.Float32)
+ {
+ argValue = read.ReadInt32();
+ parsedArg.PreferFloat32 = true;
+ }
+ else
+ {
+ argValue = new BdxInstruction(codeWord).Ssub;
+ }
+
+
+ if (arg.IsRelative)
+ {
+ var nextEntry = (ushort)(entry + (desc.CodeSize) + argValue);
+
+ parsedArg.Value = nextEntry;
+ parsedArg.AddrRef = nextEntry;
+
+ if (desc.IsJump || desc.IsGosub)
+ {
+ var newLabel = $"L{nextEntry}";
+ parsedArg.Label = newLabel;
+ AddAddr(nextEntry, newLabel);
+ Walk(nextEntry);
+ }
+ }
+ else if (arg.AiPos)
+ {
+ parsedArg.Value = (ushort)argValue;
+
+ var newLabel = $"L{(ushort)argValue}";
+ parsedArg.Label = newLabel;
+ AddAddr((ushort)argValue, newLabel);
+ }
+ else if (arg.WorkPos)
+ {
+ parsedArg.Value = (ushort)argValue;
+
+ var newLabel = $"W{(ushort)argValue}";
+ parsedArg.Label = newLabel;
+ workLabels[(ushort)argValue] = newLabel;
+ }
+ else
+ {
+ parsedArg.Value = argValue;
+ }
+
+ parsedArgs.Add(parsedArg);
+ }
+
+ if (desc.IsSyscall)
+ {
+ var tableIdx = new BdxInstruction(codeWord).Ssub;
+ var trapIdx = parsedArgs[1].Value;
+ var trap = BdxTraps.GetTraps()
+ .FirstOrDefault(it => it.TableIndex == tableIdx && it.TrapIndex == trapIdx);
+ addrCodeComments[entry] = (trap != null)
+ ? $"{trap.Name} ({trap.Flags & 65535} in, {(((trap.Flags & 0x40000000) != 0) ? 1 : 0)} out)"
+ : "?";
+ }
+
+ code.Args = parsedArgs.ToArray();
+ }
+
+ for (int x = 1; x < desc.CodeSize; x++)
+ {
+ addrAnnotated[entry + x] = CodeArg.Value;
+ }
+
+ if (desc.IsJump && !desc.IsJumpConditional)
+ {
+ break;
+ }
+
+ entry += desc.CodeSize;
+ }
+ }
+
+ var knownItems = BdxTrigger.GetKnownItems()
+ .ToDictionary(
+ one => one.Key,
+ one => one.Label
+ );
+
+ string GetTriggerLabelFor(int key)
+ {
+ if (knownItems.TryGetValue(key, out string? label) && label != null)
+ {
+ return label;
+ }
+ else
+ {
+ return $"TR{key}";
+ }
+ }
+
+ foreach (var trigger in triggers)
+ {
+ AddAddr(trigger.Addr, GetTriggerLabelFor(trigger.Key));
+ Walk(trigger.Addr);
+ }
+
+ foreach (var codeLabel in codeLabels ?? new int[0])
+ {
+ AddAddr(codeLabel, $"L{codeLabel}");
+ Walk(codeLabel);
+ }
+
+ Header.Triggers = triggers
+ .Select(
+ it => new Trigger
+ {
+ Addr = it.Addr.ToString(),
+ Key = it.Key,
+ }
+ )
+ .ToArray();
+
+ var revealed = new List();
+
+ for (int addr = firstAddr; addr < read.Length / 2 - 8; addr++)
+ {
+ if (addrAnnotated.ContainsKey(addr))
+ {
+ continue;
+ }
+
+ read.Position = 16 + 2 * addr;
+ var dataWord = read.ReadUInt16();
+
+ addrAnnotated[addr] = new IndeterminateContent(dataWord);
+
+ if (addrAnnotated.TryGetValue(addr - 1, out var prevAnnot) && prevAnnot is not IndeterminateContent prevWord)
+ {
+ AddAddr(addr, $"D{addr}");
+ }
+ }
+
+ var firstTextPoolAddr = FindFirstTextPoolAddr(addrAnnotated);
+
+ {
+ // resolve strings
+
+ var dataList = addrAnnotated
+ .Where(pair => pair.Value is IndeterminateContent)
+ .ToList();
+
+ while (dataList.Any())
+ {
+ var baseAddr = dataList[0].Key;
+
+ if (firstTextPoolAddr <= baseAddr)
+ {
+ int numContinuous = 1;
+ while (true)
+ {
+ if (true
+ && numContinuous < dataList.Count
+ && dataList[numContinuous].Value is IndeterminateContent
+ && dataList[numContinuous].Key == baseAddr + numContinuous
+ )
+ {
+ numContinuous += 1;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (numContinuous >= 2)
+ {
+ var bytes = new byte[2 * numContinuous];
+ for (int x = 0; x < numContinuous; x++)
+ {
+ var word = ((IndeterminateContent)dataList[x].Value).Word;
+ bytes[2 * x + 0] = (byte)(word);
+ bytes[2 * x + 1] = (byte)(word >> 8);
+ }
+
+ static (int numValidWords, IAnnotation? annot) TryToDecode(byte[] bytes)
+ {
+ for (int x = 0; x < bytes.Length; x++)
+ {
+ if (bytes[x] == 0)
+ {
+ if (x < 1)
+ {
+ // The length is not enough to decide this is a text.
+ break;
+ }
+ if ((x & 1) == 0)
+ {
+ x++;
+ }
+
+ // This is a valid text
+ return (
+ (x + 1) / 2,
+ new TextContent(Encoding.ASCII.GetString(bytes, 0, x + 1))
+ );
+ }
+ if (IsValidChar(bytes[x]))
+ {
+ // A valid char
+ continue;
+ }
+ else
+ {
+ // An invalid char
+ break;
+ }
+ }
+
+ // No valid text found
+ return (0, null);
+ }
+
+ var (numValidWords, annot) = TryToDecode(bytes);
+
+ if (1 <= numValidWords && annot != null)
+ {
+ dataList.RemoveRange(0, numValidWords);
+ for (int x = 0; x < numValidWords; x++)
+ {
+ if (x == 0)
+ {
+ AddAddr(baseAddr + x, $"TXT{baseAddr + x}");
+ addrAnnotated[baseAddr + x] = annot;
+ }
+ else
+ {
+ addrAnnotated[baseAddr + x] = TextPart.Value;
+ }
+ }
+ continue;
+ }
+ }
+ }
+
+ dataList.RemoveAt(0);
+ }
+ }
+
+ if (codeRevealer)
+ {
+ while (true)
+ {
+ var firstIndeterminate = addrAnnotated
+ .FirstOrDefault(
+ pair => true
+ && pair.Key < firstTextPoolAddr
+ && pair.Value is IndeterminateContent
+ );
+
+ // KeyValuePair is struct (value) and it cannot be null. While Value is null-able instead.
+
+ if (firstIndeterminate.Value == null)
+ {
+ break;
+ }
+
+ var addr = firstIndeterminate.Key;
+
+ addrAnnotated.Remove(firstIndeterminate.Key);
+
+ AddAddr(addr, $"L{addr}");
+ Walk(addr);
+
+ revealed.Add(addr);
+ }
+ }
+
+ if (codeRevealerLabeling)
+ {
+ foreach (var pair in addrAnnotated.ToArray())
+ {
+ if (pair.Value is CodeContent content)
+ {
+ if (content.Desc.CodeRevealerLabeling
+ && content.Args.Length == 1
+ && content.Args[0] is ParsedArg arg
+ && arg.Label == null
+ && arg.Value != 0
+ )
+ {
+ if (revealed.Contains(arg.Value))
+ {
+ content.Args[0].Label = $"L{arg.Value}";
+ content.Args[0].AddrRef = arg.Value;
+ }
+ }
+ }
+ }
+ }
+
+ {
+ foreach (var pair in addrAnnotated.ToArray())
+ {
+ if (pair.Value is IndeterminateContent indeterminate)
+ {
+ addrAnnotated[pair.Key] = new WordContent(indeterminate.Word);
+ }
+ }
+ }
+
+ topComment = string.Join("\n"
+ , $"{nameof(codeLabels)}: {((codeLabels != null) ? string.Join(" ", codeLabels.Select(it => $"-l {it}")) : "")}"
+ , $"{nameof(codeRevealer)}: {((revealed != null) ? string.Join(" ", revealed.Select(it => $"-l {it}")) : "")}"
+ );
+
+ AddressAnnotated = addrAnnotated;
+ AddressLabels = addrLabels;
+ AddressComments = addrComments;
+ AddressCodeComments = addrCodeComments;
+ WorkLabels = workLabels;
+ TopComment = topComment;
+ }
+
+ private static int FindFirstTextPoolAddr(IDictionary addrAnnotated)
+ {
+ var firstTextPoolAddr = int.MaxValue;
+
+ var dataPairs = addrAnnotated
+ .OrderByDescending(pair => pair.Key)
+ .Where(pair => pair.Value is IndeterminateContent);
+
+ if (dataPairs.Any())
+ {
+ foreach (var pair in dataPairs)
+ {
+ var content = (IndeterminateContent)pair.Value;
+ var bytes = new byte[] { (byte)(content.Word), (byte)(content.Word >> 8) };
+ if (true
+ && (bytes[0] == 0 || IsValidChar(bytes[0]))
+ && (bytes[1] == 0 || IsValidChar(bytes[1]))
+ )
+ {
+ firstTextPoolAddr = pair.Key;
+ continue;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ return firstTextPoolAddr;
+ }
+
+ private static bool IsValidChar(byte v)
+ {
+ var chr = (char)v;
+ return 32 <= chr && chr <= 126;
+ }
+
+ public interface IAnnotation
+ {
+
+ }
+
+ public class ParsedArg
+ {
+ public string? Label { get; set; }
+ public int Value { get; set; }
+ public int? AddrRef { get; set; }
+ public bool PreferFloat32 { get; set; }
+ }
+
+ public sealed class CodeContent : IAnnotation
+ {
+ public CodeContent(BdxInstructionDesc desc)
+ {
+ Desc = desc;
+ }
+
+ public BdxInstructionDesc Desc { get; set; }
+ public ParsedArg[] Args { get; set; } = new ParsedArg[0];
+
+ public override string ToString() => Desc?.ToString() ?? "?";
+ }
+
+ public sealed class CodeArg : IAnnotation
+ {
+ private CodeArg()
+ {
+
+ }
+
+ public override string ToString() => $"CodeArg";
+
+ public static readonly CodeArg Value = new CodeArg();
+ }
+
+ public sealed class IndeterminateContent : IAnnotation
+ {
+ public ushort Word { get; set; }
+
+ public IndeterminateContent(ushort word)
+ {
+ Word = word;
+ }
+
+ public override string ToString() => $"Indeterminate";
+ }
+
+ public sealed class WordContent : IAnnotation
+ {
+ public ushort Word { get; set; }
+
+ public WordContent(ushort word)
+ {
+ Word = word;
+ }
+
+ public override string ToString() => $"Word";
+ }
+
+ public sealed class TextContent : IAnnotation
+ {
+ public string Text { get; set; }
+
+ public TextContent(string text)
+ {
+ Text = text;
+ }
+
+ public override string ToString() => $"Text: {Text}";
+ }
+
+ public sealed class TextPart : IAnnotation
+ {
+ private TextPart()
+ {
+
+ }
+
+ public override string ToString() => $"TextPart";
+
+ public static readonly TextPart Value = new TextPart();
+ }
+
+ public static class TextFormatter
+ {
+ private static ISerializer ser = new SerializerBuilder()
+ .Build();
+
+ public static string Format(BdxDecoder decoder)
+ {
+ if (decoder.Header.IsEmpty)
+ {
+ var empty = new StringWriter();
+ empty.WriteLine("---");
+ empty.WriteLine("---");
+ return empty.ToString();
+ }
+
+ var writer = new StringWriter();
+
+ writer.WriteLine("---");
+ writer.WriteLine(
+ ser
+ .Serialize(
+ new BdxHeader
+ {
+ Name = decoder.Header.Name,
+ WorkSize = decoder.Header.WorkSize,
+ StackSize = decoder.Header.StackSize,
+ TempSize = decoder.Header.TempSize,
+ Triggers = decoder.Header.Triggers
+ .Select(
+ it =>
+ {
+ if (int.TryParse(it.Addr, out int addr))
+ {
+ decoder.AddressLabels.TryGetValue(addr, out string? labels);
+
+ return new Trigger
+ {
+ Key = it.Key,
+ Addr = ((labels != null) ? labels.Split(',')[0] : it.Addr),
+ };
+ }
+ else
+ {
+ return new Trigger
+ {
+ Key = it.Key,
+ Addr = it.Addr,
+ };
+ }
+ }
+ )
+ .ToArray(),
+ }
+ )
+ );
+ writer.WriteLine("---");
+
+ {
+ if (!string.IsNullOrEmpty(decoder.TopComment))
+ {
+ foreach (var comment in decoder.TopComment.Split('\n'))
+ {
+ writer.WriteLine($"; {comment}");
+ }
+ }
+ }
+
+ writer.WriteLine(" section .text");
+
+ foreach (var line in decoder.AddressAnnotated)
+ {
+ if (decoder.AddressComments.TryGetValue(line.Key, out var commentBody) && commentBody != null)
+ {
+ foreach (var comment in commentBody.Replace("\r\n", "\n").Split('\n'))
+ {
+ writer.WriteLine($" ; {comment}");
+ }
+ }
+
+ if (decoder.AddressLabels.TryGetValue(line.Key, out string? labels) && labels != null)
+ {
+ foreach (var label in labels.Split(','))
+ {
+ writer.WriteLine($"{label}:");
+ }
+ }
+
+ if (line.Value is CodeContent code)
+ {
+ if (decoder.AddressCodeComments.TryGetValue(line.Key, out string? commentPart))
+ {
+ commentPart = " ; " + commentPart;
+ }
+
+ writer.WriteLine($" {code.Desc.Name} {string.Join(", ", code.Args.Select(FormatArg))}{commentPart}");
+ }
+ else if (line.Value is WordContent data)
+ {
+ writer.WriteLine($" dw 0x{data.Word:X4}");
+ }
+ else if (line.Value is TextContent text)
+ {
+ writer.WriteLine($" db {MakeDbBody(text.Text)}");
+ }
+ }
+
+ if (decoder.Header.WorkSize != 0)
+ {
+ writer.WriteLine();
+ writer.WriteLine(" section .bss");
+ if (decoder.WorkLabels.Any())
+ {
+ int lastPos = 0;
+ foreach (var workLabel in decoder.WorkLabels)
+ {
+ var thisPos = workLabel.Key;
+ if (lastPos < thisPos)
+ {
+ writer.WriteLine($" resb {thisPos - lastPos}");
+ lastPos = thisPos;
+ }
+ writer.WriteLine($"{workLabel.Value}:");
+ }
+ {
+ var thisPos = decoder.Header.WorkSize;
+ if (lastPos < thisPos)
+ {
+ writer.WriteLine($" resb {thisPos - lastPos}");
+ }
+ }
+ }
+ else
+ {
+ writer.WriteLine($" resb {decoder.Header.WorkSize}");
+ }
+ }
+
+ return writer.ToString();
+ }
+
+ private static string FormatArg(ParsedArg arg)
+ {
+ if (arg.Label != null)
+ {
+ return $"{arg.Label}"; //offset
+ }
+ else if (arg.PreferFloat32)
+ {
+ return BitConverter.ToSingle(BitConverter.GetBytes(arg.Value)).ToString("R", invariantNumberFormat);
+ }
+ else
+ {
+ return arg.Value.ToString();
+ }
+ }
+
+ private static string MakeDbBody(string text)
+ {
+ var bytes = Encoding.ASCII.GetBytes(text);
+
+ bool IsPrint(byte b) => 0x20 <= b && b <= 0x7E && b != 0x27 && b != 0x5C;
+
+ var tokens = new List();
+
+ for (int x = 0, cx = bytes.Length; x < cx;)
+ {
+ {
+ int from = x;
+ while (x < cx && IsPrint(bytes[x]))
+ {
+ x++;
+ }
+ if (from != x)
+ {
+ tokens.Add("'" + Encoding.ASCII.GetString(bytes, from, x - from) + "'");
+ }
+ }
+
+ {
+ int from = x;
+ while (x < cx && !IsPrint(bytes[x]))
+ {
+ x++;
+ }
+ if (from != x)
+ {
+ for (; from < x; from++)
+ {
+ tokens.Add(bytes[from].ToString());
+ }
+ }
+ }
+ }
+
+ return string.Join(",", tokens);
+ }
+ }
+
+ private static readonly IFormatProvider invariantNumberFormat = CultureInfo.InvariantCulture.NumberFormat;
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Utils/BdxEncoder.cs b/OpenKh.Kh2/Bdx/Utils/BdxEncoder.cs
similarity index 97%
rename from OpenKh.Command.Bdxio/Utils/BdxEncoder.cs
rename to OpenKh.Kh2/Bdx/Utils/BdxEncoder.cs
index 3fe1c1445..6dec2c14e 100644
--- a/OpenKh.Command.Bdxio/Utils/BdxEncoder.cs
+++ b/OpenKh.Kh2/Bdx/Utils/BdxEncoder.cs
@@ -1,866 +1,867 @@
-using Antlr4.Runtime;
-using Antlr4.Runtime.Tree;
-using NLog;
-using OpenKh.Command.Bdxio.Models;
-using System.Globalization;
-using System.Text;
-using Xe.BinaryMapper;
-using static BdxScriptParser;
-using static OpenKh.Command.Bdxio.Models.BdxHeader;
-using static OpenKh.Command.Bdxio.Models.BdxInstructionDesc;
-
-namespace OpenKh.Command.Bdxio.Utils
-{
- public class BdxEncoder
- {
- public byte[] Content { get; } = new byte[0];
-
- public BdxEncoder(
- BdxHeader header,
- string script,
- string scriptName,
- Func loadScript
- )
- {
- var logger = LogManager.GetLogger("BdxEncoder");
-
- if (string.IsNullOrWhiteSpace(script) && header.IsEmpty)
- {
- return;
- }
-
- var labels = new SortedDictionary();
-
- var instructionDict = new (string, BdxInstructionDesc)[0]
- .Concat(
- BdxInstructionDescs.GetDescs()
- .Select(desc => (desc.Name, desc))
- )
- .Concat(
- BdxInstructionDescs.GetDescs()
- .SelectMany(
- desc => desc.OldNames
- .Select(
- oldName => (oldName, desc)
- )
- )
- )
- .GroupBy(pair => pair.Item1)
- .Select(it => it.First())
- .ToDictionary(it => it.Item1, it => it.Item2);
-
- Func ResolveInt32Factory(
- Func stringToInt32,
- Func, int> labelToInt32
- )
- {
- return (ArgContext argContext, CompilePass pass) =>
- {
- if (pass.First)
- {
- return 0;
- }
- else
- {
- if (argContext.numberdata() is NumberdataContext numberdata)
- {
- return stringToInt32(numberdata);
- }
- else if (argContext.id() is IdContext id)
- {
- var name = id.GetText();
- return labelToInt32(name, () => id.Start);
- }
- else
- {
- throw new InvalidDataException($"{FormatLineColumn(argContext.Start)} Unknown arg!");
- }
- }
- };
- }
-
- int LabelToInt32Converter(string name, Func getStart)
- {
- if (!labels.TryGetValue(name, out var any) || any == null)
- {
- throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} not found"));
- }
-
- if (any is CodeLabel label)
- {
- return label.PC;
- }
- else if (any is ConstLabel constLabel)
- {
- return constLabel.Value;
- }
- else if (any is BssLabel bssLabel)
- {
- return bssLabel.ByteOffset;
- }
-
- throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} cannot be used here"));
- }
-
- float LabelToFloat32Converter(string name, Func getStart)
- {
- if (!labels.TryGetValue(name, out var any) || any == null)
- {
- throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} not found"));
- }
-
- if (any is ConstLabel constLabel)
- {
- return constLabel.Value;
- }
-
- throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} cannot be used here"));
- }
-
- Func ResolveFloat32Factory(
- Func, float> labelToFloat32
- )
- {
- return (ArgContext argContext, CompilePass pass) =>
- {
- if (pass.First)
- {
- return 0;
- }
- else
- {
- if (argContext.numberdata() is NumberdataContext numberdata)
- {
- return float.Parse(numberdata.GetText(), invariantNumberFormat);
- }
- else if (argContext.id() is IdContext id)
- {
- var name = id.GetText();
- return labelToFloat32(name, () => id.Start);
- }
- else
- {
- throw new InvalidDataException($"{FormatLineColumn(argContext.Start)} Unknown arg!");
- }
- }
- };
- }
-
- var resolveInt32ForIntTrigger = ResolveInt32Factory(
- stringToInt32: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
- labelToInt32: LabelToInt32Converter
- );
-
- var resolveInt32ForSsub = ResolveInt32Factory(
- stringToInt32: Helper.AllowedRangeFactory(
- factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
- min: -2048,
- max: 4095
- ),
- labelToInt32: LabelToInt32Converter
- );
-
- var resolveInt32ForRelativeImm16 = ResolveInt32Factory(
- stringToInt32: Helper.AllowedRangeFactory(
- factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
- min: short.MinValue,
- max: short.MaxValue
- ),
- labelToInt32: LabelToInt32Converter
- );
-
- var resolveInt32ForValueImm16 = ResolveInt32Factory(
- stringToInt32: Helper.AllowedRangeFactory(
- factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
- min: short.MinValue,
- max: ushort.MaxValue
- ),
- labelToInt32: LabelToInt32Converter
- );
-
- var resolveInt32ForRelativeImm32 = ResolveInt32Factory(
- stringToInt32: Helper.AllowedRangeFactory(
- factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
- min: int.MinValue,
- max: int.MaxValue
- ),
- labelToInt32: LabelToInt32Converter
- );
-
- var resolveInt32ForValueImm32 = ResolveInt32Factory(
- stringToInt32: Helper.AllowedRangeFactory(
- factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: true),
- min: int.MinValue,
- max: int.MaxValue
- ),
- labelToInt32: LabelToInt32Converter
- );
-
- var resolveFloat32ForValueFloat32 = ResolveFloat32Factory(
- labelToFloat32: LabelToFloat32Converter
- );
-
- int lastBssBytes = 0;
-
- var compilePasses = new CompilePass[] {
- new CompilePass(Index: 0, First: true, Last: false), // resolve code placement and labels offset
- new CompilePass(Index: 1, First: false, Last: false), // resolve equ (const)
- new CompilePass(Index: 2, First: false, Last: true), // compile
- };
-
- foreach (var pass in compilePasses)
- {
- var words = new MemoryStream();
-
- void WordAlignment()
- {
- if ((words.Length & 1) != 0)
- {
- words.WriteByte(0);
- }
- }
-
- BinaryMapping.WriteObject(words, header);
-
- if (!pass.First)
- {
- if (header.WorkSize < lastBssBytes)
- {
- logger.Warn($"WorkSize {header.WorkSize} is extended to {lastBssBytes}");
-
- words.Position = 16;
- words.Write(BitConverter.GetBytes(lastBssBytes));
- words.Seek(0, SeekOrigin.End);
- }
- }
-
- foreach (var intTrigger in header.Triggers
- .Select(
- item =>
- {
- return new IntTrigger
- {
- Key = item.Key,
- Addr = resolveInt32ForIntTrigger(Helper.ParseAsArg(item.Addr), pass),
- };
- }
- )
- )
- {
- BinaryMapping.WriteObject(words, intTrigger);
- }
-
- BinaryMapping.WriteObject(words, new IntTrigger { Addr = 0, Key = 0, });
-
- var codeSeg = new CodeSegment(words);
- var bssSeg = new BssSegment();
- ISegment segment = codeSeg;
-
- void AddLabel(string labelName, ILabel labelValue, Func getTokenPos)
- {
- if (pass.First)
- {
- if (!labels.TryAdd(labelName, labelValue))
- {
- throw new InvalidDataException($"{FormatLineColumn(getTokenPos().Start)} Redefine of label {labelName}");
- }
- }
- else
- {
- labels[labelName] = labelValue;
- }
- }
-
- void WalkStatements(ProgContext root)
- {
- foreach (var st in root.statement())
- {
- //var pc = (int)(words.Length / 2 - 8);
-
- if (st.section() is SectionContext section)
- {
- var id = section.section_id();
- var sectionName = id.GetText();
- if (sectionName == ".text")
- {
- segment = codeSeg;
- }
- else if (sectionName == ".bss")
- {
- segment = bssSeg;
- }
- else
- {
- throw new InvalidDataException($"{FormatLineColumn(id.Start)} Unknown section name {sectionName}");
- }
- continue;
- }
- else if (st.equ() is EquContext equ)
- {
- var intValue = Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false).Invoke(equ.numberdata());
-
- AddLabel(
- equ.name.GetText(),
- new ConstLabel { Value = intValue, },
- () => equ.name
- );
- }
-
- if (st.label() is LabelContext label)
- {
- WordAlignment();
- var id = label.id();
- AddLabel(
- id.GetText(),
- segment.GetLabel(),
- () => id
- );
- }
-
- if (st.order() is OrderContext order)
- {
- if (order.db() is DbContext db)
- {
- foreach (var byteData in db.bytedata())
- {
- if (byteData.numberdata() is NumberdataContext numberData)
- {
- segment.WriteByte(Helper.GetAsByte(numberData));
- }
- else if (byteData.StringData() is ITerminalNode stringData)
- {
- var text = stringData.GetText();
- var bytes = Encoding.ASCII.GetBytes(text.Substring(1, text.Length - 2));
- segment.Write(bytes);
- }
- else if (byteData.id() is IdContext id)
- {
- var value = pass.First ? 0 : LabelToInt32Converter(id.GetText(), () => id.Start);
- segment.WriteByte((byte)value);
- }
- else
- {
- throw new InvalidDataException($"{FormatLineColumn(byteData.Start)} Unknown byte data!");
- }
- }
- }
- else if (order.resb() is ResbContext resb)
- {
- if (resb.numberdata() is NumberdataContext numberdata)
- {
- var numBytes = Helper.GetAsInt32(numberdata);
- segment.AllocateBytes(numBytes);
- }
- else if (resb.id() is IdContext id)
- {
- var numBytes = LimitInt32Range(
- pass.First
- ? 0
- : LabelToInt32Converter(id.GetText(), () => id.Start),
- min: int.MinValue,
- max: int.MaxValue,
- getStart: () => id.Start
- );
- segment.AllocateBytes(numBytes);
- }
- }
- else if (order.dw() is DwContext dw)
- {
- WordAlignment();
- foreach (var wordData in dw.worddata())
- {
- if (wordData.numberdata() is NumberdataContext numberdata)
- {
- segment.Write(BitConverter.GetBytes(Helper.GetAsUInt16(numberdata)));
- }
- else if (wordData.id() is IdContext id)
- {
- var value = (ushort)LimitInt32Range(pass.First ? 0 : LabelToInt32Converter(id.GetText(), () => id.Start), min: -127, max: 255, () => id.Start);
- segment.Write(BitConverter.GetBytes(value));
- }
- else
- {
- throw new InvalidDataException($"{FormatLineColumn(wordData.Start)} Unknown word data!");
- }
- }
- }
- else if (order.resw() is ReswContext resw)
- {
- if (resw.numberdata() is NumberdataContext numberdata)
- {
- var numBytes = 2 * Helper.GetAsInt32(numberdata);
- segment.AllocateBytes(numBytes);
- }
- else if (resw.id() is IdContext id)
- {
- var numBytes = 2 * LimitInt32Range(pass.First ? 0 : LabelToInt32Converter(id.GetText(), () => id.Start), min: int.MinValue, max: int.MaxValue, () => id.Start);
- segment.AllocateBytes(numBytes);
- }
- }
- else if (order.instruction() is InstructionContext instr)
- {
- var name = instr.id().GetText();
- if (!instructionDict.TryGetValue(name, out var desc))
- {
- throw new InvalidDataException($"{FormatLineColumn(instr.Start)} Unknown instruction '{name}'!");
- }
-
- if (segment is not CodeSegment thisSegment)
- {
- throw new InvalidDataException($"{FormatLineColumn(instr.Start)} This must be placed at `section .text`!");
- }
-
- var pc = thisSegment.PC;
-
- var word = new BdxInstruction(desc.Code);
-
- var args = desc.Args ?? new Arg[0];
-
- var instrArgs = instr.arg();
-
- for (int x = 0; x < args.Length; x++)
- {
- if (args[x].Type == ArgType.Ssub)
- {
- word.Ssub = (ushort)resolveInt32ForSsub(instrArgs[x], pass);
- }
- }
-
- segment.Write(BitConverter.GetBytes(word.Code));
-
- for (int x = 0; x < args.Length; x++)
- {
- if (args[x].Type == ArgType.Imm16)
- {
- if (args[x].IsRelative)
- {
- var baseOffset = -pc - desc.CodeSize;
-
- segment.Write(BitConverter.GetBytes((ushort)(baseOffset + resolveInt32ForRelativeImm16(instrArgs[x], pass))));
- }
- else
- {
- segment.Write(BitConverter.GetBytes((ushort)(resolveInt32ForValueImm16(instrArgs[x], pass))));
- }
- }
- else if (args[x].Type == ArgType.Imm32)
- {
- if (args[x].IsRelative)
- {
- var baseOffset = -pc - desc.CodeSize;
-
- segment.Write(BitConverter.GetBytes((uint)(baseOffset + resolveInt32ForRelativeImm32(instrArgs[x], pass))));
- }
- else
- {
- segment.Write(BitConverter.GetBytes((uint)(resolveInt32ForValueImm32(instrArgs[x], pass))));
- }
- }
- else if (args[x].Type == ArgType.Float32)
- {
- {
- segment.Write(BitConverter.GetBytes((float)(resolveFloat32ForValueFloat32(instrArgs[x], pass))));
- }
- }
- }
- }
- else if (order.include() is IncludeContext include)
- {
- var scriptName = include.FileName().GetText().Trim('"');
- var subScript = loadScript(scriptName);
-
- var stream = FromString(subScript, scriptName);
- var lexer = new BdxScriptLexer(stream);
- var tokens = new CommonTokenStream(lexer);
- var parser = new BdxScriptParser(tokens);
- var subRoot = parser.prog();
-
- WalkStatements(subRoot);
- }
- else
- {
- //throw new InvalidDataException("Unknown statement!");
- // maybe NL
- }
- }
- }
- }
-
- {
- var stream = FromString(script, scriptName);
- var lexer = new BdxScriptLexer(stream);
- var tokens = new CommonTokenStream(lexer);
- var parser = new BdxScriptParser(tokens);
- var root = parser.prog();
-
- WalkStatements(root);
- }
-
- WordAlignment();
-
- lastBssBytes = bssSeg.numBytes;
-
- if (pass.Last)
- {
- Content = words.ToArray();
- }
- }
- }
-
- private int LimitInt32Range(int value, int min, int max, Func getStart)
- {
- if (min <= value && value <= max)
- {
- return value;
- }
-
- throw new ArgumentOutOfRangeException(FormatErrorMessage(getStart(), $"Integer must be in range of from {min} to {max}"));
- }
-
- private static ICharStream FromString(string script, string sourceName)
- {
- var stream = CharStreams.fromString(script);
- if (stream is CodePointCharStream charStream)
- {
- charStream.name = sourceName;
- }
- return stream;
- }
-
- private static string FormatLineColumn(IToken start) => $"{start.InputStream.SourceName} line {start.Line}:{start.Column}";
-
- private static string FormatErrorMessage(IToken start, IFormattable text) => $"{start.InputStream.SourceName} line {start.Line}:{start.Column} {text}";
- private static string FormatErrorMessage(IToken start, string text) => $"{start.InputStream.SourceName} line {start.Line}:{start.Column} {text}";
-
- private static class Helper
- {
- internal static int GetAsInt32(NumberdataContext numberData)
- {
- var decimalNumber = numberData.decimalnumber;
- if (decimalNumber != null)
- {
- var body = decimalNumber.Text;
-
- if (uint.TryParse(body, out uint uintVal))
- {
- return (int)uintVal;
- }
- else if (int.TryParse(body, out int intVal))
- {
- return intVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
- }
- }
- else if (numberData.hexnumber is IToken hexNumber)
- {
- var body = hexNumber.Text;
-
- if (uint.TryParse(body, NumberStyles.HexNumber, null, out uint uintVal))
- {
- return (int)uintVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
- }
- }
- else if (numberData.floatnumber is IToken)
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
- }
- else
- {
- throw new InvalidDataException($"{FormatLineColumn(numberData.Start)} Unknown number data!");
- }
- }
-
- internal static ArgContext ParseAsArg(string addr)
- {
- var stream = CharStreams.fromString(addr);
- var lexer = new BdxScriptLexer(stream);
- var tokens = new CommonTokenStream(lexer);
- var parser = new BdxScriptParser(tokens);
-
- return parser.arg();
- }
-
- internal static Func NumberdataContextToInt32OrFloat32ConverterFactory()
- {
- return (NumberdataContext numberData) =>
- {
- var decimalNumber = numberData.decimalnumber;
- if (decimalNumber != null)
- {
- var body = decimalNumber.Text;
-
- if (uint.TryParse(body, out uint uintVal))
- {
- return (int)uintVal;
- }
- else if (int.TryParse(body, out int intVal))
- {
- return intVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
- }
- }
- else if (numberData.hexnumber is IToken hexNumber)
- {
- var body = hexNumber.Text;
-
- if (uint.TryParse(body, NumberStyles.HexNumber, null, out uint uintVal))
- {
- return (int)uintVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
- }
- }
- else if (numberData.floatnumber is IToken floatnumber)
- {
- var body = floatnumber.Text;
-
- if (float.TryParse(body, NumberStyles.HexNumber, invariantNumberFormat, out float floatVal))
- {
- return (float)floatVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be float32 here"));
- }
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Unknown number data!"));
- }
- };
- }
-
- internal static Func NumberdataContextToInt32ConverterFactory(bool allowFloat)
- {
- var func = NumberdataContextToInt32OrFloat32ConverterFactory();
-
- return (NumberdataContext numberData) =>
- {
- var value = func(numberData);
-
- if (value is int intValue)
- {
- return intValue;
- }
- else if (value is float floatValue)
- {
- if (!allowFloat)
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
- }
- return BitConverter.ToInt32(BitConverter.GetBytes(floatValue));
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Numeric converter bug"));
- }
- };
- }
-
- internal static Func AllowedRangeFactory(Func factory, int min, int max)
- {
- return (NumberdataContext numberData) =>
- {
- var value = factory(numberData);
- if (min <= value && value <= max)
- {
- return value;
- }
-
- throw new ArgumentOutOfRangeException(FormatErrorMessage(numberData.Start, $"The value must be in range of from {min} to {max}!"));
- };
- }
-
- internal static byte GetAsByte(NumberdataContext numberData)
- {
- var decimalNumber = numberData.decimalnumber;
- if (decimalNumber != null)
- {
- var body = decimalNumber.Text;
-
- if (byte.TryParse(body, out byte byteVal))
- {
- return byteVal;
- }
- else if (sbyte.TryParse(body, out sbyte sbyteVal))
- {
- return (byte)sbyteVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be byte here"));
- }
- }
- else if (numberData.hexnumber is IToken hexNumber)
- {
- var body = hexNumber.Text;
-
- if (byte.TryParse(body, NumberStyles.HexNumber, null, out byte byteVal))
- {
- return byteVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be byte here"));
- }
- }
- else if (numberData.floatnumber is IToken)
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Unknown number data!"));
- }
- }
-
- internal static ushort GetAsUInt16(NumberdataContext numberData)
- {
- var decimalNumber = numberData.decimalnumber;
- if (decimalNumber != null)
- {
- var body = decimalNumber.Text;
-
- if (ushort.TryParse(body, out ushort ushortVal))
- {
- return ushortVal;
- }
- else if (short.TryParse(body, out short shortVal))
- {
- return (byte)shortVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int16 here"));
- }
- }
- else if (numberData.hexnumber is IToken hexNumber)
- {
- var body = hexNumber.Text;
-
- if (ushort.TryParse(body, NumberStyles.HexNumber, null, out ushort ushortVal))
- {
- return ushortVal;
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int16 here"));
- }
- }
- else if (numberData.floatnumber is IToken)
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
- }
- else
- {
- throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Unknown number data!"));
- }
- }
- }
-
- private interface ISegment
- {
- void Write(byte[] bytes);
- void WriteByte(byte value);
- void AllocateBytes(int num);
- ILabel GetLabel();
- }
-
- private class BssSegment : ISegment
- {
- public int numBytes = 0;
-
- public void AllocateBytes(int num)
- {
- numBytes += num;
- }
-
- public ILabel GetLabel()
- {
- return new BssLabel { ByteOffset = numBytes };
- }
-
- public void Write(byte[] bytes)
- {
- throw new InvalidOperationException("`section .bss` cannot place static data. Use `resb 4` or `resw 2` or such.");
- }
-
- public void WriteByte(byte value)
- {
- throw new InvalidOperationException("`section .bss` cannot place static data. Use `resb 4` or `resw 2` or such.");
- }
- }
-
- private class CodeSegment : ISegment
- {
- private readonly MemoryStream _words;
-
- public CodeSegment(MemoryStream words)
- {
- _words = words;
- }
-
- public int PC => (int)(_words.Length / 2 - 8);
-
- public void AllocateBytes(int num)
- {
- _words.Write(new byte[num]);
- }
-
- public ILabel GetLabel()
- {
- return new CodeLabel { PC = PC };
- }
-
- public void Write(byte[] buffer)
- {
- _words.Write(buffer);
- }
-
- public void WriteByte(byte value)
- {
- _words.WriteByte(value);
- }
- }
-
- private interface ILabel
- {
-
- }
-
- private class CodeLabel : ILabel
- {
- public int PC { get; set; }
- }
-
- private class BssLabel : ILabel
- {
- public int ByteOffset { get; set; }
- }
-
- private class ConstLabel : ILabel
- {
- public int Value { get; set; }
- }
-
- private record CompilePass(
- int Index,
- bool First,
- bool Last
- );
-
- private static readonly IFormatProvider invariantNumberFormat = CultureInfo.InvariantCulture.NumberFormat;
- }
-}
+using Antlr4.Runtime;
+using Antlr4.Runtime.Tree;
+using NLog;
+using OpenKh.Kh2.Bdx.Models;
+using System;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using Xe.BinaryMapper;
+using static BdxScriptParser;
+using static OpenKh.Kh2.Bdx.Models.BdxHeader;
+using static OpenKh.Kh2.Bdx.Models.BdxInstructionDesc;
+namespace OpenKh.Kh2.Bdx.Utils
+{
+ public class BdxEncoder
+ {
+ public byte[] Content { get; } = new byte[0];
+
+ public BdxEncoder(
+ BdxHeader header,
+ string script,
+ string scriptName,
+ Func loadScript
+ )
+ {
+ var logger = LogManager.GetLogger("BdxEncoder");
+
+ if (string.IsNullOrWhiteSpace(script) && header.IsEmpty)
+ {
+ return;
+ }
+
+ var labels = new SortedDictionary();
+
+ var instructionDict = new (string, BdxInstructionDesc)[0]
+ .Concat(
+ BdxInstructionDescs.GetDescs()
+ .Select(desc => (desc.Name, desc))
+ )
+ .Concat(
+ BdxInstructionDescs.GetDescs()
+ .SelectMany(
+ desc => desc.OldNames
+ .Select(
+ oldName => (oldName, desc)
+ )
+ )
+ )
+ .GroupBy(pair => pair.Item1)
+ .Select(it => it.First())
+ .ToDictionary(it => it.Item1, it => it.Item2);
+
+ Func ResolveInt32Factory(
+ Func stringToInt32,
+ Func, int> labelToInt32
+ )
+ {
+ return (ArgContext argContext, CompilePass pass) =>
+ {
+ if (pass.First)
+ {
+ return 0;
+ }
+ else
+ {
+ if (argContext.numberdata() is NumberdataContext numberdata)
+ {
+ return stringToInt32(numberdata);
+ }
+ else if (argContext.id() is IdContext id)
+ {
+ var name = id.GetText();
+ return labelToInt32(name, () => id.Start);
+ }
+ else
+ {
+ throw new InvalidDataException($"{FormatLineColumn(argContext.Start)} Unknown arg!");
+ }
+ }
+ };
+ }
+
+ int LabelToInt32Converter(string name, Func getStart)
+ {
+ if (!labels.TryGetValue(name, out var any) || any == null)
+ {
+ throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} not found"));
+ }
+
+ if (any is CodeLabel label)
+ {
+ return label.PC;
+ }
+ else if (any is ConstLabel constLabel)
+ {
+ return constLabel.Value;
+ }
+ else if (any is BssLabel bssLabel)
+ {
+ return bssLabel.ByteOffset;
+ }
+
+ throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} cannot be used here"));
+ }
+
+ float LabelToFloat32Converter(string name, Func getStart)
+ {
+ if (!labels.TryGetValue(name, out var any) || any == null)
+ {
+ throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} not found"));
+ }
+
+ if (any is ConstLabel constLabel)
+ {
+ return constLabel.Value;
+ }
+
+ throw new ArgumentException(FormatErrorMessage(getStart(), $"Label {name} cannot be used here"));
+ }
+
+ Func ResolveFloat32Factory(
+ Func, float> labelToFloat32
+ )
+ {
+ return (ArgContext argContext, CompilePass pass) =>
+ {
+ if (pass.First)
+ {
+ return 0;
+ }
+ else
+ {
+ if (argContext.numberdata() is NumberdataContext numberdata)
+ {
+ return float.Parse(numberdata.GetText(), invariantNumberFormat);
+ }
+ else if (argContext.id() is IdContext id)
+ {
+ var name = id.GetText();
+ return labelToFloat32(name, () => id.Start);
+ }
+ else
+ {
+ throw new InvalidDataException($"{FormatLineColumn(argContext.Start)} Unknown arg!");
+ }
+ }
+ };
+ }
+
+ var resolveInt32ForIntTrigger = ResolveInt32Factory(
+ stringToInt32: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
+ labelToInt32: LabelToInt32Converter
+ );
+
+ var resolveInt32ForSsub = ResolveInt32Factory(
+ stringToInt32: Helper.AllowedRangeFactory(
+ factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
+ min: -2048,
+ max: 4095
+ ),
+ labelToInt32: LabelToInt32Converter
+ );
+
+ var resolveInt32ForRelativeImm16 = ResolveInt32Factory(
+ stringToInt32: Helper.AllowedRangeFactory(
+ factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
+ min: short.MinValue,
+ max: short.MaxValue
+ ),
+ labelToInt32: LabelToInt32Converter
+ );
+
+ var resolveInt32ForValueImm16 = ResolveInt32Factory(
+ stringToInt32: Helper.AllowedRangeFactory(
+ factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
+ min: short.MinValue,
+ max: ushort.MaxValue
+ ),
+ labelToInt32: LabelToInt32Converter
+ );
+
+ var resolveInt32ForRelativeImm32 = ResolveInt32Factory(
+ stringToInt32: Helper.AllowedRangeFactory(
+ factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false),
+ min: int.MinValue,
+ max: int.MaxValue
+ ),
+ labelToInt32: LabelToInt32Converter
+ );
+
+ var resolveInt32ForValueImm32 = ResolveInt32Factory(
+ stringToInt32: Helper.AllowedRangeFactory(
+ factory: Helper.NumberdataContextToInt32ConverterFactory(allowFloat: true),
+ min: int.MinValue,
+ max: int.MaxValue
+ ),
+ labelToInt32: LabelToInt32Converter
+ );
+
+ var resolveFloat32ForValueFloat32 = ResolveFloat32Factory(
+ labelToFloat32: LabelToFloat32Converter
+ );
+
+ int lastBssBytes = 0;
+
+ var compilePasses = new CompilePass[] {
+ new CompilePass(Index: 0, First: true, Last: false), // resolve code placement and labels offset
+ new CompilePass(Index: 1, First: false, Last: false), // resolve equ (const)
+ new CompilePass(Index: 2, First: false, Last: true), // compile
+ };
+
+ foreach (var pass in compilePasses)
+ {
+ var words = new MemoryStream();
+
+ void WordAlignment()
+ {
+ if ((words.Length & 1) != 0)
+ {
+ words.WriteByte(0);
+ }
+ }
+
+ BinaryMapping.WriteObject(words, header);
+
+ if (!pass.First)
+ {
+ if (header.WorkSize < lastBssBytes)
+ {
+ logger.Warn($"WorkSize {header.WorkSize} is extended to {lastBssBytes}");
+
+ words.Position = 16;
+ words.Write(BitConverter.GetBytes(lastBssBytes));
+ words.Seek(0, SeekOrigin.End);
+ }
+ }
+
+ foreach (var intTrigger in header.Triggers
+ .Select(
+ item =>
+ {
+ return new IntTrigger
+ {
+ Key = item.Key,
+ Addr = resolveInt32ForIntTrigger(Helper.ParseAsArg(item.Addr), pass),
+ };
+ }
+ )
+ )
+ {
+ BinaryMapping.WriteObject(words, intTrigger);
+ }
+
+ BinaryMapping.WriteObject(words, new IntTrigger { Addr = 0, Key = 0, });
+
+ var codeSeg = new CodeSegment(words);
+ var bssSeg = new BssSegment();
+ ISegment segment = codeSeg;
+
+ void AddLabel(string labelName, ILabel labelValue, Func getTokenPos)
+ {
+ if (pass.First)
+ {
+ if (!labels.TryAdd(labelName, labelValue))
+ {
+ throw new InvalidDataException($"{FormatLineColumn(getTokenPos().Start)} Redefine of label {labelName}");
+ }
+ }
+ else
+ {
+ labels[labelName] = labelValue;
+ }
+ }
+
+ void WalkStatements(ProgContext root)
+ {
+ foreach (var st in root.statement())
+ {
+ //var pc = (int)(words.Length / 2 - 8);
+
+ if (st.section() is SectionContext section)
+ {
+ var id = section.section_id();
+ var sectionName = id.GetText();
+ if (sectionName == ".text")
+ {
+ segment = codeSeg;
+ }
+ else if (sectionName == ".bss")
+ {
+ segment = bssSeg;
+ }
+ else
+ {
+ throw new InvalidDataException($"{FormatLineColumn(id.Start)} Unknown section name {sectionName}");
+ }
+ continue;
+ }
+ else if (st.equ() is EquContext equ)
+ {
+ var intValue = Helper.NumberdataContextToInt32ConverterFactory(allowFloat: false).Invoke(equ.numberdata());
+
+ AddLabel(
+ equ.name.GetText(),
+ new ConstLabel { Value = intValue, },
+ () => equ.name
+ );
+ }
+
+ if (st.label() is LabelContext label)
+ {
+ WordAlignment();
+ var id = label.id();
+ AddLabel(
+ id.GetText(),
+ segment.GetLabel(),
+ () => id
+ );
+ }
+
+ if (st.order() is OrderContext order)
+ {
+ if (order.db() is DbContext db)
+ {
+ foreach (var byteData in db.bytedata())
+ {
+ if (byteData.numberdata() is NumberdataContext numberData)
+ {
+ segment.WriteByte(Helper.GetAsByte(numberData));
+ }
+ else if (byteData.StringData() is ITerminalNode stringData)
+ {
+ var text = stringData.GetText();
+ var bytes = Encoding.ASCII.GetBytes(text.Substring(1, text.Length - 2));
+ segment.Write(bytes);
+ }
+ else if (byteData.id() is IdContext id)
+ {
+ var value = pass.First ? 0 : LabelToInt32Converter(id.GetText(), () => id.Start);
+ segment.WriteByte((byte)value);
+ }
+ else
+ {
+ throw new InvalidDataException($"{FormatLineColumn(byteData.Start)} Unknown byte data!");
+ }
+ }
+ }
+ else if (order.resb() is ResbContext resb)
+ {
+ if (resb.numberdata() is NumberdataContext numberdata)
+ {
+ var numBytes = Helper.GetAsInt32(numberdata);
+ segment.AllocateBytes(numBytes);
+ }
+ else if (resb.id() is IdContext id)
+ {
+ var numBytes = LimitInt32Range(
+ pass.First
+ ? 0
+ : LabelToInt32Converter(id.GetText(), () => id.Start),
+ min: int.MinValue,
+ max: int.MaxValue,
+ getStart: () => id.Start
+ );
+ segment.AllocateBytes(numBytes);
+ }
+ }
+ else if (order.dw() is DwContext dw)
+ {
+ WordAlignment();
+ foreach (var wordData in dw.worddata())
+ {
+ if (wordData.numberdata() is NumberdataContext numberdata)
+ {
+ segment.Write(BitConverter.GetBytes(Helper.GetAsUInt16(numberdata)));
+ }
+ else if (wordData.id() is IdContext id)
+ {
+ var value = (ushort)LimitInt32Range(pass.First ? 0 : LabelToInt32Converter(id.GetText(), () => id.Start), min: -127, max: 255, () => id.Start);
+ segment.Write(BitConverter.GetBytes(value));
+ }
+ else
+ {
+ throw new InvalidDataException($"{FormatLineColumn(wordData.Start)} Unknown word data!");
+ }
+ }
+ }
+ else if (order.resw() is ReswContext resw)
+ {
+ if (resw.numberdata() is NumberdataContext numberdata)
+ {
+ var numBytes = 2 * Helper.GetAsInt32(numberdata);
+ segment.AllocateBytes(numBytes);
+ }
+ else if (resw.id() is IdContext id)
+ {
+ var numBytes = 2 * LimitInt32Range(pass.First ? 0 : LabelToInt32Converter(id.GetText(), () => id.Start), min: int.MinValue, max: int.MaxValue, () => id.Start);
+ segment.AllocateBytes(numBytes);
+ }
+ }
+ else if (order.instruction() is InstructionContext instr)
+ {
+ var name = instr.id().GetText();
+ if (!instructionDict.TryGetValue(name, out var desc))
+ {
+ throw new InvalidDataException($"{FormatLineColumn(instr.Start)} Unknown instruction '{name}'!");
+ }
+
+ if (segment is not CodeSegment thisSegment)
+ {
+ throw new InvalidDataException($"{FormatLineColumn(instr.Start)} This must be placed at `section .text`!");
+ }
+
+ var pc = thisSegment.PC;
+
+ var word = new BdxInstruction(desc.Code);
+
+ var args = desc.Args ?? new Arg[0];
+
+ var instrArgs = instr.arg();
+
+ for (int x = 0; x < args.Length; x++)
+ {
+ if (args[x].Type == ArgType.Ssub)
+ {
+ word.Ssub = (ushort)resolveInt32ForSsub(instrArgs[x], pass);
+ }
+ }
+
+ segment.Write(BitConverter.GetBytes(word.Code));
+
+ for (int x = 0; x < args.Length; x++)
+ {
+ if (args[x].Type == ArgType.Imm16)
+ {
+ if (args[x].IsRelative)
+ {
+ var baseOffset = -pc - desc.CodeSize;
+
+ segment.Write(BitConverter.GetBytes((ushort)(baseOffset + resolveInt32ForRelativeImm16(instrArgs[x], pass))));
+ }
+ else
+ {
+ segment.Write(BitConverter.GetBytes((ushort)(resolveInt32ForValueImm16(instrArgs[x], pass))));
+ }
+ }
+ else if (args[x].Type == ArgType.Imm32)
+ {
+ if (args[x].IsRelative)
+ {
+ var baseOffset = -pc - desc.CodeSize;
+
+ segment.Write(BitConverter.GetBytes((uint)(baseOffset + resolveInt32ForRelativeImm32(instrArgs[x], pass))));
+ }
+ else
+ {
+ segment.Write(BitConverter.GetBytes((uint)(resolveInt32ForValueImm32(instrArgs[x], pass))));
+ }
+ }
+ else if (args[x].Type == ArgType.Float32)
+ {
+ {
+ segment.Write(BitConverter.GetBytes((float)(resolveFloat32ForValueFloat32(instrArgs[x], pass))));
+ }
+ }
+ }
+ }
+ else if (order.include() is IncludeContext include)
+ {
+ var scriptName = include.FileName().GetText().Trim('"');
+ var subScript = loadScript(scriptName);
+
+ var stream = FromString(subScript, scriptName);
+ var lexer = new BdxScriptLexer(stream);
+ var tokens = new CommonTokenStream(lexer);
+ var parser = new BdxScriptParser(tokens);
+ var subRoot = parser.prog();
+
+ WalkStatements(subRoot);
+ }
+ else
+ {
+ //throw new InvalidDataException("Unknown statement!");
+ // maybe NL
+ }
+ }
+ }
+ }
+
+ {
+ var stream = FromString(script, scriptName);
+ var lexer = new BdxScriptLexer(stream);
+ var tokens = new CommonTokenStream(lexer);
+ var parser = new BdxScriptParser(tokens);
+ var root = parser.prog();
+
+ WalkStatements(root);
+ }
+
+ WordAlignment();
+
+ lastBssBytes = bssSeg.numBytes;
+
+ if (pass.Last)
+ {
+ Content = words.ToArray();
+ }
+ }
+ }
+
+ private int LimitInt32Range(int value, int min, int max, Func getStart)
+ {
+ if (min <= value && value <= max)
+ {
+ return value;
+ }
+
+ throw new ArgumentOutOfRangeException(FormatErrorMessage(getStart(), $"Integer must be in range of from {min} to {max}"));
+ }
+
+ private static ICharStream FromString(string script, string sourceName)
+ {
+ var stream = CharStreams.fromString(script);
+ if (stream is CodePointCharStream charStream)
+ {
+ charStream.name = sourceName;
+ }
+ return stream;
+ }
+
+ private static string FormatLineColumn(IToken start) => $"{start.InputStream.SourceName} line {start.Line}:{start.Column}";
+
+ private static string FormatErrorMessage(IToken start, IFormattable text) => $"{start.InputStream.SourceName} line {start.Line}:{start.Column} {text}";
+ private static string FormatErrorMessage(IToken start, string text) => $"{start.InputStream.SourceName} line {start.Line}:{start.Column} {text}";
+
+ private static class Helper
+ {
+ internal static int GetAsInt32(NumberdataContext numberData)
+ {
+ var decimalNumber = numberData.decimalnumber;
+ if (decimalNumber != null)
+ {
+ var body = decimalNumber.Text;
+
+ if (uint.TryParse(body, out uint uintVal))
+ {
+ return (int)uintVal;
+ }
+ else if (int.TryParse(body, out int intVal))
+ {
+ return intVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
+ }
+ }
+ else if (numberData.hexnumber is IToken hexNumber)
+ {
+ var body = hexNumber.Text;
+
+ if (uint.TryParse(body, NumberStyles.HexNumber, null, out uint uintVal))
+ {
+ return (int)uintVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
+ }
+ }
+ else if (numberData.floatnumber is IToken)
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
+ }
+ else
+ {
+ throw new InvalidDataException($"{FormatLineColumn(numberData.Start)} Unknown number data!");
+ }
+ }
+
+ internal static ArgContext ParseAsArg(string addr)
+ {
+ var stream = CharStreams.fromString(addr);
+ var lexer = new BdxScriptLexer(stream);
+ var tokens = new CommonTokenStream(lexer);
+ var parser = new BdxScriptParser(tokens);
+
+ return parser.arg();
+ }
+
+ internal static Func NumberdataContextToInt32OrFloat32ConverterFactory()
+ {
+ return (NumberdataContext numberData) =>
+ {
+ var decimalNumber = numberData.decimalnumber;
+ if (decimalNumber != null)
+ {
+ var body = decimalNumber.Text;
+
+ if (uint.TryParse(body, out uint uintVal))
+ {
+ return (int)uintVal;
+ }
+ else if (int.TryParse(body, out int intVal))
+ {
+ return intVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
+ }
+ }
+ else if (numberData.hexnumber is IToken hexNumber)
+ {
+ var body = hexNumber.Text;
+
+ if (uint.TryParse(body, NumberStyles.HexNumber, null, out uint uintVal))
+ {
+ return (int)uintVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int32 here"));
+ }
+ }
+ else if (numberData.floatnumber is IToken floatnumber)
+ {
+ var body = floatnumber.Text;
+
+ if (float.TryParse(body, NumberStyles.HexNumber, invariantNumberFormat, out float floatVal))
+ {
+ return (float)floatVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be float32 here"));
+ }
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Unknown number data!"));
+ }
+ };
+ }
+
+ internal static Func NumberdataContextToInt32ConverterFactory(bool allowFloat)
+ {
+ var func = NumberdataContextToInt32OrFloat32ConverterFactory();
+
+ return (NumberdataContext numberData) =>
+ {
+ var value = func(numberData);
+
+ if (value is int intValue)
+ {
+ return intValue;
+ }
+ else if (value is float floatValue)
+ {
+ if (!allowFloat)
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
+ }
+ return BitConverter.ToInt32(BitConverter.GetBytes(floatValue));
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Numeric converter bug"));
+ }
+ };
+ }
+
+ internal static Func AllowedRangeFactory(Func factory, int min, int max)
+ {
+ return (NumberdataContext numberData) =>
+ {
+ var value = factory(numberData);
+ if (min <= value && value <= max)
+ {
+ return value;
+ }
+
+ throw new ArgumentOutOfRangeException(FormatErrorMessage(numberData.Start, $"The value must be in range of from {min} to {max}!"));
+ };
+ }
+
+ internal static byte GetAsByte(NumberdataContext numberData)
+ {
+ var decimalNumber = numberData.decimalnumber;
+ if (decimalNumber != null)
+ {
+ var body = decimalNumber.Text;
+
+ if (byte.TryParse(body, out byte byteVal))
+ {
+ return byteVal;
+ }
+ else if (sbyte.TryParse(body, out sbyte sbyteVal))
+ {
+ return (byte)sbyteVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be byte here"));
+ }
+ }
+ else if (numberData.hexnumber is IToken hexNumber)
+ {
+ var body = hexNumber.Text;
+
+ if (byte.TryParse(body, NumberStyles.HexNumber, null, out byte byteVal))
+ {
+ return byteVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be byte here"));
+ }
+ }
+ else if (numberData.floatnumber is IToken)
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Unknown number data!"));
+ }
+ }
+
+ internal static ushort GetAsUInt16(NumberdataContext numberData)
+ {
+ var decimalNumber = numberData.decimalnumber;
+ if (decimalNumber != null)
+ {
+ var body = decimalNumber.Text;
+
+ if (ushort.TryParse(body, out ushort ushortVal))
+ {
+ return ushortVal;
+ }
+ else if (short.TryParse(body, out short shortVal))
+ {
+ return (byte)shortVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int16 here"));
+ }
+ }
+ else if (numberData.hexnumber is IToken hexNumber)
+ {
+ var body = hexNumber.Text;
+
+ if (ushort.TryParse(body, NumberStyles.HexNumber, null, out ushort ushortVal))
+ {
+ return ushortVal;
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Must be int16 here"));
+ }
+ }
+ else if (numberData.floatnumber is IToken)
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Float number is not allowed here"));
+ }
+ else
+ {
+ throw new InvalidDataException(FormatErrorMessage(numberData.Start, "Unknown number data!"));
+ }
+ }
+ }
+
+ private interface ISegment
+ {
+ void Write(byte[] bytes);
+ void WriteByte(byte value);
+ void AllocateBytes(int num);
+ ILabel GetLabel();
+ }
+
+ private class BssSegment : ISegment
+ {
+ public int numBytes = 0;
+
+ public void AllocateBytes(int num)
+ {
+ numBytes += num;
+ }
+
+ public ILabel GetLabel()
+ {
+ return new BssLabel { ByteOffset = numBytes };
+ }
+
+ public void Write(byte[] bytes)
+ {
+ throw new InvalidOperationException("`section .bss` cannot place static data. Use `resb 4` or `resw 2` or such.");
+ }
+
+ public void WriteByte(byte value)
+ {
+ throw new InvalidOperationException("`section .bss` cannot place static data. Use `resb 4` or `resw 2` or such.");
+ }
+ }
+
+ private class CodeSegment : ISegment
+ {
+ private readonly MemoryStream _words;
+
+ public CodeSegment(MemoryStream words)
+ {
+ _words = words;
+ }
+
+ public int PC => (int)(_words.Length / 2 - 8);
+
+ public void AllocateBytes(int num)
+ {
+ _words.Write(new byte[num]);
+ }
+
+ public ILabel GetLabel()
+ {
+ return new CodeLabel { PC = PC };
+ }
+
+ public void Write(byte[] buffer)
+ {
+ _words.Write(buffer);
+ }
+
+ public void WriteByte(byte value)
+ {
+ _words.WriteByte(value);
+ }
+ }
+
+ private interface ILabel
+ {
+
+ }
+
+ private class CodeLabel : ILabel
+ {
+ public int PC { get; set; }
+ }
+
+ private class BssLabel : ILabel
+ {
+ public int ByteOffset { get; set; }
+ }
+
+ private class ConstLabel : ILabel
+ {
+ public int Value { get; set; }
+ }
+
+ private record CompilePass(
+ int Index,
+ bool First,
+ bool Last
+ );
+
+ private static readonly IFormatProvider invariantNumberFormat = CultureInfo.InvariantCulture.NumberFormat;
+ }
+}
diff --git a/OpenKh.Command.Bdxio/Utils/BdxTrigger.cs b/OpenKh.Kh2/Bdx/Utils/BdxTrigger.cs
similarity index 95%
rename from OpenKh.Command.Bdxio/Utils/BdxTrigger.cs
rename to OpenKh.Kh2/Bdx/Utils/BdxTrigger.cs
index fc8747bc6..de823f34b 100644
--- a/OpenKh.Command.Bdxio/Utils/BdxTrigger.cs
+++ b/OpenKh.Kh2/Bdx/Utils/BdxTrigger.cs
@@ -1,37 +1,37 @@
-namespace OpenKh.Command.Bdxio.Utils
-{
- public record BdxTrigger(string Label, int Key)
- {
- public static BdxTrigger[] GetKnownItems() => new BdxTrigger[]
- {
- new BdxTrigger("OBJ_INIT", 0x0),
- new BdxTrigger("OBJ_MAIN", 0x1),
- new BdxTrigger("UNIT_INIT", 0x2),
- new BdxTrigger("UNIT_MAIN", 0x3),
- new BdxTrigger("UNIT_FINALIZER", 0x4),
- new BdxTrigger("TEST", 0x5),
- new BdxTrigger("OBJ_DAMAGE", 0x6),
- new BdxTrigger("NEWGAME", 0x7),
- new BdxTrigger("PROGRESS_CALLBACK", 0x8),
- new BdxTrigger("GAMEOVER", 0x9),
- new BdxTrigger("SIGNAL_CALLBACK", 0xA),
- new BdxTrigger("REACTION_CALLBACK", 0xB),
- new BdxTrigger("SECOND_SET_CALLBACK", 0xC),
- new BdxTrigger("OBJ_FALL", 0xD),
- new BdxTrigger("OBJ_LAND", 0xE),
- new BdxTrigger("OBJ_ATTACK", 0xF),
- new BdxTrigger("OBJ_ANMATR_EFFECT", 0x10),
- new BdxTrigger("OBJ_ANMATR_CALLBACK", 0x11),
- new BdxTrigger("OBJ_CHANGE_ACT", 0x12),
- new BdxTrigger("OBJ_REFLECT", 0x13),
- new BdxTrigger("MAGIC_START", 0x14),
- new BdxTrigger("MAGIC_SHOT", 0x15),
- new BdxTrigger("LIMIT_START", 0x16),
- new BdxTrigger("LIMIT_CALL", 0x17),
- new BdxTrigger("LIMIT_ANMATR_EFFECT", 0x18),
- new BdxTrigger("LIMIT_ANMATR_CALLBACK", 0x19),
- new BdxTrigger("LIMIT_ATTACK", 0x1A),
- new BdxTrigger("OBJ_IK_ADJUST_CALLBACK", 0x1B),
- };
- }
-}
+namespace OpenKh.Kh2.Bdx.Utils
+{
+ public record BdxTrigger(string Label, int Key)
+ {
+ public static BdxTrigger[] GetKnownItems() => new BdxTrigger[]
+ {
+ new BdxTrigger("OBJ_INIT", 0x0),
+ new BdxTrigger("OBJ_MAIN", 0x1),
+ new BdxTrigger("UNIT_INIT", 0x2),
+ new BdxTrigger("UNIT_MAIN", 0x3),
+ new BdxTrigger("UNIT_FINALIZER", 0x4),
+ new BdxTrigger("TEST", 0x5),
+ new BdxTrigger("OBJ_DAMAGE", 0x6),
+ new BdxTrigger("NEWGAME", 0x7),
+ new BdxTrigger("PROGRESS_CALLBACK", 0x8),
+ new BdxTrigger("GAMEOVER", 0x9),
+ new BdxTrigger("SIGNAL_CALLBACK", 0xA),
+ new BdxTrigger("REACTION_CALLBACK", 0xB),
+ new BdxTrigger("SECOND_SET_CALLBACK", 0xC),
+ new BdxTrigger("OBJ_FALL", 0xD),
+ new BdxTrigger("OBJ_LAND", 0xE),
+ new BdxTrigger("OBJ_ATTACK", 0xF),
+ new BdxTrigger("OBJ_ANMATR_EFFECT", 0x10),
+ new BdxTrigger("OBJ_ANMATR_CALLBACK", 0x11),
+ new BdxTrigger("OBJ_CHANGE_ACT", 0x12),
+ new BdxTrigger("OBJ_REFLECT", 0x13),
+ new BdxTrigger("MAGIC_START", 0x14),
+ new BdxTrigger("MAGIC_SHOT", 0x15),
+ new BdxTrigger("LIMIT_START", 0x16),
+ new BdxTrigger("LIMIT_CALL", 0x17),
+ new BdxTrigger("LIMIT_ANMATR_EFFECT", 0x18),
+ new BdxTrigger("LIMIT_ANMATR_CALLBACK", 0x19),
+ new BdxTrigger("LIMIT_ATTACK", 0x1A),
+ new BdxTrigger("OBJ_IK_ADJUST_CALLBACK", 0x1B),
+ };
+ }
+}
diff --git a/OpenKh.Kh2/OpenKh.Kh2.csproj b/OpenKh.Kh2/OpenKh.Kh2.csproj
index a7f14128d..1ef158e8a 100644
--- a/OpenKh.Kh2/OpenKh.Kh2.csproj
+++ b/OpenKh.Kh2/OpenKh.Kh2.csproj
@@ -1,11 +1,13 @@
- netstandard2.0;net8.0
+ net8.0
latest
- 25.02.10.025.02.10.025.02.10.0-local25.02.10.0-localOpenKH contributorsOpenKHCopyright (C) OpenKH https://github.com/OpenKH/OpenKh
+ 25.02.10.025.02.10.025.02.10.0-local25.02.10.0-localOpenKH contributorsOpenKHCopyright (C) OpenKH https://github.com/OpenKH/OpenKhenable
+
+
diff --git a/OpenKh.Patcher/BarEntryExtractor/ProvideExtractorsService.cs b/OpenKh.Patcher/BarEntryExtractor/ProvideExtractorsService.cs
index fd1456cf6..67d1c90fa 100644
--- a/OpenKh.Patcher/BarEntryExtractor/ProvideExtractorsService.cs
+++ b/OpenKh.Patcher/BarEntryExtractor/ProvideExtractorsService.cs
@@ -1,6 +1,6 @@
-using OpenKh.Command.Bdxio.Utils;
using OpenKh.Common;
using OpenKh.Kh2;
+using OpenKh.Kh2.Bdx.Utils;
using OpenKh.Kh2.Messages;
using System;
using System.Collections.Generic;
diff --git a/OpenKh.Patcher/Kh2Ps2Patch/PatchCodec.cs b/OpenKh.Patcher/Kh2Ps2Patch/PatchCodec.cs
index a0881d709..e8e282962 100644
--- a/OpenKh.Patcher/Kh2Ps2Patch/PatchCodec.cs
+++ b/OpenKh.Patcher/Kh2Ps2Patch/PatchCodec.cs
@@ -3,21 +3,31 @@
namespace OpenKh.Patcher.Kh2Ps2Patch
{
///
- /// Encryptor and decryptor codes are taken from https://github.com/GovanifY/KH2FM_Toolkit
///
- /// KH2FM_Toolkit is programmed by GovanifY https://www.govanify.com https://www.twitter.com/GovanifY
- /// KH2FM_Toolkit Copyright (c) 2015 Gauvain "GovanifY" Roussel-Tarbouriech
///
public class PatchCodec
{
+ /// Attributions:
+ ///
+ /// The original KH2PATCH format (Noted here as "Legacy") has been devised by Xeeynamo.
+ /// The new KH2PATCH format (Noted here as "New") is the original format, improved upon by CrazyCatz00.
+ ///
+ /// Signature for the legacy format is 0x5032484B, for the new format is 0x5132484B.
+ ///
+ /// The new format can be compatible with the legacy format as long as it adheres to these differences:
+ ///
+ /// - Legacy format cannot edit OVL.IDX, it also can't edit the ISO direct.
+ /// - Legacy format is unable to add non-existing files.
+ /// - Legacy format patches cannot be decrypted.
+
private static readonly byte[] _xTab = Convert.FromBase64String(
"WAzdWfckf08="
);
- private static readonly byte[] _gTab = Convert.FromBase64String(
+ private static readonly byte[] _cTab = Convert.FromBase64String(
"pBxrgTANI1tcOqfe2/RzWqDCcNEoSKpyYrWafHwg4MciIHLMJsa8gC14tZXbNyF0BhG1fe+JSNcBp27Qbu58zA=="
);
- public byte[] ApplyXeeynamosMethod(ReadOnlySpan input)
+ public byte[] ApplyLegacyFormatMethod(ReadOnlySpan input)
{
var tab = _xTab;
var length = input.Length;
@@ -29,9 +39,9 @@ public byte[] ApplyXeeynamosMethod(ReadOnlySpan input)
return output;
}
- public byte[] ApplyGovanifYsMethod(ReadOnlySpan input)
+ public byte[] ApplyNewFormatMethod(ReadOnlySpan input)
{
- var tab = _gTab;
+ var tab = _cTab;
var length = input.Length;
var output = new byte[length];
for (int index = 0; 0 < length; index++)
diff --git a/OpenKh.Patcher/Kh2Ps2Patch/PatchIO.cs b/OpenKh.Patcher/Kh2Ps2Patch/PatchIO.cs
index f15c5b093..0aa598b7a 100644
--- a/OpenKh.Patcher/Kh2Ps2Patch/PatchIO.cs
+++ b/OpenKh.Patcher/Kh2Ps2Patch/PatchIO.cs
@@ -8,12 +8,6 @@
namespace OpenKh.Patcher.Kh2Ps2Patch
{
- ///
- /// The patch formats are taken from https://github.com/GovanifY/KH2FM_Toolkit
- ///
- /// KH2FM_Toolkit is programmed by GovanifY https://www.govanify.com https://www.twitter.com/GovanifY
- /// KH2FM_Toolkit Copyright (c) 2015 Gauvain "GovanifY" Roussel-Tarbouriech
- ///
public class PatchIO
{
public bool VerifySignature(Memory memory)
diff --git a/OpenKh.Patcher/Kh2Ps2Patch/PatchIOHelper.cs b/OpenKh.Patcher/Kh2Ps2Patch/PatchIOHelper.cs
index 8af300b68..4093efcf4 100644
--- a/OpenKh.Patcher/Kh2Ps2Patch/PatchIOHelper.cs
+++ b/OpenKh.Patcher/Kh2Ps2Patch/PatchIOHelper.cs
@@ -16,7 +16,7 @@ public PatchHeader Read(Memory memory)
}
{
- var decoded = _patchCodec.ApplyXeeynamosMethod(memory.Span);
+ var decoded = _patchCodec.ApplyLegacyFormatMethod(memory.Span);
if (_patchIo.VerifySignature(decoded))
{
return _patchIo.Read(decoded);
@@ -24,7 +24,7 @@ public PatchHeader Read(Memory memory)
}
{
- var decoded = _patchCodec.ApplyGovanifYsMethod(memory.Span);
+ var decoded = _patchCodec.ApplyNewFormatMethod(memory.Span);
if (_patchIo.VerifySignature(decoded))
{
return _patchIo.Read(decoded);
diff --git a/OpenKh.Patcher/Metadata.cs b/OpenKh.Patcher/Metadata.cs
index d084ae7dd..b4f910868 100644
--- a/OpenKh.Patcher/Metadata.cs
+++ b/OpenKh.Patcher/Metadata.cs
@@ -1,77 +1,101 @@
using OpenKh.Kh2;
+using SharpYaml;
+using SharpYaml.Serialization;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text.Json;
+using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
-using YamlDotNet.Serialization;
-using YamlDotNet.Serialization.NamingConventions;
namespace OpenKh.Patcher
{
- public class Metadata
+ [YamlSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, DefaultIgnoreCondition = YamlIgnoreCondition.WhenWritingDefault)]
+
+ public class Preference
{
- public class Dependency
- {
- public string Name { get; set; }
- }
+ public string Title { get; set; }
+ public string Key { get; set; }
+ public string Type { get; set; }
+ public string Description { get; set; }
+ public string Category { get; set; }
+ public string[]? Options { get; set; }
+ public object Value { get; set; }
+ }
+ public class Condition
+ {
+ public string Key { get; set; }
+ public object Value { get; set; }
+ }
+
+ public class Metadata
+ {
public string Title { get; set; }
public string OriginalAuthor { get; set; }
public string Description { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Game { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public int Specifications { get; set; }
- public List Dependencies { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public bool IsCollection { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public List CollectionGames { get; set; }
+ public List? Preferences { get; set; }
+ public string Game { get; set; }
+ public int Specifications { get; set; }
+ public List? Dependencies { get; set; }
+ public bool IsCollection { get; set; }
+ public List? CollectionGames { get; set; }
public List Assets { get; set; }
- private static readonly IDeserializer deserializer =
- new DeserializerBuilder()
- .IgnoreFields()
- .IgnoreUnmatchedProperties()
- .WithNamingConvention(CamelCaseNamingConvention.Instance)
- .Build();
- private static readonly ISerializer serializer =
- new SerializerBuilder()
- .IgnoreFields()
- .WithNamingConvention(CamelCaseNamingConvention.Instance)
- .Build();
-
+ [YamlIgnore]
+ public bool IsValid = true;
- public static Metadata Read(Stream stream)
+ public static Metadata? Read(object inputFormat)
{
+ string? _fetchYamlRAW = null;
+
+ if (inputFormat is StringReader)
+ _fetchYamlRAW = (inputFormat as StringReader).ReadToEnd();
+
+ else if (inputFormat is string)
+ _fetchYamlRAW = File.ReadAllText(inputFormat as string);
+
+ else
+ return null;
+
+ // Replace all back slashes as Windows supports forward slashes but Linux doesn't support back slashes.
+ _fetchYamlRAW = _fetchYamlRAW.Replace('\\', '/');
+
try
{
- return deserializer.Deserialize(new StreamReader(stream)); //Simplifed way of doing this. Cuts out the "deserializer" redundancies and variable for StreamReader(stream))
+ var _fetchSerial = YamlSerializer.Deserialize(_fetchYamlRAW, new YamlSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+
+ // A single mod should not be able to patch a file more than once.
+ // Ignore any and all duplicates that target the same file.
+ var _fetchAssetUnique = _fetchSerial.Assets.DistinctBy(x => new { x.Name, x.Platform, x.Condition });
+ _fetchSerial.Assets = _fetchAssetUnique.ToList();
+
+ return _fetchSerial;
}
- catch (YamlDotNet.Core.YamlException ex)
+ catch (YamlException ex)
{
// Handle YAML parsing errors
Debug.WriteLine($"Error deserializing YAML: {ex.Message}");
- string originalTitle = string.Empty;
+ var _fetchTitle = string.Empty;
+ var _fetchMatch = Regex.Match(_fetchYamlRAW, @"(?<=title:).*", RegexOptions.None, TimeSpan.FromMilliseconds(500));
- // Extract title using regex
- stream.Position = 0; // Reset stream position
- using (var reader = new StreamReader(stream))
- {
- string yamlContent = reader.ReadToEnd();
- var match = Regex.Match(yamlContent, @"(?<=title:).*");
- if (match.Success)
- {
- originalTitle = match.Value.Trim();
- }
- }
+ if (_fetchMatch.Success)
+ _fetchTitle = _fetchMatch.Value.Trim();
var metadata = new Metadata
{
- Title = $"{originalTitle}* \nMOD YML ERROR DETECTED: CHECK FORMATTING"
+ Title = _fetchTitle,
+ IsValid = false
};
return metadata; // Return modified metadata indicating failure
}
+
catch (Exception ex)
{
// Handle other unexpected errors
@@ -83,17 +107,15 @@ public static Metadata Read(Stream stream)
public void Write(Stream stream)
{
using (var writer = new StreamWriter(stream))
- {
- serializer.Serialize(writer, this);
- }
+ YamlSerializer.Serialize(writer, this, new YamlSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, DefaultIgnoreCondition = YamlIgnoreCondition.WhenWritingDefault });
}
public override string ToString() =>
- serializer.Serialize(this);
+ YamlSerializer.Serialize(this, new YamlSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, DefaultIgnoreCondition = YamlIgnoreCondition.WhenWritingDefault });
}
public class AssetFile
{
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Name { get; set; }
+ public string Name { get; set; }
///
/// "areadatascript"
@@ -108,7 +130,7 @@ public class AssetFile
/// "spawnpoint"
/// "synthpatch"
///
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Method { get; set; }
+ public string Method { get; set; }
///
/// null
@@ -117,7 +139,7 @@ public class AssetFile
/// "pc"
/// "ps2"
///
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Platform { get; set; }
+ public string Platform { get; set; }
///
/// (null)
@@ -143,11 +165,12 @@ public class AssetFile
/// Recom
/// Theater
///
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Package { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public List Multi { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public List Source { get; set; }
+ public string Package { get; set; }
+ public Condition Condition { get; set; }
+ public List Multi { get; set; }
+ public List Source { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public bool Required { get; set; }
+ public bool Required { get; set; }
///
/// "areadatascript"
@@ -184,13 +207,13 @@ public class AssetFile
/// "trsr"
/// "vtbl"
///
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Type { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public Bar.MotionsetType MotionsetType { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Language { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public bool IsSwizzled { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public int Index { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public string Game { get; set; }
- [YamlMember(DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)] public bool CollectionOptional { get; set; }
+ public string Type { get; set; }
+ public Bar.MotionsetType MotionsetType { get; set; }
+ public string Language { get; set; }
+ public bool IsSwizzled { get; set; }
+ public int Index { get; set; }
+ public string Game { get; set; }
+ public bool CollectionOptional { get; set; }
}
public class Multi
diff --git a/OpenKh.Patcher/OpenKh.Patcher.csproj b/OpenKh.Patcher/OpenKh.Patcher.csproj
index 0c265a56b..443c5966b 100644
--- a/OpenKh.Patcher/OpenKh.Patcher.csproj
+++ b/OpenKh.Patcher/OpenKh.Patcher.csproj
@@ -5,12 +5,12 @@
25.02.10.025.02.10.025.02.10.0-local25.02.10.0-localOpenKH contributorsOpenKHCopyright (C) OpenKH https://github.com/OpenKH/OpenKh
+
-
diff --git a/OpenKh.Patcher/PatcherProcessor.cs b/OpenKh.Patcher/PatcherProcessor.cs
index 60b80305b..2a294a2fe 100644
--- a/OpenKh.Patcher/PatcherProcessor.cs
+++ b/OpenKh.Patcher/PatcherProcessor.cs
@@ -1,16 +1,33 @@
using OpenKh.Bbs;
-using OpenKh.Command.Bdxio.Models;
-using OpenKh.Command.Bdxio.Utils;
+
using OpenKh.Common;
+using OpenKh.Common.Archives;
+using OpenKh.Egs;
using OpenKh.Imaging;
+using OpenKh.Kh1;
using OpenKh.Kh2;
+using OpenKh.Kh2.Bdx.Models;
+using OpenKh.Kh2.Bdx.Utils;
using OpenKh.Kh2.Messages;
using System;
+using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Net.Security;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+using Xe.IO;
using YamlDotNet.Serialization;
+using static OpenKh.Kh2.Dpd;
+using static OpenKh.Patcher.PatcherProcessor;
+using static System.Net.Mime.MediaTypeNames;
namespace OpenKh.Patcher
{
@@ -66,297 +83,370 @@ public void CopyOriginalFile(string fileName, string dstFile)
public void Patch(string originalAssets, string outputDir, string modFilePath)
{
- var metadata = File.OpenRead(modFilePath).Using(Metadata.Read);
+ var metadata = Metadata.Read(modFilePath);
var modBasePath = Path.GetDirectoryName(modFilePath);
Patch(originalAssets, outputDir, metadata, modBasePath);
}
- List GamesList = new List()
+ public static Dictionary GameShorthand = new Dictionary()
{
- "kh2",
- "kh1",
- "bbs",
- "Recom",
+ { 0, "kh1" },
+ { 1, "kh2" },
+ { 2, "Recom" },
+ { 3, "bbs" },
+ { 4, "kh3d" }
};
- /// (GameEdition) 0=OpenKH, 1=PCSX2-EX, 2=PC
- /// If true, always the first package file (kh1_first, bbs_first, kh2_first or such) is selected.
- /// If true, always invoke context.CopyOriginalFile
- /// (GameId) "kh1", "kh2", "bbs", "Recom", "kh3d"
- /// en, jp
- public void Patch(
- string originalAssets,
- string outputDir,
- Metadata metadata,
- string modBasePath,
- int platform = 1,
- bool fastMode = false,
+ public async Task Patch(
+ string extractDataPath,
+ string buildOutputPath,
+ Metadata modMetadata,
+ string modFilesPath,
+ string gameFilesPath = null,
+ int targetPlatform = 0x00,
+ int targetGame = 0x01,
+ bool isJapanese = false,
+ CancellationToken? cancelToken = null,
IDictionary packageMap = null,
- string LaunchGame = null,
- string Language = "en",
- bool Tests = false,
- Dictionary collectionOptionalEnabledMods = null
- )
+ Dictionary collectionOptionalEnabledMods = null,
+ Func reportProgress = null,
+ bool Tests = false)
{
- if (collectionOptionalEnabledMods == null)
- collectionOptionalEnabledMods = new Dictionary { };
- var context = new Context(metadata, originalAssets, modBasePath, outputDir);
+ var _isExtraction = extractDataPath != null;
+ var _fetchGameId = GameShorthand[targetGame];
+
+ var _protectPackageMap = new object();
+
+ var _fetchCollectionMods = new Dictionary { };
+ var _fetchFileDictionary = new ConcurrentDictionary();
+
+ if (collectionOptionalEnabledMods != null)
+ _fetchCollectionMods = collectionOptionalEnabledMods;
+
try
{
+ // A lot of this class relies on this existing. I am in no mood to rewrite that much code yet.
+ var _fetchContext = new Context(modMetadata, extractDataPath, modFilesPath, buildOutputPath);
- if (metadata.Assets == null)
- throw new Exception("No assets found.");
- if (metadata.Game != null && GamesList.Contains(metadata.Game.ToLower()) && metadata.Game.ToLower() != LaunchGame.ToLower())
+ // If the mod has a game declared and it doesn't match the current game, don't build it.
+ if (modMetadata.Game != null && modMetadata.Game.ToLower() != _fetchGameId)
return;
- if (metadata.IsCollection && !metadata.CollectionGames.Contains(LaunchGame))
+
+ // If the mod is part of a collection and the collection doesn't support the current game, don't build it.
+ if (modMetadata.IsCollection && !modMetadata.CollectionGames.Contains(_fetchGameId))
return;
- var exclusiveLock = new object();
- metadata.Assets.AsParallel().ForAll(assetFile =>
+ // If the mod does not have any assets, throw an error. This should not happen.
+ if (modMetadata.Assets == null)
+ throw new NullReferenceException("The mod doesn't contain any assets.");
+
+ var _assetProcessCount = 0;
+ var _assetTotalCount = modMetadata.Assets.Count;
+
+ // If the build is not extraction-based:
+ if (!_isExtraction && targetPlatform != 0x00)
+ {
+ // Fetch a list of all header files for the targeted game.
+ var _fetchDataPath = Path.Combine(gameFilesPath, "Image", targetPlatform == 0x01 ? "dt" : (isJapanese ? "jp" : "en"));
+ var _fetchHeaderFiles = Directory.GetFiles(_fetchDataPath).Where(x => x.Contains(_fetchGameId) && x.EndsWith(".hed"));
+
+ // Start a parallel for every header file.
+ await Parallel.ForEachAsync(_fetchHeaderFiles.AsParallel(), new ParallelOptions() { CancellationToken = cancelToken ?? new CancellationToken() }, async (_fetchHeader, _fetchCancelToken) =>
+ {
+ // Load up the header file and read it as a HED class.
+ using (var _fetchHeaderStream = File.OpenRead(_fetchHeader))
+ {
+ var _fetchPackageName = Path.GetFileNameWithoutExtension(_fetchHeader);
+ var _fetchHeaderChildren = Hed.Read(_fetchHeaderStream);
+
+ // Record every hash with its corresponding package name for speedier handling.
+ // This eliminates the need to inquire every package for every single file.
+ foreach (var _fetchEntry in _fetchHeaderChildren)
+ {
+ _fetchFileDictionary.TryAdd(Convert.ToHexString(_fetchEntry.MD5), _fetchPackageName);
+
+ if (_fetchCancelToken.IsCancellationRequested)
+ break;
+ }
+ }
+ });
+ }
+
+ // Start a parallel for all the assets:
+ await Parallel.ForEachAsync(modMetadata.Assets.AsParallel(), new ParallelOptions() { CancellationToken = cancelToken ?? new CancellationToken() }, async (_fetchAsset, _fetchCancelToken) =>
{
- if (assetFile.Game != null && assetFile.Game != LaunchGame)
+ // Process callback for progress.
+ _assetProcessCount++;
+
+ // If the asset has a game declared and it doesn't match the current game, skip it.
+ if (_fetchAsset.Game != null && _fetchAsset.Game != _fetchGameId)
return;
- if (assetFile.CollectionOptional == true)
- if (!collectionOptionalEnabledMods.ContainsKey(assetFile.Name))
- return;
- else if (!collectionOptionalEnabledMods[assetFile.Name])
+
+ // I don't know what this does but it is here for compat.
+ if (_fetchAsset.CollectionOptional == true && (!_fetchCollectionMods.ContainsKey(_fetchAsset.Name) || !_fetchCollectionMods[_fetchAsset.Name]))
+ return;
+
+ if (_fetchAsset.Condition != null)
+ {
+ var _fetchConditionKey = _fetchAsset.Condition.Key;
+ var _fetchConditionValue = _fetchAsset.Condition.Value;
+
+ var _fetchConditionMain = modMetadata.Preferences.FirstOrDefault(x => x.Key == _fetchConditionKey);
+
+ if (_fetchConditionMain != null && !Object.Equals(_fetchConditionValue, _fetchConditionMain.Value))
return;
- var names = new List();
- names.Add(assetFile.Name);
- if (assetFile.Multi != null)
- names.AddRange(assetFile.Multi.Select(x => x.Name).Where(x => !string.IsNullOrEmpty(x)));
+ }
- foreach (var name in names)
+ // Fetch all the target names to be used.
+ var _fetchFileNames = new List();
+ var _fetchMultiNames = _fetchAsset.Multi != null ? _fetchAsset.Multi.Select(x => x.Name)
+ .Where(x => !string.IsNullOrEmpty(x)) : null;
+
+ _fetchFileNames.Add(_fetchAsset.Name);
+
+ if (_fetchMultiNames != null)
+ _fetchFileNames.AddRange(_fetchMultiNames);
+
+ // If the platform for the asset isn't declared, default it to be both.
+ _fetchAsset.Platform = _fetchAsset.Platform != null ? _fetchAsset.Platform.ToLower() : "both";
+
+ foreach (var _fetchName in _fetchFileNames)
{
- if (assetFile.Platform == null)
- assetFile.Platform = "both";
+ // Check discrepancy for JP-specific files.
+ var _doesRegionMatch = (!isJapanese && !_fetchName.Contains(".a.jp") && !_fetchName.Contains("/jp/")) || (isJapanese && (_fetchName.Contains(".a.jp") || _fetchName.Contains("/jp/")));
+ var _isAssetExclusivePS2 = _fetchName.Contains(".a.fm") || _fetchName.Contains("/fm/");
- if (assetFile.Required && !File.Exists(context.GetOriginalAssetPath(name)))
- continue;
+ // Declare whether the asset is patchable or not.
+ var _isAssetPatchable = _fetchAsset.Method != "copy" && _fetchAsset.Method != "imd";
- string _packageFile = null;
- switch (LaunchGame)
- {
- case "kh1":
- _packageFile = assetFile.Package != null && !fastMode ? assetFile.Package : "kh1_first";
- break;
- case "bbs":
- _packageFile = assetFile.Package != null && !fastMode ? assetFile.Package : "bbs_first";
- break;
- case "Recom":
- if (assetFile != null)
- _packageFile = "Recom";
- break;
- default:
- _packageFile = assetFile.Package != null && !fastMode ? assetFile.Package : "kh2_first";
- break;
- }
+ // This is used for package map purposes.
+ var _fetchPackageMap = "";
- if (Path.IsPathRooted(name) && !Path.GetPathRoot(name).Equals(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
- {
- Log.Err($"File Path \"" + name + "\" cannot be copied as it is rooted and can cause instability! Aborting...");
- throw new PatcherException(metadata, new InvalidOperationException("Root Copy Detected!"));
- }
+ // Construct the many paths that will be needed for the asset.
- var dstFile = context.GetDestinationPath(name);
- var packageMapLocation = "";
- var _pcFile = name.Contains("remastered") || name.Contains("raw");
+ /*
+ * -> _fetchOriginalPath = Path to the target file from the game data. Constructed and used only if extraction exists.
+ * -> _fetchVariablePath = Path to the target file as it exists in the build folder. Only used if the file is patchable. [Type isn't COPY or IMD]
+ * -> _fetchExternalPath = Path to the source file as it exists in the mod's source folder. Used if the file is neither patchable nor internal.
+ * -> _fetchInternalPath = Path to the source file from the game data. Used if the file is not patchable but is internal. Constructed and used only if extraction exists.
+ */
- // Special case for mods that want to bundle scripts or DLL files
- var nonGameFile = name.StartsWith("scripts/") || name.StartsWith("scripts\\") || name.StartsWith("dlls/") || name.StartsWith("dlls\\");
+ var _fetchOriginalPath = _isExtraction ? Path.Combine(extractDataPath, _fetchName) : null;
+ var _fetchVariablePath = _isAssetPatchable && _fetchAsset.Source[0].Type != "internal" ? Path.Combine(buildOutputPath, _fetchName) : null;
+ var _fetchExternalPath = !_isAssetPatchable && (_fetchAsset.Source[0].Type != "internal" && _fetchAsset.Source[0].Name != null) ? Path.Combine(modFilesPath, _fetchAsset.Source[0].Name) : null;
+ var _fetchInternalPath = !_isAssetPatchable && (_fetchAsset.Source[0].Type == "internal" && _fetchAsset.Source[0].Name != null && _isExtraction) ? Path.Combine(extractDataPath, _fetchAsset.Source[0].Name) : null;
- var _extraPath = _pcFile ? "" : "original/";
+ // Fetch the parent directory of the file.
+ var _fetchFileParent = _fetchName.Split([Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar]).FirstOrDefault();
+
+ // Construct the target path and directory for the file.
+
+ var _fetchTargetPath = Path.Combine(buildOutputPath, _fetchName);
+ var _fetchTargetDir = Path.GetDirectoryName(_fetchTargetPath);
+
+ // If declared, fetch the package name for the asset.
+ // This is used in hard-patching and for package mapping.
+ var _fetchPackage = _fetchAsset.Package != null ? _fetchAsset.Package : $"{_fetchGameId}_first";
+
+ // If the asset is declared REQUIRED, the game is extracted, yet the original file doesn't exist: Skip it.
+ if (_fetchAsset.Required && !_isExtraction && !File.Exists(_fetchOriginalPath))
+ continue;
+
+ // Fetch certain information about the file.
+
+ var _isFileRAW = _fetchFileParent == "raw";
+ var _isFileRemastered = _fetchFileParent == "remastered";
+ var _isFileSpecial = _fetchFileParent == "scripts" || _fetchFileParent == "dll";
+
+ var _isFilePC = _isFileRemastered || _isFileRAW;
+
+ // If the file is special, commit it to the package map as such.
+ if (_isFileSpecial)
+ _fetchPackageMap = "special/" + _fetchName;
- if (nonGameFile)
- {
- packageMapLocation = "special/" + name;
- }
else
{
- switch (platform)
- {
- default:
- {
- if (assetFile.Platform.ToLower() == "pc")
- continue;
-
- else if (_pcFile)
- continue;
- }
- break;
+ // If the target platform is the PS2 and the file is PC-specific, skip it.
+ if (targetPlatform == 0x00 && _isFilePC && (_fetchFileParent == "dll" || _fetchAsset.Platform == "pc"))
+ continue;
- case 2:
- {
- if (assetFile.Platform.ToLower() == "ps2")
- continue;
+ // If the target platform is not PS2:
+ else if (targetPlatform != 0x00)
+ {
+ // But the asset is, skip it.
+ if (_fetchAsset.Platform == "ps2" || _isAssetExclusivePS2)
+ continue;
- if (assetFile.Platform.ToLower() != "ps2")
- packageMapLocation = _packageFile + "/" + _extraPath + name;
+ if (!_doesRegionMatch && (_isAssetPatchable || _fetchAsset.Source[0].Type == "internal"))
+ continue;
- else if (_pcFile)
- packageMapLocation = _packageFile + "/" + name;
- }
- break;
+ // Otherwise, commit it to the package map.
+ _fetchPackageMap = Path.Combine(_fetchPackage, _isFilePC ? "" : "original/", _fetchName);
}
}
- if (packageMap != null && packageMapLocation.Length > 0)
+ // Lock the package map and commit the constructed string.
+ if (packageMap != null && _fetchPackageMap.Length > 0)
{
- // Protect against multiple mods having the same file where one uses forward slash and one uses backslash
- lock (exclusiveLock)
- {
- packageMap[name.Replace("\\", "/")] = packageMapLocation;
- }
+ lock (_protectPackageMap)
+ packageMap[_fetchName.Replace("\\", "/")] = _fetchPackageMap;
}
- context.EnsureDirectoryExists(dstFile);
+ // If the target directory does not exist, create it.
+ if (!Directory.Exists(_fetchTargetDir))
+ Directory.CreateDirectory(_fetchTargetDir);
- //Update: Prevent from copying a blank file should it not exist.
- try
+ // If a built version of the file already exists, patch that one.
+ if (_fetchVariablePath != null && File.Exists(_fetchVariablePath))
{
- bool multi = false;
- if (assetFile.Multi != null)
+ using (var _fileStream = File.Open(_fetchVariablePath, FileMode.OpenOrCreate))
+ PatchFile(_fetchContext, _fetchAsset, _fileStream);
+ }
+
+ // Otherwise;
+ else
+ {
+ byte[] _fetchAssetData = null;
+
+ // If the asset is not patchable, meaning it has to be copied from somewhere:
+ if (!_isAssetPatchable)
{
- foreach (var entry in assetFile.Multi)
- {
- if (File.Exists(context.GetOriginalAssetPath(entry.Name)))
- {
- multi = true;
- }
- }
+ // If the file type is internal, the internal path is valid, and the file exists: Copy it to target.
+ if (_fetchAsset.Source[0].Type == "internal" && _fetchInternalPath != null && File.Exists(_fetchInternalPath))
+ File.Copy(_fetchInternalPath, _fetchTargetPath, true);
+
+ // If the file type is NOT internal, the external path is valid, and the file exists: Copy it to target.
+ else if (_fetchExternalPath != null && File.Exists(_fetchExternalPath))
+ File.Copy(_fetchExternalPath, _fetchTargetPath, true);
}
- //If editing subfiles (not Method: copy and not Method: imd) make sure the original file exists OR
- //If copying a file from the mod (NOT Type: internal) make sure it exists (doesnt check if the location its going normally exists) OR
- //If copying a file from the users extraction (Type: internal) make sure it exists (doesnt check if the location its going normally exists) OR
- //Ignore if its from a test
-
- var needToCopyOriginalFile =
- (false
- || (true
- && assetFile.Method != "copy"
- && assetFile.Method != "imd"
- && (false
- || File.Exists(context.GetOriginalAssetPath(assetFile.Name))
- || multi
- )
- )
- || (true
- && (assetFile.Method == "copy" || assetFile.Method == "imd")
- && assetFile.Source[0].Type != "internal"
- && File.Exists(context.GetSourceModAssetPath(assetFile.Source[0].Name))
- )
- || (true
- && (assetFile.Method == "copy" || assetFile.Method == "imd")
- && assetFile.Source[0].Type == "internal"
- && (false
- || File.Exists(context.GetOriginalAssetPath(assetFile.Source[0].Name))
- || multi
- )
- )
- || Tests
- );
- if (needToCopyOriginalFile)
+ // If the asset is patchable, the original path is valid, and the file exists: Copy it to target.
+ else if (_isAssetPatchable && _fetchOriginalPath != null && File.Exists(_fetchOriginalPath))
+ File.Copy(_fetchOriginalPath, _fetchTargetPath, true);
+
+ // If after the above the target file STILL does not exists, try to fetch it from the game data.
+ if (!File.Exists(_fetchTargetPath))
{
- context.CopyOriginalFile(name, dstFile);
+ if (targetPlatform != 0x00)
+ {
+ var _fetchTarget = _isAssetPatchable ? _fetchName : _fetchAsset.Source[0].Name;
- using var _stream = File.Open(dstFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
- PatchFile(context, assetFile, _stream);
+ var _fetchParent = "";
+ var _fetchChild = "";
- _stream.Close();
- _stream.Dispose();
- }
- else
- {
- // The following codes are for validation purposes only.
+ if (_isFileRAW)
+ _fetchTarget = _fetchTarget.Replace("raw/", "");
- List globalFilePaths = new List { ".a.fr", ".a.gr", ".a.it", ".a.sp", ".a.us", "/fr/", "/gr/", "/it/", "/sp/", "/us/" };
- List emulatorRegionPaths = new List { "/jp/", "/us/", "/it/", "/sp/", "/gr/", "/fr/", "/fm/" };
- if (assetFile.Method != "copy" && assetFile.Method != "imd")
- {
- if (platform == 2)
+ if (_isFileRemastered)
{
- if (Language != "jp")
- {
- if (!context.GetOriginalAssetPath(name).Contains(".a.fm") && !context.GetOriginalAssetPath(name).Contains("/jp/"))
- {
- Log.Warn("File not found: " + context.GetOriginalAssetPath(name) + " Skipping. \nPlease check your game extraction.");
- }
- }
- else
- {
- if (!globalFilePaths.Any(x => context.GetOriginalAssetPath(name).Contains(x)))
- {
- Log.Warn("File not found: " + context.GetOriginalAssetPath(name) + " Skipping. \nPlease check your game extraction.");
- }
- }
+ var _fetchMatch = Regex.Match(_fetchTarget, "[\\w,-]+\\.[a-zA-Z0-9]{2,4}", RegexOptions.None, TimeSpan.FromMilliseconds(500));
+
+ var _fetchIndex = _fetchTarget.IndexOf(_fetchMatch.Value);
+ var _fetchEndPoint = _fetchIndex + _fetchMatch.Value.Length;
+
+ var _fetchSubFirst = _fetchTarget.Substring(0, _fetchEndPoint);
+ var _fetchSubSecond = _fetchTarget.Substring(_fetchEndPoint, _fetchTarget.Length - _fetchEndPoint);
+
+ _fetchParent = _fetchSubFirst.Replace("remastered/", "");
+ _fetchChild = _fetchSubSecond.Trim('/');
}
- else
+
+ var _fetchNameHash = Egs.Helpers.CreateMD5(_isFileRemastered ? _fetchParent : _fetchTarget);
+ var _fetchKeyExists = _fetchFileDictionary.ContainsKey(_fetchNameHash);
+
+ if (_fetchKeyExists)
{
- string matchedRegion = emulatorRegionPaths.FirstOrDefault(x => name.Contains(x));
- if (matchedRegion != null)
+ var _fetchFilePack = _fetchFileDictionary[_fetchNameHash];
+
+ if (!String.IsNullOrEmpty(_fetchFilePack))
{
- string emuRegionPath = context.GetOriginalAssetPath(name.Substring(0, name.IndexOf(matchedRegion) + 3));
- if (Directory.Exists(emuRegionPath))
+ var _fetchDataPath = Path.Combine(gameFilesPath, "Image", targetPlatform == 0x01 ? "dt" : (isJapanese ? "jp" : "en"));
+
+ var _fetchHeaderName = Path.Combine(_fetchDataPath, _fetchFilePack + ".hed");
+ var _fetchPackageName = Path.Combine(_fetchDataPath, _fetchFilePack + ".pkg");
+
+ using (var _fetchHeaderStream = File.OpenRead(_fetchHeaderName))
{
- Log.Warn("File not found: " + context.GetOriginalAssetPath(name) + " Skipping. \nPlease check your game extraction.");
+ var _fetchEntries = Hed.Read(_fetchHeaderStream);
+ var _fetchTargetEntry = _fetchEntries.FirstOrDefault(x => Convert.ToHexString(x.MD5) == _fetchNameHash);
+
+ using (var _fetchPackageStream = File.OpenRead(_fetchPackageName))
+ {
+ var _fetchTargetAsset = new EgsHdAsset(_fetchPackageStream.SetPosition(_fetchTargetEntry.Offset));
+
+ if (_isFileRemastered)
+ _fetchTargetAsset.RemasteredAssetsDecompressedData.TryGetValue(_fetchChild, out _fetchAssetData);
+
+ else
+ _fetchAssetData = _isFileRAW ? _fetchTargetAsset.OriginalRawData : _fetchTargetAsset.OriginalData;
+
+ if (_fetchAssetData != null)
+ await File.WriteAllBytesAsync(_fetchTargetPath, _fetchAssetData, CancellationToken.None);
+ }
}
}
}
}
- else if (assetFile.Source[0].Type == "internal")
+
+ else
{
- if (platform == 2)
- {
- if (Language != "jp")
- {
- if (!context.GetOriginalAssetPath(assetFile.Source[0].Name).Contains(".a.fm") && !context.GetOriginalAssetPath(assetFile.Source[0].Name).Contains("/jp/") && (assetFile.Multi == null || assetFile.Name == name))
- {
- Log.Warn("File not found: " + context.GetOriginalAssetPath(assetFile.Source[0].Name) + " Skipping. \nPlease check your game extraction.");
- }
- }
- else
- {
- if (!globalFilePaths.Any(x => context.GetOriginalAssetPath(assetFile.Source[0].Name).Contains(x)) && (assetFile.Multi == null || assetFile.Name == name))
- {
- Log.Warn("File not found: " + context.GetOriginalAssetPath(assetFile.Source[0].Name) + " Skipping. \nPlease check your game extraction.");
- }
- }
- }
- else
+ var _fetchTarget = _isAssetPatchable ? _fetchName : _fetchAsset.Source[0].Name;
+
+ using (var _fetchStreamISO = new FileStream(gameFilesPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
- string matchedRegion = emulatorRegionPaths.FirstOrDefault(x => assetFile.Source[0].Name.Contains(x));
- if (matchedRegion != null)
+ switch (targetGame)
{
- string emuRegionPath = context.GetOriginalAssetPath(assetFile.Source[0].Name.Substring(0, assetFile.Source[0].Name.IndexOf(matchedRegion) + 3));
- if (Directory.Exists(emuRegionPath))
+ case 0x00:
+ break;
+ case 0x01:
{
- Log.Warn("File not found: " + context.GetOriginalAssetPath(assetFile.Source[0].Name) + " Skipping. \nPlease check your game extraction.");
+ var _fetchOffsetIDX = IsoUtility.GetFileOffset(_fetchStreamISO, "KH2.IDX;1");
+ var _fetchOffsetIMG = IsoUtility.GetFileOffset(_fetchStreamISO, "KH2.IMG;1");
+
+ var _fetchSubStrIDX = new SubStream(_fetchStreamISO, _fetchOffsetIDX * 0x800, _fetchStreamISO.Length - (_fetchOffsetIDX * 0x800));
+ var _fetchSubStrIMG = new SubStream(_fetchStreamISO, _fetchOffsetIMG * 0x800, _fetchStreamISO.Length - (_fetchOffsetIMG * 0x800));
+
+ var _fetchIDX = Idx.Read(_fetchSubStrIDX);
+ var _fetchIMG = new Img(_fetchSubStrIMG, _fetchIDX, true);
+
+ var _fetchEntry = _fetchIMG.Entries.FirstOrDefault(x => IdxName.Lookup(x) == _fetchTarget);
+
+ if (_fetchEntry != null)
+ {
+ using (var _fetchStreamTarget = _fetchIMG.FileOpen(_fetchEntry))
+ File.Create(_fetchTargetPath).Using(_tempStr => _fetchStreamTarget.CopyTo(_tempStr));
+ }
+
+ else
+ Debug.WriteLine("Entry not found: " + _fetchTarget);
}
+ break;
}
}
}
- else
- {
- Log.Warn("File not found: " + context.GetSourceModAssetPath(assetFile.Source[0].Name) + " Skipping. \nPlease check your mod install of: " + metadata.Title);
- }
}
+
+ // After all that, if the target file actually exists now: Patch it.
+ if (File.Exists(_fetchTargetPath))
+ using (var _fileStream = File.Open(_fetchTargetPath, FileMode.OpenOrCreate))
+ PatchFile(_fetchContext, _fetchAsset, _fileStream, _fetchAssetData);
}
- catch (IOException) { }
- //This is here so the user does not have to close Mod Manager to see what the warnings were if any. Helpful especially on PC since the build window closes after build unlike emulator where it stays open during mod injection.
- Log.Flush();
}
+
+ if (reportProgress != null)
+ reportProgress(_assetProcessCount, _assetTotalCount);
});
}
+ catch (TaskCanceledException) { }
+
catch (Exception ex)
{
- Log.Err($"Patcher failed: {ex.Message}");
- throw new PatcherException(metadata, ex);
+ throw new PatcherException(modMetadata, ex);
}
}
- private static void PatchFile(Context context, AssetFile assetFile, Stream stream)
+ private static void PatchFile(Context context, AssetFile assetFile, Stream stream, byte[] originalData = null)
{
if (assetFile == null)
throw new Exception("Asset file is null.");
@@ -364,7 +454,7 @@ private static void PatchFile(Context context, AssetFile assetFile, Stream strea
switch (assetFile.Method)
{
case "copy":
- CopyFile(context, assetFile, stream);
+ CopyFile(context, assetFile, stream, originalData);
break;
case "bar":
case "binarc":
@@ -414,31 +504,42 @@ private static void PatchFile(Context context, AssetFile assetFile, Stream strea
stream.SetLength(stream.Position);
}
-
-
- private static void CopyFile(Context context, AssetFile assetFile, Stream stream)
+ private static void CopyFile(Context context, AssetFile assetFile, Stream stream, byte[] originalData = null)
{
if (assetFile.Source == null || assetFile.Source.Count == 0)
throw new Exception($"File '{assetFile.Name}' does not contain any source");
- string srcFile;
-
if (assetFile.Source[0].Type == "internal")
{
- srcFile = context.GetOriginalAssetPath(assetFile.Source[0].Name);
+ if (context.OriginalAssetPath != null)
+ {
+ var _fetchSource = Path.Combine(context.OriginalAssetPath, assetFile.Source[0].Name);
+
+ using (var _fetchStream = File.OpenRead(_fetchSource))
+ _fetchStream.CopyTo(stream);
+ }
+
+ else if (originalData != null)
+ {
+ using (var _memoryRead = new MemoryStream(originalData))
+ _memoryRead.CopyTo(stream);
+ }
}
+
else
{
- srcFile = context.GetSourceModAssetPath(assetFile.Source[0].Name);
- if (!File.Exists(srcFile))
- throw new FileNotFoundException($"The mod does not contain the file {assetFile.Source[0].Name}", srcFile);
- }
- using var srcStream = File.OpenRead(srcFile);
- srcStream.CopyTo(stream);
- }
-
+ var _fetchSource = Path.Combine(context.SourceModAssetPath, assetFile.Source[0].Name);
+ if (!File.Exists(_fetchSource))
+ Console.WriteLine($"The mod does not contain the file {assetFile.Source[0].Name} in {context.SourceModAssetPath}");
+ else
+ {
+ using (var _fetchStream = File.OpenRead(_fetchSource))
+ _fetchStream.CopyTo(stream);
+ }
+ }
+ }
//Binarc Update: Specify by Name OR Index. Some files in BARS may have the same name but different indexes, and you want to patch a later index only.
private static void PatchBinarc(Context context, AssetFile assetFile, Stream stream)
@@ -451,6 +552,17 @@ private static void PatchBinarc(Context context, AssetFile assetFile, Stream str
foreach (var file in assetFile.Source)
{
+ if (file.Condition != null)
+ {
+ var _fetchConditionKey = file.Condition.Key;
+ var _fetchConditionValue = file.Condition.Value;
+
+ var _fetchConditionMain = context.Metadata.Preferences.FirstOrDefault(x => x.Key == _fetchConditionKey);
+
+ if (_fetchConditionMain != null && !Object.Equals(_fetchConditionValue, _fetchConditionMain.Value))
+ return;
+ }
+
if (!Enum.TryParse(file.Type, true, out var barEntryType))
throw new Exception($"BinArc type {file.Type} not recognized");
diff --git a/OpenKh.Research.Interceptor/OpenKh.Research.Interceptor.vcxproj b/OpenKh.Research.Interceptor/OpenKh.Research.Interceptor.vcxproj
new file mode 100644
index 000000000..afff8fde8
--- /dev/null
+++ b/OpenKh.Research.Interceptor/OpenKh.Research.Interceptor.vcxproj
@@ -0,0 +1,148 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 18.0
+ Win32Proj
+ {b74a4f17-8d09-44a7-a94b-51d642b60a60}
+ OpenKhCommandInterceptor
+ 10.0
+
+
+
+ Application
+ true
+ v145
+ Unicode
+
+
+ Application
+ false
+ v145
+ true
+ Unicode
+
+
+ Application
+ true
+ v145
+ Unicode
+
+
+ Application
+ false
+ v145
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ stdcpp20
+
+
+ Console
+ true
+
+
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ stdcpp20
+
+
+ Console
+ true
+
+
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ stdcpp20
+
+
+ Windows
+ true
+ mainCRTStartup
+
+
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ stdcpp20
+
+
+ Console
+ true
+
+
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenKh.Research.Interceptor/OpenKh.Research.Interceptor.vcxproj.filters b/OpenKh.Research.Interceptor/OpenKh.Research.Interceptor.vcxproj.filters
new file mode 100644
index 000000000..ce0c35ccf
--- /dev/null
+++ b/OpenKh.Research.Interceptor/OpenKh.Research.Interceptor.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/OpenKh.Research.Interceptor/main.cpp b/OpenKh.Research.Interceptor/main.cpp
new file mode 100644
index 000000000..db57f95b1
--- /dev/null
+++ b/OpenKh.Research.Interceptor/main.cpp
@@ -0,0 +1,93 @@
+#include
diff --git a/OpenKh.Tests/Patcher/MetadataTests.cs b/OpenKh.Tests/Patcher/MetadataTests.cs
index 0094a09ac..01e4f8941 100644
--- a/OpenKh.Tests/Patcher/MetadataTests.cs
+++ b/OpenKh.Tests/Patcher/MetadataTests.cs
@@ -7,38 +7,6 @@ namespace OpenKh.Tests.Patcher
{
public class MetadataTests
{
- [Fact]
- public void ReadModMetadataTest()
- {
- var metadata = File.OpenRead("Patcher/res/sample-simple-mod.yml").Using(Metadata.Read);
- Assert.Equal("My awesome untitled mod", metadata.Title);
- Assert.Equal(1, metadata.Specifications);
-
- Assert.Single(metadata.Dependencies);
- Assert.Equal("openkh/is-awesome", metadata.Dependencies[0].Name);
-
- Assert.NotNull(metadata.Assets);
- Assert.Single(metadata.Assets);
- Assert.Equal("my/file/path.bin", metadata.Assets[0].Name);
- }
-
- [Fact]
- public void ReadModMetadataTestCollectionOptional()
- {
- var metadata = File.OpenRead("Patcher/res/sample-simple-collection-mod.yml").Using(Metadata.Read);
-
- Assert.Equal("My awesome untitled mod - part 2", metadata.Title);
- Assert.Equal(1, metadata.Specifications);
-
- Assert.NotNull(metadata.Assets);
- Assert.Equal(3, metadata.Assets.Count);
- foreach (var asset in metadata.Assets)
- {
- Assert.IsType(asset);
- Assert.Contains(asset.Game, metadata.CollectionGames);
- }
- Assert.True(metadata.Assets[2].CollectionOptional);
- }
}
}
diff --git a/OpenKh.Tests/Patcher/PatcherTests.cs b/OpenKh.Tests/Patcher/PatcherTests.cs
index 891f157e1..178d71bc9 100644
--- a/OpenKh.Tests/Patcher/PatcherTests.cs
+++ b/OpenKh.Tests/Patcher/PatcherTests.cs
@@ -1,8 +1,8 @@
using OpenKh.Bbs;
-using OpenKh.Command.Bdxio.Utils;
using OpenKh.Common;
using OpenKh.Imaging;
using OpenKh.Kh2;
+using OpenKh.Kh2.Bdx.Utils;
using OpenKh.Kh2.Messages;
using OpenKh.Patcher;
using System;
@@ -16,4435 +16,6 @@
namespace OpenKh.Tests.Patcher
{
- public class PatcherTests : IDisposable
- {
- private const string AssetsInputDir = "original_input";
- private const string ModInputDir = "mod_input";
- private const string ModOutputDir = "mod_output";
-
- public PatcherTests()
- {
- Dispose();
- Directory.CreateDirectory(AssetsInputDir);
- Directory.CreateDirectory(ModInputDir);
- Directory.CreateDirectory(ModOutputDir);
- }
-
- public void Dispose()
- {
- if (Directory.Exists(AssetsInputDir))
- Directory.Delete(AssetsInputDir, true);
- if (Directory.Exists(ModInputDir))
- Directory.Delete(ModInputDir, true);
- if (Directory.Exists(ModOutputDir))
- Directory.Delete(ModOutputDir, true);
- }
-
- [Fact]
- public void Kh2CopyBinariesTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile.bin",
- Method = "copy",
- Source = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile.bin"
- }
- }
- }
- }
- };
-
- CreateFile(ModInputDir, patch.Assets[0].Name).Dispose();
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, patch.Assets[0].Name);
- }
-
- [Fact]
- public void Kh2CreateBinArcIfSourceDoesntExistsTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile.bar",
- Method = "binarc",
- Source = new List
- {
- new AssetFile
- {
- Name = "abcd",
- Type = "list",
- Method = "copy",
- Source = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile/abcd.bin"
- }
- }
- }
- }
- }
- }
- };
-
- CreateFile(ModInputDir, "somedir/somefile/abcd.bin").Using(x =>
- {
- x.WriteByte(0);
- x.WriteByte(1);
- x.WriteByte(2);
- x.WriteByte(3);
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, patch.Assets[0].Name);
- AssertBarFile("abcd", entry =>
- {
- Assert.Equal(Bar.EntryType.List, entry.Type);
- Assert.Equal(4, entry.Stream.Length);
- Assert.Equal(0, entry.Stream.ReadByte());
- Assert.Equal(1, entry.Stream.ReadByte());
- Assert.Equal(2, entry.Stream.ReadByte());
- Assert.Equal(3, entry.Stream.ReadByte());
- }, ModOutputDir, patch.Assets[0].Name);
- }
-
- [Fact]
- public void Kh2MergeWithOriginalBinArcTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile.bar",
- Method = "binarc",
- Source = new List
- {
- new AssetFile
- {
- Name = "abcd",
- Type = "list",
- Method = "copy",
- Source = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile/abcd.bin"
- }
- }
- }
- }
- }
- }
- };
-
- CreateFile(ModInputDir, "somedir/somefile/abcd.bin").Using(x =>
- {
- x.WriteByte(0);
- x.WriteByte(1);
- x.WriteByte(2);
- x.WriteByte(3);
- });
-
- CreateFile(AssetsInputDir, "somedir/somefile.bar").Using(x =>
- {
- Bar.Write(x, new Bar
- {
- new Bar.Entry
- {
- Name = "nice",
- Type = Bar.EntryType.Model,
- Stream = new MemoryStream(new byte[] { 4, 5, 6, 7 })
- }
- });
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, patch.Assets[0].Name);
- AssertBarFile("abcd", entry =>
- {
- Assert.Equal(Bar.EntryType.List, entry.Type);
- Assert.Equal(4, entry.Stream.Length);
- Assert.Equal(0, entry.Stream.ReadByte());
- Assert.Equal(1, entry.Stream.ReadByte());
- Assert.Equal(2, entry.Stream.ReadByte());
- Assert.Equal(3, entry.Stream.ReadByte());
- }, ModOutputDir, patch.Assets[0].Name);
- AssertBarFile("nice", entry =>
- {
- Assert.Equal(Bar.EntryType.Model, entry.Type);
- Assert.Equal(4, entry.Stream.Length);
- Assert.Equal(4, entry.Stream.ReadByte());
- Assert.Equal(5, entry.Stream.ReadByte());
- Assert.Equal(6, entry.Stream.ReadByte());
- Assert.Equal(7, entry.Stream.ReadByte());
- }, ModOutputDir, patch.Assets[0].Name);
- }
-
- [Fact]
- public void Kh2CreateImgdTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "somedir/somefile.bar",
- Method = "binarc",
- Source = new List
- {
- new AssetFile
- {
- Name = "test",
- Method = "imgd",
- Type = "imgd",
- Source = new List
- {
- new AssetFile
- {
- Name = "sample.png",
- IsSwizzled = false
- }
- }
- }
- }
- }
- }
- };
-
- File.Copy("Imaging/res/png/32.png", Path.Combine(ModInputDir, "sample.png"));
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, patch.Assets[0].Name);
- AssertBarFile("test", entry =>
- {
- Assert.True(Imgd.IsValid(entry.Stream));
- }, ModOutputDir, patch.Assets[0].Name);
- }
-
- [Fact]
- public void Kh2MergeImzTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "out.imz",
- Method = "imgz",
- Source = new List
- {
- new AssetFile
- {
- Name = "test.imd",
- Index = 1,
- }
- }
- }
- }
- };
-
- var tmpImd = Imgd.Create(new System.Drawing.Size(16, 16), PixelFormat.Indexed4, new byte[16 * 16 / 2], new byte[4], false);
- var patchImd = Imgd.Create(new System.Drawing.Size(32, 16), PixelFormat.Indexed4, new byte[32 * 16 / 2], new byte[4], false);
- CreateFile(AssetsInputDir, "out.imz").Using(x =>
- {
- Imgz.Write(x, new Imgd[]
- {
- tmpImd,
- tmpImd,
- tmpImd,
- });
- });
- CreateFile(ModInputDir, "test.imd").Using(patchImd.Write);
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "out.imz");
- File.OpenRead(Path.Combine(ModOutputDir, "out.imz")).Using(x =>
- {
- var images = Imgz.Read(x).ToList();
- Assert.Equal(3, images.Count);
- Assert.Equal(16, images[0].Size.Width);
- Assert.Equal(32, images[1].Size.Width);
- Assert.Equal(16, images[2].Size.Width);
- });
- }
-
- [Fact]
- public void Kh2MergeImzInsideBarTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "out.bar",
- Method = "binarc",
- Source = new List
- {
- new AssetFile
- {
- Name = "test",
- Type = "imgz",
- Method = "imgz",
- Source = new List
- {
- new AssetFile
- {
- Name = "test.imd",
- Index = 1
- }
- },
- }
- }
- }
- }
- };
-
- var tmpImd = Imgd.Create(new System.Drawing.Size(16, 16), PixelFormat.Indexed4, new byte[16 * 16 / 2], new byte[4], false);
- var patchImd = Imgd.Create(new System.Drawing.Size(32, 16), PixelFormat.Indexed4, new byte[32 * 16 / 2], new byte[4], false);
- CreateFile(AssetsInputDir, "out.bar").Using(x =>
- {
- using var memoryStream = new MemoryStream();
- Imgz.Write(memoryStream, new Imgd[]
- {
- tmpImd,
- tmpImd,
- tmpImd,
- });
-
- Bar.Write(x, new Bar
- {
- new Bar.Entry
- {
- Name = "test",
- Type = Bar.EntryType.Imgz,
- Stream = memoryStream
- }
- });
- });
- CreateFile(ModInputDir, "test.imd").Using(patchImd.Write);
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "out.bar");
- AssertBarFile("test", x =>
- {
- var images = Imgz.Read(x.Stream).ToList();
- Assert.Equal(3, images.Count);
- Assert.Equal(16, images[0].Size.Width);
- Assert.Equal(32, images[1].Size.Width);
- Assert.Equal(16, images[2].Size.Width);
- }, ModOutputDir, "out.bar");
- }
-
- [Fact]
- public void MergeKh2MsgTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "msg/us/sys.msg",
- Method = "kh2msg",
- Source = new List
- {
- new AssetFile
- {
- Name = "sys.yml",
- Language = "en",
- }
- }
- },
- new AssetFile
- {
- Name = "msg/it/sys.msg",
- Method = "kh2msg",
- Source = new List
- {
- new AssetFile
- {
- Name = "sys.yml",
- Language = "it",
- }
- }
- },
- new AssetFile
- {
- Name = "msg/jp/sys.msg",
- Method = "kh2msg",
- Source = new List
- {
- new AssetFile
- {
- Name = "sys.yml",
- Language = "jp",
- }
- }
- }
- }
- };
-
- Directory.CreateDirectory(Path.Combine(AssetsInputDir, "msg/us/"));
- File.Create(Path.Combine(AssetsInputDir, "msg/us/sys.msg")).Using(stream =>
- {
- Msg.Write(stream, new List
- {
- new Msg.Entry
- {
- Data = new byte[] { 1, 2, 3, 0 },
- Id = 123
- }
- });
- });
- File.Create(Path.Combine(ModInputDir, "sys.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("- id: 456");
- writer.WriteLine(" en: English");
- writer.WriteLine(" it: Italiano");
- writer.WriteLine(" jp: テスト");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "msg/jp/sys.msg");
- File.OpenRead(Path.Combine(ModOutputDir, "msg/jp/sys.msg")).Using(stream =>
- {
- var msg = Msg.Read(stream);
- Assert.Single(msg);
- Assert.Equal(456, msg[0].Id);
- Assert.Equal("テスト", Encoders.JapaneseSystem.Decode(msg[0].Data).First().Text);
- });
-
- AssertFileExists(ModOutputDir, "msg/us/sys.msg");
- File.OpenRead(Path.Combine(ModOutputDir, "msg/us/sys.msg")).Using(stream =>
- {
- var msg = Msg.Read(stream);
- Assert.Equal(2, msg.Count);
- Assert.Equal(123, msg[0].Id);
- Assert.Equal(456, msg[1].Id);
- Assert.Equal("English", Encoders.InternationalSystem.Decode(msg[1].Data).First().Text);
- });
-
- AssertFileExists(ModOutputDir, "msg/it/sys.msg");
- File.OpenRead(Path.Combine(ModOutputDir, "msg/it/sys.msg")).Using(stream =>
- {
- var msg = Msg.Read(stream);
- Assert.Single(msg);
- Assert.Equal(456, msg[0].Id);
- Assert.Equal("Italiano", Encoders.InternationalSystem.Decode(msg[0].Data).First().Text);
- });
- }
-
- [Fact]
- public void MergeKh2AreaDataScriptTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "map.script",
- Method = "areadatascript",
- Source = new List
- {
- new AssetFile
- {
- Name = "map.txt",
- }
- }
- },
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "map.script")).Using(stream =>
- {
- var compiledProgram = Kh2.Ard.AreaDataScript.Compile("Program 1\nSpawn \"1111\"");
- Kh2.Ard.AreaDataScript.Write(stream, compiledProgram);
- });
- File.Create(Path.Combine(ModInputDir, "map.txt")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("Program 2");
- writer.WriteLine("Spawn \"2222\"");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "map.script");
- File.OpenRead(Path.Combine(ModOutputDir, "map.script")).Using(stream =>
- {
- var scripts = Kh2.Ard.AreaDataScript.Read(stream);
- var decompiled = Kh2.Ard.AreaDataScript.Decompile(scripts);
- decompiled.Contains("Program 1");
- decompiled.Contains("Spawn \"1111\"");
- decompiled.Contains("Program 2");
- decompiled.Contains("Spawn \"2222\"");
- });
- }
-
- [Fact]
- public void PatchKh2BdscriptTest()
- {
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "aaa",
- Method = "bdscript",
- Source = new List
- {
- new AssetFile
- {
- Name = "test.bdscript",
- }
- }
- },
- }
- };
- File.Create(Path.Combine(ModInputDir, "test.bdscript")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("---");
- writer.WriteLine("WorkSize: 64");
- writer.WriteLine("StackSize: 64");
- writer.WriteLine("TempSize: 64");
- writer.WriteLine("Triggers:");
- writer.WriteLine("- Key: 0");
- writer.WriteLine(" Addr: TR0");
- writer.WriteLine("Name: aaa");
- writer.WriteLine("---");
- writer.WriteLine(" section .text");
- writer.WriteLine("TR0:");
- writer.WriteLine(" ret");
- writer.WriteLine("DUMMY:");
- writer.WriteLine(" ret");
- writer.Flush();
- });
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "aaa");
-
- var bdxStream = new MemoryStream(File.ReadAllBytes(Path.Combine(ModOutputDir, "aaa")));
- var decoder = new BdxDecoder(bdxStream);
- var script = BdxDecoder.TextFormatter.Format(decoder);
-
- var lines = script.Split("\r\n");
-
- Assert.Equal("WorkSize: 64", lines[1]);
- Assert.Equal("Name: aaa", lines[7]);
-
- }
-
- [Fact]
- public void PatchKh2SpawnPointTest()
- {
-
- var patcher = new PatcherProcessor();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "map.script",
- Method = "areadataspawn",
- Source = new List
- {
- new AssetFile
- {
- Name = "map.yaml",
- }
- }
- },
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "map.script")).Using(stream =>
- {
- var spawnPoint = new List();
-
- Kh2.Ard.SpawnPoint.Write(stream, spawnPoint);
- });
- File.Create(Path.Combine(ModInputDir, "map.yaml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("- Type: 2");
- writer.WriteLine(" Flag: 1");
- writer.Flush();
- });
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "map.script");
- var content = File.ReadAllText(Path.Combine(ModOutputDir, "map.script"));
- var scripts = new Deserializer().Deserialize> (content);
-
- Assert.Equal(2, scripts[0].Type);
- Assert.Equal(1, scripts[0].Flag);
-
- }
-
-
- public void ListPatchTrsrTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata() {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "trsr",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "TrsrList.yml",
- Type = "trsr"
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "03system.bar")).Using(stream =>
- {
- var trsrEntry = new List()
- {
- new Kh2.SystemData.Trsr
- {
- Id = 1,
- ItemId = 10
- }
- };
- using var trsrStream = new MemoryStream();
- Kh2.SystemData.Trsr.Write(trsrStream, trsrEntry);
- Bar.Write(stream, new Bar() {
- new Bar.Entry()
- {
- Name = "trsr",
- Type = Bar.EntryType.List,
- Stream = trsrStream
- }
- });
- });
-
- File.Create(Path.Combine(ModInputDir, "TrsrList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("1:");
- writer.WriteLine(" ItemId: 200");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var trsrStream = Kh2.SystemData.Trsr.Read(binarc[0].Stream);
- Assert.Equal(200, trsrStream[0].ItemId);
- });
-
- }
-
- [Fact]
- public void ListPatchCmdTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata() {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "cmd",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "CmdList.yml",
- Type = "cmd"
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "03system.bar")).Using(stream =>
- {
- var cmdEntry = new List()
- {
- new Kh2.SystemData.Cmd
- {
- Id = 1,
- Execute = 3,
- Argument = 3,
- SubMenu = 1,
- }
- };
- using var cmdStream = new MemoryStream();
- Kh2.SystemData.Cmd.Write(cmdStream, cmdEntry);
- Bar.Write(stream, new Bar() {
- new Bar.Entry()
- {
- Name = "cmd",
- Type = Bar.EntryType.List,
- Stream = cmdStream
- }
- });
- });
-
- File.Create(Path.Combine(ModInputDir, "CmdList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("- Id: 1");
- writer.WriteLine(" Execute: 3");
- writer.WriteLine(" Argument: 3");
- writer.WriteLine(" SubMenu: 1");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var cmdStream = Kh2.SystemData.Cmd.Read(binarc[0].Stream);
- Assert.Equal(1, cmdStream[0].Id);
- Assert.Equal(3, cmdStream[0].Execute);
- Assert.Equal(3, cmdStream[0].Argument);
- Assert.Equal(1, cmdStream[0].SubMenu);
- });
-
- }
-
- [Fact]
- public void ListPatchItemTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "item",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "ItemList.yml",
- Type = "item"
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "03system.bar")).Using(stream =>
- {
- var itemEntry = new List()
- {
- new Kh2.SystemData.Item
- {
- Items = new List()
- {
- new Kh2.SystemData.Item.Entry()
- {
- Id = 1,
- ShopBuy = 10
- }
- },
- Stats = new List()
- {
- new Kh2.SystemData.Item.Stat()
- {
- Id = 10,
- Ability = 15
- }
- }
-
- }
- };
- using var itemStream = new MemoryStream();
- itemEntry[0].Write(itemStream);
- Bar.Write(stream, new Bar() {
- new Bar.Entry()
- {
- Name = "item",
- Type = Bar.EntryType.List,
- Stream = itemStream
- }
- });
- });
-
- File.Create(Path.Combine(ModInputDir, "ItemList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("Items:");
- writer.WriteLine("- Id: 1");
- writer.WriteLine(" ShopBuy: 200");
- writer.WriteLine("Stats:");
- writer.WriteLine("- Id: 10");
- writer.WriteLine(" Ability: 150");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var itemStream = Kh2.SystemData.Item.Read(binarc[0].Stream);
- Assert.Equal(200, itemStream.Items[0].ShopBuy);
- Assert.Equal(150, itemStream.Stats[0].Ability);
- });
-
- }
-
- [Fact]
- public void ListPatchShopTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata
- {
- Assets = new List
- {
- new AssetFile
- {
- Name = "03system.bin",
- Method = "binarc",
- Source = new List
- {
- new AssetFile
- {
- Name = "shop",
- Method = "listpatch",
- Type = "Unknown41",
- Source = new List
- {
- new AssetFile
- {
- Name = "ShopList.yml",
- Type = "shop"
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "03system.bin")).Using(stream =>
- {
- var shop = new OpenKh.Kh2.SystemData.Shop
- {
- ShopEntries = new List
- {
- new OpenKh.Kh2.SystemData.Shop.ShopEntry
- {
- CommandArgument = 0x0067,
- UnlockMenuFlag = 0x0029,
- NameID = 0x8AB8,
- ShopKeeperEntityID = 0x0539,
- PosX = 0x008B,
- PosY = 0x006C,
- PosZ = -576, //0xFDC0,
- ExtraInventoryBitMask = 0x81,
- SoundID = 0x01,
- InventoryCount = 0x0001,
- ShopID = 0x00,
- Unk19 = 0x02,
- InventoryOffset = 0x0028,
- Reserved = 0x00
- }
- },
- InventoryEntries = new List
- {
- new OpenKh.Kh2.SystemData.Shop.InventoryEntry
- {
- UnlockEventID = 0xFFFF,
- ProductCount = 0x0002,
- ProductOffset = 0x0030,
- Reserved = 0x00
- }
- },
- ProductEntries = new List
- {
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x0094
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x008B
- },
- },
- ValidProductEntries = new List
- {
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x0094
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x008B
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x0000
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x0000
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x0000
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntry
- {
- ItemID = 0x0000
- }
- }
- };
-
- using var shopStream = new MemoryStream();
- OpenKh.Kh2.SystemData.Shop.Write(shopStream, shop);
- Bar.Write(stream, new Bar {
- new Bar.Entry
- {
- Name = "shop",
- Type = Bar.EntryType.Unknown41,
- Stream = shopStream
- }
- });
- });
-
- var moddedShop = new OpenKh.Kh2.SystemData.Shop.ShopHelper
- {
- ShopEntryHelpers = new List
- {
- new OpenKh.Kh2.SystemData.Shop.ShopEntryHelper
- {
- CommandArgument = 0x0068,
- UnlockMenuFlag = 0x002A,
- NameID = 0x8AB9,
- ShopKeeperEntityID = 0x0749,
- PosX = 0x0086,
- PosY = 0x0096,
- PosZ = -591, // 0xFDB1,
- ExtraInventoryBitMask = 0x82,
- SoundID = 0x01,
- InventoryCount = 0x0001,
- ShopID = 0x00,
- Unk19 = 0x02,
- InventoryStartIndex = 0
- }
- },
- InventoryEntryHelpers = new List
- {
- new OpenKh.Kh2.SystemData.Shop.InventoryEntryHelper
- {
- InventoryIndex = 0,
- UnlockEventID = 0xFFFF,
- ProductCount = 0x0002,
- ProductStartIndex = 0,
- }
- },
- ProductEntryHelpers = new List
- {
- new OpenKh.Kh2.SystemData.Shop.ProductEntryHelper
- {
- ProductIndex = 0,
- ItemID = 0x0043
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntryHelper
- {
- ProductIndex = 1,
- ItemID = 0x0128
- }
- },
- ValidProductEntryHelpers = new List
- {
- new OpenKh.Kh2.SystemData.Shop.ProductEntryHelper
- {
- ProductIndex = 0,
- ItemID = 0x0043
- },
- new OpenKh.Kh2.SystemData.Shop.ProductEntryHelper
- {
- ProductIndex = 1,
- ItemID = 0x0128
- }
- }
- };
-
- File.Create(Path.Combine(ModInputDir, "ShopList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
-
- var serializer = new Serializer();
-
- writer.Write(serializer.Serialize(moddedShop));
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bin");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bin")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var verifyShop = OpenKh.Kh2.SystemData.Shop.Read(binarc[0].Stream);
- uint inventoryEntriesBaseOffset = (uint)(OpenKh.Kh2.SystemData.Shop.HeaderSize + verifyShop.ShopEntries.Count * OpenKh.Kh2.SystemData.Shop.ShopEntrySize);
- uint productEntriesBaseOffset = (uint)(inventoryEntriesBaseOffset + verifyShop.InventoryEntries.Count * OpenKh.Kh2.SystemData.Shop.InventoryEntrySize);
- foreach (var shopEntryHelper in moddedShop.ShopEntryHelpers)
- {
- int shopID = shopEntryHelper.ShopID;
- Assert.Equal(verifyShop.ShopEntries[shopID].CommandArgument, shopEntryHelper.CommandArgument);
- Assert.Equal(verifyShop.ShopEntries[shopID].UnlockMenuFlag, shopEntryHelper.UnlockMenuFlag);
- Assert.Equal(verifyShop.ShopEntries[shopID].NameID, shopEntryHelper.NameID);
- Assert.Equal(verifyShop.ShopEntries[shopID].ShopKeeperEntityID, shopEntryHelper.ShopKeeperEntityID);
- Assert.Equal(verifyShop.ShopEntries[shopID].PosX, shopEntryHelper.PosX);
- Assert.Equal(verifyShop.ShopEntries[shopID].PosY, shopEntryHelper.PosY);
- Assert.Equal(verifyShop.ShopEntries[shopID].PosZ, shopEntryHelper.PosZ);
- Assert.Equal(verifyShop.ShopEntries[shopID].ExtraInventoryBitMask, shopEntryHelper.ExtraInventoryBitMask);
- Assert.Equal(verifyShop.ShopEntries[shopID].SoundID, shopEntryHelper.SoundID);
- Assert.Equal(verifyShop.ShopEntries[shopID].InventoryCount, shopEntryHelper.InventoryCount);
- Assert.Equal(verifyShop.ShopEntries[shopID].ShopID, shopEntryHelper.ShopID);
- Assert.Equal(verifyShop.ShopEntries[shopID].Unk19, shopEntryHelper.Unk19);
- Assert.Equal(verifyShop.ShopEntries[shopID].InventoryOffset, (int)(inventoryEntriesBaseOffset + shopEntryHelper.InventoryStartIndex * OpenKh.Kh2.SystemData.Shop.InventoryEntrySize));
- }
- foreach (var inventoryEntryHelper in moddedShop.InventoryEntryHelpers)
- {
- Assert.Equal(verifyShop.InventoryEntries[inventoryEntryHelper.InventoryIndex].UnlockEventID, inventoryEntryHelper.UnlockEventID);
- Assert.Equal(verifyShop.InventoryEntries[inventoryEntryHelper.InventoryIndex].ProductCount, inventoryEntryHelper.ProductCount);
- Assert.Equal(verifyShop.InventoryEntries[inventoryEntryHelper.InventoryIndex].ProductOffset, (int)(productEntriesBaseOffset + inventoryEntryHelper.ProductStartIndex * OpenKh.Kh2.SystemData.Shop.ProductEntrySize));
- }
- foreach (var productEntryHelper in moddedShop.ProductEntryHelpers)
- {
- Assert.Equal(verifyShop.ProductEntries[productEntryHelper.ProductIndex].ItemID, productEntryHelper.ItemID);
- }
- foreach (var productEntryHelper in moddedShop.ValidProductEntryHelpers)
- {
- Assert.Equal(verifyShop.ValidProductEntries[productEntryHelper.ProductIndex].ItemID, productEntryHelper.ItemID);
- }
- });
- }
-
- [Fact]
- public void ListPatchSkltTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "sklt",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "SkltList.yml",
- Type = "sklt"
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "03system.bar")).Using(stream =>
- {
- var skltEntry = new List()
- {
- new Kh2.SystemData.Sklt
- {
- CharacterId = 1,
- Bone1 = 178,
- Bone2 = 86
- }
- };
-
- using var skltStream = new MemoryStream();
- Kh2.SystemData.Sklt.Write(skltStream, skltEntry);
- Bar.Write(stream, new Bar() {
- new Bar.Entry()
- {
- Name = "sklt",
- Type = Bar.EntryType.List,
- Stream = skltStream
- }
- });
- });
-
- File.Create(Path.Combine(ModInputDir, "SkltList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("- CharacterId: 1");
- writer.WriteLine(" Bone1: 178");
- writer.WriteLine(" Bone2: 86");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var skltStream = Kh2.SystemData.Sklt.Read(binarc[0].Stream);
- Assert.Equal(1U, skltStream[0].CharacterId);
- Assert.Equal(178, skltStream[0].Bone1);
- Assert.Equal(86, skltStream[0].Bone2);
- });
- }
-
- [Fact] //Fixed, needed to initialize the BGMSet & Reserved bytes.
- public void ListPatchArifTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bin",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "arif",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "ArifList.yml",
- Type = "arif"
- }
- }
- }
- }
- }
- }
- };
-
- using (var stream = File.Create(Path.Combine(AssetsInputDir, "03system.bin")))
- {
- var arifEntry = new Kh2.SystemData.Arif
- {
- Flags = Kh2.SystemData.Arif.ArifFlags.IsKnownArea,
- Reverb = 0,
- SoundEffectBank1 = 13,
- SoundEffectBank2 = 0,
- Bgms = Enumerable.Range(0, 8).Select(_ => new Kh2.SystemData.BgmSet { BgmField = 0, BgmBattle = 0 }).ToArray(),
- Voice = 0,
- NavigationMapItem = 0,
- Command = 0,
- Reserved = new byte[11]
- };
-
- using (var arifStream = new MemoryStream())
- {
- Kh2.SystemData.Arif.Write(arifStream, new List> { new List { arifEntry } });
- Bar.Write(stream, new Bar
- {
- new Bar.Entry()
- {
- Name = "arif",
- Type = Bar.EntryType.List,
- Stream = arifStream
- }
- });
- }
- }
-
- File.Create(Path.Combine(ModInputDir, "ArifList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("EndOfSea:");
- writer.WriteLine(" 1:");
- writer.WriteLine(" SoundEffectBank1: 13");
- writer.WriteLine(" Voice: 0");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bin");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bin")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var arifList = Kh2.SystemData.Arif.Read(binarc[0].Stream);
- var arifEntry = arifList[0][0];
- Assert.Equal(13, arifEntry.SoundEffectBank1);
- Assert.Equal(0, arifEntry.Voice);
- });
- }
-
- [Fact]
- public void ListPatchMemtTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "memt",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "MemtList.yml",
- Type = "memt"
- }
- }
- }
- }
- }
- }
- };
-
- // Create the 03system.bar file with initial data
- File.Create(Path.Combine(AssetsInputDir, "03system.bar")).Using(stream =>
- {
- var memtEntries = new List()
- {
- new Kh2.SystemData.Memt.EntryFinalMix
- {
- WorldId = 1,
- CheckStoryFlag = 1,
- CheckStoryFlagNegation = 0,
- CheckArea = 0,
- Padding = 0,
- PlayerSize= 0,
- FriendSize = 0,
- Members = new short[18]
- }
- };
-
- var memberIndices = new Kh2.SystemData.Memt.MemberIndices[7]; // Ensure there are 7 MemberIndices
- for (int i = 0; i < memberIndices.Length; i++)
- {
- memberIndices[i] = new Kh2.SystemData.Memt.MemberIndices
- {
- Player = 0,
- Friend1 = 0,
- Friend2 = 0,
- FriendWorld = 0
- };
- }
-
- using var memtStream = new MemoryStream();
- var memt = new Kh2.SystemData.Memt();
- memt.Entries.AddRange(memtEntries.Cast());
-
- Kh2.SystemData.Memt.Write(memtStream, memt);
- memtStream.Seek(0, SeekOrigin.Begin);
-
- Bar.Write(stream, new Bar()
- {
- new Bar.Entry()
- {
- Name = "memt",
- Type = Bar.EntryType.List,
- Stream = memtStream
- }
- });
- });
-
- // Create the MemtList.yml patch file
- File.Create(Path.Combine(ModInputDir, "MemtList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("MemtEntries:");
- writer.WriteLine(" - Index: 0");
- writer.WriteLine(" WorldId: 2");
- writer.WriteLine(" CheckStoryFlag: 3");
- writer.WriteLine(" CheckStoryFlagNegation: 4");
- writer.WriteLine(" CheckArea: 5");
- writer.WriteLine(" Padding: 6");
- writer.WriteLine(" PlayerSize: 7");
- writer.WriteLine(" FriendSize: 8");
- writer.WriteLine(" Members: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]");
- writer.WriteLine("MemberIndices:");
- writer.WriteLine(" - Index: 0");
- writer.WriteLine(" Player: 0");
- writer.WriteLine(" Friend1: 0");
- writer.WriteLine(" Friend2: 0");
- writer.WriteLine(" FriendWorld: 0");
- writer.Flush();
- });
-
- // Apply the patch
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir);
-
- // Verify the patched data
- AssertFileExists(ModOutputDir, "03system.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var memtStream = binarc[0].Stream;
- memtStream.Seek(0, SeekOrigin.Begin);
-
- var memt = Kh2.SystemData.Memt.Read(memtStream);
-
- var memtEntry = memt.Entries.Cast().First();
- Assert.Equal((short)2, memtEntry.WorldId);
- Assert.Equal((short)3, memtEntry.CheckStoryFlag);
- Assert.Equal((short)4, memtEntry.CheckStoryFlagNegation);
- Assert.Equal((short)5, memtEntry.CheckArea);
- Assert.Equal((short)6, memtEntry.Padding);
- Assert.Equal((short)7, memtEntry.PlayerSize);
- Assert.Equal((short)8, memtEntry.FriendSize);
- Assert.Equal(new short[] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 }, memtEntry.Members);
-
- // Check MemberIndices deserialization
- var memberIndices = memt.MemberIndexCollection.First();
- Assert.Equal((byte)0, memberIndices.Player);
- Assert.Equal((byte)0, memberIndices.Friend1);
- Assert.Equal((byte)0, memberIndices.Friend2);
- Assert.Equal((byte)0, memberIndices.FriendWorld);
- });
- }
-
-
-
-
- [Fact]
- public void ListPatchFmabTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "03system.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "pref",
- Method = "binarc",
- Type = "Binary",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "fmab",
- Method = "listpatch",
- Type = "list",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "FmabList.yml",
- Type = "fmab"
- }
- }
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "03system.bar")).Using(stream =>
- {
- var FmabEntry = new List()
- {
- new Kh2.SystemData.Fmab
- {
- HighJumpHeight = 178,
- AirDodgeHeight = 86
- }
- };
-
- using var fmabStream = new MemoryStream();
- Kh2.SystemData.Fmab.Write(fmabStream, FmabEntry);
- Bar.Write(stream, new Bar() {
- new Bar.Entry()
- {
- Name = "fmab",
- Type = Bar.EntryType.List,
- Stream = fmabStream
- }
- });
- });
-
- File.Create(Path.Combine(ModInputDir, "FmabList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- writer.WriteLine("- HighJumpHeight: 178");
- writer.WriteLine(" AirDodgeHeight: 86");
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "03system.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "03system.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var fmabStream = Kh2.SystemData.Fmab.Read(binarc[0].Stream);
- Assert.Equal(178, fmabStream[0].HighJumpHeight);
- Assert.Equal(86, fmabStream[0].AirDodgeHeight);
- });
- }
-
- [Fact]
- public void ListPatchFmlvTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List()
- {
- new AssetFile()
- {
- Name = "00battle.bar",
- Method = "binarc",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "fmlv",
- Method = "listpatch",
- Type = "List",
- Source = new List()
- {
- new AssetFile()
- {
- Name = "FmlvList.yml",
- Type = "fmlv"
- }
- }
- }
- }
- }
- }
- };
-
- File.Create(Path.Combine(AssetsInputDir, "00battle.bar")).Using(stream =>
- {
- var fmlvEntry = new List()
- {
- new Kh2.Battle.Fmlv
- {
- FormId = 1,
- FormLevel = 1,
- Exp = 100,
- Ability = 200
- },
- new Kh2.Battle.Fmlv
- {
- FormId = 1,
- FormLevel = 2,
- Exp = 100,
- Ability = 200
- },
- new Kh2.Battle.Fmlv
- {
- FormId = 2,
- FormLevel = 1,
- Exp = 100,
- Ability = 200
- },
- };
-
- using var fmlvStream = new MemoryStream();
- Kh2.Battle.Fmlv.Write(fmlvStream, fmlvEntry);
- Bar.Write(stream, new Bar() {
- new Bar.Entry()
- {
- Name = "fmlv",
- Type = Bar.EntryType.List,
- Stream = fmlvStream
- }
- });
- });
-
- File.Create(Path.Combine(ModInputDir, "FmlvList.yml")).Using(stream =>
- {
- var writer = new StreamWriter(stream);
- var serializer = new Serializer();
- serializer.Serialize(writer, new Dictionary
- {
- ["Valor"] = new[]
- {
- new FmlvDTO
- {
- FormLevel = 1,
- Experience = 5,
- Ability = 127
- }
- }
- });
- writer.Flush();
- });
-
- patcher.Patch(AssetsInputDir, ModOutputDir, patch, ModInputDir, Tests: true);
-
- AssertFileExists(ModOutputDir, "00battle.bar");
-
- File.OpenRead(Path.Combine(ModOutputDir, "00battle.bar")).Using(stream =>
- {
- var binarc = Bar.Read(stream);
- var fmlv = Kh2.Battle.Fmlv.Read(binarc[0].Stream);
-
- Assert.Equal(3, fmlv.Count);
- Assert.Equal(1, fmlv[0].FormId);
- Assert.Equal(1, fmlv[0].FormLevel);
- Assert.Equal(5, fmlv[0].Exp);
- Assert.Equal(127, fmlv[0].Ability);
-
- Assert.Equal(1, fmlv[1].FormId);
- Assert.Equal(2, fmlv[1].FormLevel);
-
- Assert.Equal(2, fmlv[2].FormId);
- Assert.Equal(1, fmlv[2].FormLevel);
- });
- }
-
- [Fact]
- public void ListPatchBonsTest()
- {
- var patcher = new PatcherProcessor();
- var serializer = new Serializer();
- var patch = new Metadata()
- {
- Assets = new List