It's crushing and i do not know what's wrong becouse all my previouse calls are DD_OK what should i do how to debug DirectDraw ??
Posted on 2003-07-31 14:13:47 by AceEmbler
Place some OutputdebugStringA calls arround and detect where exactly it is crashing, then deal with the DirectDraw's error code returned

Output each parameter value and or structure contents and examine them as compared to what should be there... IMHO you "think" that they are ok but they are not ...obviousely since it crashes...

Even if they can be annoying those clear/localized bugs are not big stuff, they are mainly becuse you did a typo error or because you do not clearly and exactly understand what the function does and/or should do...

Logical errors are much more hard to find IMHO
Posted on 2003-07-31 16:37:59 by BogdanOntanu

It's crushing and i do not know what's wrong becouse all my previouse calls are DD_OK what should i do how to debug DirectDraw ??


Hi, AceEmbler!

here is my proggy i'm writting, it has example of debugging DX7 app
it has console window, some debug macros, and can handle some DX error codes
may be it can help :cool:

hope my asm is beter than english :grin:
Posted on 2003-08-01 05:53:11 by S.T.A.S.
It's good to be back :)
I was afk for a while so i couldn't post.


I still have not solved the problem. I dont know how to use S.T.A.S. example of debuging DX.

I'm tired of this so please if someone can help me with this. I checked variables and structures before calling CreateSurface but all this stuff looks good for me.

DX is such a pain for (DX + ASM) Beginers.

I'm attaching some files for people who wants to help me
"Remember to copy bitmap to use for the app."
Posted on 2003-08-17 15:29:28 by AceEmbler
Hi, AceEmbler!
I've had alot of problems at the beginning with DX
Then i understood that all the answers are in MS DX SDK (still C language)

Your way of initializing DX when uMsg==WM_CHAR seems strange, I initialize DX just after CreateWindowEx.
After all, you need main loop with PeekMessage and draw routines.
(search the board, Scronty made many post about it)

My "debbugging" is mDirect & COMInvoke macros, they are calling Error_Test proc after invoking DX com.
(if ErrorTest = TRUE)
Error_Test looks through errors.lst file (i use MASM to generate it) and shows some info. For me it's enough.
You can use console (is now in DX window just press "~") or commandline /CON to open console window.
This can show you some info, too

I'm afraid my asm isn't a good example, but it works for me :)
I hope it'll work for you, too
Just remove everithing you don't need now. (and copy inc folder with my DX7 includes to your RadASM\inc)

Any questions are welcome;)
Posted on 2003-08-17 19:50:32 by S.T.A.S.
New version of my prog:
Posted on 2003-08-17 19:54:26 by S.T.A.S.
That's a pity but youre dubugging stuf is useless for me becouse my app crushes while CreateSurface so i just dont know whats wrong but i know where.

Can somebody give me the simplest example of displaying Bitmap using DirectDraw ??
Posted on 2003-08-22 08:50:42 by AceEmbler
OK i solved the problem as for now.



shit but i found another one just few lines further. :(
Posted on 2003-08-23 14:15:55 by AceEmbler
OK,

for others to learn let us know what was it :D

and also tell us what is the new problem
Posted on 2003-08-23 18:34:13 by BogdanOntanu
When i was invoking CreateSurface my DDSURFACEDESC2 struct was LOCAL when i changed it into global variable my app have not crushed :P.
( still dont know why )

Right now my BltFast crushes my app :P.
But i dont have time to serch for the bugs. DD is such a pain that im going to write some tut about: how to display Bitmap with DD it will be after i will do this myself. :)
Posted on 2003-08-24 16:16:07 by AceEmbler
Hah

DDraw is so damn simple that i do not get what can be considered so complicated about it

Of course placing a global thingy on LOCAL (aka on a procedure's stack frame) never crossed my mind.

LOCAL is actually and i do not see how a global routine/method from directdraw interfaces can ever be assumed to acces YOUR ebp while running its own functions, this is just plain naive at last.... after all how are you telling it ebp+what? address ? eh?

LOCAL is strictly for YOUR variables and stuff, never send them to API or even less to low level driver based routines like DirectDraw

I am always amazed how newbies first start by "organizing" things, organization comes after many years of experience. Besides i am also amazed how newbies always push it to the limit thinking they will eventually get it by :P

IMHO: Place all your DD structures and pointers and stuff in global variables, never pushit, always use small simple and stupid (if you like to call them like that) steps...and all will work ok

I always did it like this and i never have had ANY problems with DirectDraw whatsoever

Placing a bitmap in a surface is just as simple as it can get:
(ddraw helper includes from SDK/C+= do it like this also but hidden in some classes :D )

1)Use LoadImageA with (LR_LoadFromFile) to load BMP, make an memory compatible DC for it , and select the bitmap into this GDI based DC

