public MemoryStickDevice( IEmulationInstance emulator, ComponentParameters parameters, string hostPath, bool writeProtected, long capacity ) { Debug.Assert( emulator != null ); Debug.Assert( parameters != null ); Debug.Assert( hostPath != null ); Debug.Assert( Directory.Exists( hostPath ) == true ); Debug.Assert( capacity > 0 ); _emulator = emulator; _parameters = parameters; _hostPath = hostPath; _writeProtected = writeProtected; DirectoryInfo info = new DirectoryInfo( hostPath ); _root = new MediaFolder( this, null, info ); _capacity = capacity; long used = _root.Cache(); _available = _capacity - used; if( _available < 0 ) { // User gave a capacity that is too small for the size, fix it up while( _capacity < used ) _capacity *= 2; Log.WriteLine( Verbosity.Critical, Feature.Media, "MemoryStickDevice: user gave capacity {0} but {1} is used; changing capacity to {2}", capacity, used, _capacity ); } // Would be nice to do something with this that was official-like (serial number?) _description = string.Format( "Memory Stick ({0}MB){1}", _capacity / 1024 / 1024, ( _writeProtected == true ? " read-only" : "" ) ); }
public UmdDevice(IEmulationInstance emulator, ComponentParameters parameters, string hostPath) : this(emulator, parameters) { Debug.Assert(hostPath != null); Debug.Assert(File.Exists(hostPath) == true); this.Load(hostPath, false); }
public UmdDevice( IEmulationInstance emulator, ComponentParameters parameters, string hostPath ) : this(emulator, parameters) { Debug.Assert( hostPath != null ); Debug.Assert( File.Exists( hostPath ) == true ); this.Load( hostPath, false ); }
public MGLDriver(IEmulationInstance emulator, ComponentParameters parameters) { this.Emu = emulator; this.MemorySystem = this.Emu.Cpu.Memory.MemorySystem; _parameters = parameters; _caps = new MGLCapabilities(); this.Properties = new DisplayProperties(); _statisticsSource = new MGLStatisticsSource(this); Diag.Instance.Counters.RegisterSource(_statisticsSource); }
public MGLDriver( IEmulationInstance emulator, ComponentParameters parameters ) { this.Emu = emulator; this.MemorySystem = this.Emu.Cpu.Memory.MemorySystem; _parameters = parameters; _caps = new MGLCapabilities(); this.Properties = new DisplayProperties(); _statisticsSource = new MGLStatisticsSource( this ); Diag.Instance.Counters.RegisterSource( _statisticsSource ); }
public UmdDevice( IEmulationInstance emulator, ComponentParameters parameters ) { //Debug.Assert( emulator != null ); Debug.Assert( parameters != null ); _emulator = emulator; _parameters = parameters; _state = MediaState.Ejected; _lbnLookup = new Dictionary<long, MediaFile>( 1024 ); }
public UmdDevice(IEmulationInstance emulator, ComponentParameters parameters) { //Debug.Assert( emulator != null ); Debug.Assert(parameters != null); _emulator = emulator; _parameters = parameters; _state = MediaState.Ejected; _lbnLookup = new Dictionary <long, MediaFile>(1024); }
public UmdDevice( IEmulationInstance emulator, ComponentParameters parameters, string hostPath, long capacity ) { Debug.Assert( emulator != null ); Debug.Assert( parameters != null ); Debug.Assert( hostPath != null ); Debug.Assert( Directory.Exists( hostPath ) == true ); Debug.Assert( capacity > 0 ); _emulator = emulator; _parameters = parameters; _capacity = capacity; this.Load( hostPath, false ); }
public UmdDevice(IEmulationInstance emulator, ComponentParameters parameters, string hostPath, long capacity) { Debug.Assert(emulator != null); Debug.Assert(parameters != null); Debug.Assert(hostPath != null); Debug.Assert(Directory.Exists(hostPath) == true); Debug.Assert(capacity > 0); _emulator = emulator; _parameters = parameters; _capacity = capacity; this.Load(hostPath, false); }
public Bios( IEmulationInstance emulator, ComponentParameters parameters ) { Debug.Assert( emulator != null ); Debug.Assert( parameters != null ); _emulator = emulator; _parameters = parameters; Diag.Instance.Database = new DebugDatabase(); _kernel = new Kernel( this ); _loader = new Loader( this ); _gameSetEvent = new AutoResetEvent( false ); this.GatherModulesAndFunctions(); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { string path = parameters.GetValue <string>(MediaConfiguration.PathSetting, null); if ((path == null) || (path.Length == 0) || (Directory.Exists(path) == false)) { // Error! return(null); } long capacity = parameters.GetValue <long>(MediaConfiguration.CapacitySetting, 1024 * 1024 * 1800); return(new UmdDevice(emulator, parameters, path, capacity)); }
public Bios(IEmulationInstance emulator, ComponentParameters parameters) { Debug.Assert(emulator != null); Debug.Assert(parameters != null); _emulator = emulator; _parameters = parameters; Diag.Instance.Database = new DebugDatabase(); _kernel = new Kernel(this); _loader = new Loader(this); _gameSetEvent = new AutoResetEvent(false); this.GatherModulesAndFunctions(); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { string path = parameters.GetValue <string>(MediaConfiguration.PathSetting, null); if ((path == null) || (path.Length == 0) || (Directory.Exists(path) == false)) { // Error! return(null); } bool readOnly = parameters.GetValue <bool>(MediaConfiguration.ReadOnlySetting, false); long capacity = parameters.GetValue <long>(MediaConfiguration.CapacitySetting, ( long )1024 * 1024 * 1024 * 2); return(new MemoryStickDevice(emulator, parameters, path, readOnly, capacity)); }
/// <summary> /// Setup the debugger after an instance has been started. /// </summary> public void OnInstanceStarted() { this.Emulator.AttachDebugger(); IEmulationInstance emu = this.Emulator.CurrentInstance; List <IHook> hooks = new List <IHook>(); foreach (IComponentInstance instance in emu.Components) { IDebuggable debuggable = instance as IDebuggable; if (debuggable == null) { continue; } if (debuggable.SupportsDebugging == false) { Debug.WriteLine(string.Format("Debugger: {0} does not support debugging", instance.Factory.Name)); continue; } debuggable.EnableDebugging(); hooks.Add(debuggable.DebugHook); if (debuggable.DebugHook is IBiosHook) { this.BiosHook = ( IBiosHook )debuggable.DebugHook; } else if (debuggable.DebugHook is ICpuHook) { this.CpuHook = ( ICpuHook )debuggable.DebugHook; } else if (debuggable.DebugHook is IVideoHook) { this.VideoHook = ( IVideoHook )debuggable.DebugHook; } } _hooks = hooks.ToArray(); this.Controller = emu.Cpu.DebugController; if (_isAttached == false) { return; } _client.OnStarted(emu.Bios.Game, emu.Bios.BootStream); }
public FMODDriver(IEmulationInstance emulator, ComponentParameters parameters) { FMOD.RESULT result; uint version = 0; this.Emu = emulator; this._parameters = parameters; result = FMOD.Factory.System_Create(ref this.AudioSystem); Debug.Assert(result == FMOD.RESULT.OK); result = this.AudioSystem.getVersion(ref version); Debug.Assert(result == FMOD.RESULT.OK); Debug.Assert(version >= FMOD.VERSION.number); result = this.AudioSystem.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)null); Debug.Assert(result == FMOD.RESULT.OK); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { string path = parameters.GetValue <string>(MediaConfiguration.PathSetting, null); if ((path == null) || (path.Length == 0) || (File.Exists(path) == false)) { // Path not found - this is just a generic UMD if ((path != null) && (path.Length > 0)) { Log.WriteLine(Verbosity.Critical, Feature.Media, "IsoFileSystem: unable to create instance, path {0} not found", path); } return(new UmdDevice(emulator, parameters)); } return(new UmdDevice(emulator, parameters, path)); }
public Cpu(IEmulationInstance emulator, ComponentParameters parameters) { Debug.Assert(emulator != null); Debug.Assert(parameters != null); _caps = new CpuCapabilities(); _stats = new RuntimeStatistics(); _emulator = emulator; _params = parameters; _lastSyscall = -1; _syscalls = new BiosFunction[1024]; #if STATS _timer = new PerformanceTimer(); _timeSinceLastIpsPrint = 0.0; #endif _clock = new Clock(); _memory = new Memory(); // Order matters as the lookup is linear and stupid... should be changed somehow //_memory->DefineSegment( MemoryType::PhysicalMemory, "Main Memory", 0x08000000, 0x01FFFFFF ); //_memory->DefineSegment( MemoryType::PhysicalMemory, "Hardware Vectors", 0x1FC00000, 0x000FFFFF ); //_memory->DefineSegment( MemoryType::PhysicalMemory, "Scratchpad", 0x00010000, 0x00003FFF ); //_memory->DefineSegment( MemoryType::PhysicalMemory, "Frame Buffer", 0x04000000, 0x001FFFFF ); //_memory->DefineSegment( MemoryType::HardwareMapped, "Hardware IO 1", 0x1C000000, 0x03BFFFFF ); //_memory->DefineSegment( MemoryType::HardwareMapped, "Hardware IO 2", 0x1FD00000, 0x002FFFFF ); _core0 = new Core(this, 0, "Allegrex", CoreAttributes.HasCp2); _core1 = new Core(this, 1, "Media Engine", CoreAttributes.Default); _codeCache = new CodeCache(); _context = new GenerationContext(); _context.Cpu = this; _context.Core0 = _core0; _context.Memory = _memory; _executionMode = ExecutionMode.Run; _firstExecute = true; }
public MemoryStickDevice(IEmulationInstance emulator, ComponentParameters parameters, string hostPath, bool writeProtected, long capacity) { Debug.Assert(emulator != null); Debug.Assert(parameters != null); Debug.Assert(hostPath != null); Debug.Assert(Directory.Exists(hostPath) == true); Debug.Assert(capacity > 0); _emulator = emulator; _parameters = parameters; _hostPath = hostPath; _writeProtected = writeProtected; DirectoryInfo info = new DirectoryInfo(hostPath); _root = new MediaFolder(this, null, info); _capacity = capacity; long used = _root.Cache(); _available = _capacity - used; if (_available < 0) { // User gave a capacity that is too small for the size, fix it up while (_capacity < used) { _capacity *= 2; } Log.WriteLine(Verbosity.Critical, Feature.Media, "MemoryStickDevice: user gave capacity {0} but {1} is used; changing capacity to {2}", capacity, used, _capacity); } // Would be nice to do something with this that was official-like (serial number?) _description = string.Format("Memory Stick ({0}MB){1}", _capacity / 1024 / 1024, (_writeProtected == true ? " read-only" : "")); }
public Kernel(Bios bios) { Debug.Assert(bios != null); Bios = bios; Emulator = Bios.Emulator; Debug.Assert(Emulator.Cpu != null); Cpu = Emulator.Cpu; CpuCore = Cpu.Cores[0]; Memory = Cpu.Memory; MemorySystem = Memory.MemorySystem; Devices = new List <KDevice>(); UserModules = new List <KModule>(10); Threads = new List <KThread>(128); SchedulableThreads = new FastLinkedList <KThread>(); Handles = new Dictionary <uint, KHandle>(); _lastUid = 100; SpeedLocked = true; }
public IComponentInstance CreateInstance( IEmulationInstance emulator, ComponentParameters parameters ) { string path = parameters.GetValue<string>( MediaConfiguration.PathSetting, null ); if( ( path == null ) || ( path.Length == 0 ) || ( Directory.Exists( path ) == false ) ) { // Error! return null; } long capacity = parameters.GetValue<long>( MediaConfiguration.CapacitySetting, 1024 * 1024 * 1800 ); return new UmdDevice( emulator, parameters, path, capacity ); }
/// <summary> /// Generate a load report XML file and write it to the disk. /// </summary> /// <param name="instance">The current emulation instance.</param> /// <param name="game">The game being loaded.</param> /// <param name="results">The results of the load.</param> /// <param name="outputPath">The path to write the result data to.</param> public static void GenerateReport( IEmulationInstance instance, GameInformation game, LoadResults results, string outputPath ) { Debug.Assert( game != null ); if( game == null ) return; Debug.Assert( results != null ); if( results == null ) return; XmlDocument doc = new XmlDocument(); doc.AppendChild( doc.CreateXmlDeclaration( "1.0", null, "yes" ) ); XmlElement root = doc.CreateElement( "loadResults" ); root.SetAttribute( "successful", results.Successful.ToString() ); XmlElement gameRoot = doc.CreateElement( "game" ); gameRoot.SetAttribute( "type", game.GameType.ToString() ); //gameRoot.SetAttribute( "path", EscapeFilePath( game.Folder.AbsolutePath ) ); { XmlElement sfoRoot = doc.CreateElement( "parameters" ); if( game.Parameters.Title != null ) sfoRoot.SetAttribute( "title", game.Parameters.Title ); if( game.Parameters.SystemVersion != new Version() ) sfoRoot.SetAttribute( "systemVersion", game.Parameters.SystemVersion.ToString() ); if( game.Parameters.GameVersion != new Version() ) sfoRoot.SetAttribute( "gameVersion", game.Parameters.GameVersion.ToString() ); if( game.Parameters.DiscID != null ) sfoRoot.SetAttribute( "discId", game.Parameters.DiscID ); if( game.Parameters.Region >= 0 ) sfoRoot.SetAttribute( "region", game.Parameters.Region.ToString( "X" ) ); if( game.Parameters.Language != null ) sfoRoot.SetAttribute( "language", game.Parameters.Language ); sfoRoot.SetAttribute( "category", game.Parameters.Category.ToString() ); gameRoot.AppendChild( sfoRoot ); } root.AppendChild( gameRoot ); XmlElement biosRoot = doc.CreateElement( "bios" ); { IComponent factory = Activator.CreateInstance( instance.Bios.Factory ) as IComponent; if( factory != null ) { biosRoot.SetAttribute( "name", factory.Name ); biosRoot.SetAttribute( "version", factory.Version.ToString() ); biosRoot.SetAttribute( "build", factory.Build.ToString() ); if( factory.Author != null ) biosRoot.SetAttribute( "author", factory.Author ); if( factory.Website != null ) biosRoot.SetAttribute( "website", factory.Website ); } } root.AppendChild( biosRoot ); XmlElement importsRoot = doc.CreateElement( "imports" ); foreach( StubImport import in results.Imports ) { XmlElement importRoot = doc.CreateElement( "import" ); importRoot.SetAttribute( "result", import.Result.ToString() ); importRoot.SetAttribute( "module", import.ModuleName ); importRoot.SetAttribute( "nid", string.Format( "{0:X8}", import.NID ) ); if( import.Function != null ) { XmlElement functionRoot = doc.CreateElement( "function" ); functionRoot.SetAttribute( "name", import.Function.Name ); functionRoot.SetAttribute( "isImplemented", import.Function.IsImplemented.ToString() ); //functionRoot.SetAttribute( "hasNative", ( import.Function.NativeMethod != IntPtr.Zero ) ? true.ToString() : false.ToString() ); importRoot.AppendChild( functionRoot ); } importsRoot.AppendChild( importRoot ); } root.AppendChild( importsRoot ); doc.AppendChild( root ); string fileName; if( game.GameType == GameType.Eboot ) { string title = game.Parameters.Title; title = title.Replace( "\n", "" ); // All it takes is one moron fileName = string.Format( "LoadResult-Eboot-{0}.xml", title ); } else fileName = string.Format( "LoadResult-{0}.xml", game.Parameters.DiscID ); using( FileStream stream = File.Open( Path.Combine( outputPath, fileName ), FileMode.Create ) ) doc.Save( stream ); }
public IComponentInstance CreateInstance( IEmulationInstance emulator, ComponentParameters parameters ) { return new Noxa.Emulation.Psp.Bios.ManagedHLE.Bios( emulator, parameters ); }
public IComponentInstance CreateInstance( IEmulationInstance emulator, ComponentParameters parameters ) { return null; }
public bool Load(Stream stream, IEmulationInstance emulator, uint baseAddress) { // Relocate only if we need to if (_needsRelocation == false) { baseAddress = 0; } _entryAddress += baseAddress; _initAddress += baseAddress; IMemory memory = emulator.Cpu.Memory; foreach (ElfSection section in _allocSections) { // Sanity check for broken ELFs if ((baseAddress != 0) && (baseAddress == section.Address)) { // Fuckers lied - no relocation needed! _needsRelocation = false; baseAddress = 0; } uint address = baseAddress + section.Address; section.Address = address; if (section.SectionType == ElfSectionType.NoBits) { // Write zeros? } else if (section.SectionType == ElfSectionType.ProgramBits) { stream.Seek(section.ElfOffset, SeekOrigin.Begin); byte[] bytes = new byte[section.Length]; stream.Read(bytes, 0, ( int )section.Length); memory.WriteBytes(( int )address, bytes); _upperAddress = Math.Max(_upperAddress, address + ( uint )bytes.Length); } } BinaryReader reader = new BinaryReader(stream); ElfSection sceModuleInfo = _sectionLookup[".rodata.sceModuleInfo"]; reader.BaseStream.Seek(sceModuleInfo.ElfOffset, SeekOrigin.Begin); ModuleInfo moduleInfo = new ModuleInfo(reader); _globalPointer = baseAddress + moduleInfo.Gp; // Not sure if this is needed - the header seems to give an ok address //if( _programType == ElfType.Prx ) //{ // ElfSection sceResident = _sectionLookup[ ".rodata.sceResident" ]; // reader.BaseStream.Seek( sceResident.ElfOffset, SeekOrigin.Begin ); // // 2 magic words // reader.BaseStream.Seek( 8, SeekOrigin.Current ); // _entryAddress = reader.ReadUInt32(); //} if (_needsRelocation == true) { //foreach( ElfRelocation relocation in _relocations ) //{ // this.FixRelocation( reader, memory, relocation, baseAddress ); //} foreach (ElfSection section in _relocSections) { this.ApplyRelocations(reader, memory, section, baseAddress); } } //result.Stubs = this.FixupStubs( reader, emulator.Cpu, memory, emulator.Bios, baseAddress ); return(true); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { return(new Noxa.Emulation.Psp.Bios.ManagedHLE.Bios(emulator, parameters)); }
public IComponentInstance CreateInstance( IEmulationInstance emulator, ComponentParameters parameters ) { string path = parameters.GetValue<string>( MediaConfiguration.PathSetting, null ); if( ( path == null ) || ( path.Length == 0 ) || ( Directory.Exists( path ) == false ) ) { // Error! return null; } bool readOnly = parameters.GetValue<bool>( MediaConfiguration.ReadOnlySetting, false ); long capacity = parameters.GetValue<long>( MediaConfiguration.CapacitySetting, ( long )1024 * 1024 * 1024 * 2 ); return new MemoryStickDevice( emulator, parameters, path, readOnly, capacity ); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { return(null); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { return(new FMODDriver(emulator, parameters)); }
public Cpu( IEmulationInstance emulator, ComponentParameters parameters ) { Debug.Assert( emulator != null ); Debug.Assert( parameters != null ); _caps = new CpuCapabilities(); _stats = new RuntimeStatistics(); _emulator = emulator; _params = parameters; _lastSyscall = -1; _syscalls = new BiosFunction[ 1024 ]; #if STATS _timer = new PerformanceTimer(); _timeSinceLastIpsPrint = 0.0; #endif _clock = new Clock(); _memory = new Memory(); // Order matters as the lookup is linear and stupid... should be changed somehow //_memory->DefineSegment( MemoryType::PhysicalMemory, "Main Memory", 0x08000000, 0x01FFFFFF ); //_memory->DefineSegment( MemoryType::PhysicalMemory, "Hardware Vectors", 0x1FC00000, 0x000FFFFF ); //_memory->DefineSegment( MemoryType::PhysicalMemory, "Scratchpad", 0x00010000, 0x00003FFF ); //_memory->DefineSegment( MemoryType::PhysicalMemory, "Frame Buffer", 0x04000000, 0x001FFFFF ); //_memory->DefineSegment( MemoryType::HardwareMapped, "Hardware IO 1", 0x1C000000, 0x03BFFFFF ); //_memory->DefineSegment( MemoryType::HardwareMapped, "Hardware IO 2", 0x1FD00000, 0x002FFFFF ); _core0 = new Core( this, 0, "Allegrex", CoreAttributes.HasCp2 ); _core1 = new Core( this, 1, "Media Engine", CoreAttributes.Default ); _codeCache = new CodeCache(); _context = new GenerationContext(); _context.Cpu = this; _context.Core0 = _core0; _context.Memory = _memory; _executionMode = ExecutionMode.Run; _firstExecute = true; }
public bool Load( Stream stream, IEmulationInstance emulator, uint baseAddress ) { // Relocate only if we need to if( _needsRelocation == false ) baseAddress = 0; _entryAddress += baseAddress; _initAddress += baseAddress; IMemory memory = emulator.Cpu.Memory; foreach( ElfSection section in _allocSections ) { // Sanity check for broken ELFs if( ( baseAddress != 0 ) && ( baseAddress == section.Address ) ) { // Fuckers lied - no relocation needed! _needsRelocation = false; baseAddress = 0; } uint address = baseAddress + section.Address; section.Address = address; if( section.SectionType == ElfSectionType.NoBits ) { // Write zeros? } else if( section.SectionType == ElfSectionType.ProgramBits ) { stream.Seek( section.ElfOffset, SeekOrigin.Begin ); byte[] bytes = new byte[ section.Length ]; stream.Read( bytes, 0, ( int )section.Length ); memory.WriteBytes( ( int )address, bytes ); _upperAddress = Math.Max( _upperAddress, address + ( uint )bytes.Length ); } } BinaryReader reader = new BinaryReader( stream ); ElfSection sceModuleInfo = _sectionLookup[ ".rodata.sceModuleInfo" ]; reader.BaseStream.Seek( sceModuleInfo.ElfOffset, SeekOrigin.Begin ); ModuleInfo moduleInfo = new ModuleInfo( reader ); _globalPointer = baseAddress + moduleInfo.Gp; // Not sure if this is needed - the header seems to give an ok address //if( _programType == ElfType.Prx ) //{ // ElfSection sceResident = _sectionLookup[ ".rodata.sceResident" ]; // reader.BaseStream.Seek( sceResident.ElfOffset, SeekOrigin.Begin ); // // 2 magic words // reader.BaseStream.Seek( 8, SeekOrigin.Current ); // _entryAddress = reader.ReadUInt32(); //} if( _needsRelocation == true ) { //foreach( ElfRelocation relocation in _relocations ) //{ // this.FixRelocation( reader, memory, relocation, baseAddress ); //} foreach( ElfSection section in _relocSections ) { this.ApplyRelocations( reader, memory, section, baseAddress ); } } //result.Stubs = this.FixupStubs( reader, emulator.Cpu, memory, emulator.Bios, baseAddress ); return true; }
/// <summary> /// Generate a load report XML file and write it to the disk. /// </summary> /// <param name="instance">The current emulation instance.</param> /// <param name="game">The game being loaded.</param> /// <param name="results">The results of the load.</param> /// <param name="outputPath">The path to write the result data to.</param> public static void GenerateReport(IEmulationInstance instance, GameInformation game, LoadResults results, string outputPath) { Debug.Assert(game != null); if (game == null) { return; } Debug.Assert(results != null); if (results == null) { return; } XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateXmlDeclaration("1.0", null, "yes")); XmlElement root = doc.CreateElement("loadResults"); root.SetAttribute("successful", results.Successful.ToString()); XmlElement gameRoot = doc.CreateElement("game"); gameRoot.SetAttribute("type", game.GameType.ToString()); //gameRoot.SetAttribute( "path", EscapeFilePath( game.Folder.AbsolutePath ) ); { XmlElement sfoRoot = doc.CreateElement("parameters"); if (game.Parameters.Title != null) { sfoRoot.SetAttribute("title", game.Parameters.Title); } if (game.Parameters.SystemVersion != new Version()) { sfoRoot.SetAttribute("systemVersion", game.Parameters.SystemVersion.ToString()); } if (game.Parameters.GameVersion != new Version()) { sfoRoot.SetAttribute("gameVersion", game.Parameters.GameVersion.ToString()); } if (game.Parameters.DiscID != null) { sfoRoot.SetAttribute("discId", game.Parameters.DiscID); } if (game.Parameters.Region >= 0) { sfoRoot.SetAttribute("region", game.Parameters.Region.ToString("X")); } if (game.Parameters.Language != null) { sfoRoot.SetAttribute("language", game.Parameters.Language); } sfoRoot.SetAttribute("category", game.Parameters.Category.ToString()); gameRoot.AppendChild(sfoRoot); } root.AppendChild(gameRoot); XmlElement biosRoot = doc.CreateElement("bios"); { IComponent factory = Activator.CreateInstance(instance.Bios.Factory) as IComponent; if (factory != null) { biosRoot.SetAttribute("name", factory.Name); biosRoot.SetAttribute("version", factory.Version.ToString()); biosRoot.SetAttribute("build", factory.Build.ToString()); if (factory.Author != null) { biosRoot.SetAttribute("author", factory.Author); } if (factory.Website != null) { biosRoot.SetAttribute("website", factory.Website); } } } root.AppendChild(biosRoot); XmlElement importsRoot = doc.CreateElement("imports"); foreach (StubImport import in results.Imports) { XmlElement importRoot = doc.CreateElement("import"); importRoot.SetAttribute("result", import.Result.ToString()); importRoot.SetAttribute("module", import.ModuleName); importRoot.SetAttribute("nid", string.Format("{0:X8}", import.NID)); if (import.Function != null) { XmlElement functionRoot = doc.CreateElement("function"); functionRoot.SetAttribute("name", import.Function.Name); functionRoot.SetAttribute("isImplemented", import.Function.IsImplemented.ToString()); //functionRoot.SetAttribute( "hasNative", ( import.Function.NativeMethod != IntPtr.Zero ) ? true.ToString() : false.ToString() ); importRoot.AppendChild(functionRoot); } importsRoot.AppendChild(importRoot); } root.AppendChild(importsRoot); doc.AppendChild(root); string fileName; if (game.GameType == GameType.Eboot) { string title = game.Parameters.Title; title = title.Replace("\n", ""); // All it takes is one moron fileName = string.Format("LoadResult-Eboot-{0}.xml", title); } else { fileName = string.Format("LoadResult-{0}.xml", game.Parameters.DiscID); } using (FileStream stream = File.Open(Path.Combine(outputPath, fileName), FileMode.Create)) doc.Save(stream); }
public IComponentInstance CreateInstance( IEmulationInstance emulator, ComponentParameters parameters ) { string path = parameters.GetValue<string>( MediaConfiguration.PathSetting, null ); if( ( path == null ) || ( path.Length == 0 ) || ( File.Exists( path ) == false ) ) { // Path not found - this is just a generic UMD if( ( path != null ) && ( path.Length > 0 ) ) Log.WriteLine( Verbosity.Critical, Feature.Media, "IsoFileSystem: unable to create instance, path {0} not found", path ); return new UmdDevice( emulator, parameters ); } return new UmdDevice( emulator, parameters, path ); }
public IComponentInstance CreateInstance(IEmulationInstance emulator, ComponentParameters parameters) { return new FMODDriver(emulator, parameters); }