#include "emu.h" int main(int argc, char* argv[]) { // Initialize the MAME engine bool result = cli_frontend_init(argc, argv, osd_interface()); // Get the first available machine running_machine* machine = &machine_manager().first(); // Start the machine machine->start(); // Run the machine while (machine->run(false)) {} // Shut down the MAME engine cli_frontend_exit(); return 0; }
#include "emu.h" int main(int argc, char* argv[]) { // Initialize the MAME engine bool result = cli_frontend_init(argc, argv, osd_interface()); // Get the first available machine running_machine* machine = &machine_manager().first(); // Access ROMs const rom_entry* roms = machine->system().rom; // Access Input Devices ioport_list* ioports = machine->ioport(); // Access Sound Devices device_sound_interface* sound = machine->sound(); // Shut down the MAME engine cli_frontend_exit(); return 0; }In this example, we again initialize and exit the MAME engine using the command-line interface. We then get the first available machine. Once we have the machine, we can access various parts of it using the running_machine class. We can access the ROMs using the system() method which returns a description of the system. We can access the input devices using the ioport() method which returns a list of input ports. We can access the sound devices using the sound() method which returns a sound interface. Package library: MAME (Multiple Arcade Machine Emulator)