Skip to content

Commit

Permalink
Update html template
Browse files Browse the repository at this point in the history
  • Loading branch information
aglitchman committed Apr 24, 2024
1 parent 482c3e8 commit 691e1d4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions liveupdate_reszip/manifests/web/engine_template.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<html>
<body>
<script id="engine-setup" type="text/javascript">
<script id="reszip-setup" type="text/javascript">
// {{#liveupdate_reszip.wipe_on_start}}
// HashSHA1 implementation
!function(){var r=function(r){for(var n="",t=7;t>=0;t--)n+="0123456789abcdef".charAt(r>>4*t&15);return n},n=function(r,n){var t=(65535&r)+(65535&n);return(r>>16)+(n>>16)+(t>>16)<<16|65535&t},e=function(r,n){return r<<n|r>>>32-n},o=function(r,n,t,e){return r<20?n&t|~n&e:r<40?n^t^e:r<60?n&t|n&e|t&e:n^t^e},u=function(r){return r<20?1518500249:r<40?1859775393:r<60?-1894007588:-899497514};window._HashSHA1=function(f){for(var a=function(r){for(var n=1+(r.length+8>>6),t=new Array(16*n),e=0;e<16*n;e++)t[e]=0;for(e=0;e<r.length;e++)t[e>>2]|=r.charCodeAt(e)<<24-e%4*8;return t[e>>2]|=128<<24-e%4*8,t[16*n-1]=8*r.length,t}(f),c=new Array(80),i=1732584193,h=-271733879,v=-1732584194,A=271733878,g=-1009589776,l=0;l<a.length;l+=16){for(var w=i,d=h,y=v,H=A,b=g,s=0;s<80;s++)c[s]=s<16?a[l+s]:e(c[s-3]^c[s-8]^c[s-14]^c[s-16],1),t=n(n(e(i,5),o(s,h,v,A)),n(n(g,c[s]),u(s))),g=A,A=v,v=e(h,30),h=i,i=t;i=n(i,w),h=n(h,d),v=n(v,y),A=n(A,H),g=n(g,b)}return r(i)+r(h)+r(v)+r(A)+r(g)}}();
// {{/liveupdate_reszip.wipe_on_start}}

var old_preloadAndCallMain = Module._preloadAndCallMain;
Module._preloadAndCallMain = function () {
var old_callMain = Module._callMain;
var reszip_preloadingStarted = false;
Module._callMain = function () {
// {{#liveupdate_reszip.wipe_on_start}}
// Delete all LiveUpdate files stored in IDBFS
var dir = DMSYS.GetUserPersistentDataRoot();
Expand All @@ -26,12 +27,13 @@
} catch (e) {}
// {{/liveupdate_reszip.wipe_on_start}}

if (Module._archiveLoaded) {
// {{#liveupdate_reszip.preload_file}}
// {{#liveupdate_reszip.preload_file}}
if (!reszip_preloadingStarted) {
_dmResZipRequestFileAsync("{{{liveupdate_reszip.preload_file}}}");
// {{/liveupdate_reszip.preload_file}}
reszip_preloadingStarted = true;
}
old_preloadAndCallMain();
// {{/liveupdate_reszip.preload_file}}
old_callMain();
};
</script>
</body>
Expand Down

0 comments on commit 691e1d4

Please sign in to comment.