Skip to content

Commit

Permalink
First version of menu widgets (gl only)
Browse files Browse the repository at this point in the history
  • Loading branch information
natinusala committed Feb 6, 2019
1 parent 0bef880 commit c20ab38
Show file tree
Hide file tree
Showing 88 changed files with 3,095 additions and 419 deletions.
18 changes: 16 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,23 @@
"ozone_theme.h": "c",
"ozone_texture.h": "c",
"string_list.h": "c",
"core_info.h": "c"
"core_info.h": "c",
"thread": "c",
"xlocale": "c"
"xlocale": "c",
"menu_widgets.h": "c",
"message_queue.h": "c",
"task_queue.h": "c",
"fifo_queue.h": "c",
"file_list.h": "c",
"strl.h": "c",
"configuration.h": "c",
"ozone_display.h": "c",
"verbosity.h": "c",
"retroarch.h": "c",
"menu_animation.h": "c",
"audio_driver.h": "c",
"netplay.h": "c",
"scaler.h": "c"
},
"C_Cpp.dimInactiveRegions": false,
}
8 changes: 8 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ ifeq ($(HAVE_MENU), 1)
DEFINES += -DHAVE_MENU
HAVE_MENU_COMMON = 1

ifeq ($(HAVE_MENU_WIDGETS), 1)
DEFINES += -DHAVE_MENU_WIDGETS
endif

ifeq ($(HAVE_RGUI), 1)
OBJ += menu/drivers/rgui.o
DEFINES += -DHAVE_RGUI
Expand Down Expand Up @@ -782,6 +786,10 @@ ifeq ($(HAVE_MENU_COMMON), 1)
ifeq ($(HAVE_MENU_COMMON),1)
OBJ += menu/drivers_display/menu_display_null.o
endif

ifeq ($(HAVE_MENU_WIDGETS), 1)
OBJ += menu/widgets/menu_widgets.o
endif
endif

ifeq ($(HAVE_OVERLAY), 1)
Expand Down
2 changes: 1 addition & 1 deletion audio/audio_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ static void audio_driver_mixer_play_stream_internal(unsigned i, unsigned type)
audio_mixer_streams[i].state = (enum audio_mixer_state)type;
}

static void audio_driver_load_menu_bgm_callback(void *task_data, void *user_data, const char *error)
static void audio_driver_load_menu_bgm_callback(retro_task_t *task, void *task_data, void *user_data, const char *error)
{
bool contentless = false;
bool is_inited = false;
Expand Down
3 changes: 2 additions & 1 deletion camera/camera_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ bool camera_driver_ctl(enum rarch_camera_ctl_state state, void *data)
return camera_driver->start(camera_data);

runloop_msg_queue_push(
"Camera is explicitly disabled.\n", 1, 180, false);
"Camera is explicitly disabled.\n", 1, 180, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
break;
case RARCH_CAMERA_CTL_SET_CB:
Expand Down
2 changes: 1 addition & 1 deletion cheevos-new/badges.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void set_badge_menu_texture(badges_ctx_t * badges, int i)

#ifdef HAVE_MENU
menu_display_reset_textures_list(badge_file, fullpath,
&badges->menu_texture_list[i],TEXTURE_FILTER_MIPMAP_LINEAR);
&badges->menu_texture_list[i],TEXTURE_FILTER_MIPMAP_LINEAR, NULL, NULL);
#endif
}

Expand Down
26 changes: 13 additions & 13 deletions cheevos-new/cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ static void cheevos_award(cheevos_cheevo_t* cheevo, int mode)

/* Show the OSD message. */
snprintf(buffer, sizeof(buffer), "Achievement Unlocked: %s", cheevo->info->title);
runloop_msg_queue_push(buffer, 0, 2 * 60, false);
runloop_msg_queue_push(cheevo->info->description, 0, 3 * 60, false);
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(cheevo->info->description, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);

/* Start the award task. */
if ((mode & CHEEVOS_ACTIVE_HARDCORE) != 0)
Expand Down Expand Up @@ -633,7 +633,7 @@ static void cheevos_lboard_submit(cheevos_lboard_t* lboard)
if (lboard->last_value == 0)
{
CHEEVOS_ERR(CHEEVOS_TAG "Leaderboard %s tried to submit 0\n", lboard->info->title);
runloop_msg_queue_push("Leaderboard attempt cancelled!", 0, 2 * 60, false);
runloop_msg_queue_push("Leaderboard attempt cancelled!", 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return;
}

Expand All @@ -642,7 +642,7 @@ static void cheevos_lboard_submit(cheevos_lboard_t* lboard)

snprintf(buffer, sizeof(buffer), "Submitted %s for %s",
value, lboard->info->title);
runloop_msg_queue_push(buffer, 0, 2 * 60, false);
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);

