Пример #1
0
 private void M_state_LoadFileFinished(object sender, EventArgs e)
 {
     m_scn        = m_state.SCN;
     this.Visible = true;
     if ((m_Mode == WizLongEditMode.Rip) || (m_Mode == WizLongEditMode.Mark))
     {
         if ((m_scn == WIZSCN.FC1) || (m_scn == WIZSCN.FC2) || (m_scn == WIZSCN.FC3))
         {
             if (DesignMode == false)
             {
                 this.Visible = false;
             }
         }
         else if (m_Mode == WizLongEditMode.Rip)
         {
             if ((m_scn == WIZSCN.GBC1) || (m_scn == WIZSCN.GBC2) || (m_scn == WIZSCN.GBC3))
             {
                 m_MaxValue = 0xFF; //255
                 m_NumKeta  = 3;
             }
             else
             {
                 m_MaxValue = 0xFFFF; //65535
                 m_NumKeta  = 5;
             }
         }
     }
     if (this.Visible == true)
     {
         GetInfo();
         this.Invalidate();
     }
 }
Пример #2
0
        static public byte [] StringToCode(WIZSCN scn, string str)
        {
            if (str == "")
            {
                return(new byte[0]);
            }
            byte[] ret = new byte[str.Length];

            for (int i = 0; i < str.Length; i++)
            {
                ret[i] = StringToCode(scn, str[i]);
            }
            return(ret);
        }
Пример #3
0
        public bool EditShowDialog(WizData state)
        {
            bool ret = false;

            if (state == null)
            {
                return(ret);
            }

            this.Spell = state.CharSpell;
            this.SCN   = state.SCN;

            return(this.ShowDialog() == DialogResult.OK);
        }
Пример #4
0
        static public string CodeToString(WIZSCN scn, byte [] values)
        {
            string ret = "";

            if (scn == WIZSCN.NO)
            {
                return(ret);
            }
            if (values.Length <= 0)
            {
                return(ret);
            }
            for (int i = 0; i < values.Length; i++)
            {
                ret += CodeToString(scn, values[i]);
            }
            return(ret);
        }
Пример #5
0
 // ******************************************************************************
 private void ChkEnabled()
 {
     if (m_WizData == null)
     {
         return;
     }
     m_scn = m_WizData.SCN;
     if ((m_WizData.SCN == WIZSCN.SFC1) || (m_WizData.SCN == WIZSCN.SFC2) || (m_WizData.SCN == WIZSCN.SFC3))
     {
         this.Visible = true;
     }
     else
     {
         if (DesignMode == false)
         {
             this.Visible = false;
         }
     }
     this.Invalidate();
 }
Пример #6
0
        static public string CodeToString(WIZSCN scn, byte value)
        {
            string ret = "";

            if (scn == WIZSCN.NO)
            {
                return(ret);
            }
            if ((value >= 0) && (value <= 0xFF))
            {
                switch (scn)
                {
                case WIZSCN.FC1:
                    ret = Wiz1FCStrings[(int)value];
                    break;

                case WIZSCN.FC2:
                case WIZSCN.FC3:
                    ret = Wiz2FCStrings[(int)value];
                    break;

                case WIZSCN.SFC1:
                case WIZSCN.SFC2:
                case WIZSCN.SFC3:
                case WIZSCN.SFC5:
                    ret = WizSFCStrings[(int)value];
                    break;

                case WIZSCN.GBC1:
                case WIZSCN.GBC2:
                case WIZSCN.GBC3:
                    ret = WizGBCStrings[(int)value];
                    break;
                }
            }
            return(ret);
        }
Пример #7
0
        // ******************************************************************************
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            if (e.X < XArea1)
            {
                m_scn = WIZSCN.SFC1;
            }
            else if (e.X < XArea2)
            {
                m_scn = WIZSCN.SFC2;
            }
            else
            {
                m_scn = WIZSCN.SFC3;
            }

            if (m_WizData != null)
            {
                m_WizData.SetSFC_SCN(m_scn);
            }

            this.Invalidate();
        }
