summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/windows/window.cpp')
-rw-r--r--src/osd/windows/window.cpp133
1 files changed, 40 insertions, 93 deletions
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index 28db75a7fe1..8f9be654a17 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -101,8 +101,6 @@ static int in_background;
static int ui_temp_pause;
static int ui_temp_was_paused;
-static int multithreading_enabled;
-
static HANDLE window_thread;
static DWORD window_threadid;
@@ -158,7 +156,6 @@ static void mtlog_dump(void)
}
#else
void mtlog_add(const char *event) { }
-static void mtlog_dump(void) { }
#endif
@@ -170,11 +167,6 @@ static void mtlog_dump(void) { }
bool windows_osd_interface::window_init()
{
- size_t temp;
-
- // determine if we are using multithreading or not
- multithreading_enabled = false;//downcast<windows_options &>(machine().options()).multithreading();
-
// get the main thread ID before anything else
main_threadid = GetCurrentThreadId();
@@ -186,30 +178,8 @@ bool windows_osd_interface::window_init()
if (!ui_pause_event)
fatalerror("Failed to create pause event\n");
- // if multithreading, create a thread to run the windows
- if (multithreading_enabled)
- {
- // create an event to signal when the window thread is ready
- window_thread_ready_event = CreateEvent(nullptr, TRUE, FALSE, nullptr);
- if (!window_thread_ready_event)
- fatalerror("Failed to create window thread ready event\n");
-
- // create a thread to run the windows from
- temp = _beginthreadex(nullptr, 0, win_window_info::thread_entry, this, 0, (unsigned *)&window_threadid);
- window_thread = (HANDLE)temp;
- if (window_thread == nullptr)
- fatalerror("Failed to create window thread\n");
-
- // set the thread priority equal to the main MAME thread
- SetThreadPriority(window_thread, GetThreadPriority(GetCurrentThread()));
- }
-
- // otherwise, treat the window thread as the main thread
- else
- {
- window_thread = GetCurrentThread();
- window_threadid = main_threadid;
- }
+ window_thread = GetCurrentThread();
+ window_threadid = main_threadid;
const int fallbacks[VIDEO_MODE_COUNT] = {
-1, // NONE -> no fallback
@@ -290,16 +260,45 @@ void windows_osd_interface::update_slider_list()
}
}
-void windows_osd_interface::build_slider_list()
+int windows_osd_interface::window_count()
{
- // FIXME: take all sliders from all windows without concatenate them by slider_state->next
+ int count = 0;
+ for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next)
+ {
+ count++;
+ }
+ return count;
+}
+void windows_osd_interface::build_slider_list()
+{
+ m_sliders = nullptr;
+ slider_state* full_list = nullptr;
+ slider_state* curr = nullptr;
for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next)
{
// take the sliders of the first window
- m_sliders = window->m_renderer->get_slider_list();
- return;
+ slider_state* window_sliders = window->m_renderer->get_slider_list();
+ if (window_sliders == nullptr)
+ {
+ continue;
+ }
+
+ if (full_list == nullptr)
+ {
+ full_list = curr = window_sliders;
+ }
+ else
+ {
+ curr->next = window_sliders;
+ }
+
+ while (curr->next != nullptr) {
+ curr = curr->next;
+ }
}
+
+ m_sliders = full_list;
}
//============================================================
@@ -343,15 +342,6 @@ void windows_osd_interface::window_exit()
break;
}
- // if we're multithreaded, clean up the window thread
- if (multithreading_enabled)
- {
- PostThreadMessage(window_threadid, WM_USER_SELF_TERMINATE, 0, 0);
- WaitForSingleObject(window_thread, INFINITE);
-
- mtlog_dump();
- }
-
// kill the UI pause event
if (ui_pause_event)
CloseHandle(ui_pause_event);
@@ -815,21 +805,7 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in
// set the initial maximized state
window->m_startmaximized = options.maximize();
- // finish the window creation on the window thread
- if (multithreading_enabled)
- {
- // wait until the window thread is ready to respond to events
- WaitForSingleObject(window_thread_ready_event, INFINITE);
-
- PostThreadMessage(window_threadid, WM_USER_FINISH_CREATE_WINDOW, 0, (LPARAM)window);
- while (window->m_init_state == 0)
- {
- winwindow_process_events(machine, 0, 1); //pump the message queue
- Sleep(1);
- }
- }
- else
- window->m_init_state = window->complete_create() ? -1 : 1;
+ window->m_init_state = window->complete_create() ? -1 : 1;
// handle error conditions
if (window->m_init_state == -1)
@@ -930,10 +906,7 @@ void win_window_info::update()
// post a redraw request with the primitive list as a parameter
last_update_time = timeGetTime();
mtlog_add("winwindow_video_window_update: PostMessage start");
- if (multithreading_enabled)
- PostMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
- else
- SendMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
+ SendMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
mtlog_add("winwindow_video_window_update: PostMessage end");
}
}
@@ -1089,21 +1062,7 @@ void winwindow_ui_pause_from_main_thread(running_machine &machine, int pause)
void winwindow_ui_pause_from_window_thread(running_machine &machine, int pause)
{
assert(GetCurrentThreadId() == window_threadid);
-
- // if we're multithreaded, we have to request a pause on the main thread
- if (multithreading_enabled)
- {
- // request a pause from the main thread
- PostThreadMessage(main_threadid, WM_USER_UI_TEMP_PAUSE, pause, 0);
-
- // if we're pausing, block until it happens
- if (pause)
- WaitForSingleObject(ui_pause_event, INFINITE);
- }
-
- // otherwise, we just do it directly
- else
- winwindow_ui_pause_from_main_thread(machine, pause);
+ winwindow_ui_pause_from_main_thread(machine, pause);
}
@@ -1117,16 +1076,7 @@ void winwindow_ui_exec_on_main_thread(void (*func)(void *), void *param)
{
assert(GetCurrentThreadId() == window_threadid);
- // if we're multithreaded, we have to request a pause on the main thread
- if (multithreading_enabled)
- {
- // request a pause from the main thread
- PostThreadMessage(main_threadid, WM_USER_EXEC_FUNC, (WPARAM) func, (LPARAM) param);
- }
-
- // otherwise, we just do it directly
- else
- (*func)(param);
+ (*func)(param);
}
@@ -1525,10 +1475,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
// close: cause MAME to exit
case WM_CLOSE:
- if (multithreading_enabled)
- PostThreadMessage(main_threadid, WM_QUIT, 0, 0);
- else
- window->machine().schedule_exit();
+ window->machine().schedule_exit();
break;
// destroy: clean up all attached rendering bits and nullptr out our hwnd