0

I wanted to ask how an application update works. I don't get it! I give you an example of GTA V.

When Rockstar releases a patch or update, how do they update the code without downloading the whole GBs/MBs again or recompiling it? After the update you can easily start the game.

I saw similar methods on other games. They modified e.g 2MB of code and the updater downloads only the 2MB. The modified code goes into the game without recompiling... Am I stupid or why don't I get how that works? ... I mean, if there is a 50MB big .DLL file and the devoloper edited only 1 line, the updater doesn't download the 50MB again, to the contrary it just gets the 1 edited line and yeah... It's in ._.*...

PeteDX
  • 31
  • 4
  • Some of the code is pieced together. Unless its just the executable, the program is updating dlls and so's. It's a lot of small work that goes into patches(what theyre called) they just update a certain mission1.dll or whatever, or new weapons in the library files and you get a complete update within minutes. The executable is just a frame like thing that understands how to generate what is in the dlls and other files. – David Pulse Oct 21 '15 at 15:16
  • Also, there is hex editing. They can *not* have a size check, or update it in a config. That would allow for new weapons and such in a few lines. – David Pulse Oct 21 '15 at 15:19
  • Thanks for your answer! So, the perfect way would be to make pieces? E.g dll/weapons.dll, clothes.dll, vehicles.dll, physics.dll? Or how i should understand that. – PeteDX Oct 21 '15 at 15:21
  • No,you get it. Thwre's nothing magical happening. They may even have like major freespace for lines of code to future proof updates in the dll's. Because they have to meet criteria. And leaving a empty array can allow a new weapon. – David Pulse Oct 21 '15 at 15:22
  • Oh! Now, thanks! Thank you really much. Helpful answers, i got it :D – PeteDX Oct 21 '15 at 15:27
  • And how does now the downloading work? Hex editing too in the dlls? – PeteDX Oct 21 '15 at 15:27
  • Yea, they just have a program that punches the letters into the dll. Did you know you could, after learning how, make your own GTA weapons with that knowledge? – David Pulse Oct 21 '15 at 15:28
  • LoL thats true yea would work, a nice modification – PeteDX Oct 21 '15 at 15:30
  • Why did he got down vote? I am agree that maybe isn't the right place for the question, but it was a fair Question. Strange things happen in here. – Michi Oct 21 '15 at 15:42
  • A file is a stream of bytes, as long as you know what bytes you need to replace, you can search for them and replace with new ones, so the size of the patch will be very small compared to file being patched. You can experiment this with a hex editor and a simple program that does something on a given condition like a even number, you can hack it by simply adding or removing bytes to alter the original code, its that simple. – user5159806 Oct 21 '15 at 16:09

1 Answers1

2

I think you are not aware of the possibility to apply binary patches.

Basically the idea is that if the change in the source code is small and the binary files are recompiled, a very large part will be identical. This can be exploited to release a patch that is also small in size.

For example, suppose that of your 50 MB binary only 10 bytes are changed. A smart tool could do this: take the old file, ignore the first 23,678,789 bytes, then replace the next 10 bytes with the content of the patch, delete 2 more bytes, ignore the next 4332 bytes, add one, and leave everything else untouched. In an appropriate format, this patch would only require a few bytes.

Of course it is reasonable that the full patch contains a hash of the original file and of the modified one, to make sure that everything goes smooth, and in case of disasters you could fall back to downloading the entire file anew. And you could add signatures to ensure that only authorized patches are installed. But the basic idea is that you can do binary diffs and patches, and this is absolutely common.

Community
  • 1
  • 1