0
0
mirror of https://github.com/marcrobledo/savegame-editors.git synced 2025-04-24 16:35:10 +00:00

fixed sushi striker editor

This commit is contained in:
Marc Robledo 2020-03-05 09:53:49 +01:00
parent f85532b716
commit e0d77c5b98
2 changed files with 16 additions and 11 deletions

View File

@ -30,7 +30,7 @@ caches.keys().then(function(cacheNames){
}); });
var PRECACHE_ID='sushi-striker-editor'; var PRECACHE_ID='sushi-striker-editor';
var PRECACHE_VERSION='v1'; var PRECACHE_VERSION='v2';
var PRECACHE_URLS=[ var PRECACHE_URLS=[
'/savegame-editors/sushi-striker/','/savegame-editors/sushi-striker/index.html', '/savegame-editors/sushi-striker/','/savegame-editors/sushi-striker/index.html',
'/savegame-editors/sushi-striker/favicon.png', '/savegame-editors/sushi-striker/favicon.png',

View File

@ -1,6 +1,6 @@
/* /*
Sushi Striker for HTML5 Save Editor v20191003 Sushi Striker for HTML5 Save Editor v20200305
by Marc Robledo 2019 by Marc Robledo 2019-20
*/ */
SavegameEditor={ SavegameEditor={
@ -28,8 +28,10 @@ SavegameEditor={
tempFile.littleEndian=true; tempFile.littleEndian=true;
for(var i=0; i<this.MAX_ITEMS; i++){ 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)); setValue('item'+i, tempFile.readU32(this.ITEMS_OFFSET+i*8));
get('input-item'+i).originalValue=parseInt(getValue('item'+i));
}
} }
}, },
@ -38,15 +40,18 @@ SavegameEditor={
save:function(){ save:function(){
for(var i=0; i<this.MAX_ITEMS; i++){ for(var i=0; i<this.MAX_ITEMS; i++){
if(get('input-item'+i)){ if(get('input-item'+i)){
var amount=getValue('item'+i); var amount=parseInt(getValue('item'+i));
//console.log(amount);
if(!amount){
console.log(i);
}
tempFile.writeU32(this.ITEMS_OFFSET+i*8, amount); 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;
} }
} }