From 66fed508b452da579471fafd49879bbaabd96ed5 Mon Sep 17 00:00:00 2001
From: magiczocker10 <59317952+magiczocker10@users.noreply.github.com>
Date: Tue, 2 Jul 2024 19:31:51 +0200
Subject: [PATCH 1/9] Add "The Lego Movie Videogame"
---
index.html | 1 +
.../_cache_service_worker.js | 82 +++++
the-lego-movie-videogame/index.html | 133 ++++++++
the-lego-movie-videogame/savegame.dat | Bin 0 -> 2524 bytes
.../the-lego-movie-videogame.js | 297 ++++++++++++++++++
5 files changed, 513 insertions(+)
create mode 100644 the-lego-movie-videogame/_cache_service_worker.js
create mode 100644 the-lego-movie-videogame/index.html
create mode 100644 the-lego-movie-videogame/savegame.dat
create mode 100644 the-lego-movie-videogame/the-lego-movie-videogame.js
diff --git a/index.html b/index.html
index 75aa188..88a1335 100644
--- a/index.html
+++ b/index.html
@@ -118,6 +118,7 @@ h6 a:hover{

StreetPass Mii Plaza

Picross 3D: Round 2

Rhythm Paradise Megamix
+ 
The Lego Movie Videogame
diff --git a/the-lego-movie-videogame/_cache_service_worker.js b/the-lego-movie-videogame/_cache_service_worker.js
new file mode 100644
index 0000000..1a26cf3
--- /dev/null
+++ b/the-lego-movie-videogame/_cache_service_worker.js
@@ -0,0 +1,82 @@
+/*
+ Cache Service Worker template by mrc 2019
+ mostly based in:
+ https://github.com/GoogleChrome/samples/blob/gh-pages/service-worker/basic/service-worker.js
+ https://github.com/chriscoyier/Simple-Offline-Site/blob/master/js/service-worker.js
+ https://gist.github.com/kosamari/7c5d1e8449b2fbc97d372675f16b566e
+
+ Note for GitHub Pages:
+ there can be an unexpected behaviour (cache not updating) when site is accessed from
+ https://user.github.io/repo/ (without index.html) in some browsers (Firefox)
+ use absolute paths if hosted in GitHub Pages in order to avoid it
+ also invoke sw with an absolute path:
+ navigator.serviceWorker.register('/repo/_cache_service_worker.js', {scope: '/repo/'})
+*/
+
+
+/* MOD: fix old caches for mrc */
+caches.keys().then(function(cacheNames){
+ for(var i=0; i {
+ evt.waitUntil(
+ caches.open('precache-'+PRECACHE_ID+'-'+PRECACHE_VERSION)
+ .then(cache => cache.addAll(PRECACHE_URLS))
+ .then(self.skipWaiting())
+ );
+});
+
+
+// activate event (fired when sw is has been successfully installed): cleans up old outdated caches
+self.addEventListener('activate', evt => {
+ evt.waitUntil(
+ caches.keys().then(cacheNames => {
+ return cacheNames.filter(cacheName => (cacheName.startsWith('precache-'+PRECACHE_ID+'-') && !cacheName.endsWith('-'+PRECACHE_VERSION)));
+ }).then(cachesToDelete => {
+ return Promise.all(cachesToDelete.map(cacheToDelete => {
+ console.log('delete '+cacheToDelete);
+ return caches.delete(cacheToDelete);
+ }));
+ }).then(() => self.clients.claim())
+ );
+});
+
+
+// fetch event (fired when requesting a resource): returns cached resource when possible
+self.addEventListener('fetch', evt => {
+ if(evt.request.url.startsWith(self.location.origin)){ //skip cross-origin requests
+ evt.respondWith(
+ caches.match(evt.request).then(cachedResource => {
+ if (cachedResource) {
+ return cachedResource;
+ }else{
+ return fetch(evt.request);
+ }
+ })
+ );
+ }
+});
diff --git a/the-lego-movie-videogame/index.html b/the-lego-movie-videogame/index.html
new file mode 100644
index 0000000..86e6203
--- /dev/null
+++ b/the-lego-movie-videogame/index.html
@@ -0,0 +1,133 @@
+
+
+
+ Savegame Editor – The Lego Movie Videogame
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Global settings
+
+
+
+
+
+
+
+
+
+
+
Account
+
+
Characters
+
+
Levels
+
+
+
+
Challenges
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Upgrades
+
+
+
+
+
diff --git a/the-lego-movie-videogame/savegame.dat b/the-lego-movie-videogame/savegame.dat
new file mode 100644
index 0000000000000000000000000000000000000000..b65758ba1e64a77554340df6d7fe5db2817defbb
GIT binary patch
literal 2524
zcmZp?#kcJar!a$$tGj=^tDn24pKE-uW0)%g3!~=VOihMI%-XDsqhR1efPo|@ps8k{
zDY){43&s31#t?2)2qTzb@CU+o$b!%fRS^0?p9Gkp;0fVh3V_hJzC-9mK@j}`JE8K$
z5L)L3gf3eSp~K=Jbk0Ty?K6QD%+Q$01g2l8Ld@B*3?hHw3WR>s2%&W{A@Vi*AoLd}
zi1>lW5dNyA5dIu?h$5WYta)SLteeW4RVuSjMFGlXV9_-DRC%#)~wh<7Z3
zh(|#E(WMXJXB>gh7WNSJXB;5*9Ds($8f}O?wMZ@o>OoGpSs)fB&}NWi{`dbsvV@OD
z=R_wqhW{WS&+za6Kaeb#haf&fndssSIbG>@)Sh2kO2~`C_0;
+ getField('checkbox-music').checked = tempFile.readU8(SavegameEditor.Constants.SETTINGS_MUSIC_MICROPHONE_OFFSET)>100;
+ this._load_profile();
+ },
+
+
+ /* save function */
+ save:function(){
+ }
+};
\ No newline at end of file
From c53191751e69fb663e7d804ee492863022d96a2d Mon Sep 17 00:00:00 2001
From: magiczocker10 <59317952+magiczocker10@users.noreply.github.com>
Date: Wed, 3 Jul 2024 11:03:13 +0200
Subject: [PATCH 2/9] Small fix.
---
the-lego-movie-videogame/the-lego-movie-videogame.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/the-lego-movie-videogame/the-lego-movie-videogame.js b/the-lego-movie-videogame/the-lego-movie-videogame.js
index 31b0902..7128169 100644
--- a/the-lego-movie-videogame/the-lego-movie-videogame.js
+++ b/the-lego-movie-videogame/the-lego-movie-videogame.js
@@ -268,14 +268,14 @@ SavegameEditor={
var tmp1 = get('character-list');
for (var j = 0; j < SavegameEditor.Constants.CHARACTERS.length; j++) {
tmp1.appendChild(col(2,label('checkbox-character-'+j, SavegameEditor.Constants.CHARACTERS[j].name)));
- get('checkbox-character-'+j).className+=' text-right';
tmp1.appendChild(col(1,checkbox('character-'+j,'')));
+ get('checkbox-character-'+j).className+=' text-right';
}
var tmp2 = get('upgrades-list');
for (var k = 0; k < SavegameEditor.Constants.UPGRADES.length; k++) {
tmp2.appendChild(col(4,label('checkbox-upgrades-'+k, SavegameEditor.Constants.UPGRADES[k].name)));
- get('checkbox-upgrades-'+k).className+=' text-right';
tmp2.appendChild(col(2,checkbox('upgrades-'+k,'')));
+ get('checkbox-upgrades-'+k).className+=' text-right';
}
},
@@ -294,4 +294,4 @@ SavegameEditor={
/* save function */
save:function(){
}
-};
\ No newline at end of file
+};
From be1b2a9101d84bde291d206e413f61f966464a1f Mon Sep 17 00:00:00 2001
From: magiczocker10 <59317952+magiczocker10@users.noreply.github.com>
Date: Mon, 15 Jul 2024 17:16:03 +0200
Subject: [PATCH 3/9] Added CRC32 calculation
---
.../the-lego-movie-videogame.js | 40 ++++++++++++++++++-
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/the-lego-movie-videogame/the-lego-movie-videogame.js b/the-lego-movie-videogame/the-lego-movie-videogame.js
index 7128169..ca774b9 100644
--- a/the-lego-movie-videogame/the-lego-movie-videogame.js
+++ b/the-lego-movie-videogame/the-lego-movie-videogame.js
@@ -189,6 +189,34 @@ SavegameEditor={
YELLOW_STONE_OFFSET_UNEVEN:0x238, // 568
YELLOW_STONE_OFFSET_EVEN:0x240 // 576
},
+ /* CRC32 - from Alex - https://stackoverflow.com/a/18639999 */
+ /* Combined with CRC32-Version by Slattz (https://github.com/Slattz/POTC3D_Rehash) */
+ CRC32_TABLE:(function(){
+ var c,crcTable=[];
+ for(var n=0;n<256;n++){
+ c=n;
+ for(var k=0;k<8;k++)
+ c=((c&1)?(0xedb88320^(c>>>1)):(c>>>1));
+ crcTable[n]=(c>>>0);
+ }
+ return crcTable;
+ }()),
+ crc32:function(file, len, offset){
+ var data=file.readBytes(offset, len-offset);
+ var checksum=0xFF;
+ var byte= 0b0;
+ for (var i = 0; i < data.length; i++) {
+ [byte]=new Int8Array([data[i]]);
+ var [cs_] = new Int8Array([checksum]);
+ byte^=cs_;
+ byte&=0xff;
+ var cs___ = (i===0 ? cs_ : checksum);
+ var a = SavegameEditor.CRC32_TABLE[byte];
+ checksum = a ^ (cs___>>>8);
+ }
+ console.log(checksum);
+ return ((checksum>>>0)<<0)
+ },
_getProfileOffset:function(){
return this.Constants.PROFILES[Number(getValue('profile-selector')) - 1].offset;
},
@@ -244,7 +272,7 @@ SavegameEditor={
/* check if savegame is valid */
checkValidSavegame:function(){
- return (tempFile.fileSize==2524);
+ return (tempFile.fileSize==2524)
},
preload:function() {
@@ -281,8 +309,11 @@ SavegameEditor={
/* load function */
load:function(){
- tempFile.fileName='SAVEGAME';
+ tempFile.fileName='savegame.dat';
tempFile.littleEndian=true;
+ console.log("Old CRC32 ", tempFile.readU32(0));
+ console.log("Calced CRC32 ", SavegameEditor.crc32(tempFile, tempFile.fileSize, 24));
+
setValue('language', tempFile.readU8(SavegameEditor.Constants.LANGUAGE_OFFSET));
setValue('savegame', 'Save game #' + (tempFile.readU8(SavegameEditor.Constants.PROFILE_SELECTION_OFFSET) + 1));
getField('checkbox-microphone').checked = tempFile.readU8(SavegameEditor.Constants.SETTINGS_MUSIC_MICROPHONE_OFFSET)>0;
@@ -293,5 +324,10 @@ SavegameEditor={
/* save function */
save:function(){
+ console.log("New CRC32 ", SavegameEditor.crc32(tempFile, tempFile.fileSize, 24));
+ tempFile.writeU32(
+ 0,
+ SavegameEditor.crc32(tempFile, tempFile.fileSize, 24)
+ )
}
};
From 3f2f4f8db247b2f59e2888875e70eed71c41f5e9 Mon Sep 17 00:00:00 2001
From: magiczocker10 <59317952+magiczocker10@users.noreply.github.com>
Date: Tue, 16 Jul 2024 07:01:59 +0200
Subject: [PATCH 4/9] Add functionality to character list
---
the-lego-movie-videogame/data.js | 115 ++++++++++++++++
the-lego-movie-videogame/index.html | 1 +
.../the-lego-movie-videogame.js | 129 +++++-------------
3 files changed, 148 insertions(+), 97 deletions(-)
create mode 100644 the-lego-movie-videogame/data.js
diff --git a/the-lego-movie-videogame/data.js b/the-lego-movie-videogame/data.js
new file mode 100644
index 0000000..9168a7d
--- /dev/null
+++ b/the-lego-movie-videogame/data.js
@@ -0,0 +1,115 @@
+window.SavegameEditor.Constants.CHARACTERS=[
+ 'Abraham Lincoln',
+ 'Bad Cop',
+ 'Bandit',
+ 'Batman',
+
+ 'Benny',
+ 'Blaze Firefighter',
+ 'Bruce Wayne',
+ 'Calamity Drone',
+
+ 'Cardio Carrie',
+ 'Cavalry',
+ 'Caveman',
+ 'Cleopatra',
+
+ 'Deputron',
+ 'Dr McScrubs',
+ 'El Macho Wrestler',
+ 'Emmet (Piece of Resistance)',
+
+ 'Emmet (Clown)',
+ 'Emmet (Construction)',
+ 'Emmet (Magician)',
+
+ 'Emmet (Master Builder)',
+ 'Emmet (PJs)',
+ 'Emmet (Robin Hood)',
+ 'Emmet (Robot)',
+
+ 'Emmet (Shower)',
+ 'Emmet (Surgeon)',
+ 'Emmet (Old West)',
+ 'Foreman Frank',
+
+ 'Gail',
+ 'Gallant Guard',
+ 'Gandalf',
+ 'Garbage Man Dan',
+
+ 'Good Cop',
+ 'Good Cop (Scribble Face)',
+ 'Gordon Zola',
+ 'Green Lantern',
+
+ 'Green Ninja',
+ 'Hank Haystack',
+ 'Ice Cream Jo',
+ 'Johnny Thunder',
+
+ 'Kabob Bob',
+ 'Lady Liberty',
+ 'Larry the Barrista',
+ 'Swamp Creature',
+
+ 'Lord Business',
+ 'Lord Vampyre',
+ 'Ma Cop',
+ 'Michelangelo',
+
+ 'Mrs Scratchen-Post',
+ 'Mummy',
+ 'Native Chief',
+ 'Natitve Warrior',
+
+ 'Outlaw',
+ 'Pa Cop',
+ 'Panda Guy',
+ 'Plumber Joe',
+
+ 'President Business',
+ 'Prospector',
+ 'Robo Construction',
+ 'Robo Cowboy',
+
+ 'Robo Demolition',
+ 'Robo Agent',
+ 'Robo Pilot',
+ 'Robo Receptionist',
+
+ 'Rootbeer Belle',
+ 'S.S.P Officer',
+ 'S.S.P Officer (Beanie)',
+ 'S.S.P Officer (Heavy)',
+
+ 'S.S.P Officer (SWAT)',
+ 'Sharon Shoehorn',
+ 'Sheriff Not-A-Robot',
+ 'Sir Stackabrick',
+
+ 'Sudds Backwash',
+ 'Superman',
+ 'Taco Tuesday Guy',
+ 'Test Dummy',
+
+ 'Unikitty',
+ 'Unikitty (Business)',
+ 'Unikitty (Queasy)',
+ 'Unikitty (Space)',
+
+ 'Velma Staplebot',
+ 'Vitruvius',
+ 'Vitruvius (Young)',
+ '"Where Are My Pants?" Guy',
+
+ 'Wiley Fusebot',
+ 'William Shakespeare',
+ 'Wonder Woman',
+ 'Wyldstyle',
+
+ 'Wyldstyle (Hooded)',
+ 'Wyldstyle (Robot)',
+ 'Wyldstyle (Space)',
+ 'Wyldstyle (Old West)'
+];
\ No newline at end of file
diff --git a/the-lego-movie-videogame/index.html b/the-lego-movie-videogame/index.html
index 86e6203..05597fb 100644
--- a/the-lego-movie-videogame/index.html
+++ b/the-lego-movie-videogame/index.html
@@ -10,6 +10,7 @@
+