Пример #8
0
        static public byte StringToCode(WIZSCN scn, char c)
        {
            int    idx = -1;
            string s   = c.ToString();

            switch (scn)
            {
            case WIZSCN.FC1:
                if (s != "")
                {
                    for (int i = Wiz1FCStringStart; i < Wiz1FCStringSize; i++)
                    {
                        if (Wiz1FCStrings[i] == s)
                        {
                            idx = i;
                            break;
                        }
                    }
                }
                if (idx <= -1)
                {
                    idx = 0x2E;
                }
                break;

            case WIZSCN.FC2:
            case WIZSCN.FC3:
                if (s != "")
                {
                    for (int i = Wiz2FCStringStart; i < Wiz2FCStringSize; i++)
                    {
                        if (Wiz2FCStrings[i] == s)
                        {
                            idx = i;
                            break;
                        }
                    }
                }
                if (idx <= -1)
                {
                    idx = 0x2F;
                }
                break;

            case WIZSCN.SFC1:
            case WIZSCN.SFC2:
            case WIZSCN.SFC3:
            case WIZSCN.SFC5:
                if (s != "")
                {
                    for (int i = WizSFCStringStart; i < WizSFCStringSize; i++)
                    {
                        if (WizSFCStrings[i] == s)
                        {
                            idx = i;
                            break;
                        }
                    }
                }
                if (idx <= -1)
                {
                    idx = 0x3F;
                }
                break;

            case WIZSCN.GBC1:
            case WIZSCN.GBC2:
            case WIZSCN.GBC3:
                if (s != "")
                {
                    for (int i = WizGBCStringStart; i < WizGBCStringSize; i++)
                    {
                        if (WizGBCStrings[i] == s)
                        {
                            idx = i;
                            break;
                        }
                    }
                }
                if (idx <= -1)
                {
                    idx = 0x3F;
                }
                break;
            }
            return((byte)idx);
        }
Пример #9
0
 private void M_state_ValueChanged(object sender, EventArgs e)
 {
     m_scn = m_state.SCN;
     GetInfo();
     this.Invalidate();
 }
Пример #10
0
 private void M_state_CurrentCharChanged(object sender, CurrentCharEventArgs e)
 {
     m_scn = m_state.SCN;
     GetInfo();
     this.Invalidate();
 }
Пример #11
0
        // **********************************************************************
        static public byte [] SpellBaseCount(WIZSCN scn)
        {
            byte[] ret = new byte[14];
            for (int i = 0; i < 14; i++)
            {
                ret[i] = 0;
            }

            string[][] m = null;
            string[][] p = null;

            switch (scn)
            {
            case WIZSCN.FC1:
                m = Wiz1FCSpellM;
                p = Wiz1FCSpellP;
                break;

            case WIZSCN.FC2:
                m = Wiz2FCSpellM;
                p = Wiz2FCSpellP;
                break;

            case WIZSCN.FC3:
                m = Wiz3FCSpellM;
                p = Wiz3FCSpellP;
                break;

            case WIZSCN.SFC1:
            case WIZSCN.SFC2:
                m = Wiz1SFCSpellM;
                p = Wiz1SFCSpellP;
                break;

            case WIZSCN.SFC3:
                m = Wiz3SFCSpellM;
                p = Wiz3SFCSpellP;
                break;

            case WIZSCN.SFC5:
                m = Wiz5SFCSpellM;
                p = Wiz5SFCSpellP;
                break;

            case WIZSCN.GBC1:
            case WIZSCN.GBC2:
            case WIZSCN.GBC3:
                m = WizGBCSpellM;
                p = WizGBCSpellP;
                break;
            }

            for (int i = 0; i < 7; i++)
            {
                int v = m[i].Length & 0xF;
                ret[i]     = (byte)(v);
                v          = p[i].Length & 0xF;
                ret[i + 7] = (byte)(v);
            }
            return(ret);
        }
