Closed BlisterB closed 8 years ago
Probably memory corruption.
Will check this on Monday because I can't download 1.1 GB through my mobile contract, makes me poor.
Looks like another corner case in my new Tone blit code :( Fortunately this doesn't seem to affect many games, 0 crashes reported in Android yet.
==10835== Conditional jump or move depends on uninitialised value(s)
==10835== at 0x8ACEE5: Bitmap::ToneBlit(int, int, Bitmap const&, Rect const&, Tone const&, Opacity const&) (bitmap.cpp:1029)
==10835== by 0x860761: Sprite::Refresh(Rect&) (sprite.cpp:163)
==10835== by 0x85FEDB: Sprite::BlitScreen() (sprite.cpp:84)
==10835== by 0x85FE3C: Sprite::Draw() (sprite.cpp:75)
==10835== by 0x80D495: Graphics::DrawFrame() (graphics.cpp:185)
==10835== by 0x80D221: Graphics::Update(bool) (graphics.cpp:114)
==10835== by 0x81CCFE: Player::Update(bool) (player.cpp:302)
==10835== by 0x8344A1: Scene::MainFunction() (scene.cpp:100)
==10835== by 0x81CA87: Player::MainLoop() (player.cpp:259)
==10835== by 0x81C921: Player::Run() (player.cpp:254)
==10835== by 0x80CF20: main (main.cpp:33)
==10835==
The sanitizing code in Refresh looks incorrect btw.
if (zoom_x_effect != 1.0 && zoom_y_effect != 1.0 && angle_effect != 0.0 && waver_effect_depth != 0) {
// TODO: Out of bounds check adjustments for zoom, angle and waver
// but even without this will catch most of the cases
if (Rect(x - ox, y - ox, GetWidth(), GetHeight()).IsOutOfBounds(Rect(0, 0, SCREEN_TARGET_WIDTH, SCREEN_TARGET_HEIGHT))) {
return BitmapRef();
};
}
rect.Adjust(bitmap->GetWidth(), bitmap->GetHeight());
The out of bounds check adjustments have wrong logic. They check if any effect is applied, but the TODO says it only works when no effect is applied. Which means we do lots of useless draw calls.
rect.Adjust does not adjust the rect correctly.
And I will add sanity checks to the new Tone blit...
I think this function here has an obvious bug. One case for x and y is not handled.
void Rect::Adjust(int max_width, int max_height) {
if (x < 0) {
width += x;
x = 0;
}
if (y < 0) {
height += y;
y = 0;
}
if (x < max_width && y < max_height) {
if (max_width < x + width) width = max_width - x;
if (max_height < y + height) height = max_height - y;
}
}
Fixed by #1044 1044
Name of the game:
Aedemphia
Player platform:
Windows and MacOS
Attach files (as a .zip archive or link them)
Save01.lsd.zip easyrpg_log.txt
Describe the issue in detail and how to reproduce it:
The game crashs on Windows when you go to the map at the bottom of the current map. On MacOS it crashs when you go to the map at the bottom of the current map, and next to the map to the left.
Here is the rapport from MacOS :