|
31 | 31 |
|
32 | 32 | #define CONSOLE_DEBUG |
33 | 33 |
|
| 34 | +u8 tempRAWCRTBuffer[ 1032 * 1024 ]; |
| 35 | + |
| 36 | +static u8 *rawCRT = tempRAWCRTBuffer; |
| 37 | + |
34 | 38 | u32 swapBytesU32( u8 *buf ) |
35 | 39 | { |
36 | 40 | return buf[ 3 ] | ( buf[ 2 ] << 8 ) | ( buf[ 1 ] << 16 ) | ( buf[ 0 ] << 24 ); |
@@ -79,7 +83,7 @@ int readCRTHeader( CLogger *logger, CRT_HEADER *crtHeader, const char *DRIVE, co |
79 | 83 |
|
80 | 84 | // read data in one big chunk |
81 | 85 | u32 nBytesRead; |
82 | | - u8 rawCRT[ 64 ]; |
| 86 | + memset( rawCRT, 0, filesize ); |
83 | 87 | result = f_read( &file, rawCRT, 64, &nBytesRead ); |
84 | 88 |
|
85 | 89 | if ( result != FR_OK ) |
@@ -161,7 +165,7 @@ void readCRTFile( CLogger *logger, CRT_HEADER *crtHeader, const char *DRIVE, con |
161 | 165 |
|
162 | 166 | // read data in one big chunk |
163 | 167 | u32 nBytesRead; |
164 | | - u8 rawCRT[ 1032 * 1024 ]; |
| 168 | + memset( rawCRT, 0, filesize ); |
165 | 169 | result = f_read( &file, rawCRT, filesize, &nBytesRead ); |
166 | 170 |
|
167 | 171 | if ( result != FR_OK ) |
@@ -547,7 +551,7 @@ int getVIC20CRTFileStartEndAddr( CLogger *logger, const char *FILENAME, u32 *ad |
547 | 551 |
|
548 | 552 | // read data in one big chunk |
549 | 553 | u32 nBytesRead; |
550 | | - u8 rawCRT[ 1032 * 1024 ]; |
| 554 | + memset( rawCRT, 0, filesize ); |
551 | 555 | result = f_read( &file, rawCRT, filesize, &nBytesRead ); |
552 | 556 |
|
553 | 557 | if ( result != FR_OK ) |
@@ -699,7 +703,7 @@ void writeChanges2CRTFile( CLogger *logger, const char *DRIVE, const char *FILEN |
699 | 703 |
|
700 | 704 | // read data in one big chunk |
701 | 705 | u32 nBytesRead; |
702 | | - u8 rawCRT[ 1025 * 1024 ]; |
| 706 | + memset( rawCRT, 0, filesize ); |
703 | 707 | result = f_read( &file, rawCRT, filesize, &nBytesRead ); |
704 | 708 |
|
705 | 709 | if ( result != FR_OK ) |
|
0 commit comments