Usually I'd use;
But RGSS3 doesn't have that.
I think the general idea is if you rely on finalizers in your RGSS then you are doing something wrong, but this sort of breaks down when you're using Win32 libraries.
Why I want a finalizer;
I've tried moving as much as I can to my DLL's DLL_PROCESS_DETACH call, but I'm doing some pretty crazy stuff that requires the RPG Maker Game.exe context to be alive for me to be able to clean up the memory I want to deal with and apparently the RGSS runtime will call the Win32API's FreeLibrary() AFTER it kills its own context (Wtf?).
So is there an RGSS class or point that I can attach to for my clean-up code to be called when the game is shutdown? Or is there a callback that I can attach?
EDIT:
I may have solved this myself:
Is this bad practise?
If it's a good idea and doesn't cause any problems I might write my own finalizer system that utilises this.
Ruby:
ObjectSpace.define_finalizer( self, proc { STUFF_TO_DO_HERE } )
I think the general idea is if you rely on finalizers in your RGSS then you are doing something wrong, but this sort of breaks down when you're using Win32 libraries.
Why I want a finalizer;
I've tried moving as much as I can to my DLL's DLL_PROCESS_DETACH call, but I'm doing some pretty crazy stuff that requires the RPG Maker Game.exe context to be alive for me to be able to clean up the memory I want to deal with and apparently the RGSS runtime will call the Win32API's FreeLibrary() AFTER it kills its own context (Wtf?).
So is there an RGSS class or point that I can attach to for my clean-up code to be called when the game is shutdown? Or is there a callback that I can attach?
EDIT:
I may have solved this myself:
Ruby:
module SceneManager_XI
def self.exit
STUFF_TO_DO_HERE # Cleanup library
super
end
SceneManager.module_eval { include SceneManager_XI }
end
If it's a good idea and doesn't cause any problems I might write my own finalizer system that utilises this.