Exemple #1
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, ResourceId, ResourceText);
     executableConnection.WriteInteger(_valueMapping.Laps, Laps);
     executableConnection.WriteInteger(_valueMapping.Design, Design);
     executableConnection.WriteInteger(_valueMapping.LapRecordDriver, LapRecordDriver);
     executableConnection.WriteInteger(_valueMapping.LapRecordTeam, LapRecordTeam);
     executableConnection.WriteInteger(_valueMapping.LapRecordTime, LapRecordTime);
     executableConnection.WriteInteger(_valueMapping.LapRecordMph, LapRecordMph);
     executableConnection.WriteInteger(_valueMapping.LapRecordYear, LapRecordYear);
     executableConnection.WriteInteger(_valueMapping.LastRaceDriver, LastRaceDriver);
     executableConnection.WriteInteger(_valueMapping.LastRaceTeam, LastRaceTeam);
     executableConnection.WriteInteger(_valueMapping.LastRaceYear, LastRaceYear);
     executableConnection.WriteInteger(_valueMapping.LastRaceTime, LastRaceTime);
     executableConnection.WriteInteger(_valueMapping.Hospitality, Hospitality);
     executableConnection.WriteInteger(_valueMapping.Speed, Speed);
     executableConnection.WriteInteger(_valueMapping.Grip, Grip);
     executableConnection.WriteInteger(_valueMapping.Surface, Surface);
     executableConnection.WriteInteger(_valueMapping.Tarmac, Tarmac);
     executableConnection.WriteInteger(_valueMapping.Dust, Dust);
     executableConnection.WriteInteger(_valueMapping.Overtaking, Overtaking);
     executableConnection.WriteInteger(_valueMapping.Braking, Braking);
     executableConnection.WriteInteger(_valueMapping.Rain, Rain);
     executableConnection.WriteInteger(_valueMapping.Heat, Heat);
     executableConnection.WriteInteger(_valueMapping.Wind, Wind);
 }
 private void ExportPerformanceCurve(string gameExecutablePath)
 {
     using (var executableConnection = new ExecutableConnection(gameExecutablePath))
     {
         PerformanceCurve.ExportData(executableConnection, LanguageResources);
     }
 }
Exemple #3
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText    = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     Laps            = executableConnection.ReadInteger(_valueMapping.Laps);
     Design          = executableConnection.ReadInteger(_valueMapping.Design);
     LapRecordDriver = executableConnection.ReadInteger(_valueMapping.LapRecordDriver);
     LapRecordTeam   = executableConnection.ReadInteger(_valueMapping.LapRecordTeam);
     LapRecordTime   = executableConnection.ReadInteger(_valueMapping.LapRecordTime);
     LapRecordMph    = executableConnection.ReadInteger(_valueMapping.LapRecordMph);
     LapRecordYear   = executableConnection.ReadInteger(_valueMapping.LapRecordYear);
     LastRaceDriver  = executableConnection.ReadInteger(_valueMapping.LastRaceDriver);
     LastRaceTeam    = executableConnection.ReadInteger(_valueMapping.LastRaceTeam);
     LastRaceYear    = executableConnection.ReadInteger(_valueMapping.LastRaceYear);
     LastRaceTime    = executableConnection.ReadInteger(_valueMapping.LastRaceTime);
     Hospitality     = executableConnection.ReadInteger(_valueMapping.Hospitality);
     Speed           = executableConnection.ReadInteger(_valueMapping.Speed);
     Grip            = executableConnection.ReadInteger(_valueMapping.Grip);
     Surface         = executableConnection.ReadInteger(_valueMapping.Surface);
     Tarmac          = executableConnection.ReadInteger(_valueMapping.Tarmac);
     Dust            = executableConnection.ReadInteger(_valueMapping.Dust);
     Overtaking      = executableConnection.ReadInteger(_valueMapping.Overtaking);
     Braking         = executableConnection.ReadInteger(_valueMapping.Braking);
     Rain            = executableConnection.ReadInteger(_valueMapping.Rain);
     Heat            = executableConnection.ReadInteger(_valueMapping.Heat);
     Wind            = executableConnection.ReadInteger(_valueMapping.Wind);
 }
