diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index 1ab7c52565..132bd70594 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -64,8 +64,6 @@ static enum frontend_fork ctr_fork_mode = FRONTEND_FORK_NONE; static const char* elf_path_cst = "sdmc:/retroarch/retroarch.3dsx"; -extern bool ctr_bottom_screen_enabled; - #ifdef IS_SALAMANDER static void get_first_valid_core(char* path_return, size_t len) { diff --git a/gfx/display_servers/dispserv_win32.c b/gfx/display_servers/dispserv_win32.c index 440b0349d0..16aead87e2 100644 --- a/gfx/display_servers/dispserv_win32.c +++ b/gfx/display_servers/dispserv_win32.c @@ -72,13 +72,13 @@ enum dispserv_win32_flags typedef struct { +#ifdef HAS_TASKBAR_EXT + ITaskbarList3 *taskbar_list; +#endif int crt_center; unsigned orig_width; unsigned orig_height; unsigned orig_refresh; -#ifdef HAS_TASKBAR_EXT - ITaskbarList3 *taskbar_list; -#endif uint8_t flags; } dispserv_win32_t; diff --git a/gfx/display_servers/dispserv_x11.c b/gfx/display_servers/dispserv_x11.c index 688e117e1f..5b0a7fd693 100644 --- a/gfx/display_servers/dispserv_x11.c +++ b/gfx/display_servers/dispserv_x11.c @@ -38,7 +38,7 @@ #include "../video_display_server.h" #include "../common/x11_common.h" #include "../../retroarch.h" -#include "../video_crt_switch.h" /* needed to set aspect for low res in linux */ +#include "../video_crt_switch.h" /* Needed to set aspect for low resolution in Linux */ enum dispserv_x11_flags { @@ -190,18 +190,18 @@ static bool x11_display_server_set_resolution(void *data, pixel_clock = (hmax * vmax * hz) / 2; /* above code is the modeline generator */ - /* create interlaced newmode from modline variables */ + /* Create interlaced new mode from modline variables */ if (height < 300) crt_mode_flag = 10; - /* create interlaced newmode from modline variables */ + /* Create interlaced new mode from modline variables */ if (height > 300) crt_mode_flag = 26; strlcpy(dispserv->old_mode, dispserv->new_mode, sizeof(dispserv->old_mode)); /* variable for new mode */ strlcpy(dispserv->new_mode, dispserv->crt_name, sizeof(dispserv->new_mode)); - /* need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to + /* Need to run loops for DVI0 - DVI-2 and VGA0 - VGA-2 outputs to * add and delete modes */ dispserv->crt_rrmode.name = dispserv->new_mode; @@ -479,10 +479,9 @@ static void* x11_display_server_init(void) { dispserv_x11_t *dispserv = (dispserv_x11_t*)calloc(1, sizeof(*dispserv)); - if (!dispserv) - return NULL; - - return dispserv; + if (dispserv) + return dispserv; + return NULL; } static void x11_display_server_destroy(void *data) @@ -590,6 +589,7 @@ static void x11_display_server_destroy(void *data) } XRRFreeOutputInfo(outputs); } + for (m = 0; m < resources->nmode; m++) { for (j = 0; j < res->noutput; j++) @@ -648,7 +648,6 @@ static void x11_display_server_destroy(void *data) for (m = 0; m < resources->nmode; m++) { - for (i = 1 ; i <= dispserv->crt_name_id; i++ ) { XRROutputInfo *outputs = XRRGetOutputInfo(dpy, res, res->outputs[dispserv->monitor_index]); @@ -666,8 +665,6 @@ static void x11_display_server_destroy(void *data) } } } - - } } @@ -675,7 +672,6 @@ static void x11_display_server_destroy(void *data) XRRFreeScreenResources(res); XCloseDisplay(dpy); } - #endif if (dispserv) diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 4594f538b2..c24811a6ea 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -66,8 +66,8 @@ extern uint64_t lifecycle_state; * Have to keep track of bottom screen enable state * externally, otherwise cannot detect current state * when reinitialising... */ -bool ctr_bottom_screen_enabled = true; -static int fadeCount = 256; +static bool ctr_bottom_screen_enabled = true; +static int fade_count = 256; static void ctr_set_bottom_screen_enable(bool enabled, bool idle); @@ -165,7 +165,7 @@ static INLINE void ctr_set_screen_coords(ctr_video_t * ctr) static void ctr_render_overlay(void *data); static void ctr_free_overlay(ctr_video_t *ctr) { - unsigned i; + int i; for (i = 0; i < ctr->overlays; i++) { @@ -515,14 +515,14 @@ static void bottom_menu_control(void* data, bool lcd_bottom) { ctr->bottom_is_idle = false; ctr->bottom_is_fading = false; - fadeCount = 256; + fade_count = 256; ctr_set_bottom_screen_enable(true,true); } else if (ctr->bottom_check_idle) { ctr->bottom_check_idle = false; ctr->bottom_is_fading = false; - fadeCount = 256; + fade_count = 256; } if (ctr->bottom_menu == CTR_BOTTOM_MENU_NOT_AVAILABLE) @@ -646,7 +646,7 @@ static void bottom_menu_control(void* data, bool lcd_bottom) if (ctr_update_state_date_from_file(ctr)) { - if(gfx_display_reset_textures_list( + if (gfx_display_reset_textures_list( ctr_texture_path(CTR_TEXTURE_STATE_THUMBNAIL), dir_get_ptr(RARCH_DIR_SAVESTATE), &o->texture, @@ -919,17 +919,17 @@ static void ctr_set_bottom_screen_idle(ctr_video_t * ctr) return; } - if ( fadeCount > 0 ) + if (fade_count > 0) { - fadeCount--; - ctr_fade_bottom_screen(GFX_BOTTOM, GFX_LEFT, fadeCount); + fade_count--; + ctr_fade_bottom_screen(GFX_BOTTOM, GFX_LEFT, fade_count); - if ( fadeCount <= 128 ) + if (fade_count <= 128) { ctr->bottom_is_idle = true; ctr->bottom_is_fading = false; ctr->bottom_check_idle = false; - fadeCount = 256; + fade_count = 256; ctr_set_bottom_screen_enable(false,true); return; } @@ -944,7 +944,7 @@ static void ctr_set_bottom_screen_enable(bool enabled, bool idle) u8 not_2DS; CFGU_GetModelNintendo2DS(¬_2DS); - if(not_2DS && srvGetServiceHandle(&lcd_handle, "gsp::Lcd") >= 0) + if (not_2DS && srvGetServiceHandle(&lcd_handle, "gsp::Lcd") >= 0) { u32 *cmdbuf = getThreadCommandBuffer(); cmdbuf[0] = enabled? 0x00110040: 0x00120040; @@ -1282,7 +1282,7 @@ static bool ctr_frame(void* data, const void* frame, uint64_t frame_count, unsigned pitch, const char* msg, video_frame_info_t *video_info) { - static uint64_t currentTick,lastTick; + static uint64_t current_tick, last_tick; extern GSPGPU_FramebufferInfo topFramebufferInfo, bottomFramebufferInfo; extern u8* gfxSharedMemory; extern u8 gfxThreadID; @@ -1408,13 +1408,13 @@ static bool ctr_frame(void* data, const void* frame, if (ctr_bottom_screen_enabled) { frames++; - currentTick = svcGetSystemTick(); - diff = currentTick - lastTick; - if(diff > CTR_CPU_TICKS_PER_SECOND) + current_tick = svcGetSystemTick(); + diff = current_tick - last_tick; + if (diff > CTR_CPU_TICKS_PER_SECOND) { - fps = (float)frames * ((float) CTR_CPU_TICKS_PER_SECOND / (float) diff); - lastTick = currentTick; - frames = 0; + fps = (float)frames * ((float) CTR_CPU_TICKS_PER_SECOND / (float) diff); + last_tick = current_tick; + frames = 0; } #ifdef CTR_INSPECT_MEMORY_USAGE @@ -1432,15 +1432,15 @@ static bool ctr_frame(void* data, const void* frame, svcQueryMemory(&mem_info, &page_info, query_addr); printf("0x%08X --> 0x%08X (0x%08X) \n", mem_info.base_addr, mem_info.base_addr + mem_info.size, mem_info.size); query_addr = mem_info.base_addr + mem_info.size; - if(query_addr == 0x1F000000) + if (query_addr == 0x1F000000) query_addr = 0x30000000; } #if 0 static u32* dummy_pointer; - if(total_frames == 500) + if (total_frames == 500) dummy_pointer = malloc(0x2000000); - if(total_frames == 1000) + if (total_frames == 1000) free(dummy_pointer); #endif @@ -1455,14 +1455,13 @@ static bool ctr_frame(void* data, const void* frame, printf("used: 0x%08X free: 0x%08X \n", (u32)mem_used, app_memory - (u32)mem_used); static u32 stack_usage = 0; extern u32 __stack_bottom; - if(!(total_frames & 0x3F)) + if (!(total_frames & 0x3F)) stack_usage = ctr_get_stack_usage(); printf("stack total:0x%08X used: 0x%08X\n", 0x10000000 - __stack_bottom, stack_usage); printf("========================================"); ctr_linear_get_stats(); printf("========================================"); - #else printf(PRINTFPOS(29,0)"fps: %8.4f frames: %i\r", fps, total_frames++); #endif @@ -1479,22 +1478,25 @@ static bool ctr_frame(void* data, const void* frame, ); if (ctr->refresh_bottom_menu) - { - ctrGuSetMemoryFill(true, (u32*)ctr->drawbuffers.top.left, 0x00000000, + ctrGuSetMemoryFill(true, + (u32*)ctr->drawbuffers.top.left, + 0x00000000, (u32*)ctr->drawbuffers.top.left + 2 * CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT, 0x201, - (u32*)ctr->drawbuffers.bottom, 0x00000000, + (u32*)ctr->drawbuffers.bottom, + 0x00000000, (u32*)ctr->drawbuffers.bottom + 2 * CTR_BOTTOM_FRAMEBUFFER_WIDTH * CTR_BOTTOM_FRAMEBUFFER_HEIGHT, 0x201); - } else - { - ctrGuSetMemoryFill(true, (u32*)ctr->drawbuffers.top.left, 0x00000000, + ctrGuSetMemoryFill(true, + (u32*)ctr->drawbuffers.top.left, + 0x00000000, (u32*)ctr->drawbuffers.top.left + 2 * CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT, - 0x201, NULL, 0x00000000, + 0x201, + NULL, + 0x00000000, 0, 0x201); - } GPUCMD_SetBufferOffset(0); @@ -1503,20 +1505,20 @@ static bool ctr_frame(void* data, const void* frame, if (height > ctr->texture_height) height = ctr->texture_height; - if(frame) + if (frame) { - if(((((u32)(frame)) >= 0x14000000 && ((u32)(frame)) < 0x40000000)) /* frame in linear memory */ - && !((u32)frame & 0x7F) /* 128-byte aligned */ - && !(pitch & 0xF) /* 16-byte aligned */ - && (pitch > 0x40)) + if ( ((((u32)(frame)) >= 0x14000000 && ((u32)(frame)) < 0x40000000)) /* Frame in linear memory */ + && !((u32)frame & 0x7F) /* 128-byte aligned */ + && !(pitch & 0xF) /* 16-byte aligned */ + && (pitch > 0x40)) { - /* can copy the buffer directly with the GPU */ + /* Can copy the buffer directly with the GPU */ #if 0 GSPGPU_FlushDataCache(frame, pitch * height); #endif - ctrGuSetCommandList_First(true,(void*)frame, pitch * height,0,0,0,0); - ctrGuCopyImage(true, frame, pitch / (ctr->rgb32? 4: 2), height, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, false, - ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, true); + ctrGuSetCommandList_First(true,(void*)frame, pitch * height, 0, 0, 0, 0); + ctrGuCopyImage(true, frame, pitch / (ctr->rgb32? 4: 2), height, ctr->rgb32 ? CTRGU_RGBA8 : CTRGU_RGB565, false, + ctr->texture_swizzled, ctr->texture_width, ctr->rgb32 ? CTRGU_RGBA8 : CTRGU_RGB565, true); } else { @@ -1526,7 +1528,7 @@ static bool ctr_frame(void* data, const void* frame, for (i = 0; i < height; i++) { - memcpy(dst, src, width * (ctr->rgb32? 4: 2)); + memcpy(dst, src, width * (ctr->rgb32? 4: 2)); dst += ctr->texture_width * (ctr->rgb32? 4: 2); src += pitch; } @@ -1563,28 +1565,33 @@ static bool ctr_frame(void* data, const void* frame, GPU_CONSTANT, GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_G, 0, 0), 0, - GPU_MODULATE, GPU_REPLACE, + GPU_MODULATE, + GPU_REPLACE, 0xFF0000FF); GPU_SetTexEnv(1, GPU_TEVSOURCES(GPU_TEXTURE0, GPU_CONSTANT, GPU_PREVIOUS), GPU_PREVIOUS, GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_B, 0, 0), 0, - GPU_MULTIPLY_ADD, GPU_REPLACE, + GPU_MULTIPLY_ADD, + GPU_REPLACE, 0x00FF00); GPU_SetTexEnv(2, GPU_TEVSOURCES(GPU_TEXTURE0, GPU_CONSTANT, GPU_PREVIOUS), GPU_PREVIOUS, GPU_TEVOPERANDS(GPU_TEVOP_RGB_SRC_ALPHA, 0, 0), 0, - GPU_MULTIPLY_ADD, GPU_REPLACE, + GPU_MULTIPLY_ADD, + GPU_REPLACE, 0xFF0000); } GPU_SetViewport(NULL, VIRT_TO_PHYS(ctr->drawbuffers.top.left), 0, 0, CTR_TOP_FRAMEBUFFER_HEIGHT, - ctr->video_mode == CTR_VIDEO_MODE_2D_800X240 ? CTR_TOP_FRAMEBUFFER_WIDTH * 2 : CTR_TOP_FRAMEBUFFER_WIDTH); + ctr->video_mode == CTR_VIDEO_MODE_2D_800X240 + ? CTR_TOP_FRAMEBUFFER_WIDTH * 2 + : CTR_TOP_FRAMEBUFFER_WIDTH); if (ctr->video_mode == CTR_VIDEO_MODE_3D) { @@ -1625,7 +1632,7 @@ static bool ctr_frame(void* data, const void* frame, #ifdef HAVE_MENU if (ctr->menu_texture_enable) { - if(ctr->menu_texture_frame_enable) + if (ctr->menu_texture_frame_enable) { ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(ctr->menu.texture_swizzled), ctr->menu.texture_width, ctr->menu.texture_height, GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR) | @@ -1682,11 +1689,10 @@ static bool ctr_frame(void* data, const void* frame, if ( ctr_bottom_screen_enabled && (flags & RUNLOOP_FLAG_CORE_RUNNING)) { - if ( !ctr->bottom_is_idle ) + if (!ctr->bottom_is_idle) { ctr_render_bottom_screen(ctr); - - if ( ctr->bottom_check_idle ) + if (ctr->bottom_check_idle) ctr_set_bottom_screen_idle(ctr); } } @@ -1706,20 +1712,29 @@ static bool ctr_frame(void* data, const void* frame, gfxTopLeftFramebuffers[ctr->current_buffer_top], 240, CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE); if ((ctr->video_mode == CTR_VIDEO_MODE_2D_400X240) || (ctr->video_mode == CTR_VIDEO_MODE_3D)) - ctrGuDisplayTransfer(true, ctr->drawbuffers.top.right, - 240, - 400, - CTRGU_RGBA8, - gfxTopRightFramebuffers[ctr->current_buffer_top], 240, CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE); + ctrGuDisplayTransfer( + true, + ctr->drawbuffers.top.right, + 240, + 400, + CTRGU_RGBA8, + gfxTopRightFramebuffers[ctr->current_buffer_top], + 240, + CTRGU_RGB8, + CTRGU_MULTISAMPLE_NONE); #ifndef CONSOLE_LOG if (ctr->refresh_bottom_menu) - ctrGuDisplayTransfer(true, - ctr->drawbuffers.bottom, - 240, - 320, - CTRGU_RGBA8, - gfxBottomFramebuffers[ctr->current_buffer_bottom], 240, CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE); + ctrGuDisplayTransfer( + true, + ctr->drawbuffers.bottom, + 240, + 320, + CTRGU_RGBA8, + gfxBottomFramebuffers[ctr->current_buffer_bottom], + 240, + CTRGU_RGB8, + CTRGU_MULTISAMPLE_NONE); #endif /* Swap buffers : */ @@ -1729,7 +1744,7 @@ static bool ctr_frame(void* data, const void* frame, buf0 = (u32*)gfxTopLeftFramebuffers[ctr->current_buffer_top]; - if(ctr->video_mode == CTR_VIDEO_MODE_2D_800X240) + if (ctr->video_mode == CTR_VIDEO_MODE_2D_800X240) { buf1 = (u32*)(gfxTopLeftFramebuffers[ctr->current_buffer_top] + 240 * 3); stride = 240 * 3 * 2; @@ -1768,7 +1783,7 @@ static bool ctr_frame(void* data, const void* frame, topFramebufferInfo. framebuf0_vaddr = (u32*)gfxTopLeftFramebuffers[ctr->current_buffer_top]; - if(ctr->video_mode == CTR_VIDEO_MODE_2D_800X240) + if (ctr->video_mode == CTR_VIDEO_MODE_2D_800X240) { topFramebufferInfo. framebuf1_vaddr = (u32*)(gfxTopLeftFramebuffers[ctr->current_buffer_top] + 240 * 3); @@ -1794,7 +1809,7 @@ static bool ctr_frame(void* data, const void* frame, framebuf_dispselect = ctr->current_buffer_top; topFramebufferInfo.unk = 0x00000000; - u8* framebufferInfoHeader = gfxSharedMemory+0x200+gfxThreadID*0x80; + u8* framebufferInfoHeader = gfxSharedMemory + 0x200 + gfxThreadID * 0x80; GSPGPU_FramebufferInfo* framebufferInfo = (GSPGPU_FramebufferInfo*)&framebufferInfoHeader[0x4]; framebufferInfoHeader[0x0] ^= 1; @@ -1821,7 +1836,7 @@ static bool ctr_frame(void* data, const void* frame, framebuf_dispselect = ctr->current_buffer_bottom; bottomFramebufferInfo.unk = 0x00000000; - u8* framebufferInfoHeader2 = gfxSharedMemory+0x200+gfxThreadID*0x80+0x40; + u8* framebufferInfoHeader2 = gfxSharedMemory + 0x200 + gfxThreadID * 0x80 + 0x40; GSPGPU_FramebufferInfo* framebufferInfo2 = (GSPGPU_FramebufferInfo*)&framebufferInfoHeader2[0x4]; @@ -1913,12 +1928,12 @@ static void ctr_set_texture_frame(void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) { int i; - ctr_video_t* ctr = (ctr_video_t*)data; - int line_width = width; - (void)rgb32; - (void)alpha; + uint16_t *dst; + const uint16_t *src; + ctr_video_t *ctr = (ctr_video_t*)data; + int line_width = width; - if(!ctr || !frame) + if (!ctr || !frame) return; if (line_width > ctr->menu.texture_width) @@ -1927,8 +1942,8 @@ static void ctr_set_texture_frame(void* data, const void* frame, bool rgb32, if (height > (unsigned)ctr->menu.texture_height) height = (unsigned)ctr->menu.texture_height; - const uint16_t* src = frame; - uint16_t* dst = (uint16_t*)ctr->menu.texture_linear; + src = frame; + dst = (uint16_t*)ctr->menu.texture_linear; for (i = 0; i < height; i++) { memcpy(dst, src, line_width * sizeof(uint16_t)); @@ -1955,10 +1970,7 @@ static void ctr_set_texture_frame(void* data, const void* frame, bool rgb32, static void ctr_set_texture_enable(void* data, bool state, bool full_screen) { - (void) full_screen; - ctr_video_t* ctr = (ctr_video_t*)data; - if (ctr) ctr->menu_texture_enable = state; } @@ -1970,7 +1982,7 @@ static void ctr_set_rotation(void* data, unsigned rotation) if (!ctr) return; - ctr->rotation = rotation; + ctr->rotation = rotation; ctr->should_resize = true; } static void ctr_set_filtering(void* data, unsigned index, bool smooth, bool ctx_scaling) @@ -1985,7 +1997,7 @@ static void ctr_set_aspect_ratio(void* data, unsigned aspect_ratio_idx) { ctr_video_t *ctr = (ctr_video_t*)data; - if(!ctr) + if (!ctr) return; ctr->keep_aspect = true; @@ -1998,7 +2010,6 @@ static void ctr_apply_state_changes(void* data) if (ctr) ctr->should_resize = true; - } static void ctr_viewport_info(void* data, struct video_viewport* vp) @@ -2067,7 +2078,7 @@ static uintptr_t ctr_load_texture(void *video_data, void *data, uint32_t *src = NULL; uint32_t *dst = NULL; - tmpdata = linearAlloc(image->width + tmpdata = linearAlloc(image->width * image->height * sizeof(uint32_t)); if (!tmpdata) { @@ -2132,23 +2143,18 @@ static void ctr_overlay_tex_geom(void *data, ctr_video_t *ctr = (ctr_video_t *)data; struct ctr_overlay_data *o = NULL; - if (ctr) - o = (struct ctr_overlay_data *)&ctr->overlay[image]; - - if (!o) + if (!ctr) return; -// printf("tex_geom[%i]: %i, %i, %.6f, %.6f\n%.6f, %.6f, ", image, o->texture.width, o->texture.height,x,y,w,h); + if (!(o = (struct ctr_overlay_data *)&ctr->overlay[image])) + return; o->frame_coords->u0 = x*o->texture.width; o->frame_coords->v0 = y*o->texture.height; o->frame_coords->u1 = w*o->texture.width; o->frame_coords->v1 = h*o->texture.height; -// printf("tex_geom[%i]: %i, %i, %i, %i\n", image, o->frame_coords->u0,o->frame_coords->v0,o->frame_coords->u1,o->frame_coords->v1); - GSPGPU_FlushDataCache(o->frame_coords, sizeof(ctr_vertex_t)); - } static void ctr_overlay_vertex_geom(void *data, @@ -2157,49 +2163,46 @@ static void ctr_overlay_vertex_geom(void *data, ctr_video_t *ctr = (ctr_video_t *)data; struct ctr_overlay_data *o = NULL; - if (ctr) - o = (struct ctr_overlay_data *)&ctr->overlay[image]; - - if (!o) + if (!ctr) return; -// printf("vertex_geom[%i]: %.6f, %.6f, %.6f, %.6f, ", image, x,y,w,h); + if (!(o = (struct ctr_overlay_data *)&ctr->overlay[image])) + return; o->frame_coords->x0 = x * CTR_TOP_FRAMEBUFFER_WIDTH; o->frame_coords->y0 = y * CTR_TOP_FRAMEBUFFER_HEIGHT; o->frame_coords->x1 = w * (o->frame_coords->x0 + o->texture.width); o->frame_coords->y1 = h * (o->frame_coords->y0 + o->texture.height); -// printf("vertex_geom[%i]: %i, %i, %i, %i\n", image, o->frame_coords->x0,o->frame_coords->y0,o->frame_coords->x1,o->frame_coords->y1); - GSPGPU_FlushDataCache(o->frame_coords, sizeof(ctr_vertex_t)); } static bool ctr_overlay_load(void *data, const void *image_data, unsigned num_images) { - void* tmpdata; - unsigned i, j; + int i, j; + void *tmpdata; ctr_texture_t *texture = NULL; ctr_video_t *ctr = (ctr_video_t *)data; struct texture_image *images = (struct texture_image *)image_data; - ctr_free_overlay(ctr); - - ctr->overlay = (struct ctr_overlay_data *)calloc(num_images, sizeof(*ctr->overlay)); - if (!ctr) return false; + ctr_free_overlay(ctr); + + ctr->overlay = (struct ctr_overlay_data *)calloc(num_images, sizeof(*ctr->overlay)); ctr->overlays = num_images; for (i = 0; i < num_images; i++) { + uint32_t *src = NULL; + uint32_t *dst = NULL; struct ctr_overlay_data *o = (struct ctr_overlay_data *)&ctr->overlay[i]; o->frame_coords = linearAlloc(sizeof(ctr_vertex_t)); - if (!ctr || !images || images[i].width > 1024 || images[i].height > 1024) + if (!images || images[i].width > 1024 || images[i].height > 1024) return 0; memset(&o->texture, 0, sizeof(ctr_texture_t)); @@ -2215,8 +2218,6 @@ static bool ctr_overlay_load(void *data, return 0; } - uint32_t *src = NULL; - uint32_t *dst = NULL; tmpdata = linearAlloc(images[i].width * images[i].height * sizeof(uint32_t)); @@ -2268,10 +2269,8 @@ static void ctr_overlay_enable(void *data, bool state) { ctr_video_t *ctr = (ctr_video_t *)data; - if (!ctr) - return; - - ctr->overlay_enabled = state; + if (ctr) + ctr->overlay_enabled = state; } static void ctr_overlay_full_screen(void *data, bool enable) @@ -2284,7 +2283,7 @@ static void ctr_overlay_set_alpha(void *data, unsigned image, float mod){ } static void ctr_render_overlay(void *data) { - unsigned i; + int i; ctr_video_t *ctr = (ctr_video_t*)data; for (i = 0; i < ctr->overlays; i++) @@ -2328,10 +2327,8 @@ void ctr_overlay_interface(void *data, const video_overlay_interface_t **iface) { ctr_video_t *ctr = (ctr_video_t *)data; - if (!ctr) - return; - - *iface = &ctr_overlay; + if (ctr) + *iface = &ctr_overlay; } #endif @@ -2385,27 +2382,14 @@ static const video_poke_interface_t ctr_poke_interface = { static void ctr_get_poke_interface(void* data, const video_poke_interface_t** iface) { - (void)data; *iface = &ctr_poke_interface; } #ifdef HAVE_GFX_WIDGETS -static bool ctr_gfx_widgets_enabled(void *data) -{ - (void)data; - return true; -} +static bool ctr_gfx_widgets_enabled(void *data) { return true; } #endif - static bool ctr_set_shader(void* data, - enum rarch_shader_type type, const char* path) -{ - (void)data; - (void)type; - (void)path; - - return false; -} + enum rarch_shader_type type, const char* path) { return false; } video_driver_t video_ctr = { diff --git a/gfx/drivers/d3d9_renderchain.h b/gfx/drivers/d3d9_renderchain.h index 9477297704..a3b01145af 100644 --- a/gfx/drivers/d3d9_renderchain.h +++ b/gfx/drivers/d3d9_renderchain.h @@ -156,14 +156,14 @@ static INLINE bool d3d9_renderchain_add_lut(d3d9_renderchain_t *chain, NULL, false ); + if (!lut) + return false; RARCH_LOG("[D3D9]: LUT texture loaded: %s.\n", path); info.tex = lut; info.smooth = smooth; strlcpy(info.id, id, sizeof(info.id)); - if (!lut) - return false; IDirect3DDevice9_SetTexture(chain->dev, 0, (IDirect3DBaseTexture9*)lut); IDirect3DDevice9_SetSamplerState(chain->dev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER); @@ -180,7 +180,7 @@ static INLINE void d3d9_renderchain_destroy_passes_and_luts( { if (chain->passes) { - unsigned i; + int i; for (i = 0; i < chain->passes->count; i++) { @@ -237,8 +237,7 @@ static INLINE void d3d9_renderchain_end_render(d3d9_renderchain_t *chain) static INLINE void d3d9_renderchain_unbind_all(d3d9_renderchain_t *chain) { - unsigned i; - + int i; /* Have to be a bit anal about it. * Render targets hate it when they have filters apparently. */ @@ -347,7 +346,7 @@ static INLINE void d3d9_recompute_pass_sizes( d3d9_renderchain_t *chain, d3d9_video_t *d3d) { - unsigned i; + int i; struct LinkInfo link_info; unsigned input_scale = d3d->video_info.input_scale * RARCH_SCALE_BASE;