Skip to content

Commit

Permalink
fixed sushi striker editor
Browse files Browse the repository at this point in the history
  • Loading branch information
marcrobledo committed Mar 5, 2020
1 parent f85532b commit e0d77c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sushi-striker/_cache_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ caches.keys().then(function(cacheNames){
});

var PRECACHE_ID='sushi-striker-editor';
var PRECACHE_VERSION='v1';
var PRECACHE_VERSION='v2';
var PRECACHE_URLS=[
'/savegame-editors/sushi-striker/','/savegame-editors/sushi-striker/index.html',
'/savegame-editors/sushi-striker/favicon.png',
Expand Down
25 changes: 15 additions & 10 deletions sushi-striker/sushi-striker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Sushi Striker for HTML5 Save Editor v20191003
by Marc Robledo 2019
Sushi Striker for HTML5 Save Editor v20200305
by Marc Robledo 2019-20
*/

SavegameEditor={
Expand Down Expand Up @@ -28,8 +28,10 @@ SavegameEditor={
tempFile.littleEndian=true;

for(var i=0; i<this.MAX_ITEMS; i++){
if(get('input-item'+i))
if(get('input-item'+i)){
setValue('item'+i, tempFile.readU32(this.ITEMS_OFFSET+i*8));
get('input-item'+i).originalValue=parseInt(getValue('item'+i));
}
}
},

Expand All @@ -38,15 +40,18 @@ SavegameEditor={
save:function(){
for(var i=0; i<this.MAX_ITEMS; i++){
if(get('input-item'+i)){
var amount=getValue('item'+i);
//console.log(amount);
if(!amount){
console.log(i);
}
var amount=parseInt(getValue('item'+i));
tempFile.writeU32(this.ITEMS_OFFSET+i*8, amount);
tempFile.writeU8(this.ITEMS_OFFSET+i*8+4, amount?1:0);

if(get('input-item'+i).originalValue!==amount){
if(get('input-item'+i).originalValue===0){
tempFile.writeU8(this.ITEMS_OFFSET+i*8+4, 1); //new=1
}else if(amount===0){
tempFile.writeU8(this.ITEMS_OFFSET+i*8+4, 0); //new=0
}
get('input-item'+i).originalValue=amount;
}
}
}
popa+3;
}
}

0 comments on commit e0d77c5

Please sign in to comment.