-
Notifications
You must be signed in to change notification settings - Fork 96
/
narcs.mk
640 lines (467 loc) · 24.1 KB
/
narcs.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# pokegra handled in data/graphics/pokegra.mk
# NARC_FILES handles prereqs for move_narc
# MSGDATA_COMPILETIME_DEPENDENCIES handles prereqs for msgdata
MSGDATA_DIR := $(BUILD)/text
MSGDATA_NARC := $(BUILD_NARC)/msg_data.narc
MSGDATA_TARGET := $(FILESYS)/a/0/2/7
MSGDATA_DEPENDENCIES_DIR := data/text
MSGDATA_DEPENDENCIES := $(wildcard $(MSGDATA_DEPENDENCIES_DIR)/*)
MSGDATA_COMPILETIME_DEPENDENCIES_DIR := $(BUILD)/rawtext
#MSGDATA_COMPILETIME_DEPENDENCIES := $(wildcard $(MSGDATA_COMPILETIME_DEPENDENCIES_DIR)/*.txt)
CHARMAP := charmap.txt
$(BUILD)/rawtext/%.txt: $(BUILD_NARC)/a011.narc $(BUILD_NARC)/a055.narc $(BUILD_NARC)/mondata.narc $(BUILD_NARC)/trainer_text_map.narc scripts/msg_cat.py
$(PYTHON) scripts/msg_cat.py $(BUILD)/rawtext
# actual msgdata rule at bottom to allow MSGDATA_COMPILETIME_DEPENDENCIES to be fully defined
NARC_FILES += $(MSGDATA_NARC)
BATTLEHUD_DIR := $(BUILD)/a007
BATTLEHUD_NARC := $(BUILD_NARC)/a007.narc
BATTLEHUD_TARGET := $(FILESYS)/a/0/0/7
BATTLEHUD_DEPENDENCIES_DIR := rawdata/battle_sprite
BATTLEHUD_DEPENDENCIES := $(wildcard $(BATTLEHUD_DEPENDENCIES_DIR)/*)
$(BATTLEHUD_NARC): $(BATTLEHUD_DEPENDENCIES)
$(NARCHIVE) extract $(BATTLEHUD_TARGET) -o $(BATTLEHUD_DIR) -nf
for file in $(BATTLEHUD_DEPENDENCIES_DIR)/*.png; do \
$(GFX) $$file $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .png).NCGR -bitdepth 8; \
$(GFX) $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .png).NCGR $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .png).NCGR.lz; \
$(GFX) $$file $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .png).NCLR -bitdepth 8; \
mv $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .png).NCGR.lz $(BATTLEHUD_DIR)/$$(basename $$file .png); \
export FILENAME_TEMP=$$(basename $$file); \
mv $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .png).NCLR $(BATTLEHUD_DIR)/7_$$(($$(basename $${FILENAME_TEMP#*_} .png)+1)); \
done
for file in $(BATTLEHUD_DEPENDENCIES_DIR)/*.pal; do \
$(GFX) $$file $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .pal).NCLR; \
mv $(BATTLEHUD_DEPENDENCIES_DIR)/$$(basename $$file .pal).NCLR $(BATTLEHUD_DIR)/$$(basename $$file .pal); \
done
for file in $(BATTLEHUD_DEPENDENCIES_DIR)/*.NSCR; do \
cp $$file $(BATTLEHUD_DIR)/$$(basename $$file .NSCR); \
done
rm $(BATTLEHUD_DEPENDENCIES_DIR)/*.NCGR
$(NARCHIVE) create $@ $(BATTLEHUD_DIR) -nf
NARC_FILES += $(BATTLEHUD_NARC)
MOVEDATA_DIR := $(BUILD)/a011
MOVEDATA_NARC := $(BUILD_NARC)/a011.narc
MOVEDATA_TARGET := $(FILESYS)/a/0/1/1
MOVEDATA_DEPENDENCIES := armips/data/moves.s
MOVEDATA_NAMES_DIR := $(BUILD)/rawtext/750 $(BUILD)/rawtext/751 $(BUILD)/rawtext/003 $(BUILD)/rawtext/749
$(MOVEDATA_NARC): $(MOVEDATA_DEPENDENCIES)
mkdir -p $(MOVEDATA_NAMES_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(MOVEDATA_DIR) -nf
NARC_FILES += $(MOVEDATA_NARC)
MSGDATA_COMPILETIME_DEPENDENCIES += $(BUILD)/rawtext/750.txt $(BUILD)/rawtext/751.txt $(BUILD)/rawtext/003.txt $(BUILD)/rawtext/749.txt
MOVEPARTICLES_DIR := $(BUILD)/a029
MOVEPARTICLES_NARC := $(BUILD_NARC)/a029.narc
MOVEPARTICLES_TARGET := $(FILESYS)/a/0/2/9
MOVEPARTICLES_DEPENDENCIES_DIR := rawdata/move_spa
MOVEPARTICLES_DEPENDENCIES := $(wildcard $(MOVEPARTICLES_DEPENDENCIES_DIR)/*)
$(MOVEPARTICLES_NARC): $(MOVEPARTICLES_DEPENDENCIES)
$(NARCHIVE) extract $(MOVEPARTICLES_TARGET) -o $(MOVEPARTICLES_DIR) -nf
cp -r $(MOVEPARTICLES_DEPENDENCIES_DIR)/. $(MOVEPARTICLES_DIR)
$(NARCHIVE) create $@ $(MOVEPARTICLES_DIR) -nf
NARC_FILES += $(MOVEPARTICLES_NARC)
OPENDEMO_DIR := $(BUILD)/a262
OPENDEMO_NARC := $(BUILD_NARC)/a262.narc
OPENDEMO_TARGET := $(FILESYS)/a/2/6/2
OPENDEMO_DEPENDENCIES_DIR := rawdata/op_demo
OPENDEMO_DEPENDENCIES := $(wildcard $(OPENDEMO_DEPENDENCIES_DIR)/*)
$(OPENDEMO_NARC): $(OPENDEMO_DEPENDENCIES)
$(NARCHIVE) extract $(OPENDEMO_TARGET) -o $(OPENDEMO_DIR) -nf
cp -r $(OPENDEMO_DEPENDENCIES_DIR)/. $(OPENDEMO_DIR)
$(NARCHIVE) create $@ $(OPENDEMO_DIR) -nf
NARC_FILES += $(OPENDEMO_NARC)
MONDATA_DIR := $(BUILD)/a002
MONDATA_NARC := $(BUILD_NARC)/mondata.narc
MONDATA_TARGET := $(FILESYS)/a/0/0/2
MONDATA_DEPENDENCIES := armips/data/mondata.s armips/data/tmlearnset.txt
MONDATA_NAMES_DIR := $(BUILD)/rawtext/237 $(BUILD)/rawtext/238 $(BUILD)/rawtext/817
MONDATA_DESCRIPTIONS_DIR := $(BUILD)/rawtext/803
MONDATA_CLASSIFICATIONS_DIR := $(BUILD)/rawtext/816 $(BUILD)/rawtext/823
MONDATA_HEIGHTS_DIR := $(BUILD)/rawtext/814 $(BUILD)/rawtext/815
MONDATA_WEIGHTS_DIR := $(BUILD)/rawtext/812 $(BUILD)/rawtext/813
$(MONDATA_NARC): $(MONDATA_DEPENDENCIES)
mkdir -p $(MONDATA_DIR) $(MONDATA_NAMES_DIR) $(MONDATA_DESCRIPTIONS_DIR) $(MONDATA_CLASSIFICATIONS_DIR) $(MONDATA_HEIGHTS_DIR) $(MONDATA_WEIGHTS_DIR)
$(ARMIPS) armips/data/mondata.s
$(PYTHON) scripts/tm_learnset.py armips/data/tmlearnset.txt
$(NARCHIVE) create $@ $(MONDATA_DIR) -nf
NARC_FILES += $(MONDATA_NARC)
MSGDATA_COMPILETIME_DEPENDENCIES += $(BUILD)/rawtext/237.txt $(BUILD)/rawtext/238.txt $(BUILD)/rawtext/803.txt $(BUILD)/rawtext/812.txt $(BUILD)/rawtext/813.txt $(BUILD)/rawtext/814.txt $(BUILD)/rawtext/815.txt $(BUILD)/rawtext/817.txt $(BUILD)/rawtext/823.txt
SPRITEOFFSETS_DIR := $(BUILD)/a180
SPRITEOFFSETS_NARC := $(BUILD_NARC)/spriteoffsets.narc
SPRITEOFFSETS_TARGET := $(FILESYS)/a/1/8/0
SPRITEOFFSETS_DEPENDENCIES := armips/data/spriteoffsets.s
$(SPRITEOFFSETS_NARC): $(SPRITEOFFSETS_DEPENDENCIES)
$(NARCHIVE) extract $(SPRITEOFFSETS_TARGET) -o $(SPRITEOFFSETS_DIR) -nf
$(ARMIPS) $^
$(NARCHIVE) create $@ $(SPRITEOFFSETS_DIR) -nf
NARC_FILES += $(SPRITEOFFSETS_NARC)
HEIGHT_DIR := $(BUILD)/a005
HEIGHT_NARC := $(BUILD_NARC)/heighttable.narc
HEIGHT_TARGET := $(FILESYS)/a/0/0/5
HEIGHT_DEPENDENCIES := armips/data/heighttable.s
$(HEIGHT_NARC): $(HEIGHT_DEPENDENCIES)
mkdir -p $(HEIGHT_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(HEIGHT_DIR) -nf
NARC_FILES += $(HEIGHT_NARC)
DEXAREA_DIR := $(BUILD)/a133
DEXAREA_NARC := $(BUILD_NARC)/dexareas.narc
DEXAREA_TARGET := $(FILESYS)/a/1/3/3
DEXAREA_RAWDATA_DIR := rawdata/files_from_a133
DEXAREA_DEPENDENCIES := armips/data/pokedex/areadata.s
$(DEXAREA_NARC): $(DEXAREA_DEPENDENCIES)
# $(NARCHIVE) extract $(DEXAREA_TARGET) -o $(DEXAREA_DIR) -nf
mkdir -p $(DEXAREA_DIR)
$(ARMIPS) $^
cp -r $(DEXAREA_RAWDATA_DIR)/. $(DEXAREA_DIR)
$(NARCHIVE) create $@ $(DEXAREA_DIR) -nf
NARC_FILES += $(DEXAREA_NARC)
DEXSORT_DIR := a214
DEXSORT_NARC := $(BUILD_NARC)/a214.narc
DEXSORT_TARGET := $(FILESYS)/a/2/1/4
DEXSORT_DEPENDENCIES := armips/data/pokedex/pokedexdata.s
$(DEXSORT_NARC): $(DEXSORT_DEPENDENCIES)
mkdir -p $(DEXSORT_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(DEXSORT_DIR) -nf
rm -r $(DEXSORT_DIR)
NARC_FILES += $(DEXSORT_NARC)
EGGMOVES_DIR := $(BUILD)/kowaza
EGGMOVES_NARC := $(BUILD_NARC)/kowaza.narc
EGGMOVES_TARGET := $(FILESYS)/a/2/2/9
EGGMOVES_TARGET_2 := $(FILESYS)/data/kowaza.narc
EGGMOVES_DEPENDENCIES := armips/data/eggmoves.s
$(EGGMOVES_NARC): $(EGGMOVES_DEPENDENCIES)
mkdir -p $(EGGMOVES_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(EGGMOVES_DIR) -nf
NARC_FILES += $(EGGMOVES_NARC)
EVOS_DIR := $(BUILD)/a034
EVOS_NARC := $(BUILD_NARC)/a034.narc
EVOS_TARGET := $(FILESYS)/a/0/3/4
EVOS_DEPENDENCIES := armips/data/evodata.s
$(EVOS_NARC): $(EVOS_DEPENDENCIES)
mkdir -p $(EVOS_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(EVOS_DIR) -nf
NARC_FILES += $(EVOS_NARC)
LEARNSET_DIR := $(BUILD)/a033
LEARNSET_NARC := $(BUILD_NARC)/a033.narc
LEARNSET_TARGET := $(FILESYS)/a/0/3/3
LEARNSET_DEPENDENCIES := armips/data/levelupdata.s
$(LEARNSET_NARC): $(LEARNSET_DEPENDENCIES)
mkdir -p $(LEARNSET_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(LEARNSET_DIR) -nf
NARC_FILES += $(LEARNSET_NARC)
REGIONALDEX_DIR := $(BUILD)/a138
REGIONALDEX_NARC := $(BUILD_NARC)/a138.narc
REGIONALDEX_TARGET := $(FILESYS)/a/1/3/8
REGIONALDEX_DEPENDENCIES := armips/data/regionaldex.s
$(REGIONALDEX_NARC): $(REGIONALDEX_DEPENDENCIES)
mkdir -p $(REGIONALDEX_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(REGIONALDEX_DIR) -nf
NARC_FILES += $(REGIONALDEX_NARC)
TRAINERDATA_DIR := $(BUILD)/a055
TRAINERDATA_DIR_2 := $(BUILD)/a056
TRAINERDATA_NARC := $(BUILD_NARC)/a055.narc
TRAINERDATA_NARC_2 := $(BUILD_NARC)/a056.narc
TRAINERDATA_TARGET := $(FILESYS)/a/0/5/5
TRAINERDATA_TARGET_2 := $(FILESYS)/a/0/5/6
TRAINERDATA_DEPENDENCIES := armips/data/trainers/trainers.s
TRAINERDATA_TRAINER_NAMES_DIR := $(BUILD)/rawtext/729
$(TRAINERDATA_NARC): $(TRAINERDATA_DEPENDENCIES)
mkdir -p $(TRAINERDATA_DIR) $(TRAINERDATA_DIR_2) $(TRAINERDATA_TRAINER_NAMES_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(TRAINERDATA_DIR) -nf
$(NARCHIVE) create $(TRAINERDATA_NARC_2) $(TRAINERDATA_DIR_2) -nf
NARC_FILES += $(TRAINERDATA_NARC)
MSGDATA_COMPILETIME_DEPENDENCIES += $(BUILD)/rawtext/729.txt
TRAINERTEXT_DIR := $(BUILD)/trainer_text_map
TRAINERTEXT_DIR_2 := $(BUILD)/trainer_text_offsets
TRAINERTEXT_NARC := $(BUILD_NARC)/trainer_text_map.narc
TRAINERTEXT_NARC_2 := $(BUILD_NARC)/trainer_text_offsets.narc
TRAINERTEXT_TARGET := $(FILESYS)/a/0/5/7
TRAINERTEXT_TARGET_2 := $(FILESYS)/a/1/3/1
TRAINERTEXT_DEPENDENCIES := armips/data/trainers/trainertext.s
$(TRAINERTEXT_NARC): $(TRAINERTEXT_DEPENDENCIES)
mkdir -p $(TRAINERTEXT_DIR) $(TRAINERTEXT_DIR_2) $(BUILD)/rawtext/728
touch $(TRAINERTEXT_DIR)/7_0
$(ARMIPS) $^
$(PYTHON) scripts/trainer_text.py
$(NARCHIVE) create $(TRAINERTEXT_NARC) $(TRAINERTEXT_DIR)
$(NARCHIVE) create $(TRAINERTEXT_NARC_2) $(TRAINERTEXT_DIR_2)
NARC_FILES += $(TRAINERTEXT_NARC)
MSGDATA_COMPILETIME_DEPENDENCIES += $(BUILD)/rawtext/728.txt
#FOOTPRINTS_DIR := $(BUILD)/a069
FOOTPRINTS_NARC := $(BUILD_NARC)/a069.narc
FOOTPRINTS_TARGET := $(FILESYS)/a/0/6/9
FOOTPRINTS_DEPENDENCIES_DIR := rawdata/footprints
FOOTPRINTS_DEPENDENCIES := $(wildcard $(FOOTPRINTS_DEPENDENCIES_DIR)/*)
$(FOOTPRINTS_NARC): $(FOOTPRINTS_DEPENDENCIES)
$(NARCHIVE) create $@ $(FOOTPRINTS_DEPENDENCIES_DIR) -nf
NARC_FILES += $(FOOTPRINTS_NARC)
MOVEANIM_DIR := $(BUILD)/move/move_anim
MOVEANIM_NARC := $(BUILD_NARC)/a010.narc
MOVEANIM_TARGET := $(FILESYS)/a/0/1/0
MOVEANIM_DEPENDENCIES_DIR := armips/move/move_anim
MOVEANIM_SRCS := $(wildcard $(MOVEANIM_DEPENDENCIES_DIR)/*.s)
MOVEANIM_OBJS := $(patsubst $(MOVEANIM_DEPENDENCIES_DIR)/%.s,$(MOVEANIM_DIR)/0_%,$(MOVEANIM_SRCS))
$(MOVEANIM_DIR)/0_%:$(MOVEANIM_DEPENDENCIES_DIR)/%.s
$(ARMIPS) $<
$(MOVEANIM_NARC): $(MOVEANIM_OBJS)
$(NARCHIVE) create $@ $(MOVEANIM_DIR) -nf
NARC_FILES += $(MOVEANIM_NARC)
MOVESUBANIM_DIR := $(BUILD)/move/move_sub_anim
MOVESUBANIM_NARC := $(BUILD_NARC)/a061.narc
MOVESUBANIM_TARGET := $(FILESYS)/a/0/6/1
MOVESUBANIM_DEPENDENCIES_DIR := armips/move/move_sub_anim
MOVESUBANIM_SRCS := $(wildcard $(MOVESUBANIM_DEPENDENCIES_DIR)/*.s)
MOVESUBANIM_OBJS := $(patsubst $(MOVESUBANIM_DEPENDENCIES_DIR)/%.s,$(MOVESUBANIM_DIR)/1_%,$(MOVESUBANIM_SRCS))
$(MOVESUBANIM_DIR)/1_%:$(MOVESUBANIM_DEPENDENCIES_DIR)/%.s
$(ARMIPS) $<
$(MOVESUBANIM_NARC): $(MOVESUBANIM_OBJS)
$(NARCHIVE) create $@ $(MOVESUBANIM_DIR) -nf
NARC_FILES += $(MOVESUBANIM_NARC)
MOVE_SEQ_DIR := $(BUILD)/move/battle_move_seq
MOVE_SEQ_OBJ_DIR := $(BUILD)/move/objects/battle_move_seq
MOVE_SEQ_NARC := $(BUILD_NARC)/a000.narc
MOVE_SEQ_TARGET := $(FILESYS)/a/0/0/0
MOVE_SEQ_DEPENDENCIES_DIR := data/battle_scripts/moves
MOVE_SEQ_SRCS := $(wildcard $(MOVE_SEQ_DEPENDENCIES_DIR)/*.s)
MOVE_SEQ_OBJS := $(patsubst $(MOVE_SEQ_DEPENDENCIES_DIR)/%.s,$(MOVE_SEQ_DIR)/0_%,$(MOVE_SEQ_SRCS))
$(MOVE_SEQ_DIR)/0_%:$(MOVE_SEQ_DEPENDENCIES_DIR)/%.s
$(AS) -c $< -o $(patsubst $(MOVE_SEQ_DEPENDENCIES_DIR)/%.s,$(MOVE_SEQ_OBJ_DIR)/0_%.o,$<)
$(LD) -T linker.ld -o $(patsubst $(MOVE_SEQ_DEPENDENCIES_DIR)/%.s,$(MOVE_SEQ_OBJ_DIR)/0_%_linked.o,$<) $(patsubst $(MOVE_SEQ_DEPENDENCIES_DIR)/%.s,$(MOVE_SEQ_OBJ_DIR)/0_%.o,$<)
$(OBJCOPY) -O binary $(patsubst $(MOVE_SEQ_DEPENDENCIES_DIR)/%.s,$(MOVE_SEQ_OBJ_DIR)/0_%_linked.o,$<) $@
$(MOVE_SEQ_NARC): $(MOVE_SEQ_OBJS)
$(NARCHIVE) create $@ $(MOVE_SEQ_DIR) -nf
$(OUTPUT):$(LINK)
NARC_FILES += $(MOVE_SEQ_NARC)
BATTLE_EFF_DIR := $(BUILD)/move/battle_eff_seq
BATTLE_EFF_OBJ_DIR := $(BUILD)/move/objects/battle_eff_seq
BATTLE_EFF_NARC := $(BUILD_NARC)/a030.narc
BATTLE_EFF_TARGET := $(FILESYS)/a/0/3/0
BATTLE_EFF_DEPENDENCIES_DIR := data/battle_scripts/effects
BATTLE_EFF_SRCS := $(wildcard $(BATTLE_EFF_DEPENDENCIES_DIR)/*.s)
BATTLE_EFF_OBJS := $(patsubst $(BATTLE_EFF_DEPENDENCIES_DIR)/%.s,$(BATTLE_EFF_DIR)/0_%,$(BATTLE_EFF_SRCS))
$(BATTLE_EFF_DIR)/0_%:$(BATTLE_EFF_DEPENDENCIES_DIR)/%.s
$(AS) -c $< -o $(patsubst $(BATTLE_EFF_DEPENDENCIES_DIR)/%.s,$(BATTLE_EFF_OBJ_DIR)/0_%.o,$<)
$(LD) -T linker.ld -o $(patsubst $(BATTLE_EFF_DEPENDENCIES_DIR)/%.s,$(BATTLE_EFF_OBJ_DIR)/0_%_linked.o,$<) $(patsubst $(BATTLE_EFF_DEPENDENCIES_DIR)/%.s,$(BATTLE_EFF_OBJ_DIR)/0_%.o,$<)
$(OBJCOPY) -O binary $(patsubst $(BATTLE_EFF_DEPENDENCIES_DIR)/%.s,$(BATTLE_EFF_OBJ_DIR)/0_%_linked.o,$<) $@
$(BATTLE_EFF_NARC): $(BATTLE_EFF_OBJS)
$(NARCHIVE) create $@ $(BATTLE_EFF_DIR) -nf
NARC_FILES += $(BATTLE_EFF_NARC)
BATTLE_SUB_DIR := $(BUILD)/move/battle_sub_seq
BATTLE_SUB_OBJ_DIR := $(BUILD)/move/objects/battle_sub_seq
BATTLE_SUB_NARC := $(BUILD_NARC)/a001.narc
BATTLE_SUB_TARGET := $(FILESYS)/a/0/0/1
BATTLE_SUB_DEPENDENCIES_DIR := data/battle_scripts/subscripts
BATTLE_SUB_SRCS := $(wildcard $(BATTLE_SUB_DEPENDENCIES_DIR)/*.s)
BATTLE_SUB_OBJS := $(patsubst $(BATTLE_SUB_DEPENDENCIES_DIR)/%.s,$(BATTLE_SUB_DIR)/1_%,$(BATTLE_SUB_SRCS))
$(BATTLE_SUB_DIR)/1_%:$(BATTLE_SUB_DEPENDENCIES_DIR)/%.s
$(AS) -c $< -o $(patsubst $(BATTLE_SUB_DEPENDENCIES_DIR)/%.s,$(BATTLE_SUB_OBJ_DIR)/1_%.o,$<)
$(LD) -T linker.ld -o $(patsubst $(BATTLE_SUB_DEPENDENCIES_DIR)/%.s,$(BATTLE_SUB_OBJ_DIR)/1_%_linked.o,$<) $(patsubst $(BATTLE_SUB_DEPENDENCIES_DIR)/%.s,$(BATTLE_SUB_OBJ_DIR)/1_%.o,$<)
$(OBJCOPY) -O binary $(patsubst $(BATTLE_SUB_DEPENDENCIES_DIR)/%.s,$(BATTLE_SUB_OBJ_DIR)/1_%_linked.o,$<) $@
$(BATTLE_SUB_NARC): $(BATTLE_SUB_OBJS)
$(NARCHIVE) create $@ $(BATTLE_SUB_DIR) -nf
NARC_FILES += $(BATTLE_SUB_NARC)
ITEMGFX_DIR := $(BUILD)/a018
ITEMGFX_NARC := $(BUILD_NARC)/a018.narc
ITEMGFX_TARGET := $(FILESYS)/a/0/1/8
ITEMGFX_DEPENDENCIES_DIR := data/graphics/item
ITEMGFX_SRCS := $(wildcard $(ITEMGFX_DEPENDENCIES_DIR)/*.png)
ITEMGFX_OBJS := $(patsubst $(ITEMGFX_DEPENDENCIES_DIR)/%.png,$(ITEMGFX_DIR)/9_%-00.NCGR,$(ITEMGFX_SRCS))
ITEMGFX_PALS := $(patsubst $(ITEMGFX_DEPENDENCIES_DIR)/%.png,$(ITEMGFX_DIR)/9_%-01.NCLR,$(ITEMGFX_SRCS))
$(ITEMGFX_DIR)/9_%-00.NCGR:$(ITEMGFX_DEPENDENCIES_DIR)/%.png
$(GFX) $< $@ -clobbersize -version101
$(ITEMGFX_DIR)/9_%-01.NCLR:$(ITEMGFX_DEPENDENCIES_DIR)/%.png
$(GFX) $< $@ -ir -bitdepth 4
# go overkill on the removal + support 4-digit removal, so that's fine
$(ITEMGFX_NARC): $(ITEMGFX_OBJS) $(ITEMGFX_PALS)
$(NARCHIVE) extract $(ITEMGFX_TARGET) -o $(ITEMGFX_DIR) -nf
for n in $$(seq 797 $$(expr $$(ls $(ITEMGFX_DIR) | wc -l) - 1)); do rm -f $(ITEMGFX_DIR)/8_$$n; done
for n in $$(seq 797 $$(expr $$(ls $(ITEMGFX_DIR) | wc -l) - 1)); do rm -f $(ITEMGFX_DIR)/8_$$(printf "%04d" $$n); done
$(NARCHIVE) create $@ $(ITEMGFX_DIR) -nf
NARC_FILES += $(ITEMGFX_NARC)
OVERWORLDS_DIR := $(BUILD)/pokemonow
OVERWORLDS_NARC := $(BUILD_NARC)/pokemonow.narc
OVERWORLDS_TARGET := $(FILESYS)/a/0/8/1
OVERWORLDS_DEPENDENCIES_DIR := data/graphics/overworlds
OVERWORLDS_SRCS := $(wildcard $(OVERWORLDS_DEPENDENCIES_DIR)/*.png) $(wildcard $(OVERWORLDS_DEPENDENCIES_DIR)/*.bin) $(wildcard $(OVERWORLDS_DEPENDENCIES_DIR)/*.json) $(wildcard $(OVERWORLDS_DEPENDENCIES_DIR)/*.pal)
#OVERWORLDS_SRCS := $(filter-out $(wildcard $(OVERWORLDS_DEPENDENCIES_DIR)/*_shiny.png),$(OVERWORLDS_SRCS))
OVERWORLDS_OBJS := $(patsubst $(OVERWORLDS_DEPENDENCIES_DIR)/%.png,$(OVERWORLDS_DIR)/1_%.btx0,$(OVERWORLDS_SRCS)) $(patsubst $(OVERWORLDS_DEPENDENCIES_DIR)/%.bin,$(OVERWORLDS_DIR)/1_%.bin,$(OVERWORLDS_SRCS))
#OVERWORLDS_OBJ_FILTERS := $(patsubst $(OVERWORLDS_DEPENDENCIES_DIR)/%.png,$(OVERWORLDS_DIR)/3_%,$(OVERWORLDS_SRCS))
# add your own overworld sources here
ALL_OVERWORLDS_SRCS := $(OVERWORLDS_SRCS)
ALL_OVERWORLDS_OBJS := $(OVERWORLDS_OBJS)
#$(OVERWORLDS_DIR)/2_%_shiny:$(OVERWORLDS_DEPENDENCIES_DIR)/%_shiny.png
# @:
$(OVERWORLDS_DIR)/1_%.btx0:$(OVERWORLDS_DEPENDENCIES_DIR)/%.png $(OVERWORLDS_DEPENDENCIES_DIR)/%.json $(OVERWORLDS_DEPENDENCIES_DIR)/%*.pal
$(BTX) $< $@
$(OVERWORLDS_DIR)/1_%.bin:$(OVERWORLDS_DEPENDENCIES_DIR)/%.bin
cp -f $< $@
#$(OVERWORLDS_NARC): $(ALL_OVERWORLDS_SRCS) | overworld_extract $(ALL_OVERWORLDS_OBJS)
$(OVERWORLDS_NARC): $(ALL_OVERWORLDS_SRCS) $(ALL_OVERWORLDS_OBJS)
$(NARCHIVE) create $@ $(OVERWORLDS_DIR) -nf
NARC_FILES += $(OVERWORLDS_NARC)
DEXGFX_DIR := $(BUILD)/dexgfx
DEXGFX_NARC := $(BUILD_NARC)/dexgfx.narc
DEXGFX_TARGET := $(FILESYS)/a/0/6/8
DEXGFX_DEPENDENCIES_DIR := rawdata/dex_gfx
DEXGFX_DEPENDENCIES := $(wildcard $(DEXGFX_DEPENDENCIES_DIR)/*)
$(DEXGFX_NARC): $(DEXGFX_DEPENDENCIES)
$(NARCHIVE) extract $(DEXGFX_TARGET) -o $(DEXGFX_DIR) -nf
cp -r $(DEXGFX_DEPENDENCIES_DIR)/. $(DEXGFX_DIR)
$(NARCHIVE) create $@ $(DEXGFX_DIR) -nf
NARC_FILES += $(DEXGFX_NARC)
BATTLEGFX_DIR := $(BUILD)/battlegfx
BATTLEGFX_NARC := $(BUILD_NARC)/battlegfx.narc
BATTLEGFX_TARGET := $(FILESYS)/a/0/0/8
BATTLEGFX_DEPENDENCIES_DIR := rawdata/battle_gfx
BATTLEWEATHERGFX_DEPENDENCIES_DIR := rawdata/weather_icons
BATTLEGFX_DEPENDENCIES := $(wildcard $(BATTLEGFX_DEPENDENCIES_DIR)/*) $(wildcard $(BATTLEWEATHERGFX_DEPENDENCIES_DIR)/*)
$(BATTLEGFX_NARC): $(BATTLEGFX_DEPENDENCIES)
$(NARCHIVE) extract $(BATTLEGFX_TARGET) -o $(BATTLEGFX_DIR) -nf
for n in $$(seq 346 $$(expr $$(ls $(BATTLEGFX_DIR) | wc -l) - 1)); do rm -f $(BATTLEGFX_DIR)/8_$$n; done
cp -r $(BATTLEGFX_DEPENDENCIES_DIR)/. $(BATTLEGFX_DIR)
for file in $(BATTLEWEATHERGFX_DEPENDENCIES_DIR)/*.png; do $(GFX) $$file $(BATTLEGFX_DIR)/$$(basename $$file .png)-00.NCGR; $(GFX) $$file $(BATTLEGFX_DIR)/$$(basename $$file .png)-01.NCLR -bitdepth 8 -nopad -comp 10; done
for file in $(BATTLEWEATHERGFX_DEPENDENCIES_DIR)/*_terrain.png; do $(GFX) $(BATTLEGFX_DIR)/$$(basename $$file .png)-00.NCGR $(BATTLEGFX_DIR)/$$(basename $$file .png)-00.NCGR.lz; rm $(BATTLEGFX_DIR)/$$(basename $$file .png)-00.NCGR; done
$(NARCHIVE) create $@ $(BATTLEGFX_DIR) -nf
NARC_FILES += $(BATTLEGFX_NARC)
OTHERPOKE_DIR := $(BUILD)/otherpoke
OTHERPOKE_NARC := $(BUILD_NARC)/otherpoke.narc
OTHERPOKE_TARGET := $(FILESYS)/a/1/1/4
OTHERPOKE_DEPENDENCIES_DIR := rawdata/otherpoke
OTHERPOKE_DEPENDENCIES := $(wildcard $(OTHERPOKE_DEPENDENCIES_DIR)/*)
$(OTHERPOKE_NARC): $(OTHERPOKE_DEPENDENCIES)
$(NARCHIVE) extract $(OTHERPOKE_TARGET) -o $(OTHERPOKE_DIR) -nf
@rm -f $(OTHERPOKE_DIR)/4_212 $(OTHERPOKE_DIR)/4_213
$(GFX) $(OTHERPOKE_DEPENDENCIES_DIR)/arceus-fairy-normal.pal $(OTHERPOKE_DIR)/4_212.NCLR -bitdepth 8 -nopad -comp 10
$(GFX) $(OTHERPOKE_DEPENDENCIES_DIR)/arceus-fairy-shiny.pal $(OTHERPOKE_DIR)/4_213.NCLR -bitdepth 8 -nopad -comp 10
$(NARCHIVE) create $@ $(OTHERPOKE_DIR) -nf
NARC_FILES += $(OTHERPOKE_NARC)
ENCOUNTER_DIR := $(BUILD)/a037
ENCOUNTER_NARC := $(BUILD_NARC)/encounters.narc
ENCOUNTER_TARGET := $(FILESYS)/a/0/3/7
ENCOUNTER_DEPENDENCIES := armips/data/encounters.s
$(ENCOUNTER_NARC): $(ENCOUNTER_DEPENDENCIES)
mkdir -p $(ENCOUNTER_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(ENCOUNTER_DIR) -nf
NARC_FILES += $(ENCOUNTER_NARC)
OVERWORLD_DATA_DIR := $(BUILD)/a141
OVERWORLD_DATA_NARC := $(BUILD_NARC)/overworld_properties.narc
OVERWORLD_DATA_TARGET := $(FILESYS)/a/1/4/1
OVERWORLD_DATA_DEPENDENCIES := armips/data/monoverworlds.s
$(OVERWORLD_DATA_NARC):$(OVERWORLD_DATA_DEPENDENCIES)
mkdir -p $(OVERWORLD_DATA_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(OVERWORLD_DATA_DIR) -nf
NARC_FILES += $(OVERWORLD_DATA_NARC)
SDAT_DIR := $(BUILD)/sdat
SDAT_OBJ_DIR := $(SDAT_DIR)/build
SDAT_FILES_DIR := $(SDAT_DIR)/Files
SDAT_BUILD := $(BUILD_NARC)/gs_sound_data.sdat
SDAT_TARGET := $(FILESYS)/data/sound/gs_sound_data.sdat
SDAT_DEPENDENCIES_DIR := sound/cries
SDAT_SRCS := $(wildcard $(SDAT_DEPENDENCIES_DIR)/*.wav)
SDAT_MED_OBJS := $(patsubst $(SDAT_DEPENDENCIES_DIR)/%.wav,$(SDAT_OBJ_DIR)/WAVARC/WAVE_ARC_PV%/00.swav,$(SDAT_SRCS))
SDAT_SWAR_OBJS := $(patsubst $(SDAT_DEPENDENCIES_DIR)/%.wav,$(SDAT_OBJ_DIR)/WAVARC/WAVE_ARC_PV%.swar,$(SDAT_SRCS))
$(SDAT_OBJ_DIR)/WAVARC/WAVE_ARC_PV%/00.swav:$(SDAT_DEPENDENCIES_DIR)/%.wav
mkdir -p $(SDAT_DIR) $(SDAT_OBJ_DIR) $(SDAT_OBJ_DIR)/WAVARC/WAVE_ARC_PV$$(basename "$<" .wav) $(SDAT_OBJ_DIR)/BANK build/sdat/temp
$(NTRWAVTOOL) $< $@ 16384 --adpcm-xq $(ADPCMXQ) --temp-file-dir build/sdat/temp
$(SDAT_OBJ_DIR)/WAVARC/WAVE_ARC_PV%.swar:$(SDAT_OBJ_DIR)/WAVARC/WAVE_ARC_PV%/00.swav
$(SWAV2SWAR) $< $@
# we need to unpack the sdat
# move the swav/swar/sbnk over
# reorder cries 387+ to be numerical order in the FileBlock.json and InfoBlock.json
$(SDAT_BUILD):$(SDAT_SWAR_OBJS)
$(SDATTOOL) -u $(SDAT_TARGET) $(SDAT_DIR)
cp -r $(SDAT_OBJ_DIR)/* $(SDAT_FILES_DIR)
$(PYTHON) scripts/rebuild_json.py
$(SDATTOOL) -b $@ $(SDAT_DIR)
NARC_FILES += $(SDAT_BUILD)
FONT_DIR := $(BUILD)/font
FONT_NARC := $(BUILD_NARC)/font.narc
FONT_TARGET := $(FILESYS)/a/0/1/6
FONT_DEPENDENCIES_DIR := rawdata/font
FONT_DEPENDENCIES := $(wildcard $(FONT_DEPENDENCIES_DIR)/*)
$(FONT_NARC): $(FONT_DEPENDENCIES)
$(NARCHIVE) extract $(FONT_TARGET) -o $(FONT_DIR) -nf
cp -r $(FONT_DEPENDENCIES_DIR)/. $(FONT_DIR)
$(NARCHIVE) create $@ $(FONT_DIR) -nf
NARC_FILES += $(FONT_NARC)
TEXTBOX_DIR := $(BUILD)/textbox
TEXTBOX_NARC := $(BUILD_NARC)/textbox.narc
TEXTBOX_TARGET := $(FILESYS)/a/0/3/8
TEXTBOX_DEPENDENCIES_DIR := rawdata/textbox
TEXTBOX_DEPENDENCIES := $(wildcard $(TEXTBOX_DEPENDENCIES_DIR)/*)
$(TEXTBOX_NARC): $(TEXTBOX_DEPENDENCIES)
$(NARCHIVE) extract $(TEXTBOX_TARGET) -o $(TEXTBOX_DIR) -nf
cp -r $(TEXTBOX_DEPENDENCIES_DIR)/. $(TEXTBOX_DIR)
$(NARCHIVE) create $@ $(TEXTBOX_DIR) -nf
NARC_FILES += $(TEXTBOX_NARC)
$(MSGDATA_NARC): $(MSGDATA_DEPENDENCIES) $(MSGDATA_COMPILETIME_DEPENDENCIES)
$(NARCHIVE) extract $(MSGDATA_TARGET) -o $(MSGDATA_DIR) -nf
for file in $^; do $(MSGENC) -e -c $(CHARMAP) $$file $(MSGDATA_DIR)/7_$$(basename $$file .txt); done
$(NARCHIVE) create $@ $(MSGDATA_DIR) -nf
BALL_SPA_DIR := $(BUILD)/ball_spa
BALL_SPA_NARC := $(BUILD_NARC)/ball_spa.narc
BALL_SPA_TARGET := $(FILESYS)/a/0/9/5
BALL_SPA_DEPENDENCIES_DIR := rawdata/ball_spa
BALL_SPA_DEPENDENCIES := $(wildcard $(BALL_SPA_DEPENDENCIES_DIR)/*)
$(BALL_SPA_NARC): $(BALL_SPA_DEPENDENCIES)
$(NARCHIVE) extract $(BALL_SPA_TARGET) -o $(BALL_SPA_DIR) -nf
cp -r $(BALL_SPA_DEPENDENCIES_DIR)/. $(BALL_SPA_DIR)
$(NARCHIVE) create $@ $(BALL_SPA_DIR) -nf
NARC_FILES += $(BALL_SPA_NARC)
PW_POKEGRA_DIR := $(BUILD)/pw_pokegra
PW_POKEGRA_ART_DIR := $(BUILD)/pw_pokegra_int
PW_POKEGRA_NARC := $(BUILD_NARC)/pw_pokegra.narc
PW_POKEGRA_TARGET := $(FILESYS)/a/2/5/6
PW_POKEGRA_DEPENDENCIES_DIR := data/graphics/pokewalker/sprites
PW_POKEGRA_DEPENDENCIES := $(wildcard $(PW_POKEGRA_DEPENDENCIES_DIR)/*)
PW_POKEGRA_OBJS := $(patsubst $(PW_POKEGRA_DEPENDENCIES_DIR)/%.png,$(PW_POKEGRA_DIR)/%.lz,$(PW_POKEGRA_DEPENDENCIES))
$(PW_POKEGRA_ART_DIR)/%.2bpp: $(PW_POKEGRA_DEPENDENCIES_DIR)/%.png
$(ENCODEPWIMG) 0x600 $< $@
$(PW_POKEGRA_DIR)/%.lz: $(PW_POKEGRA_ART_DIR)/%.2bpp
$(GFX) $< $@
$(PW_POKEGRA_NARC): $(PW_POKEGRA_OBJS)
$(NARCHIVE) create $@ $(PW_POKEGRA_DIR) -nf
NARC_FILES += $(PW_POKEGRA_NARC)
PW_POKEICON_DIR := $(BUILD)/pw_pokeicon
PW_POKEICON_ART_DIR := $(BUILD)/pw_pokeicon_int
PW_POKEICON_NARC := $(BUILD_NARC)/pw_pokeicon.narc
PW_POKEICON_TARGET := $(FILESYS)/a/2/4/8
PW_POKEICON_DEPENDENCIES_DIR := data/graphics/pokewalker/icons
PW_POKEICON_DEPENDENCIES := $(wildcard $(PW_POKEICON_DEPENDENCIES_DIR)/*)
PW_POKEICON_OBJS := $(patsubst $(PW_POKEICON_DEPENDENCIES_DIR)/%.png,$(PW_POKEICON_DIR)/%.lz,$(PW_POKEICON_DEPENDENCIES))
$(PW_POKEICON_ART_DIR)/%.2bpp: $(PW_POKEICON_DEPENDENCIES_DIR)/%.png
$(ENCODEPWIMG) 0x180 $< $@
$(PW_POKEICON_DIR)/%.lz: $(PW_POKEICON_ART_DIR)/%.2bpp
$(GFX) $< $@
$(PW_POKEICON_NARC): $(PW_POKEICON_OBJS)
$(NARCHIVE) create $@ $(PW_POKEICON_DIR) -nf
NARC_FILES += $(PW_POKEICON_NARC)
SCR_SEQ_DIR := $(BUILD)/a012
SCR_SEQ_NARC := $(BUILD_NARC)/scr_seq.narc
SCR_SEQ_TARGET := $(FILESYS)/a/0/1/2
SCR_SEQ_DEPENDENCIES_DIR := armips/scr_seq
SCR_SEQ_DEPENDENCIES := $(SCR_SEQ_DEPENDENCIES_DIR)/*
$(SCR_SEQ_NARC): $(SCR_SEQ_DEPENDENCIES)
$(NARCHIVE) extract $(SCR_SEQ_TARGET) -o $(SCR_SEQ_DIR) -nf
for file in $^; do $(ARMIPS) $$file; done
$(NARCHIVE) create $@ $(SCR_SEQ_DIR) -nf
# for convenience, rebuild SCR_SEQ_NARC every build so that DSPRE changes are not overwritten
.PHONY: $(SCR_SEQ_NARC)
NARC_FILES += $(SCR_SEQ_NARC)
HEADBUTT_DIR := $(BUILD)/headbutttrees
HEADBUTT_NARC := $(BUILD_NARC)/headbutt.narc
HEADBUTT_TARGET := $(FILESYS)/a/2/5/2
HEADBUTT_DEPENDENCIES := armips/data/headbutt.s
$(HEADBUTT_NARC): $(HEADBUTT_DEPENDENCIES)
mkdir -p $(HEADBUTT_DIR)
$(ARMIPS) $^
$(NARCHIVE) create $@ $(HEADBUTT_DIR) -nf
NARC_FILES += $(HEADBUTT_NARC)