Ejemplo n.º 1
0
        private static void SaveIco(BitmapImage pImage, RomInformation pRomInfo, bool pLargeIco)
        {
            if (pImage == null)
            {
                return;
            }

            FileInfo fi;

            if (pLargeIco)
            {
                fi = new FileInfo(Path.Combine(BQDirectory.IcoLargeDir, pRomInfo.BasicInfo.SubSerial + ".jpg"));
            }
            else
            {
                fi = new FileInfo(Path.Combine(BQDirectory.IcoSmallDir, pRomInfo.BasicInfo.SubSerial + ".jpg"));
            }


            if (fi.Exists)
            {
                return;
            }

            BitmapEncoder encoder = new PngBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(pImage));

            using (var fileStream = new FileStream(fi.FullName, System.IO.FileMode.Create))
            {
                encoder.Save(fileStream);
            }
        }
Ejemplo n.º 2
0
        public static RomInformation GetGameInfo(string pSerial)
        {
            SQLiteConnection lDBConnection = new SQLiteConnection("data source=" + _DBFileFullName);

            lDBConnection.Open();

            SQLiteCommand cmd = new SQLiteCommand();

            cmd.Connection  = lDBConnection;
            cmd.CommandText = "SELECT * FROM " + _TableName + " WHERE serial='" + pSerial + "'";

            SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);

            DataTable ds = new DataTable();

            da.Fill(ds);
            da.Dispose();
            cmd.Dispose();

            lDBConnection.Close();

            if (ds.Rows.Count == 0)
            {
                return(null);
            }

            RomInformation lResult = ConverDataRowToRomInfo(ds.Rows[0]);

            return(lResult);
        }
Ejemplo n.º 3
0
        public static void CopyRomToRomFolder(RomInformation pRomInfo, FileInfo pFile)
        {
            if (CheckRomFileExist(pRomInfo))
            {
                return;
            }
            string lromFolder = Path.Combine(BQDirectory.RomDir, pRomInfo.BasicInfo.Serial);
            string lromfile   = Path.Combine(lromFolder, pRomInfo.BasicInfo.Serial + "." + pRomInfo.ExpandInfo.RomType);

            BQCompression.CompressionFile(pFile, new FileInfo(lromfile));
        }
Ejemplo n.º 4
0
 public void UnloadRom()
 {
     if (externalRomBlock != null)
     {
         SuspendEmulation();
         this.mapper           = null;
         this.externalRomBlock = null;
         this.romInformation   = null;
         this.colorMode        = ColorHardware;
         ClearBreakpoints();
         Reset();                 // Will call “ResumeEmulation”…
     }
 }
Ejemplo n.º 5
0
        public static List <FileInfo> GetRomConvers(RomInformation pRomInfo)
        {
            DirectoryInfo   converDir = new DirectoryInfo(BQDirectory.ConverDir);
            List <FileInfo> fileList  = GetAllRomFile(converDir);

            for (int i = fileList.Count - 1; i >= 0; i--)
            {
                if (fileList[i].Name != pRomInfo.BasicInfo.SubSerial + ".jpg")
                {
                    fileList.RemoveAt(i);
                }
            }

            return(fileList);
        }
Ejemplo n.º 6
0
        public static RomInformation GetRomInfo(RomInformation pRomInfo)
        {
            List <Rom3dsdbInfo> l3dsdbGameInfoList = Parse3dsreleaseXML();
            Rom3dsdbInfo        l3dsdbGameInfo     = l3dsdbGameInfoList.AsParallel().FirstOrDefault(gameinfo => gameinfo.serial == pRomInfo.BasicInfo.Serial);

            if (l3dsdbGameInfo != null)
            {
                RomInformation lresult = Conver3dsdbToRomInfo(l3dsdbGameInfo);
                return(lresult);
            }
            else
            {
                return(new RomInformation());
            }
        }
