Skip to content

Commit

Permalink
Avoid MSVC compiler bug.
Browse files Browse the repository at this point in the history
Use define instead of template for pm7500_settings<>

Co-Authored-By: joevt <[email protected]>
  • Loading branch information
dingusdev and joevt committed Jan 28, 2025
1 parent 1a7ccce commit 66f2c79
Showing 1 changed file with 29 additions and 45 deletions.
74 changes: 29 additions & 45 deletions machines/machinetnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,46 +150,30 @@ int initialize_tnt(std::string& id)
return 0;
}

template <uint32_t cpu>
static const PropMap pm7500_settings = {
{"rambank0_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank1_size",
new IntProperty(16, std::vector<uint32_t>({ 4, 8, 16, 32, 64, 128}))},
{"rambank2_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank3_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank4_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank5_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank6_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank7_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank8_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank9_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank10_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank11_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"rambank12_size",
new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))},
{"emmo",
new BinProperty(0)},
{"cpu",
new StrProperty(
cpu == PPC_VER::MPC601 ? "601" :
cpu == PPC_VER::MPC604 ? "604" :
cpu == PPC_VER::MPC604E ? "604e" :
"604e", std::vector<std::string>({"601", "604", "604e", "750"})
)
},
// If this is templated, it hits a compiler bug in MSVC, so use #define instead.
#define static_const_pm7500_settings(cpu) \
static const PropMap pm7500_settings_ ## cpu = { \
{"rambank0_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank1_size" , new IntProperty(16, std::vector<uint32_t>({ 4, 8, 16, 32, 64, 128}))}, \
{"rambank2_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank3_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank4_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank5_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank6_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank7_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank8_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank9_size" , new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank10_size", new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank11_size", new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"rambank12_size", new IntProperty( 0, std::vector<uint32_t>({0, 4, 8, 16, 32, 64, 128}))}, \
{"emmo", new BinProperty(0)}, \
{"cpu", new StrProperty(# cpu, std::vector<std::string>({"601", "604", "604e", "750"}))}, \
};

static_const_pm7500_settings(601)
static_const_pm7500_settings(604)
static_const_pm7500_settings(604e)

static std::vector<std::string> pm7500_devices = {
"Hammerhead", "Bandit1", "Chaos", "ScsiMesh", "MeshTnt", "GrandCentral",
"ControlVideo"
Expand All @@ -208,55 +192,55 @@ static const MachineDescription pm7300_descriptor = {
.name = "pm7300",
.description = "Power Macintosh 7300",
.devices = pm7500_devices,
.settings = pm7500_settings<PPC_VER::MPC604E>,
.settings = pm7500_settings_604e,
.init_func = &initialize_tnt
};

static const MachineDescription pm7500_descriptor = {
.name = "pm7500",
.description = "Power Macintosh 7500",
.devices = pm7500_devices,
.settings = pm7500_settings<PPC_VER::MPC601>,
.settings = pm7500_settings_601,
.init_func = &initialize_tnt
};

static const MachineDescription pm8500_descriptor = {
.name = "pm8500",
.description = "Power Macintosh 8500",
.devices = pm8500_devices,
.settings = pm7500_settings<PPC_VER::MPC604>,
.settings = pm7500_settings_604,
.init_func = &initialize_tnt
};

static const MachineDescription pm9500_descriptor = {
.name = "pm9500",
.description = "Power Macintosh 9500",
.devices = pm9500_devices,
.settings = pm7500_settings<PPC_VER::MPC604>,
.settings = pm7500_settings_604,
.init_func = &initialize_tnt
};

static const MachineDescription pm7600_descriptor = {
.name = "pm7600",
.description = "Power Macintosh 7600",
.devices = pm7500_devices,
.settings = pm7500_settings<PPC_VER::MPC604E>,
.settings = pm7500_settings_604e,
.init_func = &initialize_tnt
};

static const MachineDescription pm8600_descriptor = {
.name = "pm8600",
.description = "Power Macintosh 8600",
.devices = pm8500_devices,
.settings = pm7500_settings<PPC_VER::MPC604E>,
.settings = pm7500_settings_604e,
.init_func = &initialize_tnt
};

static const MachineDescription pm9600_descriptor = {
.name = "pm9600",
.description = "Power Macintosh 9600",
.devices = pm9500_devices,
.settings = pm7500_settings<PPC_VER::MPC604E>,
.settings = pm7500_settings_604e,
.init_func = &initialize_tnt
};

Expand Down

0 comments on commit 66f2c79

Please sign in to comment.