Пример #12
0
        // *******************************************************************************************
        private bool ChkData()
        {
            bool ret = false;

            m_OffserAdr  = 0;
            m_OffserAdr2 = 0;
            m_OffserAdr3 = 0;
            m_WizFile    = WIZFILE.SAVE;
            m_scn        = WIZSCN.NO;

            //ファイルの先頭で判別できるものを最初に
            // FC ROM
            if ((m_Data.Length >= 0x40010) && (m_Data[0] == 0x4E) && (m_Data[1] == 0x45) && (m_Data[2] == 0x43)) //NES
            {
                //文字列を探す
                int idx = FindString("WIZARDRY(KOD)", 0);
                if (idx > 0)
                {
                    m_WizFile   = WIZFILE.ROM;
                    m_scn       = WIZSCN.FC3;
                    m_OffserAdr = 0x97A6;
                }
                else
                {
                    idx = FindString("WIZARDRY(LOL)", 0);
                    if (idx > 0)
                    {
                        m_WizFile   = WIZFILE.ROM;
                        m_scn       = WIZSCN.FC2;
                        m_OffserAdr = 0x97C8;
                    }
                    else
                    {
                        idx = FindString("WIZARDRY(PG)", 0);
                        if (idx > 0)
                        {
                            m_WizFile   = WIZFILE.ROM;
                            m_scn       = WIZSCN.FC1;
                            m_OffserAdr = 0x17310;
                        }
                    }
                }
            }
            // SFC STATE
            else if ((m_Data[0] == 0x23) && (m_Data[1] == 0x21) && (m_Data[2] == 0x73) && (m_Data[3] == 0x39) && (m_Data[3] == 0x78)) //#!s9x
            {
                //00 01 02 03 04 05 06 07 08 09 10
                //52 41 4D 3A 31 33 31 30 37 32 3A
                //R  A  M  :  1  3  1  0  7  2  :
                byte[] ramHeader = new byte[] { 0x52, 0x41, 0x4D, 0x3A, 0x31, 0x33, 0x31, 0x30, 0x37, 0x32, 0x3A };
                int    idx       = FindCode(ramHeader, 0);
                if (idx < 0)
                {
                    return(ret);
                }
                int adr = idx + ramHeader.Length;
                //sfc wiz123 state
                idx = FindString("1999 / 02 / 19 Gung Ho!Presents", 0); //sfc wiz123
                if (idx > 0)
                {
                    int sc = 0;
                    sc = m_Data[adr + 0x295]; //キャラデータの位置
                    if (sc == 0)
                    {
                        sc = m_Data[adr + 0x295 + 0x6E];
                    }
                    switch (sc)
                    {
                    case 1:
                        m_scn = WIZSCN.SFC1;
                        break;

                    case 3:
                        m_scn = WIZSCN.SFC2;
                        break;

                    case 2:
                        m_scn = WIZSCN.SFC3;
                        break;

                    default:
                        return(ret);
                    }
                    m_OffserAdr  = adr + 0x295;
                    m_OffserAdr2 = adr + 0x127F;
                    m_WizFile    = WIZFILE.STATE;
                }
                //sfc wiz5 state
                else if (idx < 0)
                {
                    idx = FindString("04 / 22 / 92 Kei Cross Presents", 0); // sfc wiz5
                    if (idx >= 0)
                    {
                        m_WizFile   = WIZFILE.STATE;
                        m_scn       = WIZSCN.SFC5;
                        m_OffserAdr = adr + 0x100;
                    }
                }
            }
            // FC nnnester State 53 4E 53 53 SNSS
            else if ((m_Data[0] == 0x53) && (m_Data[1] == 0x4E) && (m_Data[2] == 0x53) && (m_Data[3] == 0x53))
            {
                int idx = FindString("SRAM", 0);
                if (idx < 0)
                {
                    return(ret);
                }
                if (FindString("Wizardry-Proving Grounds", 0) > 0)
                {
                    m_scn       = WIZSCN.FC1;
                    m_WizFile   = WIZFILE.STATE;
                    m_OffserAdr = idx + 4 + 0x0009;
                }
                else if (FindString("Wizardry-Legacy of Llylgamyn", 0) > 0)
                {
                    m_scn       = WIZSCN.FC2;
                    m_WizFile   = WIZFILE.STATE;
                    m_OffserAdr = idx + 4 + 0x0409;
                }
                else if (FindString("GAME STUDIO Inc.", 0) > 0)
                {
                    m_scn       = WIZSCN.FC3;
                    m_WizFile   = WIZFILE.STATE;
                    m_OffserAdr = idx + 4 + 0x0409;
                }
            }
            // John gbc 47 62 53 73 GbSs
            else if ((m_Data[0] == 0x47) && (m_Data[1] == 0x62) && (m_Data[2] == 0x53) && (m_Data[3] == 0x73))
            {
                int idx = m_Data[0x0D02B];
                if (idx <= 0)
                {
                    idx = m_Data[0x0D02C + 0x6B];
                }
                if (idx <= 0)
                {
                    idx = m_Data[0x0D02C + 0x6B * 2];
                }
                switch (idx)
                {
                case 1:
                    m_scn       = WIZSCN.GBC1;
                    m_WizFile   = WIZFILE.STATE;
                    m_OffserAdr = 0x0D02B;
                    break;

                case 3:
                    m_scn       = WIZSCN.GBC2;
                    m_WizFile   = WIZFILE.STATE;
                    m_OffserAdr = 0x0D02B;
                    break;

                case 2:
                    m_scn       = WIZSCN.GBC3;
                    m_WizFile   = WIZFILE.STATE;
                    m_OffserAdr = 0x0D02B;
                    break;
                }
            }
            // Wiz123 sfc rom 容量から識別
            else if (m_Data.Length >= 0x400000)
            {
                int idx = FindString("WIZARDRY 1 2 3", 0);
                if (idx >= 0)
                {
                    m_scn        = WIZSCN.SFC1;
                    m_WizFile    = WIZFILE.ROM;
                    m_OffserAdr  = 0x28436;
                    m_OffserAdr2 = 0x286CB;
                    m_OffserAdr3 = 0x28960;
                }
            }
            // GBC rom か Wiz5 rom
            else if (m_Data.Length >= 0x100000)
            {
                if (FindString("WIZARDRY1", 0) >= 0)
                {
                    m_scn       = WIZSCN.GBC1;
                    m_WizFile   = WIZFILE.ROM;
                    m_OffserAdr = 0x14001;
                }
                else if (FindString("WIZARDRY2", 0) >= 0)
                {
                    m_scn       = WIZSCN.GBC2;
                    m_WizFile   = WIZFILE.ROM;
                    m_OffserAdr = 0x14001;
                }
                else if (FindString("WIZARDRY3", 0) >= 0)
                {
                    m_scn       = WIZSCN.GBC2;
                    m_WizFile   = WIZFILE.ROM;
                    m_OffserAdr = 0x14001;
                }
                else if (FindString("WIZARDRY V", 0) >= 0)
                {
                    m_scn       = WIZSCN.SFC5;
                    m_WizFile   = WIZFILE.ROM;
                    m_OffserAdr = 0x3D47;
                }
            }
            // GBC sv or SFC Wiz123 sav
            else if (m_Data.Length >= 0x8000)
            {
                //gbc sav
                //47 75 6E 67 48 6F 21 21 21
                //G  u  n  g  H  o  !  !  !
                if ((m_Data[0] == 0x47) && (m_Data[1] == 0x75) && (m_Data[2] == 0x6E) && (m_Data[3] == 0x67) && (m_Data[4] == 0x48) && (m_Data[5] == 0x6F))
                {
                    int sc = m_Data[0x2B];
                    if (sc == 0)
                    {
                        sc = m_Data[0x99];
                    }
                    switch (sc)
                    {
                    case 1:
                        m_scn        = WIZSCN.GBC1;
                        m_WizFile    = WIZFILE.SAVE;
                        m_OffserAdr  = 0x002B;
                        m_OffserAdr2 = 0x2012;
                        break;

                    case 3:
                        m_scn        = WIZSCN.GBC2;
                        m_WizFile    = WIZFILE.SAVE;
                        m_OffserAdr  = 0x002B;
                        m_OffserAdr2 = 0x2012;
                        break;

                    case 2:
                        m_scn        = WIZSCN.GBC3;
                        m_WizFile    = WIZFILE.SAVE;
                        m_OffserAdr  = 0x002B;
                        m_OffserAdr2 = 0x2012;
                        break;
                    }
                }
                //wiz123 sav
                // 1999/02/19 Gung Ho! Presents
                // 20 31 39 39 39 2F 30 32 2F 31 39 20 47 75 6E 67 20 48 6F 21 20 50 72 65 73 65 6E 74 73
                else if ((m_Data[0] == 0x20) && (m_Data[1] == 0x31) && (m_Data[2] == 0x39) && (m_Data[3] == 0x39) &&
                         (m_Data[0x0C] == 0x47) && (m_Data[0x0D] == 0x75) && (m_Data[0x0E] == 0x6E) && (m_Data[0x0F] == 0x67) && (m_Data[0x10] == 0x20) && (m_Data[0x11] == 0x48))
                {
                    m_scn        = WIZSCN.SFC1;
                    m_WizFile    = WIZFILE.SAVE;
                    m_OffserAdr  = 0x0814;
                    m_OffserAdr2 = 0x1414;
                    m_OffserAdr3 = 0x2014;
                }
            }
            // fc 1iz 123 or wiz5 sav
            else if (m_Data.Length >= 0x2000)
            {
                if (FindString("H.YAJIMAK.CROSS", 0) >= 0)
                {
                    m_WizFile   = WIZFILE.SAVE;
                    m_scn       = WIZSCN.FC1;
                    m_OffserAdr = 0x0000;
                }
                else if (FindString("By Kei Cross08-10-88", 0) >= 0)
                {
                    m_WizFile    = WIZFILE.SAVE;
                    m_scn        = WIZSCN.FC2;
                    m_OffserAdr  = 0x0400;
                    m_OffserAdr2 = 0x1800;
                }
                else if (FindString("Kei Cross06/10/89", 0) >= 0)
                {
                    m_WizFile    = WIZFILE.SAVE;
                    m_scn        = WIZSCN.FC3;
                    m_OffserAdr  = 0x0400;
                    m_OffserAdr2 = 0x1800;
                }
                else if (FindString("04/22/92 Kei Cross Presents", 0) >= 0)
                {
                    m_WizFile   = WIZFILE.SAVE;
                    m_scn       = WIZSCN.SFC5;
                    m_OffserAdr = 0x0000;
                    m_OffserAdr = 0x0A00;
                }
            }
            ret = (m_scn != WIZSCN.NO);
            return(ret);
        }
Пример #13
0
 public WizItem(WIZSCN scn = WIZSCN.FC1)
 {
     m_scn = scn;
 }