liblcf icon indicating copy to clipboard operation
liblcf copied to clipboard

Add EasyRPG custom LSD chunks to fix RPG_RT save game bugs

Open mateofio opened this issue 7 years ago • 5 comments

The following behaviors don't load correctly in rm2k3:

  • [ ] No chunk for flash screen period, needed for continuous flashing
  • [ ] No chunk for waited number of frames for timed keyinputrpoc
  • [ ] keyinputproc_variable is saved as a uint8_t and the value is truncated to 1 byte. #155 and https://github.com/EasyRPG/Player/issues/1674 We create a second chunk with Player will use and save both for compatibility.

They don't work because there not enough state in the LSD data to implement loading them. Fixing these requires creating some custom EasyRPG LSD chunks.

mateofio avatar Dec 09 '18 02:12 mateofio

Which state is missing? I want to check what's the internal representation of that state in RAM so that we can store it in the same way, meaning I can simply add the chunk to real RM as well. (The chunks mirror fields in RAM, usually without any conversion.)

By the way I see a mistake in the chunks in that respect: Chunk 20 (0x14), "flash_continuous", is listed as boolean, but actually it can have three values: 0 (once), 1 (continuous), 2 (continuous ceasing). It simply gets the value of the corresponding event command parameter in the "flash screen" command when it's executed. Looks like that at least... (although, I'm not sure if the 2 exists long enough to ever be saved... but I can't rule it out right now)

CherryDT avatar Feb 22 '19 20:02 CherryDT

Ah I see now... There is another field that is also initialized with the value of the shake duration, and it is not saved.

We can save it in chunk 26 (0x1A), I'll note it in case I ever come around to fix this in real RM2k3.

CherryDT avatar Feb 22 '19 20:02 CherryDT

There is another missing chunk with keyinput proc. It doesn't save the number of frames waiting for keyinputproc to complete.

Setup EV01 parallel

KeyInputProc: To Var1, Shift, Wait, Count time until key pressed into Var2
EraseEvent

Start a new game, wait a while, save, and then immediately press shift. Var2 will be some large value like 70.

Now load that saved game, and immediately press shift. Var2 will be 0. :exclamation:

Also, what are these chunks? They don't appear to be used from my tests?

  • 0x1D keyinput_value_right
  • 0x1E keyinput_value_up

@CherryDT more rm2k3 bugs. If we add chunks to fix this in player we should coordinate with you to match future patches to RPG_RT.

mateofio avatar Apr 06 '19 06:04 mateofio

Start a new game, wait a while, save, and then immediately press shift. Var2 will be some large value like 70. Now load that saved game, and immediately press shift. Var2 will be 0. ❗️

Sounds like https://github.com/EasyRPG/Player/issues/1674

Ghabry avatar Apr 06 '19 08:04 Ghabry

That's a different issue which works on rm2k and rm2k3e.

This one is because there is no keyinput_wait_frames chunk to store how long you waited for a keypress.

mateofio avatar Apr 06 '19 12:04 mateofio