Goombert
|
|
Reply #45 Posted on: October 03, 2014, 11:30:39 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Oh boy sorlok, I haven't really worked with dll's that much so I don't know how to reproduce and test what he's testing. In fact I don't think I've ever written a dll before, except changes to the compiler which make compileEGMf, but other than that I've never made my own dll's before. Additionally Josh would be the best person to talk about variant, I don't think I would be able to fully understand the implications.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
lonewolff
|
|
Reply #47 Posted on: October 04, 2014, 05:27:03 pm |
|
|
"Guest"
|
Still in Sydney at the moment so don't have access to any code right now.
Having said that, the exact same DLL is working 100% in GM:S.
Even if I skip the init to force a null pointer for the device, in the quad crate call, GM:S returns 1 for failed call (as expected) but ENIGMA crashes instantly.
|
|
|
Logged
|
|
|
|
sorlok_reaves
|
|
Reply #48 Posted on: October 04, 2014, 05:54:34 pm |
|
|
Joined: Dec 2013
Posts: 260
|
Still in Sydney at the moment so don't have access to any code right now.
Having said that, the exact same DLL is working 100% in GM:S.
Even if I skip the init to force a null pointer for the device, in the quad crate call, GM:S returns 1 for failed call (as expected) but ENIGMA crashes instantly. Yes, but that's probably because your pointer is initially in a garbage state anyway (because you never set it to anything). Anyway, it's much better to wait until we get an actual test case; I don't think we'll be able to solve this until Robert and I actually have something concrete to work with.
|
|
|
Logged
|
|
|
|
lonewolff
|
|
Reply #49 Posted on: October 04, 2014, 06:01:05 pm |
|
|
"Guest"
|
Yep, for sure. Still confused though. Even if it were a garbage pointer, the error checking would return a D3DERR* message, not simply crash the app. I am extremely pedantic when error checking, as I never want to release buggy code to the public. But, for sure, ill send over the DLL and source when I get back to civilisation.
|
|
|
Logged
|
|
|
|
sorlok_reaves
|
|
Reply #50 Posted on: October 04, 2014, 06:12:15 pm |
|
|
Joined: Dec 2013
Posts: 260
|
Just think of it this way:
D3DWhatever* something = 0xFF00FF; Give this garbage pointer, how can you *possibly* know it's invalid? In C++, it just points to a memory location, and the runtime just assumes that you point to one that represents an object, or NULL.
Now, D3D *could* maintain a list of all known D3DWhatever pointers somewhere global, and check this every single time it's given a pointer. But that's costly, and it only helps very obscure cases like this one.
Valgrind might be able to detect this, if the memory being pointed to is uninitialized or something like that. But even then, it's kind of a gray area.
This is one very good reason why you should always initialized your pointers to NULL; it allows the runtime to detect when a pointer is definitely invalid.
|
|
|
Logged
|
|
|
|
lonewolff
|
|
Reply #51 Posted on: October 04, 2014, 06:18:10 pm |
|
|
"Guest"
|
Just think of it this way:
D3DWhatever* something = 0xFF00FF; Give this garbage pointer, how can you *possibly* know it's invalid? In C++, it just points to a memory location, and the runtime just assumes that you point to one that represents an object, or NULL.
Now, D3D *could* maintain a list of all known D3DWhatever pointers somewhere global, and check this every single time it's given a pointer. But that's costly, and it only helps very obscure cases like this one.
Valgrind might be able to detect this, if the memory being pointed to is uninitialized or something like that. But even then, it's kind of a gray area.
This is one very good reason why you should always initialized your pointers to NULL; it allows the runtime to detect when a pointer is definitely invalid.
First things first, I always initialise pointers to 0 (as I have done in my DLL) Secondly even if your pointer is some random value, this is what the D3D calls return code is for. It will return an error upon failure regardless of what caused the error (invalid devices etc..). If the device handle is some random garbage, the call will simply return an error (not crash) unless the error is disregarded and program flow continues.
|
|
|
Logged
|
|
|
|
|
Goombert
|
|
Reply #53 Posted on: October 04, 2014, 07:12:40 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
the error checking would return a D3DERR* message, not simply crash the app. No it would not, because the FAILED() macro does not check for garbage pointers, it doesn't check for pointers at all in fact. http://msdn.microsoft.com/en-us/library/windows/desktop/ms693474%28v=vs.85%29.aspx#define FAILED(hr) (((HRESULT)(hr)) < 0) The following would crash. if(FAILED(d3dDevice->CreateVertexBuffer((nNumVerts)*sizeof(D3DVERTEX),D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,D3DFVF_XYZRHW|D3DFVF_DIFFUSE,D3DPOOL_DEFAULT,&pVertexObjectQuad,NULL))); Even if you took it out of the macro, before it even enters the function, that's GCC/MinGW/C++ not DirectX failing. d3dDevice->CreateVertexBuffer((nNumVerts)*sizeof(D3DVERTEX),D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,D3DFVF_XYZRHW|D3DFVF_DIFFUSE,D3DPOOL_DEFAULT,&pVertexObjectQuad,NULL);
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
Darkstar2
|
|
Reply #54 Posted on: October 04, 2014, 08:37:15 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
I am extremely pedantic when error checking, as I never want to release buggy code to the public.
Yeah you just threw out the window any chance you have at working for ANY software developing company, NOBODY would hire you ! LOL. God forbid if software companies had people like that, consumers would have better software but turn around times would be exponentially higher and shite would not be released fast enough (or ever) Though you shouldn't worry about that with ENIGMA, nobody is going to crucify you for finding bugs in your free extension, considering the said product is not exactly bug free to begin with LOL. Cheers But, for sure, ill send over the DLL and source when I get back to civilisation.
We're looking forward to your plugin, it would be great, assuming you don't get bitten by scorpions or swallowed by crocodiles, all good ! Later
|
|
|
Logged
|
|
|
|
lonewolff
|
|
Reply #55 Posted on: October 05, 2014, 04:17:10 am |
|
|
"Guest"
|
Actually had a scorpion in my back yard the other day when I was moving some bricks. Yet to see a crocodile in my back yard yet. Although, I do see kangaroos here in a daily basis
|
|
|
Logged
|
|
|
|
Darkstar2
|
|
Reply #56 Posted on: October 05, 2014, 01:07:57 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
Actually had a scorpion in my back yard the other day when I was moving some bricks.
Was it that Scorpion named Samuel ? LOL! Yet to see a crocodile in my back yard yet.
I rather see crocs in my back yard than snakes Anyhow looks like you have quite a challenge here with your plugin ..... I'm wondering if the crash problem doesn't come from something else unrelated, maybe something major that will be discovered from this who knows.........hopefully you can find a way to get this done, that will open the doors to other plugins too...
|
|
« Last Edit: October 05, 2014, 01:10:14 pm by Darkstar2 »
|
Logged
|
|
|
|
|