/* Start the submit task. */
cheevos_lboard_submit_task(NULL, lboard, "no error, first try");
Expand Down Expand Up @@ -689,8 +689,8 @@ static void cheevos_test_leaderboards(void)

snprintf(buffer, sizeof(buffer),
"Leaderboard Active: %s", lboard->info->title);
runloop_msg_queue_push(buffer, 0, 2 * 60, false);
runloop_msg_queue_push(lboard->info->description, 0, 3 * 60, false);
runloop_msg_queue_push(buffer, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(lboard->info->description, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}
}
Expand Down Expand Up @@ -958,7 +958,7 @@ bool cheevos_toggle_hardcore_mode(void)
command_event(CMD_EVENT_REWIND_DEINIT, NULL);

CHEEVOS_LOG("%s\n", msg);
runloop_msg_queue_push(msg, 0, 3 * 60, true);
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else
{
Expand Down Expand Up @@ -1328,7 +1328,7 @@ static int cheevos_iterate(coro_t* coro)

if (!coro->json)
{
runloop_msg_queue_push("Error loading achievements.", 0, 5 * 60, false);
runloop_msg_queue_push("Error loading achievements.", 0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
CHEEVOS_ERR(CHEEVOS_TAG "error loading achievements\n");
CORO_STOP();
}
Expand Down Expand Up @@ -1393,7 +1393,7 @@ static int cheevos_iterate(coro_t* coro)
"You have %d of %d achievements unlocked.",
number_of_unlocked, cheevos_locals.patchdata.core_count);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 6 * 60, false);
runloop_msg_queue_push(msg, 0, 6 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}

CORO_GOSUB(GET_BADGES);
Expand Down Expand Up @@ -1792,7 +1792,7 @@ static int cheevos_iterate(coro_t* coro)

if (!coro->json)
{
runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false);
runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
CHEEVOS_ERR(CHEEVOS_TAG "error getting user token\n");

CORO_STOP();
Expand All @@ -1806,7 +1806,7 @@ static int cheevos_iterate(coro_t* coro)
snprintf(msg, sizeof(msg),
"RetroAchievements: %s",
tok);
runloop_msg_queue_push(msg, 0, 5 * 60, false);
runloop_msg_queue_push(msg, 0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
*coro->settings->arrays.cheevos_token = 0;

CHEEVOS_FREE(coro->json);
Expand All @@ -1822,7 +1822,7 @@ static int cheevos_iterate(coro_t* coro)
"RetroAchievements: Logged in as \"%s\".",
coro->settings->arrays.cheevos_username);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 3 * 60, false);
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}

strlcpy(cheevos_locals.token, tok,
Expand Down Expand Up @@ -2047,7 +2047,7 @@ bool cheevos_load(const void *data)
if (!coro)
return false;

task = (retro_task_t*)calloc(1, sizeof(*task));
task = task_init();

if (!task)
{
Expand Down
2 changes: 1 addition & 1 deletion cheevos/badges.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void set_badge_menu_texture(badges_ctx_t * badges, int i)

#ifdef HAVE_MENU
menu_display_reset_textures_list(badge_file, fullpath,
&badges->menu_texture_list[i],TEXTURE_FILTER_MIPMAP_LINEAR);
&badges->menu_texture_list[i],TEXTURE_FILTER_MIPMAP_LINEAR, NULL, NULL);
#endif
}

Expand Down
44 changes: 25 additions & 19 deletions cheevos/cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <retro_math.h>
#include <net/net_http.h>
#include <libretro.h>
#include <queues/task_queue.h>

#ifdef HAVE_CONFIG_H
#include "../config.h"
Expand Down Expand Up @@ -1589,7 +1590,7 @@ static void cheevos_make_unlock_url(const cheevo_t *cheevo,
#endif
}

