noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
463 stars 25 forks source link

Move all usage of dword_587000_155144 #713

Open blmarket opened 2 months ago

blmarket commented 2 months ago

Hi, can you take a quick look and see it makes sense? Would like to check before working on adding unit test & etc.

Context

Working on audio effects, trying to make small incremental changes.

dword_587000_155144 is actually a pointer to a struct defined globally, storing 2 linked lists and a counter variable.

Next steps

There will be more changes defining Struct88 and Struct264 which are actually 88 and 264 byte sized struct dynamically allocated.

Required sign-off

blmarket commented 2 months ago

Few items to discuss:

  1. I put this one in opennox package instead of subpackage of legacy due to list implementation, but that decision made the code not to be isolated. Can we extract list definition (listHead, listItem etc.) to a separate package which allows this PR code to be in another package?
  2. Also it seems we have problem supporting list items in pure safe Go. Nox's list implementation looks like: there is a head which has only 3 pointers, and there are actual struct which begins with 3 pointers, but rest being used to store more information. This makes typing complicated - pointer can points to either head or full item, and can't avoid using unsafe to deal with them.
dennwc commented 2 months ago

Hey @blmarket ! I'll check it out soon, was on vacation.