Beispiel #1
0
        private void ExportSupplierRadRatingValues(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator, int sponsorRadRatingBaseAddress)
        {
            const int sponsorBlockSize        = 0x00000614;
            var       sponsorMultiplier       = dataEntity.SponsorId - 1;
            var       sponsorRadRatingAddress = sponsorRadRatingBaseAddress + sponsorBlockSize * sponsorMultiplier;

            if (dataEntity.RadRatingRandom)
            {
                var radRatingRelativeSubAddress = 0x00498A5A - 0x00400C00 - (dataLocator.RadRatingInstruction + 2 + 5); // TODO: Refactor to use CalculateRelativeAddress method

                var radRatingInstructions = new List <byte>();

                radRatingInstructions.AddRange(new byte[] { 0x6A, 0x05 });                          // push    5
                radRatingInstructions.AddRange(new byte[] { 0xE8 });                                // call
                radRatingInstructions.AddRange(BitConverter.GetBytes(radRatingRelativeSubAddress)); //         sub_498A5A
                radRatingInstructions.AddRange(new byte[] { 0x83, 0xC4, 0x04 });                    // add     esp, 4
                radRatingInstructions.AddRange(new byte[] { 0x40 });                                // inc     eax
                radRatingInstructions.AddRange(new byte[] { 0xA3 });                                // mov
                radRatingInstructions.AddRange(BitConverter.GetBytes(sponsorRadRatingAddress));     //         ds:dword_XXXXXX, eax

                _dataEndpoint.GameExecutableFileResource.WriteBytes(dataLocator.RadRatingInstruction, radRatingInstructions.ToArray());
            }
            else
            {
                var radRatingInstructions = new List <byte>();

                radRatingInstructions.AddRange(new byte[] { 0xC7, 0x05 });                         // mov
                radRatingInstructions.AddRange(BitConverter.GetBytes(sponsorRadRatingAddress));    //         ds:dword_XXXXXX,
                radRatingInstructions.AddRange(BitConverter.GetBytes(dataEntity.RadRating));       //                          X
                radRatingInstructions.AddRange(new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // nop

                _dataEndpoint.GameExecutableFileResource.WriteBytes(dataLocator.RadRatingInstruction, radRatingInstructions.ToArray());
            }
        }
Beispiel #2
0
 private void ExportSponsorCashContract(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     foreach (var contract in dataEntity.Contracts)
     {
         _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.ContractCashTeamIdValue, contract.TeamId);
     }
 }
