euddraft icon indicating copy to clipboard operation
euddraft copied to clipboard

QueueGameCommand optimization

Open armoha opened this issue 3 years ago • 1 comments

  • [ ] Optimize for multiple calls in single trigger cycle.

    • Currently every QueueGameCommand call reads command queue length and max buffer size.

      https://github.com/armoha/eudplib/blob/ba9c840a143fe8d764caebcca3b4adfb77a5188c/eudplib/eudlib/qgcf/qgc.py#L49-53

      Potential improvement:

      MAX_BUFFER = 0x57F0D8
      CMDQ_LEN = 0x654AA0
      cmdqlen = c.Forward()
      if cs.EUDIfNot()(c.Memory(CMDQ_LEN, c.Exactly, cmdqlen)):
          cmdqlen << f_dwread_epd(ut.EPD(CMDQ_LEN))
      cs.EUDEndIf()
      if cs.EUDIf()(c.Memory(MAX_BUFFER, c.AtLeast, cmdqlen + size)):
          f_memcpy(0x654880 + cmdqlen, data, size)
          cmdqlen += size
          c.SetVariables(ut.EPD(0x654AA0), cmdqlen)
      cs.EUDEndIf()
      

armoha avatar Jun 21 '21 03:06 armoha

Almost fixed by https://github.com/armoha/eudplib/commit/1398bf86f5c37ce2375eb8db85422c560acaacfe and https://github.com/armoha/eudplib/commit/2051c778ec48156388a8fb0cf3b3cd426c5afcb7. One thing left to solve is preserving offset state 0x654880 + qgc.cmdqlen of EUDByteWriter for consecutive QGC calls.

armoha avatar Dec 08 '23 02:12 armoha