Skip to content

Commit

Permalink
v 0.5.0
Browse files Browse the repository at this point in the history
- SQLite database for positions resume
- New Player GUI
- EQ presets (in eqpresets.ini)
- HTTPS and HLS support
- FLAC extension added
- Fixed negative pos seek
- Added custom port support in Enigma2
- Changed event loop (to fix some bugs)
  • Loading branch information
proconsule committed Nov 13, 2021
1 parent a0c275c commit 31e9944
Show file tree
Hide file tree
Showing 42 changed files with 1,202 additions and 171 deletions.
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,20 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := libs/imgui libs/imgui/misc/freetype source source/UI source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
SOURCES := libs/imgui libs/imgui/misc/freetype source source/eqpreset source/database source/UI source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
DATA := data
INCLUDES := libs/simpleini libs/imgui include source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
INCLUDES := libs/simpleini libs/imgui include source/eqpreset source/database source/remotefs/Enigma2 source/localfs source/localfs/usb source/remotefs/ftplib source/remotefs/HTTPDir
ROMFS := romfs

VERSION_MAJOR := 0
VERSION_MINOR := 4
VERSION_MICRO := 1
VERSION_MINOR := 5
VERSION_MICRO := 0

APP_TITLE := NXMP
APP_AUTHOR := proconsule
APP_VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}


#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
Expand All @@ -61,7 +62,7 @@ CFLAGS := -g -Wall -Wno-sign-compare -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += `sdl2-config --cflags` `freetype-config --cflags`

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

CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_MICRO=$(VERSION_MICRO) -gdwarf-2 -gstrict-dwarf

Expand All @@ -71,7 +72,9 @@ 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 -lswscale -lswresample -lavformat -lavfilter -lavcodec -lavutil -llzma -lopus -lvpx -lass -lfreetype -lfribidi -lpng -lbz2 -lusbhsfs -lntfs-3g -llwext4 -lglad -lEGL -lglapi -ldrm_nouveau -ltinyxml2 -lturbojpeg -llua -lnx -lz
LIBS := `curl-config --libs` `sdl2-config --libs` `freetype-config --libs` -lmpv -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 -lnx -lz



#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
Expand Down Expand Up @@ -174,7 +177,17 @@ all: $(BUILD)

$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
ifneq (,$(findstring r,$(MAKEFLAGS)))
@echo "Stable Release"
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile BUILD_TYPE=-DRELEASE_TYPE=0
else
@echo "Beta Release"
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile BUILD_TYPE=-DRELEASE_TYPE=1

endif




#---------------------------------------------------------------------------------
clean:
Expand All @@ -197,6 +210,7 @@ DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
ifeq ($(strip $(APP_JSON)),)


all : $(OUTPUT).nro

ifeq ($(strip $(NO_NACP)),)
Expand Down
10 changes: 5 additions & 5 deletions Makefile.win32
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ BUILD := build-win32
TARGET := $(notdir $(CURDIR))

VERSION_MAJOR := 0
VERSION_MINOR := 2
VERSION_MICRO := 1
VERSION_MINOR := 5
VERSION_MICRO := 0

CFLAGS := -g -Wall -Wno-sign-compare -O2 -ffunction-sections
CFLAGS += `sdl2-config --cflags` `freetype-config --cflags`
Expand All @@ -20,11 +20,11 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -DIMGUI_IMPL_OPENGL_LOADER_GLAD \
-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_ENABLE_FREETYPE -fpermissive


LIBS := $(shell pkgconf mpv --libs --static) $(shell pkgconf libavcodec --libs --static) -lmpv `curl-config --libs` `sdl2-config --static-libs` `freetype-config --libs` -lswscale -lswresample -lavformat -lavfilter -lavcodec -lavutil -lfreetype -lfribidi -lpng -lbz2 -ltinyxml2 -llua5.1 -ldwmapi -llcms2 -lglfw3 -lopengl32 -lmingw32 -lSDLmain -lSDL2 -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid -lws2_32 -lavrt -lz
LIBS := ../../sqlite-snapshot-202111051952/.libs/libsqlite3.a $(shell pkgconf mpv --libs --static) $(shell pkgconf libavcodec --libs --static) -lmpv `curl-config --libs` `sdl2-config --static-libs` `freetype-config --libs` -lswscale -lswresample -lavformat -lavfilter -lavcodec -lavutil -lfreetype -lfribidi -lpng -lbz2 -ltinyxml2 -llua5.1 -ldwmapi -llcms2 -lglfw3 -lopengl32 -lmingw32 -lSDLmain -lSDL2 -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid -lws2_32 -lavrt -lz


