forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu_display.c
827 lines (673 loc) · 20.3 KB
/
menu_display.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2016 - 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/>.
*/
#include <time.h>
#include <retro_assert.h>
#include <queues/message_queue.h>
#include <retro_miscellaneous.h>
#include <formats/image.h>
#include <file/file_path.h>
#include <string/stdstring.h>
#include "../config.def.h"
#include "../retroarch.h"
#include "../configuration.h"
#include "../runloop.h"
#include "../core.h"
#include "../gfx/video_driver.h"
#include "../gfx/video_thread_wrapper.h"
#include "../verbosity.h"
#include "menu_driver.h"
#include "menu_animation.h"
#include "menu_display.h"
#ifdef HAVE_THREADS
#include "../gfx/video_thread_wrapper.h"
#endif
uintptr_t menu_display_white_texture;
static menu_display_ctx_driver_t *menu_display_ctx_drivers[] = {
#ifdef HAVE_D3D
&menu_display_ctx_d3d,
#endif
#ifdef HAVE_OPENGL
&menu_display_ctx_gl,
#endif
#ifdef HAVE_VULKAN
&menu_display_ctx_vulkan,
#endif
&menu_display_ctx_null,
NULL,
};
static const char *menu_video_get_ident(void)
{
#ifdef HAVE_THREADS
settings_t *settings = config_get_ptr();
if (settings->video.threaded)
return video_thread_get_ident();
#endif
return video_driver_get_ident();
}
static bool menu_display_check_compatibility(
enum menu_display_driver_type type)
{
const char *video_driver = menu_video_get_ident();
switch (type)
{
case MENU_VIDEO_DRIVER_GENERIC:
return true;
case MENU_VIDEO_DRIVER_OPENGL:
if (string_is_equal(video_driver, "gl"))
return true;
break;
case MENU_VIDEO_DRIVER_VULKAN:
if (string_is_equal(video_driver, "vulkan"))
return true;
break;
case MENU_VIDEO_DRIVER_DIRECT3D:
if (string_is_equal(video_driver, "d3d"))
return true;
break;
}
return false;
}
void menu_display_timedate(menu_display_ctx_datetime_t *datetime)
{
time_t time_;
if (!datetime)
return;
time(&time_);
switch (datetime->time_mode)
{
case 0: /* Date and time */
strftime(datetime->s, datetime->len,
"%Y-%m-%d %H:%M:%S", localtime(&time_));
break;
case 1: /* Date */
strftime(datetime->s, datetime->len,
"%Y-%m-%d", localtime(&time_));
break;
case 2: /* Time */
strftime(datetime->s, datetime->len,
"%H:%M:%S", localtime(&time_));
break;
case 3: /* Time (hours-minutes) */
strftime(datetime->s, datetime->len,
"%H:%M", localtime(&time_));
break;
case 4: /* Date and time, without year and seconds */
strftime(datetime->s, datetime->len,
"%d/%m %H:%M", localtime(&time_));
break;
}
}
static video_coord_array_t menu_disp_ca;
static unsigned menu_display_framebuf_width = 0;
static unsigned menu_display_framebuf_height = 0;
static size_t menu_display_framebuf_pitch = 0;
static int menu_display_font_size = 0;
static unsigned menu_display_header_height = 0;
static bool menu_display_msg_force = false;
static bool menu_display_font_alloc_framebuf = false;
static bool menu_display_framebuf_dirty = false;
static const uint8_t *menu_display_font_framebuf = NULL;
static void *menu_display_font_buf = NULL;
static msg_queue_t *menu_display_msg_queue = NULL;
static menu_display_ctx_driver_t *menu_disp = NULL;
void menu_display_blend_begin(void)
{
if (!menu_disp || !menu_disp->blend_begin)
return;
menu_disp->blend_begin();
}
void menu_display_blend_end(void)
{
if (!menu_disp || !menu_disp->blend_end)
return;
menu_disp->blend_end();
}
void menu_display_font_main_deinit(void)
{
if (menu_display_font_buf)
font_driver_free(menu_display_font_buf);
menu_display_font_buf = NULL;
menu_display_font_size = 0;
}
bool menu_display_font(enum application_special_type type)
{
menu_display_ctx_font_t font_info;
char fontpath[PATH_MAX_LENGTH] = {0};
int font_size = menu_display_get_font_size();
fill_pathname_application_special(fontpath, sizeof(fontpath), type);
font_info.path = fontpath;
font_info.size = font_size;
if (!menu_display_font_main_init(&font_info))
{
RARCH_WARN("Failed to load font.");
return false;
}
return true;
}
bool menu_display_font_main_init(menu_display_ctx_font_t *font)
{
menu_display_font_main_deinit();
if (!font || !menu_disp)
return false;
if (!menu_disp->font_init_first)
return false;
if (!menu_disp->font_init_first(&menu_display_font_buf,
video_driver_get_ptr(false),
font->path, font->size))
return false;
menu_display_font_size = font->size;
return true;
}
void menu_display_font_bind_block(void *block)
{
font_driver_bind_block(menu_display_font_buf, block);
}
bool menu_display_font_flush_block(void)
{
if (!menu_display_font_buf)
return false;
font_driver_flush(menu_display_font_buf);
font_driver_bind_block(menu_display_font_buf, NULL);
return true;
}
void menu_display_framebuffer_deinit(void)
{
menu_display_framebuf_width = 0;
menu_display_framebuf_height = 0;
menu_display_framebuf_pitch = 0;
}
void menu_display_deinit(void)
{
if (menu_display_msg_queue)
msg_queue_free(menu_display_msg_queue);
video_coord_array_free(&menu_disp_ca);
menu_display_msg_queue = NULL;
menu_display_msg_force = false;
menu_display_header_height = 0;
menu_disp = NULL;
menu_animation_ctl(MENU_ANIMATION_CTL_DEINIT, NULL);
menu_display_framebuffer_deinit();
}
bool menu_display_init(void)
{
retro_assert((menu_display_msg_queue = msg_queue_new(8)) != NULL);
menu_disp_ca.allocated = 0;
return true;
}
void menu_display_coords_array_reset(void)
{
menu_disp_ca.coords.vertices = 0;
}
video_coord_array_t *menu_display_get_coords_array(void)
{
return &menu_disp_ca;
}
void *menu_display_get_font_buffer(void)
{
return menu_display_font_buf;
}
void menu_display_set_font_buffer(void *buffer)
{
menu_display_font_buf = buffer;
}
const uint8_t *menu_display_get_font_framebuffer(void)
{
return menu_display_font_framebuf;
}
void menu_display_set_font_framebuffer(const uint8_t *buffer)
{
menu_display_font_framebuf = buffer;
}
bool menu_display_libretro_running(void)
{
settings_t *settings = config_get_ptr();
if (!settings->menu.pause_libretro)
{
if (rarch_ctl(RARCH_CTL_IS_INITED, NULL)
&& !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
return true;
}
return false;
}
bool menu_display_libretro(void)
{
video_driver_set_texture_enable(true, false);
if (menu_display_libretro_running())
{
if (!input_driver_is_libretro_input_blocked())
input_driver_set_libretro_input_blocked();
core_run();
input_driver_unset_libretro_input_blocked();
return true;
}
return video_driver_cached_frame_render();
}
void menu_display_set_width(unsigned width)
{
menu_display_framebuf_width = width;
}
unsigned menu_display_get_width(void)
{
return menu_display_framebuf_width;
}
void menu_display_set_height(unsigned height)
{
menu_display_framebuf_height = height;
}
unsigned menu_display_get_height(void)
{
return menu_display_framebuf_height;
}
void menu_display_set_header_height(unsigned height)
{
menu_display_header_height = height;
}
unsigned menu_display_get_header_height(void)
{
return menu_display_header_height;
}
unsigned menu_display_get_font_size(void)
{
return menu_display_font_size;
}
void menu_display_set_font_size(unsigned size)
{
menu_display_font_size = size;
}
size_t menu_display_get_framebuffer_pitch(void)
{
return menu_display_framebuf_pitch;
}
void menu_display_set_framebuffer_pitch(size_t pitch)
{
menu_display_framebuf_pitch = pitch;
}
bool menu_display_get_msg_force(void)
{
return menu_display_msg_force;
}
void menu_display_set_msg_force(bool state)
{
menu_display_msg_force = state;
}
bool menu_display_get_font_data_init(void)
{
return menu_display_font_alloc_framebuf;
}
void menu_display_set_font_data_init(bool state)
{
menu_display_font_alloc_framebuf = state;
}
bool menu_display_get_update_pending(void)
{
if (menu_animation_ctl(MENU_ANIMATION_CTL_IS_ACTIVE, NULL))
return true;
if (menu_display_get_framebuffer_dirty_flag())
return true;
return false;
}
void menu_display_set_viewport(void)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, true, false);
}
void menu_display_unset_viewport(void)
{
unsigned width, height;
video_driver_get_size(&width, &height);
video_driver_set_viewport(width, height, false, true);
}
bool menu_display_get_framebuffer_dirty_flag(void)
{
return menu_display_framebuf_dirty;
}
void menu_display_set_framebuffer_dirty_flag(void)
{
menu_display_framebuf_dirty = true;
}
void menu_display_unset_framebuffer_dirty_flag(void)
{
menu_display_framebuf_dirty = false;
}
float menu_display_get_dpi(void)
{
gfx_ctx_metrics_t metrics;
settings_t *settings = config_get_ptr();
float dpi = menu_dpi_override_value;
if (!settings)
return true;
metrics.type = DISPLAY_METRIC_DPI;
metrics.value = &dpi;
if (settings->menu.dpi.override_enable)
return settings->menu.dpi.override_value;
else if (!video_context_driver_get_metrics(&metrics) || !dpi)
return menu_dpi_override_value;
return dpi;
}
bool menu_display_init_first_driver(void)
{
unsigned i;
for (i = 0; menu_display_ctx_drivers[i]; i++)
{
if (!menu_display_check_compatibility(
menu_display_ctx_drivers[i]->type))
continue;
RARCH_LOG("Found menu display driver: \"%s\".\n",
menu_display_ctx_drivers[i]->ident);
menu_disp = menu_display_ctx_drivers[i];
return true;
}
return false;
}
bool menu_display_restore_clear_color(void)
{
if (!menu_disp || !menu_disp->restore_clear_color)
return false;
menu_disp->restore_clear_color();
return true;
}
void menu_display_clear_color(menu_display_ctx_clearcolor_t *color)
{
if (!menu_disp || !menu_disp->clear_color)
return;
menu_disp->clear_color(color);
}
void menu_display_draw(menu_display_ctx_draw_t *draw)
{
if (!menu_disp || !draw || !menu_disp->draw)
return;
/* TODO - edge case */
if (draw->height <= 0)
draw->height = 1;
menu_disp->draw(draw);
}
bool menu_display_shader_pipeline_active(void)
{
settings_t *settings = config_get_ptr();
if (!string_is_equal(menu_driver_ident(), "xmb"))
return false;
if (settings->menu.xmb.shader_pipeline == XMB_SHADER_PIPELINE_WALLPAPER)
return false;
return true;
}
void menu_display_draw_pipeline(menu_display_ctx_draw_t *draw)
{
if (!menu_disp || !draw || !menu_disp->draw_pipeline)
return;
menu_disp->draw_pipeline(draw);
}
void menu_display_draw_bg(menu_display_ctx_draw_t *draw)
{
static struct video_coords coords;
const float *new_vertex = NULL;
const float *new_tex_coord = NULL;
bool add_opacity_to_wallpaper = false;
settings_t *settings = config_get_ptr();
if (!menu_disp || !draw)
return;
new_vertex = draw->vertex;
new_tex_coord = draw->tex_coord;
if (!new_vertex)
new_vertex = menu_disp->get_default_vertices();
if (!new_tex_coord)
new_tex_coord = menu_disp->get_default_tex_coords();
coords.vertices = draw->vertex_count;
coords.vertex = new_vertex;
coords.tex_coord = new_tex_coord;
coords.lut_tex_coord = new_tex_coord;
coords.color = (const float*)draw->color;
draw->coords = &coords;
if (!menu_display_libretro_running() && !menu_display_shader_pipeline_active())
add_opacity_to_wallpaper = true;
if (string_is_equal(menu_driver_ident(), "xmb")
&& settings->menu.xmb.menu_color_theme == XMB_THEME_WALLPAPER)
add_opacity_to_wallpaper = true;
if (add_opacity_to_wallpaper)
menu_display_set_alpha(draw->color, settings->menu.wallpaper.opacity);
if (!draw->texture)
draw->texture = menu_display_white_texture;
draw->matrix_data = (math_matrix_4x4*)menu_disp->get_default_mvp();
}
void menu_display_draw_gradient(menu_display_ctx_draw_t *draw)
{
draw->texture = 0;
draw->x = 0;
draw->y = 0;
menu_display_draw_bg(draw);
menu_display_draw(draw);
}
void menu_display_rotate_z(menu_display_ctx_rotate_draw_t *draw)
{
math_matrix_4x4 matrix_rotated, matrix_scaled;
math_matrix_4x4 *b = NULL;
if (!draw || !menu_disp || !menu_disp->get_default_mvp)
return;
b = (math_matrix_4x4*)menu_disp->get_default_mvp();
matrix_4x4_rotate_z(&matrix_rotated, draw->rotation);
matrix_4x4_multiply(draw->matrix, &matrix_rotated, b);
if (!draw->scale_enable)
return;
matrix_4x4_scale(&matrix_scaled,
draw->scale_x, draw->scale_y, draw->scale_z);
matrix_4x4_multiply(draw->matrix, &matrix_scaled, draw->matrix);
}
bool menu_display_get_tex_coords(menu_display_ctx_coord_draw_t *draw)
{
if (!draw)
return false;
if (!menu_disp || !menu_disp->get_default_tex_coords)
return false;
draw->ptr = menu_disp->get_default_tex_coords();
return true;
}
void menu_display_handle_thumbnail_upload(void *task_data,
void *user_data, const char *err)
{
menu_ctx_load_image_t load_image_info;
struct texture_image *img = (struct texture_image*)task_data;
load_image_info.data = img;
load_image_info.type = MENU_IMAGE_THUMBNAIL;
menu_driver_ctl(RARCH_MENU_CTL_LOAD_IMAGE, &load_image_info);
image_texture_free(img);
free(img);
free(user_data);
}
void menu_display_handle_wallpaper_upload(void *task_data,
void *user_data, const char *err)
{
menu_ctx_load_image_t load_image_info;
struct texture_image *img = (struct texture_image*)task_data;
load_image_info.data = img;
load_image_info.type = MENU_IMAGE_WALLPAPER;
menu_driver_ctl(RARCH_MENU_CTL_LOAD_IMAGE, &load_image_info);
image_texture_free(img);
free(img);
free(user_data);
}
void menu_display_allocate_white_texture(void)
{
struct texture_image ti;
static const uint8_t white_data[] = { 0xff, 0xff, 0xff, 0xff };
ti.width = 1;
ti.height = 1;
ti.pixels = (uint32_t*)&white_data;
if (menu_display_white_texture)
video_driver_texture_unload(&menu_display_white_texture);
video_driver_texture_load(&ti,
TEXTURE_FILTER_NEAREST, &menu_display_white_texture);
}
void menu_display_draw_cursor(
float *color, float cursor_size, uintptr_t texture,
float x, float y, unsigned width, unsigned height)
{
menu_display_ctx_draw_t draw;
struct video_coords coords;
settings_t *settings = config_get_ptr();
bool cursor_visible = settings->video.fullscreen ||
!video_driver_has_windowed();
if (!settings->menu.mouse.enable)
return;
if (!cursor_visible)
return;
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_blend_begin();
draw.x = x - (cursor_size / 2);
draw.y = (int)height - y - (cursor_size / 2);
draw.width = cursor_size;
draw.height = cursor_size;
draw.coords = &coords;
draw.matrix_data = NULL;
draw.texture = texture;
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
menu_display_draw(&draw);
menu_display_blend_end();
}
static INLINE float menu_display_scalef(float val,
float oldmin, float oldmax, float newmin, float newmax)
{
return (((val - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin;
}
static INLINE float menu_display_randf(float min, float max)
{
return (rand() * ((max - min) / RAND_MAX)) + min;
}
void menu_display_push_quad(
unsigned width, unsigned height,
const float *colors, int x1, int y1,
int x2, int y2)
{
menu_display_ctx_coord_draw_t coord_draw;
float vertex[8];
video_coords_t coords;
video_coord_array_t *ca = NULL;
ca = menu_display_get_coords_array();
vertex[0] = x1 / (float)width;
vertex[1] = y1 / (float)height;
vertex[2] = x2 / (float)width;
vertex[3] = y1 / (float)height;
vertex[4] = x1 / (float)width;
vertex[5] = y2 / (float)height;
vertex[6] = x2 / (float)width;
vertex[7] = y2 / (float)height;
coord_draw.ptr = NULL;
menu_display_get_tex_coords(&coord_draw);
coords.color = colors;
coords.vertex = vertex;
coords.tex_coord = coord_draw.ptr;
coords.lut_tex_coord = coord_draw.ptr;
coords.vertices = 3;
video_coord_array_append(ca, &coords, 3);
coords.color += 4;
coords.vertex += 2;
coords.tex_coord += 2;
coords.lut_tex_coord += 2;
video_coord_array_append(ca, &coords, 3);
}
#define PARTICLES_COUNT 100
void menu_display_snow(int width, int height)
{
struct display_particle
{
float x, y;
float xspeed, yspeed;
float alpha;
bool alive;
};
static struct display_particle particles[PARTICLES_COUNT];
static bool initialized = false;
static int timeout = 0;
unsigned i, max_gen = 2;
if (!initialized)
{
memset(particles, 0, sizeof(particles));
initialized = true;
}
for (i = 0; i < PARTICLES_COUNT; ++i)
{
struct display_particle *p = (struct display_particle*)&particles[i];
if (p->alive)
{
int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
p->y += p->yspeed;
p->x += menu_display_scalef(mouse_x, 0, width, -0.3, 0.3);
p->x += p->xspeed;
p->alive = p->y >= 0 && p->y < height
&& p->x >= 0 && p->x < width;
}
else if (max_gen > 0 && timeout <= 0)
{
p->xspeed = menu_display_randf(-0.2, 0.2);
p->yspeed = menu_display_randf(1, 2);
p->y = 0;
p->x = rand() % width;
p->alpha = (float)rand() / (float)RAND_MAX;
p->alive = true;
max_gen--;
}
}
if (max_gen == 0)
timeout = 3;
else
timeout--;
for (i = 0; i < PARTICLES_COUNT; ++i)
{
unsigned j;
float alpha, colors[16];
struct display_particle *p = &particles[i];
if (!p->alive)
continue;
alpha = menu_display_randf(0, 100) > 90 ? p->alpha/2 : p->alpha;
for (j = 0; j < 16; j++)
{
colors[j] = 1;
if (j == 3 || j == 7 || j == 11 || j == 15)
colors[j] = alpha;
}
menu_display_push_quad(width, height,
colors, p->x-2, p->y-2, p->x+2, p->y+2);
j++;
}
}
void menu_display_draw_text(const char *msg,
int width, int height, struct font_params *params)
{
void *fb_buf = menu_display_get_font_buffer();
video_driver_set_osd_msg(msg, params, fb_buf);
}
void menu_display_set_alpha(float *color, float alpha_value)
{
if (!color)
return;
color[3] = color[7] = color[11] = color[15] = alpha_value;
}
void menu_display_reset_textures_list(const char *texture_path, const char *iconpath,
uintptr_t *item)
{
struct texture_image ti = {0};
char path[PATH_MAX_LENGTH] = {0};
if (texture_path != NULL)
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
if (string_is_empty(path) || !path_file_exists(path))
return;
image_texture_load(&ti, path);
video_driver_texture_load(&ti,
TEXTURE_FILTER_MIPMAP_LINEAR, item);
image_texture_free(&ti);
}