Previous 199869 Revisions Next

r36173 Sunday 1st March, 2015 at 21:08:27 UTC by Couriersud
Some more alignment. (nw)
[src/osd/modules/render]draw13.c drawsdl.c
[src/osd/sdl]video.c video.h window.c
[src/osd/windows]video.c video.h

trunk/src/osd/modules/render/draw13.c
r244684r244685
650650void sdl_info13::destroy()
651651{
652652   destroy_all_textures();
653   SDL_DestroyRenderer(m_sdl_renderer);
653654}
654655
655656
trunk/src/osd/modules/render/drawsdl.c
r244684r244685
271271   UINT32 fmt;
272272
273273   // Determine preferred pixelformat and set up yuv if necessary
274   SDL_GetCurrentDisplayMode(*((UINT64 *)window().monitor()->handle()), &mode);
274   SDL_GetCurrentDisplayMode(*((UINT64 *)window().monitor()->oshandle()), &mode);
275275
276276   if (m_yuv_bitmap)
277277   {
trunk/src/osd/sdl/video.c
r244684r244685
6363
6464osd_video_config video_config;
6565
66// monitor info
6667osd_monitor_info *osd_monitor_info::list = NULL;
6768
69
6870//============================================================
6971//  LOCAL VARIABLES
7072//============================================================
7173
74
7275//============================================================
7376//  PROTOTYPES
7477//============================================================
r244684r244685
318321   // poll the joystick values here
319322   sdlinput_poll(machine());
320323   check_osd_inputs(machine());
321
324   // if we're running, disable some parts of the debugger
322325   if ((machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) != 0)
323326      debugger_update();
324327}
r244684r244685
450453//  pick_monitor
451454//============================================================
452455
453#if (SDLMAME_SDL2) || defined(SDLMAME_WIN32)
454456osd_monitor_info *osd_monitor_info::pick_monitor(sdl_options &options, int index)
455457{
456458   osd_monitor_info *monitor;
r244684r244685
472474   // look for a match in the name first
473475   if (scrname != NULL && (scrname[0] != 0))
474476   {
475      for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next())
477      for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next())
476478      {
477479         moncount++;
478480         if (strcmp(scrname, monitor->devicename()) == 0)
r244684r244685
482484
483485   // didn't find it; alternate monitors until we hit the jackpot
484486   index %= moncount;
485   for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next())
487   for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next())
486488      if (index-- == 0)
487489         goto finishit;
488490
489491   // return the primary just in case all else fails
490   for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next())
492   for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next())
491493      if (monitor->is_primary())
492494         goto finishit;
493495
r244684r244685
499501   }
500502   return monitor;
501503}
502#else
503osd_monitor_info *osd_monitor_info::pick_monitor(sdl_options &options, int index)
504{
505   osd_monitor_info *monitor;
506   float aspect;
507504
508   // get the aspect ratio
509   aspect = get_aspect(options.aspect(), options.aspect(index), TRUE);
510505
511   // return the primary just in case all else fails
512   monitor = osd_monitor_info::list;
513
514   if (aspect != 0)
515   {
516      monitor->m_aspect = aspect;
517   }
518   return monitor;
519}
520#endif
521
522
523506//============================================================
524507//  check_osd_inputs
525508//============================================================
trunk/src/osd/sdl/video.h
r244684r244685
128128
129129   virtual ~osd_monitor_info() { }
130130
131   const void *handle() { return m_handle; }
131   const void *oshandle() { return m_handle; }
132132
133133   const osd_rect &position_size() { refresh(); return m_pos_size; }
134134   const osd_rect &usuable_position_size() { refresh(); return m_usuable_pos_size; }
trunk/src/osd/sdl/window.c
r244684r244685
866866   }
867867
868868   // FIXME: this should be provided by monitor !
869   num = SDL_GetNumDisplayModes(*((UINT64 *)m_monitor->handle()));
869   num = SDL_GetNumDisplayModes(*((UINT64 *)m_monitor->oshandle()));
870870
871871   if (num == 0)
872872   {
r244684r244685
878878      for (i = 0; i < num; ++i)
879879      {
880880         SDL_DisplayMode mode;
881         SDL_GetDisplayMode(*((UINT64 *)m_monitor->handle()), i, &mode);
881         SDL_GetDisplayMode(*((UINT64 *)m_monitor->oshandle()), i, &mode);
882882
883883         // compute initial score based on difference between target and current
884884         size_score = 1.0f / (1.0f + fabsf((INT32)mode.w - target_width) + fabsf((INT32)mode.h - target_height));
trunk/src/osd/windows/video.c
r244684r244685
2929#include "config.h"
3030
3131//============================================================
32//  CONSTANTS
33//============================================================
34
35
36//============================================================
3237//  GLOBAL VARIABLES
3338//============================================================
3439
3540osd_video_config video_config;
3641
42// monitor info
43osd_monitor_info *osd_monitor_info::list = NULL;
3744
3845
3946//============================================================
4047//  LOCAL VARIABLES
4148//============================================================
4249
43// monitor info
44osd_monitor_info *osd_monitor_info::list = NULL;
4550
4651//============================================================
4752//  PROTOTYPES
4853//============================================================
4954
5055static void init_monitors(void);
51static osd_monitor_info *pick_monitor(windows_options &options, int index);
5256
5357static void check_osd_inputs(running_machine &machine);
5458
r244684r244685
5660static void get_resolution(const char *defdata, const char *data, osd_window_config *config, int report_error);
5761
5862
59
6063//============================================================
6164//  video_init
6265//============================================================
r244684r244685
8083   // create the windows
8184   windows_options &options = downcast<windows_options &>(machine().options());
8285   for (index = 0; index < video_config.numscreens; index++)
83      win_window_info::create(machine(), index, pick_monitor(options, index), &windows[index]);
86      win_window_info::create(machine(), index, osd_monitor_info::pick_monitor(options, index), &windows[index]);
8487   if (video_config.mode != VIDEO_MODE_NONE)
8588      SetForegroundWindow(win_window_list->m_hwnd);
8689
r244684r244685
184187
185188   // if we're not skipping this redraw, update all windows
186189   if (!skip_redraw)
190   {
191//      profiler_mark(PROFILER_BLIT);
187192      for (win_window_info *window = win_window_list; window != NULL; window = window->m_next)
188193         window->update();
194//      profiler_mark(PROFILER_END);
195   }
189196
190197   // poll the joystick values here
191198   winwindow_process_events(machine(), TRUE, FALSE);
r244684r244685
198205
199206
200207
201//============================================================
202//  init_monitors
203//============================================================
204208
205static void init_monitors(void)
206{
207   osd_monitor_info **tailptr;
208209
209   // make a list of monitors
210   osd_monitor_info::list = NULL;
211   tailptr = &osd_monitor_info::list;
212   EnumDisplayMonitors(NULL, NULL, win_monitor_info::monitor_enum_callback, (LPARAM)&tailptr);
213
214   // if we're verbose, print the list of monitors
215   {
216      osd_monitor_info *monitor;
217      for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next)
218      {
219         osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : "");
220      }
221   }
222}
223
224
225
226210//============================================================
227211//  monitor_enum_callback
228212//============================================================
r244684r244685
240224   assert(result);
241225   (void)result; // to silence gcc 4.6
242226
227   // guess the aspect ratio assuming square pixels
228   float aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top);
229
243230   // allocate a new monitor info
244   monitor = global_alloc(win_monitor_info(handle, "", 1.0f));
231   char *temp = utf8_from_wstring(info.szDevice);
245232   // copy in the data
246   //monitor->refresh();
233   monitor = global_alloc(win_monitor_info(handle, temp, aspect));
234   osd_free(temp);
247235
248   // guess the aspect ratio assuming square pixels
249   monitor->set_aspect((float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top));
250
251236   // hook us into the list
252237   **tailptr = monitor;
253238   *tailptr = &monitor->m_next;
r244684r244685
257242}
258243
259244
245//============================================================
246//  init_monitors
247//============================================================
260248
249static void init_monitors(void)
250{
251   osd_monitor_info **tailptr;
252
253   // make a list of monitors
254   osd_monitor_info::list = NULL;
255   tailptr = &osd_monitor_info::list;
256   EnumDisplayMonitors(NULL, NULL, win_monitor_info::monitor_enum_callback, (LPARAM)&tailptr);
257
258   // if we're verbose, print the list of monitors
259   {
260      osd_monitor_info *monitor;
261      for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next)
262      {
263         osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->oshandle(), monitor->devicename(), monitor->is_primary() ? "(primary)" : "");
264      }
265   }
266}
267
268
261269//============================================================
262270//  pick_monitor
263271//============================================================
264272
265static osd_monitor_info *pick_monitor(windows_options &options, int index)
273osd_monitor_info *osd_monitor_info::pick_monitor(windows_options &options, int index)
266274{
275   osd_monitor_info *monitor;
267276   const char *scrname, *scrname2;
268   osd_monitor_info *monitor;
269277   int moncount = 0;
270278   float aspect;
271279
r244684r244685
283291   // look for a match in the name first
284292   if (scrname != NULL && (scrname[0] != 0))
285293   {
286      for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next)
294      for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next())
287295      {
288296         moncount++;
289297         if (strcmp(scrname, monitor->devicename()) == 0)
r244684r244685
293301
294302   // didn't find it; alternate monitors until we hit the jackpot
295303   index %= moncount;
296   for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next)
304   for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next())
297305      if (index-- == 0)
298306         goto finishit;
299307
300308   // return the primary just in case all else fails
301   for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->m_next)
309   for (monitor = osd_monitor_info::list; monitor != NULL; monitor = monitor->next())
302310      if (monitor->is_primary())
303311         goto finishit;
304312
313   // FIXME: FatalError?
305314finishit:
306315   if (aspect != 0)
307316   {
r244684r244685
311320}
312321
313322
314
315323//============================================================
316324//  check_osd_inputs
317325//============================================================
r244684r244685
492500
493501static void get_resolution(const char *defdata, const char *data, osd_window_config *config, int report_error)
494502{
495   config->width = config->height = config->refresh = 0;
503   config->width = config->height = config->depth = config->refresh = 0;
496504   if (strcmp(data, OSDOPTVAL_AUTO) == 0)
497505   {
498506      if (strcmp(defdata, OSDOPTVAL_AUTO) == 0)
trunk/src/osd/windows/video.h
r244684r244685
1010#define __WIN_VIDEO__
1111
1212#include "render.h"
13#include "winmain.h"
1314
1415//============================================================
1516//  CONSTANTS
r244684r244685
123124
124125   osd_monitor_info    * next() { return m_next; }   // pointer to next monitor in list
125126
126#ifdef OSD_SDL
127   static osd_monitor_info *pick_monitor(sdl_options &options, int index);
128#endif
127   static osd_monitor_info *pick_monitor(windows_options &options, int index);
129128   static osd_monitor_info *list;
130129
131130   // FIXME: should be private!


Previous 199869 Revisions Next


© 1997-2024 The MAME Team