Example #1
0
        public void SetSystemAvInfo(SystemAvInfo info)
        {
            var w = Convert.ToInt32(info.geometry.base_width);
            var h = Convert.ToInt32(info.geometry.base_height);

            AudioBufferSize  = 4096;
            AudioBufferFlush = new float[AudioBufferSize];
            AudioBuffer      = new float[AudioBufferSize];
            VideoLineBytes   = (VideoSupport16Bit ? 2 : 3) * w;
            VideoBuffer      = new byte[VideoLineBytes * h];
        }
Example #2
0
        public void SetSystemAvInfo(SystemAvInfo info)
        {
            VideoWidth  = Convert.ToInt32(info.geometry.base_width);
            VideoHeight = Convert.ToInt32(info.geometry.base_height);

            AudioBufferSize  = 4096;
            AudioBufferFlush = new float[AudioBufferSize];
            AudioBuffer      = new float[AudioBufferSize];
            VideoLineBytes   = (VideoSupport16Bit ? 2 : 4) * VideoWidth;
            VideoUnitSize    = VideoWidth;
            VideoBuffer      = new byte[VideoLineBytes * VideoUnitSize];
        }
Example #3
0
        public unsafe void LoadGame(byte[] bytes)
        {
            if (bytes == null || bytes.Length == 0)
            {
                return;
            }

            var offset = (0x400 << bytes[0x7FD7] == bytes.Length) ? 0x7000 : 0xF000;

            RomHeader = new RomHeader
            {
                GameTitle       = System.Text.Encoding.GetEncoding("iso-2022-jp").GetString(bytes, offset | 0xFC0, 21).Trim(),
                RomType         = bytes[offset | 0xFD6],
                RomSize         = 0x400 << bytes[offset | 0xFD7],
                    SaveRamSize = 0x400 << bytes[offset | 0xFD8],
                    CountryCode = bytes[offset | 0xFD9],
                    License     = bytes[offset | 0xFDA],
                    Version     = bytes[offset | 0xFDB]
            };


            var arrayPointer = Marshal.AllocHGlobal(bytes.Length * Marshal.SizeOf(typeof(byte)));

            Marshal.Copy(bytes, 0, arrayPointer, bytes.Length);

            GameInfo = new GameInfo
            {
                path = (char *)Marshal.StringToHGlobalUni(Path.Combine(Buffers.TemporaryDataPath, "temp.bytes")).ToPointer(),
                size = (uint)bytes.Length,
                data = arrayPointer.ToPointer()
            };

            Bridges.retro_unload_game();
            if (!Bridges.retro_load_game(ref GameInfo))
            {
                throw new ArgumentException();
            }

            SystemAvInfo = new SystemAvInfo();
            Bridges.retro_get_system_av_info(ref SystemAvInfo);
            Buffers.SetSystemAvInfo(SystemAvInfo);
            Buffers.SetStateSize(Bridges.retro_serialize_size());
        }
Example #4
0
        private unsafe void LoadGame(byte[] bytes)
        {
            var arrayPointer = Marshal.AllocHGlobal(bytes.Length * Marshal.SizeOf(typeof(byte)));

            Marshal.Copy(bytes, 0, arrayPointer, bytes.Length);

            GameInfo = new GameInfo
            {
                path = (char *)Marshal.StringToHGlobalUni(Path.GetTempFileName()).ToPointer(),
                size = (uint)bytes.Length,
                data = arrayPointer.ToPointer()
            };

            if (!Bridges.retro_load_game(ref GameInfo))
            {
                throw new ArgumentException();
            }
            SystemAvInfo = new SystemAvInfo();
            Bridges.retro_get_system_av_info(ref SystemAvInfo);
            Buffers.SetSystemAvInfo(SystemAvInfo);
            Buffers.SetStateSize(Bridges.retro_serialize_size());
        }
Example #5
0
 public static extern void retro_get_system_av_info(ref SystemAvInfo info);