Exemple #4
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     Ability      = executableConnection.ReadInteger(_valueMapping.Ability);
     Age          = executableConnection.ReadInteger(_valueMapping.Age);
     Salary       = executableConnection.ReadInteger(_valueMapping.Salary);
     Royalty      = executableConnection.ReadInteger(_valueMapping.Royalty);
 }
Exemple #5
0
        private const int GameYear201201Offset = 0x005A1CEE - 0x00400C00;     // Calendar logic            (0x001A10EE)

        public int GetGameYear(string gameExecutableFilePath)
        {
            using (var executableConnection = new ExecutableConnection(gameExecutableFilePath))
            {
                var result = executableConnection.ReadInteger(GameYear199801Offset);
                return(result);
            }
        }
Exemple #6
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, ResourceId, ResourceText);
     executableConnection.WriteInteger(_valueMapping.Ability, Ability);
     executableConnection.WriteInteger(_valueMapping.Age, Age);
     executableConnection.WriteInteger(_valueMapping.Salary, Salary);
     executableConnection.WriteInteger(_valueMapping.Royalty, Royalty);
 }
Exemple #7
0
        public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
        {
            var valueMapping = new Mapping.PerformanceCurve();

            for (var i = 0; i < Values.Length; i++)
            {
                Values[i] = executableConnection.ReadInteger(valueMapping.Values[i]);
            }
        }
Exemple #8
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, ResourceId, ResourceText);
     executableConnection.WriteInteger(_valueMapping.Ability, Ability);
     executableConnection.WriteInteger(_valueMapping.Age, Age);
     executableConnection.WriteInteger(_valueMapping.Salary, Salary);
     executableConnection.WriteInteger(_valueMapping.Royalty, Royalty);
     executableConnection.WriteInteger(_valueMapping.Morale, Morale.ConvertToTwentyToHundredStepTwenty());
 }
Exemple #9
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, _valueMapping.Name.BuildResourceId(), ResourceText);
     executableConnection.WriteInteger(_valueMapping.Value01, Value01);
     executableConnection.WriteInteger(_valueMapping.Value02, Value02);
     executableConnection.WriteInteger(_valueMapping.Value03, Value03);
     executableConnection.WriteInteger(_valueMapping.Value04, Value04);
     executableConnection.WriteInteger(_valueMapping.Value05, Value05);
 }
Exemple #10
0
 public virtual void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText = ResourceHelper.GetResourceText(identityCollection, _valueMapping.Name.BuildResourceId());
     Value01      = executableConnection.ReadInteger(_valueMapping.Value01);
     Value02      = executableConnection.ReadInteger(_valueMapping.Value02);
     Value03      = executableConnection.ReadInteger(_valueMapping.Value03);
     Value04      = executableConnection.ReadInteger(_valueMapping.Value04);
     Value05      = executableConnection.ReadInteger(_valueMapping.Value05);
 }
Exemple #11
0
        // ReSharper disable once InconsistentNaming
        private void ApplyRelocatedFunctionAt4718EA()
        {
            const int relocationAddress = 0x004718EA;

            // Open file and write
            using (var executableConnection = new ExecutableConnection(_executableFilePath))
            {
                WriteNewBytes(executableConnection, relocationAddress, RelocatedFunctionAt4718EA.GetInstructions());
            }
        }
Exemple #12
0
        private void ApplyRelocatedFunctionAt401000(string gameExecutableFilePath)
        {
            const int relocationAddress = 0x00401000;

            // Open file and write
            using (var executableConnection = new ExecutableConnection(gameExecutableFilePath))
            {
                WriteNewBytes(executableConnection, relocationAddress, RelocatedFunctionAt401000.GetInstructions());
            }
        }
Exemple #13
0
 protected void ImportData <T>(string gameExecutablePath, IEnumerable <T> collection) where T : IDataConnection
 {
     using (var executableConnection = new ExecutableConnection(gameExecutablePath))
     {
         foreach (var item in collection)
         {
             item.ImportData(executableConnection, LanguageResources);
         }
     }
 }
