From 85ebfd835dd8cedf007b8010e6d356df897b5ca8 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 9 Aug 2018 22:11:01 +0100 Subject: 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. --- engines/startrek/space.cpp | 12 ++++++++---- 1 file 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) { -- cgit v1.2.3