Skip to content

Commit

Permalink
-dynax/dynax.cpp: More I/O improvements:
Browse files Browse the repository at this point in the history
* Replaced hjingi hopper hack with a hopper device.
* Improved DIP switch labels for mjembase and hooked up hopper.
* Improved a few DIP switch labels for mjelctrn.

-Fixed some more #include guards and added a CI task to check them in
 src/devices and src/mame.
  • Loading branch information
cuavas committed Nov 27, 2024
1 parent 33a3404 commit 958d52f
Show file tree
Hide file tree
Showing 26 changed files with 340 additions and 452 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/includeguards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Check #incude guargs'

on:
push:
paths:
- '.github/workflows/**'
- 'src/devices/**.h'
- 'src/mame/**.h'
pull_request:
- '.github/workflows/**'
- 'src/devices/**.h'
- 'src/mame/**.h'

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Validate
run: python3 scripts/build/check_include_guards.py src/devices src/mame
47 changes: 47 additions & 0 deletions scripts/build/check_include_guards.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/python3
##
## icense:BSD-3-Clause
## copyright-holders:Vas Crabb

import io
import os
import os.path
import re
import sys


def pathsplit(p):
result = [ ]
while p:
d, n = os.path.split(p)
if not n:
result.insert(0, d)
break
else:
result.insert(0, n)
p = d
return result


if __name__ == '__main__':
extpat = re.compile('.+\\.(h|hpp)$')
substpat = re.compile('[-.]')
guardpat = re.compile('^ *# *ifndef +([^\s]+)(\s+.*)?')
bad = False
for root in sys.argv[1:]:
for path, subdirs, files in os.walk(root):
prefix = 'MAME_' + '_'.join([n.upper() for n in pathsplit(os.path.relpath(path, root))]) + '_'
for f in files:
if extpat.match(f):
expected = prefix + substpat.sub('_', f.upper())
fp = os.path.join(path, f)
with io.open(fp, 'r', encoding='utf-8') as fd:
for l in fd:
m = guardpat.match(l)
if m:
if m.group(1) != expected:
sys.stderr.write('%s: #include guard does not appear to match expected %s\n' % (fp, expected))
bad = True
break
if bad:
sys.exit(1)
6 changes: 3 additions & 3 deletions src/devices/machine/dp8573a.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz

#ifndef MAME_MACHINE_DP8573_H
#define MAME_MACHINE_DP8573_H
#ifndef MAME_MACHINE_DP8573A_H
#define MAME_MACHINE_DP8573A_H

#pragma once

Expand Down Expand Up @@ -70,4 +70,4 @@ class dp8572a_device : public dp8573a_device
DECLARE_DEVICE_TYPE(DP8572A, dp8572a_device)
DECLARE_DEVICE_TYPE(DP8573A, dp8573a_device)

#endif // MAME_MACHINE_DP8573_H
#endif // MAME_MACHINE_DP8573A_H
6 changes: 3 additions & 3 deletions src/devices/sound/iopspu.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*
*/

#ifndef MAME_MACHINE_IOPSPU_H
#define MAME_MACHINE_IOPSPU_H
#ifndef MAME_SOUND_IOPSPU_H
#define MAME_SOUND_IOPSPU_H

#pragma once

Expand Down Expand Up @@ -98,4 +98,4 @@ class iop_spu_device : public device_t, public device_sound_interface

DECLARE_DEVICE_TYPE(SONYIOP_SPU, iop_spu_device)

#endif // MAME_MACHINE_IOPSPU_H
#endif // MAME_SOUND_IOPSPU_H
6 changes: 3 additions & 3 deletions src/devices/sound/meg.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//
// Audio dsp dedicated to effects generation, part of the SWP20 lineup

#ifndef DEVICES_SOUND_MEG_H
#define DEVICES_SOUND_MEG_H
#ifndef MAME_SOUND_MEG_H
#define MAME_SOUND_MEG_H

#pragma once

Expand Down Expand Up @@ -68,4 +68,4 @@ class meg_device : public device_t

DECLARE_DEVICE_TYPE(MEG, meg_device)

#endif
#endif // MAME_SOUND_MEG_H
6 changes: 3 additions & 3 deletions src/devices/sound/nes_apu_vt.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood

#ifndef MAME_AUDIO_NES_VT_APU_H
#define MAME_AUDIO_NES_VT_APU_H
#ifndef MAME_SOUND_NES_APU_VT_H
#define MAME_SOUND_NES_APU_VT_H

#pragma once

Expand All @@ -23,4 +23,4 @@ class nes_apu_vt_device : public nesapu_device
private:
};

#endif // MAME_AUDIO_NES_VT_APU_H
#endif // MAME_SOUND_NES_APU_VT_H
6 changes: 3 additions & 3 deletions src/devices/sound/nn71003f.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// Nippon Steel Corp NN71003F mpeg audio decoder

