Now has a separate struct for caller app name & icon
- New home screen wording - Removed duplicate RUN_APPLICATION macro
This commit is contained in:
@@ -77,17 +77,10 @@ typedef enum chain_kind_e {
|
||||
CHAIN_KIND_OASYS
|
||||
} chain_kind_t;
|
||||
|
||||
#ifdef HAVE_NBGL
|
||||
#include "nbgl_types.h"
|
||||
#endif // HAVE_NBGL
|
||||
|
||||
typedef struct chain_config_s {
|
||||
char coinName[10]; // ticker
|
||||
uint64_t chainId;
|
||||
chain_kind_t kind;
|
||||
#ifdef HAVE_NBGL
|
||||
nbgl_icon_details_t coinIconDetails;
|
||||
#endif // HAVE_NBGL
|
||||
} chain_config_t;
|
||||
|
||||
#define ETHEREUM_MAINNET_CHAINID 1
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#define SELECTOR_SIZE 4
|
||||
#define PARAMETER_LENGTH 32
|
||||
#define RUN_APPLICATION 1
|
||||
|
||||
void copy_address(uint8_t* dst, const uint8_t* parameter, uint8_t dst_size);
|
||||
|
||||
|
||||
32
src/main.c
32
src/main.c
@@ -69,7 +69,7 @@ bolos_ux_params_t G_ux_params;
|
||||
|
||||
const internalStorage_t N_storage_real;
|
||||
|
||||
const char *plugin_name = NULL;
|
||||
caller_app_t *caller_app = NULL;
|
||||
chain_config_t *chainConfig = NULL;
|
||||
|
||||
void reset_app_context() {
|
||||
@@ -957,7 +957,13 @@ void coin_main(libargs_t *args) {
|
||||
if (args->chain_config != NULL) {
|
||||
chainConfig = args->chain_config;
|
||||
}
|
||||
plugin_name = args->plugin_name;
|
||||
if ((caller_app = args->caller_app) != NULL) {
|
||||
if (chainConfig != NULL) {
|
||||
caller_app->type = CALLER_TYPE_CLONE;
|
||||
} else {
|
||||
caller_app->type = CALLER_TYPE_PLUGIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chainConfig == NULL) {
|
||||
init_coin_config(&config);
|
||||
@@ -1097,12 +1103,6 @@ __attribute__((section(".boot"))) int main(int arg0) {
|
||||
unsigned int libcall_params[5];
|
||||
chain_config_t local_chainConfig;
|
||||
init_coin_config(&local_chainConfig);
|
||||
#ifdef HAVE_NBGL
|
||||
uint8_t coinIcon[sizeof(ICONBITMAP)];
|
||||
memcpy(coinIcon, &ICONBITMAP, sizeof(ICONBITMAP));
|
||||
memcpy(&local_chainConfig.coinIconDetails, &ICONGLYPH, sizeof(ICONGLYPH));
|
||||
local_chainConfig.coinIconDetails.bitmap = coinIcon;
|
||||
#endif // HAVE_NBGL
|
||||
|
||||
PRINTF("Hello from Eth-clone\n");
|
||||
check_api_level(CX_COMPAT_APILEVEL);
|
||||
@@ -1111,7 +1111,21 @@ __attribute__((section(".boot"))) int main(int arg0) {
|
||||
libcall_params[1] = 0x100;
|
||||
libcall_params[2] = RUN_APPLICATION;
|
||||
libcall_params[3] = (unsigned int) &local_chainConfig;
|
||||
libcall_params[4] = 0;
|
||||
#ifdef HAVE_NBGL
|
||||
const char app_name[] = APPNAME;
|
||||
caller_app_t capp;
|
||||
nbgl_icon_details_t icon_details;
|
||||
uint8_t bitmap[sizeof(ICONBITMAP)];
|
||||
|
||||
memcpy(&icon_details, &ICONGLYPH, sizeof(ICONGLYPH));
|
||||
memcpy(&bitmap, &ICONBITMAP, sizeof(bitmap));
|
||||
icon_details.bitmap = (const uint8_t *) bitmap;
|
||||
capp.name = app_name;
|
||||
capp.icon = &icon_details;
|
||||
libcall_params[4] = (unsigned int) &capp;
|
||||
#else
|
||||
libcall_params[4] = NULL;
|
||||
#endif // HAVE_NBGL
|
||||
|
||||
if (arg0) {
|
||||
// call as a library
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#include "tokens.h"
|
||||
#include "chainConfig.h"
|
||||
#include "nft.h"
|
||||
#ifdef HAVE_NBGL
|
||||
#include "nbgl_types.h"
|
||||
#endif
|
||||
|
||||
#define MAX_BIP32_PATH 10
|
||||
|
||||
@@ -221,6 +224,16 @@ typedef enum {
|
||||
|
||||
extern pluginType_t pluginType;
|
||||
|
||||
typedef enum { CALLER_TYPE_CLONE, CALLER_TYPE_PLUGIN } e_caller_type;
|
||||
|
||||
typedef struct caller_app_t {
|
||||
const char *name;
|
||||
#ifdef HAVE_NBGL
|
||||
const nbgl_icon_details_t *icon;
|
||||
#endif
|
||||
char type; // does not have to be set by the caller app
|
||||
} caller_app_t;
|
||||
|
||||
extern uint8_t appState;
|
||||
#ifdef HAVE_STARKWARE
|
||||
extern bool quantumSet;
|
||||
@@ -229,7 +242,7 @@ extern bool quantumSet;
|
||||
extern uint32_t eth2WithdrawalIndex;
|
||||
#endif
|
||||
|
||||
extern const char *plugin_name;
|
||||
extern caller_app_t *caller_app;
|
||||
|
||||
void reset_app_context(void);
|
||||
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "stdbool.h"
|
||||
#include "chainConfig.h"
|
||||
#include "shared_context.h"
|
||||
|
||||
#define RUN_APPLICATION 1
|
||||
|
||||
@@ -61,7 +62,7 @@ typedef struct libargs_s {
|
||||
check_address_parameters_t* check_address;
|
||||
create_transaction_parameters_t* create_transaction;
|
||||
get_printable_amount_parameters_t* get_printable_amount;
|
||||
char* plugin_name;
|
||||
caller_app_t* caller_app;
|
||||
};
|
||||
} libargs_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user