コード例 #1
0
        /// <summary>
        /// Loads ROM content
        /// </summary>
        /// <returns></returns>
        private bool LoadROM()
        {
            bool changed = false;

            byte[] old_rom = null;

            // save old rom
            old_rom = Rom;

            // load ROM
            Rom = new byte[MaxRomSize];
            for (int i = 0; i < Rom.Length; i++)
            {
                Rom[i] = 0xff;
            }

            if (string.IsNullOrEmpty(Settings.ROMFileName))
            {
                ROMFile.LoadMemoryFromResource("GameCard.Resources.GameCard.bin", Rom);
            }
            else
            {
                ROMFile.LoadMemoryFromFile(Settings.ROMFileName, Rom);
            }

            changed = !ROMFile.IsMemoryEqual(old_rom, Rom);

            return(changed);
        }
コード例 #2
0
        private bool LoadROM()
        {
            bool memory_changed = false;

            byte[] old_mem_sys = m_mem_sys;
            byte[] old_mem_ext = m_mem_ext;

            // reserve space for memories
            m_mem_sys = new byte[SysMemLength];
            m_mem_ext = new byte[ExtMemLength];

            // load ROM content
            switch (m_settings.ROMVersion)
            {
            // custom version
            case 0:
                break;

            // BASIC 1.2
            case 1:
                ROMFile.LoadMemoryFromResource("YATE.Resources.rom_1_2.bin", m_mem_sys);
                ROMFile.LoadMemoryFromResource("YATE.Resources.ext_1_2.bin", m_mem_ext);
                break;

            // BASIC 1.2 (RU)
            case 2:
                ROMFile.LoadMemoryFromResource("YATE.Resources.rom_1_2_ru.bin", m_mem_sys);
                ROMFile.LoadMemoryFromResource("YATE.Resources.ext_1_2_ru.bin", m_mem_ext);
                break;

            // BASIC 2.1
            case 3:
                ROMFile.LoadMemoryFromResource("YATE.Resources.rom_2_1.bin", m_mem_sys);
                ROMFile.LoadMemoryFromResource("YATE.Resources.ext_2_1.bin", m_mem_ext);
                break;

            // BASIC 2.2
            case 4:
                ROMFile.LoadMemoryFromResource("YATE.Resources.rom_2_2.bin", m_mem_sys);
                ROMFile.LoadMemoryFromResource("YATE.Resources.ext_2_2.bin", m_mem_ext);
                break;
            }

            if (!ROMFile.IsMemoryEqual(old_mem_sys, m_mem_sys))
            {
                memory_changed = true;
            }

            if (!ROMFile.IsMemoryEqual(old_mem_ext, m_mem_ext))
            {
                memory_changed = true;
            }

            return(memory_changed);
        }