Cleanup linux OSD (nw)

This commit is contained in:
Miodrag Milanovic 2016-10-22 18:42:47 +02:00
parent 864360160b
commit 88b5a5c09f
7 changed files with 56 additions and 56 deletions

View File

@ -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)
{

View File

@ -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
}

View File

@ -13,7 +13,7 @@
std::shared_ptr<osd_monitor_info> 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)

View File

@ -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

View File

@ -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<std::mutex> 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

View File

@ -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

View File

@ -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<sdl_window_info> win = std::make_shared<sdl_window_info>(machine(), index, m_monitor_module->pick_monitor(reinterpret_cast<osd_options &>(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;