Hi!
Very nice project you have here. I've started working on a Java version of this.
I see your frameHandlers in replay_frames.mjs are out of date. Some are commented out, some seem to be wrong, and your code says it's only been tested with 0.18.22.
Maybe I can help.
I've also been reverse-engineering to figure out the proper "action codes" for various events.
Here are the values that I've found for factorio 0.18.45:
(first number is the code, second is the number of bytes in the frame, third is whether the event is triggered by player action or by the system:
UNKNOWN(-1, 0, false),
// system-generated events:
JoinSinglePlayer(0x19, 0, false),
JoinMultiPlayer(0x1a, 0, false),
CheckSum(0x46, 8, false),
U2(0xBE, 2, false),//unknown
U3(0x5E, 1, false),//unknown
// player-generated events:
PipetteTool(0x4C, 6, true),
MouseOver(0xBF, 4), // user hovers cursor over something
ClearCursor(0x0A, 0),// user stops hovering cursor over something
MouseOver2(0xBD, 1),// right mouse click on something that's out of reach
Run(0x3A, 1),
StopRunning(0x01, 0),
StartMining(0x02, 0),
StopMining(0x03, 0),
CloseWindow(0x06, 0),
OpenPlayerInventoryWindow(0x07, 0),
ClickInventoryWindowItem(0x42, 5),
DropItem(0x39, 13),
DropItem2(0x34, 0), // this seems to happen after DropItem to place inventory item.
AddFuel(0x44, 5), //this action also happens when adding to a chest
OpenTechnologiesWindow(0x0D, 0),
OpenMapWindow(0xE4, 1), // closing it also seems to trigger this.
ChooseTech(0x54, 2),
CancelTechResearch(0x98, 0),
TakeItemsFromChest(0xC8, 1), // control-left-click
TakeHalfItemsFromChest(0xCA, 1), // control-right-click
OpenBuilding(0x05, 0),
// TODO: QuitGame(0x18, 0),
StartGame(0x81, 29), // is this right?
Craft(0x47, 6),
DropOntoHotBar(0xB0, 7),
ClearDraggedObject(0x0B, 0), // Q key to stop holding something
// bottom buttons:
ToggleAltMode(0x17, 0),
CopyButton(0x2D, 0),
CutButton(0x2E, 0),
PasteButton(0x2F, 0),
DragArea(0x71, 27), // user has finished dragging out a rectangle to copy/cut
UndoButton(0x30, 0),
ImportStringButton(0xA3, 3), // plus a variable-length section
BlueprintButton(0x7F, 2), // the "blueprint book" and "deconstruction planner" and "upgrade planner" buttons also seems to trigger this.
BlueprintDragArea(0x73, 27),// user has finished dragging out a rectangle for a blueprint
DeconstructionDragArea(0x6F, 27),// user has finished dragging out a rectangle for a blueprint
UpgradePlanningDragArea(0x70, 28),// user has finished dragging out a rectangle after clicking "upgrade planner"
U4(0x11, 0), // seems to happen after BlueprintDragArea
CreateBlueprint(0x75, 0), // see custom code in ReplayParser
// TODO: toggle personal roboport, toggle exoskeleton
Rotate(0xC9, 1), // including reverse rotate
NextWeapon(0x29, 0), // tab key to rotate through equipped weapons.
OpenArmor(0x43, 5), // right-click on the armor icon in bottom right
// buttons in top-right of window:
BlueprintLibraryButton(0x36, 2),
ProductionStatisticsButton(0x0F, 0),
BonusesButton(0x1C, 0),
TutorialsButton(0x1F, 0),
TrainsButton(0x1D, 0),
AchievementsButton(0x1E, 0),
PickupItemsOnGround(0xBC, 1),
DropItemsOnGround(0x38, 8),
Shoot(0x49, 9), // both shoot-selected and shoot-enemy
// TODO: enter/leave vehicle
// TODO: copy/paste entity settings (e.g. right-click a factory then left click another factory)
;
Hi! Very nice project you have here. I've started working on a Java version of this. I see your frameHandlers in replay_frames.mjs are out of date. Some are commented out, some seem to be wrong, and your code says it's only been tested with 0.18.22.
Maybe I can help. I've also been reverse-engineering to figure out the proper "action codes" for various events. Here are the values that I've found for factorio 0.18.45: (first number is the code, second is the number of bytes in the frame, third is whether the event is triggered by player action or by the system: