Esempio n. 1
0
        public static void get_general_warnings(ref string buf, running_machine machine, machine_flags.type flags, device_t_feature_type unemulated, device_t_feature_type imperfect)  //void get_general_warnings(std::ostream &buf, running_machine &machine, machine_flags::type flags, device_t::feature_type unemulated, device_t::feature_type imperfect)
        {
            // add a warning if any ROMs were loaded with warnings
            bool bad_roms = false;

            if (machine.rom_load().warnings() > 0)
            {
                bad_roms = true;
                buf     += __("One or more ROMs/CHDs for this machine are incorrect. The machine may not run correctly.\n");
            }
            if (!machine.rom_load().software_load_warnings_message().empty())
            {
                bad_roms = true;
                buf     += machine.rom_load().software_load_warnings_message();
            }

            // if we have at least one warning flag, print the general header
            if ((machine.rom_load().knownbad() > 0) || (flags & (MACHINE_ERRORS | MACHINE_WARNINGS | MACHINE_BTANB)) != 0 || unemulated != 0 || imperfect != 0)
            {
                if (bad_roms)
                {
                    buf += '\n';
                }
                buf += __("There are known problems with this machine\n\n");
            }

            // add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP
            if (machine.rom_load().knownbad() > 0)
            {
                buf += __("One or more ROMs/CHDs for this machine have not been correctly dumped.\n");
            }
        }
Esempio n. 2
0
        public void device_scheduler_after_ctor(running_machine machine)
        {
            // ED: there's a circular dependency with device_scheduler.  it creates a emu_timer, which calls machine.time().  so we null check here to fix that.


            // append a single never-expiring timer so there is always one in the list
            m_timer_list = m_timer_allocator.alloc().init(machine, null, null, true);
            m_timer_list.adjust(attotime.never);
        }
Esempio n. 3
0
        public widgets_manager(running_machine machine)
        {
            m_hilight_bitmap       = new bitmap_ptr(256, 1);
            m_hilight_texture      = null; //, m_hilight_texture(nullptr, machine.render())
            m_hilight_main_bitmap  = new bitmap_ptr(1, 128);
            m_hilight_main_texture = null; //, m_hilight_main_texture(nullptr, machine.render())
            m_arrow_texture        = null; //, m_arrow_texture(nullptr, machine.render())


            render_manager render = machine.render();

            // create a texture for hilighting items
            for (UInt32 x = 0; x < 256; ++x)
            {
                UInt32 alpha = ((x < 25) ? (0xff * x / 25) : (x > (256 - 25)) ? (0xff * (255 - x) / 25) : 0xff);
                //m_hilight_bitmap->pix32(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff);
                RawBuffer m_hilight_bitmapBuf;
                UInt32    m_hilight_bitmapOffset = m_hilight_bitmap.pix32(out m_hilight_bitmapBuf, 0, (int)x);
                m_hilight_bitmapBuf.set_uint32((int)m_hilight_bitmapOffset, new rgb_t((byte)alpha, 0xff, 0xff, 0xff));
            }

            m_hilight_texture = render.texture_alloc();  //m_hilight_texture.reset(render.texture_alloc());
            m_hilight_texture.set_bitmap(m_hilight_bitmap, m_hilight_bitmap.cliprect(), texture_format.TEXFORMAT_ARGB32);

            // create a texture for hilighting items in main menu
            for (UInt32 y = 0; y < 128; ++y)
            {
                UInt32 r1 = 0;
                UInt32 g1 = 169;
                UInt32 b1 = 255; // any start color
                UInt32 r2 = 0;
                UInt32 g2 = 39;
                UInt32 b2 = 130; // any stop color
                UInt32 r  = r1 + (y * (r2 - r1) / 128);
                UInt32 g  = g1 + (y * (g2 - g1) / 128);
                UInt32 b  = b1 + (y * (b2 - b1) / 128);
                //m_hilight_main_bitmap->pix32(y, 0) = rgb_t(r, g, b);
                RawBuffer m_hilight_main_bitmapBuf;
                UInt32    m_hilight_main_bitmapOffset = m_hilight_main_bitmap.pix32(out m_hilight_main_bitmapBuf, (int)y, 0);
                m_hilight_main_bitmapBuf.set_uint32((int)m_hilight_main_bitmapOffset, new rgb_t((byte)r, (byte)g, (byte)b));
            }

            m_hilight_main_texture = render.texture_alloc();  //m_hilight_main_texture.reset(render.texture_alloc());
            m_hilight_main_texture.set_bitmap(m_hilight_main_bitmap, m_hilight_main_bitmap.cliprect(), texture_format.TEXFORMAT_ARGB32);

            // create a texture for arrow icons
            m_arrow_texture = render.texture_alloc(render_triangle);  //m_arrow_texture.reset(render.texture_alloc(render_triangle));
        }
