From 3ea016f75735c112902dca3cdec3b0b28149505c Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Mon, 24 Oct 2022 11:31:05 +0200 Subject: [PATCH 1/4] [apps/external] Move archive to Ion --- apps/external/Makefile | 2 - apps/external/extapp_api.cpp | 16 +- apps/home/controller.cpp | 26 +- apps/reader/list_book_controller.h | 4 +- apps/reader/read_book_controller.cpp | 2 +- apps/reader/read_book_controller.h | 6 +- apps/reader/utility.cpp | 12 +- apps/reader/utility.h | 4 +- escher/src/background_view.cpp | 1 - .../archive.h => ion/include/ion/external.h | 8 +- ion/src/blackbox/Makefile | 1 + ion/src/device/bootloader/Makefile | 1 + .../device/bootloader/drivers}/archive.cpp | 225 ++++++++---------- ion/src/device/n0110/Makefile | 1 + ion/src/device/n0110/drivers/archive.cpp | 181 ++++++++++++++ ion/src/shared/dummy/archive.cpp | 93 ++++++++ ion/src/simulator/Makefile | 1 + 17 files changed, 422 insertions(+), 162 deletions(-) rename apps/external/archive.h => ion/include/ion/external.h (86%) rename {apps/external => ion/src/device/bootloader/drivers}/archive.cpp (54%) create mode 100644 ion/src/device/n0110/drivers/archive.cpp create mode 100644 ion/src/shared/dummy/archive.cpp diff --git a/apps/external/Makefile b/apps/external/Makefile index 0929e8d218c..df8284877c2 100644 --- a/apps/external/Makefile +++ b/apps/external/Makefile @@ -2,7 +2,6 @@ ifdef HOME_DISPLAY_EXTERNALS app_external_src = $(addprefix apps/external/,\ extapp_api.cpp \ - archive.cpp \ ) $(eval $(call depends_on_image,apps/home/controller.cpp,apps/external/external_icon.png)) @@ -15,7 +14,6 @@ app_headers += apps/external/app.h app_external_src = $(addprefix apps/external/,\ app.cpp \ extapp_api.cpp \ - archive.cpp \ main_controller.cpp \ pointer_text_table_cell.cpp \ ) diff --git a/apps/external/extapp_api.cpp b/apps/external/extapp_api.cpp index 23254ab9146..450dffb9c47 100644 --- a/apps/external/extapp_api.cpp +++ b/apps/external/extapp_api.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "archive.h" +#include #include "extapp_api.h" #include "../apps_container.h" #include "../global_preferences.h" @@ -128,11 +128,11 @@ int extapp_fileListWithExtension(const char ** filenames, int maxrecords, const // Don't read external files the exam mode is enabled if (GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) return j; if (storage == EXTAPP_FLASH_FILE_SYSTEM || storage == EXTAPP_BOTH_FILE_SYSTEM) { - int n = External::Archive::numberOfFiles(); + int n = Ion::External::Archive::numberOfFiles(); for (int i = 0; i < n && j < maxrecords; i++) { - External::Archive::File entry; + Ion::External::Archive::File entry; // Filter extension - if (External::Archive::fileAtIndex(i, entry) && match(entry.name, extension)) { + if (Ion::External::Archive::fileAtIndex(i, entry) && match(entry.name, extension)) { filenames[j] = entry.name; ++j; } @@ -147,7 +147,7 @@ bool extapp_fileExists(const char * filename, int storage) { return true; } if (storage == EXTAPP_FLASH_FILE_SYSTEM || storage == EXTAPP_BOTH_FILE_SYSTEM) { - return External::Archive::indexFromName(filename) >= 0; + return Ion::External::Archive::indexFromName(filename) >= 0; } return false; } @@ -178,10 +178,10 @@ const char * extapp_fileRead(const char * filename, size_t * len, int storage) { } } if (storage == EXTAPP_FLASH_FILE_SYSTEM || storage == EXTAPP_BOTH_FILE_SYSTEM) { - int index = External::Archive::indexFromName(filename); + int index = Ion::External::Archive::indexFromName(filename); if (index >= 0) { - External::Archive::File entry; - External::Archive::fileAtIndex(index, entry); + Ion::External::Archive::File entry; + Ion::External::Archive::fileAtIndex(index, entry); if (len) { *len = entry.dataLength; } diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index a79700b3f0d..c5910959b25 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -11,7 +11,7 @@ extern "C" { #ifdef HOME_DISPLAY_EXTERNALS #include "../external/external_icon.h" -#include "../external/archive.h" +#include #include #endif @@ -77,10 +77,10 @@ Controller::Controller(Responder * parentResponder, SelectableTableViewDataSourc #ifdef HOME_DISPLAY_EXTERNALS - int index = External::Archive::indexFromName("wallpaper.obm"); + int index = Ion::External::Archive::indexFromName("wallpaper.obm"); if(index > -1) { - External::Archive::File image; - External::Archive::fileAtIndex(index, image); + Ion::External::Archive::File image; + Ion::External::Archive::fileAtIndex(index, image); m_view.backgroundView()->setBackgroundImage(image.data); } #endif @@ -96,9 +96,9 @@ bool Controller::handleEvent(Ion::Events::Event event) { if (GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::Dutch || GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::NoSymNoText || GlobalPreferences::sharedGlobalPreferences()->examMode() == GlobalPreferences::ExamMode::NoSym) { App::app()->displayWarning(I18n::Message::ForbiddenAppInExamMode1, I18n::Message::ForbiddenAppInExamMode2); } else { - External::Archive::File executable; - if (External::Archive::executableAtIndex(index - container->numberOfApps(), executable)) { - uint32_t res = External::Archive::executeFile(executable.name, ((App *)m_app)->heap(), ((App *)m_app)->heapSize()); + Ion::External::Archive::File executable; + if (Ion::External::Archive::executableAtIndex(index - container->numberOfApps(), executable)) { + uint32_t res = Ion::External::Archive::executeFile(executable.name, ((App *)m_app)->heap(), ((App *)m_app)->heapSize()); ((App*)m_app)->redraw(); switch(res) { case 0: @@ -197,19 +197,19 @@ void Controller::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) { int appIndex = (j * k_numberOfColumns + i) + 1; if (appIndex >= container->numberOfApps()) { #ifdef HOME_DISPLAY_EXTERNALS - External::Archive::File app_file; + Ion::External::Archive::File app_file; - if (External::Archive::executableAtIndex(appIndex - container->numberOfApps(), app_file)) { + if (Ion::External::Archive::executableAtIndex(appIndex - container->numberOfApps(), app_file)) { char temp_name_buffer[100]; strlcpy(temp_name_buffer, app_file.name, 94); strlcat(temp_name_buffer, ".icon", 99); - int img_index = External::Archive::indexFromName(temp_name_buffer); + int img_index = Ion::External::Archive::indexFromName(temp_name_buffer); if (img_index != -1) { - External::Archive::File image_file; - if (External::Archive::fileAtIndex(img_index, image_file)) { + Ion::External::Archive::File image_file; + if (Ion::External::Archive::fileAtIndex(img_index, image_file)) { // const Image* img = new Image(55, 56, image_file.data, image_file.dataLength); appCell->setExtAppDescriptor(app_file.name, image_file.data, image_file.dataLength); } else { @@ -237,7 +237,7 @@ int Controller::numberOfIcons() const { AppsContainer * container = AppsContainer::sharedAppsContainer(); assert(container->numberOfApps() > 0); #ifdef HOME_DISPLAY_EXTERNALS - return container->numberOfApps() - 1 + External::Archive::numberOfExecutables(); + return container->numberOfApps() - 1 + Ion::External::Archive::numberOfExecutables(); #else return container->numberOfApps() - 1; #endif diff --git a/apps/reader/list_book_controller.h b/apps/reader/list_book_controller.h index 3250b173f80..5a71c69fe87 100644 --- a/apps/reader/list_book_controller.h +++ b/apps/reader/list_book_controller.h @@ -2,7 +2,7 @@ #define __LIST_BOOK_CONTROLLER_H__ #include -#include +#include #include "read_book_controller.h" @@ -30,7 +30,7 @@ class ListBookController : public ViewController, public SimpleListViewDataSourc private: SelectableTableView m_tableView; static const int k_maxFilesNumber = 20; - External::Archive::File m_files[k_maxFilesNumber]; + Ion::External::Archive::File m_files[k_maxFilesNumber]; int m_txtFilesNumber; int m_urtFilesNumber; static const int k_cellsNumber = 6; diff --git a/apps/reader/read_book_controller.cpp b/apps/reader/read_book_controller.cpp index 85ef0b77c23..9b3f8b15aff 100644 --- a/apps/reader/read_book_controller.cpp +++ b/apps/reader/read_book_controller.cpp @@ -14,7 +14,7 @@ View * ReadBookController::view() { return &m_readerView; } -void ReadBookController::setBook(const External::Archive::File& file, bool isRichTextFile) { +void ReadBookController::setBook(const Ion::External::Archive::File& file, bool isRichTextFile) { m_file = &file; loadPosition(); m_readerView.setText(reinterpret_cast(file.data), file.dataLength, isRichTextFile); diff --git a/apps/reader/read_book_controller.h b/apps/reader/read_book_controller.h index 7fb42b16587..63db9a82580 100644 --- a/apps/reader/read_book_controller.h +++ b/apps/reader/read_book_controller.h @@ -2,7 +2,7 @@ #define _READ_BOOK_CONTROLLER_H_ #include -#include "apps/external/archive.h" +#include "ion/external.h" #include "word_wrap_view.h" namespace Reader { @@ -11,7 +11,7 @@ class ReadBookController : public ViewController { public: ReadBookController(Responder * parentResponder); View * view() override; - void setBook(const External::Archive::File& file, bool isRichTextFile); + void setBook(const Ion::External::Archive::File& file, bool isRichTextFile); bool handleEvent(Ion::Events::Event event) override; void viewDidDisappear() override; void savePosition() const; @@ -19,7 +19,7 @@ class ReadBookController : public ViewController { void throwError(); private: WordWrapTextView m_readerView; - const External::Archive::File* m_file; + const Ion::External::Archive::File* m_file; }; } diff --git a/apps/reader/utility.cpp b/apps/reader/utility.cpp index c29c28f1f29..efcfe671631 100644 --- a/apps/reader/utility.cpp +++ b/apps/reader/utility.cpp @@ -46,12 +46,12 @@ void stringNCopy(char* dest, int max, const char* src, int len) { #ifdef DEVICE -int filesWithExtension(const char* extension, External::Archive::File* files, int filesSize) { - size_t nbTotalFiles = External::Archive::numberOfFiles(); +int filesWithExtension(const char* extension, Ion::External::Archive::File* files, int filesSize) { + size_t nbTotalFiles = Ion::External::Archive::numberOfFiles(); int nbFiles = 0; for(size_t i=0; i < nbTotalFiles; ++i) { - External::Archive::File file; - External::Archive::fileAtIndex(i, file); + Ion::External::Archive::File file; + Ion::External::Archive::fileAtIndex(i, file); if(stringEndsWith(file.name, extension)) { files[nbFiles] = file; nbFiles++; @@ -63,7 +63,7 @@ int filesWithExtension(const char* extension, External::Archive::File* files, in } #else -static void fillFileData(External::Archive::File& file) { +static void fillFileData(Ion::External::Archive::File& file) { file.data = nullptr; file.dataLength = 0; @@ -87,7 +87,7 @@ static void fillFileData(External::Archive::File& file) { file.dataLength = info.st_size; } -int filesWithExtension(const char* extension, External::Archive::File* files, int filesSize) { +int filesWithExtension(const char* extension, Ion::External::Archive::File* files, int filesSize) { dirent *file; DIR *d = opendir("."); int nb = 0; diff --git a/apps/reader/utility.h b/apps/reader/utility.h index 61aabbf2cf6..794c7f17f98 100644 --- a/apps/reader/utility.h +++ b/apps/reader/utility.h @@ -1,7 +1,7 @@ #ifndef __UTILITY_H__ #define __UTILITY_H__ -#include +#include #include #include @@ -9,7 +9,7 @@ namespace Reader { bool stringEndsWith(const char* str, const char* end); -int filesWithExtension(const char* extension, External::Archive::File* files, int filesSize); +int filesWithExtension(const char* extension, Ion::External::Archive::File* files, int filesSize); void stringNCopy(char* dest, int max, const char* src, int len); const char * EndOfPrintableWord(const char * word, const char * end); const char * StartOfPrintableWord(const char * word, const char * start); diff --git a/escher/src/background_view.cpp b/escher/src/background_view.cpp index 3711185c080..392bcd16272 100644 --- a/escher/src/background_view.cpp +++ b/escher/src/background_view.cpp @@ -5,7 +5,6 @@ #include "apps/home/controller.h" #ifdef HOME_DISPLAY_EXTERNALS #include "apps/external/external_icon.h" -#include "apps/external/archive.h" #include #endif diff --git a/apps/external/archive.h b/ion/include/ion/external.h similarity index 86% rename from apps/external/archive.h rename to ion/include/ion/external.h index de96e6d204f..f384873a030 100644 --- a/apps/external/archive.h +++ b/ion/include/ion/external.h @@ -1,9 +1,12 @@ -#ifndef EXTERNAL_ARCHIVE_H -#define EXTERNAL_ARCHIVE_H +#ifndef ION_EXTERNAL_H +#define ION_EXTERNAL_H +extern "C" { #include #include +} +namespace Ion { namespace External { namespace Archive { @@ -24,6 +27,7 @@ size_t numberOfExecutables(); bool executableAtIndex(size_t index, File &entry); uint32_t executeFile(const char *name, void * heap, const uint32_t heapSize); +} } } diff --git a/ion/src/blackbox/Makefile b/ion/src/blackbox/Makefile index b4ed4aec5c1..522678c7055 100644 --- a/ion/src/blackbox/Makefile +++ b/ion/src/blackbox/Makefile @@ -13,6 +13,7 @@ ion_src += $(addprefix ion/src/shared/, \ power.cpp \ random.cpp \ timing.cpp \ + dummy/archive.cpp \ dummy/backlight.cpp \ dummy/battery.cpp \ dummy/rtc.cpp \ diff --git a/ion/src/device/bootloader/Makefile b/ion/src/device/bootloader/Makefile index c5d7208f7ab..f0822cb2285 100644 --- a/ion/src/device/bootloader/Makefile +++ b/ion/src/device/bootloader/Makefile @@ -1,5 +1,6 @@ ion_device_src += $(addprefix ion/src/device/bootloader/drivers/, \ + archive.cpp \ board.cpp \ cache.cpp \ external_flash_tramp.cpp \ diff --git a/apps/external/archive.cpp b/ion/src/device/bootloader/drivers/archive.cpp similarity index 54% rename from apps/external/archive.cpp rename to ion/src/device/bootloader/drivers/archive.cpp index 285e262a586..e211186497a 100644 --- a/apps/external/archive.cpp +++ b/ion/src/device/bootloader/drivers/archive.cpp @@ -1,42 +1,101 @@ -#include "archive.h" +#include "apps/global_preferences.h" #include "extapp_api.h" -#include "../global_preferences.h" +#include -#include #include +#include +namespace Ion { namespace External { namespace Archive { -#ifdef DEVICE - -struct TarHeader -{ /* byte offset */ - char name[100]; /* 0 */ - char mode[8]; /* 100 */ - char uid[8]; /* 108 */ - char gid[8]; /* 116 */ - char size[12]; /* 124 */ - char mtime[12]; /* 136 */ - char chksum[8]; /* 148 */ - char typeflag; /* 156 */ - char linkname[100]; /* 157 */ - char magic[8]; /* 257 */ - char uname[32]; /* 265 */ - char gname[32]; /* 297 */ - char devmajor[8]; /* 329 */ - char devminor[8]; /* 337 */ - char padding[167]; /* 345 */ +size_t numberOfFiles() { + File dummy{}; + size_t count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) {;} + + return count; +} + +int indexFromName(const char *name) { + File entry{}; + + for (int i = 0; fileAtIndex(i, entry); i++) { + if (entry.readable && strcmp(name, entry.name) == 0) { + return i; + } + } + + return -1; +} + +bool executableAtIndex(size_t index, File &entry) { + File dummy{}; + size_t count = 0; + size_t final_count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) { + if (dummy.isExecutable) { + if (final_count == index) { + entry.name = dummy.name; + entry.data = dummy.data; + entry.dataLength = dummy.dataLength; + entry.isExecutable = dummy.isExecutable; + entry.readable = dummy.readable; + return true; + } + final_count++; + } + } + return false; +} + +size_t numberOfExecutables() { + if (!GlobalPreferences::sharedGlobalPreferences()->externalAppShown()) { + return 0U; + } + File dummy{}; + size_t count = 0; + size_t final_count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) { + if (dummy.isExecutable) { + final_count++; + } + } + + return final_count; +} + +struct TarHeader { /* byte offset */ + char name[100]; /* 0 */ + char mode[8]; /* 100 */ + char uid[8]; /* 108 */ + char gid[8]; /* 116 */ + char size[12]; /* 124 */ + char mtime[12]; /* 136 */ + char chksum[8]; /* 148 */ + char typeflag; /* 156 */ + char linkname[100]; /* 157 */ + char magic[8]; /* 257 */ + char uname[32]; /* 265 */ + char gname[32]; /* 297 */ + char devmajor[8]; /* 329 */ + char devminor[8]; /* 337 */ + char padding[167]; /* 345 */ } __attribute__((packed)); static_assert(sizeof(TarHeader) == 512); -bool isSane(const TarHeader* tar) { - return !memcmp(tar->magic, "ustar ", 8) && tar->name[0] != '\x00' && tar->name[0] != '\xFF'; +bool isSane(const TarHeader *tar) { + return !memcmp(tar->magic, "ustar ", 8) && tar->name[0] != '\x00' && + tar->name[0] != '\xFF'; } -bool isExamModeAndFileNotExecutable(const TarHeader* tar) { - return GlobalPreferences::sharedGlobalPreferences()->isInExamMode() && (tar->mode[4] & 0x01) == 0; +bool isExamModeAndFileNotExecutable(const TarHeader *tar) { + return GlobalPreferences::sharedGlobalPreferences()->isInExamMode() && + (tar->mode[4] & 0x01) == 0; } bool fileAtIndex(size_t index, File &entry) { @@ -44,7 +103,7 @@ bool fileAtIndex(size_t index, File &entry) { return false; } - const TarHeader* tar = reinterpret_cast(0x90200000); + const TarHeader * tar = reinterpret_cast(0x90200000); unsigned size = 0; // Sanity check. @@ -56,13 +115,14 @@ bool fileAtIndex(size_t index, File &entry) { * TAR files are comprised of a set of records aligned to 512 bytes boundary * followed by data. */ - - for(;;) { + + for (;;) { // Calculate the size size = 0; - for (int i = 0; i < 11; i++) + for (int i = 0; i < 11; i++) { size = size * 8 + (tar->size[i] - '0'); - + } + // Check if we found our file. if (index == 0) { // If yes, check for sanity and for exam mode stuff @@ -72,7 +132,7 @@ bool fileAtIndex(size_t index, File &entry) { // File entry found, copy data out. entry.name = tar->name; - entry.data = reinterpret_cast(tar) + sizeof(TarHeader); + entry.data = reinterpret_cast(tar) + sizeof(TarHeader); entry.dataLength = size; entry.isExecutable = (tar->mode[4] & 0x01) == 1; // TODO: Handle the trash @@ -83,7 +143,8 @@ bool fileAtIndex(size_t index, File &entry) { // move to the next TAR header. unsigned stride = (sizeof(TarHeader) + size + 511); stride = (stride >> 9) << 9; - tar = reinterpret_cast(reinterpret_cast(tar) + stride); + tar = reinterpret_cast( + reinterpret_cast(tar) + stride); // Sanity check. if (!isSane(tar)) { @@ -92,109 +153,29 @@ bool fileAtIndex(size_t index, File &entry) { } index--; } - + // Achievement unlock: How did we get there ? return false; } -extern "C" void (* const apiPointers[])(void); -typedef uint32_t (*entrypoint)(const uint32_t, const void *, void *, const uint32_t); +extern "C" void (*const apiPointers[])(void); +typedef uint32_t (*entrypoint)(const uint32_t, const void *, void *, + const uint32_t); -uint32_t executeFile(const char *name, void * heap, const uint32_t heapSize) { +uint32_t executeFile(const char *name, void *heap, const uint32_t heapSize) { File entry; - if(fileAtIndex(indexFromName(name), entry)) { - if(!entry.isExecutable) { + if (fileAtIndex(indexFromName(name), entry)) { + if (!entry.isExecutable) { return 0; } - uint32_t ep = *reinterpret_cast(entry.data); - if(ep >= 0x90200000 && ep < 0x90800000) { + uint32_t ep = *reinterpret_cast(entry.data); + if (ep >= 0x90200000 && ep < 0x90800000) { return ((entrypoint)ep)(API_VERSION, apiPointers, heap, heapSize); } } return -1; } - -#else - -bool fileAtIndex(size_t index, File &entry) { - if (index != 0) { - return false; - } - - entry.name = "Built-in"; - entry.data = NULL; - entry.dataLength = 0; - entry.isExecutable = true; - entry.readable = true; - return true; } - -extern "C" void extapp_main(void); - -uint32_t executeFile(const char *name, void * heap, const uint32_t heapSize) { - extapp_main(); - return 0; -} - -#endif - -size_t numberOfFiles() { - File dummy; - size_t count; - - for (count = 0; fileAtIndex(count, dummy); count++); - - return count; -} - -int indexFromName(const char *name) { - File entry; - - for (int i = 0; fileAtIndex(i, entry); i++) { - if (entry.readable && strcmp(name, entry.name) == 0) { - return i; - } - } - - return -1; -} - -bool executableAtIndex(size_t index, File &entry) { - File dummy; - size_t count; - size_t final_count = 0; - - for (count = 0; fileAtIndex(count, dummy); count++) { - if (dummy.isExecutable) { - if (final_count == index) { - entry.name = dummy.name; - entry.data = dummy.data; - entry.dataLength = dummy.dataLength; - entry.isExecutable = dummy.isExecutable; - entry.readable = dummy.readable; - return true; - } - final_count++; - } - } - return false; -} - -size_t numberOfExecutables() { - if (!GlobalPreferences::sharedGlobalPreferences()->externalAppShown()) { - return false; - } - File dummy; - size_t count; - size_t final_count = 0; - - for (count = 0; fileAtIndex(count, dummy); count++) - if (dummy.isExecutable) - final_count++; - - return final_count; -} - } } diff --git a/ion/src/device/n0110/Makefile b/ion/src/device/n0110/Makefile index 24b1a720469..c39f28bf39f 100644 --- a/ion/src/device/n0110/Makefile +++ b/ion/src/device/n0110/Makefile @@ -1,4 +1,5 @@ ion_device_src += $(addprefix ion/src/device/n0110/drivers/, \ + archive.cpp \ cache.cpp \ external_flash.cpp \ led.cpp \ diff --git a/ion/src/device/n0110/drivers/archive.cpp b/ion/src/device/n0110/drivers/archive.cpp new file mode 100644 index 00000000000..e211186497a --- /dev/null +++ b/ion/src/device/n0110/drivers/archive.cpp @@ -0,0 +1,181 @@ +#include "apps/global_preferences.h" +#include "extapp_api.h" +#include + +#include +#include + +namespace Ion { +namespace External { +namespace Archive { + +size_t numberOfFiles() { + File dummy{}; + size_t count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) {;} + + return count; +} + +int indexFromName(const char *name) { + File entry{}; + + for (int i = 0; fileAtIndex(i, entry); i++) { + if (entry.readable && strcmp(name, entry.name) == 0) { + return i; + } + } + + return -1; +} + +bool executableAtIndex(size_t index, File &entry) { + File dummy{}; + size_t count = 0; + size_t final_count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) { + if (dummy.isExecutable) { + if (final_count == index) { + entry.name = dummy.name; + entry.data = dummy.data; + entry.dataLength = dummy.dataLength; + entry.isExecutable = dummy.isExecutable; + entry.readable = dummy.readable; + return true; + } + final_count++; + } + } + return false; +} + +size_t numberOfExecutables() { + if (!GlobalPreferences::sharedGlobalPreferences()->externalAppShown()) { + return 0U; + } + File dummy{}; + size_t count = 0; + size_t final_count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) { + if (dummy.isExecutable) { + final_count++; + } + } + + return final_count; +} + +struct TarHeader { /* byte offset */ + char name[100]; /* 0 */ + char mode[8]; /* 100 */ + char uid[8]; /* 108 */ + char gid[8]; /* 116 */ + char size[12]; /* 124 */ + char mtime[12]; /* 136 */ + char chksum[8]; /* 148 */ + char typeflag; /* 156 */ + char linkname[100]; /* 157 */ + char magic[8]; /* 257 */ + char uname[32]; /* 265 */ + char gname[32]; /* 297 */ + char devmajor[8]; /* 329 */ + char devminor[8]; /* 337 */ + char padding[167]; /* 345 */ +} __attribute__((packed)); + +static_assert(sizeof(TarHeader) == 512); + +bool isSane(const TarHeader *tar) { + return !memcmp(tar->magic, "ustar ", 8) && tar->name[0] != '\x00' && + tar->name[0] != '\xFF'; +} + +bool isExamModeAndFileNotExecutable(const TarHeader *tar) { + return GlobalPreferences::sharedGlobalPreferences()->isInExamMode() && + (tar->mode[4] & 0x01) == 0; +} + +bool fileAtIndex(size_t index, File &entry) { + if (index == -1) { + return false; + } + + const TarHeader * tar = reinterpret_cast(0x90200000); + unsigned size = 0; + + // Sanity check. + if (!isSane(tar) || isExamModeAndFileNotExecutable(tar)) { + return false; + } + + /** + * TAR files are comprised of a set of records aligned to 512 bytes boundary + * followed by data. + */ + + for (;;) { + // Calculate the size + size = 0; + for (int i = 0; i < 11; i++) { + size = size * 8 + (tar->size[i] - '0'); + } + + // Check if we found our file. + if (index == 0) { + // If yes, check for sanity and for exam mode stuff + if (!isSane(tar) || isExamModeAndFileNotExecutable(tar)) { + return false; + } + + // File entry found, copy data out. + entry.name = tar->name; + entry.data = reinterpret_cast(tar) + sizeof(TarHeader); + entry.dataLength = size; + entry.isExecutable = (tar->mode[4] & 0x01) == 1; + // TODO: Handle the trash + entry.readable = true; + + return true; + } else { + // move to the next TAR header. + unsigned stride = (sizeof(TarHeader) + size + 511); + stride = (stride >> 9) << 9; + tar = reinterpret_cast( + reinterpret_cast(tar) + stride); + + // Sanity check. + if (!isSane(tar)) { + return false; + } + } + index--; + } + + // Achievement unlock: How did we get there ? + return false; +} + +extern "C" void (*const apiPointers[])(void); +typedef uint32_t (*entrypoint)(const uint32_t, const void *, void *, + const uint32_t); + +uint32_t executeFile(const char *name, void *heap, const uint32_t heapSize) { + File entry; + if (fileAtIndex(indexFromName(name), entry)) { + if (!entry.isExecutable) { + return 0; + } + uint32_t ep = *reinterpret_cast(entry.data); + if (ep >= 0x90200000 && ep < 0x90800000) { + return ((entrypoint)ep)(API_VERSION, apiPointers, heap, heapSize); + } + } + return -1; +} + +} +} +} diff --git a/ion/src/shared/dummy/archive.cpp b/ion/src/shared/dummy/archive.cpp new file mode 100644 index 00000000000..b1e092295b0 --- /dev/null +++ b/ion/src/shared/dummy/archive.cpp @@ -0,0 +1,93 @@ +#include "apps/global_preferences.h" +#include + +#include +#include + +namespace Ion { +namespace External { +namespace Archive { + +size_t numberOfFiles() { + File dummy{}; + size_t count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) {;} + + return count; +} + +int indexFromName(const char *name) { + File entry{}; + + for (int i = 0; fileAtIndex(i, entry); i++) { + if (entry.readable && strcmp(name, entry.name) == 0) { + return i; + } + } + + return -1; +} + +bool executableAtIndex(size_t index, File &entry) { + File dummy{}; + size_t count = 0; + size_t final_count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) { + if (dummy.isExecutable) { + if (final_count == index) { + entry.name = dummy.name; + entry.data = dummy.data; + entry.dataLength = dummy.dataLength; + entry.isExecutable = dummy.isExecutable; + entry.readable = dummy.readable; + return true; + } + final_count++; + } + } + return false; +} + +size_t numberOfExecutables() { + if (!GlobalPreferences::sharedGlobalPreferences()->externalAppShown()) { + return 0U; + } + File dummy{}; + size_t count = 0; + size_t final_count = 0; + + for (count = 0; fileAtIndex(count, dummy); count++) { + if (dummy.isExecutable) { + final_count++; + } + } + + return final_count; +} + + +bool fileAtIndex(size_t index, File &entry) { + if (index != 0) { + return false; + } + + entry.name = "Built-in"; + entry.data = nullptr; + entry.dataLength = 0; + entry.isExecutable = true; + entry.readable = true; + return true; +} + +extern "C" void extapp_main(void); + +uint32_t executeFile(const char * name, void * heap, const uint32_t heapSize) { + extapp_main(); + return 0; +} + +} +} +} diff --git a/ion/src/simulator/Makefile b/ion/src/simulator/Makefile index caa9c1028a8..54b8b47fe1c 100644 --- a/ion/src/simulator/Makefile +++ b/ion/src/simulator/Makefile @@ -1,4 +1,5 @@ ion_src += $(addprefix ion/src/shared/dummy/, \ + archive.cpp \ backlight.cpp \ board.cpp \ battery.cpp \ From ef7a83a14d6c92834478d47e95c3279972a951ac Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Mon, 24 Oct 2022 12:09:50 +0200 Subject: [PATCH 2/4] [apps/external] Move extapp_api to Ion --- apps/external/Makefile | 5 - apps/external/extapp_api.h | 263 +---------- ion/Makefile | 1 + ion/include/ion/extapp_api.h | 415 ++++++++++++++++++ ion/src/device/bootloader/drivers/archive.cpp | 2 +- ion/src/device/n0110/drivers/archive.cpp | 2 +- .../src/shared}/extapp_api.cpp | 6 +- 7 files changed, 423 insertions(+), 271 deletions(-) create mode 100644 ion/include/ion/extapp_api.h rename {apps/external => ion/src/shared}/extapp_api.cpp (99%) diff --git a/apps/external/Makefile b/apps/external/Makefile index df8284877c2..bb6ced871e8 100644 --- a/apps/external/Makefile +++ b/apps/external/Makefile @@ -1,9 +1,5 @@ ifdef HOME_DISPLAY_EXTERNALS -app_external_src = $(addprefix apps/external/,\ - extapp_api.cpp \ -) - $(eval $(call depends_on_image,apps/home/controller.cpp,apps/external/external_icon.png)) else @@ -13,7 +9,6 @@ app_headers += apps/external/app.h app_external_src = $(addprefix apps/external/,\ app.cpp \ - extapp_api.cpp \ main_controller.cpp \ pointer_text_table_cell.cpp \ ) diff --git a/apps/external/extapp_api.h b/apps/external/extapp_api.h index 9a98e5526d4..bc654f7281f 100644 --- a/apps/external/extapp_api.h +++ b/apps/external/extapp_api.h @@ -1,261 +1,2 @@ -#ifndef EXTERNAL_API_H -#define EXTERNAL_API_H - -#include -#include -#include - -#define API_VERSION 2 - -#ifdef __cplusplus -#define EXTERNC extern "C" -#else -#define EXTERNC -#endif - -#define LCD_WIDTH 320 -#define LCD_HEIGHT 240 - -#define EXTAPP_RAM_FILE_SYSTEM 0 -#define EXTAPP_FLASH_FILE_SYSTEM 1 -#define EXTAPP_BOTH_FILE_SYSTEM 2 - -#define SCANCODE_Left ((uint64_t)1 << 0) -#define SCANCODE_Up ((uint64_t)1 << 1) -#define SCANCODE_Down ((uint64_t)1 << 2) -#define SCANCODE_Right ((uint64_t)1 << 3) -#define SCANCODE_OK ((uint64_t)1 << 4) -#define SCANCODE_Back ((uint64_t)1 << 5) -#define SCANCODE_Home ((uint64_t)1 << 6) -#define SCANCODE_OnOff (((uint64_t)1 << 7) || ((uint64_t)1 << 8)) -#define SCANCODE_Shift ((uint64_t)1 << 12) -#define SCANCODE_Alpha ((uint64_t)1 << 13) -#define SCANCODE_XNT ((uint64_t)1 << 14) -#define SCANCODE_Var ((uint64_t)1 << 15) -#define SCANCODE_Toolbox ((uint64_t)1 << 16) -#define SCANCODE_Backspace ((uint64_t)1 << 17) -#define SCANCODE_Exp ((uint64_t)1 << 18) -#define SCANCODE_Ln ((uint64_t)1 << 19) -#define SCANCODE_Log ((uint64_t)1 << 20) -#define SCANCODE_Imaginary ((uint64_t)1 << 21) -#define SCANCODE_Comma ((uint64_t)1 << 22) -#define SCANCODE_Power ((uint64_t)1 << 23) -#define SCANCODE_Sine ((uint64_t)1 << 24) -#define SCANCODE_Cosine ((uint64_t)1 << 25) -#define SCANCODE_Tangent ((uint64_t)1 << 26) -#define SCANCODE_Pi ((uint64_t)1 << 27) -#define SCANCODE_Sqrt ((uint64_t)1 << 28) -#define SCANCODE_Square ((uint64_t)1 << 29) -#define SCANCODE_Seven ((uint64_t)1 << 30) -#define SCANCODE_Eight ((uint64_t)1 << 31) -#define SCANCODE_Nine ((uint64_t)1 << 32) -#define SCANCODE_LeftParenthesis ((uint64_t)1 << 33) -#define SCANCODE_RightParenthesis ((uint64_t)1 << 34) -#define SCANCODE_Four ((uint64_t)1 << 36) -#define SCANCODE_Five ((uint64_t)1 << 37) -#define SCANCODE_Six ((uint64_t)1 << 38) -#define SCANCODE_Multiplication ((uint64_t)1 << 39) -#define SCANCODE_Division ((uint64_t)1 << 40) -#define SCANCODE_One ((uint64_t)1 << 42) -#define SCANCODE_Two ((uint64_t)1 << 43) -#define SCANCODE_Three ((uint64_t)1 << 44) -#define SCANCODE_Plus ((uint64_t)1 << 45) -#define SCANCODE_Minus ((uint64_t)1 << 46) -#define SCANCODE_Zero ((uint64_t)1 << 48) -#define SCANCODE_Dot ((uint64_t)1 << 49) -#define SCANCODE_EE ((uint64_t)1 << 50) -#define SCANCODE_Ans ((uint64_t)1 << 51) -#define SCANCODE_EXE ((uint64_t)1 << 52) -#define SCANCODE_None ((uint64_t)1 << 54) - -// Character codes -#define KEY_CHAR_0 0x30 -#define KEY_CHAR_1 0x31 -#define KEY_CHAR_2 0x32 -#define KEY_CHAR_3 0x33 -#define KEY_CHAR_4 0x34 -#define KEY_CHAR_5 0x35 -#define KEY_CHAR_6 0x36 -#define KEY_CHAR_7 0x37 -#define KEY_CHAR_8 0x38 -#define KEY_CHAR_9 0x39 -#define KEY_CHAR_DP 0x2e -#define KEY_CHAR_EXP 0x0f -#define KEY_CHAR_PMINUS 30200 -#define KEY_CHAR_PLUS 43 -#define KEY_CHAR_MINUS 45 -#define KEY_CHAR_MULT 42 -#define KEY_CHAR_DIV 47 -#define KEY_CHAR_FRAC 0xbb -#define KEY_CHAR_LPAR 0x28 -#define KEY_CHAR_RPAR 0x29 -#define KEY_CHAR_COMMA 0x2c -#define KEY_CHAR_STORE 0x0e -#define KEY_CHAR_LOG 0x95 -#define KEY_CHAR_LN 0x85 -#define KEY_CHAR_SIN 0x81 -#define KEY_CHAR_COS 0x82 -#define KEY_CHAR_TAN 0x83 -#define KEY_CHAR_SQUARE 0x8b -#define KEY_CHAR_POW 0xa8 -#define KEY_CHAR_IMGNRY 0x7f50 -#define KEY_CHAR_LIST 0x7f51 -#define KEY_CHAR_MAT 0x7f40 -#define KEY_CHAR_EQUAL 0x3d -#define KEY_CHAR_PI 0xd0 -#define KEY_CHAR_ANS 0xc0 -#define KEY_SHIFT_ANS 0xc1 -#define KEY_CHAR_LBRCKT 0x5b -#define KEY_CHAR_RBRCKT 0x5d -#define KEY_CHAR_LBRACE 0x7b -#define KEY_CHAR_RBRACE 0x7d -#define KEY_CHAR_CR 0x0d -#define KEY_CHAR_CUBEROOT 0x96 -#define KEY_CHAR_RECIP 0x9b -#define KEY_CHAR_ANGLE 0x7f54 -#define KEY_CHAR_EXPN10 0xb5 -#define KEY_CHAR_EXPN 0xa5 -#define KEY_CHAR_ASIN 0x91 -#define KEY_CHAR_ACOS 0x92 -#define KEY_CHAR_ATAN 0x93 -#define KEY_CHAR_ROOT 0x86 -#define KEY_CHAR_POWROOT 0xb8 -#define KEY_CHAR_SPACE 0x20 -#define KEY_CHAR_DQUATE 0x22 -#define KEY_CHAR_VALR 0xcd -#define KEY_CHAR_THETA 0xce -#define KEY_CHAR_FACTOR 0xda -#define KEY_CHAR_NORMAL 0xdb -#define KEY_CHAR_A 0x41 -#define KEY_CHAR_B 0x42 -#define KEY_CHAR_C 0x43 -#define KEY_CHAR_D 0x44 -#define KEY_CHAR_E 0x45 -#define KEY_CHAR_F 0x46 -#define KEY_CHAR_G 0x47 -#define KEY_CHAR_H 0x48 -#define KEY_CHAR_I 0x49 -#define KEY_CHAR_J 0x4a -#define KEY_CHAR_K 0x4b -#define KEY_CHAR_L 0x4c -#define KEY_CHAR_M 0x4d -#define KEY_CHAR_N 0x4e -#define KEY_CHAR_O 0x4f -#define KEY_CHAR_P 0x50 -#define KEY_CHAR_Q 0x51 -#define KEY_CHAR_R 0x52 -#define KEY_CHAR_S 0x53 -#define KEY_CHAR_T 0x54 -#define KEY_CHAR_U 0x55 -#define KEY_CHAR_V 0x56 -#define KEY_CHAR_W 0x57 -#define KEY_CHAR_X 0x58 -#define KEY_CHAR_Y 0x59 -#define KEY_CHAR_Z 0x5a - -// Control codes -#define KEY_CTRL_NOP 30202 -#define KEY_CTRL_EXE 30201 -#define KEY_CTRL_DEL 30025 -#define KEY_CTRL_AC 30070 -#define KEY_CTRL_FD 30046 -#define KEY_CTRL_UNDO 30045 -#define KEY_CTRL_XTT 30001 -#define KEY_CTRL_EXIT 5 -#define KEY_CTRL_OK 4 -#define KEY_CTRL_SHIFT 30006 -#define KEY_CTRL_ALPHA 30007 -#define KEY_CTRL_OPTN 30008 -#define KEY_CTRL_VARS 30030 -#define KEY_CTRL_UP 1 -#define KEY_CTRL_DOWN 2 -#define KEY_CTRL_LEFT 0 -#define KEY_CTRL_RIGHT 3 -#define KEY_CTRL_F1 30009 -#define KEY_CTRL_F2 30010 -#define KEY_CTRL_F3 30011 -#define KEY_CTRL_F4 30012 -#define KEY_CTRL_F5 30013 -#define KEY_CTRL_F6 30014 -#define KEY_CTRL_F7 30015 -#define KEY_CTRL_F8 30016 -#define KEY_CTRL_F9 30017 -#define KEY_CTRL_F10 30018 -#define KEY_CTRL_F11 30019 -#define KEY_CTRL_F12 30020 -#define KEY_CTRL_F13 30021 -#define KEY_CTRL_F14 30022 -#define KEY_CTRL_CATALOG 30100 -#define KEY_CTRL_CAPTURE 30055 -#define KEY_CTRL_CLIP 30050 -#define KEY_CTRL_CUT 30250 -#define KEY_CTRL_PASTE 30036 -#define KEY_CTRL_INS 30033 -#define KEY_CTRL_MIXEDFRAC 30054 -#define KEY_CTRL_FRACCNVRT 30026 -#define KEY_CTRL_QUIT 30029 -#define KEY_CTRL_PRGM 30028 -#define KEY_CTRL_SETUP 30037 -#define KEY_CTRL_PAGEUP 30052 -#define KEY_CTRL_PAGEDOWN 30053 -#define KEY_CTRL_MENU 30003 -#define KEY_SHIFT_OPTN 30059 -#define KEY_CTRL_RESERVE1 30060 -#define KEY_CTRL_RESERVE2 30061 -#define KEY_SHIFT_LEFT 30062 -#define KEY_SHIFT_RIGHT 30063 - -#define KEY_PRGM_ACON 10 -#define KEY_PRGM_DOWN 37 -#define KEY_PRGM_EXIT 47 -#define KEY_PRGM_F1 79 -#define KEY_PRGM_F2 69 -#define KEY_PRGM_F3 59 -#define KEY_PRGM_F4 49 -#define KEY_PRGM_F5 39 -#define KEY_PRGM_F6 29 -#define KEY_PRGM_LEFT 38 -#define KEY_PRGM_NONE 0 -#define KEY_PRGM_RETURN 31 -#define KEY_PRGM_RIGHT 27 -#define KEY_PRGM_UP 28 -#define KEY_PRGM_1 72 -#define KEY_PRGM_2 62 -#define KEY_PRGM_3 52 -#define KEY_PRGM_4 73 -#define KEY_PRGM_5 63 -#define KEY_PRGM_6 53 -#define KEY_PRGM_7 74 -#define KEY_PRGM_8 64 -#define KEY_PRGM_9 54 -#define KEY_PRGM_A 76 -#define KEY_PRGM_F 26 -#define KEY_PRGM_ALPHA 77 -#define KEY_PRGM_SHIFT 78 -#define KEY_PRGM_MENU 48 - -EXTERNC uint64_t extapp_millis(); -EXTERNC void extapp_msleep(uint32_t ms); -EXTERNC uint64_t extapp_scanKeyboard(); -EXTERNC void extapp_pushRect(int16_t x, int16_t y, uint16_t w, uint16_t h, const uint16_t * pixels); -EXTERNC void extapp_pushRectUniform(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t color); -EXTERNC void extapp_pullRect(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t * pixels); -EXTERNC int16_t extapp_drawTextLarge(const char *text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake); -EXTERNC int16_t extapp_drawTextSmall(const char *text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake); -EXTERNC bool extapp_waitForVBlank(); -EXTERNC void extapp_clipboardStore(const char *text); -EXTERNC const char * extapp_clipboardText(); -EXTERNC int extapp_fileListWithExtension(const char ** filenames, int maxrecords, const char * extension, int storage); -EXTERNC bool extapp_fileExists(const char * filename, int storage); -EXTERNC bool extapp_fileErase(const char * filename, int storage); -EXTERNC const char * extapp_fileRead(const char * filename, size_t *len, int storage); -EXTERNC bool extapp_fileWrite(const char * filename, const char * content, size_t len, int storage); -EXTERNC void extapp_lockAlpha(); -EXTERNC void extapp_resetKeyboard(); -EXTERNC int extapp_getKey(int allowSuspend, bool *alphaWasActive); -EXTERNC bool extapp_isKeydown(int key); -EXTERNC int extapp_restoreBackup(int mode); // Keep for compatibility with KhiCAS on Khi -EXTERNC bool extapp_eraseSector(void * ptr); -EXTERNC bool extapp_writeMemory(unsigned char * dest,const unsigned char * data,size_t length); - -#endif +// This is a dummy file to keep compatibility with sample app without editing +#include diff --git a/ion/Makefile b/ion/Makefile index 96797fba26f..3647e054310 100644 --- a/ion/Makefile +++ b/ion/Makefile @@ -31,6 +31,7 @@ ion_src += $(addprefix ion/src/shared/, \ events.cpp \ events_keyboard.cpp \ events_modifier.cpp \ + extapp_api.cpp \ rtc.cpp \ stack_position.cpp \ storage.cpp \ diff --git a/ion/include/ion/extapp_api.h b/ion/include/ion/extapp_api.h new file mode 100644 index 00000000000..2f6f25f1c61 --- /dev/null +++ b/ion/include/ion/extapp_api.h @@ -0,0 +1,415 @@ +#ifndef EXTERNAL_API_H +#define EXTERNAL_API_H + +#include +#include +#include + +#define API_VERSION 2 + +#ifdef __cplusplus +#define EXTERNC extern "C" +#else +#define EXTERNC extern +#endif + +// Screen size +// The screen width +#define LCD_WIDTH 320 +// The screen height +#define LCD_HEIGHT 240 + +// Files systems +// The RAM file system, which can be written, and it is used by the system applications, +// this storage is erased on reset +#define EXTAPP_RAM_FILE_SYSTEM 0 +// The flash file system, which is written by the external application website, +// used for big files storing, and roms, this storage is kept after a reset +#define EXTAPP_FLASH_FILE_SYSTEM 1 +#define EXTAPP_BOTH_FILE_SYSTEM 2 + +// The code of the keys, returned by `extapp_scanKeyboard()` +#define SCANCODE_Left ((uint64_t)1 << 0) +#define SCANCODE_Up ((uint64_t)1 << 1) +#define SCANCODE_Down ((uint64_t)1 << 2) +#define SCANCODE_Right ((uint64_t)1 << 3) +#define SCANCODE_OK ((uint64_t)1 << 4) +#define SCANCODE_Back ((uint64_t)1 << 5) +#define SCANCODE_Home ((uint64_t)1 << 6) +#define SCANCODE_OnOff (((uint64_t)1 << 7) || ((uint64_t)1 << 8)) +#define SCANCODE_Shift ((uint64_t)1 << 12) +#define SCANCODE_Alpha ((uint64_t)1 << 13) +#define SCANCODE_XNT ((uint64_t)1 << 14) +#define SCANCODE_Var ((uint64_t)1 << 15) +#define SCANCODE_Toolbox ((uint64_t)1 << 16) +#define SCANCODE_Backspace ((uint64_t)1 << 17) +#define SCANCODE_Exp ((uint64_t)1 << 18) +#define SCANCODE_Ln ((uint64_t)1 << 19) +#define SCANCODE_Log ((uint64_t)1 << 20) +#define SCANCODE_Imaginary ((uint64_t)1 << 21) +#define SCANCODE_Comma ((uint64_t)1 << 22) +#define SCANCODE_Power ((uint64_t)1 << 23) +#define SCANCODE_Sine ((uint64_t)1 << 24) +#define SCANCODE_Cosine ((uint64_t)1 << 25) +#define SCANCODE_Tangent ((uint64_t)1 << 26) +#define SCANCODE_Pi ((uint64_t)1 << 27) +#define SCANCODE_Sqrt ((uint64_t)1 << 28) +#define SCANCODE_Square ((uint64_t)1 << 29) +#define SCANCODE_Seven ((uint64_t)1 << 30) +#define SCANCODE_Eight ((uint64_t)1 << 31) +#define SCANCODE_Nine ((uint64_t)1 << 32) +#define SCANCODE_LeftParenthesis ((uint64_t)1 << 33) +#define SCANCODE_RightParenthesis ((uint64_t)1 << 34) +#define SCANCODE_Four ((uint64_t)1 << 36) +#define SCANCODE_Five ((uint64_t)1 << 37) +#define SCANCODE_Six ((uint64_t)1 << 38) +#define SCANCODE_Multiplication ((uint64_t)1 << 39) +#define SCANCODE_Division ((uint64_t)1 << 40) +#define SCANCODE_One ((uint64_t)1 << 42) +#define SCANCODE_Two ((uint64_t)1 << 43) +#define SCANCODE_Three ((uint64_t)1 << 44) +#define SCANCODE_Plus ((uint64_t)1 << 45) +#define SCANCODE_Minus ((uint64_t)1 << 46) +#define SCANCODE_Zero ((uint64_t)1 << 48) +#define SCANCODE_Dot ((uint64_t)1 << 49) +#define SCANCODE_EE ((uint64_t)1 << 50) +#define SCANCODE_Ans ((uint64_t)1 << 51) +#define SCANCODE_EXE ((uint64_t)1 << 52) +#define SCANCODE_None ((uint64_t)1 << 54) + +// Keys, returned by `extapp_getKey()` +// Character codes +#define KEY_CHAR_0 0x30 +#define KEY_CHAR_1 0x31 +#define KEY_CHAR_2 0x32 +#define KEY_CHAR_3 0x33 +#define KEY_CHAR_4 0x34 +#define KEY_CHAR_5 0x35 +#define KEY_CHAR_6 0x36 +#define KEY_CHAR_7 0x37 +#define KEY_CHAR_8 0x38 +#define KEY_CHAR_9 0x39 +#define KEY_CHAR_DP 0x2e +#define KEY_CHAR_EXP 0x0f +#define KEY_CHAR_PMINUS 30200 +#define KEY_CHAR_PLUS 43 +#define KEY_CHAR_MINUS 45 +#define KEY_CHAR_MULT 42 +#define KEY_CHAR_DIV 47 +#define KEY_CHAR_FRAC 0xbb +#define KEY_CHAR_LPAR 0x28 +#define KEY_CHAR_RPAR 0x29 +#define KEY_CHAR_COMMA 0x2c +#define KEY_CHAR_STORE 0x0e +#define KEY_CHAR_LOG 0x95 +#define KEY_CHAR_LN 0x85 +#define KEY_CHAR_SIN 0x81 +#define KEY_CHAR_COS 0x82 +#define KEY_CHAR_TAN 0x83 +#define KEY_CHAR_SQUARE 0x8b +#define KEY_CHAR_POW 0xa8 +#define KEY_CHAR_IMGNRY 0x7f50 +#define KEY_CHAR_LIST 0x7f51 +#define KEY_CHAR_MAT 0x7f40 +#define KEY_CHAR_EQUAL 0x3d +#define KEY_CHAR_PI 0xd0 +#define KEY_CHAR_ANS 0xc0 +#define KEY_SHIFT_ANS 0xc1 +#define KEY_CHAR_LBRCKT 0x5b +#define KEY_CHAR_RBRCKT 0x5d +#define KEY_CHAR_LBRACE 0x7b +#define KEY_CHAR_RBRACE 0x7d +#define KEY_CHAR_CR 0x0d +#define KEY_CHAR_CUBEROOT 0x96 +#define KEY_CHAR_RECIP 0x9b +#define KEY_CHAR_ANGLE 0x7f54 +#define KEY_CHAR_EXPN10 0xb5 +#define KEY_CHAR_EXPN 0xa5 +#define KEY_CHAR_ASIN 0x91 +#define KEY_CHAR_ACOS 0x92 +#define KEY_CHAR_ATAN 0x93 +#define KEY_CHAR_ROOT 0x86 +#define KEY_CHAR_POWROOT 0xb8 +#define KEY_CHAR_SPACE 0x20 +#define KEY_CHAR_DQUATE 0x22 +#define KEY_CHAR_VALR 0xcd +#define KEY_CHAR_THETA 0xce +#define KEY_CHAR_FACTOR 0xda +#define KEY_CHAR_NORMAL 0xdb +#define KEY_CHAR_A 0x41 +#define KEY_CHAR_B 0x42 +#define KEY_CHAR_C 0x43 +#define KEY_CHAR_D 0x44 +#define KEY_CHAR_E 0x45 +#define KEY_CHAR_F 0x46 +#define KEY_CHAR_G 0x47 +#define KEY_CHAR_H 0x48 +#define KEY_CHAR_I 0x49 +#define KEY_CHAR_J 0x4a +#define KEY_CHAR_K 0x4b +#define KEY_CHAR_L 0x4c +#define KEY_CHAR_M 0x4d +#define KEY_CHAR_N 0x4e +#define KEY_CHAR_O 0x4f +#define KEY_CHAR_P 0x50 +#define KEY_CHAR_Q 0x51 +#define KEY_CHAR_R 0x52 +#define KEY_CHAR_S 0x53 +#define KEY_CHAR_T 0x54 +#define KEY_CHAR_U 0x55 +#define KEY_CHAR_V 0x56 +#define KEY_CHAR_W 0x57 +#define KEY_CHAR_X 0x58 +#define KEY_CHAR_Y 0x59 +#define KEY_CHAR_Z 0x5a + +// Control codes +#define KEY_CTRL_NOP 30202 +#define KEY_CTRL_EXE 30201 +#define KEY_CTRL_DEL 30025 +#define KEY_CTRL_AC 30070 +#define KEY_CTRL_FD 30046 +#define KEY_CTRL_UNDO 30045 +#define KEY_CTRL_XTT 30001 +#define KEY_CTRL_EXIT 5 +#define KEY_CTRL_OK 4 +#define KEY_CTRL_SHIFT 30006 +#define KEY_CTRL_ALPHA 30007 +#define KEY_CTRL_OPTN 30008 +#define KEY_CTRL_VARS 30030 +#define KEY_CTRL_UP 1 +#define KEY_CTRL_DOWN 2 +#define KEY_CTRL_LEFT 0 +#define KEY_CTRL_RIGHT 3 +#define KEY_CTRL_F1 30009 +#define KEY_CTRL_F2 30010 +#define KEY_CTRL_F3 30011 +#define KEY_CTRL_F4 30012 +#define KEY_CTRL_F5 30013 +#define KEY_CTRL_F6 30014 +#define KEY_CTRL_F7 30015 +#define KEY_CTRL_F8 30016 +#define KEY_CTRL_F9 30017 +#define KEY_CTRL_F10 30018 +#define KEY_CTRL_F11 30019 +#define KEY_CTRL_F12 30020 +#define KEY_CTRL_F13 30021 +#define KEY_CTRL_F14 30022 +#define KEY_CTRL_CATALOG 30100 +#define KEY_CTRL_CAPTURE 30055 +#define KEY_CTRL_CLIP 30050 +#define KEY_CTRL_CUT 30250 +#define KEY_CTRL_PASTE 30036 +#define KEY_CTRL_INS 30033 +#define KEY_CTRL_MIXEDFRAC 30054 +#define KEY_CTRL_FRACCNVRT 30026 +#define KEY_CTRL_QUIT 30029 +#define KEY_CTRL_PRGM 30028 +#define KEY_CTRL_SETUP 30037 +#define KEY_CTRL_PAGEUP 30052 +#define KEY_CTRL_PAGEDOWN 30053 +#define KEY_CTRL_MENU 30003 +#define KEY_SHIFT_OPTN 30059 +#define KEY_CTRL_RESERVE1 30060 +#define KEY_CTRL_RESERVE2 30061 +#define KEY_SHIFT_LEFT 30062 +#define KEY_SHIFT_RIGHT 30063 + +#define KEY_PRGM_ACON 10 +#define KEY_PRGM_DOWN 37 +#define KEY_PRGM_EXIT 47 +#define KEY_PRGM_F1 79 +#define KEY_PRGM_F2 69 +#define KEY_PRGM_F3 59 +#define KEY_PRGM_F4 49 +#define KEY_PRGM_F5 39 +#define KEY_PRGM_F6 29 +#define KEY_PRGM_LEFT 38 +#define KEY_PRGM_NONE 0 +#define KEY_PRGM_RETURN 31 +#define KEY_PRGM_RIGHT 27 +#define KEY_PRGM_UP 28 +#define KEY_PRGM_1 72 +#define KEY_PRGM_2 62 +#define KEY_PRGM_3 52 +#define KEY_PRGM_4 73 +#define KEY_PRGM_5 63 +#define KEY_PRGM_6 53 +#define KEY_PRGM_7 74 +#define KEY_PRGM_8 64 +#define KEY_PRGM_9 54 +#define KEY_PRGM_A 76 +#define KEY_PRGM_F 26 +#define KEY_PRGM_ALPHA 77 +#define KEY_PRGM_SHIFT 78 +#define KEY_PRGM_MENU 48 + +// External API functions +/** + * Get the current date, in milliseconds, from the boot, excluding suspended time + * @return uint64_t, the current date from the boot in milliseconds + */ +EXTERNC uint64_t extapp_millis(); +/** + * Sleep ms milliseconds + * @param ms uint32_t, the number of milliseconds to sleep + */ +EXTERNC void extapp_msleep(uint32_t ms); +// Scan the keyboard, and return a key that can be identified by SCANCODE_* constants (like SCANCODE_Left) +EXTERNC uint64_t extapp_scanKeyboard(); +/** + * Push a buffer of pixels to the screen + * @param x uint16_t, the x position of the buffer to display on the screen + * @param y uint16_t, the y position of the buffer to display on the screen + * @param w uint16_t, the width of the buffer to display on the screen + * @param h uint16_t, the height of the buffer to display on the screen + * @param pixels const uint16_t *, the buffer to display on the screen + */ +EXTERNC void extapp_pushRect(int16_t x, int16_t y, uint16_t w, uint16_t h, const uint16_t * pixels); +/** + * Push a colored rectangle on the screen + * @param x uint16_t, the x position of the rectangle + * @param y uint16_t, the y position of the rectangle + * @param w uint16_t, the width of the rectangle + * @param h uint16_t, the height of the rectangle + * @param color uint16_t, the color of the rectangle + */ +EXTERNC void extapp_pushRectUniform(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t color); +/** + * Push a rectangle from the screen + * @param x uint16_t, the x position of the rectangle + * @param y uint16_t, the y position of the rectangle + * @param w uint16_t, the width of the rectangle + * @param h uint16_t, the height of the rectangle + * @param pixels uint16_t *, the pointer to the buffer to store the pixel rect + */ +EXTERNC void extapp_pullRect(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t * pixels); +/** + * Display large text + * @param text const char *t, the text to display + * @param x int16_t, the x position of the text to display + * @param y int16_t, the y position of the text to display + * @param fg uint16_t, the color of the foreground + * @param bg uint16_t, the color of the background + * @param fake bool, whether to not display the text, just return the size of the text + * @return uint16_t, the width of the text + */ +EXTERNC int16_t extapp_drawTextLarge(const char *text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake); +/** + * Display small text + * @param text const char *t, the text to display + * @param x int16_t, the x position of the text to display + * @param y int16_t, the y position of the text to display + * @param fg uint16_t, the color of the foreground + * @param bg uint16_t, the color of the background + * @param fake bool, whether to not display the text, just return the size of the text + * @return uint16_t, the width of the text + */ +EXTERNC int16_t extapp_drawTextSmall(const char *text, int16_t x, int16_t y, uint16_t fg, uint16_t bg, bool fake); +/** + * Wait for screen refresh + */ +EXTERNC bool extapp_waitForVBlank(); +/** + * Set text into clipboard + * @param text const char *t, the text to copy + */ +EXTERNC void extapp_clipboardStore(const char *text); +/** + * Get clipboard contents + * @return const char *, the contents of the clipboard + */ +EXTERNC const char * extapp_clipboardText(); +/** + * Get a list of files in "storage", filtered by extension + * @param filename const char **, an array that must to be a equal to + * the maxrecords variable, to avoid buffer overflow + * @param maxrecords int, the maximum number of records that can be retrieved, + * it should be equal to the length of the filenames array, + * to avoid buffer overflow + * @param extension const char *, the extension of the filename to retrieve, + * it work only with RAM file system for now + * @param storage int, the storage to use (like EXTAPP_FLASH_FILE_SYSTEM) + * @return int, the number of retrieved records + */ +EXTERNC int extapp_fileListWithExtension(const char ** filenames, int maxrecords, const char * extension, int storage); +/** + * Return if "filename" exist in "storage" + * @param filename const char *, the file to check existing + * @param storage int, the storage to use (like EXTAPP_FLASH_FILE_SYSTEM) + * @return bool, true if the operation is successful + */ +EXTERNC bool extapp_fileExists(const char * filename, int storage); +/** + * Erase "filename" in "storage" + * @param filename const char *, the file to remove + * @param storage int, the storage to use (like EXTAPP_RAM_FILE_SYSTEM) + * @return bool, true if the operation is successful + */ +EXTERNC bool extapp_fileErase(const char * filename, int storage); +/** + * Read "filename" from "storage" + * @param filename const char *, the file to read + * @param len, size_t, a pointer to a size_t variable, to store the file length + * @param storage int, the storage to use (like EXTAPP_FLASH_FILE_SYSTEM) + * @return const char *, the file content + */ +EXTERNC const char * extapp_fileRead(const char * filename, size_t *len, int storage); +/** + * Write "content" into "filename" in "storage" + * @param filename const char *, the file to write + * @param content, const char *, the content of the file to write + * @param len, size_t, the length of the file to write + * @param storage int, the storage to use (like EXTAPP_FLASH_FILE_SYSTEM) + * @return bool, true if the operation is successful + */ +EXTERNC bool extapp_fileWrite(const char * filename, const char * content, size_t len, int storage); +/** + * Enable alpha lock + */ +EXTERNC void extapp_lockAlpha(); +/** + * Reset keyboard status, like alpha lock + */ +EXTERNC void extapp_resetKeyboard(); +/** + * Get pressed keys + * @param allowSuspend bool, whether to allow suspending the calculator + * @param alphaWasActive bool, a pointer to a bool to store if the alpha (lock) was active + * @return int, the code of the pressed key, like KEY_CHAR_0 or KEY_CTRL_EXE + */ +EXTERNC int extapp_getKey(int allowSuspend, bool *alphaWasActive); +/** + * If given key is pressed + * @param key int, the key to check + * @return bool, true if the key is pressed + */ +EXTERNC bool extapp_isKeydown(int key); +/** + * Restore the exam mode backup, created by KhiCAS and Khi + * @param mode int, the mode to restore (TODO: Improve this) + * @return int, higher than 0 if the operation is successful + */ +EXTERNC int extapp_restorebackup(int mode); // currently works only with mode==-1 to restore scriptstore after exam mode +/** + * Erase flash sector, works only when "Write allowed" is enabled in the calculator + * @param ptr void *, the sector to erase + * @return bool, true if the operation is successful + */ +EXTERNC bool extapp_erasesector(void * ptr); +/** + * Write flash sector, works only when "Write allowed" is enabled in the calculator + * @param dest unsigned char *, the destination address + * @param data unsigned char *, the data to write + * @param length size_t, the length of the data to write + */ +EXTERNC bool extapp_writesector(unsigned char * dest,const unsigned char * data,size_t length); +/** + * Get if the exam mode is active + * @return bool, true if the exam mode is active + */ +EXTERNC bool extapp_inexammode(); +EXTERNC uint32_t _heap_size; +EXTERNC void *_heap_base; +EXTERNC void *_heap_ptr; +#endif \ No newline at end of file diff --git a/ion/src/device/bootloader/drivers/archive.cpp b/ion/src/device/bootloader/drivers/archive.cpp index e211186497a..419f83f8ff4 100644 --- a/ion/src/device/bootloader/drivers/archive.cpp +++ b/ion/src/device/bootloader/drivers/archive.cpp @@ -1,5 +1,5 @@ #include "apps/global_preferences.h" -#include "extapp_api.h" +#include #include #include diff --git a/ion/src/device/n0110/drivers/archive.cpp b/ion/src/device/n0110/drivers/archive.cpp index e211186497a..419f83f8ff4 100644 --- a/ion/src/device/n0110/drivers/archive.cpp +++ b/ion/src/device/n0110/drivers/archive.cpp @@ -1,5 +1,5 @@ #include "apps/global_preferences.h" -#include "extapp_api.h" +#include #include #include diff --git a/apps/external/extapp_api.cpp b/ion/src/shared/extapp_api.cpp similarity index 99% rename from apps/external/extapp_api.cpp rename to ion/src/shared/extapp_api.cpp index 450dffb9c47..063a3bc51f6 100644 --- a/apps/external/extapp_api.cpp +++ b/ion/src/shared/extapp_api.cpp @@ -5,9 +5,9 @@ #include #include #include -#include "extapp_api.h" -#include "../apps_container.h" -#include "../global_preferences.h" +#include +#include "apps/apps_container.h" +#include "apps/global_preferences.h" #ifdef DEVICE #include From 5efd36a50348426a5eb152424893ffb650a5852b Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Mon, 24 Oct 2022 12:13:39 +0200 Subject: [PATCH 3/4] [ion/extapp_api] Remove dependency on Python --- ion/src/shared/extapp_api.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ion/src/shared/extapp_api.cpp b/ion/src/shared/extapp_api.cpp index 063a3bc51f6..f769b3ac11d 100644 --- a/ion/src/shared/extapp_api.cpp +++ b/ion/src/shared/extapp_api.cpp @@ -15,12 +15,6 @@ #include #endif -#include - -extern "C" { -#include -} - uint64_t extapp_millis() { return Ion::Timing::millis(); } From 74b1221638d935d3142fd6264c422d1935ccc743 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Mon, 24 Oct 2022 13:53:37 +0200 Subject: [PATCH 4/4] [apps/external] Remove old UI (now in home) and cleanup translations --- Makefile | 8 +- apps/external/Makefile | 36 +----- apps/external/app.cpp | 48 ------- apps/external/app.h | 38 ------ apps/external/app/sources.mak | 4 +- apps/external/base.de.i18n | 7 - apps/external/base.en.i18n | 7 - apps/external/base.es.i18n | 7 - apps/external/base.fr.i18n | 7 - apps/external/base.hu.i18n | 11 +- apps/external/base.it.i18n | 7 - apps/external/base.nl.i18n | 7 - apps/external/base.pt.i18n | 7 - apps/external/base.universal.i18n | 1 - apps/external/external_icon.png | Bin 10728 -> 0 bytes apps/external/main_controller.cpp | 151 ---------------------- apps/external/main_controller.h | 34 ----- apps/external/pointer_text_table_cell.cpp | 38 ------ apps/external/pointer_text_table_cell.h | 20 --- 19 files changed, 8 insertions(+), 430 deletions(-) delete mode 100644 apps/external/app.cpp delete mode 100644 apps/external/app.h delete mode 100644 apps/external/external_icon.png delete mode 100644 apps/external/main_controller.cpp delete mode 100644 apps/external/main_controller.h delete mode 100644 apps/external/pointer_text_table_cell.cpp delete mode 100644 apps/external/pointer_text_table_cell.h diff --git a/Makefile b/Makefile index c42ed081ab2..429011fe0b8 100644 --- a/Makefile +++ b/Makefile @@ -31,13 +31,7 @@ ifeq ($(filter reader,$(apps_list)),) HAS_READER := 1 endif -# Remove the external apps for the n0100 -ifeq (${MODEL}, n0100) - apps_list = $(foreach i, ${EPSILON_APPS}, $(if $(filter external, $(i)),,$(i))) -else - apps_list = ${EPSILON_APPS} -endif - +apps_list = ${EPSILON_APPS} ifdef FORCE_EXTERNAL apps_list = ${EPSILON_APPS} endif diff --git a/apps/external/Makefile b/apps/external/Makefile index bb6ced871e8..b26f5b4e587 100644 --- a/apps/external/Makefile +++ b/apps/external/Makefile @@ -1,46 +1,16 @@ -ifdef HOME_DISPLAY_EXTERNALS - $(eval $(call depends_on_image,apps/home/controller.cpp,apps/external/external_icon.png)) -else - -apps += External::App -app_headers += apps/external/app.h - -app_external_src = $(addprefix apps/external/,\ - app.cpp \ - main_controller.cpp \ - pointer_text_table_cell.cpp \ -) - -$(eval $(call depends_on_image,apps/external/app.cpp,apps/external/external_icon.png)) - -endif - SFLAGS += -Iapps/external/ EXTAPP_PATH ?= apps/external/app/ + ifeq ($(PLATFORM),device) +# FIXME: Should be handled by Ion, since external apps are managed by Ion SFLAGS += -DDEVICE else include $(EXTAPP_PATH)/sources.mak endif -ifdef EXTERNAL_BUILTIN -SFLAGS += -DEXTERNAL_BUILTIN -endif - apps_src += $(app_external_src) -i18n_files += $(addprefix apps/external/,\ - base.de.i18n\ - base.en.i18n\ - base.es.i18n\ - base.fr.i18n\ - base.pt.i18n\ - base.it.i18n\ - base.nl.i18n\ - base.hu.i18n\ - base.universal.i18n\ -) - +i18n_files += $(call i18n_without_universal_for,external/base) diff --git a/apps/external/app.cpp b/apps/external/app.cpp deleted file mode 100644 index fba8ffccc97..00000000000 --- a/apps/external/app.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "app.h" -#include "external_icon.h" -#include - -namespace External { - -I18n::Message App::Descriptor::name() { - return I18n::Message::ExternalApp; -} - -I18n::Message App::Descriptor::upperName() { - return I18n::Message::ExternalAppCapital; -} - -App::Descriptor::ExaminationLevel App::Descriptor::examinationLevel() { - return App::Descriptor::ExaminationLevel::Basic; -} - -const Image * App::Descriptor::icon() { - return ImageStore::ExternalIcon; -} - -App * App::Snapshot::unpack(Container * container) { - return new (container->currentAppBuffer()) App(this); -} - -App::Descriptor * App::Snapshot::descriptor() { - static Descriptor descriptor; - return &descriptor; -} - -void App::didBecomeActive(Window * window) { - ::App::didBecomeActive(window); - m_window = window; -} - -void App::redraw() { - m_window->redraw(true); -} - -App::App(Snapshot * snapshot) : - ::App(snapshot, &m_stackViewController), - m_mainController(&m_stackViewController, this), - m_stackViewController(&m_modalViewController, &m_mainController) -{ -} - -} diff --git a/apps/external/app.h b/apps/external/app.h deleted file mode 100644 index d1d38487b9f..00000000000 --- a/apps/external/app.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef EXTERNAL_APP_H -#define EXTERNAL_APP_H - -#include -#include "main_controller.h" - -namespace External { - -class App : public ::App { -public: - class Descriptor : public ::App::Descriptor { - public: - I18n::Message name() override; - I18n::Message upperName() override; - App::Descriptor::ExaminationLevel examinationLevel() override; - const Image * icon() override; - }; - class Snapshot : public ::App::Snapshot { - public: - App * unpack(Container * container) override; - Descriptor * descriptor() override; - }; - void redraw(); - virtual void didBecomeActive(Window * window); - int heapSize() { return k_externalHeapSize; } - char * heap() { return m_externalHeap; } -private: - App(Snapshot * snapshot); - MainController m_mainController; - StackViewController m_stackViewController; - Window * m_window; - static constexpr int k_externalHeapSize = 99000; - char m_externalHeap[k_externalHeapSize]; -}; - -} - -#endif diff --git a/apps/external/app/sources.mak b/apps/external/app/sources.mak index 3f285e23a47..88cb7cbd024 100644 --- a/apps/external/app/sources.mak +++ b/apps/external/app/sources.mak @@ -1,3 +1,3 @@ -app_external_src += $(addprefix apps/external/app/,\ +app_external_src += $(addprefix $(EXTAPP_PATH),\ sample.c \ -) \ No newline at end of file +) diff --git a/apps/external/base.de.i18n b/apps/external/base.de.i18n index 28dd31e4e4d..5b12c77ab69 100644 --- a/apps/external/base.de.i18n +++ b/apps/external/base.de.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API stimmt nicht überein" ExternalAppExecError = "Datei kann nicht ausgeführt werden" -ExternalNotCompatible = "Externe App ist nicht kompatibel" -WithSimulator = "mit dem Simulator" -WithN0100 = "mit N0100" -GetMoreAppsAt = "Weitere Apps abrufen bei" -NoAppsInstalled = "Keine Apps installiert" \ No newline at end of file diff --git a/apps/external/base.en.i18n b/apps/external/base.en.i18n index 49b8a217333..6f3739050aa 100644 --- a/apps/external/base.en.i18n +++ b/apps/external/base.en.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" -ExternalNotCompatible = "External is not compatible" -WithSimulator = "with the simulator" -WithN0100 = "with n0100" -GetMoreAppsAt = "Get more apps at" -NoAppsInstalled = "No apps installed" diff --git a/apps/external/base.es.i18n b/apps/external/base.es.i18n index 7513cd076f7..a190200497c 100644 --- a/apps/external/base.es.i18n +++ b/apps/external/base.es.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "Discordancia de API" ExternalAppExecError = "No se puede ejecutar el archivo" -ExternalNotCompatible = "Externo no es compatible" -WithSimulator = "con el simulador" -WithN0100 = "con n0100" -GetMoreAppsAt = "Obtenga más aplicaciones en" -NoAppsInstalled = "No hay aplicaciones instaladas" diff --git a/apps/external/base.fr.i18n b/apps/external/base.fr.i18n index 626444a1b8c..98f4e698040 100644 --- a/apps/external/base.fr.i18n +++ b/apps/external/base.fr.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "Décalage API" ExternalAppExecError = "Le fichier ne peut pas être exécuté" -ExternalNotCompatible = "External n'est pas compatible" -WithSimulator = "avec le simulateur" -WithN0100 = "avec n0100" -GetMoreAppsAt = "Télécharge d'autres apps sur" -NoAppsInstalled = "Aucune applications installées" diff --git a/apps/external/base.hu.i18n b/apps/external/base.hu.i18n index e984edc511d..73a6c0f11a9 100644 --- a/apps/external/base.hu.i18n +++ b/apps/external/base.hu.i18n @@ -1,9 +1,2 @@ -ExternalApp = "Külsö" -ExternalAppCapital = "KÜLSÖ" -ExternalAppApiMismatch = "API eltérés" -ExternalAppExecError = "A fájl nem futtatható" -ExternalNotCompatible = "Externál nem kompatibilis" -WithSimulator = "Szimulátorral" -WithN0100 = "n0100-al" -GetMoreAppsAt = "Mégtöbb alkalmazás itt :" -NoAppsInstalled = "Nincs letöltött externál" +ExternalAppApiMismatch = "API eltérés" +ExternalAppExecError = "A fájl nem futtatható" diff --git a/apps/external/base.it.i18n b/apps/external/base.it.i18n index 49b8a217333..6f3739050aa 100644 --- a/apps/external/base.it.i18n +++ b/apps/external/base.it.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" -ExternalNotCompatible = "External is not compatible" -WithSimulator = "with the simulator" -WithN0100 = "with n0100" -GetMoreAppsAt = "Get more apps at" -NoAppsInstalled = "No apps installed" diff --git a/apps/external/base.nl.i18n b/apps/external/base.nl.i18n index 49b8a217333..6f3739050aa 100644 --- a/apps/external/base.nl.i18n +++ b/apps/external/base.nl.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" -ExternalNotCompatible = "External is not compatible" -WithSimulator = "with the simulator" -WithN0100 = "with n0100" -GetMoreAppsAt = "Get more apps at" -NoAppsInstalled = "No apps installed" diff --git a/apps/external/base.pt.i18n b/apps/external/base.pt.i18n index ae08d747879..6f3739050aa 100644 --- a/apps/external/base.pt.i18n +++ b/apps/external/base.pt.i18n @@ -1,9 +1,2 @@ -ExternalApp = "External" -ExternalAppCapital = "EXTERNAL" ExternalAppApiMismatch = "API mismatch" ExternalAppExecError = "Cannot execute file" -ExternalNotCompatible = "Externo no es compatiblee" -WithSimulator = "con el simulador" -WithN0100 = "con n0100" -GetMoreAppsAt = "Obtenga más aplicaciones en" -NoAppsInstalled = "No hay aplicaciones instaladas" diff --git a/apps/external/base.universal.i18n b/apps/external/base.universal.i18n index bd64604ea1a..e69de29bb2d 100644 --- a/apps/external/base.universal.i18n +++ b/apps/external/base.universal.i18n @@ -1 +0,0 @@ -URL = "zardam.github.io/nw-external-apps/" \ No newline at end of file diff --git a/apps/external/external_icon.png b/apps/external/external_icon.png deleted file mode 100644 index 297dc31c6cc743585cee6e411c74e158a91a2949..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10728 zcmVP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3;sa$UI*h5us}UIKDh4q}ye;N|-}xQ`T*G&LS; zYDDVs2B6V>LIX7WKmR`FU;HVlWD`@Vx#ev66I*P)^G&tSpXaNy@&0}Pg!1~C`~0~H zZ#Q{93cB+7XWp;tJD;atH`*&aBXXoql@GBhViR|lw{3TAW&t3XCem6=VN96qboBhWT5&vmF{`nBU zb5=cPKeOwRJZdq&CiOOz`yCfD;TZ01ng0s^C%!NDzs7&nb~{y76`9`C`BR z(ZU8+Fx@a$CfMzG9x;;pm0RJibFj&9X|zwhxUyakAVj=7F&MHqI-6ZcE<0PiFU}Fi z%KCIh?nCs06>!NUzZj*Dfl4U8dcB)_io4hPN(yz8 zLW(J+oJy*xrJh5MIpv&77EbjNN)&LFQfg_X*HB|kHP=#WZM8Sw0x*_L%dNE9TI-#c z_Skt==laeE!;diHNF$Fj>S&`+(r3n*W}ao%*=ApUg#`qdl~-AHwbi%Vq|%N%?Yzsb zyX}6+wG&P}>Eu&RJ?-@ORdcVh{j_RdSMJZN=3cAj??UOi@@v)jxRkd?IKfHMnz3R& zI##@B1xRSGHM7;l=(TcMGuwPHAtcWzlNM(=tr#m9xAW<^_qF@Aa=%?SLv;V{y7`}0 z&S>fWA1i0HbRSmk`?~$GYO7zk4R?W5g~Swu43r-ibzgfPDvuKgeox?5owJ4jd<4gc zeQAMf;H5A^T)IIt_Ix$`9dk)(_u`093ESu8HmFy98DmvKw)#3_+!#+5FT$ED64cdC zttYlIk2hz}Q_?tda((0a?3%7GZVy6bYgppWTt5%s+gJ0OA0%5`JQi@@Cjq>SBHK{& zW#dVYn)^uJ^jSZAra40uoPHyB%=ak5icnf#XtL{q?Jx`!J%C zd}Cb*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v!pEx8o<-Mn za&mIkOlAWheuUa zxpnInqoboVHa1dHQnDbtL|L__X$%YuFgQ4f)9J+H@vJFHilT_cV!>{=Q(Rn(!{LbP a@&6BvAL9gKturJ50000 -#include -#include -#include "archive.h" -#include "app.h" -#include -#include - -using namespace Poincare; - -namespace External { - -using namespace Archive; - -MainController::MainController(Responder * parentResponder, ::App * app) : - ViewController(parentResponder), - m_selectableTableView(this) -{ - m_app = app; -} - -View * MainController::view() { - return &m_selectableTableView; -} - -void MainController::didBecomeFirstResponder() { - if (selectedRow() < 0) { - selectCellAtLocation(0, 0); - } - Container::activeApp()->setFirstResponder(&m_selectableTableView); -} - -bool MainController::handleEvent(Ion::Events::Event event) { - if ((event == Ion::Events::OK || event == Ion::Events::EXE) && ((selectedRow() < k_numberOfCells - 2) && numberOfFiles() > 0)) { - uint32_t res = executeFile(m_cells[selectedRow()].text(), ((App *)m_app)->heap(), ((App *)m_app)->heapSize()); - ((App*)m_app)->redraw(); - switch(res) { - case 0: - break; - case 1: - Container::activeApp()->displayWarning(I18n::Message::ExternalAppApiMismatch); - break; - case 2: - Container::activeApp()->displayWarning(I18n::Message::StorageMemoryFull1); - break; - default: - Container::activeApp()->displayWarning(I18n::Message::ExternalAppExecError); - break; - } - return true; - } - return false; -} - -int MainController::numberOfRows() const { - return k_numberOfCells; -}; - -KDCoordinate MainController::rowHeight(int j) { - return Metric::ParameterCellHeight; -} - -KDCoordinate MainController::cumulatedHeightFromIndex(int j) { - return j*rowHeight(0); -} - -int MainController::indexFromCumulatedHeight(KDCoordinate offsetY) { - return offsetY/rowHeight(0); -} - -HighlightCell * MainController::reusableCell(int index, int type) { - assert(index < k_numberOfCells); - return &m_cells[index]; -} - -int MainController::reusableCellCount(int type) { - return k_numberOfCells; -} - -int MainController::typeAtLocation(int i, int j) { - return 0; -} - -void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) { - PointerTextTableCell * myTextCell = (PointerTextTableCell *)cell; - myTextCell->setHighlighted(myTextCell->isHighlighted()); - struct File f; - #if defined(DEVICE) || defined(EXTERNAL_BUILTIN) - #if defined(DEVICE_N0100) && !defined(EXTERNAL_BUILTIN) - if(index == 0){ - myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible)); - myTextCell->setTextColor(Palette::Red); - } else { - myTextCell->setText(I18n::translate(I18n::Message::WithN0100)); - myTextCell->setTextColor(Palette::Red); - } - #else - if(index == k_numberOfCells-1){ - myTextCell->setText(I18n::translate(I18n::Message::URL)); - myTextCell->setTextColor(Palette::AccentText); - return; - } - if(index == k_numberOfCells-2){ - myTextCell->setText(I18n::translate(I18n::Message::GetMoreAppsAt)); - myTextCell->setTextColor(Palette::AccentText); - return; - } - if(index == 0 && numberOfFiles() == 0){ - myTextCell->setText(I18n::translate(I18n::Message::NoAppsInstalled)); - myTextCell->setTextColor(Palette::Red); - } - if(numberOfFiles() > 0){ - if(fileAtIndex(index, f)) { - myTextCell->setText(f.name); - myTextCell->setTextColor(f.isExecutable ? Palette::PrimaryText : Palette::Palette::SecondaryText); - } - } - #endif - #else - if(index == 0){ - myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible)); - myTextCell->setTextColor(Palette::Red); - } else { - myTextCell->setText(I18n::translate(I18n::Message::WithSimulator)); - myTextCell->setTextColor(Palette::Red); - } - #endif -} - -void MainController::viewWillAppear() { - int count; - #if defined(DEVICE) || defined(EXTERNAL_BUILTIN) - #if !defined(DEVICE_N0110) && !defined(EXTERNAL_BUILTIN) - count = 2; - #else - if(numberOfFiles() > 0){ - count = numberOfFiles()+2; - } else { - count = 3; - } - #endif - - #else - count = 2; - #endif - k_numberOfCells = count <= k_maxNumberOfCells ? count : k_maxNumberOfCells; - m_selectableTableView.reloadData(); -} - -} diff --git a/apps/external/main_controller.h b/apps/external/main_controller.h deleted file mode 100644 index bdb6d275bd0..00000000000 --- a/apps/external/main_controller.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef EXTERNAL_MAIN_CONTROLLER_H -#define EXTERNAL_MAIN_CONTROLLER_H - -#include -#include "pointer_text_table_cell.h" - -namespace External { - -class MainController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource { -public: - MainController(Responder * parentResponder, App * app); - View * view() override; - bool handleEvent(Ion::Events::Event event) override; - void didBecomeFirstResponder() override; - int numberOfRows() const override; - KDCoordinate rowHeight(int j) override; - KDCoordinate cumulatedHeightFromIndex(int j) override; - int indexFromCumulatedHeight(KDCoordinate offsetY) override; - HighlightCell * reusableCell(int index, int type) override; - int reusableCellCount(int type) override; - int typeAtLocation(int i, int j) override; - void willDisplayCellForIndex(HighlightCell * cell, int index) override; - void viewWillAppear() override; -private: - App * m_app; - SelectableTableView m_selectableTableView; - int k_numberOfCells = 1; - constexpr static int k_maxNumberOfCells = 16; - PointerTextTableCell m_cells[k_maxNumberOfCells]; -}; - -} - -#endif diff --git a/apps/external/pointer_text_table_cell.cpp b/apps/external/pointer_text_table_cell.cpp deleted file mode 100644 index 00967fafb60..00000000000 --- a/apps/external/pointer_text_table_cell.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "pointer_text_table_cell.h" -#include -#include -#include - -PointerTextTableCell::PointerTextTableCell(const char * text, const KDFont * font, Layout layout) : - TableCell(layout), - m_pointerTextView(font, text, 0, 0.5, KDColorBlack, KDColorWhite) -{ -} - -View * PointerTextTableCell::labelView() const { - return (View *)&m_pointerTextView; -} - -const char * PointerTextTableCell::text() const { - return m_pointerTextView.text(); -} - -void PointerTextTableCell::setHighlighted(bool highlight) { - HighlightCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; - m_pointerTextView.setBackgroundColor(backgroundColor); -} - -void PointerTextTableCell::setText(const char * text) { - m_pointerTextView.setText(text); - layoutSubviews(); -} - -void PointerTextTableCell::setTextColor(KDColor color) { - m_pointerTextView.setTextColor(color); -} - -void PointerTextTableCell::setTextFont(const KDFont * font) { - m_pointerTextView.setFont(font); - layoutSubviews(); -} diff --git a/apps/external/pointer_text_table_cell.h b/apps/external/pointer_text_table_cell.h deleted file mode 100644 index 2ed0b9d5294..00000000000 --- a/apps/external/pointer_text_table_cell.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ESCHER_POINTER_TEXT_TABLE_CELL_H -#define ESCHER_POINTER_TEXT_TABLE_CELL_H - -#include -#include - -class PointerTextTableCell : public TableCell { -public: - PointerTextTableCell(const char * text = "", const KDFont * font = KDFont::SmallFont, Layout layout = Layout::HorizontalLeftOverlap); - View * labelView() const override; - const char * text() const override; - virtual void setHighlighted(bool highlight) override; - void setText(const char * text); - virtual void setTextColor(KDColor color); - void setTextFont(const KDFont * font); -private: - PointerTextView m_pointerTextView; -}; - -#endif