Skip to content

Commit

Permalink
added online only heroic mission unlocker to super kirby clash
Browse files Browse the repository at this point in the history
  • Loading branch information
marcrobledo committed Apr 26, 2020
1 parent e0d77c5 commit 7dadfc6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
17 changes: 1 addition & 16 deletions super-kirby-clash/_cache_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,8 @@
*/


/* MOD: fix old caches for mrc */
caches.keys().then(function(cacheNames){
for(var i=0; i<cacheNames.length; i++){
if(
cacheNames[i]==='runtime' ||
/^precache-\w+$/.test(cacheNames[i]) ||
/^precache-editor-([\w\+]+)-\w+$/.test(cacheNames[i]) ||
/^v?\d+\w?$/.test(cacheNames[i])
){
console.log('deleting old cache: '+cacheNames[i]);
caches.delete(cacheNames[i]);
}
}
});

var PRECACHE_ID='super-kirby-clash-editor';
var PRECACHE_VERSION='v1';
var PRECACHE_VERSION='v3';
var PRECACHE_URLS=[
'/savegame-editors/super-kirby-clash/','/savegame-editors/super-kirby-clash/index.html',
'/savegame-editors/super-kirby-clash/favicon.png',
Expand Down
13 changes: 13 additions & 0 deletions super-kirby-clash/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ <h3 class="green">Crystal shards</h3>
</div>
</div>

<!-- ONLINE MISSIONS -->
<h3 class="blue">Online only heroic missions</h3>
<div class="container">
<div class="row">
<div class="nine columns"><label for="button-mission-passwords">Use a Password</label></div>
<div class="three columns"><button id="button-mission-passwords" onclick="SavegameEditor.heroicMissionUnlock(SavegameEditor.Offsets.MISSION_PASSWORDS);this.disabled=true;">Unlock</button></div>
</div>
<div class="row">
<div class="nine columns"><label for="button-mission-eshop">Access Nintendo eShop from Other Games</label></div>
<div class="three columns"><button id="button-mission-eshop" onclick="SavegameEditor.heroicMissionUnlock(SavegameEditor.Offsets.MISSION_ESHOP);this.disabled=true;">Unlock</button></div>
</div>
</div>

</div>

</body>
Expand Down
29 changes: 26 additions & 3 deletions super-kirby-clash/super-kirby-clash.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
/*
Super Kirby Clash savegame editor v20190912
by Marc Robledo 2019
Super Kirby Clash savegame editor v20200425
by Marc Robledo 2019-2020
*/

SavegameEditor={
Name:'Super Kirby Clash',
Filename:'savedata.dat',

/* Constants */
Constants:{
HEROIC_MISSION_HIDDEN:0x00,
HEROIC_MISSION_VISIBLE:0x01,
HEROIC_MISSION_UNLOCKED_NEW:0x02,
HEROIC_MISSION_UNLOCKED:0x04,
},
Offsets:{
APPLE_GEMS:0x3ef0,
BOUGHT_APPLE_GEMS:0x3f00,
SHARDS_RED:0x3f20,
SHARDS_BLUE:0x3f24,
SHARDS_YELLOW:0x3f28,
SHARDS_RARE:0x3f2c
SHARDS_RARE:0x3f2c,

MISSION_PASSWORDS: 0x3a3c,
MISSION_ESHOP: 0x3a44,
MISSION_ALL_HEROIC_MISSIONS: 0x3aa4
//PROFILE_NAME:0x1bb4,
//PROFILE_PLAYED_TIME:0x1b74,
//PROFILE_COMPLETED_MISSIONS:0x1b90,
Expand All @@ -27,6 +37,16 @@ SavegameEditor={
return (tempFile.fileSize===54344)
},

/* heroic missions */
heroicMissionCheck:function(offset){
var b=tempFile.readU8(offset);

return (b!==this.Constants.HEROIC_MISSION_HIDDEN && b!==this.Constants.HEROIC_MISSION_VISIBLE)
},
heroicMissionUnlock:function(offset){
tempFile.writeU8(offset, this.Constants.HEROIC_MISSION_UNLOCKED_NEW);
},

/* preload function */
preload:function(){
setNumericRange('applegems', 0, 99999);
Expand Down Expand Up @@ -61,6 +81,9 @@ SavegameEditor={
setValue('shards-blue', tempFile.readU16(this.Offsets.SHARDS_BLUE));
setValue('shards-yellow', tempFile.readU16(this.Offsets.SHARDS_YELLOW));
setValue('shards-rare', tempFile.readU16(this.Offsets.SHARDS_RARE));

get('button-mission-passwords').disabled=this.heroicMissionCheck(this.Offsets.MISSION_PASSWORDS);
get('button-mission-eshop').disabled=this.heroicMissionCheck(this.Offsets.MISSION_ESHOP);
},

/* save function */
Expand Down

0 comments on commit 7dadfc6

Please sign in to comment.