Previous 199869 Revisions Next

r31516 Tuesday 5th August, 2014 at 08:47:49 UTC by Miodrag Milanović
(OSD BRANCH) window to osd_interface (nw)
[/branches/osd/src/osd]osdepend.c osdepend.h
[/branches/osd/src/osd/sdl]osdsdl.h video.c window.c window.h
[/branches/osd/src/osd/windows]video.c window.c window.h winmain.h

branches/osd/src/osd/osdepend.h
r31515r31516
171171
172172   virtual bool video_init();
173173   virtual void video_register();
174   virtual bool window_init();
174175
175176   bool sound_init();
176177   virtual void sound_register();
r31515r31516
185186
186187   void exit_subsystems();
187188   virtual void video_exit();
189   virtual void window_exit();
188190   void sound_exit();
189191   virtual void input_exit();
190192   virtual void output_exit();
branches/osd/src/osd/windows/video.c
r31515r31516
7777   init_monitors();
7878
7979   // initialize the window system so we can make windows
80   winwindow_init(machine());
80   window_init();
8181
8282   // create the windows
8383   windows_options &options = downcast<windows_options &>(machine().options());
r31515r31516
9696
9797void windows_osd_interface::video_exit()
9898{
99   window_exit();
100   
99101   // free all of our monitor information
100102   while (win_monitor_list != NULL)
101103   {
branches/osd/src/osd/windows/window.c
r31515r31516
117117//  PROTOTYPES
118118//============================================================
119119
120static void winwindow_exit(running_machine &machine);
121120static void winwindow_video_window_destroy(win_window_info *window);
122121static void draw_video_contents(win_window_info *window, HDC dc, int update);
123122
r31515r31516
181180
182181
183182//============================================================
184//  winwindow_init
183//  window_init
185184//  (main thread)
186185//============================================================
187186
188void winwindow_init(running_machine &machine)
187bool windows_osd_interface::window_init()
189188{
190189   size_t temp;
191190
192191   // determine if we are using multithreading or not
193   multithreading_enabled = downcast<windows_options &>(machine.options()).multithreading();
192   multithreading_enabled = downcast<windows_options &>(machine().options()).multithreading();
194193
195194   // get the main thread ID before anything else
196195   main_threadid = GetCurrentThreadId();
197196
198   // ensure we get called on the way out
199   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winwindow_exit), &machine));
200
201197   // set up window class and register it
202198   create_window_class();
203199
r31515r31516
234230   // initialize the drawers
235231   if (video_config.mode == VIDEO_MODE_D3D)
236232   {
237      if (drawd3d_init(machine, &draw))
233      if (drawd3d_init(machine(), &draw))
238234         video_config.mode = VIDEO_MODE_GDI;
239235   }
240236   if (video_config.mode == VIDEO_MODE_DDRAW)
241237   {
242      if (drawdd_init(machine, &draw))
238      if (drawdd_init(machine(), &draw))
243239         video_config.mode = VIDEO_MODE_GDI;
244240   }
245241   if (video_config.mode == VIDEO_MODE_GDI)
246      drawgdi_init(machine, &draw);
242      drawgdi_init(machine(), &draw);
247243   if (video_config.mode == VIDEO_MODE_NONE)
248      drawnone_init(machine, &draw);
244      drawnone_init(machine(), &draw);
249245
250246   // set up the window list
251247   last_window_ptr = &win_window_list;
248   
249   return true;
252250}
253251
254252
r31515r31516
258256//  (main thread)
259257//============================================================
260258
261static void winwindow_exit(running_machine &machine)
259void windows_osd_interface::window_exit()
262260{
263261   assert(GetCurrentThreadId() == main_threadid);
264262
branches/osd/src/osd/windows/winmain.h
r31515r31516
261261   virtual void debugger_register();
262262
263263   virtual bool video_init();
264   virtual bool window_init();
264265   virtual bool input_init();
265266   virtual void input_pause();
266267   virtual void input_resume();
r31515r31516
270271   #endif
271272
272273   virtual void video_exit();
274   virtual void window_exit();
273275   virtual void input_exit();
274276   virtual void output_exit();
275277   #ifdef USE_NETWORK
branches/osd/src/osd/windows/window.h
r31515r31516
110110//  PROTOTYPES
111111//============================================================
112112
113// core initialization
114void winwindow_init(running_machine &machine);
115
116113// creation/deletion of windows
117114void winwindow_video_window_create(running_machine &machine, int index, win_monitor_info *monitor, const win_window_config *config);
118115
branches/osd/src/osd/osdepend.c
r31515r31516
417417   return true;
418418}
419419
420bool osd_interface::window_init()
421{
422   return true;
423}
424
420425bool osd_interface::sound_init()
421426{
422427   osd_sound_type sound = m_sound_options.find(machine().options().sound());
r31515r31516
495500{
496501}
497502
503void osd_interface::window_exit()
504{
505}
506
498507void osd_interface::sound_exit()
499508{
500509   global_free(m_sound);
branches/osd/src/osd/sdl/window.c
r31515r31516
114114//  PROTOTYPES
115115//============================================================
116116
117static void sdlwindow_exit(running_machine &machine);
118117static void sdlwindow_video_window_destroy(running_machine &machine, sdl_window_info *window);
119118static OSDWORK_CALLBACK( draw_video_contents_wt );
120119static OSDWORK_CALLBACK( sdlwindow_video_window_destroy_wt );
r31515r31516
202201
203202
204203//============================================================
205//  win_init_window
204//  window_init
206205//  (main thread)
207206//============================================================
208207
209int sdlwindow_init(running_machine &machine)
208bool sdl_osd_interface::window_init()
210209{
211210   osd_printf_verbose("Enter sdlwindow_init\n");
212211   // determine if we are using multithreading or not
213   multithreading_enabled = downcast<sdl_options &>(machine.options()).multithreading();
212   multithreading_enabled = downcast<sdl_options &>(machine().options()).multithreading();
214213
215214   // get the main thread ID before anything else
216215   main_threadid = SDL_ThreadID();
217216
218   // ensure we get called on the way out
219   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sdlwindow_exit), &machine));
220
221217   // if multithreading, create a thread to run the windows
222218   if (multithreading_enabled)
223219   {
224220      // create a thread to run the windows from
225221      work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_IO);
226222      if (work_queue == NULL)
227         return 1;
223         return false;
228224      osd_work_item_queue(work_queue, &sdlwindow_thread_id, NULL, WORK_ITEM_FLAG_AUTO_RELEASE);
229225   }
230226   else
r31515r31516
238234#if USE_OPENGL
239235   if (video_config.mode == VIDEO_MODE_OPENGL)
240236   {
241      if (drawogl_init(machine, &draw))
237      if (drawogl_init(machine(), &draw))
242238         video_config.mode = VIDEO_MODE_SOFT;
243239   }
244240#endif
245241#if SDLMAME_SDL2
246242   if (video_config.mode == VIDEO_MODE_SDL13)
247243   {
248      if (draw13_init(machine, &draw))
244      if (draw13_init(machine(), &draw))
249245         video_config.mode = VIDEO_MODE_SOFT;
250246   }
251247#endif
252248   if (video_config.mode == VIDEO_MODE_SOFT)
253249   {
254250      if (drawsdl_init(&draw))
255         return 1;
251         return false;
256252   }
257253
258254   // set up the window list
259255   last_window_ptr = &sdl_window_list;
260256   osd_printf_verbose("Leave sdlwindow_init\n");
261   return 0;
257   return true;
262258}
263259
264260
r31515r31516
296292}
297293
298294
299static void sdlwindow_exit(running_machine &machine)
295void sdl_osd_interface::window_exit()
300296{
301297   ASSERT_MAIN_THREAD();
302298
r31515r31516
307303   {
308304      sdl_window_info *temp = sdl_window_list;
309305      sdl_window_list = temp->next;
310      sdlwindow_video_window_destroy(machine, temp);
306      sdlwindow_video_window_destroy(machine(), temp);
311307   }
312308
313309   // if we're multithreaded, clean up the window thread
branches/osd/src/osd/sdl/window.h
r31515r31516
119119//  PROTOTYPES
120120//============================================================
121121
122// core initialization
123int sdlwindow_init(running_machine &machine);
124
125122// creation/deletion of windows
126123int sdlwindow_video_window_create(running_machine &machine, int index, sdl_monitor_info *monitor, const sdl_window_config *config);
127124void sdlwindow_video_window_update(running_machine &machine, sdl_window_info *window);
branches/osd/src/osd/sdl/osdsdl.h
r31515r31516
201201   virtual void debugger_register();
202202
203203   virtual bool video_init();
204   virtual bool window_init();
204205   virtual bool input_init();
205206   virtual void input_pause();
206207   virtual void input_resume();
r31515r31516
210211   #endif
211212
212213   virtual void video_exit();
214   virtual void window_exit();
213215   virtual void input_exit();
214216   virtual void output_exit();
215217   #ifdef USE_NETWORK
branches/osd/src/osd/sdl/video.c
r31515r31516
109109   video_config.beamwidth = machine().options().beam();
110110
111111   // initialize the window system so we can make windows
112   if (sdlwindow_init(machine()))
112   if (!window_init())
113113      return false;
114114
115115   // create the windows
r31515r31516
133133
134134void sdl_osd_interface::video_exit()
135135{
136   window_exit();
137   
136138   // free all of our monitor information
137139   while (sdl_monitor_list != NULL)
138140   {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team