Ejemplo n.º 7
0
        private static RomInformation Conver3dsdbToRomInfo(Rom3dsdbInfo pRom3dsdbInfo)
        {
            RomInformation lresult = new RomInformation();

            lresult.BasicInfo.Serial        = pRom3dsdbInfo.serial;
            lresult.BasicInfo.Title_ID      = pRom3dsdbInfo.titleid;
            lresult.BasicInfo.English_Title = pRom3dsdbInfo.name;
            lresult.BasicInfo.Publisher     = pRom3dsdbInfo.publisher;
            lresult.BasicInfo.Region        = pRom3dsdbInfo.region;
            lresult.BasicInfo.Languages     = pRom3dsdbInfo.languages;
            lresult.BasicInfo.Developer     = pRom3dsdbInfo.group;
            lresult.BasicInfo.Imagesize     = pRom3dsdbInfo.imagesize;
            lresult.BasicInfo.Firmware      = pRom3dsdbInfo.firmware;
            lresult.BasicInfo.Card_Type     = pRom3dsdbInfo.card;
            return(lresult);
        }
Ejemplo n.º 8
0
        public static void UpdateRomInfoToDB(RomInformation pRomInfo)
        {
            RomInformation lTempRomInformation = BQDB.GetGameInfo(pRomInfo.BasicInfo.Serial);

            if (lTempRomInformation != null)
            {
                if (MergeRomInfo(pRomInfo, lTempRomInformation))
                {
                    BQDB.UpdateGameInfo(pRomInfo.BasicInfo);
                }
            }
            else
            {
                BQDB.InsertRomInfo(pRomInfo.BasicInfo);
            }
        }
