diff --git a/ChovyUI.Designer.cs b/ChovyUI.Designer.cs
new file mode 100644
index 0000000..225b8eb
--- /dev/null
+++ b/ChovyUI.Designer.cs
@@ -0,0 +1,624 @@
+namespace ChovyUI
+{
+ partial class ChovyUI
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.LBumper = new System.Windows.Forms.TextBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.StartButton = new System.Windows.Forms.TextBox();
+ this.label13 = new System.Windows.Forms.Label();
+ this.SelectButton = new System.Windows.Forms.TextBox();
+ this.label12 = new System.Windows.Forms.Label();
+ this.TriangleButton = new System.Windows.Forms.TextBox();
+ this.label11 = new System.Windows.Forms.Label();
+ this.SquareButton = new System.Windows.Forms.TextBox();
+ this.label10 = new System.Windows.Forms.Label();
+ this.CrossButton = new System.Windows.Forms.TextBox();
+ this.label9 = new System.Windows.Forms.Label();
+ this.CircleButton = new System.Windows.Forms.TextBox();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.DownDPAD = new System.Windows.Forms.TextBox();
+ this.UpDPAD = new System.Windows.Forms.TextBox();
+ this.label6 = new System.Windows.Forms.Label();
+ this.RightDPAD = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.LeftDPAD = new System.Windows.Forms.TextBox();
+ this.RBumper = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.GMPath = new System.Windows.Forms.TextBox();
+ this.label14 = new System.Windows.Forms.Label();
+ this.BrowseEXE = new System.Windows.Forms.Button();
+ this.BuildISO = new System.Windows.Forms.Button();
+ this.label15 = new System.Windows.Forms.Label();
+ this.IconPath = new System.Windows.Forms.TextBox();
+ this.BrowseIcon = new System.Windows.Forms.Button();
+ this.label16 = new System.Windows.Forms.Label();
+ this.PicPath = new System.Windows.Forms.TextBox();
+ this.BrowsePic = new System.Windows.Forms.Button();
+ this.label17 = new System.Windows.Forms.Label();
+ this.TitleId = new System.Windows.Forms.TextBox();
+ this.label18 = new System.Windows.Forms.Label();
+ this.Title = new System.Windows.Forms.TextBox();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.ForeColor = System.Drawing.Color.Cyan;
+ this.label1.Location = new System.Drawing.Point(309, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(92, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "GameMaker: PSP";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.ForeColor = System.Drawing.Color.Cyan;
+ this.label2.Location = new System.Drawing.Point(6, 16);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(74, 13);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "SCE_CTRL_L";
+ //
+ // LBumper
+ //
+ this.LBumper.BackColor = System.Drawing.Color.Black;
+ this.LBumper.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.LBumper.ForeColor = System.Drawing.Color.Lime;
+ this.LBumper.Location = new System.Drawing.Point(158, 16);
+ this.LBumper.Multiline = true;
+ this.LBumper.Name = "LBumper";
+ this.LBumper.Size = new System.Drawing.Size(192, 13);
+ this.LBumper.TabIndex = 4;
+ this.LBumper.Text = "mb_left";
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.StartButton);
+ this.groupBox1.Controls.Add(this.label13);
+ this.groupBox1.Controls.Add(this.SelectButton);
+ this.groupBox1.Controls.Add(this.label12);
+ this.groupBox1.Controls.Add(this.TriangleButton);
+ this.groupBox1.Controls.Add(this.label11);
+ this.groupBox1.Controls.Add(this.SquareButton);
+ this.groupBox1.Controls.Add(this.label10);
+ this.groupBox1.Controls.Add(this.CrossButton);
+ this.groupBox1.Controls.Add(this.label9);
+ this.groupBox1.Controls.Add(this.CircleButton);
+ this.groupBox1.Controls.Add(this.label8);
+ this.groupBox1.Controls.Add(this.label7);
+ this.groupBox1.Controls.Add(this.DownDPAD);
+ this.groupBox1.Controls.Add(this.UpDPAD);
+ this.groupBox1.Controls.Add(this.label6);
+ this.groupBox1.Controls.Add(this.RightDPAD);
+ this.groupBox1.Controls.Add(this.label5);
+ this.groupBox1.Controls.Add(this.label4);
+ this.groupBox1.Controls.Add(this.LeftDPAD);
+ this.groupBox1.Controls.Add(this.RBumper);
+ this.groupBox1.Controls.Add(this.label3);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.LBumper);
+ this.groupBox1.ForeColor = System.Drawing.Color.Cyan;
+ this.groupBox1.Location = new System.Drawing.Point(194, 197);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(356, 252);
+ this.groupBox1.TabIndex = 3;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Control Mapping";
+ //
+ // StartButton
+ //
+ this.StartButton.BackColor = System.Drawing.Color.Black;
+ this.StartButton.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.StartButton.ForeColor = System.Drawing.Color.Lime;
+ this.StartButton.Location = new System.Drawing.Point(158, 225);
+ this.StartButton.Multiline = true;
+ this.StartButton.Name = "StartButton";
+ this.StartButton.Size = new System.Drawing.Size(192, 13);
+ this.StartButton.TabIndex = 23;
+ this.StartButton.Text = "vk_shift";
+ //
+ // label13
+ //
+ this.label13.AutoSize = true;
+ this.label13.Location = new System.Drawing.Point(6, 225);
+ this.label13.Name = "label13";
+ this.label13.Size = new System.Drawing.Size(104, 13);
+ this.label13.TabIndex = 22;
+ this.label13.Text = "SCE_CTRL_START";
+ //
+ // SelectButton
+ //
+ this.SelectButton.BackColor = System.Drawing.Color.Black;
+ this.SelectButton.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.SelectButton.ForeColor = System.Drawing.Color.Lime;
+ this.SelectButton.Location = new System.Drawing.Point(158, 206);
+ this.SelectButton.Multiline = true;
+ this.SelectButton.Name = "SelectButton";
+ this.SelectButton.Size = new System.Drawing.Size(192, 13);
+ this.SelectButton.TabIndex = 21;
+ this.SelectButton.Text = "vk_pause";
+ //
+ // label12
+ //
+ this.label12.AutoSize = true;
+ this.label12.Location = new System.Drawing.Point(6, 206);
+ this.label12.Name = "label12";
+ this.label12.Size = new System.Drawing.Size(109, 13);
+ this.label12.TabIndex = 20;
+ this.label12.Text = "SCE_CTRL_SELECT";
+ //
+ // TriangleButton
+ //
+ this.TriangleButton.BackColor = System.Drawing.Color.Black;
+ this.TriangleButton.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.TriangleButton.ForeColor = System.Drawing.Color.Lime;
+ this.TriangleButton.Location = new System.Drawing.Point(158, 187);
+ this.TriangleButton.Multiline = true;
+ this.TriangleButton.Name = "TriangleButton";
+ this.TriangleButton.Size = new System.Drawing.Size(192, 13);
+ this.TriangleButton.TabIndex = 19;
+ this.TriangleButton.Text = "D";
+ //
+ // label11
+ //
+ this.label11.AutoSize = true;
+ this.label11.Location = new System.Drawing.Point(6, 187);
+ this.label11.Name = "label11";
+ this.label11.Size = new System.Drawing.Size(122, 13);
+ this.label11.TabIndex = 18;
+ this.label11.Text = "SCE_CTRL_TRIANGLE";
+ //
+ // SquareButton
+ //
+ this.SquareButton.BackColor = System.Drawing.Color.Black;
+ this.SquareButton.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.SquareButton.ForeColor = System.Drawing.Color.Lime;
+ this.SquareButton.Location = new System.Drawing.Point(158, 168);
+ this.SquareButton.Multiline = true;
+ this.SquareButton.Name = "SquareButton";
+ this.SquareButton.Size = new System.Drawing.Size(192, 13);
+ this.SquareButton.TabIndex = 17;
+ this.SquareButton.Text = "A";
+ //
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.Location = new System.Drawing.Point(6, 168);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(113, 13);
+ this.label10.TabIndex = 16;
+ this.label10.Text = "SCE_CTRL_SQUARE";
+ //
+ // CrossButton
+ //
+ this.CrossButton.BackColor = System.Drawing.Color.Black;
+ this.CrossButton.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.CrossButton.ForeColor = System.Drawing.Color.Lime;
+ this.CrossButton.Location = new System.Drawing.Point(158, 149);
+ this.CrossButton.Multiline = true;
+ this.CrossButton.Name = "CrossButton";
+ this.CrossButton.Size = new System.Drawing.Size(192, 13);
+ this.CrossButton.TabIndex = 15;
+ this.CrossButton.Text = "Z";
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(6, 149);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(105, 13);
+ this.label9.TabIndex = 14;
+ this.label9.Text = "SCE_CTRL_CROSS";
+ //
+ // CircleButton
+ //
+ this.CircleButton.BackColor = System.Drawing.Color.Black;
+ this.CircleButton.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.CircleButton.ForeColor = System.Drawing.Color.Lime;
+ this.CircleButton.Location = new System.Drawing.Point(158, 130);
+ this.CircleButton.Multiline = true;
+ this.CircleButton.Name = "CircleButton";
+ this.CircleButton.Size = new System.Drawing.Size(192, 13);
+ this.CircleButton.TabIndex = 13;
+ this.CircleButton.Text = "X";
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(6, 130);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(109, 13);
+ this.label8.TabIndex = 12;
+ this.label8.Text = "SCE_CTRL_CIRCLE ";
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(6, 111);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(103, 13);
+ this.label7.TabIndex = 11;
+ this.label7.Text = "SCE_CTRL_DOWN";
+ //
+ // DownDPAD
+ //
+ this.DownDPAD.BackColor = System.Drawing.Color.Black;
+ this.DownDPAD.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.DownDPAD.ForeColor = System.Drawing.Color.Lime;
+ this.DownDPAD.Location = new System.Drawing.Point(158, 111);
+ this.DownDPAD.Multiline = true;
+ this.DownDPAD.Name = "DownDPAD";
+ this.DownDPAD.Size = new System.Drawing.Size(192, 13);
+ this.DownDPAD.TabIndex = 10;
+ this.DownDPAD.Text = "vk_down";
+ //
+ // UpDPAD
+ //
+ this.UpDPAD.BackColor = System.Drawing.Color.Black;
+ this.UpDPAD.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.UpDPAD.ForeColor = System.Drawing.Color.Lime;
+ this.UpDPAD.Location = new System.Drawing.Point(158, 92);
+ this.UpDPAD.Multiline = true;
+ this.UpDPAD.Name = "UpDPAD";
+ this.UpDPAD.Size = new System.Drawing.Size(192, 13);
+ this.UpDPAD.TabIndex = 9;
+ this.UpDPAD.Text = "vk_up";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(6, 92);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(83, 13);
+ this.label6.TabIndex = 8;
+ this.label6.Text = "SCE_CTRL_UP";
+ //
+ // RightDPAD
+ //
+ this.RightDPAD.BackColor = System.Drawing.Color.Black;
+ this.RightDPAD.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.RightDPAD.ForeColor = System.Drawing.Color.Lime;
+ this.RightDPAD.Location = new System.Drawing.Point(158, 73);
+ this.RightDPAD.Multiline = true;
+ this.RightDPAD.Name = "RightDPAD";
+ this.RightDPAD.Size = new System.Drawing.Size(192, 13);
+ this.RightDPAD.TabIndex = 7;
+ this.RightDPAD.Text = "vk_right";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(6, 73);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(102, 13);
+ this.label5.TabIndex = 6;
+ this.label5.Text = "SCE_CTRL_RIGHT";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.ForeColor = System.Drawing.Color.Cyan;
+ this.label4.Location = new System.Drawing.Point(6, 54);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(94, 13);
+ this.label4.TabIndex = 4;
+ this.label4.Text = "SCE_CTRL_LEFT";
+ //
+ // LeftDPAD
+ //
+ this.LeftDPAD.BackColor = System.Drawing.Color.Black;
+ this.LeftDPAD.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.LeftDPAD.ForeColor = System.Drawing.Color.Lime;
+ this.LeftDPAD.Location = new System.Drawing.Point(158, 54);
+ this.LeftDPAD.Multiline = true;
+ this.LeftDPAD.Name = "LeftDPAD";
+ this.LeftDPAD.Size = new System.Drawing.Size(192, 13);
+ this.LeftDPAD.TabIndex = 5;
+ this.LeftDPAD.Text = "vk_left";
+ //
+ // RBumper
+ //
+ this.RBumper.BackColor = System.Drawing.Color.Black;
+ this.RBumper.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this.RBumper.ForeColor = System.Drawing.Color.Lime;
+ this.RBumper.Location = new System.Drawing.Point(158, 35);
+ this.RBumper.Multiline = true;
+ this.RBumper.Name = "RBumper";
+ this.RBumper.Size = new System.Drawing.Size(192, 13);
+ this.RBumper.TabIndex = 4;
+ this.RBumper.Text = "mb_right";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.ForeColor = System.Drawing.Color.Cyan;
+ this.label3.Location = new System.Drawing.Point(6, 35);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(76, 13);
+ this.label3.TabIndex = 3;
+ this.label3.Text = "SCE_CTRL_R";
+ //
+ // GMPath
+ //
+ this.GMPath.BackColor = System.Drawing.Color.Black;
+ this.GMPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.GMPath.ForeColor = System.Drawing.Color.Lime;
+ this.GMPath.Location = new System.Drawing.Point(238, 30);
+ this.GMPath.Name = "GMPath";
+ this.GMPath.Size = new System.Drawing.Size(259, 20);
+ this.GMPath.TabIndex = 0;
+ this.GMPath.TextChanged += new System.EventHandler(this.GMPath_TextChanged);
+ //
+ // label14
+ //
+ this.label14.AutoSize = true;
+ this.label14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.label14.Location = new System.Drawing.Point(176, 33);
+ this.label14.Name = "label14";
+ this.label14.Size = new System.Drawing.Size(56, 13);
+ this.label14.TabIndex = 5;
+ this.label14.Text = "GM81 exe";
+ //
+ // BrowseEXE
+ //
+ this.BrowseEXE.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BrowseEXE.ForeColor = System.Drawing.Color.Lime;
+ this.BrowseEXE.Location = new System.Drawing.Point(503, 29);
+ this.BrowseEXE.Name = "BrowseEXE";
+ this.BrowseEXE.Size = new System.Drawing.Size(54, 21);
+ this.BrowseEXE.TabIndex = 6;
+ this.BrowseEXE.Text = "Browse";
+ this.BrowseEXE.UseVisualStyleBackColor = true;
+ this.BrowseEXE.Click += new System.EventHandler(this.Browse_Click);
+ //
+ // BuildISO
+ //
+ this.BuildISO.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BuildISO.ForeColor = System.Drawing.Color.Lime;
+ this.BuildISO.Location = new System.Drawing.Point(190, 455);
+ this.BuildISO.Name = "BuildISO";
+ this.BuildISO.Size = new System.Drawing.Size(356, 23);
+ this.BuildISO.TabIndex = 7;
+ this.BuildISO.Text = "Build ISO";
+ this.BuildISO.UseVisualStyleBackColor = true;
+ this.BuildISO.Click += new System.EventHandler(this.BuildISO_Click);
+ //
+ // label15
+ //
+ this.label15.AutoSize = true;
+ this.label15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.label15.Location = new System.Drawing.Point(178, 57);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(54, 13);
+ this.label15.TabIndex = 8;
+ this.label15.Text = "icon0.png";
+ //
+ // IconPath
+ //
+ this.IconPath.BackColor = System.Drawing.Color.Black;
+ this.IconPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.IconPath.ForeColor = System.Drawing.Color.Lime;
+ this.IconPath.Location = new System.Drawing.Point(238, 55);
+ this.IconPath.Name = "IconPath";
+ this.IconPath.Size = new System.Drawing.Size(259, 20);
+ this.IconPath.TabIndex = 9;
+ this.IconPath.Text = "IMG\\ICON0.PNG";
+ this.IconPath.TextChanged += new System.EventHandler(this.IconPath_TextChanged);
+ //
+ // BrowseIcon
+ //
+ this.BrowseIcon.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BrowseIcon.ForeColor = System.Drawing.Color.Lime;
+ this.BrowseIcon.Location = new System.Drawing.Point(503, 53);
+ this.BrowseIcon.Name = "BrowseIcon";
+ this.BrowseIcon.Size = new System.Drawing.Size(54, 21);
+ this.BrowseIcon.TabIndex = 10;
+ this.BrowseIcon.Text = "Browse";
+ this.BrowseIcon.UseVisualStyleBackColor = true;
+ this.BrowseIcon.Click += new System.EventHandler(this.BrowseIcon_Click);
+ //
+ // label16
+ //
+ this.label16.AutoSize = true;
+ this.label16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.label16.Location = new System.Drawing.Point(187, 81);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(48, 13);
+ this.label16.TabIndex = 11;
+ this.label16.Text = "pic0.png";
+ //
+ // PicPath
+ //
+ this.PicPath.BackColor = System.Drawing.Color.Black;
+ this.PicPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.PicPath.ForeColor = System.Drawing.Color.Lime;
+ this.PicPath.Location = new System.Drawing.Point(238, 79);
+ this.PicPath.Name = "PicPath";
+ this.PicPath.Size = new System.Drawing.Size(259, 20);
+ this.PicPath.TabIndex = 12;
+ this.PicPath.Text = "IMG\\PIC0.PNG";
+ this.PicPath.TextChanged += new System.EventHandler(this.PicPath_TextChanged);
+ //
+ // BrowsePic
+ //
+ this.BrowsePic.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.BrowsePic.ForeColor = System.Drawing.Color.Lime;
+ this.BrowsePic.Location = new System.Drawing.Point(503, 78);
+ this.BrowsePic.Name = "BrowsePic";
+ this.BrowsePic.Size = new System.Drawing.Size(54, 21);
+ this.BrowsePic.TabIndex = 13;
+ this.BrowsePic.Text = "Browse";
+ this.BrowsePic.UseVisualStyleBackColor = true;
+ this.BrowsePic.Click += new System.EventHandler(this.BrowsePic_Click);
+ //
+ // label17
+ //
+ this.label17.AutoSize = true;
+ this.label17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.label17.Location = new System.Drawing.Point(191, 173);
+ this.label17.Name = "label17";
+ this.label17.Size = new System.Drawing.Size(44, 13);
+ this.label17.TabIndex = 14;
+ this.label17.Text = "Title ID:";
+ //
+ // TitleId
+ //
+ this.TitleId.BackColor = System.Drawing.Color.Black;
+ this.TitleId.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.TitleId.ForeColor = System.Drawing.Color.Lime;
+ this.TitleId.Location = new System.Drawing.Point(238, 171);
+ this.TitleId.MaxLength = 9;
+ this.TitleId.Name = "TitleId";
+ this.TitleId.Size = new System.Drawing.Size(319, 20);
+ this.TitleId.TabIndex = 15;
+ this.TitleId.Text = "ULES99999";
+ this.TitleId.TextChanged += new System.EventHandler(this.TitleId_TextChanged);
+ //
+ // label18
+ //
+ this.label18.AutoSize = true;
+ this.label18.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.label18.Location = new System.Drawing.Point(205, 107);
+ this.label18.Name = "label18";
+ this.label18.Size = new System.Drawing.Size(30, 13);
+ this.label18.TabIndex = 16;
+ this.label18.Text = "Title:";
+ //
+ // Title
+ //
+ this.Title.BackColor = System.Drawing.Color.Black;
+ this.Title.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.Title.ForeColor = System.Drawing.Color.Lime;
+ this.Title.Location = new System.Drawing.Point(238, 105);
+ this.Title.MaxLength = 64;
+ this.Title.Multiline = true;
+ this.Title.Name = "Title";
+ this.Title.Size = new System.Drawing.Size(319, 60);
+ this.Title.TabIndex = 17;
+ this.Title.Text = "GameMaker: PSP";
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.BackgroundImage = global::ChovyUI.Properties.Resources.psmkun;
+ this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.pictureBox1.Location = new System.Drawing.Point(12, 12);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(160, 473);
+ this.pictureBox1.TabIndex = 18;
+ this.pictureBox1.TabStop = false;
+ //
+ // ChovyUI
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.ClientSize = new System.Drawing.Size(569, 494);
+ this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.Title);
+ this.Controls.Add(this.label18);
+ this.Controls.Add(this.TitleId);
+ this.Controls.Add(this.label17);
+ this.Controls.Add(this.BrowsePic);
+ this.Controls.Add(this.PicPath);
+ this.Controls.Add(this.label16);
+ this.Controls.Add(this.BrowseIcon);
+ this.Controls.Add(this.IconPath);
+ this.Controls.Add(this.label15);
+ this.Controls.Add(this.BuildISO);
+ this.Controls.Add(this.BrowseEXE);
+ this.Controls.Add(this.label14);
+ this.Controls.Add(this.GMPath);
+ this.Controls.Add(this.groupBox1);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.Name = "ChovyUI";
+ this.Text = "CHOVY-GM";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ChovyUI_FormClosing);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox LBumper;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.TextBox CircleButton;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.TextBox DownDPAD;
+ private System.Windows.Forms.TextBox UpDPAD;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TextBox RightDPAD;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox LeftDPAD;
+ private System.Windows.Forms.TextBox RBumper;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox TriangleButton;
+ private System.Windows.Forms.Label label11;
+ private System.Windows.Forms.TextBox SquareButton;
+ private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.TextBox CrossButton;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label12;
+ private System.Windows.Forms.TextBox StartButton;
+ private System.Windows.Forms.Label label13;
+ private System.Windows.Forms.TextBox SelectButton;
+ private System.Windows.Forms.TextBox GMPath;
+ private System.Windows.Forms.Label label14;
+ private System.Windows.Forms.Button BrowseEXE;
+ private System.Windows.Forms.Button BuildISO;
+ private System.Windows.Forms.Label label15;
+ private System.Windows.Forms.TextBox IconPath;
+ private System.Windows.Forms.Button BrowseIcon;
+ private System.Windows.Forms.Label label16;
+ private System.Windows.Forms.TextBox PicPath;
+ private System.Windows.Forms.Button BrowsePic;
+ private System.Windows.Forms.Label label17;
+ private System.Windows.Forms.TextBox TitleId;
+ private System.Windows.Forms.Label label18;
+ private System.Windows.Forms.TextBox Title;
+ private System.Windows.Forms.PictureBox pictureBox1;
+ }
+}
\ No newline at end of file
diff --git a/ChovyUI.cs b/ChovyUI.cs
new file mode 100644
index 0000000..5abf6ad
--- /dev/null
+++ b/ChovyUI.cs
@@ -0,0 +1,319 @@
+using GMAssetCompiler;
+using System;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace ChovyUI
+{
+ public partial class ChovyUI : Form
+ {
+ bool wasClicked = false;
+ public ChovyUI()
+ {
+ InitializeComponent();
+ IconPath.Text = Path.Combine(Application.StartupPath, "IMG", "ICON0.PNG");
+ PicPath.Text = Path.Combine(Application.StartupPath, "IMG", "PIC0.PNG");
+
+ try
+ {
+ Microsoft.Win32.RegistryKey key;
+ key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\CHOVYProject\Chovy-GM");
+
+ TitleId.Text = key.GetValue("TITLEID", TitleId.Text).ToString();
+ Title.Text = key.GetValue("TITLE", Title.Text).ToString();
+ GMPath.Text = key.GetValue("GMEXE", GMPath.Text).ToString();
+ IconPath.Text = key.GetValue("ICONPATH", IconPath.Text).ToString();
+ PicPath.Text = key.GetValue("PICPATH", PicPath.Text).ToString();
+
+
+ LBumper.Text = key.GetValue("SCE_CTRL_L", LBumper.Text.ToUpper()).ToString();
+ RBumper.Text = key.GetValue("SCE_CTRL_R", RBumper.Text.ToUpper()).ToString();
+ LeftDPAD.Text = key.GetValue("SCE_CTRL_LEFT", LeftDPAD.Text.ToUpper()).ToString();
+ RightDPAD.Text = key.GetValue("SCE_CTRL_RIGHT", RightDPAD.Text.ToUpper()).ToString();
+ UpDPAD.Text = key.GetValue("SCE_CTRL_UP", UpDPAD.Text.ToUpper()).ToString();
+ DownDPAD.Text = key.GetValue("SCE_CTRL_DOWN", DownDPAD.Text.ToUpper()).ToString();
+
+ CircleButton.Text = key.GetValue("SCE_CTRL_CIRCLE", CircleButton.Text.ToUpper()).ToString();
+ CrossButton.Text = key.GetValue("SCE_CTRL_CROSS", CrossButton.Text.ToUpper()).ToString();
+ SquareButton.Text = key.GetValue("SCE_CTRL_SQUARE", SquareButton.Text.ToUpper()).ToString();
+ TriangleButton.Text = key.GetValue("SCE_CTRL_TRIANGLE", TriangleButton.Text.ToUpper()).ToString();
+
+ SelectButton.Text = key.GetValue("SCE_CTRL_SELECT", SelectButton.Text.ToUpper()).ToString();
+ StartButton.Text = key.GetValue("SCE_CTRL_START", StartButton.Text.ToUpper()).ToString();
+ key.Close();
+ }
+ catch (Exception) { };
+ Check();
+
+ }
+
+ private void BrowseIcon_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog openFileDialog = new OpenFileDialog();
+ openFileDialog.Filter = "PNG files (*.png)|*.png;";
+ openFileDialog.FilterIndex = 1;
+ openFileDialog.RestoreDirectory = true;
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ IconPath.Text = openFileDialog.FileName;
+ }
+ }
+
+ private void BrowsePic_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog openFileDialog = new OpenFileDialog();
+ openFileDialog.Filter = "PNG files (*.png)|*.png;";
+ openFileDialog.FilterIndex = 1;
+ openFileDialog.RestoreDirectory = true;
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ PicPath.Text = openFileDialog.FileName;
+ }
+ }
+
+ private void Browse_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog openFileDialog = new OpenFileDialog();
+ openFileDialog.Filter = "GameMaker 7/8/8.1 Executable files (*.exe)|*.exe;";
+ openFileDialog.FilterIndex = 1;
+ openFileDialog.RestoreDirectory = true;
+ if (openFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ GMPath.Text = openFileDialog.FileName;
+ }
+
+ }
+
+ public static void CopyDirTree(string SourcePath, string DestinationPath)
+ {
+ //Now Create all of the directories
+ foreach (string dirPath in Directory.GetDirectories(SourcePath, "*",
+ SearchOption.AllDirectories))
+ Directory.CreateDirectory(dirPath.Replace(SourcePath, DestinationPath));
+
+ //Copy all the files & Replaces any files with the same name
+ foreach (string newPath in Directory.GetFiles(SourcePath, "*.*",
+ SearchOption.AllDirectories))
+ File.Copy(newPath, newPath.Replace(SourcePath, DestinationPath), true);
+ }
+
+ public static void WriteString(Stream s, string Str)
+ {
+ char[] carr = Str.ToCharArray();
+ foreach (char c in carr)
+ {
+ s.WriteByte((byte)c);
+ }
+ }
+ public static void WriteValueStr(Stream s, string Key, string Value)
+ {
+ WriteString(s, Key + " = ");
+ WriteString(s, Value);
+ WriteString(s, "\r\n");
+ }
+
+ private void BuildISO_Click(object sender, EventArgs e)
+ {
+ wasClicked = true;
+ Program.OutputDir = Path.GetDirectoryName(GMPath.Text);
+
+ String InputFolder = Path.Combine(Program.OutputDir, "_iso_temp");
+ if (Directory.Exists(InputFolder))
+ {
+ Directory.Delete(InputFolder, true);
+ }
+ CopyDirTree(Path.Combine(Application.StartupPath, "RUNNER"), InputFolder);
+
+ //Write to PARAM.SFO:
+ FileStream sfo = new FileStream(Path.Combine(InputFolder, "PSP_GAME", "PARAM.SFO"),FileMode.OpenOrCreate,FileAccess.ReadWrite);
+ sfo.Seek(0x128, SeekOrigin.Begin);
+ WriteString(sfo, TitleId.Text);
+ sfo.Seek(0x158, SeekOrigin.Begin);
+ WriteString(sfo, Title.Text);
+ sfo.Close();
+
+ //Copy icon and pic0:
+ File.Copy(IconPath.Text, Path.Combine(InputFolder, "PSP_GAME", "ICON0.PNG"), true);
+ File.Copy(PicPath.Text, Path.Combine(InputFolder, "PSP_GAME", "PIC0.PNG"), true);
+ File.Copy(PicPath.Text, Path.Combine(InputFolder, "PSP_GAME", "USRDIR", "games","ICON0.PNG"), true);
+
+ //Write game.ini
+ FileStream ini = new FileStream(Path.Combine(InputFolder, "PSP_GAME", "USRDIR","games","game.ini"), FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ ini.SetLength(0);
+
+ WriteString(ini, "[PSP_LOADSAVE]\r\n");
+ WriteValueStr(ini, "ICON","games /ICON0.PNG");
+ WriteValueStr(ini, "TITLEID", TitleId.Text);
+ WriteValueStr(ini, "SHORT_NAME", Title.Text);
+ WriteValueStr(ini, "DESC_NAME", Title.Text+ " save game.");
+ WriteValueStr(ini, "PARENTAL_LEVEL", "0");
+
+ WriteString(ini, "[PSP_IO]\r\n");
+ WriteValueStr(ini, "SCE_CTRL_L", LBumper.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_R", RBumper.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_LEFT", LeftDPAD.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_RIGHT", RightDPAD.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_UP", UpDPAD.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_DOWN", DownDPAD.Text.ToUpper());
+
+ WriteValueStr(ini, "SCE_CTRL_CIRCLE", CircleButton.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_CROSS", CrossButton.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_SQUARE", SquareButton.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_TRIANGLE", TriangleButton.Text.ToUpper());
+
+ WriteValueStr(ini, "SCE_CTRL_SELECT", SelectButton.Text.ToUpper());
+ WriteValueStr(ini, "SCE_CTRL_START", StartButton.Text.ToUpper());
+
+ ini.Close();
+
+ this.Close();
+
+ }
+
+ public string GetGMPath()
+ {
+ return GMPath.Text;
+ }
+
+ public string GetTitleID()
+ {
+ return TitleId.Text;
+ }
+
+ public bool WasClicked()
+ {
+ return wasClicked;
+ }
+
+ public void Check()
+ {
+ if (File.Exists(GMPath.Text))
+ {
+ BuildISO.Enabled = true;
+ }
+ else
+ {
+ BuildISO.Enabled = false;
+ return;
+ }
+
+ if (File.Exists(IconPath.Text))
+ {
+ BuildISO.Enabled = false;
+
+ try
+ {
+ Bitmap bmp = new Bitmap(IconPath.Text);
+ if(bmp.Width != 144 || bmp.Height != 80)
+ {
+ return;
+ }
+ }
+ catch(Exception)
+ {
+ return;
+ }
+ BuildISO.Enabled = true;
+
+ }
+ else
+ {
+ BuildISO.Enabled = false;
+ return;
+ }
+
+ if (File.Exists(PicPath.Text))
+ {
+ BuildISO.Enabled = true;
+ }
+ else
+ {
+ BuildISO.Enabled = false;
+ return;
+ }
+
+ BuildISO.Enabled = false;
+
+ if (TitleId.Text.Length == 9)
+ {
+ char[] TitleArray = TitleId.Text.ToArray();
+ for (int i = 0; i < 4; i++)
+ {
+ if (!Char.IsLetter(TitleArray[i]))
+ {
+ return;
+ }
+ }
+ for (int i = 4; i < 9; i++)
+ {
+ if (!Char.IsNumber(TitleArray[i]))
+ {
+ return;
+ }
+ }
+
+ BuildISO.Enabled = true;
+ }
+
+ }
+ private void GMPath_TextChanged(object sender, EventArgs e)
+ {
+ Check();
+ }
+ private void IconPath_TextChanged(object sender, EventArgs e)
+ {
+ Check();
+ }
+
+ private void PicPath_TextChanged(object sender, EventArgs e)
+ {
+ Check();
+ }
+ private void TitleId_TextChanged(object sender, EventArgs e)
+ {
+ int Cursor = TitleId.SelectionStart;
+ TitleId.Text = TitleId.Text.ToUpper();
+ TitleId.SelectionStart = Cursor;
+
+ Check();
+ }
+
+ private void ChovyUI_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ try
+ {
+ Microsoft.Win32.RegistryKey key;
+ key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\CHOVYProject\Chovy-GM");
+
+ key.SetValue("TITLEID", TitleId.Text);
+ key.SetValue("TITLE", Title.Text);
+ key.SetValue("GMEXE", GMPath.Text);
+ key.SetValue("ICONPATH", IconPath.Text);
+ key.SetValue("PICPATH", PicPath.Text);
+
+
+ key.SetValue("SCE_CTRL_L", LBumper.Text.ToUpper());
+ key.SetValue("SCE_CTRL_R", RBumper.Text.ToUpper());
+ key.SetValue("SCE_CTRL_LEFT", LeftDPAD.Text.ToUpper());
+ key.SetValue("SCE_CTRL_RIGHT", RightDPAD.Text.ToUpper());
+ key.SetValue("SCE_CTRL_UP", UpDPAD.Text.ToUpper());
+ key.SetValue("SCE_CTRL_DOWN", DownDPAD.Text.ToUpper());
+
+ key.SetValue("SCE_CTRL_CIRCLE", CircleButton.Text.ToUpper());
+ key.SetValue("SCE_CTRL_CROSS", CrossButton.Text.ToUpper());
+ key.SetValue("SCE_CTRL_SQUARE", SquareButton.Text.ToUpper());
+ key.SetValue("SCE_CTRL_TRIANGLE", TriangleButton.Text.ToUpper());
+
+ key.SetValue("SCE_CTRL_SELECT", SelectButton.Text.ToUpper());
+ key.SetValue("SCE_CTRL_START", StartButton.Text.ToUpper());
+ key.Close();
+ }
+ catch (Exception)
+ {
+ MessageBox.Show("Failed to save settings to registry.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+}
diff --git a/ChovyUI.resx b/ChovyUI.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ChovyUI.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Flobbster.Windows.Forms/PropertyBag.cs b/Flobbster.Windows.Forms/PropertyBag.cs
new file mode 100644
index 0000000..4599cff
--- /dev/null
+++ b/Flobbster.Windows.Forms/PropertyBag.cs
@@ -0,0 +1,431 @@
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing.Design;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertyBag : ICustomTypeDescriptor
+ {
+ [Serializable]
+ public class PropertySpecCollection : IList, ICollection, IEnumerable
+ {
+ private ArrayList innerArray;
+
+ public int Count
+ {
+ get
+ {
+ return innerArray.Count;
+ }
+ }
+
+ public bool IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public PropertySpec this[int index]
+ {
+ get
+ {
+ return (PropertySpec)innerArray[index];
+ }
+ set
+ {
+ innerArray[index] = value;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ this[index] = (PropertySpec)value;
+ }
+ }
+
+ public PropertySpecCollection()
+ {
+ innerArray = new ArrayList();
+ }
+
+ public int Add(PropertySpec value)
+ {
+ return innerArray.Add(value);
+ }
+
+ public void AddRange(PropertySpec[] array)
+ {
+ innerArray.AddRange(array);
+ }
+
+ public void Clear()
+ {
+ innerArray.Clear();
+ }
+
+ public bool Contains(PropertySpec item)
+ {
+ return innerArray.Contains(item);
+ }
+
+ public bool Contains(string name)
+ {
+ foreach (PropertySpec item in innerArray)
+ {
+ if (item.Name == name)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void CopyTo(PropertySpec[] array)
+ {
+ innerArray.CopyTo(array);
+ }
+
+ public void CopyTo(PropertySpec[] array, int index)
+ {
+ innerArray.CopyTo(array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return innerArray.GetEnumerator();
+ }
+
+ public int IndexOf(PropertySpec value)
+ {
+ return innerArray.IndexOf(value);
+ }
+
+ public int IndexOf(string name)
+ {
+ int num = 0;
+ foreach (PropertySpec item in innerArray)
+ {
+ if (item.Name == name)
+ {
+ return num;
+ }
+ num++;
+ }
+ return -1;
+ }
+
+ public void Insert(int index, PropertySpec value)
+ {
+ innerArray.Insert(index, value);
+ }
+
+ public void Remove(PropertySpec obj)
+ {
+ innerArray.Remove(obj);
+ }
+
+ public void Remove(string name)
+ {
+ int index = IndexOf(name);
+ RemoveAt(index);
+ }
+
+ public void RemoveAt(int index)
+ {
+ innerArray.RemoveAt(index);
+ }
+
+ public PropertySpec[] ToArray()
+ {
+ return (PropertySpec[])innerArray.ToArray(typeof(PropertySpec));
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ CopyTo((PropertySpec[])array, index);
+ }
+
+ int IList.Add(object value)
+ {
+ return Add((PropertySpec)value);
+ }
+
+ bool IList.Contains(object obj)
+ {
+ return Contains((PropertySpec)obj);
+ }
+
+ int IList.IndexOf(object obj)
+ {
+ return IndexOf((PropertySpec)obj);
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ Insert(index, (PropertySpec)value);
+ }
+
+ void IList.Remove(object value)
+ {
+ Remove((PropertySpec)value);
+ }
+ }
+
+ private class PropertySpecDescriptor : PropertyDescriptor
+ {
+ private PropertyBag bag;
+
+ private PropertySpec item;
+
+ public override Type ComponentType
+ {
+ get
+ {
+ return item.GetType();
+ }
+ }
+
+ public override bool IsReadOnly
+ {
+ get
+ {
+ return Attributes.Matches(ReadOnlyAttribute.Yes);
+ }
+ }
+
+ public override Type PropertyType
+ {
+ get
+ {
+ return Type.GetType(item.TypeName);
+ }
+ }
+
+ public PropertySpecDescriptor(PropertySpec item, PropertyBag bag, string name, Attribute[] attrs)
+ : base(name, attrs)
+ {
+ this.bag = bag;
+ this.item = item;
+ }
+
+ public override bool CanResetValue(object component)
+ {
+ if (item.DefaultValue == null)
+ {
+ return false;
+ }
+ return !GetValue(component).Equals(item.DefaultValue);
+ }
+
+ public override object GetValue(object component)
+ {
+ PropertySpecEventArgs propertySpecEventArgs = new PropertySpecEventArgs(item, null);
+ bag.OnGetValue(propertySpecEventArgs);
+ return propertySpecEventArgs.Value;
+ }
+
+ public override void ResetValue(object component)
+ {
+ SetValue(component, item.DefaultValue);
+ }
+
+ public override void SetValue(object component, object value)
+ {
+ PropertySpecEventArgs e = new PropertySpecEventArgs(item, value);
+ bag.OnSetValue(e);
+ }
+
+ public override bool ShouldSerializeValue(object component)
+ {
+ object value = GetValue(component);
+ if (item.DefaultValue == null && value == null)
+ {
+ return false;
+ }
+ return !value.Equals(item.DefaultValue);
+ }
+ }
+
+ private string defaultProperty;
+
+ private PropertySpecCollection properties;
+
+ public string DefaultProperty
+ {
+ get
+ {
+ return defaultProperty;
+ }
+ set
+ {
+ defaultProperty = value;
+ }
+ }
+
+ public PropertySpecCollection Properties
+ {
+ get
+ {
+ return properties;
+ }
+ }
+
+ public event PropertySpecEventHandler GetValue;
+
+ public event PropertySpecEventHandler SetValue;
+
+ public PropertyBag()
+ {
+ defaultProperty = null;
+ properties = new PropertySpecCollection();
+ }
+
+ protected virtual void OnGetValue(PropertySpecEventArgs e)
+ {
+ if (this.GetValue != null)
+ {
+ this.GetValue(this, e);
+ }
+ }
+
+ protected virtual void OnSetValue(PropertySpecEventArgs e)
+ {
+ if (this.SetValue != null)
+ {
+ this.SetValue(this, e);
+ }
+ }
+
+ AttributeCollection ICustomTypeDescriptor.GetAttributes()
+ {
+ return TypeDescriptor.GetAttributes(this, true);
+ }
+
+ string ICustomTypeDescriptor.GetClassName()
+ {
+ return TypeDescriptor.GetClassName(this, true);
+ }
+
+ string ICustomTypeDescriptor.GetComponentName()
+ {
+ return TypeDescriptor.GetComponentName(this, true);
+ }
+
+ TypeConverter ICustomTypeDescriptor.GetConverter()
+ {
+ return TypeDescriptor.GetConverter(this, true);
+ }
+
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent()
+ {
+ return TypeDescriptor.GetDefaultEvent(this, true);
+ }
+
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
+ {
+ PropertySpec propertySpec = null;
+ if (defaultProperty != null)
+ {
+ int index = properties.IndexOf(defaultProperty);
+ propertySpec = properties[index];
+ }
+ if (propertySpec != null)
+ {
+ return new PropertySpecDescriptor(propertySpec, this, propertySpec.Name, null);
+ }
+ return null;
+ }
+
+ object ICustomTypeDescriptor.GetEditor(Type editorBaseType)
+ {
+ return TypeDescriptor.GetEditor(this, editorBaseType, true);
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
+ {
+ return TypeDescriptor.GetEvents(this, true);
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes)
+ {
+ return TypeDescriptor.GetEvents(this, attributes, true);
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
+ {
+ return ((ICustomTypeDescriptor)this).GetProperties(new Attribute[0]);
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
+ {
+ ArrayList arrayList = new ArrayList();
+ foreach (PropertySpec property in properties)
+ {
+ ArrayList arrayList2 = new ArrayList();
+ if (property.Category != null)
+ {
+ arrayList2.Add(new CategoryAttribute(property.Category));
+ }
+ if (property.Description != null)
+ {
+ arrayList2.Add(new DescriptionAttribute(property.Description));
+ }
+ if (property.EditorTypeName != null)
+ {
+ arrayList2.Add(new EditorAttribute(property.EditorTypeName, typeof(UITypeEditor)));
+ }
+ if (property.ConverterTypeName != null)
+ {
+ arrayList2.Add(new TypeConverterAttribute(property.ConverterTypeName));
+ }
+ if (property.Attributes != null)
+ {
+ arrayList2.AddRange(property.Attributes);
+ }
+ Attribute[] attrs = (Attribute[])arrayList2.ToArray(typeof(Attribute));
+ PropertySpecDescriptor value = new PropertySpecDescriptor(property, this, property.Name, attrs);
+ arrayList.Add(value);
+ }
+ PropertyDescriptor[] array = (PropertyDescriptor[])arrayList.ToArray(typeof(PropertyDescriptor));
+ return new PropertyDescriptorCollection(array);
+ }
+
+ object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd)
+ {
+ return this;
+ }
+ }
+}
diff --git a/Flobbster.Windows.Forms/PropertySpec.cs b/Flobbster.Windows.Forms/PropertySpec.cs
new file mode 100644
index 0000000..25fda8e
--- /dev/null
+++ b/Flobbster.Windows.Forms/PropertySpec.cs
@@ -0,0 +1,206 @@
+using System;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertySpec
+ {
+ private Attribute[] attributes;
+
+ private string category;
+
+ private object defaultValue;
+
+ private string description;
+
+ private string editor;
+
+ private string name;
+
+ private string type;
+
+ private string typeConverter;
+
+ public Attribute[] Attributes
+ {
+ get
+ {
+ return attributes;
+ }
+ set
+ {
+ attributes = value;
+ }
+ }
+
+ public string Category
+ {
+ get
+ {
+ return category;
+ }
+ set
+ {
+ category = value;
+ }
+ }
+
+ public string ConverterTypeName
+ {
+ get
+ {
+ return typeConverter;
+ }
+ set
+ {
+ typeConverter = value;
+ }
+ }
+
+ public object DefaultValue
+ {
+ get
+ {
+ return defaultValue;
+ }
+ set
+ {
+ defaultValue = value;
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return description;
+ }
+ set
+ {
+ description = value;
+ }
+ }
+
+ public string EditorTypeName
+ {
+ get
+ {
+ return editor;
+ }
+ set
+ {
+ editor = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string TypeName
+ {
+ get
+ {
+ return type;
+ }
+ set
+ {
+ type = value;
+ }
+ }
+
+ public PropertySpec(string name, string type)
+ : this(name, type, null, null, null)
+ {
+ }
+
+ public PropertySpec(string name, Type type)
+ : this(name, type.AssemblyQualifiedName, null, null, null)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category)
+ : this(name, type, category, null, null)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category)
+ : this(name, type.AssemblyQualifiedName, category, null, null)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description)
+ : this(name, type, category, description, null)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description)
+ : this(name, type.AssemblyQualifiedName, category, description, null)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue)
+ {
+ this.name = name;
+ this.type = type;
+ this.category = category;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ attributes = null;
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, string editor, string typeConverter)
+ : this(name, type, category, description, defaultValue)
+ {
+ this.editor = editor;
+ this.typeConverter = typeConverter;
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, string editor, string typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor, typeConverter)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, Type editor, string typeConverter)
+ : this(name, type, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, Type editor, string typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, string editor, Type typeConverter)
+ : this(name, type, category, description, defaultValue, editor, typeConverter.AssemblyQualifiedName)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, string editor, Type typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor, typeConverter.AssemblyQualifiedName)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, Type editor, Type typeConverter)
+ : this(name, type, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter.AssemblyQualifiedName)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, Type editor, Type typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter.AssemblyQualifiedName)
+ {
+ }
+ }
+}
diff --git a/Flobbster.Windows.Forms/PropertySpecEventArgs.cs b/Flobbster.Windows.Forms/PropertySpecEventArgs.cs
new file mode 100644
index 0000000..17388a3
--- /dev/null
+++ b/Flobbster.Windows.Forms/PropertySpecEventArgs.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertySpecEventArgs : EventArgs
+ {
+ private PropertySpec property;
+
+ private object val;
+
+ public PropertySpec Property
+ {
+ get
+ {
+ return property;
+ }
+ }
+
+ public object Value
+ {
+ get
+ {
+ return val;
+ }
+ set
+ {
+ val = value;
+ }
+ }
+
+ public PropertySpecEventArgs(PropertySpec property, object val)
+ {
+ this.property = property;
+ this.val = val;
+ }
+ }
+}
diff --git a/Flobbster.Windows.Forms/PropertySpecEventHandler.cs b/Flobbster.Windows.Forms/PropertySpecEventHandler.cs
new file mode 100644
index 0000000..05cf432
--- /dev/null
+++ b/Flobbster.Windows.Forms/PropertySpecEventHandler.cs
@@ -0,0 +1,4 @@
+namespace Flobbster.Windows.Forms
+{
+ public delegate void PropertySpecEventHandler(object sender, PropertySpecEventArgs e);
+}
diff --git a/Flobbster.Windows.Forms/PropertyTable.cs b/Flobbster.Windows.Forms/PropertyTable.cs
new file mode 100644
index 0000000..becfa19
--- /dev/null
+++ b/Flobbster.Windows.Forms/PropertyTable.cs
@@ -0,0 +1,38 @@
+using System.Collections;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertyTable : PropertyBag
+ {
+ private Hashtable propValues;
+
+ public object this[string key]
+ {
+ get
+ {
+ return propValues[key];
+ }
+ set
+ {
+ propValues[key] = value;
+ }
+ }
+
+ public PropertyTable()
+ {
+ propValues = new Hashtable();
+ }
+
+ protected override void OnGetValue(PropertySpecEventArgs e)
+ {
+ e.Value = propValues[e.Property.Name];
+ base.OnGetValue(e);
+ }
+
+ protected override void OnSetValue(PropertySpecEventArgs e)
+ {
+ propValues[e.Property.Name] = e.Value;
+ base.OnSetValue(e);
+ }
+ }
+}
diff --git a/GMAC1098/.vs/GMAssetCompiler/v15/.suo b/GMAC1098/.vs/GMAssetCompiler/v15/.suo
new file mode 100644
index 0000000..9016c57
Binary files /dev/null and b/GMAC1098/.vs/GMAssetCompiler/v15/.suo differ
diff --git a/GMAC1098/Flobbster.Windows.Forms/PropertyBag.cs b/GMAC1098/Flobbster.Windows.Forms/PropertyBag.cs
new file mode 100644
index 0000000..4599cff
--- /dev/null
+++ b/GMAC1098/Flobbster.Windows.Forms/PropertyBag.cs
@@ -0,0 +1,431 @@
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing.Design;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertyBag : ICustomTypeDescriptor
+ {
+ [Serializable]
+ public class PropertySpecCollection : IList, ICollection, IEnumerable
+ {
+ private ArrayList innerArray;
+
+ public int Count
+ {
+ get
+ {
+ return innerArray.Count;
+ }
+ }
+
+ public bool IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public PropertySpec this[int index]
+ {
+ get
+ {
+ return (PropertySpec)innerArray[index];
+ }
+ set
+ {
+ innerArray[index] = value;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ this[index] = (PropertySpec)value;
+ }
+ }
+
+ public PropertySpecCollection()
+ {
+ innerArray = new ArrayList();
+ }
+
+ public int Add(PropertySpec value)
+ {
+ return innerArray.Add(value);
+ }
+
+ public void AddRange(PropertySpec[] array)
+ {
+ innerArray.AddRange(array);
+ }
+
+ public void Clear()
+ {
+ innerArray.Clear();
+ }
+
+ public bool Contains(PropertySpec item)
+ {
+ return innerArray.Contains(item);
+ }
+
+ public bool Contains(string name)
+ {
+ foreach (PropertySpec item in innerArray)
+ {
+ if (item.Name == name)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void CopyTo(PropertySpec[] array)
+ {
+ innerArray.CopyTo(array);
+ }
+
+ public void CopyTo(PropertySpec[] array, int index)
+ {
+ innerArray.CopyTo(array, index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return innerArray.GetEnumerator();
+ }
+
+ public int IndexOf(PropertySpec value)
+ {
+ return innerArray.IndexOf(value);
+ }
+
+ public int IndexOf(string name)
+ {
+ int num = 0;
+ foreach (PropertySpec item in innerArray)
+ {
+ if (item.Name == name)
+ {
+ return num;
+ }
+ num++;
+ }
+ return -1;
+ }
+
+ public void Insert(int index, PropertySpec value)
+ {
+ innerArray.Insert(index, value);
+ }
+
+ public void Remove(PropertySpec obj)
+ {
+ innerArray.Remove(obj);
+ }
+
+ public void Remove(string name)
+ {
+ int index = IndexOf(name);
+ RemoveAt(index);
+ }
+
+ public void RemoveAt(int index)
+ {
+ innerArray.RemoveAt(index);
+ }
+
+ public PropertySpec[] ToArray()
+ {
+ return (PropertySpec[])innerArray.ToArray(typeof(PropertySpec));
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ CopyTo((PropertySpec[])array, index);
+ }
+
+ int IList.Add(object value)
+ {
+ return Add((PropertySpec)value);
+ }
+
+ bool IList.Contains(object obj)
+ {
+ return Contains((PropertySpec)obj);
+ }
+
+ int IList.IndexOf(object obj)
+ {
+ return IndexOf((PropertySpec)obj);
+ }
+
+ void IList.Insert(int index, object value)
+ {
+ Insert(index, (PropertySpec)value);
+ }
+
+ void IList.Remove(object value)
+ {
+ Remove((PropertySpec)value);
+ }
+ }
+
+ private class PropertySpecDescriptor : PropertyDescriptor
+ {
+ private PropertyBag bag;
+
+ private PropertySpec item;
+
+ public override Type ComponentType
+ {
+ get
+ {
+ return item.GetType();
+ }
+ }
+
+ public override bool IsReadOnly
+ {
+ get
+ {
+ return Attributes.Matches(ReadOnlyAttribute.Yes);
+ }
+ }
+
+ public override Type PropertyType
+ {
+ get
+ {
+ return Type.GetType(item.TypeName);
+ }
+ }
+
+ public PropertySpecDescriptor(PropertySpec item, PropertyBag bag, string name, Attribute[] attrs)
+ : base(name, attrs)
+ {
+ this.bag = bag;
+ this.item = item;
+ }
+
+ public override bool CanResetValue(object component)
+ {
+ if (item.DefaultValue == null)
+ {
+ return false;
+ }
+ return !GetValue(component).Equals(item.DefaultValue);
+ }
+
+ public override object GetValue(object component)
+ {
+ PropertySpecEventArgs propertySpecEventArgs = new PropertySpecEventArgs(item, null);
+ bag.OnGetValue(propertySpecEventArgs);
+ return propertySpecEventArgs.Value;
+ }
+
+ public override void ResetValue(object component)
+ {
+ SetValue(component, item.DefaultValue);
+ }
+
+ public override void SetValue(object component, object value)
+ {
+ PropertySpecEventArgs e = new PropertySpecEventArgs(item, value);
+ bag.OnSetValue(e);
+ }
+
+ public override bool ShouldSerializeValue(object component)
+ {
+ object value = GetValue(component);
+ if (item.DefaultValue == null && value == null)
+ {
+ return false;
+ }
+ return !value.Equals(item.DefaultValue);
+ }
+ }
+
+ private string defaultProperty;
+
+ private PropertySpecCollection properties;
+
+ public string DefaultProperty
+ {
+ get
+ {
+ return defaultProperty;
+ }
+ set
+ {
+ defaultProperty = value;
+ }
+ }
+
+ public PropertySpecCollection Properties
+ {
+ get
+ {
+ return properties;
+ }
+ }
+
+ public event PropertySpecEventHandler GetValue;
+
+ public event PropertySpecEventHandler SetValue;
+
+ public PropertyBag()
+ {
+ defaultProperty = null;
+ properties = new PropertySpecCollection();
+ }
+
+ protected virtual void OnGetValue(PropertySpecEventArgs e)
+ {
+ if (this.GetValue != null)
+ {
+ this.GetValue(this, e);
+ }
+ }
+
+ protected virtual void OnSetValue(PropertySpecEventArgs e)
+ {
+ if (this.SetValue != null)
+ {
+ this.SetValue(this, e);
+ }
+ }
+
+ AttributeCollection ICustomTypeDescriptor.GetAttributes()
+ {
+ return TypeDescriptor.GetAttributes(this, true);
+ }
+
+ string ICustomTypeDescriptor.GetClassName()
+ {
+ return TypeDescriptor.GetClassName(this, true);
+ }
+
+ string ICustomTypeDescriptor.GetComponentName()
+ {
+ return TypeDescriptor.GetComponentName(this, true);
+ }
+
+ TypeConverter ICustomTypeDescriptor.GetConverter()
+ {
+ return TypeDescriptor.GetConverter(this, true);
+ }
+
+ EventDescriptor ICustomTypeDescriptor.GetDefaultEvent()
+ {
+ return TypeDescriptor.GetDefaultEvent(this, true);
+ }
+
+ PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
+ {
+ PropertySpec propertySpec = null;
+ if (defaultProperty != null)
+ {
+ int index = properties.IndexOf(defaultProperty);
+ propertySpec = properties[index];
+ }
+ if (propertySpec != null)
+ {
+ return new PropertySpecDescriptor(propertySpec, this, propertySpec.Name, null);
+ }
+ return null;
+ }
+
+ object ICustomTypeDescriptor.GetEditor(Type editorBaseType)
+ {
+ return TypeDescriptor.GetEditor(this, editorBaseType, true);
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
+ {
+ return TypeDescriptor.GetEvents(this, true);
+ }
+
+ EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes)
+ {
+ return TypeDescriptor.GetEvents(this, attributes, true);
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
+ {
+ return ((ICustomTypeDescriptor)this).GetProperties(new Attribute[0]);
+ }
+
+ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
+ {
+ ArrayList arrayList = new ArrayList();
+ foreach (PropertySpec property in properties)
+ {
+ ArrayList arrayList2 = new ArrayList();
+ if (property.Category != null)
+ {
+ arrayList2.Add(new CategoryAttribute(property.Category));
+ }
+ if (property.Description != null)
+ {
+ arrayList2.Add(new DescriptionAttribute(property.Description));
+ }
+ if (property.EditorTypeName != null)
+ {
+ arrayList2.Add(new EditorAttribute(property.EditorTypeName, typeof(UITypeEditor)));
+ }
+ if (property.ConverterTypeName != null)
+ {
+ arrayList2.Add(new TypeConverterAttribute(property.ConverterTypeName));
+ }
+ if (property.Attributes != null)
+ {
+ arrayList2.AddRange(property.Attributes);
+ }
+ Attribute[] attrs = (Attribute[])arrayList2.ToArray(typeof(Attribute));
+ PropertySpecDescriptor value = new PropertySpecDescriptor(property, this, property.Name, attrs);
+ arrayList.Add(value);
+ }
+ PropertyDescriptor[] array = (PropertyDescriptor[])arrayList.ToArray(typeof(PropertyDescriptor));
+ return new PropertyDescriptorCollection(array);
+ }
+
+ object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd)
+ {
+ return this;
+ }
+ }
+}
diff --git a/GMAC1098/Flobbster.Windows.Forms/PropertySpec.cs b/GMAC1098/Flobbster.Windows.Forms/PropertySpec.cs
new file mode 100644
index 0000000..25fda8e
--- /dev/null
+++ b/GMAC1098/Flobbster.Windows.Forms/PropertySpec.cs
@@ -0,0 +1,206 @@
+using System;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertySpec
+ {
+ private Attribute[] attributes;
+
+ private string category;
+
+ private object defaultValue;
+
+ private string description;
+
+ private string editor;
+
+ private string name;
+
+ private string type;
+
+ private string typeConverter;
+
+ public Attribute[] Attributes
+ {
+ get
+ {
+ return attributes;
+ }
+ set
+ {
+ attributes = value;
+ }
+ }
+
+ public string Category
+ {
+ get
+ {
+ return category;
+ }
+ set
+ {
+ category = value;
+ }
+ }
+
+ public string ConverterTypeName
+ {
+ get
+ {
+ return typeConverter;
+ }
+ set
+ {
+ typeConverter = value;
+ }
+ }
+
+ public object DefaultValue
+ {
+ get
+ {
+ return defaultValue;
+ }
+ set
+ {
+ defaultValue = value;
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return description;
+ }
+ set
+ {
+ description = value;
+ }
+ }
+
+ public string EditorTypeName
+ {
+ get
+ {
+ return editor;
+ }
+ set
+ {
+ editor = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return name;
+ }
+ set
+ {
+ name = value;
+ }
+ }
+
+ public string TypeName
+ {
+ get
+ {
+ return type;
+ }
+ set
+ {
+ type = value;
+ }
+ }
+
+ public PropertySpec(string name, string type)
+ : this(name, type, null, null, null)
+ {
+ }
+
+ public PropertySpec(string name, Type type)
+ : this(name, type.AssemblyQualifiedName, null, null, null)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category)
+ : this(name, type, category, null, null)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category)
+ : this(name, type.AssemblyQualifiedName, category, null, null)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description)
+ : this(name, type, category, description, null)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description)
+ : this(name, type.AssemblyQualifiedName, category, description, null)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue)
+ {
+ this.name = name;
+ this.type = type;
+ this.category = category;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ attributes = null;
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, string editor, string typeConverter)
+ : this(name, type, category, description, defaultValue)
+ {
+ this.editor = editor;
+ this.typeConverter = typeConverter;
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, string editor, string typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor, typeConverter)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, Type editor, string typeConverter)
+ : this(name, type, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, Type editor, string typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, string editor, Type typeConverter)
+ : this(name, type, category, description, defaultValue, editor, typeConverter.AssemblyQualifiedName)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, string editor, Type typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor, typeConverter.AssemblyQualifiedName)
+ {
+ }
+
+ public PropertySpec(string name, string type, string category, string description, object defaultValue, Type editor, Type typeConverter)
+ : this(name, type, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter.AssemblyQualifiedName)
+ {
+ }
+
+ public PropertySpec(string name, Type type, string category, string description, object defaultValue, Type editor, Type typeConverter)
+ : this(name, type.AssemblyQualifiedName, category, description, defaultValue, editor.AssemblyQualifiedName, typeConverter.AssemblyQualifiedName)
+ {
+ }
+ }
+}
diff --git a/GMAC1098/Flobbster.Windows.Forms/PropertySpecEventArgs.cs b/GMAC1098/Flobbster.Windows.Forms/PropertySpecEventArgs.cs
new file mode 100644
index 0000000..17388a3
--- /dev/null
+++ b/GMAC1098/Flobbster.Windows.Forms/PropertySpecEventArgs.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertySpecEventArgs : EventArgs
+ {
+ private PropertySpec property;
+
+ private object val;
+
+ public PropertySpec Property
+ {
+ get
+ {
+ return property;
+ }
+ }
+
+ public object Value
+ {
+ get
+ {
+ return val;
+ }
+ set
+ {
+ val = value;
+ }
+ }
+
+ public PropertySpecEventArgs(PropertySpec property, object val)
+ {
+ this.property = property;
+ this.val = val;
+ }
+ }
+}
diff --git a/GMAC1098/Flobbster.Windows.Forms/PropertySpecEventHandler.cs b/GMAC1098/Flobbster.Windows.Forms/PropertySpecEventHandler.cs
new file mode 100644
index 0000000..05cf432
--- /dev/null
+++ b/GMAC1098/Flobbster.Windows.Forms/PropertySpecEventHandler.cs
@@ -0,0 +1,4 @@
+namespace Flobbster.Windows.Forms
+{
+ public delegate void PropertySpecEventHandler(object sender, PropertySpecEventArgs e);
+}
diff --git a/GMAC1098/Flobbster.Windows.Forms/PropertyTable.cs b/GMAC1098/Flobbster.Windows.Forms/PropertyTable.cs
new file mode 100644
index 0000000..becfa19
--- /dev/null
+++ b/GMAC1098/Flobbster.Windows.Forms/PropertyTable.cs
@@ -0,0 +1,38 @@
+using System.Collections;
+
+namespace Flobbster.Windows.Forms
+{
+ public class PropertyTable : PropertyBag
+ {
+ private Hashtable propValues;
+
+ public object this[string key]
+ {
+ get
+ {
+ return propValues[key];
+ }
+ set
+ {
+ propValues[key] = value;
+ }
+ }
+
+ public PropertyTable()
+ {
+ propValues = new Hashtable();
+ }
+
+ protected override void OnGetValue(PropertySpecEventArgs e)
+ {
+ e.Value = propValues[e.Property.Name];
+ base.OnGetValue(e);
+ }
+
+ protected override void OnSetValue(PropertySpecEventArgs e)
+ {
+ propValues[e.Property.Name] = e.Value;
+ base.OnSetValue(e);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Machines/Android.cs b/GMAC1098/GMAssetCompiler.Machines/Android.cs
new file mode 100644
index 0000000..0a3ee26
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Machines/Android.cs
@@ -0,0 +1,111 @@
+namespace GMAssetCompiler.Machines
+{
+ internal class Android : IMachineType
+ {
+ public string Name
+ {
+ get
+ {
+ return "Android";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "Android";
+ }
+ }
+
+ public eOutputType OutputType
+ {
+ get
+ {
+ return eOutputType.eWAD;
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return ".droid";
+ }
+ }
+
+ public int TPageWidth
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageHeight
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageBorderTop
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderBottom
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderLeft
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderRight
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public eTexType OpaqueTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public eTexType AlphaTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public ushort Convert4444(int _a, int _r, int _g, int _b)
+ {
+ return (ushort)(((_a & 0xF0) >> 4) | (_r & 0xF0) | ((_g & 0xF0) << 4) | ((_b & 0xF0) << 8));
+ }
+
+ public uint Convert8888(int _a, int _r, int _g, int _b)
+ {
+ return (uint)((_a << 24) | (_r << 16) | (_g << 8) | _b);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Machines/HTML5.cs b/GMAC1098/GMAssetCompiler.Machines/HTML5.cs
new file mode 100644
index 0000000..86dec65
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Machines/HTML5.cs
@@ -0,0 +1,111 @@
+namespace GMAssetCompiler.Machines
+{
+ internal class HTML5 : IMachineType
+ {
+ public string Name
+ {
+ get
+ {
+ return "HTML5";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "HTML5 - web target";
+ }
+ }
+
+ public eOutputType OutputType
+ {
+ get
+ {
+ return eOutputType.eHTML5;
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return ".js";
+ }
+ }
+
+ public int TPageWidth
+ {
+ get
+ {
+ return 2048;
+ }
+ }
+
+ public int TPageHeight
+ {
+ get
+ {
+ return 2048;
+ }
+ }
+
+ public int TPageBorderTop
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderBottom
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderLeft
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderRight
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public eTexType OpaqueTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public eTexType AlphaTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public ushort Convert4444(int _a, int _r, int _g, int _b)
+ {
+ return (ushort)(((_a & 0xF0) << 8) | ((_r & 0xF0) << 4) | (_g & 0xF0) | ((_b & 0xF0) >> 4));
+ }
+
+ public uint Convert8888(int _a, int _r, int _g, int _b)
+ {
+ return (uint)((_a << 24) | (_r << 16) | (_g << 8) | _b);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Machines/IOS.cs b/GMAC1098/GMAssetCompiler.Machines/IOS.cs
new file mode 100644
index 0000000..77a2bac
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Machines/IOS.cs
@@ -0,0 +1,111 @@
+namespace GMAssetCompiler.Machines
+{
+ internal class IOS : IMachineType
+ {
+ public string Name
+ {
+ get
+ {
+ return "iOS";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "iPod Touch, iPhone, iPad";
+ }
+ }
+
+ public eOutputType OutputType
+ {
+ get
+ {
+ return eOutputType.eWAD;
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return ".ios";
+ }
+ }
+
+ public int TPageWidth
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageHeight
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageBorderTop
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderBottom
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderLeft
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderRight
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public eTexType OpaqueTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public eTexType AlphaTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public ushort Convert4444(int _a, int _r, int _g, int _b)
+ {
+ return (ushort)(((_a & 0xF0) >> 4) | (_r & 0xF0) | ((_g & 0xF0) << 4) | ((_b & 0xF0) << 8));
+ }
+
+ public uint Convert8888(int _a, int _r, int _g, int _b)
+ {
+ return (uint)((_a << 24) | (_r << 16) | (_g << 8) | _b);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Machines/PSP.cs b/GMAC1098/GMAssetCompiler.Machines/PSP.cs
new file mode 100644
index 0000000..24d249c
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Machines/PSP.cs
@@ -0,0 +1,111 @@
+namespace GMAssetCompiler.Machines
+{
+ internal class PSP : IMachineType
+ {
+ public string Name
+ {
+ get
+ {
+ return "PSP";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "Sony PSP Minis";
+ }
+ }
+
+ public eOutputType OutputType
+ {
+ get
+ {
+ return eOutputType.eWAD;
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return ".psp";
+ }
+ }
+
+ public int TPageWidth
+ {
+ get
+ {
+ return 512;
+ }
+ }
+
+ public int TPageHeight
+ {
+ get
+ {
+ return 512;
+ }
+ }
+
+ public int TPageBorderTop
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderBottom
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderLeft
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderRight
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public eTexType OpaqueTextureType
+ {
+ get
+ {
+ return eTexType.eDXT;
+ }
+ }
+
+ public eTexType AlphaTextureType
+ {
+ get
+ {
+ return eTexType.eDXT;
+ }
+ }
+
+ public ushort Convert4444(int _a, int _r, int _g, int _b)
+ {
+ return (ushort)(((_a & 0xF0) << 8) | ((_r & 0xF0) << 4) | (_g & 0xF0) | ((_b & 0xF0) >> 4));
+ }
+
+ public uint Convert8888(int _a, int _r, int _g, int _b)
+ {
+ return (uint)((_a << 24) | (_r << 16) | (_g << 8) | _b);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Machines/Symbian.cs b/GMAC1098/GMAssetCompiler.Machines/Symbian.cs
new file mode 100644
index 0000000..c4c2592
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Machines/Symbian.cs
@@ -0,0 +1,111 @@
+namespace GMAssetCompiler.Machines
+{
+ internal class Symbian : IMachineType
+ {
+ public string Name
+ {
+ get
+ {
+ return "Symbian";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "Symbian";
+ }
+ }
+
+ public eOutputType OutputType
+ {
+ get
+ {
+ return eOutputType.eWAD;
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return ".symbian";
+ }
+ }
+
+ public int TPageWidth
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageHeight
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageBorderTop
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderBottom
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderLeft
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderRight
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public eTexType OpaqueTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public eTexType AlphaTextureType
+ {
+ get
+ {
+ return eTexType.ePNG;
+ }
+ }
+
+ public ushort Convert4444(int _a, int _r, int _g, int _b)
+ {
+ return (ushort)(((_a & 0xF0) >> 4) | (_r & 0xF0) | ((_g & 0xF0) << 4) | ((_b & 0xF0) << 8));
+ }
+
+ public uint Convert8888(int _a, int _r, int _g, int _b)
+ {
+ return (uint)((_a << 24) | (_r << 16) | (_g << 8) | _b);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Machines/Windows.cs b/GMAC1098/GMAssetCompiler.Machines/Windows.cs
new file mode 100644
index 0000000..7058e91
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Machines/Windows.cs
@@ -0,0 +1,111 @@
+namespace GMAssetCompiler.Machines
+{
+ internal class Windows : IMachineType
+ {
+ public string Name
+ {
+ get
+ {
+ return "Windows";
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return "Windows OS platform, targeting Direct X";
+ }
+ }
+
+ public eOutputType OutputType
+ {
+ get
+ {
+ return eOutputType.eWAD;
+ }
+ }
+
+ public string Extension
+ {
+ get
+ {
+ return ".win";
+ }
+ }
+
+ public int TPageWidth
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageHeight
+ {
+ get
+ {
+ return 1024;
+ }
+ }
+
+ public int TPageBorderTop
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderBottom
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderLeft
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public int TPageBorderRight
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ public eTexType OpaqueTextureType
+ {
+ get
+ {
+ return eTexType.eDXT;
+ }
+ }
+
+ public eTexType AlphaTextureType
+ {
+ get
+ {
+ return eTexType.eDXT;
+ }
+ }
+
+ public ushort Convert4444(int _a, int _r, int _g, int _b)
+ {
+ return (ushort)(((_a & 0xF0) << 8) | ((_r & 0xF0) << 4) | (_g & 0xF0) | ((_b & 0xF0) >> 4));
+ }
+
+ public uint Convert8888(int _a, int _r, int _g, int _b)
+ {
+ return (uint)((_a << 24) | (_r << 16) | (_g << 8) | _b);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Output/TextureOptionAttribute.cs b/GMAC1098/GMAssetCompiler.Output/TextureOptionAttribute.cs
new file mode 100644
index 0000000..3d1ec39
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Output/TextureOptionAttribute.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace GMAssetCompiler.Output
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal class TextureOptionAttribute : Attribute
+ {
+ public string Description = string.Empty;
+
+ public TextureOptionAttribute(string _description)
+ {
+ Description = _description;
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Output/TextureOptions.cs b/GMAC1098/GMAssetCompiler.Output/TextureOptions.cs
new file mode 100644
index 0000000..2fe8769
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Output/TextureOptions.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace GMAssetCompiler.Output
+{
+ internal class TextureOptions
+ {
+ private static Dictionary> TextureResourcesOptions
+ {
+ get;
+ set;
+ }
+
+ public static string ValidTextureOptions()
+ {
+ string text = "";
+ MemberInfo[] members = typeof(TexturePageEntry).GetMembers();
+ MemberInfo[] array = members;
+ foreach (MemberInfo memberInfo in array)
+ {
+ object[] customAttributes = memberInfo.GetCustomAttributes(typeof(TextureOptionAttribute), true);
+ object[] array2 = customAttributes;
+ foreach (object obj in array2)
+ {
+ TextureOptionAttribute textureOptionAttribute = obj as TextureOptionAttribute;
+ text = text + memberInfo.Name + ": " + textureOptionAttribute.Description + "\n";
+ }
+ }
+ return text;
+ }
+
+ private static void PopulateResourceOptions()
+ {
+ if (TextureResourcesOptions != null)
+ {
+ return;
+ }
+ TextureResourcesOptions = new Dictionary>();
+ MemberInfo[] members = typeof(TexturePageEntry).GetMembers();
+ MemberInfo[] array = members;
+ foreach (MemberInfo memberInfo in array)
+ {
+ object[] customAttributes = memberInfo.GetCustomAttributes(typeof(TextureOptionAttribute), true);
+ object[] array2 = customAttributes;
+ for (int j = 0; j < array2.Length; j++)
+ {
+ object obj = array2[j];
+ TextureResourcesOptions.Add(memberInfo.Name, new List());
+ }
+ }
+ }
+
+ public static void AddResourceOptions(string _optionName, List _resources)
+ {
+ PopulateResourceOptions();
+ if (TextureResourcesOptions.ContainsKey(_optionName))
+ {
+ TextureResourcesOptions[_optionName].AddRange(_resources);
+ }
+ }
+
+ public static void SetTextureOptions(string _GMResourceName, TexturePageEntry _tpageEntry)
+ {
+ if (TextureResourcesOptions != null)
+ {
+ Type type = _tpageEntry.GetType();
+ foreach (KeyValuePair> textureResourcesOption in TextureResourcesOptions)
+ {
+ if (textureResourcesOption.Value.Contains(_GMResourceName))
+ {
+ type.GetProperty(textureResourcesOption.Key).SetValue(_tpageEntry, true, null);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Properties/Resources.cs b/GMAC1098/GMAssetCompiler.Properties/Resources.cs
new file mode 100644
index 0000000..8db3597
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Properties/Resources.cs
@@ -0,0 +1,49 @@
+using System.CodeDom.Compiler;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Resources;
+using System.Runtime.CompilerServices;
+
+namespace GMAssetCompiler.Properties
+{
+ [DebuggerNonUserCode]
+ [CompilerGenerated]
+ [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ internal class Resources
+ {
+ private static ResourceManager resourceMan;
+
+ private static CultureInfo resourceCulture;
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ internal static ResourceManager ResourceManager
+ {
+ get
+ {
+ if (resourceMan == null)
+ {
+ ResourceManager resourceManager = resourceMan = new ResourceManager("GMAssetCompiler.Properties.Resources", typeof(Resources).Assembly);
+ }
+ return resourceMan;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ internal static CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+
+ internal Resources()
+ {
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.Properties/Settings.cs b/GMAC1098/GMAssetCompiler.Properties/Settings.cs
new file mode 100644
index 0000000..bd38780
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.Properties/Settings.cs
@@ -0,0 +1,21 @@
+using System.CodeDom.Compiler;
+using System.Configuration;
+using System.Runtime.CompilerServices;
+
+namespace GMAssetCompiler.Properties
+{
+ [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ [CompilerGenerated]
+ internal sealed class Settings : ApplicationSettingsBase
+ {
+ private static Settings defaultInstance = (Settings)SettingsBase.Synchronized(new Settings());
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler.csproj b/GMAC1098/GMAssetCompiler.csproj
new file mode 100644
index 0000000..1a1d51a
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.csproj
@@ -0,0 +1,217 @@
+
+
+
+ {9448EC1D-1983-4043-ACE5-94049A822CD7}
+ Debug
+ x86
+ Exe
+ 5
+ SilicaAssetCompiler
+ v4.5
+ 4
+ True
+
+
+
+ x86
+
+
+ bin\Debug\
+ true
+ full
+ false
+
+
+ bin\Release\
+ true
+ pdbonly
+ true
+
+
+ false
+
+
+ false
+
+
+
+ packages\NAudio.1.9.0\lib\net35\NAudio.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
+
+
+ C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll
+
+
+ C:\Users\Nik\AppData\Roaming\GameMaker-Studio\Ionic.Zip.Reduced.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GMAC1098/GMAssetCompiler.sln b/GMAC1098/GMAssetCompiler.sln
new file mode 100644
index 0000000..ef6a85a
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2013 for Windows Desktop
+VisualStudioVersion = 12.0.40629.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GMAssetCompiler", "GMAssetCompiler.csproj", "{9448EC1D-1983-4043-ACE5-94049A822CD7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9448EC1D-1983-4043-ACE5-94049A822CD7}.Debug|x86.ActiveCfg = Debug|x86
+ {9448EC1D-1983-4043-ACE5-94049A822CD7}.Debug|x86.Build.0 = Debug|x86
+ {9448EC1D-1983-4043-ACE5-94049A822CD7}.Release|x86.ActiveCfg = Release|x86
+ {9448EC1D-1983-4043-ACE5-94049A822CD7}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/GMAC1098/GMAssetCompiler.v12.suo b/GMAC1098/GMAssetCompiler.v12.suo
new file mode 100644
index 0000000..1e25d76
Binary files /dev/null and b/GMAC1098/GMAssetCompiler.v12.suo differ
diff --git a/GMAC1098/GMAssetCompiler/DDS.cs b/GMAC1098/GMAssetCompiler/DDS.cs
new file mode 100644
index 0000000..730d462
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/DDS.cs
@@ -0,0 +1,126 @@
+namespace GMAssetCompiler
+{
+ internal class DDS
+ {
+ public struct SDDPIXELFORMAT
+ {
+ public uint dwSize;
+
+ public uint dwFlags;
+
+ public uint dwFourCC;
+
+ public uint dwRGBBitCount;
+
+ public uint dwRBitMask;
+
+ public uint dwGBitMask;
+
+ public uint dwBBitMask;
+
+ public uint dwRGBAlphaBitMask;
+ }
+
+ public struct SDDCAPS2
+ {
+ public uint dwCaps1;
+
+ public uint dwCaps2;
+
+ public uint Reserved1;
+
+ public uint Reserved2;
+ }
+
+ public struct SDDSHeader
+ {
+ public uint Magic;
+
+ public uint dwSize;
+
+ public uint dwFlags;
+
+ public uint dwHeight;
+
+ public uint dwWidth;
+
+ public uint dwPitchOrLinearSize;
+
+ public uint dwDepth;
+
+ public uint dwMipMapCount;
+
+ public uint dwReserved1;
+
+ public uint dwReserved1_2;
+
+ public uint dwReserved1_3;
+
+ public uint dwReserved1_4;
+
+ public uint dwReserved1_5;
+
+ public uint dwReserved1_6;
+
+ public uint dwReserved1_7;
+
+ public uint dwReserved1_8;
+
+ public uint dwReserved1_9;
+
+ public uint dwReserved1_10;
+
+ public uint dwReserved1_11;
+
+ public SDDPIXELFORMAT ddpfPixelFormat;
+
+ public SDDCAPS2 ddsCaps;
+
+ public uint dwReserved2;
+ }
+
+ public const uint DDSD_CAPS = 1u;
+
+ public const uint DDSD_HEIGHT = 2u;
+
+ public const uint DDSD_WIDTH = 4u;
+
+ public const uint DDSD_PITCH = 8u;
+
+ public const uint DDSD_PIXELFORMAT = 4096u;
+
+ public const uint DDSD_MIPMAPCOUNT = 131072u;
+
+ public const uint DDSD_LINEARSIZE = 524288u;
+
+ public const uint DDSD_DEPTH = 8388608u;
+
+ public const uint DDPF_ALPHAPIXELS = 1u;
+
+ public const uint DDPF_FOURCC = 4u;
+
+ public const uint DDPF_RGB = 64u;
+
+ public const uint DDSCAPS_COMPLEX = 8u;
+
+ public const uint DDSCAPS_TEXTURE = 4096u;
+
+ public const uint DDSCAPS_MIPMAP = 4194304u;
+
+ public const uint DDSCAPS2_CUBEMAP = 512u;
+
+ public const uint DDSCAPS2_CUBEMAP_POSITIVEX = 1024u;
+
+ public const uint DDSCAPS2_CUBEMAP_NEGATIVEX = 2048u;
+
+ public const uint DDSCAPS2_CUBEMAP_POSITIVEY = 4096u;
+
+ public const uint DDSCAPS2_CUBEMAP_NEGATIVEY = 8192u;
+
+ public const uint DDSCAPS2_CUBEMAP_POSITIVEZ = 16384u;
+
+ public const uint DDSCAPS2_CUBEMAP_NEGATIVEZ = 32768u;
+
+ public const uint DDSCAPS2_VOLUME = 2097152u;
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/DummyStream.cs b/GMAC1098/GMAssetCompiler/DummyStream.cs
new file mode 100644
index 0000000..be02903
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/DummyStream.cs
@@ -0,0 +1,72 @@
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ internal class DummyStream : Stream
+ {
+ public override bool CanRead
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override bool CanSeek
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public override long Length
+ {
+ get
+ {
+ return 0L;
+ }
+ }
+
+ public override long Position
+ {
+ get
+ {
+ return 0L;
+ }
+ set
+ {
+ }
+ }
+
+ public override void Flush()
+ {
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ return 0;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ return 0L;
+ }
+
+ public override void SetLength(long value)
+ {
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/ExtensionKind.cs b/GMAC1098/GMAssetCompiler/ExtensionKind.cs
new file mode 100644
index 0000000..88d1f73
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/ExtensionKind.cs
@@ -0,0 +1,14 @@
+namespace GMAssetCompiler
+{
+ internal enum ExtensionKind
+ {
+ Error = -1,
+ Undefined = 0,
+ Dll = 1,
+ Gml = 2,
+ Lib = 3,
+ Other = 4,
+ Stdcall = 11,
+ Cdecl = 12
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/Form1.cs b/GMAC1098/GMAssetCompiler/Form1.cs
new file mode 100644
index 0000000..589542a
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/Form1.cs
@@ -0,0 +1,1081 @@
+using Flobbster.Windows.Forms;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace GMAssetCompiler
+{
+ public class Form1 : Form
+ {
+ public delegate PropertyBag Prepare(object _o);
+
+ private GMAssets m_assets;
+
+ private ToolStripMenuItem m_currentMachineSelected;
+
+ private ToolStripMenuItem[] m_currentTextureSelected;
+
+ private IContainer components;
+
+ private SplitContainer splitContainer1;
+
+ private TreeView treeView1;
+
+ private SplitContainer splitContainer2;
+
+ private PropertyGrid propertyGrid1;
+
+ private PictureBox pictureBox1;
+
+ private ToolStrip toolStrip1;
+
+ private ToolStripButton compileButton;
+
+ private ToolStripDropDownButton targetDDButton;
+
+ private ToolStripMenuItem pSPToolStripMenuItem;
+
+ private ToolStripMenuItem windowsToolStripMenuItem;
+
+ private ToolStripMenuItem iOSToolStripMenuItem;
+
+ private ToolStripButton toolStripButton1;
+
+ private ToolStripTextBox SearchBox;
+
+ private ToolStripDropDownButton toolStripOpaqueTextureButton;
+
+ private ToolStripMenuItem bitToolStripMenuItem;
+
+ private ToolStripMenuItem r8G8B8A8ToolStripMenuItem;
+
+ private ToolStripMenuItem dXTC5ToolStripMenuItem;
+
+ private ToolStripMenuItem pVRTCToolStripMenuItem;
+
+ private ToolStripDropDownButton toolStripAlphaTextureButton;
+
+ private ToolStripMenuItem toolStripMenuItem1;
+
+ private ToolStripMenuItem toolStripMenuItem2;
+
+ private ToolStripMenuItem toolStripMenuItem3;
+
+ private ToolStripMenuItem toolStripMenuItem4;
+
+ private ToolStripMenuItem pNGToolStripMenuItem;
+
+ private ToolStripMenuItem pNGToolStripMenuItem1;
+
+ private ToolStripMenuItem androidToolStripMenuItem;
+
+ private ToolStripMenuItem symbianToolStripMenuItem;
+
+ private ToolStripMenuItem hTML5ToolStripMenuItem;
+
+ private ToolStripDropDownButton toolStripDropDownButton1;
+
+ private ToolStripMenuItem writeTexturesToolStripMenuItem;
+
+ private ToolStripMenuItem writeWavsToolStripMenuItem;
+
+ private ToolStripMenuItem separateAlphaOpaqueTexturesToolStripMenuItem;
+
+ private ToolStripMenuItem noCacheStripMenuItem;
+
+ private ToolStripMenuItem verboseToolStripMenuItem;
+
+ private ToolStripMenuItem obfuscateToolStripMenuItem;
+
+ private ToolStripMenuItem prettyPrintingToolStripMenuItem;
+
+ private ToolStripMenuItem RemoveUnusedFunctionsToolStripMenuItem;
+
+ private ToolStripMenuItem encodeStringsToolStripMenuItem;
+
+ private ToolStripMenuItem obfuscateToolStripMenuItem1;
+
+ public Form1(GMAssets _assets)
+ {
+ m_assets = _assets;
+ InitializeComponent();
+ Text = string.Format("GMAssetCompiler : {0} : {1}", Program.MachineType.Name, _assets.FileName);
+ m_currentTextureSelected = new ToolStripMenuItem[2];
+ foreach (ToolStripMenuItem dropDownItem in targetDDButton.DropDownItems)
+ {
+ if (string.Compare(dropDownItem.Text, Program.MachineType.Name, true) == 0)
+ {
+ m_currentMachineSelected = dropDownItem;
+ dropDownItem.Checked = true;
+ break;
+ }
+ }
+ foreach (ToolStripMenuItem dropDownItem2 in toolStripOpaqueTextureButton.DropDownItems)
+ {
+ dropDownItem2.Tag = (eTexType)Enum.Parse(typeof(eTexType), dropDownItem2.Tag as string);
+ dropDownItem2.Checked = (Program.TextureType[0] == (eTexType)dropDownItem2.Tag);
+ if (dropDownItem2.Checked)
+ {
+ m_currentTextureSelected[0] = dropDownItem2;
+ }
+ }
+ foreach (ToolStripMenuItem dropDownItem3 in toolStripAlphaTextureButton.DropDownItems)
+ {
+ dropDownItem3.Tag = (eTexType)Enum.Parse(typeof(eTexType), dropDownItem3.Tag as string);
+ dropDownItem3.Checked = (Program.TextureType[1] == (eTexType)dropDownItem3.Tag);
+ if (dropDownItem3.Checked)
+ {
+ m_currentTextureSelected[1] = dropDownItem3;
+ }
+ }
+ writeTexturesToolStripMenuItem.Checked = Program.WriteTextures;
+ writeWavsToolStripMenuItem.Checked = Program.WriteWaves;
+ separateAlphaOpaqueTexturesToolStripMenuItem.Checked = Program.SeparateOpaqueAndAlpha;
+ noCacheStripMenuItem.Checked = Program.NoCache;
+ verboseToolStripMenuItem.Checked = Program.Verbose;
+ obfuscateToolStripMenuItem.Checked = Program.DoObfuscate;
+ prettyPrintingToolStripMenuItem.Checked = Program.ObfuscatePrettyPrint;
+ RemoveUnusedFunctionsToolStripMenuItem.Checked = Program.ObfuscateRemoveUnused;
+ encodeStringsToolStripMenuItem.Checked = Program.ObfuscateEncodeStrings;
+ obfuscateToolStripMenuItem1.Checked = Program.ObfuscateObfuscate;
+ AddExtensions();
+ AddSounds();
+ AddSprites();
+ AddBackgrounds();
+ AddPaths();
+ AddScripts();
+ AddFonts();
+ AddTimeLines();
+ AddObjects();
+ AddRooms();
+ AddDataFiles();
+ AddLibraries();
+ AddRoomOrder();
+ AddOptions();
+ }
+
+ private void AddEntry(IList> _collection, string _name, Type _tag)
+ {
+ List list = new List();
+ int num = 0;
+ foreach (KeyValuePair item in _collection)
+ {
+ if (!string.IsNullOrEmpty(item.Key))
+ {
+ TreeNode treeNode = new TreeNode(item.Key + string.Format("({0})", num));
+ treeNode.Tag = ((_tag != null) ? Activator.CreateInstance(_tag, item.Value) : null);
+ list.Add(treeNode);
+ }
+ num++;
+ }
+ TreeNode node = new TreeNode(_name, list.ToArray());
+ treeView1.Nodes.Add(node);
+ }
+
+ public void AddSprites()
+ {
+ AddEntry(m_assets.Sprites, "sprites", typeof(ViewSprite));
+ }
+
+ public void AddExtensions()
+ {
+ List list = new List();
+ foreach (GMExtension extension in m_assets.Extensions)
+ {
+ list.Add(new TreeNode(extension.Name));
+ }
+ TreeNode node = new TreeNode("extensions", list.ToArray());
+ treeView1.Nodes.Add(node);
+ }
+
+ public void AddSounds()
+ {
+ AddEntry(m_assets.Sounds, "sounds", typeof(View));
+ }
+
+ public void AddBackgrounds()
+ {
+ AddEntry(m_assets.Backgrounds, "backgrounds", typeof(ViewBackground));
+ }
+
+ public void AddPaths()
+ {
+ AddEntry(m_assets.Paths, "paths", typeof(View));
+ }
+
+ public void AddScripts()
+ {
+ AddEntry(m_assets.Scripts, "scripts", typeof(View));
+ }
+
+ public void AddFonts()
+ {
+ AddEntry(m_assets.Fonts, "fonts", typeof(ViewFont));
+ }
+
+ public void AddTimeLines()
+ {
+ AddEntry(m_assets.TimeLines, "timelines", typeof(View));
+ }
+
+ public void AddObjects()
+ {
+ AddEntry(m_assets.Objects, "objects", typeof(View));
+ }
+
+ public void AddRooms()
+ {
+ AddEntry(m_assets.Rooms, "rooms", typeof(View));
+ }
+
+ public void AddDataFiles()
+ {
+ AddEntry(m_assets.DataFiles, "datafiles", typeof(View));
+ }
+
+ public void AddLibraries()
+ {
+ List list = new List();
+ foreach (string library in m_assets.Libraries)
+ {
+ list.Add(new TreeNode(library));
+ }
+ TreeNode node = new TreeNode("libraries", list.ToArray());
+ treeView1.Nodes.Add(node);
+ }
+
+ public void AddRoomOrder()
+ {
+ List list = new List();
+ foreach (int item in m_assets.RoomOrder)
+ {
+ list.Add(new TreeNode(m_assets.Rooms[item].Key));
+ }
+ TreeNode node = new TreeNode("roomOrder", list.ToArray());
+ treeView1.Nodes.Add(node);
+ }
+
+ public void AddOptions()
+ {
+ }
+
+ private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
+ {
+ propertyGrid1.SelectedObject = null;
+ if (e.Node.Tag != null)
+ {
+ IPropertyGrid propertyGrid = (IPropertyGrid)e.Node.Tag;
+ PropertyBag selectedObject = propertyGrid.Prepare();
+ propertyGrid1.SelectedObject = selectedObject;
+ Image image = propertyGrid.PrepareImage();
+ pictureBox1.Image = image;
+ }
+ }
+
+ public static byte[] createOutTexture(Image image, eSquishFlags _flags, out Image _dest, eTexType _type)
+ {
+ _dest = null;
+ switch (_type)
+ {
+ case eTexType.e4444:
+ return CompressImageRaw4444(image, out _dest);
+ case eTexType.eRaw:
+ return CompressImageRaw(image);
+ case eTexType.ePVR:
+ return CompressImagePVR(image);
+ case eTexType.ePNG:
+ {
+ MemoryStream memoryStream = new MemoryStream();
+ image.Save(memoryStream, ImageFormat.Png);
+ return memoryStream.ToArray();
+ }
+ default:
+ return CompressImageDXT(image, _flags);
+ }
+ }
+
+ private unsafe static byte[] CompressImageRaw(Image image)
+ {
+ int num = 0;
+ Bitmap bitmap = new Bitmap(image);
+ Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
+ BitmapData bitmapData = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
+ IMachineType machineType = Program.MachineType;
+ byte[] array = new byte[image.Width * image.Height * 4 + 16];
+ fixed (byte* ptr2 = &array[0])
+ {
+ IntPtr scan = bitmapData.Scan0;
+ IntPtr intPtr = scan;
+ int num2 = 0;
+ while (num2 < image.Height)
+ {
+ IntPtr ptr = intPtr;
+ int num3 = 0;
+ while (num3 < image.Width)
+ {
+ int num4 = Marshal.ReadInt32(ptr);
+ *(uint*)(ptr2 + (long)(4 + num) * 4L) = machineType.Convert8888((num4 >> 24) & 0xFF, num4 & 0xFF, (num4 & 0xFF00) >> 8, (num4 >> 16) & 0xFF);
+ num++;
+ num3++;
+ ptr = new IntPtr(ptr.ToInt64() + 4);
+ }
+ num2++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ }
+ *(int*)ptr2 = 542589266;
+ *(int*)(ptr2 + 4) = image.Width;
+ *(int*)(ptr2 + 8) = image.Height;
+ *(int*)(ptr2 + 12) = 0;
+ }
+ bitmap.UnlockBits(bitmapData);
+ return array;
+ }
+
+ private unsafe static byte[] CompressImageRaw4444(Image image, out Image _destImage)
+ {
+ Bitmap bitmap = (Bitmap)(_destImage = new Bitmap(image));
+ int num = 0;
+ Bitmap bitmap2 = new Bitmap(image);
+ Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
+ BitmapData bitmapData = bitmap2.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
+ BitmapData bitmapData2 = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
+ byte[] array = new byte[image.Width * image.Height * 2 + 16];
+ fixed (byte* ptr3 = &array[0])
+ {
+ IntPtr scan = bitmapData.Scan0;
+ IntPtr scan2 = bitmapData2.Scan0;
+ IntPtr intPtr = scan;
+ IntPtr intPtr2 = scan2;
+ IMachineType machineType = Program.MachineType;
+ int num2 = 0;
+ while (num2 < image.Height)
+ {
+ IntPtr ptr = intPtr;
+ IntPtr ptr2 = intPtr2;
+ float num3 = 0.4375f;
+ float num4 = 0.1875f;
+ float num5 = 0.3125f;
+ float num6 = 0.0625f;
+ int num7 = 0;
+ while (num7 < image.Width)
+ {
+ int num8 = Marshal.ReadInt32(ptr);
+ int num9 = num8 & 0xFF;
+ int num10 = (num8 >> 8) & 0xFF;
+ int num11 = (num8 >> 16) & 0xFF;
+ int num12 = (num8 >> 24) & 0xFF;
+ *(ushort*)(ptr3 + (long)(8 + num) * 2L) = machineType.Convert4444(num12, num9, num10, num11);
+ int num13 = num12 & 0xF0;
+ if (num13 != 0)
+ {
+ num13 |= 0xF;
+ }
+ Marshal.WriteInt32(ptr2, (num13 << 24) | ((num11 & 0xF0) << 16) | ((num10 & 0xF0) << 8) | (num9 & 0xF0));
+ int num14 = num9 & 0xF;
+ int num15 = num10 & 0xF;
+ int num16 = num11 & 0xF;
+ if (num7 < image.Width - 1)
+ {
+ num8 = Marshal.ReadInt32(ptr, 4);
+ num9 = (int)((float)(num8 & 0xFF) + num3 * (float)num14);
+ num10 = (int)((float)((num8 >> 8) & 0xFF) + num3 * (float)num15);
+ num11 = (int)((float)((num8 >> 16) & 0xFF) + num3 * (float)num16);
+ num12 = ((num8 >> 24) & 0xFF);
+ num9 = ((num9 >= 0) ? ((num9 > 255) ? 255 : num9) : 0);
+ num10 = ((num10 >= 0) ? ((num10 > 255) ? 255 : num10) : 0);
+ num11 = ((num11 >= 0) ? ((num11 > 255) ? 255 : num11) : 0);
+ num8 = ((num12 << 24) | (num11 << 16) | (num10 << 8) | num9);
+ Marshal.WriteInt32(ptr, 4, num8);
+ }
+ if (num7 > 0 && num2 < image.Height - 1)
+ {
+ num8 = Marshal.ReadInt32(ptr, -4 + bitmapData.Stride);
+ num9 = (int)((float)(num8 & 0xFF) + num4 * (float)num14);
+ num10 = (int)((float)((num8 >> 8) & 0xFF) + num4 * (float)num15);
+ num11 = (int)((float)((num8 >> 16) & 0xFF) + num4 * (float)num16);
+ num12 = ((num8 >> 24) & 0xFF);
+ num9 = ((num9 >= 0) ? ((num9 > 255) ? 255 : num9) : 0);
+ num10 = ((num10 >= 0) ? ((num10 > 255) ? 255 : num10) : 0);
+ num11 = ((num11 >= 0) ? ((num11 > 255) ? 255 : num11) : 0);
+ num8 = ((num12 << 24) | (num11 << 16) | (num10 << 8) | num9);
+ Marshal.WriteInt32(ptr, -4 + bitmapData.Stride, num8);
+ }
+ if (num2 < image.Height - 1)
+ {
+ num8 = Marshal.ReadInt32(ptr, bitmapData.Stride);
+ num9 = (int)((float)(num8 & 0xFF) + num5 * (float)num14);
+ num10 = (int)((float)((num8 >> 8) & 0xFF) + num5 * (float)num15);
+ num11 = (int)((float)((num8 >> 16) & 0xFF) + num5 * (float)num16);
+ num12 = ((num8 >> 24) & 0xFF);
+ num9 = ((num9 >= 0) ? ((num9 > 255) ? 255 : num9) : 0);
+ num10 = ((num10 >= 0) ? ((num10 > 255) ? 255 : num10) : 0);
+ num11 = ((num11 >= 0) ? ((num11 > 255) ? 255 : num11) : 0);
+ num8 = ((num12 << 24) | (num11 << 16) | (num10 << 8) | num9);
+ Marshal.WriteInt32(ptr, bitmapData.Stride, num8);
+ }
+ if (num7 < image.Width - 1 && num2 < image.Height - 1)
+ {
+ num8 = Marshal.ReadInt32(ptr, 4 + bitmapData.Stride);
+ num9 = (int)((float)(num8 & 0xFF) + num6 * (float)num14);
+ num10 = (int)((float)((num8 >> 8) & 0xFF) + num6 * (float)num15);
+ num11 = (int)((float)((num8 >> 16) & 0xFF) + num6 * (float)num16);
+ num12 = ((num8 >> 24) & 0xFF);
+ num9 = ((num9 >= 0) ? ((num9 > 255) ? 255 : num9) : 0);
+ num10 = ((num10 >= 0) ? ((num10 > 255) ? 255 : num10) : 0);
+ num11 = ((num11 >= 0) ? ((num11 > 255) ? 255 : num11) : 0);
+ num8 = ((num12 << 24) | (num11 << 16) | (num10 << 8) | num9);
+ Marshal.WriteInt32(ptr, 4 + bitmapData.Stride, num8);
+ }
+ num++;
+ num7++;
+ ptr = new IntPtr(ptr.ToInt64() + 4);
+ ptr2 = new IntPtr(ptr2.ToInt64() + 4);
+ }
+ num2++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ intPtr2 = new IntPtr(intPtr2.ToInt64() + bitmapData2.Stride);
+ }
+ *(int*)ptr3 = 542589266;
+ *(int*)(ptr3 + 4) = image.Width;
+ *(int*)(ptr3 + 8) = image.Height;
+ *(int*)(ptr3 + 12) = 1;
+ }
+ bitmap2.UnlockBits(bitmapData);
+ return array;
+ }
+
+ private static byte[] CompressImagePVR(Image image)
+ {
+ Bitmap bitmap = new Bitmap(image);
+ Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
+ BitmapData bitmapData = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
+ IntPtr scan = bitmapData.Scan0;
+ IntPtr intPtr = scan;
+ int num = 0;
+ while (num < image.Height)
+ {
+ IntPtr ptr = intPtr;
+ int num2 = 0;
+ while (num2 < image.Width)
+ {
+ int num3 = Marshal.ReadInt32(ptr);
+ int val = (num3 & -16711936) | ((num3 & 0xFF) << 16) | ((num3 & 0xFF0000) >> 16);
+ Marshal.WriteInt32(ptr, val);
+ num2++;
+ ptr = new IntPtr(ptr.ToInt64() + 4);
+ }
+ num++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ }
+ string text = Path.ChangeExtension(Path.GetTempFileName(), ".pvr");
+ IntPtr intPtr2 = Marshal.StringToHGlobalAnsi(text);
+ Squish.CompressPVRTC(bitmapData.Scan0, image.Width, image.Height, intPtr2, 0);
+ Marshal.FreeHGlobal(intPtr2);
+ scan = bitmapData.Scan0;
+ intPtr = scan;
+ int num4 = 0;
+ while (num4 < image.Height)
+ {
+ IntPtr ptr2 = intPtr;
+ int num5 = 0;
+ while (num5 < image.Width)
+ {
+ int num6 = Marshal.ReadInt32(ptr2);
+ int val2 = (num6 & -16711936) | ((num6 & 0xFF) << 16) | ((num6 & 0xFF0000) >> 16);
+ Marshal.WriteInt32(ptr2, val2);
+ num5++;
+ ptr2 = new IntPtr(ptr2.ToInt64() + 4);
+ }
+ num4++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ }
+ byte[] result = File.ReadAllBytes(text);
+ bitmap.UnlockBits(bitmapData);
+ return result;
+ }
+
+ private unsafe static byte[] CompressImageDXT(Image image, eSquishFlags _flags)
+ {
+ Bitmap bitmap = new Bitmap(image);
+ Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
+ BitmapData bitmapData = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
+ int storageRequirements = Squish.GetStorageRequirements(image.Width, image.Height, _flags);
+ int num = Marshal.SizeOf(typeof(DDS.SDDSHeader));
+ storageRequirements += num;
+ byte[] array = new byte[storageRequirements + 15];
+ fixed (byte* value = &array[num])
+ {
+ IntPtr scan = bitmapData.Scan0;
+ IntPtr intPtr = scan;
+ int num2 = 0;
+ while (num2 < image.Height)
+ {
+ IntPtr ptr = intPtr;
+ int num3 = 0;
+ while (num3 < image.Width)
+ {
+ int num4 = Marshal.ReadInt32(ptr);
+ int val = (num4 & -16711936) | ((num4 & 0xFF) << 16) | ((num4 & 0xFF0000) >> 16);
+ Marshal.WriteInt32(ptr, val);
+ num3++;
+ ptr = new IntPtr(ptr.ToInt64() + 4);
+ }
+ num2++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ }
+ Squish.CompressImage(bitmapData.Scan0, image.Width, image.Height, new IntPtr(value), _flags);
+ intPtr = scan;
+ int num5 = 0;
+ while (num5 < image.Height)
+ {
+ IntPtr ptr2 = intPtr;
+ int num6 = 0;
+ while (num6 < image.Width)
+ {
+ int num7 = Marshal.ReadInt32(ptr2);
+ int val2 = (num7 & -16711936) | ((num7 & 0xFF) << 16) | ((num7 & 0xFF0000) >> 16);
+ Marshal.WriteInt32(ptr2, val2);
+ num6++;
+ ptr2 = new IntPtr(ptr2.ToInt64() + 4);
+ }
+ num5++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ }
+ }
+ bitmap.UnlockBits(bitmapData);
+ fixed (byte* ptr3 = &array[0])
+ {
+ DDS.SDDSHeader* ptr4 = (DDS.SDDSHeader*)ptr3;
+ ptr4->Magic = 542327876u;
+ ptr4->dwSize = (uint)Marshal.SizeOf(typeof(DDS.SDDSHeader));
+ ptr4->dwFlags = 659463u;
+ ptr4->dwMipMapCount = 0u;
+ ptr4->dwWidth = (uint)image.Width;
+ ptr4->dwHeight = (uint)image.Height;
+ ptr4->ddpfPixelFormat.dwSize = (uint)Marshal.SizeOf(typeof(DDS.SDDPIXELFORMAT));
+ if ((_flags & eSquishFlags.kDxt1) != 0)
+ {
+ ptr4->ddpfPixelFormat.dwFourCC = 827611204u;
+ }
+ else if ((_flags & eSquishFlags.kDxt3) != 0)
+ {
+ ptr4->ddpfPixelFormat.dwFourCC = 861165636u;
+ }
+ else if ((_flags & eSquishFlags.kDxt5) != 0)
+ {
+ ptr4->ddpfPixelFormat.dwFourCC = 894720068u;
+ }
+ ptr4->ddpfPixelFormat.dwFlags = 4u;
+ ptr4->ddsCaps.dwCaps1 = 4096u;
+ }
+ return array;
+ }
+
+ private void compileButton_Click(object sender, EventArgs e)
+ {
+ string extension = Program.MachineType.Extension;
+ if (Program.Studio)
+ {
+ extension = ".zip";
+ }
+ string name = Path.Combine(Program.OutputDir, Path.ChangeExtension(Path.GetFileName(m_assets.FileName), extension));
+ switch (Program.MachineType.OutputType)
+ {
+ case eOutputType.eWAD:
+ IFFSaver.Save(m_assets, name);
+ break;
+ case eOutputType.eHTML5:
+ HTML5Saver.Save(m_assets, name);
+ break;
+ }
+ }
+
+ private void ToolStripMenuItem_MachineSelect_Click(object sender, EventArgs e)
+ {
+ m_currentMachineSelected.Checked = false;
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.SetMachineType(toolStripMenuItem.Text);
+ toolStripMenuItem.Checked = true;
+ m_currentMachineSelected = toolStripMenuItem;
+ Text = string.Format("GMAssetCompiler : {0} : {1}", Program.MachineType.Name, m_assets.FileName);
+ foreach (ToolStripMenuItem dropDownItem in toolStripOpaqueTextureButton.DropDownItems)
+ {
+ dropDownItem.Checked = (Program.TextureType[0] == (eTexType)dropDownItem.Tag);
+ if (dropDownItem.Checked)
+ {
+ m_currentTextureSelected[0] = dropDownItem;
+ }
+ }
+ foreach (ToolStripMenuItem dropDownItem2 in toolStripAlphaTextureButton.DropDownItems)
+ {
+ dropDownItem2.Checked = (Program.TextureType[1] == (eTexType)dropDownItem2.Tag);
+ if (dropDownItem2.Checked)
+ {
+ m_currentTextureSelected[1] = dropDownItem2;
+ }
+ }
+ }
+
+ private void toolStripButton1_Click(object sender, EventArgs e)
+ {
+ string text = SearchBox.Text;
+ Console.WriteLine("------------- Finding '{0}' ----------------------", text);
+ foreach (KeyValuePair script in m_assets.Scripts)
+ {
+ GMScript value = script.Value;
+ if (value != null && !string.IsNullOrEmpty(value.Script) && value.Script.Contains(text))
+ {
+ Console.WriteLine("Found in script - {0}", script.Key);
+ }
+ }
+ foreach (KeyValuePair @object in m_assets.Objects)
+ {
+ GMObject value2 = @object.Value;
+ if (value2 != null)
+ {
+ foreach (IList> @event in value2.Events)
+ {
+ foreach (KeyValuePair item in @event)
+ {
+ GMEvent value3 = item.Value;
+ foreach (GMAction action in value3.Actions)
+ {
+ foreach (string arg in action.Args)
+ {
+ if (!string.IsNullOrEmpty(arg) && arg.Contains(text))
+ {
+ Console.WriteLine("Found in object {0} in event {1} action {2}", @object.Key, item.Key, action.Name);
+ }
+ }
+ if (!string.IsNullOrEmpty(action.Code) && action.Code.Contains(text))
+ {
+ Console.WriteLine("Found in object {0} in event {1} action {2}", @object.Key, item.Key, action.Name);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void ToolStripMenuItem_OpaqueTextureSelect_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem_TextureSelect_Click(sender, e, 0);
+ }
+
+ private void ToolStripMenuItem_AlphaTextureSelect_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem_TextureSelect_Click(sender, e, 1);
+ }
+
+ private void ToolStripMenuItem_TextureSelect_Click(object sender, EventArgs e, int n)
+ {
+ m_currentTextureSelected[n].Checked = false;
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.TextureType[n] = (eTexType)toolStripMenuItem.Tag;
+ toolStripMenuItem.Checked = true;
+ m_currentTextureSelected[n] = toolStripMenuItem;
+ }
+
+ private void writeTexturesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.WriteTextures = !Program.WriteTextures;
+ toolStripMenuItem.Checked = Program.WriteTextures;
+ }
+
+ private void writeWavsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.WriteWaves = !Program.WriteWaves;
+ toolStripMenuItem.Checked = Program.WriteWaves;
+ }
+
+ private void separateAlphaOpaqueTexturesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.SeparateOpaqueAndAlpha = !Program.SeparateOpaqueAndAlpha;
+ toolStripMenuItem.Checked = Program.SeparateOpaqueAndAlpha;
+ }
+
+ private void noCacheStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.NoCache = !Program.NoCache;
+ toolStripMenuItem.Checked = Program.NoCache;
+ }
+
+ private void verboseToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.Verbose = !Program.Verbose;
+ toolStripMenuItem.Checked = Program.Verbose;
+ }
+
+ private void obfuscateToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.DoObfuscate = !Program.DoObfuscate;
+ toolStripMenuItem.Checked = Program.DoObfuscate;
+ }
+
+ private void prettyPrintingToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.ObfuscatePrettyPrint = !Program.ObfuscatePrettyPrint;
+ toolStripMenuItem.Checked = Program.ObfuscatePrettyPrint;
+ }
+
+ private void reToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.ObfuscateRemoveUnused = !Program.ObfuscateRemoveUnused;
+ toolStripMenuItem.Checked = Program.ObfuscateRemoveUnused;
+ }
+
+ private void encodeStringsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.ObfuscateEncodeStrings = !Program.ObfuscateEncodeStrings;
+ toolStripMenuItem.Checked = Program.ObfuscateEncodeStrings;
+ }
+
+ private void obfuscateToolStripMenuItem1_Click(object sender, EventArgs e)
+ {
+ ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
+ Program.ObfuscateObfuscate = !Program.ObfuscateObfuscate;
+ toolStripMenuItem.Checked = Program.ObfuscateObfuscate;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && components != null)
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GMAssetCompiler.Form1));
+ splitContainer1 = new System.Windows.Forms.SplitContainer();
+ treeView1 = new System.Windows.Forms.TreeView();
+ splitContainer2 = new System.Windows.Forms.SplitContainer();
+ propertyGrid1 = new System.Windows.Forms.PropertyGrid();
+ pictureBox1 = new System.Windows.Forms.PictureBox();
+ toolStrip1 = new System.Windows.Forms.ToolStrip();
+ compileButton = new System.Windows.Forms.ToolStripButton();
+ targetDDButton = new System.Windows.Forms.ToolStripDropDownButton();
+ pSPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ windowsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ iOSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ androidToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ symbianToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ hTML5ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ toolStripOpaqueTextureButton = new System.Windows.Forms.ToolStripDropDownButton();
+ bitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ r8G8B8A8ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ dXTC5ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ pVRTCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ pNGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ toolStripAlphaTextureButton = new System.Windows.Forms.ToolStripDropDownButton();
+ toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
+ toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
+ toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
+ pNGToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton();
+ writeTexturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ writeWavsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ separateAlphaOpaqueTexturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ noCacheStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ verboseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ obfuscateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ prettyPrintingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ RemoveUnusedFunctionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ encodeStringsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ SearchBox = new System.Windows.Forms.ToolStripTextBox();
+ toolStripButton1 = new System.Windows.Forms.ToolStripButton();
+ obfuscateToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ splitContainer1.Panel1.SuspendLayout();
+ splitContainer1.Panel2.SuspendLayout();
+ splitContainer1.SuspendLayout();
+ splitContainer2.Panel1.SuspendLayout();
+ splitContainer2.Panel2.SuspendLayout();
+ splitContainer2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
+ toolStrip1.SuspendLayout();
+ SuspendLayout();
+ splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ splitContainer1.Location = new System.Drawing.Point(0, 25);
+ splitContainer1.Name = "splitContainer1";
+ splitContainer1.Panel1.Controls.Add(treeView1);
+ splitContainer1.Panel2.Controls.Add(splitContainer2);
+ splitContainer1.Size = new System.Drawing.Size(921, 633);
+ splitContainer1.SplitterDistance = 173;
+ splitContainer1.TabIndex = 0;
+ treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ treeView1.Location = new System.Drawing.Point(0, 0);
+ treeView1.Name = "treeView1";
+ treeView1.Size = new System.Drawing.Size(173, 633);
+ treeView1.TabIndex = 0;
+ treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(treeView1_AfterSelect);
+ splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ splitContainer2.Location = new System.Drawing.Point(0, 0);
+ splitContainer2.Name = "splitContainer2";
+ splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ splitContainer2.Panel1.Controls.Add(propertyGrid1);
+ splitContainer2.Panel2.Controls.Add(pictureBox1);
+ splitContainer2.Size = new System.Drawing.Size(744, 633);
+ splitContainer2.SplitterDistance = 371;
+ splitContainer2.TabIndex = 0;
+ propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
+ propertyGrid1.Location = new System.Drawing.Point(0, 0);
+ propertyGrid1.Name = "propertyGrid1";
+ propertyGrid1.Size = new System.Drawing.Size(744, 371);
+ propertyGrid1.TabIndex = 0;
+ pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ pictureBox1.Location = new System.Drawing.Point(0, 0);
+ pictureBox1.Name = "pictureBox1";
+ pictureBox1.Size = new System.Drawing.Size(744, 258);
+ pictureBox1.TabIndex = 0;
+ pictureBox1.TabStop = false;
+ toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[7]
+ {
+ compileButton,
+ targetDDButton,
+ toolStripOpaqueTextureButton,
+ toolStripAlphaTextureButton,
+ toolStripDropDownButton1,
+ SearchBox,
+ toolStripButton1
+ });
+ toolStrip1.Location = new System.Drawing.Point(0, 0);
+ toolStrip1.Name = "toolStrip1";
+ toolStrip1.Size = new System.Drawing.Size(921, 25);
+ toolStrip1.TabIndex = 1;
+ toolStrip1.Text = "toolStrip1";
+ compileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ compileButton.Image = (System.Drawing.Image)resources.GetObject("compileButton.Image");
+ compileButton.ImageTransparentColor = System.Drawing.Color.Magenta;
+ compileButton.Name = "compileButton";
+ compileButton.Size = new System.Drawing.Size(56, 22);
+ compileButton.Text = "Compile";
+ compileButton.Click += new System.EventHandler(compileButton_Click);
+ targetDDButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ targetDDButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[6]
+ {
+ pSPToolStripMenuItem,
+ windowsToolStripMenuItem,
+ iOSToolStripMenuItem,
+ androidToolStripMenuItem,
+ symbianToolStripMenuItem,
+ hTML5ToolStripMenuItem
+ });
+ targetDDButton.Image = (System.Drawing.Image)resources.GetObject("targetDDButton.Image");
+ targetDDButton.ImageTransparentColor = System.Drawing.Color.Magenta;
+ targetDDButton.Name = "targetDDButton";
+ targetDDButton.Size = new System.Drawing.Size(54, 22);
+ targetDDButton.Text = "Target";
+ pSPToolStripMenuItem.Name = "pSPToolStripMenuItem";
+ pSPToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ pSPToolStripMenuItem.Tag = "";
+ pSPToolStripMenuItem.Text = "PSP";
+ pSPToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_MachineSelect_Click);
+ windowsToolStripMenuItem.Name = "windowsToolStripMenuItem";
+ windowsToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ windowsToolStripMenuItem.Text = "Windows";
+ windowsToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_MachineSelect_Click);
+ iOSToolStripMenuItem.Name = "iOSToolStripMenuItem";
+ iOSToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ iOSToolStripMenuItem.Tag = "";
+ iOSToolStripMenuItem.Text = "iOS";
+ iOSToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_MachineSelect_Click);
+ androidToolStripMenuItem.Name = "androidToolStripMenuItem";
+ androidToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ androidToolStripMenuItem.Text = "Android";
+ androidToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_MachineSelect_Click);
+ symbianToolStripMenuItem.Name = "symbianToolStripMenuItem";
+ symbianToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ symbianToolStripMenuItem.Text = "Symbian";
+ symbianToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_MachineSelect_Click);
+ hTML5ToolStripMenuItem.Name = "hTML5ToolStripMenuItem";
+ hTML5ToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ hTML5ToolStripMenuItem.Text = "HTML5";
+ hTML5ToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_MachineSelect_Click);
+ toolStripOpaqueTextureButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ toolStripOpaqueTextureButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[5]
+ {
+ bitToolStripMenuItem,
+ r8G8B8A8ToolStripMenuItem,
+ dXTC5ToolStripMenuItem,
+ pVRTCToolStripMenuItem,
+ pNGToolStripMenuItem
+ });
+ toolStripOpaqueTextureButton.Image = (System.Drawing.Image)resources.GetObject("toolStripOpaqueTextureButton.Image");
+ toolStripOpaqueTextureButton.ImageTransparentColor = System.Drawing.Color.Magenta;
+ toolStripOpaqueTextureButton.Name = "toolStripOpaqueTextureButton";
+ toolStripOpaqueTextureButton.Size = new System.Drawing.Size(133, 22);
+ toolStripOpaqueTextureButton.Text = "Opaque Texture Type";
+ bitToolStripMenuItem.Name = "bitToolStripMenuItem";
+ bitToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+ bitToolStripMenuItem.Tag = "e4444";
+ bitToolStripMenuItem.Text = "16bit - R4G4B4A4";
+ bitToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_OpaqueTextureSelect_Click);
+ r8G8B8A8ToolStripMenuItem.Name = "r8G8B8A8ToolStripMenuItem";
+ r8G8B8A8ToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+ r8G8B8A8ToolStripMenuItem.Tag = "eRaw";
+ r8G8B8A8ToolStripMenuItem.Text = "32bit - R8G8B8A8";
+ r8G8B8A8ToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_OpaqueTextureSelect_Click);
+ dXTC5ToolStripMenuItem.Name = "dXTC5ToolStripMenuItem";
+ dXTC5ToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+ dXTC5ToolStripMenuItem.Tag = "eDXT";
+ dXTC5ToolStripMenuItem.Text = "DXTC5";
+ dXTC5ToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_OpaqueTextureSelect_Click);
+ pVRTCToolStripMenuItem.Name = "pVRTCToolStripMenuItem";
+ pVRTCToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+ pVRTCToolStripMenuItem.Tag = "ePVR";
+ pVRTCToolStripMenuItem.Text = "PVRTC";
+ pVRTCToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_OpaqueTextureSelect_Click);
+ pNGToolStripMenuItem.Name = "pNGToolStripMenuItem";
+ pNGToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
+ pNGToolStripMenuItem.Tag = "ePNG";
+ pNGToolStripMenuItem.Text = "PNG";
+ pNGToolStripMenuItem.Click += new System.EventHandler(ToolStripMenuItem_OpaqueTextureSelect_Click);
+ toolStripAlphaTextureButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ toolStripAlphaTextureButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[5]
+ {
+ toolStripMenuItem1,
+ toolStripMenuItem2,
+ toolStripMenuItem3,
+ toolStripMenuItem4,
+ pNGToolStripMenuItem1
+ });
+ toolStripAlphaTextureButton.Image = (System.Drawing.Image)resources.GetObject("toolStripAlphaTextureButton.Image");
+ toolStripAlphaTextureButton.ImageTransparentColor = System.Drawing.Color.Magenta;
+ toolStripAlphaTextureButton.Name = "toolStripAlphaTextureButton";
+ toolStripAlphaTextureButton.Size = new System.Drawing.Size(122, 22);
+ toolStripAlphaTextureButton.Text = "Alpha Texture Type";
+ toolStripMenuItem1.Name = "toolStripMenuItem1";
+ toolStripMenuItem1.Size = new System.Drawing.Size(165, 22);
+ toolStripMenuItem1.Tag = "e4444";
+ toolStripMenuItem1.Text = "16bit - R4G4B4A4";
+ toolStripMenuItem1.Click += new System.EventHandler(ToolStripMenuItem_AlphaTextureSelect_Click);
+ toolStripMenuItem2.Name = "toolStripMenuItem2";
+ toolStripMenuItem2.Size = new System.Drawing.Size(165, 22);
+ toolStripMenuItem2.Tag = "eRaw";
+ toolStripMenuItem2.Text = "32bit - R8G8B8A8";
+ toolStripMenuItem2.Click += new System.EventHandler(ToolStripMenuItem_AlphaTextureSelect_Click);
+ toolStripMenuItem3.Name = "toolStripMenuItem3";
+ toolStripMenuItem3.Size = new System.Drawing.Size(165, 22);
+ toolStripMenuItem3.Tag = "eDXT";
+ toolStripMenuItem3.Text = "DXTC5";
+ toolStripMenuItem3.Click += new System.EventHandler(ToolStripMenuItem_AlphaTextureSelect_Click);
+ toolStripMenuItem4.Name = "toolStripMenuItem4";
+ toolStripMenuItem4.Size = new System.Drawing.Size(165, 22);
+ toolStripMenuItem4.Tag = "ePVR";
+ toolStripMenuItem4.Text = "PVRTC";
+ toolStripMenuItem4.Click += new System.EventHandler(ToolStripMenuItem_AlphaTextureSelect_Click);
+ pNGToolStripMenuItem1.Name = "pNGToolStripMenuItem1";
+ pNGToolStripMenuItem1.Size = new System.Drawing.Size(165, 22);
+ pNGToolStripMenuItem1.Tag = "ePNG";
+ pNGToolStripMenuItem1.Text = "PNG";
+ pNGToolStripMenuItem1.Click += new System.EventHandler(ToolStripMenuItem_AlphaTextureSelect_Click);
+ toolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[6]
+ {
+ writeTexturesToolStripMenuItem,
+ writeWavsToolStripMenuItem,
+ separateAlphaOpaqueTexturesToolStripMenuItem,
+ noCacheStripMenuItem,
+ verboseToolStripMenuItem,
+ obfuscateToolStripMenuItem
+ });
+ toolStripDropDownButton1.Image = (System.Drawing.Image)resources.GetObject("toolStripDropDownButton1.Image");
+ toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ toolStripDropDownButton1.Name = "toolStripDropDownButton1";
+ toolStripDropDownButton1.Size = new System.Drawing.Size(62, 22);
+ toolStripDropDownButton1.Text = "Options";
+ writeTexturesToolStripMenuItem.Name = "writeTexturesToolStripMenuItem";
+ writeTexturesToolStripMenuItem.Size = new System.Drawing.Size(268, 22);
+ writeTexturesToolStripMenuItem.Text = "Write Textures";
+ writeTexturesToolStripMenuItem.Click += new System.EventHandler(writeTexturesToolStripMenuItem_Click);
+ writeWavsToolStripMenuItem.Name = "writeWavsToolStripMenuItem";
+ writeWavsToolStripMenuItem.Size = new System.Drawing.Size(268, 22);
+ writeWavsToolStripMenuItem.Text = "Write Wavs";
+ writeWavsToolStripMenuItem.Click += new System.EventHandler(writeWavsToolStripMenuItem_Click);
+ separateAlphaOpaqueTexturesToolStripMenuItem.Name = "separateAlphaOpaqueTexturesToolStripMenuItem";
+ separateAlphaOpaqueTexturesToolStripMenuItem.Size = new System.Drawing.Size(268, 22);
+ separateAlphaOpaqueTexturesToolStripMenuItem.Text = "Separate Alpha and Opaque Textures";
+ separateAlphaOpaqueTexturesToolStripMenuItem.Click += new System.EventHandler(separateAlphaOpaqueTexturesToolStripMenuItem_Click);
+ noCacheStripMenuItem.Name = "noCacheStripMenuItem";
+ noCacheStripMenuItem.Size = new System.Drawing.Size(268, 22);
+ noCacheStripMenuItem.Text = "No-cache (html5)";
+ noCacheStripMenuItem.Click += new System.EventHandler(noCacheStripMenuItem_Click);
+ verboseToolStripMenuItem.Name = "verboseToolStripMenuItem";
+ verboseToolStripMenuItem.Size = new System.Drawing.Size(268, 22);
+ verboseToolStripMenuItem.Text = "Verbose";
+ verboseToolStripMenuItem.Click += new System.EventHandler(verboseToolStripMenuItem_Click);
+ obfuscateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[4]
+ {
+ prettyPrintingToolStripMenuItem,
+ RemoveUnusedFunctionsToolStripMenuItem,
+ encodeStringsToolStripMenuItem,
+ obfuscateToolStripMenuItem1
+ });
+ obfuscateToolStripMenuItem.Name = "obfuscateToolStripMenuItem";
+ obfuscateToolStripMenuItem.Size = new System.Drawing.Size(268, 22);
+ obfuscateToolStripMenuItem.Text = "Obfuscate";
+ obfuscateToolStripMenuItem.Click += new System.EventHandler(obfuscateToolStripMenuItem_Click);
+ prettyPrintingToolStripMenuItem.Name = "prettyPrintingToolStripMenuItem";
+ prettyPrintingToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
+ prettyPrintingToolStripMenuItem.Text = "Pretty Printing";
+ prettyPrintingToolStripMenuItem.Click += new System.EventHandler(prettyPrintingToolStripMenuItem_Click);
+ RemoveUnusedFunctionsToolStripMenuItem.Name = "RemoveUnusedFunctionsToolStripMenuItem";
+ RemoveUnusedFunctionsToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
+ RemoveUnusedFunctionsToolStripMenuItem.Text = "Remove Unused Functions";
+ RemoveUnusedFunctionsToolStripMenuItem.Click += new System.EventHandler(reToolStripMenuItem_Click);
+ encodeStringsToolStripMenuItem.Name = "encodeStringsToolStripMenuItem";
+ encodeStringsToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
+ encodeStringsToolStripMenuItem.Text = "Encode Strings";
+ encodeStringsToolStripMenuItem.Click += new System.EventHandler(encodeStringsToolStripMenuItem_Click);
+ SearchBox.Name = "SearchBox";
+ SearchBox.Size = new System.Drawing.Size(150, 25);
+ toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ toolStripButton1.Image = (System.Drawing.Image)resources.GetObject("toolStripButton1.Image");
+ toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ toolStripButton1.Name = "toolStripButton1";
+ toolStripButton1.Size = new System.Drawing.Size(46, 22);
+ toolStripButton1.Text = "Search";
+ toolStripButton1.Click += new System.EventHandler(toolStripButton1_Click);
+ obfuscateToolStripMenuItem1.Name = "obfuscateToolStripMenuItem1";
+ obfuscateToolStripMenuItem1.Size = new System.Drawing.Size(215, 22);
+ obfuscateToolStripMenuItem1.Text = "Obfuscate";
+ obfuscateToolStripMenuItem1.Click += new System.EventHandler(obfuscateToolStripMenuItem1_Click);
+ base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
+ base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ base.ClientSize = new System.Drawing.Size(921, 658);
+ base.Controls.Add(splitContainer1);
+ base.Controls.Add(toolStrip1);
+ base.Name = "Form1";
+ Text = "GMAssetCompiler";
+ splitContainer1.Panel1.ResumeLayout(false);
+ splitContainer1.Panel2.ResumeLayout(false);
+ splitContainer1.ResumeLayout(false);
+ splitContainer2.Panel1.ResumeLayout(false);
+ splitContainer2.Panel2.ResumeLayout(false);
+ splitContainer2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
+ toolStrip1.ResumeLayout(false);
+ toolStrip1.PerformLayout();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/Form1.resx b/GMAC1098/GMAssetCompiler/Form1.resx
new file mode 100644
index 0000000..946e56f
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/Form1.resx
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+text/microsoft-resx1.3System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAcwIAAAKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAAghJREFUOE+lk/tLU3EYxs8/EppdVSQwSrwikpQKhj+EaAjKaqQNhhdwKMNk4A1RFKMI0YVBROyXgZdUzEqTrZhTh9dCloiXKAdDEFEfz/PC/JogBh74cuCc83ye570cDee8NOrrehb+ObXdc7C89MHcNgVjkwf5td9w3zKB9NIxJJd8RKJxAPEGp1gfAfb2D3Da2dndRyC4i82tHfjXt7G4EkTk3Wf/B/AuBcQ5zfwFzrE1Edv7/Liebj0bQGeK3bN/0fpuSWIT+Mq5jGt3qhWANZ+MH4pNZ4ozKsYRV+jAhO8P2t7/0AFVCsCGHQccr5mx6Uwxo3+a/C0Nv5pWqQDsdgjAiPfKx+W49Oismc/oTPGgewPWzllcSS1TAI6KgHl/UIQ9H37BMbqK6Kx6tOjx2TCeDsdP9H5dQ8XzGVxOMSsA50xxbo1bxJOLAbzu96PyhQ838+wS/e3wCjRNk/dPW7y4lGRSAC5Jge073ugvGZd3m30ejxo9Mr4bOe2o1+subZ8WiKHBg4jEYgXgqOgYEvNjU6sX2To44XGfAMLjDEgxfUbSkyGBXIw3KgDXc8C1Ls6smTU+sLr0tR1BbG4XojJsetctEjsmu1l2gMCjVeZuMzIP62NJfEZxdGadiDm20P1C7EOE3S5SAM6Zu81Ok84loYCjYrfpzJoZm84Uh90qVIDz/NGH0AEgNQb7UmkAAAAASUVORK5CYIILAAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAcwIAAAKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAAghJREFUOE+lk/tLU3EYxs8/EppdVSQwSrwikpQKhj+EaAjKaqQNhhdwKMNk4A1RFKMI0YVBROyXgZdUzEqTrZhTh9dCloiXKAdDEFEfz/PC/JogBh74cuCc83ye570cDee8NOrrehb+ObXdc7C89MHcNgVjkwf5td9w3zKB9NIxJJd8RKJxAPEGp1gfAfb2D3Da2dndRyC4i82tHfjXt7G4EkTk3Wf/B/AuBcQ5zfwFzrE1Edv7/Liebj0bQGeK3bN/0fpuSWIT+Mq5jGt3qhWANZ+MH4pNZ4ozKsYRV+jAhO8P2t7/0AFVCsCGHQccr5mx6Uwxo3+a/C0Nv5pWqQDsdgjAiPfKx+W49Oismc/oTPGgewPWzllcSS1TAI6KgHl/UIQ9H37BMbqK6Kx6tOjx2TCeDsdP9H5dQ8XzGVxOMSsA50xxbo1bxJOLAbzu96PyhQ838+wS/e3wCjRNk/dPW7y4lGRSAC5Jge073ugvGZd3m30ejxo9Mr4bOe2o1+subZ8WiKHBg4jEYgXgqOgYEvNjU6sX2To44XGfAMLjDEgxfUbSkyGBXIw3KgDXc8C1Ls6smTU+sLr0tR1BbG4XojJsetctEjsmu1l2gMCjVeZuMzIP62NJfEZxdGadiDm20P1C7EOE3S5SAM6Zu81Ok84loYCjYrfpzJoZm84Uh90qVIDz/NGH0AEgNQb7UmkAAAAASUVORK5CYIILAAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAcwIAAAKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAAghJREFUOE+lk/tLU3EYxs8/EppdVSQwSrwikpQKhj+EaAjKaqQNhhdwKMNk4A1RFKMI0YVBROyXgZdUzEqTrZhTh9dCloiXKAdDEFEfz/PC/JogBh74cuCc83ye570cDee8NOrrehb+ObXdc7C89MHcNgVjkwf5td9w3zKB9NIxJJd8RKJxAPEGp1gfAfb2D3Da2dndRyC4i82tHfjXt7G4EkTk3Wf/B/AuBcQ5zfwFzrE1Edv7/Liebj0bQGeK3bN/0fpuSWIT+Mq5jGt3qhWANZ+MH4pNZ4ozKsYRV+jAhO8P2t7/0AFVCsCGHQccr5mx6Uwxo3+a/C0Nv5pWqQDsdgjAiPfKx+W49Oismc/oTPGgewPWzllcSS1TAI6KgHl/UIQ9H37BMbqK6Kx6tOjx2TCeDsdP9H5dQ8XzGVxOMSsA50xxbo1bxJOLAbzu96PyhQ838+wS/e3wCjRNk/dPW7y4lGRSAC5Jge073ugvGZd3m30ejxo9Mr4bOe2o1+subZ8WiKHBg4jEYgXgqOgYEvNjU6sX2To44XGfAMLjDEgxfUbSkyGBXIw3KgDXc8C1Ls6smTU+sLr0tR1BbG4XojJsetctEjsmu1l2gMCjVeZuMzIP62NJfEZxdGadiDm20P1C7EOE3S5SAM6Zu81Ok84loYCjYrfpzJoZm84Uh90qVIDz/NGH0AEgNQb7UmkAAAAASUVORK5CYIILAAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAcwIAAAKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAAghJREFUOE+lk/tLU3EYxs8/EppdVSQwSrwikpQKhj+EaAjKaqQNhhdwKMNk4A1RFKMI0YVBROyXgZdUzEqTrZhTh9dCloiXKAdDEFEfz/PC/JogBh74cuCc83ye570cDee8NOrrehb+ObXdc7C89MHcNgVjkwf5td9w3zKB9NIxJJd8RKJxAPEGp1gfAfb2D3Da2dndRyC4i82tHfjXt7G4EkTk3Wf/B/AuBcQ5zfwFzrE1Edv7/Liebj0bQGeK3bN/0fpuSWIT+Mq5jGt3qhWANZ+MH4pNZ4ozKsYRV+jAhO8P2t7/0AFVCsCGHQccr5mx6Uwxo3+a/C0Nv5pWqQDsdgjAiPfKx+W49Oismc/oTPGgewPWzllcSS1TAI6KgHl/UIQ9H37BMbqK6Kx6tOjx2TCeDsdP9H5dQ8XzGVxOMSsA50xxbo1bxJOLAbzu96PyhQ838+wS/e3wCjRNk/dPW7y4lGRSAC5Jge073ugvGZd3m30ejxo9Mr4bOe2o1+subZ8WiKHBg4jEYgXgqOgYEvNjU6sX2To44XGfAMLjDEgxfUbSkyGBXIw3KgDXc8C1Ls6smTU+sLr0tR1BbG4XojJsetctEjsmu1l2gMCjVeZuMzIP62NJfEZxdGadiDm20P1C7EOE3S5SAM6Zu81Ok84loYCjYrfpzJoZm84Uh90qVIDz/NGH0AEgNQb7UmkAAAAASUVORK5CYIILAAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAcwIAAAKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAAghJREFUOE+lk/tLU3EYxs8/EppdVSQwSrwikpQKhj+EaAjKaqQNhhdwKMNk4A1RFKMI0YVBROyXgZdUzEqTrZhTh9dCloiXKAdDEFEfz/PC/JogBh74cuCc83ye570cDee8NOrrehb+ObXdc7C89MHcNgVjkwf5td9w3zKB9NIxJJd8RKJxAPEGp1gfAfb2D3Da2dndRyC4i82tHfjXt7G4EkTk3Wf/B/AuBcQ5zfwFzrE1Edv7/Liebj0bQGeK3bN/0fpuSWIT+Mq5jGt3qhWANZ+MH4pNZ4ozKsYRV+jAhO8P2t7/0AFVCsCGHQccr5mx6Uwxo3+a/C0Nv5pWqQDsdgjAiPfKx+W49Oismc/oTPGgewPWzllcSS1TAI6KgHl/UIQ9H37BMbqK6Kx6tOjx2TCeDsdP9H5dQ8XzGVxOMSsA50xxbo1bxJOLAbzu96PyhQ838+wS/e3wCjRNk/dPW7y4lGRSAC5Jge073ugvGZd3m30ejxo9Mr4bOe2o1+subZ8WiKHBg4jEYgXgqOgYEvNjU6sX2To44XGfAMLjDEgxfUbSkyGBXIw3KgDXc8C1Ls6smTU+sLr0tR1BbG4XojJsetctEjsmu1l2gMCjVeZuMzIP62NJfEZxdGadiDm20P1C7EOE3S5SAM6Zu81Ok84loYCjYrfpzJoZm84Uh90qVIDz/NGH0AEgNQb7UmkAAAAASUVORK5CYIILAAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0yLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAcwIAAAKJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAABc1JHQgCuzhzpAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAAghJREFUOE+lk/tLU3EYxs8/EppdVSQwSrwikpQKhj+EaAjKaqQNhhdwKMNk4A1RFKMI0YVBROyXgZdUzEqTrZhTh9dCloiXKAdDEFEfz/PC/JogBh74cuCc83ye570cDee8NOrrehb+ObXdc7C89MHcNgVjkwf5td9w3zKB9NIxJJd8RKJxAPEGp1gfAfb2D3Da2dndRyC4i82tHfjXt7G4EkTk3Wf/B/AuBcQ5zfwFzrE1Edv7/Liebj0bQGeK3bN/0fpuSWIT+Mq5jGt3qhWANZ+MH4pNZ4ozKsYRV+jAhO8P2t7/0AFVCsCGHQccr5mx6Uwxo3+a/C0Nv5pWqQDsdgjAiPfKx+W49Oismc/oTPGgewPWzllcSS1TAI6KgHl/UIQ9H37BMbqK6Kx6tOjx2TCeDsdP9H5dQ8XzGVxOMSsA50xxbo1bxJOLAbzu96PyhQ838+wS/e3wCjRNk/dPW7y4lGRSAC5Jge073ugvGZd3m30ejxo9Mr4bOe2o1+subZ8WiKHBg4jEYgXgqOgYEvNjU6sX2To44XGfAMLjDEgxfUbSkyGBXIw3KgDXc8C1Ls6smTU+sLr0tR1BbG4XojJsetctEjsmu1l2gMCjVeZuMzIP62NJfEZxdGadiDm20P1C7EOE3S5SAM6Zu81Ok84loYCjYrfpzJoZm84Uh90qVIDz/NGH0AEgNQb7UmkAAAAASUVORK5CYIIL
\ No newline at end of file
diff --git a/GMAC1098/GMAssetCompiler/GMAction.cs b/GMAC1098/GMAssetCompiler/GMAction.cs
new file mode 100644
index 0000000..d15bcde
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMAction.cs
@@ -0,0 +1,203 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMAction
+ {
+ private static int countScript;
+
+ public int LibID
+ {
+ get;
+ private set;
+ }
+
+ public int ID
+ {
+ get;
+ private set;
+ }
+
+ public eAction Kind
+ {
+ get;
+ private set;
+ }
+
+ public bool UseRelative
+ {
+ get;
+ private set;
+ }
+
+ public bool IsQuestion
+ {
+ get;
+ private set;
+ }
+
+ public bool UseApplyTo
+ {
+ get;
+ private set;
+ }
+
+ public eExecuteTypes ExeType
+ {
+ get;
+ private set;
+ }
+
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public string Code
+ {
+ get;
+ private set;
+ }
+
+ public int ArgumentCount
+ {
+ get;
+ private set;
+ }
+
+ public IList ArgTypes
+ {
+ get;
+ private set;
+ }
+
+ public int Who
+ {
+ get;
+ private set;
+ }
+
+ public bool Relative
+ {
+ get;
+ private set;
+ }
+
+ public IList Args
+ {
+ get;
+ private set;
+ }
+
+ public bool IsNot
+ {
+ get;
+ private set;
+ }
+
+ public GMAction(GMAssets _a, Stream _stream)
+ {
+ _stream.ReadInteger();
+ LibID = _stream.ReadInteger();
+ ID = _stream.ReadInteger();
+ Kind = (eAction)_stream.ReadInteger();
+ UseRelative = _stream.ReadBoolean();
+ IsQuestion = _stream.ReadBoolean();
+ UseApplyTo = _stream.ReadBoolean();
+ ExeType = (eExecuteTypes)_stream.ReadInteger();
+ Name = _stream.ReadString();
+ Code = _stream.ReadString();
+ ArgumentCount = _stream.ReadInteger();
+ int num = _stream.ReadInteger();
+ ArgTypes = new List(num);
+ for (int i = 0; i < num; i++)
+ {
+ ArgTypes.Add((eArgTypes)_stream.ReadInteger());
+ }
+ Who = _stream.ReadInteger();
+ Relative = _stream.ReadBoolean();
+ num = _stream.ReadInteger();
+ Args = new List(num);
+ for (int j = 0; j < num; j++)
+ {
+ Args.Add(_stream.ReadString());
+ }
+ IsNot = _stream.ReadBoolean();
+ }
+
+ public GMAction(int _id, string _code)
+ {
+ LibID = 1;
+ ID = _id;
+ Kind = eAction.ACT_CODE;
+ UseRelative = false;
+ IsQuestion = false;
+ UseApplyTo = true;
+ ExeType = eExecuteTypes.EXE_CODE;
+ Name = string.Empty;
+ Code = string.Empty;
+ ArgumentCount = 1;
+ ArgTypes = new List(1);
+ ArgTypes.Add(eArgTypes.ARG_STRING);
+ Who = -1;
+ Relative = false;
+ Args = new List(1);
+ Args.Add(_code);
+ IsNot = false;
+ }
+
+ public void Compile(GMAssets _assets)
+ {
+ switch (Kind)
+ {
+ case eAction.ACT_VARIABLE:
+ if (Relative)
+ {
+ Code = Code + Args[0] + " += " + Args[1];
+ }
+ else
+ {
+ Code = Code + Args[0] + " = " + Args[1];
+ }
+ Kind = eAction.ACT_NORMAL;
+ Args.Clear();
+ break;
+ case eAction.ACT_CODE:
+ Code = Args[0];
+ Kind = eAction.ACT_NORMAL;
+ Args.Clear();
+ if (Program.RemoveDND)
+ {
+ List _errors = null;
+ bool inhibitErrorOutput = Program.InhibitErrorOutput;
+ Program.InhibitErrorOutput = true;
+ GMLCompile.Compile(_assets, "test_compile", Code, out _errors);
+ Program.InhibitErrorOutput = inhibitErrorOutput;
+ if (_errors.Count > 0)
+ {
+ foreach (GMLError item2 in _errors)
+ {
+ eErrorKind kind = item2.Kind;
+ if (kind == eErrorKind.Warning_Unclosed_Comment)
+ {
+ Code += "*/";
+ }
+ }
+ }
+ }
+ break;
+ }
+ if (IsQuestion && ExeType == eExecuteTypes.EXE_CODE)
+ {
+ Name = string.Format("__script{0}__", countScript);
+ GMScript value = new GMScript(Code);
+ KeyValuePair item = new KeyValuePair(Name, value);
+ _assets.Scripts.Add(item);
+ countScript++;
+ ExeType = eExecuteTypes.EXE_FUNCTION;
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMAssets.cs b/GMAC1098/GMAssetCompiler/GMAssets.cs
new file mode 100644
index 0000000..bffc041
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMAssets.cs
@@ -0,0 +1,779 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMAssets
+ {
+ private delegate T Factory(GMAssets _this, Stream _s);
+
+ private static byte[] map1 = new byte[256];
+
+ private static byte[] map2 = new byte[256];
+
+ public int Magic
+ {
+ get;
+ private set;
+ }
+
+ public int Version
+ {
+ get;
+ private set;
+ }
+
+ public bool Debug
+ {
+ get;
+ private set;
+ }
+
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public int GameID
+ {
+ get;
+ private set;
+ }
+
+ public Guid GameGUID
+ {
+ get;
+ private set;
+ }
+
+ public IList Extensions
+ {
+ get;
+ private set;
+ }
+
+ public IList Triggers
+ {
+ get;
+ private set;
+ }
+
+ public IList> Sounds
+ {
+ get;
+ private set;
+ }
+
+ public IList> Sprites
+ {
+ get;
+ private set;
+ }
+
+ public IList> Backgrounds
+ {
+ get;
+ private set;
+ }
+
+ public IList> Paths
+ {
+ get;
+ private set;
+ }
+
+ public IList> Scripts
+ {
+ get;
+ private set;
+ }
+
+ public IList> Fonts
+ {
+ get;
+ private set;
+ }
+
+ public IList> TimeLines
+ {
+ get;
+ private set;
+ }
+
+ public IList> Objects
+ {
+ get;
+ private set;
+ }
+
+ public IList> Rooms
+ {
+ get;
+ private set;
+ }
+
+ public IList> DataFiles
+ {
+ get;
+ private set;
+ }
+
+ public IList Libraries
+ {
+ get;
+ private set;
+ }
+
+ public IList RoomOrder
+ {
+ get;
+ private set;
+ }
+
+ public GMHelp Help
+ {
+ get;
+ private set;
+ }
+
+ public int RoomMaxId
+ {
+ get;
+ private set;
+ }
+
+ public int RoomMaxTileId
+ {
+ get;
+ private set;
+ }
+
+ public string FileName
+ {
+ get;
+ set;
+ }
+
+ public GMOptions Options
+ {
+ get;
+ private set;
+ }
+
+ public bool DNDRemoved
+ {
+ get;
+ set;
+ }
+
+ internal GMAssets(Stream _s, bool _gmk)
+ {
+ Magic = _s.ReadInteger();
+ Version = _s.ReadInteger();
+ Stream stream = _s;
+ byte[] array = null;
+ if (Version >= 701)
+ {
+ int num = stream.ReadInteger();
+ int num2 = stream.ReadInteger();
+ for (int i = 0; i <= num - 1; i++)
+ {
+ stream.ReadInteger();
+ }
+ int key = stream.ReadInteger();
+ for (int j = 0; j <= num2 - 1; j++)
+ {
+ stream.ReadInteger();
+ }
+ long position = stream.Position;
+ array = new byte[stream.Length];
+ stream.Position = 0L;
+ stream.Read(array, 0, (int)stream.Length);
+ Decrypt2(key, array, position + 1);
+ MemoryStream memoryStream = new MemoryStream(array, false);
+ stream = memoryStream;
+ stream.Position = position;
+ }
+ if (Version < 600)
+ {
+ stream.ReadInteger();
+ }
+ GameID = stream.ReadInteger();
+ GameGUID = stream.ReadGuid();
+ Extensions = new List();
+ Triggers = new List();
+ Sounds = new List>();
+ Sprites = new List>();
+ Backgrounds = new List>();
+ Paths = new List>();
+ Scripts = new List>();
+ Fonts = new List>();
+ TimeLines = new List>();
+ Objects = new List>();
+ Rooms = new List>();
+ DataFiles = new List>();
+ Libraries = new List();
+ RoomOrder = new List();
+ Options = new GMOptions(this, stream, true);
+ LoadGMK(Sounds, stream, (GMAssets _t, Stream _st) => new GMSound(_t, _st));
+ LoadGMK(Sprites, stream, (GMAssets _t, Stream _st) => new GMSprite(_t, _st));
+ LoadGMK(Backgrounds, stream, (GMAssets _t, Stream _st) => new GMBackground(_t, _st));
+ LoadGMK(Paths, stream, (GMAssets _t, Stream _st) => new GMPath(_t, _st));
+ LoadGMK(Scripts, stream, (GMAssets _t, Stream _st) => new GMScript(_t, _st));
+ LoadGMK(Fonts, stream, (GMAssets _t, Stream _st) => new GMFont(_t, _st));
+ LoadGMK(TimeLines, stream, (GMAssets _t, Stream _st) => new GMTimeLine(_t, _st));
+ LoadGMK(Objects, stream, (GMAssets _t, Stream _st) => new GMObject(_t, _st));
+ LoadGMK(Rooms, stream, (GMAssets _t, Stream _st) => new GMRoom(_t, _st, true));
+ RoomMaxId = stream.ReadInteger();
+ RoomMaxTileId = stream.ReadInteger();
+ LoadGMK_GMDataFile(DataFiles, stream);
+ LoadGMK_GMExtension(Extensions, stream);
+ Help = new GMHelp(this, stream);
+ Library_Load(stream);
+ }
+
+ private void LoadGMK(IList> _list, Stream _s, Factory _factory)
+ {
+ _s.ReadInteger();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ if (_s.ReadBoolean())
+ {
+ string key = _s.ReadString();
+ T value = _factory(this, _s);
+ _list.Add(new KeyValuePair(key, value));
+ }
+ }
+ }
+
+ private void LoadGMK_GMDataFile(IList> _list, Stream _s)
+ {
+ _s.ReadInteger();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ string key = _s.ReadString();
+ GMDataFile value = new GMDataFile(this, _s);
+ _list.Add(new KeyValuePair(key, value));
+ }
+ }
+
+ private void LoadGMK_GMExtension(IList _list, Stream _s)
+ {
+ _s.ReadInteger();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ _s.ReadString();
+ GMExtension item = new GMExtension(this, _s);
+ _list.Add(item);
+ }
+ }
+
+ internal GMAssets(Stream _s)
+ {
+ Magic = _s.ReadInteger();
+ Version = _s.ReadInteger();
+ if (Version == 810)
+ {
+ _s.ReadInteger();
+ }
+ Debug = _s.ReadBoolean();
+ if (Version == 810)
+ {
+ _s.ReadInteger();
+ }
+ Options = new GMOptions(this, _s);
+ Name = _s.ReadString();
+ _s.ReadCompressedStream();
+ Stream stream = null;
+ byte[] array = null;
+ if (Version != 800 && Version != 810)
+ {
+ array = _s.ReadCompressedStream();
+ stream = new MemoryStream(array);
+ }
+ else
+ {
+ stream = _s;
+ }
+ if (Version == 800 || Version == 810)
+ {
+ stream = stream.ReadStreamE();
+ int num = stream.ReadInteger();
+ for (int i = 1; i <= num; i++)
+ {
+ stream.ReadInteger();
+ }
+ stream.ReadBoolean();
+ }
+ else
+ {
+ int num2 = stream.ReadInteger();
+ int num3 = stream.ReadInteger();
+ for (int j = 0; j <= num2 - 1; j++)
+ {
+ stream.ReadInteger();
+ }
+ int key = stream.ReadInteger();
+ for (int k = 0; k <= num3 - 1; k++)
+ {
+ stream.ReadInteger();
+ }
+ long position = stream.Position;
+ Decrypt2(key, array, position + 1);
+ stream.ReadInteger();
+ }
+ GameID = stream.ReadInteger();
+ GameGUID = stream.ReadGuid();
+ Extensions = new List();
+ Triggers = new List();
+ Sounds = new List>();
+ Sprites = new List>();
+ Backgrounds = new List>();
+ Paths = new List>();
+ Scripts = new List>();
+ Fonts = new List>();
+ TimeLines = new List>();
+ Objects = new List>();
+ Rooms = new List>();
+ DataFiles = new List>();
+ Libraries = new List();
+ RoomOrder = new List();
+ Extensions_Load(stream);
+ if (Version == 800 || Version == 810)
+ {
+ Trigger_Load(stream);
+ Constant_Load(stream);
+ }
+ Sound_Load(stream);
+ Sprite_Load(stream);
+ Background_Load(stream);
+ Path_Load(stream);
+ Script_Load(stream);
+ Font_Load(stream);
+ TimeLine_Load(stream);
+ Object_Load(stream);
+ Room_Load(stream);
+ DataFile_Load(stream);
+ Help = new GMHelp(this, stream);
+ Library_Load(stream);
+ Room_LoadOrder(stream);
+ }
+
+ public void Extensions_Load(Stream _s)
+ {
+ _s.ReadInteger();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ GMExtension item = new GMExtension(this, _s);
+ Extensions.Add(item);
+ }
+ }
+
+ public void Trigger_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ if (num != 800)
+ {
+ return;
+ }
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s.ReadStreamC();
+ if (s.ReadBoolean())
+ {
+ Triggers.Add(new GMTrigger(this, s));
+ }
+ }
+ }
+
+ public void Constant_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ if (num == 800)
+ {
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ string key = _s.ReadString();
+ string value = _s.ReadString();
+ Options.Constants[key] = value;
+ }
+ }
+ }
+
+ public void Sound_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s;
+ if (num == 800)
+ {
+ s = _s.ReadStreamC();
+ }
+ bool flag = s.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = s.ReadString();
+ GMSound value = new GMSound(this, s);
+ item = new KeyValuePair(key, value);
+ }
+ Sounds.Add(item);
+ }
+ }
+
+ public void Sprite_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s;
+ if (num == 800)
+ {
+ s = _s.ReadStreamC();
+ }
+ bool flag = s.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = s.ReadString();
+ GMSprite value = new GMSprite(this, s);
+ item = new KeyValuePair(key, value);
+ }
+ Sprites.Add(item);
+ }
+ }
+
+ public void Background_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s;
+ if (num == 800)
+ {
+ s = _s.ReadStreamC();
+ }
+ bool flag = s.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = s.ReadString();
+ GMBackground value = new GMBackground(this, s);
+ item = new KeyValuePair(key, value);
+ }
+ Backgrounds.Add(item);
+ }
+ }
+
+ public void Path_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s;
+ if (num == 800)
+ {
+ s = _s.ReadStreamC();
+ }
+ bool flag = s.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = s.ReadString();
+ GMPath value = new GMPath(this, s);
+ item = new KeyValuePair(key, value);
+ }
+ Paths.Add(item);
+ }
+ }
+
+ public void Script_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s;
+ if (num == 800)
+ {
+ s = _s.ReadStreamC();
+ }
+ bool flag = s.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = s.ReadString();
+ GMScript value = new GMScript(this, s);
+ item = new KeyValuePair(key, value);
+ }
+ Scripts.Add(item);
+ }
+ }
+
+ public void Font_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream s = _s;
+ if (num == 800)
+ {
+ s = _s.ReadStreamC();
+ }
+ bool flag = s.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = s.ReadString();
+ GMFont value = new GMFont(this, s);
+ item = new KeyValuePair(key, value);
+ }
+ Fonts.Add(item);
+ }
+ }
+
+ public void TimeLine_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream stream = _s;
+ if (num == 800)
+ {
+ stream = _s.ReadStreamC();
+ }
+ bool flag = stream.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = stream.ReadString();
+ GMTimeLine value = new GMTimeLine(this, stream);
+ item = new KeyValuePair(key, value);
+ }
+ TimeLines.Add(item);
+ }
+ }
+
+ public void Object_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream stream = _s;
+ if (num == 800)
+ {
+ stream = _s.ReadStreamC();
+ }
+ bool flag = stream.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = stream.ReadString();
+ GMObject value = new GMObject(this, stream);
+ item = new KeyValuePair(key, value);
+ }
+ Objects.Add(item);
+ }
+ }
+
+ public void Room_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream stream = _s;
+ if (num == 800)
+ {
+ stream = _s.ReadStreamC();
+ }
+ bool flag = stream.ReadBoolean();
+ KeyValuePair item = default(KeyValuePair);
+ if (flag)
+ {
+ string key = stream.ReadString();
+ GMRoom value = new GMRoom(this, stream);
+ item = new KeyValuePair(key, value);
+ }
+ Rooms.Add(item);
+ }
+ RoomMaxId = _s.ReadInteger();
+ RoomMaxTileId = _s.ReadInteger();
+ }
+
+ public void DataFile_Load(Stream _s)
+ {
+ int num = _s.ReadInteger();
+ int num2 = _s.ReadInteger();
+ for (int i = 0; i < num2; i++)
+ {
+ Stream stream = _s;
+ if (num == 800)
+ {
+ stream = _s.ReadStreamC();
+ }
+ KeyValuePair keyValuePair = default(KeyValuePair);
+ GMDataFile value = new GMDataFile(this, stream);
+ keyValuePair = new KeyValuePair("datafile" + i, value);
+ DataFiles.Add(keyValuePair);
+ }
+ }
+
+ public void Library_Load(Stream _s)
+ {
+ _s.ReadInteger();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ Libraries.Add(_s.ReadString());
+ }
+ }
+
+ public void Room_LoadOrder(Stream _s)
+ {
+ _s.ReadInteger();
+ int num = _s.ReadInteger();
+ if (num >= 0)
+ {
+ RoomOrder = new List(num);
+ for (int i = 0; i < num; i++)
+ {
+ RoomOrder.Add(_s.ReadInteger());
+ }
+ }
+ }
+
+ private static void SetKey(int _key)
+ {
+ int num = 6 + _key % 250;
+ if (num < 0)
+ {
+ num += 256;
+ }
+ int num2 = _key / 250;
+ if (num2 < 0)
+ {
+ num2 += 256;
+ }
+ for (int i = 0; i <= 255; i++)
+ {
+ map1[i] = (byte)i;
+ }
+ for (int j = 0; j <= 255; j++)
+ {
+ map2[j] = (byte)j;
+ }
+ for (int k = 1; k <= 10000; k++)
+ {
+ int num3 = 1 + (k * num + num2) % 254;
+ byte b = map1[num3];
+ map1[num3] = map1[num3 + 1];
+ map1[num3 + 1] = b;
+ }
+ for (int l = 1; l <= 255; l++)
+ {
+ map2[map1[l]] = (byte)l;
+ }
+ }
+
+ public static void Decrypt(int _key, byte[] _b, long _pos)
+ {
+ SetKey(_key);
+ long num = _b.LongLength - _pos;
+ for (long num2 = _pos; num2 <= _pos + num - 1; num2++)
+ {
+ _b[num2] = map2[_b[num2]];
+ }
+ }
+
+ private static void Decrypt2(int _key, byte[] _b, long _pos)
+ {
+ SetKey(_key);
+ long num = _b.LongLength - _pos;
+ for (long num2 = _pos; num2 <= _pos + num - 1; num2++)
+ {
+ byte b = _b[num2];
+ int num3 = (int)(map2[b] - num2 % 256);
+ if (num3 < 0)
+ {
+ num3 += 256;
+ }
+ _b[num2] = (byte)num3;
+ }
+ }
+
+ public void RemoveDND()
+ {
+ if (!DNDRemoved)
+ {
+ DNDRemoved = true;
+ foreach (KeyValuePair @object in Objects)
+ {
+ GMObject value = @object.Value;
+ if (value != null)
+ {
+ foreach (IList> @event in value.Events)
+ {
+ using (IEnumerator> enumerator3 = @event.GetEnumerator())
+ {
+ while (enumerator3.MoveNext())
+ {
+ RemoveEventDND(_ev: enumerator3.Current.Value, _name: @object.Key);
+ }
+ }
+ }
+ }
+ }
+ foreach (KeyValuePair timeLine in TimeLines)
+ {
+ GMTimeLine value3 = timeLine.Value;
+ if (value3 != null)
+ {
+ using (IEnumerator> enumerator5 = value3.Entries.GetEnumerator())
+ {
+ while (enumerator5.MoveNext())
+ {
+ RemoveEventDND(_ev: enumerator5.Current.Value, _name: timeLine.Key);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void RemoveEventDND(string _name, GMEvent _ev)
+ {
+ if (_ev.Actions.Count > 0)
+ {
+ foreach (GMAction action in _ev.Actions)
+ {
+ action.Compile(this);
+ }
+ string text = _ev.CompressEvent(Scripts);
+ if (Program.CompileVerbose)
+ {
+ Console.WriteLine("Compressed event for {0} - {1}", _name, text);
+ }
+ GMAction item = new GMAction(_ev.Actions[0].ID, text);
+ _ev.Actions.Clear();
+ _ev.Actions.Add(item);
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMBack.cs b/GMAC1098/GMAssetCompiler/GMBack.cs
new file mode 100644
index 0000000..5646221
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMBack.cs
@@ -0,0 +1,107 @@
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMBack
+ {
+ public bool Visible
+ {
+ get;
+ private set;
+ }
+
+ public bool Foreground
+ {
+ get;
+ private set;
+ }
+
+ public int Index
+ {
+ get;
+ private set;
+ }
+
+ public int X
+ {
+ get;
+ private set;
+ }
+
+ public int Y
+ {
+ get;
+ private set;
+ }
+
+ public bool HTiled
+ {
+ get;
+ private set;
+ }
+
+ public bool VTiled
+ {
+ get;
+ private set;
+ }
+
+ public int HSpeed
+ {
+ get;
+ private set;
+ }
+
+ public int VSpeed
+ {
+ get;
+ private set;
+ }
+
+ public double XScale
+ {
+ get;
+ private set;
+ }
+
+ public double YScale
+ {
+ get;
+ private set;
+ }
+
+ public int Blend
+ {
+ get;
+ private set;
+ }
+
+ public double Alpha
+ {
+ get;
+ private set;
+ }
+
+ public bool Stretch
+ {
+ get;
+ private set;
+ }
+
+ public GMBack(Stream _stream)
+ {
+ Visible = _stream.ReadBoolean();
+ Foreground = _stream.ReadBoolean();
+ Index = _stream.ReadInteger();
+ X = _stream.ReadInteger();
+ Y = _stream.ReadInteger();
+ HTiled = _stream.ReadBoolean();
+ VTiled = _stream.ReadBoolean();
+ HSpeed = _stream.ReadInteger();
+ VSpeed = _stream.ReadInteger();
+ Blend = 16777215;
+ Alpha = 1.0;
+ Stretch = _stream.ReadBoolean();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMBackground.cs b/GMAC1098/GMAssetCompiler/GMBackground.cs
new file mode 100644
index 0000000..b12df27
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMBackground.cs
@@ -0,0 +1,75 @@
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMBackground
+ {
+ public int Width
+ {
+ get;
+ private set;
+ }
+
+ public int Height
+ {
+ get;
+ private set;
+ }
+
+ public bool Transparent
+ {
+ get;
+ private set;
+ }
+
+ public bool Smooth
+ {
+ get;
+ private set;
+ }
+
+ public bool Preload
+ {
+ get;
+ private set;
+ }
+
+ public bool Tileset
+ {
+ get;
+ set;
+ }
+
+ public GMBitmap32 Bitmap
+ {
+ get;
+ private set;
+ }
+
+ public GMBackground(GMAssets _a, Stream _s)
+ {
+ switch (_s.ReadInteger())
+ {
+ case 543:
+ Width = _s.ReadInteger();
+ Height = _s.ReadInteger();
+ Transparent = _s.ReadBoolean();
+ Smooth = _s.ReadBoolean();
+ Preload = _s.ReadBoolean();
+ Tileset = false;
+ if (_s.ReadBoolean())
+ {
+ Bitmap = new GMBitmap32(_s);
+ }
+ break;
+ case 710:
+ Bitmap = new GMBitmap32(_s);
+ Width = _s.ReadInteger();
+ Height = _s.ReadInteger();
+ Width = Bitmap.Width;
+ Height = Bitmap.Height;
+ break;
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMBitmap32.cs b/GMAC1098/GMAssetCompiler/GMBitmap32.cs
new file mode 100644
index 0000000..3a9feb1
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMBitmap32.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace GMAssetCompiler
+{
+ public class GMBitmap32
+ {
+ public int Width
+ {
+ get;
+ private set;
+ }
+
+ public int Height
+ {
+ get;
+ private set;
+ }
+
+ public byte[] Data
+ {
+ get;
+ private set;
+ }
+
+ public Bitmap Bitmap
+ {
+ get
+ {
+ Bitmap bitmap = new Bitmap(Width, Height, PixelFormat.Format32bppArgb);
+ Rectangle rect = new Rectangle(0, 0, Width, Height);
+ BitmapData bitmapData = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
+ IntPtr intPtr = bitmapData.Scan0;
+ int num = 0;
+ int num2 = 0;
+ while (num2 < Height)
+ {
+ int num3 = num;
+ IntPtr ptr = intPtr;
+ int num4 = 0;
+ while (num4 < Width)
+ {
+ int val = Data[num3] + (Data[num3 + 1] << 8) + (Data[num3 + 2] << 16) + (Data[num3 + 3] << 24);
+ Marshal.WriteInt32(ptr, val);
+ num4++;
+ ptr = new IntPtr(ptr.ToInt64() + 4);
+ num3 += 4;
+ }
+ num2++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ num += Width * 4;
+ }
+ bitmap.UnlockBits(bitmapData);
+ return bitmap;
+ }
+ }
+
+ public GMBitmap32(Stream _s)
+ {
+ switch (_s.ReadInteger())
+ {
+ case 540:
+ if (_s.ReadBoolean())
+ {
+ Width = _s.ReadInteger();
+ Height = _s.ReadInteger();
+ int width = Width;
+ int height = Height;
+ Data = _s.ReadCompressedStream();
+ }
+ break;
+ case 800:
+ Width = _s.ReadInteger();
+ Height = _s.ReadInteger();
+ Data = _s.ReadStream();
+ break;
+ }
+ }
+
+ public void SetAlphaFromBitmap(GMBitmap32 _other)
+ {
+ int num = Math.Min(Width, _other.Width);
+ int num2 = Math.Min(Height, _other.Height);
+ for (int i = 0; i < num2; i++)
+ {
+ for (int j = 0; j < num; j++)
+ {
+ int num3 = j * 4 + i * _other.Width * 4;
+ int num4 = j * 4 + i * Width * 4;
+ int val = (_other.Data[num4] + _other.Data[num4 + 1] + _other.Data[num4 + 2]) / 3;
+ Data[num3 + 3] = (byte)Math.Min(_other.Data[num4 + 3], val);
+ }
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMDataFile.cs b/GMAC1098/GMAssetCompiler/GMDataFile.cs
new file mode 100644
index 0000000..b27b9b0
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMDataFile.cs
@@ -0,0 +1,100 @@
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMDataFile
+ {
+ public string FileName
+ {
+ get;
+ private set;
+ }
+
+ public string OrigName
+ {
+ get;
+ private set;
+ }
+
+ public bool Exists
+ {
+ get;
+ private set;
+ }
+
+ public int Size
+ {
+ get;
+ private set;
+ }
+
+ public bool Store
+ {
+ get;
+ private set;
+ }
+
+ public byte[] Data
+ {
+ get;
+ private set;
+ }
+
+ public int ExportAction
+ {
+ get;
+ private set;
+ }
+
+ public string ExportDir
+ {
+ get;
+ private set;
+ }
+
+ public bool Overwrite
+ {
+ get;
+ private set;
+ }
+
+ public bool FreeData
+ {
+ get;
+ private set;
+ }
+
+ public bool RemoveEnd
+ {
+ get;
+ private set;
+ }
+
+ public GMDataFile(GMAssets _a, Stream _stream)
+ {
+ int num = _stream.ReadInteger();
+ FileName = _stream.ReadString();
+ OrigName = _stream.ReadString();
+ Exists = _stream.ReadBoolean();
+ Size = _stream.ReadInteger();
+ Store = _stream.ReadBoolean();
+ if (Exists && Store)
+ {
+ switch (num)
+ {
+ case 620:
+ Data = _stream.ReadCompressedStream();
+ break;
+ case 800:
+ Data = _stream.ReadStream();
+ break;
+ }
+ }
+ ExportAction = _stream.ReadInteger();
+ ExportDir = _stream.ReadString();
+ Overwrite = _stream.ReadBoolean();
+ FreeData = _stream.ReadBoolean();
+ RemoveEnd = _stream.ReadBoolean();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMEvent.cs b/GMAC1098/GMAssetCompiler/GMEvent.cs
new file mode 100644
index 0000000..f6bcff4
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMEvent.cs
@@ -0,0 +1,380 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace GMAssetCompiler
+{
+ public class GMEvent
+ {
+ private static Stack RelativeStack = new Stack();
+
+ private static bool conditionVar = false;
+
+ public List Actions
+ {
+ get;
+ set;
+ }
+
+ public GMEvent(GMAssets _a, Stream _stream)
+ {
+ _stream.ReadInteger();
+ int num = _stream.ReadInteger();
+ Actions = new List(num);
+ for (int i = 0; i < num; i++)
+ {
+ Actions.Add(new GMAction(_a, _stream));
+ }
+ }
+
+ private int CompressExit(int n, StringBuilder _sb)
+ {
+ if (RelativeStack.Count > 0)
+ {
+ _sb.AppendLine("action_set_relative( 0 );");
+ }
+ _sb.AppendLine("exit;");
+ return n + 1;
+ }
+
+ private int CompressBlock(int n, StringBuilder _sb)
+ {
+ _sb.AppendLine("{");
+ for (n++; n < Actions.Count; n = CompressAction(n, _sb))
+ {
+ GMAction gMAction = Actions[n];
+ if (gMAction.Kind == eAction.ACT_END)
+ {
+ n++;
+ break;
+ }
+ }
+ _sb.AppendLine("}");
+ return n;
+ }
+
+ private int CompressRepeat(int n, StringBuilder _sb)
+ {
+ GMAction gMAction = Actions[n];
+ _sb.AppendFormat("repeat( {0} )", gMAction.Args[0]);
+ return CompressAction(n + 1, _sb);
+ }
+
+ private int CompressCondition(int n, StringBuilder _sb)
+ {
+ GMAction gMAction = Actions[n];
+ bool flag = false;
+ bool flag2 = false;
+ if (gMAction.UseApplyTo)
+ {
+ switch (gMAction.Who)
+ {
+ case -2:
+ _sb.AppendLine("with( other ) ");
+ flag = true;
+ break;
+ default:
+ _sb.AppendLine(string.Format("with( {0} ) ", gMAction.Who));
+ flag = true;
+ flag2 = true;
+ break;
+ case -1:
+ break;
+ }
+ }
+ flag = (flag || (gMAction.UseRelative && RelativeStack.Count > 0 && RelativeStack.Peek() != gMAction.Relative));
+ if (flag)
+ {
+ _sb.AppendLine("{");
+ }
+ if (!conditionVar)
+ {
+ _sb.AppendLine("var __b__;");
+ conditionVar = true;
+ }
+ bool flag3 = PushRelativeness(_sb, gMAction);
+ switch (gMAction.ExeType)
+ {
+ case eExecuteTypes.EXE_FUNCTION:
+ if (gMAction.Name == "action_execute_script")
+ {
+ _sb.AppendFormat("__b__ = ");
+ CompressExecuteScriptAction(n, gMAction, _sb);
+ }
+ else
+ {
+ _sb.AppendFormat("__b__ = {0}( ", gMAction.Name);
+ CompressFunctionArguments(_sb, gMAction);
+ _sb.AppendLine(" );");
+ }
+ break;
+ case eExecuteTypes.EXE_CODE:
+ _sb.AppendFormat("__b__ = {0};", gMAction.Code);
+ _sb.AppendLine("");
+ break;
+ }
+ if (flag2)
+ {
+ _sb.AppendFormat("if {0}__b__ break;", gMAction.IsNot ? "!" : "");
+ _sb.AppendLine("");
+ }
+ if (flag3)
+ {
+ PopRelativeness(_sb);
+ }
+ if (flag)
+ {
+ _sb.AppendLine("}");
+ }
+ if (gMAction.IsNot)
+ {
+ _sb.AppendLine("if !__b__");
+ }
+ else
+ {
+ _sb.AppendLine("if __b__");
+ }
+ _sb.AppendLine("{");
+ n = CompressAction(n + 1, _sb);
+ _sb.AppendLine("}");
+ if (n < Actions.Count && Actions[n].Kind == eAction.ACT_ELSE)
+ {
+ _sb.AppendLine("else");
+ _sb.AppendLine("{");
+ n = CompressAction(n + 1, _sb);
+ _sb.AppendLine("}");
+ }
+ return n;
+ }
+
+ private static void PopRelativeness(StringBuilder _sb)
+ {
+ bool flag = RelativeStack.Pop();
+ if (RelativeStack.Peek() != flag)
+ {
+ _sb.AppendLine(string.Format("action_set_relative( {0} );", RelativeStack.Peek() ? 1 : 0));
+ }
+ }
+
+ private static bool PushRelativeness(StringBuilder _sb, GMAction action)
+ {
+ bool result = false;
+ if (action.UseRelative && RelativeStack.Count > 0 && RelativeStack.Peek() != action.Relative)
+ {
+ _sb.AppendLine(string.Format("action_set_relative( {0} );", action.Relative ? 1 : 0));
+ RelativeStack.Push(action.Relative);
+ result = true;
+ }
+ return result;
+ }
+
+ private int CompressNormalAction(int n, StringBuilder _sb)
+ {
+ GMAction gMAction = Actions[n];
+ if (gMAction.ExeType != 0)
+ {
+ bool flag = false;
+ if (gMAction.UseApplyTo)
+ {
+ switch (gMAction.Who)
+ {
+ case -2:
+ _sb.AppendLine("with( other ) ");
+ flag = true;
+ break;
+ default:
+ _sb.AppendLine(string.Format("with( {0} ) ", gMAction.Who));
+ flag = true;
+ break;
+ case -1:
+ break;
+ }
+ }
+ flag = (flag || (gMAction.UseRelative && RelativeStack.Count > 0 && RelativeStack.Peek() != gMAction.Relative));
+ if (flag)
+ {
+ _sb.AppendLine("{");
+ }
+ bool flag2 = PushRelativeness(_sb, gMAction);
+ switch (gMAction.ExeType)
+ {
+ case eExecuteTypes.EXE_FUNCTION:
+ if (gMAction.Name == "action_execute_script")
+ {
+ CompressExecuteScriptAction(n, gMAction, _sb);
+ break;
+ }
+ _sb.AppendFormat("{0}( ", gMAction.Name);
+ CompressFunctionArguments(_sb, gMAction);
+ _sb.AppendLine(" );");
+ break;
+ case eExecuteTypes.EXE_CODE:
+ _sb.AppendLine(gMAction.Code);
+ break;
+ }
+ if (flag2)
+ {
+ PopRelativeness(_sb);
+ }
+ if (flag)
+ {
+ _sb.AppendLine("}");
+ }
+ }
+ return n + 1;
+ }
+
+ private static void CompressFunctionArguments(StringBuilder _sb, GMAction action)
+ {
+ for (int i = 0; i < action.ArgumentCount; i++)
+ {
+ if (i > 0)
+ {
+ _sb.Append(", ");
+ }
+ switch (action.ArgTypes[i])
+ {
+ case eArgTypes.ARG_STRING:
+ case eArgTypes.ARG_STRINGEXP:
+ if (action.Args[i].StartsWith("'") || action.Args[i].StartsWith("\""))
+ {
+ _sb.AppendFormat("{0}", action.Args[i]);
+ }
+ else
+ {
+ _sb.AppendFormat("\"{0}\"", action.Args[i]);
+ }
+ break;
+ case eArgTypes.ARG_CONSTANT:
+ case eArgTypes.ARG_EXPRESSION:
+ case eArgTypes.ARG_BOOLEAN:
+ case eArgTypes.ARG_MENU:
+ case eArgTypes.ARG_SPRITE:
+ case eArgTypes.ARG_SOUND:
+ case eArgTypes.ARG_BACKGROUND:
+ case eArgTypes.ARG_PATH:
+ case eArgTypes.ARG_SCRIPT:
+ case eArgTypes.ARG_OBJECT:
+ case eArgTypes.ARG_ROOM:
+ case eArgTypes.ARG_FONTR:
+ case eArgTypes.ARG_COLOR:
+ case eArgTypes.ARG_TIMELINE:
+ case eArgTypes.ARG_FONT:
+ _sb.Append(action.Args[i]);
+ break;
+ }
+ }
+ }
+
+ private int CompressAction(int n, StringBuilder _sb)
+ {
+ if (n < Actions.Count)
+ {
+ GMAction gMAction = Actions[n];
+ switch (gMAction.Kind)
+ {
+ case eAction.ACT_EXIT:
+ return CompressExit(n, _sb);
+ case eAction.ACT_BEGIN:
+ return CompressBlock(n, _sb);
+ case eAction.ACT_REPEAT:
+ return CompressRepeat(n, _sb);
+ default:
+ if (gMAction.IsQuestion)
+ {
+ return CompressCondition(n, _sb);
+ }
+ return CompressNormalAction(n, _sb);
+ }
+ }
+ return n;
+ }
+
+ private int CompressExecuteScriptAction(int n, GMAction _action, StringBuilder _sb)
+ {
+ if (_action.Args.Count == 8)
+ {
+ int num = int.Parse(_action.Args[0]);
+ if (num >= 0)
+ {
+ string key = Program.Assets.Scripts[num].Key;
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.AppendFormat("{0}(", key);
+ for (int i = 1; i < 6; i++)
+ {
+ if (!string.IsNullOrEmpty(_action.Args[i]))
+ {
+ if (i >= 2)
+ {
+ stringBuilder.Append(",");
+ }
+ stringBuilder.AppendFormat("{0}", _action.Args[i]);
+ }
+ }
+ stringBuilder.Append(");");
+ _sb.AppendLine(stringBuilder.ToString());
+ }
+ else
+ {
+ Console.WriteLine("Execute script action is not bound to a script");
+ }
+ }
+ else
+ {
+ Console.WriteLine("Failed to parse action_execute_script() - incorrect number of arguments received\n");
+ }
+ return n + 1;
+ }
+
+ public string CompressEvent(IList> _scripts)
+ {
+ RelativeStack.Clear();
+ conditionVar = false;
+ int num = 0;
+ bool flag = false;
+ for (int i = 0; i < Actions.Count; i++)
+ {
+ if (Actions[i].UseRelative)
+ {
+ if (flag != Actions[i].Relative)
+ {
+ num++;
+ }
+ flag = Actions[i].Relative;
+ }
+ }
+ if (num > 0)
+ {
+ for (int j = 0; j < Actions.Count; j++)
+ {
+ if (Actions[j].UseRelative)
+ {
+ RelativeStack.Push(Actions[j].Relative);
+ break;
+ }
+ }
+ }
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.AppendLine("{");
+ if (RelativeStack.Count > 0)
+ {
+ stringBuilder.AppendLine(string.Format("action_set_relative( {0} );", RelativeStack.Peek() ? 1 : 0));
+ }
+ for (int num2 = 0; num2 < Actions.Count; num2 = ((!(Actions[num2].Name == "action_execute_script")) ? CompressAction(num2, stringBuilder) : CompressExecuteScriptAction(num2, Actions[num2], stringBuilder)))
+ {
+ }
+ if (RelativeStack.Count > 0)
+ {
+ stringBuilder.AppendLine("action_set_relative( 0 );");
+ RelativeStack.Pop();
+ }
+ if (RelativeStack.Count != 0)
+ {
+ Console.WriteLine("Unbalanced RelativeStack... need to rebalance now\n");
+ }
+ stringBuilder.AppendLine("}");
+ return stringBuilder.ToString();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMExtension.cs b/GMAC1098/GMAssetCompiler/GMExtension.cs
new file mode 100644
index 0000000..c41399f
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMExtension.cs
@@ -0,0 +1,61 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMExtension
+ {
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public string Folder
+ {
+ get;
+ private set;
+ }
+
+ public IList Includes
+ {
+ get;
+ private set;
+ }
+
+ public IList ExtensionDLL
+ {
+ get;
+ private set;
+ }
+
+ public GMExtension(GMAssets _a, Stream _s)
+ {
+ _s.ReadInteger();
+ Name = _s.ReadString();
+ Folder = _s.ReadString();
+ Includes = new List();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ Includes.Add(new GMExtensionInclude(_s));
+ }
+ byte[] array = _s.ReadStream();
+ if (array == null)
+ {
+ return;
+ }
+ MemoryStream memoryStream = new MemoryStream(array);
+ int key = memoryStream.ReadInteger();
+ GMAssets.Decrypt(key, array, memoryStream.Position + 1);
+ ExtensionDLL = new List();
+ for (int j = 0; j < Includes.Count; j++)
+ {
+ if (Includes[j].Kind != 3)
+ {
+ ExtensionDLL.Add(memoryStream.ReadCompressedStream());
+ }
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMExtensionConstant.cs b/GMAC1098/GMAssetCompiler/GMExtensionConstant.cs
new file mode 100644
index 0000000..e96731c
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMExtensionConstant.cs
@@ -0,0 +1,26 @@
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMExtensionConstant
+ {
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public string Value
+ {
+ get;
+ private set;
+ }
+
+ public GMExtensionConstant(Stream _s)
+ {
+ _s.ReadInteger();
+ Name = _s.ReadString();
+ Value = _s.ReadString();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMExtensionFunction.cs b/GMAC1098/GMAssetCompiler/GMExtensionFunction.cs
new file mode 100644
index 0000000..1c49e6a
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMExtensionFunction.cs
@@ -0,0 +1,64 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMExtensionFunction
+ {
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public string ExtName
+ {
+ get;
+ private set;
+ }
+
+ public int Kind
+ {
+ get;
+ private set;
+ }
+
+ public int Id
+ {
+ get;
+ private set;
+ }
+
+ public IList Args
+ {
+ get;
+ private set;
+ }
+
+ public int ReturnType
+ {
+ get;
+ private set;
+ }
+
+ public GMExtensionFunction(Stream _s)
+ {
+ _s.ReadInteger();
+ Name = _s.ReadString();
+ ExtName = _s.ReadString();
+ Kind = _s.ReadInteger();
+ Id = _s.ReadInteger();
+ Args = new List();
+ int num = _s.ReadInteger();
+ for (int i = 0; i <= 16; i++)
+ {
+ int item = _s.ReadInteger();
+ if (i < num)
+ {
+ Args.Add(item);
+ }
+ }
+ ReturnType = _s.ReadInteger();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMExtensionInclude.cs b/GMAC1098/GMAssetCompiler/GMExtensionInclude.cs
new file mode 100644
index 0000000..4736d81
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMExtensionInclude.cs
@@ -0,0 +1,77 @@
+using System.Collections.Generic;
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMExtensionInclude
+ {
+ public string Filename
+ {
+ get;
+ private set;
+ }
+
+ public int Kind
+ {
+ get;
+ private set;
+ }
+
+ public string Init
+ {
+ get;
+ private set;
+ }
+
+ public string Final
+ {
+ get;
+ private set;
+ }
+
+ public IList Functions
+ {
+ get;
+ private set;
+ }
+
+ public IList Constants
+ {
+ get;
+ private set;
+ }
+
+ public GMExtensionInclude(Stream _s)
+ {
+ _s.ReadInteger();
+ Filename = _s.ReadString();
+ Kind = _s.ReadInteger();
+ Init = _s.ReadString();
+ Final = _s.ReadString();
+ Functions = new List();
+ int num = _s.ReadInteger();
+ for (int i = 0; i < num; i++)
+ {
+ Functions.Add(new GMExtensionFunction(_s));
+ }
+ Constants = new List();
+ int num2 = _s.ReadInteger();
+ for (int j = 0; j < num2; j++)
+ {
+ Constants.Add(new GMExtensionConstant(_s));
+ }
+ switch (Path.GetExtension(Filename).ToLower())
+ {
+ case ".gml":
+ Kind = 2;
+ break;
+ case ".dll":
+ Kind = 1;
+ break;
+ default:
+ Kind = 4;
+ break;
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMFont.cs b/GMAC1098/GMAssetCompiler/GMFont.cs
new file mode 100644
index 0000000..ad193c7
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMFont.cs
@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace GMAssetCompiler
+{
+ public class GMFont
+ {
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public int Size
+ {
+ get;
+ private set;
+ }
+
+ public bool Bold
+ {
+ get;
+ private set;
+ }
+
+ public bool Italic
+ {
+ get;
+ private set;
+ }
+
+ public int First
+ {
+ get;
+ private set;
+ }
+
+ public int Last
+ {
+ get;
+ private set;
+ }
+
+ public int CharSet
+ {
+ get;
+ private set;
+ }
+
+ public int AntiAlias
+ {
+ get;
+ private set;
+ }
+
+ public IList Glyphs
+ {
+ get;
+ private set;
+ }
+
+ public Bitmap Bitmap
+ {
+ get;
+ private set;
+ }
+
+ public GMFont(GMAssets _a, Stream _s)
+ {
+ int num = _s.ReadInteger();
+ Name = _s.ReadString();
+ Size = _s.ReadInteger();
+ Bold = _s.ReadBoolean();
+ Italic = _s.ReadBoolean();
+ First = _s.ReadInteger();
+ Last = _s.ReadInteger();
+ CharSet = ((First >> 16) & 0xFF);
+ AntiAlias = ((First >> 24) & 0xFF);
+ First &= 65535;
+ Glyphs = new List();
+ for (int i = 0; i < 256; i++)
+ {
+ int x = _s.ReadInteger();
+ int y = _s.ReadInteger();
+ int w = _s.ReadInteger();
+ int h = _s.ReadInteger();
+ int shift = _s.ReadInteger();
+ int offset = _s.ReadInteger();
+ Glyphs.Add(new GMGlyph(x, y, w, h, shift, offset));
+ }
+ int num2 = _s.ReadInteger();
+ int num3 = _s.ReadInteger();
+ byte[] array = null;
+ array = ((num != 540) ? _s.ReadStream() : _s.ReadCompressedStream());
+ Bitmap = new Bitmap(num2, num3, PixelFormat.Format32bppArgb);
+ Rectangle rect = new Rectangle(0, 0, Bitmap.Width, Bitmap.Height);
+ BitmapData bitmapData = Bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
+ IntPtr intPtr = new IntPtr(bitmapData.Scan0.ToInt64());
+ int num4 = 0;
+ int num5 = 0;
+ while (num5 < num3)
+ {
+ int num6 = num4;
+ IntPtr ptr = intPtr;
+ int num7 = 0;
+ while (num7 < num2)
+ {
+ int val = 16777215 + (array[num6] << 24);
+ Marshal.WriteInt32(ptr, val);
+ num7++;
+ num6++;
+ ptr = new IntPtr(ptr.ToInt64() + 4);
+ }
+ num5++;
+ intPtr = new IntPtr(intPtr.ToInt64() + bitmapData.Stride);
+ num4 += num2;
+ }
+ Bitmap.UnlockBits(bitmapData);
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMGlyph.cs b/GMAC1098/GMAssetCompiler/GMGlyph.cs
new file mode 100644
index 0000000..f3a0ba2
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMGlyph.cs
@@ -0,0 +1,51 @@
+namespace GMAssetCompiler
+{
+ public class GMGlyph
+ {
+ public int X
+ {
+ get;
+ private set;
+ }
+
+ public int Y
+ {
+ get;
+ private set;
+ }
+
+ public int W
+ {
+ get;
+ private set;
+ }
+
+ public int H
+ {
+ get;
+ private set;
+ }
+
+ public int Shift
+ {
+ get;
+ private set;
+ }
+
+ public int Offset
+ {
+ get;
+ private set;
+ }
+
+ public GMGlyph(int _x, int _y, int _w, int _h, int _shift, int _offset)
+ {
+ X = _x;
+ Y = _y;
+ W = _w;
+ H = _h;
+ Shift = _shift;
+ Offset = _offset;
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMHelp.cs b/GMAC1098/GMAssetCompiler/GMHelp.cs
new file mode 100644
index 0000000..25c944f
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMHelp.cs
@@ -0,0 +1,121 @@
+using System.IO;
+using System.Text;
+
+namespace GMAssetCompiler
+{
+ public class GMHelp
+ {
+ public int BackgroundColour
+ {
+ get;
+ private set;
+ }
+
+ public bool Mimic
+ {
+ get;
+ private set;
+ }
+
+ public string Caption
+ {
+ get;
+ private set;
+ }
+
+ public int Left
+ {
+ get;
+ private set;
+ }
+
+ public int Top
+ {
+ get;
+ private set;
+ }
+
+ public int Width
+ {
+ get;
+ private set;
+ }
+
+ public int Height
+ {
+ get;
+ private set;
+ }
+
+ public bool Border
+ {
+ get;
+ private set;
+ }
+
+ public bool Sizable
+ {
+ get;
+ private set;
+ }
+
+ public bool OnTop
+ {
+ get;
+ private set;
+ }
+
+ public bool Modal
+ {
+ get;
+ private set;
+ }
+
+ public string Text
+ {
+ get;
+ private set;
+ }
+
+ public GMHelp(GMAssets _a, Stream _stream)
+ {
+ int num = _stream.ReadInteger();
+ if (num == 800)
+ {
+ _stream = _stream.ReadStreamC();
+ }
+ BackgroundColour = _stream.ReadInteger();
+ Mimic = _stream.ReadBoolean();
+ Caption = _stream.ReadString();
+ Left = _stream.ReadInteger();
+ Top = _stream.ReadInteger();
+ Width = _stream.ReadInteger();
+ Height = _stream.ReadInteger();
+ Border = _stream.ReadBoolean();
+ Sizable = _stream.ReadBoolean();
+ OnTop = _stream.ReadBoolean();
+ Modal = _stream.ReadBoolean();
+ byte[] array = null;
+ switch (num)
+ {
+ case 600:
+ array = _stream.ReadCompressedStream();
+ break;
+ case 800:
+ array = _stream.ReadStream();
+ break;
+ }
+ if (array != null)
+ {
+ MemoryStream memoryStream = new MemoryStream(array);
+ StringBuilder stringBuilder = new StringBuilder();
+ while (memoryStream.Position != memoryStream.Length)
+ {
+ char value = (char)memoryStream.ReadByte();
+ stringBuilder.Append(value);
+ }
+ Text = stringBuilder.ToString();
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMInstance.cs b/GMAC1098/GMAssetCompiler/GMInstance.cs
new file mode 100644
index 0000000..72cc54d
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMInstance.cs
@@ -0,0 +1,104 @@
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ public class GMInstance
+ {
+ public int X
+ {
+ get;
+ private set;
+ }
+
+ public int Y
+ {
+ get;
+ private set;
+ }
+
+ public int Id
+ {
+ get;
+ private set;
+ }
+
+ public int Index
+ {
+ get;
+ private set;
+ }
+
+ public string Code
+ {
+ get;
+ private set;
+ }
+
+ public double ScaleX
+ {
+ get;
+ private set;
+ }
+
+ public double ScaleY
+ {
+ get;
+ private set;
+ }
+
+ public uint Colour
+ {
+ get;
+ private set;
+ }
+
+ public double Rotation
+ {
+ get;
+ private set;
+ }
+
+ public GMInstance(Stream _stream, int _version)
+ {
+ X = _stream.ReadInteger();
+ Y = _stream.ReadInteger();
+ Index = _stream.ReadInteger();
+ Id = _stream.ReadInteger();
+ Code = _stream.ReadString();
+ if (_version >= 810)
+ {
+ ScaleX = _stream.ReadDouble();
+ ScaleY = _stream.ReadDouble();
+ Colour = (uint)_stream.ReadInteger();
+ }
+ else
+ {
+ ScaleX = 1.0;
+ ScaleY = 1.0;
+ Colour = uint.MaxValue;
+ }
+ if (_version >= 811)
+ {
+ Rotation = _stream.ReadDouble();
+ }
+ else
+ {
+ Rotation = 0.0;
+ }
+ }
+
+ public GMInstance(Stream _stream, bool _gmk)
+ {
+ X = _stream.ReadInteger();
+ Y = _stream.ReadInteger();
+ Index = _stream.ReadInteger();
+ Id = _stream.ReadInteger();
+ Code = _stream.ReadString();
+ _stream.ReadBoolean();
+ ScaleX = 1.0;
+ ScaleY = 1.0;
+ Colour = uint.MaxValue;
+ Rotation = 0.0;
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GML2JavaScript.cs b/GMAC1098/GMAssetCompiler/GML2JavaScript.cs
new file mode 100644
index 0000000..47d4ee2
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GML2JavaScript.cs
@@ -0,0 +1,1138 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace GMAssetCompiler
+{
+ internal class GML2JavaScript
+ {
+ private static GMLCode ms_code;
+
+ private static GMAssets ms_assets;
+
+ private static int ms_numErrors;
+
+ private static bool ms_error;
+
+ public static string ms_varPrefix = "gml";
+
+ public static Dictionary ms_globals = new Dictionary();
+
+ private static Dictionary ms_locals = new Dictionary();
+
+ private static Dictionary ms_arguments = new Dictionary();
+
+ private static Stack ms_thisName = new Stack();
+
+ private static Stack ms_otherName = new Stack();
+
+ private static Stack ms_breakContext = new Stack();
+
+ private static int ms_unique = 0;
+
+ private static int ms_statements = 0;
+
+ private static Dictionary ms_arrays = new Dictionary();
+
+ private static StringBuilder ms_sbVariableName = new StringBuilder();
+
+ private static string GetUniqueName()
+ {
+ return string.Format("__yy__v{0}", ms_unique++);
+ }
+
+ public static void Error(string _errorMessage, GMLToken _token)
+ {
+ if (!Program.InhibitErrorOutput)
+ {
+ int num = 1;
+ for (int i = 0; i < _token.Index; i++)
+ {
+ if (ms_code.Code[i] == '\n')
+ {
+ num++;
+ }
+ }
+ Console.WriteLine("Error : {0}({1}) : {2}", ms_code.Name, num, _errorMessage);
+ }
+ ms_numErrors++;
+ ms_error = true;
+ Program.ExitCode = 1;
+ }
+
+ private static eType CompileUnary(GMLToken _tok, TextWriter _sw)
+ {
+ eType result = eType.eGMLT_Unknown;
+ switch (_tok.Id)
+ {
+ case 203:
+ _sw.Write("!(");
+ if (CompileExpression(_tok.Children[0], _sw) != 0)
+ {
+ _sw.Write(" > 0.5)");
+ }
+ else
+ {
+ _sw.Write(")");
+ }
+ result = eType.eGMLT_Bool;
+ break;
+ case 210:
+ case 211:
+ case 220:
+ _sw.Write(_tok.Text);
+ result = CompileExpression(_tok.Children[0], _sw);
+ break;
+ }
+ return result;
+ }
+
+ private static eType CompileBinary(GMLToken _tok, TextWriter _sw)
+ {
+ eType result = 0;
+ bool flag = false;
+ switch (_tok.Children[1].Token)
+ {
+ case eToken.eDiv:
+ _sw.Write("(~~");
+ break;
+ case eToken.eAnd:
+ case eToken.eOr:
+ flag = true;
+ break;
+ }
+ _sw.Write("(");
+ if (flag)
+ {
+ _sw.Write("(");
+ }
+ eType eType = CompileExpression(_tok.Children[0], _sw);
+ if (flag && eType != 0)
+ {
+ _sw.Write(" > 0.5");
+ }
+ if (flag)
+ {
+ _sw.Write(")");
+ }
+ for (int i = 1; i < _tok.Children.Count; i += 2)
+ {
+ switch (_tok.Children[i].Token)
+ {
+ case eToken.eNot:
+ _sw.Write("!");
+ break;
+ case eToken.eBitXor:
+ _sw.Write("^");
+ break;
+ case eToken.eDiv:
+ _sw.Write("/");
+ break;
+ case eToken.eMod:
+ _sw.Write("%");
+ break;
+ case eToken.eAnd:
+ _sw.Write("&&");
+ break;
+ case eToken.eOr:
+ _sw.Write("||");
+ break;
+ case eToken.eNotEqual:
+ _sw.Write("!=");
+ break;
+ case eToken.eAssign:
+ case eToken.eEqual:
+ _sw.Write("==");
+ break;
+ default:
+ _sw.Write(_tok.Children[i].Text);
+ break;
+ }
+ if (flag)
+ {
+ _sw.Write("(");
+ }
+ eType eType2 = CompileExpression(_tok.Children[i + 1], _sw);
+ if (flag && eType2 != 0)
+ {
+ _sw.Write(" > 0.5");
+ }
+ if (flag)
+ {
+ _sw.Write(")");
+ }
+ switch (_tok.Children[i].Token)
+ {
+ case eToken.eAssign:
+ case eToken.eAnd:
+ case eToken.eOr:
+ case eToken.eLess:
+ case eToken.eLessEqual:
+ case eToken.eEqual:
+ case eToken.eNotEqual:
+ case eToken.eGreaterEqual:
+ case eToken.eGreater:
+ result = eType.eGMLT_Bool;
+ break;
+ }
+ eType = eType2;
+ }
+ _sw.Write(")");
+ eToken token = _tok.Children[1].Token;
+ if (token == eToken.eDiv)
+ {
+ _sw.Write(")");
+ }
+ return result;
+ }
+
+ private static eType CompileConstant(GMLToken _tok, TextWriter _sw)
+ {
+ bool _setFunc = false;
+ eType result = eType.eGMLT_Var;
+ switch (_tok.Text)
+ {
+ case "global":
+ case "other":
+ case "self":
+ CompileVariable(_tok, _sw, false, out _setFunc);
+ break;
+ default:
+ switch (_tok.Value.Kind)
+ {
+ case eKind.eConstant:
+ _sw.Write("g_gmlConst.{0}", _tok.Value.ValueS);
+ break;
+ case eKind.eNone:
+ _sw.Write("null");
+ break;
+ case eKind.eNumber:
+ if (_tok.Value.ValueI < 0.0)
+ {
+ _sw.Write("(");
+ }
+ _sw.Write("{0}", Convert.ToString(_tok.Value.ValueI, CultureInfo.InvariantCulture.NumberFormat));
+ if (_tok.Value.ValueI < 0.0)
+ {
+ _sw.Write(")");
+ }
+ result = ((!(_tok.Text == "true") && !(_tok.Text == "false")) ? eType.eGMLT_Real : eType.eGMLT_Bool);
+ break;
+ case eKind.eString:
+ {
+ string text = _tok.Value.ValueS.Replace("\\", "\\\\");
+ text = text.Replace("\"", "\\\"");
+ text = text.Replace(Environment.NewLine, "#");
+ text = text.Replace(new string('\n', 1), "#");
+ _sw.Write("\"{0}\"", text);
+ result = eType.eGMLT_String;
+ break;
+ }
+ }
+ break;
+ }
+ return result;
+ }
+
+ private static eType CompileExpression(GMLToken _tok, TextWriter _sw)
+ {
+ eType result = eType.eGMLT_Unknown;
+ bool _setFunc = false;
+ switch (_tok.Token)
+ {
+ case eToken.eConstant:
+ result = CompileConstant(_tok, _sw);
+ break;
+ case eToken.eBinary:
+ result = CompileBinary(_tok, _sw);
+ break;
+ case eToken.eUnary:
+ result = CompileUnary(_tok, _sw);
+ break;
+ case eToken.eFunction:
+ result = CompileFunction(_tok, _sw);
+ break;
+ case eToken.eVariable:
+ case eToken.eDot:
+ result = CompileVariable(_tok, _sw, false, out _setFunc);
+ break;
+ }
+ return result;
+ }
+
+ private static void CompileSimpleVariable(GMLToken _tok, StringWriter _sw, bool _lvalue, out bool _setFunc, bool _inhibitExpansion)
+ {
+ string text = null;
+ string text2 = _tok.Text;
+ GMLVariable value = null;
+ if (!GMLCompile.ms_builtins.TryGetValue(text2, out value))
+ {
+ GMLCompile.ms_builtinsLocal.TryGetValue(text2, out value);
+ }
+ _setFunc = false;
+ if (value != null)
+ {
+ if (_lvalue && value.setFunction != null)
+ {
+ text2 = string.Format("{0}( ", value.setFunction);
+ _setFunc = true;
+ }
+ else if (!_lvalue && value.getFunction != null)
+ {
+ text2 = string.Format("{0}()", value.getFunction);
+ }
+ }
+ else
+ {
+ text2 = ms_varPrefix + text2;
+ }
+ text = text2;
+ if (!_inhibitExpansion && _tok.Id < 100000 && GMLCompile.ms_builtins.TryGetValue(_tok.Text, out value) && !ms_arguments.TryGetValue(_tok.Text, out text))
+ {
+ string empty = string.Empty;
+ empty = ((!(text2 == "argument_count")) ? string.Format("g_pBuiltIn.{0}", text2) : string.Format("({0}.arguments.length-2)", ms_code.Name));
+ _sw.Write(empty);
+ }
+ else if (!_inhibitExpansion && ms_globals.TryGetValue(_tok.Text, out text))
+ {
+ string value2 = string.Format("global.{0}", text2);
+ _sw.Write(value2);
+ }
+ else if (_inhibitExpansion || ms_locals.TryGetValue(text2, out text) || ms_arguments.TryGetValue(_tok.Text, out text) || string.IsNullOrEmpty(ms_thisName.Peek()))
+ {
+ _sw.Write(text);
+ }
+ else if (!_inhibitExpansion && GMLCompile.Find(ms_assets.Objects, _tok.Text) >= 0)
+ {
+ _sw.Write(GMLCompile.Find(ms_assets.Objects, _tok.Text).ToString());
+ }
+ else
+ {
+ string value3 = string.Format("{0}.{1}", ms_thisName.Peek(), text2);
+ _sw.Write(value3);
+ }
+ bool flag = false;
+ string value4 = "]";
+ string text3 = string.Empty;
+ if (_tok.Children.Count > 0)
+ {
+ string text4 = _sw.GetStringBuilder().ToString();
+ if (text4 == "g_pBuiltIn.instance_id")
+ {
+ _sw.GetStringBuilder().Length = 0;
+ _sw.Write("g_pBuiltIn.get_instance_id(");
+ value4 = ")";
+ flag = true;
+ }
+ else if (text4 == "g_pBuiltIn.argument")
+ {
+ _sw.GetStringBuilder().Length = 0;
+ _sw.Write("{0}.arguments[", ms_code.Name);
+ text3 = "2+";
+ flag = true;
+ }
+ else
+ {
+ int num = text4.LastIndexOf('.');
+ string arg = (num < 0) ? "_inst" : text4.Substring(0, num);
+ string arg2 = (num < 0) ? text4 : text4.Substring(num + 1, text4.Length - (num + 1));
+ _sw.GetStringBuilder().Length = 0;
+ _setFunc = _lvalue;
+ if (_lvalue)
+ {
+ string value5 = string.Format("array_set_{0}D( {1}, \"__{2}__\" ", _tok.Children.Count, arg, arg2);
+ _sw.Write(value5);
+ }
+ else
+ {
+ string value6 = string.Format("array_get_{0}D( {1}, \"__{2}__\" ", _tok.Children.Count, arg, arg2);
+ _sw.Write(value6);
+ }
+ }
+ }
+ ms_thisName.Pop();
+ if (_tok.Token != eToken.eVariable)
+ {
+ return;
+ }
+ int num2 = 0;
+ foreach (GMLToken child in _tok.Children)
+ {
+ if (!flag || num2 > 0)
+ {
+ _sw.Write(", ");
+ }
+ if (!string.IsNullOrEmpty(text3))
+ {
+ _sw.Write("{0} (", text3);
+ }
+ CompileExpression(child, _sw);
+ if (!string.IsNullOrEmpty(text3))
+ {
+ _sw.Write(")");
+ }
+ num2++;
+ }
+ if (_tok.Children.Count > 0)
+ {
+ if (flag)
+ {
+ _sw.Write(value4);
+ }
+ else if (_lvalue)
+ {
+ _sw.Write(", ");
+ }
+ else
+ {
+ _sw.Write(" ) ");
+ }
+ }
+ }
+
+ private static eType CompileVariable(GMLToken _tok, TextWriter _sw, bool _lvalue, out bool _setFunc)
+ {
+ eType result = eType.eGMLT_Var;
+ _setFunc = false;
+ int count = ms_thisName.Count;
+ ms_sbVariableName.Length = 0;
+ bool flag = false;
+ StringBuilder stringBuilder = new StringBuilder();
+ StringWriter stringWriter = new StringWriter(stringBuilder);
+ switch (_tok.Token)
+ {
+ case eToken.eDot:
+ switch (_tok.Children.Count)
+ {
+ case 0:
+ case 1:
+ Error("Expecting expression after the '.' ", _tok);
+ break;
+ default:
+ {
+ string text = null;
+ switch (_tok.Children[0].Text)
+ {
+ case "global":
+ text = _tok.Children[0].Text;
+ stringWriter.Write(text);
+ flag = true;
+ break;
+ case "self":
+ stringWriter.Write(ms_thisName.Peek());
+ flag = true;
+ break;
+ case "other":
+ stringWriter.Write(ms_otherName.Peek());
+ flag = true;
+ break;
+ default:
+ switch (_tok.Children[0].Token)
+ {
+ case eToken.eConstant:
+ CompileConstant(_tok.Children[0], stringWriter);
+ break;
+ case eToken.eVariable:
+ ms_thisName.Push(ms_thisName.Peek());
+ CompileSimpleVariable(_tok.Children[0], stringWriter, false, out _setFunc, false);
+ break;
+ case eToken.eFunction:
+ CompileFunction(_tok.Children[0], stringWriter);
+ break;
+ case eToken.eDot:
+ CompileVariable(_tok.Children[0], stringWriter, _lvalue, out _setFunc);
+ break;
+ default:
+ Console.WriteLine("This is a problem now!");
+ break;
+ }
+ break;
+ }
+ for (int i = 1; i < _tok.Children.Count; i++)
+ {
+ if (!flag)
+ {
+ string arg = stringBuilder.ToString();
+ stringBuilder.Length = 0;
+ stringWriter.Write("yyInst({0})", arg);
+ }
+ flag = false;
+ stringWriter.Write(".");
+ ms_thisName.Push("");
+ CompileSimpleVariable(_tok.Children[i], stringWriter, i == _tok.Children.Count - 1 && _lvalue, out _setFunc, true);
+ }
+ break;
+ }
+ }
+ break;
+ case eToken.eVariable:
+ ms_thisName.Push(ms_thisName.Peek());
+ CompileSimpleVariable(_tok, stringWriter, _lvalue, out _setFunc, false);
+ break;
+ case eToken.eConstant:
+ switch (_tok.Text)
+ {
+ default:
+ Error("constant is invalid here", _tok);
+ break;
+ case "self":
+ stringWriter.Write("{0}.id", ms_thisName.Peek());
+ break;
+ case "other":
+ stringWriter.Write("{0}.id", ms_otherName.Peek());
+ break;
+ }
+ break;
+ }
+ stringWriter.Close();
+ _sw.Write(stringBuilder.ToString());
+ if (count != ms_thisName.Count)
+ {
+ Error("Houston we have a problem!", _tok);
+ }
+ return result;
+ }
+
+ private static void CompileVar(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count > 0)
+ {
+ _sw.Write("var ");
+ int num = 0;
+ foreach (GMLToken child in _tok.Children)
+ {
+ if (num != 0)
+ {
+ _sw.Write(",");
+ }
+ string text = ms_varPrefix + child.Text;
+ _sw.Write("{0}", text);
+ string value;
+ if (!ms_locals.TryGetValue(text, out value))
+ {
+ ms_locals.Add(text, text);
+ }
+ num++;
+ }
+ }
+ }
+
+ private static void CompileGlobalVar(GMLToken _tok, TextWriter _sw)
+ {
+ foreach (GMLToken child in _tok.Children)
+ {
+ ms_globals[child.Text] = child.Text;
+ }
+ }
+
+ private static void CompileRepeat(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count != 2)
+ {
+ Error("malformed repeat statement", _tok);
+ }
+ string uniqueName = GetUniqueName();
+ string uniqueName2 = GetUniqueName();
+ _sw.Write("for( var {0}=0, {1}=", uniqueName, uniqueName2);
+ CompileExpression(_tok.Children[0], _sw);
+ _sw.Write("; {0}<{1}; {0}++) ", uniqueName, uniqueName2);
+ if (_tok.Children[1].Token == eToken.eBegin)
+ {
+ ms_statements++;
+ }
+ ms_breakContext.Push("CompileRepeat");
+ CompileStatement(_tok.Children[1], _sw);
+ ms_breakContext.Pop();
+ }
+
+ private static void CompileIf(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count < 2)
+ {
+ Error("malformed if statement", _tok);
+ }
+ _sw.Write("if (");
+ if (CompileExpression(_tok.Children[0], _sw) != 0)
+ {
+ _sw.Write(" > 0.5");
+ }
+ _sw.Write(") {");
+ if (_tok.Children.Count > 1)
+ {
+ if (_tok.Children[1].Token == eToken.eBegin)
+ {
+ ms_statements++;
+ }
+ CompileStatement(_tok.Children[1], _sw);
+ _sw.WriteLine(";}");
+ if (_tok.Children.Count > 2)
+ {
+ _sw.Write(" else {");
+ if (_tok.Children[2].Token == eToken.eBegin)
+ {
+ ms_statements++;
+ }
+ CompileStatement(_tok.Children[2], _sw);
+ _sw.Write(";}");
+ }
+ }
+ else
+ {
+ Error("if requires a then statement", _tok);
+ }
+ }
+
+ private static void CompileWhile(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count != 2)
+ {
+ Error("malformed while statement", _tok);
+ }
+ _sw.Write("while (");
+ CompileExpression(_tok.Children[0], _sw);
+ _sw.Write(") ");
+ ms_breakContext.Push("CompileWhile");
+ if (_tok.Children[1].Token == eToken.eBegin)
+ {
+ ms_statements++;
+ }
+ CompileStatement(_tok.Children[1], _sw);
+ ms_breakContext.Pop();
+ }
+
+ private static void CompileDo(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count != 2)
+ {
+ Error("malformed do statement", _tok);
+ }
+ _sw.WriteLine("do {");
+ ms_breakContext.Push("CompileDo");
+ CompileStatement(_tok.Children[0], _sw);
+ ms_breakContext.Pop();
+ _sw.Write("} while( !(");
+ CompileExpression(_tok.Children[1], _sw);
+ _sw.WriteLine("))");
+ }
+
+ private static void CompileFor(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count != 4)
+ {
+ Error("malformed for statement", _tok);
+ }
+ _sw.Write("for (");
+ CompileStatement(_tok.Children[0], _sw);
+ _sw.Write(" ; ");
+ CompileExpression(_tok.Children[1], _sw);
+ _sw.Write(" ; ");
+ CompileStatement(_tok.Children[2], _sw);
+ _sw.Write(") ");
+ if (_tok.Children[3].Token == eToken.eBegin)
+ {
+ ms_statements++;
+ }
+ ms_breakContext.Push("CompileFor");
+ CompileStatement(_tok.Children[3], _sw);
+ ms_breakContext.Pop();
+ }
+
+ private static void CompileWith(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count != 2)
+ {
+ Error("malformed with statement", _tok);
+ }
+ if (_tok.Children[0].Token == eToken.eConstant && (_tok.Children[0].Text == "other" || _tok.Children[0].Text == "self"))
+ {
+ string item = string.Empty;
+ switch (_tok.Children[0].Text)
+ {
+ case "other":
+ item = ms_otherName.Peek();
+ break;
+ case "self":
+ item = ms_thisName.Peek();
+ break;
+ }
+ ms_otherName.Push(ms_thisName.Peek());
+ ms_thisName.Push(item);
+ CompileStatement(_tok.Children[1], _sw);
+ if (_tok.Children[1].Token != eToken.eBegin)
+ {
+ _sw.Write(";");
+ }
+ ms_thisName.Pop();
+ ms_otherName.Pop();
+ return;
+ }
+ _sw.WriteLine("{");
+ string uniqueName = GetUniqueName();
+ string uniqueName2 = GetUniqueName();
+ string uniqueName3 = GetUniqueName();
+ _sw.Write("var {0} = GetWithArray(", uniqueName);
+ CompileExpression(_tok.Children[0], _sw);
+ _sw.WriteLine(" );");
+ _sw.WriteLine("for( var {0} in {1} ) {{", uniqueName2, uniqueName);
+ _sw.WriteLine(" var {0} = {1}[{2}];", uniqueName3, uniqueName, uniqueName2);
+ ms_otherName.Push(ms_thisName.Peek());
+ ms_thisName.Push(uniqueName3);
+ ms_statements++;
+ ms_breakContext.Push("CompileWith");
+ CompileStatement(_tok.Children[1], _sw);
+ ms_breakContext.Pop();
+ if (_tok.Children[1].Token != eToken.eBegin)
+ {
+ _sw.Write(";");
+ }
+ _sw.WriteLine("}");
+ ms_thisName.Pop();
+ ms_otherName.Pop();
+ _sw.WriteLine("}");
+ }
+
+ private static void CompileSwitch(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count == 0)
+ {
+ Error("malformed switch statement", _tok);
+ }
+ _sw.Write("switch(");
+ CompileExpression(_tok.Children[0], _sw);
+ _sw.WriteLine(") {");
+ ms_breakContext.Push("CompileSwitch");
+ bool flag = false;
+ for (int i = 1; i < _tok.Children.Count; i++)
+ {
+ switch (_tok.Children[i].Token)
+ {
+ case eToken.eCase:
+ _sw.Write("case ");
+ CompileExpression(_tok.Children[i].Children[0], _sw);
+ _sw.WriteLine(":");
+ flag = true;
+ break;
+ case eToken.eDefault:
+ _sw.WriteLine("default:");
+ flag = true;
+ break;
+ case eToken.eBreak:
+ if (!flag)
+ {
+ Error("statement in a switch MUST appear after case or default", _tok.Children[i]);
+ break;
+ }
+ CompileStatement(_tok.Children[i], _sw);
+ _sw.WriteLine(";");
+ flag = false;
+ break;
+ default:
+ if (!flag)
+ {
+ Error("statement in a switch MUST appear after case or default", _tok.Children[i]);
+ break;
+ }
+ CompileStatement(_tok.Children[i], _sw);
+ _sw.WriteLine(";");
+ break;
+ }
+ }
+ _sw.Write("}");
+ ms_breakContext.Pop();
+ }
+
+ private static eType CompileFunction(GMLToken _tok, TextWriter _sw)
+ {
+ eType result = eType.eGMLT_Var;
+ string text = _tok.Text;
+ int num = 0;
+ bool flag = false;
+ bool flag2 = false;
+ bool flag3 = false;
+ if (_tok.Id < 100000)
+ {
+ if (_tok.Text == "script_execute")
+ {
+ _sw.Write("JSON_game.Scripts[ ");
+ CompileExpression(_tok.Children[0], _sw);
+ _sw.Write("]( ");
+ flag = true;
+ flag2 = true;
+ flag3 = true;
+ }
+ else
+ {
+ int num2 = _tok.Id - GMLCompile.ms_id;
+ int index = (num2 >> 8) & 0xF;
+ int index2 = num2 >> 12;
+ if (_tok.Id > GMLCompile.ms_id && ms_assets.Extensions[index].Includes[index2].Kind == 2)
+ {
+ _sw.Write("gml_Script_{0}( ", _tok.Text);
+ flag = true;
+ flag2 = true;
+ }
+ else
+ {
+ GMLFunction value = null;
+ GMLCompile.ms_funcs.TryGetValue(text, out value);
+ _sw.Write("{0}( ", text);
+ flag = (value != null && value.InstanceFirstParam);
+ flag2 = (value != null && value.OtherSecondParam);
+ }
+ }
+ }
+ else
+ {
+ _sw.Write("gml_Script_{0}( ", _tok.Text);
+ flag = true;
+ flag2 = true;
+ }
+ if (flag)
+ {
+ if (!string.IsNullOrEmpty(ms_thisName.Peek()))
+ {
+ _sw.Write("{0} ", ms_thisName.Peek());
+ num++;
+ }
+ else
+ {
+ Error("calling a function that needs an instance and no instance is available", _tok);
+ }
+ if (flag2)
+ {
+ if (!string.IsNullOrEmpty(ms_otherName.Peek()))
+ {
+ _sw.Write(", {0} ", ms_otherName.Peek());
+ num++;
+ }
+ else
+ {
+ Error("calling a function that needs an \"other\" and no \"other\" is available", _tok);
+ }
+ }
+ }
+ foreach (GMLToken child in _tok.Children)
+ {
+ if ((flag3 && num < 2) || !flag3)
+ {
+ if (num != 0)
+ {
+ _sw.Write(", ");
+ }
+ CompileExpression(child, _sw);
+ }
+ num++;
+ flag3 = false;
+ }
+ _sw.Write(" )");
+ return result;
+ }
+
+ private static void CompileAssign(GMLToken _tok, TextWriter _sw)
+ {
+ if (_tok.Children.Count != 3)
+ {
+ Error("malformed assignment statement", _tok);
+ }
+ bool _setFunc = false;
+ CompileVariable(_tok.Children[0], _sw, true, out _setFunc);
+ if (!_setFunc)
+ {
+ switch (_tok.Children[1].Token)
+ {
+ case eToken.eAssignPlus:
+ case eToken.eAssignMinus:
+ case eToken.eAssignTimes:
+ case eToken.eAssignDivide:
+ case eToken.eAssignOr:
+ case eToken.eAssignAnd:
+ case eToken.eAssignXor:
+ _sw.Write(_tok.Children[1].Text);
+ CompileExpression(_tok.Children[2], _sw);
+ break;
+ case eToken.eAssign:
+ _sw.Write("=");
+ CompileExpression(_tok.Children[2], _sw);
+ break;
+ }
+ return;
+ }
+ switch (_tok.Children[1].Token)
+ {
+ case eToken.eAssignPlus:
+ case eToken.eAssignMinus:
+ case eToken.eAssignTimes:
+ case eToken.eAssignDivide:
+ case eToken.eAssignOr:
+ case eToken.eAssignAnd:
+ case eToken.eAssignXor:
+ CompileVariable(_tok.Children[0], _sw, false, out _setFunc);
+ _sw.Write(" {0} ", _tok.Children[1].Text[0]);
+ CompileExpression(_tok.Children[2], _sw);
+ break;
+ case eToken.eAssign:
+ CompileExpression(_tok.Children[2], _sw);
+ break;
+ }
+ _sw.Write(" )");
+ }
+
+ private static void CompileReturn(GMLToken _tok, TextWriter _sw)
+ {
+ _sw.Write("return ");
+ if (_tok.Children.Count > 0)
+ {
+ CompileExpression(_tok.Children[0], _sw);
+ }
+ }
+
+ private static void CompileBreak(GMLToken _tok, TextWriter _sw)
+ {
+ if (ms_breakContext.Count > 0)
+ {
+ _sw.Write("break");
+ }
+ else
+ {
+ _sw.Write("return");
+ }
+ }
+
+ private static void CompileExit(GMLToken _tok, TextWriter _sw)
+ {
+ _sw.Write("return");
+ }
+
+ private static void CompileContinue(GMLToken _tok, TextWriter _sw)
+ {
+ if (ms_breakContext.Count > 0)
+ {
+ _sw.Write("continue");
+ }
+ else
+ {
+ _sw.Write("return");
+ }
+ }
+
+ private static void CompileStatement(GMLToken _tok, TextWriter _sw)
+ {
+ switch (_tok.Token)
+ {
+ case eToken.eVar:
+ CompileVar(_tok, _sw);
+ break;
+ case eToken.eGlobalVar:
+ CompileGlobalVar(_tok, _sw);
+ break;
+ case eToken.eBegin:
+ case eToken.eBlock:
+ CompileBlock(_tok, _sw);
+ break;
+ case eToken.eRepeat:
+ CompileRepeat(_tok, _sw);
+ break;
+ case eToken.eIf:
+ CompileIf(_tok, _sw);
+ break;
+ case eToken.eWhile:
+ CompileWhile(_tok, _sw);
+ break;
+ case eToken.eDo:
+ CompileDo(_tok, _sw);
+ break;
+ case eToken.eFor:
+ CompileFor(_tok, _sw);
+ break;
+ case eToken.eWith:
+ CompileWith(_tok, _sw);
+ break;
+ case eToken.eSwitch:
+ CompileSwitch(_tok, _sw);
+ break;
+ case eToken.eFunction:
+ CompileFunction(_tok, _sw);
+ break;
+ case eToken.eAssign:
+ CompileAssign(_tok, _sw);
+ break;
+ case eToken.eReturn:
+ CompileReturn(_tok, _sw);
+ break;
+ case eToken.eBreak:
+ CompileBreak(_tok, _sw);
+ break;
+ case eToken.eExit:
+ CompileExit(_tok, _sw);
+ break;
+ case eToken.eContinue:
+ CompileContinue(_tok, _sw);
+ break;
+ }
+ }
+
+ private static void CheckEmitArrayCheck(TextWriter _sw)
+ {
+ IEnumerable> enumerable = ms_arrays.Where((KeyValuePair a) => a.Value == ms_statements);
+ foreach (KeyValuePair item in enumerable)
+ {
+ _sw.WriteLine("if (!{0}) {0} = [];", item.Key);
+ }
+ }
+
+ private static void CompileStatement2(GMLToken _tok, TextWriter _sw)
+ {
+ CheckEmitArrayCheck(_sw);
+ CompileStatement(_tok, _sw);
+ ms_statements++;
+ }
+
+ private static void CompileBlock(GMLToken _tok, TextWriter _sw)
+ {
+ _sw.WriteLine("{");
+ foreach (GMLToken child in _tok.Children)
+ {
+ CompileStatement2(child, _sw);
+ _sw.WriteLine(";");
+ }
+ _sw.WriteLine("}");
+ }
+
+ private static void CompileProgram(GMLToken _tok, TextWriter _sw)
+ {
+ switch (_tok.Token)
+ {
+ case eToken.eEOF:
+ break;
+ case eToken.eBlock:
+ CompileBlock(_tok, _sw);
+ break;
+ default:
+ Error("No program to compile", _tok);
+ break;
+ }
+ }
+
+ private static void GatherArgs(GMLToken _tok)
+ {
+ eToken token = _tok.Token;
+ if (token == eToken.eVariable)
+ {
+ switch (_tok.Text)
+ {
+ case "argument0":
+ case "argument1":
+ case "argument2":
+ case "argument3":
+ case "argument4":
+ case "argument5":
+ case "argument6":
+ case "argument7":
+ case "argument8":
+ case "argument9":
+ case "argument10":
+ case "argument11":
+ case "argument12":
+ case "argument13":
+ case "argument14":
+ case "argument15":
+ {
+ string value;
+ if (!ms_arguments.TryGetValue(_tok.Text, out value))
+ {
+ ms_arguments.Add(_tok.Text, _tok.Text);
+ }
+ break;
+ }
+ }
+ }
+ foreach (GMLToken child in _tok.Children)
+ {
+ GatherArgs(child);
+ }
+ }
+
+ public static void Compile(GMAssets _assets, GMLCode _code, TextWriter _sw)
+ {
+ ms_assets = _assets;
+ ms_code = _code;
+ ms_numErrors = 0;
+ ms_error = false;
+ Console.WriteLine("Compiling - {0}", _code.Name);
+ _sw.WriteLine("\n// #####################################################################################################");
+ string[] array = _code.Code.Split('\n');
+ string[] array2 = array;
+ foreach (string text in array2)
+ {
+ string text2 = text.Replace('\r', ' ');
+ text2 = text2.Replace('\n', ' ');
+ _sw.WriteLine("// {0}", text2);
+ }
+ ms_arguments.Clear();
+ switch (_code.Type)
+ {
+ case eGMLCodeType.eRoomCreate:
+ _sw.WriteLine("function {0}(_inst)", _code.Name);
+ ms_thisName.Push("_inst");
+ ms_otherName.Push("_inst");
+ break;
+ case eGMLCodeType.eScript:
+ {
+ GatherArgs(_code.Token);
+ _sw.Write("function {0}( _inst, _other ", _code.Name);
+ for (int j = 0; j < ms_arguments.Count; j++)
+ {
+ string text3 = string.Format("argument{0}", j);
+ string value = string.Empty;
+ if (!ms_arguments.TryGetValue(text3, out value))
+ {
+ Error(string.Format("argument naming error, {0} arguments but no reference found to {1}", ms_arguments.Count, text3), _code.Token);
+ }
+ _sw.Write(", {0}", text3);
+ }
+ _sw.Write(")");
+ ms_thisName.Push("_inst");
+ ms_otherName.Push("_other");
+ break;
+ }
+ case eGMLCodeType.eRoomInstanceCreate:
+ _sw.WriteLine("function {0}( _inst )", _code.Name);
+ ms_thisName.Push("_inst");
+ ms_otherName.Push("_inst");
+ break;
+ case eGMLCodeType.eEvent:
+ case eGMLCodeType.eTrigger:
+ _sw.WriteLine("function {0}( _inst, _other )", _code.Name);
+ ms_thisName.Push("_inst");
+ ms_otherName.Push("_other");
+ break;
+ case eGMLCodeType.eConstant:
+ _sw.WriteLine("function {0}()", _code.Name);
+ ms_thisName.Push("");
+ ms_otherName.Push("");
+ break;
+ }
+ DummyStream stream = new DummyStream();
+ StreamWriter sw = new StreamWriter(stream);
+ int num = ms_unique;
+ ms_locals.Clear();
+ ms_arrays.Clear();
+ ms_breakContext.Clear();
+ ms_statements = 0;
+ CompileProgram(_code.Token, sw);
+ if (!ms_error)
+ {
+ ms_unique = num;
+ ms_locals.Clear();
+ ms_breakContext.Clear();
+ ms_statements = 0;
+ CompileProgram(_code.Token, _sw);
+ }
+ ms_thisName.Pop();
+ ms_otherName.Pop();
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GML2VM.cs b/GMAC1098/GMAssetCompiler/GML2VM.cs
new file mode 100644
index 0000000..301414a
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GML2VM.cs
@@ -0,0 +1,1281 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace GMAssetCompiler
+{
+ internal class GML2VM
+ {
+ private const int VARIABLE_ARRAY_MAX_DIMENSION = 32000;
+
+ public static int ms_numErrors;
+
+ public VMBuffer VMB
+ {
+ get;
+ set;
+ }
+
+ public GMLCode Code
+ {
+ get;
+ set;
+ }
+
+ public bool ErrorFlag
+ {
+ get;
+ set;
+ }
+
+ public Stack TypeStack
+ {
+ get;
+ set;
+ }
+
+ public Stack LoopEnv
+ {
+ get;
+ set;
+ }
+
+ public Stack LoopEndEnv
+ {
+ get;
+ set;
+ }
+
+ public static List Strings
+ {
+ get;
+ set;
+ }
+
+ public static List StringPatches
+ {
+ get;
+ set;
+ }
+
+ public static List VarStringEntry
+ {
+ get;
+ set;
+ }
+
+ public static List VarPatches
+ {
+ get;
+ set;
+ }
+
+ public static List ObjectStringEntry
+ {
+ get;
+ set;
+ }
+
+ public static List ObjectPatches
+ {
+ get;
+ set;
+ }
+
+ static GML2VM()
+ {
+ Strings = new List();
+ StringPatches = new List();
+ VarStringEntry = new List();
+ VarPatches = new List();
+ ObjectStringEntry = new List();
+ ObjectPatches = new List();
+ }
+
+ public GML2VM()
+ {
+ VMB = new VMBuffer();
+ TypeStack = new Stack();
+ LoopEnv = new Stack();
+ LoopEndEnv = new Stack();
+ }
+
+ private int AddString(string _string)
+ {
+ int num = Strings.IndexOf(_string);
+ if (num == -1)
+ {
+ num = Strings.Count;
+ Strings.Add(_string);
+ }
+ return num;
+ }
+
+ private int AddStringAndPatch(string _string)
+ {
+ int result = AddString(_string);
+ StringPatches.Add(VMB.Buffer.Position);
+ return result;
+ }
+
+ private int AddVar(string _string)
+ {
+ int item = AddString(_string);
+ int num = VarStringEntry.IndexOf(item);
+ if (num == -1)
+ {
+ num = VarStringEntry.Count;
+ VarStringEntry.Add(item);
+ }
+ return num;
+ }
+
+ private int AddVarAndPatch(string _string)
+ {
+ int result = AddVar(_string);
+ VarPatches.Add(VMB.Buffer.Position);
+ return result;
+ }
+
+ private int AddObjectAndPatch(string _string)
+ {
+ int item = AddString(_string);
+ int num = ObjectStringEntry.IndexOf(item);
+ if (num == -1)
+ {
+ num = ObjectStringEntry.Count;
+ ObjectStringEntry.Add(item);
+ }
+ ObjectPatches.Add(VMB.Buffer.Position);
+ return num;
+ }
+
+ private void EmitBreak(ushort _v)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg(255, 15) | _v);
+ }
+
+ private void Emit(eVM_Instruction _inst, eVM_Type _type1)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, (int)_type1));
+ }
+
+ private void Emit(eVM_Instruction _inst, eVM_Type _type1, eVM_Type _type2)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, VMBuffer.EncodeArgDouble((int)_type1, (int)_type2)));
+ }
+
+ private void EmitI(eVM_Instruction _inst, double _val)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 0));
+ VMB.Buffer.WriteDouble(_val);
+ }
+
+ private void EmitI(eVM_Instruction _inst, float _val)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 1));
+ VMB.Buffer.WriteSingle(_val);
+ }
+
+ private void EmitI(eVM_Instruction _inst, long _val)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 3));
+ VMB.Buffer.WriteLong(_val);
+ }
+
+ private void EmitI(eVM_Instruction _inst, int _val)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 2));
+ VMB.Buffer.WriteInteger(_val);
+ }
+
+ private void EmitI(eVM_Instruction _inst, bool _val)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 4));
+ VMB.Buffer.WriteBoolean(_val);
+ }
+
+ private void EmitI(eVM_Instruction _inst, string _val)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 6));
+ int count = Strings.Count;
+ Strings.Add(_val);
+ StringPatches.Add(VMB.Buffer.Position);
+ VMB.Buffer.WriteInteger(count);
+ }
+
+ private void EmitIVar(eVM_Instruction _inst, int _var)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 5));
+ VMB.Buffer.WriteInteger(_var);
+ }
+
+ private void EmitIVar(eVM_Instruction _inst, int _var, eVM_Type _target)
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, VMBuffer.EncodeArgDouble(5, (int)_target)));
+ VMB.Buffer.WriteInteger(_var);
+ }
+
+ private void Emit(eVM_Instruction _inst, VMLabel _label)
+ {
+ if (!_label.Marked)
+ {
+ _label.Patches.Add((int)VMB.Buffer.Position);
+ VMB.Add(VMBuffer.EncodeInstructionBranch((int)_inst, 0));
+ }
+ else
+ {
+ long num = _label.Address - VMB.Buffer.Position;
+ VMB.Add(VMBuffer.EncodeInstructionBranch((int)_inst, (int)num));
+ }
+ }
+
+ private void EmitDebugInfo(GMLToken _tok)
+ {
+ }
+
+ public void Error(string _errorMessage, GMLToken _token)
+ {
+ if (!Program.InhibitErrorOutput)
+ {
+ int num = 1;
+ for (int i = 0; i < _token.Index; i++)
+ {
+ if (Code.Code[i] == '\n')
+ {
+ num++;
+ }
+ }
+ Console.WriteLine("Error : {0}({1}) : {2}", Code.Name, num, _errorMessage);
+ }
+ ms_numErrors++;
+ ErrorFlag = true;
+ Program.ExitCode = 1;
+ }
+
+ private void CompileConstant(GMLToken _tok)
+ {
+ switch (_tok.Value.Kind)
+ {
+ case eKind.eConstant:
+ Error("constant token", _tok);
+ break;
+ case eKind.eNone:
+ Error("None constant token", _tok);
+ break;
+ case eKind.eNumber:
+ {
+ double num = (long)_tok.Value.ValueI;
+ if (num == _tok.Value.ValueI)
+ {
+ long num2 = (long)_tok.Value.ValueI;
+ if (num2 > int.MaxValue || num2 < int.MinValue)
+ {
+ EmitI(eVM_Instruction.eVMI_PUSH, num2);
+ TypeStack.Push(eVM_Type.eVMT_Long);
+ }
+ else if (num2 > 32767 || num2 < -32768)
+ {
+ EmitI(eVM_Instruction.eVMI_PUSH, (int)num2);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ else
+ {
+ VMB.Add(VMBuffer.EncodeInstructionArg(192, 15) | (int)(num2 & 0xFFFF));
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ }
+ else
+ {
+ EmitI(eVM_Instruction.eVMI_PUSH, _tok.Value.ValueI);
+ TypeStack.Push(eVM_Type.eVMT_Double);
+ }
+ break;
+ }
+ case eKind.eString:
+ EmitI(eVM_Instruction.eVMI_PUSH, _tok.Value.ValueS);
+ TypeStack.Push(eVM_Type.eVMT_String);
+ break;
+ }
+ }
+
+ private void BinaryTypeCoercion(GMLToken _tok, int _parmNum)
+ {
+ eVM_Type eVM_Type = TypeStack.Peek();
+ switch (_tok.Children[1].Token)
+ {
+ case eToken.eNot:
+ case eToken.eLess:
+ case eToken.eLessEqual:
+ case eToken.eEqual:
+ case eToken.eNotEqual:
+ case eToken.eGreaterEqual:
+ case eToken.eGreater:
+ case eToken.eBitNegate:
+ break;
+ case eToken.ePlus:
+ case eToken.eMinus:
+ case eToken.eTime:
+ case eToken.eDivide:
+ case eToken.eDiv:
+ case eToken.eMod:
+ if (eVM_Type == eVM_Type.eVMT_Bool)
+ {
+ TypeStack.Pop();
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ break;
+ case eToken.eAnd:
+ case eToken.eOr:
+ case eToken.eXor:
+ if (eVM_Type != eVM_Type.eVMT_Bool)
+ {
+ TypeStack.Pop();
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Bool);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ }
+ break;
+ case eToken.eBitOr:
+ case eToken.eBitAnd:
+ case eToken.eBitXor:
+ case eToken.eBitShiftLeft:
+ case eToken.eBitShiftRight:
+ if (eVM_Type == eVM_Type.eVMT_Int)
+ {
+ TypeStack.Pop();
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ break;
+ }
+ }
+
+ private int TypeSize(eVM_Type _t)
+ {
+ int result = 0;
+ switch (_t)
+ {
+ case eVM_Type.eVMT_Double:
+ result = 8;
+ break;
+ case eVM_Type.eVMT_Long:
+ result = 8;
+ break;
+ case eVM_Type.eVMT_String:
+ result = 4;
+ break;
+ case eVM_Type.eVMT_Variable:
+ result = 12;
+ break;
+ case eVM_Type.eVMT_Float:
+ result = 4;
+ break;
+ case eVM_Type.eVMT_Bool:
+ result = 4;
+ break;
+ case eVM_Type.eVMT_Int:
+ result = 4;
+ break;
+ }
+ return result;
+ }
+
+ private void CompileBinary(GMLToken _tok)
+ {
+ CompileExpression(_tok.Children[0]);
+ BinaryTypeCoercion(_tok, 1);
+ CompileExpression(_tok.Children[2]);
+ BinaryTypeCoercion(_tok, 2);
+ eVM_Type eVM_Type = TypeStack.Pop();
+ eVM_Type eVM_Type2 = TypeStack.Pop();
+ int num = TypeSize(eVM_Type);
+ int num2 = TypeSize(eVM_Type2);
+ eVM_Type item = (num > num2) ? eVM_Type : eVM_Type2;
+ switch (_tok.Children[1].Token)
+ {
+ case eToken.eTime:
+ Emit(eVM_Instruction.eVMI_MUL, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eDivide:
+ Emit(eVM_Instruction.eVMI_DIV, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eDiv:
+ Emit(eVM_Instruction.eVMI_REM, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eMod:
+ Emit(eVM_Instruction.eVMI_MOD, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.ePlus:
+ Emit(eVM_Instruction.eVMI_ADD, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eMinus:
+ Emit(eVM_Instruction.eVMI_SUB, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eLess:
+ Emit(eVM_Instruction.eVMI_SET_LT, eVM_Type, eVM_Type2);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ break;
+ case eToken.eLessEqual:
+ Emit(eVM_Instruction.eVMI_SET_LE, eVM_Type, eVM_Type2);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ break;
+ case eToken.eAssign:
+ case eToken.eEqual:
+ Emit(eVM_Instruction.eVMI_SET_EQ, eVM_Type, eVM_Type2);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ break;
+ case eToken.eNotEqual:
+ Emit(eVM_Instruction.eVMI_SET_NE, eVM_Type, eVM_Type2);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ break;
+ case eToken.eGreaterEqual:
+ Emit(eVM_Instruction.eVMI_SET_GE, eVM_Type, eVM_Type2);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ break;
+ case eToken.eGreater:
+ Emit(eVM_Instruction.eVMI_SET_GT, eVM_Type, eVM_Type2);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ break;
+ case eToken.eAnd:
+ case eToken.eBitAnd:
+ Emit(eVM_Instruction.eVMI_AND, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eOr:
+ case eToken.eBitOr:
+ Emit(eVM_Instruction.eVMI_OR, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eXor:
+ case eToken.eBitXor:
+ Emit(eVM_Instruction.eVMI_XOR, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eBitShiftLeft:
+ Emit(eVM_Instruction.eVMI_SHL, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ case eToken.eBitShiftRight:
+ Emit(eVM_Instruction.eVMI_SHR, eVM_Type, eVM_Type2);
+ TypeStack.Push(item);
+ break;
+ }
+ }
+
+ private void CompileUnary(GMLToken _tok)
+ {
+ CompileExpression(_tok.Children[0]);
+ eVM_Type eVM_Type = TypeStack.Peek();
+ switch (_tok.Id)
+ {
+ case 203:
+ switch (eVM_Type)
+ {
+ case eVM_Type.eVMT_String:
+ case eVM_Type.eVMT_Error:
+ Error("Unable to Not a string", _tok);
+ break;
+ case eVM_Type.eVMT_Double:
+ case eVM_Type.eVMT_Float:
+ case eVM_Type.eVMT_Int:
+ case eVM_Type.eVMT_Long:
+ case eVM_Type.eVMT_Variable:
+ TypeStack.Pop();
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Bool);
+ TypeStack.Push(eVM_Type.eVMT_Bool);
+ eVM_Type = eVM_Type.eVMT_Bool;
+ break;
+ }
+ Emit(eVM_Instruction.eVMI_NOT, eVM_Type);
+ break;
+ case 211:
+ Emit(eVM_Instruction.eVMI_NEG, eVM_Type);
+ break;
+ case 220:
+ switch (eVM_Type)
+ {
+ case eVM_Type.eVMT_String:
+ case eVM_Type.eVMT_Error:
+ Error("Unable to Negate a string", _tok);
+ break;
+ case eVM_Type.eVMT_Double:
+ case eVM_Type.eVMT_Float:
+ case eVM_Type.eVMT_Variable:
+ TypeStack.Pop();
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ eVM_Type = eVM_Type.eVMT_Int;
+ break;
+ }
+ Emit(eVM_Instruction.eVMI_NOT, eVM_Type);
+ break;
+ }
+ }
+
+ private void CompileVariable(GMLToken _tok)
+ {
+ switch (_tok.Token)
+ {
+ case eToken.eVariable:
+ case eToken.eDot:
+ if (_tok.Children.Count >= 2)
+ {
+ int num = 0;
+ CompileExpression(_tok.Children[0]);
+ if (TypeStack.Peek() != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, TypeStack.Pop(), eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ if (_tok.Children[1].Children.Count > 0)
+ {
+ CompileExpression(_tok.Children[1].Children[0]);
+ if (TypeStack.Peek() != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, TypeStack.Pop(), eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ if (_tok.Children[1].Children.Count > 1)
+ {
+ EmitI(eVM_Instruction.eVMI_PUSH, 32000);
+ Emit(eVM_Instruction.eVMI_MUL, eVM_Type.eVMT_Int, eVM_Type.eVMT_Int);
+ CompileExpression(_tok.Children[1].Children[1]);
+ if (TypeStack.Peek() != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, TypeStack.Pop(), eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ Emit(eVM_Instruction.eVMI_ADD, eVM_Type.eVMT_Int, eVM_Type.eVMT_Int);
+ TypeStack.Pop();
+ }
+ TypeStack.Pop();
+ }
+ else
+ {
+ num |= int.MinValue;
+ }
+ TypeStack.Pop();
+ EmitIVar(eVM_Instruction.eVMI_PUSH, _tok.Children[1].Id | num);
+ TypeStack.Push(eVM_Type.eVMT_Variable);
+ }
+ else
+ {
+ Error("Malformed variable reference", _tok);
+ }
+ break;
+ case eToken.eConstant:
+ Error("Unsure where these come from", _tok);
+ break;
+ }
+ }
+
+ private void CompileExpression(GMLToken _tok)
+ {
+ EmitDebugInfo(_tok);
+ switch (_tok.Token)
+ {
+ case eToken.eConstant:
+ CompileConstant(_tok);
+ break;
+ case eToken.eBinary:
+ CompileBinary(_tok);
+ break;
+ case eToken.eUnary:
+ CompileUnary(_tok);
+ break;
+ case eToken.eFunction:
+ CompileFunction(_tok);
+ break;
+ case eToken.eVariable:
+ case eToken.eDot:
+ CompileVariable(_tok);
+ break;
+ }
+ }
+
+ private void CompileGlobalVar(GMLToken _tok)
+ {
+ }
+
+ private void CompileRepeat(GMLToken _tok)
+ {
+ VMLabel vMLabel = new VMLabel("End", VMB);
+ VMLabel vMLabel2 = new VMLabel("Repeat", VMB);
+ CompileExpression(_tok.Children[0]);
+ eVM_Type eVM_Type = TypeStack.Pop();
+ if (eVM_Type != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Int);
+ }
+ Emit(eVM_Instruction.eVMI_DUP, eVM_Type.eVMT_Int);
+ EmitI(eVM_Instruction.eVMI_PUSH, 0);
+ Emit(eVM_Instruction.eVMI_SET_LE, eVM_Type.eVMT_Int, eVM_Type.eVMT_Int);
+ Emit(eVM_Instruction.eVMI_BTRUE, vMLabel);
+ LoopEnv.Push(vMLabel2);
+ LoopEndEnv.Push(vMLabel);
+ vMLabel2.Mark(VMB.Buffer.Position);
+ CompileStatement(_tok.Children[1]);
+ EmitI(eVM_Instruction.eVMI_PUSH, 1);
+ Emit(eVM_Instruction.eVMI_SUB, eVM_Type.eVMT_Int, eVM_Type.eVMT_Int);
+ Emit(eVM_Instruction.eVMI_DUP, eVM_Type.eVMT_Int);
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type.eVMT_Int, eVM_Type.eVMT_Bool);
+ Emit(eVM_Instruction.eVMI_BTRUE, vMLabel2);
+ vMLabel.Mark(VMB.Buffer.Position);
+ Emit(eVM_Instruction.eVMI_POPNULL, eVM_Type.eVMT_Int);
+ LoopEnv.Pop();
+ LoopEndEnv.Pop();
+ }
+
+ private void CompileIf(GMLToken _tok)
+ {
+ }
+
+ private void CompileWhile(GMLToken _tok)
+ {
+ }
+
+ private void CompileDo(GMLToken _tok)
+ {
+ }
+
+ private void CompileFor(GMLToken _tok)
+ {
+ }
+
+ private void CompileWith(GMLToken _tok)
+ {
+ }
+
+ private void CompileSwitch(GMLToken _tok)
+ {
+ }
+
+ private void CompileFunction(GMLToken _tok)
+ {
+ foreach (GMLToken child in _tok.Children)
+ {
+ CompileExpression(child);
+ eVM_Type eVM_Type = TypeStack.Pop();
+ if (eVM_Type != eVM_Type.eVMT_Variable)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Variable);
+ }
+ }
+ EmitI(eVM_Instruction.eVMI_CALL, _tok.Id);
+ TypeStack.Push(GMAssetCompiler.eVM_Type.eVMT_Variable);
+ }
+
+ private void CompilePop(GMLToken _tok, eVM_Type _type)
+ {
+ switch (_tok.Token)
+ {
+ case eToken.eVariable:
+ case eToken.eDot:
+ if (_tok.Children.Count >= 2)
+ {
+ int num = 0;
+ CompileExpression(_tok.Children[0]);
+ if (TypeStack.Peek() != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, TypeStack.Pop(), eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ if (_tok.Children[1].Children.Count > 0)
+ {
+ CompileExpression(_tok.Children[1].Children[0]);
+ if (TypeStack.Peek() != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, TypeStack.Pop(), eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ if (_tok.Children[1].Children.Count > 1)
+ {
+ EmitI(eVM_Instruction.eVMI_PUSH, 32000);
+ Emit(eVM_Instruction.eVMI_MUL, eVM_Type.eVMT_Int, eVM_Type.eVMT_Int);
+ CompileExpression(_tok.Children[1].Children[1]);
+ if (TypeStack.Peek() != eVM_Type.eVMT_Int)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, TypeStack.Pop(), eVM_Type.eVMT_Int);
+ TypeStack.Push(eVM_Type.eVMT_Int);
+ }
+ Emit(eVM_Instruction.eVMI_ADD, eVM_Type.eVMT_Int, eVM_Type.eVMT_Int);
+ TypeStack.Pop();
+ }
+ TypeStack.Pop();
+ }
+ else
+ {
+ num |= int.MinValue;
+ }
+ TypeStack.Pop();
+ EmitIVar(eVM_Instruction.eVMI_POP, _tok.Children[1].Id | num, _type);
+ TypeStack.Push(eVM_Type.eVMT_Variable);
+ }
+ else
+ {
+ Error("Malformed variable reference", _tok);
+ }
+ break;
+ case eToken.eConstant:
+ Error("Unsure where these come from", _tok);
+ break;
+ }
+ }
+
+ private void CompileAssign(GMLToken _tok)
+ {
+ switch (_tok.Children[1].Token)
+ {
+ case eToken.eAssign:
+ CompileExpression(_tok.Children[2]);
+ CompilePop(_tok.Children[0], TypeStack.Pop());
+ break;
+ case eToken.eAssignPlus:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type3 = TypeStack.Pop();
+ if (eVM_Type3 == eVM_Type.eVMT_Bool)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type3, eVM_Type.eVMT_Int);
+ eVM_Type3 = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_ADD, eVM_Type3, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ case eToken.eAssignMinus:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type7 = TypeStack.Pop();
+ if (eVM_Type7 == eVM_Type.eVMT_Bool)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type7, eVM_Type.eVMT_Int);
+ eVM_Type7 = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_SUB, eVM_Type7, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ case eToken.eAssignTimes:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type2 = TypeStack.Pop();
+ if (eVM_Type2 == eVM_Type.eVMT_Bool)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type2, eVM_Type.eVMT_Int);
+ eVM_Type2 = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_MUL, eVM_Type2, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ case eToken.eAssignDivide:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type6 = TypeStack.Pop();
+ if (eVM_Type6 == eVM_Type.eVMT_Bool)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type6, eVM_Type.eVMT_Int);
+ eVM_Type6 = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_DIV, eVM_Type6, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ case eToken.eAssignOr:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type4 = TypeStack.Pop();
+ if (eVM_Type4 != eVM_Type.eVMT_Int && eVM_Type4 != eVM_Type.eVMT_Long)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type4, eVM_Type.eVMT_Int);
+ eVM_Type4 = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_OR, eVM_Type4, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ case eToken.eAssignAnd:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type5 = TypeStack.Pop();
+ if (eVM_Type5 != eVM_Type.eVMT_Int && eVM_Type5 != eVM_Type.eVMT_Long)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type5, eVM_Type.eVMT_Int);
+ eVM_Type5 = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_AND, eVM_Type5, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ case eToken.eAssignXor:
+ {
+ CompileVariable(_tok.Children[0]);
+ TypeStack.Pop();
+ CompileExpression(_tok.Children[2]);
+ eVM_Type eVM_Type = TypeStack.Pop();
+ if (eVM_Type != eVM_Type.eVMT_Int && eVM_Type != eVM_Type.eVMT_Long)
+ {
+ Emit(eVM_Instruction.eVMI_CONV, eVM_Type, eVM_Type.eVMT_Int);
+ eVM_Type = eVM_Type.eVMT_Int;
+ }
+ Emit(eVM_Instruction.eVMI_XOR, eVM_Type, eVM_Type.eVMT_Variable);
+ CompilePop(_tok.Children[0], eVM_Type.eVMT_Variable);
+ break;
+ }
+ }
+ }
+
+ private void CompileReturn(GMLToken _tok)
+ {
+ }
+
+ private void CompileBreak(GMLToken _tok)
+ {
+ }
+
+ private void CompileExit(GMLToken _tok)
+ {
+ }
+
+ private void CompileContinue(GMLToken _tok)
+ {
+ }
+
+ private void CompileStatement(GMLToken _tok)
+ {
+ EmitDebugInfo(_tok);
+ switch (_tok.Token)
+ {
+ case eToken.eVar:
+ break;
+ case eToken.eGlobalVar:
+ CompileGlobalVar(_tok);
+ break;
+ case eToken.eBegin:
+ case eToken.eBlock:
+ CompileBlock(_tok);
+ break;
+ case eToken.eRepeat:
+ CompileRepeat(_tok);
+ break;
+ case eToken.eIf:
+ CompileIf(_tok);
+ break;
+ case eToken.eWhile:
+ CompileWhile(_tok);
+ break;
+ case eToken.eDo:
+ CompileDo(_tok);
+ break;
+ case eToken.eFor:
+ CompileFor(_tok);
+ break;
+ case eToken.eWith:
+ CompileWith(_tok);
+ break;
+ case eToken.eSwitch:
+ CompileSwitch(_tok);
+ break;
+ case eToken.eFunction:
+ CompileFunction(_tok);
+ break;
+ case eToken.eAssign:
+ CompileAssign(_tok);
+ break;
+ case eToken.eReturn:
+ CompileReturn(_tok);
+ break;
+ case eToken.eBreak:
+ CompileBreak(_tok);
+ break;
+ case eToken.eExit:
+ CompileExit(_tok);
+ break;
+ case eToken.eContinue:
+ CompileContinue(_tok);
+ break;
+ default:
+ Error("Token is undefined at CompileStatement", _tok);
+ break;
+ }
+ }
+
+ private void CompileBlock(GMLToken _tok)
+ {
+ foreach (GMLToken child in _tok.Children)
+ {
+ CompileStatement(child);
+ }
+ }
+
+ private void CompileProgram(GMLToken _tok)
+ {
+ switch (_tok.Token)
+ {
+ case eToken.eEOF:
+ break;
+ case eToken.eBlock:
+ CompileBlock(_tok);
+ break;
+ default:
+ Error("No program to compile", _tok);
+ break;
+ }
+ }
+
+ private GMLToken RewriteVariable(GMLToken _tok)
+ {
+ GMLToken gMLToken = new GMLToken(_tok);
+ gMLToken.Token = eToken.eDot;
+ gMLToken.Children = new List(2);
+ gMLToken.Children.Add(new GMLToken(eToken.eConstant, _tok, -6, new GMLValue(-6.0)));
+ gMLToken.Children.Add(_tok);
+ return gMLToken;
+ }
+
+ private GMLToken RewriteDot(GMLToken _tok)
+ {
+ GMLToken gMLToken = null;
+ if (_tok.Children.Count > 2)
+ {
+ gMLToken = new GMLToken(_tok);
+ GMLToken gMLToken2 = gMLToken;
+ gMLToken2.Children = new List(2);
+ gMLToken2.Children.Add(null);
+ gMLToken2.Children.Add(null);
+ gMLToken2.Children[1] = _tok.Children[_tok.Children.Count - 1];
+ for (int num = _tok.Children.Count - 2; num > 2; num--)
+ {
+ gMLToken2.Children[0] = new GMLToken(_tok);
+ gMLToken2.Children[0].Children = new List(2);
+ gMLToken2.Children[0].Children.Add(null);
+ gMLToken2.Children[0].Children.Add(null);
+ gMLToken2.Children[0].Children[1] = _tok.Children[num];
+ gMLToken2 = gMLToken2.Children[0];
+ }
+ gMLToken2.Children[0] = new GMLToken(_tok);
+ gMLToken2.Children[0].Children = new List(2);
+ gMLToken2.Children[0].Children.Add(null);
+ gMLToken2.Children[0].Children.Add(null);
+ gMLToken2.Children[0].Children[1] = _tok.Children[1];
+ gMLToken2.Children[0].Children[0] = _tok.Children[0];
+ }
+ return gMLToken;
+ }
+
+ private GMLToken RewriteTree(GMLToken _tok)
+ {
+ GMLToken result = null;
+ bool flag = true;
+ switch (_tok.Token)
+ {
+ case eToken.eDot:
+ result = RewriteDot(_tok);
+ flag = false;
+ break;
+ case eToken.eVariable:
+ result = RewriteVariable(_tok);
+ flag = false;
+ break;
+ }
+ if (flag)
+ {
+ for (int i = 0; i < _tok.Children.Count; i++)
+ {
+ GMLToken gMLToken = RewriteTree(_tok.Children[i]);
+ if (gMLToken != null)
+ {
+ _tok.Children[i] = gMLToken;
+ }
+ }
+ }
+ return result;
+ }
+
+ private int ParamSize(int _arg)
+ {
+ int result = 0;
+ switch (_arg & 0xF)
+ {
+ case 0:
+ result = 8;
+ break;
+ case 3:
+ result = 8;
+ break;
+ case 1:
+ case 2:
+ case 4:
+ case 5:
+ case 6:
+ result = 4;
+ break;
+ }
+ return result;
+ }
+
+ private string Instruction2String(int _ins)
+ {
+ string result = "unknown";
+ switch (_ins)
+ {
+ case 192:
+ result = "push";
+ break;
+ case 65:
+ result = "pop";
+ break;
+ case 130:
+ result = "dup";
+ break;
+ case 4:
+ result = "mul";
+ break;
+ case 5:
+ result = "div";
+ break;
+ case 6:
+ result = "rem";
+ break;
+ case 7:
+ result = "mod";
+ break;
+ case 8:
+ result = "add";
+ break;
+ case 9:
+ result = "sub";
+ break;
+ case 3:
+ result = "conv";
+ break;
+ case 10:
+ result = "and";
+ break;
+ case 11:
+ result = "or";
+ break;
+ case 12:
+ result = "xor";
+ break;
+ case 13:
+ result = "neg";
+ break;
+ case 14:
+ result = "not";
+ break;
+ case 15:
+ result = "shl";
+ break;
+ case 16:
+ result = "shr";
+ break;
+ case 17:
+ result = "slt";
+ break;
+ case 18:
+ result = "sle";
+ break;
+ case 19:
+ result = "seq";
+ break;
+ case 20:
+ result = "sne";
+ break;
+ case 21:
+ result = "sge";
+ break;
+ case 22:
+ result = "sgt";
+ break;
+ case 183:
+ result = "b";
+ break;
+ case 184:
+ result = "bt";
+ break;
+ case 185:
+ result = "bf";
+ break;
+ case 218:
+ result = "call";
+ break;
+ case 187:
+ result = "pushenv";
+ break;
+ case 188:
+ result = "popenv";
+ break;
+ case 157:
+ result = "ret";
+ break;
+ case 158:
+ result = "exit";
+ break;
+ case 159:
+ result = "popz";
+ break;
+ case 255:
+ result = "break";
+ break;
+ }
+ return result;
+ }
+
+ private string Arg2String(int _arg)
+ {
+ string result = "";
+ switch (_arg & 0xF)
+ {
+ case 3:
+ result = ".l";
+ break;
+ case 0:
+ result = ".d";
+ break;
+ case 2:
+ result = ".i";
+ break;
+ case 5:
+ result = ".v";
+ break;
+ case 6:
+ result = ".s";
+ break;
+ case 1:
+ result = ".f";
+ break;
+ case 4:
+ result = ".b";
+ break;
+ case 15:
+ result = ".e";
+ break;
+ }
+ return result;
+ }
+
+ public int DisasmOne(VMBuffer _vmb, int _offs, TextWriter _sw)
+ {
+ int num = _offs;
+ int @int = _vmb.GetInt(_offs);
+ _offs += 4;
+ int instruction = VMBuffer.GetInstruction(@int);
+ int arg = VMBuffer.GetArg(@int);
+ int num2 = _offs;
+ if ((instruction & 0x40) != 0)
+ {
+ _offs += ParamSize(arg);
+ }
+ int i = 11;
+ _sw.Write("{0:x8} : ", num);
+ int num3 = num;
+ while (num3 < _offs)
+ {
+ _sw.Write("{0:x2}", _vmb.Buffer.GetBuffer()[num3]);
+ num3++;
+ i += 2;
+ }
+ for (; i < 36; i++)
+ {
+ _sw.Write(" ");
+ }
+ string text = Instruction2String(instruction);
+ _sw.Write(text);
+ i += text.Length;
+ if ((instruction & 0xA0) == 128)
+ {
+ _sw.Write(Arg2String(arg));
+ i += 2;
+ }
+ else if ((instruction & 0xA0) == 0)
+ {
+ _sw.Write(Arg2String(arg & 0xF));
+ _sw.Write(Arg2String(arg >> 4));
+ i += 4;
+ }
+ for (; i < 46; i++)
+ {
+ _sw.Write(" ");
+ }
+ if ((instruction & 0x40) != 0)
+ {
+ long position = _vmb.Buffer.Position;
+ _vmb.Buffer.Position = num2;
+ switch (arg & 0xF)
+ {
+ case 3:
+ _sw.Write("{0}", _vmb.Buffer.ReadLong());
+ break;
+ case 0:
+ _sw.Write("{0}", _vmb.Buffer.ReadDouble());
+ break;
+ case 2:
+ _sw.Write("{0}", _vmb.Buffer.ReadInteger());
+ break;
+ case 5:
+ _sw.Write("{0}", _vmb.Buffer.ReadInteger() & 0x1FFFFFFF);
+ break;
+ case 6:
+ _sw.Write("{0}", Strings[_vmb.Buffer.ReadInteger()]);
+ break;
+ case 1:
+ _sw.Write("{0}", _vmb.Buffer.ReadSingle());
+ break;
+ case 4:
+ _sw.Write("{0}", _vmb.Buffer.ReadInteger() != 0);
+ break;
+ case 15:
+ _sw.Write("{0}", @int << 16 >> 16);
+ break;
+ }
+ _vmb.Buffer.Position = position;
+ }
+ else if ((instruction & 0x20) != 0)
+ {
+ int num4 = num + VMBuffer.GetBranch(@int);
+ _sw.WriteLine("0x{0:x8}", num4);
+ }
+ _sw.WriteLine("");
+ return _offs;
+ }
+
+ public void Disasm(TextWriter _sw)
+ {
+ for (int num = 0; num < VMB.Buffer.Position; num = DisasmOne(VMB, num, _sw))
+ {
+ }
+ }
+
+ public void Compile(GMAssets _assets, GMLCode _code)
+ {
+ Code = _code;
+ if (Program.CompileVerbose)
+ {
+ RewriteTree(_code.Token);
+ CompileProgram(_code.Token);
+ Disasm(Program.Out);
+ }
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMLCode.cs b/GMAC1098/GMAssetCompiler/GMLCode.cs
new file mode 100644
index 0000000..b1ff1a1
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMLCode.cs
@@ -0,0 +1,47 @@
+using System.Collections.Generic;
+
+namespace GMAssetCompiler
+{
+ public class GMLCode
+ {
+ public eGMLCodeType Type
+ {
+ get;
+ set;
+ }
+
+ public string Name
+ {
+ get;
+ set;
+ }
+
+ public string Code
+ {
+ get;
+ set;
+ }
+
+ public GMLToken Token
+ {
+ get;
+ set;
+ }
+
+ public List Errors
+ {
+ get;
+ set;
+ }
+
+ public GMLCode(GMAssets _assets, string _name, string _code, eGMLCodeType _type)
+ {
+ Name = _name.Replace(' ', '_').Replace('\t', '_');
+ Code = _code;
+ Type = _type;
+ List _errors = null;
+ Token = GMLCompile.Compile(_assets, Name, Code, out _errors);
+ Errors = _errors;
+ }
+ }
+}
diff --git a/GMAC1098/GMAssetCompiler/GMLCompile.cs b/GMAC1098/GMAssetCompiler/GMLCompile.cs
new file mode 100644
index 0000000..cc825ca
--- /dev/null
+++ b/GMAC1098/GMAssetCompiler/GMLCompile.cs
@@ -0,0 +1,3559 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Windows.Forms;
+
+namespace GMAssetCompiler
+{
+ internal class GMLCompile
+ {
+ public const int OBJECT_SELF = -1;
+
+ public const int OBJECT_OTHER = -2;
+
+ public const int OBJECT_ALL = -3;
+
+ public const int OBJECT_NOONE = -4;
+
+ public const int OBJECT_GLOBAL = -5;
+
+ public const int OBJECT_LOCAL = -7;
+
+ public const int OBJECT_NOTSPECIFIED = -6;
+
+ private const int clBlack = 0;
+
+ private const int clMaroon = 128;
+
+ private const int clGreen = 32768;
+
+ private const int clOlive = 32896;
+
+ private const int clNavy = 8388608;
+
+ private const int clPurple = 8388736;
+
+ private const int clTeal = 8421376;
+
+ private const int clGray = 8421504;
+
+ private const int clSilver = 12632256;
+
+ private const int clRed = 255;
+
+ private const int clLime = 65280;
+
+ private const int clYellow = 65535;
+
+ private const int clBlue = 16711680;
+
+ private const int clFuchsia = 16711935;
+
+ private const int clAqua = 16776960;
+
+ private const int clLtGray = 12632256;
+
+ private const int clDkGray = 8421504;
+
+ private const int clWhite = 16777215;
+
+ private const int clMoneyGreen = 12639424;
+
+ private const int clSkyBlue = 15780518;
+
+ private const int clCream = 15793151;
+
+ private const int clMedGray = 10789024;
+
+ private const int EVENT_CREATE = 0;
+
+ private const int EVENT_DESTROY = 1;
+
+ private const int EVENT_ALARM = 2;
+
+ private const int EVENT_STEP = 3;
+
+ private const int EVENT_COLLISION = 4;
+
+ private const int EVENT_KEYBOARD = 5;
+
+ private const int EVENT_MOUSE = 6;
+
+ private const int EVENT_OTHER = 7;
+
+ private const int EVENT_DRAW = 8;
+
+ private const int EVENT_KEYPRESS = 9;
+
+ private const int EVENT_KEYRELEASE = 10;
+
+ private const int EVENT_TRIGGER = 11;
+
+ private const int VK_RETURN = 13;
+
+ private const int VK_SHIFT = 16;
+
+ private const int VK_CONTROL = 17;
+
+ private const int VK_MENU = 18;
+
+ private const int VK_ESCAPE = 27;
+
+ private const int VK_SPACE = 32;
+
+ private const int VK_BACK = 8;
+
+ private const int VK_TAB = 9;
+
+ private const int VK_PAUSE = 19;
+
+ private const int VK_SNAPSHOT = 44;
+
+ private const int VK_LEFT = 37;
+
+ private const int VK_RIGHT = 39;
+
+ private const int VK_UP = 38;
+
+ private const int VK_DOWN = 40;
+
+ private const int VK_HOME = 36;
+
+ private const int VK_END = 35;
+
+ private const int VK_DELETE = 46;
+
+ private const int VK_INSERT = 45;
+
+ private const int VK_PRIOR = 33;
+
+ private const int VK_NEXT = 34;
+
+ private const int VK_F1 = 112;
+
+ private const int VK_F2 = 113;
+
+ private const int VK_F3 = 114;
+
+ private const int VK_F4 = 115;
+
+ private const int VK_F5 = 116;
+
+ private const int VK_F6 = 117;
+
+ private const int VK_F7 = 118;
+
+ private const int VK_F8 = 119;
+
+ private const int VK_F9 = 120;
+
+ private const int VK_F10 = 121;
+
+ private const int VK_F11 = 128;
+
+ private const int VK_F12 = 129;
+
+ private const int VK_NUMPAD0 = 96;
+
+ private const int VK_NUMPAD1 = 97;
+
+ private const int VK_NUMPAD2 = 98;
+
+ private const int VK_NUMPAD3 = 99;
+
+ private const int VK_NUMPAD4 = 100;
+
+ private const int VK_NUMPAD5 = 101;
+
+ private const int VK_NUMPAD6 = 102;
+
+ private const int VK_NUMPAD7 = 103;
+
+ private const int VK_NUMPAD8 = 104;
+
+ private const int VK_NUMPAD9 = 105;
+
+ private const int VK_DIVIDE = 111;
+
+ private const int VK_MULTIPLY = 106;
+
+ private const int VK_SUBTRACT = 109;
+
+ private const int VK_ADD = 107;
+
+ private const int VK_DECIMAL = 110;
+
+ private const int VK_LSHIFT = 160;
+
+ private const int VK_LCONTROL = 162;
+
+ private const int VK_LMENU = 164;
+
+ private const int VK_RSHIFT = 161;
+
+ private const int VK_RCONTROL = 163;
+
+ private const int VK_RMENU = 165;
+
+ public static Dictionary ms_constants = new Dictionary();
+
+ public static Dictionary ms_ConstantCount = new Dictionary();
+
+ public static Dictionary ms_funcs = new Dictionary();
+
+ public static Dictionary ms_builtins = new Dictionary();
+
+ public static Dictionary ms_builtinsArray = new Dictionary();
+
+ public static Dictionary ms_builtinsLocal = new Dictionary();
+
+ public static Dictionary ms_builtinsLocalArray = new Dictionary();
+
+ private static Dictionary ms_vars = new Dictionary();
+
+ public static int ms_id = 0;
+
+ private static GMAssets ms_assets = null;
+
+ private static string ms_script = string.Empty;
+
+ private static List ms_errors = null;
+
+ private static bool ms_error = false;
+
+ private static int ms_numErrors = 0;
+
+ private static string ms_scriptName = "";
+
+ private static void SkipWhitespace(string _script, ref int _index)
+ {
+ bool flag = false;
+ while (!flag)
+ {
+ while (_index < _script.Length && char.IsWhiteSpace(_script[_index]))
+ {
+ _index++;
+ }
+ if (_index < _script.Length && _script[_index] == '/')
+ {
+ if (_index + 1 < _script.Length)
+ {
+ switch (_script[_index + 1])
+ {
+ case '*':
+ _index += 2;
+ while (_index < _script.Length && (_script[_index] != '*' || _script[_index + 1] != '/'))
+ {
+ _index++;
+ }
+ if (_index >= _script.Length)
+ {
+ ms_errors.Add(new GMLError(eErrorKind.Warning_Unclosed_Comment, "unclosed comment (/*) at tend of script", null, _index));
+ }
+ else
+ {
+ _index += 2;
+ }
+ break;
+ case '/':
+ _index += 2;
+ while (_index < _script.Length && _script[_index] != '\n' && _script[_index] != '\r')
+ {
+ _index++;
+ }
+ _index++;
+ break;
+ default:
+ flag = true;
+ break;
+ }
+ }
+ else
+ {
+ flag = true;
+ }
+ }
+ else
+ {
+ flag = true;
+ }
+ }
+ }
+
+ private static GMLToken NextName(string _script, ref int _index)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ int index = _index;
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ while (_index < _script.Length && (char.IsLetterOrDigit(_script[_index]) || _script[_index] == '_'))
+ {
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ }
+ string text = stringBuilder.ToString();
+ switch (text)
+ {
+ case "var":
+ return new GMLToken(eToken.eVar, index, text);
+ case "if":
+ return new GMLToken(eToken.eIf, index, text);
+ case "end":
+ return new GMLToken(eToken.eEnd, index, text);
+ case "else":
+ return new GMLToken(eToken.eElse, index, text);
+ case "while":
+ return new GMLToken(eToken.eWhile, index, text);
+ case "do":
+ return new GMLToken(eToken.eDo, index, text);
+ case "for":
+ return new GMLToken(eToken.eFor, index, text);
+ case "begin":
+ return new GMLToken(eToken.eBegin, index, text);
+ case "then":
+ return new GMLToken(eToken.eThen, index, text);
+ case "with":
+ return new GMLToken(eToken.eWith, index, text);
+ case "until":
+ return new GMLToken(eToken.eUntil, index, text);
+ case "repeat":
+ return new GMLToken(eToken.eRepeat, index, text);
+ case "exit":
+ return new GMLToken(eToken.eExit, index, text);
+ case "return":
+ return new GMLToken(eToken.eReturn, index, text);
+ case "break":
+ return new GMLToken(eToken.eBreak, index, text);
+ case "continue":
+ return new GMLToken(eToken.eContinue, index, text);
+ case "switch":
+ return new GMLToken(eToken.eSwitch, index, text);
+ case "case":
+ return new GMLToken(eToken.eCase, index, text);
+ case "default":
+ return new GMLToken(eToken.eDefault, index, text);
+ case "and":
+ return new GMLToken(eToken.eAnd, index, text);
+ case "or":
+ return new GMLToken(eToken.eOr, index, text);
+ case "not":
+ return new GMLToken(eToken.eNot, index, text);
+ case "div":
+ return new GMLToken(eToken.eDiv, index, text);
+ case "mod":
+ return new GMLToken(eToken.eMod, index, text);
+ case "xor":
+ return new GMLToken(eToken.eBitXor, index, text);
+ case "globalvar":
+ return new GMLToken(eToken.eGlobalVar, index, text);
+ default:
+ return new GMLToken(eToken.eName, index, text);
+ }
+ }
+
+ private static GMLToken NextValue(string _script, ref int _index)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ int index = _index;
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ while (_index < _script.Length && (char.IsDigit(_script[_index]) || _script[_index] == '.'))
+ {
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ }
+ return new GMLToken(eToken.eNumber, index, stringBuilder.ToString());
+ }
+
+ private static GMLToken NextHex(string _script, ref int _index)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ int index = _index;
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ while (_index < _script.Length && (char.IsDigit(_script[_index]) || (char.ToLower(_script[_index]) >= 'a' && char.ToLower(_script[_index]) <= 'f')))
+ {
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ }
+ return new GMLToken(eToken.eNumber, index, stringBuilder.ToString());
+ }
+
+ private static GMLToken NextString(string _script, ref int _index)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ int index = _index;
+ char c = _script[_index];
+ _index++;
+ while (_index < _script.Length && c != _script[_index])
+ {
+ stringBuilder.Append(_script[_index]);
+ _index++;
+ }
+ if (_index < _script.Length)
+ {
+ _index++;
+ }
+ return new GMLToken(eToken.eString, index, stringBuilder.ToString());
+ }
+
+ private static GMLToken NextToken(string _script, ref int _index)
+ {
+ SkipWhitespace(_script, ref _index);
+ if (_index >= _script.Length)
+ {
+ return new GMLToken(eToken.eEOF, _index, string.Empty);
+ }
+ char c = _script[_index];
+ if (char.IsLetter(c) || c == '_')
+ {
+ return NextName(_script, ref _index);
+ }
+ if (char.IsDigit(c))
+ {
+ return NextValue(_script, ref _index);
+ }
+ switch (c)
+ {
+ case '$':
+ return NextHex(_script, ref _index);
+ case '"':
+ case '\'':
+ return NextString(_script, ref _index);
+ default:
+ if (_index + 1 < _script.Length && _script[_index] == '.' && char.IsDigit(_script[_index + 1]))
+ {
+ return NextValue(_script, ref _index);
+ }
+ switch (c)
+ {
+ case '{':
+ return new GMLToken(eToken.eBegin, _index++, "{");
+ case '}':
+ return new GMLToken(eToken.eEnd, _index++, "}");
+ case '(':
+ return new GMLToken(eToken.eOpen, _index++, "(");
+ case ')':
+ return new GMLToken(eToken.eClose, _index++, ")");
+ case '[':
+ return new GMLToken(eToken.eArrayOpen, _index++, "[");
+ case ']':
+ return new GMLToken(eToken.eArrayClose, _index++, "]");
+ case ';':
+ return new GMLToken(eToken.eSepStatement, _index++, ";");
+ case ',':
+ return new GMLToken(eToken.eSepArgument, _index++, ",");
+ case '.':
+ return new GMLToken(eToken.eDot, _index++, ".");
+ case '~':
+ return new GMLToken(eToken.eBitNegate, _index++, "~");
+ case '!':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.eNot, _index - 1, "!");
+ }
+ return new GMLToken(eToken.eNotEqual, _index++ - 2, "!=");
+ case '=':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.eAssign, _index - 1, "=");
+ }
+ return new GMLToken(eToken.eEqual, _index++ - 2, "==");
+ case ':':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.eLabel, _index - 1, ":");
+ }
+ return new GMLToken(eToken.eAssign, _index++ - 2, ":=");
+ case '+':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.ePlus, _index - 1, "+");
+ }
+ return new GMLToken(eToken.eAssignPlus, _index++ - 2, "+=");
+ case '-':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.eMinus, _index - 1, "-");
+ }
+ return new GMLToken(eToken.eAssignMinus, _index++ - 2, "-=");
+ case '*':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.eTime, _index - 1, "*");
+ }
+ return new GMLToken(eToken.eAssignTimes, _index++ - 2, "*=");
+ case '/':
+ _index++;
+ if (_index >= _script.Length || _script[_index] != '=')
+ {
+ return new GMLToken(eToken.eDivide, _index - 1, "/");
+ }
+ return new GMLToken(eToken.eAssignDivide, _index++ - 2, "/=");
+ case '<':
+ if (_index + 1 < _script.Length)
+ {
+ switch (_script[_index + 1])
+ {
+ case '>':
+ _index += 2;
+ return new GMLToken(eToken.eNotEqual, _index, "<>");
+ case '<':
+ _index += 2;
+ return new GMLToken(eToken.eBitShiftLeft, _index, "<<");
+ case '=':
+ _index += 2;
+ return new GMLToken(eToken.eLessEqual, _index, "<=");
+ default:
+ return new GMLToken(eToken.eLess, _index++, "<");
+ }
+ }
+ return new GMLToken(eToken.eLess, _index++, "<");
+ case '>':
+ if (_index + 1 < _script.Length)
+ {
+ switch (_script[_index + 1])
+ {
+ case '>':
+ _index += 2;
+ return new GMLToken(eToken.eBitShiftRight, _index, ">>");
+ case '=':
+ _index += 2;
+ return new GMLToken(eToken.eGreaterEqual, _index, ">=");
+ default:
+ return new GMLToken(eToken.eGreater, _index++, ">");
+ }
+ }
+ return new GMLToken(eToken.eGreater, _index++, ">");
+ case '|':
+ if (_index + 1 < _script.Length)
+ {
+ switch (_script[_index + 1])
+ {
+ case '|':
+ _index += 2;
+ return new GMLToken(eToken.eOr, _index, "||");
+ case '=':
+ _index += 2;
+ return new GMLToken(eToken.eAssignOr, _index, "|=");
+ default:
+ return new GMLToken(eToken.eBitOr, _index++, "|");
+ }
+ }
+ return new GMLToken(eToken.eBitOr, _index++, "|");
+ case '&':
+ if (_index + 1 < _script.Length)
+ {
+ switch (_script[_index + 1])
+ {
+ case '&':
+ _index += 2;
+ return new GMLToken(eToken.eAnd, _index, "&&");
+ case '=':
+ _index += 2;
+ return new GMLToken(eToken.eAssignAnd, _index, "&=");
+ default:
+ return new GMLToken(eToken.eBitAnd, _index++, "&");
+ }
+ }
+ return new GMLToken(eToken.eBitAnd, _index++, "&");
+ case '^':
+ if (_index + 1 < _script.Length)
+ {
+ switch (_script[_index + 1])
+ {
+ case '^':
+ _index += 2;
+ return new GMLToken(eToken.eXor, _index, "^^");
+ case '=':
+ _index += 2;
+ return new GMLToken(eToken.eAssignXor, _index, "^=");
+ default:
+ return new GMLToken(eToken.eBitXor, _index++, "^");
+ }
+ }
+ return new GMLToken(eToken.eBitXor, _index++, "^");
+ default:
+ return new GMLToken(eToken.eError, _index, string.Empty);
+ }
+ }
+ }
+
+ public static void Check(string _check, eToken _token)
+ {
+ int _index = 0;
+ GMLToken gMLToken = NextToken(_check, ref _index);
+ if (gMLToken.Token != _token && _index == _check.Length)
+ {
+ Console.WriteLine("Failed Token Check : got {0:G} should be {1:G} for {2}", gMLToken.Token, _token, _check);
+ }
+ }
+
+ public static void Test()
+ {
+ Check("012345", eToken.eNumber);
+ Check("var", eToken.eVar);
+ Check("if", eToken.eIf);
+ Check("end", eToken.eEnd);
+ Check("else", eToken.eElse);
+ Check("while", eToken.eWhile);
+ Check("do", eToken.eDo);
+ Check("for", eToken.eFor);
+ Check("begin", eToken.eBegin);
+ Check("then", eToken.eThen);
+ Check("with", eToken.eWith);
+ Check("until", eToken.eUntil);
+ Check("repeat", eToken.eRepeat);
+ Check("exit", eToken.eExit);
+ Check("return", eToken.eReturn);
+ Check("break", eToken.eBreak);
+ Check("continue", eToken.eContinue);
+ Check("switch", eToken.eSwitch);
+ Check("case", eToken.eCase);
+ Check("default", eToken.eDefault);
+ Check("and", eToken.eAnd);
+ Check("or", eToken.eOr);
+ Check("div", eToken.eDiv);
+ Check("mod", eToken.eMod);
+ Check("xor", eToken.eBitXor);
+ Check("globalvar", eToken.eGlobalVar);
+ Check("$0123456", eToken.eNumber);
+ Check(".0123456", eToken.eNumber);
+ Check("0123.456", eToken.eNumber);
+ Check("\"0123.456\"", eToken.eString);
+ Check("'0123.456'", eToken.eString);
+ Check("blahblah", eToken.eName);
+ Check("{", eToken.eBegin);
+ Check("}", eToken.eEnd);
+ Check("(", eToken.eOpen);
+ Check(")", eToken.eClose);
+ Check("[", eToken.eArrayOpen);
+ Check("]", eToken.eArrayClose);
+ Check(";", eToken.eSepStatement);
+ Check(",", eToken.eSepArgument);
+ Check(".", eToken.eDot);
+ Check("~", eToken.eBitNegate);
+ Check("!=", eToken.eNotEqual);
+ Check("!", eToken.eNot);
+ Check("==", eToken.eEqual);
+ Check("=", eToken.eAssign);
+ Check(":=", eToken.eAssign);
+ Check(":", eToken.eLabel);
+ Check("+=", eToken.eAssignPlus);
+ Check("+", eToken.ePlus);
+ Check("-=", eToken.eAssignMinus);
+ Check("-", eToken.eMinus);
+ Check("*=", eToken.eAssignTimes);
+ Check("*", eToken.eTime);
+ Check("/=", eToken.eAssignDivide);
+ Check("/", eToken.eDivide);
+ Check("<<", eToken.eBitShiftLeft);
+ Check("<=", eToken.eLessEqual);
+ Check("<", eToken.eLess);
+ Check(">>", eToken.eBitShiftRight);
+ Check(">=", eToken.eGreaterEqual);
+ Check(">", eToken.eGreater);
+ Check("||", eToken.eOr);
+ Check("|=", eToken.eAssignOr);
+ Check("&&", eToken.eAnd);
+ Check("&=", eToken.eAssignAnd);
+ Check("&", eToken.eBitAnd);
+ Check("^^", eToken.eXor);
+ Check("^=", eToken.eAssignXor);
+ Check("^", eToken.eBitXor);
+ }
+
+ public static void Error(string _errorMessage, string _script, GMLToken _token)
+ {
+ if (!Program.InhibitErrorOutput)
+ {
+ int num = 1;
+ for (int i = 0; i < _token.Index; i++)
+ {
+ if (_script[i] == '\n')
+ {
+ num++;
+ }
+ }
+ Console.WriteLine("Error : {0}({1}) : {2}", ms_scriptName, num, _errorMessage);
+ }
+ ms_numErrors++;
+ ms_error = true;
+ Program.ExitCode = 1;
+ }
+
+ private static void Function_Add(string _string, int _numArgs7, int _numArgs8, bool _Pro)
+ {
+ GMLFunction gMLFunction = new GMLFunction();
+ gMLFunction.Name = _string;
+ gMLFunction.Id = ms_id++;
+ gMLFunction.NumArgs7 = _numArgs7;
+ gMLFunction.NumArgs8 = _numArgs8;
+ gMLFunction.Pro = _Pro;
+ gMLFunction.InstanceFirstParam = false;
+ gMLFunction.OtherSecondParam = false;
+ try
+ {
+ ms_funcs.Add(_string, gMLFunction);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show(_string);
+ }
+ }
+
+ private static void Function_Add(string _string, int _numArgs7, int _numArgs8, bool _Pro, bool _InstanceFirstParam)
+ {
+ GMLFunction gMLFunction = new GMLFunction();
+ gMLFunction.Name = _string;
+ gMLFunction.Id = ms_id++;
+ gMLFunction.NumArgs7 = _numArgs7;
+ gMLFunction.NumArgs8 = _numArgs8;
+ gMLFunction.Pro = _Pro;
+ gMLFunction.InstanceFirstParam = _InstanceFirstParam;
+ gMLFunction.OtherSecondParam = false;
+ ms_funcs.Add(_string, gMLFunction);
+ }
+
+ private static void Function_Add(string _string, int _numArgs7, int _numArgs8, bool _Pro, bool _InstanceFirstParam, bool _OtherSecondParam)
+ {
+ GMLFunction gMLFunction = new GMLFunction();
+ gMLFunction.Name = _string;
+ gMLFunction.Id = ms_id++;
+ gMLFunction.NumArgs7 = _numArgs7;
+ gMLFunction.NumArgs8 = _numArgs8;
+ gMLFunction.Pro = _Pro;
+ gMLFunction.InstanceFirstParam = _InstanceFirstParam;
+ gMLFunction.OtherSecondParam = _OtherSecondParam;
+ ms_funcs.Add(_string, gMLFunction);
+ }
+
+ private static void AddRealConstant(string _name, double _value)
+ {
+ ms_constants.Add(_name, _value);
+ }
+
+ private static void Variable_BuiltIn_Add(string _name, bool _get, bool _set, bool _pro, string _setFunc, string _getFunc)
+ {
+ GMLVariable gMLVariable = new GMLVariable();
+ gMLVariable.Name = _name;
+ gMLVariable.Id = ms_id++;
+ gMLVariable.Get = _get;
+ gMLVariable.Set = _set;
+ gMLVariable.Pro = _pro;
+ gMLVariable.setFunction = _setFunc;
+ gMLVariable.getFunction = _getFunc;
+ ms_builtins.Add(_name, gMLVariable);
+ }
+
+ private static void Variable_BuiltIn_Array_Add(string _name, bool _get, bool _set, bool _pro)
+ {
+ GMLVariable gMLVariable = new GMLVariable();
+ gMLVariable.Name = _name;
+ gMLVariable.Id = ms_id++;
+ gMLVariable.Get = _get;
+ gMLVariable.Set = _set;
+ gMLVariable.Pro = _pro;
+ gMLVariable.setFunction = null;
+ gMLVariable.getFunction = null;
+ ms_builtins.Add(_name, gMLVariable);
+ ms_builtinsArray.Add(_name, gMLVariable);
+ }
+
+ private static void Variable_BuiltIn_Local_Add(string _name, bool _get, bool _set, bool _pro, string _setFunc, string _getFunc)
+ {
+ GMLVariable gMLVariable = new GMLVariable();
+ gMLVariable.Name = _name;
+ gMLVariable.Id = ms_id++;
+ gMLVariable.Get = _get;
+ gMLVariable.Set = _set;
+ gMLVariable.Pro = _pro;
+ gMLVariable.setFunction = _setFunc;
+ gMLVariable.getFunction = _getFunc;
+ ms_builtinsLocal.Add(_name, gMLVariable);
+ }
+
+ private static void Variable_BuiltIn_Local_Array_Add(string _name, bool _get, bool _set, bool _pro)
+ {
+ GMLVariable gMLVariable = new GMLVariable();
+ gMLVariable.Name = _name;
+ gMLVariable.Id = ms_id++;
+ gMLVariable.Get = _get;
+ gMLVariable.Set = _set;
+ gMLVariable.Pro = _pro;
+ gMLVariable.setFunction = null;
+ gMLVariable.getFunction = null;
+ ms_builtinsLocal.Add(_name, gMLVariable);
+ ms_builtinsLocalArray.Add(_name, gMLVariable);
+ }
+
+ public static void Code_Init()
+ {
+ Function_Add("d3d_start", 0, 0, true);
+ Function_Add("d3d_end", 0, 0, true);
+ Function_Add("d3d_set_perspective", 1, 1, true);
+ Function_Add("d3d_set_hidden", 1, 1, true);
+ Function_Add("d3d_set_depth", 1, 1, true);
+ Function_Add("d3d_set_lighting", 1, 1, true);
+ Function_Add("d3d_set_shading", 1, 1, true);
+ Function_Add("d3d_set_fog", 4, 4, true);
+ Function_Add("d3d_set_culling", 1, 1, true);
+ Function_Add("d3d_primitive_begin", 1, 1, true);
+ Function_Add("d3d_primitive_begin_texture", 2, 2, true);
+ Function_Add("d3d_primitive_end", 0, 0, true);
+ Function_Add("d3d_vertex", 3, 3, true);
+ Function_Add("d3d_vertex_color", 5, 5, true);
+ Function_Add("d3d_vertex_texture", 5, 5, true);
+ Function_Add("d3d_vertex_texture_color", 7, 7, true);
+ Function_Add("d3d_vertex_normal", 6, 6, true);
+ Function_Add("d3d_vertex_normal_color", 8, 8, true);
+ Function_Add("d3d_vertex_normal_texture", 8, 8, true);
+ Function_Add("d3d_vertex_normal_texture_color", 10, 10, true);
+ Function_Add("d3d_draw_block", 9, 9, true);
+ Function_Add("d3d_draw_cylinder", 11, 11, true);
+ Function_Add("d3d_draw_cone", 11, 11, true);
+ Function_Add("d3d_draw_ellipsoid", 10, 10, true);
+ Function_Add("d3d_draw_wall", 9, 9, true);
+ Function_Add("d3d_draw_floor", 9, 9, true);
+ Function_Add("d3d_set_projection", 9, 9, true);
+ Function_Add("d3d_set_projection_ext", 13, 13, true);
+ Function_Add("d3d_set_projection_ortho", 5, 5, true);
+ Function_Add("d3d_set_projection_perspective", 5, 5, true);
+ Function_Add("d3d_transform_set_identity", 0, 0, true);
+ Function_Add("d3d_transform_set_translation", 3, 3, true);
+ Function_Add("d3d_transform_set_scaling", 3, 3, true);
+ Function_Add("d3d_transform_set_rotation_x", 1, 1, true);
+ Function_Add("d3d_transform_set_rotation_y", 1, 1, true);
+ Function_Add("d3d_transform_set_rotation_z", 1, 1, true);
+ Function_Add("d3d_transform_set_rotation_axis", 4, 4, true);
+ Function_Add("d3d_transform_add_translation", 3, 3, true);
+ Function_Add("d3d_transform_add_scaling", 3, 3, true);
+ Function_Add("d3d_transform_add_rotation_x", 1, 1, true);
+ Function_Add("d3d_transform_add_rotation_y", 1, 1, true);
+ Function_Add("d3d_transform_add_rotation_z", 1, 1, true);
+ Function_Add("d3d_transform_add_rotation_axis", 4, 4, true);
+ Function_Add("d3d_transform_stack_clear", 0, 0, true);
+ Function_Add("d3d_transform_stack_empty", 0, 0, true);
+ Function_Add("d3d_transform_stack_push", 0, 0, true);
+ Function_Add("d3d_transform_stack_pop", 0, 0, true);
+ Function_Add("d3d_transform_stack_top", 0, 0, true);
+ Function_Add("d3d_transform_stack_discard", 0, 0, true);
+ Function_Add("d3d_light_define_direction", 5, 5, true);
+ Function_Add("d3d_light_define_point", 6, 6, true);
+ Function_Add("d3d_light_enable", 2, 2, true);
+ Function_Add("d3d_model_create", 0, 0, true);
+ Function_Add("d3d_model_destroy", 1, 1, true);
+ Function_Add("d3d_model_clear", 1, 1, true);
+ Function_Add("d3d_model_load", 2, 2, true);
+ Function_Add("d3d_model_save", 2, 2, true);
+ Function_Add("d3d_model_draw", 5, 5, true);
+ Function_Add("d3d_model_primitive_begin", 2, 2, true);
+ Function_Add("d3d_model_primitive_end", 1, 1, true);
+ Function_Add("d3d_model_vertex", 4, 4, true);
+ Function_Add("d3d_model_vertex_color", 6, 6, true);
+ Function_Add("d3d_model_vertex_texture", 6, 6, true);
+ Function_Add("d3d_model_vertex_texture_color", 8, 8, true);
+ Function_Add("d3d_model_vertex_normal", 7, 7, true);
+ Function_Add("d3d_model_vertex_normal_color", 9, 9, true);
+ Function_Add("d3d_model_vertex_normal_texture", 9, 9, true);
+ Function_Add("d3d_model_vertex_normal_texture_color", 11, 11, true);
+ Function_Add("d3d_model_block", 9, 9, true);
+ Function_Add("d3d_model_cylinder", 11, 11, true);
+ Function_Add("d3d_model_cone", 11, 11, true);
+ Function_Add("d3d_model_ellipsoid", 10, 10, true);
+ Function_Add("d3d_model_wall", 9, 9, true);
+ Function_Add("d3d_model_floor", 9, 9, true);
+ Function_Add("action_path_old", 3, 3, false);
+ Function_Add("action_set_sprite", 2, 2, false, true);
+ Function_Add("action_draw_font", 1, 1, false);
+ Function_Add("action_draw_font_old", 6, 6, false);
+ Function_Add("action_fill_color", 1, 1, false);
+ Function_Add("action_line_color", 1, 1, false);
+ Function_Add("action_highscore", 0, 0, false);
+ Function_Add("action_set_relative", 1, 1, false);
+ Function_Add("action_move", 2, 2, false, true);
+ Function_Add("action_set_motion", 2, 2, false, true);
+ Function_Add("action_set_hspeed", 1, 1, false, true);
+ Function_Add("action_set_vspeed", 1, 1, false, true);
+ Function_Add("action_set_gravity", 2, 2, false, true);
+ Function_Add("action_set_friction", 1, 1, false, true);
+ Function_Add("action_move_point", 3, 3, false, true);
+ Function_Add("action_move_to", 2, 2, false, true);
+ Function_Add("action_move_start", 0, 0, false, true);
+ Function_Add("action_move_random", 2, 2, false, true);
+ Function_Add("action_snap", 2, 2, false, true);
+ Function_Add("action_wrap", 1, 1, false, true);
+ Function_Add("action_reverse_xdir", 0, 0, false, true);
+ Function_Add("action_reverse_ydir", 0, 0, false, true);
+ Function_Add("action_move_contact", 3, 3, false, true);
+ Function_Add("action_bounce", 2, 2, false, true);
+ Function_Add("action_path", 4, 4, false, true);
+ Function_Add("action_path_end", 0, 0, false, true);
+ Function_Add("action_path_position", 1, 1, false, true);
+ Function_Add("action_path_speed", 1, 1, false, true);
+ Function_Add("action_linear_step", 4, 4, false, true);
+ Function_Add("action_potential_step", 4, 4, false, true);
+ Function_Add("action_kill_object", 0, 0, false, true);
+ Function_Add("action_create_object", 3, 3, false, true);
+ Function_Add("action_create_object_motion", 5, 5, false, true);
+ Function_Add("action_create_object_random", 6, 6, false, true);
+ Function_Add("action_change_object", 2, 2, false, true);
+ Function_Add("action_kill_position", 2, 2, false, true);
+ Function_Add("action_sprite_set", 3, 3, false, true);
+ Function_Add("action_sprite_transform", 4, 4, true, true);
+ Function_Add("action_sprite_color", 2, 2, true, true);
+ Function_Add("action_sound", 2, 2, false);
+ Function_Add("action_end_sound", 1, 1, false);
+ Function_Add("action_if_sound", 1, 1, false);
+ Function_Add("action_another_room", 2, 2, false);
+ Function_Add("action_current_room", 1, 1, false);
+ Function_Add("action_previous_room", 1, 1, false);
+ Function_Add("action_next_room", 1, 1, false);
+ Function_Add("action_if_previous_room", 0, 0, false);
+ Function_Add("action_if_next_room", 0, 0, false);
+ Function_Add("action_set_alarm", 2, 2, false, true);
+ Function_Add("action_sleep", 2, 2, false);
+ Function_Add("action_set_timeline", 2, 2, false, true);
+ Function_Add("action_timeline_set", 2, 2, false, true);
+ Function_Add("action_timeline_start", 0, 0, false, true);
+ Function_Add("action_timeline_stop", 0, 0, false, true);
+ Function_Add("action_timeline_pause", 0, 0, false, true);
+ Function_Add("action_set_timeline_position", 1, 1, false, true);
+ Function_Add("action_set_timeline_speed", 1, 1, false, true);
+ Function_Add("action_message", 1, 1, false);
+ Function_Add("action_show_info", 0, 0, false);
+ Function_Add("action_show_video", 3, 3, true);
+ Function_Add("action_end_game", 0, 0, false);
+ Function_Add("action_restart_game", 0, 0, false);
+ Function_Add("action_save_game", 1, 1, false);
+ Function_Add("action_load_game", 1, 1, false);
+ Function_Add("action_replace_sprite", 3, 3, true);
+ Function_Add("action_replace_sound", 2, 2, true);
+ Function_Add("action_replace_background", 2, 2, true);
+ Function_Add("action_if_empty", 3, 3, false, true);
+ Function_Add("action_if_collision", 3, 3, false, true);
+ Function_Add("action_if", 1, 1, false);
+ Function_Add("action_if_number", 3, 3, false);
+ Function_Add("action_if_object", 3, 3, false, true);
+ Function_Add("action_if_question", 1, 1, false);
+ Function_Add("action_if_dice", 1, 1, false);
+ Function_Add("action_if_mouse", 1, 1, false);
+ Function_Add("action_if_aligned", 2, 2, false, true);
+ Function_Add("action_execute_script", 6, 6, false, true);
+ Function_Add("action_inherited", 0, 0, false, true, true);
+ Function_Add("action_if_variable", 3, 3, false);
+ Function_Add("action_draw_variable", 3, 3, false, true);
+ Function_Add("action_set_score", 1, 1, false);
+ Function_Add("action_if_score", 2, 2, false);
+ Function_Add("action_draw_score", 3, 3, false, true);
+ Function_Add("action_highscore_show", 5, 5, false);
+ Function_Add("action_highscore_clear", 0, 0, false);
+ Function_Add("action_set_life", 1, 1, false);
+ Function_Add("action_if_life", 2, 2, false);
+ Function_Add("action_draw_life", 3, 3, false, true);
+ Function_Add("action_draw_life_images", 3, 3, false, true);
+ Function_Add("action_set_health", 1, 1, false, true);
+ Function_Add("action_if_health", 2, 2, false, true);
+ Function_Add("action_draw_health", 6, 6, false, true);
+ Function_Add("action_set_caption", 6, 6, false);
+ Function_Add("action_partsyst_create", 1, 1, true);
+ Function_Add("action_partsyst_destroy", 0, 0, true);
+ Function_Add("action_partsyst_clear", 0, 0, true);
+ Function_Add("action_parttype_create_old", 6, 6, true);
+ Function_Add("action_parttype_create", 6, 6, true);
+ Function_Add("action_parttype_color", 6, 6, true);
+ Function_Add("action_parttype_life", 3, 3, true);
+ Function_Add("action_parttype_speed", 6, 6, true);
+ Function_Add("action_parttype_gravity", 3, 3, true);
+ Function_Add("action_parttype_secondary", 5, 5, true);
+ Function_Add("action_partemit_create", 6, 6, true);
+ Function_Add("action_partemit_destroy", 1, 1, true);
+ Function_Add("action_partemit_burst", 3, 3, true);
+ Function_Add("action_partemit_stream", 3, 3, true);
+ Function_Add("action_cd_play", 2, 2, true);
+ Function_Add("action_cd_stop", 0, 0, true);
+ Function_Add("action_cd_pause", 0, 0, true);
+ Function_Add("action_cd_resume", 0, 0, true);
+ Function_Add("action_cd_present", 0, 0, true);
+ Function_Add("action_cd_playing", 0, 0, true);
+ Function_Add("action_set_cursor", 2, 2, true);
+ Function_Add("action_webpage", 1, 1, true);
+ Function_Add("action_splash_web", 1, 1, true);
+ Function_Add("action_draw_sprite", 4, 4, false, true);
+ Function_Add("action_draw_background", 4, 4, false, true);
+ Function_Add("action_draw_text", 3, 3, false, true);
+ Function_Add("action_draw_text_transformed", 6, 6, true, true);
+ Function_Add("action_draw_rectangle", 5, 5, false, true);
+ Function_Add("action_draw_gradient_hor", 6, 6, true, true);
+ Function_Add("action_draw_gradient_vert", 6, 6, true, true);
+ Function_Add("action_draw_ellipse", 5, 5, false, true);
+ Function_Add("action_draw_ellipse_gradient", 6, 6, true, true);
+ Function_Add("action_draw_line", 4, 4, false, true);
+ Function_Add("action_draw_arrow", 5, 5, false, true);
+ Function_Add("action_color", 1, 1, false);
+ Function_Add("action_font", 2, 2, false);
+ Function_Add("action_fullscreen", 1, 1, false);
+ Function_Add("action_snapshot", 1, 1, true);
+ Function_Add("action_effect", 6, 6, true, true);
+ Function_Add("ds_set_precision", 1, 1, true);
+ Function_Add("ds_stack_create", 0, 0, true);
+ Function_Add("ds_stack_destroy", 1, 1, true);
+ Function_Add("ds_stack_clear", 1, 1, true);
+ Function_Add("ds_stack_copy", 2, 2, true);
+ Function_Add("ds_stack_size", 1, 1, true);
+ Function_Add("ds_stack_empty", 1, 1, true);
+ Function_Add("ds_stack_push", 2, 2, true);
+ Function_Add("ds_stack_pop", 1, 1, true);
+ Function_Add("ds_stack_top", 1, 1, true);
+ Function_Add("ds_stack_write", 1, 1, true);
+ Function_Add("ds_stack_read", 2, 2, true);
+ Function_Add("ds_queue_create", 0, 0, true);
+ Function_Add("ds_queue_destroy", 1, 1, true);
+ Function_Add("ds_queue_clear", 1, 1, true);
+ Function_Add("ds_queue_copy", 2, 2, true);
+ Function_Add("ds_queue_size", 1, 1, true);
+ Function_Add("ds_queue_empty", 1, 1, true);
+ Function_Add("ds_queue_enqueue", 2, 2, true);
+ Function_Add("ds_queue_dequeue", 1, 1, true);
+ Function_Add("ds_queue_head", 1, 1, true);
+ Function_Add("ds_queue_tail", 1, 1, true);
+ Function_Add("ds_queue_write", 1, 1, true);
+ Function_Add("ds_queue_read", 2, 2, true);
+ Function_Add("ds_list_create", 0, 0, true);
+ Function_Add("ds_list_destroy", 1, 1, true);
+ Function_Add("ds_list_clear", 1, 1, true);
+ Function_Add("ds_list_copy", 2, 2, true);
+ Function_Add("ds_list_size", 1, 1, true);
+ Function_Add("ds_list_empty", 1, 1, true);
+ Function_Add("ds_list_add", 2, 2, true);
+ Function_Add("ds_list_insert", 3, 3, true);
+ Function_Add("ds_list_replace", 3, 3, true);
+ Function_Add("ds_list_delete", 2, 2, true);
+ Function_Add("ds_list_find_index", 2, 2, true);
+ Function_Add("ds_list_find_value", 2, 2, true);
+ Function_Add("ds_list_sort", 2, 2, true);
+ Function_Add("ds_list_shuffle", 1, 1, true);
+ Function_Add("ds_list_write", 1, 1, true);
+ Function_Add("ds_list_read", 2, 2, true);
+ Function_Add("ds_map_create", 0, 0, true);
+ Function_Add("ds_map_destroy", 1, 1, true);
+ Function_Add("ds_map_clear", 1, 1, true);
+ Function_Add("ds_map_copy", 2, 2, true);
+ Function_Add("ds_map_size", 1, 1, true);
+ Function_Add("ds_map_empty", 1, 1, true);
+ Function_Add("ds_map_add", 3, 3, true);
+ Function_Add("ds_map_replace", 3, 3, true);
+ Function_Add("ds_map_delete", 2, 2, true);
+ Function_Add("ds_map_exists", 2, 2, true);
+ Function_Add("ds_map_find_value", 2, 2, true);
+ Function_Add("ds_map_find_previous", 2, 2, true);
+ Function_Add("ds_map_find_next", 2, 2, true);
+ Function_Add("ds_map_find_first", 1, 1, true);
+ Function_Add("ds_map_find_last", 1, 1, true);
+ Function_Add("ds_map_write", 1, 1, true);
+ Function_Add("ds_map_read", 1, 2, true);
+ Function_Add("ds_priority_create", 0, 0, true);
+ Function_Add("ds_priority_destroy", 1, 1, true);
+ Function_Add("ds_priority_clear", 1, 1, true);
+ Function_Add("ds_priority_copy", 1, 2, true);
+ Function_Add("ds_priority_size", 1, 1, true);
+ Function_Add("ds_priority_empty", 1, 1, true);
+ Function_Add("ds_priority_add", 3, 3, true);
+ Function_Add("ds_priority_change_priority", 3, 3, true);
+ Function_Add("ds_priority_find_priority", 2, 2, true);
+ Function_Add("ds_priority_delete_value", 2, 2, true);
+ Function_Add("ds_priority_delete_min", 1, 1, true);
+ Function_Add("ds_priority_find_min", 1, 1, true);
+ Function_Add("ds_priority_delete_max", 1, 1, true);
+ Function_Add("ds_priority_find_max", 1, 1, true);
+ Function_Add("ds_priority_write", 1, 1, true);
+ Function_Add("ds_priority_read", 2, 2, true);
+ Function_Add("ds_grid_create", 2, 2, true);
+ Function_Add("ds_grid_destroy", 1, 1, true);
+ Function_Add("ds_grid_copy", 2, 2, true);
+ Function_Add("ds_grid_resize", 3, 3, true);
+ Function_Add("ds_grid_width", 1, 1, true);
+ Function_Add("ds_grid_height", 1, 1, true);
+ Function_Add("ds_grid_clear", 2, 2, true);
+ Function_Add("ds_grid_set", 4, 4, true);
+ Function_Add("ds_grid_add", 4, 4, true);
+ Function_Add("ds_grid_multiply", 4, 4, true);
+ Function_Add("ds_grid_set_region", 6, 6, true);
+ Function_Add("ds_grid_add_region", 6, 6, true);
+ Function_Add("ds_grid_multiply_region", 6, 6, true);
+ Function_Add("ds_grid_set_disk", 5, 5, true);
+ Function_Add("ds_grid_add_disk", 5, 5, true);
+ Function_Add("ds_grid_multiply_disk", 5, 5, true);
+ Function_Add("ds_grid_set_grid_region", 8, 8, true);
+ Function_Add("ds_grid_add_grid_region", 8, 8, true);
+ Function_Add("ds_grid_multiply_grid_region", 8, 8, true);
+ Function_Add("ds_grid_get", 3, 3, true);
+ Function_Add("ds_grid_get_sum", 5, 5, true);
+ Function_Add("ds_grid_get_max", 5, 5, true);
+ Function_Add("ds_grid_get_min", 5, 5, true);
+ Function_Add("ds_grid_get_mean", 5, 5, true);
+ Function_Add("ds_grid_get_disk_sum", 4, 4, true);
+ Function_Add("ds_grid_get_disk_max", 4, 4, true);
+ Function_Add("ds_grid_get_disk_min", 4, 4, true);
+ Function_Add("ds_grid_get_disk_mean", 4, 4, true);
+ Function_Add("ds_grid_value_exists", 6, 6, true);
+ Function_Add("ds_grid_value_x", 6, 6, true);
+ Function_Add("ds_grid_value_y", 6, 6, true);
+ Function_Add("ds_grid_value_disk_exists", 5, 5, true);
+ Function_Add("ds_grid_value_disk_x", 5, 5, true);
+ Function_Add("ds_grid_value_disk_y", 5, 5, true);
+ Function_Add("ds_grid_shuffle", 1, 1, true);
+ Function_Add("ds_grid_write", 1, 1, true);
+ Function_Add("ds_grid_read", 2, 2, true);
+ Function_Add("mplay_init_ipx", 0, 0, true);
+ Function_Add("mplay_init_tcpip", 1, 1, true);
+ Function_Add("mplay_init_modem", 2, 2, true);
+ Function_Add("mplay_init_serial", 5, 5, true);
+ Function_Add("mplay_connect_status", 0, 0, true);
+ Function_Add("mplay_end", 0, 0, true);
+ Function_Add("mplay_session_mode", 1, 1, true);
+ Function_Add("mplay_session_create", 3, 3, true);
+ Function_Add("mplay_session_find", 0, 0, true);
+ Function_Add("mplay_session_name", 1, 1, true);
+ Function_Add("mplay_session_join", 2, 2, true);
+ Function_Add("mplay_session_status", 0, 0, true);
+ Function_Add("mplay_session_end", 0, 0, true);
+ Function_Add("mplay_player_find", 0, 0, true);
+ Function_Add("mplay_player_name", 1, 1, true);
+ Function_Add("mplay_player_id", 1, 1, true);
+ Function_Add("mplay_data_write", 2, 2, true);
+ Function_Add("mplay_data_read", 1, 1, true);
+ Function_Add("mplay_data_mode", 1, 1, true);
+ Function_Add("mplay_message_send", 3, 3, true);
+ Function_Add("mplay_message_send_guaranteed", 3, 3, true);
+ Function_Add("mplay_message_receive", 1, 1, true);
+ Function_Add("mplay_message_id", 0, 0, true);
+ Function_Add("mplay_message_value", 0, 0, true);
+ Function_Add("mplay_message_player", 0, 0, true);
+ Function_Add("mplay_message_name", 0, 0, true);
+ Function_Add("mplay_message_count", 1, 1, true);
+ Function_Add("mplay_message_clear", 1, 1, true);
+ Function_Add("mplay_ipaddress", 0, 0, true);
+ Function_Add("file_bin_open", 2, 2, false);
+ Function_Add("file_bin_rewrite", 1, 1, false);
+ Function_Add("file_bin_close", 1, 1, false);
+ Function_Add("file_bin_position", 1, 1, false);
+ Function_Add("file_bin_size", 1, 1, false);
+ Function_Add("file_bin_seek", 2, 2, false);
+ Function_Add("file_bin_read_byte", 1, 1, false);
+ Function_Add("file_bin_write_byte", 2, 2, false);
+ Function_Add("file_text_open_read", 1, 1, false);
+ Function_Add("file_text_open_write", 1, 1, false);
+ Function_Add("file_text_open_append", 1, 1, false);
+ Function_Add("file_text_close", 1, 1, false);
+ Function_Add("file_text_read_string", 1, 1, false);
+ Function_Add("file_text_read_real", 1, 1, false);
+ Function_Add("file_text_readln", 1, 1, false);
+ Function_Add("file_text_eof", 1, 1, false);
+ Function_Add("file_text_write_string", 2, 2, false);
+ Function_Add("file_text_write_real", 2, 2, false);
+ Function_Add("file_text_writeln", 1, 1, false);
+ Function_Add("file_open_read", 1, 1, false);
+ Function_Add("file_open_write", 1, 1, false);
+ Function_Add("file_open_append", 1, 1, false);
+ Function_Add("file_close", 0, 0, false);
+ Function_Add("file_read_string", 0, 0, false);
+ Function_Add("file_read_real", 0, 0, false);
+ Function_Add("file_readln", 0, 0, false);
+ Function_Add("file_eof", 0, 0, false);
+ Function_Add("file_write_string", 1, 1, false);
+ Function_Add("file_write_real", 1, 1, false);
+ Function_Add("file_writeln", 0, 0, false);
+ Function_Add("file_exists", 1, 1, false);
+ Function_Add("file_delete", 1, 1, false);
+ Function_Add("file_rename", 2, 2, false);
+ Function_Add("file_copy", 2, 2, false);
+ Function_Add("directory_exists", 1, 1, false);
+ Function_Add("directory_create", 1, 1, false);
+ Function_Add("file_find_first", 2, 2, false);
+ Function_Add("file_find_next", 0, 0, false);
+ Function_Add("file_find_close", 0, 0, false);
+ Function_Add("file_attributes", 2, 2, false);
+ Function_Add("filename_name", 1, 1, false);
+ Function_Add("filename_path", 1, 1, false);
+ Function_Add("filename_dir", 1, 1, false);
+ Function_Add("filename_drive", 1, 1, false);
+ Function_Add("filename_ext", 1, 1, false);
+ Function_Add("filename_change_ext", 2, 2, false);
+ Function_Add("export_include_file", 1, 1, false);
+ Function_Add("export_include_file_location", 2, 2, false);
+ Function_Add("discard_include_file", 1, 1, false);
+ Function_Add("execute_program", 3, 3, false);
+ Function_Add("execute_shell", 2, 2, false);
+ Function_Add("parameter_count", 0, 0, false);
+ Function_Add("parameter_string", 1, 1, false);
+ Function_Add("environment_get_variable", 1, 1, false);
+ Function_Add("registry_write_string", 2, 2, false);
+ Function_Add("registry_write_real", 2, 2, false);
+ Function_Add("registry_read_string", 1, 1, false);
+ Function_Add("registry_read_real", 1, 1, false);
+ Function_Add("registry_exists", 1, 1, false);
+ Function_Add("registry_write_string_ext", 3, 3, false);
+ Function_Add("registry_write_real_ext", 3, 3, false);
+ Function_Add("registry_read_string_ext", 2, 2, false);
+ Function_Add("registry_read_real_ext", 2, 2, false);
+ Function_Add("registry_exists_ext", 2, 2, false);
+ Function_Add("registry_set_root", 1, 1, false);
+ Function_Add("ini_open", 1, 1, false);
+ Function_Add("ini_close", 0, 0, false);
+ Function_Add("ini_read_string", 3, 3, false);
+ Function_Add("ini_read_real", 3, 3, false);
+ Function_Add("ini_write_string", 3, 3, false);
+ Function_Add("ini_write_real", 3, 3, false);
+ Function_Add("ini_key_exists", 2, 2, false);
+ Function_Add("ini_section_exists", 1, 1, false);
+ Function_Add("ini_key_delete", 2, 2, false);
+ Function_Add("ini_section_delete", 1, 1, false);
+ Function_Add("http_post_string", 2, 2, false);
+ Function_Add("http_get", 1, 1, false);
+ Function_Add("move_random", 2, 2, false, true);
+ Function_Add("place_free", 2, 2, false, true);
+ Function_Add("place_empty", 2, 2, false, true);
+ Function_Add("place_meeting", 3, 3, false, true);
+ Function_Add("place_snapped", 2, 2, false, true);
+ Function_Add("move_snap", 2, 2, false, true);
+ Function_Add("move_towards_point", 3, 3, false, true);
+ Function_Add("move_contact", 1, 1, false, true);
+ Function_Add("move_contact_solid", 2, 2, false, true);
+ Function_Add("move_contact_all", 2, 2, false, true);
+ Function_Add("move_outside_solid", 2, 2, false, true);
+ Function_Add("move_outside_all", 2, 2, false, true);
+ Function_Add("move_bounce", 1, 1, false, true);
+ Function_Add("move_bounce_solid", 1, 1, false, true);
+ Function_Add("move_bounce_all", 1, 1, false, true);
+ Function_Add("move_wrap", 3, 3, false, true);
+ Function_Add("motion_set", 2, 2, false, true);
+ Function_Add("motion_add", 2, 2, false, true);
+ Function_Add("distance_to_point", 2, 2, false, true);
+ Function_Add("distance_to_object", 1, 1, false, true);
+ Function_Add("path_start", 4, 4, false, true);
+ Function_Add("path_end", 0, 0, false, true);
+ Function_Add("mp_linear_step", 4, 4, false, true);
+ Function_Add("mp_linear_path", 5, 5, true, true);
+ Function_Add("mp_linear_step_object", 4, 4, false, true);
+ Function_Add("mp_linear_path_object", 5, 5, true, true);
+ Function_Add("mp_potential_settings", 4, 4, false, true);
+ Function_Add("mp_potential_step", 4, 4, false, true);
+ Function_Add("mp_potential_path", 6, 6, true, true);
+ Function_Add("mp_potential_step_object", 4, 4, false, true);
+ Function_Add("mp_potential_path_object", 6, 6, true, true);
+ Function_Add("mp_grid_create", 6, 6, true);
+ Function_Add("mp_grid_destroy", 1, 1, true);
+ Function_Add("mp_grid_clear_all", 1, 1, true);
+ Function_Add("mp_grid_clear_cell", 3, 3, true);
+ Function_Add("mp_grid_clear_rectangle", 5, 5, true);
+ Function_Add("mp_grid_add_cell", 3, 3, true);
+ Function_Add("mp_grid_add_rectangle", 5, 5, true);
+ Function_Add("mp_grid_add_instances", 3, 3, true, true);
+ Function_Add("mp_grid_path", 7, 7, true, true);
+ Function_Add("mp_grid_draw", 1, 1, true);
+ Function_Add("collision_point", 5, 5, false, true);
+ Function_Add("collision_rectangle", 7, 7, false, true);
+ Function_Add("collision_circle", 6, 6, false, true);
+ Function_Add("collision_ellipse", 7, 7, false, true);
+ Function_Add("collision_line", 7, 7, false, true);
+ Function_Add("instance_find", 2, 2, false);
+ Function_Add("instance_exists", 1, 1, false);
+ Function_Add("instance_number", 1, 1, false);
+ Function_Add("instance_position", 3, 3, false);
+ Function_Add("instance_nearest", 3, 3, false, true);
+ Function_Add("instance_furthest", 3, 3, false, true);
+ Function_Add("instance_place", 3, 3, false, true);
+ Function_Add("instance_create", 3, 3, false);
+ Function_Add("instance_copy", 1, 1, false, true);
+ Function_Add("instance_change", 2, 2, false, true);
+ Function_Add("instance_destroy", 0, 0, false, true);
+ Function_Add("instance_sprite", 1, 1, false, true);
+ Function_Add("position_empty", 2, 2, false, true);
+ Function_Add("position_meeting", 3, 3, false, true);
+ Function_Add("position_destroy", 2, 2, false, true);
+ Function_Add("position_change", 4, 4, false, true);
+ Function_Add("instance_deactivate_all", 1, 1, false, true);
+ Function_Add("instance_deactivate_object", 1, 1, false, true);
+ Function_Add("instance_deactivate_region", 6, 6, false, true);
+ Function_Add("instance_activate_all", 0, 0, false, true);
+ Function_Add("instance_activate_object", 1, 1, false, true);
+ Function_Add("instance_activate_region", 5, 5, false, true);
+ Function_Add("room_goto", 1, 1, false);
+ Function_Add("room_goto_previous", 0, 0, false);
+ Function_Add("room_goto_next", 0, 0, false);
+ Function_Add("room_previous", 1, 1, false);
+ Function_Add("room_next", 1, 1, false);
+ Function_Add("room_restart", 0, 0, false);
+ Function_Add("game_end", 0, 0, false);
+ Function_Add("game_restart", 0, 0, false);
+ Function_Add("game_load", 1, 1, false);
+ Function_Add("game_save", 1, 1, false);
+ Function_Add("transition_define", 2, 2, true);
+ Function_Add("transition_exists", 1, 1, true);
+ Function_Add("sleep", 1, 1, false);
+ Function_Add("display_get_width", 0, 0, false);
+ Function_Add("display_get_height", 0, 0, false);
+ Function_Add("display_get_colordepth", 0, 0, false);
+ Function_Add("display_get_frequency", 0, 0, false);
+ Function_Add("display_get_orientation", 0, 0, false);
+ Function_Add("display_set_size", 2, 2, true);
+ Function_Add("display_set_colordepth", 1, 1, true);
+ Function_Add("display_set_frequency", 1, 1, true);
+ Function_Add("display_set_all", 4, 4, true);
+ Function_Add("display_test_all", 4, 4, true);
+ Function_Add("display_reset", 0, 0, true);
+ Function_Add("display_mouse_get_x", 0, 0, false);
+ Function_Add("display_mouse_get_y", 0, 0, false);
+ Function_Add("display_mouse_set", 2, 2, false);
+ Function_Add("window_set_visible", 1, 1, false);
+ Function_Add("window_get_visible", 0, 0, false);
+ Function_Add("window_set_fullscreen", 1, 1, false);
+ Function_Add("window_get_fullscreen", 0, 0, false);
+ Function_Add("window_set_showborder", 1, 1, false);
+ Function_Add("window_get_showborder", 0, 0, false);
+ Function_Add("window_set_showicons", 1, 1, false);
+ Function_Add("window_get_showicons", 0, 0, false);
+ Function_Add("window_set_stayontop", 1, 1, false);
+ Function_Add("window_get_stayontop", 0, 0, false);
+ Function_Add("window_set_sizeable", 1, 1, false);
+ Function_Add("window_get_sizeable", 0, 0, false);
+ Function_Add("window_set_caption", 1, 1, false);
+ Function_Add("window_get_caption", 0, 0, false);
+ Function_Add("window_set_cursor", 1, 1, false);
+ Function_Add("window_get_cursor", 0, 0, false);
+ Function_Add("window_set_color", 1, 1, false);
+ Function_Add("window_get_color", 0, 0, false);
+ Function_Add("window_set_position", 2, 2, false);
+ Function_Add("window_set_size", 2, 2, false);
+ Function_Add("window_set_rectangle", 4, 4, false);
+ Function_Add("window_center", 0, 0, false);
+ Function_Add("window_default", 0, 0, false);
+ Function_Add("window_get_x", 0, 0, false);
+ Function_Add("window_get_y", 0, 0, false);
+ Function_Add("window_get_width", 0, 0, false);
+ Function_Add("window_get_height", 0, 0, false);
+ Function_Add("window_set_region_size", 3, 3, false);
+ Function_Add("window_get_region_width", 0, 0, false);
+ Function_Add("window_get_region_height", 0, 0, false);
+ Function_Add("window_set_region_scale", 2, 2, false);
+ Function_Add("window_get_region_scale", 0, 0, false);
+ Function_Add("window_mouse_get_x", 0, 0, false);
+ Function_Add("window_mouse_get_y", 0, 0, false);
+ Function_Add("window_mouse_set", 2, 2, false);
+ Function_Add("window_view_mouse_get_x", 1, 1, false);
+ Function_Add("window_view_mouse_get_y", 1, 1, false);
+ Function_Add("window_view_mouse_set", 3, 3, false);
+ Function_Add("window_views_mouse_get_x", 0, 0, false);
+ Function_Add("window_views_mouse_get_y", 0, 0, false);
+ Function_Add("window_views_mouse_set", 2, 2, false);
+ Function_Add("set_synchronization", 1, 1, false);
+ Function_Add("set_automatic_draw", 1, 1, false);
+ Function_Add("screen_redraw", 0, 0, false);
+ Function_Add("screen_refresh", 0, 0, false);
+ Function_Add("screen_wait_vsync", 0, 0, false);
+ Function_Add("screen_save", 1, 1, false);
+ Function_Add("screen_save_part", 5, 5, false);
+ Function_Add("draw_getpixel", 2, 2, false);
+ Function_Add("draw_set_color", 1, 1, false);
+ Function_Add("draw_set_alpha", 1, 1, false);
+ Function_Add("draw_get_color", 0, 0, false);
+ Function_Add("draw_get_alpha", 0, 0, false);
+ Function_Add("make_color", 3, 3, false);
+ Function_Add("make_color_rgb", 3, 3, false);
+ Function_Add("make_color_hsv", 3, 3, false);
+ Function_Add("color_get_red", 1, 1, false);
+ Function_Add("color_get_green", 1, 1, false);
+ Function_Add("color_get_blue", 1, 1, false);
+ Function_Add("color_get_hue", 1, 1, false);
+ Function_Add("color_get_saturation", 1, 1, false);
+ Function_Add("color_get_value", 1, 1, false);
+ Function_Add("merge_color", 3, 3, false);
+ Function_Add("draw_set_blend_mode", 1, 1, true);
+ Function_Add("draw_set_blend_mode_ext", 2, 2, true);
+ Function_Add("draw_clear", 1, 1, false);
+ Function_Add("draw_clear_alpha", 2, 2, false);
+ Function_Add("draw_point", 2, 2, false);
+ Function_Add("draw_line", 4, 4, false);
+ Function_Add("draw_line_width", 5, 5, false);
+ Function_Add("draw_rectangle", 5, 5, false);
+ Function_Add("draw_roundrect", 5, 5, false);
+ Function_Add("draw_triangle", 7, 7, false);
+ Function_Add("draw_circle", 4, 4, false);
+ Function_Add("draw_ellipse", 5, 5, false);
+ Function_Add("draw_arrow", 5, 5, false);
+ Function_Add("draw_button", 5, 5, false);
+ Function_Add("draw_healthbar", 11, 11, false);
+ Function_Add("draw_path", 4, 4, false);
+ Function_Add("draw_point_color", 3, 3, true);
+ Function_Add("draw_line_color", 6, 6, true);
+ Function_Add("draw_line_width_color", 7, 7, true);
+ Function_Add("draw_rectangle_color", 9, 9, true);
+ Function_Add("draw_roundrect_color", 7, 7, true);
+ Function_Add("draw_triangle_color", 10, 10, true);
+ Function_Add("draw_circle_color", 6, 6, true);
+ Function_Add("draw_ellipse_color", 7, 7, true);
+ Function_Add("draw_set_circle_precision", 1, 1, true);
+ Function_Add("draw_primitive_begin", 1, 1, true);
+ Function_Add("draw_primitive_begin_texture", 2, 2, true);
+ Function_Add("draw_primitive_end", 0, 0, true);
+ Function_Add("draw_vertex", 2, 2, true);
+ Function_Add("draw_vertex_color", 4, 4, true);
+ Function_Add("draw_vertex_texture", 4, 4, true);
+ Function_Add("draw_vertex_texture_color", 6, 6, true);
+ Function_Add("sprite_get_texture", 2, 2, true);
+ Function_Add("background_get_texture", 1, 1, true);
+ Function_Add("texture_exists", 1, 1, true);
+ Function_Add("texture_set_interpolation", 1, 1, true);
+ Function_Add("texture_set_blending", 1, 1, true);
+ Function_Add("texture_set_repeat", 1, 1, true);
+ Function_Add("texture_get_width", 1, 1, true);
+ Function_Add("texture_get_height", 1, 1, true);
+ Function_Add("texture_preload", 1, 1, true);
+ Function_Add("texture_set_priority", 2, 2, true);
+ Function_Add("draw_set_font", 1, 1, false);
+ Function_Add("draw_set_halign", 1, 1, false);
+ Function_Add("draw_set_valign", 1, 1, false);
+ Function_Add("string_width", 1, 1, false);
+ Function_Add("string_height", 1, 1, false);
+ Function_Add("string_width_ext", 3, 3, false);
+ Function_Add("string_height_ext", 3, 3, false);
+ Function_Add("draw_text", 3, 3, false);
+ Function_Add("draw_text_ext", 5, 5, false);
+ Function_Add("draw_text_transformed", 6, 6, true);
+ Function_Add("draw_text_ext_transformed", 8, 8, true);
+ Function_Add("draw_text_color", 8, 8, true);
+ Function_Add("draw_text_transformed_color", 11, 11, true);
+ Function_Add("draw_text_ext_color", 10, 10, true);
+ Function_Add("draw_text_ext_transformed_color", 13, 13, true);
+ Function_Add("draw_self", 0, 0, false, true);
+ Function_Add("draw_sprite", 4, 4, false, true);
+ Function_Add("draw_sprite_pos", 11, 11, false, true);
+ Function_Add("draw_sprite_ext", 9, 9, true, true);
+ Function_Add("draw_sprite_stretched", 6, 6, false, true);
+ Function_Add("draw_sprite_stretched_ext", 8, 8, true, true);
+ Function_Add("draw_sprite_part", 8, 8, false, true);
+ Function_Add("draw_sprite_part_ext", 12, 12, true, true);
+ Function_Add("draw_sprite_general", 16, 16, true, true);
+ Function_Add("draw_sprite_tiled", 4, 4, false, true);
+ Function_Add("draw_sprite_tiled_ext", 8, 8, true, true);
+ Function_Add("draw_background", 3, 3, false);
+ Function_Add("draw_background_ext", 8, 8, true);
+ Function_Add("draw_background_stretched", 5, 5, false);
+ Function_Add("draw_background_stretched_ext", 7, 7, true);
+ Function_Add("draw_background_part", 7, 7, false);
+ Function_Add("draw_background_part_ext", 11, 11, true);
+ Function_Add("draw_background_general", 15, 15, true);
+ Function_Add("draw_background_tiled", 3, 3, false);
+ Function_Add("draw_background_tiled_ext", 7, 7, true);
+ Function_Add("tile_get_x", 1, 1, false);
+ Function_Add("tile_get_y", 1, 1, false);
+ Function_Add("tile_get_left", 1, 1, false);
+ Function_Add("tile_get_top", 1, 1, false);
+ Function_Add("tile_get_width", 1, 1, false);
+ Function_Add("tile_get_height", 1, 1, false);
+ Function_Add("tile_get_depth", 1, 1, false);
+ Function_Add("tile_get_visible", 1, 1, false);
+ Function_Add("tile_get_xscale", 1, 1, false);
+ Function_Add("tile_get_yscale", 1, 1, false);
+ Function_Add("tile_get_blend", 1, 1, false);
+ Function_Add("tile_get_alpha", 1, 1, false);
+ Function_Add("tile_get_background", 1, 1, false);
+ Function_Add("tile_set_visible", 2, 2, false);
+ Function_Add("tile_set_background", 2, 2, false);
+ Function_Add("tile_set_region", 5, 5, false);
+ Function_Add("tile_set_position", 3, 3, false);
+ Function_Add("tile_set_depth", 2, 2, false);
+ Function_Add("tile_set_scale", 3, 3, false);
+ Function_Add("tile_set_blend", 2, 2, true);
+ Function_Add("tile_set_alpha", 2, 2, false);
+ Function_Add("tile_add", 8, 8, false);
+ Function_Add("tile_find", 3, 3, false);
+ Function_Add("tile_exists", 1, 1, false);
+ Function_Add("tile_delete", 1, 1, false);
+ Function_Add("tile_delete_at", 3, 3, false);
+ Function_Add("tile_layer_hide", 1, 1, false);
+ Function_Add("tile_layer_show", 1, 1, false);
+ Function_Add("tile_layer_delete", 1, 1, false);
+ Function_Add("tile_layer_shift", 3, 3, false);
+ Function_Add("tile_layer_find", 3, 3, false);
+ Function_Add("tile_layer_delete_at", 3, 3, false);
+ Function_Add("tile_layer_depth", 2, 2, false);
+ Function_Add("surface_create", 2, 2, true);
+ Function_Add("surface_create_ext", 3, 3, true);
+ Function_Add("surface_free", 1, 1, true);
+ Function_Add("surface_exists", 1, 1, true);
+ Function_Add("surface_get_width", 1, 1, true);
+ Function_Add("surface_get_height", 1, 1, true);
+ Function_Add("surface_get_texture", 1, 1, true);
+ Function_Add("surface_set_target", 1, 1, true);
+ Function_Add("surface_reset_target", 0, 0, true);
+ Function_Add("draw_surface", 3, 3, true);
+ Function_Add("draw_surface_ext", 8, 8, true);
+ Function_Add("draw_surface_stretched", 5, 5, true);
+ Function_Add("draw_surface_stretched_ext", 7, 7, true);
+ Function_Add("draw_surface_part", 7, 7, true);
+ Function_Add("draw_surface_part_ext", 11, 11, true);
+ Function_Add("draw_surface_general", 15, 15, true);
+ Function_Add("draw_surface_tiled", 3, 3, true);
+ Function_Add("draw_surface_tiled_ext", 7, 7, true);
+ Function_Add("surface_save", 2, 2, true);
+ Function_Add("surface_save_part", 6, 6, true);
+ Function_Add("surface_getpixel", 3, 3, true);
+ Function_Add("surface_copy", 4, 4, true);
+ Function_Add("surface_copy_part", 8, 8, true);
+ Function_Add("splash_show_video", 2, 2, true);
+ Function_Add("splash_show_text", 2, 2, true);
+ Function_Add("splash_show_image", 2, 2, true);
+ Function_Add("splash_show_web", 2, 2, true);
+ Function_Add("splash_set_caption", 1, 1, true);
+ Function_Add("splash_set_fullscreen", 1, 1, true);
+ Function_Add("splash_set_border", 1, 1, true);
+ Function_Add("splash_set_size", 2, 2, true);
+ Function_Add("splash_set_adapt", 1, 1, true);
+ Function_Add("splash_set_top", 1, 1, true);
+ Function_Add("splash_set_color", 1, 1, true);
+ Function_Add("splash_set_main", 1, 1, true);
+ Function_Add("splash_set_scale", 1, 1, true);
+ Function_Add("splash_set_cursor", 1, 1, true);
+ Function_Add("splash_set_interrupt", 1, 1, true);
+ Function_Add("splash_set_stop_key", 1, 1, true);
+ Function_Add("splash_set_stop_mouse", 1, 1, true);
+ Function_Add("splash_set_close_button", 1, 1, true);
+ Function_Add("splash_set_position", 1, 1, true);
+ Function_Add("show_image", 3, 3, true);
+ Function_Add("show_video", 3, 3, true);
+ Function_Add("show_text", 4, 4, true);
+ Function_Add("show_message", 1, 1, false);
+ Function_Add("show_question", 1, 1, false);
+ Function_Add("show_error", 2, 2, false);
+ Function_Add("show_info", 0, 0, false);
+ Function_Add("load_info", 1, 1, false);
+ Function_Add("highscore_show", 1, 1, false);
+ Function_Add("highscore_set_background", 1, 1, false);
+ Function_Add("highscore_set_border", 1, 1, false);
+ Function_Add("highscore_set_font", 3, 3, false);
+ Function_Add("highscore_set_strings", 3, 3, false);
+ Function_Add("highscore_set_colors", 3, 3, false);
+ Function_Add("highscore_show_ext", 7, 7, false);
+ Function_Add("highscore_clear", 0, 0, false);
+ Function_Add("highscore_add", 2, 2, false);
+ Function_Add("highscore_add_current", 0, 0, false);
+ Function_Add("highscore_value", 1, 1, false);
+ Function_Add("highscore_name", 1, 1, false);
+ Function_Add("draw_highscore", 4, 4, false);
+ Function_Add("show_message_ext", 4, 4, false);
+ Function_Add("message_background", 1, 1, false);
+ Function_Add("message_button", 1, 1, false);
+ Function_Add("message_alpha", 1, 1, false);
+ Function_Add("message_text_font", 4, 4, false);
+ Function_Add("message_button_font", 4, 4, false);
+ Function_Add("message_input_font", 4, 4, false);
+ Function_Add("message_mouse_color", 1, 1, false);
+ Function_Add("message_input_color", 1, 1, false);
+ Function_Add("message_position", 2, 2, false);
+ Function_Add("message_size", 2, 2, false);
+ Function_Add("message_caption", 2, 2, false);
+ Function_Add("show_menu", 2, 2, false);
+ Function_Add("show_menu_pos", 4, 4, false);
+ Function_Add("get_integer", 2, 2, false);
+ Function_Add("get_string", 2, 2, false);
+ Function_Add("get_color", 1, 1, false);
+ Function_Add("get_open_filename", 2, 2, false);
+ Function_Add("get_save_filename", 2, 2, false);
+ Function_Add("get_directory", 1, 1, false);
+ Function_Add("get_directory_alt", 2, 2, false);
+ Function_Add("keyboard_get_numlock", 0, 0, false);
+ Function_Add("keyboard_set_numlock", 1, 1, false);
+ Function_Add("keyboard_key_press", 1, 1, false);
+ Function_Add("keyboard_key_release", 1, 1, false);
+ Function_Add("keyboard_set_map", 2, 2, false);
+ Function_Add("keyboard_get_map", 1, 1, false);
+ Function_Add("keyboard_unset_map", 0, 0, false);
+ Function_Add("keyboard_check", 1, 1, false);
+ Function_Add("keyboard_check_pressed", 1, 1, false);
+ Function_Add("keyboard_check_released", 1, 1, false);
+ Function_Add("keyboard_check_direct", 1, 1, false);
+ Function_Add("mouse_check_button", 1, 1, false);
+ Function_Add("mouse_check_button_pressed", 1, 1, false);
+ Function_Add("mouse_check_button_released", 1, 1, false);
+ Function_Add("joystick_exists", 1, 1, false);
+ Function_Add("joystick_direction", 1, 1, false);
+ Function_Add("joystick_name", 1, 1, false);
+ Function_Add("joystick_axes", 1, 1, false);
+ Function_Add("joystick_buttons", 1, 1, false);
+ Function_Add("joystick_has_pov", 1, 1, false);
+ Function_Add("joystick_check_button", 2, 2, false);
+ Function_Add("joystick_xpos", 1, 1, false);
+ Function_Add("joystick_ypos", 1, 1, false);
+ Function_Add("joystick_zpos", 1, 1, false);
+ Function_Add("joystick_rpos", 1, 1, false);
+ Function_Add("joystick_upos", 1, 1, false);
+ Function_Add("joystick_vpos", 1, 1, false);
+ Function_Add("joystick_pov", 1, 1, false);
+ Function_Add("keyboard_clear", 1, 1, false);
+ Function_Add("mouse_clear", 1, 1, false);
+ Function_Add("io_clear", 0, 0, false);
+ Function_Add("io_handle", 0, 0, false);
+ Function_Add("keyboard_wait", 0, 0, false);
+ Function_Add("mouse_wait", 0, 0, false);
+ Function_Add("is_real", 1, 1, false);
+ Function_Add("is_string", 1, 1, false);
+ Function_Add("random", 1, 1, false);
+ Function_Add("random_range", 2, 2, false);
+ Function_Add("irandom", 1, 1, false);
+ Function_Add("irandom_range", 2, 2, false);
+ Function_Add("random_set_seed", 1, 1, false);
+ Function_Add("random_get_seed", 0, 0, false);
+ Function_Add("randomize", 0, 0, false);
+ Function_Add("abs", 1, 1, false);
+ Function_Add("round", 1, 1, false);
+ Function_Add("floor", 1, 1, false);
+ Function_Add("ceil", 1, 1, false);
+ Function_Add("sign", 1, 1, false);
+ Function_Add("frac", 1, 1, false);
+ Function_Add("sqrt", 1, 1, false);
+ Function_Add("sqr", 1, 1, false);
+ Function_Add("exp", 1, 1, false);
+ Function_Add("ln", 1, 1, false);
+ Function_Add("log2", 1, 1, false);
+ Function_Add("log10", 1, 1, false);
+ Function_Add("sin", 1, 1, false);
+ Function_Add("cos", 1, 1, false);
+ Function_Add("tan", 1, 1, false);
+ Function_Add("arcsin", 1, 1, false);
+ Function_Add("arccos", 1, 1, false);
+ Function_Add("arctan", 1, 1, false);
+ Function_Add("arctan2", 2, 2, false);
+ Function_Add("degtorad", 1, 1, false);
+ Function_Add("radtodeg", 1, 1, false);
+ Function_Add("power", 2, 2, false);
+ Function_Add("logn", 2, 2, false);
+ Function_Add("min", -1, -1, false);
+ Function_Add("max", -1, -1, false);
+ Function_Add("min3", 3, 3, false);
+ Function_Add("max3", 3, 3, false);
+ Function_Add("mean", -1, -1, false);
+ Function_Add("median", -1, -1, false);
+ Function_Add("choose", -1, -1, false);
+ Function_Add("clamp", 3, 3, true);
+ Function_Add("lerp", 3, 3, true);
+ Function_Add("real", 1, 1, false);
+ Function_Add("string", 1, 1, false);
+ Function_Add("string_format", 3, 3, false);
+ Function_Add("chr", 1, 1, false);
+ Function_Add("ord", 1, 1, false);
+ Function_Add("string_length", 1, 1, false);
+ Function_Add("string_pos", 2, 2, false);
+ Function_Add("string_copy", 3, 3, false);
+ Function_Add("string_char_at", 2, 2, false);
+ Function_Add("string_delete", 3, 3, false);
+ Function_Add("string_insert", 3, 3, false);
+ Function_Add("string_lower", 1, 1, false);
+ Function_Add("string_upper", 1, 1, false);
+ Function_Add("string_repeat", 2, 2, false);
+ Function_Add("string_letters", 1, 1, false);
+ Function_Add("string_digits", 1, 1, false);
+ Function_Add("string_lettersdigits", 1, 1, false);
+ Function_Add("string_replace", 3, 3, false);
+ Function_Add("string_replace_all", 3, 3, false);
+ Function_Add("string_count", 2, 2, false);
+ Function_Add("point_distance", 4, 4, false);
+ Function_Add("point_direction", 4, 4, false);
+ Function_Add("lengthdir_x", 2, 2, false);
+ Function_Add("lengthdir_y", 2, 2, false);
+ Function_Add("event_inherited", 0, 0, false, true, true);
+ Function_Add("event_perform", 2, 2, false, true, true);
+ Function_Add("event_user", 1, 1, false, true, true);
+ Function_Add("event_perform_object", 3, 3, false, true, true);
+ Function_Add("external_define", -1, -1, true);
+ Function_Add("external_call", -1, -1, true);
+ Function_Add("external_free", 1, 1, true);
+ Function_Add("external_define0", 3, 3, true);
+ Function_Add("external_call0", 1, 1, true);
+ Function_Add("external_define1", 4, 4, true);
+ Function_Add("external_call1", 2, 2, true);
+ Function_Add("external_define2", 5, 5, true);
+ Function_Add("external_call2", 3, 3, true);
+ Function_Add("external_define3", 6, 6, true);
+ Function_Add("external_call3", 4, 4, true);
+ Function_Add("external_define4", 7, 7, true);
+ Function_Add("external_call4", 5, 5, true);
+ Function_Add("external_define5", 3, 3, true);
+ Function_Add("external_call5", 6, 6, true);
+ Function_Add("external_define6", 3, 3, true);
+ Function_Add("external_call6", 7, 7, true);
+ Function_Add("external_define7", 3, 3, true);
+ Function_Add("external_call7", 8, 8, true);
+ Function_Add("external_define8", 3, 3, true);
+ Function_Add("external_call8", 9, 9, true);
+ Function_Add("execute_string", -1, -1, false);
+ Function_Add("execute_file", -1, -1, false);
+ Function_Add("window_handle", 0, 0, false);
+ Function_Add("show_debug_message", 1, 1, false);
+ Function_Add("set_program_priority", 1, 1, false);
+ Function_Add("set_application_title", 1, 1, false);
+ Function_Add("variable_global_exists", 1, 1, false);
+ Function_Add("variable_global_get", 1, 1, false);
+ Function_Add("variable_global_array_get", 2, 2, false);
+ Function_Add("variable_global_array2_get", 3, 3, false);
+ Function_Add("variable_global_set", 2, 2, false);
+ Function_Add("variable_global_array_set", 3, 3, false);
+ Function_Add("variable_global_array2_set", 4, 4, false);
+ Function_Add("variable_local_exists", 1, 1, false, true);
+ Function_Add("variable_local_get", 1, 1, false, true);
+ Function_Add("variable_local_array_get", 2, 2, false, true);
+ Function_Add("variable_local_array2_get", 3, 3, false, true);
+ Function_Add("variable_local_set", 2, 2, false, true);
+ Function_Add("variable_local_array_set", 3, 3, false, true);
+ Function_Add("variable_local_array2_set", 4, 4, false, true);
+ Function_Add("clipboard_has_text", 0, 0, false);
+ Function_Add("clipboard_set_text", 1, 1, false);
+ Function_Add("clipboard_get_text", 0, 0, false);
+ Function_Add("date_current_datetime", 0, 0, false);
+ Function_Add("date_current_date", 0, 0, false);
+ Function_Add("date_current_time", 0, 0, false);
+ Function_Add("date_create_datetime", 6, 6, false);
+ Function_Add("date_create_date", 3, 3, false);
+ Function_Add("date_create_time", 3, 3, false);
+ Function_Add("date_valid_datetime", 6, 6, false);
+ Function_Add("date_valid_date", 3, 3, false);
+ Function_Add("date_valid_time", 3, 3, false);
+ Function_Add("date_inc_year", 2, 2, false);
+ Function_Add("date_inc_month", 2, 2, false);
+ Function_Add("date_inc_week", 2, 2, false);
+ Function_Add("date_inc_day", 2, 2, false);
+ Function_Add("date_inc_hour", 2, 2, false);
+ Function_Add("date_inc_minute", 2, 2, false);
+ Function_Add("date_inc_second", 2, 2, false);
+ Function_Add("date_get_year", 1, 1, false);
+ Function_Add("date_get_month", 1, 1, false);
+ Function_Add("date_get_week", 1, 1, false);
+ Function_Add("date_get_day", 1, 1, false);
+ Function_Add("date_get_hour", 1, 1, false);
+ Function_Add("date_get_minute", 1, 1, false);
+ Function_Add("date_get_second", 1, 1, false);
+ Function_Add("date_get_weekday", 1, 1, false);
+ Function_Add("date_get_day_of_year", 1, 1, false);
+ Function_Add("date_get_hour_of_year", 1, 1, false);
+ Function_Add("date_get_minute_of_year", 1, 1, false);
+ Function_Add("date_get_second_of_year", 1, 1, false);
+ Function_Add("date_year_span", 2, 2, false);
+ Function_Add("date_month_span", 2, 2, false);
+ Function_Add("date_week_span", 2, 2, false);
+ Function_Add("date_day_span", 2, 2, false);
+ Function_Add("date_hour_span", 2, 2, false);
+ Function_Add("date_minute_span", 2, 2, false);
+ Function_Add("date_second_span", 2, 2, false);
+ Function_Add("date_compare_datetime", 2, 2, false);
+ Function_Add("date_compare_date", 2, 2, false);
+ Function_Add("date_compare_time", 2, 2, false);
+ Function_Add("date_date_of", 1, 1, false);
+ Function_Add("date_time_of", 1, 1, false);
+ Function_Add("date_datetime_string", 1, 1, false);
+ Function_Add("date_date_string", 1, 1, false);
+ Function_Add("date_time_string", 1, 1, false);
+ Function_Add("date_days_in_month", 1, 1, false);
+ Function_Add("date_days_in_year", 1, 1, false);
+ Function_Add("date_leap_year", 1, 1, false);
+ Function_Add("date_is_today", 1, 1, false);
+ Function_Add("part_type_create", 0, 0, true);
+ Function_Add("part_type_destroy", 1, 1, true);
+ Function_Add("part_type_exists", 1, 1, true);
+ Function_Add("part_type_clear", 1, 1, true);
+ Function_Add("part_type_shape", 2, 2, true);
+ Function_Add("part_type_sprite", 5, 5, true);
+ Function_Add("part_type_size", 5, 5, true);
+ Function_Add("part_type_scale", 3, 3, true);
+ Function_Add("part_type_life", 3, 3, true);
+ Function_Add("part_type_step", 3, 3, true);
+ Function_Add("part_type_death", 3, 3, true);
+ Function_Add("part_type_speed", 5, 5, true);
+ Function_Add("part_type_direction", 5, 5, true);
+ Function_Add("part_type_orientation", 6, 6, true);
+ Function_Add("part_type_gravity", 3, 3, true);
+ Function_Add("part_type_color_mix", 3, 3, true);
+ Function_Add("part_type_color_rgb", 7, 7, true);
+ Function_Add("part_type_color_hsv", 7, 7, true);
+ Function_Add("part_type_color1", 2, 2, true);
+ Function_Add("part_type_color2", 3, 3, true);
+ Function_Add("part_type_color3", 4, 4, true);
+ Function_Add("part_type_color", 4, 4, true);
+ Function_Add("part_type_alpha1", 2, 2, true);
+ Function_Add("part_type_alpha2", 3, 3, true);
+ Function_Add("part_type_alpha3", 4, 4, true);
+ Function_Add("part_type_alpha", 4, 4, true);
+ Function_Add("part_type_blend", 2, 2, true);
+ Function_Add("part_system_create", 0, 0, true);
+ Function_Add("part_system_destroy", 1, 1, true);
+ Function_Add("part_system_exists", 1, 1, true);
+ Function_Add("part_system_clear", 1, 1, true);
+ Function_Add("part_system_draw_order", 2, 2, true);
+ Function_Add("part_system_depth", 2, 2, true);
+ Function_Add("part_system_position", 3, 3, true);
+ Function_Add("part_system_automatic_update", 2, 2, true);
+ Function_Add("part_system_automatic_draw", 2, 2, true);
+ Function_Add("part_system_update", 1, 1, true);
+ Function_Add("part_system_drawit", 1, 1, true);
+ Function_Add("part_particles_create", 5, 5, true);
+ Function_Add("part_particles_create_color", 6, 6, true);
+ Function_Add("part_particles_clear", 1, 1, true);
+ Function_Add("part_particles_count", 1, 1, true);
+ Function_Add("part_emitter_create", 1, 1, true);
+ Function_Add("part_emitter_destroy", 2, 2, true);
+ Function_Add("part_emitter_destroy_all", 1, 1, true);
+ Function_Add("part_emitter_exists", 2, 2, true);
+ Function_Add("part_emitter_clear", 2, 2, true);
+ Function_Add("part_emitter_region", 8, 8, true);
+ Function_Add("part_emitter_burst", 4, 4, true);
+ Function_Add("part_emitter_stream", 4, 4, true);
+ Function_Add("part_attractor_create", 1, 1, true);
+ Function_Add("part_attractor_destroy", 2, 2, true);
+ Function_Add("part_attractor_destroy_all", 1, 1, true);
+ Function_Add("part_attractor_exists", 2, 2, true);
+ Function_Add("part_attractor_clear", 2, 2, true);
+ Function_Add("part_attractor_position", 4, 4, true);
+ Function_Add("part_attractor_force", 6, 6, true);
+ Function_Add("part_destroyer_create", 1, 1, true);
+ Function_Add("part_destroyer_destroy", 2, 2, true);
+ Function_Add("part_destroyer_destroy_all", 1, 1, true);
+ Function_Add("part_destroyer_exists", 2, 2, true);
+ Function_Add("part_destroyer_clear", 2, 2, true);
+ Function_Add("part_destroyer_region", 7, 7, true);
+ Function_Add("part_deflector_create", 1, 1, true);
+ Function_Add("part_deflector_destroy", 2, 2, true);
+ Function_Add("part_deflector_destroy_all", 1, 1, true);
+ Function_Add("part_deflector_exists", 2, 2, true);
+ Function_Add("part_deflector_clear", 2, 2, true);
+ Function_Add("part_deflector_region", 6, 6, true);
+ Function_Add("part_deflector_kind", 3, 3, true);
+ Function_Add("part_deflector_friction", 3, 3, true);
+ Function_Add("part_changer_create", 1, 1, true);
+ Function_Add("part_changer_destroy", 2, 2, true);
+ Function_Add("part_changer_destroy_all", 1, 1, true);
+ Function_Add("part_changer_exists", 2, 2, true);
+ Function_Add("part_changer_clear", 2, 2, true);
+ Function_Add("part_changer_region", 7, 7, true);
+ Function_Add("part_changer_kind", 3, 3, true);
+ Function_Add("part_changer_types", 4, 4, true);
+ Function_Add("effect_create_below", 5, 5, true);
+ Function_Add("effect_create_above", 5, 5, true);
+ Function_Add("effect_clear", 0, 0, true);
+ Function_Add("sprite_name", 1, 1, false);
+ Function_Add("sprite_exists", 1, 1, false);
+ Function_Add("sprite_get_name", 1, 1, false);
+ Function_Add("sprite_get_number", 1, 1, false);
+ Function_Add("sprite_get_width", 1, 1, false);
+ Function_Add("sprite_get_height", 1, 1, false);
+ Function_Add("sprite_get_transparent", 1, 1, false);
+ Function_Add("sprite_get_smooth", 1, 1, false);
+ Function_Add("sprite_get_preload", 1, 1, false);
+ Function_Add("sprite_get_xoffset", 1, 1, false);
+ Function_Add("sprite_get_yoffset", 1, 1, false);
+ Function_Add("sprite_get_bbox_mode", 1, 1, false);
+ Function_Add("sprite_get_bbox_left", 1, 1, false);
+ Function_Add("sprite_get_bbox_right", 1, 1, false);
+ Function_Add("sprite_get_bbox_top", 1, 1, false);
+ Function_Add("sprite_get_bbox_bottom", 1, 1, false);
+ Function_Add("sprite_get_precise", 1, 1, false);
+ Function_Add("sprite_collision_mask", 9, 9, false);
+ Function_Add("sprite_set_offset", 3, 3, true);
+ Function_Add("sprite_set_bbox_mode", 2, 2, true);
+ Function_Add("sprite_set_bbox", 5, 5, true);
+ Function_Add("sprite_set_precise", 2, 2, true);
+ Function_Add("sprite_set_alpha_from_sprite", 2, 2, true);
+ Function_Add("sprite_create_from_screen", 10, 10, true);
+ Function_Add("sprite_add_from_screen", 5, 5, true);
+ Function_Add("sprite_create_from_surface", 11, 11, true);
+ Function_Add("sprite_add_from_surface", 6, 6, true);
+ Function_Add("sprite_add", 8, 8, true);
+ Function_Add("sprite_replace", 9, 9, true);
+ Function_Add("sprite_add_alpha", 6, 6, true);
+ Function_Add("sprite_replace_alpha", 7, 7, true);
+ Function_Add("sprite_delete", 1, 1, true);
+ Function_Add("sprite_duplicate", 1, 1, true);
+ Function_Add("sprite_assign", 2, 2, true);
+ Function_Add("sprite_merge", 2, 2, true);
+ Function_Add("sprite_save", 3, 3, true);
+ Function_Add("sprite_set_cache_size", 2, 2, true);
+ Function_Add("sprite_set_cache_size_ext", 3, 3, true);
+ Function_Add("background_name", 1, 1, false);
+ Function_Add("background_exists", 1, 1, false);
+ Function_Add("background_get_name", 1, 1, false);
+ Function_Add("background_get_width", 1, 1, false);
+ Function_Add("background_get_height", 1, 1, false);
+ Function_Add("background_get_transparent", 1, 1, false);
+ Function_Add("background_get_smooth", 1, 1, false);
+ Function_Add("background_get_preload", 1, 1, false);
+ Function_Add("background_set_alpha_from_background", 2, 2, true);
+ Function_Add("background_create_from_screen", 7, 7, true);
+ Function_Add("background_create_from_surface", 8, 8, true);
+ Function_Add("background_create_color", 4, 3, true);
+ Function_Add("background_create_gradient", 6, 6, true);
+ Function_Add("background_add", 4, 4, true);
+ Function_Add("background_replace", 5, 5, true);
+ Function_Add("background_add_alpha", 2, 2, true);
+ Function_Add("background_replace_alpha", 3, 3, true);
+ Function_Add("background_delete", 1, 1, true);
+ Function_Add("background_duplicate", 1, 1, true);
+ Function_Add("background_assign", 2, 2, true);
+ Function_Add("background_save", 2, 2, true);
+ Function_Add("sound_name", 1, 1, false);
+ Function_Add("sound_exists", 1, 1, false);
+ Function_Add("sound_get_name", 1, 1, false);
+ Function_Add("sound_get_kind", 1, 1, false);
+ Function_Add("sound_get_preload", 1, 1, false);
+ Function_Add("sound_discard", 1, 1, false);
+ Function_Add("sound_restore", 1, 1, false);
+ Function_Add("sound_add", 3, 3, true);
+ Function_Add("sound_replace", 4, 4, true);
+ Function_Add("sound_delete", 1, 1, true);
+ Function_Add("font_name", 1, 1, false);
+ Function_Add("font_exists", 1, 1, false);
+ Function_Add("font_get_name", 1, 1, false);
+ Function_Add("font_get_fontname", 1, 1, false);
+ Function_Add("font_get_size", 1, 1, false);
+ Function_Add("font_get_bold", 1, 1, false);
+ Function_Add("font_get_italic", 1, 1, false);
+ Function_Add("font_get_first", 1, 1, false);
+ Function_Add("font_get_last", 1, 1, false);
+ Function_Add("font_add", 6, 6, true);
+ Function_Add("font_replace", 7, 7, true);
+ Function_Add("font_add_sprite", 4, 4, true);
+ Function_Add("font_replace_sprite", 5, 5, true);
+ Function_Add("font_delete", 1, 1, true);
+ Function_Add("script_name", 1, 1, false);
+ Function_Add("script_exists", 1, 1, false);
+ Function_Add("script_get_name", 1, 1, false);
+ Function_Add("script_get_text", 1, 1, false);
+ Function_Add("script_execute", -1, -1, false);
+ Function_Add("path_name", 1, 1, false);
+ Function_Add("path_exists", 1, 1, false);
+ Function_Add("path_get_name", 1, 1, false);
+ Function_Add("path_get_length", 1, 1, false);
+ Function_Add("path_get_kind", 1, 1, false);
+ Function_Add("path_get_closed", 1, 1, false);
+ Function_Add("path_get_precision", 1, 1, false);
+ Function_Add("path_get_number", 1, 1, false);
+ Function_Add("path_get_point_x", 2, 2, false);
+ Function_Add("path_get_point_y", 2, 2, false);
+ Function_Add("path_get_point_speed", 2, 2, false);
+ Function_Add("path_get_x", 2, 2, false);
+ Function_Add("path_get_y", 2, 2, false);
+ Function_Add("path_get_speed", 2, 2, false);
+ Function_Add("path_set_kind", 2, 2, true);
+ Function_Add("path_set_closed", 2, 2, true);
+ Function_Add("path_set_precision", 2, 2, true);
+ Function_Add("path_add", 0, 0, true);
+ Function_Add("path_duplicate", 1, 1, true);
+ Function_Add("path_assign", 2, 2, true);
+ Function_Add("path_append", 2, 2, true);
+ Function_Add("path_delete", 1, 1, true);
+ Function_Add("path_add_point", 4, 4, true);
+ Function_Add("path_insert_point", 5, 5, true);
+ Function_Add("path_change_point", 5, 5, true);
+ Function_Add("path_delete_point", 2, 2, true);
+ Function_Add("path_clear_points", 1, 1, true);
+ Function_Add("path_reverse", 1, 1, true);
+ Function_Add("path_mirror", 1, 1, true);
+ Function_Add("path_flip", 1, 1, true);
+ Function_Add("path_rotate", 2, 2, true);
+ Function_Add("path_scale", 3, 3, true);
+ Function_Add("path_shift", 3, 3, true);
+ Function_Add("timeline_name", 1, 1, false);
+ Function_Add("timeline_exists", 1, 1, false);
+ Function_Add("timeline_get_name", 1, 1, false);
+ Function_Add("timeline_add", 0, 0, true);
+ Function_Add("timeline_delete", 1, 1, true);
+ Function_Add("timeline_moment_clear", 2, 2, true);
+ Function_Add("timeline_moment_add", 3, 3, true);
+ Function_Add("object_name", 1, 1, false);
+ Function_Add("object_exists", 1, 1, false);
+ Function_Add("object_get_name", 1, 1, false);
+ Function_Add("object_get_sprite", 1, 1, false);
+ Function_Add("object_get_solid", 1, 1, false);
+ Function_Add("object_get_visible", 1, 1, false);
+ Function_Add("object_get_depth", 1, 1, false);
+ Function_Add("object_get_persistent", 1, 1, false);
+ Function_Add("object_get_mask", 1, 1, false);
+ Function_Add("object_get_parent", 1, 1, false);
+ Function_Add("object_is_ancestor", 2, 2, false);
+ Function_Add("object_set_sprite", 2, 2, true);
+ Function_Add("object_set_solid", 2, 2, true);
+ Function_Add("object_set_visible", 2, 2, true);
+ Function_Add("object_set_depth", 2, 2, true);
+ Function_Add("object_set_persistent", 2, 2, true);
+ Function_Add("object_set_mask", 2, 2, true);
+ Function_Add("object_set_parent", 2, 2, true);
+ Function_Add("object_add", 0, 0, true);
+ Function_Add("object_delete", 1, 1, true);
+ Function_Add("object_event_clear", 3, 3, true);
+ Function_Add("object_event_add", 4, 4, true);
+ Function_Add("room_name", 1, 1, false);
+ Function_Add("room_exists", 1, 1, false);
+ Function_Add("room_get_name", 1, 1, false);
+ Function_Add("room_set_width", 2, 2, true);
+ Function_Add("room_set_height", 2, 2, true);
+ Function_Add("room_set_caption", 2, 2, true);
+ Function_Add("room_set_persistent", 2, 2, true);
+ Function_Add("room_set_code", 2, 2, true);
+ Function_Add("room_set_background_color", 3, 3, true);
+ Function_Add("room_set_background", 12, 12, true);
+ Function_Add("room_set_view", 16, 16, true);
+ Function_Add("room_set_view_enabled", 2, 2, true);
+ Function_Add("room_add", 0, 0, true);
+ Function_Add("room_duplicate", 1, 1, true);
+ Function_Add("room_assign", 2, 2, true);
+ Function_Add("room_instance_add", 4, 4, true);
+ Function_Add("room_instance_clear", 1, 1, true);
+ Function_Add("room_tile_add", 9, 9, true);
+ Function_Add("room_tile_add_ext", 12, 12, true);
+ Function_Add("room_tile_clear", 1, 1, true);
+ Function_Add("sound_play", 1, 1, false);
+ Function_Add("sound_loop", 1, 1, false);
+ Function_Add("sound_stop", 1, 1, false);
+ Function_Add("sound_stop_all", 0, 0, false);
+ Function_Add("sound_isplaying", 1, 1, false);
+ Function_Add("sound_volume", 2, 2, false);
+ Function_Add("sound_fade", 3, 3, false);
+ Function_Add("sound_pan", 2, 2, false);
+ Function_Add("sound_background_tempo", 1, 1, false);
+ Function_Add("sound_global_volume", 1, 1, false);
+ Function_Add("sound_set_search_directory", 1, 1, false);
+ Function_Add("sound_effect_set", 2, 2, true);
+ Function_Add("sound_effect_chorus", 8, 8, true);
+ Function_Add("sound_effect_compressor", 7, 7, true);
+ Function_Add("sound_effect_echo", 6, 6, true);
+ Function_Add("sound_effect_flanger", 8, 8, true);
+ Function_Add("sound_effect_gargle", 3, 3, true);
+ Function_Add("sound_effect_equalizer", 4, 4, true);
+ Function_Add("sound_effect_reverb", 5, 5, true);
+ Function_Add("sound_3d_set_sound_position", 4, 4, true);
+ Function_Add("sound_3d_set_sound_velocity", 4, 4, true);
+ Function_Add("sound_3d_set_sound_distance", 3, 3, true);
+ Function_Add("sound_3d_set_sound_cone", 7, 7, true);
+ Function_Add("cd_init", 0, 0, true);
+ Function_Add("cd_present", 0, 0, true);
+ Function_Add("cd_number", 0, 0, true);
+ Function_Add("cd_playing", 0, 0, true);
+ Function_Add("cd_paused", 0, 0, true);
+ Function_Add("cd_track", 0, 0, true);
+ Function_Add("cd_length", 0, 0, true);
+ Function_Add("cd_track_length", 1, 1, true);
+ Function_Add("cd_position", 0, 0, true);
+ Function_Add("cd_track_position", 0, 0, true);
+ Function_Add("cd_play", 2, 2, true);
+ Function_Add("cd_stop", 0, 0, true);
+ Function_Add("cd_pause", 0, 0, true);
+ Function_Add("cd_resume", 0, 0, true);
+ Function_Add("cd_set_position", 1, 1, true);
+ Function_Add("cd_set_track_position", 1, 1, true);
+ Function_Add("cd_open_door", 0, 0, true);
+ Function_Add("cd_close_door", 0, 0, true);
+ Function_Add("MCI_command", 1, 1, true);
+ Function_Add("YoYo_AddVirtualKey", 5, 5, false);
+ Function_Add("YoYo_DeleteVirtualKey", 1, 1, false);
+ Function_Add("YoYo_ShowVirtualKey", 1, 1, false);
+ Function_Add("YoYo_HideVirtualKey", 1, 1, false);
+ Function_Add("YoYo_LoginAchievements", 0, 0, false);
+ Function_Add("YoYo_LogoutAchievements", 0, 0, false);
+ Function_Add("YoYo_PostAchievement", 2, 2, false);
+ Function_Add("YoYo_PostScore", 2, 2, false);
+ Function_Add("YoYo_AchievementsAvailable", 0, 0, false);
+ Function_Add("YoYo_GetDomain", 0, 0, false);
+ Function_Add("YoYo_OpenURL", 1, 1, false);
+ Function_Add("YoYo_OpenURL_ext", 2, 2, false);
+ Function_Add("YoYo_OpenURL_full", 3, 3, false);
+ Function_Add("YoYo_EnableAds", 5, 5, false);
+ Function_Add("YoYo_DisableAds", 0, 0, false);
+ Function_Add("YoYo_LeaveRating", 4, 4, false);
+ Function_Add("YoYo_GetTimer", 0, 0, false);
+ Function_Add("YoYo_EnableAlphaBlend", 1, 1, false);
+ Function_Add("YoYo_GetPlatform", 0, 0, false);
+ Function_Add("YoYo_GetDevice", 0, 0, false);
+ Function_Add("YoYo_GetConfig", 0, 0, false);
+ Function_Add("YoYo_GetTiltX", 0, 0, false);
+ Function_Add("YoYo_GetTiltY", 0, 0, false);
+ Function_Add("YoYo_GetTiltZ", 0, 0, false);
+ Function_Add("YoYo_SelectPicture", 0, 0, false);
+ Function_Add("YoYo_GetPictureSprite", 0, 0, false);
+ Function_Add("YoYo_IsKeypadOpen", 0, 0, false);
+ Function_Add("YoYo_OF_StartDashboard", 0, 0, false);
+ Function_Add("YoYo_OF_AddAchievement", 2, 2, false);
+ Function_Add("YoYo_OF_AddLeaderboard", 3, 3, false);
+ Function_Add("YoYo_OF_SendChallenge", 3, 3, false);
+ Function_Add("YoYo_OF_SendInvite", 1, 1, false);
+ Function_Add("YoYo_OF_SendSocial", 3, 3, false);
+ Function_Add("YoYo_OF_SetURL", 1, 1, false);
+ Function_Add("YoYo_OF_AcceptChallenge", 0, 0, false);
+ Function_Add("YoYo_OF_IsOnline", 0, 0, false);
+ Function_Add("YoYo_OF_SendChallengeResult", 2, 2, false);
+ Function_Add("YoYo_MouseCheckButton", 2, 2, false);
+ Function_Add("YoYo_MouseCheckButtonPressed", 2, 2, false);
+ Function_Add("YoYo_MouseCheckButtonReleased", 2, 2, false);
+ Function_Add("YoYo_MouseX", 1, 1, false);
+ Function_Add("YoYo_MouseY", 1, 1, false);
+ Function_Add("YoYo_EnableInAppPurchases", 0, 0, false);
+ Function_Add("YoYo_RestoreInAppPurchases", 0, 0, false);
+ Function_Add("YoYo_RetrieveInAppPurchases", 0, 0, false);
+ Function_Add("YoYo_AcquireInAppPurchase", 1, 1, false);
+ Function_Add("YoYo_GetPurchasedDetails", 0, 0, false);
+ Function_Add("YoYo_ProductPurchased", 1, 1, false);
+ Function_Add("YoYo_FacebookInit", 1, 1, false);
+ Function_Add("YoYo_FacebookLogin", 1, 1, false);
+ Function_Add("YoYo_FacebookLoginStatus", 0, 0, false);
+ Function_Add("YoYo_FacebookGraphRequest", 4, 4, false);
+ Function_Add("YoYo_FacebookDialog", 3, 3, false);
+ Function_Add("YoYo_FacebookLogout", 0, 0, false);
+ Function_Add("YoYo_OSPauseEvent", 0, 0, false);
+ AddRealConstant("self", -1.0);
+ AddRealConstant("other", -2.0);
+ AddRealConstant("all", -3.0);
+ AddRealConstant("noone", -4.0);
+ AddRealConstant("global", -5.0);
+ AddRealConstant("local", -7.0);
+ AddRealConstant("true", 1.0);
+ AddRealConstant("false", 0.0);
+ AddRealConstant("pi", Math.PI);
+ AddRealConstant("pr_pointlist", 1.0);
+ AddRealConstant("pr_linelist", 2.0);
+ AddRealConstant("pr_linestrip", 3.0);
+ AddRealConstant("pr_trianglelist", 4.0);
+ AddRealConstant("pr_trianglestrip", 5.0);
+ AddRealConstant("pr_trianglefan", 6.0);
+ AddRealConstant("c_aqua", 16776960.0);
+ AddRealConstant("c_black", 0.0);
+ AddRealConstant("c_blue", 16711680.0);
+ AddRealConstant("c_dkgray", 4210752.0);
+ AddRealConstant("c_fuchsia", 16711935.0);
+ AddRealConstant("c_gray", 8421504.0);
+ AddRealConstant("c_green", 32768.0);
+ AddRealConstant("c_lime", 65280.0);
+ AddRealConstant("c_ltgray", 12632256.0);
+ AddRealConstant("c_maroon", 128.0);
+ AddRealConstant("c_navy", 8388608.0);
+ AddRealConstant("c_olive", 32896.0);
+ AddRealConstant("c_purple", 8388736.0);
+ AddRealConstant("c_red", 255.0);
+ AddRealConstant("c_silver", 12632256.0);
+ AddRealConstant("c_teal", 8421376.0);
+ AddRealConstant("c_white", 16777215.0);
+ AddRealConstant("c_yellow", 65535.0);
+ AddRealConstant("c_orange", 4235519.0);
+ AddRealConstant("bm_normal", 0.0);
+ AddRealConstant("bm_add", 1.0);
+ AddRealConstant("bm_max", 2.0);
+ AddRealConstant("bm_subtract", 3.0);
+ AddRealConstant("bm_zero", 1.0);
+ AddRealConstant("bm_one", 2.0);
+ AddRealConstant("bm_src_color", 3.0);
+ AddRealConstant("bm_inv_src_color", 4.0);
+ AddRealConstant("bm_src_alpha", 5.0);
+ AddRealConstant("bm_inv_src_alpha", 6.0);
+ AddRealConstant("bm_dest_alpha", 7.0);
+ AddRealConstant("bm_inv_dest_alpha", 8.0);
+ AddRealConstant("bm_dest_color", 9.0);
+ AddRealConstant("bm_inv_dest_color", 10.0);
+ AddRealConstant("bm_src_alpha_sat", 11.0);
+ AddRealConstant("se_none", 0.0);
+ AddRealConstant("se_chorus", 1.0);
+ AddRealConstant("se_echo", 2.0);
+ AddRealConstant("se_flanger", 4.0);
+ AddRealConstant("se_gargle", 8.0);
+ AddRealConstant("se_reverb", 16.0);
+ AddRealConstant("se_compressor", 32.0);
+ AddRealConstant("se_equalizer", 64.0);
+ AddRealConstant("fa_left", 0.0);
+ AddRealConstant("fa_center", 1.0);
+ AddRealConstant("fa_right", 2.0);
+ AddRealConstant("fa_top", 0.0);
+ AddRealConstant("fa_middle", 1.0);
+ AddRealConstant("fa_bottom", 2.0);
+ AddRealConstant("mb_any", -1.0);
+ AddRealConstant("mb_none", 0.0);
+ AddRealConstant("mb_left", 1.0);
+ AddRealConstant("mb_right", 2.0);
+ AddRealConstant("mb_middle", 3.0);
+ AddRealConstant("vk_nokey", 0.0);
+ AddRealConstant("vk_anykey", 1.0);
+ AddRealConstant("vk_enter", 13.0);
+ AddRealConstant("vk_return", 13.0);
+ AddRealConstant("vk_shift", 16.0);
+ AddRealConstant("vk_control", 17.0);
+ AddRealConstant("vk_alt", 18.0);
+ AddRealConstant("vk_escape", 27.0);
+ AddRealConstant("vk_space", 32.0);
+ AddRealConstant("vk_backspace", 8.0);
+ AddRealConstant("vk_tab", 9.0);
+ AddRealConstant("vk_pause", 19.0);
+ AddRealConstant("vk_printscreen", 44.0);
+ AddRealConstant("vk_left", 37.0);
+ AddRealConstant("vk_right", 39.0);
+ AddRealConstant("vk_up", 38.0);
+ AddRealConstant("vk_down", 40.0);
+ AddRealConstant("vk_home", 36.0);
+ AddRealConstant("vk_end", 35.0);
+ AddRealConstant("vk_delete", 46.0);
+ AddRealConstant("vk_insert", 45.0);
+ AddRealConstant("vk_pageup", 33.0);
+ AddRealConstant("vk_pagedown", 34.0);
+ AddRealConstant("vk_f1", 112.0);
+ AddRealConstant("vk_f2", 113.0);
+ AddRealConstant("vk_f3", 114.0);
+ AddRealConstant("vk_f4", 115.0);
+ AddRealConstant("vk_f5", 116.0);
+ AddRealConstant("vk_f6", 117.0);
+ AddRealConstant("vk_f7", 118.0);
+ AddRealConstant("vk_f8", 119.0);
+ AddRealConstant("vk_f9", 120.0);
+ AddRealConstant("vk_f10", 121.0);
+ AddRealConstant("vk_f11", 128.0);
+ AddRealConstant("vk_f12", 129.0);
+ AddRealConstant("vk_numpad0", 96.0);
+ AddRealConstant("vk_numpad1", 97.0);
+ AddRealConstant("vk_numpad2", 98.0);
+ AddRealConstant("vk_numpad3", 99.0);
+ AddRealConstant("vk_numpad4", 100.0);
+ AddRealConstant("vk_numpad5", 101.0);
+ AddRealConstant("vk_numpad6", 102.0);
+ AddRealConstant("vk_numpad7", 103.0);
+ AddRealConstant("vk_numpad8", 104.0);
+ AddRealConstant("vk_numpad9", 105.0);
+ AddRealConstant("vk_divide", 111.0);
+ AddRealConstant("vk_multiply", 106.0);
+ AddRealConstant("vk_subtract", 109.0);
+ AddRealConstant("vk_add", 107.0);
+ AddRealConstant("vk_decimal", 110.0);
+ AddRealConstant("vk_lshift", 160.0);
+ AddRealConstant("vk_lcontrol", 162.0);
+ AddRealConstant("vk_lalt", 164.0);
+ AddRealConstant("vk_rshift", 161.0);
+ AddRealConstant("vk_rcontrol", 163.0);
+ AddRealConstant("vk_ralt", 165.0);
+ AddRealConstant("ev_create", 0.0);
+ AddRealConstant("ev_destroy", 1.0);
+ AddRealConstant("ev_step", 3.0);
+ AddRealConstant("ev_alarm", 2.0);
+ AddRealConstant("ev_keyboard", 5.0);
+ AddRealConstant("ev_mouse", 6.0);
+ AddRealConstant("ev_collision", 4.0);
+ AddRealConstant("ev_other", 7.0);
+ AddRealConstant("ev_draw", 8.0);
+ AddRealConstant("ev_keypress", 9.0);
+ AddRealConstant("ev_keyrelease", 10.0);
+ AddRealConstant("ev_trigger", 11.0);
+ AddRealConstant("ev_left_button", 0.0);
+ AddRealConstant("ev_right_button", 1.0);
+ AddRealConstant("ev_middle_button", 2.0);
+ AddRealConstant("ev_no_button", 3.0);
+ AddRealConstant("ev_left_press", 4.0);
+ AddRealConstant("ev_right_press", 5.0);
+ AddRealConstant("ev_middle_press", 6.0);
+ AddRealConstant("ev_left_release", 7.0);
+ AddRealConstant("ev_right_release", 8.0);
+ AddRealConstant("ev_middle_release", 9.0);
+ AddRealConstant("ev_mouse_enter", 10.0);
+ AddRealConstant("ev_mouse_leave", 11.0);
+ AddRealConstant("ev_global_press", 12.0);
+ AddRealConstant("ev_global_release", 13.0);
+ AddRealConstant("ev_joystick1_left", 16.0);
+ AddRealConstant("ev_joystick1_right", 17.0);
+ AddRealConstant("ev_joystick1_up", 18.0);
+ AddRealConstant("ev_joystick1_down", 19.0);
+ AddRealConstant("ev_joystick1_button1", 21.0);
+ AddRealConstant("ev_joystick1_button2", 22.0);
+ AddRealConstant("ev_joystick1_button3", 23.0);
+ AddRealConstant("ev_joystick1_button4", 24.0);
+ AddRealConstant("ev_joystick1_button5", 25.0);
+ AddRealConstant("ev_joystick1_button6", 26.0);
+ AddRealConstant("ev_joystick1_button7", 27.0);
+ AddRealConstant("ev_joystick1_button8", 28.0);
+ AddRealConstant("ev_joystick2_left", 31.0);
+ AddRealConstant("ev_joystick2_right", 32.0);
+ AddRealConstant("ev_joystick2_up", 33.0);
+ AddRealConstant("ev_joystick2_down", 34.0);
+ AddRealConstant("ev_joystick2_button1", 36.0);
+ AddRealConstant("ev_joystick2_button2", 37.0);
+ AddRealConstant("ev_joystick2_button3", 38.0);
+ AddRealConstant("ev_joystick2_button4", 39.0);
+ AddRealConstant("ev_joystick2_button5", 40.0);
+ AddRealConstant("ev_joystick2_button6", 41.0);
+ AddRealConstant("ev_joystick2_button7", 42.0);
+ AddRealConstant("ev_joystick2_button8", 43.0);
+ AddRealConstant("ev_global_left_button", 50.0);
+ AddRealConstant("ev_global_right_button", 51.0);
+ AddRealConstant("ev_global_middle_button", 52.0);
+ AddRealConstant("ev_global_left_press", 53.0);
+ AddRealConstant("ev_global_right_press", 54.0);
+ AddRealConstant("ev_global_middle_press", 55.0);
+ AddRealConstant("ev_global_left_release", 56.0);
+ AddRealConstant("ev_global_right_release", 57.0);
+ AddRealConstant("ev_global_middle_release", 58.0);
+ AddRealConstant("ev_mouse_wheel_up", 60.0);
+ AddRealConstant("ev_mouse_wheel_down", 61.0);
+ AddRealConstant("ev_outside", 0.0);
+ AddRealConstant("ev_boundary", 1.0);
+ AddRealConstant("ev_game_start", 2.0);
+ AddRealConstant("ev_game_end", 3.0);
+ AddRealConstant("ev_room_start", 4.0);
+ AddRealConstant("ev_room_end", 5.0);
+ AddRealConstant("ev_no_more_lives", 6.0);
+ AddRealConstant("ev_animation_end", 7.0);
+ AddRealConstant("ev_end_of_path", 8.0);
+ AddRealConstant("ev_no_more_health", 9.0);
+ AddRealConstant("ev_user0", 10.0);
+ AddRealConstant("ev_user1", 11.0);
+ AddRealConstant("ev_user2", 12.0);
+ AddRealConstant("ev_user3", 13.0);
+ AddRealConstant("ev_user4", 14.0);
+ AddRealConstant("ev_user5", 15.0);
+ AddRealConstant("ev_user6", 16.0);
+ AddRealConstant("ev_user7", 17.0);
+ AddRealConstant("ev_user8", 18.0);
+ AddRealConstant("ev_user9", 19.0);
+ AddRealConstant("ev_user10", 20.0);
+ AddRealConstant("ev_user11", 21.0);
+ AddRealConstant("ev_user12", 22.0);
+ AddRealConstant("ev_user13", 23.0);
+ AddRealConstant("ev_user14", 24.0);
+ AddRealConstant("ev_user15", 25.0);
+ AddRealConstant("ev_close_button", 30.0);
+ AddRealConstant("ev_step_normal", 0.0);
+ AddRealConstant("ev_step_begin", 1.0);
+ AddRealConstant("ev_step_end", 2.0);
+ AddRealConstant("ty_real", 0.0);
+ AddRealConstant("ty_string", 1.0);
+ AddRealConstant("dll_cdecl", 0.0);
+ AddRealConstant("dll_stdcall", 1.0);
+ AddRealConstant("fa_readonly", 1.0);
+ AddRealConstant("fa_hidden", 2.0);
+ AddRealConstant("fa_sysfile", 4.0);
+ AddRealConstant("fa_volumeid", 8.0);
+ AddRealConstant("fa_directory", 16.0);
+ AddRealConstant("fa_archive", 32.0);
+ AddRealConstant("cr_default", 0.0);
+ AddRealConstant("cr_none", -1.0);
+ AddRealConstant("cr_arrow", -2.0);
+ AddRealConstant("cr_arrrow", -3.0);
+ AddRealConstant("cr_cross", -4.0);
+ AddRealConstant("cr_beam", -5.0);
+ AddRealConstant("cr_size_nesw", -6.0);
+ AddRealConstant("cr_size_ns", -7.0);
+ AddRealConstant("cr_size_nwse", -8.0);
+ AddRealConstant("cr_size_we", -9.0);
+ AddRealConstant("cr_uparrow", -10.0);
+ AddRealConstant("cr_hourglass", -11.0);
+ AddRealConstant("cr_drag", -12.0);
+ AddRealConstant("cr_nodrop", -13.0);
+ AddRealConstant("cr_hsplit", -14.0);
+ AddRealConstant("cr_vsplit", -15.0);
+ AddRealConstant("cr_multidrag", -16.0);
+ AddRealConstant("cr_sqlwait", -17.0);
+ AddRealConstant("cr_no", -18.0);
+ AddRealConstant("cr_appstart", -19.0);
+ AddRealConstant("cr_help", -20.0);
+ AddRealConstant("cr_handpoint", -21.0);
+ AddRealConstant("cr_size_all", -22.0);
+ AddRealConstant("pt_shape_pixel", 0.0);
+ AddRealConstant("pt_shape_disk", 1.0);
+ AddRealConstant("pt_shape_square", 2.0);
+ AddRealConstant("pt_shape_line", 3.0);
+ AddRealConstant("pt_shape_star", 4.0);
+ AddRealConstant("pt_shape_circle", 5.0);
+ AddRealConstant("pt_shape_ring", 6.0);
+ AddRealConstant("pt_shape_sphere", 7.0);
+ AddRealConstant("pt_shape_flare", 8.0);
+ AddRealConstant("pt_shape_spark", 9.0);
+ AddRealConstant("pt_shape_explosion", 10.0);
+ AddRealConstant("pt_shape_cloud", 11.0);
+ AddRealConstant("pt_shape_smoke", 12.0);
+ AddRealConstant("pt_shape_snow", 13.0);
+ AddRealConstant("ps_distr_linear", 0.0);
+ AddRealConstant("ps_distr_gaussian", 1.0);
+ AddRealConstant("ps_distr_invgaussian", 2.0);
+ AddRealConstant("ps_shape_rectangle", 0.0);
+ AddRealConstant("ps_shape_ellipse", 1.0);
+ AddRealConstant("ps_shape_diamond", 2.0);
+ AddRealConstant("ps_shape_line", 3.0);
+ AddRealConstant("ps_force_constant", 0.0);
+ AddRealConstant("ps_force_linear", 1.0);
+ AddRealConstant("ps_force_quadratic", 2.0);
+ AddRealConstant("ps_deflect_vertical", 0.0);
+ AddRealConstant("ps_deflect_horizontal", 1.0);
+ AddRealConstant("ps_change_all", 0.0);
+ AddRealConstant("ps_change_shape", 1.0);
+ AddRealConstant("ps_change_motion", 2.0);
+ AddRealConstant("ef_explosion", 0.0);
+ AddRealConstant("ef_ring", 1.0);
+ AddRealConstant("ef_ellipse", 2.0);
+ AddRealConstant("ef_firework", 3.0);
+ AddRealConstant("ef_smoke", 4.0);
+ AddRealConstant("ef_smokeup", 5.0);
+ AddRealConstant("ef_star", 6.0);
+ AddRealConstant("ef_spark", 7.0);
+ AddRealConstant("ef_flare", 8.0);
+ AddRealConstant("ef_cloud", 9.0);
+ AddRealConstant("ef_rain", 10.0);
+ AddRealConstant("ef_snow", 11.0);
+ AddRealConstant("display_landscape", 0.0);
+ AddRealConstant("display_portrait", 1.0);
+ AddRealConstant("os_win32", 0.0);
+ AddRealConstant("os_windows", 0.0);
+ AddRealConstant("os_maxos", 1.0);
+ AddRealConstant("os_psp", 2.0);
+ AddRealConstant("os_ios", 3.0);
+ AddRealConstant("os_android", 4.0);
+ AddRealConstant("os_symbian", 5.0);
+ AddRealConstant("os_linux", 6.0);
+ AddRealConstant("browser_not_a_browser", -1.0);
+ AddRealConstant("browser_unknown", 0.0);
+ AddRealConstant("browser_ie", 1.0);
+ AddRealConstant("browser_firefox", 2.0);
+ AddRealConstant("browser_chrome", 3.0);
+ AddRealConstant("browser_safari", 4.0);
+ AddRealConstant("browser_safari_mobile", 5.0);
+ AddRealConstant("browser_opera", 6.0);
+ AddRealConstant("device_ios_unknown", -1.0);
+ AddRealConstant("device_ios_ipad", 0.0);
+ AddRealConstant("device_ios_iphone", 1.0);
+ AddRealConstant("device_ios_iphone_retina", 2.0);
+ AddRealConstant("of_challenge_win", 0.0);
+ AddRealConstant("of_challenge_lose", 1.0);
+ AddRealConstant("of_challenge_tie", 2.0);
+ AddRealConstant("leaderboard_type_number", 0.0);
+ AddRealConstant("leaderboard_type_time_mins_secs", 1.0);
+ AddRealConstant("phy_joint_anchor_1_x", 0.0);
+ AddRealConstant("phy_joint_anchor_1_y", 1.0);
+ AddRealConstant("phy_joint_anchor_2_x", 2.0);
+ AddRealConstant("phy_joint_anchor_2_y", 3.0);
+ AddRealConstant("phy_joint_reaction_force_x", 4.0);
+ AddRealConstant("phy_joint_reaction_force_y", 5.0);
+ AddRealConstant("phy_joint_reaction_torque", 6.0);
+ AddRealConstant("phy_joint_motor_speed", 7.0);
+ AddRealConstant("phy_joint_angle", 8.0);
+ AddRealConstant("phy_joint_motor_torque", 9.0);
+ AddRealConstant("phy_joint_max_motor_torque", 10.0);
+ AddRealConstant("phy_joint_translation", 11.0);
+ AddRealConstant("phy_joint_speed", 12.0);
+ AddRealConstant("phy_joint_motor_force", 13.0);
+ AddRealConstant("phy_joint_max_motor_force", 14.0);
+ AddRealConstant("phy_joint_length_1", 15.0);
+ AddRealConstant("phy_joint_length_2", 16.0);
+ AddRealConstant("phy_debug_render_shapes", 1.0);
+ AddRealConstant("phy_debug_render_joints", 2.0);
+ AddRealConstant("phy_debug_render_coms", 4.0);
+ AddRealConstant("phy_debug_render_aabb", 8.0);
+ AddRealConstant("phy_debug_render_obb", 16.0);
+ AddRealConstant("phy_debug_render_core_shapes", 32.0);
+ AddRealConstant("phy_debug_render_collision_pairs", 64.0);
+ Variable_BuiltIn_Add("argument_relative", true, false, false, null, null);
+ Variable_BuiltIn_Add("argument_count", true, false, false, null, null);
+ Variable_BuiltIn_Add("argument", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument0", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument1", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument2", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument3", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument4", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument5", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument6", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument7", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument8", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument9", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument10", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument11", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument12", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument13", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument14", true, true, true, null, null);
+ Variable_BuiltIn_Add("argument15", true, true, true, null, null);
+ Variable_BuiltIn_Add("debug_mode", true, true, true, null, null);
+ Variable_BuiltIn_Add("room", true, true, true, "set_current_room", "get_current_room");
+ Variable_BuiltIn_Add("room_first", true, false, false, null, null);
+ Variable_BuiltIn_Add("room_last", true, false, false, null, null);
+ Variable_BuiltIn_Add("transition_kind", true, true, true, null, null);
+ Variable_BuiltIn_Add("transition_steps", true, true, true, null, null);
+ Variable_BuiltIn_Add("score", true, true, true, null, null);
+ Variable_BuiltIn_Add("lives", true, true, true, "set_lives_function", null);
+ Variable_BuiltIn_Add("health", true, true, true, "set_health_function", null);
+ Variable_BuiltIn_Add("game_id", true, false, false, null, null);
+ Variable_BuiltIn_Add("working_directory", true, false, false, null, null);
+ Variable_BuiltIn_Add("temp_directory", true, false, false, null, null);
+ Variable_BuiltIn_Add("program_directory", true, false, false, null, null);
+ Variable_BuiltIn_Add("instance_count", true, false, false, null, "get_instance_count");
+ Variable_BuiltIn_Add("instance_id", true, false, false, null, null);
+ Variable_BuiltIn_Add("room_width", true, false, false, "set_room_width", null);
+ Variable_BuiltIn_Add("room_height", true, false, false, "set_room_height", null);
+ Variable_BuiltIn_Add("room_caption", true, true, true, "set_room_caption", null);
+ Variable_BuiltIn_Add("room_speed", true, true, true, "set_room_speed", null);
+ Variable_BuiltIn_Add("room_persistent", true, true, true, "room_persistent", null);
+ Variable_BuiltIn_Add("background_color", true, true, true, "setbackground_color", "getbackground_color");
+ Variable_BuiltIn_Add("background_showcolor", true, true, true, "setbackground_showcolor", "getbackground_showcolor");
+ Variable_BuiltIn_Array_Add("background_visible", true, true, true);
+ Variable_BuiltIn_Array_Add("background_foreground", true, true, true);
+ Variable_BuiltIn_Array_Add("background_index", true, true, true);
+ Variable_BuiltIn_Array_Add("background_x", true, true, true);
+ Variable_BuiltIn_Array_Add("background_y", true, true, true);
+ Variable_BuiltIn_Array_Add("background_width", true, false, false);
+ Variable_BuiltIn_Array_Add("background_height", true, false, false);
+ Variable_BuiltIn_Array_Add("background_htiled", true, true, true);
+ Variable_BuiltIn_Array_Add("background_vtiled", true, true, true);
+ Variable_BuiltIn_Array_Add("background_xscale", true, true, true);
+ Variable_BuiltIn_Array_Add("background_yscale", true, true, true);
+ Variable_BuiltIn_Array_Add("background_hspeed", true, true, true);
+ Variable_BuiltIn_Array_Add("background_vspeed", true, true, true);
+ Variable_BuiltIn_Array_Add("background_blend", true, true, true);
+ Variable_BuiltIn_Array_Add("background_alpha", true, true, true);
+ Variable_BuiltIn_Add("view_enabled", true, true, true, "set_view_enable", "get_view_enable");
+ Variable_BuiltIn_Add("view_current", true, false, false, null, null);
+ Variable_BuiltIn_Add("view_visible", true, true, true, null, null);
+ Variable_BuiltIn_Array_Add("view_xview", true, true, true);
+ Variable_BuiltIn_Array_Add("view_yview", true, true, true);
+ Variable_BuiltIn_Array_Add("view_wview", true, true, true);
+ Variable_BuiltIn_Array_Add("view_hview", true, true, true);
+ Variable_BuiltIn_Array_Add("view_xport", true, true, true);
+ Variable_BuiltIn_Array_Add("view_yport", true, true, true);
+ Variable_BuiltIn_Array_Add("view_wport", true, true, true);
+ Variable_BuiltIn_Array_Add("view_hport", true, true, true);
+ Variable_BuiltIn_Array_Add("view_angle", true, true, true);
+ Variable_BuiltIn_Array_Add("view_hborder", true, true, true);
+ Variable_BuiltIn_Array_Add("view_vborder", true, true, true);
+ Variable_BuiltIn_Array_Add("view_hspeed", true, true, true);
+ Variable_BuiltIn_Array_Add("view_vspeed", true, true, true);
+ Variable_BuiltIn_Array_Add("view_object", true, true, true);
+ Variable_BuiltIn_Array_Add("view_surface_id", true, true, true);
+ Variable_BuiltIn_Add("mouse_x", true, false, false, null, null);
+ Variable_BuiltIn_Add("mouse_y", true, false, false, null, null);
+ Variable_BuiltIn_Add("mouse_button", true, true, true, null, null);
+ Variable_BuiltIn_Add("mouse_lastbutton", true, true, true, null, null);
+ Variable_BuiltIn_Add("keyboard_key", true, true, true, null, null);
+ Variable_BuiltIn_Add("keyboard_lastkey", true, true, true, null, null);
+ Variable_BuiltIn_Add("keyboard_lastchar", true, true, true, null, null);
+ Variable_BuiltIn_Add("keyboard_string", true, true, true, null, null);
+ Variable_BuiltIn_Add("cursor_sprite", true, true, true, null, null);
+ Variable_BuiltIn_Add("show_score", true, true, true, null, null);
+ Variable_BuiltIn_Add("show_lives", true, true, true, null, null);
+ Variable_BuiltIn_Add("show_health", true, true, true, null, null);
+ Variable_BuiltIn_Add("caption_score", true, true, true, null, null);
+ Variable_BuiltIn_Add("caption_lives", true, true, true, null, null);
+ Variable_BuiltIn_Add("caption_health", true, true, true, null, null);
+ Variable_BuiltIn_Add("fps", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_time", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_year", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_month", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_day", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_weekday", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_hour", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_minute", true, false, false, null, null);
+ Variable_BuiltIn_Add("current_second", true, false, false, null, null);
+ Variable_BuiltIn_Add("event_type", true, false, false, null, null);
+ Variable_BuiltIn_Add("event_number", true, false, false, null, null);
+ Variable_BuiltIn_Add("event_object", true, false, false, null, null);
+ Variable_BuiltIn_Add("event_action", true, false, false, null, null);
+ Variable_BuiltIn_Add("secure_mode", true, false, false, null, null);
+ Variable_BuiltIn_Add("error_occurred", true, true, true, null, null);
+ Variable_BuiltIn_Add("error_last", true, true, true, null, null);
+ Variable_BuiltIn_Add("gamemaker_registered", true, false, false, null, null);
+ Variable_BuiltIn_Add("gamemaker_pro", true, false, false, null, null);
+ Variable_BuiltIn_Add("os_type", true, false, false, null, "get_os_type");
+ Variable_BuiltIn_Add("os_device", true, false, false, null, "get_os_device");
+ Variable_BuiltIn_Add("os_browser", true, false, false, null, "get_os_browser");
+ Variable_BuiltIn_Add("os_version", true, false, false, null, "get_os_version");
+ Variable_BuiltIn_Add("browser_width", true, false, false, null, "get_browser_width");
+ Variable_BuiltIn_Add("browser_height", true, false, false, null, "get_browser_height");
+ Variable_BuiltIn_Add("async_load", true, false, false, null, "get_async_load");
+ Variable_BuiltIn_Local_Add("x", true, true, true, "setx", null);
+ Variable_BuiltIn_Local_Add("y", true, true, true, "sety", null);
+ Variable_BuiltIn_Local_Add("xprevious", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("yprevious", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("xstart", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("ystart", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("hspeed", true, true, true, "sethspeed", null);
+ Variable_BuiltIn_Local_Add("vspeed", true, true, true, "setvspeed", null);
+ Variable_BuiltIn_Local_Add("direction", true, true, true, "setdirection", null);
+ Variable_BuiltIn_Local_Add("speed", true, true, true, "setspeed", null);
+ Variable_BuiltIn_Local_Add("friction", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("gravity", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("gravity_direction", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("object_index", true, false, false, null, null);
+ Variable_BuiltIn_Local_Add("id", true, false, false, null, null);
+ Variable_BuiltIn_Local_Add("alarm", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("solid", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("visible", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("persistent", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("depth", true, true, true, "setdepth", "getdepth");
+ Variable_BuiltIn_Local_Add("bbox_left", true, false, false, null, "get_bbox_left");
+ Variable_BuiltIn_Local_Add("bbox_right", true, false, false, null, "get_bbox_right");
+ Variable_BuiltIn_Local_Add("bbox_top", true, false, false, null, "get_bbox_top");
+ Variable_BuiltIn_Local_Add("bbox_bottom", true, false, false, null, "get_bbox_bottom");
+ Variable_BuiltIn_Local_Add("sprite_index", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("image_index", true, true, true, "set_image_index", null);
+ Variable_BuiltIn_Local_Add("image_single", true, true, true, "set_image_single", "get_image_single");
+ Variable_BuiltIn_Local_Add("image_number", true, false, false, null, "get_image_number");
+ Variable_BuiltIn_Local_Add("sprite_width", true, false, false, null, "get_sprite_width");
+ Variable_BuiltIn_Local_Add("sprite_height", true, false, false, null, "get_sprite_height");
+ Variable_BuiltIn_Local_Add("sprite_xoffset", true, false, false, null, "get_sprite_xoffset");
+ Variable_BuiltIn_Local_Add("sprite_yoffset", true, false, false, null, "get_sprite_yoffset");
+ Variable_BuiltIn_Local_Add("image_xscale", true, true, true, "setxscale", null);
+ Variable_BuiltIn_Local_Add("image_yscale", true, true, true, "setyscale", null);
+ Variable_BuiltIn_Local_Add("image_angle", true, true, true, "setangle", null);
+ Variable_BuiltIn_Local_Add("image_alpha", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("image_blend", true, true, true, "set_imageblend", "get_imageblend");
+ Variable_BuiltIn_Local_Add("image_speed", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("mask_index", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("path_index", true, false, false, null, null);
+ Variable_BuiltIn_Local_Add("path_position", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("path_positionprevious", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("path_speed", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("path_scale", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("path_orientation", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("path_endaction", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("timeline_index", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("timeline_position", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("timeline_speed", true, true, true, null, null);
+ Variable_BuiltIn_Local_Add("timeline_running", true, true, true, "set_timeline_running", "get_timeline_running");
+ Variable_BuiltIn_Local_Add("timeline_loop", true, true, true, "set_timeline_loop", "get_timeline_loop");
+ Variable_BuiltIn_Local_Add("phy_mass", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_inertia", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_com_x", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_com_y", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_dynamic", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_frozen", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_sleeping", true, false, true, null, null);
+ Variable_BuiltIn_Local_Add("phy_collision_points", true, false, true, null, null);
+ Variable_BuiltIn_Local_Array_Add("phy_collision_x", true, false, true);
+ Variable_BuiltIn_Local_Array_Add("phy_collision_y", true, false, true);
+ Variable_BuiltIn_Local_Array_Add("phy_col_normal_x", true, false, true);
+ Variable_BuiltIn_Local_Array_Add("phy_col_normal_y", true, false, true);
+ }
+
+ public static int Find(IList> _list, string _name)
+ {
+ int i;
+ for (i = 0; i < _list.Count && !(_list[i].Key == _name); i++)
+ {
+ }
+ if (i >= _list.Count)
+ {
+ return -1;
+ }
+ return i;
+ }
+
+ public static int FindTriggerConstName(IList _list, string _name)
+ {
+ int result = -1;
+ for (int i = 0; i < _list.Count; i++)
+ {
+ if (_list[i].ConstName == _name)
+ {
+ result = i + 1;
+ break;
+ }
+ }
+ return result;
+ }
+
+ private static int Code_Function_Find(string _name)
+ {
+ if (ms_assets != null)
+ {
+ int num = 0;
+ foreach (GMExtension extension in ms_assets.Extensions)
+ {
+ int num2 = 0;
+ foreach (GMExtensionInclude include in extension.Includes)
+ {
+ int num3 = 0;
+ foreach (GMExtensionFunction function in include.Functions)
+ {
+ if (function.Name == _name)
+ {
+ return ms_id + num * 256 + num2 * 4096 + num3;
+ }
+ num3++;
+ }
+ num2++;
+ }
+ num++;
+ }
+ int num4 = Find(ms_assets.Scripts, _name);
+ if (num4 >= 0)
+ {
+ return num4 + 100000;
+ }
+ }
+ GMLFunction value = null;
+ if (!ms_funcs.TryGetValue(_name, out value))
+ {
+ return -1;
+ }
+ return value.Id;
+ }
+
+ private static int FindResourceIndexFromName(string _name)
+ {
+ int result = -1;
+ if (ms_assets != null)
+ {
+ int num = Find(ms_assets.Objects, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Sprites, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Sounds, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Backgrounds, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Paths, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Fonts, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.TimeLines, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Scripts, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = Find(ms_assets.Rooms, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ num = FindTriggerConstName(ms_assets.Triggers, _name);
+ if (num >= 0)
+ {
+ return num;
+ }
+ }
+ return result;
+ }
+
+ private static bool Code_Constant_Find(string _name, out GMLValue _val)
+ {
+ _val = new GMLValue();
+ _val.Kind = eKind.eNumber;
+ int value = 0;
+ ms_ConstantCount.TryGetValue(_name, out value);
+ ms_ConstantCount[_name] = value + 1;
+ int num = FindResourceIndexFromName(_name);
+ if (num >= 0)
+ {
+ _val.ValueI = num;
+ return true;
+ }
+ string value2;
+ if (ms_assets.Options.Constants.TryGetValue(_name, out value2))
+ {
+ double result = 0.0;
+ if (double.TryParse(value2, out result))
+ {
+ _val.ValueI = result;
+ return true;
+ }
+ num = FindResourceIndexFromName(value2);
+ if (num >= 0)
+ {
+ _val.ValueI = num;
+ return true;
+ }
+ _val.Kind = eKind.eConstant;
+ _val.ValueS = _name;
+ return true;
+ }
+ double value3 = 0.0;
+ if (!ms_constants.TryGetValue(_name, out value3))
+ {
+ return false;
+ }
+ _val.ValueI = value3;
+ return true;
+ }
+
+ private static int Code_Variable_Find(string _name)
+ {
+ GMLVariable value = null;
+ if (!ms_builtins.TryGetValue(_name, out value) && !ms_builtinsLocal.TryGetValue(_name, out value) && !ms_vars.TryGetValue(_name, out value))
+ {
+ value = new GMLVariable();
+ value.Name = _name;
+ value.Id = 100000 + ms_vars.Count;
+ ms_vars.Add(_name, value);
+ }
+ return value.Id;
+ }
+
+ private static void CreateFunctionsToken(string _script, List _pass1, List _pass2, int _index)
+ {
+ int num = Code_Function_Find(_pass1[_index].Text);
+ if (num < 0)
+ {
+ Error(string.Format("unknown function or script {0}", _pass1[_index].Text), _script, _pass1[_index]);
+ }
+ _pass2.Add(new GMLToken(eToken.eFunction, _pass1[_index], num));
+ }
+
+ private static void CreateNameToken(string _script, List _pass1, List _pass2, int _index)
+ {
+ GMLValue _val = null;
+ if (!Code_Constant_Find(_pass1[_index].Text, out _val))
+ {
+ int id = Code_Variable_Find(_pass1[_index].Text);
+ _pass2.Add(new GMLToken(eToken.eVariable, _pass1[_index], id));
+ }
+ else
+ {
+ _pass2.Add(new GMLToken(eToken.eConstant, _pass1[_index], 0, _val));
+ }
+ }
+
+ private static void CreateValueToken(string _script, List _pass1, List _pass2, int _index)
+ {
+ string text = _pass1[_index].Text;
+ GMLValue gMLValue = null;
+ if (text[0] == '$')
+ {
+ long num = Convert.ToInt64(text.Substring(1), 16);
+ gMLValue = new GMLValue(num);
+ }
+ else
+ {
+ double result = 0.0;
+ if (!double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out result))
+ {
+ Error(string.Format("Number {0} in incorrect format", text), _script, _pass1[_index]);
+ }
+ gMLValue = new GMLValue(result);
+ }
+ _pass2.Add(new GMLToken(eToken.eConstant, _pass1[_index], 0, gMLValue));
+ }
+
+ private static void CreateStringToken(string _script, List _pass1, List _pass2, int _index)
+ {
+ _pass2.Add(new GMLToken(eToken.eConstant, _pass1[_index], 0, new GMLValue(_pass1[_index].Text)));
+ }
+
+ private static void CreateNormalToken(string _script, List _pass1, List _pass2, int _index)
+ {
+ _pass2.Add(new GMLToken(_pass1[_index].Token, _pass1[_index], 0));
+ }
+
+ private static int ParseStatement(List _pass3, List _pass2, int _index)
+ {
+ int i = _index;
+ switch (_pass2[i].Token)
+ {
+ case eToken.eEOF:
+ Error("unexpected EOF encountered", ms_script, _pass2[i]);
+ break;
+ case eToken.eVar:
+ i = ParseVar(_pass3, _pass2, _index);
+ break;
+ case eToken.eGlobalVar:
+ i = ParseGlobalVar(_pass3, _pass2, _index);
+ break;
+ case eToken.eBegin:
+ i = ParseBlock(_pass3, _pass2, _index);
+ break;
+ case eToken.eRepeat:
+ i = ParseRepeat(_pass3, _pass2, _index);
+ break;
+ case eToken.eIf:
+ i = ParseIf(_pass3, _pass2, _index);
+ break;
+ case eToken.eWhile:
+ i = ParseWhile(_pass3, _pass2, _index);
+ break;
+ case eToken.eFor:
+ i = ParseFor(_pass3, _pass2, _index);
+ break;
+ case eToken.eDo:
+ i = ParseDo(_pass3, _pass2, _index);
+ break;
+ case eToken.eWith:
+ i = ParseWith(_pass3, _pass2, _index);
+ break;
+ case eToken.eSwitch:
+ i = ParseSwitch(_pass3, _pass2, _index);
+ break;
+ case eToken.eCase:
+ i = ParseCase(_pass3, _pass2, _index);
+ break;
+ case eToken.eDefault:
+ i = ParseDefault(_pass3, _pass2, _index);
+ break;
+ case eToken.eReturn:
+ i = ParseReturn(_pass3, _pass2, _index);
+ break;
+ case eToken.eFunction:
+ i = ParseFunction(_pass3, _pass2, _index);
+ break;
+ case eToken.eExit:
+ case eToken.eBreak:
+ case eToken.eContinue:
+ _pass3.Add(new GMLToken(_pass2[_index].Token, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value));
+ i++;
+ break;
+ default:
+ i = ParseAssignment(_pass3, _pass2, _index);
+ break;
+ case eToken.eSepStatement:
+ break;
+ }
+ for (; _pass2[i].Token == eToken.eSepStatement; i++)
+ {
+ }
+ return i;
+ }
+
+ private static int ParseVar(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eVar, _pass2[_index], 0);
+ int num = _index + 1;
+ while (_pass2[num].Token == eToken.eVariable)
+ {
+ if (_pass2[num].Id < 100000)
+ {
+ Error("cannot redeclare a builtin varable", ms_script, _pass2[num]);
+ }
+ GMLToken gMLToken2 = new GMLToken(_pass2[num]);
+ gMLToken2.Token = eToken.eConstant;
+ gMLToken.Children.Add(gMLToken2);
+ num++;
+ if (_pass2[num].Token == eToken.eSepArgument)
+ {
+ num++;
+ }
+ }
+ _pass3.Add(gMLToken);
+ return num;
+ }
+
+ private static int ParseGlobalVar(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eGlobalVar, _pass2[_index], 0);
+ int num = _index + 1;
+ while (_pass2[num].Token == eToken.eVariable)
+ {
+ if (_pass2[num].Id < 100000)
+ {
+ Error("cannot redeclare a builtin varable", ms_script, _pass2[num]);
+ }
+ GMLToken gMLToken2 = new GMLToken(_pass2[num]);
+ gMLToken2.Token = eToken.eConstant;
+ gMLToken.Children.Add(gMLToken2);
+ num++;
+ GML2JavaScript.ms_globals[gMLToken2.Text] = gMLToken2.Text;
+ if (_pass2[num].Token == eToken.eSepArgument)
+ {
+ num++;
+ }
+ }
+ _pass3.Add(gMLToken);
+ return num;
+ }
+
+ private static int ParseBlock(List _pass3, List _pass2, int _index)
+ {
+ int num = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ while (!ms_error && _pass2[num].Token != eToken.eEOF && _pass2[num].Token != eToken.eEnd)
+ {
+ num = ParseStatement(gMLToken.Children, _pass2, num);
+ }
+ if (_pass2[num].Token != eToken.eEnd)
+ {
+ Error("symbol } expected", ms_script, _pass2[num]);
+ }
+ else
+ {
+ num++;
+ }
+ return num;
+ }
+
+ private static int ParseRepeat(List _pass3, List _pass2, int _index)
+ {
+ int index = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ index = ParseExpression1(gMLToken.Children, _pass2, index);
+ return ParseStatement(gMLToken.Children, _pass2, index);
+ }
+
+ private static int ParseIf(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ int num = ParseExpression1(gMLToken.Children, _pass2, _index + 1);
+ if (_pass2[num].Token == eToken.eThen)
+ {
+ num++;
+ }
+ num = ParseStatement(gMLToken.Children, _pass2, num);
+ if (_pass2[num].Token == eToken.eElse)
+ {
+ num = ParseStatement(gMLToken.Children, _pass2, num + 1);
+ }
+ return num;
+ }
+
+ private static int ParseWhile(List _pass3, List _pass2, int _index)
+ {
+ int index = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ index = ParseExpression1(gMLToken.Children, _pass2, index);
+ if (_pass2[index].Token == eToken.eDo)
+ {
+ index++;
+ }
+ return ParseStatement(gMLToken.Children, _pass2, index);
+ }
+
+ private static int ParseFor(List _pass3, List _pass2, int _index)
+ {
+ int num = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ if (_pass2[num].Token != eToken.eOpen)
+ {
+ Error("symbol ( expected", ms_script, _pass2[num]);
+ }
+ num++;
+ num = ParseStatement(gMLToken.Children, _pass2, num);
+ if (_pass2[num].Token == eToken.eSepStatement)
+ {
+ num++;
+ }
+ num = ParseExpression1(gMLToken.Children, _pass2, num);
+ if (_pass2[num].Token == eToken.eSepStatement)
+ {
+ num++;
+ }
+ num = ParseStatement(gMLToken.Children, _pass2, num);
+ if (_pass2[num].Token != eToken.eClose)
+ {
+ Error("Symbol ) expected", ms_script, _pass2[num]);
+ }
+ num++;
+ return ParseStatement(gMLToken.Children, _pass2, num);
+ }
+
+ private static int ParseDo(List _pass3, List _pass2, int _index)
+ {
+ int index = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ index = ParseStatement(gMLToken.Children, _pass2, index);
+ if (_pass2[index].Token != eToken.eUntil)
+ {
+ Error("keyword Until expected", ms_script, _pass2[index]);
+ }
+ return ParseExpression1(gMLToken.Children, _pass2, index + 1);
+ }
+
+ private static int ParseWith(List _pass3, List _pass2, int _index)
+ {
+ int index = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ index = ParseExpression1(gMLToken.Children, _pass2, index);
+ if (_pass2[index].Token == eToken.eDo)
+ {
+ index++;
+ }
+ return ParseStatement(gMLToken.Children, _pass2, index);
+ }
+
+ private static int ParseSwitch(List _pass3, List _pass2, int _index)
+ {
+ int index = _index + 1;
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ index = ParseExpression1(gMLToken.Children, _pass2, index);
+ if (_pass2[index].Token != eToken.eBegin)
+ {
+ Error("Symbol { expected", ms_script, _pass2[index]);
+ }
+ index++;
+ while (_pass2[index].Token != eToken.eEnd && _pass2[index].Token != eToken.eEOF)
+ {
+ index = ParseStatement(gMLToken.Children, _pass2, index);
+ }
+ if (_pass2[index].Token != eToken.eEnd)
+ {
+ Error("Symbol } expected", ms_script, _pass2[index]);
+ }
+ return index + 1;
+ }
+
+ private static int ParseCase(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ int num = ParseExpression1(gMLToken.Children, _pass2, _index + 1);
+ if (_pass2[num].Token != eToken.eLabel)
+ {
+ Error("Symbol : expected", ms_script, _pass2[num]);
+ }
+ _pass3.Add(gMLToken);
+ return num + 1;
+ }
+
+ private static int ParseDefault(List _pass3, List _pass2, int _index)
+ {
+ int num = _index + 1;
+ GMLToken item = new GMLToken(_pass2[_index]);
+ if (_pass2[num].Token != eToken.eLabel)
+ {
+ Error("Symbol : expected", ms_script, _pass2[num]);
+ }
+ _pass3.Add(item);
+ return num + 1;
+ }
+
+ private static int ParseReturn(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eReturn, _pass2[_index], 0);
+ int index = _index + 1;
+ index = ParseExpression1(gMLToken.Children, _pass2, index);
+ _pass3.Add(gMLToken);
+ return index;
+ }
+
+ private static int ParseFunction(List _pass3, List _pass2, int _index)
+ {
+ if (_pass2[_index].Token != eToken.eFunction)
+ {
+ Error("Function name expected", ms_script, _pass2[_index]);
+ }
+ GMLToken gMLToken = new GMLToken(_pass2[_index]);
+ _pass3.Add(gMLToken);
+ int num = _index + 1;
+ if (_pass2[num].Token != eToken.eOpen)
+ {
+ Error("Symbol ( expected", ms_script, _pass2[num]);
+ }
+ num++;
+ while (!ms_error && _pass2[num].Token != eToken.eEOF && _pass2[num].Token != eToken.eClose)
+ {
+ num = ParseExpression1(gMLToken.Children, _pass2, num);
+ if (_pass2[num].Token == eToken.eSepArgument)
+ {
+ num++;
+ }
+ else if (_pass2[num].Token != eToken.eClose)
+ {
+ Error("Symbol , or ) expected", ms_script, _pass2[num]);
+ }
+ }
+ if (_pass2[num].Token != eToken.eClose)
+ {
+ Error("Symbol ) expected", ms_script, _pass2[num]);
+ }
+ else
+ {
+ num++;
+ }
+ return num;
+ }
+
+ private static int ParseAssignment(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eAssign, _pass2[_index], 0);
+ _pass3.Add(gMLToken);
+ int num = ParseVariable2(gMLToken.Children, _pass2, _index);
+ switch (_pass2[num].Token)
+ {
+ case eToken.eAssign:
+ case eToken.eAssignPlus:
+ case eToken.eAssignMinus:
+ case eToken.eAssignTimes:
+ case eToken.eAssignDivide:
+ case eToken.eAssignOr:
+ case eToken.eAssignAnd:
+ case eToken.eAssignXor:
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseExpression1(gMLToken.Children, _pass2, num + 1);
+ break;
+ default:
+ Error("Assignment operator expected", ms_script, _pass2[num]);
+ break;
+ }
+ return num;
+ }
+
+ private static int ParseExpression1(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eBinary, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value);
+ int num = ParseExpression2(gMLToken.Children, _pass2, _index);
+ if (!ms_error)
+ {
+ bool flag = true;
+ while (_pass2[num].Token == eToken.eAnd || _pass2[num].Token == eToken.eOr || _pass2[num].Token == eToken.eXor)
+ {
+ flag = false;
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseExpression2(gMLToken.Children, _pass2, num + 1);
+ }
+ if (flag)
+ {
+ _pass3.AddRange(gMLToken.Children);
+ }
+ else
+ {
+ _pass3.Add(gMLToken);
+ }
+ }
+ return num;
+ }
+
+ private static int ParseExpression2(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eBinary, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value);
+ int num = ParseExpression3(gMLToken.Children, _pass2, _index);
+ if (!ms_error)
+ {
+ bool flag = true;
+ while (_pass2[num].Token == eToken.eLess || _pass2[num].Token == eToken.eLessEqual || _pass2[num].Token == eToken.eEqual || _pass2[num].Token == eToken.eNotEqual || _pass2[num].Token == eToken.eAssign || _pass2[num].Token == eToken.eGreater || _pass2[num].Token == eToken.eGreaterEqual)
+ {
+ flag = false;
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseExpression3(gMLToken.Children, _pass2, num + 1);
+ }
+ if (flag)
+ {
+ _pass3.AddRange(gMLToken.Children);
+ }
+ else
+ {
+ _pass3.Add(gMLToken);
+ }
+ }
+ return num;
+ }
+
+ private static int ParseExpression3(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eBinary, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value);
+ int num = ParseExpression4(gMLToken.Children, _pass2, _index);
+ if (!ms_error)
+ {
+ bool flag = true;
+ while (_pass2[num].Token == eToken.eBitOr || _pass2[num].Token == eToken.eBitAnd || _pass2[num].Token == eToken.eBitXor)
+ {
+ flag = false;
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseExpression4(gMLToken.Children, _pass2, num + 1);
+ }
+ if (flag)
+ {
+ _pass3.AddRange(gMLToken.Children);
+ }
+ else
+ {
+ _pass3.Add(gMLToken);
+ }
+ }
+ return num;
+ }
+
+ private static int ParseExpression4(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eBinary, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value);
+ int num = ParseExpression5(gMLToken.Children, _pass2, _index);
+ if (!ms_error)
+ {
+ bool flag = true;
+ while (_pass2[num].Token == eToken.eBitShiftLeft || _pass2[num].Token == eToken.eBitShiftRight)
+ {
+ flag = false;
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseExpression5(gMLToken.Children, _pass2, num + 1);
+ }
+ if (flag)
+ {
+ _pass3.AddRange(gMLToken.Children);
+ }
+ else
+ {
+ _pass3.Add(gMLToken);
+ }
+ }
+ return num;
+ }
+
+ private static int ParseExpression5(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eBinary, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value);
+ int num = ParseExpression6(gMLToken.Children, _pass2, _index);
+ if (!ms_error)
+ {
+ bool flag = true;
+ while (_pass2[num].Token == eToken.ePlus || _pass2[num].Token == eToken.eMinus)
+ {
+ flag = false;
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseExpression6(gMLToken.Children, _pass2, num + 1);
+ }
+ if (flag)
+ {
+ _pass3.AddRange(gMLToken.Children);
+ }
+ else
+ {
+ _pass3.Add(gMLToken);
+ }
+ }
+ return num;
+ }
+
+ private static int ParseExpression6(List _pass3, List _pass2, int _index)
+ {
+ GMLToken gMLToken = new GMLToken(eToken.eBinary, _pass2[_index], _pass2[_index].Id, _pass2[_index].Value);
+ int num = ParseVariable2(gMLToken.Children, _pass2, _index);
+ if (!ms_error)
+ {
+ bool flag = true;
+ while (_pass2[num].Token == eToken.eTime || _pass2[num].Token == eToken.eDivide || _pass2[num].Token == eToken.eDiv || _pass2[num].Token == eToken.eMod)
+ {
+ flag = false;
+ gMLToken.Children.Add(_pass2[num]);
+ num = ParseVariable2(gMLToken.Children, _pass2, num + 1);
+ }
+ if (flag)
+ {
+ _pass3.AddRange(gMLToken.Children);
+ }
+ else
+ {
+ _pass3.Add(gMLToken);
+ }
+ }
+ return num;
+ }
+
+ private static int ParseVariable2(List