Exemplo n.º 1
0
        public int Open(string hddPath)
        {
            CreateHDDinfo(DEV9Header.config.HddSize);

            //Open File
            if (File.Exists(hddPath))
            {
                hddImage = new FileStream(hddPath, FileMode.Open, FileAccess.ReadWrite);
            }
            else
            {
                //Need to Zero fill the hdd image
                HddCreate hddCreator = new HddCreate();
                hddCreator.neededSize = DEV9Header.config.HddSize;
                hddCreator.filePath   = hddPath;

                hddCreator.ShowDialog();
                hddCreator.Dispose();

                hddImage = new FileStream(hddPath, FileMode.Open, FileAccess.ReadWrite);
            }

            ioThread = new Thread(IO_Thread);
            ioRead   = new ManualResetEvent(false);
            ioWrite  = new ManualResetEvent(false);
            ioClose  = new AutoResetEvent(false);

            ioThread.Start();

            return(0);
        }
Exemplo n.º 2
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            int size = int.Parse(comboSize.Text);

            if (size > 127) //PS2 limit is apparently 1TiB (1024GiB)
            {
                //Limit Size as we don't support 48bit stuff
                size = 127;
            }
            DEV9Header.config.HddSize = size * 1024;

            if (!(iniFolder.EndsWith("\\") || iniFolder.EndsWith("/")))
            {
                iniFolder = iniFolder + Path.DirectorySeparatorChar;
            }

            if (tbPath.Text.StartsWith(iniFolder) &&
                !(tbPath.Text.Substring(iniFolder.Length).Contains("\\") || tbPath.Text.Substring(iniFolder.Length).Contains("/")))
            {
                //Path is in ini folder
                DEV9Header.config.Hdd = tbPath.Text.Substring(iniFolder.Length);
            }
            else
            {
                DEV9Header.config.Hdd = tbPath.Text;
            }

            string path = "";

            if (DEV9Header.config.Hdd.Contains("\\") || DEV9Header.config.Hdd.Contains("/"))
            {
                path = DEV9Header.config.Hdd;
            }
            else
            {
                path = iniFolder + DEV9Header.config.Hdd;
            }

            if (!File.Exists(path))
            {
                //Need to Zero fill the hdd image
                HddCreate hddcreator = new HddCreate();
                hddcreator.neededSize = DEV9Header.config.HddSize;
                hddcreator.filePath   = path;

                hddcreator.ShowDialog();
                hddcreator.Dispose();
            }

            Close();
        }
Exemplo n.º 3
0
        public int Open(string hddPath)
        {
            nsector = 1;
            sector = 1;
            status = 0x40;

            CreateHDDinfo(DEV9Header.config.HddSize);

            //Open File
            if (File.Exists(hddPath))
            {
                hddImage = new FileStream(hddPath, FileMode.Open, FileAccess.ReadWrite);
            }
            else
            {
                //Need to Zero fill the hdd image
                HddCreate hddCreator = new HddCreate();
                hddCreator.neededSize = DEV9Header.config.HddSize;
                hddCreator.filePath = hddPath;

                hddCreator.ShowDialog();
                hddCreator.Dispose();

                hddImage = new FileStream(hddPath, FileMode.Open, FileAccess.ReadWrite);
            }

            return 0;
        }