Пример #1
0
        protected void PostInit()
        {
            using (_exe.EnterExit())
            {
                var areas = new LibWaterboxCore.MemoryArea[256];
                _core.GetMemoryAreas(areas);
                _memoryAreas = areas.Where(a => a.Data != IntPtr.Zero && a.Size != 0)
                               .ToArray();

                var memoryDomains = _memoryAreas.Select(a => WaterboxMemoryDomain.Create(a, _exe)).ToList();
                var primaryDomain = memoryDomains
                                    .Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Primary))
                                    .Single();

                var mdl = new MemoryDomainList(
                    memoryDomains.Cast <MemoryDomain>()
                    .Concat(new[] { _exe.GetPagesDomain() })
                    .ToList()
                    );
                mdl.MainMemory = primaryDomain;
                _serviceProvider.Register <IMemoryDomains>(mdl);

                _saveramAreas = memoryDomains
                                .Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Saverammable))
                                .ToArray();
                _saveramSize = (int)_saveramAreas.Sum(a => a.Size);

                _exe.Seal();
            }
        }
Пример #2
0
        protected void PostInit()
        {
            using (_exe.EnterExit())
            {
                var areas = new LibWaterboxCore.MemoryArea[256];
                _core.GetMemoryAreas(areas);
                _memoryAreas = areas.Where(a => a.Data != IntPtr.Zero && a.Size != 0)
                               .ToArray();

                var memoryDomains = _memoryAreas.Select(a => WaterboxMemoryDomain.Create(a, _exe)).ToList();
                var primaryDomain = memoryDomains
                                    .Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Primary))
                                    .Single();

                var mdl = new MemoryDomainList(memoryDomains.Cast <MemoryDomain>().ToList());
                mdl.MainMemory = primaryDomain;
                _serviceProvider.Register <IMemoryDomains>(mdl);

                _saveramAreas = memoryDomains
                                .Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Saverammable))
                                .ToArray();
                _saveramSize = (int)_saveramAreas.Sum(a => a.Size);

                var sr = _core as ICustomSaveram;
                if (sr != null)
                {
                    _serviceProvider.Register <ISaveRam>(new CustomSaverammer(sr));                    // override the default implementation
                }
                _exe.Seal();
            }
        }