1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 20:25:47 +00:00

Fix some static code analysis warnings from MSVC 2017

This commit is contained in:
twinaphex 2019-01-10 21:47:15 +01:00
parent 24ce1aee21
commit b9ff2e4de1
14 changed files with 368 additions and 282 deletions

View File

@ -392,9 +392,9 @@ static bool audio_driver_deinit_internal(void)
return true;
}
static void audio_driver_mixer_init(unsigned out_rate)
static void audio_driver_mixer_init(unsigned audio_out_rate)
{
audio_mixer_init(out_rate);
audio_mixer_init(audio_out_rate);
}
static bool audio_driver_init_internal(bool audio_cb_inited)

View File

@ -422,18 +422,23 @@ void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id)
}
}
memset(mon, 0, sizeof(*mon));
mon->cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(*hm_to_use, (LPMONITORINFO)mon);
if (hm_to_use)
{
memset(mon, 0, sizeof(*mon));
mon->cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(*hm_to_use, (LPMONITORINFO)mon);
}
}
bool win32_load_content_from_gui(const char *szFilename)
{
/* poll list of current cores */
size_t list_size;
content_ctx_info_t content_info = { 0 };
content_ctx_info_t content_info = { 0 };
core_info_list_t *core_info_list = NULL;
const core_info_t *core_info = NULL;
const core_info_t *core_info = NULL;
core_info_get_list(&core_info_list);
if (!core_info_list)
@ -463,7 +468,6 @@ bool win32_load_content_from_gui(const char *szFilename)
if (string_is_equal(path_get(RARCH_PATH_CORE), info->path))
{
/* Our previous core supports the current rom */
content_ctx_info_t content_info = { 0 };
task_push_load_content_with_current_core_from_companion_ui(
NULL,
&content_info,
@ -489,13 +493,12 @@ bool win32_load_content_from_gui(const char *szFilename)
}
else
{
bool okay = false;
bool okay = false;
settings_t *settings = config_get_ptr();
/* Fullscreen: Show mouse cursor for dialog */
if (settings->bools.video_fullscreen)
{
video_driver_show_mouse();
}
/* Pick one core that could be compatible, ew */
if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE),
@ -508,9 +511,7 @@ bool win32_load_content_from_gui(const char *szFilename)
/* Fullscreen: Hide mouse cursor after dialog */
if (settings->bools.video_fullscreen)
{
video_driver_hide_mouse();
}
return okay;
}
return false;
@ -518,21 +519,19 @@ bool win32_load_content_from_gui(const char *szFilename)
static bool win32_drag_query_file(HWND hwnd, WPARAM wparam)
{
bool okay = false;
#ifdef LEGACY_WIN32
char szFilename[1024];
szFilename[0] = '\0';
#else
char *szFilename = NULL;
wchar_t wszFilename[1024];
wszFilename[0] = L'\0';
#endif
if (DragQueryFileR((HDROP)wparam, 0xFFFFFFFF, NULL, 0))
{
bool okay = false;
#ifdef LEGACY_WIN32
char szFilename[1024];
szFilename[0] = '\0';
DragQueryFileR((HDROP)wparam, 0, szFilename, sizeof(szFilename));
#else
wchar_t wszFilename[4096];
char *szFilename = NULL;
wszFilename[0] = L'\0';
DragQueryFileR((HDROP)wparam, 0, wszFilename, sizeof(wszFilename));
szFilename = utf16_to_utf8_string_alloc(wszFilename);
#endif
@ -541,9 +540,11 @@ static bool win32_drag_query_file(HWND hwnd, WPARAM wparam)
if (szFilename)
free(szFilename);
#endif
return okay;
}
return okay;
return false;
}
#ifndef _XBOX
@ -625,28 +626,33 @@ static LRESULT win32_handle_keyboard_event(HWND hwnd, UINT message,
static void win32_set_position_from_config(void)
{
settings_t *settings = config_get_ptr();
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU);
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU);
if (!settings->bools.video_window_save_positions)
return;
g_win32_pos_x = settings->uints.window_position_x;
g_win32_pos_y = settings->uints.window_position_y;
g_win32_pos_width = settings->uints.window_position_width + border_thickness * 2;
g_win32_pos_height= settings->uints.window_position_height + border_thickness * 2 + title_bar_height;
g_win32_pos_x = settings->uints.window_position_x;
g_win32_pos_y = settings->uints.window_position_y;
g_win32_pos_width = settings->uints.window_position_width
+ border_thickness * 2;
g_win32_pos_height = settings->uints.window_position_height
+ border_thickness * 2 + title_bar_height;
}
static void win32_save_position(void)
{
RECT rect;
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU);
WINDOWPLACEMENT placement;
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_bar_height = GetSystemMetrics(SM_CYCAPTION);
int menu_bar_height = GetSystemMetrics(SM_CYMENU);
settings_t *settings = config_get_ptr();
memset(&placement, 0, sizeof(placement));
placement.length = sizeof(placement);
placement.length = sizeof(placement);
GetWindowPlacement(main_window.hwnd, &placement);
@ -689,10 +695,8 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
}
break;
case WM_DROPFILES:
{
win32_drag_query_file(hwnd, wparam);
DragFinish((HDROP)wparam);
}
win32_drag_query_file(hwnd, wparam);
DragFinish((HDROP)wparam);
break;
case WM_CHAR:
case WM_KEYDOWN:
@ -1146,14 +1150,22 @@ bool win32_suppress_screensaver(void *data, bool enable)
{
#if _WIN32_WINNT >= 0x0601
/* Windows 7, 8, 10 codepath */
PowerCreateRequestPtr powerCreateRequest;
PowerSetRequestPtr powerSetRequest;
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
POWER_REQUEST_TYPE RequestType);
HMODULE kernel32 = GetModuleHandle("kernel32.dll");
PowerCreateRequestPtr powerCreateRequest =
(PowerCreateRequestPtr)GetProcAddress(kernel32, "PowerCreateRequest");
PowerSetRequestPtr powerSetRequest =
(PowerSetRequestPtr)GetProcAddress(kernel32, "PowerSetRequest");
if (kernel32)
{
powerCreateRequest =
(PowerCreateRequestPtr)GetProcAddress(
kernel32, "PowerCreateRequest");
powerSetRequest =
(PowerSetRequestPtr)GetProcAddress(
kernel32, "PowerSetRequest");
}
if (powerCreateRequest && powerSetRequest)
{
@ -1512,10 +1524,8 @@ float win32_get_refresh_rate(void *data)
&TopologyID);
if (result == ERROR_SUCCESS && NumPathArrayElements >= 1)
{
refresh_rate = (float) PathInfoArray[0].targetInfo.refreshRate.Numerator /
PathInfoArray[0].targetInfo.refreshRate.Denominator;
}
free(ModeInfoArray);
free(PathInfoArray);

