port to update libplutonium and libnx

This commit is contained in:
nyyu 2021-09-05 12:59:57 +02:00
parent f29491688a
commit 2a1feebe79
16 changed files with 109 additions and 104 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "include/Plutonium"]
path = include/Plutonium
url = https://github.com/HookedBehemoth/Plutonium
url = https://github.com/XorTroll/Plutonium.git

View File

@ -41,7 +41,7 @@ TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source source/ui source/data source/install source/nx source/nx/ipc source/util
DATA := data
INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util include/Plutonium/Plutonium/Output-switch/include
INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util include/Plutonium/Plutonium/out/include
APP_TITLE := Awoo Installer
APP_AUTHOR := Huntereb & Behemoth
APP_VERSION := 1.3.4
@ -74,7 +74,7 @@ LIBS += -lmbedtls -lmbedcrypto -lminizip -lzstd # Memes
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX) $(CURDIR)/include/Plutonium/Plutonium/Output
LIBDIRS := $(PORTLIBS) $(LIBNX) $(CURDIR)/include/Plutonium/Plutonium/out
#---------------------------------------------------------------------------------
@ -171,18 +171,17 @@ all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
#comment this out if you are hacking on the code or compilation will take forever
$(MAKE) --no-print-directory -C include/Plutonium -f Makefile lib
@$(MAKE) --no-print-directory -C include/Plutonium/Plutonium -f Makefile
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
ifeq ($(strip $(APP_JSON)),)
@$(MAKE) --no-print-directory -C include/Plutonium/Plutonium -f Makefile clean
#@$(MAKE) --no-print-directory -C include/Plutonium/Plutonium -f Makefile clean
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
else
@$(MAKE) --no-print-directory -C include/Plutonium/Plutonium -f Makefile clean
#@$(MAKE) --no-print-directory -C include/Plutonium/Plutonium -f Makefile clean
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
endif

@ -1 +1 @@
Subproject commit 301413d86fc3dbcbd99dea44b12d7df2977e8be1
Subproject commit fe5a9b96e52b70eceea493def38418fe021d2e74

View File