Exemple #14
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     Fuel         = executableConnection.ReadInteger(_valueMapping.Fuel);
     Heat         = executableConnection.ReadInteger(_valueMapping.Heat);
     Power        = executableConnection.ReadInteger(_valueMapping.Power);
     Reliability  = executableConnection.ReadInteger(_valueMapping.Reliability);
     Response     = executableConnection.ReadInteger(_valueMapping.Response);
     Rigidity     = executableConnection.ReadInteger(_valueMapping.Rigidity);
     Weight       = executableConnection.ReadInteger(_valueMapping.Weight);
 }
Exemple #15
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText      = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     Age               = executableConnection.ReadInteger(_valueMapping.Age);
     Ability           = executableConnection.ReadInteger(_valueMapping.Ability);
     Salary            = executableConnection.ReadInteger(_valueMapping.Salary);
     RaceBonus         = executableConnection.ReadInteger(_valueMapping.RaceBonus);
     ChampionshipBonus = executableConnection.ReadInteger(_valueMapping.ChampionshipBonus);
     DriverLoyalty     = executableConnection.ReadInteger(_valueMapping.DriverLoyalty);
     Morale            = executableConnection.ReadInteger(_valueMapping.Morale).ConvertToOneToFiveStepOne();
 }
Exemple #16
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, ResourceId, ResourceText);
     executableConnection.WriteInteger(_valueMapping.Fuel, Fuel);
     executableConnection.WriteInteger(_valueMapping.Heat, Heat);
     executableConnection.WriteInteger(_valueMapping.Power, Power);
     executableConnection.WriteInteger(_valueMapping.Reliability, Reliability);
     executableConnection.WriteInteger(_valueMapping.Response, Response);
     executableConnection.WriteInteger(_valueMapping.Rigidity, Rigidity);
     executableConnection.WriteInteger(_valueMapping.Weight, Weight);
 }
Exemple #17
0
 private void ApplyCode(IEnumerable <DataPatcherUnitTask> instructionTasks)
 {
     using (var executableConnection = new ExecutableConnection(_executableFilePath))
     {
         foreach (var instructionTask in instructionTasks)
         {
             var realPosition = InstructionHelper.CalculateRealPositionFromVirtualPosition(instructionTask.VirtualPosition);
             Debug.WriteLine($"Executing task {instructionTask.TaskId:D2} at location {instructionTask.VirtualPosition:X8} ({realPosition:X8})");
             executableConnection.WriteByteArray(realPosition, instructionTask.Instructions);
         }
     }
 }
Exemple #18
0
        private static void ClearExistingBytes(ExecutableConnection executableConnection, int address, int length)
        {
            // Create byte array
            var clearByteArray = new byte[length];

            for (var i = 0; i < clearByteArray.Length; i++)
            {
                clearByteArray[i] = 0xCC; // Fill array with int3 opcode
            }

            // Write byte array
            executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(address), clearByteArray);
        }
        public void Apply()
        {
            var firstByte = 0x0047141F;
            var lastByte  = 0x00478F18;

            // Open file and write
            using (var executableConnection = new ExecutableConnection(_executableFilePath))
            {
                // Create byte array of NOPs
                var nopInstructions = new byte[lastByte + 1 - firstByte];
                for (var i = 0; i < nopInstructions.Length; i++)
                {
                    nopInstructions[i] = 0x90;
                }

                // Write byte array of NOPs
                executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte), nopInstructions);

                // Get the data-laden instructions
                var teamInstructions      = TeamData.GetInstructions();
                var personnelInstructions = PersonnelData.GetInstructions();
                var driverInstructions    = DriverData.GetInstructions();

                // Write instructions
                var writePosition = InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte);
                executableConnection.WriteByteArray(writePosition, teamInstructions);
                writePosition += teamInstructions.Length;
                executableConnection.WriteByteArray(writePosition, personnelInstructions);
                writePosition += personnelInstructions.Length;
                executableConnection.WriteByteArray(writePosition, driverInstructions);

                // Apply track changes
                firstByte = 0x005031C6;
                lastByte  = 0x00503EE5;

                // Create byte array of NOPs
                var nopTrackInstructions = new byte[lastByte + 1 - firstByte];
                for (var i = 0; i < nopTrackInstructions.Length; i++)
                {
                    nopTrackInstructions[i] = 0x90;
                }

                // Write byte array of NOPs
                executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte), nopTrackInstructions);

                // Get the data-laden instructions
                var trackInstructions = TrackData.GetInstructions();
                writePosition = InstructionHelper.CalculateRealPositionFromVirtualPosition(firstByte);
                executableConnection.WriteByteArray(writePosition, trackInstructions);
            }
        }