View File

@ -1202,8 +1202,6 @@ static bool d3d10_gfx_frame(
if (d3d10->shader_preset)
{
unsigned i;
for (i = 0; i < d3d10->shader_preset->passes; i++)
{
if (d3d10->shader_preset->pass[i].feedback)
@ -1233,14 +1231,17 @@ static bool d3d10_gfx_frame(
if (buffer_sem->stage_mask && buffer_sem->uniforms)
{
void* data;
void* uniform_data = NULL;
uniform_sem_t* uniform = buffer_sem->uniforms;
D3D10MapBuffer(buffer, D3D10_MAP_WRITE_DISCARD, 0, (void**)&data);
D3D10MapBuffer(buffer, D3D10_MAP_WRITE_DISCARD,
0, (void**)&uniform_data);
while (uniform->size)
{
if (uniform->data)
memcpy((uint8_t*)data + uniform->offset, uniform->data, uniform->size);
memcpy((uint8_t*)uniform_data + uniform->offset,
uniform->data, uniform->size);
uniform++;
}
D3D10UnmapBuffer(buffer);

View File

@ -1824,12 +1824,14 @@ static void d3d9_set_menu_texture_frame(void *data,
(void)height;
(void)alpha;
if (!d3d || !d3d->menu)
return;
if ( !d3d->menu->tex ||
d3d->menu->tex_w != width ||
d3d->menu->tex_h != height)
{
if (d3d->menu)
d3d9_texture_free((LPDIRECT3DTEXTURE9)d3d->menu->tex);
d3d9_texture_free((LPDIRECT3DTEXTURE9)d3d->menu->tex);
d3d->menu->tex = d3d9_texture_new(d3d->dev, NULL,
width, height, 1,

View File

@ -90,6 +90,9 @@ static void *gdi_gfx_init(const video_info_t *video,
settings_t *settings = config_get_ptr();
gdi_t *gdi = (gdi_t*)calloc(1, sizeof(*gdi));
if (!gdi)
return NULL;
*input = NULL;
*input_data = NULL;
@ -115,7 +118,8 @@ static void *gdi_gfx_init(const video_info_t *video,
if (ctx_data)
gdi->ctx_data = ctx_data;
gdi->ctx_driver = ctx_driver;
gdi->ctx_driver = ctx_driver;
video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver);
RARCH_LOG("[GDI]: Found GDI context: %s\n", ctx_driver->ident);
@ -189,6 +193,7 @@ static bool gdi_gfx_frame(void *data, const void *frame,
unsigned frame_width, unsigned frame_height, uint64_t frame_count,
unsigned pitch, const char *msg, video_frame_info_t *video_info)
{
BITMAPINFO *info;
gfx_ctx_mode_t mode;
const void *frame_to_copy = frame;
unsigned width = 0;
@ -197,10 +202,9 @@ static bool gdi_gfx_frame(void *data, const void *frame,
bool draw = true;
gdi_t *gdi = (gdi_t*)data;
HWND hwnd = win32_get_window();
BITMAPINFO *info;
/* FIXME: Force these settings off as they interfere with the rendering */
video_info->xmb_shadows_enable = false;
video_info->xmb_shadows_enable = false;
video_info->menu_shader_pipeline = 0;
if (!frame || !frame_width || !frame_height)
@ -210,13 +214,15 @@ static bool gdi_gfx_frame(void *data, const void *frame,
menu_driver_frame(video_info);
#endif
if (gdi_video_width != frame_width || gdi_video_height != frame_height || gdi_video_pitch != pitch)
if ( gdi_video_width != frame_width ||
gdi_video_height != frame_height ||
gdi_video_pitch != pitch)
{
if (frame_width > 4 && frame_height > 4)
{
gdi_video_width = frame_width;
gdi_video_width = frame_width;
gdi_video_height = frame_height;
gdi_video_pitch = pitch;
gdi_video_pitch = pitch;
}
}
@ -234,7 +240,10 @@ static bool gdi_gfx_frame(void *data, const void *frame,
height = gdi_video_height;
pitch = gdi_video_pitch;
if (frame_width == 4 && frame_height == 4 && (frame_width < width && frame_height < height))
if ( frame_width == 4 &&
frame_height == 4 &&
(frame_width < width && frame_height < height)
)
draw = false;
if (video_info->menu_is_alive)
@ -243,11 +252,12 @@ static bool gdi_gfx_frame(void *data, const void *frame,
if (hwnd && !gdi->winDC)
{
gdi->winDC = GetDC(hwnd);
gdi->memDC = CreateCompatibleDC(gdi->winDC);
gdi->video_width = width;
gdi->winDC = GetDC(hwnd);
gdi->memDC = CreateCompatibleDC(gdi->winDC);
gdi->video_width = width;
gdi->video_height = height;
gdi->bmp = CreateCompatibleBitmap(gdi->winDC, gdi->video_width, gdi->video_height);
gdi->bmp = CreateCompatibleBitmap(
gdi->winDC, gdi->video_width, gdi->video_height);
}
gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp);
@ -257,28 +267,34 @@ static bool gdi_gfx_frame(void *data, const void *frame,
SelectObject(gdi->memDC, gdi->bmp_old);
DeleteObject(gdi->bmp);
gdi->video_width = width;
gdi->video_width = width;
gdi->video_height = height;
gdi->bmp = CreateCompatibleBitmap(gdi->winDC, gdi->video_width, gdi->video_height);
gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp);
gdi->bmp = CreateCompatibleBitmap(
gdi->winDC, gdi->video_width, gdi->video_height);
gdi->bmp_old = (HBITMAP)SelectObject(gdi->memDC, gdi->bmp);
if (gdi_lte_win98)
{
if (gdi_temp_buf)
{
free(gdi_temp_buf);
}
unsigned short *tmp = NULL;
gdi_temp_buf = (unsigned short*)malloc(width * height * sizeof(unsigned short));
if (gdi_temp_buf)
free(gdi_temp_buf);
tmp = (unsigned short*)malloc(width * height
* sizeof(unsigned short));
if (tmp)
gdi_temp_buf = tmp;
}
}
video_context_driver_get_video_size(&mode);
gdi->screen_width = mode.width;
gdi->screen_height = mode.height;
gdi->screen_width = mode.width;
gdi->screen_height = mode.height;
info = (BITMAPINFO*)calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD)));
info = (BITMAPINFO*)
calloc(1, sizeof(*info) + (3 * sizeof(RGBQUAD)));
info->bmiHeader.biBitCount = bits;
info->bmiHeader.biWidth = pitch / (bits / 8);
@ -334,10 +350,8 @@ static bool gdi_gfx_frame(void *data, const void *frame,
info->bmiHeader.biCompression = BI_RGB;
if (draw)
{
StretchDIBits(gdi->memDC, 0, 0, width, height, 0, 0, width, height,
frame_to_copy, info, DIB_RGB_COLORS, SRCCOPY);
}
SelectObject(gdi->memDC, gdi->bmp_old);
@ -495,9 +509,19 @@ static void gdi_set_texture_frame(void *data,
gdi_menu_frame = NULL;
}
if (!gdi_menu_frame || gdi_menu_width != width || gdi_menu_height != height || gdi_menu_pitch != pitch)
if ( !gdi_menu_frame ||
gdi_menu_width != width ||
gdi_menu_height != height ||
gdi_menu_pitch != pitch)
{
if (pitch && height)
gdi_menu_frame = (unsigned char*)malloc(pitch * height);
{
unsigned char *tmp = (unsigned char*)malloc(pitch * height);
if (tmp)
gdi_menu_frame = tmp;
}
}
if (gdi_menu_frame && frame && pitch && height)
{
@ -514,7 +538,8 @@ static void gdi_set_osd_msg(void *data,
const char *msg,
const void *params, void *font)
{
font_driver_render_msg(video_info, font, msg, (const struct font_params *)params);
font_driver_render_msg(video_info, font,
msg, (const struct font_params *)params);
}
static void gdi_get_video_output_size(void *data,
@ -551,21 +576,27 @@ static void gdi_set_video_mode(void *data, unsigned width, unsigned height,
static uintptr_t gdi_load_texture(void *video_data, void *data,
bool threaded, enum texture_filter_type filter_type)
{
void *tmpdata = NULL;
gdi_texture_t *texture = NULL;
struct texture_image *image = (struct texture_image*)data;
int size = image->width * image->height * sizeof(uint32_t);
gdi_texture_t *texture = NULL;
void *tmpdata = NULL;
int size = image->width *
image->height * sizeof(uint32_t);
if (!image || image->width > 2048 || image->height > 2048)
return 0;
texture = calloc(1, sizeof(*texture));
texture->width = image->width;
texture->height = image->height;
texture->active_width = image->width;
texture->active_height = image->height;
texture->data = calloc(1, texture->width * texture->height * sizeof(uint32_t));
texture->type = filter_type;
texture = calloc(1, sizeof(*texture));
if (!texture)
return 0;
texture->width = image->width;
texture->height = image->height;
texture->active_width = image->width;
texture->active_height = image->height;
texture->data = calloc(1,
texture->width * texture->height * sizeof(uint32_t));
texture->type = filter_type;
if (!texture->data)
{
@ -573,7 +604,8 @@ static uintptr_t gdi_load_texture(void *video_data, void *data,
return 0;
}
memcpy(texture->data, image->pixels, texture->width * texture->height * sizeof(uint32_t));
memcpy(texture->data, image->pixels,
texture->width * texture->height * sizeof(uint32_t));
return (uintptr_t)texture;
}

View File

@ -1001,12 +1001,14 @@ static void vulkan_set_image(void *handle,
if (num_semaphores > 0)
{
vk->hw.wait_dst_stages = (VkPipelineStageFlags*)
VkPipelineStageFlags *stage_flags = (VkPipelineStageFlags*)
realloc(vk->hw.wait_dst_stages,
sizeof(VkPipelineStageFlags) * vk->hw.num_semaphores);
/* If this fails, we're screwed anyways. */
retro_assert(vk->hw.wait_dst_stages);
retro_assert(stage_flags);
vk->hw.wait_dst_stages = stage_flags;
for (i = 0; i < vk->hw.num_semaphores; i++)
vk->hw.wait_dst_stages[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
@ -1030,11 +1032,14 @@ static void vulkan_set_command_buffers(void *handle, uint32_t num_cmd,
unsigned required_capacity = num_cmd + 1;
if (required_capacity > vk->hw.capacity_cmd)
{
vk->hw.cmd = (VkCommandBuffer*)realloc(vk->hw.cmd,
VkCommandBuffer *hw_cmd = (VkCommandBuffer*)
realloc(vk->hw.cmd,
sizeof(VkCommandBuffer) * required_capacity);
/* If this fails, we're just screwed. */
retro_assert(vk->hw.cmd);
retro_assert(hw_cmd);
vk->hw.cmd = hw_cmd;
vk->hw.capacity_cmd = required_capacity;
}

View File

@ -67,7 +67,7 @@ typedef struct __GLsync *GLsync;
#endif
#endif
typedef struct gl2_renderchain
typedef struct gl2_renderchain_data
{
bool egl_images;
bool has_fp_fbo;
@ -89,7 +89,7 @@ typedef struct gl2_renderchain
#endif
struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS];
} gl2_renderchain_t;
} gl2_renderchain_data_t;
#if (!defined(HAVE_OPENGLES) || defined(HAVE_OPENGLES3))
#ifdef GL_PIXEL_PACK_BUFFER
@ -260,7 +260,7 @@ static void gl_check_fbo_dimension(gl_t *gl,
struct video_fbo_rect *fbo_rect = &gl->fbo_rect[i];
/* Check proactively since we might suddently
* get sizes of tex_w width or tex_h height. */
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
unsigned img_width = fbo_rect->max_img_width;
unsigned img_height = fbo_rect->max_img_height;
unsigned max = img_width > img_height ? img_width : img_height;
@ -296,7 +296,7 @@ static void gl2_renderchain_check_fbo_dimensions(
gl_t *gl, void *chain_data)
{
int i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
/* Check if we have to recreate our FBO textures. */
for (i = 0; i < chain->fbo_pass; i++)
@ -326,7 +326,7 @@ static void gl2_renderchain_render(
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
video_shader_ctx_info_t shader_info;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
static GLfloat fbo_tex_coords[8] = {0.0f};
struct video_tex_info fbo_tex_info[GFX_MAX_SHADERS];
struct video_tex_info *fbo_info = NULL;
@ -345,8 +345,6 @@ static void gl2_renderchain_render(
* and render all passes from FBOs, to another FBO. */
for (i = 1; i < chain->fbo_pass; i++)
{
video_shader_ctx_coords_t coords;
video_shader_ctx_params_t params;
const struct video_fbo_rect *rect = &gl->fbo_rect[i];
prev_rect = &gl->fbo_rect[i - 1];
@ -495,7 +493,7 @@ static void gl2_renderchain_render(
static void gl2_renderchain_deinit_fbo(gl_t *gl,
void *chain_data)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (gl)
{
@ -527,7 +525,7 @@ static void gl2_renderchain_deinit_hw_render(
gl_t *gl,
void *chain_data)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!gl)
return;
@ -551,7 +549,7 @@ static void gl2_renderchain_free(gl_t *gl, void *chain_data)
static bool gl_create_fbo_targets(gl_t *gl, void *chain_data)
{
int i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
glBindTexture(GL_TEXTURE_2D, 0);
gl2_gen_fb(chain->fbo_pass, chain->fbo);
@ -604,20 +602,20 @@ static void gl_create_fbo_texture(gl_t *gl,
{
GLenum mag_filter, wrap_enum;
video_shader_ctx_filter_t filter_type;
video_shader_ctx_wrap_t wrap = {0};
bool fp_fbo = false;
bool smooth = false;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
settings_t *settings = config_get_ptr();
GLuint base_filt = settings->bools.video_smooth ? GL_LINEAR : GL_NEAREST;
GLuint base_mip_filt = settings->bools.video_smooth ?
video_shader_ctx_wrap_t wrap = {0};
bool fp_fbo = false;
bool smooth = false;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
settings_t *settings = config_get_ptr();
GLuint base_filt = settings->bools.video_smooth ? GL_LINEAR : GL_NEAREST;
GLuint base_mip_filt = settings->bools.video_smooth ?
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
unsigned mip_level = i + 2;
bool mipmapped = video_shader_driver_mipmap_input(&mip_level);
GLenum min_filter = mipmapped ? base_mip_filt : base_filt;
unsigned mip_level = i + 2;
bool mipmapped = video_shader_driver_mipmap_input(&mip_level);
GLenum min_filter = mipmapped ? base_mip_filt : base_filt;
filter_type.index = i + 2;
filter_type.smooth = &smooth;
filter_type.index = i + 2;
filter_type.smooth = &smooth;
if (video_shader_driver_filter_type(&filter_type))
{
@ -704,7 +702,8 @@ static void gl_create_fbo_texture(gl_t *gl,
}
}
static void gl_create_fbo_textures(gl_t *gl, gl2_renderchain_t *chain)
static void gl_create_fbo_textures(gl_t *gl,
gl2_renderchain_data_t *chain)
{
int i;
@ -736,7 +735,8 @@ static void gl2_renderchain_recompute_pass_sizes(
unsigned vp_width, unsigned vp_height)
{
int i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t
*chain = (gl2_renderchain_data_t*)chain_data;
bool size_modified = false;
GLint max_size = 0;
unsigned last_width = width;
@ -807,7 +807,7 @@ static void gl2_renderchain_start_render(
0, 1,
1, 1
};
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
gl2_bind_fb(chain->fbo[0]);
@ -838,7 +838,7 @@ void gl2_renderchain_init(
video_shader_ctx_scale_t scaler;
video_shader_ctx_info_t shader_info;
struct gfx_fbo_scale scale, scale_last;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!video_shader_driver_info(&shader_info))
return;
@ -951,7 +951,7 @@ static bool gl2_renderchain_init_hw_render(
GLint max_renderbuffer_size = 0;
struct retro_hw_render_callback *hwr =
video_driver_get_hw_context();
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
/* We can only share texture objects through contexts.
* FBOs are "abstract" objects and are not shared. */
@ -1045,7 +1045,7 @@ static void gl2_renderchain_bind_prev_texture(
void *chain_data,
const struct video_tex_info *tex_info)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
memmove(gl->prev_info + 1, gl->prev_info,
sizeof(*tex_info) * (gl->textures - 1));
@ -1170,7 +1170,7 @@ error:
void gl2_renderchain_free_internal(void *data, void *chain_data)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain)
return;
@ -1180,7 +1180,8 @@ void gl2_renderchain_free_internal(void *data, void *chain_data)
static void *gl2_renderchain_new(void)
{
gl2_renderchain_t *renderchain = (gl2_renderchain_t*)calloc(1, sizeof(*renderchain));
gl2_renderchain_data_t *renderchain =
(gl2_renderchain_data_t*)calloc(1, sizeof(*renderchain));
if (!renderchain)
return NULL;
@ -1191,7 +1192,7 @@ static void *gl2_renderchain_new(void)
static void gl2_renderchain_bind_vao(void *data,
void *chain_data)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain)
return;
glBindVertexArray(chain->vao);
@ -1206,7 +1207,7 @@ static void gl2_renderchain_unbind_vao(void *data,
static void gl2_renderchain_new_vao(void *data,
void *chain_data)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain)
return;
glGenVertexArrays(1, &chain->vao);
@ -1215,7 +1216,7 @@ static void gl2_renderchain_new_vao(void *data,
static void gl2_renderchain_free_vao(void *data,
void *chain_data)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
if (!chain)
return;
glDeleteVertexArrays(1, &chain->vao);
@ -1244,7 +1245,7 @@ static void gl2_renderchain_copy_frame(
const void *frame,
unsigned width, unsigned height, unsigned pitch)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
(void)chain;
@ -1424,7 +1425,7 @@ static void gl2_renderchain_fence_iterate(
unsigned hard_sync_frames)
{
#ifdef HAVE_GL_SYNC
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
chain->fences[chain->fence_count++] =
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
@ -1447,7 +1448,7 @@ static void gl2_renderchain_fence_free(void *data,
{
#ifdef HAVE_GL_SYNC
unsigned i;
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
for (i = 0; i < chain->fence_count; i++)
{
@ -1465,7 +1466,7 @@ static void gl2_renderchain_init_textures_reference(
unsigned internal_fmt, unsigned texture_fmt,
unsigned texture_type)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
(void)chain;
@ -1493,7 +1494,7 @@ static void gl2_renderchain_resolve_extensions(gl_t *gl,
void *chain_data, const char *context_ident,
const video_info_t *video)
{
gl2_renderchain_t *chain = (gl2_renderchain_t*)chain_data;
gl2_renderchain_data_t *chain = (gl2_renderchain_data_t*)chain_data;
settings_t *settings = config_get_ptr();
if (!chain)

View File

@ -126,7 +126,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
char scale_type_y[64];
char frame_count_mod[64];
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
char *tmp_str = (char*)malloc(path_size);
char *tmp_path = NULL;
struct gfx_fbo_scale *scale = NULL;
bool tmp_bool = false;
@ -443,7 +443,7 @@ bool video_shader_resolve_current_parameters(config_file_t *conf,
if (!conf)
return false;
parameters = (char*)malloc(4096 * sizeof(char));
parameters = (char*)malloc(param_size);
parameters[0] = '\0';
/* Read in parameters which override the defaults. */
@ -526,7 +526,7 @@ bool video_shader_resolve_parameters(config_file_t *conf,
if (!file)
continue;
line = (char*)malloc(4096 * sizeof(char));
line = (char*)malloc(line_size);
line[0] = '\0';
/* even though the pass is set in the loop too, not all passes have parameters */
@ -690,6 +690,10 @@ static bool video_shader_parse_imports(config_file_t *conf,
}
tmp_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
if (!tmp_str)
goto error;
tmp_str[0] = '\0';
if (config_get_path(conf, "import_script", tmp_str, path_size))
strlcpy(shader->script_path, tmp_str, sizeof(shader->script_path));
@ -961,112 +965,122 @@ void video_shader_write_conf_cgp(config_file_t *conf,
for (i = 0; i < shader->passes; i++)
{
char key[64];
size_t tmp_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
size_t tmp_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp = (char*)malloc(tmp_size);
const struct video_shader_pass *pass = &shader->pass[i];
key[0] = '\0';
snprintf(key, sizeof(key), "shader%u", i);
strlcpy(tmp, pass->source.path, tmp_size);
if (!path_is_absolute(tmp))
path_resolve_realpath(tmp, tmp_size);
config_set_string(conf, key, tmp);
free(tmp);
if (pass->filter != RARCH_FILTER_UNSPEC)
if (tmp)
{
snprintf(key, sizeof(key), "filter_linear%u", i);
config_set_bool(conf, key, pass->filter == RARCH_FILTER_LINEAR);
key[0] = '\0';
snprintf(key, sizeof(key), "shader%u", i);
strlcpy(tmp, pass->source.path, tmp_size);
if (!path_is_absolute(tmp))
path_resolve_realpath(tmp, tmp_size);
config_set_string(conf, key, tmp);
free(tmp);
if (pass->filter != RARCH_FILTER_UNSPEC)
{
snprintf(key, sizeof(key), "filter_linear%u", i);
config_set_bool(conf, key, pass->filter == RARCH_FILTER_LINEAR);
}
snprintf(key, sizeof(key), "wrap_mode%u", i);
config_set_string(conf, key, wrap_mode_to_str(pass->wrap));
if (pass->frame_count_mod)
{
snprintf(key, sizeof(key), "frame_count_mod%u", i);
config_set_int(conf, key, pass->frame_count_mod);
}
snprintf(key, sizeof(key), "mipmap_input%u", i);
config_set_bool(conf, key, pass->mipmap);
snprintf(key, sizeof(key), "alias%u", i);
config_set_string(conf, key, pass->alias);
shader_write_fbo(conf, &pass->fbo, i);
}
snprintf(key, sizeof(key), "wrap_mode%u", i);
config_set_string(conf, key, wrap_mode_to_str(pass->wrap));
if (pass->frame_count_mod)
{
snprintf(key, sizeof(key), "frame_count_mod%u", i);
config_set_int(conf, key, pass->frame_count_mod);
}
snprintf(key, sizeof(key), "mipmap_input%u", i);
config_set_bool(conf, key, pass->mipmap);
snprintf(key, sizeof(key), "alias%u", i);
config_set_string(conf, key, pass->alias);
shader_write_fbo(conf, &pass->fbo, i);
}
if (shader->num_parameters)
{
size_t param_size = 4096 * sizeof(char);
char *parameters = (char*)malloc(4096 * sizeof(char));
char *parameters = (char*)malloc(param_size);
parameters[0] = '\0';
strlcpy(parameters, shader->parameters[0].id, param_size);
for (i = 1; i < shader->num_parameters; i++)
if (parameters)
{
/* O(n^2), but number of parameters is very limited. */
strlcat(parameters, ";", param_size);
strlcat(parameters, shader->parameters[i].id, param_size);
parameters[0] = '\0';
strlcpy(parameters, shader->parameters[0].id, param_size);
for (i = 1; i < shader->num_parameters; i++)
{
/* O(n^2), but number of parameters is very limited. */
strlcat(parameters, ";", param_size);
strlcat(parameters, shader->parameters[i].id, param_size);
}
config_set_string(conf, "parameters", parameters);
for (i = 0; i < shader->num_parameters; i++)
config_set_float(conf, shader->parameters[i].id,
shader->parameters[i].current);
free(parameters);
}
config_set_string(conf, "parameters", parameters);
for (i = 0; i < shader->num_parameters; i++)
config_set_float(conf, shader->parameters[i].id,
shader->parameters[i].current);
free(parameters);
}
if (shader->luts)
{
size_t tex_size = 4096 * sizeof(char);
char *textures = (char*)malloc(4096 * sizeof(char));
char *textures = (char*)malloc(tex_size);
textures[0] = '\0';
strlcpy(textures, shader->lut[0].id, tex_size);
for (i = 1; i < shader->luts; i++)
if (textures)
{
/* O(n^2), but number of textures is very limited. */
strlcat(textures, ";", tex_size);
strlcat(textures, shader->lut[i].id, tex_size);
}
textures[0] = '\0';
config_set_string(conf, "textures", textures);
strlcpy(textures, shader->lut[0].id, tex_size);
free(textures);
for (i = 0; i < shader->luts; i++)
{
char key[64];
key[0] = '\0';
config_set_string(conf, shader->lut[i].id, shader->lut[i].path);
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
for (i = 1; i < shader->luts; i++)
{
snprintf(key, sizeof(key), "%s_linear", shader->lut[i].id);
config_set_bool(conf, key,
shader->lut[i].filter == RARCH_FILTER_LINEAR);
/* O(n^2), but number of textures is very limited. */
strlcat(textures, ";", tex_size);
strlcat(textures, shader->lut[i].id, tex_size);
}
snprintf(key, sizeof(key),
"%s_wrap_mode", shader->lut[i].id);
config_set_string(conf, key,
wrap_mode_to_str(shader->lut[i].wrap));
config_set_string(conf, "textures", textures);
snprintf(key, sizeof(key),
"%s_mipmap", shader->lut[i].id);
config_set_bool(conf, key,
shader->lut[i].mipmap);
free(textures);
for (i = 0; i < shader->luts; i++)
{
char key[64];
key[0] = '\0';
config_set_string(conf, shader->lut[i].id, shader->lut[i].path);
if (shader->lut[i].filter != RARCH_FILTER_UNSPEC)
{
snprintf(key, sizeof(key), "%s_linear", shader->lut[i].id);
config_set_bool(conf, key,
shader->lut[i].filter == RARCH_FILTER_LINEAR);
}
snprintf(key, sizeof(key),
"%s_wrap_mode", shader->lut[i].id);
config_set_string(conf, key,
wrap_mode_to_str(shader->lut[i].wrap));
snprintf(key, sizeof(key),
"%s_mipmap", shader->lut[i].id);
config_set_bool(conf, key,
shader->lut[i].mipmap);
}
}
}
@ -1078,23 +1092,26 @@ void video_shader_write_conf_cgp(config_file_t *conf,
if (shader->variables)
{
size_t var_tmp = 4096 * sizeof(char);
char *variables = (char*)malloc(4096 * sizeof(char));
char *variables = (char*)malloc(var_tmp);
variables[0] = '\0';
strlcpy(variables, shader->variable[0].id, var_tmp);
for (i = 1; i < shader->variables; i++)
if (variables)
{
strlcat(variables, ";", var_tmp);
strlcat(variables, shader->variable[i].id, var_tmp);
variables[0] = '\0';
strlcpy(variables, shader->variable[0].id, var_tmp);
for (i = 1; i < shader->variables; i++)
{
strlcat(variables, ";", var_tmp);
strlcat(variables, shader->variable[i].id, var_tmp);
}
config_set_string(conf, "imports", variables);
for (i = 0; i < shader->variables; i++)
shader_write_variable(conf, &shader->variable[i]);
free(variables);
}
config_set_string(conf, "imports", variables);
for (i = 0; i < shader->variables; i++)
shader_write_variable(conf, &shader->variable[i]);
free(variables);
}
}
@ -1309,7 +1326,7 @@ void video_shader_resolve_relative(struct video_shader *shader,
{
unsigned i;
size_t tmp_path_size = 4096 * sizeof(char);
char *tmp_path = (char*)malloc(4096 * sizeof(char));
char *tmp_path = (char*)malloc(tmp_path_size);
tmp_path[0] = '\0';

View File

@ -430,24 +430,28 @@ static bool video_thread_handle_packet(
break;
case CMD_OVERLAY_LOAD:
if (thr->overlay && thr->overlay->load)
ret = thr->overlay->load(thr->driver_data,
pkt.data.image.data,
pkt.data.image.num);
pkt.data.b = ret;
thr->alpha_mods = pkt.data.image.num;
thr->alpha_mod = (float*)realloc(thr->alpha_mod,
thr->alpha_mods * sizeof(float));
for (i = 0; i < thr->alpha_mods; i++)
{
/* Avoid temporary garbage data. */
thr->alpha_mod[i] = 1.0f;
}
float *tmp_alpha_mod = NULL;
video_thread_reply(thr, &pkt);
if (thr->overlay && thr->overlay->load)
ret = thr->overlay->load(thr->driver_data,
pkt.data.image.data,
pkt.data.image.num);
pkt.data.b = ret;
thr->alpha_mods = pkt.data.image.num;
tmp_alpha_mod = (float*)realloc(thr->alpha_mod,
thr->alpha_mods * sizeof(float));
if (tmp_alpha_mod)
thr->alpha_mod = tmp_alpha_mod;
/* Avoid temporary garbage data. */
for (i = 0; i < thr->alpha_mods; i++)
thr->alpha_mod[i] = 1.0f;
video_thread_reply(thr, &pkt);
}
break;
case CMD_OVERLAY_TEX_GEOM:
@ -845,7 +849,7 @@ static bool video_thread_set_shader(void *data,
}
static void video_thread_set_viewport(void *data, unsigned width,
unsigned height, bool force_full, bool allow_rotate)
unsigned height, bool force_full, bool video_allow_rotate)
{
thread_video_t *thr = (thread_video_t*)data;
if (!thr)
@ -855,7 +859,7 @@ static void video_thread_set_viewport(void *data, unsigned width,
if (thr->driver && thr->driver->set_viewport)
thr->driver->set_viewport(thr->driver_data, width, height,
force_full, allow_rotate);
force_full, video_allow_rotate);
slock_unlock(thr->lock);
}
@ -1052,7 +1056,7 @@ static void video_thread_get_overlay_interface(void *data,
#endif
static void thread_set_video_mode(void *data, unsigned width, unsigned height,
bool fullscreen)
bool video_fullscreen)
{
thread_video_t *thr = (thread_video_t*)data;
thread_packet_t pkt = { CMD_POKE_SET_VIDEO_MODE };
@ -1062,7 +1066,7 @@ static void thread_set_video_mode(void *data, unsigned width, unsigned height,
pkt.data.new_mode.width = width;
pkt.data.new_mode.height = height;
pkt.data.new_mode.fullscreen = fullscreen;
pkt.data.new_mode.fullscreen = video_fullscreen;
video_thread_send_and_wait_user_to_thread(thr, &pkt);
}
@ -1131,12 +1135,11 @@ static void thread_set_aspect_ratio(void *data, unsigned aspectratio_idx)
static void thread_set_texture_frame(void *data, const void *frame,
bool rgb32, unsigned width, unsigned height, float alpha)
{
size_t required;
thread_video_t *thr = (thread_video_t*)data;
size_t required = width * height *
(rgb32 ? sizeof(uint32_t) : sizeof(uint16_t));
slock_lock(thr->frame.lock);
required = width * height *
(rgb32 ? sizeof(uint32_t) : sizeof(uint16_t));
if (required > thr->texture.frame_cap)
{
@ -1163,7 +1166,7 @@ static void thread_set_texture_enable(void *data, bool state, bool full_screen)
return;
slock_lock(thr->frame.lock);
thr->texture.enable = state;
thr->texture.enable = state;
thr->texture.full_screen = full_screen;
slock_unlock(thr->frame.lock);
}

View File

@ -752,9 +752,9 @@ static void dinput_clear_pointers(struct dinput_input *di)
}
}
bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lParam)
bool dinput_handle_message(void *data, UINT message, WPARAM wParam, LPARAM lParam)
{
struct dinput_input *di = (struct dinput_input *)dinput;
struct dinput_input *di = (struct dinput_input *)data;
/* WM_POINTERDOWN : Arrives for each new touch event
* with a new ID - add to list.
* WM_POINTERUP : Arrives once the pointer is no

View File

@ -133,14 +133,16 @@ static bool winraw_set_keyboard_input(HWND window)
static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt)
{
UINT r;
unsigned i;
char name[256];
UINT name_size = sizeof(name);
name[0] = '\0';
for (i = 0; i < mouse_cnt; ++i)
{
r = GetRawInputDeviceInfoA(mice[i].hnd, RIDI_DEVICENAME, name, &name_size);
UINT r = GetRawInputDeviceInfoA(mice[i].hnd, RIDI_DEVICENAME,
name, &name_size);
if (r == (UINT)-1 || r == 0)
name[0] = '\0';
RARCH_LOG("[WINRAW]: Mouse #%u %s.\n", i, name);

View File

@ -36,7 +36,7 @@
#include "../../verbosity.h"
#include "dinput_joypad.h"
struct dinput_joypad
struct dinput_joypad_data
{
LPDIRECTINPUTDEVICE8 joypad;
DIJOYSTATE2 joy_state;
@ -48,7 +48,7 @@ struct dinput_joypad
DIEFFECT rumble_props;
};
static struct dinput_joypad g_pads[MAX_USERS];
static struct dinput_joypad_data g_pads[MAX_USERS];
static unsigned g_joypad_cnt;
static unsigned g_last_xinput_pad_idx;
@ -130,7 +130,7 @@ static void dinput_joypad_destroy(void)
dinput_destroy_context();
}
static void dinput_create_rumble_effects(struct dinput_joypad *pad)
static void dinput_create_rumble_effects(struct dinput_joypad_data *pad)
{
DIENVELOPE dienv;
DICONSTANTFORCE dicf;
@ -408,8 +408,8 @@ static bool dinput_joypad_init(void *data)
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
{
unsigned hat_dir = 0;
const struct dinput_joypad *pad = &g_pads[port_num];
unsigned hat_dir = 0;
const struct dinput_joypad_data *pad = &g_pads[port_num];
if (!pad || !pad->joypad)
return false;
@ -461,11 +461,11 @@ static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
static int16_t dinput_joypad_axis(unsigned port_num, uint32_t joyaxis)
{
const struct dinput_joypad *pad = NULL;
int val = 0;
int axis = -1;
bool is_neg = false;
bool is_pos = false;
const struct dinput_joypad_data *pad = NULL;
int val = 0;
int axis = -1;
bool is_neg = false;
bool is_pos = false;
if (joyaxis == AXIS_NONE)
return 0;
@ -526,8 +526,8 @@ static void dinput_joypad_poll(void)
unsigned i;
for (i = 0; i < MAX_USERS; i++)
{
struct dinput_joypad *pad = &g_pads[i];
bool polled = g_xinput_pad_indexes[i] < 0;
struct dinput_joypad_data *pad = &g_pads[i];
bool polled = g_xinput_pad_indexes[i] < 0;
if (!pad || !pad->joypad || !polled)
continue;

View File

@ -1387,15 +1387,15 @@ bool input_driver_owns_driver(void)
bool input_driver_init_command(void)
{
#ifdef HAVE_COMMAND
settings_t *settings = config_get_ptr();
bool stdin_cmd_enable = settings->bools.stdin_cmd_enable;
bool network_cmd_enable = settings->bools.network_cmd_enable;
bool grab_stdin = input_driver_grab_stdin();
settings_t *settings = config_get_ptr();
bool input_stdin_cmd_enable = settings->bools.stdin_cmd_enable;
bool input_network_cmd_enable = settings->bools.network_cmd_enable;
bool grab_stdin = input_driver_grab_stdin();
if (!stdin_cmd_enable && !network_cmd_enable)
if (!input_stdin_cmd_enable && !input_network_cmd_enable)
return false;
if (stdin_cmd_enable && grab_stdin)
if (input_stdin_cmd_enable && grab_stdin)
{
RARCH_WARN("stdin command interface is desired, but input driver has already claimed stdin.\n"
"Cannot use this command interface.\n");
@ -1405,7 +1405,7 @@ bool input_driver_init_command(void)
if (command_network_new(
input_driver_command,
stdin_cmd_enable && !grab_stdin,
input_stdin_cmd_enable && !grab_stdin,
network_cmd_enable,
settings->uints.network_cmd_port))
return true;

View File

@ -460,7 +460,7 @@ error:
bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
{
unsigned i;
unsigned orig_size;
unsigned orig_size = 0;
if (!cheat_manager_state.cheats)
{
@ -470,6 +470,7 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
}
else
{
struct item_cheat *val = NULL;
orig_size = cheat_manager_state.size;
/* if size is decreasing, free the items that will be lost */
@ -481,8 +482,12 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
free(cheat_manager_state.cheats[i].desc);
}
cheat_manager_state.cheats = (struct item_cheat*)
realloc(cheat_manager_state.cheats, new_size * sizeof(struct item_cheat));
val = (struct item_cheat*)
realloc(cheat_manager_state.cheats,
new_size * sizeof(struct item_cheat));
if (val)
cheat_manager_state.cheats = val;
}
if (!cheat_manager_state.cheats)
@ -750,7 +755,15 @@ int cheat_manager_initialize_memory(rarch_setting_t *setting, bool wraparound)
if (!cheat_manager_state.memory_size_list)
cheat_manager_state.memory_size_list = (unsigned*)calloc(1, sizeof(unsigned));
else
cheat_manager_state.memory_size_list = (unsigned*)realloc(cheat_manager_state.memory_size_list, sizeof(unsigned) * cheat_manager_state.num_memory_buffers);
{
unsigned *val = (unsigned*)realloc(
cheat_manager_state.memory_size_list,
sizeof(unsigned) *
cheat_manager_state.num_memory_buffers);
if (val)
cheat_manager_state.memory_size_list = val;
}
cheat_manager_state.memory_buf_list[cheat_manager_state.num_memory_buffers-1] = (uint8_t*)system->mmaps.descriptors[i].core.ptr;
cheat_manager_state.memory_size_list[cheat_manager_state.num_memory_buffers-1] = system->mmaps.descriptors[i].core.len;