@ -10,8 +10,7 @@ int main(int argc, char* argv[])
{
inst::util::initApp();
try {
auto renderer = Renderer::New(SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER,
RendererInitOptions::RendererNoSound, RendererHardwareFlags);
auto renderer = Renderer::New(RendererInitOptions(SDL_INIT_EVERYTHING, RendererHardwareFlags).WithIMG(IMGAllFlags).WithMixer(MixerAllFlags).WithTTF());
auto main = inst::ui::MainApplication::New(renderer);
std::thread updateThread;
if (inst::config::autoUpdate && inst::util::getIPAddress() != "1.0.0.127") updateThread = std::thread(inst::util::checkForAppUpdate);

View File

@ -248,18 +248,17 @@ namespace netInstStuff{
}
// Break on input pressed
hidScanInput();
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
u64 kDown = inst::ui::mainApp->GetButtonsDown();
if (kDown & KEY_B)
if (kDown & HidNpadButton_B)
{
break;
}
if (kDown & KEY_Y)
if (kDown & HidNpadButton_Y)
{
return {"supplyUrl"};
}
if (kDown & KEY_X)
if (kDown & HidNpadButton_X)
{
inst::ui::mainApp->CreateShowDialog("inst.net.help.title"_lang, "inst.net.help.desc"_lang, {"common.ok"_lang}, true);
}

View File

@ -16,16 +16,16 @@ namespace inst::ui {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980"));
if (inst::config::gayMode) {
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion);
}
else {
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion);
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->pageInfoText = TextBlock::New(10, 109, "", 30);
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->installInfoText = TextBlock::New(15, 568, "", 22);
this->installInfoText = TextBlock::New(15, 568, "");
this->installInfoText->SetColor(COLOR("#FFFFFFFF"));
this->installBar = pu::ui::elm::ProgressBar::New(10, 600, 850, 40, 100.0f);
this->installBar->SetColor(COLOR("#222222FF"));

View File

@ -42,14 +42,14 @@ namespace inst::ui {
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#17090980"));
if (inst::config::gayMode) {
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion);
}
else {
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion);
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, "main.buttons"_lang, 24);
this->butText = TextBlock::New(10, 678, "main.buttons"_lang);
this->butText->SetColor(COLOR("#FFFFFFFF"));
this->optionMenu = pu::ui::elm::Menu::New(0, 95, 1280, COLOR("#67000000"), 94, 6);
this->optionMenu->SetOnFocusColor(COLOR("#00000033"));
@ -133,11 +133,11 @@ namespace inst::ui {
}
void MainPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos) {
if (((Down & KEY_PLUS) || (Down & KEY_MINUS) || (Down & KEY_B)) && mainApp->IsShown()) {
if (((Down & HidNpadButton_Plus) || (Down & HidNpadButton_Minus) || (Down & HidNpadButton_B)) && mainApp->IsShown()) {
mainApp->FadeOut();
mainApp->Close();
}
if ((Down & KEY_A) || (Up & KEY_TOUCH)) {
if ((Down & HidNpadButton_A)) {
switch (this->optionMenu->GetSelectedIndex()) {
case 0:
this->installMenuItem_Click();
@ -161,11 +161,11 @@ namespace inst::ui {
break;
}
}
if (Down & KEY_X) {
if (Down & HidNpadButton_X) {
this->awooImage->SetVisible(false);
this->eggImage->SetVisible(true);
}
if (Up & KEY_X) {
if (Up & HidNpadButton_X) {
this->eggImage->SetVisible(false);
if (!inst::config::gayMode) this->awooImage->SetVisible(true);
}

View File

@ -26,16 +26,16 @@ namespace inst::ui {
this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980"));
if (inst::config::gayMode) {
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion);
}
else {
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion);
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->pageInfoText = TextBlock::New(10, 109, "", 30);
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, "", 24);
this->butText = TextBlock::New(10, 678, "");
this->butText->SetColor(COLOR("#FFFFFFFF"));
this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), 84, (506 / 84));
this->menu->SetOnFocusColor(COLOR("#00000033"));
@ -155,7 +155,7 @@ namespace inst::ui {
}
void netInstPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos) {
if (Down & KEY_B) {
if (Down & HidNpadButton_B) {
if (this->menu->GetItems().size() > 0){
if (this->selectedUrls.size() == 0) {
this->selectTitle(this->menu->GetSelectedIndex());
@ -165,13 +165,13 @@ namespace inst::ui {
netInstStuff::OnUnwound();
mainApp->LoadLayout(mainApp->mainPage);
}
if ((Down & KEY_A) || (Up & KEY_TOUCH)) {
if ((Down & HidNpadButton_A)) {
this->selectTitle(this->menu->GetSelectedIndex());
if (this->menu->GetItems().size() == 1 && this->selectedUrls.size() == 1) {
this->startInstall(false);
}
}
if ((Down & KEY_Y)) {
if ((Down & HidNpadButton_Y)) {
if (this->selectedUrls.size() == this->menu->GetItems().size()) this->drawMenuItems(true);
else {
for (long unsigned int i = 0; i < this->menu->GetItems().size(); i++) {
@ -181,7 +181,7 @@ namespace inst::ui {
this->drawMenuItems(false);
}
}
if (Down & KEY_PLUS) {
if (Down & HidNpadButton_Plus) {
if (this->selectedUrls.size() == 0) {
this->selectTitle(this->menu->GetSelectedIndex());
}

View File

@ -27,16 +27,16 @@ namespace inst::ui {
this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980"));
if (inst::config::gayMode) {
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion);
}
else {
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion);
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->pageInfoText = TextBlock::New(10, 109, "options.title"_lang, 30);
this->pageInfoText = TextBlock::New(10, 109, "options.title"_lang);
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, "options.buttons"_lang, 24);
this->butText = TextBlock::New(10, 678, "options.buttons"_lang);
this->butText->SetColor(COLOR("#FFFFFFFF"));
this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), 84, (506 / 84));
this->menu->SetOnFocusColor(COLOR("#00000033"));
@ -151,14 +151,13 @@ namespace inst::ui {
}
void optionsPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos) {
if (Down & KEY_B) {
if (Down & HidNpadButton_B) {
mainApp->LoadLayout(mainApp->mainPage);
}
if ((Down & KEY_A) || (Up & KEY_TOUCH)) {
if ((Down & HidNpadButton_A)) {
std::string keyboardResult;
int rc;
std::vector<std::string> downloadUrl;
std::vector<std::string> languageList;
switch (this->menu->GetSelectedIndex()) {
case 0:
inst::config::ignoreReqVers = !inst::config::ignoreReqVers;
@ -234,48 +233,50 @@ namespace inst::ui {
}
break;
case 7:
languageList = languageStrings;
{
std::vector<pu::String> languageList(languageStrings.begin(), languageStrings.end());
languageList.push_back("options.language.system_language"_lang);
rc = inst::ui::mainApp->CreateShowDialog("options.language.title"_lang, "options.language.desc"_lang, languageList, false);
if (rc == -1) break;
switch(rc) {
case 0:
inst::config::languageSetting = 1;
break;
case 1:
inst::config::languageSetting = 0;
break;
case 2:
inst::config::languageSetting = 2;
break;
case 3:
inst::config::languageSetting = 3;
break;
case 4:
inst::config::languageSetting = 4;
break;
case 5:
inst::config::languageSetting = 14;
break;
case 6:
inst::config::languageSetting = 9;
break;
case 7:
inst::config::languageSetting = 10;
break;
case 8:
inst::config::languageSetting = 6;
break;
case 9:
inst::config::languageSetting = 11;
break;
default:
inst::config::languageSetting = 99;
switch (rc) {
case 0:
inst::config::languageSetting = 1;
break;
case 1:
inst::config::languageSetting = 0;
break;
case 2:
inst::config::languageSetting = 2;
break;
case 3:
inst::config::languageSetting = 3;
break;
case 4:
inst::config::languageSetting = 4;
break;
case 5:
inst::config::languageSetting = 14;
break;
case 6:
inst::config::languageSetting = 9;
break;
case 7:
inst::config::languageSetting = 10;
break;
case 8:
inst::config::languageSetting = 6;
break;
case 9:
inst::config::languageSetting = 11;
break;
default:
inst::config::languageSetting = 99;
}
inst::config::setConfig();
mainApp->FadeOut();
mainApp->Close();
break;
}
break;
case 8:
if (inst::util::getIPAddress() == "1.0.0.127") {
inst::ui::mainApp->CreateShowDialog("main.net.title"_lang, "main.net.desc"_lang, {"common.ok"_lang}, true);

View File

@ -21,16 +21,16 @@ namespace inst::ui {
this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980"));
if (inst::config::gayMode) {
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion);
}
else {
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion);
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->pageInfoText = TextBlock::New(10, 109, "inst.sd.top_info"_lang, 30);
this->pageInfoText = TextBlock::New(10, 109, "inst.sd.top_info"_lang);
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, "inst.sd.buttons"_lang, 24);
this->butText = TextBlock::New(10, 678, "inst.sd.buttons"_lang);
this->butText->SetColor(COLOR("#FFFFFFFF"));
this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), 84, (506 / 84));
this->menu->SetOnFocusColor(COLOR("#00000033"));
@ -128,16 +128,16 @@ namespace inst::ui {
}
void sdInstPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos) {
if (Down & KEY_B) {
if (Down & HidNpadButton_B) {
mainApp->LoadLayout(mainApp->mainPage);
}
if ((Down & KEY_A) || (Up & KEY_TOUCH)) {
if ((Down & HidNpadButton_A)) {
this->selectNsp(this->menu->GetSelectedIndex());
if (this->ourFiles.size() == 1 && this->selectedTitles.size() == 1) {
this->startInstall();
}
}
if ((Down & KEY_Y)) {
if ((Down & HidNpadButton_Y)) {
if (this->selectedTitles.size() == this->ourFiles.size()) this->drawMenuItems(true, currentDir);
else {
int topDir = 0;
@ -149,10 +149,10 @@ namespace inst::ui {
this->drawMenuItems(false, currentDir);
}
}
if ((Down & KEY_X)) {
if ((Down & HidNpadButton_A)) {
inst::ui::mainApp->CreateShowDialog("inst.sd.help.title"_lang, "inst.sd.help.desc"_lang, {"common.ok"_lang}, true);
}
if (Down & KEY_PLUS) {
if (Down & HidNpadButton_Plus) {
if (this->selectedTitles.size() == 0 && this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetIcon() == "romfs:/images/icons/checkbox-blank-outline.png") {
this->selectNsp(this->menu->GetSelectedIndex());
}

View File

@ -21,16 +21,16 @@ namespace inst::ui {
this->botRect = Rectangle::New(0, 660, 1280, 60, COLOR("#17090980"));
if (inst::config::gayMode) {
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion);
}
else {
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion);
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->pageInfoText = TextBlock::New(10, 109, "", 30);
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, "", 24);
this->butText = TextBlock::New(10, 678, "");
this->butText->SetColor(COLOR("#FFFFFFFF"));
this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), 84, (506 / 84));
this->menu->SetOnFocusColor(COLOR("#00000033"));
@ -108,17 +108,17 @@ namespace inst::ui {
}
void usbInstPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos) {
if (Down & KEY_B) {
if (Down & HidNpadButton_B) {
tin::util::USBCmdManager::SendExitCmd();
mainApp->LoadLayout(mainApp->mainPage);
}
if ((Down & KEY_A) || (Up & KEY_TOUCH)) {
if ((Down & HidNpadButton_A)) {
this->selectTitle(this->menu->GetSelectedIndex());
if (this->menu->GetItems().size() == 1 && this->selectedTitles.size() == 1) {
this->startInstall();
}
}
if ((Down & KEY_Y)) {
if ((Down & HidNpadButton_Y)) {
if (this->selectedTitles.size() == this->menu->GetItems().size()) this->drawMenuItems(true);
else {
for (long unsigned int i = 0; i < this->menu->GetItems().size(); i++) {
@ -128,7 +128,7 @@ namespace inst::ui {
this->drawMenuItems(false);
}
}
if (Down & KEY_PLUS) {
if (Down & HidNpadButton_Plus) {
if (this->selectedTitles.size() == 0) {
this->selectTitle(this->menu->GetSelectedIndex());
this->startInstall();

View File

@ -60,12 +60,20 @@ namespace usbInstStuff {
std::vector<std::string> OnSelected() {
TUSHeader header;
u64 freq = armGetSystemTickFreq();
u64 startTime = armGetSystemTick();
while(true) {
// If we don't update the UI occasionally the Switch basically crashes on this screen if you press the home button
u64 newTime = armGetSystemTick();
if (newTime - startTime >= freq * 0.25) {
startTime = newTime;
inst::ui::mainApp->CallForRender();
}
if (bufferData(&header, sizeof(TUSHeader), 500000000) != 0) break;
hidScanInput();
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
if (kDown & KEY_B) return {};
if (kDown & KEY_X) inst::ui::mainApp->CreateShowDialog("inst.usb.help.title"_lang, "inst.usb.help.desc"_lang, {"common.ok"_lang}, true);
u64 kDown = inst::ui::mainApp->GetButtonsDown();
if (kDown & HidNpadButton_B) return {};
if (kDown & HidNpadButton_X) inst::ui::mainApp->CreateShowDialog("inst.usb.help.title"_lang, "inst.usb.help.desc"_lang, {"common.ok"_lang}, true);
if (!inst::util::usbIsConnected()) return {};
}

View File

@ -43,7 +43,7 @@ namespace Language {
case 15:
languagePath = "romfs:/lang/zh-CN.json";
// the default font will miss some chinese character, so use a chinese font (simplified)
pu::ui::render::SetDefaultFontFromShared(pu::ui::render::SharedFont::ChineseSimplified);
//pu::ui::render::SetDefaultFontFromShared(pu::ui::render::SharedFont::ChineseSimplified);
break;
case 7:
languagePath = "romfs:/lang/ko.json";
@ -60,7 +60,7 @@ namespace Language {
case 11:
languagePath = "romfs:/lang/zh-TW.json";
// the default font will miss some chinese character, so use a chinese font (traditional)
pu::ui::render::SetDefaultFontFromShared(pu::ui::render::SharedFont::ChineseTraditional);
//pu::ui::render::SetDefaultFontFromShared(pu::ui::render::SharedFont::ChineseTraditional);
break;
default:
languagePath = "romfs:/lang/en.json";

View File

@ -249,9 +249,9 @@ namespace tin::network
size_t written = 0;
while (written < len)
{
if (hidKeysDown(CONTROLLER_P1_AUTO) & KEY_B) // Break if user clicks 'B'
break;
{
/*if (padGetButtonsDown(m_pad) & HidNpadButton_B) // Break if user clicks 'B'
break;*/
errno = 0;
ret = send(sockfd, (u8*)buf + written, len - written, 0);

View File

@ -46,7 +46,7 @@ bool _makeDirectoryParents(std::string path)
case EEXIST:
//Done!
bSuccess = true;
break;std::string getHost();
break;
default:
bSuccess = false;
break;

View File

@ -19,7 +19,6 @@
namespace inst::util {
void initApp () {
// Seethe
if (!pu::IsReiNX()) pu::IsAtmosphere();
if (!std::filesystem::exists("sdmc:/switch")) std::filesystem::create_directory("sdmc:/switch");
if (!std::filesystem::exists(inst::config::appDir)) std::filesystem::create_directory(inst::config::appDir);
inst::config::parseConfig();