Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

InSim.NET Application

insim.net insimdotnet lfs live for speed car simulator lfs.net c# help

This topic has been archived. This means that you cannot reply to this topic.
49 replies to this topic

#1 Kriss

Kriss

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 02 February 2015 - 11:58 AM

Hi, I'm programming an InSim Application for the car simulator Live For Speed. This InSim is using a InSim.NET library.
The problem here is that if I send a message that is longer than 128 characters, half of the message disappears.
Here's some code:
 
so.. I expanded the Packets section.
Packets.JPG
 
and selected the MST packet. This is what the code inside that packet looks like:
fullwindow.JPG
 
I've tried to just change the numbers higher than they are, but as a result the message won't show at all. I've seen other servers do this, I know its possible :)
For example where it says

public IS_MSO()
{
	this.Size = 136;
	this.Type = PacketType.ISP_MSO;
	this.Msg = string.Empty;
}

Since the length of the message is 128, the size (picture above) has to be 4 bytes more than the length.
So I changed that to 260
 
Then over to the length..

{
	string pname = reader.ReadString(textStart);
	this.TextStart = (byte)pname.Length;
	this.Msg = pname + reader.ReadString(128 - textStart);
	return;
}

Ok, where it says 128.. Thats the length of the message. I changed that to 256.
 
So:
- Size: 260
- Length: 256
 
Should work just fine, but nothing happens.. any ideas?
The file I'm editing, is a .dll file. The project file I have is not the original either, I used ILSpy to decompile the content.

 

Thanks in advance.

Kriss :)



#2 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 02 February 2015 - 04:37 PM

The file I'm editing, is a .dll file. The project file I have is not the original either, I used ILSpy to decompile the content.

 

Well there's your problem. I can't give you a concrete answer because neither of us has the source code, but this sounds like you're overrunning a static-sized buffer somewhere. You need to figure out where this buffer is and change the size manually.


Edited by dargueta, 02 February 2015 - 04:37 PM.

sudo rm -rf / && echo $'Sanitize your inputs!'


#3 Kriss

Kriss

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 02 February 2015 - 11:50 PM

@dargueta

 

Yeah, thanks for the quick reply.

I've been trying on this several hours. (6-7h). I'm gonna upload the source code later.



#4 Kriss

Kriss

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 03 February 2015 - 10:21 AM

Here's the source :)

Have a look and let me know how I can do this :D

Attached File  InSim.NET sourcecode.zip   339.88KB   143 downloads

 

 

~Kriss


Edited by Kriss, 03 February 2015 - 10:22 AM.


#5 PBJ

PBJ

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 176 posts

Posted 03 February 2015 - 03:31 PM

@kriss

Please read CodeCall's FAQ on how to properly post a programming question. In brief, just post the code on the forum in code tags.



#6 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 03 February 2015 - 05:02 PM

So where are the functions you're trying to modify? Can you point out specifically what you need to change (and why)?


sudo rm -rf / && echo $'Sanitize your inputs!'


#7 Kriss

Kriss

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 05 February 2015 - 02:11 PM

@dargueta

 

I wanna increase the length of the message, its too short... Its originally 128 characters and I want it to be 256 or longer.. :)

this.Msg = pname + reader.ReadString(128 - textStart);

I believe its the GetBuffer(); function.


Edited by Kriss, 05 February 2015 - 02:14 PM.


#8 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 05 February 2015 - 02:54 PM

Can't you just split the payload across multiple messages and include something that indicates the payload is continued in the next message? That's how a lot of protocols work. The 128-character limit is there for a reason.


Edited by dargueta, 05 February 2015 - 02:55 PM.

sudo rm -rf / && echo $'Sanitize your inputs!'


#9 Kriss

Kriss

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 06 February 2015 - 02:38 AM

well, yea.. I could do half of the message in one line and then the rest in the next one.. but I still got extend the length. Cause if people have playernames that have lots of colors and are long:

^0 - black
^1 - red
^2 - green
^3 - yellow
^4 - dark blue
^5 - pink
^6 - light blue
^7 - white
^8 - grey


Each ^ and numbers counts as a character. Which means that some messages get cutted out at the end.



#10 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 06 February 2015 - 04:30 AM

Who says you have to fit the name into a single message?


sudo rm -rf / && echo $'Sanitize your inputs!'


#11 Kriss

Kriss

    CC Regular

  • Member
  • PipPipPip
  • 30 posts

Posted 06 February 2015 - 03:32 PM

No one says that, I just want it that way.. It just doesn't look good with 2 messages.



#12 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 06 February 2015 - 05:58 PM

Er... So these are literal messages, not like packets or something? That changes things. Hm...


sudo rm -rf / && echo $'Sanitize your inputs!'





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download