@@ -1509,6 +1509,7 @@ function setupDebugControls() {
15091509 $ ( "#item_request_persist" ) . click ( ( ) => requestPersistPermission ( true , false ) ) ;
15101510 $ ( "#item_settings" ) . click ( openSettings ) ;
15111511 $ ( "#item_keyboard_shortcuts" ) . click ( openKeyboardShortcuts ) ;
1512+ $ ( "#item_asset_editor_help" ) . click ( openAssetEditorHelp ) ;
15121513 updateDebugWindows ( ) ;
15131514 // code analyzer?
15141515 if ( platform . newCodeAnalyzer ) {
@@ -1569,6 +1570,55 @@ function openKeyboardShortcuts() {
15691570 } ) ;
15701571}
15711572
1573+ function openAssetEditorHelp ( ) {
1574+ const row = ( field : string , dflt : string , desc : string ) =>
1575+ `<tr><td><code>${ field } </code></td><td>${ dflt } </td><td>${ desc } </td></tr>` ;
1576+ bootbox . dialog ( {
1577+ title : "Asset Editor Reference" ,
1578+ onEscape : true ,
1579+ message : `
1580+ <p>Add asset headers in source code as comments containing JSON format descriptors:</p>
1581+ <p>
1582+ C: <code>/*{w:8,h:8}*/</code> followed by data, terminated by <code>;</code><br>
1583+ ASM: <code>;;{w:8,h:8};;</code> followed by data, terminated by <code>;;</code>
1584+ </p>
1585+ <table class="help">
1586+ <tr><th colspan="3">Image Format</th></tr>
1587+ <tr><td><b>Field</b></td><td><b>Default</b></td><td><b>Description</b></td></tr>
1588+ ${ row ( 'w' , '<i>required</i>' , 'Width in pixels' ) }
1589+ ${ row ( 'h' , '<i>required</i>' , 'Height in pixels' ) }
1590+ ${ row ( 'count' , '1' , 'Number of images' ) }
1591+ ${ row ( 'bpp' , '1' , 'Bits per pixel' ) }
1592+ ${ row ( 'np' , '1' , 'Number of bitplanes (total colors = 2<sup>bpp×np</sup>)' ) }
1593+ ${ row ( 'bpw' , '8' , 'Bits per word (8, 16, 32)' ) }
1594+ ${ row ( 'sl' , 'ceil(w×bpp/bpw)' , 'Words per scanline (stride)' ) }
1595+ ${ row ( 'brev' , 'false' , 'Bit reverse: true = MSB is leftmost pixel' ) }
1596+ ${ row ( 'flip' , 'false' , 'Flip vertically (y=0 is bottom row)' ) }
1597+ ${ row ( 'skip' , '0' , 'Skip bytes at start of each image' ) }
1598+ ${ row ( 'pofs' , 'sl×h×count' , 'Offset between bitplanes' ) }
1599+ ${ row ( 'remap' , '—' , 'Bit remapping table for address lines' ) }
1600+ ${ row ( 'reindex' , '—' , 'Pixel-to-byte/bit remapping' ) }
1601+ ${ row ( 'wpimg' , 'sl×h' , 'Words per image' ) }
1602+ ${ row ( 'aspect' , '1' , 'Pixel aspect ratio for display' ) }
1603+ ${ row ( 'xform' , '—' , 'CSS transform on canvas' ) }
1604+ <tr><th colspan="3">Palette Format</th></tr>
1605+ <tr><td><b>Field</b></td><td><b>Default</b></td><td><b>Description</b></td></tr>
1606+ ${ row ( 'pal' , '—' , 'Palette: number (e.g. 332 = 3R,3G,2B) or name (nes, vcs, c64, ap2lores, astrocade)' ) }
1607+ ${ row ( 'n' , '—' , 'Number of palette entries' ) }
1608+ ${ row ( 'layout' , '—' , 'Palette editor layout (nes, astrocade)' ) }
1609+ <tr><th colspan="3">Examples</th></tr>
1610+ <tr><td colspan="2"><code>/*{w:8,h:8,bpp:1,brev:1}*/</code></td><td>8x8 1bpp, MSB first (NES-style)</td></tr>
1611+ <tr><td colspan="2"><code>;;{w:7,h:8};;</code></td><td>7x8 1bpp, LSB first (Apple II HGR)</td></tr>
1612+ <tr><td colspan="2"><code>/*{w:16,h:16,bpp:4,np:1}*/</code></td><td>16x16 4bpp</td></tr>
1613+ <tr><td colspan="2"><code>/*{pal:332,n:16}*/</code></td><td>16-entry RGB332 palette</pre></td></tr>
1614+ </table>` ,
1615+ buttons : {
1616+ ok : { label : "OK" , className : "btn-primary" }
1617+ } ,
1618+ size : "large"
1619+ } ) ;
1620+ }
1621+
15721622function setupReplaySlider ( ) {
15731623 var replayslider = $ ( "#replayslider" ) ;
15741624 var clockslider = $ ( "#clockslider" ) ;
0 commit comments