Пример #1
0
        public TestInstance( TestHost host, EmulationParameters parameters )
        {
            Debug.Assert( host != null );
            Debug.Assert( parameters != null );

            _host = host;
            _params = parameters;
        }
Пример #2
0
        public TestInstance(TestHost host, EmulationParameters parameters)
        {
            Debug.Assert(host != null);
            Debug.Assert(parameters != null);

            _host   = host;
            _params = parameters;
        }
Пример #3
0
        public Instance( Host host, EmulationParameters parameters, bool suppressXmb )
        {
            Debug.Assert( host != null );
            Debug.Assert( parameters != null );

            _host = host;
            _params = parameters;

            _switchToXmb = !suppressXmb;
        }
Пример #4
0
        public Instance(Host host, EmulationParameters parameters, bool suppressXmb)
        {
            Debug.Assert(host != null);
            Debug.Assert(parameters != null);

            _host   = host;
            _params = parameters;

            _switchToXmb = !suppressXmb;
        }
Пример #5
0
        public bool CreateInstance()
        {
            EmulationParameters emulationParams = new EmulationParameters();

            emulationParams.BiosComponent = new Noxa.Emulation.Psp.Bios.MHLE();
            emulationParams.CpuComponent  = new Noxa.Emulation.Psp.Cpu.UltraCpu();
            //emulationParams.InputComponent = new Noxa.Emulation.Psp.Input.SimpleInput();
            emulationParams.MemoryStickComponent = new Noxa.Emulation.Psp.Media.UserHostFileSystem();
            emulationParams.UmdComponent         = new Noxa.Emulation.Psp.Media.Iso.IsoFileSystem();
            //emulationParams.VideoComponent = new Noxa.Emulation.Psp.Video.OpenGLVideo();

            emulationParams[emulationParams.MemoryStickComponent]         = new ComponentParameters();
            emulationParams[emulationParams.MemoryStickComponent]["path"] = @"C:\Dev\Noxa.Emulation\trunk\Test Stick\";

            _instance = new TestInstance(this, emulationParams);

            List <ComponentIssue> issues = _instance.Test();
            bool showReport = false;
            bool allowRun   = true;

            if (issues.Count > 0)
            {
                int errorCount = 0;
                foreach (ComponentIssue issue in issues)
                {
                    if (issue.Level == IssueLevel.Error)
                    {
                        errorCount++;
                    }
                }
                if (errorCount == 0)
                {
                    showReport = false;
                }
                else
                {
                    showReport = true;
                    allowRun   = false;
                }
            }

            Debug.Assert(showReport == false);
            if (showReport == true)
            {
            }

            if (allowRun == true)
            {
                return(_instance.Create());
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public bool CreateInstance( bool suppressXmb )
        {
            EmulationParameters emulationParams = new EmulationParameters();

            Dictionary<KeyValuePair<string, int>, ComponentParameters> parameters = new Dictionary<KeyValuePair<string, int>, ComponentParameters>();

            Settings[] settingsList = _componentSettings.GetValue<Settings[]>( "settingsList" );
            if( settingsList != null )
            {
                foreach( Settings settings in settingsList )
                {
                    string componentName = settings.GetValue<string>( "componentName" );
                    int index = settings.GetValue<int>( "componentIndex" );
                    ComponentParameters p = settings.GetValue<ComponentParameters>( "parameters" );
                    parameters.Add( new KeyValuePair<string, int>( componentName, index ), p );
                }
            }

            Settings[] pickedComponents = _componentSettings.GetValue<Settings[]>( "pickedComponents" );
            if( pickedComponents != null )
            {
                foreach( Settings settings in pickedComponents )
                {
                    string componentName = settings.GetValue<string>( "componentName" );
                    int index = settings.GetValue<int>( "componentIndex" );
                    string componentPath = settings.GetValue<string>( "componentPath" );

                    Assembly assembly;
                    try
                    {
                        assembly = Assembly.LoadFile( componentPath );
                    }
                    catch
                    {
                        Log.WriteLine( Verbosity.Critical, Feature.General, "CreateInstance: assembly not found or not loadable: {0}", componentPath );
                        continue;
                    }
                    Type type = assembly.GetType( componentName, false );
                    if( type == null )
                    {
                        Log.WriteLine( Verbosity.Critical, Feature.General, "CreateInstance: component not found or not loadable: {0} in {1}", componentName, componentPath );
                        continue;
                    }
                    IComponent component;
                    try
                    {
                        component = ( IComponent )Activator.CreateInstance( type );
                    }
                    catch
                    {
                        Log.WriteLine( Verbosity.Critical, Feature.General, "CreateInstance: component could not be instantiated: {0} in {1}", componentName, componentPath );
                        continue;
                    }

                    switch( component.Type )
                    {
                        case ComponentType.Audio:
                            emulationParams.AudioComponent = component;
                            break;
                        case ComponentType.Bios:
                            emulationParams.BiosComponent = component;
                            break;
                        case ComponentType.Cpu:
                            emulationParams.CpuComponent = component;
                            break;
                        case ComponentType.Input:
                            emulationParams.InputComponent = component;
                            break;
                        case ComponentType.UserMedia:
                            emulationParams.MemoryStickComponent = component;
                            break;
                        case ComponentType.GameMedia:
                            emulationParams.UmdComponent = component;
                            break;
                        case ComponentType.Network:
                            emulationParams.IOComponents.Add( component );
                            break;
                        case ComponentType.Video:
                            emulationParams.VideoComponent = component;
                            break;
                        case ComponentType.Other:
                        default:
                            //Log.WriteLine( Verbosity.Critical, Feature.General, "CreateInstance: unknown component type for {0} in {1}", componentName, componentPath );
                            continue;
                    }

                    ComponentParameters p = null;
                    KeyValuePair<string, int> specifier = new KeyValuePair<string, int>( componentName, index );
                    if( parameters.ContainsKey( specifier ) == true )
                        p = parameters[ specifier ];
                    if( p != null )
                        emulationParams.Parameters[ component ] = p;
                    else
                        emulationParams.Parameters[ component ] = new ComponentParameters();
                }
            }

            _instance = new Instance( this, emulationParams, suppressXmb );

            List<ComponentIssue> issues = _instance.Test();
            bool showReport = false;
            bool allowRun = true;
            if( issues.Count > 0 )
            {
                int errorCount = 0;
                foreach( ComponentIssue issue in issues )
                {
                    if( issue.Level == IssueLevel.Error )
                        errorCount++;
                }
                if( errorCount == 0 )
                {
                    if( Properties.Settings.Default.ShowReportOnWarnings == true )
                        showReport = true;
                }
                else
                {
                    showReport = true;
                    allowRun = false;
                }
            }

            if( showReport == true )
            {
                IssueReport report = new IssueReport( this, issues );
                report.ShowDialog( _player );
            }

            if( allowRun == true )
                return _instance.Create();
            else
                return false;
        }
Пример #7
0
        public bool CreateInstance(bool suppressXmb)
        {
            EmulationParameters emulationParams = new EmulationParameters();

            Dictionary <KeyValuePair <string, int>, ComponentParameters> parameters = new Dictionary <KeyValuePair <string, int>, ComponentParameters>();

            Settings[] settingsList = _componentSettings.GetValue <Settings[]>("settingsList");
            if (settingsList != null)
            {
                foreach (Settings settings in settingsList)
                {
                    string componentName  = settings.GetValue <string>("componentName");
                    int    index          = settings.GetValue <int>("componentIndex");
                    ComponentParameters p = settings.GetValue <ComponentParameters>("parameters");
                    parameters.Add(new KeyValuePair <string, int>(componentName, index), p);
                }
            }

            Settings[] pickedComponents = _componentSettings.GetValue <Settings[]>("pickedComponents");
            if (pickedComponents != null)
            {
                foreach (Settings settings in pickedComponents)
                {
                    string componentName = settings.GetValue <string>("componentName");
                    int    index         = settings.GetValue <int>("componentIndex");
                    string componentPath = settings.GetValue <string>("componentPath");

                    Assembly assembly;
                    try
                    {
                        assembly = Assembly.LoadFile(componentPath);
                    }
                    catch
                    {
                        Log.WriteLine(Verbosity.Critical, Feature.General, "CreateInstance: assembly not found or not loadable: {0}", componentPath);
                        continue;
                    }
                    Type type = assembly.GetType(componentName, false);
                    if (type == null)
                    {
                        Log.WriteLine(Verbosity.Critical, Feature.General, "CreateInstance: component not found or not loadable: {0} in {1}", componentName, componentPath);
                        continue;
                    }
                    IComponent component;
                    try
                    {
                        component = ( IComponent )Activator.CreateInstance(type);
                    }
                    catch
                    {
                        Log.WriteLine(Verbosity.Critical, Feature.General, "CreateInstance: component could not be instantiated: {0} in {1}", componentName, componentPath);
                        continue;
                    }

                    switch (component.Type)
                    {
                    case ComponentType.Audio:
                        emulationParams.AudioComponent = component;
                        break;

                    case ComponentType.Bios:
                        emulationParams.BiosComponent = component;
                        break;

                    case ComponentType.Cpu:
                        emulationParams.CpuComponent = component;
                        break;

                    case ComponentType.Input:
                        emulationParams.InputComponent = component;
                        break;

                    case ComponentType.UserMedia:
                        emulationParams.MemoryStickComponent = component;
                        break;

                    case ComponentType.GameMedia:
                        emulationParams.UmdComponent = component;
                        break;

                    case ComponentType.Network:
                        emulationParams.IOComponents.Add(component);
                        break;

                    case ComponentType.Video:
                        emulationParams.VideoComponent = component;
                        break;

                    case ComponentType.Other:
                    default:
                        //Log.WriteLine( Verbosity.Critical, Feature.General, "CreateInstance: unknown component type for {0} in {1}", componentName, componentPath );
                        continue;
                    }

                    ComponentParameters        p         = null;
                    KeyValuePair <string, int> specifier = new KeyValuePair <string, int>(componentName, index);
                    if (parameters.ContainsKey(specifier) == true)
                    {
                        p = parameters[specifier];
                    }
                    if (p != null)
                    {
                        emulationParams.Parameters[component] = p;
                    }
                    else
                    {
                        emulationParams.Parameters[component] = new ComponentParameters();
                    }
                }
            }

            _instance = new Instance(this, emulationParams, suppressXmb);

            List <ComponentIssue> issues = _instance.Test();
            bool showReport = false;
            bool allowRun   = true;

            if (issues.Count > 0)
            {
                int errorCount = 0;
                foreach (ComponentIssue issue in issues)
                {
                    if (issue.Level == IssueLevel.Error)
                    {
                        errorCount++;
                    }
                }
                if (errorCount == 0)
                {
                    if (Properties.Settings.Default.ShowReportOnWarnings == true)
                    {
                        showReport = true;
                    }
                }
                else
                {
                    showReport = true;
                    allowRun   = false;
                }
            }

            if (showReport == true)
            {
                IssueReport report = new IssueReport(this, issues);
                report.ShowDialog(_player);
            }

            if (allowRun == true)
            {
                return(_instance.Create());
            }
            else
            {
                return(false);
            }
        }