-
Notifications
You must be signed in to change notification settings - Fork 8
/
gfxdefs
696 lines (582 loc) · 13.5 KB
/
gfxdefs
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
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
profile
{
id nec_pcengine_sprites
comment NEC PC Engine / TurboGrafx-16 (sprites)
chrdef chr_nec_pcengine_sprites
paldef pal_nec_pcengine
coldef col_nec_pcengine
}
profile
{
id nec_pcengine_tiles
comment NEC PC Engine / TurboGrafx-16 (tiles)
chrdef chr_nec_pcengine_tiles
paldef pal_nec_pcengine
coldef col_nec_pcengine
}
profile
{
id snk_neogeocd
comment SNK NeoGeo CD
chrdef chr_snk_neogeocd
paldef pal_snk_neogeo
coldef col_snk_neogeo
}
profile
{
id snk_neogeo
comment SNK NeoGeo
chrdef chr_snk_neogeo
paldef pal_snk_neogeo
coldef col_snk_neogeo
}
profile
{
id capcom_cps
comment Capcom CPS / CPS 2
chrdef chr_capcom_cps
paldef pal_capcom_cps
coldef col_capcom_cps_accurate
}
profile
{
id sega_ms
comment Sega Master System
chrdef chr_sega_gg
paldef pal_sega_ms
coldef col_sega_ms
}
profile
{
id sega_gg
comment Sega Game Gear
chrdef chr_sega_gg
paldef pal_sega_gg
coldef col_sega_gg
}
profile
{
id nintendo_sfc
comment Nintendo Super Famicom
chrdef chr_nintendo_sfc
paldef pal_nintendo_sfc
coldef col_nintendo_sfc
}
profile
{
id nintendo_vb
comment Nintendo Virtual Boy
chrdef chr_nintendo_vb
paldef pal_nintendo_vb
coldef col_nintendo_vb
}
profile
{
id nintendo_fc
comment Nintendo Famicom
chrdef chr_nintendo_fc
paldef pal_nintendo_fc
coldef col_nintendo_fc
}
profile
{
id nintendo_gb
comment Nintendo Game Boy
chrdef chr_nintendo_gb
paldef pal_nintendo_gb
coldef col_nintendo_gb
}
profile
{
id nintendo_gb_pocket
comment Nintendo Game Boy Pocket
chrdef chr_nintendo_gb
paldef pal_nintendo_gb
coldef col_nintendo_gb_pocket
}
profile
{
id sega_md
comment Sega Megadrive
chrdef chr_4bpp_8x8_packed
paldef pal_sega_md
coldef col_sega_md
}
#################################
##
## P A L D E F S
##
#################################
paldef
{
# 2 byte_t per color
# 16 subpalettes, 16 colors each
id pal_nec_pcengine
comment NEC PC Engine / TurgoGrafx-16
entry_datasize 16
pal_length 16
}
paldef
{
id pal_snk_neogeo
comment SNK NeoGeo
# Neo-Geo has 256 palettes (!) of 16 colors each
entry_datasize 16
pal_length 16
}
paldef
{
id pal_capcom_cps
comment Capcom CPS
# 192 palettes of 16 colors each (guessing here)
# color size is 16 bits
# palette data is stored within gfxram (0x900000 - 0x92ffff)
# however, the base address for palettes (and all gfxram components) is not constant
# you'll need to check the palette base address set in CPS-A register #6 (offset 0x0a)
# (from MAME you'll want to use the memory/:maincpu/0/00800000 view in particular)
# it's a word size value making up the MSB of the palette base address
# for example, D&D Tower of Doom has 0x91c0 in the register
# so the palettes are at 0x91c000
# length is 0x1800
entry_datasize 16
pal_length 16
}
paldef
{
id pal_sega_ms
comment Sega Master System
# 32 colors per palette, 1 byte_t per color
# 2 subpalettes, 16 colors each
entry_datasize 8
pal_length 16
}
paldef
{
id pal_sega_gg
comment Sega Game Gear
# 32 colors per palette, 2 byte_t per color
# 2 subpalettes, 16 colors each
entry_datasize 16
pal_length 16
}
paldef
{
id pal_nintendo_sfc
comment Nintendo Super Famicom
# 256 colors total
# Palette length varies by video mode
# Default is 16 palettes of 16 colors each,
# so that's what we're using here
entry_datasize 16
pal_length 16
}
paldef
{
id pal_nintendo_vb
comment Nintendo Virtual Boy
# 2 bits per color, 3 colors per palette
# palette data is 1 byte; lowest two bits ignored as padding
# 8 palettes total
entry_datasize 2
pal_length 4
# We manually specify the palette data size here since
# VB palettes are actually word length, with the upper
# byte_t ignored
pal_datasize 16
}
paldef
{
id pal_nintendo_fc
comment Nintendo Famicom
# 32 colors, each color is 1 byte; 8 palettes, 4 colors each
# (color 0 is always transparent)
entry_datasize 8
pal_length 4
}
paldef
{
id pal_nintendo_gb
comment Nintendo Game Boy
# 2 bits per color, 4 colors, packed (1 byte_t per palette)
# 3 palettes (3 bytes, stored at 0xFF47 in memory)
entry_datasize 2
pal_length 4
}
paldef
{
id pal_sega_md
comment Sega Megadrive
# 4 subpalettes of 16 colors each (64 colors total)
entry_datasize 16
pal_length 16
}
paldef
{
id pal_capcom_cps
comment Capcom CPS / CPS 2
# 192 palettes of 16 colors each (guessing here)
# color size is 16 bits
# palette data is stored within gfxram (0x900000 - 0x92ffff)
# however, the base address for palettes (and all gfxram components) is not constant
# you'll need to check the palette base address set in CPS-A register #6 (offset 0x0a)
# (from MAME you'll want to use the memory/:maincpu/0/00800000 view in particular)
# it's a word size value making up the MSB of the palette base address
# for example, D&D Tower of Doom has 0x91c0 in the register
# so the palettes are at 0x91c000
# length is 0x1800
entry_datasize 16
pal_length 16
}
#################################
##
## C H R D E F S
##
#################################
chrdef
{
id chr_nec_pcengine_tiles
comment NEC PC Engine / TurgoGrafx-16 (tiles)
# 8x8 4bpp Planar
# 2 byte_t interleaved
width 8
height 8
bpp 4
planeoffset 0, 8, 128, 136
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7
rowoffset 0, 16, 32, 48, 64, 80, 96, 112
}
chrdef
{
id chr_nec_pcengine_sprites
comment NEC PC Engine / TurgoGrafx-16 (sprites)
# 16x16 4bpp Planar
width 16
height 16
bpp 4
planeoffset 0, 256, 512, 768
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
rowoffset 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240
}
chrdef
{
id chr_snk_neogeocd
comment SNK NeoGeo CD
# 16x16 4bpp Planar
# basically the same as normal NeoGeo but the 8x8
# "subtiles" are ordered differently
# https://wiki.neogeodev.org/index.php?title=Sprite_graphics_format
width 16
height 16
bpp 4
planeoffset 8, 0, 24, 16
pixeloffset 519, 518, 517, 516, 515, 514, 513, 512, 7, 6, 5, 4, 3, 2, 1, 0
rowoffset 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480
}
chrdef
{
id chr_snk_neogeo
comment SNK NeoGeo
# 16x16 4bpp Planar
# note that your tile data (C ROMs) will need to be
# interleaved (odd|even|odd|even..., at 2 bytes each) into one file first.
# see this page: https://wiki.neogeodev.org/index.php?title=Sprite_graphics_format
width 16
height 16
bpp 4
planeoffset 0, 8, 16, 24
pixeloffset 519, 518, 517, 516, 515, 514, 513, 512, 7, 6, 5, 4, 3, 2, 1, 0
rowoffset 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480
}
chrdef
{
id chr_capcom_cps
comment Capcom CPS 1/2
# 16x16 4bpp Planar
width 16
height 16
bpp 4
#planeoffset 24, 16, 8, 0
planeoffset 0, 8, 16, 24
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7, 32, 33, 34, 35, 36, 37, 38, 39
rowoffset 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960
}
chrdef
{
id chr_sega_gg
comment Sega Game Gear, Sega Mark III, Bandai Wonderswan
# 8x8 4bpp Planar
width 8
height 8
bpp 4
planeoffset 0, 8, 16, 24
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7
rowoffset 0, 32, 64, 96, 128, 160, 192, 224
}
chrdef
{
id chr_nintendo_sfc
comment Nintendo Super Famicom, NEC PC Engine
# 8x8 4bpp planar
width 8
height 8
bpp 4
planeoffset 0, 8, 128, 136
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7
rowoffset 0, 16, 32, 48, 64, 80, 96, 112
}
chrdef
{
id chr_nintendo_vb
comment Nintendo Virtual Boy
# 8x8 2bpp Packed
width 8
height 8
bpp 2
planeoffset 0, 1
pixeloffset 6, 4, 2, 0, 14, 12, 10, 8
rowoffset 0, 16, 32, 48, 64, 80, 96, 112
}
chrdef
{
id chr_nintendo_fc
comment Nintendo Famicom
# 8x8 2bpp planar
width 8
height 8
bpp 2
planeoffset 0, 64
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7
rowoffset 0, 8, 16, 24, 32, 40, 48, 56
}
chrdef
{
id chr_nintendo_gb
comment Nintendo Game Boy, Game Boy Color, Super Famicom
# 8x8 2bpp Planar
width 8
height 8
bpp 2
planeoffset 0, 8
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7
rowoffset 0, 16, 32, 48, 64, 80, 96, 112
}
chrdef
{
id chr_4bpp_8x8_packed
comment Sega Megadrive, Sharp X68000
width 8
height 8
bpp 4
planeoffset 3, 2, 1, 0
pixeloffset 0, 4, 8, 12, 16, 20, 24, 28
rowoffset 0, 32, 64, 96, 128, 160, 192, 224
}
chrdef
{
id chr_capcom_cps
comment Capcom CPS / CPS 2
# 16x16 4bpp Planar
width 16
height 16
bpp 4
#planeoffset 24, 16, 8, 0
planeoffset 0, 8, 16, 24
pixeloffset 0, 1, 2, 3, 4, 5, 6, 7, 32, 33, 34, 35, 36, 37, 38, 39
rowoffset 0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960
}
#################################
##
## C O L D E F S
##
#################################
rgbcoldef
{
# 15| |0
# xxxxxxxG GGRRRBBB
# (little endian)
id col_nec_pcengine
comment NEC PC Engine / TurgoGrafx-16
bitdepth 3
red_shift 3
red_size 3
green_shift 6
green_size 3
blue_shift 0
blue_size 3
big_endian 0
}
rgbcoldef
{
id col_snk_neogeo
comment SNK NeoGeo
# 15 | |0
# DDR0G0B0R4R3R2R1 G4G3G2G1B4B3B2B1
# D = "dark bit", acts as shared LSB for all color components
bitdepth 6
color_passes 3
red_shift 15, 14, 8
red_size 1, 1, 4
green_shift 15, 13, 4
green_size 1, 1, 4
blue_shift 15, 12, 0
blue_size 1, 1, 4
big_endian 1
}
rgbcoldef
{
id col_capcom_cps
comment Capcom CPS 1/2
# CPS 1/2 color format
# 15 | |0
# BrBrBrBrRRRRGGGGBBBB
# 4 bits each of RGB and 4 bits of 'bright' component
# This version uses the Bright bits as
# the shared lower four bits of each color
# This makes the colors somewhat inaccurate
# as they will be slightly brighter
# However, this version is compatible with
# converting to CPS raw format as it takes
# all eight bits of data into account.
# Use this coldef if you plan to convert
# from PNG to raw CPS data
bitdepth 8
color_passes 2
red_shift 12, 8
red_size 4, 4
green_shift 12, 4
green_size 4, 4
blue_shift 12, 0
blue_size 4, 4
big_endian 1
}
rgbcoldef
{
id col_capcom_cps_accurate
comment Capcom CPS 1/2 (more accurate colors)
# CPS 1/2 color format
# 15 | |0
# BrBrBrBrRRRRGGGGBBBB
# 4 bits each of RGB and 4 bits of 'bright' component
# This version ignores the bright bits, using only
# the RGB values. The colors generated will be exact
# to the output from e.g. MAME, but this coldef
# will not convert to raw CPS data properly as the
# bright bits will not be set, and the color will be
# 'dark' from the point of view of the hardware.
# Use this coldef if you only plan to convert from
# raw CPS data to PNG images
bitdepth 4
color_passes 1
red_shift 8
red_size 4
green_shift 4
green_size 4
blue_shift 0
blue_size 4
big_endian 1
}
rgbcoldef
{
id col_sega_ms
comment Sega Master System
# 8| |0
# xxBBGGRR
bitdepth 2
red_shift 0
red_size 2
green_shift 2
green_size 2
blue_shift 4
blue_size 2
}
rgbcoldef
{
id col_sega_gg
comment Sega Game Gear
# 15| |0
# xxxxBBBB GGGGRRRR
# (little endian)
bitdepth 4
red_shift 0
red_size 4
green_shift 4
green_size 4
blue_shift 8
blue_size 4
big_endian 0
}
rgbcoldef
{
id col_nintendo_sfc
comment Nintendo Super Famicom
# 15| |0
# xBBBBBGG GGGRRRRR
bitdepth 5
color_passes 1
red_shift 0
red_size 5
green_shift 5
green_size 5
blue_shift 10
blue_size 5
big_endian 0
}
refcoldef
{
id col_nintendo_vb
comment Nintendo Virtual Boy
# VB "colors" are based on four levels of intensity
# The first level is always black, but the other
# three are variable and set by the game code
# Therefore it's impossible to make a 'standard'
# reference palette. The values below were sampled
# from Tetris 3D, which has a nice middle ground
# (based on output from MAME)
reftab #000000,#2f0000,#8f0000,#cf0000
# alternatively, here is a reference palette based
# on the Wario Land VB title screen, which leans a
# bit brighter
# reftab #000000,#3f0000,#df0000,#ff0000
}
refcoldef
{
id col_nintendo_fc
comment Nintendo Famicom
big_endian 0
# a 'standard' 2C02 PPU palette, from:
# https://wiki.nesdev.com/w/index.php/PPU_palettes
reftab #545454,#001E74,#08102C,#300088,#440064,#5C0030,#540400,#3C1800,#202A00,#083A00,#004000,#003C00,#00323C,#000000,#000000,#000000,#989698,#084CC4,#3032EC,#5C1EE4,#8814B0,#A01464,#982220,#783C00,#545A00,#287200,#087C00,#007628,#006678,#000000,#000000,#000000,#ECEEEC,#4C9AEC,#787CEC,#B062EC,#E454EC,#EC58B4,#EC6A64,#D48820,#A0AA00,#74C400,#4CD020,#38CC6C,#38B4CC,#3C3C3C,#000000,#000000,#ECEEEC,#A8CCEC,#BCBCEC,#D4B2EC,#ECAEEC,#ECAED4,#ECB4B0,#E4C490,#CCD278,#B4DE78,#A8E290,#98E2B4,#A0D6E4,#A0A2A0,#000000,#000000
# Some other palette examples: http://emulation.gametechwiki.com/index.php/Famicom_Color_Palette
}
refcoldef
{
id col_nintendo_gb
comment Nintendo Game Boy
# black & white "colors" are based on luminance only
# so we need an RGB equivalent palette
# this is based on the yellow-green tint on the original system
reftab #fffb87,#b1ae4e,#84804e,#4e4e4e
}
refcoldef
{
id col_nintendo_gb_pocket
comment Nintendo Game Boy Pocket
# this is based on the light gray/black tint of the GB Pocket screen
reftab #c4cfa1,#8b956d,#6b7353,#414141
}
rgbcoldef
{
id col_sega_md
comment Sega Megadrive
# 3 bit BGR
# 15| |0
# xxxxBBBx GGGxRRRx
bitdepth 3
red_shift 1
red_size 3
green_shift 5
green_size 3
blue_shift 9
blue_size 3
big_endian 1
}