From 88b5a5c09fccc9c74b065523dbf2175d263a8db2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 22 Oct 2016 18:42:47 +0200 Subject: [PATCH] Cleanup linux OSD (nw) --- src/lib/util/xmlfile.cpp | 2 +- src/osd/modules/file/posixfile.cpp | 2 +- src/osd/modules/monitor/monitor_common.cpp | 2 +- src/osd/modules/render/drawogl.cpp | 58 +++++++++++----------- src/osd/osdsync.cpp | 38 +++++++------- src/osd/osdsync.h | 6 +-- src/osd/sdl/video.cpp | 4 +- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp index 0676326fdd8..2b9bc8ed20d 100644 --- a/src/lib/util/xmlfile.cpp +++ b/src/lib/util/xmlfile.cpp @@ -197,7 +197,7 @@ xml_data_node *xml_string_read(const char *string, xml_parse_options *opts) return nullptr; /* parse the data */ - if (XML_Parse(parse_info.parser, string, length, TRUE) == XML_STATUS_ERROR) + if (XML_Parse(parse_info.parser, string, length, 1) == XML_STATUS_ERROR) { if (opts != nullptr && opts->error != nullptr) { diff --git a/src/osd/modules/file/posixfile.cpp b/src/osd/modules/file/posixfile.cpp index 15e86a1814b..370c98afe03 100644 --- a/src/osd/modules/file/posixfile.cpp +++ b/src/osd/modules/file/posixfile.cpp @@ -341,7 +341,7 @@ osd_file::error osd_file::remove(std::string const &filename) int osd_get_physical_drive_geometry(const char *filename, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors, uint32_t *bps) { - return FALSE; // no, no way, huh-uh, forget it + return false; // no, no way, huh-uh, forget it } diff --git a/src/osd/modules/monitor/monitor_common.cpp b/src/osd/modules/monitor/monitor_common.cpp index 5a1a5fa8377..7e4571e01a8 100644 --- a/src/osd/modules/monitor/monitor_common.cpp +++ b/src/osd/modules/monitor/monitor_common.cpp @@ -13,7 +13,7 @@ std::shared_ptr monitor_module_base::pick_monitor(osd_options& options, int index) { // get the aspect ratio - float aspect = get_aspect(options.aspect(), options.aspect(index), TRUE); + float aspect = get_aspect(options.aspect(), options.aspect(index), true); auto monitor = pick_monitor_internal(options, index); if (aspect != 0) diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index d32a8a8a759..364bce21fe2 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -617,7 +617,7 @@ int renderer_ogl::xy_to_render_target(int x, int y, int *xt, int *yt) void renderer_ogl::destroy_all_textures() { ogl_texture_info *texture = nullptr; - int lock=FALSE; + bool lock=false; int i; if ( !m_initialized ) @@ -634,7 +634,7 @@ void renderer_ogl::destroy_all_textures() if(win->m_primlist) { - lock=TRUE; + lock=true; win->m_primlist->acquire_lock(); } @@ -682,7 +682,7 @@ void renderer_ogl::destroy_all_textures() { free(texture->data); texture->data=nullptr; - texture->data_own=FALSE; + texture->data_own=false; } global_free(texture); } @@ -707,9 +707,9 @@ void renderer_ogl::loadGLExtensions() { static int _once = 1; - // usevbo=FALSE; // You may want to switch VBO and PBO off, by uncommenting this statement - // usepbo=FALSE; // You may want to switch PBO off, by uncommenting this statement - // useglsl=FALSE; // You may want to switch GLSL off, by uncommenting this statement + // usevbo=false; // You may want to switch VBO and PBO off, by uncommenting this statement + // usepbo=false; // You may want to switch PBO off, by uncommenting this statement + // useglsl=false; // You may want to switch GLSL off, by uncommenting this statement if (! m_usevbo) { @@ -719,7 +719,7 @@ void renderer_ogl::loadGLExtensions() { osd_printf_warning("OpenGL: PBO not supported, no VBO support. (sdlmame error)\n"); } - m_usepbo=FALSE; + m_usepbo=false; } if(m_useglsl) // should never ever happen ;-) { @@ -727,7 +727,7 @@ void renderer_ogl::loadGLExtensions() { osd_printf_warning("OpenGL: GLSL not supported, no VBO support. (sdlmame error)\n"); } - m_useglsl=FALSE; + m_useglsl=false; } } @@ -763,7 +763,7 @@ void renderer_ogl::loadGLExtensions() !pfn_glBindBuffer || !pfn_glBufferData || !pfn_glBufferSubData ) ) { - m_usepbo=FALSE; + m_usepbo=false; if (_once) { osd_printf_warning("OpenGL: VBO not supported, missing: "); @@ -795,13 +795,13 @@ void renderer_ogl::loadGLExtensions() { osd_printf_warning("OpenGL: PBO not supported, no VBO support.\n"); } - m_usepbo=FALSE; + m_usepbo=false; } } if ( m_usepbo && ( !pfn_glMapBuffer || !pfn_glUnmapBuffer ) ) { - m_usepbo=FALSE; + m_usepbo=false; if (_once) { osd_printf_warning("OpenGL: PBO not supported, missing: "); @@ -822,7 +822,7 @@ void renderer_ogl::loadGLExtensions() !pfn_glGenFramebuffers || !pfn_glCheckFramebufferStatus || !pfn_glFramebufferTexture2D )) { - m_usefbo=FALSE; + m_usefbo=false; if (_once) { osd_printf_warning("OpenGL: FBO not supported, missing: "); @@ -930,7 +930,7 @@ void renderer_ogl::loadGLExtensions() if ( m_useglsl ) { int i; - video_config.filter = FALSE; + video_config.filter = false; glsl_shader_feature = GLSL_SHADER_FEAT_PLAIN; m_glsl_program_num = 0; m_glsl_program_mb2sc = 0; @@ -1401,15 +1401,15 @@ static const char * texfmt_to_string[9] = { enum { SDL_TEXFORMAT_SRC_EQUALS_DEST, SDL_TEXFORMAT_SRC_HAS_PALETTE }; static const GLint texture_copy_properties[9][2] = { - { TRUE, FALSE }, // SDL_TEXFORMAT_ARGB32 - { TRUE, FALSE }, // SDL_TEXFORMAT_RGB32 - { TRUE, TRUE }, // SDL_TEXFORMAT_RGB32_PALETTED - { FALSE, FALSE }, // SDL_TEXFORMAT_YUY16 - { FALSE, TRUE }, // SDL_TEXFORMAT_YUY16_PALETTED - { FALSE, TRUE }, // SDL_TEXFORMAT_PALETTE16 - { TRUE, FALSE }, // SDL_TEXFORMAT_RGB15 - { TRUE, TRUE }, // SDL_TEXFORMAT_RGB15_PALETTED - { FALSE, TRUE } // SDL_TEXFORMAT_PALETTE16A + { true, false }, // SDL_TEXFORMAT_ARGB32 + { true, false }, // SDL_TEXFORMAT_RGB32 + { true, true }, // SDL_TEXFORMAT_RGB32_PALETTED + { false, false }, // SDL_TEXFORMAT_YUY16 + { false, true }, // SDL_TEXFORMAT_YUY16_PALETTED + { false, true }, // SDL_TEXFORMAT_PALETTE16 + { true, false }, // SDL_TEXFORMAT_RGB15 + { true, true }, // SDL_TEXFORMAT_RGB15_PALETTED + { false, true } // SDL_TEXFORMAT_PALETTE16A }; //============================================================ @@ -1420,13 +1420,13 @@ static const GLint texture_copy_properties[9][2] = { // glBufferData to push a nocopy texture to the GPU is slower than TexSubImage2D, // so don't use PBO here // -// we also don't want to use PBO's in the case of nocopy==TRUE, +// we also don't want to use PBO's in the case of nocopy==true, // since we now might have GLSL shaders - this decision simplifies out life ;-) // void renderer_ogl::texture_compute_type_subroutine(const render_texinfo *texsource, ogl_texture_info *texture, uint32_t flags) { texture->type = TEXTURE_TYPE_NONE; - texture->nocopy = FALSE; + texture->nocopy = false; if ( texture->type == TEXTURE_TYPE_NONE && !PRIMFLAG_GET_SCREENTEX(flags)) @@ -1453,7 +1453,7 @@ void renderer_ogl::texture_compute_type_subroutine(const render_texinfo *texsour !texture->borderpix && !texsource->palette && texsource->rowpixels <= m_texture_max_width ) { - texture->nocopy = TRUE; + texture->nocopy = true; } if( texture->type == TEXTURE_TYPE_NONE && @@ -1552,7 +1552,7 @@ void renderer_ogl::texture_compute_size_type(const render_texinfo *texsource, og ((finalwidth > m_texture_max_width && finalwidth - 2 <= m_texture_max_width) || (finalheight > m_texture_max_height && finalheight - 2 <= m_texture_max_height))) { - texture->borderpix = FALSE; + texture->borderpix = false; texture_compute_type_subroutine(texsource, texture, flags); @@ -1563,10 +1563,10 @@ void renderer_ogl::texture_compute_size_type(const render_texinfo *texsource, og // if we're above the max width/height, do what? if (finalwidth_create > m_texture_max_width || finalheight_create > m_texture_max_height) { - static int printed = FALSE; + static int printed = false; if (!printed) osd_printf_warning("Texture too big! (wanted: %dx%d, max is %dx%d)\n", finalwidth_create, finalheight_create, m_texture_max_width, m_texture_max_height); - printed = TRUE; + printed = true; } if(!texture->nocopy || texture->type==TEXTURE_TYPE_DYNAMIC || texture->type==TEXTURE_TYPE_SHADER || @@ -2007,7 +2007,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, if ( !texture->nocopy && texture->type!=TEXTURE_TYPE_DYNAMIC ) { texture->data = (uint32_t *) malloc(texture->rawwidth* texture->rawheight * sizeof(uint32_t)); - texture->data_own=TRUE; + texture->data_own=true; } // add us to the texture list diff --git a/src/osd/osdsync.cpp b/src/osd/osdsync.cpp index 38758bd877b..3c6600c73e8 100644 --- a/src/osd/osdsync.cpp +++ b/src/osd/osdsync.cpp @@ -103,7 +103,7 @@ struct work_thread_info work_thread_info(uint32_t aid, osd_work_queue &aqueue) : queue(aqueue) , handle(nullptr) - , wakeevent(FALSE, FALSE) // auto-reset, not signalled + , wakeevent(false, false) // auto-reset, not signalled , active(0) , id(aid) #if KEEP_STATISTICS @@ -143,7 +143,7 @@ struct osd_work_queue , exiting(0) , threads(0) , flags(0) - , doneevent(TRUE, TRUE) // manual reset, signalled + , doneevent(true, true) // manual reset, signalled #if KEEP_STATISTICS , itemsqueued(0) , setevents(0) @@ -185,7 +185,7 @@ struct osd_work_item , result(nullptr) , event(nullptr) // manual reset, not signalled , flags(0) - , done(FALSE) + , done(false) { } @@ -234,12 +234,12 @@ int thread_adjust_priority(std::thread *thread, int adjust) { sched.sched_priority += adjust; if (pthread_setschedparam(thread->native_handle(), policy, &sched) == 0) - return TRUE; + return true; else - return FALSE; + return false; } #endif - return TRUE; + return true; } //============================================================ @@ -339,11 +339,11 @@ int osd_work_queue_wait(osd_work_queue *queue, osd_ticks_t timeout) { // if no threads, no waiting if (queue->threads == 0) - return TRUE; + return true; // if no items, we're done if (queue->items == 0) - return TRUE; + return true; // if this is a multi queue, help out rather than doing nothing if (queue->flags & WORK_QUEUE_FLAG_MULTI) @@ -371,12 +371,12 @@ int osd_work_queue_wait(osd_work_queue *queue, osd_ticks_t timeout) // reset our done event and double-check the items before waiting queue->doneevent.reset(); - queue->waiting = TRUE; + queue->waiting = true; if (queue->items != 0) queue->doneevent.wait(timeout); - queue->waiting = FALSE; + queue->waiting = false; - // return TRUE if we actually hit 0 + // return true if we actually hit 0 return (queue->items == 0); } @@ -394,7 +394,7 @@ void osd_work_queue_free(osd_work_queue *queue) } // signal all the threads to exit - queue->exiting = TRUE; + queue->exiting = true; for (int threadnum = 0; threadnum < queue->threads; threadnum++) { work_thread_info *thread = queue->thread[threadnum]; @@ -501,7 +501,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call } else { - item->done = FALSE; // needs to be set this way to prevent data race/usage of uninitialized memory on Linux + item->done = false; // needs to be set this way to prevent data race/usage of uninitialized memory on Linux } // fill in the basics @@ -572,13 +572,13 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) { // if we're done already, just return if (item->done) - return TRUE; + return true; // if we don't have an event, create one if (item->event == nullptr) { std::lock_guard lock(item->queue.lock); - item->event = new osd_event(TRUE, FALSE); // manual reset, not signalled + item->event = new osd_event(true, false); // manual reset, not signalled } else item->event->reset(); @@ -594,7 +594,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) else if (!item->done) item->event->wait(timeout); - // return TRUE if the refcount actually hit 0 + // return true if the refcount actually hit 0 return item->done; } @@ -687,7 +687,7 @@ static void *worker_thread_entry(void *param) break; // indicate that we are live - thread->active = TRUE; + thread->active = true; ++queue.livethreads; // process work items @@ -712,7 +712,7 @@ static void *worker_thread_entry(void *param) } // decrement the live thread count - thread->active = FALSE; + thread->active = false; --queue.livethreads; } @@ -771,7 +771,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa // decrement the item count after we are done --queue->items; - item->done = TRUE; + item->done = true; add_to_stat(thread->itemsdone, 1); // if it's an auto-release item, release it diff --git a/src/osd/osdsync.h b/src/osd/osdsync.h index c373dded382..27497d674d3 100644 --- a/src/osd/osdsync.h +++ b/src/osd/osdsync.h @@ -122,7 +122,7 @@ public: void reset() { m_mutex.lock(); - m_signalled = FALSE; + m_signalled = false; m_mutex.unlock(); } @@ -144,9 +144,9 @@ public: void set() { m_mutex.lock(); - if (m_signalled == FALSE) + if (m_signalled == false) { - m_signalled = TRUE; + m_signalled = true; if (m_autoreset) m_cond.notify_one(); else diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 5ec47a105a0..88bc1b51ce4 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -71,7 +71,7 @@ bool sdl_osd_interface::video_init() { osd_window_config conf; memset(&conf, 0, sizeof(conf)); - get_resolution(options().resolution(), options().resolution(index), &conf, TRUE); + get_resolution(options().resolution(), options().resolution(index), &conf, true); // create window ... std::shared_ptr win = std::make_shared(machine(), index, m_monitor_module->pick_monitor(reinterpret_cast(options()), index), &conf); @@ -190,7 +190,7 @@ void sdl_osd_interface::extract_video_config() // if we are in debug mode, never go full screen if (machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) - video_config.windowed = TRUE; + video_config.windowed = true; // default to working video please video_config.novideo = 0;