SOURCES := libs/glad/src/ libs/imgui libs/imgui/misc/freetype source source/UI source/remotefs/Enigma2 source/remotefs/ftplib source/remotefs/HTTPDir
INCLUDES := /mingw64/include/ libs/glad/include libs/simpleini libs/imgui include source/remotefs/Enigma2 source/remotefs/ftplib source/remotefs/HTTPDir
SOURCES := libs/glad/src/ libs/imgui libs/imgui/misc/freetype source source/eqpreset source/database source/localfs source/localfs/usb source/UI source/remotefs/Enigma2 source/remotefs/ftplib source/remotefs/HTTPDir
INCLUDES := /mingw64/include/ source/localfs/usb source/localfs libs/glad/include libs/simpleini libs/imgui source/database source/eqpreset include source/remotefs/Enigma2 source/remotefs/ftplib source/remotefs/HTTPDir


ifneq ($(BUILD),$(notdir $(CURDIR)))
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Buttons Mapping
- R L ZR ZL (seek +/- during playback)
- \+ Exit NXMP
- R Stick Button Toggle Masterlock (during playback, only A button will work)
- Dpad Right (during playback show right menu)
- Dpad Left (during playback close right menu)
- Dpad Right (during playback show/hide right menu)
- Dpad Down (during playback show/hide player UI)
- R Stick Up/Down Fast Scroll on file list

FAQ
Expand All @@ -62,6 +62,8 @@ 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)
- 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
- docgold @ GBATemp forum for Enigma2 samples and support on decoders
- tataniko @ GBATemp forum for suggestions and bug hunting
- All guys on GBAtemp
1 change: 1 addition & 0 deletions include/apppopups.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Popups {
};

void SaveSettingsPopup(void);
void ResumePopup(void);
}

#endif
2 changes: 1 addition & 1 deletion include/appwindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Windows {
ImGui::PopStyleVar();
};