Exemple #20
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, ResourceId, ResourceText);
     executableConnection.WriteInteger(_valueMapping.LastPosition, LastPosition);
     executableConnection.WriteInteger(_valueMapping.LastPoints, LastPoints);
     executableConnection.WriteInteger(_valueMapping.FirstGpTrack, FirstGpTrack);
     executableConnection.WriteInteger(_valueMapping.FirstGpYear, FirstGpYear);
     executableConnection.WriteInteger(_valueMapping.Wins, Wins);
     executableConnection.WriteInteger(_valueMapping.YearlyBudget, YearlyBudget);
     executableConnection.WriteInteger(_valueMapping.Unknown, Unknown);
     executableConnection.WriteInteger(_valueMapping.CountryMapId, CountryMapId);
     executableConnection.WriteInteger(_valueMapping.LocationPointerX, LocationPointerX);
     executableConnection.WriteInteger(_valueMapping.LocationPointerY, LocationPointerY);
     executableConnection.WriteInteger(_valueMapping.TyreSupplierId, TyreSupplierId);
 }
Exemple #21
0
        private void ApplyReconstructedFunctionAt4E7A25(string gameExecutableFilePath)
        {
            const int firstByteAddress = 0x004E7A25;
            const int lastByteAddress  = 0x004EA3EF;

            const int address = firstByteAddress;
            const int length  = lastByteAddress + 1 - firstByteAddress;

            // Open file and write
            using (var executableConnection = new ExecutableConnection(gameExecutableFilePath))
            {
                ClearExistingBytes(executableConnection, address, length);
                WriteNewBytes(executableConnection, address, _reconstructedFunctionAt4E7A25.GetInstructions());
            }
        }
Exemple #22
0
        private void ApplyReconstructedFunctionAt4706D7()
        {
            const int firstByteAddress = 0x004706D7;
            const int lastByteAddress  = 0x004793DE;

            const int address = firstByteAddress;
            const int length  = lastByteAddress + 1 - firstByteAddress;

            // Open file and write
            using (var executableConnection = new ExecutableConnection(_executableFilePath))
            {
                ClearExistingBytes(executableConnection, address, length);
                WriteNewBytes(executableConnection, address, ReconstructedFunctionAt4706D7.GetInstructions());
            }
        }
Exemple #23
0
        private void ApplyReorderedModuleAt5031C6()
        {
            const int firstByteAddress = 0x005031C6;
            const int lastByteAddress  = 0x00503EE5;

            const int address = firstByteAddress;
            const int length  = lastByteAddress + 1 - firstByteAddress;

            // Open file and write
            using (var executableConnection = new ExecutableConnection(_executableFilePath))
            {
                ClearExistingBytes(executableConnection, address, length);
                WriteNewBytes(executableConnection, address, ReorderedModuleAt5031C6.GetInstructions());
            }
        }