#ifndef DEVICES_SOUND_NN71003F_H
#define DEVICES_SOUND_NN71003F_H
#ifndef MAME_SOUND_NN71003F_H
#define MAME_SOUND_NN71003F_H

#pragma once

Expand Down Expand Up @@ -39,4 +39,4 @@ class nn71003f_device : public device_t, public device_sound_interface

DECLARE_DEVICE_TYPE(NN71003F, nn71003f_device)

#endif
#endif // MAME_SOUND_NN71003F_H
13 changes: 3 additions & 10 deletions src/devices/sound/rp2c33_snd.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
***************************************************************************/

#ifndef MAME_MACHINE_RP2C33_SND_H
#define MAME_MACHINE_RP2C33_SND_H
#ifndef MAME_SOUND_RP2C33_SND_H
#define MAME_SOUND_RP2C33_SND_H

#pragma once

Expand Down Expand Up @@ -95,11 +95,4 @@ class rp2c33_sound_device : public device_t, public device_sound_interface
// device type definition
DECLARE_DEVICE_TYPE(RP2C33_SOUND, rp2c33_sound_device)



//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************


#endif // MAME_MACHINE_RP2C33_SND_H
#endif // MAME_SOUND_RP2C33_SND_H
6 changes: 3 additions & 3 deletions src/devices/sound/segapcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
/* SEGA 8bit PCM */
/*********************************************************/

#ifndef MAMESOUND_SEGAPCM_H
#define MAMESOUND_SEGAPCM_H
#ifndef MAME_SOUND_SEGAPCM_H
#define MAME_SOUND_SEGAPCM_H

#pragma once

Expand Down Expand Up @@ -56,4 +56,4 @@ class segapcm_device : public device_t,

DECLARE_DEVICE_TYPE(SEGAPCM, segapcm_device)

#endif // MAMESOUND_SEGAPCM_H
#endif // MAME_SOUND_SEGAPCM_H
6 changes: 3 additions & 3 deletions src/devices/sound/swp00.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// Yamaha SWP00, rompler/dsp combo

#ifndef DEVICES_SOUND_SWP00_H
#define DEVICES_SOUND_SWP00_H
#ifndef MAME_SOUND_SWP00_H
#define MAME_SOUND_SWP00_H

#pragma once

Expand Down Expand Up @@ -247,4 +247,4 @@ class swp00_device : public device_t, public device_sound_interface, public devi

DECLARE_DEVICE_TYPE(SWP00, swp00_device)

#endif
#endif // MAME_SOUND_SWP00_H
6 changes: 3 additions & 3 deletions src/devices/sound/swp20.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// Yamaha SWP20, rompler

#ifndef DEVICES_SOUND_SWP20_H
#define DEVICES_SOUND_SWP20_H
#ifndef MAME_SOUND_SWP20_H
#define MAME_SOUND_SWP20_H

#pragma once

Expand Down Expand Up @@ -72,4 +72,4 @@ class swp20_device : public device_t, public device_sound_interface, public devi

DECLARE_DEVICE_TYPE(SWP20, swp20_device)

#endif
#endif // MAME_SOUND_SWP20_H
6 changes: 3 additions & 3 deletions src/devices/sound/swp30.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// Yamaha SWP30/30B, rompler/dsp combo

#ifndef DEVICES_SOUND_SWP30_H
#define DEVICES_SOUND_SWP30_H
#ifndef MAME_SOUND_SWP30_H
#define MAME_SOUND_SWP30_H

#pragma once

Expand Down Expand Up @@ -239,4 +239,4 @@ class swp30_device : public cpu_device, public device_sound_interface, public sw

DECLARE_DEVICE_TYPE(SWP30, swp30_device)

#endif
#endif // MAME_SOUND_SWP30_H
6 changes: 3 additions & 3 deletions src/devices/sound/swp30d.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//
// Disassembler

#ifndef DEVICES_SOUND_SWP30D_H
#define DEVICES_SOUND_SWP30D_H
#ifndef MAME_SOUND_SWP30D_H
#define MAME_SOUND_SWP30D_H

#pragma once

Expand Down Expand Up @@ -36,4 +36,4 @@ class swp30_disassembler : public util::disasm_interface
static inline void append(std::string &r, const std::string &e);
};

#endif
#endif // MAME_SOUND_SWP30D_H
6 changes: 3 additions & 3 deletions src/devices/sound/swx00.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// Yamaha SWX00, rompler/dsp/cpu combo, audio support

#ifndef DEVICES_SOUND_SWX00_H
#define DEVICES_SOUND_SWX00_H
#ifndef MAME_SOUND_SWX00_H
#define MAME_SOUND_SWX00_H