Esempio n. 4
0
        attoseconds_t m_quantum_minimum;                                                           // duration of minimum quantum


        // construction/destruction

        //-------------------------------------------------
        //  device_scheduler - constructor
        //-------------------------------------------------
        public device_scheduler(running_machine machine)
        {
            m_machine  = machine;
            m_basetime = attotime.zero;
            m_callback_timer_expire_time = attotime.zero;
            m_suspend_changes_pending    = true;
            m_quantum_minimum            = attotime.ATTOSECONDS_IN_NSEC(1) / 1000;

            // append a single never-expiring timer so there is always one in the list
            //m_timer_list = m_timer_allocator.alloc().init(machine, null, null, true);
            //m_timer_list.adjust(attotime.never);

            // register global states
            machine.save().save_item(m_basetime, "m_basetime");
            machine.save().register_presave(presave);
            machine.save().register_postload(postload);
        }
Esempio n. 5
0
        public widgets_manager(running_machine machine)
        {
            m_hilight_bitmap       = new bitmap_ptr(256, 1);
            m_hilight_texture      = null; //, m_hilight_texture(nullptr, machine.render())
            m_hilight_main_bitmap  = new bitmap_ptr(1, 128);
            m_hilight_main_texture = null; //, m_hilight_main_texture(nullptr, machine.render())
            m_arrow_texture        = null; //, m_arrow_texture(nullptr, machine.render())


            render_manager render = machine.render();

            // create a texture for hilighting items
            for (unsigned x = 0; x < 256; ++x)
            {
                unsigned alpha = ((x < 25) ? (0xff * x / 25) : (x > (256 - 25)) ? (0xff * (255 - x) / 25) : 0xff);
                m_hilight_bitmap.pix(0, (int32_t)x)[0] = new rgb_t((uint8_t)alpha, 0xff, 0xff, 0xff);  //m_hilight_bitmap->pix(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff);
            }

            m_hilight_texture = render.texture_alloc();  //m_hilight_texture.reset(render.texture_alloc());
            m_hilight_texture.set_bitmap(m_hilight_bitmap, m_hilight_bitmap.cliprect(), texture_format.TEXFORMAT_ARGB32);

            // create a texture for hilighting items in main menu
            for (unsigned y = 0; y < 128; ++y)
            {
                unsigned r1 = 0;
                unsigned g1 = 169;
                unsigned b1 = 255; // any start color
                unsigned r2 = 0;
                unsigned g2 = 39;
                unsigned b2 = 130; // any stop color
                unsigned r  = r1 + (y * (r2 - r1) / 128);
                unsigned g  = g1 + (y * (g2 - g1) / 128);
                unsigned b  = b1 + (y * (b2 - b1) / 128);
                m_hilight_main_bitmap.pix((int32_t)y, 0)[0] = new rgb_t((uint8_t)r, (uint8_t)g, (uint8_t)b);  //m_hilight_main_bitmap->pix(y, 0) = rgb_t(r, g, b);
            }

            m_hilight_main_texture = render.texture_alloc();  //m_hilight_main_texture.reset(render.texture_alloc());
            m_hilight_main_texture.set_bitmap(m_hilight_main_bitmap, m_hilight_main_bitmap.cliprect(), texture_format.TEXFORMAT_ARGB32);

            // create a texture for arrow icons
            m_arrow_texture = render.texture_alloc(render_triangle);  //m_arrow_texture.reset(render.texture_alloc(render_triangle));
        }
