Hey everyone, I recently made a SDL racing game, using just an empty C++
project, and everything worked fine without me playing with any advanced
settings or anything like that.
As part of a group project for school, I have not implemented this SDL game
inside of a MFC application, I added the classes, and worked through all the
errors, and now it compiles with the same warnings as the original game did. So
no problems, however, I now get
Unhandled exception at 0x1002769e in exe: 0xC0000005: Access violation reading
location 0x00000004.
Whenever I use
SDL_SetColorKey( carturn, SDL_RLEACCEL | SDL_SRCCOLORKEY, 0x000000);
It also crashes on a few other points, all with the same type of errors. Is
there a setting or something that I should be changing? If I skip past these,
ie, edit them out, the next place it crashes is inside this function:
Uint32 get_pixel32( SDL_Surface *surface, int x, int y )
{
SDL_LockSurface(surface);
Uint32 pixels = (Uint32)surface->pixels;
Uint32 result = pixels[ ( y * surface->w ) + x ];
SDL_UnlockSurface(surface);
return result;
}
right at the SDL_LockSurface(surface)l
any Ideas?
As part of a group project for school, I have not implemented this SDL game
inside of a MFC application,
errr, I meant I have implemented it in MFC sorry for the typo
You might be able to avoid the LockSurface errors by using
if(SDL_MUSTLOCK(surface)) SDL_LockSurface(surface);
and the same for unlocking. Some surfaces shouldn’t be locked, and this can
cause problems.On 3/22/06, Ringo598 wrote:
Hey everyone, I recently made a SDL racing game, using just an empty C++
project, and everything worked fine without me playing with any advanced
settings or anything like that.
As part of a group project for school, I have not implemented this SDL
game
inside of a MFC application, I added the classes, and worked through all
the
errors, and now it compiles with the same warnings as the original game
did. So
no problems, however, I now get
Unhandled exception at 0x1002769e in exe: 0xC0000005: Access violation
reading
location 0x00000004.
Whenever I use
SDL_SetColorKey( carturn, SDL_RLEACCEL | SDL_SRCCOLORKEY, 0x000000);
It also crashes on a few other points, all with the same type of
errors. Is
there a setting or something that I should be changing? If I skip past
these,
ie, edit them out, the next place it crashes is inside this function:
Uint32 get_pixel32( SDL_Surface *surface, int x, int y )
{
SDL_LockSurface(surface);
Uint32 pixels = (Uint32)surface->pixels;
Uint32 result = pixels[ ( y * surface->w ) + x ];
SDL_UnlockSurface(surface);
return result;
}
right at the SDL_LockSurface(surface)l
any Ideas?
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
–
Cheers,
Josh
PGP: http://revvy.box43.net/Josh_Matthews.asc
hmmm, I tried those, and now it crashes on those commands, does taking out
SDLMain have anything to do with it? I had to remove it from the program
because of the multiple entry points. Its weird, the game compiles fine, and
then the MFC dialog boxes start up and run fine, but I get that error:
First-chance exception at 0x10022f55 in Kronosoft.exe: 0xC0000005: Access
violation reading location 0x0000002c.
Unhandled exception at 0x10022f55 in Kronosoft.exe: 0xC0000005: Access violation
reading location 0x0000002c.
Would what needs to be locked change from my original program? The program
works fine when its not in MFC, its just when I load the program in MFC I get
these runtime errors.
hmmm, I tried those, and now it crashes on those commands, does taking out
SDLMain have anything to do with it? I had to remove it from the program
because of the multiple entry points. Its weird, the game compiles fine, and
then the MFC dialog boxes start up and run fine, but I get that error:
First-chance exception at 0x10022f55 in Kronosoft.exe: 0xC0000005: Access
violation reading location 0x0000002c.
Unhandled exception at 0x10022f55 in Kronosoft.exe: 0xC0000005: Access violation
reading location 0x0000002c.
I don’t suppose running this in a debugger yields any useful information?
See ya,
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment
What do you mean by that? Like, running it, and then breaking at the line that
starts the errors? If so, the error I wrote earlier is what Visual Studio puts
in the box on the bottom as well. I think that I am trying to access something
in memory that a blank C++ project allows, but a MFC application does not? I am
completely at a loss here…