Skip to content

Commit

Permalink
Improved item details
Browse files Browse the repository at this point in the history
Getting ready for new release
  • Loading branch information
bucanero committed Dec 19, 2019
1 parent 6ff846b commit eb103c1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to the `pkgi-ps3` project will be documented in this file. T

## [Unreleased]()

## [v1.0.8](https://github.com/bucanero/pkgi-ps3/releases/tag/v1.0.8) - 2019-12-19

### Added

* Added analog pad support
Expand Down
2 changes: 1 addition & 1 deletion docs/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "name":"PKGi PS3 v1.0.5" }
{ "name":"PKGi PS3 v1.0.8" }
6 changes: 2 additions & 4 deletions include/pkgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <dbglogger.h>

#define PKGI_UPDATE_URL "http://pkgi.bucanero.com.ar/version.txt" //api.github.com/repos/bucanero/pkgi-ps3/releases/latest
#define PKGI_VERSION "1.0.5"
#define PKGI_UPDATE_URL "http://update.pkgi.tk/version.txt" //api.github.com/repos/bucanero/pkgi-ps3/releases/latest
#define PKGI_VERSION "1.0.8"

// values compatible with psp2/ctrl.h header
#define PKGI_BUTTON_SELECT 0x00000001
Expand Down Expand Up @@ -141,8 +141,6 @@ typedef void* pkgi_texture;
pkgi_load_##type##_raw((void*) name##_##type , name##_##type##_size); \
})

void draw_msgDialog_OK(const char * str);
int draw_msgDialog_YesNo(const char * str);


pkgi_texture pkgi_load_png_raw(const void* data, uint32_t size);
Expand Down
4 changes: 4 additions & 0 deletions include/pkgi_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ int pkgi_dialog_is_cancelled(void);
void pkgi_dialog_allow_close(int allow);
void pkgi_dialog_message(const char* text);
void pkgi_dialog_error(const char* text);
void pkgi_dialog_details(const char* title, const char* text, const char* extra);

void pkgi_dialog_start_progress(const char* title, const char* text, float progress);
void pkgi_dialog_set_progress_title(const char* title);
Expand All @@ -17,3 +18,6 @@ void pkgi_dialog_update_progress(const char* text, const char* extra, const char
void pkgi_dialog_close(void);

void pkgi_do_dialog(pkgi_input* input);

void pkgi_msgDialog_OK(const char * str);
int pkgi_msgDialog_YesNo(const char * str);
37 changes: 21 additions & 16 deletions source/pkgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ static void pkgi_do_main(pkgi_input* input)
{
if (input->active & PKGI_BUTTON_START) {
input->pressed &= ~PKGI_BUTTON_START;
if (draw_msgDialog_YesNo("Exit to XMB?") == 1)
if (pkgi_msgDialog_YesNo("Exit to XMB?") == 1)
state = StateTerminate;
}

if (input->active & PKGI_BUTTON_SELECT) {
input->pressed &= ~PKGI_BUTTON_SELECT;
draw_msgDialog_OK(" \xE2\x98\x85 PKGi PS3 v" PKGI_VERSION " \xE2\x98\x85 \n\n"
pkgi_msgDialog_OK(" \xE2\x98\x85 PKGi PS3 v" PKGI_VERSION " \xE2\x98\x85 \n\n"
" original PS Vita version by mmozeiko \n\n"
" ported to PlayStation 3 by Bucanero ");
}
Expand Down Expand Up @@ -426,16 +426,15 @@ static void pkgi_do_main(pkgi_input* input)
input->pressed &= ~PKGI_BUTTON_S;

DbItem* item = pkgi_db_get(selected_item);
char extra[256];
char item_info[256];

pkgi_snprintf(extra, sizeof(extra), "ID: %s\nDescription: %s\nURL: (%s) RAP: (%s) SHA256: (%s)",
pkgi_snprintf(item_info, sizeof(item_info), "ID: %s\n\nURL: (%s) RAP: (%s) SHA256: (%s)",
item->content,
item->description,
(pkgi_validate_url(item->url) ? PKGI_UTF8_CHECK_ON : PKGI_UTF8_CHECK_OFF),
(item->rap ? PKGI_UTF8_CHECK_ON : PKGI_UTF8_CHECK_OFF),
(item->digest ? PKGI_UTF8_CHECK_ON : PKGI_UTF8_CHECK_OFF) );

pkgi_dialog_details(item->name, extra);
pkgi_dialog_details(item->name, item_info, item->description);
}
}

Expand Down Expand Up @@ -616,19 +615,25 @@ static void pkgi_check_for_update(void)
*end = 0;
LOG("latest version is %s", start);

const char* current = PKGI_VERSION;
if (current[0] == '0')
{
current++;
}

if (pkgi_stricmp(current, start) != 0)
if (pkgi_stricmp(PKGI_VERSION, start) != 0)
{
LOG("new version available");

char text[256];
pkgi_snprintf(text, sizeof(text), "New pkgi version v%s available!", start);
pkgi_dialog_message(text);
DbItem update_item;
update_item.content = "UP0001-NP00PKGI3_00-0000000000000000";
update_item.name = "PKGi PS3 Update";
update_item.url = "http://update.pkgi.tk/pkgi-ps3.pkg";

pkgi_dialog_start_progress(update_item.name, "Preparing...", 0);

if (pkgi_download(&update_item, 0) && install(update_item.content))
{
char text[256];
pkgi_snprintf(text, sizeof(text), "Successfully downloaded PKGi PS3 v%s", start);
pkgi_dialog_message(text);
pkgi_dialog_set_progress_title(update_item.name);
LOG("update downloaded!");
}
}
}
else
Expand Down
25 changes: 19 additions & 6 deletions source/pkgi_dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ typedef enum {
DialogMessage,
DialogError,
DialogProgress,
DialogDetails
} DialogType;

static DialogType dialog_type;
Expand Down Expand Up @@ -51,17 +52,17 @@ void pkgi_dialog_allow_close(int allow)
pkgi_dialog_unlock();
}

