-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
577 lines (511 loc) · 19.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
<!DOCTYPE html>
<html>
<head>
<title>RetroPad Editor</title>
<link rel='shortcut icon' type='image/svg' href='img/retroarch-icon.svg'>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1'>
<meta name='description' content='Edit onscreen gamepads for RetroArch'>
<link rel='stylesheet' href='css/reset.css'>
<link rel='stylesheet' href='css/elements.css'>
<link rel='stylesheet' href='css/style.css'>
<script defer src='js/defaults.js'></script>
<script defer src='js/config-handler.js'></script>
<script defer src='js/editor.js'></script>
<script defer src='js/file-input-helper.js'></script>
</head>
<body>
<div id='main-container'>
<div id='header'>
<button class='important' onclick='showFileDialog()'>Import • Export</button>
<button class='danger button--normal-size' onclick='showDialog("reset-dialog", true)'>Reset</button>
<span id='header__caption'><img src='img/retroarch-icon.svg'>RetroPad Editor</span>
</div>
<div id='workarea-container'>
<div id='toolbar'>
<div class='toolbar-group'>
<span class='group-header'>TOOLS</span>
<div class='join-buttons-div'>
<button onclick='showScreenSizeDialog()'>Set screen size</button>
<button title='Color theme' id='show-colors-button' onclick='showColorsDialog()'>C</button>
</div>
<br>
<div class='toolbar-group__checkboxes'>
<div class='checkbox-wrapper'>
<input type='checkbox' id='chk-show-shapes' autocomplete='off'>
<label for='chk-show-shapes'>Show shapes</label>
</div>
<div class='checkbox-wrapper'>
<input type='checkbox' id='chk-show-names' autocomplete='off' checked>
<label for='chk-show-names'>Show names</label>
</div>
<div class='checkbox-wrapper'>
<input type='checkbox' id='chk-show-portrait' autocomplete='off'>
<label for='chk-show-portrait'>Portrait</label>
</div>
<div class='checkbox-wrapper'>
<input type='checkbox' id='chk-show-offscreen' autocomplete='off'>
<label for='chk-show-offscreen'>Show offscreen</label>
</div>
</div>
</div>
<div class='toolbar-group'>
<span class='group-header'>OVERLAY</span>
<select id='overlay-selector' class='notranslate' translate='no'></select>
<div class='toolbar-group__buttons'>
<button onclick='showOverlayEditor()'>Create • Edit</button>
<button onclick='showDialog("overlay-delete-dialog", true)'>Delete overlay</button>
<button onclick='showAspectFixer()'>Fix aspect ratio</button>
</div>
</div>
<div class='toolbar-group'>
<span class='group-header'>BUTTON</span>
<div class='toolbar-group__buttons'>
<button onclick='showButtonCreator()'>New button</button>
<button id='del-current-button' onclick='showDialog("button-delete-dialog", true)'>Delete
button</button>
<button id='show-button-editor' onclick='showButtonEditor()'>Edit
button</button>
</div>
</div>
</div>
<div id='editor-container' class='notranslate' translate='no'>
<div id='gamepad-container'>
<div id='gamepad-container__scroll-frame'>
<div id='screenpad' class='hide-offscreen'>
<div id='game-screenshot'></div>
</div>
</div>
</div>
<div id='editor'>
<div>
<span>X</span>
<input type='range' max=1 step=0.00001 id='x-range'>
<input type='number' step=any id='x-number'>
<button onclick='flipXcoord()'>Flip</button>
</div>
<div>
<span>Y</span>
<input type='range' max=1 step=0.00001 id='y-range'>
<input type='number' step=any id='y-number'>
</div>
<div>
<span>W</span>
<input type='range' max=1 step=0.00001 id='w-range'>
<input type='number' step=any id='w-number'>
<button id='norm-width' onclick='normalizeWidth()'>Quad</button>
</div>
<div>
<span>H</span>
<input type='range' max=1 step=0.00001 id='h-range'>
<input type='number' step=any id='h-number'>
<button id='norm-height' onclick='normalizeHeight()'>Quad</button>
</div>
</div>
</div>
</div>
<div id='footer'>
<a href='https://github.com/valent-in/retropad-editor' target='_blank' rel='noopener'>GitHub</a>
<a href='https://forums.libretro.com/t/retropad-editor-create-and-edit-onscreen-gamepads' target='_blank'
rel='noopener'>Forum</a>
<a href='https://www.retroarch.com' target='_blank' rel='noopener'>RetroArch</a>
<span id='version'>v0.9.8</span>
</div>
<!-- Dialogs (hidden by default) -->
<div id='button-create-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Button properties</span>
<button class='close-button danger' onclick='hideButtonEditor()'></button>
</div>
<div class='modal-dialog__content-box'>
<table id='button-properties-table'>
<tr>
<td>
<label for='command-name'>Command</label>
</td>
<td>
<input type='text' id='command-name' class='js-dialog__focus'>
<select class='miniselect notranslate' translate='no' id='command-select'></select>
</td>
</tr>
<tr>
<td>
<label for='image-name'>Image</label>
</td>
<td>
<input type='text' id='image-name'>
<select class='miniselect notranslate' translate='no' id='image-select'></select>
</td>
</tr>
<tr>
<td>
<label for='button-shape'>Shape</label>
</td>
<td>
<select id='button-shape' class='notranslate' translate='no'>
<option>rect</option>
<option>radial</option>
</select>
</td>
</tr>
<tr>
<td>
<button class='empty expander button--normal-size' id='btn-additional-button'
onclick='toggleAdditionalButtonProperties()'>Additional</button>
</td>
<td></td>
</tr>
<tr class='js-additional-button-property hidden'>
<td>
<label for='next_target_property' class='notranslate' translate='no'>next_target</label>
</td>
<td>
<select id='next_target_property' class='notranslate' translate='no'></select>
</td>
</tr>
<tr class='js-additional-button-property hidden'>
<td>
<label for='range_mod_property' class='notranslate' translate='no'>range_mod</label>
</td>
<td>
<input type='number' step=0.01 id='range_mod_property'>
</td>
</tr>
<tr class='js-additional-button-property hidden'>
<td>
<label for='alpha_mod_property' class='notranslate' translate='no'>alpha_mod</label>
</td>
<td>
<input type='number' step=0.01 id='alpha_mod_property'>
</td>
</tr>
<tr class='js-additional-button-property hidden'>
<td>
<label for='saturate_pct_property' class='notranslate'
translate='no'>saturate_pct</label>
</td>
<td>
<input type='number' step=0.01 id='saturate_pct_property'>
</td>
</tr>
<tr class='js-additional-button-property hidden'>
<td>
<label for='movable_property' class='notranslate' translate='no'>movable</label>
</td>
<td>
<select id='movable_property' class='notranslate' translate='no'>
<option></option>
<option>false</option>
<option>true</option>
</select>
</td>
</tr>
<tr class='js-additional-button-property hidden'>
<td class='vertical-align-top'>
<label for='raw-button-properties'>Raw data:</label>
<br>
<span class='small-warning'>Edit carefully!</span>
</td>
<td>
<textarea spellcheck='false' id='raw-button-properties'></textarea>
</td>
</tr>
</table>
</div>
<div class='modal-dialog__footer-box'>
<button class='important' id='button-create-button' onclick='addButton()'>Create
button</button>
<button class='important' id='button-edit-button' onclick='editButton()'>Edit
button</button>
<button onclick='hideButtonEditor()'>Cancel</button>
</div>
</div>
</div>
<div id='overlay-create-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Create/Edit overlay</span>
<button class='close-button danger' onclick='hideOverlayEditor()'></button>
</div>
<div class='modal-dialog__content-box'>
<div class='dialog-content-box__section'>
<label>Overlay name</label>
<input type='text' id='overlay-name' class='js-dialog__focus' autocomplete='off'>
<br class='wide'>
<input type='checkbox' autocomplete='off' id='chk-edit-overlay'
onchange='updateNewOverlayFields()'>
<label for='chk-edit-overlay' class='group-header'>Edit current overlay</label>
<br class='wide'>
<input type='checkbox' autocomplete='off' id='chk-duplicate-overlay'
onchange='updateNewOverlayFields()'>
<label for='chk-duplicate-overlay'>Duplicate current overlay</label>
<br class='wide'>
<input type='checkbox' autocomplete='off' id='chk-portrait-overlay'
onchange='updateNewOverlayFields()'>
<label for='chk-portrait-overlay'>Portrait</label>
</div>
<div class='dialog-content-box__section'>
<button class='empty expander button--normal-size' onclick='toggleAdditionalOverlayProperties()'
id='overlay-additional-button'>Additional</button>
<div id='overlay-properties-container' class='dialog-content-box__expandable hidden'>
<span class='small-warning'>WARNING! Edit carefully!</span>
<br>
<textarea spellcheck='false' id='raw-overlay-properties'></textarea>
</div>
</div>
</div>
<div class='modal-dialog__footer-box'>
<button id='overlay-create-button' class='important' onclick='addOverlay()'>Create overlay</button>
<button id='overlay-edit-button' class='danger hidden' onclick='editOverlay()'>Edit overlay</button>
<button onclick='hideOverlayEditor()'>Cancel</button>
</div>
</div>
</div>
<div id='aspect-fixer-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Fix aspect ratio</span>
<span id='aspect-hint' class='hidden'>portrait</span>
<button class='close-button danger' onclick='hideAspectFixer()'></button>
</div>
<div class='modal-dialog__content-box'>
<div class='dialog-content-box__section'>
<span class='group-header'>Initial aspect ratio</span>
<br class='wide'>
<input type='number' step=0.00001 id='initial-aspect-width' value=16>
<span>:</span>
<input type='number' step=0.00001 id='initial-aspect-height' value=9>
</div>
<div class='dialog-content-box__section'>
<span class='group-header'>Target screen dimensions</span>
<br class='wide'>
<input type='number' id='target-display-width'>
<span>:</span>
<input type='number' id='target-display-height'>
</div>
<div class='dialog-content-box__section'>
<input type='checkbox' id='chk-keep-relative' autocomplete='off'>
<label for='chk-keep-relative'>Keep relative positions</label>
<button class='empty button--normal-size'
onclick='showDialog("aspect-hint-dialog", true)'>?</button>
</div>
</div>
<div class='modal-dialog__footer-box'>
<button class='important js-dialog__focus' onclick='fixAspect()'>Fix</button>
<button onclick='hideAspectFixer()'>Cancel</button>
</div>
</div>
</div>
<div id='screen-size-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Set screen size</span>
<button class='close-button danger' onclick='hideScreenSizeDialog()'></button>
</div>
<div class='modal-dialog__content-box'>
<div class='dialog-content-box__section'>
<span class='group-header'>Screen dimensions</span>
<br class='wide'>
<input type='number' id='display-width' step=0.00001 class='js-dialog__focus'>
<span>x</span>
<input type='number' id='display-height' step=0.00001>
<br class='wide'>
<input type='checkbox' id='chk-rescale-to-fit' autocomplete='off'>
<label for='chk-rescale-to-fit'>Rescale to fit editor window</label>
</div>
<div class='dialog-content-box__section'>
<button class='empty expander button--normal-size' id='screenshot-settings-expander'
onclick='toggleScreenshotSettings()'>Screenshot area</button>
<div id='screenshot-area-settings' class='dialog-content-box__expandable hidden'>
<input type='number' id='screenshot-width' step=0.00001>
<span>x</span>
<input type='number' id='screenshot-height' step=0.00001>
<br class='wide'>
<input type='radio' onchange='onScreenshotModeChange()' id='radio-screenshot-fit'
name='screenshot-mode'>
<label for='radio-screenshot-fit'>Fit screen</label>
<br class='narrow'>
<input type='radio' onchange='onScreenshotModeChange()' id='radio-screenshot-set'
name='screenshot-mode'>
<label for='radio-screenshot-set'>Set size</label>
<br class='narrow'>
<input type='radio' onchange='onScreenshotModeChange()' id='radio-screenshot-match'
name='screenshot-mode'>
<label for='radio-screenshot-match'>Screenshot image size</label>
</div>
</div>
</div>
<div class='modal-dialog__footer-box'>
<button class='important' onclick='applyScreenDimensions()'>Set size</button>
<button onclick='hideScreenSizeDialog()'>Cancel</button>
</div>
</div>
</div>
<div id='import-export-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Files</span>
<button class='close-button danger' onclick='hideFileDialog()'></button>
</div>
<div class='modal-dialog__content-box'>
<table>
<tr>
<td>
<span>Import config</span>
</td>
<td>
<span class='input_file'>
<input type='file' accept='.cfg' id='load-config' class='js-dialog__focus'>
<label id='load-config-filename' for='load-config'></label>
</span>
</td>
</tr>
<tr>
<td>
<span>Import images</span>
</td>
<td>
<span class='input_file'>
<input type='file' accept='.png,.jpg' multiple id='load-button-images'>
<label id='load-button-images-filename' for='load-button-images'></label>
</span>
</td>
</tr>
<tr>
<td>
<input type='checkbox' id='chk-show-screenshot'>
<label for='chk-show-screenshot'>Game screenshot</label>
</td>
<td>
<span class='input_file'>
<input type='file' accept='.png,.jpg' id='load-screenshot'>
<label id='load-screenshot-filename' for='load-screenshot'></label>
</span>
</td>
</tr>
<tr>
<td colspan='2'>
<span id='download-help'>Config file and image files must be stored in same
folder.</span>
</td>
</tr>
<tr>
<td>
<button class='empty' id='export-button' onclick='createDownloadLink()'><a
id='export-link' download='new-retropad.cfg' href=''>Export config</a></button>
</td>
<td>
<a onclick='showArchiveHint()'
href='https://github.com/Valent-in/retropad-editor/releases/download/v0.6/overlay-images.zip'>Image
pack</a>
</td>
</tr>
</table>
<div id='archive-hint' class='small-warning'>Do not forget to unpack the archive</div>
</div>
<div class='modal-dialog__footer-box'>
<button onclick='hideFileDialog()'>Close</button>
</div>
</div>
</div>
<div id='reset-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__content-box'>
<span>Do you want to reset?<br>All unsaved editions will be lost!</span>
</div>
<div class='modal-dialog__footer-box'>
<button class='danger js-dialog__focus' onclick='resetPad()'>Reset</button>
<button onclick='showDialog("reset-dialog", false)'>Cancel</button>
</div>
</div>
</div>
<div id='overlay-delete-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__content-box'>
<span>Delete current overlay?</span>
</div>
<div class='modal-dialog__footer-box'>
<button class='danger js-dialog__focus' onclick='delCurrentOverlay()'>Delete</button>
<button onclick='showDialog("overlay-delete-dialog", false)'>Cancel</button>
</div>
</div>
</div>
<div id='button-delete-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__content-box'>
<span>Delete selected button?</span>
</div>
<div class='modal-dialog__footer-box'>
<button class='danger js-dialog__focus' onclick='delCurrentButton()'>Delete</button>
<button onclick='showDialog("button-delete-dialog", false)'>Cancel</button>
</div>
</div>
</div>
<div id='name-exist-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__content-box'>
<span>Overlay with this name already exist.</span>
</div>
<div class='modal-dialog__footer-box'>
<button class='js-dialog__focus' onclick='showDialog("name-exist-dialog", false)'>Close</button>
</div>
</div>
</div>
<div id='name-empty-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__content-box'>
<span>Enter overlay name.</span>
</div>
<div class='modal-dialog__footer-box'>
<button class='js-dialog__focus' onclick='showDialog("name-empty-dialog", false)'>Close</button>
</div>
</div>
</div>
<div id='aspect-hint-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Aspect ratio hint</span>
<button class='close-button danger' onclick='showDialog("aspect-hint-dialog", false)'></button>
</div>
<div class='modal-dialog__content-box'>
<div class='aspect-hint-text-container'>
<span>Default aspect ratio fix</span>
</div>
<img id='aspect-hint-image' src='aspect-ratio-hint.svg'>
<div class='aspect-hint-text-container'>
<span>Keep relative positions</span>
</div>
</div>
<div class='modal-dialog__footer-box'>
<button class='js-dialog__focus' onclick='showDialog("aspect-hint-dialog", false)'>Close</button>
</div>
</div>
</div>
<div id='colors-dialog' class='dialog-container hidden'>
<div class='modal-dialog'>
<div class='modal-dialog__header-box'>
<span>Color theme</span>
<button class='close-button danger' onclick='showDialog("colors-dialog", false)'></button>
</div>
<div class='modal-dialog__content-box'>
<input type=radio name='color-scheme-radio' id='color-scheme-0' autocomplete='off' checked
onchange='setColorScheme(0)'>
<label for='color-scheme-0' id='color-scheme-0-label'>Color theme 0</label>
<br class='wide'>
<input type=radio name='color-scheme-radio' id='color-scheme-1' autocomplete='off'
onchange='setColorScheme(1)'>
<label for='color-scheme-1' id='color-scheme-1-label'>Color theme 1</label>
<br class='wide'>
<input type=radio name='color-scheme-radio' id='color-scheme-2' autocomplete='off'
onchange='setColorScheme(2)'>
<label for='color-scheme-2' id='color-scheme-2-label'>Color theme 2</label>
</div>
<div class='modal-dialog__footer-box'>
<button class='js-dialog__focus' onclick='showDialog("colors-dialog", false)'>Close</button>
</div>
</div>
</div>
</div>
</body>
</html>