ACS module storage pointers

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
TDRR
Posts: 816
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

ACS module storage pointers

Post by TDRR »

Crosspost of my own post on the GZDoom dev channel.
Yet another ACS question. I was thinking of adding pointers to module storage to ACS. Function pointers are already supported, but that's about it. You can't pass an array or variable by reference to a function or anything like that. While this can be more or less alleviated by the compiler for hub/global storage (with a hacky jump table, but doable nonetheless), that's just not possible for module storage, since it's specific to each module, and to access it from another module you need to import and know the name and size beforehand.

This of course greatly limits what libraries can do, requiring very clumsy and slow workarounds like passing a function pointer to read and another to write to an array, for example.
What I'd do is implement 5 instructions. One like pushfunction that would push into the stack a globally usable pointer to the specified module variable/array, and the 4 others just to read/write module variables/arrays taking the pointer from the stack (and ideally equivalent stack variants for writing/reading hub/global storage, but it's not a huge necessity).

This would obviously benefit Zandronum the most, but this is one of the things that should likely be implemented in GZDoom first if possible and then transplant the changes.

Should I write it or there's no real hope this would be merged into GZDoom?
As mentioned in the post, I'm going to make the PR myself, but I'd like to know first if it will be merged (if it's up to standards, of course) or if I shouldn't do it because it won't be merged.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49118
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ACS module storage pointers

Post by Graf Zahl »

That entirely depends on the quality of the implementation so I give no guarantees. I'm not against the feature itself.
User avatar
TDRR
Posts: 816
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

Re: ACS module storage pointers

Post by TDRR »

That's great news then. I'll make a PR at some point.

Return to “Feature Suggestions [GZDoom]”