Sign in to follow this  

What is happening here?

This topic is 2043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

EDIT: Nvm, this isn't the problem.

Gotta love it when a piece of simple and unrelated code stops working for absolutely no reason. [img]http://public.gamedev.net//public/style_emoticons/default/angry.png[/img]

[code]// Store the image sizes
mHeight = surface->h;
mWidth = surface->w;[/code]

I haven't touched this file all day, and it decided to start giving me problems for no reason. The "surface" variable is an SDL_Surface. I set a breakpoint right after these two lines and surface is an object, and both h and w have valid and expected values. mHeight stores the h value as expected. mWidth does not store the value at all. If I swap the two lines, the same problem occurs to the second line of code.

Would the disassembly help?
[code] 13: mWidth = 0;
002219C7 fldz
002219C9 push ebx
002219CA fst dword ptr [esi+4]
14: mHeight = 0;
002219CD fstp dword ptr [esi+8]
...
37:
38: // Store the image sizes
39: mHeight = surface->h;
00221A19 fild dword ptr [eax+0Ch] // Convert h to a float and store it on the stack
00221A1C lea ecx,[eax+0Ch] // store the address of our converted h value into the ecx register
00221A1F push edi // Push whatever is in the edi register onto the stack?
40: mWidth = surface->w;
00221A20 add eax,8 // Add 8 to the eax register? I.E. point eax to the w variable?
00221A23 fstp dword ptr [esi+8] // "copy the value on the top of the floating point register stack to ... another variable"
41: [/code]

(I did do Windows updates last night, did the VS Service Pack 1 break something?) Edited by CirdanValen

Share this post


Link to post
Share on other sites
It's unlikely that the SP broke anything; what is more likely is that the original code never worked properly in the first place, but somehow managed to get the correct result owing to a compiler and/or linker bug that has since been fixed by the SP.

If code in a completely unrelated place starts breaking the first thing to look at is memory corruption. You probably have a bad pointer somewhere else and are scribbling over this memory.

Share this post


Link to post
Share on other sites
Thanks for the reply. The problem isn't those variables. VS debugger seems to try and hide as much information as it can from me, so the only way I can really debug is to cout all the values I need to check.

My problem is, I'm drawing sprites to a RenderTexture. However, the whole RenderTexture becomes the color of the very first pixel. I can't figure it out because I know both the sprite and the RenderTexture are working correctly in other areas of the code.

EDIT: Solved the problem [img]http://public.gamedev.net//public/style_emoticons/default/dry.png[/img] I have no idea what it is about writing forum posts that make me magically realize the problem. Edited by CirdanValen

Share this post


Link to post
Share on other sites

This topic is 2043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this