mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
commit
162405b476
@ -2,6 +2,8 @@
|
||||
#include "file.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "miscellaneous.h"
|
||||
#include "../native/com_retroarch_browser_NativeInterface.h"
|
||||
|
||||
//#define VERBOSE_LOG
|
||||
|
@ -46,6 +46,11 @@ static DSMIXBINS dsmb;
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _XBOX
|
||||
// Need these includes in MinGW-w64 4.9 it seems ...
|
||||
#include <mmreg.h>
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
#include <dsound.h>
|
||||
#include "../fifo_buffer.h"
|
||||
#include "../general.h"
|
||||
|
@ -571,7 +571,7 @@ static bool verify_command(const char *cmd)
|
||||
bool network_cmd_send(const char *cmd_)
|
||||
{
|
||||
if (!netplay_init_network())
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
char *command = strdup(cmd_);
|
||||
if (!command)
|
||||
|
164
driver.h
164
driver.h
@ -27,6 +27,7 @@
|
||||
#include "gfx/scaler/scaler.h"
|
||||
#include "gfx/image/image.h"
|
||||
#include "gfx/filters/softfilter.h"
|
||||
#include "gfx/shader_parse.h"
|
||||
#include "audio/dsp_filter.h"
|
||||
#include "input/overlay.h"
|
||||
#include "frontend/frontend_context.h"
|
||||
@ -34,6 +35,8 @@
|
||||
#include "miscellaneous.h"
|
||||
#endif
|
||||
|
||||
#include "driver_menu.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@ -167,14 +170,6 @@ struct platform_bind
|
||||
char desc[64];
|
||||
};
|
||||
|
||||
enum rarch_shader_type
|
||||
{
|
||||
RARCH_SHADER_CG,
|
||||
RARCH_SHADER_HLSL,
|
||||
RARCH_SHADER_GLSL,
|
||||
RARCH_SHADER_NONE
|
||||
};
|
||||
|
||||
#if defined(_XBOX360)
|
||||
#define DEFAULT_SHADER_TYPE RARCH_SHADER_HLSL
|
||||
#elif defined(__PSL1GHT__)
|
||||
@ -407,159 +402,6 @@ typedef struct video_driver
|
||||
void (*poke_interface)(void *data, const video_poke_interface_t **iface);
|
||||
} video_driver_t;
|
||||
|
||||
typedef struct menu_ctx_driver_backend
|
||||
{
|
||||
void (*entries_init)(void*, unsigned);
|
||||
int (*iterate)(unsigned);
|
||||
void (*shader_manager_init)(void *);
|
||||
void (*shader_manager_get_str)(void *, char *, size_t, unsigned);
|
||||
void (*shader_manager_set_preset)(void *, unsigned, const char*);
|
||||
void (*shader_manager_save_preset)(const char *, bool);
|
||||
unsigned (*shader_manager_get_type)(void *);
|
||||
int (*shader_manager_setting_toggle)(unsigned, unsigned);
|
||||
unsigned (*type_is)(unsigned);
|
||||
int (*core_setting_toggle)(unsigned, unsigned);
|
||||
int (*setting_toggle)(unsigned, unsigned, unsigned);
|
||||
int (*setting_set)(unsigned, unsigned);
|
||||
void (*setting_set_label)(char *, size_t, unsigned *, unsigned);
|
||||
void (*defer_decision_automatic)(void);
|
||||
void (*defer_decision_manual)(void);
|
||||
const char *ident;
|
||||
} menu_ctx_driver_backend_t;
|
||||
|
||||
typedef struct menu_ctx_driver
|
||||
{
|
||||
void (*set_texture)(void*);
|
||||
void (*render_messagebox)(const char*);
|
||||
void (*render)(void);
|
||||
void (*frame)(void);
|
||||
void* (*init)(void);
|
||||
void (*free)(void*);
|
||||
void (*context_reset)(void*);
|
||||
void (*context_destroy)(void*);
|
||||
void (*populate_entries)(void*, unsigned);
|
||||
void (*iterate)(void*, unsigned);
|
||||
int (*input_postprocess)(uint64_t);
|
||||
void (*navigation_clear)(void *);
|
||||
void (*navigation_decrement)(void *);
|
||||
void (*navigation_increment)(void *);
|
||||
void (*navigation_set)(void *);
|
||||
void (*navigation_set_last)(void *);
|
||||
void (*navigation_descend_alphabet)(void *, size_t *);
|
||||
void (*navigation_ascend_alphabet)(void *, size_t *);
|
||||
void (*list_insert)(void *, const char *, size_t);
|
||||
void (*list_delete)(void *, size_t);
|
||||
void (*list_clear)(void *);
|
||||
void (*list_set_selection)(void *);
|
||||
void (*init_core_info)(void *);
|
||||
|
||||
const menu_ctx_driver_backend_t *backend;
|
||||
// Human readable string.
|
||||
const char *ident;
|
||||
} menu_ctx_driver_t;
|
||||
|
||||
#define MENU_MAX_BUTTONS 219
|
||||
|
||||
#define MENU_MAX_AXES 32
|
||||
#define MENU_MAX_HATS 4
|
||||
|
||||
#ifndef MAX_PLAYERS
|
||||
#define MAX_PLAYERS 8
|
||||
#endif
|
||||
|
||||
struct menu_bind_state_port
|
||||
{
|
||||
bool buttons[MENU_MAX_BUTTONS];
|
||||
int16_t axes[MENU_MAX_AXES];
|
||||
uint16_t hats[MENU_MAX_HATS];
|
||||
};
|
||||
|
||||
struct menu_bind_axis_state
|
||||
{
|
||||
// Default axis state.
|
||||
int16_t rested_axes[MENU_MAX_AXES];
|
||||
// Locked axis state. If we configured an axis, avoid having the same axis state trigger something again right away.
|
||||
int16_t locked_axes[MENU_MAX_AXES];
|
||||
};
|
||||
|
||||
struct menu_bind_state
|
||||
{
|
||||
struct retro_keybind *target;
|
||||
int64_t timeout_end; // For keyboard binding.
|
||||
unsigned begin;
|
||||
unsigned last;
|
||||
unsigned player;
|
||||
struct menu_bind_state_port state[MAX_PLAYERS];
|
||||
struct menu_bind_axis_state axis_state[MAX_PLAYERS];
|
||||
bool skip;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t old_input_state;
|
||||
uint64_t trigger_state;
|
||||
bool do_held;
|
||||
|
||||
unsigned delay_timer;
|
||||
unsigned delay_count;
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
|
||||
uint16_t *frame_buf;
|
||||
size_t frame_buf_pitch;
|
||||
bool frame_buf_show;
|
||||
|
||||
void *menu_stack;
|
||||
void *selection_buf;
|
||||
size_t selection_ptr;
|
||||
unsigned info_selection;
|
||||
bool need_refresh;
|
||||
bool msg_force;
|
||||
bool push_start_screen;
|
||||
|
||||
void *core_info;
|
||||
void *core_info_current;
|
||||
bool defer_core;
|
||||
char deferred_path[PATH_MAX];
|
||||
|
||||
// Quick jumping indices with L/R.
|
||||
// Rebuilt when parsing directory.
|
||||
size_t scroll_indices[2 * (26 + 2) + 1];
|
||||
unsigned scroll_indices_size;
|
||||
unsigned scroll_accel;
|
||||
|
||||
char default_glslp[PATH_MAX];
|
||||
char default_cgp[PATH_MAX];
|
||||
|
||||
const uint8_t *font;
|
||||
bool alloc_font;
|
||||
|
||||
struct retro_system_info info;
|
||||
bool load_no_rom;
|
||||
|
||||
void *shader;
|
||||
void *parameter_shader; // Points to either shader or graphics driver current shader.
|
||||
unsigned current_pad;
|
||||
|
||||
void *history;
|
||||
retro_time_t last_time; // Used to throttle menu in case VSync is broken.
|
||||
|
||||
struct menu_bind_state binds;
|
||||
struct
|
||||
{
|
||||
const char **buffer;
|
||||
const char *label;
|
||||
bool display;
|
||||
} keyboard;
|
||||
|
||||
bool bind_mode_keyboard;
|
||||
retro_time_t time;
|
||||
retro_time_t delta;
|
||||
retro_time_t target_msec;
|
||||
retro_time_t sleep_msec;
|
||||
} menu_handle_t;
|
||||
|
||||
enum rarch_display_type
|
||||
{
|
||||
RARCH_DISPLAY_NONE = 0, // Non-bindable types like consoles, KMS, VideoCore, etc.
|
||||
|
189
driver_menu.h
Normal file
189
driver_menu.h
Normal file
@ -0,0 +1,189 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DRIVER_MENU_H__
|
||||
#define DRIVER_MENU_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "boolean.h"
|
||||
#include "frontend/menu/file_list.h"
|
||||
#include "frontend/menu/history.h"
|
||||
#include "frontend/info/core_info.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct menu_ctx_driver_backend
|
||||
{
|
||||
void (*entries_init)(void*, unsigned);
|
||||
int (*iterate)(unsigned);
|
||||
void (*shader_manager_init)(void *);
|
||||
void (*shader_manager_get_str)(struct gfx_shader *, char *, size_t, unsigned);
|
||||
void (*shader_manager_set_preset)(struct gfx_shader *, unsigned, const char*);
|
||||
void (*shader_manager_save_preset)(const char *, bool);
|
||||
unsigned (*shader_manager_get_type)(const struct gfx_shader *);
|
||||
int (*shader_manager_setting_toggle)(unsigned, unsigned);
|
||||
unsigned (*type_is)(unsigned);
|
||||
int (*core_setting_toggle)(unsigned, unsigned);
|
||||
int (*setting_toggle)(unsigned, unsigned, unsigned);
|
||||
int (*setting_set)(unsigned, unsigned);
|
||||
void (*setting_set_label)(char *, size_t, unsigned *, unsigned);
|
||||
void (*defer_decision_automatic)(void);
|
||||
void (*defer_decision_manual)(void);
|
||||
const char *ident;
|
||||
} menu_ctx_driver_backend_t;
|
||||
|
||||
typedef struct menu_ctx_driver
|
||||
{
|
||||
void (*set_texture)(void*);
|
||||
void (*render_messagebox)(const char*);
|
||||
void (*render)(void);
|
||||
void (*frame)(void);
|
||||
void* (*init)(void);
|
||||
void (*free)(void*);
|
||||
void (*context_reset)(void*);
|
||||
void (*context_destroy)(void*);
|
||||
void (*populate_entries)(void*, unsigned);
|
||||
void (*iterate)(void*, unsigned);
|
||||
int (*input_postprocess)(uint64_t);
|
||||
void (*navigation_clear)(void *);
|
||||
void (*navigation_decrement)(void *);
|
||||
void (*navigation_increment)(void *);
|
||||
void (*navigation_set)(void *);
|
||||
void (*navigation_set_last)(void *);
|
||||
void (*navigation_descend_alphabet)(void *, size_t *);
|
||||
void (*navigation_ascend_alphabet)(void *, size_t *);
|
||||
void (*list_insert)(void *, const char *, size_t);
|
||||
void (*list_delete)(void *, size_t);
|
||||
void (*list_clear)(void *);
|
||||
void (*list_set_selection)(void *);
|
||||
void (*init_core_info)(void *);
|
||||
|
||||
const menu_ctx_driver_backend_t *backend;
|
||||
// Human readable string.
|
||||
const char *ident;
|
||||
} menu_ctx_driver_t;
|
||||
|
||||
#define MENU_MAX_BUTTONS 219
|
||||
|
||||
#define MENU_MAX_AXES 32
|
||||
#define MENU_MAX_HATS 4
|
||||
|
||||
#ifndef MAX_PLAYERS
|
||||
#define MAX_PLAYERS 8
|
||||
#endif
|
||||
|
||||
struct menu_bind_state_port
|
||||
{
|
||||
bool buttons[MENU_MAX_BUTTONS];
|
||||
int16_t axes[MENU_MAX_AXES];
|
||||
uint16_t hats[MENU_MAX_HATS];
|
||||
};
|
||||
|
||||
struct menu_bind_axis_state
|
||||
{
|
||||
// Default axis state.
|
||||
int16_t rested_axes[MENU_MAX_AXES];
|
||||
// Locked axis state. If we configured an axis, avoid having the same axis state trigger something again right away.
|
||||
int16_t locked_axes[MENU_MAX_AXES];
|
||||
};
|
||||
|
||||
struct menu_bind_state
|
||||
{
|
||||
struct retro_keybind *target;
|
||||
int64_t timeout_end; // For keyboard binding.
|
||||
unsigned begin;
|
||||
unsigned last;
|
||||
unsigned player;
|
||||
struct menu_bind_state_port state[MAX_PLAYERS];
|
||||
struct menu_bind_axis_state axis_state[MAX_PLAYERS];
|
||||
bool skip;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t old_input_state;
|
||||
uint64_t trigger_state;
|
||||
bool do_held;
|
||||
|
||||
unsigned delay_timer;
|
||||
unsigned delay_count;
|
||||
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
|
||||
uint16_t *frame_buf;
|
||||
size_t frame_buf_pitch;
|
||||
bool frame_buf_show;
|
||||
|
||||
file_list_t *menu_stack;
|
||||
file_list_t *selection_buf;
|
||||
size_t selection_ptr;
|
||||
unsigned info_selection;
|
||||
bool need_refresh;
|
||||
bool msg_force;
|
||||
bool push_start_screen;
|
||||
|
||||
core_info_list_t *core_info;
|
||||
core_info_t *core_info_current;
|
||||
bool defer_core;
|
||||
char deferred_path[PATH_MAX];
|
||||
|
||||
// Quick jumping indices with L/R.
|
||||
// Rebuilt when parsing directory.
|
||||
size_t scroll_indices[2 * (26 + 2) + 1];
|
||||
unsigned scroll_indices_size;
|
||||
unsigned scroll_accel;
|
||||
|
||||
char default_glslp[PATH_MAX];
|
||||
char default_cgp[PATH_MAX];
|
||||
|
||||
const uint8_t *font;
|
||||
bool alloc_font;
|
||||
|
||||
struct retro_system_info info;
|
||||
bool load_no_rom;
|
||||
|
||||
struct gfx_shader *shader;
|
||||
struct gfx_shader *parameter_shader; // Points to either shader or graphics driver current shader.
|
||||
unsigned current_pad;
|
||||
|
||||
rom_history_t *history;
|
||||
retro_time_t last_time; // Used to throttle menu in case VSync is broken.
|
||||
|
||||
struct menu_bind_state binds;
|
||||
struct
|
||||
{
|
||||
const char **buffer;
|
||||
const char *label;
|
||||
bool display;
|
||||
} keyboard;
|
||||
|
||||
bool bind_mode_keyboard;
|
||||
retro_time_t time;
|
||||
retro_time_t delta;
|
||||
retro_time_t target_msec;
|
||||
retro_time_t sleep_msec;
|
||||
} menu_handle_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
1
file.h
1
file.h
@ -21,7 +21,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include "general.h"
|
||||
#include "file_path.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "file_extract.h"
|
||||
#include "file.h"
|
||||
#include "compat/strl.h"
|
||||
#include "general.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -236,7 +237,7 @@ bool zlib_parse_file(const char *file, zlib_file_cb file_cb, void *userdata)
|
||||
|
||||
const struct zlib_file_backend *backend = zlib_get_default_file_backend();
|
||||
if (!backend)
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
ssize_t zip_size = 0;
|
||||
void *handle = backend->open(file);
|
||||
|
@ -24,13 +24,12 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
static core_info_list_t* global_core_list = 0;
|
||||
static core_info_list_t *global_core_list;
|
||||
static char core_config_path[PATH_MAX];
|
||||
|
||||
static void core_info_list_resolve_all_extensions(void *data)
|
||||
static void core_info_list_resolve_all_extensions(core_info_list_t *core_info_list)
|
||||
{
|
||||
size_t i, all_ext_len = 0;
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
@ -60,11 +59,10 @@ static void core_info_list_resolve_all_extensions(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void core_info_list_resolve_all_firmware(void *data)
|
||||
static void core_info_list_resolve_all_firmware(core_info_list_t *core_info_list)
|
||||
{
|
||||
size_t i;
|
||||
unsigned c;
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
@ -183,10 +181,9 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void core_info_list_free(void *data)
|
||||
void core_info_list_free(core_info_list_t *core_info_list)
|
||||
{
|
||||
size_t i, j;
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
@ -220,10 +217,9 @@ void core_info_list_free(void *data)
|
||||
free(core_info_list);
|
||||
}
|
||||
|
||||
size_t core_info_list_num_info_files(void *data)
|
||||
size_t core_info_list_num_info_files(core_info_list_t *core_info_list)
|
||||
{
|
||||
size_t i, num;
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return 0;
|
||||
|
||||
@ -233,10 +229,9 @@ size_t core_info_list_num_info_files(void *data)
|
||||
return num;
|
||||
}
|
||||
|
||||
bool core_info_list_get_display_name(void *data, const char *path, char *buf, size_t size)
|
||||
bool core_info_list_get_display_name(core_info_list_t *core_info_list, const char *path, char *buf, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return false;
|
||||
|
||||
@ -253,11 +248,9 @@ bool core_info_list_get_display_name(void *data, const char *path, char *buf, si
|
||||
return false;
|
||||
}
|
||||
|
||||
bool core_info_list_get_info(void *data1, void *data2, const char *path)
|
||||
bool core_info_list_get_info(core_info_list_t *core_info_list, core_info_t *out_info, const char *path)
|
||||
{
|
||||
size_t i;
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data1;
|
||||
core_info_t *out_info = (core_info_t*)data2;
|
||||
if (!core_info_list || !out_info)
|
||||
return false;
|
||||
|
||||
@ -276,11 +269,9 @@ bool core_info_list_get_info(void *data1, void *data2, const char *path)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool core_info_does_support_any_file(const void *data1, const void *data2)
|
||||
bool core_info_does_support_any_file(const core_info_t *core, const struct string_list *list)
|
||||
{
|
||||
size_t i;
|
||||
const core_info_t *core = (const core_info_t*)data1;
|
||||
const struct string_list *list = (const struct string_list*)data2;
|
||||
if (!list || !core || !core->supported_extensions_list)
|
||||
return false;
|
||||
|
||||
@ -290,18 +281,16 @@ bool core_info_does_support_any_file(const void *data1, const void *data2)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool core_info_does_support_file(const void *data, const char *path)
|
||||
bool core_info_does_support_file(const core_info_t *core, const char *path)
|
||||
{
|
||||
const core_info_t *core = (const core_info_t*)data;
|
||||
if (!path || !core || !core->supported_extensions_list)
|
||||
return false;
|
||||
|
||||
return string_list_find_elem_prefix(core->supported_extensions_list, ".", path_get_extension(path));
|
||||
}
|
||||
|
||||
const char *core_info_list_get_all_extensions(void *data)
|
||||
const char *core_info_list_get_all_extensions(core_info_list_t *core_info_list)
|
||||
{
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (core_info_list)
|
||||
return core_info_list->all_ext;
|
||||
return "";
|
||||
@ -327,10 +316,9 @@ static int core_info_qsort_cmp(const void *a_, const void *b_)
|
||||
return strcasecmp(a->display_name, b->display_name);
|
||||
}
|
||||
|
||||
void core_info_list_get_supported_cores(void *data, const char *path,
|
||||
void core_info_list_get_supported_cores(core_info_list_t *core_info_list, const char *path,
|
||||
const core_info_t **infos, size_t *num_infos)
|
||||
{
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
@ -368,10 +356,9 @@ void core_info_list_get_supported_cores(void *data, const char *path,
|
||||
*num_infos = supported;
|
||||
}
|
||||
|
||||
static core_info_t *find_core_info(void *data, const char *core)
|
||||
static core_info_t *find_core_info(core_info_list_t *list, const char *core)
|
||||
{
|
||||
size_t i;
|
||||
core_info_list_t *list = (core_info_list_t*)data;
|
||||
|
||||
if (!list)
|
||||
return NULL;
|
||||
@ -397,12 +384,11 @@ static int core_info_firmware_cmp(const void *a_, const void *b_)
|
||||
return strcasecmp(a->path, b->path);
|
||||
}
|
||||
|
||||
void core_info_list_update_missing_firmware(void *data,
|
||||
void core_info_list_update_missing_firmware(core_info_list_t *core_info_list,
|
||||
const char *core, const char *systemdir)
|
||||
{
|
||||
size_t i;
|
||||
char path[PATH_MAX];
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
@ -420,13 +406,12 @@ void core_info_list_update_missing_firmware(void *data,
|
||||
}
|
||||
}
|
||||
|
||||
void core_info_list_get_missing_firmware(void *data,
|
||||
void core_info_list_get_missing_firmware(core_info_list_t *core_info_list,
|
||||
const char *core, const char *systemdir,
|
||||
const core_info_firmware_t **firmware, size_t *num_firmware)
|
||||
{
|
||||
size_t i;
|
||||
char path[PATH_MAX];
|
||||
core_info_list_t *core_info_list = (core_info_list_t*)data;
|
||||
if (!core_info_list)
|
||||
return;
|
||||
|
||||
@ -449,7 +434,7 @@ void core_info_list_get_missing_firmware(void *data,
|
||||
qsort(info->firmware, info->firmware_count, sizeof(*info->firmware), core_info_firmware_cmp);
|
||||
}
|
||||
|
||||
void core_info_set_core_path(const char* core_path)
|
||||
void core_info_set_core_path(const char *core_path)
|
||||
{
|
||||
if (global_core_list)
|
||||
core_info_list_free(global_core_list);
|
||||
@ -460,7 +445,7 @@ void core_info_set_core_path(const char* core_path)
|
||||
RARCH_WARN("No cores were found at %s", core_path ? core_path : "(null");
|
||||
}
|
||||
|
||||
void core_info_set_config_path(const char* config_path)
|
||||
void core_info_set_config_path(const char *config_path)
|
||||
{
|
||||
if (!config_path || strlcpy(core_config_path, config_path, sizeof(core_config_path)) >= PATH_MAX)
|
||||
*core_config_path = '\0';
|
||||
@ -474,10 +459,10 @@ core_info_list_t *core_info_list_get(void)
|
||||
return global_core_list;
|
||||
}
|
||||
|
||||
const core_info_t *core_info_list_get_by_id(const char* core_id)
|
||||
const core_info_t *core_info_list_get_by_id(const char *core_id)
|
||||
{
|
||||
unsigned i;
|
||||
const core_info_list_t* cores = (const core_info_list_t*)core_info_list_get();
|
||||
const core_info_list_t* cores = core_info_list_get();
|
||||
|
||||
if (core_id)
|
||||
for (i = 0; i < cores->count; i ++)
|
||||
@ -487,7 +472,7 @@ const core_info_t *core_info_list_get_by_id(const char* core_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *core_info_get_id(const core_info_t* info, char* buffer, size_t buffer_length)
|
||||
const char *core_info_get_id(const core_info_t *info, char *buffer, size_t buffer_length)
|
||||
{
|
||||
if (!buffer || !buffer_length)
|
||||
return "";
|
||||
@ -499,7 +484,7 @@ const char *core_info_get_id(const core_info_t* info, char* buffer, size_t buffe
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char *core_info_get_custom_config(const char* core_id, char* buffer, size_t buffer_length)
|
||||
const char *core_info_get_custom_config(const char *core_id, char *buffer, size_t buffer_length)
|
||||
{
|
||||
if (!core_id || !buffer || !buffer_length)
|
||||
return 0;
|
||||
@ -509,7 +494,7 @@ const char *core_info_get_custom_config(const char* core_id, char* buffer, size_
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool core_info_has_custom_config(const char* core_id)
|
||||
bool core_info_has_custom_config(const char *core_id)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
if (!core_id)
|
||||
|
@ -60,41 +60,41 @@ typedef struct
|
||||
} core_info_list_t;
|
||||
|
||||
core_info_list_t *core_info_list_new(const char *modules_path);
|
||||
void core_info_list_free(void *data);
|
||||
void core_info_list_free(core_info_list_t *list);
|
||||
|
||||
size_t core_info_list_num_info_files(void *data);
|
||||
size_t core_info_list_num_info_files(core_info_list_t *list);
|
||||
|
||||
bool core_info_does_support_file(const void *data, const char *path);
|
||||
bool core_info_does_support_any_file(const void *data, const void *list);
|
||||
bool core_info_does_support_file(const core_info_t *info, const char *path);
|
||||
bool core_info_does_support_any_file(const core_info_t *info, const struct string_list *list);
|
||||
|
||||
// Non-reentrant, does not allocate. Returns pointer to internal state.
|
||||
void core_info_list_get_supported_cores(void *data, const char *path,
|
||||
void core_info_list_get_supported_cores(core_info_list_t *list, const char *path,
|
||||
const core_info_t **infos, size_t *num_infos);
|
||||
|
||||
// Non-reentrant, does not allocate. Returns pointer to internal state.
|
||||
void core_info_list_get_missing_firmware(void *data,
|
||||
void core_info_list_get_missing_firmware(core_info_list_t *list,
|
||||
const char *core, const char *systemdir,
|
||||
const core_info_firmware_t **firmware, size_t *num_firmware);
|
||||
|
||||
void core_info_list_update_missing_firmware(void *data,
|
||||
void core_info_list_update_missing_firmware(core_info_list_t *list,
|
||||
const char *core, const char *systemdir);
|
||||
|
||||
// Shallow-copies internal state. Data in *info is invalidated when the core_info_list is freed.
|
||||
bool core_info_list_get_info(void *data1, void *data2, const char *path);
|
||||
bool core_info_list_get_info(core_info_list_t *list, core_info_t *info, const char *path);
|
||||
|
||||
const char *core_info_list_get_all_extensions(void *data);
|
||||
const char *core_info_list_get_all_extensions(core_info_list_t *list);
|
||||
|
||||
bool core_info_list_get_display_name(void *data, const char *path, char *buf, size_t size);
|
||||
bool core_info_list_get_display_name(core_info_list_t *list, const char *path, char *buf, size_t size);
|
||||
|
||||
void core_info_set_core_path(const char* core_path);
|
||||
void core_info_set_config_path(const char* config_path);
|
||||
void core_info_set_core_path(const char *core_path);
|
||||
void core_info_set_config_path(const char *config_path);
|
||||
|
||||
core_info_list_t* core_info_list_get(void);
|
||||
const core_info_t* core_info_list_get_by_id(const char* core_id);
|
||||
const char* core_info_get_id(const core_info_t* info, char* buffer, size_t buffer_length);
|
||||
core_info_list_t *core_info_list_get(void);
|
||||
const core_info_t *core_info_list_get_by_id(const char *core_id);
|
||||
const char *core_info_get_id(const core_info_t *info, char *buffer, size_t buffer_length);
|
||||
|
||||
const char* core_info_get_custom_config(const char* core_id, char* buffer, size_t buffer_length);
|
||||
bool core_info_has_custom_config(const char* core_id);
|
||||
const char *core_info_get_custom_config(const char *core_id, char *buffer, size_t buffer_length);
|
||||
bool core_info_has_custom_config(const char *core_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static inline struct gfx_shader *shader_manager_get_current_shader(void *data, u
|
||||
}
|
||||
|
||||
if (type == MENU_SETTINGS_SHADER_PRESET_PARAMETERS)
|
||||
shader = (struct gfx_shader *)menu->shader;
|
||||
shader = menu->shader;
|
||||
|
||||
if (!shader && driver.video_poke && driver.video_data && driver.video_poke->get_current_shader)
|
||||
shader = driver.video_poke->get_current_shader(driver.video_data);
|
||||
@ -82,7 +82,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
{
|
||||
file_list_clear(menu->selection_buf);
|
||||
|
||||
struct gfx_shader *shader = (struct gfx_shader*)shader_manager_get_current_shader(menu, menu_type);
|
||||
struct gfx_shader *shader = shader_manager_get_current_shader(menu, menu_type);
|
||||
if (shader)
|
||||
for (i = 0; i < shader->num_parameters; i++)
|
||||
file_list_push(menu->selection_buf, shader->parameters[i].desc, MENU_SETTINGS_SHADER_PARAMETER_0 + i, 0);
|
||||
@ -91,7 +91,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
}
|
||||
case MENU_SETTINGS_SHADER_OPTIONS:
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)menu->shader;
|
||||
struct gfx_shader *shader = menu->shader;
|
||||
|
||||
if (!shader)
|
||||
return;
|
||||
@ -224,7 +224,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
break;
|
||||
case MENU_SETTINGS_CORE_INFO:
|
||||
{
|
||||
core_info_t *info = (core_info_t*)menu->core_info_current;
|
||||
core_info_t *info = menu->core_info_current;
|
||||
file_list_clear(menu->selection_buf);
|
||||
|
||||
if (info->data)
|
||||
@ -2395,7 +2395,7 @@ static int menu_common_iterate(unsigned action)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||
struct gfx_shader *shader = driver.menu->shader;
|
||||
unsigned pass = (menu_type - MENU_SETTINGS_SHADER_0) / 3;
|
||||
|
||||
fill_pathname_join(shader->pass[pass].source.path,
|
||||
@ -2725,7 +2725,7 @@ static void menu_common_shader_manager_init(void *data)
|
||||
}
|
||||
else if (strcmp(ext, "glsl") == 0 || strcmp(ext, "cg") == 0)
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)menu->shader;
|
||||
struct gfx_shader *shader = menu->shader;
|
||||
|
||||
strlcpy(shader->pass[0].source.path, g_settings.video.shader_path,
|
||||
sizeof(shader->pass[0].source.path));
|
||||
@ -2758,11 +2758,9 @@ static void menu_common_shader_manager_init(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_common_shader_manager_set_preset(void *data, unsigned type, const char *path)
|
||||
static void menu_common_shader_manager_set_preset(struct gfx_shader *shader, unsigned type, const char *path)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
|
||||
RARCH_LOG("Setting Menu shader: %s.\n", path ? path : "N/A (stock)");
|
||||
|
||||
if (video_set_shader_func((enum rarch_shader_type)type, path))
|
||||
@ -2798,15 +2796,14 @@ static void menu_common_shader_manager_set_preset(void *data, unsigned type, con
|
||||
#endif
|
||||
}
|
||||
|
||||
static void menu_common_shader_manager_get_str(void *data, char *type_str, size_t type_str_size, unsigned type)
|
||||
static void menu_common_shader_manager_get_str(struct gfx_shader *shader, char *type_str, size_t type_str_size, unsigned type)
|
||||
{
|
||||
(void)data;
|
||||
(void)shader;
|
||||
(void)type_str;
|
||||
(void)type_str_size;
|
||||
(void)type;
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
if (type == MENU_SETTINGS_SHADER_APPLY)
|
||||
*type_str = '\0';
|
||||
else if (type >= MENU_SETTINGS_SHADER_PARAMETER_0 && type <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||
@ -2953,11 +2950,10 @@ static void menu_common_shader_manager_save_preset(const char *basename, bool ap
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned menu_common_shader_manager_get_type(void *data)
|
||||
static unsigned menu_common_shader_manager_get_type(const struct gfx_shader *shader)
|
||||
{
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
unsigned i, type;
|
||||
const struct gfx_shader *shader = (const struct gfx_shader*)data;
|
||||
|
||||
// All shader types must be the same, or we cannot use it.
|
||||
type = RARCH_SHADER_NONE;
|
||||
@ -3039,16 +3035,11 @@ static int menu_common_shader_manager_setting_toggle(unsigned setting, unsigned
|
||||
}
|
||||
else if (setting >= MENU_SETTINGS_SHADER_PARAMETER_0 && setting <= MENU_SETTINGS_SHADER_PARAMETER_LAST)
|
||||
{
|
||||
struct gfx_shader *shader;
|
||||
struct gfx_shader_parameter *param;
|
||||
|
||||
shader = (struct gfx_shader*)driver.menu->parameter_shader;
|
||||
|
||||
struct gfx_shader *shader = driver.menu->parameter_shader;
|
||||
if (!shader)
|
||||
return 0;
|
||||
|
||||
param = (struct gfx_shader_parameter*)&shader->parameters[setting - MENU_SETTINGS_SHADER_PARAMETER_0];
|
||||
|
||||
struct gfx_shader_parameter *param = &shader->parameters[setting - MENU_SETTINGS_SHADER_PARAMETER_0];
|
||||
if (!param)
|
||||
return 0;
|
||||
|
||||
@ -3077,12 +3068,11 @@ static int menu_common_shader_manager_setting_toggle(unsigned setting, unsigned
|
||||
driver.menu_ctx->backend->setting_set(setting, action);
|
||||
else if (((dist_shader % 3) == 0 || setting == MENU_SETTINGS_SHADER_PRESET))
|
||||
{
|
||||
struct gfx_shader *shader = NULL;
|
||||
struct gfx_shader_pass *pass = NULL;
|
||||
dist_shader /= 3;
|
||||
shader = (struct gfx_shader*)driver.menu->shader;
|
||||
struct gfx_shader *shader = driver.menu->shader;
|
||||
struct gfx_shader_pass *pass = NULL;
|
||||
if (shader && setting == MENU_SETTINGS_SHADER_PRESET)
|
||||
pass = (struct gfx_shader_pass*)&shader->pass[dist_shader];
|
||||
pass = &shader->pass[dist_shader];
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@ -3103,11 +3093,9 @@ static int menu_common_shader_manager_setting_toggle(unsigned setting, unsigned
|
||||
}
|
||||
else if ((dist_filter % 3) == 0)
|
||||
{
|
||||
struct gfx_shader *shader = NULL;
|
||||
struct gfx_shader_pass *pass = NULL;
|
||||
dist_filter /= 3;
|
||||
shader = (struct gfx_shader*)driver.menu->shader;
|
||||
pass = (struct gfx_shader_pass*)&shader->pass[dist_filter];
|
||||
struct gfx_shader *shader = driver.menu->shader;
|
||||
struct gfx_shader_pass *pass = &shader->pass[dist_filter];
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_START:
|
||||
@ -3129,11 +3117,9 @@ static int menu_common_shader_manager_setting_toggle(unsigned setting, unsigned
|
||||
}
|
||||
else if ((dist_scale % 3) == 0)
|
||||
{
|
||||
struct gfx_shader *shader = NULL;
|
||||
struct gfx_shader_pass *pass = NULL;
|
||||
dist_scale /= 3;
|
||||
shader = (struct gfx_shader*)driver.menu->shader;
|
||||
pass = (struct gfx_shader_pass*)&shader->pass[dist_scale];
|
||||
struct gfx_shader *shader = driver.menu->shader;
|
||||
struct gfx_shader_pass *pass = &shader->pass[dist_scale];
|
||||
switch (action)
|
||||
{
|
||||
case MENU_ACTION_START:
|
||||
@ -4722,7 +4708,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
case MENU_SETTINGS_SHADER_PASSES:
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||
struct gfx_shader *shader = driver.menu->shader;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
@ -4759,7 +4745,7 @@ static int menu_common_setting_set(unsigned setting, unsigned action)
|
||||
break;
|
||||
case MENU_SETTINGS_SHADER_APPLY:
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)driver.menu->shader;
|
||||
struct gfx_shader *shader = driver.menu->shader;
|
||||
unsigned type = RARCH_SHADER_NONE;
|
||||
|
||||
if (!driver.video || !driver.video->set_shader || action != MENU_ACTION_OK)
|
||||
|
@ -465,7 +465,7 @@ static void rmenu_context_reset(void *data)
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
texture_image_load(driver.video_data, g_extern.menu_texture_path, menu_texture);
|
||||
texture_image_load(menu_texture, g_extern.menu_texture_path);
|
||||
menu->width = menu_texture->width;
|
||||
menu->height = menu_texture->height;
|
||||
|
||||
@ -485,7 +485,7 @@ static void *rmenu_init(void)
|
||||
|
||||
static void rmenu_context_destroy(void *data)
|
||||
{
|
||||
texture_image_free(driver.video_data, menu_texture);
|
||||
texture_image_free(menu_texture);
|
||||
}
|
||||
|
||||
static void rmenu_free(void *data)
|
||||
|
@ -29,10 +29,9 @@ struct item_file
|
||||
size_t directory_ptr;
|
||||
};
|
||||
|
||||
void file_list_push(void *data,
|
||||
void file_list_push(file_list_t *list,
|
||||
const char *path, unsigned type, size_t directory_ptr)
|
||||
{
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
@ -54,19 +53,17 @@ void file_list_push(void *data,
|
||||
|
||||
}
|
||||
|
||||
size_t file_list_get_size(const void *data)
|
||||
size_t file_list_get_size(const file_list_t *list)
|
||||
{
|
||||
const file_list_t *list = (const file_list_t*)data;
|
||||
if (!list)
|
||||
return 0;
|
||||
|
||||
return list->size;
|
||||
}
|
||||
|
||||
size_t file_list_get_directory_ptr(const void *data)
|
||||
size_t file_list_get_directory_ptr(const file_list_t *list)
|
||||
{
|
||||
size_t size;
|
||||
const file_list_t *list = (const file_list_t*)data;
|
||||
if (!list)
|
||||
return 0;
|
||||
|
||||
@ -74,9 +71,8 @@ size_t file_list_get_directory_ptr(const void *data)
|
||||
return list->list[size].directory_ptr;
|
||||
}
|
||||
|
||||
void file_list_pop(void *data, size_t *directory_ptr)
|
||||
void file_list_pop(file_list_t *list, size_t *directory_ptr)
|
||||
{
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
@ -88,18 +84,15 @@ void file_list_pop(void *data, size_t *directory_ptr)
|
||||
}
|
||||
|
||||
if (directory_ptr)
|
||||
{
|
||||
*directory_ptr = list->list[list->size].directory_ptr;
|
||||
}
|
||||
|
||||
if (driver.menu_ctx && driver.menu_ctx->list_set_selection)
|
||||
driver.menu_ctx->list_set_selection(list);
|
||||
}
|
||||
|
||||
void file_list_free(void *data)
|
||||
void file_list_free(file_list_t *list)
|
||||
{
|
||||
size_t i;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
@ -110,10 +103,9 @@ void file_list_free(void *data)
|
||||
free(list);
|
||||
}
|
||||
|
||||
void file_list_clear(void *data)
|
||||
void file_list_clear(file_list_t *list)
|
||||
{
|
||||
size_t i;
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
@ -129,10 +121,9 @@ void file_list_clear(void *data)
|
||||
list->size = 0;
|
||||
}
|
||||
|
||||
void file_list_set_alt_at_offset(void *data, size_t index,
|
||||
void file_list_set_alt_at_offset(file_list_t *list, size_t index,
|
||||
const char *alt)
|
||||
{
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
@ -140,10 +131,9 @@ void file_list_set_alt_at_offset(void *data, size_t index,
|
||||
list->list[index].alt = strdup(alt);
|
||||
}
|
||||
|
||||
void file_list_get_alt_at_offset(const void *data, size_t index,
|
||||
void file_list_get_alt_at_offset(const file_list_t *list, size_t index,
|
||||
const char **alt)
|
||||
{
|
||||
const file_list_t *list = (const file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
@ -160,19 +150,17 @@ static int file_list_alt_cmp(const void *a_, const void *b_)
|
||||
return strcasecmp(cmp_a, cmp_b);
|
||||
}
|
||||
|
||||
void file_list_sort_on_alt(void *data)
|
||||
void file_list_sort_on_alt(file_list_t *list)
|
||||
{
|
||||
file_list_t *list = (file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
qsort(list->list, list->size, sizeof(list->list[0]), file_list_alt_cmp);
|
||||
}
|
||||
|
||||
void file_list_get_at_offset(const void *data, size_t index,
|
||||
void file_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
const char **path, unsigned *file_type)
|
||||
{
|
||||
const file_list_t *list = (const file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
if (!list->list)
|
||||
@ -184,10 +172,9 @@ void file_list_get_at_offset(const void *data, size_t index,
|
||||
*file_type = list->list[index].type;
|
||||
}
|
||||
|
||||
void file_list_get_last(const void *data,
|
||||
void file_list_get_last(const file_list_t *list,
|
||||
const char **path, unsigned *file_type)
|
||||
{
|
||||
const file_list_t *list = (const file_list_t*)data;
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
@ -195,12 +182,11 @@ void file_list_get_last(const void *data,
|
||||
file_list_get_at_offset(list, list->size - 1, path, file_type);
|
||||
}
|
||||
|
||||
bool file_list_search(const void *data, const char *needle, size_t *index)
|
||||
bool file_list_search(const file_list_t *list, const char *needle, size_t *index)
|
||||
{
|
||||
size_t i;
|
||||
const char *alt;
|
||||
bool ret = false;
|
||||
const file_list_t *list = (const file_list_t*)data;
|
||||
|
||||
if (!list)
|
||||
return false;
|
||||
|
@ -32,30 +32,30 @@ typedef struct file_list
|
||||
size_t size;
|
||||
} file_list_t;
|
||||
|
||||
void file_list_free(void *list);
|
||||
void file_list_free(file_list_t *list);
|
||||
|
||||
void file_list_push(void *userdata, const char *path,
|
||||
void file_list_push(file_list_t *userdata, const char *path,
|
||||
unsigned type, size_t current_directory_ptr);
|
||||
void file_list_pop(void *list, size_t *directory_ptr);
|
||||
void file_list_clear(void *list);
|
||||
void file_list_pop(file_list_t *list, size_t *directory_ptr);
|
||||
void file_list_clear(file_list_t *list);
|
||||
|
||||
void file_list_get_last(const void *list,
|
||||
void file_list_get_last(const file_list_t *list,
|
||||
const char **path, unsigned *type);
|
||||
|
||||
size_t file_list_get_size(const void *list);
|
||||
size_t file_list_get_directory_ptr(const void *list);
|
||||
size_t file_list_get_size(const file_list_t *list);
|
||||
size_t file_list_get_directory_ptr(const file_list_t *list);
|
||||
|
||||
void file_list_get_at_offset(const void *list, size_t index,
|
||||
void file_list_get_at_offset(const file_list_t *list, size_t index,
|
||||
const char **path, unsigned *type);
|
||||
|
||||
void file_list_set_alt_at_offset(void *list, size_t index,
|
||||
void file_list_set_alt_at_offset(file_list_t *list, size_t index,
|
||||
const char *alt);
|
||||
void file_list_get_alt_at_offset(const void *list, size_t index,
|
||||
void file_list_get_alt_at_offset(const file_list_t *list, size_t index,
|
||||
const char **alt);
|
||||
|
||||
void file_list_sort_on_alt(void *list);
|
||||
void file_list_sort_on_alt(file_list_t *list);
|
||||
|
||||
bool file_list_search(const void *list, const char *needle, size_t *index);
|
||||
bool file_list_search(const file_list_t *list, const char *needle, size_t *index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -42,12 +42,11 @@ struct rom_history
|
||||
char *conf_path;
|
||||
};
|
||||
|
||||
void rom_history_get_index(void *data,
|
||||
void rom_history_get_index(rom_history_t *hist,
|
||||
size_t index,
|
||||
const char **path, const char **core_path,
|
||||
const char **core_name)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
@ -64,12 +63,11 @@ static void rom_history_free_entry(struct rom_history_entry *entry)
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
}
|
||||
|
||||
void rom_history_push(void *data,
|
||||
void rom_history_push(rom_history_t *hist,
|
||||
const char *path, const char *core_path,
|
||||
const char *core_name)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
|
||||
if (!hist)
|
||||
return;
|
||||
@ -110,10 +108,9 @@ void rom_history_push(void *data,
|
||||
hist->size++;
|
||||
}
|
||||
|
||||
static void rom_history_write_file(void *data)
|
||||
static void rom_history_write_file(rom_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
FILE *file = fopen(hist->conf_path, "w");
|
||||
if (!file || !hist)
|
||||
return;
|
||||
@ -129,10 +126,9 @@ static void rom_history_write_file(void *data)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void rom_history_free(void *data)
|
||||
void rom_history_free(rom_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
@ -147,10 +143,9 @@ void rom_history_free(void *data)
|
||||
free(hist);
|
||||
}
|
||||
|
||||
void rom_history_clear(void *data)
|
||||
void rom_history_clear(rom_history_t *hist)
|
||||
{
|
||||
size_t i;
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return;
|
||||
|
||||
@ -159,19 +154,17 @@ void rom_history_clear(void *data)
|
||||
hist->size = 0;
|
||||
}
|
||||
|
||||
size_t rom_history_size(void *data)
|
||||
size_t rom_history_size(rom_history_t *hist)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
if (hist)
|
||||
return hist->size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool rom_history_read_file(void *data, const char *path)
|
||||
static bool rom_history_read_file(rom_history_t *hist, const char *path)
|
||||
{
|
||||
rom_history_t *hist = (rom_history_t*)data;
|
||||
FILE *file = fopen(path, "r");
|
||||
if (!file || !data)
|
||||
if (!file || !hist)
|
||||
return true;
|
||||
|
||||
char buf[3][PATH_MAX];
|
||||
@ -232,10 +225,9 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* rom_history_get_path(void *data, unsigned index)
|
||||
const char* rom_history_get_path(rom_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_t* hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return "";
|
||||
|
||||
@ -250,10 +242,9 @@ const char* rom_history_get_path(void *data, unsigned index)
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *rom_history_get_core_path(void *data, unsigned index)
|
||||
const char *rom_history_get_core_path(rom_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_t* hist = (rom_history_t*)data;
|
||||
if (!hist)
|
||||
return "";
|
||||
|
||||
@ -268,10 +259,9 @@ const char *rom_history_get_core_path(void *data, unsigned index)
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *rom_history_get_core_name(void *data, unsigned index)
|
||||
const char *rom_history_get_core_name(rom_history_t *hist, unsigned index)
|
||||
{
|
||||
const char *path, *core_path, *core_name;
|
||||
rom_history_t* hist = (rom_history_t*)data;
|
||||
|
||||
if (!hist)
|
||||
return "";
|
||||
|
@ -25,26 +25,26 @@ extern "C" {
|
||||
typedef struct rom_history rom_history_t;
|
||||
|
||||
rom_history_t *rom_history_init(const char *path, size_t size);
|
||||
void rom_history_free(void *data);
|
||||
void rom_history_free(rom_history_t *hist);
|
||||
|
||||
void rom_history_clear(void *data);
|
||||
void rom_history_clear(rom_history_t *hist);
|
||||
|
||||
size_t rom_history_size(void *data);
|
||||
size_t rom_history_size(rom_history_t *hist);
|
||||
|
||||
void rom_history_get_index(void *data,
|
||||
void rom_history_get_index(rom_history_t *hist,
|
||||
size_t index,
|
||||
const char **path, const char **core_path,
|
||||
const char **core_name);
|
||||
|
||||
void rom_history_push(void *data,
|
||||
void rom_history_push(rom_history_t *hist,
|
||||
const char *path, const char *core_path,
|
||||
const char *core_name);
|
||||
|
||||
const char* rom_history_get_path(void *data,
|
||||
const char* rom_history_get_path(rom_history_t *hist,
|
||||
unsigned index);
|
||||
const char* rom_history_get_core_path(void *data,
|
||||
const char* rom_history_get_core_path(rom_history_t *hist,
|
||||
unsigned index);
|
||||
const char* rom_history_get_core_name(void *data,
|
||||
const char* rom_history_get_core_name(rom_history_t *hist,
|
||||
unsigned index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -92,9 +92,9 @@ typedef enum
|
||||
MENU_ACTION_NOOP
|
||||
} menu_action_t;
|
||||
|
||||
void menu_poll_bind_get_rested_axes(void *data);
|
||||
void menu_poll_bind_state(void *data);
|
||||
bool menu_poll_find_trigger(void *data1, void *data2);
|
||||
void menu_poll_bind_get_rested_axes(struct menu_bind_state *state);
|
||||
void menu_poll_bind_state(struct menu_bind_state *state);
|
||||
bool menu_poll_find_trigger(struct menu_bind_state *state, struct menu_bind_state *new_state);
|
||||
bool menu_custom_bind_keyboard_cb(void *data, unsigned code);
|
||||
|
||||
void *menu_init(const void *data);
|
||||
|
@ -142,10 +142,8 @@ void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mo
|
||||
}
|
||||
}
|
||||
|
||||
void menu_poll_bind_state(void *data)
|
||||
void menu_poll_bind_state(struct menu_bind_state *state)
|
||||
{
|
||||
struct menu_bind_state *state = (struct menu_bind_state*)data;
|
||||
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
@ -180,11 +178,10 @@ void menu_poll_bind_state(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
void menu_poll_bind_get_rested_axes(void *data)
|
||||
void menu_poll_bind_get_rested_axes(struct menu_bind_state *state)
|
||||
{
|
||||
unsigned i, a;
|
||||
const rarch_joypad_driver_t *joypad = NULL;
|
||||
struct menu_bind_state *state = (struct menu_bind_state*)data;
|
||||
|
||||
if (!state)
|
||||
return;
|
||||
@ -265,12 +262,9 @@ static bool menu_poll_find_trigger_pad(struct menu_bind_state *state, struct men
|
||||
return false;
|
||||
}
|
||||
|
||||
bool menu_poll_find_trigger(void *data1, void *data2)
|
||||
bool menu_poll_find_trigger(struct menu_bind_state *state, struct menu_bind_state *new_state)
|
||||
{
|
||||
unsigned i;
|
||||
struct menu_bind_state *state, *new_state;
|
||||
state = (struct menu_bind_state*)data1;
|
||||
new_state = (struct menu_bind_state*)data2;
|
||||
|
||||
if (!state || !new_state)
|
||||
return false;
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "fonts.h"
|
||||
#include "../../file.h"
|
||||
#include "../../general.h"
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
88
gfx/gl.c
88
gfx/gl.c
@ -195,10 +195,9 @@ static bool check_fbo_proc(gl_t *gl)
|
||||
|
||||
////////////////// Shaders
|
||||
|
||||
static bool gl_shader_init(void *data)
|
||||
static bool gl_shader_init(gl_t *gl)
|
||||
{
|
||||
bool ret;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
const gl_shader_backend_t *backend = NULL;
|
||||
|
||||
const char *shader_path = (g_settings.video.shader_enable && *g_settings.video.shader_path) ?
|
||||
@ -264,10 +263,8 @@ static bool gl_shader_init(void *data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void gl_shader_deinit(void *data)
|
||||
static inline void gl_shader_deinit(gl_t *gl)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
@ -319,10 +316,8 @@ static void gl_set_mvp(const void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
void gl_shader_set_coords(void *data, const struct gl_coords *coords, const math_matrix *mat)
|
||||
void gl_shader_set_coords(gl_t *gl, const struct gl_coords *coords, const math_matrix *mat)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
@ -363,21 +358,18 @@ void apple_bind_game_view_fbo(void);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
static void gl_shader_scale(void *data, unsigned index, struct gfx_fbo_scale *scale)
|
||||
static void gl_shader_scale(gl_t *gl, unsigned index, struct gfx_fbo_scale *scale)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
scale->valid = false;
|
||||
if (gl->shader)
|
||||
gl->shader->shader_scale(index, scale);
|
||||
}
|
||||
|
||||
static void gl_compute_fbo_geometry(void *data, unsigned width, unsigned height,
|
||||
static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
|
||||
unsigned vp_width, unsigned vp_height)
|
||||
{
|
||||
int i;
|
||||
unsigned last_width, last_height, last_max_width, last_max_height;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
last_width = width;
|
||||
last_height = height;
|
||||
last_max_width = gl->tex_w;
|
||||
@ -475,11 +467,9 @@ static inline GLenum min_filter_to_mag(GLenum type)
|
||||
}
|
||||
}
|
||||
|
||||
static void gl_create_fbo_textures(void *data)
|
||||
static void gl_create_fbo_textures(gl_t *gl)
|
||||
{
|
||||
int i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
@ -575,11 +565,9 @@ static void gl_create_fbo_textures(void *data)
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
static bool gl_create_fbo_targets(void *data)
|
||||
static bool gl_create_fbo_targets(gl_t *gl)
|
||||
{
|
||||
int i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return false;
|
||||
|
||||
@ -603,10 +591,8 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
void gl_deinit_fbo(void *data)
|
||||
void gl_deinit_fbo(gl_t *gl)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (gl->fbo_inited)
|
||||
{
|
||||
glDeleteTextures(gl->fbo_pass, gl->fbo_texture);
|
||||
@ -618,10 +604,9 @@ void gl_deinit_fbo(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
void gl_init_fbo(void *data, unsigned width, unsigned height)
|
||||
void gl_init_fbo(gl_t *gl, unsigned width, unsigned height)
|
||||
{
|
||||
int i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl || gl_shader_num(gl) == 0)
|
||||
return;
|
||||
@ -788,10 +773,8 @@ static bool gl_init_hw_render(gl_t *gl, unsigned width, unsigned height)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate)
|
||||
void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
@ -809,11 +792,10 @@ void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate)
|
||||
gl->mvp = gl->mvp_no_rot;
|
||||
}
|
||||
|
||||
void gl_set_viewport(void *data, unsigned width, unsigned height, bool force_full, bool allow_rotate)
|
||||
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate)
|
||||
{
|
||||
int x, y;
|
||||
float device_aspect = 0.0f;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
struct gl_ortho ortho = {0, 1, 0, 1, -1, 1};
|
||||
|
||||
if (!gl)
|
||||
@ -936,11 +918,9 @@ static inline void gl_start_frame_fbo(gl_t *gl)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gl_check_fbo_dimensions(void *data)
|
||||
static void gl_check_fbo_dimensions(gl_t *gl)
|
||||
{
|
||||
int i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
@ -976,10 +956,9 @@ static void gl_check_fbo_dimensions(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void gl_frame_fbo(void *data, const struct gl_tex_info *tex_info)
|
||||
static void gl_frame_fbo(gl_t *gl, const struct gl_tex_info *tex_info)
|
||||
{
|
||||
int i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
GLfloat fbo_tex_coords[8] = {0.0f};
|
||||
|
||||
if (!gl)
|
||||
@ -1095,9 +1074,8 @@ static void gl_frame_fbo(void *data, const struct gl_tex_info *tex_info)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void gl_update_resize(void *data)
|
||||
static void gl_update_resize(gl_t *gl)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
#ifdef HAVE_FBO
|
||||
if (!gl->fbo_inited)
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
@ -1113,9 +1091,8 @@ static void gl_update_resize(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gl_update_input_size(void *data, unsigned width, unsigned height, unsigned pitch, bool clear)
|
||||
static void gl_update_input_size(gl_t *gl, unsigned width, unsigned height, unsigned pitch, bool clear)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
// Res change. Need to clear out texture.
|
||||
if ((width != gl->last_width[gl->tex_index] || height != gl->last_height[gl->tex_index]) && gl->empty_buf)
|
||||
{
|
||||
@ -1154,9 +1131,8 @@ static void gl_update_input_size(void *data, unsigned width, unsigned height, un
|
||||
|
||||
// It is *much* faster (order of mangnitude on my setup) to use a custom SIMD-optimized conversion routine than letting GL do it :(
|
||||
#if !defined(HAVE_PSGL) && !defined(HAVE_OPENGLES2)
|
||||
static inline void gl_convert_frame_rgb16_32(void *data, void *output, const void *input, int width, int height, int in_pitch)
|
||||
static inline void gl_convert_frame_rgb16_32(gl_t *gl, void *output, const void *input, int width, int height, int in_pitch)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
if (width != gl->scaler.in_width || height != gl->scaler.in_height)
|
||||
{
|
||||
gl->scaler.in_width = width;
|
||||
@ -1176,10 +1152,9 @@ static inline void gl_convert_frame_rgb16_32(void *data, void *output, const voi
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGLES2
|
||||
static inline void gl_convert_frame_argb8888_abgr8888(void *data, void *output, const void *input,
|
||||
static inline void gl_convert_frame_argb8888_abgr8888(gl_t *gl, void *output, const void *input,
|
||||
int width, int height, int in_pitch)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
if (width != gl->scaler.in_width || height != gl->scaler.in_height)
|
||||
{
|
||||
gl->scaler.in_width = width;
|
||||
@ -1198,10 +1173,9 @@ static inline void gl_convert_frame_argb8888_abgr8888(void *data, void *output,
|
||||
}
|
||||
#endif
|
||||
|
||||
static void gl_init_textures_data(void *data)
|
||||
static void gl_init_textures_data(gl_t *gl)
|
||||
{
|
||||
unsigned i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
for (i = 0; i < gl->textures; i++)
|
||||
{
|
||||
gl->last_width[i] = gl->tex_w;
|
||||
@ -1219,10 +1193,9 @@ static void gl_init_textures_data(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void gl_init_textures(void *data, const video_info_t *video)
|
||||
static void gl_init_textures(gl_t *gl, const video_info_t *video)
|
||||
{
|
||||
unsigned i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
#if defined(HAVE_EGL) && defined(HAVE_OPENGLES2)
|
||||
// Use regular textures if we use HW render.
|
||||
gl->egl_images = !gl->hw_render_use && check_eglimage_proc() &&
|
||||
@ -1297,9 +1270,8 @@ static void gl_init_textures(void *data, const video_info_t *video)
|
||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||
}
|
||||
|
||||
static inline void gl_copy_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch)
|
||||
static inline void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, unsigned height, unsigned pitch)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
#if defined(HAVE_OPENGLES2)
|
||||
#if defined(HAVE_EGL)
|
||||
if (gl->egl_images)
|
||||
@ -1407,25 +1379,22 @@ static inline void gl_copy_frame(void *data, const void *frame, unsigned width,
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void gl_set_prev_texture(void *data, const struct gl_tex_info *tex_info)
|
||||
static inline void gl_set_prev_texture(gl_t *gl, const struct gl_tex_info *tex_info)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
memmove(gl->prev_info + 1, gl->prev_info, sizeof(*tex_info) * (gl->textures - 1));
|
||||
memcpy(&gl->prev_info[0], tex_info, sizeof(*tex_info));
|
||||
}
|
||||
|
||||
static inline void gl_set_shader_viewport(void *data, unsigned shader)
|
||||
static inline void gl_set_shader_viewport(gl_t *gl, unsigned shader)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
if (gl->shader)
|
||||
gl->shader->use(gl, shader);
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
}
|
||||
|
||||
#if defined(HAVE_GL_ASYNC_READBACK) && defined(HAVE_MENU)
|
||||
static void gl_pbo_async_readback(void *data)
|
||||
static void gl_pbo_async_readback(gl_t *gl)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index++]);
|
||||
gl->pbo_readback_index &= 3;
|
||||
|
||||
@ -1455,10 +1424,8 @@ static void gl_pbo_async_readback(void *data)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
static inline void gl_draw_texture(void *data)
|
||||
static inline void gl_draw_texture(gl_t *gl)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
if (!gl->menu_texture)
|
||||
return;
|
||||
|
||||
@ -1933,10 +1900,8 @@ static bool resolve_extensions(gl_t *gl)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void gl_set_texture_fmts(void *data, bool rgb32)
|
||||
static inline void gl_set_texture_fmts(gl_t *gl, bool rgb32)
|
||||
{
|
||||
gl_t *gl = (gl_t*)data;
|
||||
|
||||
gl->internal_fmt = rgb32 ? RARCH_GL_INTERNAL_FORMAT32 : RARCH_GL_INTERNAL_FORMAT16;
|
||||
gl->texture_type = rgb32 ? RARCH_GL_TEXTURE_TYPE32 : RARCH_GL_TEXTURE_TYPE16;
|
||||
gl->texture_fmt = rgb32 ? RARCH_GL_FORMAT32 : RARCH_GL_FORMAT16;
|
||||
@ -1960,10 +1925,9 @@ static inline void gl_set_texture_fmts(void *data, bool rgb32)
|
||||
}
|
||||
|
||||
#ifdef HAVE_GL_ASYNC_READBACK
|
||||
static void gl_init_pbo_readback(void *data)
|
||||
static void gl_init_pbo_readback(gl_t *gl)
|
||||
{
|
||||
unsigned i;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
// Only bother with this if we're doing FFmpeg GPU recording.
|
||||
// Check g_extern.recording and not g_extern.rec, because recording is not initialized yet.
|
||||
gl->pbo_readback_enable = g_settings.video.gpu_record && g_extern.recording;
|
||||
|
@ -397,12 +397,12 @@ extern void glBufferSubDataTextureReferenceRA( GLenum target, GLintptr offset, G
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate);
|
||||
void gl_set_viewport(void *data, unsigned width, unsigned height, bool force_full, bool allow_rotate);
|
||||
void gl_shader_set_coords(void *data, const struct gl_coords *coords, const math_matrix *mat);
|
||||
void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate);
|
||||
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height, bool force_full, bool allow_rotate);
|
||||
void gl_shader_set_coords(gl_t *gl, const struct gl_coords *coords, const math_matrix *mat);
|
||||
|
||||
void gl_init_fbo(void *data, unsigned width, unsigned height);
|
||||
void gl_deinit_fbo(void *data);
|
||||
void gl_init_fbo(gl_t *gl, unsigned width, unsigned height);
|
||||
void gl_deinit_fbo(gl_t *gl);
|
||||
|
||||
static inline GLenum gl_wrap_type_to_enum(enum gfx_wrap_type type)
|
||||
{
|
||||
|
@ -38,22 +38,7 @@ struct texture_image
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct image_ctx_driver
|
||||
{
|
||||
bool (*load)(void*, const char*, void *);
|
||||
void (*free)(void *, void *);
|
||||
// Human readable string.
|
||||
const char *ident;
|
||||
} image_ctx_driver_t;
|
||||
|
||||
#if 0
|
||||
extern const image_ctx_driver_t image_ctx_xdk1;
|
||||
extern const image_ctx_driver_t image_ctx_ps3;
|
||||
extern const image_ctx_driver_t image_ctx_sdl;
|
||||
extern const image_ctx_driver_t image_ctx_rpng;
|
||||
#endif
|
||||
|
||||
bool texture_image_load(void *data, const char *path, void *img);
|
||||
void texture_image_free(void *data, void *img);
|
||||
bool texture_image_load(struct texture_image *img, const char *path);
|
||||
void texture_image_free(struct texture_image *img);
|
||||
|
||||
#endif
|
||||
|
@ -304,15 +304,12 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool texture_image_load(void *data, const char *path, void *image_data)
|
||||
bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||
{
|
||||
(void)data;
|
||||
struct texture_image *out_img = (struct texture_image*)image_data;
|
||||
|
||||
if (!out_img)
|
||||
return false;
|
||||
|
||||
if(strstr(path, ".PNG") != NULL || strstr(path, ".png") != NULL)
|
||||
if (strstr(path, ".PNG") != NULL || strstr(path, ".png") != NULL)
|
||||
{
|
||||
if (!ps3_load_png(path, out_img))
|
||||
return false;
|
||||
@ -326,9 +323,8 @@ bool texture_image_load(void *data, const char *path, void *image_data)
|
||||
return true;
|
||||
}
|
||||
|
||||
void texture_image_free(void *data, void *image_data)
|
||||
void texture_image_free(struct texture_image *img)
|
||||
{
|
||||
struct texture_image *img = (struct texture_image*)image_data;
|
||||
if (!img)
|
||||
return;
|
||||
|
||||
|
@ -199,19 +199,15 @@ static bool rpng_gx_convert_texture32(struct texture_image *image)
|
||||
|
||||
#endif
|
||||
|
||||
void texture_image_free(void *data, void *image_data)
|
||||
void texture_image_free(struct texture_image *img)
|
||||
{
|
||||
struct texture_image *img = (struct texture_image*)image_data;
|
||||
|
||||
free(img->pixels);
|
||||
memset(img, 0, sizeof(*img));
|
||||
}
|
||||
|
||||
bool texture_image_load(void *data, const char *path, void *image_data)
|
||||
bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||
{
|
||||
(void)data;
|
||||
bool ret;
|
||||
struct texture_image *out_img = (struct texture_image*)image_data;
|
||||
|
||||
// This interface "leak" is very ugly. FIXME: Fix this properly ...
|
||||
if (driver.gfx_use_rgba)
|
||||
@ -224,7 +220,7 @@ bool texture_image_load(void *data, const char *path, void *image_data)
|
||||
{
|
||||
if (!rpng_gx_convert_texture32(out_img))
|
||||
{
|
||||
texture_image_free(data, out_img);
|
||||
texture_image_free(out_img);
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
|
@ -17,17 +17,16 @@
|
||||
#include "image.h"
|
||||
#include "../../xdk/xdk_d3d.h"
|
||||
|
||||
bool texture_image_load(void *data, const char *path, void *image_data)
|
||||
bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||
{
|
||||
d3d_video_t *d3d = (d3d_video_t*)data;
|
||||
struct texture_image *out_img = (struct texture_image*)image_data;
|
||||
|
||||
D3DXIMAGE_INFO m_imageInfo;
|
||||
|
||||
out_img->pixels = NULL;
|
||||
out_img->vertex_buf = NULL;
|
||||
|
||||
if(FAILED(D3DXCreateTextureFromFileExA(d3d->dev,
|
||||
if (FAILED(D3DXCreateTextureFromFileExA(d3d->dev,
|
||||
path, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, &m_imageInfo, NULL,
|
||||
&out_img->pixels)))
|
||||
@ -50,10 +49,8 @@ bool texture_image_load(void *data, const char *path, void *image_data)
|
||||
return true;
|
||||
}
|
||||
|
||||
void texture_image_free(void *data, void *image_data)
|
||||
void texture_image_free(struct texture_image *img)
|
||||
{
|
||||
struct texture_image *img = (struct texture_image*)image_data;
|
||||
|
||||
if (!img)
|
||||
return;
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool gl_load_luts(const struct gfx_shader *generic_shader, GLuint *lut_textures)
|
||||
RARCH_LOG("Loading texture image from: \"%s\" ...\n",
|
||||
generic_shader->lut[i].path);
|
||||
|
||||
if (!texture_image_load(driver.video_data, generic_shader->lut[i].path, &img))
|
||||
if (!texture_image_load(&img, generic_shader->lut[i].path))
|
||||
{
|
||||
RARCH_ERR("Failed to load texture image from: \"%s\"\n", generic_shader->lut[i].path);
|
||||
return false;
|
||||
@ -74,7 +74,7 @@ bool gl_load_luts(const struct gfx_shader *generic_shader, GLuint *lut_textures)
|
||||
gl_wrap_type_to_enum(generic_shader->lut[i].wrap),
|
||||
generic_shader->lut[i].filter != RARCH_FILTER_NEAREST,
|
||||
generic_shader->lut[i].mipmap);
|
||||
texture_image_free(driver.video_data, &img);
|
||||
texture_image_free(&img);
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "../compat/posix_string.h"
|
||||
#include "../msvc/msvc_compat.h"
|
||||
#include "../file.h"
|
||||
#include "../compat/strl.h"
|
||||
#include "../general.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -58,9 +60,8 @@ static enum gfx_wrap_type wrap_str_to_mode(const char *wrap_mode)
|
||||
}
|
||||
|
||||
// CGP
|
||||
static bool shader_parse_pass(config_file_t *conf, void *data, unsigned i)
|
||||
static bool shader_parse_pass(config_file_t *conf, struct gfx_shader_pass *pass, unsigned i)
|
||||
{
|
||||
struct gfx_shader_pass *pass = (struct gfx_shader_pass*)data;
|
||||
// Source
|
||||
char shader_name[64];
|
||||
print_buf(shader_name, "shader%u", i);
|
||||
@ -228,12 +229,11 @@ static bool shader_parse_pass(config_file_t *conf, void *data, unsigned i)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool shader_parse_textures(config_file_t *conf, void *data)
|
||||
static bool shader_parse_textures(config_file_t *conf, struct gfx_shader *shader)
|
||||
{
|
||||
const char *id;
|
||||
char *save;
|
||||
char textures[1024];
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
|
||||
if (!config_get_array(conf, "textures", textures, sizeof(textures)))
|
||||
return true;
|
||||
@ -287,10 +287,9 @@ static struct gfx_shader_parameter *find_parameter(struct gfx_shader_parameter *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool gfx_shader_resolve_parameters(config_file_t *conf, void *data)
|
||||
bool gfx_shader_resolve_parameters(config_file_t *conf, struct gfx_shader *shader)
|
||||
{
|
||||
unsigned i;
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
|
||||
shader->num_parameters = 0;
|
||||
struct gfx_shader_parameter *param = &shader->parameters[shader->num_parameters];
|
||||
@ -453,13 +452,10 @@ static bool shader_parse_imports(config_file_t *conf, struct gfx_shader *shader)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gfx_shader_read_conf_cgp(config_file_t *conf, void *data)
|
||||
bool gfx_shader_read_conf_cgp(config_file_t *conf, struct gfx_shader *shader)
|
||||
{
|
||||
unsigned shaders, i;
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
|
||||
memset(shader, 0, sizeof(*shader));
|
||||
|
||||
shader->type = RARCH_SHADER_CG;
|
||||
|
||||
shaders = 0;
|
||||
@ -597,10 +593,9 @@ static void shader_write_variable(config_file_t *conf, const struct state_tracke
|
||||
}
|
||||
}
|
||||
|
||||
void gfx_shader_write_conf_cgp(config_file_t *conf, void *data)
|
||||
void gfx_shader_write_conf_cgp(config_file_t *conf, struct gfx_shader *shader)
|
||||
{
|
||||
unsigned i;
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
config_set_int(conf, "shaders", shader->passes);
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
@ -721,11 +716,10 @@ enum rarch_shader_type gfx_shader_parse_type(const char *path, enum rarch_shader
|
||||
return fallback;
|
||||
}
|
||||
|
||||
void gfx_shader_resolve_relative(void *data, const char *ref_path)
|
||||
void gfx_shader_resolve_relative(struct gfx_shader *shader, const char *ref_path)
|
||||
{
|
||||
unsigned i;
|
||||
char tmp_path[PATH_MAX];
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
|
@ -18,7 +18,8 @@
|
||||
|
||||
#include "../boolean.h"
|
||||
#include "state_tracker.h"
|
||||
#include "../general.h"
|
||||
#include "../conf/config_file.h"
|
||||
#include "../miscellaneous.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -40,6 +41,14 @@ extern "C" {
|
||||
#define GFX_MAX_PARAMETERS 64
|
||||
#endif
|
||||
|
||||
enum rarch_shader_type
|
||||
{
|
||||
RARCH_SHADER_CG,
|
||||
RARCH_SHADER_HLSL,
|
||||
RARCH_SHADER_GLSL,
|
||||
RARCH_SHADER_NONE
|
||||
};
|
||||
|
||||
enum gfx_scale_type
|
||||
{
|
||||
RARCH_SCALE_INPUT = 0,
|
||||
@ -141,11 +150,11 @@ struct gfx_shader
|
||||
char script_class[512];
|
||||
};
|
||||
|
||||
bool gfx_shader_read_conf_cgp(config_file_t *conf, void *data);
|
||||
void gfx_shader_write_conf_cgp(config_file_t *conf, void *data);
|
||||
bool gfx_shader_read_conf_cgp(config_file_t *conf, struct gfx_shader *shader);
|
||||
void gfx_shader_write_conf_cgp(config_file_t *conf, struct gfx_shader *shader);
|
||||
|
||||
void gfx_shader_resolve_relative(void *data, const char *ref_path);
|
||||
bool gfx_shader_resolve_parameters(config_file_t *conf, void *data);
|
||||
void gfx_shader_resolve_relative(struct gfx_shader *shader, const char *ref_path);
|
||||
bool gfx_shader_resolve_parameters(config_file_t *conf, struct gfx_shader *shader);
|
||||
|
||||
enum rarch_shader_type gfx_shader_parse_type(const char *path, enum rarch_shader_type fallback);
|
||||
|
||||
|
@ -644,14 +644,14 @@ static bool guid_is_xinput_device(const GUID* product_guid)
|
||||
/* Go through RAWINPUT (WinXP and later) to find HID devices. */
|
||||
if (!raw_devs)
|
||||
{
|
||||
if ((GetRawInputDeviceList(NULL, &num_raw_devs, sizeof (RAWINPUTDEVICELIST)) == -1) || (!num_raw_devs))
|
||||
if ((GetRawInputDeviceList(NULL, &num_raw_devs, sizeof(RAWINPUTDEVICELIST)) == (UINT)-1) || (!num_raw_devs))
|
||||
return false;
|
||||
|
||||
raw_devs = (PRAWINPUTDEVICELIST) malloc(sizeof(RAWINPUTDEVICELIST) * num_raw_devs);
|
||||
raw_devs = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * num_raw_devs);
|
||||
if (!raw_devs)
|
||||
return false;
|
||||
|
||||
if (GetRawInputDeviceList(raw_devs, &num_raw_devs, sizeof (RAWINPUTDEVICELIST)) == -1)
|
||||
if (GetRawInputDeviceList(raw_devs, &num_raw_devs, sizeof (RAWINPUTDEVICELIST)) == (UINT)-1)
|
||||
{
|
||||
free(raw_devs);
|
||||
raw_devs = NULL;
|
||||
|
@ -164,11 +164,11 @@ static void input_overlay_free_overlay(struct overlay *overlay)
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < overlay->size; i++)
|
||||
texture_image_free(driver.video_data, &overlay->descs[i].image);
|
||||
texture_image_free(&overlay->descs[i].image);
|
||||
|
||||
free(overlay->load_images);
|
||||
free(overlay->descs);
|
||||
texture_image_free(driver.video_data, &overlay->image);
|
||||
texture_image_free(&overlay->image);
|
||||
}
|
||||
|
||||
static void input_overlay_free_overlays(input_overlay_t *ol)
|
||||
@ -199,7 +199,7 @@ static bool input_overlay_load_desc(input_overlay_t *ol, config_file_t *conf, st
|
||||
fill_pathname_resolve_relative(path, ol->overlay_path, image_path, sizeof(path));
|
||||
|
||||
struct texture_image img = {0};
|
||||
if (texture_image_load(driver.video_data, path, &img))
|
||||
if (texture_image_load(&img, path))
|
||||
desc->image = img;
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ static bool input_overlay_load_overlay(input_overlay_t *ol, config_file_t *conf,
|
||||
fill_pathname_resolve_relative(overlay_resolved_path, config_path,
|
||||
overlay_path, sizeof(overlay_resolved_path));
|
||||
|
||||
if (texture_image_load(driver.video_data, overlay_resolved_path, &img))
|
||||
if (texture_image_load(&img, overlay_resolved_path))
|
||||
overlay->image = img;
|
||||
else
|
||||
{
|
||||
|
@ -520,8 +520,6 @@ void config_set_defaults(void)
|
||||
|
||||
/* Avoid reloading config on every ROM load */
|
||||
g_extern.block_config_read = default_block_config_read;
|
||||
|
||||
rarch_init_msg_queue();
|
||||
}
|
||||
|
||||
static void parse_config_file(void);
|
||||
|
@ -79,7 +79,7 @@ int rl_fnmatch(const char *pattern, const char *string, int flags) {
|
||||
case '\\':
|
||||
c++;
|
||||
// Dangling escape at end of pattern
|
||||
if (c == '\0') {
|
||||
if (*c == '\0') { // FIXME: Was c == '\0' (makes no sense). Not sure if c == NULL or *c == '\0' is intended. Assuming *c due to c++ right before.
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user