#include namespace MegaDrive { Interface* interface = nullptr; Settings settings; Interface::Interface() { interface = this; information.manufacturer = "Sega"; information.name = "Mega Drive"; information.width = 320; //1280 information.height = 240; // 480 information.overscan = true; information.aspectRatio = 4.0 / 3.0; information.resettable = true; information.capability.states = false; information.capability.cheats = false; media.append({ID::MegaDrive, "Mega Drive", "md"}); Port controllerPort1{ID::Port::Controller1, "Controller Port 1"}; Port controllerPort2{ID::Port::Controller2, "Controller Port 2"}; { Device device{ID::Device::Gamepad, "Gamepad"}; device.inputs.append({0, "Up" }); device.inputs.append({0, "Down" }); device.inputs.append({0, "Left" }); device.inputs.append({0, "Right"}); device.inputs.append({0, "A" }); device.inputs.append({0, "B" }); device.inputs.append({0, "C" }); device.inputs.append({0, "X" }); device.inputs.append({0, "Y" }); device.inputs.append({0, "Z" }); device.inputs.append({0, "Start"}); controllerPort1.devices.append(device); controllerPort2.devices.append(device); } ports.append(move(controllerPort1)); ports.append(move(controllerPort2)); } auto Interface::manifest() -> string { return cartridge.manifest(); } auto Interface::title() -> string { return cartridge.title(); } auto Interface::videoFrequency() -> double { return 60.0; } auto Interface::videoColors() -> uint32 { return 1 << 9; } auto Interface::videoColor(uint32 color) -> uint64 { uint B = color.bits(0,2); uint G = color.bits(3,5); uint R = color.bits(6,8); uint64 r = image::normalize(R, 3, 16); uint64 g = image::normalize(G, 3, 16); uint64 b = image::normalize(B, 3, 16); return r << 32 | g << 16 | b << 0; } auto Interface::audioFrequency() -> double { return 52'000.0; } auto Interface::loaded() -> bool { return system.loaded(); } auto Interface::load(uint id) -> bool { return system.load(); } auto Interface::save() -> void { system.save(); } auto Interface::unload() -> void { system.unload(); } auto Interface::power() -> void { system.power(); } auto Interface::reset() -> void { system.reset(); } auto Interface::run() -> void { system.run(); } auto Interface::serialize() -> serializer { return {}; } auto Interface::unserialize(serializer& s) -> bool { return false; } auto Interface::cap(const string& name) -> bool { return false; } auto Interface::get(const string& name) -> any { return {}; } auto Interface::set(const string& name, const any& value) -> bool { return false; } }