void pkgi_dialog_details(const char* title, const char* text)
void pkgi_dialog_details(const char* title, const char* text, const char* extra)
{
pkgi_dialog_lock();

pkgi_strncpy(dialog_title, sizeof(dialog_title), title);
pkgi_strncpy(dialog_text, sizeof(dialog_text), text);
dialog_extra[0] = 0;
pkgi_strncpy(dialog_extra, sizeof(dialog_extra), extra);
dialog_eta[0] = 0;

dialog_cancelled = 0;
dialog_type = DialogMessage;
dialog_type = DialogDetails;
dialog_delta = 1;

pkgi_dialog_unlock();
Expand Down Expand Up @@ -147,7 +148,7 @@ void pkgi_do_dialog(pkgi_input* input)

if (dialog_allow_close)
{
if ((dialog_type == DialogMessage || dialog_type == DialogError) && (input->pressed & pkgi_ok_button()))
if ((dialog_type == DialogMessage || dialog_type == DialogError || dialog_type == DialogDetails) && (input->pressed & pkgi_ok_button()))
{
dialog_delta = -1;
}
Expand Down Expand Up @@ -293,6 +294,18 @@ void pkgi_do_dialog(pkgi_input* input)
pkgi_draw_text_z((VITA_WIDTH - pkgi_text_width(text)) / 2, PKGI_DIALOG_VMARGIN + h - 2 * font_height, PKGI_DIALOG_TEXT_Z, PKGI_COLOR_TEXT_DIALOG, text);
}
}
else if (local_type == DialogDetails)
{
pkgi_draw_text_z(PKGI_DIALOG_HMARGIN + PKGI_DIALOG_PADDING, PKGI_DIALOG_VMARGIN + PKGI_DIALOG_PADDING + font_height*2, PKGI_DIALOG_TEXT_Z, PKGI_COLOR_TEXT_DIALOG, local_text);
pkgi_draw_text_z(PKGI_DIALOG_HMARGIN + PKGI_DIALOG_PADDING, PKGI_DIALOG_VMARGIN + PKGI_DIALOG_PADDING + font_height*5, PKGI_DIALOG_TEXT_Z, PKGI_COLOR_TEXT_DIALOG, local_extra);

if (local_allow_close)
{
char text[256];
pkgi_snprintf(text, sizeof(text), "press %s to close", pkgi_ok_button() == PKGI_BUTTON_X ? PKGI_UTF8_X : PKGI_UTF8_O);
pkgi_draw_text_z((VITA_WIDTH - pkgi_text_width(text)) / 2, PKGI_DIALOG_VMARGIN + h - 2 * font_height, PKGI_DIALOG_TEXT_Z, PKGI_COLOR_TEXT_DIALOG, text);
}
}
else
{
uint32_t color;
Expand Down Expand Up @@ -354,15 +367,15 @@ void wait_dialog()
pkgi_sleep(100);
}

void draw_msgDialog_OK(const char * str)
void pkgi_msgDialog_OK(const char * str)
{
msg_dialog_action = 0;
msgType mdialogok = MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK;
msgDialogOpen2(mdialogok, str, msg_dialog_event, (void*) 0x0000aaab, NULL );
wait_dialog();
}

int draw_msgDialog_YesNo(const char * str)
int pkgi_msgDialog_YesNo(const char * str)
{
msg_dialog_action = 0;
msgType mdialogyesno = MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_YESNO | MSG_DIALOG_DEFAULT_CURSOR_NO;
Expand Down

0 comments on commit eb103c1

Please sign in to comment.