Skip to content

Commit

Permalink
Merged preliminary 0.6.1 code (need cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
proconsule committed Feb 5, 2022
1 parent 0d539bf commit 3297931
Show file tree
Hide file tree
Showing 50 changed files with 2,163 additions and 130 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := libs/imgui libs/imgui/misc/freetype source source/touchcontrols source/playlist source/shadermania source/eqpreset source/database source/UI source/remotefs/smb2 source/remotefs/sshDir source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
SOURCES := libs/imgui libs/imgui/opengl3 libs/imgui/misc/freetype source source/curldownloader source/touchcontrols source/playlist source/shadermania source/eqpreset source/database source/UI source/remotefs/UPNP source/remotefs/nfsDir source/remotefs/smb2 source/remotefs/sshDir source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
DATA := data
INCLUDES := libs/simpleini libs/imgui include source/touchcontrols source/playlist source/shadermania source/eqpreset source/database source/remotefs/smb2 source/remotefs/sshDir source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
INCLUDES := libs/simpleini libs/imgui libs/imgui/opengl3 include source/curldownloader source/touchcontrols source/playlist source/shadermania source/eqpreset source/database source/remotefs/UPNP source/remotefs/nfsDir source/remotefs/smb2 source/remotefs/sshDir source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
ROMFS := romfs

VERSION_MAJOR := 0
VERSION_MINOR := 6
VERSION_MICRO := 0
VERSION_MICRO := 1

APP_TITLE := NXMP
APP_AUTHOR := proconsule
Expand All @@ -60,7 +60,7 @@ ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE

CFLAGS := -g -Wall -Wno-sign-compare -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += `sdl2-config --cflags` `freetype-config --cflags` -fpermissive
CFLAGS += `sdl2-config --cflags` `freetype-config --cflags` -fpermissive -DIMGUI_USE_WCHAR32 -I${PORTLIBS}/include/upnp/

CFLAGS += $(INCLUDE) -D__SWITCH__ $(BUILD_TYPE)

Expand All @@ -72,7 +72,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -DIMGUI_IMPL_OPENGL_LOADER_GLAD \
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS := `curl-config --libs` `sdl2-config --libs` `freetype-config --libs` -lmpv -lssh2 -lswscale -lswresample -lavformat -lavfilter -lavcodec -lavutil -llzma -lopus -lvpx -lass -lharfbuzz -lfreetype -lfribidi -lpng -lbz2 -lusbhsfs -lntfs-3g -llwext4 -lglad -lEGL -lglapi -ldrm_nouveau -ltinyxml2 -lturbojpeg -llua -lmbedcrypto -lmbedx509 -lmbedtls -lmbedcrypto -lmbedx509 -lmbedtls -lsqlite3 -lsmb2 -lnx -lz
LIBS := `curl-config --libs` `sdl2-config --libs` `freetype-config --libs` -lmpv -lssh2 -lswscale -lswresample -lavformat -lavfilter -lavcodec -lavutil -llzma -lopus -lvpx -lass -lharfbuzz -lfreetype -lfribidi -lpng -lbz2 -lusbhsfs -lntfs-3g -llwext4 -lglad -lEGL -lglapi -ldrm_nouveau -ltinyxml2 -lturbojpeg -llua -lmbedcrypto -lmbedx509 -lmbedtls -lmbedcrypto -lmbedx509 -lmbedtls -lsqlite3 -lsmb2 -lupnp -lixml -lnfs -lnx -lz



Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ source=TESTFtp|ftp://user:[email protected]:21/path/
source=TestHTTP|http://192.168.1.10/path/
source=TestSFTp|sftp://192.168.1.10/path/ (without path it default to home)
source=TestSamba|smb://192.168.1.10/share/ (share is a share name not a path)
source=TestNFS|nfs://192.168.1.10/export/
```

Enigma2 have syntax
Expand Down Expand Up @@ -69,9 +70,10 @@ Thanks to
-----
- Cpasjuste for pPlay https://github.com/Cpasjuste/pplay some code was taken here (mpv part)
- DarkMatterCore for libusbhsfs https://github.com/DarkMatterCore/libusbhsfs (this gives NXMP USB support)
- Chocola @ GBATemp forum for usage guide and beta testing
- sashka69 @ GBATemp forum for beta testing
- bodyXY @ GBATemp forum for banner and icons
- Godorowski @ GBATemp forum for player UI design and icons
- Chocola @ GBATemp forum for usage guide and beta testing
- student @ reboot.ms forum for beta testing
- docgold @ GBATemp forum for Enigma2 samples and support on decoders
- tataniko @ GBATemp forum for suggestions and bug hunting
Expand Down
11 changes: 11 additions & 0 deletions include/appwindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define NXMP_WINDOWS_H

#include "imgui.h"
#include "platforms.h"

namespace Windows {

Expand Down Expand Up @@ -30,14 +31,24 @@ namespace Windows {
};

void FileBrowserWindow(bool *focus, bool *first_item);
#ifdef NXMP_USBSUPPORT
void USBBrowserWindow(bool *focus, bool *first_item);
#endif
#ifdef NXMP_ENIGMASUPPORT
void EnigmaWindow(bool *focus, bool *first_item);
#endif
void MainMenuWindow(bool *focus, bool *first_item);
#ifdef NXMP_NETWORKSUPPORT
void FtpWindow(bool *focus, bool *first_item);
void HttpWindow(bool *focus, bool *first_item);
void SSHWindow(bool *focus, bool *first_item);
void SambaWindow(bool *focus, bool *first_item);
void NFSWindow(bool *focus, bool *first_item);
void NetworkWindow(bool *focus, bool *first_item);
#endif
#ifdef NXMP_UPNPSUPPORT
void UPNPBrowserWindow(bool *focus, bool *first_item);
#endif
void InfoMenuWindow(bool *focus, bool *first_item);
void VideoWindow(bool *focus, bool *first_item);
void SettingsMenuWindow(bool *focus, bool *first_item);
Expand Down
1 change: 1 addition & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <string>
#include <vector>

#include "platforms.h"

#include "SimpleIni.h"

Expand Down
32 changes: 29 additions & 3 deletions include/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <string>
#include <SDL.h>
#include "platforms.h"
#ifdef __SWITCH__
#include <switch.h>
#endif
Expand All @@ -22,12 +23,22 @@
#include "remotefs.h"
#include "localFs.h"
#include "utils.h"
#ifdef NXMP_USBSUPPORT
#include "usbfs.h"
#endif
#ifdef NXMP_ENIGMASUPPORT
#include "Enigma2.h"
#endif
#ifdef NXMP_NETWORKSUPPORT
#include "HTTPDir.h"
#include "FTPDir.h"
#include "sshDir.h"
#include "sambaDir.h"
#include "nfsDir.h"
#endif
#ifdef NXMP_UPNPSUPPORT
#include "NX-UPNP.h"
#endif

#include "imgui_impl_sdl.h"

Expand All @@ -44,6 +55,8 @@ enum MENU_STATES {
MENU_STATE_HTTPBROWSER,
MENU_STATE_SSHBROWSER,
MENU_STATE_SAMBABROWSER,
MENU_STATE_NFSBROWSER,
MENU_STATE_UPNPBROWSER,
MENU_STATE_ENIGMABROWSER,
MENU_STATE_PLAYLISTBROWSER,
MENU_STATE_INFO,
Expand Down Expand Up @@ -137,17 +150,30 @@ typedef struct {


extern SDL_Window *window;
#ifdef _WIN32
extern bool fullscreen;
#endif
extern MenuItem item;

extern libMpv *libmpv;
extern localFs *localdir;
#ifdef NXMP_NETWORKSUPPORT
extern HTTPDir *httpdir;
extern FTPDir *ftpdir;
extern sshDir *sshdir;
extern sambaDir *sambadir;
#ifdef __SWITCH__
extern nfsDir *nfsdir;
#endif
#ifdef NXMP_UPNPSUPPORT
extern NXUPnP *nxupnp;
#endif
#ifdef NXMP_USBSUPPORT
extern USBMounter *usbmounter;
#endif
#ifdef NXMP_ENIGMASUPPORT
extern Enigma2 *enigma2;
#endif

extern uint32_t wakeup_on_mpv_render_update;
extern uint32_t wakeup_on_mpv_events;

Expand All @@ -159,8 +185,6 @@ extern bool renderloopdone;

extern std::string nxmpTitle;

extern Enigma2 *enigma2;

extern Config *configini;
extern EQPreset *eqpreset;
extern SQLiteDB *sqlitedb;
Expand All @@ -184,6 +208,8 @@ extern Tex FTPTexture;
extern Tex HTTPTexture;
extern Tex SFTPTexture;
extern Tex SMBTexture;
extern Tex NFSTexture;
extern Tex UPNPTexture;

extern Tex FFMPEGTexture;
extern Tex MPVTexture;
Expand Down
4 changes: 4 additions & 0 deletions include/libmpv.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class libMpv{
void setLoop(bool val);
bool getLoop();

void setAudioNormalize(bool val);
bool getAudioNormalize();

void getfileInfo();

void setShader(std::string _filename);
Expand All @@ -108,6 +111,7 @@ class libMpv{
fileInfo * fileinfo = nullptr;

bool loop = false;
bool audionorm = false;
int volume = 100;
int tmpvolume = 100;

Expand Down
2 changes: 1 addition & 1 deletion include/localfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace FS {
struct FileEntry{
std::string name;
std::string path;
size_t size = 0;
int64_t size = 0;
FileEntryType type = FileEntryType::Unknown;
bool checked = false;
};
Expand Down
27 changes: 27 additions & 0 deletions include/platforms.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef NXMP_PLATFORMS_H
#define NXMP_PLATFORMS_H

#ifdef _WIN32

#define NXMP_WIN32
#define NXMP_NETWORKSUPPORT
#define NXMP_UPNPSUPPORT
#define NXMP_ENIGMASUPPORT


#endif

#ifdef __SWITCH__



#define NXMP_SWITCH
#define NXMP_USBSUPPORT
#define NXMP_NETWORKSUPPORT
#define NXMP_UPNPSUPPORT
#define NXMP_ENIGMASUPPORT

#endif


#endif
1 change: 1 addition & 0 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace Utility{
urlschema parseUrl(std::string url);
bool compare(const remotefs_entry &a, const remotefs_entry &b);
bool TxtLoadFromFile(std::string filename, GLuint* out_texture, int* out_width, int* out_height);
bool TxtLoadFromMemory(unsigned char* data,size_t image_size, GLuint* out_texture, int* out_width, int* out_height);
std::string toLower(const std::string &str);
std::string toUpper(const std::string &str);
bool endsWith(const std::string &value, const std::string &ending, bool sensitive);
Expand Down
File renamed without changes.
File renamed without changes.
Binary file modified romfs/ftp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified romfs/http.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified romfs/network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added romfs/nfs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified romfs/sftp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified romfs/smb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added romfs/upnp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion source/UI/apppopups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Popups{
ImGui::Text("Start Playlist?");
ImVec2 button_size(ImGui::GetFontSize() * 7.0f, 0.0f);
if (ImGui::Button("Yes", button_size)) {
if(item.state == MENU_STATE_FILEBROWSER || item.state == MENU_STATE_USB ||item.state == MENU_STATE_FTPBROWSER || item.state == MENU_STATE_HTTPBROWSER || item.state == MENU_STATE_SSHBROWSER || item.state == MENU_STATE_SAMBABROWSER){
if(item.state == MENU_STATE_FILEBROWSER || item.state == MENU_STATE_USB ||item.state == MENU_STATE_FTPBROWSER || item.state == MENU_STATE_HTTPBROWSER || item.state == MENU_STATE_SSHBROWSER || item.state == MENU_STATE_SAMBABROWSER || item.state == MENU_STATE_NFSBROWSER){
item.popupstate = POPUP_STATE_NONE;
Playlist::playlist_struct nextfile = playlist->getPlaylist()[0];
libmpv->loadFile(nextfile.fulluri);
Expand Down
2 changes: 2 additions & 0 deletions source/UI/enigmaui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


namespace Windows {
#ifdef NXMP_ENIGMASUPPORT
void EnigmaWindow(bool *focus, bool *first_item) {
Windows::SetupWindow();
std::vector<std::string> topmenu = {"Local Files","Network","Enigma2"};
Expand Down Expand Up @@ -80,4 +81,5 @@ namespace Windows {
}
Windows::ExitWindow();
}
#endif
}
37 changes: 27 additions & 10 deletions source/UI/mainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,36 @@ namespace Windows {
for (unsigned int n = 0; n < topmenu.size(); n++){
std::string itemid = "##" + std::to_string(n);
if(topmenu[n] == "Local Files"){
ImGui::Image((void*)(intptr_t)SdCardTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)SdCardTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "USB"){
ImGui::Image((void*)(intptr_t)UsbTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)UsbTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "Network"){
ImGui::Image((void*)(intptr_t)NetworkTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)NetworkTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "UPNP"){
ImGui::Image((void*)(intptr_t)UPNPTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "Enigma2"){
ImGui::Image((void*)(intptr_t)Enigma2Texture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)Enigma2Texture.id, ImVec2(50,50));
}
else if(topmenu[n] == "Playlist"){
ImGui::Image((void*)(intptr_t)PlaylistTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)PlaylistTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "Info"){
ImGui::Image((void*)(intptr_t)InfoTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)InfoTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "Settings"){
ImGui::Image((void*)(intptr_t)SettingsTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)SettingsTexture.id, ImVec2(50,50));
}
else if(topmenu[n] == "Exit"){
ImGui::Image((void*)(intptr_t)ExitTexture.id, ImVec2(40,40));
ImGui::Image((void*)(intptr_t)ExitTexture.id, ImVec2(50,50));
}


ImGui::SameLine();
ImGui::SetCursorPos({ImGui::GetCursorPos().x, ImGui::GetCursorPos().y + (40 - ImGui::GetFont()->FontSize) / 2});
ImGui::SetCursorPos({ImGui::GetCursorPos().x, ImGui::GetCursorPos().y + (50 - ImGui::GetFont()->FontSize) / 2});

if (ImGui::Selectable(itemid.c_str(), selected == n)){
if(topmenu[n] == "Local Files"){
Expand All @@ -52,7 +55,7 @@ namespace Windows {
item.first_item = true;
}
if(topmenu[n] == "USB"){
#ifdef __SWITCH__
#ifdef NXMP_USBSUPPORT
usbInit();
item.state = MENU_STATE_USB;
if(usbmounter == nullptr){
Expand All @@ -62,13 +65,26 @@ namespace Windows {
#endif
}
if(topmenu[n] == "Network"){
#ifdef NXMP_NETWORKSUPPORT
item.networksources.clear();
item.networksources = configini->getNetworks();
item.state = MENU_STATE_NETWORKBROWSER;
item.first_item = true;
#endif

}
if(topmenu[n] == "UPNP"){
#ifdef NXMP_UPNPSUPPORT
printf("upnp selected\n");
fflush(stdout);
nxupnp = new NXUPnP();
nxupnp->Discovery();
item.state = MENU_STATE_UPNPBROWSER;
item.first_item = true;
#endif
}
if(topmenu[n] == "Enigma2"){
#ifdef NXMP_ENIGMASUPPORT
enigma2 = new Enigma2(configini->getEnigma());
item.first_item = true;
if(configini->getEnigma() == ""){
Expand All @@ -77,6 +93,7 @@ namespace Windows {
enigma2->getServices();
item.state = MENU_STATE_ENIGMABROWSER;
}
#endif
}
if(topmenu[n] == "Settings"){
configini->setLongSeek(configini->getLongSeek(false));
Expand Down
Loading

0 comments on commit 3297931

Please sign in to comment.