Beispiel #3
0
        private void ExportSupplierInactiveValue(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator, int sponsorInactiveBaseAddress)
        {
            const int sponsorBlockSize       = 0x00000614;
            var       sponsorMultiplier      = dataEntity.SponsorId - 1;
            var       sponsorInactiveAddress = sponsorInactiveBaseAddress + sponsorBlockSize * sponsorMultiplier;

            if (dataEntity.Inactive)
            {
                var inactiveInstructions = new List <byte>();

                inactiveInstructions.AddRange(new byte[] { 0xC7, 0x05 });                          // mov
                inactiveInstructions.AddRange(BitConverter.GetBytes(sponsorInactiveAddress));      //         ds:dword_XXXXXX,
                inactiveInstructions.AddRange(BitConverter.GetBytes(dataEntity.Inactive ? 2 : 0)); //                          X

                _dataEndpoint.GameExecutableFileResource.WriteBytes(dataLocator.InactiveInstruction, inactiveInstructions.ToArray());
            }
            else
            {
                var inactiveInstructions = new List <byte>();

                inactiveInstructions.AddRange(new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }); // nop

                _dataEndpoint.GameExecutableFileResource.WriteBytes(dataLocator.InactiveInstruction, inactiveInstructions.ToArray());
            }
        }
        private void ImportSupplierInactiveValue(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
        {
            var inactiveInstructionValue = _dataEndpoint.GameExecutableFileResource.ReadByte(dataLocator.InactiveInstruction);

            if (inactiveInstructionValue == 0xC7)
            {
                dataEntity.Inactive = true;
            }
        }
Beispiel #5
0
 private void ExportEngineAttributes(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Fuel, dataEntity.Fuel);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Heat, dataEntity.Heat);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Power, dataEntity.Power);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Reliability, dataEntity.Reliability);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Response, dataEntity.Response);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Rigidity, dataEntity.Rigidity);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Weight, dataEntity.Weight);
 }
 private void ImportEngineAttributes(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     dataEntity.Fuel        = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Fuel);
     dataEntity.Heat        = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Heat);
     dataEntity.Power       = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Power);
     dataEntity.Reliability = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Reliability);
     dataEntity.Response    = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Response);
     dataEntity.Rigidity    = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Rigidity);
     dataEntity.Weight      = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Weight);
 }
        private void ImportCashContract(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
        {
            var contract = _sponsorContractObjectFactory.Create();

            contract.SponsorId     = dataEntity.SponsorId;
            contract.SponsorTypeId = dataEntity.SponsorTypeId; // Populate from parent
            contract.Cash          = 0;                        // Leave unpopulated
            contract.TeamId        = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.ContractCashTeamIdValue);
            dataEntity.Contracts.Add(contract);
        }
        private void ImportEntityValues(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
        {
            ImportLanguageCatalogueValue(_dataEndpoint, dataEntity.Name, dataLocator.Name);

            dataEntity.SponsorId     = _identityCalculator.GetSponsorId(dataEntity.Id);
            dataEntity.SponsorTypeId = _identityCalculator.GetSponsorTypeId(dataEntity.Id);

            dataEntity.EntityTypeId   = _dataEndpoint.GameExecutableFileResource.ReadByte(dataLocator.EntityTypeValue);
            dataEntity.EntityResource = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.EntityResourceValue);
            dataEntity.EntityData     = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.EntityDataValue);
        }
 private void ImportFuelContracts(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     // Pass parameters in context of fuel suppliers
     ImportSupplierContracts(
         dataEntity,
         0x007ED31C,
         SponsorDataLocator.ContractFuelLocalOffset,
         dataLocator.ContractFuelTeamIdAddress,
         dataLocator.ContractFuelTeamIdValue,
         dataLocator.ContractFuelDealIdTeamValue,
         dataLocator.ContractFuelTermsIdTeamValue);
 }
 private void ImportTyreContracts(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     // Pass parameters in context of tyre suppliers
     ImportSupplierContracts(
         dataEntity,
         0x007E9040,
         SponsorDataLocator.ContractTyreLocalOffset,
         dataLocator.ContractTyreTeamIdAddress,
         dataLocator.ContractTyreTeamIdValue,
         dataLocator.ContractTyreDealIdTeamValue,
         dataLocator.ContractTyreTermsIdTeamValue);
 }
        private void ImportSupplierRadRatingValues(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
        {
            var radRatingInstructionValue = _dataEndpoint.GameExecutableFileResource.ReadByte(dataLocator.RadRatingInstruction);

            if (radRatingInstructionValue == 0x6A)
            {
                dataEntity.RadRatingRandom = true;
            }
            else
            {
                dataEntity.RadRating = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.RadRatingValue);
            }
        }
 private void ImportTyreAttributes(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     dataEntity.DryHardGrip             = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DryHardGripSupplier);
     dataEntity.DryHardResilience       = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DryHardResilienceSupplier);
     dataEntity.DryHardStiffness        = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DryHardStiffnessSupplier);
     dataEntity.DryHardTemperature      = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DryHardTemperatureSupplier);
     dataEntity.DrySoftGrip             = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DrySoftGripSupplier);
     dataEntity.DrySoftResilience       = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DrySoftResilienceSupplier);
     dataEntity.DrySoftStiffness        = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DrySoftStiffnessSupplier);
     dataEntity.DrySoftTemperature      = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.DrySoftTemperatureSupplier);
     dataEntity.IntermediateGrip        = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.IntermediateGripSupplier);
     dataEntity.IntermediateResilience  = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.IntermediateResilienceSupplier);
     dataEntity.IntermediateStiffness   = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.IntermediateStiffnessSupplier);
     dataEntity.IntermediateTemperature = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.IntermediateTemperatureSupplier);
     dataEntity.WetWeatherGrip          = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.WetWeatherGripSupplier);
     dataEntity.WetWeatherResilience    = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.WetWeatherResilienceSupplier);
     dataEntity.WetWeatherStiffness     = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.WetWeatherStiffnessSupplier);
     dataEntity.WetWeatherTemperature   = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.WetWeatherTemperatureSupplier);
 }
Beispiel #13
0
 private void ExportFuelContracts(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     ExportSupplierContracts(
         dataEntity,
         0x007ED31C,
         0x007ED3FC,
         0x007ED13C,
         0x01205648,
         0x0120561C,
         SponsorDataLocator.ContractFuelLocalOffset,
         dataLocator.ContractFuelTeamIdAddress,
         dataLocator.ContractFuelTeamIdValue,
         dataLocator.ContractFuelDealIdSponsorAddress,
         dataLocator.ContractFuelDealIdSponsorValue,
         dataLocator.ContractFuelDealIdTeamAddress,
         dataLocator.ContractFuelDealIdTeamValue,
         dataLocator.ContractFuelTermsIdSponsorAddress,
         dataLocator.ContractFuelTermsIdSponsorValue,
         dataLocator.ContractFuelTermsIdTeamAddress,
         dataLocator.ContractFuelTermsIdTeamValue);
 }
