@camoto/gamecode
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -24,5 +24,8 @@ /* | ||
const debug = Debug.extend(FORMAT_ID); | ||
import { RecordType } from '@camoto/record-io-buffer'; | ||
import CodeHandler_Simple from '../interface/CodeHandler_Simple.js'; | ||
const stringz = len => RecordType.string.fixed.reqTerm(len); | ||
export default class Code_Cosmo1 extends CodeHandler_Simple | ||
@@ -50,3 +53,3 @@ { | ||
return [ | ||
{ id: 'filename.archive.standard', type: 'stringz', len: 11, offset: 0x1A5D6, | ||
{ id: 'filename.archive.standard', type: stringz(11), offset: 0x1A5D6, | ||
desc: 'Archive filename for standard content shared between episodes. ' | ||
@@ -56,228 +59,228 @@ + 'Although the original games use a different filename for each ' | ||
+ 'a single file shared amongst all the episodes.' }, | ||
{ id: 'filename.archive.episode', type: 'stringz', len: 11, | ||
{ id: 'filename.archive.episode', type: stringz(11), | ||
desc: 'Archive filename for episode-specific content.' }, | ||
{ id: 'filename.splash.pretitle', type: 'stringz', len: 13 }, | ||
{ id: 'filename.splash.title', type: 'stringz', len: 11 }, | ||
{ id: 'filename.splash.credits', type: 'stringz', len: 11 }, | ||
{ id: 'filename.splash.bonus', type: 'stringz', len: 10 }, | ||
{ id: 'filename.splash.end', type: 'stringz', len: 9 }, | ||
{ id: 'filename.splash.loading', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.1', type: 'stringz', len: 12 }, | ||
{ id: 'filename.backdrop.2', type: 'stringz', len: 11 }, | ||
{ id: 'filename.backdrop.3', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.4', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.5', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.6', type: 'stringz', len: 11 }, | ||
{ id: 'filename.backdrop.7', type: 'stringz', len: 12 }, | ||
{ id: 'filename.backdrop.8', type: 'stringz', len: 11 }, | ||
{ id: 'filename.backdrop.9', type: 'stringz', len: 10 }, | ||
{ id: 'filename.backdrop.10', type: 'stringz', len: 12 }, | ||
{ id: 'filename.backdrop.11', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.12', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.13', type: 'stringz', len: 12 }, | ||
{ id: 'filename.backdrop.14', type: 'stringz', len: 12 }, | ||
{ id: 'filename.backdrop.15', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.16', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.17', type: 'stringz', len: 11 }, | ||
{ id: 'filename.backdrop.18', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.19', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.20', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.21', type: 'stringz', len: 11 }, | ||
{ id: 'filename.backdrop.22', type: 'stringz', len: 12 }, | ||
{ id: 'filename.backdrop.23', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.24', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.25', type: 'stringz', len: 13 }, | ||
{ id: 'filename.backdrop.26', type: 'stringz', len: 13 }, | ||
{ id: 'filename.level.1', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.2', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.bonus.1', type: 'stringz', len: 11 }, | ||
{ id: 'filename.level.bonus.2', type: 'stringz', len: 11 }, | ||
{ id: 'filename.level.3', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.4', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.5', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.6', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.7', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.8', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.9', type: 'stringz', len: 7 }, | ||
{ id: 'filename.level.10', type: 'stringz', len: 8 }, | ||
{ id: 'filename.level.11', type: 'stringz', len: 8 }, | ||
{ id: 'filename.level.12', type: 'stringz', len: 8 }, | ||
{ id: 'filename.level.13', type: 'stringz', len: 8 }, | ||
{ id: 'filename.level.14', type: 'stringz', len: 8 }, | ||
{ id: 'filename.level.15', type: 'stringz', len: 8 }, | ||
{ id: 'filename.level.16', type: 'stringz', len: 8 }, | ||
{ id: 'filename.music.1', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.2', type: 'stringz', len: 12 }, | ||
{ id: 'filename.music.3', type: 'stringz', len: 10 }, | ||
{ id: 'filename.music.4', type: 'stringz', len: 13 }, | ||
{ id: 'filename.music.5', type: 'stringz', len: 12 }, | ||
{ id: 'filename.music.6', type: 'stringz', len: 12 }, | ||
{ id: 'filename.music.7', type: 'stringz', len: 13 }, | ||
{ id: 'filename.music.8', type: 'stringz', len: 12 }, | ||
{ id: 'filename.music.9', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.10', type: 'stringz', len: 10 }, | ||
{ id: 'filename.music.11', type: 'stringz', len: 12 }, | ||
{ id: 'filename.music.12', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.13', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.14', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.15', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.16', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.17', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.18', type: 'stringz', len: 11 }, | ||
{ id: 'filename.music.19', type: 'stringz', len: 11 }, | ||
{ id: 'msg.result.1', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.2', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.3', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.4', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.5', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.6', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.7', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.8', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.9', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.10', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.11', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.12', type: 'stringz', len: 17 }, | ||
{ id: 'msg.result.13', type: 'stringz', len: 17 }, | ||
{ id: 'filename.tiles.actors', type: 'stringz', len: 11 }, | ||
{ id: 'filename.tiles.story', type: 'stringz', len: 12 }, | ||
{ id: 'unknown.1', type: 'stringz', len: 23 }, | ||
{ id: 'filename.config', type: 'stringz', len: 11 }, | ||
{ id: 'filename.savegame.temp', type: 'stringz', len: 11 }, | ||
{ id: 'filename.b800.farewell', type: 'stringz', len: 11 }, | ||
{ id: 'msg.error.no_ega', type: 'stringz', len: 24 }, | ||
{ id: 'filename.b800.nomemory', type: 'stringz', len: 13 }, | ||
{ id: 'filename.sounds.1', type: 'stringz', len: 11 }, | ||
{ id: 'filename.sounds.2', type: 'stringz', len: 12 }, | ||
{ id: 'filename.sounds.3', type: 'stringz', len: 12 }, | ||
{ id: 'filename.tileset.player', type: 'stringz', len: 12 }, | ||
{ id: 'filename.tileset.statusbar', type: 'stringz', len: 11 }, | ||
{ id: 'filename.tileset.level', type: 'stringz', len: 10 }, | ||
{ id: 'filename.tileinfo.actors', type: 'stringz', len: 13 }, | ||
{ id: 'filename.tileinfo.player', type: 'stringz', len: 13 }, | ||
{ id: 'filename.tileinfo.story', type: 'stringz', len: 13 }, | ||
{ id: 'filename.gfx.font', type: 'stringz', len: 10 }, | ||
{ id: 'filename.tileattr', type: 'stringz', len: 13 }, | ||
{ id: 'filename.savegame.template', type: 'stringz', len: 11 }, | ||
{ id: 'parameter.fopen.read', type: 'stringz', len: 3, desc: 'Mode parameter to fopen() function for reading files.' }, | ||
{ id: 'parameter.fopen.write', type: 'stringz', len: 3, desc: 'Mode parameter to fopen() function for writing files.' }, | ||
{ id: 'msg.savegame.restore.title', type: 'stringz', len: 16 }, | ||
{ id: 'msg.savegame.restore.esc', type: 'stringz', len: 19 }, | ||
{ id: 'msg.savegame.restore.prompt', type: 'stringz', len: 25 }, | ||
{ id: 'msg.savegame.restore.invalid', type: 'stringz', len: 21 }, | ||
{ id: 'msg.savegame.restore.any', type: 'stringz', len: 15 }, | ||
{ id: 'msg.savegame.save.title', type: 'stringz', len: 14 }, | ||
{ id: 'msg.savegame.save.reminder.line1', type: 'stringz', len: 23 }, | ||
{ id: 'msg.savegame.save.reminder.line2', type: 'stringz', len: 21 }, | ||
{ id: 'msg.savegame.saved', type: 'stringz', len: 12 }, | ||
{ id: 'msg.cheat.warp.title', type: 'stringz', len: 11 }, | ||
{ id: 'msg.cheat.warp.prompt', type: 'stringz', len: 20 }, | ||
{ id: 'msg.help.title', type: 'stringz', len: 10 }, | ||
{ id: 'msg.help.menuitem.1', type: 'stringz', len: 17 }, | ||
{ id: 'msg.help.menuitem.2', type: 'stringz', len: 17 }, | ||
{ id: 'msg.help.menuitem.3', type: 'stringz', len: 7 }, | ||
{ id: 'msg.help.menuitem.4', type: 'stringz', len: 16 }, | ||
{ id: 'msg.help.menuitem.5', type: 'stringz', len: 19 }, | ||
{ id: 'msg.help.menuitem.6', type: 'stringz', len: 12 }, | ||
{ id: 'filename.demo', type: 'stringz', len: 13 }, | ||
{ id: 'msg.bonus.title', type: 'stringz', len: 21 }, | ||
{ id: 'msg.bonus.multiplier', type: 'stringz', len: 9 }, | ||
{ id: 'msg.bonus.your', type: 'stringz', len: 15 }, | ||
{ id: 'msg.bonus.summary', type: 'stringz', len: 24 }, | ||
{ id: 'msg.bonus.summary', type: 'stringz', len: 19 }, | ||
{ id: 'unknown.2', type: 'stringz', len: 1 }, | ||
{ id: 'unknown.3', type: 'stringz', len: 1 }, | ||
{ id: 'filename.tileset.masked', type: 'stringz', len: 13 }, | ||
{ id: 'filename.splash.pretitle', type: stringz(13) }, | ||
{ id: 'filename.splash.title', type: stringz(11) }, | ||
{ id: 'filename.splash.credits', type: stringz(11) }, | ||
{ id: 'filename.splash.bonus', type: stringz(10) }, | ||
{ id: 'filename.splash.end', type: stringz(9) }, | ||
{ id: 'filename.splash.loading', type: stringz(13) }, | ||
{ id: 'filename.backdrop.1', type: stringz(12) }, | ||
{ id: 'filename.backdrop.2', type: stringz(11) }, | ||
{ id: 'filename.backdrop.3', type: stringz(13) }, | ||
{ id: 'filename.backdrop.4', type: stringz(13) }, | ||
{ id: 'filename.backdrop.5', type: stringz(13) }, | ||
{ id: 'filename.backdrop.6', type: stringz(11) }, | ||
{ id: 'filename.backdrop.7', type: stringz(12) }, | ||
{ id: 'filename.backdrop.8', type: stringz(11) }, | ||
{ id: 'filename.backdrop.9', type: stringz(10) }, | ||
{ id: 'filename.backdrop.10', type: stringz(12) }, | ||
{ id: 'filename.backdrop.11', type: stringz(13) }, | ||
{ id: 'filename.backdrop.12', type: stringz(13) }, | ||
{ id: 'filename.backdrop.13', type: stringz(12) }, | ||
{ id: 'filename.backdrop.14', type: stringz(12) }, | ||
{ id: 'filename.backdrop.15', type: stringz(13) }, | ||
{ id: 'filename.backdrop.16', type: stringz(13) }, | ||
{ id: 'filename.backdrop.17', type: stringz(11) }, | ||
{ id: 'filename.backdrop.18', type: stringz(13) }, | ||
{ id: 'filename.backdrop.19', type: stringz(13) }, | ||
{ id: 'filename.backdrop.20', type: stringz(13) }, | ||
{ id: 'filename.backdrop.21', type: stringz(11) }, | ||
{ id: 'filename.backdrop.22', type: stringz(12) }, | ||
{ id: 'filename.backdrop.23', type: stringz(13) }, | ||
{ id: 'filename.backdrop.24', type: stringz(13) }, | ||
{ id: 'filename.backdrop.25', type: stringz(13) }, | ||
{ id: 'filename.backdrop.26', type: stringz(13) }, | ||
{ id: 'filename.level.1', type: stringz(7) }, | ||
{ id: 'filename.level.2', type: stringz(7) }, | ||
{ id: 'filename.level.bonus.1', type: stringz(11) }, | ||
{ id: 'filename.level.bonus.2', type: stringz(11) }, | ||
{ id: 'filename.level.3', type: stringz(7) }, | ||
{ id: 'filename.level.4', type: stringz(7) }, | ||
{ id: 'filename.level.5', type: stringz(7) }, | ||
{ id: 'filename.level.6', type: stringz(7) }, | ||
{ id: 'filename.level.7', type: stringz(7) }, | ||
{ id: 'filename.level.8', type: stringz(7) }, | ||
{ id: 'filename.level.9', type: stringz(7) }, | ||
{ id: 'filename.level.10', type: stringz(8) }, | ||
{ id: 'filename.level.11', type: stringz(8) }, | ||
{ id: 'filename.level.12', type: stringz(8) }, | ||
{ id: 'filename.level.13', type: stringz(8) }, | ||
{ id: 'filename.level.14', type: stringz(8) }, | ||
{ id: 'filename.level.15', type: stringz(8) }, | ||
{ id: 'filename.level.16', type: stringz(8) }, | ||
{ id: 'filename.music.1', type: stringz(11) }, | ||
{ id: 'filename.music.2', type: stringz(12) }, | ||
{ id: 'filename.music.3', type: stringz(10) }, | ||
{ id: 'filename.music.4', type: stringz(13) }, | ||
{ id: 'filename.music.5', type: stringz(12) }, | ||
{ id: 'filename.music.6', type: stringz(12) }, | ||
{ id: 'filename.music.7', type: stringz(13) }, | ||
{ id: 'filename.music.8', type: stringz(12) }, | ||
{ id: 'filename.music.9', type: stringz(11) }, | ||
{ id: 'filename.music.10', type: stringz(10) }, | ||
{ id: 'filename.music.11', type: stringz(12) }, | ||
{ id: 'filename.music.12', type: stringz(11) }, | ||
{ id: 'filename.music.13', type: stringz(11) }, | ||
{ id: 'filename.music.14', type: stringz(11) }, | ||
{ id: 'filename.music.15', type: stringz(11) }, | ||
{ id: 'filename.music.16', type: stringz(11) }, | ||
{ id: 'filename.music.17', type: stringz(11) }, | ||
{ id: 'filename.music.18', type: stringz(11) }, | ||
{ id: 'filename.music.19', type: stringz(11) }, | ||
{ id: 'msg.result.1', type: stringz(17) }, | ||
{ id: 'msg.result.2', type: stringz(17) }, | ||
{ id: 'msg.result.3', type: stringz(17) }, | ||
{ id: 'msg.result.4', type: stringz(17) }, | ||
{ id: 'msg.result.5', type: stringz(17) }, | ||
{ id: 'msg.result.6', type: stringz(17) }, | ||
{ id: 'msg.result.7', type: stringz(17) }, | ||
{ id: 'msg.result.8', type: stringz(17) }, | ||
{ id: 'msg.result.9', type: stringz(17) }, | ||
{ id: 'msg.result.10', type: stringz(17) }, | ||
{ id: 'msg.result.11', type: stringz(17) }, | ||
{ id: 'msg.result.12', type: stringz(17) }, | ||
{ id: 'msg.result.13', type: stringz(17) }, | ||
{ id: 'filename.tiles.actors', type: stringz(11) }, | ||
{ id: 'filename.tiles.story', type: stringz(12) }, | ||
{ id: 'unknown.1', type: stringz(23) }, | ||
{ id: 'filename.config', type: stringz(11) }, | ||
{ id: 'filename.savegame.temp', type: stringz(11) }, | ||
{ id: 'filename.b800.farewell', type: stringz(11) }, | ||
{ id: 'msg.error.no_ega', type: stringz(24) }, | ||
{ id: 'filename.b800.nomemory', type: stringz(13) }, | ||
{ id: 'filename.sounds.1', type: stringz(11) }, | ||
{ id: 'filename.sounds.2', type: stringz(12) }, | ||
{ id: 'filename.sounds.3', type: stringz(12) }, | ||
{ id: 'filename.tileset.player', type: stringz(12) }, | ||
{ id: 'filename.tileset.statusbar', type: stringz(11) }, | ||
{ id: 'filename.tileset.level', type: stringz(10) }, | ||
{ id: 'filename.tileinfo.actors', type: stringz(13) }, | ||
{ id: 'filename.tileinfo.player', type: stringz(13) }, | ||
{ id: 'filename.tileinfo.story', type: stringz(13) }, | ||
{ id: 'filename.gfx.font', type: stringz(10) }, | ||
{ id: 'filename.tileattr', type: stringz(13) }, | ||
{ id: 'filename.savegame.template', type: stringz(11) }, | ||
{ id: 'parameter.fopen.read', type: stringz(3), desc: 'Mode parameter to fopen() function for reading files.' }, | ||
{ id: 'parameter.fopen.write', type: stringz(3), desc: 'Mode parameter to fopen() function for writing files.' }, | ||
{ id: 'msg.savegame.restore.title', type: stringz(16) }, | ||
{ id: 'msg.savegame.restore.esc', type: stringz(19) }, | ||
{ id: 'msg.savegame.restore.prompt', type: stringz(25) }, | ||
{ id: 'msg.savegame.restore.invalid', type: stringz(21) }, | ||
{ id: 'msg.savegame.restore.any', type: stringz(15) }, | ||
{ id: 'msg.savegame.save.title', type: stringz(13) }, | ||
{ id: 'msg.savegame.save.reminder.line1', type: stringz(24) }, | ||
{ id: 'msg.savegame.save.reminder.line2', type: stringz(21) }, | ||
{ id: 'msg.savegame.saved', type: stringz(12) }, | ||
{ id: 'msg.cheat.warp.title', type: stringz(11) }, | ||
{ id: 'msg.cheat.warp.prompt', type: stringz(20) }, | ||
{ id: 'msg.help.title', type: stringz(10) }, | ||
{ id: 'msg.help.menuitem.1', type: stringz(17) }, | ||
{ id: 'msg.help.menuitem.2', type: stringz(17) }, | ||
{ id: 'msg.help.menuitem.3', type: stringz(7) }, | ||
{ id: 'msg.help.menuitem.4', type: stringz(16) }, | ||
{ id: 'msg.help.menuitem.5', type: stringz(19) }, | ||
{ id: 'msg.help.menuitem.6', type: stringz(12) }, | ||
{ id: 'filename.demo', type: stringz(13) }, | ||
{ id: 'msg.bonus.title', type: stringz(21) }, | ||
{ id: 'msg.bonus.multiplier', type: stringz(9) }, | ||
{ id: 'msg.bonus.your', type: stringz(15) }, | ||
{ id: 'msg.bonus.summary1', type: stringz(24) }, | ||
{ id: 'msg.bonus.summary2', type: stringz(19) }, | ||
{ id: 'unknown.2', type: stringz(1) }, | ||
{ id: 'unknown.3', type: stringz(1) }, | ||
{ id: 'filename.tileset.masked', type: stringz(13) }, | ||
{ id: 'msg.key.none', type: 'stringz', len: 6, offset: 0x1ac84 }, | ||
{ id: 'msg.key.esc', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.1', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.2', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.3', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.4', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.5', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.6', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.7', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.8', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.9', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.0', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.minus', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.equal', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.bksp', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.tab', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.q', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.w', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.e', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.r', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.t', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.y', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.u', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.i', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.o', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.p', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.[', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.]', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.enter', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.ctrl', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.a', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.s', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.d', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.g', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.h', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.j', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.k', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.l', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.semi', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.quote', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.tilde', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.lshift', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.backslash', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.z', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.x', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.c', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.v', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.b', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.n', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.m', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.comma', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.period', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.question', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.rshift', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.star', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.alt', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.space', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.caps', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f1', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f2', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f3', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f4', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f5', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f6', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f7', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f8', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f9', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f10', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.num', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.scroll', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.home', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.up', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.pgup', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.minus', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.left', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.5', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.right', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.plus', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.end', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.down', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.pgdn', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.ins', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.del', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.pad.sysrq', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.fn', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.compose', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f11', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.f12', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.extra', type: 'stringz', len: 6 }, | ||
{ id: 'msg.key.none', type: stringz(6), offset: 0x1ac84 }, | ||
{ id: 'msg.key.esc', type: stringz(6) }, | ||
{ id: 'msg.key.1', type: stringz(6) }, | ||
{ id: 'msg.key.2', type: stringz(6) }, | ||
{ id: 'msg.key.3', type: stringz(6) }, | ||
{ id: 'msg.key.4', type: stringz(6) }, | ||
{ id: 'msg.key.5', type: stringz(6) }, | ||
{ id: 'msg.key.6', type: stringz(6) }, | ||
{ id: 'msg.key.7', type: stringz(6) }, | ||
{ id: 'msg.key.8', type: stringz(6) }, | ||
{ id: 'msg.key.9', type: stringz(6) }, | ||
{ id: 'msg.key.0', type: stringz(6) }, | ||
{ id: 'msg.key.minus', type: stringz(6) }, | ||
{ id: 'msg.key.equal', type: stringz(6) }, | ||
{ id: 'msg.key.bksp', type: stringz(6) }, | ||
{ id: 'msg.key.tab', type: stringz(6) }, | ||
{ id: 'msg.key.q', type: stringz(6) }, | ||
{ id: 'msg.key.w', type: stringz(6) }, | ||
{ id: 'msg.key.e', type: stringz(6) }, | ||
{ id: 'msg.key.r', type: stringz(6) }, | ||
{ id: 'msg.key.t', type: stringz(6) }, | ||
{ id: 'msg.key.y', type: stringz(6) }, | ||
{ id: 'msg.key.u', type: stringz(6) }, | ||
{ id: 'msg.key.i', type: stringz(6) }, | ||
{ id: 'msg.key.o', type: stringz(6) }, | ||
{ id: 'msg.key.p', type: stringz(6) }, | ||
{ id: 'msg.key.[', type: stringz(6) }, | ||
{ id: 'msg.key.]', type: stringz(6) }, | ||
{ id: 'msg.key.enter', type: stringz(6) }, | ||
{ id: 'msg.key.ctrl', type: stringz(6) }, | ||
{ id: 'msg.key.a', type: stringz(6) }, | ||
{ id: 'msg.key.s', type: stringz(6) }, | ||
{ id: 'msg.key.d', type: stringz(6) }, | ||
{ id: 'msg.key.f', type: stringz(6) }, | ||
{ id: 'msg.key.g', type: stringz(6) }, | ||
{ id: 'msg.key.h', type: stringz(6) }, | ||
{ id: 'msg.key.j', type: stringz(6) }, | ||
{ id: 'msg.key.k', type: stringz(6) }, | ||
{ id: 'msg.key.l', type: stringz(6) }, | ||
{ id: 'msg.key.semi', type: stringz(6) }, | ||
{ id: 'msg.key.quote', type: stringz(6) }, | ||
{ id: 'msg.key.tilde', type: stringz(6) }, | ||
{ id: 'msg.key.lshift', type: stringz(6) }, | ||
{ id: 'msg.key.backslash', type: stringz(6) }, | ||
{ id: 'msg.key.z', type: stringz(6) }, | ||
{ id: 'msg.key.x', type: stringz(6) }, | ||
{ id: 'msg.key.c', type: stringz(6) }, | ||
{ id: 'msg.key.v', type: stringz(6) }, | ||
{ id: 'msg.key.b', type: stringz(6) }, | ||
{ id: 'msg.key.n', type: stringz(6) }, | ||
{ id: 'msg.key.m', type: stringz(6) }, | ||
{ id: 'msg.key.comma', type: stringz(6) }, | ||
{ id: 'msg.key.period', type: stringz(6) }, | ||
{ id: 'msg.key.question', type: stringz(6) }, | ||
{ id: 'msg.key.rshift', type: stringz(6) }, | ||
{ id: 'msg.key.pad.star', type: stringz(6) }, | ||
{ id: 'msg.key.alt', type: stringz(6) }, | ||
{ id: 'msg.key.space', type: stringz(6) }, | ||
{ id: 'msg.key.caps', type: stringz(6) }, | ||
{ id: 'msg.key.f1', type: stringz(6) }, | ||
{ id: 'msg.key.f2', type: stringz(6) }, | ||
{ id: 'msg.key.f3', type: stringz(6) }, | ||
{ id: 'msg.key.f4', type: stringz(6) }, | ||
{ id: 'msg.key.f5', type: stringz(6) }, | ||
{ id: 'msg.key.f6', type: stringz(6) }, | ||
{ id: 'msg.key.f7', type: stringz(6) }, | ||
{ id: 'msg.key.f8', type: stringz(6) }, | ||
{ id: 'msg.key.f9', type: stringz(6) }, | ||
{ id: 'msg.key.f10', type: stringz(6) }, | ||
{ id: 'msg.key.num', type: stringz(6) }, | ||
{ id: 'msg.key.scroll', type: stringz(6) }, | ||
{ id: 'msg.key.pad.home', type: stringz(6) }, | ||
{ id: 'msg.key.pad.up', type: stringz(6) }, | ||
{ id: 'msg.key.pad.pgup', type: stringz(6) }, | ||
{ id: 'msg.key.pad.minus', type: stringz(6) }, | ||
{ id: 'msg.key.pad.left', type: stringz(6) }, | ||
{ id: 'msg.key.pad.5', type: stringz(6) }, | ||
{ id: 'msg.key.pad.right', type: stringz(6) }, | ||
{ id: 'msg.key.pad.plus', type: stringz(6) }, | ||
{ id: 'msg.key.pad.end', type: stringz(6) }, | ||
{ id: 'msg.key.pad.down', type: stringz(6) }, | ||
{ id: 'msg.key.pad.pgdn', type: stringz(6) }, | ||
{ id: 'msg.key.pad.ins', type: stringz(6) }, | ||
{ id: 'msg.key.pad.del', type: stringz(6) }, | ||
{ id: 'msg.key.pad.sysrq', type: stringz(6) }, | ||
{ id: 'msg.key.fn', type: stringz(6) }, | ||
{ id: 'msg.key.compose', type: stringz(6) }, | ||
{ id: 'msg.key.f11', type: stringz(6) }, | ||
{ id: 'msg.key.f12', type: stringz(6) }, | ||
{ id: 'msg.key.extra', type: stringz(6) }, | ||
]; | ||
} | ||
} |
@@ -21,1 +21,2 @@ /* | ||
export { default as exe_cosmo1 } from './exe-cosmo1.js'; | ||
export { default as exe_ddave } from './exe-ddave.js'; |
@@ -23,14 +23,5 @@ /* | ||
import { RecordBuffer, RecordType } from '@camoto/record-io-buffer'; | ||
import { RecordBuffer } from '@camoto/record-io-buffer'; | ||
import CodeHandler from './CodeHandler.js'; | ||
function attrType(a) { | ||
switch (a.type) { | ||
case 'stringz': | ||
return RecordType.string.fixed.reqTerm(a.len); | ||
} | ||
throw new Error(`Unknown attribute data type "${a.type}".`); | ||
} | ||
export default class CodeHandler_Simple extends CodeHandler | ||
@@ -71,5 +62,16 @@ { | ||
} | ||
const recordType = attrType(a); | ||
const value = buffer.read(recordType); | ||
let value; | ||
try { | ||
value = buffer.read(a.type); | ||
} catch (e) { | ||
console.error(e); | ||
throw new Error(`Error reading field ${a.id}: ${e.message}`); | ||
} | ||
if (a.valueOffset) value += a.valueOffset; | ||
if (attributes[a.id]) { | ||
throw Error(`BUG: File format declared multiple items with the ID "${a.id}".`); | ||
} | ||
attributes[a.id] = { | ||
@@ -80,2 +82,3 @@ ...a, | ||
//delete attributes[a.id].id; | ||
delete attributes[a.id].valueOffset; | ||
} | ||
@@ -89,7 +92,6 @@ | ||
static patch({main: content}, exe) { | ||
const ats = this.attributes(); | ||
let buffer = new RecordBuffer(content); | ||
for (const idAttr of Object.keys(exe.attributes)) { | ||
const a = exe.attributes[idAttr]; | ||
for (const a of ats) { | ||
if (a.offset !== undefined) { | ||
@@ -99,4 +101,12 @@ buffer.seekAbs(a.offset); | ||
const recordType = attrType(a); | ||
buffer.write(recordType, a.value); | ||
if (exe.attributes[a.id]) { | ||
let targetValue = exe.attributes[a.id].value; | ||
if (a.valueOffset) targetValue -= a.valueOffset; | ||
buffer.write(a.type, targetValue); | ||
} else { | ||
// Value omitted, skip over the field. | ||
debug(`Missing value for ${a.id}`); | ||
buffer.seekRel(a.type.len); | ||
} | ||
} | ||
@@ -103,0 +113,0 @@ |
{ | ||
"name": "@camoto/gamecode", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Modify executable files used by DOS games", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -21,2 +21,3 @@ # gamecode.js | ||
* Cosmo's Cosmic Adventure (episode 1) | ||
* Dangerous Dave | ||
@@ -23,0 +24,0 @@ Eventually, the patching functionality will work on any .exe file, specific game |
67060
12
1359
127