protected override void OnExiting(object sender, EventArgs args) { base.OnExiting(sender, args); var kernel = FSOFacade.Kernel; if (kernel != null) { kernel.Get <LotConnectionRegulator>()?.Disconnect(); kernel.Get <CityConnectionRegulator>()?.Disconnect(); } GameThread.SetKilled(); }
static void Main(string[] args) { FSO.Windows.Program.InitWindows(); TimedReferenceController.SetMode(CacheType.PERMANENT); Console.WriteLine("Loading Config..."); try { var configString = File.ReadAllText("facadeconfig.json"); Config = Newtonsoft.Json.JsonConvert.DeserializeObject <FacadeConfig>(configString); } catch (Exception e) { Console.WriteLine("Could not find configuration file 'facadeconfig.json'. Please ensure it is valid and present in the same folder as this executable."); return; } Console.WriteLine("Locating The Sims Online..."); string baseDir = AppDomain.CurrentDomain.BaseDirectory; Directory.SetCurrentDirectory(baseDir); //Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; ILocator gameLocator; bool linux = pid == PlatformID.MacOSX || pid == PlatformID.Unix; if (linux && Directory.Exists("/Users")) { gameLocator = new MacOSLocator(); } else if (linux) { gameLocator = new LinuxLocator(); } else { gameLocator = new WindowsLocator(); } bool useDX = true; FSOEnvironment.Enable3D = true; GraphicsModeControl.ChangeMode(FSO.LotView.Model.GlobalGraphicsMode.Full3D); GameThread.NoGame = true; GameThread.UpdateExecuting = true; var path = Config.Game_Path ?? gameLocator.FindTheSimsOnline(); if (path != null) { FSOEnvironment.ContentDir = "Content/"; FSOEnvironment.GFXContentDir = "Content/" + (useDX ? "DX/" : "OGL/"); FSOEnvironment.Linux = linux; FSOEnvironment.DirectX = useDX; FSOEnvironment.TexCompress = FSOEnvironment.TexCompressSupport; FSOEnvironment.GameThread = Thread.CurrentThread; FSO.HIT.HITVM.Init(); FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.AMBIENCE, 0); FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.FX, 0); FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.MUSIC, 0); FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.VOX, 0); FSO.Files.Formats.IFF.Chunks.STR.DefaultLangCode = FSO.Files.Formats.IFF.Chunks.STRLangCode.EnglishUS; } Console.WriteLine("Creating Graphics Device..."); var gds = new GraphicsDeviceServiceMock(); var gd = gds.GraphicsDevice; //set up some extra stuff like the content manager var services = new GameServiceContainer(); var content = new ContentManager(services); content.RootDirectory = FSOEnvironment.GFXContentDir; services.AddService <IGraphicsDeviceService>(gds); var vitaboyEffect = content.Load <Effect>("Effects/Vitaboy"); FSO.Vitaboy.Avatar.setVitaboyEffect(vitaboyEffect); WorldConfig.Current = new WorldConfig() { LightingMode = 3, SmoothZoom = true, SurroundingLots = 0 }; DGRP3DMesh.Sync = true; Console.WriteLine("Looks like that worked. Loading FSO Content!"); VMContext.InitVMConfig(false); Content.Init(path, gd); WorldContent.Init(services, content.RootDirectory); VMAmbientSound.ForceDisable = true; Layer = new _3DLayer(); Layer.Initialize(gd); GD = gd; if (args.FirstOrDefault() == "debug") { DebugLot = uint.Parse(args[1]); } Console.WriteLine("Starting Worker Loop!"); WorkerLoop(); Console.WriteLine("Exiting."); GameThread.SetKilled(); gds.Release(); }
protected override void OnExiting(object sender, EventArgs args) { base.OnExiting(sender, args); GameThread.SetKilled(); }