Skip to content

Commit 82220b5

Browse files
committed
namcos21: shorthand variable types
1 parent a55b81d commit 82220b5

7 files changed

Lines changed: 243 additions & 243 deletions

File tree

src/mame/namco/namcos21.cpp

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -335,46 +335,46 @@ class namcos21_state : public driver_device
335335
required_device<namco_c148_device> m_master_intc;
336336
required_device<namco_c148_device> m_slave_intc;
337337
required_device<namco_c148_device> m_gpu_intc;
338-
memory_share_creator<uint8_t> m_nvram;
338+
memory_share_creator<u8> m_nvram;
339339
required_device<c140_device> m_c140;
340340
required_device<palette_device> m_palette;
341341
required_device<screen_device> m_screen;
342342
required_memory_bank m_audiobank;
343343
required_region_ptr<u16> m_c140_region;
344-
required_shared_ptr<uint8_t> m_dpram;
344+
required_shared_ptr<u8> m_dpram;
345345
required_device<namcos21_3d_device> m_namcos21_3d;
346346
required_device<namcos21_dsp_device> m_namcos21_dsp;
347347

348-
std::unique_ptr<uint8_t[]> m_gpu_videoram;
348+
std::unique_ptr<u8[]> m_gpu_videoram;
349349

350-
uint8_t m_gpu_videoram_mask = 0;
351-
uint16_t m_gpu_color = 0;
352-
uint16_t m_gpu_register[0x10/2] = { };
350+
u8 m_gpu_videoram_mask = 0;
351+
u16 m_gpu_color = 0;
352+
u16 m_gpu_register[0x10/2] = { };
353353

354-
uint16_t dpram_word_r(offs_t offset);
355-
void dpram_word_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
356-
uint8_t dpram_byte_r(offs_t offset);
357-
void dpram_byte_w(offs_t offset, uint8_t data);
354+
u16 dpram_word_r(offs_t offset);
355+
void dpram_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
356+
u8 dpram_byte_r(offs_t offset);
357+
void dpram_byte_w(offs_t offset, u8 data);
358358

359-
uint16_t gpu_color_r();
360-
void gpu_color_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
361-
uint16_t gpu_register_r(offs_t offset);
362-
void gpu_register_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
363-
void gpu_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
364-
uint16_t gpu_videoram_r(offs_t offset);
359+
u16 gpu_color_r();
360+
void gpu_color_w(offs_t offset, u16 data, u16 mem_mask = ~0);
361+
u16 gpu_register_r(offs_t offset);
362+
void gpu_register_w(offs_t offset, u16 data, u16 mem_mask = ~0);
363+
void gpu_videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
364+
u16 gpu_videoram_r(offs_t offset);
365365

366-
void nvram_w(offs_t offset, uint8_t data) { m_nvram[offset] = data; }
367-
uint8_t nvram_r(offs_t offset) { return m_nvram[offset]; }
366+
void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; }
367+
u8 nvram_r(offs_t offset) { return m_nvram[offset]; }
368368

369-
void sound_bankselect_w(uint8_t data);
369+
void sound_bankselect_w(u8 data);
370370

371-
void sound_reset_w(uint8_t data);
372-
void system_reset_w(uint8_t data);
371+
void sound_reset_w(u8 data);
372+
void system_reset_w(u8 data);
373373
void reset_all_subcpus(int state);
374374

375375
TIMER_DEVICE_CALLBACK_MEMBER(screen_scanline);
376376

377-
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
377+
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
378378

379379
void bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect);
380380

@@ -388,36 +388,36 @@ class namcos21_state : public driver_device
388388

389389
void namcos21_state::video_start()
390390
{
391-
m_gpu_videoram = make_unique_clear<uint8_t[]>(0x80000);
391+
m_gpu_videoram = make_unique_clear<u8[]>(0x80000);
392392
save_pointer(NAME(m_gpu_videoram), 0x80000);
393393
}
394394

