diff options
author | D G Turner | 2018-08-09 22:11:01 +0100 |
---|---|---|
committer | D G Turner | 2018-08-09 22:11:01 +0100 |
commit | 85ebfd835dd8cedf007b8010e6d356df897b5ca8 (patch) | |
tree | 55fa5ff8f77a139766e678a9696ea975d41b26e1 | |
parent | d7a977b15201f2c849da4b8bbadca05122f8be6f (diff) | |
download | scummvm-rg350-85ebfd835dd8cedf007b8010e6d356df897b5ca8.tar.gz scummvm-rg350-85ebfd835dd8cedf007b8010e6d356df897b5ca8.tar.bz2 scummvm-rg350-85ebfd835dd8cedf007b8010e6d356df897b5ca8.zip |
STARTREK: Possible Fix for OUYA Toolchain Build Error.
The size of the void StarTrekEngine::drawR3Shape(R3 *r3) function is
very large, and this is using quite a lot of large variables on the
stack, rather than by heap allocation.
The exact cause is unclear, but this provokes an internal GCC error /
bug in the Android OUYA toolchain. To try to avoid this, this commit
changes several of the large local allocations from stack to heap i.e.
using new and delete[] to try to avoid this.
-rw-r--r-- | engines/startrek/space.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/startrek/space.cpp b/engines/startrek/space.cpp index 6d2c469aec..ec1c89dfb2 100644 --- a/engines/startrek/space.cpp +++ b/engines/startrek/space.cpp @@ -310,9 +310,8 @@ void StarTrekEngine::drawR3Shape(R3 *r3) { thing[6] = 1.0 * dbl20 + dbl3e4 * dbl30 + dbl10; thing[7] = 1.0 * dbl18 + dbl3e4 * dbl28 + dbl8; - - int16 rightBounds[SCREEN_HEIGHT]; - int16 leftBounds[SCREEN_HEIGHT]; + int16 *rightBounds = new int16[SCREEN_HEIGHT]; + int16 *leftBounds = new int16[SCREEN_HEIGHT]; for (int y = _starfieldRect.top; y < _starfieldRect.bottom; y++) { leftBounds[y] = _starfieldRect.right; @@ -416,7 +415,7 @@ void StarTrekEngine::drawR3Shape(R3 *r3) { int16 var3f8 = var3f4 * shpImageTop + (int16)(dbl38 * 256); Bitmap tmpBitmap(256, 249); - byte otherBuffer[256 * 256]; + byte *otherBuffer = new byte[256 * 256]; int16 bitmapWidth = bitmap->width; int16 bitmapHeight = bitmap->height; @@ -482,7 +481,12 @@ void StarTrekEngine::drawR3Shape(R3 *r3) { warning("Unimplemented branch in \"drawR3Shape\""); } } + + delete[] otherBuffer; } + + delete[] rightBounds; + delete[] leftBounds; } if (r3->funcPtr2 != 0) { |