static void cheevos_unlocked(void *task_data, void *user_data,
static void cheevos_unlocked(retro_task_t *task, void *task_data, void *user_data,
const char *error)
{
cheevo_t *cheevo = (cheevo_t *)user_data;
Expand Down Expand Up @@ -1657,8 +1658,8 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
snprintf(msg, sizeof(msg), "Achievement Unlocked: %s",
cheevo->title);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 2 * 60, false);
runloop_msg_queue_push(cheevo->description, 0, 3 * 60, false);
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(cheevo->description, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);

cheevos_make_unlock_url(cheevo, url, sizeof(url));
task_push_http_transfer(url, true, NULL,
Expand Down Expand Up @@ -1818,7 +1819,7 @@ static void cheevos_make_lboard_url(const cheevos_leaderboard_t *lboard,
#endif
}

static void cheevos_lboard_submit(void *task_data, void *user_data,
static void cheevos_lboard_submit(retro_task_t *task, void *task_data, void *user_data,
const char *error)
{
cheevos_leaderboard_t *lboard = (cheevos_leaderboard_t *)user_data;
Expand Down Expand Up @@ -1866,7 +1867,8 @@ static void cheevos_test_leaderboards(void)
CHEEVOS_LOG("[CHEEVOS]: error: lboard %s tried to submit 0\n",
lboard->title);
runloop_msg_queue_push("Leaderboard attempt cancelled!",
0, 2 * 60, false);
0, 2 * 60, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else
{
Expand All @@ -1884,7 +1886,7 @@ static void cheevos_test_leaderboards(void)
snprintf(msg, sizeof(msg), "Submitted %s for %s",
formatted_value, lboard->title);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 2 * 60, false);
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}

Expand All @@ -1893,7 +1895,8 @@ static void cheevos_test_leaderboards(void)
CHEEVOS_LOG("[CHEEVOS]: cancel lboard %s\n", lboard->title);
lboard->active = 0;
runloop_msg_queue_push("Leaderboard attempt cancelled!",
0, 2 * 60, false);
0, 2 * 60, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}
else
Expand All @@ -1909,8 +1912,8 @@ static void cheevos_test_leaderboards(void)
snprintf(msg, sizeof(msg),
"Leaderboard Active: %s", lboard->title);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 2 * 60, false);
runloop_msg_queue_push(lboard->description, 0, 3*60, false);
runloop_msg_queue_push(msg, 0, 2 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(lboard->description, 0, 3*60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}
}
Expand Down Expand Up @@ -2279,7 +2282,7 @@ bool cheevos_toggle_hardcore_mode(void)
command_event(CMD_EVENT_REWIND_DEINIT, NULL);

CHEEVOS_LOG("%s\n", msg);
runloop_msg_queue_push(msg, 0, 3 * 60, true);
runloop_msg_queue_push(msg, 0, 3 * 60, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
else
{
Expand Down Expand Up @@ -2810,7 +2813,7 @@ static int cheevos_iterate(coro_t *coro)

if (!coro->json)
{
runloop_msg_queue_push("Error loading achievements.", 0, 5 * 60, false);
runloop_msg_queue_push("Error loading achievements.", 0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
CHEEVOS_ERR("[CHEEVOS]: error loading achievements.\n");
CORO_STOP();
}
Expand Down Expand Up @@ -2839,7 +2842,8 @@ static int cheevos_iterate(coro_t *coro)
{
runloop_msg_queue_push(
"This game has no achievements.",
0, 5 * 60, false);
0, 5 * 60, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);

cheevos_free_cheevo_set(&cheevos_locals.core);
cheevos_free_cheevo_set(&cheevos_locals.unofficial);
Expand Down Expand Up @@ -2887,7 +2891,7 @@ static int cheevos_iterate(coro_t *coro)
"You have %d of %d achievements unlocked.",
number_of_unlocked, cheevos_locals.core.count);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 6 * 60, false);
runloop_msg_queue_push(msg, 0, 6 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}

CORO_GOSUB(GET_BADGES);
Expand Down Expand Up @@ -3292,10 +3296,12 @@ static int cheevos_iterate(coro_t *coro)
{
runloop_msg_queue_push(
"Missing RetroAchievements account information.",
0, 5 * 60, false);
0, 5 * 60, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(
"Please fill in your account information in Settings.",
0, 5 * 60, false);
0, 5 * 60, false,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
CHEEVOS_ERR("[CHEEVOS]: login info not informed.\n");
CORO_STOP();
}
Expand Down Expand Up @@ -3352,7 +3358,7 @@ static int cheevos_iterate(coro_t *coro)
"RetroAchievements: Logged in as \"%s\".",
coro->settings->arrays.cheevos_username);
msg[sizeof(msg) - 1] = 0;
runloop_msg_queue_push(msg, 0, 3 * 60, false);
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}

/* Save token to config and clear pass on success */
Expand All @@ -3373,13 +3379,13 @@ static int cheevos_iterate(coro_t *coro)
"RetroAchievements: %s",
error_response);
error_message[sizeof(error_message) - 1] = 0;
runloop_msg_queue_push(error_message, 0, 5 * 60, false);
runloop_msg_queue_push(error_message, 0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
*coro->settings->arrays.cheevos_token = '\0';

CORO_STOP();
}

runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false);
runloop_msg_queue_push("RetroAchievements: Error contacting server.", 0, 5 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
CHEEVOS_ERR("[CHEEVOS]: error getting user token.\n");

CORO_STOP();
Expand Down Expand Up @@ -3636,7 +3642,7 @@ bool cheevos_load(const void *data)
if (!coro)
return false;

task = (retro_task_t*)calloc(1, sizeof(*task));
task = task_init();

if (!task)
{
Expand Down
Loading

0 comments on commit c20ab38

Please sign in to comment.