Exemple #24
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText     = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     LastPosition     = executableConnection.ReadInteger(_valueMapping.LastPosition);
     LastPoints       = executableConnection.ReadInteger(_valueMapping.LastPoints);
     FirstGpTrack     = executableConnection.ReadInteger(_valueMapping.FirstGpTrack);
     FirstGpYear      = executableConnection.ReadInteger(_valueMapping.FirstGpYear);
     Wins             = executableConnection.ReadInteger(_valueMapping.Wins);
     YearlyBudget     = executableConnection.ReadInteger(_valueMapping.YearlyBudget);
     Unknown          = executableConnection.ReadInteger(_valueMapping.Unknown);
     CountryMapId     = executableConnection.ReadInteger(_valueMapping.CountryMapId);
     LocationPointerX = executableConnection.ReadInteger(_valueMapping.LocationPointerX);
     LocationPointerY = executableConnection.ReadInteger(_valueMapping.LocationPointerY);
     TyreSupplierId   = executableConnection.ReadInteger(_valueMapping.TyreSupplierId);
 }
Exemple #25
0
        private bool AreInstructionTasksEqual(IEnumerable <DataPatcherUnitTask> instructionTasks)
        {
            using (var executableConnection = new ExecutableConnection(_executableFilePath))
            {
                foreach (var instructionTask in instructionTasks)
                {
                    var realPosition        = InstructionHelper.CalculateRealPositionFromVirtualPosition(instructionTask.VirtualPosition);
                    var currentInstructions = executableConnection.ReadByteArray(realPosition, instructionTask.Instructions.Length);

#if DEBUG
                    var virtualPosition = instructionTask.VirtualPosition;
                    Debug.WriteLine($"Evaluating task {instructionTask.TaskId:D2} at location {virtualPosition:X8} ({realPosition:X8})");

                    // If current instructions (file) do not equal task instructions (code)
                    var debugStringCollection = new StringCollection();
                    for (var i = 0; i < currentInstructions.Count(); i++)
                    {
                        if (currentInstructions[i].Equals(instructionTask.Instructions[i]))
                        {
                            continue;
                        }

                        var debugVirtualPosition = virtualPosition + i;
                        var debugRealPosition    = realPosition + i;

                        debugStringCollection.Add($"Mismatch at location {debugVirtualPosition:X8} ({debugRealPosition:X8}) at byte index {i:X8}. Value {currentInstructions[i]:X2} vs. {instructionTask.Instructions[i]:X2} (File vs. Code).");
                    }
                    if (debugStringCollection.Count > 0)
                    {
                        Debug.WriteLine("WARNING - Instructions in code are not equal to instructions in file.");
                        foreach (var line in debugStringCollection)
                        {
                            Debug.WriteLine(line);
                        }
                        return(false);
                    }
#else
                    // If current instructions (file) do not equal task instructions (code)
                    if (!currentInstructions.SequenceEqual(instructionTask.Instructions))
                    {
                        return(false);
                    }
#endif
                }

                return(true);
            }
        }
Exemple #26
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText      = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     Salary            = executableConnection.ReadInteger(_valueMapping.Salary);
     RaceBonus         = executableConnection.ReadInteger(_valueMapping.RaceBonus);
     ChampionshipBonus = executableConnection.ReadInteger(_valueMapping.ChampionshipBonus);
     Age             = executableConnection.ReadInteger(_valueMapping.Age);
     Nationality     = executableConnection.ReadInteger(_valueMapping.Nationality);
     Unknown         = executableConnection.ReadInteger(_valueMapping.Unknown);
     CommentaryIndex = executableConnection.ReadInteger(_valueMapping.CommentaryIndex);
     Speed           = executableConnection.ReadInteger(_valueMapping.Speed);
     Skill           = executableConnection.ReadInteger(_valueMapping.Skill);
     Overtaking      = executableConnection.ReadInteger(_valueMapping.Overtaking);
     WetWeather      = executableConnection.ReadInteger(_valueMapping.WetWeather);
     Concentration   = executableConnection.ReadInteger(_valueMapping.Concentration);
     Experience      = executableConnection.ReadInteger(_valueMapping.Experience);
     Stamina         = executableConnection.ReadInteger(_valueMapping.Stamina);
     Morale          = executableConnection.ReadInteger(_valueMapping.Morale);
 }
