Example #1
0
        private void ExecuteMAMEThread()
        {
            // dodge GC
            periodicCallback = MAMEPeriodicCallback;
            soundCallback    = MAMESoundCallback;
            bootCallback     = MAMEBootCallback;
            logCallback      = MAMELogCallback;

            LibMAME.mame_set_periodic_callback(periodicCallback);
            LibMAME.mame_set_sound_callback(soundCallback);
            LibMAME.mame_set_boot_callback(bootCallback);
            LibMAME.mame_set_log_callback(logCallback);

            // https://docs.mamedev.org/commandline/commandline-index.html
            string[] args = new string[] {
                "mame"                                                 // dummy, internally discarded by index, so has to go first
                , gameFilename                                         // no dash for rom names
                , "-noreadconfig"                                      // forbid reading any config files
                , "-norewind"                                          // forbid rewind savestates (captured upon frame advance)
                , "-skip_gameinfo"                                     // forbid this blocking screen that requires user input
                , "-nothrottle"                                        // forbid throttling to "real" speed of the device
                , "-update_in_pause"                                   // ^ including frame-advancing
                , "-rompath", gameDirectory                            // mame doesn't load roms from full paths, only from dirs to scan
                , "-volume", "-32"                                     // lowest attenuation means mame osd remains silent
                , "-output", "console"                                 // print everyting to hawk console
                , "-samplerate", sampleRate.ToString()                 // match hawk samplerate
                , "-video", "none"                                     // forbid mame window altogether
                , "-keyboardprovider", "none"
                , "-mouseprovider", "none"
                , "-lightgunprovider", "none"
                , "-joystickprovider", "none"
            };

            LibMAME.mame_launch(args.Length, args);
        }
Example #2
0
        private void ExecuteMAMEThread()
        {
            _periodicCallback = MAMEPeriodicCallback;
            _soundCallback    = MAMESoundCallback;
            _bootCallback     = MAMEBootCallback;
            _logCallback      = MAMELogCallback;

            LibMAME.mame_set_periodic_callback(_periodicCallback);
            LibMAME.mame_set_sound_callback(_soundCallback);
            LibMAME.mame_set_boot_callback(_bootCallback);
            LibMAME.mame_set_log_callback(_logCallback);

            // https://docs.mamedev.org/commandline/commandline-index.html
            List <string> args = new List <string>
            {
                "mame"                                                  // dummy, internally discarded by index, so has to go first
                , _gameFileName                                         // no dash for rom names
                , "-noreadconfig"                                       // forbid reading ini files
                , "-nowriteconfig"                                      // forbid writing ini files
                , "-norewind"                                           // forbid rewind savestates (captured upon frame advance)
                , "-skip_gameinfo"                                      // forbid this blocking screen that requires user input
                , "-nothrottle"                                         // forbid throttling to "real" speed of the device
                , "-update_in_pause"                                    // ^ including frame-advancing
                , "-rompath", _gameDirectory                            // mame doesn't load roms from full paths, only from dirs to scan
                , "-joystick_contradictory"                             // allow L+R/U+D on digital joystick
                , "-nonvram_save"                                       // prevent dumping non-volatile ram to disk
                , "-artpath", "mame\\artwork"                           // path to load artowrk from
                , "-diff_directory", "mame\\diff"                       // hdd diffs, whenever stuff is written back to an image
                , "-cfg_directory", "?"                                 // send invalid path to prevent cfg handling
                , "-volume", "-32"                                      // lowest attenuation means mame osd remains silent
                , "-output", "console"                                  // print everything to hawk console
                , "-samplerate", _sampleRate.ToString()                 // match hawk samplerate
                , "-video", "none"                                      // forbid mame window altogether
                , "-keyboardprovider", "none"
                , "-mouseprovider", "none"
                , "-lightgunprovider", "none"
                , "-joystickprovider", "none"
                //	, "-debug"                              // launch mame debugger (because we can)
            };

            if (_syncSettings.DriverSettings.TryGetValue(
                    MAMELuaCommand.MakeLookupKey(_gameFileName.Split('.')[0], LibMAME.BIOS_LUA_CODE),
                    out string value))
            {
                args.AddRange(new[] { "-bios", value });
            }

            LibMAME.mame_launch(args.Count, args.ToArray());
        }
Example #3
0
        private void ExecuteMAMEThread()
        {
            // dodge GC
            _periodicCallback = MAMEPeriodicCallback;
            _soundCallback    = MAMESoundCallback;
            _bootCallback     = MAMEBootCallback;
            _logCallback      = MAMELogCallback;

            LibMAME.mame_set_periodic_callback(_periodicCallback);
            LibMAME.mame_set_sound_callback(_soundCallback);
            LibMAME.mame_set_boot_callback(_bootCallback);
            LibMAME.mame_set_log_callback(_logCallback);

            // https://docs.mamedev.org/commandline/commandline-index.html
            string[] args =
            {
                "mame"                                                  // dummy, internally discarded by index, so has to go first
                , _gameFilename                                         // no dash for rom names
                , "-noreadconfig"                                       // forbid reading ini files
                , "-nowriteconfig"                                      // forbid writing ini files
                , "-norewind"                                           // forbid rewind savestates (captured upon frame advance)
                , "-skip_gameinfo"                                      // forbid this blocking screen that requires user input
                , "-nothrottle"                                         // forbid throttling to "real" speed of the device
                , "-update_in_pause"                                    // ^ including frame-advancing
                , "-rompath", _gameDirectory                            // mame doesn't load roms from full paths, only from dirs to scan
                , "-joystick_contradictory"                             // L+R/U+D on digital joystick
                , "-nonvram_save"                                       // prevent dumping non-volatile ram to disk
                , "-artpath", "mame\\artwork"                           // path to load artowrk from
                , "-diff_directory", "mame\\diff"                       // hdd diffs, whenever stuff is written back to an image
                , "-cfg_directory", ":"                                 // send invalid path to prevent cfg handling
                , "-volume", "-32"                                      // lowest attenuation means mame osd remains silent
                , "-output", "console"                                  // print everything to hawk console
                , "-samplerate", _sampleRate.ToString()                 // match hawk samplerate
                , "-video", "none"                                      // forbid mame window altogether
                , "-keyboardprovider", "none"
                , "-mouseprovider", "none"
                , "-lightgunprovider", "none"
                , "-joystickprovider", "none"
            };

            LibMAME.mame_launch(args.Length, args);
        }