Jump to content
  • Advertisement
Sign in to follow this  

What is happening here?

This topic is 2350 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. angry.png

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

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?
13: mWidth = 0;
002219C7 fldz
002219C9 push ebx
002219CA fst dword ptr [esi+4]
14: mHeight = 0;
002219CD fstp dword ptr [esi+8]
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"

(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 dry.png 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!