本文整理汇总了C++中driver_get_ptr函数的典型用法代码示例。如果您正苦于以下问题:C++ driver_get_ptr函数的具体用法?C++ driver_get_ptr怎么用?C++ driver_get_ptr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了driver_get_ptr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recording_deinit
bool recording_deinit(void)
{
driver_t *driver = driver_get_ptr();
if (!driver->recording_data || !driver->recording)
return false;
if (driver->recording->finalize)
driver->recording->finalize(driver->recording_data);
if (driver->recording->free)
driver->recording->free(driver->recording_data);
driver->recording_data = NULL;
driver->recording = NULL;
event_command(EVENT_CMD_GPU_RECORD_DEINIT);
return true;
}
示例2: gfx_ctx_glx_bind_hw_render
static void gfx_ctx_glx_bind_hw_render(void *data, bool enable)
{
driver_t *driver = driver_get_ptr();
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
if (!glx)
return;
(void)data;
glx->g_use_hw_ctx = enable;
if (!glx->g_dpy)
return;
if (!glx->g_glx_win)
return;
glXMakeContextCurrent(glx->g_dpy, glx->g_glx_win,
glx->g_glx_win, enable ? glx->g_hw_ctx : glx->g_ctx);
}
示例3: gl_glsl_set_mvp
static bool gl_glsl_set_mvp(void *data, const math_matrix_4x4 *mat)
{
int loc;
driver_t *driver = driver_get_ptr();
glsl_shader_data_t *glsl = (glsl_shader_data_t*)driver->video_shader_data;
(void)data;
if (!glsl || !glsl->shader->modern)
{
gl_ff_matrix(mat);
return false;
}
loc = glsl->gl_uniforms[glsl->glsl_active_index].mvp;
if (loc >= 0)
glUniformMatrix4fv(loc, 1, GL_FALSE, mat->data);
return true;
}
示例4: video_texture_load
unsigned video_texture_load(void *data,
enum texture_backend_type type,
enum texture_filter_type filter_type)
{
settings_t *settings = config_get_ptr();
const struct retro_hw_render_callback *hw_render =
(const struct retro_hw_render_callback*)video_driver_callback();
if (settings->video.threaded && !hw_render->context_type)
{
driver_t *driver = driver_get_ptr();
thread_video_t *thr = (thread_video_t*)driver->video_data;
thread_packet_t pkt = { CMD_CUSTOM_COMMAND };
if (!thr)
return 0;
switch (type)
{
case TEXTURE_BACKEND_OPENGL:
if (filter_type == TEXTURE_FILTER_MIPMAP_LINEAR ||
filter_type == TEXTURE_FILTER_MIPMAP_NEAREST)
pkt.data.custom_command.method = video_texture_png_load_wrap_gl_mipmap;
else
pkt.data.custom_command.method = video_texture_png_load_wrap_gl;
break;
case TEXTURE_BACKEND_DEFAULT:
default:
pkt.data.custom_command.method = video_texture_png_load_wrap;
break;
}
pkt.data.custom_command.data = (void*)data;
thr->send_and_wait(thr, &pkt);
return pkt.data.custom_command.return_value;
}
return video_texture_png_load(data, type, filter_type);
}
示例5: video_texture_load
unsigned video_texture_load(void *data,
enum texture_backend_type type,
enum texture_filter_type filter_type)
{
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
if (settings->video.threaded
&& !global->system.hw_render_callback.context_type)
{
driver_t *driver = driver_get_ptr();
thread_video_t *thr = (thread_video_t*)driver->video_data;
if (!thr)
return 0;
switch (type)
{
case TEXTURE_BACKEND_OPENGL:
if (filter_type == TEXTURE_FILTER_MIPMAP_LINEAR ||
filter_type == TEXTURE_FILTER_MIPMAP_NEAREST)
thr->cmd_data.custom_command.method = video_texture_png_load_wrap_gl_mipmap;
else
thr->cmd_data.custom_command.method = video_texture_png_load_wrap_gl;
break;
case TEXTURE_BACKEND_DEFAULT:
default:
thr->cmd_data.custom_command.method = video_texture_png_load_wrap;
break;
}
thr->cmd_data.custom_command.data = (void*)data;
thr->send_cmd_func(thr, CMD_CUSTOM_COMMAND);
thr->wait_reply_func(thr, CMD_CUSTOM_COMMAND);
return thr->cmd_data.custom_command.return_value;
}
return video_texture_png_load(data, type, filter_type);
}
示例6: menu_load_content
/**
* menu_load_content:
*
* Loads content into currently selected core.
* Will also optionally push the content entry to the history playlist.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool menu_load_content(void)
{
menu_handle_t *menu = menu_driver_get_ptr();
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
/* redraw menu frame */
if (menu)
menu->msg_force = true;
menu_entry_iterate(MENU_ACTION_NOOP);
menu_display_fb();
if (!(main_load_content(0, NULL, NULL, menu_environment_get,
driver->frontend_ctx->process_args)))
{
char name[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
fill_pathname_base(name, global->fullpath, sizeof(name));
snprintf(msg, sizeof(msg), "Failed to load %s.\n", name);
rarch_main_msg_queue_push(msg, 1, 90, false);
if (menu)
menu->msg_force = true;
return false;
}
menu_shader_manager_init(menu);
event_command(EVENT_CMD_HISTORY_INIT);
if (*global->fullpath || (menu && menu->load_no_content))
push_to_history_playlist();
event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO);
event_command(EVENT_CMD_RESUME);
return true;
}
示例7: menu_display_init_main_font
bool menu_display_init_main_font(menu_handle_t *menu,
const char *font_path, float font_size)
{
driver_t *driver = driver_get_ptr();
void *video = video_driver_get_ptr(NULL);
bool result;
if (menu->font.buf)
menu_display_free_main_font(menu);
result = menu_display_font_init_first(
(const void**)&driver->font_osd_driver, &menu->font.buf, video,
font_path, font_size);
if (result)
menu->font.size = font_size;
else
menu->font.buf = NULL;
return result;
}
示例8: driver_update_system_av_info
/**
* driver_update_system_av_info:
* @info : pointer to new A/V info
*
* Update the system Audio/Video information.
* Will reinitialize audio/video drivers.
* Used by RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool driver_update_system_av_info(const struct retro_system_av_info *info)
{
global_t *global = global_get_ptr();
driver_t *driver = driver_get_ptr();
global->system.av_info = *info;
event_command(EVENT_CMD_REINIT);
/* Cannot continue recording with different parameters.
* Take the easiest route out and just restart the recording. */
if (driver->recording_data)
{
static const char *msg = "Restarting recording due to driver reinit.";
rarch_main_msg_queue_push(msg, 2, 180, false);
RARCH_WARN("%s\n", msg);
event_command(EVENT_CMD_RECORD_DEINIT);
event_command(EVENT_CMD_RECORD_INIT);
}
return true;
}
示例9: menu_list_destroy
static void menu_list_destroy(file_list_t *list)
{
unsigned i;
driver_t *driver = driver_get_ptr();
if (!list)
return;
if (!driver->menu_ctx)
goto end;
for (i = 0; i < list->size; i++)
{
menu_driver_list_delete(list, i, list->size);
menu_common_list_delete(list, i, list->size);
}
end:
if (list)
file_list_free(list);
}
示例10: win32_window_create
bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,
unsigned height, bool fullscreen)
{
#ifndef _XBOX
driver_t *driver = driver_get_ptr();
g_hwnd = CreateWindowEx(0, "RetroArch", "RetroArch",
style,
fullscreen ? mon_rect->left : g_pos_x,
fullscreen ? mon_rect->top : g_pos_y,
width, height,
NULL, NULL, NULL, data);
if (!g_hwnd)
return false;
driver->display_type = RARCH_DISPLAY_WIN32;
driver->video_display = 0;
driver->video_window = (uintptr_t)g_hwnd;
#endif
return true;
}
示例11: rarch_main_iterate_time_to_exit
/* Time to exit out of the main loop?
* Reasons for exiting:
* a) Shutdown environment callback was invoked.
* b) Quit key was pressed.
* c) Frame count exceeds or equals maximum amount of frames to run.
* d) Video driver no longer alive.
* e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better)
*/
static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd)
{
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
driver_t *driver = driver_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
video_driver_t *video = driver ? (video_driver_t*)driver->video : NULL;
bool shutdown_pressed = (system && system->shutdown) || cmd->quit_key_pressed;
bool video_alive = video && video->alive(driver->video_data);
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
uint64_t *frame_count = video_driver_get_frame_count();
bool frame_count_end = main_max_frames && (*frame_count >= main_max_frames);
if (shutdown_pressed || frame_count_end || movie_end || !video_alive || global->exec)
{
if (global->exec)
global->exec = false;
/* Quits out of RetroArch main loop.
* On special case, loads dummy core
* instead of exiting RetroArch completely.
* Aborts core shutdown if invoked.
*/
if (global->core_shutdown_initiated
&& settings->load_dummy_on_core_shutdown)
{
if (!event_command(EVENT_CMD_PREPARE_DUMMY))
return -1;
system->shutdown = false;
global->core_shutdown_initiated = false;
return 0;
}
return -1;
}
return 1;
}
示例12: retro_init_libretro_cbs
/**
* retro_init_libretro_cbs:
* @data : pointer to retro_callbacks object
*
* Initializes libretro callbacks, and binds the libretro callbacks
* to default callback functions.
**/
void retro_init_libretro_cbs(void *data)
{
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
if (!cbs)
return;
(void)driver;
(void)global;
pretro_set_video_refresh(video_frame);
pretro_set_audio_sample(audio_driver_sample);
pretro_set_audio_sample_batch(audio_driver_sample_batch);
pretro_set_input_state(input_state);
pretro_set_input_poll(input_poll);
retro_set_default_callbacks(cbs);
#ifdef HAVE_NETPLAY
if (!driver->netplay_data)
return;
if (global->netplay_is_spectate)
{
pretro_set_input_state(
(global->netplay_is_client ?
input_state_spectate_client : input_state_spectate)
);
}
else
{
pretro_set_video_refresh(video_frame_net);
pretro_set_audio_sample(audio_sample_net);
pretro_set_audio_sample_batch(audio_sample_batch_net);
pretro_set_input_state(input_state_net);
}
#endif
}
示例13: menu_input_pointer
static int menu_input_pointer(unsigned *action)
{
int pointer_device, pointer_x, pointer_y;
const struct retro_keybind *binds[MAX_USERS];
menu_handle_t *menu = menu_driver_get_ptr();
settings_t *settings = config_get_ptr();
driver_t *driver = driver_get_ptr();
if (!menu)
return -1;
if (!settings->menu.pointer.enable)
{
memset(&menu->pointer, 0, sizeof(menu->pointer));
return 0;
}
pointer_device = driver->menu_ctx->set_texture?
RETRO_DEVICE_POINTER : RARCH_DEVICE_POINTER_SCREEN;
menu->pointer.pressed[0] = input_driver_state(binds, 0, pointer_device,
0, RETRO_DEVICE_ID_POINTER_PRESSED);
menu->pointer.pressed[1] = input_driver_state(binds, 0, pointer_device,
1, RETRO_DEVICE_ID_POINTER_PRESSED);
menu->pointer.back = input_driver_state(binds, 0, pointer_device,
0, RARCH_DEVICE_ID_POINTER_BACK);
pointer_x = input_driver_state(binds, 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_X);
pointer_y = input_driver_state(binds, 0, pointer_device, 0, RETRO_DEVICE_ID_POINTER_Y);
menu->pointer.x = ((pointer_x + 0x7fff) * (int)menu->frame_buf.width) / 0xFFFF;
menu->pointer.y = ((pointer_y + 0x7fff) * (int)menu->frame_buf.height) / 0xFFFF;
if (menu->pointer.pressed[0] || menu->pointer.oldpressed[0]
|| menu->pointer.back || menu->pointer.dragging
|| menu->pointer.dy != 0 || menu->pointer.dx != 0)
menu->animation_is_active = true;
return 0;
}
示例14: gfx_ctx_drm_egl_bind_hw_render
static void gfx_ctx_drm_egl_bind_hw_render(void *data, bool enable)
{
driver_t *driver = driver_get_ptr();
gfx_ctx_drm_egl_data_t *drm = (gfx_ctx_drm_egl_data_t*)
driver->video_context_data;
if (!drm)
return;
(void)data;
drm->g_use_hw_ctx = enable;
if (!drm->g_egl_dpy)
return;
if (!drm->g_egl_surf)
return;
eglMakeCurrent(drm->g_egl_dpy, drm->g_egl_surf,
drm->g_egl_surf,
enable ? drm->g_egl_hw_ctx : drm->g_egl_ctx);
}
示例15: init_location
void init_location(void)
{
driver_t *driver = driver_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
/* Resource leaks will follow if location interface is initialized twice. */
if (driver->location_data)
return;
find_location_driver();
driver->location_data = driver->location->init();
if (!driver->location_data)
{
RARCH_ERR("Failed to initialize location driver. Will continue without location.\n");
driver->location_active = false;
}
if (system->location_callback.initialized)
system->location_callback.initialized();
}