Initial commit
This commit is contained in:
commit
019a620dbe
14
Makefile
Normal file
14
Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
CC=coffee
|
||||
|
||||
all: PPGEditor.js
|
||||
|
||||
# coffeescript files
|
||||
|
||||
PPGEditor.js: PPGEditor.coffee
|
||||
$(CC) -cm PPGEditor.coffee
|
||||
|
||||
# cleanup
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm PPGEditor.js
|
61
PPGEditor.coffee
Normal file
61
PPGEditor.coffee
Normal file
@ -0,0 +1,61 @@
|
||||
window.loadSavegame = ->
|
||||
data = $.trim($('#file').val())
|
||||
console.log 'Loaded %i characters.', data.length
|
||||
fields = data.split ';'
|
||||
console.log 'Found %i fields.', fields.length
|
||||
savedata = {}
|
||||
for own i, field of fields
|
||||
[name, value, type] = field.split ':'
|
||||
switch type
|
||||
when 'B' then value = (value is 'T')
|
||||
when 'I' then value = parseInt value
|
||||
when 'F' then value = parseFloat value
|
||||
when 'L' then value = parseInt value
|
||||
savedata[name] = {
|
||||
'value': value
|
||||
'type': type
|
||||
}
|
||||
console.log 'Savegame data: %o', savedata
|
||||
missing = 0
|
||||
for own field, value of savedata
|
||||
html = $('#'+field)
|
||||
if html.length is 0
|
||||
console.log 'Missing HTML field for: %s (%s:%o)', field, value.type, value.value
|
||||
missing++
|
||||
continue
|
||||
element = html.get(0).tagName
|
||||
# console.log 'HTML: %o %s', html, html.get(0).tagName
|
||||
switch element
|
||||
when 'INPUT'
|
||||
type = html.prop 'type'
|
||||
switch type
|
||||
when 'checkbox'
|
||||
html.attr 'checked', value.value
|
||||
html.attr 'data-type', value.type
|
||||
else
|
||||
html.val value.value
|
||||
html.attr 'data-type', value.type
|
||||
else
|
||||
html.val value.value
|
||||
html.attr 'data-type', value.type
|
||||
console.log '%i HTML fields were missing', missing
|
||||
|
||||
window.copySavegame = (src, trg) ->
|
||||
srcFields = $('*[id^=S'+src+']')
|
||||
console.log 'Source objects: %o', srcFields
|
||||
for i in [0..srcFields.length-1]
|
||||
srcEl = srcFields.eq(i)
|
||||
srcId = srcEl.attr('id')
|
||||
srcType = srcFields.eq(i).prop 'type'
|
||||
trgId = srcId.replace 'S'+src, 'S'+trg
|
||||
trgEl = $('#'+trgId)
|
||||
console.log 'Copy %o to %o', srcEl, trgEl
|
||||
switch srcType
|
||||
when 'checkbox'
|
||||
trgEl.attr 'checked', srcEl.attr 'checked'
|
||||
else
|
||||
trgEl.val srcEl.val()
|
||||
console.log 'All done.'
|
||||
|
||||
window.generateSavegame = ->
|
||||
console.log 'Creating savegame from fields.'
|
1191
PPGEditor.html
Normal file
1191
PPGEditor.html
Normal file
File diff suppressed because one or more lines are too long
24
README.md
Normal file
24
README.md
Normal file
@ -0,0 +1,24 @@
|
||||
The Powerpuff Girls: Defenders of Townsville
|
||||
============================================
|
||||
|
||||
Savegame Format
|
||||
---------------
|
||||
|
||||
The file is located in `/storage/emulated/0/Android/data/com.turner.ppg/files/PPGSaveData.txt`. It consists of one line of text in the format:
|
||||
|
||||
```
|
||||
VAR1:VALUE1:TYPE1;VAR2:VALUE2:TYPE2;VAR3:VALUE3:TYPE3;...;VARn:VALUEn:TYPEn
|
||||
```
|
||||
|
||||
There are the following types:
|
||||
|
||||
B - Boolean - Values: T = true, F = false
|
||||
F - Float
|
||||
I - Integer
|
||||
L - Longint
|
||||
|
||||
|
||||
Savegame Values
|
||||
---------------
|
||||
|
||||
Savegame values start with `S0`. `S1` or `S2` for the 3 savegame slots.
|
4
jquery-2.1.1.min.js
vendored
Normal file
4
jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
jquery-latest.min.js
vendored
Symbolic link
1
jquery-latest.min.js
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
jquery-2.1.1.min.js
|
Reference in New Issue
Block a user