Writing a latent function.

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Writing a latent function.

Post by Hanfling »

atrey65789 wrote:Do I call RegisterNames() in the native functions I am importing?
You need to call it once so your the names get initialized, you just need to make sure this gets called at least once (before you use any name, like when doing your event* call). Classic place these were called are inside UEngine and subclasses Init() method, for dx they also put it into other places like DeusExPlayer. So i think just calling it off the constructor of your class you add should work fine.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Writing a latent function.

Post by Hanfling »

You don't have do copy each individual include file you need into src, just add the relative paths to the dirs they reside as include paths to the project.

Also you should use relative paths to libs like Core.lib, WinMM.lib should be in VC library dir anyway, etc.

You could use SampleNativePackage project files out of ut/rune pubsrc as a template to properly set it up.

Also you can create a file named as the C++ name of the class, e.g. Inc\AUnrealMidi.h which gets autoincluded in the class definition to put the declaration for the ctor and poll exec in.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
Hanfling
MJ12
Posts: 406
Joined: Sun Oct 04, 2009 6:54 pm

Re: Writing a latent function.

Post by Hanfling »

Did a bit of experimenting around, cleaned up the stit and added some define to test just basic ue polling code, etc.

http://coding.hanfling.de/UnrealMIDI.zip

Turns out, the reason why the polling exec was never called is because you didn't set up your project correctly and in particular used an struct alignment of 8 instead of 4 and thus due to changed alignment LatentAction was apparently never written to right place and hence having no effect.
I demand my DXE User ID back. Launcher for DeusEx, Rune, Nerf, Unreal & Botpack. HX on Mod DB. Revision on Steam.
atrey65789
Thug
Posts: 49
Joined: Tue Jun 26, 2012 3:32 am

Re: Writing a latent function.

Post by atrey65789 »

This looks great, I am studying the heck out of this and noting your revisions. Did this compile for you? I am getting 3 errors all regarding redefinitions, but looking over everything, all the error-related functions are only defined once. They include the function you made that calls RegisterNames() (It says it already has a body), The poll function (MidiPoll) and MidiPollTemp, where I cannot find anywhere but the error brings me to the IMPLEMENT_FUNCTION line for MidiPoll.

Thank you very much so far, I am impressed as heck about your proficiency of C++


And I saw what you were saying about each individual header being in my source, I did that because I couldn't get the paths of them to work, wierd stuff. I swear I was putting in the correct path for an hour, so I did this to save me a headache.
atrey65789
Thug
Posts: 49
Joined: Tue Jun 26, 2012 3:32 am

Re: Writing a latent function.

Post by atrey65789 »

I got it to compile, but still isn't calling the Poll function... question, I have a callback function that actually detects the midi signal and message, that sort of acts as a poll function, as it waits for detection of what it is looking for. I tried using it to call eventMidiMessage and got this error: 'AUnrealMIDI::eventMidiMessage' : illegal call of non-static member function.

It also tells me to look at its declaration, in a sense that I am giving it incorrect parameters, but it has two parameters (both being strings) which is what I give it.

Maybe there is a way to get it to work?
atrey65789
Thug
Posts: 49
Joined: Tue Jun 26, 2012 3:32 am

Re: Writing a latent function.

Post by atrey65789 »

Got the poll function to work, almost there thanks to your help... The function in-game waits patiently for detection before it moves on with the rest of the state... Now all I need to figure out is why the callback function isn't detecting midi input.

Edit: I found the issue to that too, fixed that.. very close.

Last Edit: fixed the final issue which was the engine only accepting one midi input due to not closing the midi port at the end of the function. Everything works the way I need it to to advance with what I want to do.


Hanfling, what can I say, you went above and beyond by helping me for a month with this and I appreciate every single bit of it.
Post Reply