Exemple #27
0
 public void ExportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceHelper.SetResourceText(identityCollection, ResourceId, ResourceText);
     executableConnection.WriteInteger(_valueMapping.Salary, Salary);
     executableConnection.WriteInteger(_valueMapping.RaceBonus, RaceBonus);
     executableConnection.WriteInteger(_valueMapping.ChampionshipBonus, ChampionshipBonus);
     executableConnection.WriteInteger(_valueMapping.Age, Age);
     executableConnection.WriteInteger(_valueMapping.Nationality, Nationality);
     executableConnection.WriteInteger(_valueMapping.Unknown, Unknown);
     executableConnection.WriteInteger(_valueMapping.CommentaryIndex, CommentaryIndex);
     executableConnection.WriteInteger(_valueMapping.Speed, Speed);
     executableConnection.WriteInteger(_valueMapping.Skill, Skill);
     executableConnection.WriteInteger(_valueMapping.Overtaking, Overtaking);
     executableConnection.WriteInteger(_valueMapping.WetWeather, WetWeather);
     executableConnection.WriteInteger(_valueMapping.Concentration, Concentration);
     executableConnection.WriteInteger(_valueMapping.Experience, Experience);
     executableConnection.WriteInteger(_valueMapping.Stamina, Stamina);
     executableConnection.WriteInteger(_valueMapping.Morale, Morale);
 }
Exemple #28
0
 public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
 {
     ResourceText            = ResourceHelper.GetResourceText(identityCollection, ResourceId);
     DryHardGrip             = executableConnection.ReadInteger(_valueMapping.DryHardGripSupplier);
     DryHardResilience       = executableConnection.ReadInteger(_valueMapping.DryHardResilienceSupplier);
     DryHardStiffness        = executableConnection.ReadInteger(_valueMapping.DryHardStiffnessSupplier);
     DryHardTemperature      = executableConnection.ReadInteger(_valueMapping.DryHardTemperatureSupplier);
     DrySoftGrip             = executableConnection.ReadInteger(_valueMapping.DrySoftGripSupplier);
     DrySoftResilience       = executableConnection.ReadInteger(_valueMapping.DrySoftResilienceSupplier);
     DrySoftStiffness        = executableConnection.ReadInteger(_valueMapping.DrySoftStiffnessSupplier);
     DrySoftTemperature      = executableConnection.ReadInteger(_valueMapping.DrySoftTemperatureSupplier);
     IntermediateGrip        = executableConnection.ReadInteger(_valueMapping.IntermediateGripSupplier);
     IntermediateResilience  = executableConnection.ReadInteger(_valueMapping.IntermediateResilienceSupplier);
     IntermediateStiffness   = executableConnection.ReadInteger(_valueMapping.IntermediateStiffnessSupplier);
     IntermediateTemperature = executableConnection.ReadInteger(_valueMapping.IntermediateTemperatureSupplier);
     WetWeatherGrip          = executableConnection.ReadInteger(_valueMapping.WetWeatherGripSupplier);
     WetWeatherResilience    = executableConnection.ReadInteger(_valueMapping.WetWeatherResilienceSupplier);
     WetWeatherStiffness     = executableConnection.ReadInteger(_valueMapping.WetWeatherStiffnessSupplier);
     WetWeatherTemperature   = executableConnection.ReadInteger(_valueMapping.WetWeatherTemperatureSupplier);
 }