#pragma once

Expand Down Expand Up @@ -123,4 +123,4 @@ class swx00_sound_device : public device_t, public device_sound_interface, publi

DECLARE_DEVICE_TYPE(SWX00_SOUND, swx00_sound_device)

#endif
#endif // MAME_SOUND_SWX00_H
6 changes: 3 additions & 3 deletions src/devices/sound/vgm_visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
***************************************************************************/

#ifndef MAME_SOUND_VGMVIZ_H
#define MAME_SOUND_VGMVIZ_H
#ifndef MAME_SOUND_VGM_VISUALIZER_H
#define MAME_SOUND_VGM_VISUALIZER_H

#pragma once

Expand Down Expand Up @@ -137,4 +137,4 @@ class vgmviz_device : public device_t, public device_mixer_interface
static const bool NEEDS_FFT[VIZ_COUNT];
};

#endif // MAME_SOUND_VGMVIZ_H
#endif // MAME_SOUND_VGM_VISUALIZER_H
6 changes: 3 additions & 3 deletions src/devices/video/ati_mach32.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Created on: 16/05/2014
*/

#ifndef MAME_BUS_ISA_MACH32_H
#define MAME_BUS_ISA_MACH32_H
#ifndef MAME_VIDEO_ATI_MACH32_H
#define MAME_VIDEO_ATI_MACH32_H

#pragma once

Expand Down Expand Up @@ -240,4 +240,4 @@ DECLARE_DEVICE_TYPE(ATIMACH32_8514A, mach32_8514a_device)
DECLARE_DEVICE_TYPE(ATIMACH64, mach64_device)
DECLARE_DEVICE_TYPE(ATIMACH64_8514A, mach64_8514a_device)

#endif // MAME_BUS_ISA_MACH32_H
#endif // MAME_VIDEO_ATI_MACH32_H
6 changes: 3 additions & 3 deletions src/devices/video/ati_mach8.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Barry Rodewald

#ifndef MAME_VIDEO_MACH8_H
#define MAME_VIDEO_MACH8_H
#ifndef MAME_VIDEO_ATI_MACH8_H
#define MAME_VIDEO_ATI_MACH8_H

#pragma once

Expand Down Expand Up @@ -82,4 +82,4 @@ class mach8_device : public ibm8514a_device
// device type definition
DECLARE_DEVICE_TYPE(MACH8, mach8_device)

#endif // MAME_VIDEO_MACH8_H
#endif // MAME_VIDEO_ATI_MACH8_H
13 changes: 3 additions & 10 deletions src/devices/video/imagetek_i4100.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
***************************************************************************/

#ifndef MAME_VIDEO_I4100_H
#define MAME_VIDEO_I4100_H
#ifndef MAME_VIDEO_IMAGETEK_I4100_H
#define MAME_VIDEO_IMAGETEK_I4100_H

#pragma once

Expand Down Expand Up @@ -266,11 +266,4 @@ DECLARE_DEVICE_TYPE(I4100, imagetek_i4100_device)
DECLARE_DEVICE_TYPE(I4220, imagetek_i4220_device)
DECLARE_DEVICE_TYPE(I4300, imagetek_i4300_device)



//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************


#endif // MAME_VIDEO_I4100_H
#endif // MAME_VIDEO_IMAGETEK_I4100_H
6 changes: 3 additions & 3 deletions src/devices/video/mb90082.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
***************************************************************************/

#ifndef MAME_VIDEO_MB90082DEV_H
#define MAME_VIDEO_MB90082DEV_H
#ifndef MAME_VIDEO_MB90082_H
#define MAME_VIDEO_MB90082_H

#pragma once

Expand Down Expand Up @@ -68,4 +68,4 @@ class mb90082_device : public device_t,
// device type definition
DECLARE_DEVICE_TYPE(MB90082, mb90082_device)

#endif // MAME_VIDEO_MB90082DEV_H
#endif // MAME_VIDEO_MB90082_H
6 changes: 3 additions & 3 deletions src/devices/video/pc_vga_alliance.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:

#ifndef MAME_VIDEO_PC_VGA_PROMOTION_H
#define MAME_VIDEO_PC_VGA_PROMOTION_H
#ifndef MAME_VIDEO_PC_VGA_ALLIANCE_H
#define MAME_VIDEO_PC_VGA_ALLIANCE_H

#pragma once

Expand Down Expand Up @@ -37,4 +37,4 @@ class promotion_vga_device : public svga_device

DECLARE_DEVICE_TYPE(PROMOTION_VGA, promotion_vga_device)

#endif // MAME_VIDEO_PC_VGA_PROMOTION_H
#endif // MAME_VIDEO_PC_VGA_ALLIANCE_H
Loading

0 comments on commit 958d52f

Please sign in to comment.