Beispiel #1
0
 internal indoor_telepathy()
 {
     dataAddress = AddressLoROM.SnesToPc(
         ROM.DATA[POINTER_LOCATION + 0],
         ROM.DATA[POINTER_LOCATION + 1],
         AddressLoROM.PcToSnes_Bank(POINTER_LOCATION));
 }
Beispiel #2
0
 public static int LongRead_LoHiBank(int loAddress, int hiAddress, int bankAddress)
 {
     return(AddressLoROM.SnesToPc(
                ROM.DATA[loAddress],
                ROM.DATA[hiAddress],
                ROM.DATA[bankAddress]));
 }
Beispiel #3
0
 private void updatePointer(byte[] rawData, ref int[] pointer, int length, int start = 0)
 {
     for (int i = 0, j = 0; (i < length - 1) && (j < rawData.Length - 1); i += 1, j += 3)
     {
         pointer[i + start] = AddressLoROM.SnesToPc((rawData[j]), (rawData[j + 1]), (rawData[j + 2]));
     }
 }
Beispiel #4
0
 public static int ShortRead_LoHi(int address)
 {
     return(AddressLoROM.SnesToPc
            (
                ROM.DATA[address],
                ROM.DATA[address + 1],
                AddressLoROM.PcToSnes_Bank(address)
            ));
 }
Beispiel #5
0
    private void readPointer()
    {
        if (ROM.Read(primaryPointer + bankOffset1) != ROM.Read(primaryPointer + bankOffset2))
        {
            throw new Exception();
        }

        secondaryPointer = PointerRead.LongRead_LoHiBank(primaryPointer);
        secondaryPointer = PointerRead.LongRead_LoHiBank(primaryPointer, primaryPointer + 1, pointer_bank);

        roomHeaderPointers = new int[numberOfHeaders];
        for (int i = 0; i < numberOfHeaders; i++)
        {
            int temp = secondaryPointer + i * 2;
            roomHeaderPointers[i] = AddressLoROM.SnesToPc(
                ROM.Read(temp + 0),
                ROM.Read(temp + 1),
                AddressLoROM.PcToSnes_Bank(secondaryPointer));

            roomHeaders[i] = new i_roomHeader(ROM.Read(roomHeaderPointers[i], sizeOfEachHeader));
        }
    }
Beispiel #6
0
        /// <summary>
        /// Load a project
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog of = new OpenFileDialog();

            of.Filter = "ZScream Project (*.zscr)|*.zscr";
            if (of.ShowDialog() == DialogResult.OK)
            {
                loadedProject = Path.GetDirectoryName(of.FileName);
                configs       = JsonConvert.DeserializeObject <string[]>(File.ReadAllText(loadedProject + "//Project.zscr"));
                emulatorPath  = configs[0];
                JsonData data = new JsonData(Path.GetDirectoryName(of.FileName));
                overworldForm.setData(data);
                overworldForm.Enabled = true;
                allScriptsFiles       = Directory.EnumerateFiles(loadedProject + "\\ASM").ToArray();
                foreach (string script in allScriptsFiles)
                {
                    string f = Path.GetFileName(script);
                    if (f == "Main.asm")
                    {
                        string[] usedFiles = File.ReadAllLines(script);
                        foreach (string s in usedFiles)
                        {
                            if (s.Contains("incsrc"))
                            {
                                scriptsActive.Add(s.Remove(0, 7));
                            }
                        }
                        continue;
                    }
                    if (f != "Readme.txt")
                    {
                        scriptsDetected.Add(f);
                    }
                }
            }
            else
            {
                return;
            }

            foreach (string s in scriptsDetected)
            {
                //Create information of each scripts
                StringBuilder information  = new StringBuilder();
                bool          description  = false;
                string[]      asmfileLines = File.ReadAllLines(loadedProject + "\\ASM\\" + s);
                Console.WriteLine("Lines : " + asmfileLines.Length);
                int id = 0;
                foreach (string line in asmfileLines)
                {
                    if (line.Contains(";#="))
                    {
                        description = !description;
                        continue;
                    }
                    if (description == true)
                    {
                        information.AppendLine(line);
                    }
                    else
                    {
                        if (line.Length > 0)
                        {
                            if (line[0] != ';') //if line is a comment
                            {
                                if (line.Contains("org $"))
                                {
                                    string addr    = line.Substring(line.IndexOf('$') + 1, 6);
                                    string comment = "";
                                    if (addr.Contains(";")) //address is shorter than 6
                                    {
                                        addr = line.Substring(line.IndexOf('$') + 1, line.IndexOf(';') - line.IndexOf('$'));;
                                    }
                                    if (line.Contains(";"))
                                    {
                                        comment = line.Substring(line.IndexOf(';'), line.Length - line.IndexOf(';'));
                                    }
                                    int snesAddr = ParseHexString(addr);
                                    int pcAddr   = AddressLoROM.SnesToPc(snesAddr);
                                    information.AppendLine("SNES:" + snesAddr.ToString("X6") + " PC:" + pcAddr.ToString("X6") + " ;" + comment);
                                }
                            }
                        }
                    }
                }

                scriptsInformation.Add(information.ToString());

                //add the script in the script list
                ToolStripItem item = scriptsToolStripMenuItem.DropDownItems.Add(s);
                if (scriptsActive.Contains(s))
                {
                    //check the script if it active
                    (item as ToolStripMenuItem).Checked      = true;
                    (item as ToolStripMenuItem).CheckOnClick = true;
                }
                if (item.Text == "EditorCore.asm")
                {
                    (item as ToolStripMenuItem).CheckOnClick = false;
                }

                ToolStripItem itemInfo = scriptsToolStripMenuItem.DropDownItems.Add("Information");
                itemInfo.Tag    = id;
                itemInfo.Click += ItemInfo_Click;
                (item as ToolStripMenuItem).DropDownItems.Add(itemInfo);

                //add an information tab with tag value

                id++;
            }
            Console.WriteLine(scriptsInformation[0]);
        }