Exemple #29
0
        /// <summary>
        /// Applies the changes to enter the track editor in the race screen.
        /// This method is only intended for use with gpw.exe v1.01b.
        /// This method requires the Jump Bypass Patcher to be applied beforehand.
        /// Do not invoke this method more than once on the same file.
        /// </summary>
        public void Apply()
        {
            const int replacementWndProcLocation     = 0x44F2B0;
            var       replacementWndProcInstructions = new byte[]
            {
                0xE8, 0x94, 0x59, 0x02, 0x00
            };

            const int newTrackEditorToggleLocation     = 0x00474C49;
            var       newTrackEditorToggleInstructions = new byte[]
            {
                0x55,
                0x8B, 0xEC,
                0x53,
                0x56,
                0x57,
                0x83, 0x3D, 0xDC, 0x31, 0x5F, 0x01, 0x00,
                0x0F, 0x85, 0x0F, 0x00, 0x00, 0x00,
                0xC7, 0x05, 0xDC, 0x31, 0x5F, 0x01, 0x01, 0x00, 0x00, 0x00,
                0xE9, 0x0A, 0x00, 0x00, 0x00,
                0xC7, 0x05, 0xDC, 0x31, 0x5F, 0x01, 0x00, 0x00, 0x00, 0x00,
                0x5F,
                0x5E,
                0x5B,
                0xC9,
                0xC3
            };

            // Open file and write
            using (var executableConnection = new ExecutableConnection(_executableFilePath))
            {
                // Replace code in WndProc to respond to WM_KEYDOWN for VK_F8 (0x77)
                // Overwrites existing functionality to reduce race speed with the F8 key
                executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(replacementWndProcLocation), replacementWndProcInstructions);

                // Apply new function to toggle track editor flag value
                executableConnection.WriteByteArray(InstructionHelper.CalculateRealPositionFromVirtualPosition(newTrackEditorToggleLocation), newTrackEditorToggleInstructions);
            }
        }
Exemple #30
0
        public void ImportData(ExecutableConnection executableConnection, IdentityCollection identityCollection)
        {
            ResourceText             = ResourceHelper.GetResourceText(identityCollection, ResourceId);
            Salary                   = executableConnection.ReadInteger(_valueMapping.Salary);
            RaceBonus                = executableConnection.ReadInteger(_valueMapping.RaceBonus);
            ChampionshipBonus        = executableConnection.ReadInteger(_valueMapping.ChampionshipBonus);
            PayRating                = executableConnection.ReadInteger(_valueMapping.PayRating);
            PositiveSalary           = executableConnection.ReadInteger(_valueMapping.PositiveSalary);
            LastChampionshipPosition = executableConnection.ReadInteger(_valueMapping.LastChampionshipPosition);
            DriverRole               = executableConnection.ReadInteger(_valueMapping.DriverRole);
            CarNumberA               = executableConnection.ReadInteger(_valueMapping.CarNumberA);
            Age                  = executableConnection.ReadInteger(_valueMapping.Age);
            Nationality          = executableConnection.ReadInteger(_valueMapping.Nationality);
            CommentaryIndex      = executableConnection.ReadInteger(_valueMapping.CommentaryIndex);
            CareerChampionships  = executableConnection.ReadInteger(_valueMapping.CareerChampionships);
            CareerRaces          = executableConnection.ReadInteger(_valueMapping.CareerRaces);
            CareerWins           = executableConnection.ReadInteger(_valueMapping.CareerWins);
            CareerPoints         = executableConnection.ReadInteger(_valueMapping.CareerPoints);
            CareerFastestLaps    = executableConnection.ReadInteger(_valueMapping.CareerFastestLaps);
            CareerPointsFinishes = executableConnection.ReadInteger(_valueMapping.CareerPointsFinishes);
            CareerPolePositions  = executableConnection.ReadInteger(_valueMapping.CareerPolePositions);
            Speed                = executableConnection.ReadInteger(_valueMapping.Speed);
            Skill                = executableConnection.ReadInteger(_valueMapping.Skill);
            Overtaking           = executableConnection.ReadInteger(_valueMapping.Overtaking);
            WetWeather           = executableConnection.ReadInteger(_valueMapping.WetWeather);
            Concentration        = executableConnection.ReadInteger(_valueMapping.Concentration);
            Experience           = executableConnection.ReadInteger(_valueMapping.Experience);
            Stamina              = executableConnection.ReadInteger(_valueMapping.Stamina);
            Morale               = executableConnection.ReadInteger(_valueMapping.Morale).ConvertToOneToFiveStepOne();

            // Only read value if driver is driver 1 or 2, and not T.
            var driverId = LocalResourceId % 8;

            if (driverId == 6 || driverId == 7) // 1 and 2
            {
                CarNumberB = executableConnection.ReadInteger(_valueMapping.CarNumberB);
            }
        }