Esempio n. 6
0
        public static void get_system_warnings(ref string buf, running_machine machine, machine_flags.type flags, device_t_feature_type unemulated, device_t_feature_type imperfect)
        {
            // start with the unemulated/imperfect features
            get_device_warnings(ref buf, unemulated, imperfect);

            // add one line per machine warning flag
            if ((flags & machine_flags.type.NO_COCKTAIL) != 0)
            {
                buf += __("Screen flipping in cocktail mode is not supported.\n");
            }
            if ((flags & machine_flags.type.REQUIRES_ARTWORK) != 0)
            {
                buf += __("This machine requires external artwork files.\n");
            }
            if ((flags & machine_flags.type.IS_INCOMPLETE) != 0)
            {
                buf += __("This machine was never completed. It may exhibit strange behavior or missing elements that are not bugs in the emulation.\n");
            }
            if ((flags & machine_flags.type.NO_SOUND_HW) != 0)
            {
                buf += __("This machine has no sound hardware, MAME will produce no sounds, this is expected behaviour.\n");
            }

            // these are more severe warnings
            if ((flags & machine_flags.type.NOT_WORKING) != 0)
            {
                buf += __("\nTHIS MACHINE DOESN'T WORK. The emulation for this machine is not yet complete. There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n");
            }
            if ((flags & machine_flags.type.MECHANICAL) != 0)
            {
                buf += __("\nElements of this machine cannot be emulated as they require physical interaction or consist of mechanical devices. It is not possible to fully experience this machine.\n");
            }

            if ((flags & MACHINE_ERRORS) != 0 || ((machine.system().type.unemulated_features() | machine.system().type.imperfect_features()) & device_t_feature.type.PROTECTION) != 0)
            {
                // find the parent of this driver
                driver_enumerator drivlist = new driver_enumerator(machine.options());
                int maindrv  = driver_list.find(machine.system());
                int clone_of = driver_list.non_bios_clone((size_t)maindrv);
                if (clone_of != -1)
                {
                    maindrv = clone_of;
                }

                // scan the driver list for any working clones and add them
                bool foundworking = false;
                while (drivlist.next())
                {
                    if (drivlist.current() == maindrv || drivlist.clone() == maindrv)
                    {
                        game_driver driver = drivlist.driver();
                        if ((driver.flags & MACHINE_ERRORS) == 0 && ((driver.type.unemulated_features() | driver.type.imperfect_features()) & device_t_feature.type.PROTECTION) == 0)
                        {
                            // this one works, add a header and display the name of the clone
                            if (!foundworking)
                            {
                                util.stream_format(ref buf, __("\n\nThere are working clones of this machine: {0}"), driver.name);
                            }
                            else
                            {
                                util.stream_format(ref buf, __(", {0}"), driver.name);
                            }

                            foundworking = true;
                        }
                    }
                }

                if (foundworking)
                {
                    buf += '\n';
                }
            }
        }
Esempio n. 7
0
 //-------------------------------------------------
 //  machine_info - constructor
 //-------------------------------------------------
 public machine_info(running_machine machine)
     : base(((mame_ui_manager)machine.ui()).options(), machine.config(), machine.ioport().ports())
 {
     m_machine = machine;
 }
Esempio n. 8
0
File: info.cs Progetto: kwanboy/mcs
 //-------------------------------------------------
 //  machine_info - constructor
 //-------------------------------------------------
 public machine_info(running_machine machine)
     : base(machine.config(), machine.ioport().ports())
 {
     m_machine = machine;
 }