395-
uint16_t namcos21_state::gpu_color_r()
395+
u16 namcos21_state::gpu_color_r()
396396
{
397397
return m_gpu_color;
398398
}
399399

400-
void namcos21_state::gpu_color_w(offs_t offset, uint16_t data, uint16_t mem_mask)
400+
void namcos21_state::gpu_color_w(offs_t offset, u16 data, u16 mem_mask)
401401
{
402402
COMBINE_DATA(&m_gpu_color);
403403
}
404404

405-
uint16_t namcos21_state::gpu_register_r(offs_t offset)
405+
u16 namcos21_state::gpu_register_r(offs_t offset)
406406
{
407407
return m_gpu_register[offset];
408408
}
409409

410-
void namcos21_state::gpu_register_w(offs_t offset, uint16_t data, uint16_t mem_mask)
410+
void namcos21_state::gpu_register_w(offs_t offset, u16 data, u16 mem_mask)
411411
{
412412
m_screen->update_partial(m_screen->vpos());
413413
COMBINE_DATA(&m_gpu_register[offset]);
414414
}
415415

416-
void namcos21_state::gpu_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
416+
void namcos21_state::gpu_videoram_w(offs_t offset, u16 data, u16 mem_mask)
417417
{
418418
// it always does word access
419419
m_gpu_videoram_mask = data & 0xff;
420-
uint8_t color = data >> 8;
420+
u8 color = data >> 8;
421421

422422
for (int i = 0; i < 8; i++)
423423
{
@@ -426,7 +426,7 @@ void namcos21_state::gpu_videoram_w(offs_t offset, uint16_t data, uint16_t mem_m
426426
}
427427
}
428428

429-
uint16_t namcos21_state::gpu_videoram_r(offs_t offset)
429+
u16 namcos21_state::gpu_videoram_r(offs_t offset)
430430
{
431431
return (m_gpu_videoram[offset] << 8) | m_gpu_videoram_mask;
432432
}
@@ -441,14 +441,14 @@ void namcos21_state::bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect
441441
printf("| %04x\n", m_gpu_color);
442442
#endif
443443

444-
int const yscroll = -cliprect.top() + (int16_t)m_gpu_register[1];
444+
int const yscroll = -cliprect.top() + (s16)m_gpu_register[1];
445445
int const xscroll = m_gpu_register[0] & 0xff;
446446
int const base = 0x1000 | (m_gpu_color << 8 & 0xf00);
447447

448448
for (int sy = cliprect.top(); sy <= cliprect.bottom(); sy++)
449449
{
450-
uint8_t const *const pSource = &m_gpu_videoram[((yscroll + sy) & 0x3ff) * 0x200];
451-
uint16_t *const pDest = &bitmap.pix(sy);
450+
u8 const *const pSource = &m_gpu_videoram[((yscroll + sy) & 0x3ff) * 0x200];
451+
u16 *const pDest = &bitmap.pix(sy);
452452
for (int sx = cliprect.left(); sx <= cliprect.right(); sx++)
453453
{
454454
int const pen = pSource[(sx + xscroll) & 0x1ff];
@@ -481,7 +481,7 @@ void namcos21_state::bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect
481481
}
482482

483483

484-
uint32_t namcos21_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
484+
u32 namcos21_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
485485
{
486486
bitmap.fill((m_gpu_color << 8 & 0xf00) | 0xff, cliprect);
487487

@@ -512,23 +512,23 @@ uint32_t namcos21_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
512512

513513
// dual port ram memory handlers
514514

515-
uint16_t namcos21_state::dpram_word_r(offs_t offset)
515+
u16 namcos21_state::dpram_word_r(offs_t offset)
516516
{
517517
return m_dpram[offset];
518518
}
519519

520-
void namcos21_state::dpram_word_w(offs_t offset, uint16_t data, uint16_t mem_mask)
520+
void namcos21_state::dpram_word_w(offs_t offset, u16 data, u16 mem_mask)
521521
{
522522
if (ACCESSING_BITS_0_7)
523523
m_dpram[offset] = data & 0xff;
524524
}
525525

526-
uint8_t namcos21_state::dpram_byte_r(offs_t offset)
526+
u8 namcos21_state::dpram_byte_r(offs_t offset)
527527
{
528528
return m_dpram[offset];
529529
}
530530

531-
void namcos21_state::dpram_byte_w(offs_t offset, uint8_t data)
531+
void namcos21_state::dpram_byte_w(offs_t offset, u8 data)
532532
{
533533
m_dpram[offset] = data;
534534
}
@@ -707,12 +707,12 @@ static INPUT_PORTS_START( winrungp )
707707
PORT_DIPSETTING( 0x00, "4M" )
708708
INPUT_PORTS_END
709709

710-
void namcos21_state::sound_bankselect_w(uint8_t data)
710+
void namcos21_state::sound_bankselect_w(u8 data)
711711
{
712712
m_audiobank->set_entry(data >> 4);
713713
}
714714

715-
void namcos21_state::sound_reset_w(uint8_t data)
715+
void namcos21_state::sound_reset_w(u8 data)
716716
{
717717
if (data & 0x01)
718718
{
@@ -726,7 +726,7 @@ void namcos21_state::sound_reset_w(uint8_t data)
726726
}
727727
}
728728

729-
void namcos21_state::system_reset_w(uint8_t data)
729+
void namcos21_state::system_reset_w(u8 data)
730730
{
731731
reset_all_subcpus(data & 1 ? CLEAR_LINE : ASSERT_LINE);
732732
}
@@ -752,7 +752,7 @@ void namcos21_state::machine_reset()
752752

753753
void namcos21_state::machine_start()
754754
{
755-
uint32_t max = memregion("audiocpu")->bytes() / 0x4000;
755+
u32 max = memregion("audiocpu")->bytes() / 0x4000;
756756
for (int i = 0; i < 0x10; i++)
757757
m_audiobank->configure_entry(i, memregion("audiocpu")->base() + (i % max) * 0x4000);
758758

src/mame/namco/namcos21_3d.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Namco System 21 3D Rasterizer
1717

1818
DEFINE_DEVICE_TYPE(NAMCOS21_3D, namcos21_3d_device, "namcos21_3d", "Namco System 21 3D Rasterizer")
1919

20-
namcos21_3d_device::namcos21_3d_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
20+
namcos21_3d_device::namcos21_3d_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
2121
device_t(mconfig, NAMCOS21_3D, tag, owner, clock),
2222
m_fixed_palbase(-1),
2323
m_zz_shift(10),
@@ -39,11 +39,11 @@ void namcos21_3d_device::allocate_poly_framebuffer()
3939
if (m_framebuffer_size_in_bytes == 0)
4040
fatalerror("m_framebuffer_size_in_bytes == 0\n");
4141

42-
m_mpPolyFrameBufferZ = make_unique_clear<uint16_t[]>(m_framebuffer_size_in_bytes / 2);
43-
m_mpPolyFrameBufferPens = make_unique_clear<uint16_t[]>(m_framebuffer_size_in_bytes / 2);
42+
m_mpPolyFrameBufferZ = make_unique_clear<u16[]>(m_framebuffer_size_in_bytes / 2);
43+
m_mpPolyFrameBufferPens = make_unique_clear<u16[]>(m_framebuffer_size_in_bytes / 2);
4444

45-
m_mpPolyFrameBufferZ2 = make_unique_clear<uint16_t[]>(m_framebuffer_size_in_bytes / 2);
46-
m_mpPolyFrameBufferPens2 = make_unique_clear<uint16_t[]>(m_framebuffer_size_in_bytes / 2);
45+
m_mpPolyFrameBufferZ2 = make_unique_clear<u16[]>(m_framebuffer_size_in_bytes / 2);
46+
m_mpPolyFrameBufferPens2 = make_unique_clear<u16[]>(m_framebuffer_size_in_bytes / 2);
4747

4848
swap_and_clear_poly_framebuffer();
4949
swap_and_clear_poly_framebuffer();
@@ -77,9 +77,9 @@ void namcos21_3d_device::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, con
7777
/* blit the visible framebuffer */
7878
for (int sy = clip.top(); sy <= clip.bottom(); sy++)
7979
{
80-
uint16_t *const dest = &bitmap.pix(sy);
81-
uint16_t const *const pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy;
82-
uint16_t const *const pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy;
80+
u16 *const dest = &bitmap.pix(sy);
81+
u16 const *const pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy;
82+
u16 const *const pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy;
8383
for (int sx = clip.left(); sx <= clip.right(); sx++)
8484
{
8585
int z = pZ[sx];
@@ -99,8 +99,8 @@ void namcos21_3d_device::renderscanline_flat(const edge *e1, const edge *e2, int
9999
if (e1->x > e2->x)
100100
std::swap(e1, e2);
101101

102-
uint16_t *pDest = m_mpPolyFrameBufferPens.get() + sy * m_poly_frame_width;
103-
uint16_t *pZBuf = m_mpPolyFrameBufferZ.get() + sy * m_poly_frame_width;
102+
u16 *pDest = m_mpPolyFrameBufferPens.get() + sy * m_poly_frame_width;
103+
u16 *pZBuf = m_mpPolyFrameBufferZ.get() + sy * m_poly_frame_width;
104104
int x0 = (int)e1->x;
105105
int x1 = (int)e2->x;
106106
int w = x1 - x0;
@@ -119,7 +119,7 @@ void namcos21_3d_device::renderscanline_flat(const edge *e1, const edge *e2, int
119119

120120
for (int x = x0; x < x1; x++)
121121
{
122-
uint16_t zz = (uint16_t)z;
122+
u16 zz = (u16)z;
123123
if (zz < pZBuf[x])
124124
{
125125
int pen = color;
@@ -253,7 +253,7 @@ void namcos21_3d_device::rendertri(const n21_vertex *v0, const n21_vertex *v1, c
253253
}
254254
}
255255

256-
void namcos21_3d_device::blit_single_quad(int sx[4], int sy[4], int zcode[4], uint16_t color)
256+
void namcos21_3d_device::blit_single_quad(int sx[4], int sy[4], int zcode[4], u16 color)
257257
{
258258
int depthcueenable = 1;
259259
// 0x0000..0x1fff sprite palettes (0x20 sets of 0x100 colors)
@@ -294,42 +294,42 @@ void namcos21_3d_device::blit_single_quad(int sx[4], int sy[4], int zcode[4], ui
294294
rendertri(&c, &d, &a, color, depthcueenable);
295295
}
296296

297-
void namcos21_3d_device::draw_direct_quad(const uint16_t *source, uint16_t color)
297+
void namcos21_3d_device::draw_direct_quad(const u16 *source, u16 color)
298298
{
299299
int sx[4], sy[4], zcode[4];
300300

301301
for (int i = 0; i < 4; i++)
302302
{
303-
sx[i] = m_poly_frame_width/2 + (int16_t)*source++;
304-
sy[i] = m_poly_frame_height/2 + (int16_t)*source++;
303+
sx[i] = m_poly_frame_width/2 + (s16)*source++;
304+
sy[i] = m_poly_frame_height/2 + (s16)*source++;
305305
zcode[i] = *source++;
306306
}
307307

308308
blit_single_quad(sx, sy, zcode, color);
309309
}
310310

311-
void namcos21_3d_device::draw_quads(const uint16_t *source, const uint8_t *pointram, const uint32_t ptram_size, uint32_t quad_idx)
311+
void namcos21_3d_device::draw_quads(const u16 *source, const u8 *pointram, const u32 ptram_size, u32 quad_idx)
312312
{
313-
const uint32_t ptram_mask = ptram_size - 1;
313+
const u32 ptram_mask = ptram_size - 1;
314314
quad_idx = (quad_idx * 6) & ptram_mask;
315315

316316
int sx[4], sy[4], zcode[4];
317317

318318
for (int count = 0; count < ptram_size / 6; count++)
319319
{
320-
uint8_t code = pointram[quad_idx];
320+
u8 code = pointram[quad_idx];
321321
quad_idx = (quad_idx + 1) & ptram_mask;
322322

323-
uint16_t color = pointram[quad_idx] | (code << 8);
323+
u16 color = pointram[quad_idx] | (code << 8);
324324
quad_idx = (quad_idx + 1) & ptram_mask;
325325

326326
for (int i = 0; i < 4; i++)
327327
{
328-
uint8_t vi = pointram[quad_idx];
328+
u8 vi = pointram[quad_idx];
329329
quad_idx = (quad_idx + 1) & ptram_mask;
330330

331-
sx[i] = m_poly_frame_width/2 + (int16_t)source[vi * 3 + 0];
332-
sy[i] = m_poly_frame_height/2 + (int16_t)source[vi * 3 + 1];
331+
sx[i] = m_poly_frame_width/2 + (s16)source[vi * 3 + 0];
332+
sy[i] = m_poly_frame_height/2 + (s16)source[vi * 3 + 1];
333333
zcode[i] = source[vi * 3 + 2];
334334
}
335335

src/mame/namco/namcos21_3d.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class namcos21_3d_device : public device_t
99
{
1010
public:
11-
namcos21_3d_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
11+
namcos21_3d_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
1212

1313
// config
1414
void set_fixed_palbase(int base) { m_fixed_palbase = base; }
@@ -19,14 +19,14 @@ class namcos21_3d_device : public device_t
1919
{
2020
m_poly_frame_width = width;
2121
m_poly_frame_height = height;
22-
m_framebuffer_size_in_bytes = sizeof(uint16_t)*m_poly_frame_width*m_poly_frame_height;
22+
m_framebuffer_size_in_bytes = sizeof(u16)*m_poly_frame_width*m_poly_frame_height;
2323
}
2424

2525
void copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const rectangle &cliprect, int zlo, int zhi);
2626
void swap_and_clear_poly_framebuffer();
2727

28-
void draw_direct_quad(const uint16_t *source, uint16_t color);
29-
void draw_quads(const uint16_t *source, const uint8_t *pointram, const uint32_t ptram_size, uint32_t quad_idx);
28+
void draw_direct_quad(const u16 *source, u16 color);
29+
void draw_quads(const u16 *source, const u8 *pointram, const u32 ptram_size, u32 quad_idx);
3030

3131
protected:
3232
// device-level overrides
@@ -47,13 +47,13 @@ class namcos21_3d_device : public device_t
4747

4848
void renderscanline_flat(const edge *e1, const edge *e2, int sy, unsigned color, int depthcueenable);
4949
void rendertri(const n21_vertex *v0, const n21_vertex *v1, const n21_vertex *v2, unsigned color, int depthcueenable);
50-
void blit_single_quad(int sx[4], int sy[4], int zcode[4], uint16_t color);
50+
void blit_single_quad(int sx[4], int sy[4], int zcode[4], u16 color);
5151
void allocate_poly_framebuffer();
5252

53-
std::unique_ptr<uint16_t[]> m_mpPolyFrameBufferPens;
54-
std::unique_ptr<uint16_t[]> m_mpPolyFrameBufferZ;
55-
std::unique_ptr<uint16_t[]> m_mpPolyFrameBufferPens2;
56-
std::unique_ptr<uint16_t[]> m_mpPolyFrameBufferZ2;
53+
std::unique_ptr<u16[]> m_mpPolyFrameBufferPens;
54+
std::unique_ptr<u16[]> m_mpPolyFrameBufferZ;
55+
std::unique_ptr<u16[]> m_mpPolyFrameBufferPens2;
56+
std::unique_ptr<u16[]> m_mpPolyFrameBufferZ2;
5757

5858
int m_fixed_palbase;
5959
int m_zz_shift, m_zzmult;

0 commit comments

Comments
 (0)