Skip to content

Commit

Permalink
gui: Initial implement poor network indicator like PS4 remote play
Browse files Browse the repository at this point in the history
resolve #146
  • Loading branch information
d3m3vilurr committed May 21, 2019
1 parent 70330e2 commit 749aaaf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/gui/guilib.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define ICON_LEFT_ARROW "\xef\x95\x8c"
#define ICON_RIGHT_ARROW "\xef\x95\x93"
#define ICON_LEFT_RIGHT_ARROWS ICON_LEFT_ARROW ICON_RIGHT_ARROW
#define ICON_NETWORK "\xef\xa6\x8c"

typedef struct menu_entry {
int id;
Expand Down
23 changes: 17 additions & 6 deletions src/video/vita.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,16 @@ SceUID pacer_thread = -1;
SceVideodecQueryInitInfoHwAvcdec *init = NULL;
SceAvcdecQueryDecoderInfo *decoder_info = NULL;

typedef struct {
bool activated;
uint8_t alpha;
bool plus;
} indicator_status;

static unsigned numframes;
static bool active_video_thread = true;
static bool active_pacer_thread = false;
static bool active_poor_net_indicator = false;
static indicator_status poor_net_indicator = {0};

uint32_t frame_count = 0;
uint32_t need_drop = 0;
Expand Down Expand Up @@ -420,9 +426,13 @@ static int vita_submit_decode_unit(PDECODE_UNIT decodeUnit) {
}

void draw_indicators() {
if (active_poor_net_indicator) {
// TODO draw image instead text
//display_message(60, 40, "poor network");
if (poor_net_indicator.activated) {
vita2d_font_draw_text(font, 40, 500, RGBA8(0xFF, 0xFF, 0xFF, poor_net_indicator.alpha), 64, ICON_NETWORK);
poor_net_indicator.alpha += (0x4 * (poor_net_indicator.plus ? 1 : -1));
if (poor_net_indicator.alpha == 0) {
poor_net_indicator.plus = !poor_net_indicator.plus;
poor_net_indicator.alpha += (0x4 * (poor_net_indicator.plus ? 1 : -1));
}
}
}

Expand All @@ -435,11 +445,12 @@ void vitavideo_stop() {
}

void vitavideo_show_poor_net_indicator() {
active_poor_net_indicator = true;
poor_net_indicator.activated = true;
}

void vitavideo_hide_poor_net_indicator() {
active_poor_net_indicator = false;
//poor_net_indicator.activated = false;
memset(&poor_net_indicator, 0, sizeof(indicator_status));
}

DECODER_RENDERER_CALLBACKS decoder_callbacks_vita = {
Expand Down

1 comment on commit 749aaaf

@gnuton
Copy link

@gnuton gnuton commented on 749aaaf May 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent! Thanks a lot!

Please sign in to comment.