Beispiel #14
0
 private void ExportTyreContracts(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     ExportSupplierContracts(
         dataEntity,
         0x007E9040,
         0x007E9120,
         0x007E8E60,
         0x01205644,
         0x01205618,
         SponsorDataLocator.ContractTyreLocalOffset,
         dataLocator.ContractTyreTeamIdAddress,
         dataLocator.ContractTyreTeamIdValue,
         dataLocator.ContractTyreDealIdSponsorAddress,
         dataLocator.ContractTyreDealIdSponsorValue,
         dataLocator.ContractTyreDealIdTeamAddress,
         dataLocator.ContractTyreDealIdTeamValue,
         dataLocator.ContractTyreTermsIdSponsorAddress,
         dataLocator.ContractTyreTermsIdSponsorValue,
         dataLocator.ContractTyreTermsIdTeamAddress,
         dataLocator.ContractTyreTermsIdTeamValue);
 }
Beispiel #15
0
 private void ExportEngineContracts(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     ExportSupplierContracts(
         dataEntity,
         0x007EA27C,
         0x007EA35C,
         0x007EA09C,
         0x01205640,
         0x01205614,
         SponsorDataLocator.ContractEngineLocalOffset,
         dataLocator.ContractEngineTeamIdAddress,
         dataLocator.ContractEngineTeamIdValue,
         dataLocator.ContractEngineDealIdSponsorAddress,
         dataLocator.ContractEngineDealIdSponsorValue,
         dataLocator.ContractEngineDealIdTeamAddress,
         dataLocator.ContractEngineDealIdTeamValue,
         dataLocator.ContractEngineTermsIdSponsorAddress,
         dataLocator.ContractEngineTermsIdSponsorValue,
         dataLocator.ContractEngineTermsIdTeamAddress,
         dataLocator.ContractEngineTermsIdTeamValue);
 }
Beispiel #16
0
        private void ExportTyreAttributes(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
        {
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardGripSupplier, dataEntity.DryHardGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardResilienceSupplier, dataEntity.DryHardResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardStiffnessSupplier, dataEntity.DryHardStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardTemperatureSupplier, dataEntity.DryHardTemperature);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftGripSupplier, dataEntity.DrySoftGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftResilienceSupplier, dataEntity.DrySoftResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftStiffnessSupplier, dataEntity.DrySoftStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftTemperatureSupplier, dataEntity.DrySoftTemperature);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateGripSupplier, dataEntity.IntermediateGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateResilienceSupplier, dataEntity.IntermediateResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateStiffnessSupplier, dataEntity.IntermediateStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateTemperatureSupplier, dataEntity.IntermediateTemperature);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherGripSupplier, dataEntity.WetWeatherGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherResilienceSupplier, dataEntity.WetWeatherResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherStiffnessSupplier, dataEntity.WetWeatherStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherTemperatureSupplier, dataEntity.WetWeatherTemperature);

            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardGripTeam, dataEntity.DryHardGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardResilienceTeam, dataEntity.DryHardResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardStiffnessTeam, dataEntity.DryHardStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DryHardTemperatureTeam, dataEntity.DryHardTemperature);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftGripTeam, dataEntity.DrySoftGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftResilienceTeam, dataEntity.DrySoftResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftStiffnessTeam, dataEntity.DrySoftStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.DrySoftTemperatureTeam, dataEntity.DrySoftTemperature);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateGripTeam, dataEntity.IntermediateGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateResilienceTeam, dataEntity.IntermediateResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateStiffnessTeam, dataEntity.IntermediateStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.IntermediateTemperatureTeam, dataEntity.IntermediateTemperature);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherGripTeam, dataEntity.WetWeatherGrip);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherResilienceTeam, dataEntity.WetWeatherResilience);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherStiffnessTeam, dataEntity.WetWeatherStiffness);
            _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.WetWeatherTemperatureTeam, dataEntity.WetWeatherTemperature);
        }
 private void ImportSponsorCashRatingValue(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     dataEntity.CashRating = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.CashRatingValue);
 }
Beispiel #18
0
 private void ExportSponsorCashRatingValue(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     _dataEndpoint.GameExecutableFileResource.WriteBytes(dataLocator.CashRatingValue, BitConverter.GetBytes(dataEntity.CashRating));
 }
Beispiel #19
0
 private void ExportEntityValues(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     ExportLanguageCatalogueValue(_dataEndpoint, dataEntity.Name, dataLocator.Name);
 }
Beispiel #20
0
 private void ExportFuelAttributes(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Performance, dataEntity.Performance);
     _dataEndpoint.GameExecutableFileResource.WriteInteger(dataLocator.Tolerance, dataEntity.Tolerance);
 }
 private void ImportFuelAttributes(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
 {
     dataEntity.Performance = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Performance);
     dataEntity.Tolerance   = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.Tolerance);
 }