Esempio n. 9
0
        public override void init(running_machine machine)
        {
            // call our parent
            base.init(machine);

            set_verbose(true);

            string stemp;
            osd_options_WinForms options = (osd_options_WinForms)machine.options();

            // determine if we are benchmarking, and adjust options appropriately
            int bench = options.bench();
            if (bench > 0)
            {
                options.set_value(emu_options.OPTION_THROTTLE, 0, OPTION_PRIORITY_MAXIMUM);
                options.set_value(osd_options.OSDOPTION_SOUND, "none", OPTION_PRIORITY_MAXIMUM);
                options.set_value(osd_options.OSDOPTION_VIDEO, "none", OPTION_PRIORITY_MAXIMUM);
                options.set_value(emu_options.OPTION_SECONDS_TO_RUN, bench, OPTION_PRIORITY_MAXIMUM);
            }

            // determine if we are profiling, and adjust options appropriately
            int profile = options.profile();
            if (profile > 0)
            {
                options.set_value(emu_options.OPTION_THROTTLE, 0, OPTION_PRIORITY_MAXIMUM);
                options.set_value(osd_options.OSDOPTION_NUMPROCESSORS, 1, OPTION_PRIORITY_MAXIMUM);
            }

#if false
            // thread priority
            if ((machine.debug_flags_get() & running_machine.DEBUG_FLAG_OSD_ENABLED) == 0)
                SetThreadPriority(GetCurrentThread(), options.priority());
#endif

            // get number of processors
            stemp = options.numprocessors();

#if false
            osd_num_processors = 0;

            if (stemp != "auto")
            {
                osd_num_processors = Convert.ToInt32(stemp);
                if (osd_num_processors < 1)
                {
                    osdcore_global.m_osdcore.osd_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n");
                    osd_num_processors = 0;
                }
            }
#endif

            // initialize the subsystems
            init_subsystems();

#if false
            // notify listeners of screen configuration
            string tempstring;
            for (win_window_info info = win_window_list; info != null; info = info.m_next)
            {
                string tmp = utf8_from_tstring(info.m_monitor.info.szDevice);
                string tempstring = string.Format("Orientation({0})", tmp);
                output_set_value(tempstring, info.m_targetorient);
                //osd_free(tmp);
            }
#endif


            // hook up the debugger log
            if (options.oslog())
                machine.add_logerror_callback(osdcore_interface.osd_printf_debug);


#if false
            // crank up the multimedia timer resolution to its max
            // this gives the system much finer timeslices
            timeresult = timeGetDevCaps(&timecaps, sizeof(timecaps));
            if (timeresult == TIMERR_NOERROR)
                timeBeginPeriod(timecaps.wPeriodMin);
#endif

#if false
            // if a watchdog thread is requested, create one
            int watchdog = options.watchdog();
            if (watchdog != 0)
            {
                watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL);
                emucore_global.assert_always(watchdog_reset_event != null, "Failed to create watchdog reset event");
                watchdog_exit_event = CreateEvent(NULL, TRUE, FALSE, NULL);
                emucore_global.assert_always(watchdog_exit_event != null, "Failed to create watchdog exit event");
                watchdog_thread = CreateThread(NULL, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, NULL);
                emucore_global.assert_always(watchdog_thread != null, "Failed to create watchdog thread");
            }
#endif

#if false
            // create and start the profiler
            if (profile > 0)
            {
                profiler = new sampling_profiler(1000, profile - 1));
                profiler.start();
            }
#endif

#if false
            // initialize sockets
            win_init_sockets();
#endif

#if false
            // note the existence of a machine
            g_current_machine = &machine; 