Ejemplo n.º 9
0
        RomInformation IRomParser.ParseRom(FileInfo pRomFile)
        {
            if (pRomFile.Extension.ToLower() != ".cia")
            {
                return(new RomInformation());
            }

            RomInformation lRomInfo = new RomInformation();

            lRomInfo.BasicInfo.OriginalName = pRomFile.Name;

            byte[]     tByteContent = null;
            string     tStrContent  = "";
            FileStream tFS;

            try
            {
                tFS = new FileStream(pRomFile.FullName, FileMode.Open);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            // Serial
            tFS.Position = 0X3a90;
            tByteContent = new byte[10];
            tFS.Read(tByteContent, 0, tByteContent.Length);
            lRomInfo.BasicInfo.Serial = Encoding.Default.GetString(tByteContent);

            // Title_ID
            tFS.Position = 0X3a48;
            tByteContent = new byte[8];
            tFS.Read(tByteContent, 0, tByteContent.Length);
            tStrContent = "";
            for (int i = tByteContent.Length - 1; i >= 0; i--)
            {
                tStrContent += tByteContent[i].ToString("X2");
            }

            lRomInfo.BasicInfo.Title_ID = tStrContent;

            tFS.Close();

            return(lRomInfo);
        }
Ejemplo n.º 10
0
        public static List <BitmapImage> GetRomConverPic(RomInformation pRomInfo)
        {
            List <BitmapImage> lRomPicList    = new List <BitmapImage>();
            DirectoryInfo      lDir           = new DirectoryInfo(BQDirectory.ConverDir);
            List <FileInfo>    lAllConverList = new List <FileInfo>();

            lAllConverList = GetAllFiles(lDir);
            foreach (var converFile in lAllConverList)
            {
                if (converFile.Name == pRomInfo.BasicInfo.SubSerial)
                {
                    BitmapImage lRomPic = new BitmapImage(new Uri(converFile.FullName));
                    lRomPicList.Add(lRomPic);
                }
            }

            return(lRomPicList);
        }
Ejemplo n.º 11
0
        public static List <RomInformation> LoadRom(FileInfo pInputFile)
        {
            List <RomInformation> lRomInformationList = new List <RomInformation>();

            List <FileInfo> tRomFiles = null;

            tRomFiles = PreTreatRom(pInputFile);

            foreach (var romFile in tRomFiles)
            {
                RomInformation tRomInfo = ParseRom(romFile);
                if (tRomInfo != null)
                {
                    lRomInformationList.Add(tRomInfo);
                }
            }

            return(lRomInformationList);
        }
Ejemplo n.º 12
0
        private static RomInformation ConverDataRowToRomInfo(DataRow pDBDataRow)
        {
            RomInformation lResult = new RomInformation();

            lResult.BasicInfo.Serial                    = pDBDataRow["Serial"].ToString().Trim();
            lResult.BasicInfo.Capacity                  = pDBDataRow["Capacity"].ToString().Trim();
            lResult.BasicInfo.Region                    = pDBDataRow["Region"].ToString().Trim();
            lResult.BasicInfo.Region_Lockout            = pDBDataRow["Region_Lockout"].ToString().Trim();
            lResult.BasicInfo.Languages                 = pDBDataRow["Languages"].ToString().Trim();
            lResult.BasicInfo.Title_ID                  = pDBDataRow["Title_ID"].ToString().Trim();
            lResult.BasicInfo.Game_Title                = pDBDataRow["Game_Title"].ToString().Trim();
            lResult.BasicInfo.English_Title             = pDBDataRow["English_Title"].ToString().Trim();
            lResult.BasicInfo.Japanese_Title            = pDBDataRow["Japanese_Title"].ToString().Trim();
            lResult.BasicInfo.French_Title              = pDBDataRow["French_Title"].ToString().Trim();
            lResult.BasicInfo.German_Title              = pDBDataRow["German_Title"].ToString().Trim();
            lResult.BasicInfo.Italian_Title             = pDBDataRow["Italian_Title"].ToString().Trim();
            lResult.BasicInfo.Spanish_Title             = pDBDataRow["Spanish_Title"].ToString().Trim();
            lResult.BasicInfo.Simplified_Chinese_Title  = pDBDataRow["Simplified_Chinese_Title"].ToString().Trim();
            lResult.BasicInfo.Korean_Title              = pDBDataRow["Korean_Title"].ToString().Trim();
            lResult.BasicInfo.Dutch_Title               = pDBDataRow["Dutch_Title"].ToString().Trim();
            lResult.BasicInfo.Portuguese_Title          = pDBDataRow["Portuguese_Title"].ToString().Trim();
            lResult.BasicInfo.Russian_Title             = pDBDataRow["Russian_Title"].ToString().Trim();
            lResult.BasicInfo.Traditional_Chinese_Title = pDBDataRow["Traditional_Chinese_Title"].ToString().Trim();
            lResult.BasicInfo.Platform                  = pDBDataRow["Platform"].ToString().Trim();
            lResult.BasicInfo.Card_Type                 = pDBDataRow["Card_Type"].ToString().Trim();
            lResult.BasicInfo.Card_ID                   = pDBDataRow["Card_ID"].ToString().Trim();
            lResult.BasicInfo.Chip_ID                   = pDBDataRow["Chip_ID"].ToString().Trim();
            lResult.BasicInfo.Manufacturer              = pDBDataRow["Manufacturer"].ToString().Trim();
            lResult.BasicInfo.OriginalName              = pDBDataRow["OriginalName"].ToString().Trim();
            lResult.BasicInfo.Developer                 = pDBDataRow["Developer"].ToString().Trim();
            lResult.BasicInfo.Publisher                 = pDBDataRow["Publisher"].ToString().Trim();
            lResult.BasicInfo.ReleaseDate               = pDBDataRow["ReleaseDate"].ToString().Trim();
            lResult.BasicInfo.Genre           = pDBDataRow["Genre"].ToString().Trim();
            lResult.BasicInfo.Rating          = pDBDataRow["Rating"].ToString().Trim();
            lResult.BasicInfo.Players         = pDBDataRow["Players"].ToString().Trim();
            lResult.BasicInfo.Imagesize       = pDBDataRow["Imagesize"].ToString().Trim();
            lResult.BasicInfo.Firmware        = pDBDataRow["Firmware"].ToString().Trim();
            lResult.BasicInfo.Favorite        = pDBDataRow["Favorite"].ToString().Trim();
            lResult.BasicInfo.IsCustomsizeRom = pDBDataRow["IsCustomsizeRom"].ToString().Trim();
            lResult.BasicInfo.SourceSerial    = pDBDataRow["SourceSerial"].ToString().Trim();
            return(lResult);
        }
Ejemplo n.º 13
0
        public static void DownLoadRomConver(RomInformation pRomInfo)
        {
            string lWebSoruce = "";

            lWebSoruce = BQWeb.DownloadWebHtml(URL3dsdb + pRomInfo.BasicInfo.SubSerial);
            lWebSoruce = lWebSoruce.Replace("\n", "");
            lWebSoruce = lWebSoruce.Replace("\r", "");

            MatchCollection lResult = Regex.Matches(lWebSoruce, _RegexImagePattern);

            if (lResult.Count <= 0)
            {
                return;
            }

            foreach (Match match in lResult)
            {
                GroupCollection gc             = match.Groups;
                FileInfo        tRomConverFile = SavePic(gc["imgLink"].ToString());
            }
        }
Ejemplo n.º 14
0
        RomInformation IRomParser.ParseRom(FileInfo pRomFile)
        {
            if (pRomFile.Extension.ToLower() != ".cia")
            {
                return(new RomInformation());
            }

            RomInformation lRomInfo = new RomInformation();
            CIAGame        cIAGame  = new CIAGame(pRomFile.FullName);

            lRomInfo.BasicInfo.Serial       = cIAGame.Serial;
            lRomInfo.BasicInfo.Title_ID     = cIAGame.TitleId;
            lRomInfo.BasicInfo.Publisher    = cIAGame.Publisher;
            lRomInfo.BasicInfo.Manufacturer = cIAGame.MakerCode;
            if (cIAGame.Titles.Count > 0)
            {
                lRomInfo.BasicInfo.English_Title = cIAGame.Titles[0].ShortDescription;
            }
            lRomInfo.ExpandInfo.LargeIcon = BQIO.BitmapToBitmapImage(cIAGame.LargeIcon);
            lRomInfo.ExpandInfo.SmallIcon = BQIO.BitmapToBitmapImage(cIAGame.SmallIcon);
            return(lRomInfo);
        }
Ejemplo n.º 15
0
        public static List <RomInformation> InitializeFirstRomList()
        {
            List <RomInformation> lAllRomInfo    = new List <RomInformation>();
            List <string>         lRomSerialList = BQIO.GetAllRomFileFromLocal();

            for (int i = 0; i < lRomSerialList.Count; i++)
            {
                RomInformation lRomInformation = BQDB.GetGameInfo(lRomSerialList[i]);
                if (lRomInformation != null)
                {
                    lAllRomInfo.Add(lRomInformation);
                }
            }

            foreach (var romInfo in lAllRomInfo)
            {
                romInfo.ExpandInfo.LargeIcon = BQIO.GetRomLargeIco(romInfo);
                romInfo.ExpandInfo.SmallIcon = BQIO.GetRomSmallIco(romInfo);
            }

            return(lAllRomInfo);
        }
Ejemplo n.º 16
0
        public static List <RomInformation> LoadRom(FileInfo pRomFile, bool isCNRom = false)
        {
            List <RomInformation> lRomInformationList = new List <RomInformation>();

            if (BQSpecs.CompressionFileExtension.Contains(pRomFile.Extension))
            {
                BQCompression.UnCompressionFile(pRomFile, new DirectoryInfo(BQDirectory.TempDir));
                List <FileInfo> lFileList = BQIO.GetRomFile(new DirectoryInfo(BQDirectory.TempDir));
                foreach (var file in lFileList)
                {
                    RomInformation tRomInformation = ParseRom(pRomFile, isCNRom);
                    lRomInformationList.Add(tRomInformation);
                }
            }
            else
            {
                RomInformation tRomInformation = ParseRom(pRomFile, isCNRom);
                lRomInformationList.Add(tRomInformation);
            }

            return(lRomInformationList);
        }
Ejemplo n.º 17
0
        public static bool MergeRomInfo(RomInformation pBaseRomInfo, RomInformation pAdditionRomInfo)
        {
            bool lHasDiff = false;

            foreach (var addromInfoProp in pAdditionRomInfo.BasicInfo.GetType().GetProperties())
            {
                if (addromInfoProp.Name == "SubSerial")
                {
                    continue;
                }
                foreach (var baseRomInfoProp in pBaseRomInfo.BasicInfo.GetType().GetProperties())
                {
                    if (baseRomInfoProp.Name == addromInfoProp.Name)
                    {
                        var baseValue = baseRomInfoProp.GetValue(pBaseRomInfo.BasicInfo);
                        var tarValue  = addromInfoProp.GetValue(pAdditionRomInfo.BasicInfo);
                        if ((baseValue == null || baseValue.ToString().Trim() == "") &&
                            (tarValue != null && tarValue.ToString().Trim() != ""))
                        {
                            baseRomInfoProp.SetValue(pBaseRomInfo.BasicInfo, tarValue);
                            lHasDiff = true;
                        }
                        break;
                    }
                }
            }

            if (pBaseRomInfo.ExpandInfo.LargeIcon == null && pAdditionRomInfo.ExpandInfo.LargeIcon != null)
            {
                pBaseRomInfo.ExpandInfo.LargeIcon = pAdditionRomInfo.ExpandInfo.LargeIcon;
            }

            if (pBaseRomInfo.ExpandInfo.SmallIcon == null && pAdditionRomInfo.ExpandInfo.SmallIcon != null)
            {
                pBaseRomInfo.ExpandInfo.SmallIcon = pAdditionRomInfo.ExpandInfo.SmallIcon;
            }

            return(lHasDiff);
        }
Ejemplo n.º 18
0
        private static BitmapImage GetRomIco(RomInformation pRomInfo, bool pLargeIco)
        {
            DirectoryInfo lDir;

            if (pLargeIco)
            {
                lDir = new DirectoryInfo(BQDirectory.IcoLargeDir);
            }
            else
            {
                lDir = new DirectoryInfo(BQDirectory.IcoSmallDir);
            }

            List <FileInfo> lAllConverList = new List <FileInfo>();

            lAllConverList = GetAllFiles(lDir);
            foreach (var converFile in lAllConverList)
            {
                if (converFile.Name.Replace(converFile.Extension, "") == pRomInfo.BasicInfo.SubSerial)
                {
                    BitmapImage tRomPic = new BitmapImage(new Uri(converFile.FullName));
                    return(tRomPic);
                }
            }

            BitmapImage lRomPic;

            if (pLargeIco)
            {
                lRomPic = BitmapToBitmapImage(ResourceDefault.Large);
            }
            else
            {
                lRomPic = BitmapToBitmapImage(ResourceDefault.Small);
            }

            return(lRomPic);
        }
Ejemplo n.º 19
0
        private static RomInformation ParseRom(FileInfo pRomFile)
        {
            RomInformation lRomInformation = new RomInformation();

            lRomInformation.ExpandInfo.RomType = pRomFile.Extension.TrimStart('.');

            BQLog.WriteMsgToUI("解析Rom。");

            foreach (var romParser in _RomParserList)
            {
                MergeRomInfo(lRomInformation, romParser.ParseRom(pRomFile));
            }

            if (lRomInformation.BasicInfo.Serial == "")
            {
                BQLog.WriteMsgToUI("解析Rom失败。");
                return(null);
            }

            if (lRomInformation.ExpandInfo.LargeIcon != null)
            {
                BQLog.WriteMsgToUI("保持大图标文件");
                BQIO.SaveLargeIco(lRomInformation.ExpandInfo.LargeIcon, lRomInformation);
            }

            if (lRomInformation.ExpandInfo.SmallIcon != null)
            {
                BQLog.WriteMsgToUI("保持小图标文件");
                BQIO.SaveSmallIco(lRomInformation.ExpandInfo.SmallIcon, lRomInformation);
            }

            BQLog.WriteMsgToUI("复制Rom文件");
            BQIO.CopyRomToRomFolder(lRomInformation, pRomFile);

            return(lRomInformation);
        }
Ejemplo n.º 20
0
        public static bool CheckRomFileExist(RomInformation pRomInfo)
        {
            if (pRomInfo.BasicInfo.SubSerial == "")
            {
                return(false);
            }
            string lromFolder = Path.Combine(BQDirectory.RomDir, pRomInfo.BasicInfo.Serial);

            if (pRomInfo.ExpandInfo.RomType == "")
            {
                DirectoryInfo ldirInfo = new DirectoryInfo(lromFolder);
                if (ldirInfo.GetFiles().Length > 0)
                {
                    return(true);
                }
            }
            else
            {
                string lromfile = Path.Combine(lromFolder, pRomInfo.BasicInfo.Serial + "." + pRomInfo.ExpandInfo.RomType + ".7z");
                return(File.Exists(lromfile));
            }

            return(false);
        }
Ejemplo n.º 21
0
        public RomInformation GetExistRomInfo()
        {
            RomInformation lResult = new RomInformation();

            return(lResult);
        }
Ejemplo n.º 22
0
 public void MergeRomInfoList(RomInformation pRomInformation)
 {
 }
Ejemplo n.º 23
0
 public static BitmapImage GetRomLargeIco(RomInformation pRomInfo)
 {
     return(GetRomIco(pRomInfo, true));
 }
Ejemplo n.º 24
0
 public static BitmapImage GetRomSmallIco(RomInformation pRomInfo)
 {
     return(GetRomIco(pRomInfo, false));
 }
Ejemplo n.º 25
0
        private static RomInformation ParseRom(FileInfo pRomFile, bool isCNRom = false)
        {
            RomInformation lRomInformation = new RomInformation();

            lRomInformation.ExpandInfo.RomType = pRomFile.Extension.TrimStart('.');

            foreach (var romParser in _RomParserList)
            {
                MergeRomInfo(lRomInformation, romParser.ParseRom(pRomFile));
            }
            if (lRomInformation.BasicInfo.Serial != "")
            {
                if (lRomInformation.BasicInfo.Serial.Length == 10)
                {
                    lRomInformation.BasicInfo.Serial = lRomInformation.BasicInfo.Serial.Substring(0, 4) + lRomInformation.BasicInfo.Serial.Substring(6, 4);
                }

                lRomInformation.BasicInfo.SourceSerial = lRomInformation.BasicInfo.Serial;
                UpdateRomInfoToDB(lRomInformation);
                if (isCNRom)
                {
                    lRomInformation.BasicInfo.SourceSerial = lRomInformation.BasicInfo.Serial;
                    lRomInformation.BasicInfo.Serial       = CreateCNSerial(lRomInformation.BasicInfo.SourceSerial);
                    UpdateRomInfoToDB(lRomInformation);
                }
            }

            if (lRomInformation.ExpandInfo.LargeIcon != null)
            {
                BQIO.SaveLargeIco(lRomInformation.ExpandInfo.LargeIcon, lRomInformation);
            }

            if (lRomInformation.ExpandInfo.SmallIcon != null)
            {
                BQIO.SaveSmallIco(lRomInformation.ExpandInfo.SmallIcon, lRomInformation);
            }

            if (BQIO.CheckRomFileExist(lRomInformation) == false)
            {
                BQIO.CopyRomToRomFolder(lRomInformation, pRomFile);
            }

            switch (pRomFile.Extension.ToLower())
            {
            case ".3ds":
                lRomInformation.ExpandInfo.Existed3DS = true;
                break;

            case ".3dz":
                lRomInformation.ExpandInfo.Existed3DZ = true;
                break;

            case ".cia":
                lRomInformation.ExpandInfo.ExistedCIA = true;
                break;

            default:
                break;
            }

            return(lRomInformation);
        }
Ejemplo n.º 26
0
        public void LoadRom(MemoryBlock externalRom)
        {
            RomInformation romInformation;

            if (externalRom == null)
            {
                throw new ArgumentNullException("externalRom");
            }

            if ((externalRom.Length & 0x3FFF) != 0 ||
                (externalRom.Length >> 14) > 512)
            {
                throw new InvalidOperationException();
            }

            romInformation = new RomInformation(externalRom);

            if (romInformation.RomSize != externalRom.Length)
            {
                throw new InvalidOperationException();
            }

            Mapper mapper;

            switch (romInformation.RomType)
            {
            case RomType.RomOnly:
            case RomType.RomRam:
            case RomType.RomRamBattery:
                mapper = new Mappers.RomController(this);
                break;

            case RomType.RomMbc1:
            case RomType.RomMbc1Ram:
            case RomType.RomMbc1RamBattery:
                mapper = new Mappers.MemoryBankController1(this);
                break;

            case RomType.RomMbc2:
            case RomType.RomMbc2Battery:
                mapper = new Mappers.MemoryBankController2(this);
                break;

            case RomType.RomMbc3:
            case RomType.RomMbc3Ram:
            case RomType.RomMbc3RamBattery:
            case RomType.RomMbc3TimerBattery:
            case RomType.RomMbc3TimerRamBattery:
                mapper = new Mappers.MemoryBankController3(this);
                break;

            case RomType.RomMbc5:
            case RomType.RomMbc5Ram:
            case RomType.RomMbc5RamBattery:
            case RomType.RomMbc5Rumble:
            case RomType.RomMbc5RumbleRam:
            case RomType.RomMbc5RumbleRamBattery:
                mapper = new Mappers.MemoryBankController5(this);
                break;

            default:
                throw new NotSupportedException("Unsupported Cartidge Type");
            }

            SuspendEmulation();

            this.romInformation   = romInformation;
            this.externalRomBlock = externalRom;
            this.mapper           = mapper;
            this.colorMode        = ColorHardware & romInformation.SupportsColorGameBoy;

#if WITH_DEBUGGING
            ClearBreakpoints();
#endif
            Reset();             // Will call “ResumeEmulation”…

            // Fills the external RAM with random data.
            // It can be loaded with real data later.
            unsafe { RandomFill((byte *)externalRamBlock.Pointer, externalRamBlock.Length); }

            romLoaded = true;
        }
Ejemplo n.º 27
0
 public static void SaveLargeIco(BitmapImage pImage, RomInformation pRomInfo)
 {
     SaveIco(pImage, pRomInfo, true);
 }
Ejemplo n.º 28
0
		public void UnloadRom()
		{
			if (externalRomBlock != null)
			{
#if WITH_THREADING
				SuspendEmulation();
#endif
				this.mapper = null;
				this.externalRomBlock = null;
				this.romInformation = null;
				this.colorMode = ColorHardware;
#if WITH_DEBUGGING
				ClearBreakpoints();
#endif
				Reset(); // Will call “ResumeEmulation”…
			}
		}
Ejemplo n.º 29
0
        RomInformation IRomInfoNetCrawler.ScanRomInfo(RomInformation pRomInfo)
        {
            RomInformation lreslut    = new RomInformation();
            string         lWebSoruce = "";

            if (_BufferCrawleredSubSerial == pRomInfo.BasicInfo.SubSerial)
            {
                lWebSoruce = _BufferCrawleredUrl;
            }
            else
            {
                lWebSoruce          = BQWeb.DownloadWebHtml(URL3dsdb + pRomInfo.BasicInfo.SubSerial);
                lWebSoruce          = lWebSoruce.Replace("\n", "");
                lWebSoruce          = lWebSoruce.Replace("\r", "");
                _BufferCrawleredUrl = lWebSoruce;
            }
            lWebSoruce = lWebSoruce.Replace("<tr><td", "</td></tr><tr><td");

            Match lResult = lRegexInfo.Match(lWebSoruce);

            if (lResult.Success == false)
            {
                return(lreslut);
            }

            string          lRomInfo         = lResult.Groups["body"].Value.ToString();
            MatchCollection lMatchCollection = lRegextd.Matches(lRomInfo);

            if (lMatchCollection.Count <= 0)
            {
                return(lreslut);
            }
            List <string> lTrList = new List <string>();

            foreach (Match match in lMatchCollection)
            {
                GroupCollection gc = match.Groups;
                lTrList.Add(gc["tdValue"].ToString());
            }

            Romgamedb3dsInfo romgamedb3DsInfo = new Romgamedb3dsInfo();

            string tPropName = "";
            bool   tFindProp = false;

            foreach (var gameInfo in lTrList)
            {
                if (gameInfo == "")
                {
                    continue;
                }
                tFindProp = false;
                foreach (var item in romgamedb3DsInfo.GetType().GetProperties())
                {
                    string prpname = item.Name;
                    prpname = prpname.Replace("_1", " (");
                    prpname = prpname.Replace("_2", ")");
                    prpname = prpname.Replace("_3", " ");
                    prpname = prpname.Replace("_4", ".");
                    prpname = prpname.Replace("__", "");

                    if (gameInfo.ToLower() == prpname.ToLower())
                    {
                        tFindProp = true;
                        tPropName = item.Name;
                        break;
                    }
                }

                if (tFindProp)
                {
                    continue;
                }

                if (tPropName != "")
                {
                    string value = lRegextdDummy.Replace(gameInfo, "");

                    romgamedb3DsInfo.GetType().GetProperty(tPropName).SetValue(romgamedb3DsInfo, value);
                    tPropName = "";
                    tFindProp = false;
                }
            }

            lreslut.BasicInfo.English_Title  = romgamedb3DsInfo.title_1EN_2;
            lreslut.BasicInfo.Japanese_Title = romgamedb3DsInfo.title_1JA_2;
            lreslut.BasicInfo.Developer      = romgamedb3DsInfo.developer;
            lreslut.BasicInfo.Players        = romgamedb3DsInfo.players;
            lreslut.BasicInfo.ReleaseDate    = romgamedb3DsInfo.release_3date;
            lreslut.BasicInfo.Publisher      = romgamedb3DsInfo.publisher;
            lreslut.BasicInfo.Languages      = romgamedb3DsInfo.languages;
            lreslut.BasicInfo.Genre          = romgamedb3DsInfo.genre;

            return(lreslut);
        }
Ejemplo n.º 30
0
 public RomInfoWindow(RomInformation pRomInfo)
 {
     _RomInfo = pRomInfo;
     InitializeComponent();
 }
Ejemplo n.º 31
0
		public void LoadRom(MemoryBlock externalRom)
		{
			RomInformation romInformation;

			if (externalRom == null) throw new ArgumentNullException("externalRom");

			if ((externalRom.Length & 0x3FFF) != 0
				|| (externalRom.Length >> 14) > 256)
				throw new InvalidOperationException();

			romInformation = new RomInformation(externalRom);

			if (romInformation.RomSize != externalRom.Length) throw new InvalidOperationException();

			Mapper mapper;

			switch (romInformation.RomType)
			{
				case RomType.RomOnly:
				case RomType.RomRam:
				case RomType.RomRamBattery:
					mapper = new Mappers.RomController(this);
					break;
				case RomType.RomMbc1:
				case RomType.RomMbc1Ram:
				case RomType.RomMbc1RamBattery:
					mapper = new Mappers.MemoryBankController1(this);
					break;
				case RomType.RomMbc2:
				case RomType.RomMbc2Battery:
					mapper = new Mappers.MemoryBankController2(this);
					break;
				case RomType.RomMbc3:
				case RomType.RomMbc3Ram:
				case RomType.RomMbc3RamBattery:
				case RomType.RomMbc3TimerBattery:
				case RomType.RomMbc3TimerRamBattery:
					mapper = new Mappers.MemoryBankController3(this);
					break;
				case RomType.RomMbc5:
				case RomType.RomMbc5Ram:
				case RomType.RomMbc5RamBattery:
				case RomType.RomMbc5Rumble:
				case RomType.RomMbc5RumbleRam:
				case RomType.RomMbc5RumbleRamBattery:
					mapper = new Mappers.MemoryBankController5(this);
					break;
				default:
					throw new NotSupportedException("Unsupported Cartidge Type");
			}

#if WITH_THREADING
			SuspendEmulation();
#endif

			this.romInformation = romInformation;
			this.externalRomBlock = externalRom;
			this.mapper = mapper;
			this.colorMode = ColorHardware & romInformation.ColorGameBoySupport;

#if WITH_DEBUGGING
			ClearBreakpoints();
#endif
			Reset(); // Will call “ResumeEmulation”…

			// Fills the external RAM with random data.
			// It can be loaded with real data later.
			unsafe { RandomFill((byte*)externalRamBlock.Pointer, externalRamBlock.Length); }

			romLoaded = true;
		}
Ejemplo n.º 32
0
 public static void SaveSmallIco(BitmapImage pImage, RomInformation pRomInfo)
 {
     SaveIco(pImage, pRomInfo, false);
 }