File tree Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Original file line number Diff line number Diff line change 13
13
#include <lz4.h>
14
14
15
15
// include the LZ4 binary data -> image_c64_multi_lz4[]
16
-
17
- //#incbin "image-c64.multi.lz4"
16
+ const char image_c64_multi_lz4 [] = {
17
+ #embed "image-c64.multi.lz4"
18
+ };
18
19
19
20
/*
20
- CharData equ .
21
- ScreenData equ CharData+8000
22
- ColorData equ ScreenData+ 1000
23
- XtraData equ ColorData+1000
21
+ CharData 8000 bytes
22
+ ScreenData 1000 bytes
23
+ ColorData 1000 bytes
24
+ XtraData 2 bytes
24
25
*/
25
26
26
27
void main () {
Original file line number Diff line number Diff line change @@ -189,12 +189,12 @@ export class CodeProject {
189
189
} else {
190
190
// for .asm -- [.%]include "file"
191
191
// for .c -- #include "file"
192
- let re2 = / ^ \s * [ . # % ] ? ( i n c l u d e | i n c b i n ) \s + " ( .+ ?) " / gmi;
192
+ let re2 = / ^ \s * [ . # % ] ? ( i n c l u d e | i n c b i n | e m b e d ) \s + " ( .+ ?) " / gmi;
193
193
while ( m = re2 . exec ( text ) ) {
194
194
this . pushAllFiles ( files , m [ 2 ] ) ;
195
195
}
196
196
// for .c -- //#resource "file" (or ;resource or #resource)
197
- let re3 = / ^ \s * ( [ ; ' ] | [ / ] [ / ] ) # ( r e s o u r c e | i n c b i n ) \s + " ( .+ ?) " / gm;
197
+ let re3 = / ^ \s * ( [ ; ' ] | [ / ] [ / ] ) # ( r e s o u r c e ) \s + " ( .+ ?) " / gm;
198
198
while ( m = re3 . exec ( text ) ) {
199
199
this . pushAllFiles ( files , m [ 3 ] ) ;
200
200
}
Original file line number Diff line number Diff line change @@ -273,22 +273,17 @@ export function linkLD65(step: BuildStep): BuildStepResult {
273
273
}
274
274
275
275
function processIncbin ( code : string ) {
276
- let re3 = / ^ \s * ( [ ; ' ] | [ / ] [ / ] ) # i n c b i n \s + " ( .+ ?) " / gm;
277
- // find #incbin "filename.bin" and replace with C array declaration
278
- return code . replace ( re3 , ( m , m1 , m2 ) => {
279
- let filename = m2 ;
276
+ let re3 = / ^ \s * # e m b e d \s + " ( .+ ?) " / gm;
277
+ // find #embed "filename.bin" and replace with C array data
278
+ return code . replace ( re3 , ( m , m1 ) => {
279
+ let filename = m1 ;
280
280
let filedata = store . getFileData ( filename ) ;
281
281
let bytes = convertDataToUint8Array ( filedata ) ;
282
- if ( ! bytes ) throw new Error ( '#incbin : file not found: "' + filename + '"' ) ;
282
+ if ( ! bytes ) throw new Error ( '#embed : file not found: "' + filename + '"' ) ;
283
283
let out = '' ;
284
- let ident = safeident ( filename ) ;
285
- console . log ( '#incbin' , filename , ident , bytes . length ) ;
286
- out += 'const unsigned char ' + ident + '[' + bytes . length + '] = {' ;
287
284
for ( let i = 0 ; i < bytes . length ; i ++ ) {
288
285
out += bytes [ i ] . toString ( ) + ',' ;
289
286
}
290
- out += '};' ;
291
- console . log ( 'incbin' , out ) ;
292
287
return out ;
293
288
} ) ;
294
289
}
You can’t perform that action at this time.
0 commit comments