├── .gitignore ├── Binaries ├── AForge.Imaging.dll ├── AForge.Imaging.xml ├── AForge.Math.dll ├── AForge.Math.xml ├── AForge.dll ├── AForge.xml ├── FSharp.Core.dll ├── FSharp.Core.xml ├── MathNet.Numerics.FSharp.dll ├── MathNet.Numerics.FSharp.xml ├── MathNet.Numerics.dll ├── MathNet.Numerics.xml ├── vJoyInterface.dll └── vJoyInterfaceWrap.dll ├── ETS2 engine revving speed vs power.xlsx ├── Icons ├── Active Blue │ ├── Antistall_active.png │ ├── CameraHorizon_active.png │ ├── Cruisecontrol_active.png │ ├── DrivetrainCalibrator_active.png │ ├── LaneAssistance_active.png │ ├── LaunchControl_active.png │ ├── Powerlimiter_active.png │ ├── Speedlimiter_active.png │ ├── TractionControl_active.png │ ├── Transmission_active.png │ └── profileswitcher_active.png ├── Antistall.png ├── Antistall_active.png ├── CameraHorizon.png ├── CameraHorizon_active.png ├── Cruisecontrol.png ├── Cruisecontrol_active.png ├── DrivetrainCalibrator.png ├── DrivetrainCalibrator_active.png ├── LaneAssistance.png ├── LaneAssistance_active.png ├── LaunchControl.png ├── LaunchControl_active.png ├── Powerlimiter.png ├── Powerlimiter_active.png ├── Speedlimiter.png ├── Speedlimiter_active.png ├── TractionControl.png ├── TractionControl_active.png ├── Transmission.png ├── Transmission_active.png ├── profileswitcher.png ├── profileswitcher_active.png └── raw │ ├── 120px-Rocket_symbol.svg.png │ ├── 9LKA-icon.jpg │ ├── abs.png │ ├── battery.png │ ├── cameras-s.jpg │ ├── clutch.gif │ ├── cog.png │ ├── cruisecontrol.png │ ├── engine.png │ ├── esp.png │ ├── fuel.png │ ├── gearbox.jpg │ ├── highbeam.png │ ├── oilwarning.png │ ├── overdrive.png │ ├── powertrain.png │ ├── profile.png │ ├── tractioncontrol.png │ ├── turn.png │ ├── warning.png │ └── watertemp.png ├── LICENSE ├── README.md ├── Resources ├── AForge │ ├── AForge.Controls.dll │ ├── AForge.Controls.xml │ ├── AForge.DebuggerVisualizers (2010).dll │ ├── AForge.Fuzzy.dll │ ├── AForge.Fuzzy.xml │ ├── AForge.Genetic.dll │ ├── AForge.Genetic.xml │ ├── AForge.Imaging.Formats.dll │ ├── AForge.Imaging.Formats.xml │ ├── AForge.Imaging.IPPrototyper.dll │ ├── AForge.Imaging.dll │ ├── AForge.Imaging.xml │ ├── AForge.MachineLearning.dll │ ├── AForge.MachineLearning.xml │ ├── AForge.Math.dll │ ├── AForge.Math.xml │ ├── AForge.Neuro.dll │ ├── AForge.Neuro.xml │ ├── AForge.Robotics.Lego.dll │ ├── AForge.Robotics.Lego.xml │ ├── AForge.Robotics.Surveyor.dll │ ├── AForge.Robotics.Surveyor.xml │ ├── AForge.Robotics.TeRK.dll │ ├── AForge.Robotics.TeRK.xml │ ├── AForge.Video.DirectShow.dll │ ├── AForge.Video.DirectShow.xml │ ├── AForge.Video.FFMPEG.dll │ ├── AForge.Video.FFMPEG.xml │ ├── AForge.Video.Kinect.dll │ ├── AForge.Video.Kinect.xml │ ├── AForge.Video.VFW.dll │ ├── AForge.Video.VFW.xml │ ├── AForge.Video.Ximea.dll │ ├── AForge.Video.Ximea.xml │ ├── AForge.Video.dll │ ├── AForge.Video.xml │ ├── AForge.Vision.dll │ ├── AForge.Vision.xml │ ├── AForge.dll │ ├── AForge.xml │ └── IPPrototyper.exe ├── AdaptiveCruiseControl.pdn ├── AdaptiveCruiseControl.png ├── AdaptiveCruiseControlOff.pdn ├── AdaptiveCruiseControlOff.png ├── AdaptiveCruiseControlOn.pdn ├── AdaptiveCruiseControlOn.png ├── Alert.wav ├── CruiseControlIcon.pdn ├── CruiseControlIcon.png ├── CruiseOff.pdn ├── CruiseOff.png ├── CruiseOn.pdn ├── CruiseOn.png ├── CuteCar.pdn ├── LUT1.19-cities.csv ├── LUT1.19-companies.csv ├── LUT1.19-prefab.csv ├── LUT1.19-prefab.sii ├── LUT1.19-roadlook.sii ├── LUT1.19-roads.csv ├── LaneAssist Data │ ├── 0.png │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 2.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── fel.png │ ├── geel.png │ └── lamp_donker.png ├── Mem │ ├── TDU2 Camera.CT │ └── TDU2.CT ├── Needle.png ├── Needle_150px.png ├── TeslaDash │ ├── Background.png │ ├── Background2.pdn │ ├── Background2.png │ ├── Background2a.png │ ├── Background3.png │ ├── Efficiency.png │ ├── Empty.png │ ├── Energy.png │ ├── Lade-Balken.png │ ├── Media.png │ ├── Music.png │ ├── Navi.png │ ├── Numbers.png │ ├── Range.png │ ├── Street.png │ ├── Tacho.png │ ├── Tacho_Mitte.png │ ├── Tile.png │ ├── Trips.png │ ├── bg.png │ └── call.png ├── prefabs tmp.csv └── tractioncontrol.wav ├── SimShift ├── SimShift.Map │ ├── ByteSearchMethods.cs │ ├── Ets2Company.cs │ ├── Ets2CurveHelper.cs │ ├── Ets2Item.cs │ ├── Ets2ItemSearchRequest.cs │ ├── Ets2ItemType.cs │ ├── Ets2Mapper.cs │ ├── Ets2NavigationRoute.cs │ ├── Ets2NavigationSegment.cs │ ├── Ets2NavigationSegmentType.cs │ ├── Ets2Node.cs │ ├── Ets2Point.cs │ ├── Ets2Prefab.cs │ ├── Ets2PrefabCurve.cs │ ├── Ets2PrefabNode.cs │ ├── Ets2PrefabRoute.cs │ ├── Ets2RoadLook.cs │ ├── Ets2Sector.cs │ ├── IndicatorSignal.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SimShift.MapTool.csproj │ └── Splines │ │ ├── ArrayUtil.cs │ │ ├── CubicSpline.cs │ │ └── TriDiagonalMatrix.cs ├── SimShift.sln └── SimShift │ ├── Controllers │ ├── JoystickInput.cs │ ├── JoystickInputDevice.cs │ ├── JoystickMethods.cs │ └── JoystickOutput.cs │ ├── Data │ ├── Common │ │ ├── GenericDataDefinition.cs │ │ ├── IDataDefinition.cs │ │ ├── IDataMiner.cs │ │ ├── MemoryReader.cs │ │ ├── MemoryWriter.cs │ │ ├── ProcessMemoryReaderApi.cs │ │ └── SharedMemory.cs │ ├── DataArbiter.cs │ ├── Ets2DataAuxilliary.cs │ ├── Ets2DataDebug.Designer.cs │ ├── Ets2DataDebug.cs │ ├── Ets2DataDebug.resx │ ├── Ets2DataMiner.cs │ ├── Memory │ │ ├── IDataField.cs │ │ ├── IDataNode.cs │ │ ├── IDataProvider.cs │ │ ├── IMemoryObject.cs │ │ ├── MemoryAddress.cs │ │ ├── MemoryDataConverter.cs │ │ ├── MemoryDataConverterProvider.cs │ │ ├── MemoryField.cs │ │ ├── MemoryFieldConstant.cs │ │ ├── MemoryFieldFunc.cs │ │ ├── MemoryFieldLazy.cs │ │ ├── MemoryFieldSignature.cs │ │ ├── MemoryFieldSignaturePointer.cs │ │ ├── MemoryPool.cs │ │ ├── MemoryProvider.cs │ │ ├── MemoryReader.cs │ │ ├── MemoryReaderApi.cs │ │ ├── MemoryRegionType.cs │ │ └── MemorySignatureScanner.cs │ ├── Tdu2DataMiner.cs │ ├── TelemetryChannel.cs │ └── WorldMapper.cs │ ├── Dialogs │ ├── Tesla │ │ ├── ColorBlender.cs │ │ ├── dlTeslaDashboard.Designer.cs │ │ ├── dlTeslaDashboard.cs │ │ ├── dlTeslaDashboard.resx │ │ ├── ucTeslaTacho.Designer.cs │ │ ├── ucTeslaTacho.cs │ │ └── ucTeslaTacho.resx │ ├── dlDebugInfo.Designer.cs │ ├── dlDebugInfo.cs │ ├── dlDebugInfo.resx │ ├── dlGearboxShifterTable.Designer.cs │ ├── dlGearboxShifterTable.cs │ ├── dlGearboxShifterTable.resx │ ├── dlJoysticks.Designer.cs │ ├── dlJoysticks.cs │ ├── dlJoysticks.resx │ ├── dlMap.Designer.cs │ ├── dlMap.cs │ ├── dlMap.resx │ ├── dlPlotter.Designer.cs │ ├── dlPlotter.cs │ ├── dlPlotter.resx │ ├── dlTwitchDashboard.Designer.cs │ ├── dlTwitchDashboard.cs │ ├── dlTwitchDashboard.resx │ ├── ucDashboard.Designer.cs │ ├── ucDashboard.cs │ ├── ucDashboard.resx │ ├── ucGearboxShifterGraph.Designer.cs │ ├── ucGearboxShifterGraph.cs │ ├── ucGearboxShifterGraph.resx │ ├── ucJoystickChannel.Designer.cs │ ├── ucJoystickChannel.cs │ ├── ucJoystickChannel.resx │ ├── ucPlotter.Designer.cs │ ├── ucPlotter.cs │ └── ucPlotter.resx │ ├── Entities │ ├── ConfigurableShiftPattern.cs │ ├── IConfigurable.cs │ ├── IControlChainObj.cs │ ├── JoyControls.cs │ ├── MmTimer.cs │ ├── Profile.cs │ ├── Profiles.cs │ ├── ShiftPattern.cs │ ├── ShiftPatternFrame.cs │ ├── ShifterTableConfiguration.cs │ ├── ShifterTableConfigurationDefault.cs │ └── ShifterTableLookupResult.cs │ ├── FrmMain.Designer.cs │ ├── FrmMain.cs │ ├── FrmMain.resx │ ├── Models │ ├── Ets2Aero.cs │ ├── Ets2Drivetrain.cs │ ├── GenericDrivetrain.cs │ └── IDrivetrain.cs │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Services │ ├── ACC.cs │ ├── Antistall.cs │ ├── CameraHorizon.cs │ ├── ControlChain.cs │ ├── CruiseControl.cs │ ├── Dashboard.cs │ ├── DrivetrainCalibrator.cs │ ├── EarlyClutch.cs │ ├── Ets2PowerMeter.cs │ ├── LaneAssistance.cs │ ├── LaunchControl.cs │ ├── Main.cs │ ├── ProfileSwitcher.cs │ ├── Speedlimiter.cs │ ├── ThrottleMapping.cs │ ├── TractionControl.cs │ ├── Transmission.cs │ ├── TransmissionCalibrator.cs │ ├── VariableSpeedTransmission.cs │ └── WheelTorqueLimiter.cs │ ├── SimShift.csproj │ ├── Simulation │ └── SimulationEnvironment.cs │ └── Utils │ ├── IniReader.cs │ ├── IniValueObject.cs │ ├── NativeMethods.cs │ └── Rect.cs └── TestData ├── Air Resistance Test Scania R 730hp - gear 4.xlsx ├── Air Resistance Test Scania R 730hp.csv ├── Air Resistance Test Scania R 730hp.xlsx ├── Fuel Efficiency Tests.xlsx ├── Negative torque measured with 0rpm-per-s test - Scania R 730hp.xlsx ├── Power Scania R 730hp - Air compensated.csv ├── PowerCoastScaniaR-420hp.xlsx ├── PowerCoastScaniaR-730hp.xlsx ├── RPM vs LiterPerHour - Fixed Throttle.xlsx └── Throttle vs LiterPerHour - Fixed RPM.xlsx /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | -------------------------------------------------------------------------------- /Binaries/AForge.Imaging.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/AForge.Imaging.dll -------------------------------------------------------------------------------- /Binaries/AForge.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/AForge.Math.dll -------------------------------------------------------------------------------- /Binaries/AForge.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/AForge.dll -------------------------------------------------------------------------------- /Binaries/FSharp.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/FSharp.Core.dll -------------------------------------------------------------------------------- /Binaries/MathNet.Numerics.FSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/MathNet.Numerics.FSharp.dll -------------------------------------------------------------------------------- /Binaries/MathNet.Numerics.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/MathNet.Numerics.dll -------------------------------------------------------------------------------- /Binaries/vJoyInterface.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/vJoyInterface.dll -------------------------------------------------------------------------------- /Binaries/vJoyInterfaceWrap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Binaries/vJoyInterfaceWrap.dll -------------------------------------------------------------------------------- /ETS2 engine revving speed vs power.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/ETS2 engine revving speed vs power.xlsx -------------------------------------------------------------------------------- /Icons/Active Blue/Antistall_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/Antistall_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/CameraHorizon_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/CameraHorizon_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/Cruisecontrol_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/Cruisecontrol_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/DrivetrainCalibrator_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/DrivetrainCalibrator_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/LaneAssistance_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/LaneAssistance_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/LaunchControl_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/LaunchControl_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/Powerlimiter_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/Powerlimiter_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/Speedlimiter_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/Speedlimiter_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/TractionControl_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/TractionControl_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/Transmission_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/Transmission_active.png -------------------------------------------------------------------------------- /Icons/Active Blue/profileswitcher_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Active Blue/profileswitcher_active.png -------------------------------------------------------------------------------- /Icons/Antistall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Antistall.png -------------------------------------------------------------------------------- /Icons/Antistall_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Antistall_active.png -------------------------------------------------------------------------------- /Icons/CameraHorizon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/CameraHorizon.png -------------------------------------------------------------------------------- /Icons/CameraHorizon_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/CameraHorizon_active.png -------------------------------------------------------------------------------- /Icons/Cruisecontrol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Cruisecontrol.png -------------------------------------------------------------------------------- /Icons/Cruisecontrol_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Cruisecontrol_active.png -------------------------------------------------------------------------------- /Icons/DrivetrainCalibrator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/DrivetrainCalibrator.png -------------------------------------------------------------------------------- /Icons/DrivetrainCalibrator_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/DrivetrainCalibrator_active.png -------------------------------------------------------------------------------- /Icons/LaneAssistance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/LaneAssistance.png -------------------------------------------------------------------------------- /Icons/LaneAssistance_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/LaneAssistance_active.png -------------------------------------------------------------------------------- /Icons/LaunchControl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/LaunchControl.png -------------------------------------------------------------------------------- /Icons/LaunchControl_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/LaunchControl_active.png -------------------------------------------------------------------------------- /Icons/Powerlimiter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Powerlimiter.png -------------------------------------------------------------------------------- /Icons/Powerlimiter_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Powerlimiter_active.png -------------------------------------------------------------------------------- /Icons/Speedlimiter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Speedlimiter.png -------------------------------------------------------------------------------- /Icons/Speedlimiter_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Speedlimiter_active.png -------------------------------------------------------------------------------- /Icons/TractionControl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/TractionControl.png -------------------------------------------------------------------------------- /Icons/TractionControl_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/TractionControl_active.png -------------------------------------------------------------------------------- /Icons/Transmission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Transmission.png -------------------------------------------------------------------------------- /Icons/Transmission_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/Transmission_active.png -------------------------------------------------------------------------------- /Icons/profileswitcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/profileswitcher.png -------------------------------------------------------------------------------- /Icons/profileswitcher_active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/profileswitcher_active.png -------------------------------------------------------------------------------- /Icons/raw/120px-Rocket_symbol.svg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/120px-Rocket_symbol.svg.png -------------------------------------------------------------------------------- /Icons/raw/9LKA-icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/9LKA-icon.jpg -------------------------------------------------------------------------------- /Icons/raw/abs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/abs.png -------------------------------------------------------------------------------- /Icons/raw/battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/battery.png -------------------------------------------------------------------------------- /Icons/raw/cameras-s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/cameras-s.jpg -------------------------------------------------------------------------------- /Icons/raw/clutch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/clutch.gif -------------------------------------------------------------------------------- /Icons/raw/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/cog.png -------------------------------------------------------------------------------- /Icons/raw/cruisecontrol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/cruisecontrol.png -------------------------------------------------------------------------------- /Icons/raw/engine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/engine.png -------------------------------------------------------------------------------- /Icons/raw/esp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/esp.png -------------------------------------------------------------------------------- /Icons/raw/fuel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/fuel.png -------------------------------------------------------------------------------- /Icons/raw/gearbox.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/gearbox.jpg -------------------------------------------------------------------------------- /Icons/raw/highbeam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/highbeam.png -------------------------------------------------------------------------------- /Icons/raw/oilwarning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/oilwarning.png -------------------------------------------------------------------------------- /Icons/raw/overdrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/overdrive.png -------------------------------------------------------------------------------- /Icons/raw/powertrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/powertrain.png -------------------------------------------------------------------------------- /Icons/raw/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/profile.png -------------------------------------------------------------------------------- /Icons/raw/tractioncontrol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/tractioncontrol.png -------------------------------------------------------------------------------- /Icons/raw/turn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/turn.png -------------------------------------------------------------------------------- /Icons/raw/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/warning.png -------------------------------------------------------------------------------- /Icons/raw/watertemp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Icons/raw/watertemp.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Hans 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SimShift 2 | ======== 3 | 4 | [![Foo](https://scan.coverity.com/projects/12842/badge.svg)](https://scan.coverity.com/projects/nlhans-simshift) 5 | 6 | Driver utilities for various open roaming simulators, like ETS2. 7 | -------------------------------------------------------------------------------- /Resources/AForge/AForge.Controls.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Controls.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.DebuggerVisualizers (2010).dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.DebuggerVisualizers (2010).dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Fuzzy.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Fuzzy.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Genetic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Genetic.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Imaging.Formats.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Imaging.Formats.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Imaging.IPPrototyper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Imaging.IPPrototyper.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Imaging.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Imaging.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.MachineLearning.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.MachineLearning.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Math.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Math.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Neuro.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Neuro.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Robotics.Lego.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Robotics.Lego.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Robotics.Surveyor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Robotics.Surveyor.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Robotics.TeRK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Robotics.TeRK.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Video.DirectShow.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Video.DirectShow.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Video.FFMPEG.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Video.FFMPEG.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Video.Kinect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Video.Kinect.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Video.VFW.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Video.VFW.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Video.Ximea.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Video.Ximea.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Video.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Video.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.Vision.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.Vision.dll -------------------------------------------------------------------------------- /Resources/AForge/AForge.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/AForge.dll -------------------------------------------------------------------------------- /Resources/AForge/IPPrototyper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AForge/IPPrototyper.exe -------------------------------------------------------------------------------- /Resources/AdaptiveCruiseControl.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AdaptiveCruiseControl.pdn -------------------------------------------------------------------------------- /Resources/AdaptiveCruiseControl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AdaptiveCruiseControl.png -------------------------------------------------------------------------------- /Resources/AdaptiveCruiseControlOff.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AdaptiveCruiseControlOff.pdn -------------------------------------------------------------------------------- /Resources/AdaptiveCruiseControlOff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AdaptiveCruiseControlOff.png -------------------------------------------------------------------------------- /Resources/AdaptiveCruiseControlOn.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AdaptiveCruiseControlOn.pdn -------------------------------------------------------------------------------- /Resources/AdaptiveCruiseControlOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/AdaptiveCruiseControlOn.png -------------------------------------------------------------------------------- /Resources/Alert.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/Alert.wav -------------------------------------------------------------------------------- /Resources/CruiseControlIcon.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CruiseControlIcon.pdn -------------------------------------------------------------------------------- /Resources/CruiseControlIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CruiseControlIcon.png -------------------------------------------------------------------------------- /Resources/CruiseOff.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CruiseOff.pdn -------------------------------------------------------------------------------- /Resources/CruiseOff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CruiseOff.png -------------------------------------------------------------------------------- /Resources/CruiseOn.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CruiseOn.pdn -------------------------------------------------------------------------------- /Resources/CruiseOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CruiseOn.png -------------------------------------------------------------------------------- /Resources/CuteCar.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/CuteCar.pdn -------------------------------------------------------------------------------- /Resources/LUT1.19-cities.csv: -------------------------------------------------------------------------------- 1 | 0000028A215FDC9F,IJmuiden 2 | 00000000001893A0,Pecs 3 | 000001D913F65717,Salzburg 4 | 000A6C7D46175459,Strasbourg 5 | 00BB06C733A2004A,Gdansk 6 | 0000000000149823,Koln 7 | 0006F4A3A90ED7A0,Bratislava 8 | 0000547ADA08D70F,Osnabruck 9 | 00000333CD9F84E6,Budapest 10 | 0000000069DCE573,Kassel 11 | 000000111C4D7549,Munchen 12 | 000001D8C85BE9C2,Nurnberg 13 | 0000000001F02A80,Lille 14 | 000002F505E877A4,Hannover 15 | 0000547ADA17E87B,Innsbruck 16 | 00004638F3EE339D,Magdeburg 17 | 000000000012C313,Kiel 18 | 0000000C730CED40,Hamburg 19 | 0000000003AB3704,Paris 20 | 000000081461CB02,Venezia 21 | 0000000072CBABD0,Poznan 22 | 0000000037048482,Verona 23 | 000079A0EB7A2894,Frankfurt am Main 24 | 0000000091442C1F,Erfurt 25 | 00000272501CF759,Mannheim 26 | 00007992EC0624BD,Stuttgart 27 | 0000000C49365A0C,Leipzig 28 | 000000008B5C2A9F,Calais 29 | 0000000073C858F6,Berlin 30 | 0000000EF962B866,Rostock 31 | 000001991279EF77,Katowice 32 | 000000004AC04CB6,Praha 33 | 00095320032125EA,Felixstowe 34 | 000000000388252C,Dover 35 | 000000007480778C,London 36 | 000000000012EC54,Hull 37 | 000000000310FBC8,Dijon 38 | 0000000003AE5E3A,Reims 39 | 00005C22415CF2C9,Amsterdam 40 | 0000000001EBD34C,Liege 41 | 0000608324C0CB6D,Groningen 42 | 000000004ADEB873,Geneve 43 | 0000000FB6CA80F8,Brussel 44 | 0000000056B0BFC6,Zurich 45 | 0000000CDE40928C,Harwich 46 | 000000084EB6D3AF,Ostrava 47 | 00000000001EAEA8,Linz 48 | 0000000000157A2C,Brno 49 | 00003D1F89C4786B,Cambridge 50 | 00120DE301336CAD,Klagenfurt am Worthersee 51 | 00000018C5A8475D,Grimsby 52 | 0000000079171FA9,Milano 53 | 000000009F075671,Krakow 54 | 000000007349A3A8,Bremen 55 | 0000000066DCB721,Gdansk 56 | 0000000001F21FC1,Gdynia 57 | 000001865C58BF14,Dortmund 58 | 000000111BDB634A,Dresden 59 | 000000175919CD85,Wroclaw 60 | 0000028CEA0882B9,Szczecin 61 | 000000179AA64309,Glasgow 62 | 00000000001E66A5,Graz 63 | 00003DB020D710FE,Newcastle-upon-Tyne 64 | 0000028A25771E4F,Aberdeen 65 | 0000000000146FCF,Wien 66 | 00000000440A4B19,Szeged 67 | 0000012E831211C2,Banska Bystrica 68 | 000039B121A629C5,Sheffield 69 | 00000000001E7724,Lodz 70 | 0000013C639854CB,Warszawa 71 | 000DAD78B597BA26,Birmingham 72 | 000000117C534651,Olsztyn 73 | 000055B9DA96368A,Bialystok 74 | 0010ADE2AE7AF591,Manchester 75 | 000000000014B876,Bern 76 | 0000019F8F25763F,Carlisle 77 | 0000028A1C24CE28,Debrecen 78 | 00000000791DF52C,Torino 79 | 0000000073C80120,Lublin 80 | 000000004885AB57,Kosice 81 | 0000490676D48C6F,Edinburgh 82 | 000059AA96CDE9D0,Liverpool 83 | 00000000001ECFE9,Metz 84 | 000000000014AA8C,Lyon 85 | 000001F5202B1762,Plymouth 86 | 0000000B856D469F,Cardiff 87 | 0000000800A6347F,Swansea 88 | 000A6C7D455BE950,Luxembourg 89 | 0009D59288494D64,Dusseldorf 90 | 000001D913F06CAC,Duisburg 91 | 0000799CE1D04A71,Europoort 92 | 00005C22415CF8CA,Rotterdam -------------------------------------------------------------------------------- /Resources/LUT1.19-companies.csv: -------------------------------------------------------------------------------- 1 | prefab.41,-50,65,55,-76 2 | prefab.200,-52,65,54,-76 3 | prefab.67,-60,0,89,-150 4 | prefab.249,-10,0,160,-165 5 | prefab.68,-32,23,42,-48 6 | prefab.261,-42,62,57,-57 7 | prefab.262,-42,62,57,-57 8 | prefab.282,-35,39,84,-50 9 | prefab.283,-35,50,35,-50 10 | prefab.44,-85,62,82,-72 11 | prefab.252,-24,42,27,-23 12 | prefab.330,-23,42,27,-23 13 | prefab.251,-29,9,59,-123 14 | prefab.13,-400,112,146,-475 15 | prefab.203,-85,0,100,-100 16 | prefab.254,-53,42,32,-16 17 | prefab.31,-101,23,31,-60 18 | prefab.34,-113,67,27,-90 19 | prefab.36,-102,67,30,-90 20 | prefab.32,-54,40,31,-16 21 | prefab.33,-17,96,39,-8 22 | -------------------------------------------------------------------------------- /Resources/LUT1.19-roads.csv: -------------------------------------------------------------------------------- 1 | 0031F718,road.look0 2 | 0051C828,road.look1 3 | 00719938,road.look2 4 | 00916A48,road.look3 5 | 00B13B58,road.look4 6 | 00D10C68,road.look5 7 | 00F0DD78,road.look6 8 | 0110AE88,road.look7 9 | 01307F98,road.look8 10 | 015050A8,road.look9 11 | 050AD088,road.look10 12 | 09C3D8E8,road.look11 13 | 0E7CE148,road.look12 14 | 1335E9A8,road.look13 15 | 17EEF208,road.look14 16 | 1CA7FA68,road.look15 17 | 216102C8,road.look16 18 | 261A0B28,road.look17 19 | 2AD31388,road.look18 20 | 2F8C1BE8,road.look19 21 | 09E3A9F8,road.look21 22 | 0E9CB258,road.look22 23 | 1355BAB8,road.look23 24 | 180EC318,road.look24 25 | 1CC7CB78,road.look25 26 | 2180D3D8,road.look26 27 | 2639DC38,road.look27 28 | 2AF2E498,road.look28 -------------------------------------------------------------------------------- /Resources/LaneAssist Data/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/0.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/1.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/10.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/11.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/12.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/13.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/14.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/15.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/16.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/17.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/18.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/19.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/2.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/20.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/21.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/22.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/23.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/3.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/4.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/5.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/6.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/7.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/8.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/9.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/fel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/fel.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/geel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/geel.png -------------------------------------------------------------------------------- /Resources/LaneAssist Data/lamp_donker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/LaneAssist Data/lamp_donker.png -------------------------------------------------------------------------------- /Resources/Mem/TDU2 Camera.CT: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | "No description" 7 | 80000008 8 | 4 Bytes 9 |
17553910
10 |
11 | 12 | 1 13 | "CurrentView" 14 | 1 15 | 80000008 16 | 4 Bytes 17 |
TestDrive2.exe+D95BF0
18 |
19 | 20 | 2 21 | "CurrentView" 22 | 1 23 | 80000008 24 | 4 Bytes 25 |
TestDrive2.exe+E2C9E8
26 |
27 |
28 | 29 |
30 | -------------------------------------------------------------------------------- /Resources/Mem/TDU2.CT: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | "Car ID" 7 | 80000008 8 | 4 Bytes 9 |
TestDrive2.exe+B907C4
10 |
11 | 12 | 1 13 | "Car ID" 14 | 80000008 15 | 4 Bytes 16 |
TestDrive2.exe+C35224
17 |
18 | 19 | 2 20 | "Car ID" 21 | 80000008 22 | 4 Bytes 23 |
TestDrive2.exe+D95864
24 |
25 | 26 | 3 27 | "Gear" 28 | 80000008 29 | 4 Bytes 30 |
TestDrive2.exe+C2DAD0
31 |
32 | 33 | 4 34 | "Spd" 35 | 80000008 36 | Float 37 |
TestDrive2.exe+C2DB24
38 |
39 | 40 | 5 41 | "RPM" 42 | 80000008 43 | Float 44 |
TestDrive2.exe+C2DB18
45 |
46 | 47 | 6 48 | "Throttle" 49 | 80000008 50 | Float 51 |
TestDrive2.exe+C2DB00
52 |
53 | 54 | 7 55 | "POWER" 56 | 80000008 57 | Float 58 |
0102DB1C
59 |
60 | 61 | 8 62 | "FF60FF VV Upgrade VW" 63 | 1 64 | 80000008 65 | Array of byte 66 | 3 67 |
1DB81558
68 |
69 | 70 | 9 71 | "Leetz Upgrades" 72 | 1 73 | 80000008 74 | Array of byte 75 | 3 76 |
1DB81558
77 |
78 | 79 | 10 80 | "No description" 81 | 1 82 | 80000008 83 | 4 Bytes 84 |
1DB8111C
85 |
86 | 87 | 11 88 | "No description" 89 | 80000008 90 | Float 91 |
1DB81554
92 |
93 | 94 | 12 95 | "Gear Count" 96 | 80000008 97 | 4 Bytes 98 |
TestDrive2.exe+C98840
99 |
100 | 101 | 14 102 | "Car model" 103 | 80000008 104 | String 105 | 32 106 | 0 107 | 1 108 |
TestDrive2.exe+C2DC30
109 |
110 |
111 | 112 |
113 | -------------------------------------------------------------------------------- /Resources/Needle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/Needle.png -------------------------------------------------------------------------------- /Resources/Needle_150px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/Needle_150px.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Background.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Background2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Background2.pdn -------------------------------------------------------------------------------- /Resources/TeslaDash/Background2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Background2.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Background2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Background2a.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Background3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Background3.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Efficiency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Efficiency.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Empty.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Energy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Energy.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Lade-Balken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Lade-Balken.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Media.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Media.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Music.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Navi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Navi.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Numbers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Numbers.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Range.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Range.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Street.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Street.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Tacho.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Tacho.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Tacho_Mitte.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Tacho_Mitte.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Tile.png -------------------------------------------------------------------------------- /Resources/TeslaDash/Trips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/Trips.png -------------------------------------------------------------------------------- /Resources/TeslaDash/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/bg.png -------------------------------------------------------------------------------- /Resources/TeslaDash/call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/TeslaDash/call.png -------------------------------------------------------------------------------- /Resources/tractioncontrol.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/Resources/tractioncontrol.wav -------------------------------------------------------------------------------- /SimShift/SimShift.Map/ByteSearchMethods.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SimShift.MapTool 4 | { 5 | public static class ByteSearchMethods 6 | { 7 | public static unsafe List IndexesOf(this byte[] Haystack, byte[] Needle) 8 | { 9 | List Indexes = new List(); 10 | fixed (byte* H = Haystack) 11 | fixed (byte* N = Needle) 12 | { 13 | int i = 0; 14 | for (byte* hNext = H, hEnd = H + Haystack.Length; hNext < hEnd; i++, hNext++) 15 | { 16 | bool Found = true; 17 | for (byte* hInc = hNext, nInc = N, nEnd = N + Needle.LongLength; 18 | Found && nInc < nEnd; 19 | Found = *nInc == *hInc, nInc++, hInc++) ; 20 | if (Found) Indexes.Add(i); 21 | } 22 | return Indexes; 23 | } 24 | } 25 | 26 | public static unsafe List IndexesOfUlong(this byte[] Haystack, byte[] Needle) 27 | { 28 | List Indexes = new List(); 29 | fixed (byte* H = Haystack) 30 | fixed (byte* N = Needle) 31 | { 32 | int i = 0; 33 | for (byte* hNext = H, hEnd = H + Haystack.Length; hNext < hEnd; i++, hNext++) 34 | { 35 | if (*((ulong*) hNext) == *((ulong*) N)) Indexes.Add(i); 36 | } 37 | return Indexes; 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2Company.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace SimShift.MapTool 4 | { 5 | public class Ets2Company 6 | { 7 | public Ets2Mapper Mapper { get; private set; } 8 | 9 | public Ets2Prefab Prefab; 10 | public string PrefabID { get; private set; } 11 | 12 | public int MinX; 13 | public int MinY; 14 | public int MaxX; 15 | public int MaxY; 16 | 17 | public Ets2Company(string line, Ets2Mapper mapper) 18 | { 19 | Mapper = mapper; 20 | 21 | var d = line.Split(",".ToCharArray()); 22 | 23 | PrefabID = d[0]; 24 | int.TryParse(d[1], out MinX); 25 | int.TryParse(d[2], out MinY); 26 | int.TryParse(d[3], out MaxX); 27 | int.TryParse(d[4], out MaxY); 28 | 29 | // find prefab obj 30 | Prefab = mapper.PrefabsLookup.FirstOrDefault(x => x.IDSII == PrefabID); 31 | 32 | if (Prefab!=null) 33 | Prefab.Company = this; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2CurveHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimShift.MapTool 4 | { 5 | public class Ets2CurveHelper 6 | { 7 | public static double Hermite(float s, float P1, float P2, float T1, float T2) 8 | { 9 | double h1 = 2 * Math.Pow(s, 3) - 3 * Math.Pow(s, 2) + 1; // calculate basis function 1 10 | double h2 = -2 * Math.Pow(s, 3) + 3 * Math.Pow(s, 2); // calculate basis function 2 11 | double h3 = Math.Pow(s, 3) - 2 * Math.Pow(s, 2) + s; // calculate basis function 3 12 | double h4 = Math.Pow(s, 3) - Math.Pow(s, 2); // calculate basis function 4 13 | 14 | 15 | return h1 * P1 + // multiply and sum all funtions 16 | h2 * P2 + // together to build the interpolated 17 | h3 * T1 + // point along the curve. 18 | h4 * T2; 19 | 20 | } 21 | 22 | public static double HermiteTangent(float s, float P1, float P2, float T1, float T2) 23 | { 24 | double h1 = 6 * Math.Pow(s, 2) - 6*s; // calculate basis function 1 25 | double h2 = -6 * Math.Pow(s, 2) + 6*s; // calculate basis function 2 26 | double h3 = 3*Math.Pow(s, 2) - 4*s + 1; // calculate basis function 3 27 | double h4 = 3*Math.Pow(s, 2) - 2*s; // calculate basis function 4 28 | 29 | 30 | return h1 * P1 + // multiply and sum all funtions 31 | h2 * P2 + // together to build the interpolated 32 | h3 * T1 + // point along the curve. 33 | h4 * T2; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2ItemSearchRequest.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.MapTool 2 | { 3 | public class Ets2ItemSearchRequest 4 | { 5 | public Ets2Node Node; 6 | public ulong ItemUID; 7 | public bool IsForward; 8 | public bool IsBackward; 9 | } 10 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2ItemType.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.MapTool 2 | { 3 | public enum Ets2ItemType 4 | { 5 | Building = 0x01, 6 | Road = 0x02, 7 | Prefab = 0x03, 8 | Model = 0x04, 9 | Company = 0x05, 10 | Service = 0x06, 11 | CutPlane = 0x07, 12 | Dunno = 0x08, 13 | City = 0x0B, 14 | MapOverlay = 0x11, 15 | Ferry = 0x12, 16 | Garage = 0x15, 17 | Trigger = 0x21, 18 | FuelPump = 0x22, 19 | Sign = 0x23, 20 | BusStop = 0x24, 21 | TrafficRule = 0x25, 22 | } 23 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2NavigationSegmentType.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.MapTool 2 | { 3 | public enum Ets2NavigationSegmentType 4 | { 5 | Prefab, 6 | Road 7 | } 8 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2Node.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace SimShift.MapTool 8 | { 9 | public class Ets2Node 10 | { 11 | public ulong NodeUID { get; private set; } 12 | 13 | public Ets2Item ForwardItem { get; set; } 14 | public ulong ForwardItemUID { get; private set; } 15 | public Ets2Item BackwardItem { get; set; } 16 | public ulong BackwardItemUID { get; private set; } 17 | 18 | public float X; 19 | public float Y; 20 | public float Z; 21 | 22 | public float Yaw { get; private set; } 23 | public float Pitch { get; private set; } 24 | public float Roll { get; private set; } 25 | 26 | public Ets2Point Point 27 | { 28 | get { return new Ets2Point(X, Y, Z, Yaw); } 29 | } 30 | 31 | public Ets2Node(byte[] stream, int position) 32 | { 33 | NodeUID = BitConverter.ToUInt64(stream, position); 34 | ForwardItemUID = BitConverter.ToUInt64(stream, position + 44); 35 | BackwardItemUID = BitConverter.ToUInt64(stream, position + 44 - 8); 36 | 37 | X = BitConverter.ToInt32(stream, position + 8) / 256.0f; 38 | Y = BitConverter.ToInt32(stream, position + 12) / 256.0f; 39 | Z = BitConverter.ToInt32(stream, position + 16) / 256.0f; 40 | 41 | var rX = BitConverter.ToSingle(stream, position + 20); 42 | var rY = BitConverter.ToSingle(stream, position + 24); 43 | var rZ = BitConverter.ToSingle(stream, position + 28); 44 | 45 | Yaw = (float) Math.PI-(float)Math.Atan2(rZ, rX); 46 | Yaw = Yaw%(float)Math.PI*2; 47 | // X,Y,Z is position of NodeUID 48 | // ForwardItemUID = Forward item 49 | // BackwardItemUID = Backward item 50 | 51 | //Console.WriteLine(position.ToString("X4") + " | " + NodeUID.ToString("X16") + " " + ForwardItemUID.ToString("X16") + " " + BackwardItemUID.ToString("X16") + " @ " + string.Format("{0} {1} {2} {3} {4} {5} {6} {7}de", X, Y, Z, rX,rY,rZ,Yaw,Yaw/Math.PI*180)); 52 | 53 | Yaw = (float)Math.PI*0.5f - Yaw; 54 | } 55 | 56 | public override string ToString() 57 | { 58 | return "Node #" + NodeUID.ToString("X16") + " ("+X+","+Y+","+Z+")"; 59 | } 60 | 61 | public IEnumerable GetItems() 62 | { 63 | if (ForwardItem != null) 64 | yield return ForwardItem; 65 | if (BackwardItem != null) 66 | yield return BackwardItem; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2Point.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | 4 | namespace SimShift.MapTool 5 | { 6 | public class Ets2Point 7 | { 8 | public float X; 9 | public float Y; 10 | public float Z; 11 | public float Heading; 12 | 13 | public Ets2Point(float x, float y, float z, float heading) 14 | { 15 | X = x; 16 | Y = y; 17 | Z = z; 18 | Heading = heading; 19 | } 20 | 21 | public Ets2Point(PointF fr) 22 | { 23 | X = fr.X; 24 | Y = 0; 25 | Z = fr.Y; 26 | Heading = 0; 27 | } 28 | 29 | public PointF ToPoint() 30 | { 31 | return new PointF(X, Z); 32 | } 33 | 34 | public override string ToString() 35 | { 36 | return "P " + Math.Round(X, 2) + "," + Math.Round(Z, 2) + " / " + Math.Round(Heading/Math.PI*180,1) + "deg (" + 37 | Math.Round(Heading, 3) + ")"; 38 | } 39 | 40 | public bool CloseTo(Ets2Point pt) 41 | { 42 | return DistanceTo(pt) <= 2f; 43 | } 44 | 45 | public float DistanceTo(Ets2Point pt) 46 | { 47 | if (pt == null) return float.MaxValue; 48 | var dx = pt.X - X; 49 | var dy = pt.Z - Z; 50 | 51 | var dst = (float) Math.Sqrt(dx * dx + dy * dy); 52 | 53 | return dst; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2PrefabCurve.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SimShift.MapTool 4 | { 5 | public class Ets2PrefabCurve 6 | { 7 | public float StartX; 8 | public float StartY; 9 | public float StartZ; 10 | 11 | public float StartRotationX; 12 | public float StartRotationY; 13 | public float StartRotationZ; 14 | 15 | public float EndX; 16 | public float EndY; 17 | public float EndZ; 18 | 19 | public float EndRotationX; 20 | public float EndRotationY; 21 | public float EndRotationZ; 22 | 23 | public int[] Next; 24 | public int[] Prev; 25 | 26 | public float Length; 27 | 28 | public double StartYaw { get; set; } 29 | public double EndYaw { get; set; } 30 | 31 | public List NextCurve { get; set; } 32 | public List PrevCurve { get; set; } 33 | public int Index { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2PrefabNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SimShift.MapTool 4 | { 5 | public class Ets2PrefabNode 6 | { 7 | public float X; 8 | public float Y; 9 | public float Z; 10 | 11 | public float RotationX; 12 | public float RotationY; 13 | public float RotationZ; 14 | 15 | public List InputCurve; 16 | public List OutputCurve; 17 | 18 | public double Yaw { get; set; } 19 | public int Node { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2PrefabRoute.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace SimShift.MapTool 5 | { 6 | public class Ets2PrefabRoute 7 | { 8 | public IndicatorSignal Indicator; 9 | 10 | public List Route { get; private set; } 11 | 12 | public int Start { get { return Route.FirstOrDefault().Index; } } 13 | public int End { get { return Route.LastOrDefault().Index; } } 14 | 15 | public Ets2PrefabNode Entry { get; private set; } 16 | public Ets2PrefabNode Exit { get; private set; } 17 | 18 | public Ets2PrefabRoute(List route, Ets2PrefabNode entry, Ets2PrefabNode exit) 19 | { 20 | Route = route; 21 | 22 | Entry = entry; 23 | Exit = exit; 24 | 25 | // TODO: Interpret indicator signal 26 | 27 | } 28 | 29 | public override string ToString() 30 | { 31 | return "Prefab route " + Start + " to " + End; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Ets2RoadLook.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace SimShift.MapTool 5 | { 6 | public class Ets2RoadLook 7 | { 8 | public bool IsHighway { get; private set; } 9 | public bool IsLocal { get; private set; } 10 | public bool IsExpress { get; private set; } 11 | public string LookID { get; private set; } 12 | private Ets2Mapper Mapper; 13 | 14 | public float Offset; 15 | public float SizeLeft; 16 | public float SizeRight; 17 | public float ShoulderLeft; 18 | public float ShoulderRight; 19 | 20 | public int LanesLeft; 21 | public int LanesRight; 22 | 23 | public Ets2RoadLook(string look, Ets2Mapper mapper) 24 | { 25 | LookID = look; 26 | Mapper = mapper; 27 | 28 | var roadLookData = mapper.LUTFolder + "-roadlook.sii"; 29 | var fileData = File.ReadAllLines(roadLookData); 30 | 31 | var found = false; 32 | foreach (var k in fileData) 33 | { 34 | if (!found) 35 | { 36 | if (k.StartsWith("road_look") && k.Contains(LookID)) 37 | { 38 | found = true; 39 | } 40 | } 41 | else 42 | { 43 | //value: 44 | if (k.Contains(":")) 45 | { 46 | var key = k; 47 | var data = key.Substring(key.IndexOf(":")+1).Trim(); 48 | key = key.Substring(0, key.IndexOf(":")).Trim(); 49 | 50 | switch (key) 51 | { 52 | case "road_size_left": 53 | float.TryParse(data, out SizeLeft); 54 | break; 55 | 56 | case "road_size_right": 57 | float.TryParse(data, out SizeRight); 58 | break; 59 | 60 | case "shoulder_size_right": 61 | float.TryParse(data, out ShoulderLeft); 62 | break; 63 | 64 | case "shoulder_size_left": 65 | float.TryParse(data, out ShoulderRight); 66 | break; 67 | 68 | case "road_offset": 69 | float.TryParse(data, out Offset); 70 | break; 71 | case "lanes_left[]": 72 | LanesLeft++; 73 | IsLocal = (data == "traffic_lane.road.local"); 74 | IsExpress = (data == "traffic_lane.road.expressway"); 75 | IsHighway = (data == "traffic_lane.road.motorway"); 76 | 77 | break; 78 | 79 | case "lanes_right[]": 80 | LanesRight++; 81 | break; 82 | } 83 | } 84 | if (k.Trim() == "}") 85 | break; 86 | } 87 | } 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/IndicatorSignal.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.MapTool 2 | { 3 | public enum IndicatorSignal 4 | { 5 | None, 6 | Left, 7 | Right 8 | } 9 | } -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SimShift.Map")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("SimShift.Map")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3be4a8d8-c6cd-4f7b-9d70-a2ea2cd18b4d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SimShift/SimShift.Map/SimShift.MapTool.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BFC2FB74-143A-4278-B7F3-943F60803345} 8 | Library 9 | Properties 10 | SimShift.Map 11 | SimShift.Map 12 | v4.0 13 | 512 14 | Client 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | true 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | true 34 | 35 | 36 | 37 | Z:\Software\SimShift\Binaries\MathNet.Numerics.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /SimShift/SimShift.Map/Splines/ArrayUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace SimShift.Map.Splines 4 | { 5 | /// 6 | /// Utility methods for arrays. 7 | /// 8 | public static class ArrayUtil 9 | { 10 | /// 11 | /// Create a string to display the array values. 12 | /// 13 | /// The array 14 | /// Optional. A string to use to format each value. Must contain the colon, so something like ':0.000' 15 | public static string ToString(T[] array, string format = "") 16 | { 17 | var s = new StringBuilder(); 18 | string formatString = "{0" + format + "}"; 19 | 20 | for (int i = 0; i < array.Length; i++) 21 | { 22 | if (i < array.Length - 1) 23 | { 24 | s.AppendFormat(formatString + ", ", array[i]); 25 | } 26 | else 27 | { 28 | s.AppendFormat(formatString, array[i]); 29 | } 30 | } 31 | 32 | return s.ToString(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SimShift/SimShift.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimShift", "SimShift\SimShift.csproj", "{4B79AB62-2794-43A8-9710-32731CDAFA72}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimShift.MapTool", "SimShift.Map\SimShift.MapTool.csproj", "{BFC2FB74-143A-4278-B7F3-943F60803345}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|Mixed Platforms = Debug|Mixed Platforms 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|Mixed Platforms = Release|Mixed Platforms 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Debug|Any CPU.ActiveCfg = Debug|x86 19 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 20 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Debug|Mixed Platforms.Build.0 = Debug|x86 21 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Debug|x86.ActiveCfg = Debug|x86 22 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Debug|x86.Build.0 = Debug|x86 23 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Release|Any CPU.ActiveCfg = Release|x86 24 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Release|Mixed Platforms.ActiveCfg = Release|x86 25 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Release|Mixed Platforms.Build.0 = Release|x86 26 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Release|x86.ActiveCfg = Release|x86 27 | {4B79AB62-2794-43A8-9710-32731CDAFA72}.Release|x86.Build.0 = Release|x86 28 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 31 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 32 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Debug|x86.ActiveCfg = Debug|Any CPU 33 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 36 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Release|Mixed Platforms.Build.0 = Release|Any CPU 37 | {BFC2FB74-143A-4278-B7F3-943F60803345}.Release|x86.ActiveCfg = Release|Any CPU 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | GlobalSection(Performance) = preSolution 43 | HasPerformanceSessions = true 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /SimShift/SimShift/Controllers/JoystickInputDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.Win32; 5 | 6 | namespace SimShift.Controllers 7 | { 8 | public class JoystickInputDevice 9 | { 10 | private const string RegKeyAxisData = @"SYSTEM\ControlSet001\Control\MediaProperties\PrivateProperties\Joystick\OEM"; 11 | private const string RegKeyPlace = @"System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\"; 12 | private const string RegReferencePlace = @"System\CurrentControlSet\Control\MediaResources\Joystick\DINPUT.DLL\CurrentJoystickSettings"; 13 | 14 | public int id; 15 | public JOYCAPS data; 16 | 17 | public Dictionary AxisNames = new Dictionary(); 18 | 19 | public string Name { get; private set; } 20 | 21 | public JoystickInputDevice(JOYCAPS captured, int device) 22 | { 23 | id = device; 24 | 25 | // Copy all members. 26 | data = new JOYCAPS(); 27 | data.szPname = captured.szPname; 28 | data.wMid = captured.wMid; 29 | data.wPid = captured.wPid; 30 | data.wXmin = captured.wXmin; 31 | data.wXmax = captured.wXmax; 32 | data.wYmin = captured.wYmin; 33 | data.wYmax = captured.wYmax; 34 | data.wZmin = captured.wZmin; 35 | data.wZmax = captured.wZmax; 36 | data.wNumButtons = captured.wNumButtons; 37 | data.wPeriodMin = captured.wPeriodMin; 38 | data.wPeriodMax = captured.wPeriodMax; 39 | 40 | // Search register. 41 | RegistryKey rf = Registry.CurrentUser.OpenSubKey(RegReferencePlace); 42 | string USBDevice = Convert.ToString(rf.GetValue("Joystick" + (1 + id).ToString() + "OEMName")); 43 | RegistryKey usb = Registry.CurrentUser.OpenSubKey(RegKeyPlace); 44 | usb = usb.OpenSubKey(USBDevice); 45 | Name = (string)usb.GetValue("OEMName"); 46 | 47 | // Get axis names 48 | RegistryKey axisMaster = Registry.LocalMachine.OpenSubKey(RegKeyAxisData).OpenSubKey(USBDevice); 49 | 50 | AxisNames = new Dictionary(); 51 | if (axisMaster != null) 52 | { 53 | axisMaster = axisMaster.OpenSubKey("Axes"); 54 | if (axisMaster != null) 55 | { 56 | foreach (string name in axisMaster.GetSubKeyNames()) 57 | { 58 | RegistryKey axis = axisMaster.OpenSubKey(name); 59 | AxisNames.Add(Convert.ToInt32(name), (string)axis.GetValue("")); 60 | axis.Close(); 61 | } 62 | axisMaster.Close(); 63 | } 64 | } 65 | rf.Close(); 66 | usb.Close(); 67 | } 68 | 69 | public static IEnumerable Search(string name) 70 | { 71 | var results1 = Search(); 72 | var results2 = results1.Where(dev => dev.Name.ToLower().Contains(name.ToLower())); 73 | 74 | return results2; 75 | } 76 | 77 | 78 | /******************* STATIC ******************/ 79 | static int deviceNumber = 0; 80 | public static IEnumerable Search() 81 | { 82 | List Joysticks = new List(); 83 | 84 | JOYCAPS CapturedJoysticks; 85 | uint devs = JoystickMethods.joyGetNumDevs(); 86 | for (deviceNumber = 0; deviceNumber < devs; deviceNumber++) 87 | { 88 | UInt32 res = JoystickMethods.joyGetDevCaps(deviceNumber, out CapturedJoysticks, JOYCAPS.Size); 89 | if (res != 165) 90 | { 91 | Joysticks.Add(new JoystickInputDevice(CapturedJoysticks, deviceNumber)); 92 | } 93 | } 94 | 95 | return Joysticks; 96 | } 97 | 98 | } 99 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Controllers/JoystickMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SimShift.Controllers 5 | { 6 | public static class JoystickMethods 7 | { 8 | [DllImport("Winmm.dll")] 9 | public static extern UInt32 joyGetDevCaps(Int32 uJoyID, out JOYCAPS pjc, Int32 cbjc); 10 | [DllImport("Winmm.dll")] 11 | public static extern UInt32 joyGetPosEx(Int32 uJoyID, out JOYINFOEX pji); 12 | [DllImport("Winmm.dll")] 13 | public static extern UInt32 joyGetNumDevs(); 14 | } 15 | public enum JoystickError 16 | { 17 | NoError = 0, 18 | InvalidParameters = 165, 19 | NoCanDo = 166, 20 | Unplugged = 167 21 | } 22 | 23 | [Flags()] 24 | public enum JoystickFlags 25 | { 26 | JOY_RETURNX = 0x1, 27 | JOY_RETURNY = 0x2, 28 | JOY_RETURNZ = 0x4, 29 | JOY_RETURNR = 0x8, 30 | JOY_RETURNU = 0x10, 31 | JOY_RETURNV = 0x20, 32 | JOY_RETURNPOV = 0x40, 33 | JOY_RETURNBUTTONS = 0x80, 34 | JOY_RETURNALL = (JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | JOY_RETURNR | JOY_RETURNU | JOY_RETURNV | JOY_RETURNPOV | JOY_RETURNBUTTONS) 35 | } 36 | 37 | public class WinMM 38 | { 39 | // Verreweg van compleet 40 | public const int MAXPNAMELEN = 32; 41 | } 42 | [Flags] 43 | public enum JoystCapsFlags 44 | { 45 | HasZ = 0x1, 46 | HasR = 0x2, 47 | HasU = 0x4, 48 | HasV = 0x8, 49 | HasPov = 0x16, 50 | HasPov4Dir = 0x32, 51 | HasPovContinuous = 0x64 52 | } 53 | 54 | public struct JOYCAPS 55 | { 56 | public short wMid; 57 | public short wPid; 58 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = WinMM.MAXPNAMELEN)] 59 | public string szPname; 60 | public uint wXmin; 61 | public uint wXmax; 62 | public uint wYmin; 63 | public uint wYmax; 64 | public uint wZmin; 65 | public uint wZmax; 66 | public uint wNumButtons; 67 | public uint wPeriodMin; 68 | public uint wPeriodMax; 69 | public uint RMin; 70 | public uint RMax; 71 | public uint UMin; 72 | public uint UMax; 73 | public uint VMin; 74 | public uint VMax; 75 | public JoystCapsFlags Capabilities; 76 | public uint MaxAxes; 77 | public uint NumAxes; 78 | public uint MaxButtons; 79 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] 80 | public string RegKey; 81 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] 82 | public string OemVxD; 83 | 84 | public static readonly int SizeInBytes; 85 | 86 | public static int Size { get { return Marshal.SizeOf(default(JOYCAPS)); } } 87 | } 88 | public struct JOYINFOEX 89 | { 90 | public int dwSize; 91 | public JoystickFlags dwFlags; 92 | public int dwXpos; 93 | public int dwYpos; 94 | public int dwZpos; 95 | public int dwRpos; 96 | public int dwUpos; 97 | public int dwVpos; 98 | public int dwButtons; 99 | public int dwButtonNumber; 100 | public int dwPOV; 101 | public int dwReserved1; 102 | public int dwReserved2; 103 | } 104 | public struct JOYINFO 105 | { 106 | public int wXpos; 107 | public int wYpos; 108 | public int wZpos; 109 | public int wButtons; 110 | } 111 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Common/GenericDataDefinition.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Data.Common 2 | { 3 | public class GenericDataDefinition : IDataDefinition 4 | { 5 | public GenericDataDefinition(string car, float time, bool paused, int gear, int gears, float engineRpm, float fuel, float throttle, float brake, float speed) 6 | { 7 | Car = car; 8 | Time = time; 9 | Paused = paused; 10 | Gear = gear; 11 | Gears = gears; 12 | EngineRpm = engineRpm; 13 | Fuel = fuel; 14 | Throttle = throttle; 15 | Brake = brake; 16 | Speed = speed; 17 | } 18 | 19 | public string Car { get; set; } 20 | 21 | public float Time { get; private set; } 22 | public bool Paused { get; private set; } 23 | 24 | public int Gear { get; private set; } 25 | public int Gears { get; private set; } 26 | 27 | public float EngineRpm { get; private set; } 28 | public float Fuel { get; private set; } 29 | 30 | public float Throttle { get; private set; } 31 | public float Brake { get; private set; } 32 | 33 | public float Speed { get; private set; } 34 | } 35 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Common/IDataDefinition.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Data.Common 2 | { 3 | public interface IDataDefinition 4 | { 5 | string Car { get; set; } 6 | float Time { get; } 7 | bool Paused { get; } 8 | int Gear { get; } 9 | int Gears { get; } 10 | float EngineRpm { get; } 11 | float Fuel { get; } 12 | float Throttle { get; } 13 | float Brake { get; } 14 | float Speed { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Common/IDataMiner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using SimShift.Services; 4 | 5 | namespace SimShift.Data.Common 6 | { 7 | public interface IDataMiner 8 | { 9 | string Application { get; } 10 | string Name { get; } 11 | 12 | EventHandler DataReceived { get; set; } 13 | IDataDefinition Telemetry { get; } 14 | bool Running { get; set; } 15 | bool IsActive { get; set; } 16 | bool SelectManually { get; } 17 | bool RunEvent { get; set; } 18 | Process ActiveProcess { get; set; } 19 | 20 | bool SupportsCar { get; } 21 | bool TransmissionSupportsRanges { get; } 22 | bool EnableWeirdAntistall { get; } 23 | 24 | void EvtStart(); 25 | void EvtStop(); 26 | void Write(TelemetryChannel cameraHorizon, T i); 27 | } 28 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Common/MemoryWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimShift.Data.Common 4 | { 5 | public class MemoryWriter : MemoryReader 6 | { 7 | public override bool Open() 8 | { 9 | m_hProcess = ProcessMemoryReaderApi.OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_READ, 0, (uint)m_ReadProcess.Id); 10 | return m_hProcess != IntPtr.Zero; 11 | } 12 | 13 | #region Write 14 | public void WriteFloat(IntPtr address, float value) 15 | { 16 | Write(address, BitConverter.GetBytes(value)); 17 | } 18 | 19 | public void WriteDouble(IntPtr address, double value) 20 | { 21 | Write(address, BitConverter.GetBytes(value)); 22 | } 23 | 24 | public void WriteByte(IntPtr address, byte value) 25 | { 26 | Write(address, new byte[1] { value }); 27 | } 28 | 29 | public void WriteBytes(IntPtr address, byte[] value) 30 | { 31 | Write(address, value); 32 | } 33 | 34 | public void WriteInt16(IntPtr address, short value) 35 | { 36 | Write(address, BitConverter.GetBytes(value)); 37 | } 38 | 39 | public void WriteInt32(IntPtr address, int value) 40 | { 41 | Write(address, BitConverter.GetBytes(value)); 42 | } 43 | 44 | public void WriteInt64(IntPtr address, long value) 45 | { 46 | Write(address, BitConverter.GetBytes(value)); 47 | } 48 | 49 | public void WriteUInt16(IntPtr address, ushort value) 50 | { 51 | Write(address, BitConverter.GetBytes(value)); 52 | } 53 | 54 | public void WriteUInt32(IntPtr address, uint value) 55 | { 56 | Write(address, BitConverter.GetBytes(value)); 57 | } 58 | 59 | public void WriteUInt64(IntPtr address, ulong value) 60 | { 61 | Write(address, BitConverter.GetBytes(value)); 62 | } 63 | #endregion 64 | #region Write 65 | 66 | public void WriteFloat(int address, float value) 67 | { 68 | Write((IntPtr)address, BitConverter.GetBytes(value)); 69 | } 70 | 71 | public void WriteDouble(int address, double value) 72 | { 73 | Write((IntPtr)address, BitConverter.GetBytes(value)); 74 | } 75 | 76 | public void WriteByte(int address, byte value) 77 | { 78 | Write((IntPtr)address, new byte[1] { value }); 79 | } 80 | 81 | public void WriteBytes(int address, byte[] value) 82 | { 83 | Write((IntPtr)address, value); 84 | } 85 | 86 | public void WriteInt16(int address, short value) 87 | { 88 | Write((IntPtr)address, BitConverter.GetBytes(value)); 89 | } 90 | 91 | public void WriteInt32(int address, int value) 92 | { 93 | Write((IntPtr)address, BitConverter.GetBytes(value)); 94 | } 95 | 96 | public void WriteInt64(int address, long value) 97 | { 98 | Write((IntPtr)address, BitConverter.GetBytes(value)); 99 | } 100 | 101 | public void WriteUInt16(int address, ushort value) 102 | { 103 | Write((IntPtr)address, BitConverter.GetBytes(value)); 104 | } 105 | 106 | public void WriteUInt32(int address, uint value) 107 | { 108 | Write((IntPtr)address, BitConverter.GetBytes(value)); 109 | } 110 | 111 | public void WriteUInt64(int address, ulong value) 112 | { 113 | Write((IntPtr)address, BitConverter.GetBytes(value)); 114 | } 115 | #endregion 116 | protected void Write(IntPtr address, byte[] data) 117 | { 118 | int bytesWritten; 119 | ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, address, data, (UIntPtr)data.Length, out bytesWritten); 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Common/ProcessMemoryReaderApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SimShift.Data.Common 5 | { 6 | /// 7 | /// ProcessMemoryReader is a class that enables direct reading a process memory 8 | /// 9 | class ProcessMemoryReaderApi 10 | { 11 | // constants information can be found in 12 | 13 | // function declarations are found in the MSDN and in 14 | 15 | // HANDLE OpenProcess( 16 | // DWORD dwDesiredAccess, // access flag 17 | // BOOL bInheritHandle, // handle inheritance option 18 | // DWORD dwProcessId // process identifier 19 | // ); 20 | [DllImport("kernel32.dll")] 21 | public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId); 22 | 23 | // BOOL CloseHandle( 24 | // HANDLE hObject // handle to object 25 | // ); 26 | [DllImport("kernel32.dll")] 27 | public static extern Int32 CloseHandle(IntPtr hObject); 28 | 29 | // BOOL ReadProcessMemory( 30 | // HANDLE hProcess, // handle to the process 31 | // LPCVOID lpBaseAddress, // base of memory area 32 | // LPVOID lpBuffer, // data buffer 33 | // SIZE_T nSize, // number of bytes to read 34 | // SIZE_T * lpNumberOfBytesRead // number of bytes read 35 | // ); 36 | [DllImport("kernel32.dll")] 37 | public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead); 38 | 39 | [DllImport("kernel32.dll")] 40 | public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out int lpNumberOfBytesWritten); 41 | [DllImport("kernel32.dll", SetLastError = true)] 42 | public static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, uint dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow, uint dwNumberOfBytesToMap); 43 | [DllImport("kernel32.dll", SetLastError = true)] 44 | public static extern IntPtr OpenFileMapping(uint dwDesiredAccess, bool bInheritHandle, string lpName); 45 | [DllImport("kernel32.dll", SetLastError = true)] 46 | public static extern bool UnmapViewOfFile(IntPtr lpBaseAddress); 47 | 48 | [DllImport("kernel32.dll")] 49 | public static extern Int32 GetLastError(); 50 | } 51 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Common/SharedMemory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO.MemoryMappedFiles; 4 | using System.Net; 5 | using System.Net.NetworkInformation; 6 | using System.Net.Sockets; 7 | using System.Runtime.InteropServices; 8 | 9 | namespace SimShift.Data.Common 10 | { 11 | public class SharedMemory 12 | { 13 | public const uint mapSize = 16*1024; 14 | 15 | public bool Hooked { get; private set; } 16 | public T Data { get; private set; } 17 | 18 | public byte[] RawData { get; private set; } 19 | 20 | private MemoryMappedFile _memoryMappedFile; 21 | private MemoryMappedViewAccessor _memoryMappedBuffer; 22 | 23 | //private UdpClient udpServer; 24 | 25 | public void Connect(string map) 26 | { 27 | try 28 | { 29 | RawData = new byte[mapSize]; //Marshal.SizeOf(typeof(T))]; 30 | 31 | //_mMMF = MemoryMappedFile.OpenExisting(map, MemoryMappedFileRights.TakeOwnership); 32 | _memoryMappedFile = MemoryMappedFile.CreateOrOpen(map, mapSize, MemoryMappedFileAccess.ReadWrite); 33 | _memoryMappedBuffer = _memoryMappedFile.CreateViewAccessor(0, mapSize); 34 | 35 | /*udpServer = new UdpClient(); 36 | 37 | // Look up my wi-fi 38 | var ifaceIndex = 0; 39 | 40 | NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); 41 | foreach (NetworkInterface adapter in nics) 42 | { 43 | if (adapter.Name.Contains("Wireless")) 44 | { 45 | 46 | IPv4InterfaceProperties p = adapter.GetIPProperties().GetIPv4Properties(); 47 | ifaceIndex = p.Index; 48 | // now we have adapter index as p.Index, let put it to socket option 49 | udpServer.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, 50 | (int)IPAddress.HostToNetworkOrder(p.Index)); 51 | break; 52 | } 53 | } 54 | 55 | var ip = IPAddress.Parse("224.5.6.8"); 56 | udpServer.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip,ifaceIndex)); 57 | udpServer.Connect(new IPEndPoint(ip, 1235));*/ 58 | 59 | Hooked = true; 60 | } 61 | catch (Exception e) 62 | { 63 | Hooked = false; 64 | // 65 | } 66 | } 67 | 68 | public void Disconnect() 69 | { 70 | Hooked = false; 71 | _memoryMappedBuffer.Dispose(); 72 | _memoryMappedFile.Dispose(); 73 | } 74 | 75 | public void Update() 76 | { 77 | if (_memoryMappedBuffer == null) return; 78 | 79 | _memoryMappedBuffer.ReadArray(0, RawData, 0, RawData.Length); 80 | 81 | Data = ToObject(RawData); 82 | 83 | //udpServer.Send(RawData, RawData.Length); 84 | } 85 | 86 | // Casts raw byte stream to object. 87 | protected T ToObject(byte[] structureDataBytes) 88 | { 89 | T createdObject = default(T); 90 | 91 | var memoryObjectSize = Marshal.SizeOf(typeof(T)); 92 | 93 | // Cannot create object from array that is too small. 94 | if (memoryObjectSize > structureDataBytes.Length) 95 | return createdObject; 96 | 97 | // Reserve unmanaged memory, copy structureDataBytes bytes to there, and convert this unmanaged memory to a managed type. 98 | // Then free memory. 99 | var reservedMemPtr = Marshal.AllocHGlobal(memoryObjectSize); 100 | 101 | Marshal.Copy(structureDataBytes, 0, reservedMemPtr, memoryObjectSize); 102 | 103 | createdObject = (T)Marshal.PtrToStructure(reservedMemPtr, typeof(T)); 104 | 105 | Marshal.FreeHGlobal(reservedMemPtr); 106 | 107 | return createdObject; 108 | } 109 | 110 | 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Ets2DataAuxilliary.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Data 2 | { 3 | public enum Ets2DataAuxilliary : int 4 | { 5 | CruiseControl = 0, 6 | Wipers = 1, 7 | 8 | ParkBrake = 2, 9 | MotorBrake = 3, 10 | 11 | ElectricEnabled = 4, 12 | EngineEnabled = 5, 13 | 14 | BlinkerLeftActive = 6, 15 | BlinkerRightActive = 7, 16 | BlinkerLeftOn = 8, 17 | BlinkerRightOn = 9, 18 | 19 | LightsParking = 10, 20 | LightsBeamLow = 11, 21 | LightsBeamHigh = 12, 22 | LightsAuxFront = 13, 23 | LightsAuxRoof = 14, 24 | LightsBeacon = 15, 25 | LightsBrake = 16, 26 | LightsReverse = 17, 27 | 28 | BatteryVoltageWarning = 18, 29 | AirPressureWarning = 19, 30 | AirPressureEmergency = 20, 31 | AdblueWarning = 21, 32 | OilPressureWarning = 22, 33 | WaterTemperatureWarning = 23, 34 | } 35 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Ets2DataDebug.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Data 2 | { 3 | partial class Ets2DataDebug 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.label1 = new System.Windows.Forms.Label(); 32 | this.SuspendLayout(); 33 | // 34 | // label1 35 | // 36 | this.label1.AutoSize = true; 37 | this.label1.Location = new System.Drawing.Point(12, 9); 38 | this.label1.Name = "label1"; 39 | this.label1.Size = new System.Drawing.Size(35, 13); 40 | this.label1.TabIndex = 0; 41 | this.label1.Text = "label1"; 42 | // 43 | // Ets2DataDebug 44 | // 45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 47 | this.ClientSize = new System.Drawing.Size(778, 460); 48 | this.Controls.Add(this.label1); 49 | this.Name = "Ets2DataDebug"; 50 | this.Text = "Ets2DataDebug"; 51 | this.ResumeLayout(false); 52 | this.PerformLayout(); 53 | 54 | } 55 | 56 | #endregion 57 | 58 | private System.Windows.Forms.Label label1; 59 | } 60 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/IDataField.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimTelemetry.Domain.Memory 4 | { 5 | public interface IDataField 6 | { 7 | string Name { get; } 8 | Type ValueType { get; } 9 | 10 | bool HasChanged(); 11 | 12 | T ReadAs(); 13 | } 14 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/IDataNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml; 3 | 4 | namespace SimTelemetry.Domain.Memory 5 | { 6 | public interface IDataNode 7 | { 8 | Dictionary Fields { get; } 9 | 10 | string Name { get; } 11 | T ReadAs(string field); 12 | IEnumerable GetDataFields(); 13 | byte[] ReadBytes(string field); 14 | void GetDebugInfo(XmlWriter file); 15 | IDataNode Clone(string newName, int newAddress); 16 | } 17 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/IDataProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SimTelemetry.Domain.Memory 4 | { 5 | public interface IDataProvider 6 | { 7 | IDataNode Get(string name); 8 | IEnumerable GetAll(); 9 | 10 | void MarkDirty(); 11 | void Refresh(); 12 | } 13 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/IMemoryObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SimTelemetry.Domain.Memory; 3 | 4 | namespace SimShift.Data.Memory 5 | { 6 | public interface IMemoryObject : IDataField, ICloneable 7 | { 8 | string Name { get; } 9 | MemoryProvider Memory { get; } 10 | MemoryAddress AddressType { get; } 11 | 12 | bool IsDynamic { get; } 13 | bool IsStatic { get; } 14 | bool IsConstant { get; } 15 | 16 | MemoryPool Pool { get; } 17 | int Offset { get; } 18 | int Address { get; } 19 | int Size { get; } 20 | Type ValueType { get; } 21 | 22 | T ReadAs(); 23 | object Read(); 24 | bool HasChanged(); 25 | 26 | void MarkDirty(); 27 | 28 | void Refresh(); 29 | void SetProvider(MemoryProvider provider); 30 | void SetPool(MemoryPool pool); 31 | } 32 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryAddress.cs: -------------------------------------------------------------------------------- 1 | namespace SimTelemetry.Domain.Memory 2 | { 3 | public enum MemoryAddress 4 | { 5 | Static, 6 | StaticAbsolute, 7 | Dynamic, 8 | Constant 9 | } 10 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryDataConverterProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimTelemetry.Domain.Memory 4 | { 5 | public class MemoryDataConverterProvider 6 | { 7 | public Type DataType { get { return typeof(T); } } 8 | public Func Byte2Obj { get; private set; } 9 | public Func Obj2Obj { get; private set; } 10 | 11 | public MemoryDataConverterProvider(Func byte2obj, Func obj2obj) 12 | { 13 | Byte2Obj = byte2obj; 14 | Obj2Obj = obj2obj; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryFieldConstant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SimShift.Data.Memory; 3 | 4 | namespace SimTelemetry.Domain.Memory 5 | { 6 | public class MemoryFieldConstant : IMemoryObject 7 | { 8 | 9 | public string Name { get; protected set; } 10 | public MemoryPool Pool { get; protected set; } 11 | 12 | public MemoryProvider Memory { get; protected set; } 13 | public MemoryAddress AddressType { get { return MemoryAddress.Constant; } } 14 | 15 | public bool IsDynamic { get { return false; } } 16 | public bool IsStatic { get { return false; } } 17 | public bool IsConstant { get { return true; } } 18 | 19 | public int Address { get { return 0; } } 20 | public int Offset { get { return 0; } } 21 | public int Size { get { return 0; } } 22 | 23 | public T StaticValue { get; protected set; } 24 | public Type ValueType { get { return typeof(T); } } 25 | 26 | private bool firstCall = true; 27 | 28 | public virtual object Read() 29 | { 30 | return StaticValue; 31 | } 32 | 33 | public bool HasChanged() 34 | { 35 | if (firstCall) 36 | { 37 | firstCall = false; 38 | return true; 39 | } 40 | return false; 41 | } 42 | 43 | public void MarkDirty() 44 | { 45 | firstCall = true; 46 | } 47 | 48 | public MemoryFieldConstant(string name, T staticValue) 49 | { 50 | Name = name; 51 | StaticValue = staticValue; 52 | } 53 | 54 | public TOut ReadAs() 55 | { 56 | return MemoryDataConverter.Cast(StaticValue); 57 | } 58 | 59 | public void Refresh() 60 | { 61 | // Done! 62 | } 63 | 64 | public void SetProvider(MemoryProvider provider) 65 | { 66 | Memory = provider; // don't care 67 | } 68 | 69 | public void SetPool(MemoryPool pool) 70 | { 71 | Pool = pool; // don't care 72 | } 73 | 74 | public object Clone() 75 | { 76 | var newObj = new MemoryFieldConstant(Name, StaticValue); 77 | return newObj; 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryFieldFunc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SimShift.Data.Memory; 3 | 4 | namespace SimTelemetry.Domain.Memory 5 | { 6 | public class MemoryFieldFunc : IMemoryObject 7 | { 8 | public string Name { get; protected set; } 9 | public MemoryPool Pool { get; protected set; } 10 | 11 | public MemoryProvider Memory { get; protected set; } 12 | public MemoryAddress AddressType { get { return MemoryAddress.Constant; } } 13 | 14 | public bool IsDynamic { get { return false; } } 15 | public bool IsStatic { get { return false; } } 16 | public bool IsConstant { get { return false; } } 17 | 18 | public int Address { get { return 0; } } 19 | public int Offset { get { return 0; } } 20 | public int Size { get { return 0; } } 21 | 22 | public Type ValueType { get { return typeof (T); } } 23 | 24 | public Func ValidationFunc { get; protected set; } 25 | 26 | public MemoryFieldFunc(string name, Func validationFunc) 27 | { 28 | Name = name; 29 | ValidationFunc = validationFunc; 30 | IsChanging = true; 31 | } 32 | 33 | public MemoryFieldFunc(string name, Func validationFunc, bool isChanging) 34 | { 35 | Name = name; 36 | ValidationFunc = validationFunc; 37 | IsChanging = isChanging; 38 | } 39 | 40 | public object Read() 41 | { 42 | return ValidationFunc(Pool); 43 | } 44 | 45 | protected bool IsChanging = false; 46 | public virtual bool HasChanged() 47 | { 48 | return IsChanging; 49 | } 50 | 51 | public void MarkDirty() 52 | { 53 | IsChanging = true; 54 | } 55 | 56 | public TOut ReadAs() 57 | { 58 | return MemoryDataConverter.Cast(ValidationFunc(Pool)); 59 | } 60 | 61 | public void Refresh() 62 | { 63 | // Done! 64 | } 65 | 66 | public void SetProvider(MemoryProvider provider) 67 | { 68 | Memory = provider; 69 | } 70 | 71 | public void SetPool(MemoryPool pool) 72 | { 73 | Pool = pool; 74 | } 75 | 76 | public object Clone() 77 | { 78 | var newObj = new MemoryFieldFunc(Name, ValidationFunc); 79 | return newObj; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryFieldLazy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimTelemetry.Domain.Memory 4 | { 5 | public class MemoryFieldLazy : MemoryField 6 | { 7 | #region Lazyness 8 | protected Lazy _LazyValue; 9 | public override T Value 10 | { 11 | get 12 | { 13 | if (_LazyValue == null) Refresh(); 14 | return _LazyValue.Value; 15 | } 16 | } 17 | 18 | protected bool Refreshed = false; 19 | public override bool HasChanged() 20 | { 21 | if (!Refreshed) return false; 22 | if (readCounter < 2) return true; 23 | if (_OldValue == null) return true; 24 | bool what = _OldValue.Equals(_Value); 25 | return !what; 26 | } 27 | 28 | public override void Refresh() 29 | { 30 | Refreshed = false; 31 | if (_LazyValue == null || _LazyValue.IsValueCreated) 32 | { 33 | _LazyValue = new Lazy(() => 34 | { 35 | readCounter++; 36 | Refreshed = true; 37 | _OldValue = _Value; 38 | if (IsStatic) 39 | RefreshStatic(); 40 | else 41 | RefreshDynamic(); 42 | 43 | if (_Value != null && Conversion != null) 44 | _Value = Conversion(_Value); 45 | return _Value; 46 | }); 47 | } 48 | } 49 | #endregion 50 | #region Constructors 51 | 52 | public MemoryFieldLazy(string name, MemoryAddress type, int address, int size) 53 | : base(name, type, address, size) 54 | { 55 | } 56 | 57 | public MemoryFieldLazy(string name, MemoryAddress type, int address, int offset, int size) 58 | : base(name, type, address, offset, size) 59 | { 60 | } 61 | 62 | public MemoryFieldLazy(string name, MemoryAddress type, MemoryPool pool, int offset, int size) 63 | : base(name, type, pool, offset, size) 64 | { 65 | } 66 | 67 | public MemoryFieldLazy(string name, MemoryAddress type, int address, int size, Func conversion) 68 | : base(name, type, address, size, conversion) 69 | { 70 | } 71 | 72 | public MemoryFieldLazy(string name, MemoryAddress type, int address, int offset, int size, Func conversion) 73 | : base(name, type, address, offset, size, conversion) 74 | { 75 | } 76 | 77 | public MemoryFieldLazy(string name, MemoryAddress type, MemoryPool pool, int offset, int size, Func conversion) 78 | : base(name, type, pool, offset, size, conversion) 79 | { 80 | } 81 | 82 | #endregion 83 | } 84 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryFieldSignaturePointer.cs: -------------------------------------------------------------------------------- 1 | namespace SimTelemetry.Domain.Memory 2 | { 3 | public class MemoryFieldSignaturePointer 4 | { 5 | public int Offset { get; private set; } 6 | public string Signature { get; private set; } 7 | public bool IsDirty { get; private set; } 8 | public bool Additive { get; private set; } 9 | 10 | 11 | public MemoryFieldSignaturePointer(string signature, bool additive) 12 | { 13 | Signature = signature; 14 | Additive = additive; 15 | MarkDirty(); 16 | } 17 | 18 | public MemoryFieldSignaturePointer(int offset, bool additive) 19 | { 20 | Offset = offset; 21 | Additive = additive; 22 | IsDirty = false; 23 | } 24 | 25 | public void MarkDirty() 26 | { 27 | IsDirty = true; 28 | } 29 | 30 | public void Refresh(MemoryProvider master) 31 | { 32 | if (IsDirty && master.Scanner.Enabled && Signature != string.Empty) 33 | { 34 | Offset = master.Scanner.Scan(MemoryRegionType.EXECUTE, Signature); 35 | IsDirty = false; 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace SimTelemetry.Domain.Memory 6 | { 7 | public class MemoryProvider : IDataProvider 8 | { 9 | public int BaseAddress { get; protected set; } 10 | public MemoryReader Reader { get; protected set; } 11 | 12 | public MemorySignatureScanner Scanner { get; protected set; } 13 | 14 | public IList Pools { get { return _pools; } } 15 | private readonly IList _pools = new List(); 16 | 17 | public MemoryProvider(MemoryReader reader) 18 | { 19 | if (reader != null) 20 | { 21 | BaseAddress = reader.Process.MainModule.BaseAddress.ToInt32(); 22 | Reader = reader; 23 | 24 | Scanner = new MemorySignatureScanner(this); 25 | } 26 | } 27 | 28 | public void Add(IDataNode pool) 29 | { 30 | _pools.Add((MemoryPool) pool); 31 | ((MemoryPool)pool).SetProvider(this); 32 | } 33 | 34 | public void Remove(IDataNode pool) 35 | { 36 | _pools.Remove((MemoryPool) pool); 37 | } 38 | 39 | public IDataNode Get(string name) 40 | { 41 | return _pools.Where(x => x.Name == name).Cast().FirstOrDefault(); 42 | } 43 | 44 | public IEnumerable GetAll() 45 | { 46 | return _pools; 47 | } 48 | 49 | public void MarkDirty() 50 | { 51 | _pools.SelectMany(x => x.Fields.Values).ToList().ForEach(x => x.MarkDirty()); 52 | } 53 | 54 | public bool Contains(string name) 55 | { 56 | return _pools.Any(x => x.Name == name); 57 | } 58 | 59 | public void Refresh() 60 | { 61 | foreach (var pool in _pools) 62 | { 63 | pool.Refresh(); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryReaderApi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | 5 | namespace SimShift.Data.Memory 6 | { 7 | internal partial class MemoryReaderApi 8 | { 9 | [DllImport("kernel32.dll")] 10 | public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId); 11 | [DllImport("kernel32.dll")] 12 | public static extern Int32 CloseHandle(IntPtr hObject); 13 | [DllImport("kernel32.dll")] 14 | public static extern int VirtualQueryEx(IntPtr hProcess, IntPtr lpAddress, out MEMORY_BASIC_INFORMATION lpBuffer, uint dwLength); 15 | [DllImport("kernel32.dll")] 16 | public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead); 17 | [DllImport("kernel32.dll")] 18 | public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out int lpNumberOfBytesWritten); 19 | [DllImport("kernel32.dll", SetLastError = true)] 20 | public static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, uint dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow, uint dwNumberOfBytesToMap); 21 | [DllImport("kernel32.dll", SetLastError = true)] 22 | public static extern IntPtr OpenFileMapping(uint dwDesiredAccess, bool bInheritHandle, string lpName); 23 | [DllImport("kernel32.dll", SetLastError = true)] 24 | public static extern bool UnmapViewOfFile(IntPtr lpBaseAddress); 25 | [DllImport("kernel32.dll")] 26 | public static extern Int32 GetLastError(); 27 | 28 | [DllImport("psapi.dll")] 29 | public static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, [Out] StringBuilder lpBaseName, [In] [MarshalAs(UnmanagedType.U4)] int nSize); 30 | [DllImport("psapi.dll")] 31 | public static extern uint GetMappedFileName(IntPtr hProcess, IntPtr hAddress, [Out] StringBuilder lpBaseName, [In] [MarshalAs(UnmanagedType.U4)] int nSize); 32 | 33 | [StructLayout(LayoutKind.Sequential)] 34 | public struct MEMORY_BASIC_INFORMATION 35 | { 36 | public IntPtr BaseAddress; 37 | public IntPtr AllocationBase; 38 | public uint AllocationProtect; 39 | public uint RegionSize; 40 | public uint State; 41 | public uint Protect; 42 | public uint Type; 43 | 44 | } 45 | 46 | [Flags] 47 | public enum AccessType : uint 48 | { 49 | PROCESS_TERMINATE = (0x0001), 50 | PROCESS_CREATE_THREAD = (0x0002), 51 | PROCESS_SET_SESSIONID = (0x0004), 52 | PROCESS_VM_OPERATION = (0x0008), 53 | PROCESS_VM_READ = (0x0010), 54 | PROCESS_VM_WRITE = (0x0020), 55 | PROCESS_DUP_HANDLE = (0x0040), 56 | PROCESS_CREATE_PROCESS = (0x0080), 57 | PROCESS_SET_QUOTA = (0x0100), 58 | PROCESS_SET_INFORMATION = (0x0200), 59 | PROCESS_QUERY_INFORMATION = (0x0400) 60 | } 61 | 62 | [Flags] 63 | public enum PageFlags : uint 64 | { 65 | MEM_COMMIT = 0x1000, 66 | 67 | PAGE_READWRITE = 0x04, 68 | PAGE_WRITECOPY = 0x08, 69 | PAGE_EXECUTE = 0x10, 70 | PAGE_EXECUTE_READ = 0x20, 71 | PAGE_EXECUTE_READWRITE = 0x40, 72 | PAGE_EXECUTE_WRITECOPY = 0x80, 73 | PAGE_GUARD = 0x100, 74 | WRITABLE = PAGE_READWRITE | PAGE_WRITECOPY | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_GUARD, 75 | 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/Memory/MemoryRegionType.cs: -------------------------------------------------------------------------------- 1 | namespace SimTelemetry.Domain.Memory 2 | { 3 | public enum MemoryRegionType 4 | { 5 | EXECUTE, 6 | READ, 7 | READWRITE 8 | } 9 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/TelemetryChannel.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Data 2 | { 3 | public enum TelemetryChannel 4 | { 5 | CameraHorizon, 6 | CameraViewBase 7 | } 8 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Data/WorldMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using SimShift.Data.Common; 8 | 9 | namespace SimShift.Data 10 | { 11 | public class WorldMapper 12 | { 13 | private Ets2DataMiner source; 14 | public List cells; 15 | 16 | public WorldMapper(IDataMiner dataSource) 17 | { 18 | if (dataSource.Application == "eurotrucks2" && !dataSource.SelectManually) 19 | { 20 | source = dataSource as Ets2DataMiner; 21 | source.DataReceived += OnDataReceived; 22 | 23 | cells = new List(); 24 | 25 | Import(); 26 | } 27 | } 28 | 29 | public WorldMapCell LookupCell(float x, float z) 30 | { 31 | WorldMapCell c = default(WorldMapCell); 32 | var cellX = (int) (x / 512); 33 | var cellZ = (int)(z / 512); 34 | lock (cells) 35 | { 36 | if (cells.Any(d => d.X == cellX && d.Z == cellZ)) 37 | return cells.FirstOrDefault(d => d.X == cellX && d.Z == cellZ); 38 | 39 | Debug.WriteLine("Created cell " + cellX + "," + cellZ); 40 | c = new WorldMapCell(cellX, cellZ); 41 | cells.Add(c); 42 | } 43 | return c; 44 | } 45 | 46 | private void OnDataReceived(object sender, EventArgs args) 47 | { 48 | var x = source.MyTelemetry.Physics.CoordinateX; 49 | var y = source.MyTelemetry.Physics.CoordinateY; 50 | var z = source.MyTelemetry.Physics.CoordinateZ; 51 | 52 | var activeCell = LookupCell(x,z); 53 | 54 | if (activeCell == null) return; 55 | 56 | lock (activeCell.points) 57 | { 58 | if (activeCell.points.Any(d => Math.Abs(d.x - x) < 1 || Math.Abs(d.z - z) < 1)) return; 59 | 60 | activeCell.points.Add(new WorldMapPoint(x, y, z)); 61 | 62 | } 63 | } 64 | 65 | public void Import() 66 | { 67 | string[] l = File.ReadAllLines("map.ini"); 68 | 69 | WorldMapCell active = default(WorldMapCell); 70 | foreach (var li in l) 71 | { 72 | if (li.Substring(0, 5) == "[Cell") 73 | { 74 | string[] cellData = li.Split("_".ToCharArray()); 75 | active = new WorldMapCell(int.Parse(cellData[1]), int.Parse(cellData[2])); 76 | lock (cells) 77 | { 78 | cells.Add(active); 79 | } 80 | } 81 | else 82 | { 83 | string[] pointData = li.Split(",".ToCharArray()); 84 | lock (active.points) 85 | { 86 | active.points.Add(new WorldMapPoint(float.Parse(pointData[0]), float.Parse(pointData[1]), 87 | float.Parse(pointData[2]))); 88 | } 89 | } 90 | } 91 | } 92 | 93 | public void Export() 94 | { 95 | if (cells == null) return; 96 | StringBuilder export = new StringBuilder(); 97 | 98 | foreach(var c in cells) 99 | { 100 | export.AppendLine(string.Format("[Cell_{0}_{1}_]", c.X, c.Z)); 101 | foreach (var p in c.points) 102 | export.AppendLine(string.Format("{0},{1},{2}", p.x, p.y, p.z)); 103 | } 104 | 105 | File.WriteAllText("map.ini", export.ToString()); 106 | } 107 | } 108 | 109 | public class WorldMapCell 110 | { 111 | public List points; 112 | 113 | public int X { get; private set; } 114 | public int Z { get; private set; } 115 | 116 | public WorldMapCell(int cellX, int cellZ) 117 | { 118 | points = new List(); 119 | 120 | X = cellX; 121 | Z = cellZ; 122 | } 123 | } 124 | 125 | public class WorldMapPoint 126 | { 127 | public float x; 128 | public float y; 129 | public float z; 130 | 131 | public WorldMapPoint(float x, float y, float z) 132 | { 133 | this.x = x; 134 | this.y = y; 135 | this.z = z; 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/Tesla/ColorBlender.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace SimShift.Dialogs.Tesla 4 | { 5 | public static class ColorBlender 6 | { 7 | public static Color Blend(this Color color, Color backColor, double amount) 8 | { 9 | byte r = (byte) ((color.R*amount) + backColor.R*(1 - amount)); 10 | byte g = (byte) ((color.G*amount) + backColor.G*(1 - amount)); 11 | byte b = (byte) ((color.B*amount) + backColor.B*(1 - amount)); 12 | byte a = (byte) color.A; 13 | return Color.FromArgb(a, r, g, b); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/Tesla/dlTeslaDashboard.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs.Tesla 2 | { 3 | partial class dlTeslaDashboard 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // dlTeslaDashboard 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.ClientSize = new System.Drawing.Size(1400, 550); 38 | this.Name = "dlTeslaDashboard"; 39 | this.Text = "dlTeslaDashboard"; 40 | this.ResumeLayout(false); 41 | 42 | } 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/Tesla/ucTeslaTacho.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs.Tesla 2 | { 3 | partial class ucTeslaTacho 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // ucTeslaTacho 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "ucTeslaTacho"; 38 | this.Size = new System.Drawing.Size(901, 954); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/Tesla/ucTeslaTacho.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace SimShift.Dialogs.Tesla 11 | { 12 | public partial class ucTeslaTacho : UserControl 13 | { 14 | 15 | public ucTeslaTacho() 16 | { 17 | InitializeComponent(); 18 | 19 | BackColor = Color.Magenta; 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlDebugInfo.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class dlDebugInfo 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // dlDebugInfo 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.ClientSize = new System.Drawing.Size(177, 107); 38 | this.Name = "dlDebugInfo"; 39 | this.Text = "dlDebugInfo"; 40 | this.ResumeLayout(false); 41 | 42 | } 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlGearboxShifterTable.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class dlGearboxShifterTable 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lGearCount = new System.Windows.Forms.Label(); 32 | this.shifterTable = new System.Windows.Forms.DataGridView(); 33 | ((System.ComponentModel.ISupportInitialize)(this.shifterTable)).BeginInit(); 34 | this.SuspendLayout(); 35 | // 36 | // lGearCount 37 | // 38 | this.lGearCount.AutoSize = true; 39 | this.lGearCount.Location = new System.Drawing.Point(12, 9); 40 | this.lGearCount.Name = "lGearCount"; 41 | this.lGearCount.Size = new System.Drawing.Size(90, 13); 42 | this.lGearCount.TabIndex = 0; 43 | this.lGearCount.Text = "Number of Gears:"; 44 | // 45 | // shifterTable 46 | // 47 | this.shifterTable.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 48 | this.shifterTable.Location = new System.Drawing.Point(15, 25); 49 | this.shifterTable.Name = "shifterTable"; 50 | this.shifterTable.Size = new System.Drawing.Size(851, 252); 51 | this.shifterTable.TabIndex = 1; 52 | // 53 | // dlGearboxShifterTable 54 | // 55 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 56 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 57 | this.ClientSize = new System.Drawing.Size(878, 519); 58 | this.Controls.Add(this.shifterTable); 59 | this.Controls.Add(this.lGearCount); 60 | this.Name = "dlGearboxShifterTable"; 61 | this.Text = "dlGearboxShifterTable"; 62 | ((System.ComponentModel.ISupportInitialize)(this.shifterTable)).EndInit(); 63 | this.ResumeLayout(false); 64 | this.PerformLayout(); 65 | 66 | } 67 | 68 | #endregion 69 | 70 | private System.Windows.Forms.Label lGearCount; 71 | private System.Windows.Forms.DataGridView shifterTable; 72 | private ucGearboxShifterGraph sim; 73 | } 74 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlJoysticks.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class dlJoysticks 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.cbControl = new System.Windows.Forms.ComboBox(); 32 | this.btDoCal = new System.Windows.Forms.Button(); 33 | this.gbIn = new System.Windows.Forms.GroupBox(); 34 | this.gbOut = new System.Windows.Forms.GroupBox(); 35 | this.gbController = new System.Windows.Forms.GroupBox(); 36 | this.SuspendLayout(); 37 | // 38 | // cbControl 39 | // 40 | this.cbControl.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 41 | this.cbControl.FormattingEnabled = true; 42 | this.cbControl.Location = new System.Drawing.Point(12, 458); 43 | this.cbControl.Name = "cbControl"; 44 | this.cbControl.Size = new System.Drawing.Size(210, 21); 45 | this.cbControl.TabIndex = 2; 46 | // 47 | // btDoCal 48 | // 49 | this.btDoCal.Location = new System.Drawing.Point(228, 458); 50 | this.btDoCal.Name = "btDoCal"; 51 | this.btDoCal.Size = new System.Drawing.Size(142, 23); 52 | this.btDoCal.TabIndex = 3; 53 | this.btDoCal.Text = "Toggle for calibration"; 54 | this.btDoCal.UseVisualStyleBackColor = true; 55 | this.btDoCal.Click += new System.EventHandler(this.btDoCal_Click); 56 | // 57 | // gbIn 58 | // 59 | this.gbIn.Location = new System.Drawing.Point(12, 12); 60 | this.gbIn.Name = "gbIn"; 61 | this.gbIn.Size = new System.Drawing.Size(210, 440); 62 | this.gbIn.TabIndex = 4; 63 | this.gbIn.TabStop = false; 64 | this.gbIn.Text = "Joystick Inputs"; 65 | // 66 | // gbOut 67 | // 68 | this.gbOut.Location = new System.Drawing.Point(228, 12); 69 | this.gbOut.Name = "gbOut"; 70 | this.gbOut.Size = new System.Drawing.Size(210, 440); 71 | this.gbOut.TabIndex = 5; 72 | this.gbOut.TabStop = false; 73 | this.gbOut.Text = "Joystick Outputs"; 74 | // 75 | // gbController 76 | // 77 | this.gbController.Location = new System.Drawing.Point(444, 12); 78 | this.gbController.Name = "gbController"; 79 | this.gbController.Size = new System.Drawing.Size(249, 440); 80 | this.gbController.TabIndex = 6; 81 | this.gbController.TabStop = false; 82 | this.gbController.Text = "Joystick"; 83 | // 84 | // dlJoysticks 85 | // 86 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 87 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 88 | this.ClientSize = new System.Drawing.Size(708, 490); 89 | this.Controls.Add(this.gbController); 90 | this.Controls.Add(this.gbOut); 91 | this.Controls.Add(this.gbIn); 92 | this.Controls.Add(this.btDoCal); 93 | this.Controls.Add(this.cbControl); 94 | this.Name = "dlJoysticks"; 95 | this.Text = "dlJoysticks"; 96 | this.ResumeLayout(false); 97 | 98 | } 99 | 100 | #endregion 101 | 102 | private System.Windows.Forms.ComboBox cbControl; 103 | private System.Windows.Forms.Button btDoCal; 104 | private System.Windows.Forms.GroupBox gbIn; 105 | private System.Windows.Forms.GroupBox gbOut; 106 | private System.Windows.Forms.GroupBox gbController; 107 | } 108 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlMap.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class dlMap 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // dlMap 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.ClientSize = new System.Drawing.Size(692, 423); 38 | this.Name = "dlMap"; 39 | this.Text = "dlMap"; 40 | this.ResumeLayout(false); 41 | 42 | } 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlPlotter.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class dlPlotter 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // dlPlotter 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.ClientSize = new System.Drawing.Size(996, 630); 38 | this.Name = "dlPlotter"; 39 | this.Text = "dlPlotter"; 40 | this.ResumeLayout(false); 41 | 42 | } 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlPlotter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using SimShift.Data; 10 | using SimShift.Entities; 11 | using SimShift.Services; 12 | 13 | namespace SimShift.Dialogs 14 | { 15 | public partial class dlPlotter : Form 16 | { 17 | private ucPlotter plot; 18 | private Timer updater; 19 | 20 | public dlPlotter() 21 | { 22 | InitializeComponent(); 23 | 24 | plot = new ucPlotter(5, new float[] 25 | { 26 | //1, 27 | //1, 28 | 1, 29 | 1, 30 | 2500, 31 | 150, 32 | 5 33 | }); 34 | plot.Dock = DockStyle.Fill; 35 | Controls.Add(plot); 36 | 37 | Main.Data.DataReceived += Data_DataReceived; 38 | var tmr = new Timer {Enabled = true, Interval = 1000}; 39 | tmr.Tick += tmr_Tick; 40 | tmr.Start(); 41 | } 42 | 43 | private void tmr_Tick(object sender, EventArgs e) 44 | { 45 | plot.Frequency = hz; 46 | hz = 0; 47 | } 48 | 49 | private double prevSpeed; 50 | private double prevTime; 51 | private double prevAcc; 52 | 53 | private double dj; 54 | private double prevAccT; 55 | 56 | private double acc; 57 | private int hz = 0; 58 | private void Data_DataReceived(object sender, EventArgs e) 59 | { 60 | var miner = Main.Data.Active as Ets2DataMiner; 61 | var tel = Main.Data.Telemetry; // miner.MyTelemetry; 62 | var dt = tel.Time - prevTime; 63 | var dv = tel.Speed - prevSpeed; 64 | 65 | var dt2 = tel.Time - prevAccT; 66 | if (dt2 > 0.05) 67 | { 68 | var acc = dv / dt; 69 | var da = acc - prevAcc; 70 | dj = Math.Abs(da) >= 0.001f ? da / dt2 / 10.0f : 0; 71 | prevAcc = acc; 72 | prevAccT = tel.Time; 73 | } 74 | if (dt > 0.0001) 75 | { 76 | hz++; 77 | var data = new double[] 78 | { 79 | Main.GetAxisOut(JoyControls.Throttle), 80 | Main.GetAxisOut(JoyControls.Clutch), 81 | tel.EngineRpm - 2500, 82 | tel.Speed*3.6, 83 | prevAcc }; 84 | 85 | plot.Add(data.ToList()); 86 | } 87 | prevSpeed = tel.Speed; 88 | prevTime = tel.Time; 89 | 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlTwitchDashboard.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class dlTwitchDashboard 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // dlTwitchDashboard 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.BackColor = System.Drawing.Color.Black; 38 | this.ClientSize = new System.Drawing.Size(779, 203); 39 | this.Name = "dlTwitchDashboard"; 40 | this.Text = "dlTwitchDashboard"; 41 | this.TransparencyKey = System.Drawing.Color.Gray; 42 | this.ResumeLayout(false); 43 | 44 | } 45 | 46 | #endregion 47 | } 48 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/dlTwitchDashboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | 10 | namespace SimShift.Dialogs 11 | { 12 | public partial class dlTwitchDashboard : Form 13 | { 14 | private ucDashboard dsh; 15 | 16 | public dlTwitchDashboard() 17 | { 18 | InitializeComponent(); 19 | SetStyle(ControlStyles.UserPaint, true); 20 | SetStyle(ControlStyles.OptimizedDoubleBuffer, true); 21 | SetStyle(ControlStyles.AllPaintingInWmPaint, true); 22 | 23 | var updateUi = new Timer(); 24 | updateUi.Interval = 20; 25 | updateUi.Tick += new EventHandler(updateUi_Tick); 26 | updateUi.Start(); 27 | dsh = new ucDashboard(Color.FromArgb(5, 5, 5)); 28 | dsh.Dock = DockStyle.Fill; 29 | Controls.Add(dsh); 30 | 31 | this.StartPosition = FormStartPosition.CenterScreen; 32 | } 33 | 34 | void updateUi_Tick(object sender, EventArgs e) 35 | { 36 | dsh.Invalidate(); 37 | 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/ucDashboard.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class ucDashboard 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // ucDashboard 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "ucDashboard"; 38 | this.Size = new System.Drawing.Size(795, 241); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/ucGearboxShifterGraph.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class ucGearboxShifterGraph 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // ucGearboxShifterGraph 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "ucGearboxShifterGraph"; 38 | this.Size = new System.Drawing.Size(745, 337); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/ucJoystickChannel.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class ucJoystickChannel 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.lblControl = new System.Windows.Forms.Label(); 32 | this.pbVal = new System.Windows.Forms.ProgressBar(); 33 | this.SuspendLayout(); 34 | // 35 | // lblControl 36 | // 37 | this.lblControl.AutoSize = true; 38 | this.lblControl.Location = new System.Drawing.Point(3, 0); 39 | this.lblControl.Name = "lblControl"; 40 | this.lblControl.Size = new System.Drawing.Size(35, 13); 41 | this.lblControl.TabIndex = 0; 42 | this.lblControl.Text = "label1"; 43 | // 44 | // pbVal 45 | // 46 | this.pbVal.Location = new System.Drawing.Point(100, 0); 47 | this.pbVal.Name = "pbVal"; 48 | this.pbVal.Size = new System.Drawing.Size(75, 13); 49 | this.pbVal.TabIndex = 1; 50 | // 51 | // ucJoystickChannel 52 | // 53 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 54 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 55 | this.Controls.Add(this.pbVal); 56 | this.Controls.Add(this.lblControl); 57 | this.Name = "ucJoystickChannel"; 58 | this.Size = new System.Drawing.Size(175, 13); 59 | this.ResumeLayout(false); 60 | this.PerformLayout(); 61 | 62 | } 63 | 64 | #endregion 65 | 66 | private System.Windows.Forms.Label lblControl; 67 | private System.Windows.Forms.ProgressBar pbVal; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/ucJoystickChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using SimShift.Entities; 10 | using SimShift.Services; 11 | 12 | namespace SimShift.Dialogs 13 | { 14 | public partial class ucJoystickChannel : UserControl 15 | { 16 | private JoyControls ctrl; 17 | public bool Input { get; private set; } 18 | 19 | private bool isJoystickInput; 20 | private int index; 21 | private bool isAxis; 22 | 23 | public ucJoystickChannel(JoyControls c, bool inout) 24 | { 25 | InitializeComponent(); 26 | lblControl.Text = c.ToString(); 27 | pbVal.Value = 0; 28 | Input = inout; 29 | ctrl = c; 30 | } 31 | 32 | public ucJoystickChannel(bool axis, int i) 33 | { 34 | InitializeComponent(); 35 | isAxis = axis; 36 | index = i; 37 | isJoystickInput = true; 38 | 39 | lblControl.Text = ((axis) ? "Axis" : "Button") + " " + i; 40 | pbVal.Value = 0; 41 | Input = true; 42 | } 43 | 44 | public void Tick() 45 | { 46 | int output = 0; 47 | 48 | if (isJoystickInput) 49 | { 50 | if (isAxis) 51 | output = (int)(100 * Main.Controller.GetAxis(index) / 0x7FFF); 52 | else if (index >= 20) 53 | output = Main.Controller.GetPov(index - 20) ? 100 : 0; 54 | else 55 | output = Main.Controller.GetButton(index) ? 100 : 0; 56 | } 57 | else 58 | { 59 | var axisValue = Input ? Main.GetAxisIn(ctrl) : Main.GetAxisOut(ctrl); 60 | var buttonValue = Input ? Main.GetButtonIn(ctrl) : Main.GetButtonOut(ctrl); 61 | 62 | output = (int)Math.Max(axisValue*100, buttonValue ? 100 : 0); 63 | } 64 | if (double.IsNaN(output)) output = 0; 65 | if (output > 99) output = 99; 66 | if (output < 0) output = 0; 67 | 68 | pbVal.Value = (int) output+1; 69 | pbVal.Value = (int) output; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SimShift/SimShift/Dialogs/ucPlotter.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Dialogs 2 | { 3 | partial class ucPlotter 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Component Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.SuspendLayout(); 32 | // 33 | // ucPlotter 34 | // 35 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 37 | this.Name = "ucPlotter"; 38 | this.Size = new System.Drawing.Size(1042, 695); 39 | this.ResumeLayout(false); 40 | 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/ConfigurableShiftPattern.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Entities 2 | { 3 | public struct ConfigurableShiftPattern 4 | { 5 | public string Region { get; private set; } 6 | public string File { get; private set; } 7 | 8 | public ConfigurableShiftPattern(string region, string file) : this() 9 | { 10 | Region = region; 11 | File = file; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/IConfigurable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SimShift.Utils; 3 | 4 | namespace SimShift.Entities 5 | { 6 | public interface IConfigurable 7 | { 8 | IEnumerable AcceptsConfigs { get; } 9 | 10 | void ResetParameters(); 11 | void ApplyParameter(IniValueObject obj); 12 | IEnumerable ExportParameters(); 13 | } 14 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/IControlChainObj.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SimShift.Data.Common; 3 | using SimShift.Services; 4 | 5 | namespace SimShift.Entities 6 | { 7 | public interface IControlChainObj 8 | { 9 | IEnumerable SimulatorsOnly { get; } 10 | IEnumerable SimulatorsBan { get; } 11 | 12 | bool Enabled { get; } 13 | bool Active { get; } 14 | 15 | bool Requires(JoyControls c); 16 | double GetAxis(JoyControls c, double val); 17 | bool GetButton(JoyControls c, bool val); 18 | void TickControls(); 19 | void TickTelemetry(IDataMiner data); 20 | } 21 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/JoyControls.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Entities 2 | { 3 | public enum JoyControls 4 | { 5 | Steering, 6 | Throttle, 7 | Brake, 8 | Clutch, 9 | VstLever, // variable speed transmission module 10 | VstChange, 11 | MeasurePower, 12 | GearDown, 13 | GearUp, 14 | GearR, 15 | Gear1, 16 | Gear2, 17 | Gear3, 18 | Gear4, 19 | Gear5, 20 | Gear6, 21 | Gear7, 22 | Gear8, 23 | GearRange1, 24 | GearRange2, 25 | CruiseControlMaintain, 26 | CruiseControlUp, 27 | CruiseControlDown, 28 | CruiseControlOnOff, 29 | LaunchControl, 30 | CameraHorizon, 31 | LaneAssistance, 32 | 33 | NUM_OF_CONTROLS 34 | } 35 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/MmTimer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Timers; 4 | 5 | namespace SimShift.Entities 6 | { 7 | public class MmTimer 8 | { 9 | public event EventHandler Tick; 10 | private TimerEventHandler handler; 11 | private Timer _rescueTimer; 12 | private uint id = 0; 13 | private uint period = 1; 14 | private uint resolution = 1; 15 | private bool usedMMTimer = false; 16 | protected LPTIMECAPS mmCapabilities = new LPTIMECAPS(); 17 | #region API imports 18 | private const int TIME_PERIODIC = 1; 19 | private const int EVENT_TYPE = TIME_PERIODIC; 20 | private const int TIMERR_BASE = 96; 21 | private const int TIMERR_NOERROR = 0; 22 | private const int TIMERR_NOCANDO = TIMERR_BASE + 1; 23 | private delegate void TimerEventHandler(int id, int msg, IntPtr user, int dw1, int dw2); 24 | [DllImport("winmm.dll")] 25 | private static extern UInt32 timeSetEvent(UInt32 delay, UInt32 resolution, TimerEventHandler handler, IntPtr user, UInt32 eventType); 26 | [DllImport("winmm.dll")] 27 | private static extern UInt32 timeKillEvent(UInt32 id); 28 | [DllImport("winmm.dll")] 29 | private static extern UInt32 timeBeginPeriod(UInt32 msec); 30 | [DllImport("winmm.dll")] 31 | private static extern UInt32 timeEndPeriod(UInt32 msec); 32 | [DllImport("winmm.dll")] 33 | private static extern UInt32 timeGetDevCaps(ref LPTIMECAPS ptc, UInt32 cbtc); 34 | [StructLayout(LayoutKind.Sequential)] 35 | protected struct LPTIMECAPS 36 | { 37 | public uint wPeriodMin; 38 | public uint wPeriodMax; 39 | } ; 40 | #endregion 41 | public uint Period 42 | { 43 | get 44 | { 45 | return period; 46 | } 47 | set 48 | { 49 | if (value <= 0) return; 50 | period = value; 51 | } 52 | } 53 | public bool Enabled 54 | { 55 | get 56 | { 57 | return id != 0; 58 | } 59 | } 60 | 61 | public MmTimer(uint period) 62 | { 63 | Period = period; 64 | } 65 | public void Start() 66 | { 67 | if (id != 0) return; 68 | if (Check() == false) 69 | { 70 | _rescueTimer = new Timer(Period); 71 | _rescueTimer.Elapsed += (o, s) => TimerHandler(0, 0, IntPtr.Zero, 0, 0); 72 | _rescueTimer.Start(); 73 | usedMMTimer = false; 74 | } 75 | else 76 | { 77 | handler = new TimerEventHandler(TimerHandler); 78 | id = timeSetEvent(period, 1, handler, IntPtr.Zero, EVENT_TYPE); 79 | usedMMTimer = true; 80 | } 81 | } 82 | protected bool Check() 83 | { 84 | var err = timeGetDevCaps(ref mmCapabilities, (uint)Marshal.SizeOf(mmCapabilities)); 85 | if (err == TIMERR_NOCANDO) return false; 86 | if (mmCapabilities.wPeriodMin > period || mmCapabilities.wPeriodMax < period) return false; 87 | resolution = mmCapabilities.wPeriodMin; 88 | err = timeBeginPeriod(resolution); 89 | return (err == TIMERR_NOERROR) ? true : false; 90 | } 91 | public void Stop() 92 | { 93 | if (usedMMTimer) 94 | { 95 | if (id == 0) return; 96 | timeKillEvent(id); 97 | timeEndPeriod(resolution); 98 | id = 0; 99 | } 100 | else 101 | { 102 | _rescueTimer.Stop(); 103 | _rescueTimer = null; 104 | } 105 | } 106 | private void TimerHandler(int id, int msg, IntPtr user, int dw1, int dw2) 107 | { 108 | if (Tick != null) 109 | Tick(this, new EventArgs()); 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/Profiles.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using SimShift.Services; 7 | using SimShift.Utils; 8 | 9 | namespace SimShift.Entities 10 | { 11 | public class Profiles : IConfigurable 12 | { 13 | public List Loaded = new List(); 14 | public List Unloaded = new List(); 15 | public string UniqueID { get; private set; } 16 | 17 | public event EventHandler LoadedProfile; 18 | 19 | public string MasterFile { get; private set; } 20 | public string PatternFile { get; private set; } 21 | 22 | public Profiles(string app, string car) 23 | { 24 | UniqueID = string.Format("{0}.{1}", app, car); 25 | MasterFile = string.Format("Settings/Profiles/{0}.{1}.Master.ini", app, car); 26 | PatternFile = string.Format("Settings/Profiles/{0}.{1}.{2}.ini", app, car, "{0}"); 27 | 28 | if (File.Exists(MasterFile) == false) 29 | { 30 | Debug.WriteLine("Cannot find " + MasterFile + " - creating default Performance"); 31 | 32 | ResetParameters(); 33 | var performanceProfile = new Profile(this, "Performance"); 34 | Loaded.Add(performanceProfile); 35 | var efficiencyProfile = new Profile(this, "Efficiency"); 36 | Loaded.Add(efficiencyProfile); 37 | var economyProfile = new Profile(this, "Economy"); 38 | Loaded.Add(economyProfile); 39 | 40 | Main.Store(ExportParameters(), MasterFile); 41 | } 42 | 43 | 44 | Main.Load(this, MasterFile); 45 | } 46 | 47 | #region Implementation of IConfigurable 48 | 49 | public IEnumerable AcceptsConfigs 50 | { 51 | get { return new string[] {"Profiles"}; } 52 | } 53 | 54 | public string Active { get; private set; } 55 | 56 | public void ResetParameters() 57 | { 58 | Loaded.Clear(); 59 | Unloaded.Clear(); 60 | } 61 | 62 | public void Load(string profile, float staticMass) 63 | { 64 | if(Loaded.Any(x=>x.Name == profile)) 65 | { 66 | Debug.WriteLine("Loading profile "+profile); 67 | Active = profile; 68 | Loaded.FirstOrDefault(x => x.Name == profile).Load(staticMass); 69 | 70 | if(LoadedProfile != null) 71 | LoadedProfile(this, new EventArgs()); 72 | } 73 | } 74 | 75 | public void ApplyParameter(IniValueObject obj) 76 | { 77 | switch (obj.Key) 78 | { 79 | case "Load": 80 | var p = new Profile(this, obj.ReadAsString()); 81 | if(p.Loaded==false) 82 | { 83 | Unloaded.Add(obj.ReadAsString()); 84 | } 85 | else 86 | { 87 | Loaded.Add(p); 88 | } 89 | break; 90 | 91 | case "Unload": 92 | Unloaded.Add(obj.ReadAsString()); 93 | break; 94 | } 95 | } 96 | 97 | public IEnumerable ExportParameters() 98 | { 99 | var obj = new List(); 100 | 101 | foreach (var l in Loaded) obj.Add(new IniValueObject(AcceptsConfigs, "Load", l.Name)); 102 | foreach (var l in Unloaded) obj.Add(new IniValueObject(AcceptsConfigs, "Load", l)); 103 | 104 | return obj; 105 | } 106 | 107 | #endregion 108 | } 109 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/ShiftPattern.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using SimShift.Services; 3 | using SimShift.Utils; 4 | 5 | namespace SimShift.Entities 6 | { 7 | public class ShiftPattern : IConfigurable 8 | { 9 | public List Frames = new List(); 10 | 11 | public int Count 12 | { 13 | get { return Frames.Count; } 14 | } 15 | 16 | #region Implementation of IConfigurable 17 | 18 | public IEnumerable AcceptsConfigs 19 | { 20 | get { return new[] {"Pattern"}; } 21 | } 22 | 23 | public void ResetParameters() 24 | { 25 | Frames = new List(); 26 | 27 | } 28 | 29 | public void ApplyParameter(IniValueObject obj) 30 | { 31 | switch (obj.Key) 32 | { 33 | case "Frame": 34 | var thr = obj.ReadAsFloat(0); 35 | var clt = obj.ReadAsFloat(1); 36 | var thrAbs = obj.ReadAsString(2); 37 | var gear = obj.ReadAsString(3); 38 | 39 | var useNewGear = gear == "new"; 40 | var useOldGear = gear == "old"; 41 | var absoluteThrottle = thrAbs == "abs"; 42 | 43 | var frame = new ShiftPatternFrame(clt, thr, absoluteThrottle, useOldGear, useNewGear); 44 | 45 | Frames.Add(frame); 46 | break; 47 | } 48 | } 49 | 50 | public IEnumerable ExportParameters() 51 | { 52 | var frames = new List(); 53 | 54 | foreach(var fr in Frames) 55 | { 56 | string absThrStr = fr.AbsoluteThrottle ? "abs" : "rel"; 57 | string gearStr = fr.UseNewGear ? "new" : fr.UseOldGear ? "old" : "neu"; 58 | 59 | frames.Add(new IniValueObject(AcceptsConfigs, "Frame", string.Format("Frame=({0:0.00},{1:0.00},{2},{3})", fr.Throttle, fr.Clutch, absThrStr, gearStr))); 60 | } 61 | 62 | return frames; 63 | } 64 | 65 | #endregion 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/ShiftPatternFrame.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Entities 2 | { 3 | public class ShiftPatternFrame 4 | { 5 | public double Clutch { get; private set; } 6 | public double Throttle { get; private set; } 7 | public bool AbsoluteThrottle { get; private set; } 8 | public bool UseOldGear { get; private set; } 9 | public bool UseNewGear { get; private set; } 10 | 11 | public ShiftPatternFrame(double clutch, double throttle, bool useOldGear, bool useNewGear) 12 | { 13 | Clutch = clutch; 14 | Throttle = throttle; 15 | AbsoluteThrottle = false; 16 | UseOldGear = useOldGear; 17 | UseNewGear = useNewGear; 18 | } 19 | public ShiftPatternFrame(double clutch, double throttle, bool absThr, bool useOldGear, bool useNewGear) 20 | { 21 | Clutch = clutch; 22 | Throttle = throttle; 23 | AbsoluteThrottle = absThr; 24 | UseOldGear = useOldGear; 25 | UseNewGear = useNewGear; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/ShifterTableConfigurationDefault.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Entities 2 | { 3 | public enum ShifterTableConfigurationDefault 4 | { 5 | Economy, 6 | Efficiency, 7 | Performance, 8 | PeakRpm, 9 | AlsEenOpa, 10 | Henk, 11 | PowerEfficiency 12 | } 13 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Entities/ShifterTableLookupResult.cs: -------------------------------------------------------------------------------- 1 | namespace SimShift.Entities 2 | { 3 | public class ShifterTableLookupResult 4 | { 5 | public int Gear { get; private set; } 6 | public double ThrottleScale { get; private set; } 7 | 8 | public double UsedSpeed { get; private set; } 9 | public double UsedLoad { get; private set; } 10 | 11 | public ShifterTableLookupResult(int gear, double thrScale, double usedSpeed, double usedLoad) 12 | { 13 | Gear = gear; 14 | ThrottleScale = thrScale; 15 | UsedSpeed = usedSpeed; 16 | UsedLoad = usedLoad; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Models/Ets2Aero.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SimShift.Models 4 | { 5 | public class Ets2Aero 6 | { 7 | public double CalculateTorque(double speed) 8 | { 9 | var t = 3550.0 / 41964; 10 | 11 | var trq =t*0.0837217043 * Math.Exp(0.0002886324 * Math.Abs(speed * 200)); 12 | trq *= 2*9000; 13 | return trq; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Models/IDrivetrain.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using SimShift.Entities; 3 | using SimShift.Services; 4 | 5 | namespace SimShift.Models 6 | { 7 | public interface IDrivetrain : IConfigurable 8 | { 9 | bool GotDamage(float damage); 10 | 11 | double StallRpm { get; set; } 12 | double MaximumRpm { get; set; } 13 | double CalculateTorqueN(double rpm); 14 | double CalculateTorqueP(double rpm, double throttle); 15 | double CalculateThrottleByTorque(double rpm, double torque); 16 | double CalculatePower(double rpm, double throttle); 17 | double CalculateMaxPower(); 18 | double CalculateFuelConsumption(double rpm, double throttle); 19 | double CalculateThrottleByPower(double rpm, double powerRequired); 20 | 21 | double[] GearRatios { get; set; } 22 | int Gears { get; set; } 23 | bool Calibrated { get; set; } 24 | string File { get; set; } 25 | double CalculateSpeedForRpm(int gear, float rpm); 26 | double CalculateRpmForSpeed(int idealGear, float speed); 27 | } 28 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | using System.Windows.Forms.VisualStyles; 9 | 10 | namespace SimShift 11 | { 12 | static class Program 13 | { 14 | /// 15 | /// The main entry point for the application. 16 | /// 17 | [STAThread] 18 | static void Main() 19 | { 20 | Application.ApplicationExit +=ApplicationOnApplicationExit; 21 | Application.ThreadException += Application_ThreadException; 22 | AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; 23 | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; 24 | Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); 25 | 26 | Debug.Listeners.Add(new TextWriterTraceListener("trace.txt")); 27 | log = File.OpenWrite("./exception.txt"); 28 | log.Seek(0, SeekOrigin.End); 29 | 30 | Application.EnableVisualStyles(); 31 | Application.SetCompatibleTextRenderingDefault(false); 32 | Application.Run(new FrmMain()); 33 | } 34 | 35 | private static FileStream log; 36 | private static void ApplicationOnApplicationExit(object sender, EventArgs eventArgs) 37 | { 38 | log.Close(); 39 | } 40 | 41 | 42 | static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 43 | { 44 | Log("UnhandledException", (Exception)e.ExceptionObject); 45 | } 46 | 47 | static void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e) 48 | { 49 | Log("FirstChanceException", e.Exception); 50 | } 51 | 52 | private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) 53 | { 54 | Log("ThreadException", e.Exception); 55 | } 56 | private static void Log(string what, Exception e) 57 | { 58 | var h = "------------------ "+what+" ----------------\r\n" + e.Message + "\r\nSTACKTRACE: " + e.StackTrace + "\r\n" + e.ToString() + "\r\n"; 59 | var h2 = ASCIIEncoding.ASCII.GetBytes(h); 60 | log.Write(h2,0,h2.Length); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SimShift/SimShift/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SimShift")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SimShift")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9141ba18-64dd-45ec-8e5f-6db60aef6da9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SimShift/SimShift/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18063 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimShift.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SimShift.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SimShift/SimShift/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18063 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SimShift.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SimShift/SimShift/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimShift/SimShift/Services/CameraHorizon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SimShift.Data; 4 | using SimShift.Data.Common; 5 | using SimShift.Entities; 6 | 7 | namespace SimShift.Services 8 | { 9 | /// 10 | /// This is an budget TrackIR feature for TDU2, designed to look side-ways when a look-around stick is moved. 11 | /// The look side-ways auto centers. Control of camera angle is done with ProcessMemoryWrite access. 12 | /// 13 | public class CameraHorizon : IControlChainObj 14 | { 15 | public double CameraAngle = 0; 16 | public bool CameraHackEnabled { get; set; } 17 | 18 | public IEnumerable SimulatorsOnly { get { return new String[] {"TestDrive2"}; } } 19 | public IEnumerable SimulatorsBan { get { return new String[0]; } } 20 | 21 | public bool Active { get { return Math.Abs(CameraAngle) > 0.05; } } 22 | public bool Enabled { get; private set; } 23 | 24 | #region Implementation of IControlChainObj 25 | 26 | public bool Requires(JoyControls c) 27 | { 28 | switch(c) 29 | { 30 | case JoyControls.CameraHorizon: 31 | return true; 32 | 33 | default: 34 | return false; 35 | } 36 | } 37 | 38 | public double GetAxis(JoyControls c, double val) 39 | { 40 | return val; 41 | } 42 | 43 | public bool GetButton(JoyControls c, bool val) 44 | { 45 | return val; 46 | } 47 | 48 | public void TickControls() 49 | { 50 | CameraAngle = Main.GetAxisIn(JoyControls.CameraHorizon)*0.1 + CameraAngle*0.9; 51 | } 52 | 53 | public void TickTelemetry(IDataMiner data) 54 | { 55 | // TODO: Only supports TDU2. 56 | if (Main.Data.Active.Application != "TestDrive2") 57 | { 58 | Enabled = false; 59 | return; 60 | } 61 | else 62 | { 63 | Enabled = true; 64 | } 65 | if (CameraHackEnabled) 66 | { 67 | data.Write(TelemetryChannel.CameraHorizon, (float)(CameraAngle * CameraAngle * CameraAngle * -25)); 68 | 69 | } else if (CameraAngle != 0) 70 | { 71 | CameraAngle = 0; 72 | data.Write(TelemetryChannel.CameraHorizon, 0.0f); 73 | } 74 | } 75 | 76 | #endregion 77 | } 78 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Services/Dashboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.IO.Ports; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading; 8 | using AForge; 9 | using SimShift.Data.Common; 10 | using SimShift.Entities; 11 | 12 | namespace SimShift.Services 13 | { 14 | class Dashboard : IControlChainObj 15 | { 16 | public IEnumerable SimulatorsOnly { get { return new string[0]; } } 17 | public IEnumerable SimulatorsBan { get { return new string[0]; } } 18 | public bool Enabled { get; private set; } 19 | public bool Active { get; private set; } 20 | public bool Requires(JoyControls c) 21 | { 22 | return false; 23 | } 24 | 25 | public double GetAxis(JoyControls c, double val) 26 | { 27 | return val; 28 | } 29 | 30 | public bool GetButton(JoyControls c, bool val) 31 | { 32 | return val; 33 | } 34 | 35 | public void TickControls() 36 | { 37 | 38 | } 39 | 40 | private SerialPort sp; 41 | private bool busy = false; 42 | public void TickTelemetry(IDataMiner data) 43 | { 44 | return; 45 | try 46 | { 47 | if (busy) return; 48 | busy = true; 49 | if (sp == null) 50 | { 51 | sp = new SerialPort("COM4", 115200); 52 | sp.Open(); 53 | WriteInitLedTable(); 54 | } 55 | sp.Write("rpm " + Math.Round(data.Telemetry.EngineRpm) + "\r\n"); 56 | sp.Write("gear " + Math.Round(data.Telemetry.Gear%7*1.0f) + "\r\n"); 57 | busy = false; 58 | } 59 | catch(Exception ex) 60 | { 61 | 62 | } 63 | } 64 | 65 | 66 | public static Color GetRgb(double r, double g, double b) 67 | { 68 | return Color.FromArgb(255, (byte)(r * 255.0), (byte)(g * 255.0), (byte)(b * 255.0)); 69 | } 70 | public static Color HsvToRgb(double h, double s, double v) 71 | { 72 | int hi = (int)Math.Floor(h / 60.0) % 6; 73 | double f = (h / 60.0) - Math.Floor(h / 60.0); 74 | 75 | double p = v * (1.0 - s); 76 | double q = v * (1.0 - (f * s)); 77 | double t = v * (1.0 - ((1.0 - f) * s)); 78 | 79 | Color ret; 80 | 81 | switch (hi) 82 | { 83 | case 0: 84 | ret = Dashboard.GetRgb(v, t, p); 85 | break; 86 | case 1: 87 | ret = Dashboard.GetRgb(q, v, p); 88 | break; 89 | case 2: 90 | ret = Dashboard.GetRgb(p, v, t); 91 | break; 92 | case 3: 93 | ret = Dashboard.GetRgb(p, q, v); 94 | break; 95 | case 4: 96 | ret = Dashboard.GetRgb(t, p, v); 97 | break; 98 | case 5: 99 | ret = Dashboard.GetRgb(v, p, q); 100 | break; 101 | default: 102 | ret = Color.FromArgb(0xFF, 0x00, 0x00, 0x00); 103 | break; 104 | } 105 | return ret; 106 | } 107 | private void WriteInitLedTable() 108 | { 109 | for (int led = 1; led <= 16; led++) 110 | { 111 | sp.Write("led-animation " + led + ",-1 2000,0,2000 200,1000\r\n"); 112 | System.Threading.Thread.Sleep(10); 113 | } 114 | for (int gear = 0; gear < 10; gear++) 115 | { 116 | for (int led = 1; led <= 16; led++) 117 | { 118 | Color c = Dashboard.HsvToRgb(led/16.0f*360, 1.0f, 1.0f); 119 | var r = c.R * 10; 120 | var g = c.G * 10; 121 | var b = c.B*10; 122 | 123 | var rpm = 800 + (1800 - 800) / 15.0f * (led-1); 124 | 125 | var s = -150 + rpm; 126 | var e = 150 + rpm; 127 | if (s < 0) s = 0; 128 | if (e > 2400) e = 2400; 129 | sp.Write("led-animation "+led+","+gear+" "+r+","+g+","+b+" "+s+","+e+"\r\n"); 130 | System.Threading.Thread.Sleep(10); 131 | } 132 | } 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /SimShift/SimShift/Services/EarlyClutch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SimShift.Data.Common; 6 | using SimShift.Entities; 7 | 8 | namespace SimShift.Services 9 | { 10 | /// 11 | /// This module is a gimmick where the clutch is engaged when dropping below 35km/h when the vehicle was driving faster than that (55km/h+) 12 | /// 13 | class EarlyClutch : IControlChainObj 14 | { 15 | public bool Enabled { get; private set; } 16 | public bool Active { get; private set; } 17 | 18 | public IEnumerable SimulatorsOnly { get { return new String[0]; } } 19 | public IEnumerable SimulatorsBan { get { return new String[0]; } } 20 | 21 | // 22 | private bool clutching = false; 23 | private bool clutchctrl = false; 24 | 25 | private bool triggered = false; 26 | #region Implementation of IControlChainObj 27 | 28 | public bool Requires(JoyControls c) 29 | { 30 | switch(c) 31 | { 32 | case JoyControls.Clutch: 33 | return clutching; 34 | default: 35 | return false; 36 | } 37 | } 38 | 39 | public double GetAxis(JoyControls c, double val) 40 | { 41 | switch(c) 42 | { 43 | case JoyControls.Clutch: 44 | return clutching ? 1 : val; 45 | default: 46 | return val; 47 | } 48 | } 49 | 50 | public bool GetButton(JoyControls c, bool val) 51 | { 52 | return val; 53 | } 54 | 55 | public void TickControls() 56 | { 57 | //clutching = Main.GetAxisIn(JoyControls.Throttle) < 0.1 && clutchctrl; 58 | clutching = false; 59 | } 60 | 61 | public void TickTelemetry(IDataMiner data) 62 | { 63 | if (data.Telemetry.Speed * 3.6 > 55) 64 | triggered = true; 65 | 66 | if (triggered && data.Telemetry.Speed * 3.6 < 35) 67 | { 68 | clutchctrl = true; 69 | } 70 | else if (data.Telemetry.Speed*3.6 > 35) 71 | { 72 | clutchctrl = false; 73 | } 74 | if (data.Telemetry.Speed*3.6 < 10 && Main.GetAxisIn(JoyControls.Throttle) > 0.1) 75 | { 76 | clutchctrl = false; 77 | triggered = false; 78 | } 79 | } 80 | 81 | #endregion 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SimShift/SimShift/Services/ProfileSwitcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SimShift.Data; 4 | using SimShift.Data.Common; 5 | using SimShift.Entities; 6 | 7 | namespace SimShift.Services 8 | { 9 | /// 10 | /// This module monitors user inputs to switch driving profiles. 11 | /// Driving profiles contain a set of settings for all different driving modules, e.g. transmission, speedlimiter, traction control, etc. 12 | /// 13 | public class ProfileSwitcher : IControlChainObj 14 | { 15 | public bool Active { get { return ProfileSwitchFrozen; } } 16 | public bool Enabled { get { return true; } } 17 | 18 | public IEnumerable SimulatorsOnly { get { return new String[0]; } } 19 | public IEnumerable SimulatorsBan { get { return new String[0]; } } 20 | 21 | // 22 | 23 | public DateTime ProfileSwitchTimeout { get; private set; } 24 | public bool ProfileSwitchFrozen { get { return ProfileSwitchTimeout > DateTime.Now; } } 25 | 26 | public DateTime TransmissionReverseTimeout { get; private set; } 27 | public bool TransmissionReverseFrozen { get { return TransmissionReverseTimeout > DateTime.Now; } } 28 | 29 | private bool TrailerAttached = false; 30 | 31 | #region Implementation of IControlChainObj 32 | 33 | public bool Requires(JoyControls c) 34 | { 35 | switch(c) 36 | { 37 | case JoyControls.GearUp: 38 | case JoyControls.GearDown: 39 | return true; 40 | 41 | default: 42 | return false; 43 | } 44 | } 45 | 46 | public double GetAxis(JoyControls c, double val) 47 | { 48 | return val; 49 | } 50 | 51 | public bool GetButton(JoyControls c, bool val) 52 | { 53 | switch(c) 54 | { 55 | case JoyControls.GearUp: 56 | if (val && !ProfileSwitchFrozen) 57 | { 58 | ProfileSwitchTimeout = DateTime.Now.Add(new TimeSpan(0, 0, 0, 1)); 59 | if (Main.Data.Active.Application == "eurotrucks2") 60 | { 61 | // 62 | var ets2miner = (Ets2DataMiner) Main.Data.Active; 63 | var ets2telemetry = ets2miner.MyTelemetry; 64 | Main.LoadNextProfile(ets2telemetry.Job.Mass); 65 | } 66 | else 67 | { 68 | Main.LoadNextProfile(10000); 69 | } 70 | } 71 | return false; 72 | break; 73 | case JoyControls.GearDown: 74 | if(val && !TransmissionReverseFrozen) 75 | { 76 | TransmissionReverseTimeout = DateTime.Now.Add(new TimeSpan(0, 0, 0, 1)); 77 | Transmission.InReverse = !Transmission.InReverse; 78 | } 79 | return false; 80 | break; 81 | 82 | default: 83 | return val; 84 | 85 | } 86 | } 87 | 88 | public void TickControls() 89 | { 90 | // 91 | } 92 | 93 | public void TickTelemetry(IDataMiner data) 94 | { 95 | // 96 | if (data.Application == "eurotrucks2") 97 | { 98 | // 99 | var ets2miner = (Ets2DataMiner) data; 100 | var ets2telemetry = ets2miner.MyTelemetry; 101 | var trailerAttached = ets2telemetry.Job.TrailerAttached; 102 | if (trailerAttached != TrailerAttached) 103 | { 104 | TrailerAttached = trailerAttached; 105 | Main.ReloadProfile(trailerAttached ? ets2telemetry.Job.Mass : 0); 106 | } 107 | } 108 | } 109 | 110 | #endregion 111 | } 112 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Services/ThrottleMapping.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | using SimShift.Data.Common; 7 | using SimShift.Entities; 8 | 9 | namespace SimShift.Services 10 | { 11 | /// 12 | /// This module can make the throttle less sensitive. This is adventagous when driving some vehicles, like trucks. 13 | /// 14 | class ThrottleMapping : IControlChainObj 15 | { 16 | public bool Enabled { get; private set; } 17 | public bool Active { get; private set; } 18 | 19 | public IEnumerable SimulatorsOnly { get { return new String[0]; } } 20 | public IEnumerable SimulatorsBan { get { return new String[0]; } } 21 | 22 | // 23 | #region Implementation of IControlChainObj 24 | 25 | public bool Requires(JoyControls c) 26 | { 27 | return (c == JoyControls.Throttle); 28 | } 29 | 30 | public double GetAxis(JoyControls c, double val) 31 | { 32 | var amp = 2; 33 | var expMax = Math.Exp(1 * amp) - 1; 34 | 35 | if (c == JoyControls.Throttle) 36 | return (Math.Exp(val * amp) - 1) / expMax; 37 | else 38 | return val; 39 | } 40 | 41 | public bool GetButton(JoyControls c, bool val) 42 | { 43 | return val; 44 | } 45 | 46 | public void TickControls() 47 | { 48 | } 49 | 50 | public void TickTelemetry(IDataMiner data) 51 | { 52 | Enabled = true; 53 | Active = true; 54 | } 55 | 56 | #endregion 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SimShift/SimShift/Services/WheelTorqueLimiter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SimShift.Data.Common; 4 | using SimShift.Entities; 5 | 6 | namespace SimShift.Services 7 | { 8 | /// 9 | /// This module is a gimmick to simulate a torque limiter for the drive wheels. It practically limits the throttle in lower gears, because it may exceed torque limit of the drivetrain. 10 | /// / 11 | /// 12 | class WheelTorqueLimiter: IControlChainObj 13 | { 14 | public bool Enabled { get; private set; } 15 | public bool Active { get; private set; } 16 | 17 | public IEnumerable SimulatorsOnly { get { return new String[0]; } } 18 | public IEnumerable SimulatorsBan { get { return new String[0]; } } 19 | 20 | // 21 | private double TorqueLimit = 0; 22 | #region Implementation of IControlChainObj 23 | 24 | public bool Requires(JoyControls c) 25 | { 26 | return (c == JoyControls.Throttle); 27 | } 28 | 29 | public double GetAxis(JoyControls c, double val) 30 | { 31 | if (c == JoyControls.Throttle) 32 | return val*TorqueLimit; 33 | else return val; 34 | } 35 | 36 | public bool GetButton(JoyControls c, bool val) 37 | { 38 | return val; 39 | } 40 | 41 | public void TickControls() 42 | { 43 | } 44 | 45 | public void TickTelemetry(IDataMiner data) 46 | { 47 | Enabled = true; 48 | Active = true; 49 | 50 | var f = 1.0; 51 | if (Main.Drivetrain.GearRatios != null && data.Telemetry.Gear >= 1) 52 | f = Main.Drivetrain.GearRatios[data.Telemetry.Gear - 1] / 5.5; 53 | var throttle = Math.Max(Main.GetAxisIn(JoyControls.Throttle), data.Telemetry.Throttle); 54 | TorqueLimit = 1; 55 | var NotGood = false; 56 | do 57 | { 58 | var wheelTorque = Main.Drivetrain.CalculateTorqueP(data.Telemetry.EngineRpm, TorqueLimit * throttle) * f; 59 | if (wheelTorque > 20000) 60 | { 61 | TorqueLimit *= 0.999f; 62 | NotGood = true; 63 | } 64 | else 65 | { 66 | NotGood = false; 67 | } 68 | if (TorqueLimit <= 0.2f) 69 | { 70 | TorqueLimit = 0.2f; 71 | break; 72 | } 73 | } while (NotGood); 74 | 75 | TorqueLimit = 1.0f; 76 | } 77 | 78 | #endregion 79 | } 80 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Simulation/SimulationEnvironment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using SimShift.Dialogs; 7 | using SimShift.Entities; 8 | using SimShift.Models; 9 | using SimShift.Services; 10 | 11 | namespace SimShift.Simulation 12 | { 13 | public class SimulationEnvironment 14 | { 15 | private IDrivetrain drivetrain; 16 | private ShifterTableConfiguration shifter; 17 | 18 | 19 | private double Speed = 0.0f; 20 | 21 | public SimulationEnvironment() 22 | { 23 | drivetrain = new Ets2Drivetrain(); 24 | Main.Load(drivetrain, "Settings/Drivetrain/eurotrucks2.scania.g7ld6x2.ini"); 25 | shifter = new ShifterTableConfiguration(ShifterTableConfigurationDefault.Performance, drivetrain, 1, 0); 26 | 27 | Speed = 30/3.6; 28 | StringBuilder sim = new StringBuilder(); 29 | for (int k = 0; k < 10000; k++) 30 | { 31 | Tick(); 32 | sim.AppendLine(k + "," + Speed); 33 | } 34 | 35 | File.WriteAllText("./sim.csv", sim.ToString()); 36 | } 37 | 38 | public void Tick() 39 | { 40 | // Model : engine 41 | var topGear = drivetrain.Gears - 1; 42 | var engineRpm = drivetrain.CalculateRpmForSpeed(topGear, (float)Speed); 43 | var enginePower = drivetrain.CalculatePower(engineRpm, 1.0f); 44 | 45 | // Model: aero 46 | var aero = Speed*Speed*0.5; 47 | 48 | var acceleration = enginePower - aero; 49 | acceleration /= 100; 50 | Speed += acceleration*1.0/100; 51 | 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SimShift/SimShift/Utils/IniValueObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace SimShift.Utils 6 | { 7 | public class IniValueObject 8 | { 9 | public IEnumerable NestedGroup { get; private set; } 10 | public string Group { get { return NestedGroup.ElementAt(NestedGroup.Count() - 1); } } 11 | public string NestedGroupName { get { return string.Join(".", NestedGroup); } } 12 | 13 | public string Key { get; private set; } 14 | public string RawValue { get; private set; } 15 | 16 | protected string Value { get; private set; } 17 | protected string[] ValueArray { get; private set; } 18 | public bool IsTuple { get; private set; } 19 | 20 | public IniValueObject(IEnumerable nestedGroup, string key, string rawValue) 21 | { 22 | NestedGroup = nestedGroup; 23 | Key = key; 24 | RawValue = rawValue; 25 | 26 | var value = rawValue; 27 | 28 | // Does this rawValue contain multiple values? 29 | if (value.StartsWith("(") && value.EndsWith(")") && value.Length > 2) 30 | value = value.Substring(1, value.Length - 2); 31 | if (value.StartsWith("\"") && value.EndsWith("\"") && value.Length > 2) 32 | value = value.Substring(1, value.Length - 2); 33 | 34 | if (value.Contains(",")) 35 | { 36 | IsTuple = true; 37 | 38 | var values = value.Split(new[] { ',' }); 39 | ValueArray = new string[values.Length]; 40 | 41 | for (var i = 0; i < values.Length; i++) 42 | { 43 | var val = values[i]; 44 | if (val.StartsWith("\"") && val.EndsWith("\"") && val.Length > 2) 45 | val = val.Substring(1, val.Length - 2); 46 | 47 | ValueArray[i] = val.Trim(); 48 | 49 | } 50 | } 51 | else 52 | { 53 | 54 | IsTuple = false; 55 | Value = value; 56 | } 57 | } 58 | 59 | public bool BelongsTo(string group) 60 | { 61 | return NestedGroup.Contains(group); 62 | } 63 | 64 | public int ReadAsInteger(int index) 65 | { 66 | if (!IsTuple) throw new Exception("This is not a tuple value"); 67 | return int.Parse(ValueArray[index]); 68 | } 69 | 70 | public double ReadAsDouble(int index) 71 | { 72 | if (!IsTuple) throw new Exception("This is not a tuple value"); 73 | return double.Parse(ValueArray[index]); 74 | } 75 | 76 | public float ReadAsFloat(int index) 77 | { 78 | if (!IsTuple) throw new Exception("This is not a tuple value"); 79 | return float.Parse(ValueArray[index]); 80 | } 81 | 82 | public string ReadAsString(int index) 83 | { 84 | if (!IsTuple) throw new Exception("This is not a tuple value"); 85 | return ValueArray[index]; 86 | } 87 | 88 | public string ReadAsString() 89 | { 90 | return IsTuple ? ReadAsString(0) : Value; 91 | } 92 | 93 | public int ReadAsInteger() 94 | { 95 | return IsTuple ? ReadAsInteger(0) : int.Parse(Value); 96 | } 97 | 98 | public double ReadAsDouble() 99 | { 100 | return IsTuple ? ReadAsDouble(0) : double.Parse(Value); 101 | } 102 | 103 | 104 | public float ReadAsFloat() 105 | { 106 | return IsTuple ? ReadAsFloat(0) : float.Parse(Value); 107 | } 108 | 109 | public IEnumerable ReadAsStringArray() 110 | { 111 | return IsTuple ? ValueArray : new string[] { Value }; 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Utils/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace SimShift.Utils 6 | { 7 | [System.Security.SuppressUnmanagedCodeSecurity()] 8 | internal sealed class NativeMethods 9 | { 10 | [DllImport("user32.dll")] 11 | internal static extern bool GetClientRect(IntPtr hWnd, out Rect lpRect); 12 | 13 | [DllImport("user32.dll")] 14 | [return: MarshalAs(UnmanagedType.Bool)] 15 | internal static extern bool GetWindowRect(IntPtr hWnd, out Rect lpRect); 16 | 17 | /// 18 | /// Get a windows client rectangle in a .NET structure 19 | /// 20 | /// The window handle to look up 21 | /// The rectangle 22 | internal static Rectangle GetClientRect(IntPtr hwnd) 23 | { 24 | Rect rect = new Rect(); 25 | GetClientRect(hwnd, out rect); 26 | return rect.AsRectangle; 27 | } 28 | 29 | /// 30 | /// Get a windows rectangle in a .NET structure 31 | /// 32 | /// The window handle to look up 33 | /// The rectangle 34 | internal static Rectangle GetWindowRect(IntPtr hwnd) 35 | { 36 | Rect rect = new Rect(); 37 | GetWindowRect(hwnd, out rect); 38 | return rect.AsRectangle; 39 | } 40 | 41 | internal static Rectangle GetAbsoluteClientRect(IntPtr hWnd) 42 | { 43 | Rectangle windowRect = NativeMethods.GetWindowRect(hWnd); 44 | Rectangle clientRect = NativeMethods.GetClientRect(hWnd); 45 | 46 | // This gives us the width of the left, right and bottom chrome - we can then determine the top height 47 | int chromeWidth = (int)((windowRect.Width - clientRect.Width) / 2); 48 | 49 | return new Rectangle(new Point(windowRect.X + chromeWidth, windowRect.Y + (windowRect.Height - clientRect.Height - chromeWidth)), clientRect.Size); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /SimShift/SimShift/Utils/Rect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace SimShift.Utils 6 | { 7 | /// 8 | /// The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle. 9 | /// 10 | [Serializable, StructLayout(LayoutKind.Sequential)] 11 | internal struct Rect 12 | { 13 | public int Left; 14 | public int Top; 15 | public int Right; 16 | public int Bottom; 17 | 18 | public Rect(int left, int top, int right, int bottom) 19 | { 20 | this.Left = left; 21 | this.Top = top; 22 | this.Right = right; 23 | this.Bottom = bottom; 24 | } 25 | 26 | public Rectangle AsRectangle 27 | { 28 | get 29 | { 30 | return new Rectangle(this.Left, this.Top, this.Right - this.Left, this.Bottom - this.Top); 31 | } 32 | } 33 | 34 | public static Rect FromXYWH(int x, int y, int width, int height) 35 | { 36 | return new Rect(x, y, x + width, y + height); 37 | } 38 | 39 | public static Rect FromRectangle(Rectangle rect) 40 | { 41 | return new Rect(rect.Left, rect.Top, rect.Right, rect.Bottom); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /TestData/Air Resistance Test Scania R 730hp - gear 4.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/Air Resistance Test Scania R 730hp - gear 4.xlsx -------------------------------------------------------------------------------- /TestData/Air Resistance Test Scania R 730hp.csv: -------------------------------------------------------------------------------- 1 | 1060,9.6408378,0.146835,, 2 | 1070,9.7317891,0.146973,,Sample taken in 8th gear 3 | 1080,9.8227404,0.147641,,All RPM is referenced against 8 gear 4 | 1090,9.9136917,0.148151,,1000 rpm = 9.09513 m/s 5 | 1100,10.004643,0.149065,,0.00909513 6 | 1110,10.0955943,0.149818,, 7 | 1120,10.1865456,0.150482,, 8 | 1130,10.2774969,0.151294,, 9 | 1140,10.3684482,0.152026,, 10 | 1150,10.4593995,0.152932,, 11 | 1160,10.5503508,0.153743,, 12 | 1170,10.6413021,0.154947,, 13 | 1180,10.7322534,0.155543,, 14 | 1190,10.8232047,0.156476,, 15 | 1200,10.914156,0.157339,, 16 | 1210,11.0051073,0.158656,, 17 | 1220,11.0960586,0.158969,, 18 | 1230,11.1870099,0.159535,, 19 | 1240,11.2779612,0.160525,, 20 | 1250,11.3689125,0.161132,, 21 | 1260,11.4598638,0.16222,, 22 | 1270,11.5508151,0.163075,, 23 | 1280,11.6417664,0.164003,, 24 | 1290,11.7327177,0.164785,, 25 | 1300,11.823669,0.16563,, 26 | 1310,11.9146203,0.166509,, 27 | 1320,12.0055716,0.167144,, 28 | 1330,12.0965229,0.168118,, 29 | 1340,12.1874742,0.168935,, 30 | 1350,12.2784255,0.170105,, 31 | 1360,12.3693768,0.170936,, 32 | 1370,12.4603281,0.171865,, 33 | 1380,12.5512794,0.172749,, 34 | 1390,12.6422307,0.17376,, 35 | 1400,12.733182,0.174667,, 36 | 1410,12.8241333,0.175563,, 37 | 1420,12.9150846,0.176635,, 38 | 1430,13.0060359,0.177348,, 39 | 1440,13.0969872,0.178316,, 40 | 1450,13.1879385,0.179202,, 41 | 1460,13.2788898,0.180104,, 42 | 1470,13.3698411,0.181069,, 43 | 1480,13.4607924,0.18197,, 44 | 1490,13.5517437,0.183049,, 45 | 1500,13.642695,0.184063,, 46 | 1510,13.7336463,0.184922,, 47 | 1520,13.8245976,0.185629,, 48 | 1530,13.9155489,0.186787,, 49 | 1540,14.0065002,0.187885,, 50 | 1550,14.0974515,0.188973,, 51 | 1560,14.1884028,0.189821,, 52 | 1570,14.2793541,0.19078,, 53 | 1580,14.3703054,0.191805,, 54 | 1590,14.4612567,0.192785,, 55 | 1600,14.552208,0.193547,, 56 | 1610,14.6431593,0.194787,, 57 | 1620,14.7341106,0.196008,, 58 | 1630,14.8250619,0.19692,, 59 | 1640,14.9160132,0.197829,, 60 | 1650,15.0069645,0.19917,, 61 | 1660,15.0979158,0.199946,, 62 | 1670,15.1888671,0.200973,, 63 | 1680,15.2798184,0.202,, 64 | 1690,15.3707697,0.203027,, 65 | 1700,15.461721,0.203995,, 66 | 1710,15.5526723,0.204934,, 67 | 1720,15.6436236,0.205966,, 68 | 1730,15.7345749,0.20709,, 69 | 1740,15.8255262,0.208189,, 70 | 1750,15.9164775,0.209249,, 71 | 1760,16.0074288,0.210327,, 72 | 1770,16.0983801,0.211164,, 73 | 1780,16.1893314,0.212409,, 74 | 1790,16.2802827,0.213469,, 75 | 1800,16.371234,0.214632,, 76 | 1810,16.4621853,0.21576,, 77 | 1820,16.5531366,0.216954,, 78 | 1830,16.6440879,0.218041,, 79 | 1840,16.7350392,0.219105,, 80 | 1850,16.8259905,0.220052,, 81 | 1860,16.9169418,0.221173,, 82 | 1870,17.0078931,0.222298,, 83 | 1880,17.0988444,0.223327,, 84 | 1890,17.1897957,0.224549,, 85 | 1900,17.280747,0.225565,, 86 | 1910,17.3716983,0.226708,, 87 | 1920,17.4626496,0.227936,, 88 | 1930,17.5536009,0.228959,, 89 | 1940,17.6445522,0.230482,, 90 | 1950,17.7355035,0.231358,, 91 | 1960,17.8264548,0.232602,, 92 | 1970,17.9174061,0.234267,, 93 | 1980,18.0083574,0.235125,, 94 | 1990,18.0993087,0.236078,, 95 | 2000,18.19026,0.237214,, 96 | 2010,18.2812113,0.238294,, 97 | 2020,18.3721626,0.239667,, 98 | 2030,18.4631139,0.240695,, 99 | 2040,18.5540652,0.242141,, 100 | 2050,18.6450165,0.243161,, 101 | 2060,18.7359678,0.244325,, 102 | 2070,18.8269191,0.245425,, 103 | 2080,18.9178704,0.246704,, 104 | 2090,19.0088217,0.247973,, 105 | 2100,19.099773,0.249386,, 106 | 2110,19.1907243,0.250588,, 107 | 2120,19.2816756,0.251658,, 108 | 2130,19.3726269,0.252811,, 109 | 2140,19.4635782,0.254213,, 110 | 2150,19.5545295,0.25543,, 111 | 2160,19.6454808,0.256898,, 112 | 2170,19.7364321,0.258214,, 113 | 2180,19.8273834,0.260395,, 114 | 2190,19.9183347,0.260728,, 115 | 2200,20.009286,0.263242,, 116 | 2210,20.1002373,0.263434,, 117 | 2220,20.1911886,0.264597,, 118 | 2230,20.2821399,0.265813,, 119 | 2240,20.3730912,0.266847,, 120 | 2250,20.4640425,0.267911,, 121 | -------------------------------------------------------------------------------- /TestData/Air Resistance Test Scania R 730hp.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/Air Resistance Test Scania R 730hp.xlsx -------------------------------------------------------------------------------- /TestData/Fuel Efficiency Tests.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/Fuel Efficiency Tests.xlsx -------------------------------------------------------------------------------- /TestData/Negative torque measured with 0rpm-per-s test - Scania R 730hp.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/Negative torque measured with 0rpm-per-s test - Scania R 730hp.xlsx -------------------------------------------------------------------------------- /TestData/PowerCoastScaniaR-420hp.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/PowerCoastScaniaR-420hp.xlsx -------------------------------------------------------------------------------- /TestData/PowerCoastScaniaR-730hp.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/PowerCoastScaniaR-730hp.xlsx -------------------------------------------------------------------------------- /TestData/RPM vs LiterPerHour - Fixed Throttle.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/RPM vs LiterPerHour - Fixed Throttle.xlsx -------------------------------------------------------------------------------- /TestData/Throttle vs LiterPerHour - Fixed RPM.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nlhans/SimShift/b3493e72e89836ed9987cbabd9cddac78f3fef3a/TestData/Throttle vs LiterPerHour - Fixed RPM.xlsx --------------------------------------------------------------------------------