Exemple #1
0
        private void LoadBannerLang(int lIdx)
        {
            int pos;

            byte[] bb;

            if (bnr == null)
            {
                return;
            }

            bannerLoaded = false;

            pos          = 0x1820 + (lIdx * 0x140);
            bnr.Position = pos;

            bb = bnrr.ReadBytes(0x20);
            tbBDShortName.Text = SIOExtensions.ToStringC(bannerEnc.GetChars(bb));
            bb = bnrr.ReadBytes(0x20);
            tbBDShortMaker.Text = SIOExtensions.ToStringC(bannerEnc.GetChars(bb));
            bb = bnrr.ReadBytes(0x40);
            tbBDLongName.Text = SIOExtensions.ToStringC(bannerEnc.GetChars(bb));
            bb = bnrr.ReadBytes(0x40);
            tbBDLongMaker.Text = SIOExtensions.ToStringC(bannerEnc.GetChars(bb));
            bb = bnrr.ReadBytes(0x80);
            tbBDDescription.Text = SIOExtensions.ToStringC(bannerEnc.GetChars(bb));

            tbBDShortName.Enabled   = true;
            tbBDShortMaker.Enabled  = true;
            tbBDLongName.Enabled    = true;
            tbBDLongMaker.Enabled   = true;
            tbBDDescription.Enabled = true;
            bannerLoaded            = true;
        }
Exemple #2
0
        private void LoadISOInfo(bool image)
        {
            sio.FileStream   fs;
            sio.BinaryReader br;
            string           loadPath;
            byte             b;

            byte[] bb;

            loadPath = (image) ? imgPath : toc.fils[2].path;

            fs = new sio.FileStream(loadPath, sio.FileMode.Open, sio.FileAccess.Read, sio.FileShare.Read);
            br = new sio.BinaryReader(fs, ste.Default);

            bb = br.ReadBytes(4);
            tbIDGameCode.Text = SIOExtensions.ToStringC(ste.Default.GetChars(bb));
            switch (Convert.ToString(ste.Default.GetChars(new byte[] { bb[3] })[0]).ToLower())
            {
            case "e":
                tbIDRegion.Text = "USA/NTSC";
                region          = 'u';
                break;

            case "j":
                tbIDRegion.Text = "JAP/NTSC";
                region          = 'j';
                break;

            case "p":
                tbIDRegion.Text = "EUR/PAL";
                region          = 'e';
                break;

            default:
                tbIDRegion.Text = "UNK";
                region          = 'n';
                break;
            }
            bb = br.ReadBytes(2);
            tbIDMakerCode.Text = SIOExtensions.ToStringC(ste.Default.GetChars(bb));
            b = br.ReadByte();
            tbIDDiscID.Text = string.Format("0x{0:x2}", b);
            fs.Position    += 0x19;
            tbIDName.Text   = br.ReadStringNT();

            br.Close();
            fs.Close();

            loadPath = (image) ? imgPath : toc.fils[3].path;

            fs = new sio.FileStream(loadPath, sio.FileMode.Open, sio.FileAccess.Read, sio.FileShare.Read);
            br = new sio.BinaryReader(fs, ste.Default);
            if (image)
            {
                fs.Position = toc.fils[3].pos;
            }

            tbIDDate.Text = br.ReadStringNT();

            br.Close();
            fs.Close();

            tbIDName.Enabled      = true;
            tbIDDiscID.Enabled    = true;
            tbIDGameCode.Enabled  = true;
            tbIDRegion.Enabled    = true;
            tbIDMakerCode.Enabled = true;
            tbIDDate.Enabled      = true;
        }
Exemple #3
0
        private void LoadBannerInfo(int fIdx, bool image)
        {
            sio.FileStream   fs;
            sio.BinaryReader br;
            sio.FileInfo     fi;
            string           loadPath;
            string           tag;

            byte[] bb    = new byte[4];
            bool   error = false;

            tag  = (string)cbBDFile.Tag;
            fIdx = tag.IndexOf(string.Format("x{0:d2}", fIdx));
            if (fIdx == -1)
            {
                MessageBox.Show("Banner index not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            fIdx = Convert.ToInt32(tag.Substring(fIdx + 3, 6));
            if (!image)
            {
                fi = new sio.FileInfo(toc.fils[fIdx].path);
                if (!fi.Exists)
                {
                    MessageBox.Show(string.Format("Banner '{0}' not found", toc.fils[fIdx].path), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (bnr != null)
            {
                bnrr.Close();
                bnrw.Close();
                bnr.Close();
            }

            loadPath = (image) ? imgPath : toc.fils[fIdx].path;

            fs = new sio.FileStream(loadPath, sio.FileMode.Open, sio.FileAccess.Read, sio.FileShare.Read);
            br = new sio.BinaryReader(fs, ste.Default);
            if (image)
            {
                if (fs.Length < toc.fils[fIdx].pos + toc.fils[fIdx].len)
                {
                    MessageBox.Show(string.Format("Banner '{0}' not found", toc.fils[fIdx].path), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (image)
            {
                fs.Position = toc.fils[fIdx].pos;
            }
            bnr  = new sio.MemoryStream(br.ReadBytes(toc.fils[fIdx].len));
            bnrr = new sio.BinaryReader(bnr, ste.Default);
            bnrw = new sio.BinaryWriter(bnr, ste.Default);
            br.Close();
            fs.Close();

            bnr.Read(bb, 0, 4);
            tbBDVersion.Text = SIOExtensions.ToStringC(ste.Default.GetChars(bb));
            if (tbBDVersion.Text.Length < 3)
            {
                error = true;
            }
            if (!error)
            {
                if (tbBDVersion.Text.ToLower().Substring(0, 3) != "bnr")
                {
                    error = true;
                }
            }
            if (error)
            {
                bannerLoaded            = false;
                cbBDLanguage.Enabled    = false;
                tbBDVersion.Text        = "";
                tbBDVersion.Enabled     = false;
                tbBDShortName.Text      = "";
                tbBDShortName.Enabled   = false;
                tbBDShortMaker.Text     = "";
                tbBDShortMaker.Enabled  = false;
                tbBDLongName.Text       = "";
                tbBDLongName.Enabled    = false;
                tbBDLongMaker.Text      = "";
                tbBDLongMaker.Enabled   = false;
                tbBDDescription.Text    = "";
                tbBDDescription.Enabled = false;

                btnBDImport.Enabled = false;
                btnBDExport.Enabled = false;
                btnBDSave.Enabled   = false;

                img = null;
                pbBDBanner.Invalidate();

                MessageBox.Show("This is not banner file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            tbBDVersion.Enabled = true;

            if (region == 'j')
            {
                bannerEnc = ste.GetEncoding(932);
            }
            else
            {
                bannerEnc = ste.GetEncoding(1252);
            }

            if (cbBDLanguage.Items.IndexOf("Japan") == 0)
            {
                cbBDLanguage.Items.RemoveAt(0);
            }

            if (region == 'j')
            {
                cbBDLanguage.Items.Insert(0, "Japan");
            }

            if (bb[3] == 0x32)
            {
                if (cbBDLanguage.Items.IndexOf("Japan") == 0)
                {
                    cbBDLanguage.Items.RemoveAt(0);
                }
                bannerEnc            = ste.GetEncoding(1252);
                cbBDLanguage.Enabled = true;
            }
            else
            {
                cbBDLanguage.Enabled = false;
                LoadBannerLang(0);
            }

            if (cbBDLanguage.SelectedIndex == 0)
            {
                LoadBannerLang(0);
            }
            else
            {
                cbBDLanguage.SelectedIndex = 0;
            }

            LoadBannerImage();
        }