void FileBrowserWindow(bool *focus, bool first_item);
void FileBrowserWindow(bool *focus, bool *first_item);
void USBBrowserWindow(bool *focus, bool *first_item);
void EnigmaWindow(bool *focus, bool *first_item);
void MainMenuWindow(bool *focus, bool *first_item);
Expand Down
18 changes: 18 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class Config{
int getDeinterlace(bool tmpvalue);
void setDeinterlace(int value);

bool getDbActive(bool tmpvalue);
void setDbActive(bool value);

int getResumeStartPerc(bool tmpvalue);
void setResumeStartPerc(int value);
int getResumeStopPerc(bool tmpvalue);
void setResumeStopPerc(int value);

void saveSettings();

std::vector<std::string> topmenu;
Expand All @@ -52,6 +60,16 @@ class Config{
int tmpdeint;
int deint;


int tmpstartresumeperc;
int tmpstopresumeperc;
int startresumeperc;
int stopresumeperc;


bool tmpdbactive;
bool dbactive;

std::string inifilePath;
};

Expand Down
9 changes: 9 additions & 0 deletions include/fileInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class fileInfo {
int sample_rate;
int width;
int height;
bool albumart = false;
bool selected = false;
};

Expand All @@ -35,12 +36,20 @@ class fileInfo {
int aud_id = -1;
int sub_id = -1;
int position = 0;
int duration = 0;
std::string title;
std::string artist;
double getplayPerc(){
return (double)position/(double)duration;
}
bool islive = false;
};


std::string title = "Unknown";
std::string path;
long duration = 0;
long resume = 0;
int bit_rate = 0;
std::vector<Track> videos;
std::vector<Track> audios;
Expand Down
25 changes: 24 additions & 1 deletion include/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "remotefs.h"
#include "localfiles.h"
#include "SimpleIni.h"
#include "eqpreset.h"
#include "SQLiteDB.h"
#include "remotefs.h"
#include "localFs.h"
#include "utils.h"
Expand Down Expand Up @@ -47,7 +49,8 @@ enum PLAYER_STATES {

enum APP_POPUP_STATES {
POPUP_STATE_NONE,
POPUP_STATE_SAVE_SETTINGS
POPUP_STATE_SAVE_SETTINGS,
POPUP_STATE_RESUME
};

enum PLAYER_RIGHT_MENU_STATES {
Expand All @@ -67,12 +70,18 @@ enum PLAYER_RIGHT_MENU_STATES {
PLAYER_SUPERAUDIOEQ
};

enum PLAYER_CONTROL_STATES {
PLAYER_CONTROL_STATE_NONE,
PLAYER_CONTROL_STATE_CONTROLS
};


typedef struct {
MENU_STATES state = MENU_STATE_HOME;
MENU_STATES laststate = MENU_STATE_FILEBROWSER;
PLAYER_RIGHT_MENU_STATES rightmenustate = PLAYER_RIGHT_MENU_PLAYER;
PLAYER_STATES playerstate = PLAYER_STATE_VIDEO;
PLAYER_CONTROL_STATES playercontrolstate = PLAYER_CONTROL_STATE_NONE;
APP_POPUP_STATES popupstate = POPUP_STATE_NONE;
int selected = 0;
std::string usbpath = "";
Expand All @@ -81,6 +90,7 @@ typedef struct {

std::vector<networkSource> networksources;

float rightmenu_startpos = 1280.0;

bool networkselect = true;
int playershowcontrols = false;
Expand Down Expand Up @@ -121,6 +131,8 @@ extern std::string nxmpTitle;
extern Enigma2 *enigma2;

extern Config *configini;
extern EQPreset *eqpreset;
extern SQLiteDB *sqlitedb;

extern Tex SdCardTexture;
extern Tex UsbTexture;
Expand All @@ -142,6 +154,17 @@ extern Tex MPVTexture;
extern Tex NXMPBannerTexture;
extern Tex ExitTexture;


extern Tex PlayIcon;
extern Tex PauseIcon;
extern Tex StopIcon;
extern Tex MuteIcon;
extern Tex VolumeIcon;
extern Tex LoopIcon;
extern Tex NoLoopIcon;



extern ImFont* fontSmall;


Expand Down
20 changes: 19 additions & 1 deletion include/libmpv.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class libMpv{

~libMpv();

void loadFile(std::string _path);

void loadFileLive(std::string _path,std::string _changename = "");

void Pause();

void Resume();
Expand All @@ -35,6 +39,9 @@ class libMpv{
bool Paused();

int64_t getPosition();
int64_t getDuration();

int getFileInfoPerc();

int64_t getVideoWidth();
int64_t getVideoHeight();
Expand All @@ -56,21 +63,28 @@ class libMpv{
void setRotate(int value, bool osd);

void setVolume(int value,bool osd);

bool getMute();
void toggleMute();

void setAudioDelay(double value,bool osd);

void setAudioEQ(int *eqval,bool osd);
void setAudioSuperEQ(float *eqval,bool osd);
void setAudioSuperEQband(float eqval,int band,bool osd);

void setSubDelay(double value,bool osd);
void setSubPos(int value,bool osd);
void setSubFontSize(int value,bool osd);

void setDeinterlace(int value);


void setLoop(bool val);
bool getLoop();

void getfileInfo();



mpv_handle *getHandle();

Expand All @@ -87,6 +101,10 @@ class libMpv{
std::vector<decoderlist_struct> decoderlist;
fileInfo * fileinfo = nullptr;

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

};

#endif
1 change: 1 addition & 0 deletions include/localfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace FS {
std::vector<FileEntry> getDirList(const std::string &path,bool showHidden,const std::vector<std::string> &extensions);
std::string backPath(std::string path);
bool Sort(const FileEntry &entryA, const FileEntry &entryB);
std::string getFilefromPath(std::string path);
}

#endif
13 changes: 12 additions & 1 deletion include/playerwindows.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define NXMP_PLAYERWINDOWS_H

#include "imgui.h"
#include "gui.h"


namespace playerWindows{
Expand All @@ -13,8 +14,9 @@ namespace playerWindows{
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0,0.0,0.0,0.5));
}

static float rightmenuposX = 1280.0f;
inline void SetupRightWindow(void) {
ImGui::SetNextWindowPos(ImVec2(1080.0f, 0.0f), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(rightmenuposX, 0.0f), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(200.0f, 720.0f), ImGuiCond_Once);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0,0.0,0.0,0.5));
Expand All @@ -35,6 +37,13 @@ namespace playerWindows{
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0,0.0,0.0,0.5));
};

inline void SetupPlayerControlsWindow(void) {
ImGui::SetNextWindowPos(ImVec2(0.0f, 620.0f), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(1280.0f, 720.0f), ImGuiCond_Once);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0,0.0,0.0,0.5));
};

inline void ExitWindow(void) {
ImGui::End();
Expand All @@ -61,6 +70,8 @@ namespace playerWindows{

void CacheWindow();

void playerControls();

}

#endif
1 change: 1 addition & 0 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace Utility{
std::string ltrim(const std::string &s);
std::string rtrim(const std::string &s);
std::string trim(const std::string &s);
std::string truncateLen(std::string path,int len);
}

#endif
Empty file modified romfs/network.png
100755 → 100644
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/player/loop.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/player/mute.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/player/noloop.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/player/pause.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/player/play.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/player/stop.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/player/volume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified romfs/sdcard.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 31e9944

Please sign in to comment.