Kamek icon indicating copy to clipboard operation
Kamek copied to clipboard

Fix Apply() logic in Command subclasses

Open RoadrunnerWMC opened this issue 3 years ago • 0 comments

This PR improves some logic in BranchCommand.Apply(), making it possible to use kmBranch() and kmCall() to create a call from one game address to another (i.e. kmCall(0xFROMADDR, 0xTOADDR)). I also preemptively added similar logic to a couple other Command subclasses that make the same invalid assumptions. Fixes #28.

This only works for literal target addresses. Call targets defined as extern, as suggested by @CLF78 in the linked issue, seem to be a significantly more difficult challenge, as CodeWarrior throws a warning and generates a static initializer in this case. I think solving that would require changing the kstdlib headers in some way, at minimum.

RoadrunnerWMC avatar Oct 06 '22 05:10 RoadrunnerWMC