Esempio n. 1
0
        public static void Main(IntPtr serverPointer, IntPtr resourcePointer, string resourceName, string entryPoint)
        {
            _resource = new ResourceLoader(serverPointer, resourceName, entryPoint).Init();
            if (_resource == null)
            {
                return;
            }

            var playerFactory       = _resource.GetPlayerFactory();
            var vehicleFactory      = _resource.GetVehicleFactory();
            var blipFactory         = _resource.GetBlipFactory();
            var checkpointFactory   = _resource.GetCheckpointFactory();
            var voiceChannelFactory = _resource.GetVoiceChannelFactory();
            var playerPool          = _resource.GetPlayerPool(playerFactory);
            var vehiclePool         = _resource.GetVehiclePool(vehicleFactory);
            var blipPool            = _resource.GetBlipPool(blipFactory);
            var checkpointPool      = _resource.GetCheckpointPool(checkpointFactory);
            var voiceChannelPool    = _resource.GetVoiceChannelPool(voiceChannelFactory);
            var entityPool          = _resource.GetBaseEntityPool(playerPool, vehiclePool);
            var baseObjectPool      = _resource.GetBaseBaseObjectPool(playerPool, vehiclePool, blipPool, checkpointPool, voiceChannelPool);
            var server = new Server(serverPointer, baseObjectPool, entityPool, playerPool, vehiclePool, blipPool,
                                    checkpointPool, voiceChannelPool);
            var csharpResource = new CSharpNativeResource(resourcePointer);

            _module = _resource.GetModule(server, csharpResource, baseObjectPool, entityPool, playerPool, vehiclePool,
                                          blipPool, checkpointPool, voiceChannelPool);
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            _resource.OnStart();
        }
Esempio n. 2
0
 public virtual Module GetModule(IServer server, CSharpNativeResource cSharpNativeResource,
                                 IBaseBaseObjectPool baseBaseObjectPool,
                                 IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool, IEntityPool <IVehicle> vehiclePool,
                                 IBaseObjectPool <IBlip> blipPool,
                                 IBaseObjectPool <ICheckpoint> checkpointPool, IBaseObjectPool <IVoiceChannel> voiceChannelPool)
 {
     return(new Module(server, cSharpNativeResource, baseBaseObjectPool, baseEntityPool, playerPool, vehiclePool,
                       blipPool, checkpointPool, voiceChannelPool));
 }
Esempio n. 3
0
 public Module(IServer server, CSharpNativeResource cSharpNativeResource, IBaseBaseObjectPool baseBaseObjectPool,
               IBaseEntityPool baseEntityPool, IEntityPool <IPlayer> playerPool,
               IEntityPool <IVehicle> vehiclePool,
               IBaseObjectPool <IBlip> blipPool,
               IBaseObjectPool <ICheckpoint> checkpointPool,
               IBaseObjectPool <IVoiceChannel> voiceChannelPool)
 {
     Alt.Init(this);
     Server = server;
     CSharpNativeResource = cSharpNativeResource;
     BaseBaseObjectPool   = baseBaseObjectPool;
     BaseEntityPool       = baseEntityPool;
     PlayerPool           = playerPool;
     VehiclePool          = vehiclePool;
     BlipPool             = blipPool;
     CheckpointPool       = checkpointPool;
     VoiceChannelPool     = voiceChannelPool;
 }
Esempio n. 4
0
        public static void MainWithResource(IntPtr serverPointer, IntPtr resourcePointer, IResource resource,
                                            AssemblyLoadContext assemblyLoadContext)
        {
            _resource = resource;
            if (_resource == null)
            {
                return;
            }

            var playerFactory       = _resource.GetPlayerFactory();
            var vehicleFactory      = _resource.GetVehicleFactory();
            var blipFactory         = _resource.GetBlipFactory();
            var checkpointFactory   = _resource.GetCheckpointFactory();
            var voiceChannelFactory = _resource.GetVoiceChannelFactory();
            var colShapeFactory     = _resource.GetColShapeFactory();
            var playerPool          = _resource.GetPlayerPool(playerFactory);
            var vehiclePool         = _resource.GetVehiclePool(vehicleFactory);
            var blipPool            = _resource.GetBlipPool(blipFactory);
            var checkpointPool      = _resource.GetCheckpointPool(checkpointFactory);
            var voiceChannelPool    = _resource.GetVoiceChannelPool(voiceChannelFactory);
            var colShapePool        = _resource.GetColShapePool(colShapeFactory);
            var entityPool          = _resource.GetBaseEntityPool(playerPool, vehiclePool);
            var baseObjectPool      =
                _resource.GetBaseBaseObjectPool(playerPool, vehiclePool, blipPool, checkpointPool, voiceChannelPool,
                                                colShapePool);
            var csharpResource = new CSharpNativeResource(resourcePointer);
            var server         = new Server(serverPointer, csharpResource, baseObjectPool, entityPool, playerPool, vehiclePool, blipPool,
                                            checkpointPool, voiceChannelPool, colShapePool);

            _module = _resource.GetModule(server, assemblyLoadContext, csharpResource, baseObjectPool, entityPool,
                                          playerPool, vehiclePool,
                                          blipPool, checkpointPool, voiceChannelPool, colShapePool);

            foreach (var unused in server.GetPlayers())
            {
            }

            foreach (var unused in server.GetVehicles())
            {
            }

            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
        }
Esempio n. 5
0
        public Server(IntPtr nativePointer, CSharpNativeResource resource, IBaseBaseObjectPool baseBaseObjectPool, IBaseEntityPool baseEntityPool,
                      IEntityPool <IPlayer> playerPool,
                      IEntityPool <IVehicle> vehiclePool,
                      IBaseObjectPool <IBlip> blipPool,
                      IBaseObjectPool <ICheckpoint> checkpointPool,
                      IBaseObjectPool <IVoiceChannel> voiceChannelPool,
                      IBaseObjectPool <IColShape> colShapePool)
        {
            NativePointer           = nativePointer;
            this.baseBaseObjectPool = baseBaseObjectPool;
            this.baseEntityPool     = baseEntityPool;
            this.playerPool         = playerPool;
            this.vehiclePool        = vehiclePool;
            this.blipPool           = blipPool;
            this.checkpointPool     = checkpointPool;
            this.voiceChannelPool   = voiceChannelPool;
            this.colShapePool       = colShapePool;
            var ptr = IntPtr.Zero;

            AltNative.Server.Server_GetRootDirectory(nativePointer, ref ptr);
            RootDirectory = Marshal.PtrToStringUTF8(ptr);
            Resource      = resource;
        }