The above warning message mainly causes the crash.
It's because image\title\titlebtn1.png is not there.
In current version, the code is:
if ( buf[0] != '\0' ){ btndef_info.setImageName( buf ); parseTaggedString( &btndef_info ); btndef_info.trans_mode = AnimationInfo::TRANS_COPY; setupAnimationInfo( &btndef_info ); SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
}
In this case, buf = "image\title\titlebtn1.png" so btndef_info.setImageName() and following calls will result btndef_info.image_surface to be NULL because it's really not exists.
And then SDL_SetAlpha crash because it's NULL.
In Haeleth's version, the code is
if ( buf[0] != '\0' ){ btndef_info.setImageName( buf ); parseTaggedString( &btndef_info ); btndef_info.trans_mode = AnimationInfo::TRANS_COPY; setupAnimationInfo( &btndef_info );
#ifdef RCA_SCALE
if (btndef_info.image_surface
&& (scr_stretch_x > 1.0 || scr_stretch_y > 1.0 )) {
// Scale and reposition buttons if screen is bigger than game SDL_Surface* src = btndef_info.image_surface; SDL_PixelFormat *fmt = src->format; SDL_Surface* dst = SDL_CreateRGBSurface( SDL_SWSURFACE, scr_stretch_x*src->w, scr_stretch_y*src->h, fmt->BitsPerPixel, fmt resizeSurface( src, dst ); btndef_info.image_surface = dst; btndef_info.pos.w *= scr_stretch_x; btndef_info.pos.h *= scr_stretch_y; SDL_FreeSurface( src );
}
if (btndef_info.image_surface)
#endif SDL_SetAlpha( btndef_info.image_surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
} else btntime_value = 0; //Mion - clear the btn wait time
So when RCA_SCALE is defined, it checks btndef_info.image_surface before calls to SDL_SetAlpha() which won't cause the crash.
*** can't find file [image\ title\titlebtn1 .png] ***
The above warning message mainly causes the crash. titlebtn1. png is not there.
It's because image\title\
In current version, the code is:
btndef_ info.setImageNa me( buf );
parseTagge dString( &btndef_info );
btndef_ info.trans_ mode = AnimationInfo: :TRANS_ COPY;
setupAnima tionInfo( &btndef_info );
SDL_ SetAlpha( btndef_ info.image_ surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
if ( buf[0] != '\0' ){
}
In this case, buf = "image\ title\titlebtn1 .png" so btndef_ info.setImageNa me() and following calls will result btndef_ info.image_ surface to be NULL because it's really not exists.
And then SDL_SetAlpha crash because it's NULL.
In Haeleth's version, the code is
btndef_ info.setImageNa me( buf );
parseTagge dString( &btndef_info );
btndef_ info.trans_ mode = AnimationInfo: :TRANS_ COPY;
setupAnima tionInfo( &btndef_info ); info.image_ surface
SDL_Surface* src = btndef_ info.image_ surface;
SDL_PixelForm at *fmt = src->format;
SDL_Surface* dst = SDL_CreateRGBSu rface( SDL_SWSURFACE,
scr_stretch_ x*src-> w,
scr_stretch_ y*src-> h,
fmt->BitsPerPi xel, fmt
resizeSurface ( src, dst );
btndef_ info.image_ surface = dst;
btndef_ info.pos. w *= scr_stretch_x;
btndef_ info.pos. h *= scr_stretch_y;
SDL_FreeSurfa ce( src ); info.image_ surface)
SDL_ SetAlpha( btndef_ info.image_ surface, DEFAULT_BLIT_FLAG, SDL_ALPHA_OPAQUE );
if ( buf[0] != '\0' ){
#ifdef RCA_SCALE
if (btndef_
&& (scr_stretch_x > 1.0 || scr_stretch_y > 1.0 )) {
// Scale and reposition buttons if screen is bigger than game
}
if (btndef_
#endif
} else btntime_value = 0; //Mion - clear the btn wait time
So when RCA_SCALE is defined, it checks btndef_ info.image_ surface before calls to SDL_SetAlpha() which won't cause the crash.