コード例 #1
0
        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;
            GameThread.NoGame          = true;
            GameThread.UpdateExecuting = true;

            var path = gameLocator.FindTheSimsOnline();

            if (path != null)
            {
                FSOEnvironment.ContentDir    = "Content/";
                FSOEnvironment.GFXContentDir = "Content/" + (useDX ? "DX/" : "OGL/");
                FSOEnvironment.Linux         = linux;
                FSOEnvironment.DirectX       = useDX;
                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;

            Console.WriteLine("Starting Worker Loop!");
            WorkerLoop();

            Console.WriteLine("Exiting.");
            GameThread.Killed = true;
            GameThread.OnKilled.Set();
            gds.Release();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            FSO.Windows.Program.InitWindows();
            TimedReferenceController.SetMode(CacheType.PERMANENT);

            Console.WriteLine("Loading Config...");
            _config = FacadeConfig.Default;

            Console.WriteLine("Locating The Sims Online...");
            string baseDir = AppDomain.CurrentDomain.BaseDirectory;

            Directory.SetCurrentDirectory(baseDir);
            //Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

            var os    = Environment.OSVersion;
            var pid   = os.Platform;
            var linux = pid == PlatformID.MacOSX || pid == PlatformID.Unix;

            bool useDX = true;

            FSOEnvironment.Enable3D    = false;
            GameThread.NoGame          = true;
            GameThread.UpdateExecuting = true;

            var path = Pathfinder.GamePath;

            if (path != null)
            {
                FSOEnvironment.ContentDir    = "Content/";
                FSOEnvironment.GFXContentDir = "Content/" + (useDX ? "DX/" : "OGL/");
                FSOEnvironment.Linux         = linux;
                FSOEnvironment.DirectX       = useDX;
                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)
            {
                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;

            Console.WriteLine("Starting Worker Loop!");
            WorkerLoop();

            Console.WriteLine("Exiting.");
            GameThread.Killed = true;
            GameThread.OnKilled.Set();
            gds.Release();
        }