mirror of
https://github.com/marcrobledo/savegame-editors.git
synced 2025-04-24 16:35:10 +00:00
Add PICROSS e save editor
This commit is contained in:
parent
b479efe926
commit
a97cb853f6
82
picross-e/_cache_service_worker.js
Normal file
82
picross-e/_cache_service_worker.js
Normal file
@ -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<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='picross-e-editor';
|
||||
var PRECACHE_VERSION='v1';
|
||||
var PRECACHE_URLS=[
|
||||
'/savegame-editors/picross-e/','/savegame-editors/picross-e/index.html',
|
||||
'/savegame-editors/picross-e/favicon.png',
|
||||
'/savegame-editors/picross-e/picross-e.js',
|
||||
'/savegame-editors/savegame-editor.js',
|
||||
'/savegame-editors/savegame-editor.css'
|
||||
];
|
||||
|
||||
|
||||
|
||||
// install event (fired when sw is first installed): opens a new cache
|
||||
self.addEventListener('install', evt => {
|
||||
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);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
BIN
picross-e/all.dat
Normal file
BIN
picross-e/all.dat
Normal file
Binary file not shown.
113
picross-e/index.html
Normal file
113
picross-e/index.html
Normal file
@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Savegame Editor – PICROSS e</title>
|
||||
<meta http-equiv="content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="description" content="A savegame editor for PICROSS e."/>
|
||||
<meta name="keywords" content="html5, savegame, save, editor, hack, exploit, 3ds, PICROSS e, unlock, puzzles"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<link rel="shortcut icon" href="favicon.png"/>
|
||||
<link type="text/css" rel="stylesheet" href="../savegame-editor.css" media="all"/>
|
||||
<script type="text/javascript" src="../savegame-editor.js"></script>
|
||||
<script type="text/javascript" src="./picross-e.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
/* service worker */
|
||||
var FORCE_HTTPS=true;
|
||||
window.addEventListener('load',function(){
|
||||
if(location.protocol==='http:' && FORCE_HTTPS)
|
||||
location.replace(window.location.href.replace('http:','https:'));
|
||||
else if(location.protocol==='https:' && 'serviceWorker' in navigator)
|
||||
navigator.serviceWorker.register('/savegame-editors/picross-e/_cache_service_worker.js', {scope: '/savegame-editors/picross-e/'});
|
||||
}, false);
|
||||
--></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- HEADER -->
|
||||
<div id="header">
|
||||
<div id="header-top">
|
||||
<div class="row wrapper">
|
||||
<h1 class="six columns text-left"><img src="favicon.png" /> Savegame Editor <small>for Picross 3D: Round 2</small></h1>
|
||||
<div class="six columns header-buttons text-right">
|
||||
by <a href="/">Marc Robledo</a>
|
||||
<i class="icon github"></i> <a href="https://github.com/marcrobledo/savegame-editors/tree/master/picross-e" target="_blank">See on GitHub</a>
|
||||
<i class="icon heart"></i> <a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow">Donate</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hidden row wrapper" id="toolbar">
|
||||
<div class="twelve columns text-center">
|
||||
<button class="close" onclick="closeFile()"><i class="icon close"></i> Close file</button>
|
||||
<button class="colored" onclick="saveChanges()"><i class="icon accept"></i> Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- THE EDITOR -->
|
||||
<div id="the-editor" class="wrapper hidden">
|
||||
<!-- Easy -->
|
||||
<h3 class="orange">Easy Mode</h3>
|
||||
<div class="container">
|
||||
<div class="row" id="puzzles-easy">
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Normal -->
|
||||
<h3 class="orange">Normal Mode</h3>
|
||||
<div class="container">
|
||||
<div class="row" id="puzzles-normal">
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Free -->
|
||||
<h3 class="orange">Free Mode</h3>
|
||||
<div class="container">
|
||||
<div class="row" id="puzzles-free">
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Extra -->
|
||||
<h3 class="orange">EXTRA</h3>
|
||||
<div class="container">
|
||||
<div class="row" id="puzzles-extra">
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
<div class="columns c1">Puzzle</div>
|
||||
<div class="columns c3">Seconds</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Setting -->
|
||||
<h3 class="orange">Settings</h3>
|
||||
<div class="container">
|
||||
<div class="row" id="settings">
|
||||
<div class="columns c8">Control Method</div><div class="columns c4" id="container-settings-control-method"></div>
|
||||
<div class="columns c8"><label for="checkbox-settings-hint-number-auto-check">Hint Number Auto-Check</label></div>
|
||||
<div class="columns c4"><input id="checkbox-settings-hint-number-auto-check" type="checkbox" class="fw" /></div>
|
||||
<div class="columns c8"><label for="checkbox-settings-navigation">Navigation</label></div>
|
||||
<div class="columns c4"><input id="checkbox-settings-navigation" type="checkbox" class="fw" /></div>
|
||||
<div class="columns c8">BGM</div><div class="columns c4" id="container-settings-bgm"></div>
|
||||
<div class="columns c8">Effects</div><div class="columns c4" id="container-settings-effects"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
121
picross-e/picross-e.js
Normal file
121
picross-e/picross-e.js
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
PICROSS e for HTML5 Save Editor v20160704
|
||||
by Marc Robledo 2016
|
||||
*/
|
||||
|
||||
SavegameEditor={
|
||||
Name:'PICROSS e',
|
||||
Filename:'all.dat',
|
||||
Constants:{
|
||||
SETTINGS_CONTROL_METHOD_OFFSET: 0x258, // 0=Button, 1=Stylus
|
||||
SETTINGS_HINT_NUMBER_OFFSET: 0x259, // 0=OFF, 1=ON
|
||||
SETTINGS_NAVIGATION_OFFSET: 0x25A, //0=OFF, 1=ON
|
||||
SETTINGS_BGM_OFFSET: 0x25D, // 0=OFF, 1-5
|
||||
SETTINGS_EFFECTS_OFFSET: 0x25E, // 0=OFF, 1-5
|
||||
BGM_EFFECTS:[
|
||||
{value:0, name:'OFF'},
|
||||
{value:1, name:'1'},
|
||||
{value:2, name:'2'},
|
||||
{value:3, name:'3'},
|
||||
{value:4, name:'4'},
|
||||
{value:5, name:'5'},
|
||||
],
|
||||
CONTROL_METHOD:[
|
||||
{value:0, name:'Stylus Controls'},
|
||||
{value:1, name:'Button Controls'}
|
||||
]
|
||||
},
|
||||
|
||||
_write_settings_control_method:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.SETTINGS_CONTROL_METHOD_OFFSET,
|
||||
getValue('settings-control-method')
|
||||
);
|
||||
},
|
||||
_write_hint_number:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.SETTINGS_HINT_NUMBER_OFFSET,
|
||||
getValue('settings-hint-number-auto-check')
|
||||
);
|
||||
},
|
||||
_write_navigation:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.SETTINGS_NAVIGATION_OFFSET,
|
||||
getValue('settings-navigation')
|
||||
);
|
||||
},
|
||||
_write_settings_bgm:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.SETTINGS_BGM_OFFSET,
|
||||
getValue('settings-bgm')
|
||||
);
|
||||
},
|
||||
_write_settings_effects:function(){
|
||||
tempFile.writeU8(
|
||||
SavegameEditor.Constants.SETTINGS_EFFECTS_OFFSET,
|
||||
getValue('settings-effects')
|
||||
);
|
||||
},
|
||||
_write_puzzle_time:function(e){
|
||||
if (e.target.valueAsNumber > 86399000) {return;} // Filter invalid values
|
||||
tempFile.writeU32(
|
||||
Number(e.target.dataset.offset),
|
||||
Math.floor(e.target.valueAsNumber / 1000) * 60
|
||||
);
|
||||
},
|
||||
|
||||
/* check if savegame is valid */
|
||||
checkValidSavegame:function(){
|
||||
return (tempFile.fileSize==740)
|
||||
},
|
||||
|
||||
preload:function(){
|
||||
get('container-settings-control-method').appendChild(select('settings-control-method', SavegameEditor.Constants.CONTROL_METHOD, SavegameEditor._write_settings_control_method));
|
||||
get('checkbox-settings-hint-number-auto-check').addEventListener('change', SavegameEditor._write_hint_number);
|
||||
get('checkbox-settings-navigation').addEventListener('change', SavegameEditor._write_navigation);
|
||||
get('container-settings-bgm').appendChild(select('settings-bgm', SavegameEditor.Constants.BGM_EFFECTS, SavegameEditor._write_settings_bgm));
|
||||
get('container-settings-effects').appendChild(select('settings-effects', SavegameEditor.Constants.BGM_EFFECTS, SavegameEditor._write_settings_effects));
|
||||
},
|
||||
|
||||
/* load function */
|
||||
load:function(){
|
||||
tempFile.fileName='all.dat';
|
||||
tempFile.littleEndian=true;
|
||||
|
||||
for (var difficulty of [
|
||||
['E', 'easy', 0, 15],
|
||||
['N', 'normal', 15, 75],
|
||||
['F', 'free', 75, 135],
|
||||
['X', 'extra', 135, 150],
|
||||
]) {
|
||||
var ce = get('puzzles-' + difficulty[1]);
|
||||
for (var i = difficulty[2]; i < difficulty[3]; i++) {
|
||||
var date = new Date(0);
|
||||
date.setSeconds(Math.floor(tempFile.readU32(4*i)/60));
|
||||
var timeString = date.toISOString().substring(11, 19);
|
||||
var time_ele = document.createElement('input');
|
||||
time_ele.type='time';
|
||||
time_ele.min='00:00:00';
|
||||
time_ele.max='23:59:59';
|
||||
time_ele.step='1';
|
||||
time_ele.value=timeString;
|
||||
time_ele.dataset.offset=4*i;
|
||||
time_ele.addEventListener('change', SavegameEditor._write_puzzle_time);
|
||||
ce.append(
|
||||
col(1, span(difficulty[0] + ('0' + String(i-difficulty[2]+1)).slice(-2))),
|
||||
col(3, time_ele)
|
||||
);
|
||||
}
|
||||
}
|
||||
setValue('settings-control-method', tempFile.readU8(SavegameEditor.Constants.SETTINGS_CONTROL_METHOD_OFFSET));
|
||||
getField('checkbox-settings-hint-number-auto-check').checked = tempFile.readU8(SavegameEditor.Constants.SETTINGS_HINT_NUMBER_OFFSET)>0;
|
||||
getField('checkbox-settings-navigation').checked = tempFile.readU8(SavegameEditor.Constants.SETTINGS_NAVIGATION_OFFSET)>0;
|
||||
setValue('settings-bgm', tempFile.readU8(SavegameEditor.Constants.SETTINGS_BGM_OFFSET));
|
||||
setValue('settings-effects', tempFile.readU8(SavegameEditor.Constants.SETTINGS_EFFECTS_OFFSET));
|
||||
},
|
||||
|
||||
|
||||
/* save function */
|
||||
save:function(){
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user