Index: names.h ================================================================== --- names.h +++ names.h @@ -142,6 +142,92 @@ "FAROUT", "KEWEL", "WHACK", "STEAM", "HAWK", +}; +static const char*const heromesh_key_names[256]={ + [8]="BACK", + [9]="TAB", + [12]="CENTER", + [13]="ENTER", + [16]="SHIFT", + [17]="CTRL", + [19]="BREAK", + [20]="CAPSLOCK", + [32]="SPACE", + [33]="PGUP", + [34]="PGDN", + [35]="END", + [36]="HOME", + [37]="LEFT", + [38]="UP", + [39]="RIGHT", + [40]="DOWN", + [46]="DELETE", + [48]="0", + [49]="1", + [50]="2", + [51]="3", + [52]="4", + [53]="5", + [54]="6", + [55]="7", + [56]="8", + [57]="9", + [65]="A", + [66]="B", + [67]="C", + [68]="D", + [69]="E", + [70]="F", + [71]="G", + [72]="H", + [73]="I", + [74]="J", + [75]="K", + [76]="L", + [77]="M", + [78]="N", + [79]="O", + [80]="P", + [81]="Q", + [82]="R", + [83]="S", + [84]="T", + [85]="U", + [86]="V", + [87]="W", + [88]="X", + [89]="Y", + [90]="Z", + [96]="NUMPAD0", + [97]="NUMPAD1", + [98]="NUMPAD2", + [99]="NUMPAD3", + [100]="NUMPAD4", + [101]="NUMPAD5", + [102]="NUMPAD6", + [103]="NUMPAD7", + [104]="NUMPAD8", + [105]="NUMPAD9", + [106]="MULTIPLY", + [110]="DECIMAL", + [111]="DIVIDE", + [120]="F9", + [121]="F10", + [122]="F11", + [123]="F12", + [144]="NUMLOCK", + [145]="SCRLOCK", + [186]="SEMICOLON", + [187]="EQUALS", + [188]="COMMA", + [189]="MINUS", + [190]="PERIOD", + [191]="SLASH", + [192]="TILDE", + [219]="OBRACKET", + [220]="BACKSLASH", + [221]="CBRACKET", + [222]="QUOTE", }; Index: names.js ================================================================== --- names.js +++ names.js @@ -77,14 +77,73 @@ KEWEL WHACK STEAM HAWK `.replace(/[A-Za-z_0-9]+/g,x=>standard_sound_names.push(x)); +const heromesh_key_names=Object.create(null); +` + 8 BACK + 9 TAB + 12 CENTER + 13 ENTER + 16 SHIFT + 17 CTRL + 19 BREAK + 20 CAPSLOCK + 32 SPACE + 33 PGUP + 34 PGDN + 35 END + 36 HOME + 37 LEFT + 38 UP + 39 RIGHT + 40 DOWN + 46 DELETE + 96 NUMPAD0 + 97 NUMPAD1 + 98 NUMPAD2 + 99 NUMPAD3 + 100 NUMPAD4 + 101 NUMPAD5 + 102 NUMPAD6 + 103 NUMPAD7 + 104 NUMPAD8 + 105 NUMPAD9 + 106 MULTIPLY + 110 DECIMAL + 111 DIVIDE + 120 F9 + 121 F10 + 122 F11 + 123 F12 + 144 NUMLOCK + 145 SCRLOCK + 186 SEMICOLON + 187 EQUALS + 188 COMMA + 189 MINUS + 190 PERIOD + 191 SLASH + 192 TILDE + 219 OBRACKET + 220 BACKSLASH + 221 CBRACKET + 222 QUOTE +`.replace(/([0-9]+) +([A-Z][A-Z0-9_]*)/g,(x,y,z)=>{ + heromesh_key_names[y]=z; +}); +[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"].forEach(x=>{ + heromesh_key_names[x.charCodeAt()]=x; +}); console.log("// Auto-generated! Do not modify directly!"); standard_message_names.forEach(([a,b,c])=>console.log("#define MSG_"+c+" "+b)); console.log("static const char*const standard_message_names[]={"); standard_message_names.forEach(([a,b,c])=>console.log(" \""+c+"\",")); console.log("};"); standard_sound_names.forEach((x,y)=>console.log("#define SND_"+x+" "+y)); console.log("static const char*const standard_sound_names[]={"); standard_sound_names.forEach(x=>console.log(" \""+x+"\",")); console.log("};"); +console.log("static const char*const heromesh_key_names[256]={"); +Object.keys(heromesh_key_names).forEach(x=>console.log(" ["+x+"]=\""+heromesh_key_names[x]+"\",")); +console.log("};"); Index: notes ================================================================== --- notes +++ notes @@ -45,7 +45,8 @@ Disadvantages of hybrid: * SQLite must be included in this program. * Level/solution files must still be rewritten entirely when it changes. Hero Mesh will rewrite the puzzle set file only on exit, so it is possible -to do the similar thing in this case, by using the session database. +to do the similar thing in this case, by using the session database. A way +of incrementally storing and then "vacuuming" the file may also work.