The online racing simulator
Hi sicotange. Sorry for the off topic post but did you get the email I sent you today, about French translation? It's urgent as I will get the final translations for 0.6G tomorrow afternoon (not evening) and that will be it.
I confirm that the French translations will be updated before midnight (GMT). Replying to your email asap.
Quote from sicotange :Exact same crash / exploit:

Quote :Sep 25 00:09:08 Repaired Mesh
Sep 25 00:09:08 ^J™›œ›™ ^Lreset his car (FXR)
Sep 25 00:14:48 ^H¡¸¡³¡·¡´¡·¡³¡¸ : ^Lr
Sep 25 00:15:28 ^H¡¸¡³¡·¡´¡·¡³¡¸ : ^L...
Sep 25 00:19:20 Draggo^L took over from ^H¡¸¡³¡·¡´¡·¡³¡¸
Sep 25 00:19:33 Repaired Mesh
Sep 25 00:19:33 Draggo ^Lreset his car (FXR)
Sep 25 00:19:57 Repaired Mesh
Sep 25 00:19:57 Draggo ^Lreset his car (FXR)
Sep 25 00:21:51 Draggo : ^L¦jj¦¦¦¦¦¦¦^E¢¢¢¢¢•••¢¦0•,,,,,¦
Sep 25 00:27:10 Draggo : ^L^J™‚`‚a‚b‚c‚d‚e‚f‚g‚h‚i‚j‚k‚l‚m‚n‚o‚p‚q‚r‚s‚t‚u‚v‚w‚x‚y™
Sep 25 00:31:56 Draggo : ^L^H¢á¢Ý¢à¢à¢ç ^S£Á£Â£Ã£Ä ©–^K¢À¢Á¢¾¢¿ £Á£Â£Ã£Ä£Å£Æ£Ç£È£É£Ê£Ë£Ì£Í£Î£Ï£Ð£Ñ£Ò£Ó£Ô£Õ£Ö£×£Ø£Ù£Ú
Sep 25 00:32:48 Draggo : ^L!menu
Sep 25 00:39:11 Draggo : ^LÂ^J‚r‚n‚q‚q‚x ‚r‚n‚q‚q‚x ^K£Ó£Ï£Ò£Ò£Ù¡Ù ^J™
Sep 25 00:40:07 Repaired Mesh
Sep 25 00:40:07 Draggo ^Lreset his car (FXR)
Sep 25 00:42:10 Draggo : ^L^J™ ‚r‚n‚q‚q‚x ™ ‚m‚n ‚o‚q‚n‚a‚k‚d‚l ™
Sep 25 00:42:13 Repaired Mesh
Sep 25 00:42:13 Draggo ^Lreset his car (FXR)
Sep 25 00:57:09 Draggo : ^L^J™ ‚r‚n‚q‚q‚x ™ ™ ‚m‚n ‚o‚q‚n‚a‚k‚d‚l ™
Sep 25 00:59:07 Draggo : ^L^J™ ‚r‚n‚q‚q‚x ™^H¡¸^S¡î^K¡Ù ^^^J™ ‚m‚n ‚o‚q‚n‚a‚k‚d‚l ™
Sep 25 01:00:04 Draggo ^Lreset his car (FXR)
Sep 25 01:02:04 Draggo : ^L^J™š ‚` š™ ^H¡¸¡¹ ¢Ð¡¹¡¸ ^S¡î¡ï £Ã¡ï¡î ^K¡Ù¡Ú £Ä ¡Ú¡Ù
Sep 25 01:02:40 Draggo ^Lreset his car (FXR)
Sep 25 01:19:49 Draggo : ^L^J™‚k‚`‚k‚`™ ™‚k‚`™
Sep 25 01:20:00 Draggo ^Lreset his car (FXR)
Sep 25 01:23:11 Draggo : ^L^J™‚k‚`‚k‚`™ 2^^2™‚k‚`™
Sep 25 01:27:03 Draggo ^Lreset his car (FXR)
Sep 25 01:27:07 Draggo : ^L^J™‚k‚`‚k‚^™ 2^^^™‚k‚^™
Sep 25 01:27:07 InSim guest closed : ClaViCo
Sep 25 01:37:54 Leave @ 2262791 : Draggo
Sep 25 01:37:54 Draggo^L disconnected (Draggo)

This bug is paradise for trolls, I hope you will fix it soon

Is this with the latest code from the GitHub repository? I have been able to recreate this bug (finally) but only in the current stable release, it doesn't seem to happen for me in the updated code I pushed to GitHub.
Quote :Hi sicotange. Sorry for the off topic post but did you get the email I sent you today, about French translation? It's urgent as I will get the final translations for 0.6G tomorrow afternoon (not evening) and that will be it.

FYI, the translations mentioned in your email (I replied too) have been updated


Quote :Is this with the latest code from the GitHub repository? I have been able to recreate this bug (finally) but only in the current stable release, it doesn't seem to happen for me in the updated code I pushed to GitHub.

If you're not able to clone the GitHub repo here is a compiled version of the latest commits with this (potential) fix.

The 2 (identical) crashes happened using InSim.NET 2.1.0.0 hereby attached. I asked Draggo to explain how I can reproduce it but I didn't understand his explanations much. If I got it half-right typing a special character in combination with '^' in the chat could cause the crash (?).
Attached files
InSimDotNet EXPLOIT.zip - 53.2 KB - 642 views
That version of InSimDotNet.dll is from back in August, did you try it with the updated DLL in my last post?

The DLL in my last post is an updated one with a fix for this exploit, if you could try that one in your project and report if the issue is fixed or not. It seems to be fixed in my tests but I need someone to confirm it.
I tried it now with Draggo. He could make it crash instantly with Old version. With the New version he hasn't succeeded yet, it seems to be fixed
Yay!
I pushed a beta release of 2.1.1 onto GitHub and NuGet. Let me know if it works.
I'm glad you could fix that exploit rather rapidly Not much to report at the moment, hoping the lib is stable in the long run. I think I may have found another bug though but I don't know if it is related to the recent InSim.NET releases. Either way I can reproduce it in 2.1.0 & 2.1.1. I haven't tested in an older version. The IS_CPR Plate string has difficulties with special characters and '^' doesn't seem to be digested well (unicode issue?).

The following string ^ _ ^ results in _ ^8 for example.
Also could you please implement the new InSim packet introduced with 0.6F12: IS_HCP


// HANDICAPS
// =========

// You can send a packet to add mass and restrict the intake on each car model
// The same restriction applies to all drivers using a particular car model
// This can be useful for creating multi class hosts

Quote :struct CarHCP // Car handicaps in 2 bytes - there is an array of these in the HCP (below)
{
byteH_Mass;// 0 to 200 - added mass (kg)
byteH_TRes;// 0 to 50 - intake restriction
};

struct IS_HCP // HandiCaPs
{
byteSize;// 68
byteType;// ISP_HCP
byteReqI;// 0
byteZero;

CarHCPInfo[32];// H_Mass and H_TRes for each car : XF GTI = 0 / XR GT = 1 etc
};



EDIT: Actually I might be able to update it myself, looking into it
I added the new packet and pushed it to GitHub, not massively tested it yet so might still have some problems, seems to work OK though. I will add it to the beta tomorrow as it's a bit late tonight.

Here is how you use it:

var hcp = new IS_HCP();

// Set handicap for XF GTI
hcp.Info[0].H_Mass = 50;
hcp.Info[0].H_TRes = 20;

// Set handicap for XR GT
hcp.Info[1].H_Mass = 20;
hcp.Info[1].H_TRes = 30;

// etc.

// Send packet.
insim.Send(hcp);

There might be a better way to specify which car you want to modify as remembering the index for each one will be very difficult.
Works perfectly so far, thanks :-)

Quote :There might be a better way to specify which car you want to modify as remembering the index for each one will be very difficult.

It shouldn't be to difficult if we use a simple GetIndexCar(string); or GetIndexCar(CarFlag);
-
(sicotange) DELETED by sicotange : I should not write codes when I am tired...
Yes I'm thinking about some kind of helper method on the class like:

hcp.SetHandicap(CarFlags.XFG, T_Mass = 50, H_TRes = 20);

Maybe you could combine them in order to set multiple cars at a time.

hcp.SetHandicap(CarFlags.XFG | CarFlags.XRG, T_Mass = 50, H_TRes = 20);

Or it might be better to add this as a helper class. I'll think about it.
I think I would prefer to distinguish InSim.NET core code from helpers clearly. But that's from my point of view.

Quote :hcp.SetHandicap(CarFlags.XFG | CarFlags.XRG, T_Mass = 50, H_TRes = 20);

Either way this is indeed clean/neat
I agree, I would like to keep the packets as close to LFS as possible and use the helpers for this kind of extra stuff.

The alternative would be to create some kind of helper like this:

var hpc = new IS_HPC();

HandicapHelper.SetHandicap(hpc, CarFlags.XFG | CarFlags.XRG, T_Mass = 50, H_TRes = 20);

insim.Send(hpc);

It's late tonight, I will think about it and figure something out tomorrow.

Edit: BTW I have noted the problem with updating number plates and will look into it before the beta is released.
Btw is this a mini bug (duplication) in PacketFactory.cs?

if (type == typeof(IS_PLC))
return PacketType.ISP_PLC;
if (type == typeof(IS_AXM))
return PacketType.ISP_AXM;
if (type == typeof(IS_AXM))
return PacketType.ISP_AXM;

if (type == typeof(IS_ACR))
return PacketType.ISP_ACR;
if (type == typeof(IR_ARP))

I suppose it doesn't affect anything though.
It's not a bug as it doesn't change the behaviour of the program, but it is clearly a mistake. I've updated the code on GitHub, thanks!
I released InSim.NET 2.1.1 onto GitHub and NuGet.

Changes
  • Added new IS_HCP packet and HandicapHelper class.
  • Added ContinueOnCapturedContext property to InSim, OutSim, OutGauge, TcpSocket and UdpSocket. Setting this to false prevents InSim.NET from marshalling packet callbacks back onto the calling thread e.g. in UI apps.
  • Fixed bug that allowed players to crash InSim.NET by typing characters in LFS that were not translatable into unicode.
  • TcpSocket and UdpSocket now expose their underlying .NET Socket objects for convenience.
I added the new IS_HCP packet, here's how to use it:

var hcp = new IS_HCP();

// Set handicap for XF GTI
hcp.Info[0].H_Mass = 50;
hcp.Info[0].H_TRes = 20;

// Set handicap for XR GT
hcp.Info[1].H_Mass = 20;
hcp.Info[1].H_TRes = 30;

// etc.

// Send packet.
insim.Send(hcp);

Alternatively I added a new HandicapHelper class to the Helpers namespace which makes it easier to use:

// Create packet.
var hcp = new IS_HCP();

// Set handicaps for specified cars.
HandicapHelper.SetHandicap(hpc, CarFlags.XFG | CarFlags.XRG, H_Mass: 50, H_TRes: 20);

// Send packet to LFS.
insim.Send(hcp);

You can also set CarFlags.All to set the handicap for all cars:

HandicapHelper.SetHandicap(hpc, CarFlags.All, H_Mass: 50, H_TRes: 20);

I made a mistake with the last NuGet release, the binary was 2.1.0 when it should have been 2.1.1.

To fix this I have released InSim.NET 2.1.2, which is just the previous version with a couple of very small tweaks.

The release on GitHub wasn't affected.
Great work as always
Yeah, I read about this. From a InSim.NET point of view it means you won't need to use Mono to run it on Linux and Mac anymore, there will be an official .NET runtime you can use. Also Visual Studio Community is very interesting as well, as it has all the same features and functionality as Visual Studio Professional, which is normally very expensive. It's basically like they are going to give away Professional for free now.
Any ideas when this is going to happen?
I think the .NET cross-platform stuff will be released with Visual Studio 2015, although that's a guess, I don't really know. Visual Studio Community is out now.
There isn't much that doesn't work with Mono anyway. PInvoke into Windows libraries is obviously one, and that isn't going to change.

.NET isn't coming to non-Windows platforms, so Mono isn't going to become obsolete; they will just be able to incorporate code from the .NET framework more easily.

FGED GREDG RDFGDR GSFDG