Search Unity

SimplePatchTool - open source patching solution for standalone platforms

Discussion in 'Assets and Asset Store' started by yasirkula, Jul 26, 2018.

  1. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    Thank you! Then I've good news for you: I've been working on an update for a while and it will be out very soon :)
     
    Shadowing, hopeful and zyzyx like this.
  2. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    The big update is finally out on GitHub!

    P.S. The update is now live on Asset Store, as well.

    Changelog

    - Introduced "Project"s to create patches much more easily
    - Added "Installer Patch" method (might be useful for launchers downloading a whole app)
    - Log file is now stored inside the directory application resides and stores more useful information (most of the previously unhandled exceptions are now logged to the log file)
    - Added GZIP compression method as a faster alternative to LZMA*
    - Added NONE compression method (applies no compression)*
    - Added SimplePatchTool.FetchOverallProgress
    - Added SimplePatchTool.CheckForMultipleRunningInstances to abort if multiple instances of the application are running
    - Added SimplePatchTool.IListener interface and its PatcherListener implementation to receive callbacks from SimplePatchTool
    - Added VersionInfoFetched callback to SimplePatchTool.IListener (i.e. it's now possible to modify the VersionInfo just before the patch starts)
    - Added PatchMethod property to SimplePatchTool to see which patch method is being applied
    - Added NewVersion property to SimplePatchTool to fetch new version's version number (e.g. 1.2.0)
    - Added PatchUtils.GetCurrentAppVersion to fetch app's current version
    - Added PatchUtils.GetDefaultSelfPatcherExecutablePath
    - Added Binary Diff Quality to produce smaller incremental patches (by trying different chunk sizes for each file)
    - Added ApplyingSelfPatch to SimplePatchTool.PatchOperation
    - SimplePatchTool automatically replaces {ROOT_PATH} and/or {APPLICATION_DIRECTORY} in rootPath argument with the application directory
    - SimplePatchTool no longer comes bundled with a self patcher executable on Windows, you need to build the self patcher executable yourself
    - Updated the wiki, check it out: https://github.com/yasirkula/SimplePatchTool/wiki/
    - Updated demo scenes
    - Removed SimplePatchTool.UseRepair, use UseRepairPatch instead
    - Numerous bugfixes

    *If you already have a published app that uses SimplePatchTool, keep using LZMA compression, other compression methods are not backwards-compatible. Or, see this post: https://github.com/yasirkula/SimplePatchTool/wiki/About-Backwards-Compatibility

    Migrating existing projects to "Project"s

    I'm assuming that you're planning to continue with the LZMA compression method which is the only backwards-compatible one as described above.
    1. Create a project
    2. If your latest version was e.g. 1.4.0, then create a subdirectory called
      1.4.0
      inside the Versions folder of the project
    3. Move your latest version's files into the 1.4.0 subdirectory (the files inside version 1.4.0 of your app's build directory, which contains the
      {PROJECT_NAME}_vers.sptv
      file)
    4. Open the project's Settings.xml and change change its Name property to match {PROJECT_NAME}
    5. If you had any incremental patches, create a subdirectory called IncrementalPatch inside the Output folder of the project and copy these incremental patches there
    6. Copy your latest VersionInfo.info to the Output folder of the project
    7. All done! Now you can continue creating your patches via this project (I've updated all the tutorials on GitHub, as well)
    8. If you don't want to use projects (using projects is much easier, trust me), you can always access the legacy build options from the "Open Legacy Window" option of Window-Simple Patch Tool
     
    Last edited: May 28, 2019
    AthrunVLokiz and hopeful like this.
  3. Airmouse

    Airmouse

    Joined:
    Jan 12, 2019
    Posts:
    23
    I keep getting error when using google drive:

    "Error: no suitable patch method found"


    What am I doing wrong?

    I used the DownloadLinkGeneratorForGoogleDrive and saved to txt file then updated my versioninfo.info like it says to here

    But after I click the update button, the error immediately shows (and with no debugging).

    What do I do now?


    Is there a reason for this?
     
    Last edited: May 28, 2019
  4. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    If SimplePatchTool is configured like
    UseRepairPatch(false).UseIncrementalPatch(false)
    or if you haven't created repair and/or incremental patches while generating the patch, this error occurs. Can you send me your VersionInfo via private message?

    I don't have a certificate from a trusted CA to sign the self patcher executable with, so it is probable that users' Windows OSes or anti virus softwares complain about the file being potentially harmful. At least if developers build their own self patcher executables themselves, they are responsible from either shipping the self patcher executable without signing it or signing it with a certificate from a trusted CA. On Windows, it is pretty easy to build a self patcher executable:

    - download this repository: https://github.com/yasirkula/SimplePatchTool
    - open Extras/SimplePatchToolExtras.sln
    - build the SelfPatcherWinForms project
    - move the generated SelfPatcher.exe and SelfPatcherCore.dll to the self patcher executable directory
     
    Last edited: May 28, 2019
  5. BlueTera

    BlueTera

    Joined:
    Jul 19, 2018
    Posts:
    21
    Will you make a updated version with launcher example. ?
    Becuse i really want to use it when i have gone further into development. on my current project.
     
  6. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    I've updated all the example scenes. Do you mean something like a video tutorial?
     
  7. BlueTera

    BlueTera

    Joined:
    Jul 19, 2018
    Posts:
    21
    Yea. that could be awsome like the old one but isen`t that one outdated ?.
     
  8. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    The video tutorials are old but will continue working, it is still possible to create patches the old way. The only difference is that you have to build the self patcher executable yourself and move it into your Unity build directory (inside a subdirectory called SPPatcher, to be precise).

    I've spent some time making sure that the written tutorials are clear and on point. You can give them a try, as well: https://github.com/yasirkula/UnitySimplePatchTool#examples
     
  9. tindolt

    tindolt

    Joined:
    Mar 28, 2014
    Posts:
    1
    Hey so the patcher is saying no suitable patch method found and I cant find where to set it so useIncrementalPatch(true) I have looked so hard and now its annoyed me.

    Ok so I found use incremental patch but its already true...
     
    Last edited: Jun 3, 2019
  10. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    No incremental patch will be generated in your first patch because incremental patch requires a "from" version and a "to" version in order to generate the binary diffs. Make sure that you generate either repair patch or installer patch, as well.
     
  11. AndyHubbard

    AndyHubbard

    Joined:
    Jul 9, 2015
    Posts:
    4
    Hi,
    I have got this integrated as a self patching Unity application but I get
    ERROR: downloaded file DS3D_Data\globalgamemanagers is corrupt

    Permissions seem OK on the server the files are trying to download from

    Can you please help me figure out what I am doing wrong?

    Many thanks,

    Andy
     
    Last edited: Jun 12, 2019
  12. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    I don't understand why the PatchInfo downloaded by SimplePatchTool contains a
    <html xmlns=''>
    line while the same file downloaded manually obviously doesn't contain that line. It might be the case that when SimplePatchTool downloads several files one after another, server returns an HTML page stating that there is an unusual traffic, instead of returning the actual file.

    When a patch is not completed successfully, the patch files remain untouched. You can navigate to
    %APPDATA%/../Local/SimplePatchToolDls
    in file explorer and open globalgamemanagers.lzdat with Notepad++ to see its contents. Check if it matches the contents of the actual globalgamemanagers.lzdat file.
     
  13. AndyHubbard

    AndyHubbard

    Joined:
    Jul 9, 2015
    Posts:
    4
    Thanks for helping. I looked at the
    %APPDATA%/../Local/SimplePatchToolDls/
    globalgamemanagers file and it is actually the webpage html of /DS3D/Distribution !
    So the actual file is not being downloaded. Is my <BaseDownloadURL> set properly in VersionInfo.info? Or could my server (.htaccess?) be preventing the file download?
     
  14. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    Oh, didn't even check BaseDownloadURL. It should be
    https://www.dreamscapes.dyn.dhs.org/DS3D/Distribution/
    . You can simply change that value and upload the new VersionInfo to the server, no need create the patches from scratch.
     
  15. AndyHubbard

    AndyHubbard

    Joined:
    Jul 9, 2015
    Posts:
    4
    Duh, that was it, many thanks for the great support :)
     
    yasirkula likes this.
  16. ssuniljust4u

    ssuniljust4u

    Joined:
    Jun 27, 2016
    Posts:
    3
    hi,

    will this patch work with UWP also.

    Best regards,
    Sunil
     
  17. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    Honestly, haven't tried it. But it may not work because UWP may no allow accessing files by their absolute file paths.
     
  18. KuPAfoo

    KuPAfoo

    Joined:
    Aug 24, 2013
    Posts:
    14
    I feel like a complete noob...
    I've read what seems to be every article of documentation and I cannot seem to find out how to manage the contents of the versioninfo.info file...

    I created a dummy
    i uploaded it to the cloud
    i generated a sharable link
    i replaced the app's pointer to the link

    now it shows "ERROR: version info is invalid"
    all I've learned from documentation about versioninfo.info is the <BaseDownloadURL> tag should be... existant...

    I also downloaded that "Download link generator"
    but everyone else's example versioninfo.info files have all kinds of xml in it...
    that includes file sizes... Now i'm thinking, if that's the case, how am I supposed to update the versioninfo to download NEW files, without manually adding each <VersionItem> manually...

    I'm so confused. It literally took 2 hours to figure out I can use the LauncherUI in the hierarchy to change the variables...

    The documentation on github is like a gigantic 6 hour goose chase with no answers. I don't mean to be rude, but this really looks a WHOLE LOT easier than your documentation is making it out to be.
     
  19. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    VersionInfo is auto-generated when you create a patch. Then, you make any modifications to it (like updating the download links) and then replace the dummy VersionInfo with the real one. Were the step-by-step tutorials confusing on this subject?
     
  20. KuPAfoo

    KuPAfoo

    Joined:
    Aug 24, 2013
    Posts:
    14
    The link you provided me is for the "Self patching app demo"
    https://github.com/yasirkula/UnitySimplePatchTool/#selfpatchingappdemo

    I'm trying to understand the "Launcher demo" before I continue to discover self-patching.

    but it seems in the inspector, self-patching is already integrated into your unity project "LauncherDemo" scene.


    You can test this scene as follows:

    • follow these steps and paste VersionInfo's url to the Version Info URL
    The link listed in step 1 shows you to create a versioninfo.info file and upload it to the cloud... easy process.
    • variable of SelfPatchingAppUI in the Inspector
    what is this step even trying to say?
    • tweak the value of Check Version Only as you like
    where are we looking for this? We haven't opened unity, visual studio... I have no idea what file or inspector you're looking at...
    What is this step even about?
    "A project is basically a directory that contains the following files and folders:"
    and then it goes on to describe how changing these variables will force you to access executables... within this launcher's file folders?

    Wait... are we not hosting our own separate program on the cloud, and keeping the launcher a separate entity? Or is this creating a build where I update the launcher, and that automatically updates the game?
    • as this app uses self patching, we need a self patcher executable: create a self patcher executable and put it inside the SelfPatcher directory of the project
    Right, self patcher executable... but is this still setup process or is this customization?

    So back to the original point... if the versioninfo.info is generated on runtime, but the client says the versioninfo.info in my cloud (which is a blank dummy) is incorrect, how am I supposed to get the correct version?

    that's not covered in the link you sent me either...

    again, I really don't mean to be rude, and I appreciate your creation and sharing of this gem, but the documentation seems to have too much legacy knowledge, and not enough unity information...

    I wish you could just look from the end user's perspective (knowing nothing about your architecture) and make a video on how to do a simple setup.
     
  21. KuPAfoo

    KuPAfoo

    Joined:
    Aug 24, 2013
    Posts:
    14
    Well, I found this video
    it's listed as (Legacy) in the github documentation... This definitely has the best guide for getting started. It shows you where to navigate in the hierarchy and how to upload the files...


    When I choose "Create patch" it shows nothing in the unity console, and generates a folder that does not contain versioninfo.info
     
    Last edited: Jun 14, 2019
  22. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    925
    • follow these steps and paste VersionInfo's url to the Version Info URL variable of SelfPatchingAppUI in the Inspector

    SelfPatchingAppUI (or LauncherUI) is the name of the GameObject in the example scene that handles patching the app. When you select it, in Inspector you'll see some variables, one of which is "Version Info URL". Simply paste the download URL of the dummy VersionInfo there.

    • tweak the value of Check Version Only as you like

    Again, a value exposed in the Inspector. You can hover over it for a tooltip.

    • create a project for this app

    A "project" is a SimplePatchTool-project that makes patch creation process much easier. It was actually more difficult to create patches in the past, trust me :) You put each new build of your app inside a new subdirectory in the project's Versions folder and after you start generating the patch, the project looks at the configuration in Settings.xml and generates the patch files accordingly.

    • Wait... are we not hosting our own separate program on the cloud, and keeping the launcher a separate entity? Or is this creating a build where I update the launcher, and that automatically updates the game?

    You are hosting all the patch files on the server of your choice. That's actually why SimplePatchTool might be harder to grasp than other solutions: as SimplePatchTool can't guess where the files will be hosted, you are responsible from providing the correct download links for the patch files in VersionInfo.

    • as this app uses self patching, we need a self patcher executable: create a self patcher executable and put it inside the SelfPatcher directory of the project

    If you don't need the launcher the update itself, then you don't need a self patcher executable. Otherwise, you'll need one because the launcher can't update itself while it is still running, a companion app (self patcher executable) is needed for this job.

    • So back to the original point... if the versioninfo.info is generated on runtime, but the client says the versioninfo.info in my cloud (which is a blank dummy) is incorrect, how am I supposed to get the correct version?

    VersionInfo is not generated at runtime. It is generated automatically by the "project" after you generate a patch. Then, you'll need to upload the patch files to the server of your choice and update the files' download links in VersionInfo. Finally, you'll update the dummy VersionInfo with this new one. So your users will not be fetching a dummy file.

    • Creating a Project

    You can find the Unity section at the bottom of the same page: https://github.com/yasirkula/SimplePatchTool/wiki/Project:-Create#via-unity-plugin. SimplePatchTool is not a Unity-specific library, it can be used for native C# applications, as well. Thus, I explain all the possible ways to handle things in the wiki (via console app, Scripting API or Unity plugin). If there is a "Via Unity plugin" section in the page you are looking, you can ignore the other methods.

    • Legacy video tutorial

    I find the legacy method more confusing than using projects, and I intend to update those videos in the near future. One key change that has happened since the video was released is that, SimplePatchTool plugin doesn't come bundled with a self patcher executable anymore and you must create your own self patcher executable yourself (it is as simple as building a Visual Studio project). The reasoning behind this decision is explained here.

    If Create Patch does nothing, are you sure that all log types (errors, warnings, logs) are enabled in the console? There is supposed to be at least an error message.
     
  23. KuPAfoo

    KuPAfoo

    Joined:
    Aug 24, 2013
    Posts:
    14
    Beautiful response! I'll have to scour this message for some better understanding!

    My apologies for being so hard on you at first, but honestly if I hadn't found that legacy video i'd probably be ripping my hair out right now!

    your project is so beautiful, and it boasts about some really grand features. I can understand how this architecture is working, but the setup and configuration process was really outside of my limited scope. If you can go into lame-man's terms in documentation, (Like, simple patch tool for dummies xD)
    and possibly update your videos... that legacy one I shared is GOLD! but out of date...

    Thank you so much for this asset, I think it's finally coming together for me.