public static InjectContext CreateInjectContext(PspStoredConfig storedConfig, bool test) { var injectContext = new InjectContext(); injectContext.SetInstance <PspStoredConfig>(storedConfig); injectContext.GetInstance <HleConfig>().HleModulesDll = typeof(HleModulesRoot).Assembly; injectContext.SetInstanceType <ICpuConnector, HleThreadManager>(); injectContext.SetInstanceType <IGpuConnector, HleThreadManager>(); injectContext.SetInstanceType <IInterruptManager, HleInterruptManager>(); // Memory #if true // Disabled because crashes on x86 if (storedConfig.UseFastMemory) { injectContext.SetInstanceType <PspMemory, FastPspMemory>(); } else #endif { injectContext.SetInstanceType <PspMemory, NormalPspMemory>(); } if (!test) { // GPU PspPluginImpl.SelectWorkingPlugin <GpuImpl>(injectContext, #if false typeof(GpuImplNull) #else typeof(OpenglGpuImpl), //typeof(GpuImplOpenglEs), //typeof(GpuImplSoft), typeof(GpuImplNull) #endif ); // AUDIO var audioPlugins = new List <Type> { //typeof(PspAudioOpenalImpl) }; //if (Platform.OS == OS.Windows) audioPlugins.Add(typeof(PspAudioWaveOutImpl)); //if (Platform.OS == OS.Linux) audioPlugins.Add(typeof(AudioAlsaImpl)); audioPlugins.Add(typeof(AudioImplNull)); PspPluginImpl.SelectWorkingPlugin <PspAudioImpl>(injectContext, audioPlugins.ToArray()); } else { injectContext.SetInstanceType <GpuImpl, OpenglGpuImpl>(); injectContext.SetInstanceType <PspAudioImpl, AudioImplNull>(); } return(injectContext); }
public static InjectContext CreateInjectContext(PspStoredConfig storedConfig, bool test, Action <InjectContext>?configure = null) { var injectContext = new InjectContext(); configure?.Invoke(injectContext); injectContext.SetInstance <PspStoredConfig>(storedConfig); injectContext.GetInstance <HleConfig>().HleModulesDll = typeof(HleModulesRoot).Assembly; injectContext.SetInstanceType <ICpuConnector, HleThreadManager>(); injectContext.SetInstanceType <IGpuConnector, HleThreadManager>(); injectContext.SetInstanceType <IInterruptManager, HleInterruptManager>(); injectContext.SetInstanceType <PspMemory, FastPspMemory>(); if (!test) { // GPU PspPluginImpl.SelectWorkingPlugin <GpuImpl>(injectContext, typeof(GpuImplSoft), typeof(OpenglGpuImpl), typeof(GpuImplNull) ); // AUDIO var audioPlugins = new List <Type>(); //if (Platform.OS == OS.Windows) audioPlugins.Add(typeof(PspAudioWaveOutImpl)); //if (Platform.OS == OS.Linux) audioPlugins.Add(typeof(AudioAlsaImpl)); //audioPlugins.Add(typeof(PspAudioOpenalImpl)); audioPlugins.Add(typeof(AudioImplNull)); PspPluginImpl.SelectWorkingPlugin <PspAudioImpl>(injectContext, audioPlugins.ToArray()); } else { injectContext.SetInstanceType <GpuImpl, GpuImplNull>(); injectContext.SetInstanceType <PspAudioImpl, AudioImplNull>(); } return(injectContext); }