2)Create a surface with needed size, run ::GetDC Metod on this surface and use a GDI BitBlt to transfer the BMP from the GDI memory DC to the DC of the surface.

3)Release Surface DC, then eventually release the GDI memory DC and the GDI Bitmap Handle
you might want to skip releasing GDI structures is your Surface is in video memory because you will have to use them again and ::Restore method after and alt_tab in full screen mode (or when getting DDERR_SURFACELOST)

You can now use standard DX operations on this surface like the ::Blt method

But of course you HAVE to pushi it and try to use BltFast (because it sounds "fast"?) that is well documented in SDK to have some heavy limitations, and trust me is not "that" fast as you imagine...
Posted on 2003-08-24 16:40:17 by BogdanOntanu
Finally I made it :grin:. There are still some bugs but the Bitmap is appearing.Can u tell me why this "bugs" are appearing. U will know what i mean when run my prog. Just press any key when the Window appears.
Posted on 2003-08-27 15:22:27 by AceEmbler

Hah

DDraw is so damn simple that i do not get what can be considered so complicated about it



My two cents:

Don't let anyone else tell you otherwise: DirectDraw is hard. If you don't get this stuff immediately, it doesn't mean you're slow and it doesn't mean you're not ready for Windows programming; it means your normal. DirectX wasn't designed to be easy to use. It was designed to be fast while allowing Windows to maintain some semblance of control over the system. DirectX has gotten much better in recent recent versions, but it still isn't a trivial thing to pick up. Not to mention writing it using 32 bit asm.

Sliver
Posted on 2003-09-12 12:22:29 by Sliver
Can you give me one example
for what is "so hard" about DirectDraw in "older versions" (aka DX5,6,7) in asm ?

It is just pushing parameters and calling some API functions IMHO

the extra thingy i have to do every time is:



mov eax,pThisObject
push eax
mov eax,[eax]
call [eax+ThisObjectMethod]



Is hardly a "complicated and / or hard stuff ...

Of course you must understand parameters and how to use the API without wrongly assuming things,
but that is an issue with any API.
:stupid:
Posted on 2003-09-12 18:04:54 by BogdanOntanu
DirectX is sux documented. And i think this is the only one difficulty but a huge one. It's my own opinion so correct me if i'm wrong:tongue:
Posted on 2003-09-13 18:30:48 by AceEmbler

DirectX is sux documented. And i think this is the only one difficulty but a huge one. It's my own opinion so correct me if i'm wrong:tongue:

Most of DirectX stuff is commented in DirectX SDK (for C & VB) and MSDN, though newer versions of DX SDK tends to C++. You'd better to find DX7/DX6 ones.
Other things can be found in *.h files...

Also SDK includes some examples how to do somthing "step by step".
C can be translated to asm, you just need some macros to get life easier. ;)
Posted on 2003-09-15 00:44:40 by S.T.A.S.

Can you give me one example
for what is "so hard" about DirectDraw in "older versions" (aka DX5,6,7) in asm ?

....

Of course you must understand parameters and how to use the API without wrongly assuming things, but that is an issue with any API.
:stupid:


Why is that taken for granted when you start? So shall we assume everyone evntering the game programming field has a background in COM? Or that everyone know the correct way to draw a line across the screen? Or how to load a *.bmp? Maybe how to draw text?

It all depends on what resources are available to you when you start...
Don't assume everyone starts at the same place... Because then you'll be sadly mistaken...

I'm gonna make an assumtion that we're not all as quick as you are and leave it at that... How fortunate for you...

Sliver
Posted on 2003-09-15 05:40:47 by Sliver

It all depends on what resources are available to you when you start...

Yes, Sliver , I have to agree with you.
I've got some background programming... lines, text...
But about COM, it would be good if I understand this :)
I'm just able to write some macro and... forgot about it.

Also there are no tutors about programming DX in asm available in inet...
May be just ones that shows how to invoke DX methods from asm.
It's goot that I know how to draw char, but I'm not sure is it possible to find some example with google.:confused:
But the other side this isn't programming in DirectX, this is programming gfx with asm
Posted on 2003-09-15 21:03:01 by S.T.A.S.
dx (especially directdraw7!) is not so hard i think...

it is well documented too (just read it very carefully).

everything dx-related keep in global variables, because dx does some shit with stack.

of course documentation is in c++ (or vb), but the syntax is not complicated, so u should understand the examples.

heh, this 'shotty documentation' stuff reminds me of ACM. .. if u think that dx is not documented well enough, then try ACM (microsoft's audio compression manager - can bre found in multimedia.chm in platformsdk's helps) - it has the most shitty documentation i have ever seen.

...

learn some basics of c++ (the syntax for example), and your problems will solve.

cya

any questions about dx7, (or acm, or dx8's DirectShow, or whatever windows OS related):http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=e8bce7295bb9b5527c818551b9421bb2
Posted on 2003-10-06 10:58:56 by ti_mo_n