#endif


            /////////////////////////////////////////////
            // custom code below

            validity_checker valid = new validity_checker(machine.options());
            valid.set_validate_all(true);
            string sysname = machine.options().system_name();
            bool result = valid.check_all_matching(string.IsNullOrEmpty(sysname) ? "*" : sysname);
            if (!result)
                throw new emu_fatalerror(main_global.EMU_ERR_FAILED_VALIDITY, "Validity check failed ({0} errors, {1} warnings in total)\n", valid.errors(), valid.warnings());
            valid.Dispose();

            /**
             *  Save away the machine, we'll need it in osd_customize_input_type_list
             **/
            //g_state.machine = machine;
    
            /**
             * Create the render_target that tells MAME the rendering parameters it
             * will use.
             **/
            m_target = machine.render().target_alloc();


            /**
             * Have this target hold every view since we only support one target
             **/
            m_target.set_view(m_target.configured_view("auto", 0, 1));

            /**
             * Set render target bounds to 10000 x 10000 and allow the callback to
             * scale that to whatever they want.
             **/
            //m_target.set_bounds(640, 480, 1.0f);
            m_target.set_bounds(400, 400, 1.0f);


            screenbufferptr = new RawBufferPointer(screenbuffer);


            {
                keyboard_state = new intref[(int)input_item_id.ITEM_ID_ABSOLUTE_MAXIMUM];
                for (int i = 0; i < (int)input_item_id.ITEM_ID_ABSOLUTE_MAXIMUM; i++)
                    keyboard_state[i] = new intref();

                input_device keyboard_device;
                keyboard_device = machine.input().device_class(input_device_class.DEVICE_CLASS_KEYBOARD).add_device("Keyboard", "Keyboard0");
                if (keyboard_device == null)
                    throw new emu_fatalerror("osd_interface.init() - FAILED - add_device() failed\n");

                foreach (var entry in mameForm.Form1.keymap)
                {
                    string defname = entry.Key.ToString();  //string.Format("Scan{0}", count++);
                    input_item_id itemid = entry.Value;
                    keyboard_device.add_item(defname, itemid, keyboard_get_state, keyboard_state[(int)itemid]);
                }
            }


            {
                mouse_axis_state = new intref[2];
                for (int i = 0; i < 2; i++)
                    mouse_axis_state[i] = new intref();

                input_device mouse_device;
                mouse_device = machine.input().device_class(input_device_class.DEVICE_CLASS_MOUSE).add_device("Mouse", "Mouse0");
                if (mouse_device == null)
                    throw new emu_fatalerror("osd_interface.init() - FAILED - add_device() failed\n");

                string defname;
                defname = string.Format("X {0}", mouse_device.name());
                mouse_device.add_item(defname, input_item_id.ITEM_ID_XAXIS, mouse_axis_get_state, mouse_axis_state[0]);
                defname = string.Format("Y {0}", mouse_device.name());
                mouse_device.add_item(defname, input_item_id.ITEM_ID_YAXIS, mouse_axis_get_state, mouse_axis_state[1]);


                mouse_button_state = new intref[5];
                for (int i = 0; i < 5; i++)
                    mouse_button_state[i] = new intref();

                defname = string.Format("B1");
                mouse_device.add_item(defname, input_item_id.ITEM_ID_BUTTON1, mouse_button_get_state, mouse_button_state[0]);
                defname = string.Format("B2");
                mouse_device.add_item(defname, input_item_id.ITEM_ID_BUTTON2, mouse_button_get_state, mouse_button_state[1]);
                defname = string.Format("B3");
                mouse_device.add_item(defname, input_item_id.ITEM_ID_BUTTON3, mouse_button_get_state, mouse_button_state[2]);
                defname = string.Format("B4");
                mouse_device.add_item(defname, input_item_id.ITEM_ID_BUTTON4, mouse_button_get_state, mouse_button_state[3]);
                defname = string.Format("B5");
                mouse_device.add_item(defname, input_item_id.ITEM_ID_BUTTON5, mouse_button_get_state, mouse_button_state[4]);
            }


            //System.Windows.Forms.Application.Run(new mameForm.Form1());
            //System.Windows.Forms.Form mainForm = new mameForm.Form1();
            //mainForm.FormClosed += (_sender, _args) => { System.Windows.Forms.Application.ExitThread(); };
            //mainForm.Show();

            //Console.WriteLine("After Show()");
        }