shithub: rgbds

Download patch

ref: 17192ea6f07c2697bd87bc28df015a66f6e97fc3
parent: 0f488b67599c5d93423cf9ed830d829825eaf283
author: Anthony J. Bentley <[email protected]>
date: Sat Feb 8 18:26:43 EST 2014

Improve performance when padding: don't write a byte at a time.

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -390,11 +390,10 @@
 			headbyte++;
 		}
 
-		while (newsize != ftell(rom)) /* ROM needs resizing */
-			fputc(padvalue, rom);
-
 		if (newsize > 0x800000) /* ROM is bigger than 8MiB */
 			fprintf(stderr, "ROM size is bigger than 8MiB\n");
+
+		ftruncate(fileno(rom), newsize);
 
 		fseek(rom, 0x148, SEEK_SET);
 		fputc(headbyte, rom);