diff --git a/README.md b/README.md index 7feb767..27dd473 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ FAQ ----- **Question:** My 4K file dont work? Why? -**Answer** ~~Keep in mind that currently Homebrew apps can't access the HW Decoder, so all is done with CPU, 4K file is too heavy to be decoded~~ **From version 0.7.0 NXMP have HW Decoding for format H264,HEVC,VP9,MPEG2 it can decode up to 4K HDR@30fps +**Answer** ~~Keep in mind that currently Homebrew apps can't access the HW Decoder, so all is done with CPU, 4K file is too heavy to be decoded~~ **From version 0.7.0 NXMP have HW Decoding for format H264,HEVC,VP9,MPEG2 it can decode up to 4K HDR@30fps** **Q:** What is Enigma2? @@ -74,7 +74,7 @@ Thanks to ----- - Cpasjuste for pPlay https://github.com/Cpasjuste/pplay some code was taken here (mpv and Overclock part) - DarkMatterCore for libusbhsfs https://github.com/DarkMatterCore/libusbhsfs (this gives NXMP USB support) -- Averne for HW Decoding on Tegra X1 and for all the hints and help (thanks a lot!) +- Averne for HW Decoding on Tegra X1 https://github.com/averne/FFmpeg and for all the hints and help (thanks a lot!) - Chocola @ GBATemp forum for usage guide and beta testing - sashka69 @ GBATemp forum for beta testing - bodyXY @ GBATemp forum for banner and icons diff --git a/include/config.h b/include/config.h index c9e9070..6b8472d 100644 --- a/include/config.h +++ b/include/config.h @@ -20,6 +20,7 @@ typedef struct{ int slang; bool useoc; bool hwdec = true; + bool vsync = false; int subfontsize; float subfontscale; int deint; @@ -76,6 +77,9 @@ class Config{ bool getHWDec(bool tmpvalue); void setHWDec(bool _val); + + bool getVSYNC(bool tmpvalue); + void setVSYNC(bool _val); int getSubFontSize(bool tmpvalue); void setSubFontSize(int val); diff --git a/include/custom_widgets.h b/include/custom_widgets.h deleted file mode 100644 index f444b3a..0000000 --- a/include/custom_widgets.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include -#include - -void batteryIcon(ImVec2 pos,bool absolute,uint32_t batlevel, float w, float h); \ No newline at end of file diff --git a/include/gui.h b/include/gui.h index 49be8ee..b577ef1 100644 --- a/include/gui.h +++ b/include/gui.h @@ -178,7 +178,7 @@ typedef struct { Tex FolderTexture; Tex FileTexture; - + Tex ShareAddTexture; Tex FTPTexture; Tex HTTPTexture; Tex SFTPTexture; diff --git a/romfs/shareadd.png b/romfs/shareadd.png new file mode 100644 index 0000000..4af7c1b Binary files /dev/null and b/romfs/shareadd.png differ diff --git a/source/UI/UIHelpers.cpp b/source/UI/UIHelpers.cpp index 9779801..5057853 100644 --- a/source/UI/UIHelpers.cpp +++ b/source/UI/UIHelpers.cpp @@ -71,7 +71,7 @@ namespace Windows { float currstartpos = ImGui::GetCursorPosX(); ImGui::Text(data.c_str()); ImGui::SetCursorPosX(currstartpos); - ImGui::SetCursorPosY(ImGui::GetCursorPosY()-26.0f); + ImGui::SetCursorPosY(ImGui::GetCursorPosY()-26.0f*multiplyRes); if (ImGui::Selectable(uuid.c_str(), false)){ SwkbdConfig kbd; char tmpoutstr[256] = {0}; @@ -88,7 +88,7 @@ namespace Windows { //swkbdConfigSetOkButtonText(&kbd, "Submit"); //swkbdConfigSetLeftOptionalSymbolKey(&kbd, "a"); //swkbdConfigSetRightOptionalSymbolKey(&kbd, "b"); - //swkbdConfigSetHeaderText(&kbd, "Header"); + swkbdConfigSetHeaderText(&kbd, label.c_str()); //swkbdConfigSetSubText(&kbd, "Sub"); //swkbdConfigSetGuideText(&kbd, "Guide"); diff --git a/source/UI/custom_widgets.cpp b/source/UI/custom_widgets.cpp deleted file mode 100644 index 83c9abb..0000000 --- a/source/UI/custom_widgets.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "custom_widgets.h" - -void batteryIcon(ImVec2 pos,bool absolute,uint32_t batlevel, float w, float h){ - - //ImVec2 iconsize = ImVec2(50.0f, 20.0f); - ImVec2 iconsize = ImVec2(w, h); - - ImVec2 canvas_p0 = ImGui::GetCursorScreenPos(); - if(absolute){ - canvas_p0 = pos; - } - ImVec2 canvas_pnew = ImVec2(canvas_p0.x+3.0,canvas_p0.y+3.0f); - ImVec2 canvas_p1 = ImVec2(canvas_p0.x+iconsize.x, canvas_p0.y + iconsize.y); - ImVec2 batteryfill = ImVec2(canvas_p0.x+(float)batlevel*(iconsize.x-3.0f)/100.0f, canvas_p0.y-3.0 + iconsize.y); - ImVec2 batteryicon_p0 = ImVec2(canvas_p1.x,canvas_p0.y+5.0f); - ImVec2 batteryicon_p1 = ImVec2(canvas_p1.x+5.0,canvas_p0.y+15.0f); - - - - //ImDrawList* draw_list = ImGui::GetWindowDrawList(); - ImGui::GetForegroundDrawList()->AddRectFilled(canvas_p0, canvas_p1, IM_COL32(0, 0, 0, 255)); - //green - if(batlevel >= 66) - ImGui::GetForegroundDrawList()->AddRectFilled(canvas_pnew, batteryfill, IM_COL32(50, 255, 50, 255)); - //yellow - else if(batlevel >= 33 ) - ImGui::GetForegroundDrawList()->AddRectFilled(canvas_pnew, batteryfill, IM_COL32(255, 204, 0, 255)); - //red - else if(batlevel >= 0 ) - ImGui::GetForegroundDrawList()->AddRectFilled(canvas_pnew, batteryfill, IM_COL32(204, 51, 0, 255)); - - ImGui::GetForegroundDrawList()->AddRect(canvas_p0, canvas_p1, IM_COL32(255, 255, 255, 255)); - - ImGui::GetForegroundDrawList()->AddRectFilled(batteryicon_p0, batteryicon_p1, IM_COL32(255, 255, 255, 255)); - - -} \ No newline at end of file diff --git a/source/UI/mainMenu.cpp b/source/UI/mainMenu.cpp index 350c212..ce2820a 100644 --- a/source/UI/mainMenu.cpp +++ b/source/UI/mainMenu.cpp @@ -7,24 +7,13 @@ #include "Enigma2.h" #include "curldownloader.h" -#include "custom_widgets.h" - namespace Windows { void MainMenuWindow(bool *focus, bool *first_item) { Windows::SetupMainWindow(); std::vector topmenu = configini->topmenu; - /* - if(isHandheld == true){ - batteryIcon(ImVec2(1230.0f,5.0f),true,batteryPercent,40,20); - } - else{ - batteryIcon(ImVec2(1230.0f*multiplyRes + 20,5.0f),true,batteryPercent,40,20); - } - */ GUI::newbatteryIcon(ImVec2(1180.0f*multiplyRes,5.0f),true,batteryPercent,40,20,true); - if (ImGui::Begin(nxmpTitle.c_str(), nullptr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) { static int selected = -1; for (unsigned int n = 0; n < topmenu.size(); n++){ diff --git a/source/UI/networkBrowser.cpp b/source/UI/networkBrowser.cpp index dd1f99c..21a6c02 100644 --- a/source/UI/networkBrowser.cpp +++ b/source/UI/networkBrowser.cpp @@ -26,7 +26,43 @@ namespace Windows { ImGui::Text("Protocol: "); ImGui::SameLine(); - ImGui::Combo("##protocombo", (int *)&NewNetworkShare->type, NewNetworkShare->protonames, 5); + //ImGui::Combo("##protocombo", (int *)&NewNetworkShare->type, NewNetworkShare->protonames, 5); + static const char* item_current = NULL; + if (ImGui::BeginCombo("##protocombo", item_current, NULL)) // The second parameter is the label previewed before opening the combo. + { + for (int n = 0; n < IM_ARRAYSIZE(NewNetworkShare->protonames); n++) + { + bool is_selected = (item_current == NewNetworkShare->protonames[n]); + + if(NewNetworkShare->protonames[n] == "FTP"){ + GUI::NXMPImage((void*)(intptr_t)nxmpicons.FTPTexture.id, ImVec2(30,30)); + } + if(NewNetworkShare->protonames[n] == "HTTP"){ + GUI::NXMPImage((void*)(intptr_t)nxmpicons.HTTPTexture.id, ImVec2(30,30)); + } + if(NewNetworkShare->protonames[n] == "SMB"){ + GUI::NXMPImage((void*)(intptr_t)nxmpicons.NFSTexture.id, ImVec2(30,30)); + } + if(NewNetworkShare->protonames[n] == "NFS"){ + GUI::NXMPImage((void*)(intptr_t)nxmpicons.FTPTexture.id, ImVec2(30,30)); + } + if(NewNetworkShare->protonames[n] == "SSH"){ + GUI::NXMPImage((void*)(intptr_t)nxmpicons.SFTPTexture.id, ImVec2(30,30)); + } + + ImGui::SameLine(); + + if (ImGui::Selectable(NewNetworkShare->protonames[n], is_selected)){ + item_current = NewNetworkShare->protonames[n]; + NewNetworkShare->type = n; + } + + if (is_selected) + ImGui::SetItemDefaultFocus(); // Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch) + } + ImGui::EndCombo(); + } + if(NewNetworkShare->type == 0){ NewNetworkShare->httpstring = InputSwitchKeyboard("##httpstring","HTTP String",NewNetworkShare->httpstring); @@ -794,7 +830,7 @@ namespace Windows { if(item.networkselect){ if (ImGui::BeginListBox("Network Source Menu",ImVec2(1280.0f*multiplyRes, 720.0f*multiplyRes))){ - GUI::NXMPImage((void*)(intptr_t)nxmpicons.SMBTexture.id, ImVec2(50,50)); + GUI::NXMPImage((void*)(intptr_t)nxmpicons.ShareAddTexture.id, ImVec2(50,50)); ImGui::SameLine(); ImGui::SetCursorPos({ImGui::GetCursorPos().x, ImGui::GetCursorPos().y + (50 - ImGui::GetFont()->FontSize) / 2}); static int selected = -1; diff --git a/source/UI/playerWindows.cpp b/source/UI/playerWindows.cpp index 963bd5c..c450521 100644 --- a/source/UI/playerWindows.cpp +++ b/source/UI/playerWindows.cpp @@ -3,7 +3,6 @@ #include "imgui.h" #include "utils.h" #include "imgui_internal.h" -#include "custom_widgets.h" #include "SwitchSys.h" @@ -90,13 +89,13 @@ namespace playerWindows{ }*/ } } - ImGui::Checkbox("Show Power Stats", &item.showstats); + ImGui::Checkbox("Power Stats", &item.showstats); if (*first_item) { ImGui::SetFocusID(ImGui::GetID(topmenu[0].c_str()), ImGui::GetCurrentWindow()); *first_item = false; } - ImGui::Checkbox("Show Decoding Stats", &item.showdecstats); + ImGui::Checkbox("Dec Stats", &item.showdecstats); if (*first_item) { ImGui::SetFocusID(ImGui::GetID(topmenu[0].c_str()), ImGui::GetCurrentWindow()); *first_item = false; @@ -110,20 +109,8 @@ namespace playerWindows{ ImGui::SetCursorPosY(ImGui::GetWindowSize().y -40*multiplyRes); ImGui::Separator(); - if(isHandheld) - GUI::newbatteryIcon(ImVec2((rightmenuposX*multiplyRes) + 13.0f,ImGui::GetWindowSize().y -24),true,batteryPercent,40,18,true); - else GUI::newbatteryIcon(ImVec2((rightmenuposX*multiplyRes) + 13.0f,ImGui::GetWindowSize().y -24*multiplyRes),true,batteryPercent,40*multiplyRes,18*multiplyRes,true); - - - //if(isHandheld) - //batteryIcon(ImVec2((rightmenuposX) + 13.0f,ImGui::GetWindowSize().y -24),true,batteryPercent,40,18); - //else - //batteryIcon(ImVec2((rightmenuposX*multiplyRes) + 113.0f,ImGui::GetWindowSize().y -24),true,batteryPercent,40,18); - //ImGui::Text(" %d%%",batteryPercent); - - //endBattery ImGui::EndListBox(); } diff --git a/source/UI/settingsMenu.cpp b/source/UI/settingsMenu.cpp index cd3abf0..ddbd2a5 100644 --- a/source/UI/settingsMenu.cpp +++ b/source/UI/settingsMenu.cpp @@ -56,11 +56,16 @@ namespace Windows { if(ImGui::Checkbox("OverClock at Startup", &ocdefault)){ configini->setUseOc(ocdefault); } - + ImGui::Text("Misc (Need Restart))"); + ImGui::Separator(); bool hwdecdefault = configini->getHWDec(true); if(ImGui::Checkbox("HW Decoder", &hwdecdefault)){ configini->setHWDec(hwdecdefault); } + bool vsyncdefault = configini->getVSYNC(true); + if(ImGui::Checkbox("VSYNC", &vsyncdefault)){ + configini->setVSYNC(vsyncdefault); + } ImGui::EndTabItem(); } diff --git a/source/config.cpp b/source/config.cpp index b0b195a..d501e06 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -71,6 +71,7 @@ Config::Config(std::string inifile){ nxmpconfig.useoc = ini->GetBoolValue("Main", "useoc"); nxmpconfig.hwdec = ini->GetBoolValue("Main", "hwdec",true); + nxmpconfig.vsync = ini->GetBoolValue("Main", "vsync",false); const char* themenamepv; themenamepv = ini->GetValue("Main", "theme"); @@ -326,6 +327,16 @@ void Config::setHWDec(bool _val){ nxmptmpconfig.hwdec = _val; } +bool Config::getVSYNC(bool tmpvalue){ + if(tmpvalue){ + return nxmptmpconfig.vsync; + } + return nxmpconfig.vsync; +} +void Config::setVSYNC(bool _val){ + nxmptmpconfig.vsync = _val; +} + int Config::getSubFontSize(bool tmpvalue){ if(tmpvalue){ return nxmptmpconfig.subfontsize; @@ -540,6 +551,9 @@ void Config::saveSettings(){ ini->Delete("Main", "hwdec"); ini->SetBoolValue("Main", "hwdec", nxmpconfig.hwdec, NULL, false); + + ini->Delete("Main", "vsync"); + ini->SetBoolValue("Main", "vsync", nxmpconfig.vsync, NULL, false); ini->Delete("Main", "subfontsize"); ini->SetLongValue("Main", "subfontsize", nxmpconfig.subfontsize, NULL, false); diff --git a/source/main.cpp b/source/main.cpp index 39b5e32..78c277a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -216,7 +216,11 @@ static bool init() { else { gladLoadGL(); } - SDL_GL_SetSwapInterval(1); + if(configini->getVSYNC(false)){ + SDL_GL_SetSwapInterval(1); + }else{ + SDL_GL_SetSwapInterval(0); + } } } return success; @@ -302,6 +306,7 @@ int main() { Utility::TxtLoadFromFile("romfs:/sdcard.png",&nxmpicons.SdCardTexture.id,&nxmpicons.SdCardTexture.width,&nxmpicons.SdCardTexture.height); Utility::TxtLoadFromFile("romfs:/usb.png",&nxmpicons.UsbTexture.id,&nxmpicons.UsbTexture.width,&nxmpicons.UsbTexture.height); Utility::TxtLoadFromFile("romfs:/network.png",&nxmpicons.NetworkTexture.id,&nxmpicons.NetworkTexture.width,&nxmpicons.NetworkTexture.height); + Utility::TxtLoadFromFile("romfs:/shareadd.png",&nxmpicons.ShareAddTexture.id,&nxmpicons.ShareAddTexture.width,&nxmpicons.ShareAddTexture.height); Utility::TxtLoadFromFile("romfs:/enigma2.png",&nxmpicons.Enigma2Texture.id,&nxmpicons.Enigma2Texture.width,&nxmpicons.Enigma2Texture.height); Utility::TxtLoadFromFile("romfs:/folder.png",&nxmpicons.FolderTexture.id,&nxmpicons.FolderTexture.width,&nxmpicons.FolderTexture.height); Utility::TxtLoadFromFile("romfs:/file.png",&nxmpicons.FileTexture.id,&nxmpicons.FileTexture.width,&nxmpicons.FileTexture.height); diff --git a/source/stats/stats.cpp b/source/stats/stats.cpp index a94978c..fce78a7 100644 --- a/source/stats/stats.cpp +++ b/source/stats/stats.cpp @@ -81,7 +81,6 @@ void CheckCore2(void *arg) { void Misc(void*arg) { CStats * ctx = (CStats *)arg; - int ret = 0; //Service* psmService = 0; //Result nvCheck = 1;