diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..cf7abd2 --- /dev/null +++ b/.clang-format @@ -0,0 +1,136 @@ +--- +Language: Cpp +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Right +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 144 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + - Regex: '.*' + Priority: 1 + SortPriority: 0 +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: true +IndentCaseLabels: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: All +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 1000 +PointerAlignment: Right +ReflowComments: false +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Latest +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 4 +UseCRLF: false +UseTab: Never +... diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..b17808b --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,9 @@ +--- +Checks: 'clang-analyzer-*,cppcoreguidelines-*,modernize-*,bugprone-*,performance-*,readability-*,readability-non-const-parameter,misc-const-correctness,misc-use-anonymous-namespace,google-explicit-constructor,-modernize-use-trailing-return-type,-bugprone-exception-escape,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-avoid-magic-numbers,-bugprone-easily-swappable-parameters,-cppcoreguidelines-non-private-member-variables-in-classes' +WarningsAsErrors: '' +HeaderFilterRegex: '' +CheckOptions: + - key: readability-magic-numbers.IgnoredFloatingPointValues + value: '0.0;1.0;100.0;' + - key: readability-magic-numbers.IgnoredIntegerValues + value: '0;1;2;3;4;5;6;7;8;9;' diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7fc84ba --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig is awesome: http://EditorConfig.org + +root = true + +[*] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true +insert_final_newline = true +end_of_line = lf + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c9a5f2b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# Set the default behavior for all files. +* text=auto eol=lf + +# Normalized and converts to native line endings on checkout. +*.c text +*.cc text +*.cxx +*.cpp text +*.h text +*.hxx text +*.hpp text diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..865dc49 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "Libraries/FsLib"] + path = Libraries/FsLib + url = https://github.com/J-D-K/FsLib.git +[submodule "Libraries/SDLLib"] + path = Libraries/SDLLib + url = https://github.com/J-D-K/SDLLib.git diff --git a/Include/AppStates/AppState.hpp b/Include/AppStates/AppState.hpp new file mode 100644 index 0000000..93c7fc3 --- /dev/null +++ b/Include/AppStates/AppState.hpp @@ -0,0 +1,46 @@ +#pragma once +#include "SDL.hpp" +#include + +class AppState +{ + public: + AppState(void) = default; + virtual ~AppState() = 0; + + virtual void Update(void) = 0; + virtual void Render(void) = 0; + + // Returns whether or not state is still active or can be purged. + bool IsActive(void) const + { + return m_IsActive; + } + + void Deactivate(void) + { + m_IsActive = false; + } + + void GiveFocus(void) + { + m_HasFocus = true; + } + + void TakeFocus(void) + { + m_HasFocus = false; + } + + // Returns whether state is at back of vector and has focus. + bool HasFocus(void) const + { + return m_HasFocus; + } + + private: + // Whether state is still active or can be purged. + bool m_IsActive = true; + // Whether or not state has focus + bool m_HasFocus = false; +}; diff --git a/Include/AppStates/ProgressState.hpp b/Include/AppStates/ProgressState.hpp new file mode 100644 index 0000000..24512de --- /dev/null +++ b/Include/AppStates/ProgressState.hpp @@ -0,0 +1,27 @@ +#pragma once +#include "AppStates/AppState.hpp" +#include "System/ProgressTask.hpp" +#include + +class ProgressState : public AppState +{ + public: + template + ProgressState(void (*Function)(Args...), Args... Arguments) : m_Task(Function, std::forward(Arguments)...){}; + ~ProgressState() {}; + + void Update(void); + void Render(void); + + private: + // Underlying progress tracking task. + System::ProgressTask m_Task; + // Progress as whole number instead of decimal. + size_t m_Progress = 0; + // Width of the green bar. The other is hard coded for 720px. + size_t m_ProgressBarWidth = 0; + // X coordinate of the percentage. + int m_PerentageX = 0; + // String for percentage. + std::string m_PercentageString; +}; diff --git a/Include/AppStates/TaskState.hpp b/Include/AppStates/TaskState.hpp new file mode 100644 index 0000000..f43c4a1 --- /dev/null +++ b/Include/AppStates/TaskState.hpp @@ -0,0 +1,18 @@ +#pragma once +#include "AppStates/AppState.hpp" +#include "System/Task.hpp" + +class TaskState : public AppState +{ + public: + template + TaskState(void (*Function)(Args...), Args... Arguments) : m_Task(Function, std::forward(Arguments)...){}; + ~TaskState() {}; + + void Update(void); + void Render(void); + + private: + // Underlying task. + System::Task m_Task; +}; diff --git a/Include/Colors.hpp b/Include/Colors.hpp new file mode 100644 index 0000000..f36b510 --- /dev/null +++ b/Include/Colors.hpp @@ -0,0 +1,16 @@ +#pragma once +#include "SDL.hpp" + +namespace Colors +{ + static constexpr SDL::Color White = {0xFFFFFFFF}; + static constexpr SDL::Color Black = {0x000000FF}; + static constexpr SDL::Color Red = {0xFF0000FF}; + static constexpr SDL::Color Green = {0x00FF00FF}; + static constexpr SDL::Color Blue = {0x0099EEFF}; + static constexpr SDL::Color Yellow = {0xF8FC00FF}; + static constexpr SDL::Color Pink = {0xFF4444FF}; + static constexpr SDL::Color ClearColor = {0x2D2D2DFF}; + static constexpr SDL::Color DialogBox = {0x505050FF}; + static constexpr SDL::Color BackgroundDim = {0x00000088}; +} // namespace Colors diff --git a/Include/Data/Data.hpp b/Include/Data/Data.hpp new file mode 100644 index 0000000..a241425 --- /dev/null +++ b/Include/Data/Data.hpp @@ -0,0 +1,6 @@ +#pragma once + +namespace Data +{ + bool Initialize(void); +} diff --git a/Include/Input.hpp b/Include/Input.hpp new file mode 100644 index 0000000..ea33776 --- /dev/null +++ b/Include/Input.hpp @@ -0,0 +1,11 @@ +#pragma once +#include + +namespace Input +{ + void Initialize(void); + void Update(void); + bool ButtonPressed(HidNpadButton Button); + bool ButtonHeld(HidNpadButton Button); + bool ButtonReleased(HidNpadButton Button); +} // namespace Input diff --git a/Include/JKSV.hpp b/Include/JKSV.hpp new file mode 100644 index 0000000..d1e8465 --- /dev/null +++ b/Include/JKSV.hpp @@ -0,0 +1,32 @@ +#pragma once +#include "AppStates/AppState.hpp" +#include "SDL.hpp" +#include +#include + +class JKSV +{ + public: + // Initializes JKSV. + JKSV(void); + // Exits JKSV + ~JKSV(); + // Returns whether or not JKSV is actually running. + bool IsRunning(void) const; + // Updates input and back of state vector. + void Update(void); + // Renders base of app and states of vector. + void Render(void); + // Pushes a new state to the back of state vector. + static void PushState(std::shared_ptr NewState); + + private: + // Whether or not initialization was successful. + bool m_IsRunning = false; + // Whether or not translation author wants to be acknowledged. + bool m_ShowTranslationInfo = false; + // Header icon + SDL::SharedTexture m_HeaderIcon = nullptr; + // Vector of states. + static inline std::vector> m_StateVector; +}; diff --git a/Include/JSON.hpp b/Include/JSON.hpp new file mode 100644 index 0000000..6080677 --- /dev/null +++ b/Include/JSON.hpp @@ -0,0 +1,16 @@ +#pragma once +#include +#include + +namespace JSON +{ + // Use this instead of default json_object + using Object = std::unique_ptr; + + // Use this instead of json_object_from_x. Pass the function and its arguments instead. + template + static inline JSON::Object NewObject(json_object *(*Function)(Args...), Args... Arguments) + { + return JSON::Object((*Function)(Arguments...), json_object_put); + } +} // namespace JSON diff --git a/Include/Logger.hpp b/Include/Logger.hpp new file mode 100644 index 0000000..dc8bf30 --- /dev/null +++ b/Include/Logger.hpp @@ -0,0 +1,7 @@ +#pragma once + +namespace Logger +{ + void Initialize(void); + void Log(const char *Format, ...); +} // namespace Logger diff --git a/Include/StringUtil.hpp b/Include/StringUtil.hpp new file mode 100644 index 0000000..8b85e01 --- /dev/null +++ b/Include/StringUtil.hpp @@ -0,0 +1,7 @@ +#pragma once +#include + +namespace StringUtil +{ + std::string GetFormattedString(const char *Format, ...); +} diff --git a/Include/Strings.hpp b/Include/Strings.hpp new file mode 100644 index 0000000..d723a81 --- /dev/null +++ b/Include/Strings.hpp @@ -0,0 +1,15 @@ +#pragma once +#include + +namespace Strings +{ + // Attempts to load strings from file in RomFS. + bool Initialize(void); + // Returns string with name and index. Returns nullptr if string doesn't exist. + const char *GetByName(std::string_view Name, int Index); + // Names of strings to prevent typos. + namespace Names + { + static constexpr std::string_view TranslationInfo = "TranslationInfo"; + } // namespace Names +} // namespace Strings diff --git a/Include/System/ProgressTask.hpp b/Include/System/ProgressTask.hpp new file mode 100644 index 0000000..01cc578 --- /dev/null +++ b/Include/System/ProgressTask.hpp @@ -0,0 +1,25 @@ +#pragma once +#include "System/Task.hpp" + +namespace System +{ + class ProgressTask : public System::Task + { + public: + template + ProgressTask(void (*Function)(System::ProgressTask *, Args...), Args... Arguments) + : System::Task(Function, this, std::forward(Arguments)...){}; + + // Resets current down to 0 and sets goal + void Reset(double Goal); + // Sets current value + void UpdateCurrent(double Current); + + // Returns progress + double GetCurrentProgress(void) const; + + private: + // Current value and goal + double m_Current, m_Goal; + }; +} // namespace System diff --git a/Include/System/Task.hpp b/Include/System/Task.hpp new file mode 100644 index 0000000..d44d34b --- /dev/null +++ b/Include/System/Task.hpp @@ -0,0 +1,46 @@ +#pragma once +#include +#include +#include + +namespace System +{ + class Task + { + public: + template + Task(void (*Function)(System::Task *, Args...), Args... Arguments) + { + m_Thread = std::thread(Function, this, std::forward(Arguments)...); + } + + // This is an alternate constructor that passes through a pointer to a derived class. + template + Task(void (*Function)(System::Task *, Args...), System::Task *Task, Args... Arguments) + { + m_Thread = std::thread(Function, Task, std::forward(Arguments)...); + } + + virtual ~Task(); + + // Returns if thread is still running. + bool IsRunning(void) const; + // Signals thread is finished running. + void Finished(void); + + // Sets status to display. + void SetStatus(const char *Format, ...); + // Returns status string. + std::string GetStatus(void); + + private: + // Whether task is still running. + bool m_IsRunning = true; + // Status string the thread can set that the main thread can display. + std::string m_Status; + // Mutex so that string doesn't get messed up. + std::mutex m_StatusLock; + // Thread + std::thread m_Thread; + }; +} // namespace System diff --git a/Include/UI/RenderFunctions.hpp b/Include/UI/RenderFunctions.hpp new file mode 100644 index 0000000..8a5cb3b --- /dev/null +++ b/Include/UI/RenderFunctions.hpp @@ -0,0 +1,9 @@ +#pragma once +#include "SDL.hpp" + +// These are just functions to render generic parts of the UI. +namespace UI +{ + void RenderDialogBox(SDL_Texture *Target, int X, int Y, int Width, int Height); + void RenderBoundingBox(SDL_Texture *Target, int X, int Y, int Width, int Height); +} // namespace UI diff --git a/Libraries/FsLib b/Libraries/FsLib new file mode 160000 index 0000000..960698b --- /dev/null +++ b/Libraries/FsLib @@ -0,0 +1 @@ +Subproject commit 960698b56f3088c6f5f549aceb94d4b66fb67d88 diff --git a/Libraries/SDLLib b/Libraries/SDLLib new file mode 160000 index 0000000..d25a582 --- /dev/null +++ b/Libraries/SDLLib @@ -0,0 +1 @@ +Subproject commit d25a582249299fee8bfbe59487f057b4a2e0d990 diff --git a/Makefile b/Makefile index 0a568f8..598383b 100644 --- a/Makefile +++ b/Makefile @@ -32,14 +32,14 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- TARGET := JKSV BUILD := build -SOURCES := src src/ui src/fs src/gfx +SOURCES := Source Source/AppStates Source/UI DATA := data -INCLUDES := inc inc/ui inc/fs inc/gfx +INCLUDES := Include ./Libraries/FsLib/Switch/FsLib/include ./Libraries/SDLLib/SDL/include EXEFS_SRC := exefs_src APP_TITLE := JKSV APP_AUTHOR := JK -APP_VERSION := 11.5.2024 -ROMFS := romfs +APP_VERSION := 12.05.2024 +ROMFS := RomFS ICON := icon.jpg #--------------------------------------------------------------------------------- @@ -51,12 +51,14 @@ override CFLAGS += $(INCLUDE) -D__SWITCH__ override CFLAGS += `sdl2-config --cflags` `freetype-config --cflags` `curl-config --cflags` override CFLAGS += -g -Wall -O2 -ffunction-sections -ffast-math $(ARCH) $(DEFINES) -CXXFLAGS:= $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17 +CXXFLAGS:= $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++23 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -LIBS := `sdl2-config --libs` `freetype-config --libs` `curl-config --libs` -lSDL2_image -lwebp -lpng -ljpeg -lz -lminizip -ljson-c -ltinyxml2 -lnx +LIBS := ../Libraries/FsLib/Switch/FsLib/lib/libFsLib.a ../Libraries/SDLLib/SDL/lib/libSDL.a \ + `sdl2-config --libs` `freetype-config --libs` `curl-config --libs` -lSDL2_image \ + -lwebp -lpng -ljpeg -lz -lminizip -ljson-c -ltinyxml2 -lnx #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing @@ -141,18 +143,30 @@ ifneq ($(ROMFS),) export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS) endif -.PHONY: $(BUILD) clean all +.PHONY: $(BUILD) FsLib SDLLib clean all #--------------------------------------------------------------------------------- -all: $(BUILD) +all: FsLib SDLLib $(BUILD) -$(BUILD): +$(BUILD): FsLib SDLLib @[ -d $@ ] || mkdir -p $@ @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile +#--------------------------------------------------------------------------------- + +FsLib: + @$(MAKE) -C ./Libraries/FsLib/Switch/FsLib/ + +#--------------------------------------------------------------------------------- + +SDLLib: + @$(MAKE) -C ./Libraries/SDLLib/SDL/ + #--------------------------------------------------------------------------------- clean: @echo clean ... + @$(MAKE) -C ./Libraries/FsLib clean + @$(MAKE) -C ./Libraries/SDLLib clean @rm -fr $(BUILD) $(TARGET).pfs0 $(TARGET).nso $(TARGET).nro $(TARGET).nacp $(TARGET).elf diff --git a/RomFS/Text/ENUS.json b/RomFS/Text/ENUS.json new file mode 100644 index 0000000..81f108a --- /dev/null +++ b/RomFS/Text/ENUS.json @@ -0,0 +1,6 @@ +{ + "TranslationInfo" : [ + "Translated By: %s", + "NULL" + ] +} diff --git a/RomFS/Textures/DialogCorners.png b/RomFS/Textures/DialogCorners.png new file mode 100644 index 0000000..01fc15e Binary files /dev/null and b/RomFS/Textures/DialogCorners.png differ diff --git a/RomFS/Textures/HeaderIcon.png b/RomFS/Textures/HeaderIcon.png new file mode 100644 index 0000000..f502f36 Binary files /dev/null and b/RomFS/Textures/HeaderIcon.png differ diff --git a/RomFS/Textures/MenuBounding.png b/RomFS/Textures/MenuBounding.png new file mode 100644 index 0000000..25f79f8 Binary files /dev/null and b/RomFS/Textures/MenuBounding.png differ diff --git a/Source/AppStates/ProgressState.cpp b/Source/AppStates/ProgressState.cpp new file mode 100644 index 0000000..cf021a3 --- /dev/null +++ b/Source/AppStates/ProgressState.cpp @@ -0,0 +1,18 @@ +#include "AppStates/ProgressState.hpp" +#include "Colors.hpp" +#include "SDL.hpp" +#include "StringUtil.hpp" +#include + +void ProgressState::Update(void) +{ + m_ProgressBarWidth = std::ceil(720.0f * m_Task.GetCurrentProgress()); + m_Progress = std::ceil(m_Task.GetCurrentProgress() * 100); + m_PercentageString = StringUtil::GetFormattedString("%u", m_Progress); + m_PerentageX = 640 - (SDL::Text::GetWidth(18, m_PercentageString.c_str())); +} + +void ProgressState::Render(void) +{ + SDL::RenderRectFill(NULL, 0, 0, 1280, 720, Colors::BackgroundDim); +} diff --git a/Source/AppStates/TaskState.cpp b/Source/AppStates/TaskState.cpp new file mode 100644 index 0000000..abc2cea --- /dev/null +++ b/Source/AppStates/TaskState.cpp @@ -0,0 +1,23 @@ +#include "AppStates/TaskState.hpp" +#include "Colors.hpp" +#include "SDL.hpp" + +void TaskState::Update(void) +{ + if (!m_Task.IsRunning()) + { + AppState::Deactivate(); + } +} + +void TaskState::Render(void) +{ + // Grab task string. + std::string Status = m_Task.GetStatus(); + // Center so it looks perty + int StatusX = 640 - (SDL::Text::GetWidth(18, Status.c_str()) / 2); + // Dim the background states. + SDL::RenderRectFill(NULL, 0, 0, 1280, 720, Colors::BackgroundDim); + // Render the status. + SDL::Text::Render(NULL, StatusX, 351, 18, SDL::Text::NO_TEXT_WRAP, Colors::White, Status.c_str()); +} diff --git a/Source/Input.cpp b/Source/Input.cpp new file mode 100644 index 0000000..425e417 --- /dev/null +++ b/Source/Input.cpp @@ -0,0 +1,32 @@ +#include "Input.hpp" + +namespace +{ + PadState s_Gamepad; +} + +void Input::Initialize(void) +{ + padConfigureInput(1, HidNpadStyleSet_NpadStandard); + padInitializeDefault(&s_Gamepad); +} + +void Input::Update(void) +{ + padUpdate(&s_Gamepad); +} + +bool Input::ButtonPressed(HidNpadButton Button) +{ + return (s_Gamepad.buttons_cur & Button) && !(s_Gamepad.buttons_old & Button); +} + +bool Input::ButtonHeld(HidNpadButton Button) +{ + return (s_Gamepad.buttons_cur & Button) && (s_Gamepad.buttons_old & Button); +} + +bool Input::ButtonReleased(HidNpadButton Button) +{ + return (s_Gamepad.buttons_old & Button) && !(s_Gamepad.buttons_cur & Button); +} diff --git a/Source/JKSV.cpp b/Source/JKSV.cpp new file mode 100644 index 0000000..c3e03bd --- /dev/null +++ b/Source/JKSV.cpp @@ -0,0 +1,141 @@ +#include "JKSV.hpp" +#include "Colors.hpp" +#include "FsLib.hpp" +#include "Input.hpp" +#include "Logger.hpp" +#include "SDL.hpp" +#include "Strings.hpp" +#include + +#include "UI/RenderFunctions.hpp" + +#define ABORT_ON_FAILURE(x) \ + if (!x) \ + { \ + return; \ + } + +namespace +{ + constexpr uint8_t BUILD_MON = 12; + constexpr uint8_t BUILD_DAY = 5; + constexpr uint16_t BUILD_YEAR = 2024; +} // namespace + +template +static bool InitializeService(Result (*Function)(Args...), const char *ServiceName, Args... Arguments) +{ + Result Error = (*Function)(Arguments...); + if (R_FAILED(Error)) + { + Logger::Log("Error initializing %s: 0x%X.", Error); + return false; + } + return true; +} + +JKSV::JKSV(void) +{ + ABORT_ON_FAILURE(FsLib::Initialize()); + // Need to init RomFS here for now until I update FsLib to take care of this. + ABORT_ON_FAILURE(InitializeService(romfsInit, "RomFS")); + // Let FsLib take care of calls to SDMC instead of fs_dev + ABORT_ON_FAILURE(FsLib::Dev::InitializeSDMC()); + // SDL + ABORT_ON_FAILURE(SDL::Initialize("JKSV", 1280, 720)); + ABORT_ON_FAILURE(SDL::Text::Initialize()); + + // Services. + // Using administrator so JKSV can still run in Applet mode. + ABORT_ON_FAILURE(InitializeService(accountInitialize, "Account", AccountServiceType_Administrator)); + ABORT_ON_FAILURE(InitializeService(nsInitialize, "NS")); + ABORT_ON_FAILURE(InitializeService(pdmqryInitialize, "PDMQry")); + ABORT_ON_FAILURE(InitializeService(plInitialize, "PL", PlServiceType_User)); + ABORT_ON_FAILURE(InitializeService(pmshellInitialize, "PMShell")); + ABORT_ON_FAILURE(InitializeService(setInitialize, "Set")); + ABORT_ON_FAILURE(InitializeService(setsysInitialize, "SetSys")); + ABORT_ON_FAILURE(InitializeService(socketInitializeDefault, "Socket")); + + // This needs Set. JKSV also has no internal strings anymore. This is FATAL now. + ABORT_ON_FAILURE(Strings::Initialize()); + + // Install/setup our color changing characters. + SDL::Text::AddColorCharacter(L'#', Colors::Blue); + SDL::Text::AddColorCharacter(L'*', Colors::Red); + SDL::Text::AddColorCharacter(L'<', Colors::Yellow); + SDL::Text::AddColorCharacter(L'>', Colors::Green); + + // This is to check whether the author wanted credit for their work. + m_ShowTranslationInfo = std::char_traits::compare(Strings::GetByName(Strings::Names::TranslationInfo, 1), "NULL", 4) != 0; + + // This can't be in an initializer list because it needs SDL initialized. + m_HeaderIcon = SDL::TextureManager::CreateLoadTexture("HeaderIcon", "romfs:/Textures/HeaderIcon.png"); + + Input::Initialize(); + + m_IsRunning = true; +} + +JKSV::~JKSV() +{ + socketExit(); + setsysExit(); + setExit(); + pmshellExit(); + plExit(); + pdmqryExit(); + nsExit(); + accountExit(); + SDL::Text::Exit(); + SDL::Exit(); + FsLib::Exit(); +} + +bool JKSV::IsRunning(void) const +{ + return m_IsRunning; +} + +void JKSV::Update(void) +{ + Input::Update(); + + if (Input::ButtonPressed(HidNpadButton_Plus)) + { + m_IsRunning = false; + } +} + +void JKSV::Render(void) +{ + SDL::FrameBegin(Colors::ClearColor); + // Top and bottom divider lines. + SDL::RenderLine(NULL, 30, 88, 1250, 88, Colors::White); + SDL::RenderLine(NULL, 30, 648, 1250, 648, Colors::White); + // Icon + m_HeaderIcon->Render(NULL, 66, 27); + // "JKSV" + SDL::Text::Render(NULL, 130, 32, 34, SDL::Text::NO_TEXT_WRAP, Colors::White, "JKSV"); + // Translation info in bottom left. + if (m_ShowTranslationInfo) + { + SDL::Text::Render(NULL, + 8, + 682, + 12, + SDL::Text::NO_TEXT_WRAP, + Colors::White, + Strings::GetByName(Strings::Names::TranslationInfo, 0), + Strings::GetByName(Strings::Names::TranslationInfo, 1)); + } + SDL::Text::Render(NULL, 8, 700, 12, SDL::Text::NO_TEXT_WRAP, Colors::White, "v %02d.%02d.%04d", BUILD_MON, BUILD_DAY, BUILD_YEAR); + + UI::RenderDialogBox(NULL, 320, 240, 320, 240); + + SDL::FrameEnd(); +} + +void JKSV::PushState(std::shared_ptr NewState) +{ + m_StateVector.push_back(NewState); +} diff --git a/Source/Logger.cpp b/Source/Logger.cpp new file mode 100644 index 0000000..60c7208 --- /dev/null +++ b/Source/Logger.cpp @@ -0,0 +1,32 @@ +#include "Logger.hpp" +#include "FsLib.hpp" +#include + +namespace +{ + // Path to log file. + FsLib::Path s_LogFilePath; + // Size of va buffer for log. + constexpr size_t VA_BUFFER_SIZE = 0x1000; +} // namespace + +void Logger::Initialize(void) +{ + // To do: Update this once config is implemented. + s_LogFilePath = "sdmc:/JKSV/JKSV.log"; + FsLib::File LogFile(s_LogFilePath, FsOpenMode_Create | FsOpenMode_Write); +} + +void Logger::Log(const char *Format, ...) +{ + char VaBuffer[VA_BUFFER_SIZE] = {0}; + + std::va_list VaList; + va_start(VaList, Format); + vsnprintf(VaBuffer, VA_BUFFER_SIZE, Format, VaList); + va_end(VaList); + + FsLib::File LogFile(s_LogFilePath, FsOpenMode_Append); + LogFile << VaBuffer << "\n"; + LogFile.Flush(); +} diff --git a/Source/Main.cpp b/Source/Main.cpp new file mode 100644 index 0000000..895a046 --- /dev/null +++ b/Source/Main.cpp @@ -0,0 +1,12 @@ +#include "JKSV.hpp" + +int main(void) +{ + JKSV Jksv; + while (Jksv.IsRunning()) + { + Jksv.Update(); + Jksv.Render(); + } + return 0; +} diff --git a/Source/StringUtil.cpp b/Source/StringUtil.cpp new file mode 100644 index 0000000..81935be --- /dev/null +++ b/Source/StringUtil.cpp @@ -0,0 +1,19 @@ +#include "StringUtil.hpp" +#include + +namespace +{ + constexpr size_t VA_BUFFER_SIZE = 0x1000; +} + +std::string StringUtil::GetFormattedString(const char *Format, ...) +{ + char VaBuffer[VA_BUFFER_SIZE]; + + std::va_list VaList; + va_start(VaList, Format); + vsnprintf(VaBuffer, VA_BUFFER_SIZE, Format, VaList); + va_end(VaList); + + return std::string(VaBuffer); +} diff --git a/Source/Strings.cpp b/Source/Strings.cpp new file mode 100644 index 0000000..6dac94b --- /dev/null +++ b/Source/Strings.cpp @@ -0,0 +1,90 @@ +#include "Strings.hpp" +#include "FsLib.hpp" +#include "JSON.hpp" +#include +#include +#include + +namespace +{ + // This is the actual map where the strings are. + std::map, std::string> s_StringMap; + // This map is for matching files to the language value + std::unordered_map s_FileMap = {{SetLanguage_JA, "JA.json"}, + {SetLanguage_ENUS, "ENUS.json"}, + {SetLanguage_FR, "FR.json"}, + {SetLanguage_DE, "DE.json"}, + {SetLanguage_IT, "IT.json"}, + {SetLanguage_ES, "ES.json"}, + {SetLanguage_ZHCN, "ZHCN.json"}, + {SetLanguage_KO, "KO.json"}, + {SetLanguage_NL, "NL.json"}, + {SetLanguage_PT, "PT.json"}, + {SetLanguage_RU, "RU.json"}, + {SetLanguage_ZHTW, "ZHTW.json"}, + {SetLanguage_ENGB, "ENGB.json"}, + {SetLanguage_FRCA, "FRCA.json"}, + {SetLanguage_ES419, "ES419.json"}, + {SetLanguage_ZHHANS, "ZHCN.json"}, + {SetLanguage_ZHHANT, "ZHTW.json"}, + {SetLanguage_PTBR, "PTBR.json"}}; +} // namespace + +static FsLib::Path GetStringFilePath(void) +{ + FsLib::Path ReturnPath = "romfs:/Text"; + + uint64_t LanguageCode = 0; + Result SetError = setGetLanguageCode(&LanguageCode); + if (R_FAILED(SetError)) + { + return ReturnPath / s_FileMap.at(SetLanguage_ENUS); + } + + SetLanguage Language; + SetError = setMakeLanguage(LanguageCode, &Language); + if (R_FAILED(SetError)) + { + return ReturnPath / s_FileMap.at(SetLanguage_ENUS); + } + return ReturnPath / s_FileMap.at(Language); +} + +bool Strings::Initialize() +{ + FsLib::Path StringsPath = GetStringFilePath(); + + JSON::Object TextJSON = JSON::NewObject(json_object_from_file, StringsPath.CString()); + if (!TextJSON) + { + return false; + } + + json_object_iterator StringIterator = json_object_iter_begin(TextJSON.get()); + json_object_iterator StringEnd = json_object_iter_end(TextJSON.get()); + while (!json_object_iter_equal(&StringIterator, &StringEnd)) + { + // Get name of string(s) and pointer to array + const char *StringName = json_object_iter_peek_name(&StringIterator); + json_object *StringArray = json_object_iter_peek_value(&StringIterator); + + // Loop through array and add them to map so I can be lazier and not have to edit code or do shit to add more strings. + size_t ArrayLength = json_object_array_length(StringArray); + for (size_t i = 0; i < ArrayLength; i++) + { + json_object *String = json_object_array_get_idx(StringArray, i); + s_StringMap[std::make_pair(StringName, static_cast(i))] = json_object_get_string(String); + } + json_object_iter_next(&StringIterator); + } + return true; +} + +const char *Strings::GetByName(std::string_view Name, int Index) +{ + if (s_StringMap.find(std::make_pair(Name.data(), Index)) == s_StringMap.end()) + { + return nullptr; + } + return s_StringMap.at(std::make_pair(Name.data(), Index)).c_str(); +} diff --git a/Source/System/ProgressTask.cpp b/Source/System/ProgressTask.cpp new file mode 100644 index 0000000..db1f974 --- /dev/null +++ b/Source/System/ProgressTask.cpp @@ -0,0 +1,16 @@ +#include "ProgressTask.hpp" + +void System::ProgressTask::Reset(double Goal) +{ + m_Goal = Goal; +} + +void System::ProgressTask::UpdateCurrent(double Current) +{ + m_Current = Current; +} + +double System::ProgressTask::GetCurrentProgress(void) const +{ + return m_Current / m_Goal; +} diff --git a/Source/System/Task.cpp b/Source/System/Task.cpp new file mode 100644 index 0000000..d820f7c --- /dev/null +++ b/Source/System/Task.cpp @@ -0,0 +1,41 @@ +#include "Task.hpp" +#include + +namespace +{ + constexpr size_t VA_BUFFER_SIZE = 0x1000; +} + +System::Task::~Task() +{ + m_Thread.join(); +} + +bool System::Task::IsRunning(void) const +{ + return m_IsRunning; +} + +void System::Task::Finished(void) +{ + m_IsRunning = false; +} + +void System::Task::SetStatus(const char *Format, ...) +{ + char VaBuffer[VA_BUFFER_SIZE]; + + std::va_list VaList; + va_start(VaList, Format); + vsnprintf(VaBuffer, VA_BUFFER_SIZE, Format, VaList); + va_end(VaList); + + std::scoped_lock StatusLock(m_StatusLock); + m_Status = VaBuffer; +} + +std::string System::Task::GetStatus(void) +{ + std::scoped_lock StatusLock(m_StatusLock); + return m_Status; +} diff --git a/Source/UI/RenderFunctions.cpp b/Source/UI/RenderFunctions.cpp new file mode 100644 index 0000000..21ab292 --- /dev/null +++ b/Source/UI/RenderFunctions.cpp @@ -0,0 +1,27 @@ +#include "UI/RenderFunctions.hpp" +#include "Colors.hpp" + +namespace +{ + SDL::SharedTexture s_DialogCorners = nullptr; + SDL::SharedTexture s_MenuBoundingCorners = nullptr; +} // namespace + +void UI::RenderDialogBox(SDL_Texture *Target, int X, int Y, int Width, int Height) +{ + if (!s_DialogCorners) + { + s_DialogCorners = SDL::TextureManager::CreateLoadTexture("DialogCorners", "romfs:/Textures/DialogCorners.png"); + } + + // Top + s_DialogCorners->RenderPart(Target, X, Y, 0, 0, 16, 16); + SDL::RenderRectFill(Target, X + 16, Y, Width - 32, 16, Colors::DialogBox); + s_DialogCorners->RenderPart(Target, (X + Width) - 16, Y, 16, 0, 16, 16); + // Middle + SDL::RenderRectFill(NULL, X, Y + 16, Width, Height - 32, Colors::DialogBox); + // Bottom + s_DialogCorners->RenderPart(Target, X, (Y + Height) - 16, 0, 16, 16, 16); + SDL::RenderRectFill(NULL, X + 16, (Y + Height) - 16, Width - 32, 16, Colors::DialogBox); + s_DialogCorners->RenderPart(NULL, (X + Width) - 16, (Y + Height) - 16, 16, 16, 16, 16); +} diff --git a/inc/cfg.h b/inc/cfg.h deleted file mode 100644 index 87c937f..0000000 --- a/inc/cfg.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace cfg -{ - typedef enum - { - ALPHA, - MOST_PLAYED, - LAST_PLAYED - } sortTypes; - - void resetConfig(); - void loadConfig(); - void saveConfig(); - - bool isBlacklisted(const uint64_t& tid); - void addTitleToBlacklist(void *a); - void removeTitleFromBlacklist(const uint64_t& tid); - - bool isFavorite(const uint64_t& tid); - void addTitleToFavorites(const uint64_t& tid); - - bool isDefined(const uint64_t& tid); - void pathDefAdd(const uint64_t& tid, const std::string& newPath); - std::string getPathDefinition(const uint64_t& tid); - - void addPathToFilter(const uint64_t& tid, const std::string& _p); - - extern std::unordered_map config; - extern std::vector blacklist; - extern std::vector favorites; - extern uint8_t sortType; - extern std::string driveClientID, driveClientSecret, driveRefreshToken; - extern std::string webdavOrigin, webdavBasePath, webdavUser, webdavPassword; -} diff --git a/inc/curlfuncs.h b/inc/curlfuncs.h deleted file mode 100644 index 3a5a7dc..0000000 --- a/inc/curlfuncs.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include - -#define HEADER_ERROR "ERROR" - -namespace curlFuncs -{ - typedef struct - { - FILE *f; - uint64_t *o; - } curlUpArgs; - - typedef struct - { - std::string path; - unsigned int size; - uint64_t *o; - } curlDlArgs; - - size_t writeDataString(const char *buff, size_t sz, size_t cnt, void *u); - size_t writeHeaders(const char *buff, size_t sz, size_t cnt, void *u); - size_t readDataFile(char *buff, size_t sz, size_t cnt, void *u); - size_t readDataBuffer(char *buff, size_t sz, size_t cnt, void *u); - size_t writeDataFile(const char *buff, size_t sz, size_t cnt, void *u); - size_t writeDataBuffer(const char *buff, size_t sz, size_t cnt, void *u); - - std::string getHeader(const std::string& _name, std::vector *h); - - //Shortcuts/legacy - std::string getJSONURL(std::vector *headers, const std::string& url); - bool getBinURL(std::vector *out, const std::string& url); -} diff --git a/inc/data.h b/inc/data.h deleted file mode 100644 index 4974270..0000000 --- a/inc/data.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once -#include - -#include -#include -#include - -#include "gfx.h" - -#define BLD_MON 11 -#define BLD_DAY 5 -#define BLD_YEAR 2024 - -namespace data -{ - //Loads user + title info - void init(); - void exit(); - bool loadUsersTitles(bool clearUsers); - void sortUserTitles(); - - //Draws some stats to the upper left corner - void dispStats(); - - //Global stuff for all titles/saves - typedef struct - { - NacpStruct nacp; - std::string title, safeTitle, author;//Shortcuts sorta. - SDL_Texture *icon = NULL; - bool fav; - } titleInfo; - - //Holds stuff specific to user's titles/saves - typedef struct - { - //Makes it easier to grab id - uint64_t tid; - FsSaveDataInfo saveInfo; - PdmPlayStatistics playStats; - } userTitleInfo; - - //Class to store user info + titles - class user - { - public: - user() = default; - user(const AccountUid& _id, const std::string& _backupName, const std::string& _safeBackupName); - user(const AccountUid& _id, const std::string& _backupName, const std::string& _safeBackupName, SDL_Texture *img); - - //Sets ID - void setUID(const AccountUid& _id); - - //Assigns icon - void assignIcon(SDL_Texture *_icn) { userIcon = _icn; } - - //Returns user ID - AccountUid getUID() const { return userID; } - u128 getUID128() const { return uID128; } - - //Returns username - std::string getUsername() const { return username; } - std::string getUsernameSafe() const { return userSafe; } - - SDL_Texture *getUserIcon(){ return userIcon; } - void delIcon(){ SDL_DestroyTexture(userIcon); } - - std::vector titleInfo; - void addUserTitleInfo(const uint64_t& _tid, const FsSaveDataInfo *_saveInfo, const PdmPlayStatistics *_stats); - - private: - AccountUid userID; - u128 uID128; - std::string username, userSafe; - //User icon - SDL_Texture *userIcon; - }; - - //User vector - extern std::vector users; - //Title data/info map - extern std::unordered_map titles; - - //Sets/Retrieves current user/title - void setUserIndex(unsigned _sUser); - data::user *getCurrentUser(); - unsigned getCurrentUserIndex(); - - void setTitleIndex(unsigned _sTitle); - data::userTitleInfo *getCurrentUserTitleInfo(); - unsigned getCurrentUserTitleInfoIndex(); - - //Gets pointer to info that also has title + nacp - data::titleInfo *getTitleInfoByTID(const uint64_t& tid); - - //More shortcut functions - std::string getTitleNameByTID(const uint64_t& tid); - std::string getTitleSafeNameByTID(const uint64_t& tid); - SDL_Texture *getTitleIconByTID(const uint64_t& tid); - int getTitleIndexInUser(const data::user& u, const uint64_t& tid); - extern SetLanguage sysLang; - -} diff --git a/inc/fs.h b/inc/fs.h deleted file mode 100644 index 99549c8..0000000 --- a/inc/fs.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include -#include - -#include "fs/fstype.h" -#include "fs/file.h" -#include "fs/dir.h" -#include "fs/zip.h" -#include "fs/fsfile.h" -#include "fs/remote.h" -#include "ui/miscui.h" - -#define BUFF_SIZE 0x4000 -#define ZIP_BUFF_SIZE 0x20000 -#define TRANSFER_BUFFER_LIMIT 0xC00000 - -namespace fs -{ - copyArgs *copyArgsCreate(const std::string& src, const std::string& dst, const std::string& dev, zipFile z, unzFile unz, bool _cleanup, bool _trimZipPath, uint8_t _trimPlaces); - void copyArgsDestroy(copyArgs *c); - - void init(); - bool mountSave(const FsSaveDataInfo& _m); - inline bool unmountSave() { return fsdevUnmountDevice("sv") == 0; } - bool commitToDevice(const std::string& dev); - std::string getWorkDir(); - void setWorkDir(const std::string& _w); - - //Loads paths to filter from backup/deletion - void loadPathFilters(const uint64_t& tid); - bool pathIsFiltered(const std::string& _path); - void freePathFilters(); - - void createSaveData(FsSaveDataType _type, uint64_t _tid, AccountUid _uid, threadInfo *t); - void createSaveDataThreaded(FsSaveDataType _type, uint64_t _tid, AccountUid _uid); - bool extendSaveData(const data::userTitleInfo *tinfo, uint64_t extSize, threadInfo *t); - void extendSaveDataThreaded(const data::userTitleInfo *tinfo, uint64_t extSize); - uint64_t getJournalSize(const data::userTitleInfo *tinfo); - uint64_t getJournalSizeMax(const data::userTitleInfo *tinfo); - - //Always threaded - void wipeSave(); - - void createNewBackup(void *a); - void overwriteBackup(void *a); - void restoreBackup(void *a); - void deleteBackup(void *a); - - void dumpAllUserSaves(void *a); - void dumpAllUsersAllSaves(void *a); - - void logOpen(); - void logWrite(const char *fmt, ...); -} diff --git a/inc/fs/dir.h b/inc/fs/dir.h deleted file mode 100644 index 7870cbe..0000000 --- a/inc/fs/dir.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include "type.h" - -namespace fs -{ - void mkDir(const std::string& _p); - void mkDirRec(const std::string& _p); - void delDir(const std::string& _p); - bool dirNotEmpty(const std::string& _dir); - bool isDir(const std::string& _path); - - //threadInfo is optional. Only for updating task status. - void copyDirToDir(const std::string& src, const std::string& dst, threadInfo *t); - void copyDirToDirThreaded(const std::string& src, const std::string& dst); - void copyDirToDirCommit(const std::string& src, const std::string& dst, const std::string& dev, threadInfo *t); - void copyDirToDirCommitThreaded(const std::string& src, const std::string& dst, const std::string& dev); - void getDirProps(const std::string& path, unsigned& dirCount, unsigned& fileCount, uint64_t& totalSize); - - class dirItem - { - public: - dirItem(const std::string& pathTo, const std::string& sItem); - std::string getItm() const { return itm; } - std::string getName() const; - std::string getExt() const; - bool isDir() const { return dir; } - - private: - std::string itm; - bool dir = false; - }; - - //Just retrieves a listing for _path and stores it in item vector - class dirList - { - public: - dirList() = default; - dirList(const std::string& _path, bool ignoreDotFiles = false); - void reassign(const std::string& _path); - void rescan(); - - std::string getItem(int index) const { return item[index].getItm(); } - std::string getItemExt(int index) const { return item[index].getExt(); } - bool isDir(int index) const { return item[index].isDir(); } - unsigned getCount() const { return item.size(); } - fs::dirItem *getDirItemAt(unsigned int _ind) { return &item[_ind]; } - - private: - std::string path; - std::vector item; - }; -} diff --git a/inc/fs/file.h b/inc/fs/file.h deleted file mode 100644 index 49b064e..0000000 --- a/inc/fs/file.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#include "fs.h" -#include "data.h" -#include "ui.h" - -namespace fs -{ - //Copy args are optional and only used if passed and threaded - void copyFile(const std::string& src, const std::string& dst, threadInfo *t); - void copyFileThreaded(const std::string& src, const std::string& dst); - void copyFileCommit(const std::string& src, const std::string& dst, const std::string& dev, threadInfo *t); - void copyFileCommitThreaded(const std::string& src, const std::string& dst, const std::string& dev); - void fileDrawFunc(void *a); - - //deletes file - void delfile(const std::string& _p); - - //Dumps all titles for current user - void dumpAllUserSaves(); - - void getShowFileProps(const std::string& _path); - void getShowDirProps(const std::string& _path); - - bool fileExists(const std::string& _path); - //Returns file size - size_t fsize(const std::string& _f); - - class dataFile - { - public: - dataFile(const std::string& _path); - ~dataFile(); - void close(){ fclose(f); } - - bool isOpen() const { return opened; } - - bool readNextLine(bool proc); - //Finds where variable name ends. When a '(' or '=' is hit. Strips spaces - void procLine(); - std::string getLine() const { return line; } - std::string getName() const { return name; } - //Reads until ';', ',', or '\n' is hit and returns as string. - std::string getNextValueStr(); - int getNextValueInt(); - - private: - FILE *f; - std::string line, name; - size_t lPos = 0; - bool opened = false; - }; - - void logOpen(); - void logWrite(const char *fmt, ...); - void logClose(); -} diff --git a/inc/fs/fsfile.h b/inc/fs/fsfile.h deleted file mode 100644 index c84be82..0000000 --- a/inc/fs/fsfile.h +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include -#include - -//Bare minimum wrapper around switch fs for JKSV -#define FS_SEEK_SET 0 -#define FS_SEEK_CUR 1 -#define FS_SEEK_END 2 - -#ifdef __cplusplus -extern "C" -{ -#endif -typedef struct -{ - FsFile _f; - Result error; - s64 offset, fsize; -} FSFILE; - -int fsremove(const char *_p); -Result fsDelDirRec(const char *_p); - -char *getDeviceFromPath(char *dev, size_t _max, const char *path); -char *getFilePath(char *pathOut, size_t _max, const char *path); - -bool fsMkDir(const char *_p); - -/*Opens file. Device is fetched from path. Libnx romfs doesn't work with this. -Mode needs to be: - FsOpenMode_Read - FsOpenMode_Write - FsOpenMode_Append -*/ -bool fsfcreate(const char *_p, int64_t crSize); - -FSFILE *fsfopen(const char *_p, uint32_t mode); - -/*Same as above, but FsFileSystem _s is used. Path cannot have device in it*/ -FSFILE *fsfopenWithSystem(FsFileSystem *_s, const char *_p, uint32_t mode); - -//Closes _f -inline void fsfclose(FSFILE *_f) -{ - if(_f != NULL) - { - fsFileClose(&_f->_f); - free(_f); - } -} - -//Seeks like stdio -inline void fsfseek(FSFILE *_f, int offset, int origin) -{ - switch(origin) - { - case FS_SEEK_SET: - _f->offset = offset; - break; - - case FS_SEEK_CUR: - _f->offset += offset; - break; - - case FS_SEEK_END: - _f->offset = offset + _f->fsize; - break; - } -} - -//Returns offset -inline size_t fsftell(FSFILE *_f) { return _f->offset; } - -//Writes buf to file. Automatically resizes _f to fit buf -size_t fsfwrite(const void *buf, size_t sz, size_t count, FSFILE *_f); - -//Reads to buff -inline size_t fsfread(void *buf, size_t sz, size_t count, FSFILE *_f) -{ - uint64_t read = 0; - _f->error = fsFileRead(&_f->_f, _f->offset, buf, sz * count, 0, &read); - _f->offset += read; - return read; -} - -//Gets byte from file -inline char fsfgetc(FSFILE *_f) -{ - char ret = 0; - uint64_t read = 0; - _f->error = fsFileRead(&_f->_f, _f->offset++, &ret, 1, 0, &read); - return ret; -} - -//Writes byte to file -inline void fsfputc(int ch, FSFILE *_f) { fsfwrite(&ch, 1, 1, _f); } -#ifdef __cplusplus -} -#endif diff --git a/inc/fs/fstype.h b/inc/fs/fstype.h deleted file mode 100644 index 4f9e2d5..0000000 --- a/inc/fs/fstype.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include "data.h" -#include "miscui.h" -#include "type.h" - -namespace fs -{ - typedef struct - { - std::string src, dst, dev; - zipFile z; - unzFile unz; - bool cleanup = false, trimZipPath = false; - uint8_t trimZipPlaces = 0; - uint64_t offset = 0; - ui::progBar *prog; - threadStatus *thrdStatus; - Mutex arglck = 0; - void argLock() { mutexLock(&arglck); } - void argUnlock() { mutexUnlock(&arglck); } - } copyArgs; - - typedef struct - { - FsSaveDataType type; - uint64_t tid; - AccountUid account; - uint16_t index; - } svCreateArgs; - - typedef struct - { - const data::userTitleInfo *tinfo; - uint64_t extSize; - } svExtendArgs; - - typedef struct - { - std::string path; - bool origin = false; - unsigned dirCount = 0; - unsigned fileCount = 0; - uint64_t totalSize = 0; - } dirCountArgs; -} diff --git a/inc/fs/remote.h b/inc/fs/remote.h deleted file mode 100644 index 1b05b35..0000000 --- a/inc/fs/remote.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "../rfs.h" - -#define JKSV_DRIVE_FOLDER "JKSV" - -namespace fs -{ - extern rfs::IRemoteFS *rfs; - extern std::string rfsRootID; - - void remoteInit(); - void remoteExit(); - - // Google Drive - void driveInit(); - std::string driveSignInGetAuthCode(); - - // Webdav - void webDavInit(); -} \ No newline at end of file diff --git a/inc/fs/zip.h b/inc/fs/zip.h deleted file mode 100644 index 4f8afb5..0000000 --- a/inc/fs/zip.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "type.h" - -namespace fs -{ - //threadInfo is optional and only used when threaded versions are used - void copyDirToZip(const std::string& src, zipFile dst, bool trimPath, int trimPlaces, threadInfo *t); - void copyDirToZipThreaded(const std::string& src, zipFile dst, bool trimPath, int trimPlaces); - void copyZipToDir(unzFile src, const std::string& dst, const std::string& dev, threadInfo *t); - void copyZipToDirThreaded(unzFile src, const std::string& dst, const std::string& dev); - uint64_t getZipTotalSize(unzFile unz); - bool zipNotEmpty(unzFile unz); -} diff --git a/inc/gd.h b/inc/gd.h deleted file mode 100644 index 3e735cc..0000000 --- a/inc/gd.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include - -#include "curlfuncs.h" -#include "rfs.h" - -#define HEADER_CONTENT_TYPE_APP_JSON "Content-Type: application/json; charset=UTF-8" -#define HEADER_AUTHORIZATION "Authorization: Bearer " - -#define MIMETYPE_FOLDER "application/vnd.google-apps.folder" - -namespace drive -{ - class gd : public rfs::IRemoteFS - { - public: - void setClientID(const std::string& _clientID) { clientID = _clientID; } - void setClientSecret(const std::string& _clientSecret) { secretID = _clientSecret; } - void setRefreshToken(const std::string& _refreshToken) { rToken = _refreshToken; } - - bool exhangeAuthCode(const std::string& _authCode); - bool hasToken() { return token.empty() == false; } - bool refreshToken(); - bool tokenIsValid(); - - void clearDriveList() { driveList.clear(); } - // TODO: This also gets files that do not belong to JKSV - void driveListInit(const std::string& _q); - void driveListAppend(const std::string& _q); - std::vector getListWithParent(const std::string& _parent); - void debugWriteList(); - - bool createDir(const std::string& _dirName, const std::string& _parent); - // TODO: This is problematic, because multiple files could share the same name without a parent. - bool dirExists(const std::string& _dirName); - bool dirExists(const std::string& _dirName, const std::string& _parent); - - bool fileExists(const std::string& _filename, const std::string& _parent); - void uploadFile(const std::string& _filename, const std::string& _parent, curlFuncs::curlUpArgs *_upload); - void updateFile(const std::string& _fileID, curlFuncs::curlUpArgs *_upload); - void downloadFile(const std::string& _fileID, curlFuncs::curlDlArgs *_download); - void deleteFile(const std::string& _fileID); - - std::string getClientID() const { return clientID; } - std::string getClientSecret() const { return secretID; } - std::string getRefreshToken() const { return rToken; } - - std::string getFileID(const std::string& _name, const std::string& _parent); - // TODO: This is problematic, because multiple files could share the same name without a parent. - std::string getDirID(const std::string& _name); - std::string getDirID(const std::string& _name, const std::string& _parent); - - size_t getDriveListCount() const { return driveList.size(); } - rfs::RfsItem *getItemAt(unsigned int _ind) { return &driveList[_ind]; } - - private: - std::vector driveList; - std::string clientID, secretID, token, rToken; - }; -} \ No newline at end of file diff --git a/inc/gfx.h b/inc/gfx.h deleted file mode 100644 index 19317ed..0000000 --- a/inc/gfx.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include -#include "textureMgr.h" - -namespace gfx -{ - extern SDL_Renderer *render; - extern gfx::textureMgr *texMgr; - - void init(); - void exit(); - void present(); - - void drawTextf(SDL_Texture *target, int fontSize, int x, int y, const SDL_Color *c, const char *fmt, ...); - void drawTextfWrap(SDL_Texture *target, int fontSize, int x, int y, int maxWidth, const SDL_Color* c, const char *fmt, ...); - size_t getTextWidth(const char *str, int fontSize); - - //Shortcuts for drawing - void texDraw(SDL_Texture *target, SDL_Texture *tex, int x, int y); - void texDrawStretch(SDL_Texture *target, SDL_Texture *tex, int x, int y, int w, int h); - void texDrawPart(SDL_Texture *target, SDL_Texture *tex, int srcX, int srcY, int srcW, int srcH, int dstX, int dstY); - void drawLine(SDL_Texture *target, const SDL_Color *c, int x1, int y1, int x2, int y2); - void drawRect(SDL_Texture *target, const SDL_Color *c, int x, int y, int w, int h); - void clearTarget(SDL_Texture *target, const SDL_Color *clear); -} diff --git a/inc/gfx/textureMgr.h b/inc/gfx/textureMgr.h deleted file mode 100644 index 62002b7..0000000 --- a/inc/gfx/textureMgr.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include - -/*Texture manager class -Keeps pointers to ALL textures so it is not possible to forget to free them. Also keeps code a little easier to read. A little.*/ - -typedef enum -{ - IMG_FMT_PNG, - IMG_FMT_JPG, - IMG_FMT_BMP -} imgTypes; - -namespace gfx -{ - class textureMgr - { - public: - textureMgr() = default; - ~textureMgr(); - - void textureAdd(SDL_Texture *_tex); - SDL_Texture *textureCreate(int _w, int _h); - SDL_Texture *textureLoadFromFile(const char *_path); - SDL_Texture *textureLoadFromMem(imgTypes _type, const void *_dat, size_t _datSize); - void textureResize(SDL_Texture **_tex, int _w, int _h); - - private: - std::vector textures; - }; -} diff --git a/inc/rfs.h b/inc/rfs.h deleted file mode 100644 index f098f89..0000000 --- a/inc/rfs.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include -#include "curlfuncs.h" -#include - -#define UPLOAD_BUFFER_SIZE 0x8000 -#define DOWNLOAD_BUFFER_SIZE 0xC00000 -#define USER_AGENT "JKSV" - -namespace rfs { - - typedef struct - { - std::string name, id, parent; - bool isDir = false; - unsigned int size; - } RfsItem; - - class IRemoteFS - { - public: - virtual ~IRemoteFS() {} // Virtual destructor to allow correct deletion through the base class pointer - - virtual bool createDir(const std::string& _dirName, const std::string& _parent) = 0; - virtual bool dirExists(const std::string& _dirName, const std::string& _parent) = 0; - virtual bool fileExists(const std::string& _filename, const std::string& _parent) = 0; - virtual void uploadFile(const std::string& _filename, const std::string& _parent, curlFuncs::curlUpArgs *_upload) = 0; - virtual void updateFile(const std::string& _fileID, curlFuncs::curlUpArgs *_upload) = 0; - virtual void downloadFile(const std::string& _fileID, curlFuncs::curlDlArgs *_download) = 0; - virtual void deleteFile(const std::string& _fileID) = 0; - - virtual std::string getFileID(const std::string& _name, const std::string& _parent) = 0; - virtual std::string getDirID(const std::string& _name, const std::string& _parent) = 0; - - virtual std::vector getListWithParent(const std::string& _parent) = 0; - }; - - // Shared multi-threading definitions - typedef struct - { - curlFuncs::curlDlArgs *cfa; - std::mutex dataLock; - std::condition_variable cond; - std::vector sharedBuffer; - bool bufferFull = false; - unsigned int downloaded = 0; - } dlWriteThreadStruct; - - extern std::vector downloadBuffer; - void writeThread_t(void *a); - size_t writeDataBufferThreaded(uint8_t *buff, size_t sz, size_t cnt, void *u); -} diff --git a/inc/type.h b/inc/type.h deleted file mode 100644 index d1dcc6f..0000000 --- a/inc/type.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include -#include - -//Misc stuff for new menu code -typedef void (*funcPtr)(void *); - -class threadStatus -{ - public: - void setStatus(const char *fmt, ...); - void getStatus(std::string& statusOut); - - private: - Mutex statusLock = 0; - std::string status; -}; - -typedef struct -{ - bool running = false, finished = false; - Thread thrd; - ThreadFunc thrdFunc; - void *argPtr = NULL; - funcPtr drawFunc = NULL;//Draw func is passed threadInfo pointer too - threadStatus *status; -} threadInfo; diff --git a/inc/ui.h b/inc/ui.h deleted file mode 100644 index f76427a..0000000 --- a/inc/ui.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "data.h" -#include "gfx.h" - -//ui headers - split up to keep a bit more organized -#include "ui/miscui.h" -#include "ui/uistr.h" -#include "ui/ttlview.h" -#include "ui/thrdProc.h" -#include "ui/sldpanel.h" -#include "ui/usr.h" -#include "ui/ttl.h" -#include "ui/fld.h" -#include "ui/sett.h" -#include "ui/ext.h" -#include "ui/fm.h" - -enum menuState -{ - USR_SEL, - TTL_SEL, - ADV_MDE, - EX_MNU, - OPT_MNU, - FIL_MDE -}; - -namespace ui -{ - //Current menu/ui state - extern int mstate, prevState; - - //Slide/animation scaling - extern float animScale; - - //Loading glyph - extern const std::string loadGlyphArray[]; - - //pad data cause i don't know where else to put it - extern PadState pad; - extern HidTouchScreenState touchState; - static inline void updateInput() { touchState = {0}; padUpdate(&pad); hidGetTouchScreenStates(&touchState, 1); } - inline uint64_t padKeysDown() { return padGetButtonsDown(&pad); } - inline uint64_t padKeysHeld() { return padGetButtons(&pad); } - inline uint64_t padKeysUp() { return padGetButtonsUp(&pad); } - - inline void changeState(int newState) - { - prevState = mstate; - mstate = newState; - } - - //Holds theme set id - extern ColorSetId thmID; - - //Both UI modes need access to this - extern std::string folderMenuInfo; - - /*Colors - clearClr = color to clear buffer - txtCont = text that contrasts clearClr - txtDiag = text color for dialogs - */ - extern SDL_Color clearClr, transparent, txtCont, txtDiag, rectLt, rectSh, tboxClr, sideRect, divClr, heartColor, slidePanelColor; - - //Textbox graphics - extern SDL_Texture *cornerTopLeft, *cornerTopRight, *cornerBottomLeft, *cornerBottomRight; - //Menu bounding - extern SDL_Texture *mnuTopLeft, *mnuTopRight, *mnuBotLeft, *mnuBotRight; - - //Covers left and right of progress bar to fake being not a rectangle. - extern SDL_Texture *progCovLeft, *progCovRight, *diaBox; - - //Side bar from Freebird. RIP. - extern SDL_Texture *sideBar; - - //Sets colors and loads font for icon creation - void initTheme(); - - //Loads graphics and stuff - void init(); - void exit(); - - //Inits HID - void hidInit(); - - //Adds a panel pointer to a vector since they need to be drawn over everything else - int registerMenu(ui::menu *m); - int registerPanel(ui::slideOutPanel *sop); - threadInfo *newThread(ThreadFunc func, void *args, funcPtr _drawFunc); - - //Just draws a screen and flips JIC boot takes long. - void showLoadScreen(); - - //Clears and draws general stuff used by multiple screens - void drawUI(); - - //switch case so we don't have problems with multiple main loops like 3DS - bool runApp(); - - void showPopMessage(int frameCount, const char *fmt, ...); - - //Used for multiple menu functions/callback - void toTTL(void *); -} diff --git a/inc/ui/ext.h b/inc/ui/ext.h deleted file mode 100644 index 5785572..0000000 --- a/inc/ui/ext.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -namespace ui -{ - extern ui::menu *extMenu; - void extInit(); - void extExit(); - void extUpdate(); - void extDraw(SDL_Texture *target); -} diff --git a/inc/ui/fld.h b/inc/ui/fld.h deleted file mode 100644 index aed957f..0000000 --- a/inc/ui/fld.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "ui.h" -#include "dir.h" - -namespace ui -{ - //extern ui::menu *fldMenu; - extern ui::slideOutPanel *fldPanel; - //extern fs::dirList *fldList; - - void fldInit(); - void fldExit(); - void fldUpdate(); - - //Populate to open menu, refresh for updating after actions - void fldPopulateMenu(); - void fldRefreshMenu(); -} \ No newline at end of file diff --git a/inc/ui/fm.h b/inc/ui/fm.h deleted file mode 100644 index e9dcfac..0000000 --- a/inc/ui/fm.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -namespace ui -{ - void fmInit(); - void fmExit(); - void fmPrep(const FsSaveDataType& _type, const std::string& _dev, const std::string& _baseSDMC, bool _commit); - void fmUpdate(); - void fmDraw(SDL_Texture *target); -} diff --git a/inc/ui/miscui.h b/inc/ui/miscui.h deleted file mode 100644 index e482669..0000000 --- a/inc/ui/miscui.h +++ /dev/null @@ -1,165 +0,0 @@ -#pragma once - -#include -#include - -#include "type.h" -#include "gfx.h" - -#define POP_FRAME_DEFAULT 130 - -#define MENU_FONT_SIZE_DEFAULT 18 -#define MENU_MAX_SCROLL_DEFAULT 15 - -typedef enum -{ - MENU_X, - MENU_Y, - MENU_RECT_WIDTH, - MENU_RECT_HEIGHT, - MENU_FONT_SIZE, - MENU_MAX_SCROLL -} menuParams; - -//For smaller classes that aren't easy to get lost in and general functions -namespace ui -{ - typedef struct - { - std::string text; - bool hold; - funcPtr confFunc, cancelFunc; - void *args; - unsigned lgFrame = 0, frameCount = 0;//To count frames cause I don't have time and am lazy - } confirmArgs; - - typedef struct - { - funcPtr func = NULL; - void *args = NULL; - HidNpadButton button = (HidNpadButton)0; - } menuOptEvent; - - typedef struct - { - SDL_Texture *icn = NULL; - std::string txt; - int txtWidth; - std::vector events; - } menuOpt; - - class menu - { - public: - menu() = default; - menu(const int& _x, const int& _y, const int& _rW, const int& _fS, const int& _mL); - void editParam(int _param, int newVal); - - //Gets executed when menu changes at all - void setOnChangeFunc(funcPtr func) { onChange = func; } - - //executed when .update() is called. - void setCallback(funcPtr _callback, void *args) { callback = _callback; callbackArgs = args; } - - //Adds option. - int addOpt(SDL_Texture *_icn, const std::string& add); - - //Adds an function to be executed on pressing button specified - void optAddButtonEvent(unsigned _ind, HidNpadButton _button, funcPtr _func, void *args); - //Changes opt text - void editOpt(int ind, SDL_Texture *_icn, const std::string& ch); - size_t getOptCount() { return opt.size(); } - int getOptPos(const std::string& txt); - - //Clears menu stuff - ~menu(); - - //Handles controller input and executes functions for buttons if they're set - void update(); - - //Returns selected option - int getSelected() { return selected; } - - //Returns menu option count - int getCount() { return opt.size(); } - - //Draws the menu at x and y. rectWidth is the width of the rectangle drawn under the selected - void draw(SDL_Texture *target, const SDL_Color *textClr, bool drawText); - - //Clears and resets menu - void reset(); - - //Resets selected + start - void resetSel() { selected = 0; } - - //Enables control/disables drawing select box - void setActive(bool _set); - bool getActive() { return isActive; } - - private: - //drawing x and y + rectangle width/height. Height is calc'd with font size - int x = 0, mY = 0, tY = 0, y = 0, rW = 0, rY = 0, fSize = 0, rH = 0, mL = 0; - //Options vector - std::vector opt; - //Selected + frame counting for auto-scroll. Hover count is to not break autoscroll - int selected = 0, fc = 0, hoverCount = 0, spcWidth = 0; - //How much we shift the color of the rectangle - uint8_t clrSh = 0; - bool clrAdd = true, isActive = true, hover = false; - //Option buffer. Basically, text is draw to this so it can't overlap. Also allows scrolling - SDL_Texture *optTex; - funcPtr onChange = NULL, callback = NULL; - void *callbackArgs, *funcArgs; - }; - - //Progress bar for showing loading. Mostly so people know it didn't freeze - class progBar - { - public: - //Constructor. _max is the maximum value - progBar() = default; - progBar(const uint64_t& _max) { max = _max; } - - void setMax(const uint64_t& _max) { max = _max; }; - - //Updates progress - void update(const uint64_t& _prog); - - //Draws with text at top - void draw(const std::string& text); - - private: - uint64_t max = 0, prog = 0; - float width = 0; - }; - - typedef struct - { - std::string message; - int rectWidth = 0, frames = 0, y = 720; - } popMessage; - - class popMessageMngr - { - public: - ~popMessageMngr(); - - void update(); - - void popMessageAdd(const std::string& mess, int frameTime); - void draw(); - - private: - std::vector popQueue;//All graphics need to be on main thread. Directly adding will cause text issues - std::vector message; - }; - - //General use - ui::confirmArgs *confirmArgsCreate(bool _hold, funcPtr _confFunc, funcPtr _cancelFunc, void *_funcArgs, const char *fmt, ...); - void confirm(void *a); - void showMessage(const char *fmt, ...); - bool confirmTransfer(const std::string& f, const std::string& t); - bool confirmDelete(const std::string& p); - void drawBoundBox(SDL_Texture *target, int x, int y, int w, int h, uint8_t clrSh); - void drawTextbox(SDL_Texture *target, int x, int y, int w, int h); -} diff --git a/inc/ui/sett.h b/inc/ui/sett.h deleted file mode 100644 index 38b1d7b..0000000 --- a/inc/ui/sett.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include - -namespace ui -{ - void settInit(); - void settExit(); - void settUpdate(); - void settDraw(SDL_Texture *target); - - extern ui::menu *settMenu; -} diff --git a/inc/ui/sldpanel.h b/inc/ui/sldpanel.h deleted file mode 100644 index 3476722..0000000 --- a/inc/ui/sldpanel.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -namespace ui -{ - //Maybe more later *if* needed, but not now. - typedef enum - { - SLD_LEFT, - SLD_RIGHT - } slidePanelOrientation; - - //_draw is called and passed the panel texture/target when this.draw() is called. - class slideOutPanel - { - public: - slideOutPanel(int _w, int _h, int _y, slidePanelOrientation _side, funcPtr _draw); - - void resizePanel(int _w, int _h, int _y); - void update(); - void setCallback(funcPtr _cb, void *_args) { callback = _cb; cbArgs = _args; } - void openPanel() { open = true; } - void closePanel() { open = false; } - void setX(int _nX){ x = _nX; }; - bool isOpen() { return open; } - void draw(const SDL_Color *backCol); - - private: - int w, h, x, y; - uint8_t sldSide; - bool open = false; - SDL_Texture *panel; - funcPtr drawFunc, callback = NULL; - void *cbArgs = NULL; - }; -} diff --git a/inc/ui/thrdProc.h b/inc/ui/thrdProc.h deleted file mode 100644 index d434fca..0000000 --- a/inc/ui/thrdProc.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "type.h" - -namespace ui -{ - class threadProcMngr - { - public: - ~threadProcMngr(); - //Draw function is used and called to draw on overlay - threadInfo *newThread(ThreadFunc func, void *args, funcPtr _drawFunc); - void update(); - void draw(); - bool empty() { return threads.empty(); } - - private: - std::vector threads; - uint8_t lgFrame = 0, clrShft = 0; - bool clrAdd = true; - unsigned frameCount = 0; - Mutex threadLock = 0; - }; -} diff --git a/inc/ui/ttl.h b/inc/ui/ttl.h deleted file mode 100644 index 053dfe2..0000000 --- a/inc/ui/ttl.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -namespace ui -{ - void ttlInit(); - void ttlExit(); - void ttlSetActive(int usr, bool _set, bool _showSel); - void ttlRefresh(); - - //JIC for func ptr - void ttlReset(); - void ttlUpdate(); - void ttlDraw(SDL_Texture *target); - - //File mode needs access to this. - extern ui::slideOutPanel *ttlOptsPanel; -} diff --git a/inc/ui/ttlview.h b/inc/ui/ttlview.h deleted file mode 100644 index 2aa9f5a..0000000 --- a/inc/ui/ttlview.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include - -#include "type.h" -#include "data.h" - -namespace ui -{ - class titleTile - { - public: - titleTile(unsigned _w, unsigned _h, bool _fav, SDL_Texture *_icon) - { - w = _w; - h = _h; - wS = _w; - hS = _h; - fav = _fav; - icon = _icon; - } - - void draw(SDL_Texture *target, int x, int y, bool sel); - - private: - unsigned w, h, wS, hS; - bool fav = false; - SDL_Texture *icon; - }; - - //Todo less hardcode etc - class titleview - { - public: - titleview(const data::user& _u, int _iconW, int _iconH, int _horGap, int _vertGap, int _rowCount, funcPtr _callback); - ~titleview(); - - void update(); - void refresh(); - - void setActive(bool _set, bool _showSel) { active = _set; showSel = _showSel; } - bool getActive() { return active; } - void setSelected(int _set) { selected = _set; } - int getSelected() { return selected; } - void draw(SDL_Texture *target); - - private: - const data::user *u;//Might not be safe. Users *shouldn't* be touched after initial load - bool active = false, showSel = false, clrAdd = true; - uint8_t clrShft = 0; - funcPtr callback = NULL; - int x = 200, y = 62, selected = 0, selRectX = 10, selRectY = 45; - int iconW, iconH, horGap, vertGap, rowCount; - std::vector tiles; - }; -} diff --git a/inc/ui/uistr.h b/inc/ui/uistr.h deleted file mode 100644 index b7afb0b..0000000 --- a/inc/ui/uistr.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -//Strings since translation support -namespace ui -{ - void initStrings(); - void loadTrans(); - void saveTranslationFiles(void *a); - extern std::map, std::string> strings; - - inline std::string getUIString(const std::string& _name, int ind){ return strings[std::make_pair(_name, ind)]; } - inline const char *getUICString(const std::string& _name, int ind){ return strings[std::make_pair(_name, ind)].c_str(); } -} diff --git a/inc/ui/usr.h b/inc/ui/usr.h deleted file mode 100644 index 500e517..0000000 --- a/inc/ui/usr.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace ui -{ - void usrInit(); - void usrExit(); - void usrRefresh(); - void usrUpdate(); - void usrDraw(SDL_Texture *target); - - //A lot of stuff needs access to these - extern ui::menu *usrMenu; - extern ui::slideOutPanel *usrSelPanel; -} diff --git a/inc/util.h b/inc/util.h deleted file mode 100644 index 6ae24c9..0000000 --- a/inc/util.h +++ /dev/null @@ -1,158 +0,0 @@ -#pragma once - -#include "data.h" -#include "ui.h" -#include "file.h" -#include "gfx.h" - -namespace util -{ - enum - { - DATE_FMT_YMD, - DATE_FMT_YDM, - DATE_FMT_HOYSTE, - DATE_FMT_JHK, - DATE_FMT_ASC - }; - - typedef enum - { - CPU_SPEED_204MHz = 204000000, - CPU_SPEED_306MHz = 306000000, - CPU_SPEED_408MHz = 408000000, - CPU_SPEED_510MHz = 510000000, - CPU_SPEED_612MHz = 612000000, - CPU_SPEED_714MHz = 714000000, - CPU_SPEED_816MHz = 816000000, - CPU_SPEED_918MHz = 918000000, - CPU_SPEED_1020MHz = 1020000000, //Default - CPU_SPEED_1122MHz = 1122000000, - CPU_SPEED_1224MHz = 1224000000, - CPU_SPEED_1326MHz = 1326000000, - CPU_SPEED_1428MHz = 1428000000, - CPU_SPEED_1581MHz = 1581000000, - CPU_SPEED_1683MHz = 1683000000, - CPU_SPEED_1785MHz = 1785000000 - } cpuSpds; - - typedef enum - { - GPU_SPEED_0MHz = 0, - GPU_SPEED_76MHz = 76800000, - GPU_SPEED_153MHz = 153600000, - GPU_SPEED_203MHz = 230400000, - GPU_SPEED_307MHz = 307200000, //Handheld 1 - GPU_SPEED_384MHz = 384000000, //Handheld 2 - GPU_SPEED_460MHz = 460800000, - GPU_SPEED_537MHz = 537600000, - GPU_SPEED_614MHz = 614400000, - GPU_SPEED_768MHz = 768000000, //Docked - GPU_SPEED_844MHz = 844800000, - GPU_SPEED_921MHZ = 921600000 - } gpuSpds; - - typedef enum - { - RAM_SPEED_0MHz = 0, - RAM_SPEED_40MHz = 40800000, - RAM_SPEED_68MHz = 68000000, - RAM_SPEED_102MHz = 102000000, - RAM_SPEED_204MHz = 204000000, - RAM_SPEED_408MHz = 408000000, - RAM_SPEED_665MHz = 665600000, - RAM_SPEED_800MHz = 800000000, - RAM_SPEED_1065MHz = 1065600000, - RAM_SPEED_1331MHz = 1331200000, - RAM_SPEED_1600MHz = 1600000000 - } ramSpds; - - //Returns string with date S+ time - std::string getDateTime(int fmt); - - //Copys dir list to a menu with 'D: ' + 'F: ' - void copyDirListToMenu(const fs::dirList& d, ui::menu& m); - - //Removes last folder from '_path' - void removeLastFolderFromString(std::string& _path); - size_t getTotalPlacesInPath(const std::string& _path); - void trimPath(std::string& _path, uint8_t _places); - - inline bool isASCII(const uint32_t& t) - { - return t > 30 && t < 127; - } - - std::string safeString(const std::string& s); - - std::string getStringInput(SwkbdType _type, const std::string& def, const std::string& head, size_t maxLength, unsigned dictCnt, const std::string dictWords[]); - - std::string getExtensionFromString(const std::string& get); - std::string getFilenameFromPath(const std::string& get); - - std::string generateAbbrev(const uint64_t& tid); - - //removes char from C++ string - void stripChar(char _c, std::string& _s); - - void replaceStr(std::string& _str, const std::string& _find, const std::string& _rep); - - //For future external translation support. Replaces [button] with button chars - void replaceButtonsInString(std::string& rep); - - //Creates a basic generic icon for stuff without one - SDL_Texture *createIconGeneric(const char *txt, int fontSize, bool clearBack); - - inline u128 accountUIDToU128(AccountUid uid) - { - return ((u128)uid.uid[0] << 64 | uid.uid[1]); - } - - inline AccountUid u128ToAccountUID(u128 id) - { - AccountUid ret; - ret.uid[0] = id >> 64; - ret.uid[1] = id; - return ret; - } - - inline std::string getIDStr(const uint64_t& _id) - { - char tmp[18]; - sprintf(tmp, "%016lX", _id); - return std::string(tmp); - } - - inline std::string getIDStrLower(const uint64_t& _id) - { - char tmp[18]; - sprintf(tmp, "%08X", (uint32_t)_id); - return std::string(tmp); - } - - inline std::string generatePathByTID(const uint64_t& tid) - { - return fs::getWorkDir() + data::getTitleSafeNameByTID(tid) + "/"; - } - - std::string getSizeString(const uint64_t& _size); - - inline void createTitleDirectoryByTID(const uint64_t& tid) - { - std::string makePath = fs::getWorkDir() + data::getTitleSafeNameByTID(tid); - mkdir(makePath.c_str(), 777); - } - - Result accountDeleteUser(AccountUid *uid); - - void sysBoost(); - void sysNormal(); - - inline bool isApplet() - { - AppletType type = appletGetAppletType(); - return type == AppletType_LibraryApplet; - } - - void checkForUpdate(void *a); -} diff --git a/inc/webdav.h b/inc/webdav.h deleted file mode 100644 index 3db44b9..0000000 --- a/inc/webdav.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "rfs.h" - -namespace rfs { - - // Note: Everything declared an "id" is the full path component from the origin to the resource starting with a "/". - // Note: Directories ALWAYS have a trailing / while files NEVER have a trailing / - // e.g. //JKSV/ - // e.g. //JKSV// - // e.g. //JKSV// - // e.g. / - // other string arguments never have any leading or trailing "/" - class WebDav : public IRemoteFS { - private: - CURL* curl; - std::string origin; - std::string basePath; - std::string username; - std::string password; - - - std::vector parseXMLResponse(const std::string& xml); - bool resourceExists(const std::string& id); - std::string appendResourceToParentId(const std::string& resourceName, const std::string& parentId, bool isDir); - std::string getNamespacePrefix(tinyxml2::XMLElement* root, const std::string& nsURI); - - public: - WebDav(const std::string& origin, - const std::string& username, - const std::string& password); - ~WebDav(); - - bool createDir(const std::string& dirName, const std::string& parentId); - bool dirExists(const std::string& dirName, const std::string& parentId); - - bool fileExists(const std::string& filename, const std::string& parentId); - void uploadFile(const std::string& filename, const std::string& parentId, curlFuncs::curlUpArgs *_upload); - void updateFile(const std::string& fileID, curlFuncs::curlUpArgs *_upload); - void downloadFile(const std::string& fileID, curlFuncs::curlDlArgs *_download); - void deleteFile(const std::string& fileID); - - std::string getFileID(const std::string& name, const std::string& parentId); - std::string getDirID(const std::string& dirName, const std::string& parentId); - - std::vector getListWithParent(const std::string& _parent); - std::string getDisplayNameFromURL(const std::string &url); - }; -} diff --git a/romfs/icon.png b/romfs/icon.png deleted file mode 100644 index fb07d76..0000000 Binary files a/romfs/icon.png and /dev/null differ diff --git a/romfs/img/fb/lDark.png b/romfs/img/fb/lDark.png deleted file mode 100644 index 7b22141..0000000 Binary files a/romfs/img/fb/lDark.png and /dev/null differ diff --git a/romfs/img/fb/lLight.png b/romfs/img/fb/lLight.png deleted file mode 100644 index 043fda5..0000000 Binary files a/romfs/img/fb/lLight.png and /dev/null differ diff --git a/romfs/img/fb/menuBotLeft.png b/romfs/img/fb/menuBotLeft.png deleted file mode 100644 index 5caf702..0000000 Binary files a/romfs/img/fb/menuBotLeft.png and /dev/null differ diff --git a/romfs/img/fb/menuBotRight.png b/romfs/img/fb/menuBotRight.png deleted file mode 100644 index 49f8f65..0000000 Binary files a/romfs/img/fb/menuBotRight.png and /dev/null differ diff --git a/romfs/img/fb/menuTopLeft.png b/romfs/img/fb/menuTopLeft.png deleted file mode 100644 index 9088aa2..0000000 Binary files a/romfs/img/fb/menuTopLeft.png and /dev/null differ diff --git a/romfs/img/fb/menuTopRight.png b/romfs/img/fb/menuTopRight.png deleted file mode 100644 index 3cde9be..0000000 Binary files a/romfs/img/fb/menuTopRight.png and /dev/null differ diff --git a/romfs/img/icn/icnDefault.png b/romfs/img/icn/icnDefault.png deleted file mode 100644 index 72f6676..0000000 Binary files a/romfs/img/icn/icnDefault.png and /dev/null differ diff --git a/romfs/img/icn/icnDrk.png b/romfs/img/icn/icnDrk.png deleted file mode 100644 index ce18385..0000000 Binary files a/romfs/img/icn/icnDrk.png and /dev/null differ diff --git a/romfs/img/icn/icnLght.png b/romfs/img/icn/icnLght.png deleted file mode 100644 index 71594c2..0000000 Binary files a/romfs/img/icn/icnLght.png and /dev/null differ diff --git a/romfs/img/icn/icon.msk b/romfs/img/icn/icon.msk deleted file mode 100644 index 87176a5..0000000 Binary files a/romfs/img/icn/icon.msk and /dev/null differ diff --git a/romfs/img/tboxDrk/progBarCoverLeftDrk.png b/romfs/img/tboxDrk/progBarCoverLeftDrk.png deleted file mode 100644 index 3dab469..0000000 Binary files a/romfs/img/tboxDrk/progBarCoverLeftDrk.png and /dev/null differ diff --git a/romfs/img/tboxDrk/progBarCoverRightDrk.png b/romfs/img/tboxDrk/progBarCoverRightDrk.png deleted file mode 100644 index 23fe4ab..0000000 Binary files a/romfs/img/tboxDrk/progBarCoverRightDrk.png and /dev/null differ diff --git a/romfs/img/tboxDrk/tboxCornerBotLeft.png b/romfs/img/tboxDrk/tboxCornerBotLeft.png deleted file mode 100644 index 32baa3a..0000000 Binary files a/romfs/img/tboxDrk/tboxCornerBotLeft.png and /dev/null differ diff --git a/romfs/img/tboxDrk/tboxCornerBotRight.png b/romfs/img/tboxDrk/tboxCornerBotRight.png deleted file mode 100644 index 29672ff..0000000 Binary files a/romfs/img/tboxDrk/tboxCornerBotRight.png and /dev/null differ diff --git a/romfs/img/tboxDrk/tboxCornerTopLeft.png b/romfs/img/tboxDrk/tboxCornerTopLeft.png deleted file mode 100644 index d2fa70f..0000000 Binary files a/romfs/img/tboxDrk/tboxCornerTopLeft.png and /dev/null differ diff --git a/romfs/img/tboxDrk/tboxCornerTopRight.png b/romfs/img/tboxDrk/tboxCornerTopRight.png deleted file mode 100644 index b119f32..0000000 Binary files a/romfs/img/tboxDrk/tboxCornerTopRight.png and /dev/null differ diff --git a/romfs/img/tboxLght/progBarCoverLeftLight.png b/romfs/img/tboxLght/progBarCoverLeftLight.png deleted file mode 100644 index 43cc657..0000000 Binary files a/romfs/img/tboxLght/progBarCoverLeftLight.png and /dev/null differ diff --git a/romfs/img/tboxLght/progBarCoverRightLight.png b/romfs/img/tboxLght/progBarCoverRightLight.png deleted file mode 100644 index 8242487..0000000 Binary files a/romfs/img/tboxLght/progBarCoverRightLight.png and /dev/null differ diff --git a/romfs/img/tboxLght/tboxCornerBotLeft.png b/romfs/img/tboxLght/tboxCornerBotLeft.png deleted file mode 100644 index c0dc01f..0000000 Binary files a/romfs/img/tboxLght/tboxCornerBotLeft.png and /dev/null differ diff --git a/romfs/img/tboxLght/tboxCornerBotRight.png b/romfs/img/tboxLght/tboxCornerBotRight.png deleted file mode 100644 index beeddf6..0000000 Binary files a/romfs/img/tboxLght/tboxCornerBotRight.png and /dev/null differ diff --git a/romfs/img/tboxLght/tboxCornerTopLeft.png b/romfs/img/tboxLght/tboxCornerTopLeft.png deleted file mode 100644 index 4787cdc..0000000 Binary files a/romfs/img/tboxLght/tboxCornerTopLeft.png and /dev/null differ diff --git a/romfs/img/tboxLght/tboxCornerTopRight.png b/romfs/img/tboxLght/tboxCornerTopRight.png deleted file mode 100644 index d379d1a..0000000 Binary files a/romfs/img/tboxLght/tboxCornerTopRight.png and /dev/null differ diff --git a/romfs/lang/de.txt b/romfs/lang/de.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/de.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/en-GB.txt b/romfs/lang/en-GB.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/en-GB.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/en-US.txt b/romfs/lang/en-US.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/en-US.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/es-419.txt b/romfs/lang/es-419.txt deleted file mode 100644 index f8ad784..0000000 --- a/romfs/lang/es-419.txt +++ /dev/null @@ -1,218 +0,0 @@ -appletModeWarning = 0, "*ADVERTENCIA*: JKSV se está ejecutando en modo 'applet'. Algunas características no funcionarán." -author = 0, "Impeeza" -confirmBlacklist = 0, "¿Estás seguro que deseas adicionar #%s# a la lista negra?" -confirmCopy = 0, "¿Seguro que desea copiar #%s# a #%s#?" -confirmCreateAllSaveData = 0, "¿Seguro que desea crear todos los Datos de Partidas Guardadas en este sistema para #%s#? ¡Puede tomar un tiempo dependiendo de la cantidad de títulos sean encontrados!" -confirmDelete = 0, "¿Seguro que desea borrar #%s#? *¡Es permanente!*" -confirmDeleteBackupsAll = 0, "¿Seguro que desea borrar *TODOS* los respaldos de partidas guardadas para todos sus juegos?" -confirmDeleteBackupsTitle = 0, "¿Seguro que desea borrar *TODOS* los respaldos de partidas guardadas para #%s#?" -confirmDeleteSaveData = 0, "*ADVERTENCIA*: Ésto eliminará la partida guardada para #%s# *DE SU SISTEMA*. ¿Está seguro que así lo desea?" - -#CHANGED=============================================> -confirmDriveOverwrite = 0, "Al descargar este respaldo desde el servidor remoto se reemplazará el que actualmente está en la tarjeta SD, ¿Continuar?" -#<==================================================== - -confirmOverwrite = 0, "¿Sobrescribir #%s#?" -confirmResetSaveData = 0, "*ADVERTENCIA*: Ésto restablecerá la partida guardada para este juego, como si nunca se hubiera ejecutado. ¿Está seguro que es lo que desea?" -confirmRestore = 0, "¿Seguro que desea restaurar #%s#?" - -#CHANGED=============================================> -debugStatus = 0, "Número de Usuarios: " -debugStatus = 1, "Usuario Actual: " -debugStatus = 2, "Título Actual: " -debugStatus = 3, "Título Seguro: " -debugStatus = 4, "Tipo órden: " -#<==================================================== - -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Si [A]" -extrasMenu = 0, "Navegador de SD a SD" -extrasMenu = 1, "Navegar 'ProdInfo'" -extrasMenu = 2, "Navegar 'Safe'" -extrasMenu = 3, "Navegar 'System'" -extrasMenu = 4, "Navegar 'User'" -extrasMenu = 5, "Eliminar actualizaciones pendientes" -extrasMenu = 6, "Detener proceso" -extrasMenu = 7, "Montar 'System Save'" -extrasMenu = 8, "Recargar Lista de Títulos" -extrasMenu = 9, "Navegar 'Process RomFS'" -extrasMenu = 10, "Realizar respaldo de la carpeta de JKSV" -extrasMenu = 11, "*[DEV]* Extraer Archivos de Lenguaje actuales" -fileModeFileProperties = 0, "Ruta: %s\nTamaño: %s" -fileModeFolderProperties = 0, "Ruta: %s\nSubCarpetas: %u\nCantidad Archivos: %u\nTamaño Total: %s" -fileModeMenu = 0, "Copiar a " -fileModeMenu = 1, "Borrar" -fileModeMenu = 2, "Renombrar" -fileModeMenu = 3, "Crear Carpeta" -fileModeMenu = 4, "Propiedades" -fileModeMenu = 5, "Cerrar" -fileModeMenu = 6, "Adicionar a filtros de Carpetas" -fileModeMenuMkDir = 0, "Nuevo" -folderMenuNew = 0, "Nuevo Respaldo" - -#CHANGED=============================================> -helpFolder = 0, "[A] Selecionar [Y] Restaurar [X] Borrar [ZR] Subir [B] Cerrar" -#<==================================================== - -helpSettings = 0, "[A] Cambiar [X] Predeterminados [B] Atrás" -helpTitle = 0, "[A] Seleccionar [L][R] Cambiar Página [Y] Favoritos [X] Opciones de Títulos [B] Atrás" -helpUser = 0, "[A] Seleccionar [Y] Extraer Todos [X] Opciones de Usuario" -holdingText = 0, "(Sostenga) " -holdingText = 1, "(Siga Sosteniendo) " -holdingText = 2, "(¡Ya Casi!) " - -#CHANGED=============================================> -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Tiempo Jugado: %02d:%02d" -infoStatus = 3, "Veces Ejecutado: %u" -infoStatus = 4, "Editor: %s" -infoStatus = 5, "Tipo Partida Guardada: %s" -infoStatus = 6, "Índice de Caché: %u" -infoStatus = 7, "Usuario: %s" -infoStatus = 9, "" -#<===================================================== - -loadingStartPage = 0, "Cargando..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Configs." -onlineErrorConnecting = 0, "¡Error Conectando!" -onlineNoUpdates = 0, "No hay actualizaciones disponibles." -popAddedToPathFilter = 0, "Se adicionó '#%s#' a filtros de carpeta." -popCPUBoostEnabled = 0, "Aumento de CPU para ZIP." -popChangeOutputError = 0, "#%s# contiene carácteres ilegales o no-ASCII." -popChangeOutputFolder = 0, "Se cambia #%s# por #%s#" - -#CHANGED=============================================> -popDriveFailed = 0, "Falla al iniciar Google Drive." -popRemoteNotActive = 0, "Servidor Remoto no está disponible." -popDriveStarted = 0, "Se ha iniciado Google Drive correctamente." -popWebdavStarted = 0, "Se ha iniciado Webdav Correctamente." -popWebdavFailed = 0, "Falla al iniciar Webdav." -#<==================================================== - -popErrorCommittingFile = 0, "¡Error guardando archivo!" -popFolderIsEmpty = 0, "¡La carpeta está vacía!" -popProcessShutdown = 0, "#%s# Apagado satisfactorio." - -#CHANGED=============================================> -popSVIExported = 0, "SVI Exportado." -#<==================================================== - -popSaveIsEmpty = 0, "¡Partida Guardada está vacía!" -popTrashEmptied = 0, "Papelera Vaciada" -popZipIsEmpty = 0, "¡Archivo ZIP está vacío!" -saveDataBackupDeleted = 0, "#%s# ha sido borrado." -saveDataBackupMovedToTrash = 0, "#%s# ha sido movido a papelera." -saveDataCreatedForUser = 0, "Se creó Partida Guardada para %s!" -saveDataCreationFailed = 0, "¡Error en creación de Partida Guardada!" -saveDataDeleteAllUser = 0, "*¿SEGURO QUE DESEA BORRAR TODAS LAS PARTIDAS GUARDADAS DE %s?*" -saveDataDeleteSuccess = 0, "¡Se borró la Partida Guardada de #%s#!" -saveDataExtendFailed = 0, "Error al expandir la partida guardada." -saveDataExtendSuccess = 0, "¡Partida Guardada para #%s# expandida con éxito!" -saveDataIndexText = 0, "Guardar Índice: " -saveDataNoneFound = 0, "¡No se encontraron partidas guardadas para #%s#!" -saveDataResetSuccess = 0, "¡Partida Guardada para #%s# restablecida!" -saveDataTypeText = 0, "Datos de Sistema" -saveDataTypeText = 1, "Partida Guardada" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Datos de Dispositivo" -saveDataTypeText = 4, "Almacenamiento Temporal" -saveDataTypeText = 5, "Almacenamiento de Caché" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Caché" -saveTypeMainMenu = 3, "Sistema" -saveTypeMainMenu = 4, "BCAT de Sistema" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Vaciar Papelera" -settingsMenu = 1, "Buscar Actualizaciones" -settingsMenu = 2, "Configurar carpeta de salida para JKSV" -settingsMenu = 3, "Editar lista negra de Títulos" -settingsMenu = 4, "Eliminar todos los respaldos" -settingsMenu = 5, "Incluír Datos de Dispositivo con los Usuarios: " -settingsMenu = 6, "Crear respaldo automático al restaurar: " -settingsMenu = 7, "Nombrar Automáticamente los respaldos: " -settingsMenu = 8, "Overclock/Aumento de CPU: " -settingsMenu = 9, "Sostener para Borrar: " -settingsMenu = 10, "Sostener para Restaurar: " -settingsMenu = 11, "Sostener para Sobreescribir: " -settingsMenu = 12, "Montar forzado: " -settingsMenu = 13, "Datos de la cuenta de Sistema: " -settingsMenu = 14, "Habilitar escritura para datos de Sistema: " -settingsMenu = 15, "Usar comandos FS directamente: " -settingsMenu = 16, "Exportar partidas guardadas a archivos ZIP: " -settingsMenu = 17, "Forzar el uso de idioma Inglés: " -settingsMenu = 18, "Habilitar papelera: " -settingsMenu = 19, "Ordenar Títulos: " -settingsMenu = 20, "Escala de Animación: " -settingsMenu = 21, "Subir automáticamente a GDrive/Webdav: " -settingsOff = 0, "Apagado" -settingsOn = 0, ">Encendido>" -sortType = 0, "Alfabéticamente" -sortType = 1, "Por Duración Juegos" -sortType = 2, "Recientemente Jugado" -swkbdEnterName = 0, "Ingrese un nuevo nombre" -swkbdExpandSize = 0, "Ingrese nuevo tamaño en MB" -swkbdMkDir = 0, "Ingrese nombre de carpeta" -swkbdNewSafeTitle = 0, "Ingrese Nueva Carpeta de Salida" -swkbdProcessID = 0, "Ingrese ID de proceso" -swkbdRename = 0, "Ingrese un nuevo nombre para el elemento" -swkbdSaveIndex = 0, "Ingrese Índice de Caché" -swkbdSetWorkDir = 0, "Ingrese Nueva Carpeta de Salida" -swkbdSysSavID = 0, "Ingrese ID de Datos de Sistema" -threadStatusAddingFileToZip = 0, "Agregando '#%s#' a archivo ZIP..." - -#CHANGED=============================================> -threadStatusCalculatingSaveSize = 0, "Calculando tamaño de partida guardada..." -#<==================================================== - -threadStatusCheckingForUpdate = 0, "Verificando actualizaciones..." - -#CHANGED=============================================> -threadStatusCompressingSaveForUpload = 0, "Comprimiendo #%s# para subirlo..." -#<==================================================== - -threadStatusCopyingFile = 0, "Copiando '#%s#'..." -threadStatusCreatingSaveData = 0, "Creando Partida Guardada para #%s#..." -threadStatusDecompressingFile = 0, "Descomprimiendo '#%s#'..." -threadStatusDeletingFile = 0, "Borrando..." -threadStatusDeletingSaveData = 0, "Borrando Partida Guardada para #%s#..." -threadStatusDeletingUpdate = 0, "Borrando Actualización Pendiente..." - -#CHANGED=============================================> -threadStatusDownloadingFile = 0, "Descargando #%s#..." -#<==================================================== - -threadStatusDownloadingUpdate = 0, "Borrando Actualización..." -threadStatusExtendingSaveData = 0, "Expandiendo Datos Guardados para #%s#..." -threadStatusGetDirProps = 0, "Obteniendo propiedades de Carpeta..." -threadStatusOpeningFolder = 0, "Abriendo '#%s#'..." -threadStatusPackingJKSV = 0, "Guardando contenidos de carpeta de JKSV en archivo ZIP..." -threadStatusResettingSaveData = 0, "Restableciendo datos de partida..." -threadStatusSavingTranslations = 0, "Guardando archivo maestro..." - -#CHANGED=============================================> -threadStatusUploadingFile = 0, "Subiendo #%s#..." -#<==================================================== - -titleOptions = 0, "Información" -titleOptions = 1, "Lista Negra" -titleOptions = 2, "Cambiar Carpeta de Salida" -titleOptions = 3, "Abrir en Modo Archivo" -titleOptions = 4, "Borrar todos los respaldos" -titleOptions = 5, "Restablecer Datos de Partida" -titleOptions = 6, "Borrar Datos de Partida" -titleOptions = 7, "Expandir Datos de Partida" - -#CHANGED=============================================> -titleOptions = 8, "Exportar SVI" -#<==================================================== - -translationMainPage = 0, "Traducción: " -userOptions = 0, "Extrar Todo para " -userOptions = 1, "Crear Datos de Partida" -userOptions = 2, "Crear Todos los Datos de Partida" -userOptions = 3, "Borrar Datos de Partida para todos los Usuarios" diff --git a/romfs/lang/es.txt b/romfs/lang/es.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/es.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/fr-CA.txt b/romfs/lang/fr-CA.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/fr-CA.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/fr.txt b/romfs/lang/fr.txt deleted file mode 100644 index 51a2121..0000000 --- a/romfs/lang/fr.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "Shadow2560" -confirmBlacklist = 0, "Souhaitez-vous vraiment ajouter #%s# à votre liste noire?" -confirmCopy = 0, "Souhaitez-vous vraiment copier #%s# vers #%s#?" -confirmCreateAllSaveData = 0, "Souhaitez-vous vraiment créer toutes les données de sauvegarde de ce système pour #%s# ? Cela peut prendre un certain temps en fonction du nombre de titres trouvés." -confirmDelete = 0, "Souhaitez-vous vraiment supprimer #%s# ? *Ceci sera permanent* !" -confirmDeleteBackupsAll = 0, "Êtes-vous sûr de vouloir supprimer *toutes* vos sauvegardes pour tous vos jeux ?" -confirmDeleteBackupsTitle = 0, "Souhaitez-vous vraiment supprimer toutes les sauvegardes sauvegardées pour #%s#?" -confirmDeleteSaveData = 0, "*ATTENTION* : Ceci *effacera* les données sauvegardées pour #%s# *de votre système*. Êtes-vous sûr de vouloir faire cela ?" -confirmDriveOverwrite = 0, "Le téléchargement de cette sauvegarde depuis le disque dur écrasera celle qui se trouve sur votre carte SD. Continuer?" -confirmOverwrite = 0, "Souhaitez-vous vraiment écraser #%s#?" -confirmResetSaveData = 0, "*ATTENTION* : Cela *réinitialisera* les données de sauvegarde de ce jeu comme s'il n'avait jamais été exécuté auparavant. Êtes-vous sûr de vouloir faire cela ?" -confirmRestore = 0, "Souhaitez-vous vraiment restaurer #%s#?" -debugStatus = 0, "Nombre d'utilisateurs: " -debugStatus = 1, "Utilisateur actuel: " -debugStatus = 2, "Titre actuel: " -debugStatus = 3, "Titre sauvegardé: " -debugStatus = 4, "Type de tri: " -dialogNo = 0, "Non [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Oui [A]" -extrasMenu = 0, "Explorateur SD vers SD" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Supprimer la mise à jour en attente" -extrasMenu = 6, "Terminer le processus" -extrasMenu = 7, "Monter la sauvegarde système" -extrasMenu = 8, "Re-scanner les titres" -extrasMenu = 9, "Monter le processus RomFS" -extrasMenu = 10, "Sauvegarder le répertoire de JKSV" -extrasMenu = 11, "*[DEV]* Forcer la langue en en-US" -fileModeFileProperties = 0, "Chemin: %s\nTaille: %s" -fileModeFolderProperties = 0, "Chemin: %s\nSous-répertoires: %u\nNombre de fichiers: %u\nTaille totale: %s" -fileModeMenu = 0, "Copier vers " -fileModeMenu = 1, "Supprimer" -fileModeMenu = 2, "Renommer" -fileModeMenu = 3, "Créer un nouveau dossier" -fileModeMenu = 4, "Propriétés" -fileModeMenu = 5, "Fermer" -fileModeMenu = 6, "Ajouter aux filtres de chemins" -fileModeMenuMkDir = 0, "Nouveau" -folderMenuNew = 0, "Nouvelle sauvegarde" -helpFolder = 0, "[A] Sélectionner [Y] Restorer [X] Suprimer [ZR] Upload [B] Fermer" -helpSettings = 0, "[A] Basculer [X] Défauts [B] Retour" -helpTitle = 0, "[A] Sélectionner [L][R] Saut de page [Y] Favorie [X] Options du titre [B] Retour" -helpUser = 0, "[A] Sélectionner [X] Options pour l'utilisateur" -holdingText = 0, "(Maintenir) " -holdingText = 1, "(Garder maintenu) " -holdingText = 2, "(Presque fini!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Temps de jeu: %02d:%02d" -infoStatus = 3, "Nombre de fois lancé: %u" -infoStatus = 4, "Auteur: %s" -infoStatus = 5, "Type de sauvegarde: %s" -infoStatus = 6, "Index du Cache: %u" -infoStatus = 7, "Utilisateur: %s" -loadingStartPage = 0, "Chargement..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Paramètres" -onlineErrorConnecting = 0, "Erreur de connection!" -onlineNoUpdates = 0, "Aucune mise à jour disponible." -popAddedToPathFilter = 0, "'#%s#' ajouté aux filtres de chemins." -popCPUBoostEnabled = 0, "CPU Boost activé pour les ZIP." -popChangeOutputError = 0, "#%s# contient des caractères incorrects ou non-ASCII." -popChangeOutputFolder = 0, "#%s# modifié en #%s#" -popDriveFailed = 0, "Echec du démarrage de Google Drive." -popRemoteNotActive = 0, "Remote n'est pas utilisable" -popDriveStarted = 0, "Google Drive lancé avec succès." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Erreur d'ajout du fichier à la sauvegarde!" -popFolderIsEmpty = 0, "Le dossier est vide!" -popProcessShutdown = 0, "#%s# terminé avec succès." -popSVIExported = 0, "SVI Exporté." -popSaveIsEmpty = 0, "Les données de la sauvegarde sont vides!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "Le fichier ZIP est vide!" -saveDataBackupDeleted = 0, "#%s# a été supprimé." -saveDataBackupMovedToTrash = 0, "#%s# a été déplacé dans la corbeille." -saveDataCreatedForUser = 0, "Données de sauvegarde créée pour %s!" -saveDataCreationFailed = 0, "Echec de la création des données de sauvegarde!" -saveDataDeleteAllUser = 0, "*Souhaitez-vous vraiment supprimer toutes les données de sauvegarde pour %s?*" -saveDataDeleteSuccess = 0, "Données de la sauvegarde pour #%s# Supprimée!" -saveDataExtendFailed = 0, "Echec de l'extention des données de la sauvegarde." -saveDataExtendSuccess = 0, "Données de la sauvegarde pour #%s# étendue!" -saveDataIndexText = 0, "Index de la sauvegarde: " -saveDataNoneFound = 0, "Aucune sauvegarde trouvée pour #%s#!" -saveDataResetSuccess = 0, "Sauvegarde pour #%s# réinitialisée!" -saveDataTypeText = 0, "Sauvegarde système" -saveDataTypeText = 1, "Données de sauvegarde" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Sauvegarde de périphérique" -saveDataTypeText = 4, "Stockage temporaire" -saveDataTypeText = 5, "Stockage cache" -saveDataTypeText = 6, "BCAT système" -saveTypeMainMenu = 0, "Périphérique" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "Système" -saveTypeMainMenu = 4, "BCAT système" -saveTypeMainMenu = 5, "Stockage SysTemp" -settingsMenu = 0, "Vider la corbeille" -settingsMenu = 1, "Vérifier les mises à jour" -settingsMenu = 2, "Définir le dossier de sortie de JKSV" -settingsMenu = 3, "Modifier les titres de la liste noire" -settingsMenu = 4, "Supprimer toutes les sauvegardes sauvegardées" -settingsMenu = 5, "Inclure les sauvegardes du matériel avec les utilisateurs: " -settingsMenu = 6, "Sauvegarder automatiquement avant la restauration: " -settingsMenu = 7, "Nom automatique des sauvegardes: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Maintenir pour supprimer: " -settingsMenu = 10, "Maintenir pour restaurer: " -settingsMenu = 11, "Maintenir pour écraser: " -settingsMenu = 12, "Forcer le montage: " -settingsMenu = 13, "Compte des sauvegardes système: " -settingsMenu = 14, "Activer l'écriture pour les sauvegardes système: " -settingsMenu = 15, "Utiliser directement les commandes FS : " -settingsMenu = 16, "Exporter les sauvegardes en ZIP: " -settingsMenu = 17, "Forcer l'utilisation de l'anglais: " -settingsMenu = 18, "Activer la corbeille: " -settingsMenu = 19, "Type de tri des titres: " -settingsMenu = 20, "Échelle d'animation: " -settingsOff = 0, "Désactivé" -settingsOn = 0, ">Activé>" -sortType = 0, "Alphabétique" -sortType = 1, "Temps de jeu" -sortType = 2, "Joué dernièrement" -swkbdEnterName = 0, "Entrez un nouveau nom" -swkbdExpandSize = 0, "Entrez la nouvelle taille en MB" -swkbdMkDir = 0, "Entrez un nom de dossier" -swkbdNewSafeTitle = 0, "Entrez un nouveau nom de dossier" -swkbdProcessID = 0, "Entrez l'ID du processus" -swkbdRename = 0, "Entrez un nouveau nom pour l'objet" -swkbdSaveIndex = 0, "Entrez l'index du cache" -swkbdSetWorkDir = 0, "Entrez un nouveau chemin de sortie" -swkbdSysSavID = 0, "Entrez l'ID de la sauvegarde système" -threadStatusAddingFileToZip = 0, "Ajout de '#%s#' au ZIP..." -threadStatusCalculatingSaveSize = 0, "Calcul de la taille de la sauvegarde..." -threadStatusCheckingForUpdate = 0, "Vérification de mises à jour..." -threadStatusCompressingSaveForUpload = 0, "Compression de #%s# pour l'upload..." -threadStatusCopyingFile = 0, "Copie de '#%s#'..." -threadStatusCreatingSaveData = 0, "Création de la sauvegarde pour #%s#..." -threadStatusDecompressingFile = 0, "Décompression de '#%s#'..." -threadStatusDeletingFile = 0, "Suppression..." -threadStatusDeletingSaveData = 0, "Supression de la sauvegarde pour #%s#..." -threadStatusDeletingUpdate = 0, "Suppression de la mise à jour en attente..." -threadStatusDownloadingFile = 0, "Téléchargement de #%s#..." -threadStatusDownloadingUpdate = 0, "Téléchargement de la mise à jour..." -threadStatusExtendingSaveData = 0, "Extention de la sauvegarde pour #%s#..." -threadStatusGetDirProps = 0, "Obtention des propriétés du dossier..." -threadStatusOpeningFolder = 0, "Ouverture de '#%s#'..." -threadStatusPackingJKSV = 0, "Ecriture du contenu du répertoire JKSV dans le ZIP..." -threadStatusResettingSaveData = 0, "Réinitialisation de la sauvegarde..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Upload de #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Liste noir" -titleOptions = 2, "Changer le dossier de sortie" -titleOptions = 3, "Ouvrir en mode fichier" -titleOptions = 4, "Supprimer toutes les sauvegardes de la sauvegarde" -titleOptions = 5, "Réinitialiser la sauvegarde" -titleOptions = 6, "Supprimer la sauvegarde" -titleOptions = 7, "Etendre la sauvegarde" -titleOptions = 8, "Exporter SVI" -translationMainPage = 0, "Traduction: " -userOptions = 0, "Dumper tout pour" -userOptions = 1, "Sauvegarder la sauvegarde" -userOptions = 2, "Sauvegarder toutes les sauvegardes" -userOptions = 3, "Supprimer toutes les sauvegardes de l'utilisateur" diff --git a/romfs/lang/it.txt b/romfs/lang/it.txt deleted file mode 100644 index 86af9fd..0000000 --- a/romfs/lang/it.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "SimoCasa" -confirmBlacklist = 0, "Sei sicuro di voler aggiungere #%s# alla tua blacklist?" -confirmCopy = 0, "Sei sicuro di voler copiare #%s# in #%s#?" -confirmCreateAllSaveData = 0, "Sei sicuro di voler creare tutti i dati di salvataggio su questo sistema per #%s#? Può metterci un po' di tempo in base ai titoli trovati." -confirmDelete = 0, "Sei sicuro di voler cancellare #%s#? *È permanente*!" -confirmDeleteBackupsAll = 0, "Sei sicuro di voler cancellare *tutti* i tuoi backup dei salvataggi di gioco?" -confirmDeleteBackupsTitle = 0, "Sei sicuro di voler cancellare tutti i salvataggi di backup di #%s#?" -confirmDeleteSaveData = 0, "*ATTENZIONE*: Questo *cancellerà* il salvataggio di #%s# *dal tuo sistema*. Sei sicuro di volerlo fare?" -confirmDriveOverwrite = 0, "Scaricando questo backup da Drive sovrascriverai quello nella tua scheda SD. Vuoi continuare?" -confirmOverwrite = 0, "Sei sicuro di voler sovrascrivere #%s#?" -confirmResetSaveData = 0, "*ATTENZIONE*: Questo *resetterà* i dati di salvataggio per questo gioco come se non fosse mai stato eseguito prima. Sei sicuro di volerlo fare?" -confirmRestore = 0, "Sei sicuro di voler ripristinare #%s#?" -debugStatus = 0, "Numero Utenti: " -debugStatus = 1, "Utente Corrente: " -debugStatus = 2, "Titolo Corrente: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Tipo Ordinamento: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Si [A]" -extrasMenu = 0, "Browser da SD a SD" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Rimuovi Aggiornamento in attesa" -extrasMenu = 6, "Termina Processo" -extrasMenu = 7, "Monta Salvataggio di Sistema" -extrasMenu = 8, "Riscansiona Titoli" -extrasMenu = 9, "Monta Processo RomFS" -extrasMenu = 10, "Backup cartella JKSV" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Percorso: %s\nDimensione: %s" -fileModeFolderProperties = 0, "Percorso: %s\nSottocartelle: %u\nNumero File: %u\nDimensione totale: %s" -fileModeMenu = 0, "Copia in " -fileModeMenu = 1, "Elimina" -fileModeMenu = 2, "Rinomina" -fileModeMenu = 3, "Crea Cartella" -fileModeMenu = 4, "Proprietà" -fileModeMenu = 5, "Chiudi" -fileModeMenu = 6, "Aggiungi ai Filtri del Percorso" -fileModeMenuMkDir = 0, "Nuovo" -folderMenuNew = 0, "Nuovo Backup" -helpFolder = 0, "[A] Seleziona [Y] Ripristina [X] Cancella [ZR] Upload [B] Chiudi" -helpSettings = 0, "[A] Attiva/Disattiva [X] Predefinite [B] Indietro" -helpTitle = 0, "[A] Seleziona [L][R] Jump [Y] Preferiti [X] Opzioni Titolo [B] Indietro" -helpUser = 0, "[A] Seleziona [Y] Dump di tutti i Salvataggi [X] Opzioni Utente" -holdingText = 0, "(Tieni Premuto) " -holdingText = 1, "(Continua a Premere) " -holdingText = 2, "(Ci sei quasi!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Tempo di Gioco: %02d:%02d" -infoStatus = 3, "Avvii Totali: %u" -infoStatus = 4, "Casa Editrice: %s" -infoStatus = 5, "Tipo Salvataggio: %s" -infoStatus = 6, "Indice della Cache: %u" -infoStatus = 7, "Utente: %s" -loadingStartPage = 0, "Caricamento..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Impost." -onlineErrorConnecting = 0, "Errore di Connessione!" -onlineNoUpdates = 0, "Nessun Aggiornamento Disponibile." -popAddedToPathFilter = 0, "'#%s#' aggiunto ai filtri del percorso." -popCPUBoostEnabled = 0, "CPU Boost Abilitato per ZIP." -popChangeOutputError = 0, "#%s# contiene caratteri illeciti o non-ASCII." -popChangeOutputFolder = 0, "#%s# cambiato in #%s#" -popDriveFailed = 0, "Impossibile avviare Google Drive." -popRemoteNotActive = 0, "Remote non è Disponibile" -popDriveStarted = 0, "Google Drive avviato con successo." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Errore durante il commiting del file da salvare!" -popFolderIsEmpty = 0, "La cartella è vuota!" -popProcessShutdown = 0, "#%s# spento con successo." -popSVIExported = 0, "SVI Esportato." -popSaveIsEmpty = 0, "Il salvataggio è vuoto!" -popTrashEmptied = 0, "Cestino Svuotato" -popZipIsEmpty = 0, "Il file ZIP è vuoto!" -saveDataBackupDeleted = 0, "#%s# è stato cancellato." -saveDataBackupMovedToTrash = 0, "#%s# è stato spostato nel cestino." -saveDataCreatedForUser = 0, "Salvataggio creato per %s!" -saveDataCreationFailed = 0, "Creazione salvataggio fallita!" -saveDataDeleteAllUser = 0, "*SEI SICURO DI VOLER CANCELLARE TUTTI I SALVATAGGI DI %s?*" -saveDataDeleteSuccess = 0, "Salvataggio di #%s# cancellato!" -saveDataExtendFailed = 0, "Estensione salvataggio fallita." -saveDataExtendSuccess = 0, "Salvataggio di #%s# esteso!" -saveDataIndexText = 0, "Indice di backup: " -saveDataNoneFound = 0, "Nessun Salvataggio trovato per #%s#!" -saveDataResetSuccess = 0, "Salvataggio di #%s# resettato!" -saveDataTypeText = 0, "Sistema" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Dispositivo" -saveDataTypeText = 4, "Temporanea" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Disposit." -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "Sistema" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Svuota Cestino" -settingsMenu = 1, "Controllo Aggiornamenti" -settingsMenu = 2, "Imposta cartella JKSV di Output" -settingsMenu = 3, "Modifica titoli in Blacklist" -settingsMenu = 4, "Cancella tutti i Salvataggi di Backup" -settingsMenu = 5, "Includi Salvataggi Dispositivo con Utenti: " -settingsMenu = 6, "Backup Automatico nel Ripristino: " -settingsMenu = 7, "Auto-Rinominazione Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Tieni premuto per eliminare: " -settingsMenu = 10, "Tieni premuto per ripristinare: " -settingsMenu = 11, "Tieni premuto per sovrascrivere: " -settingsMenu = 12, "Forza Montaggio: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Abilita scrittura su Salvataggi Sistema: " -settingsMenu = 15, "Usa comandi FS direttamente: " -settingsMenu = 16, "Esporta salvataggio in ZIP: " -settingsMenu = 17, "Forza utilizzo Inglese: " -settingsMenu = 18, "Abilita Cestino: " -settingsMenu = 19, "Tipo di ordinamento del Titolo: " -settingsMenu = 20, "Scala di Animazione: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alfabetico" -sortType = 1, "Tempo di Gioco" -sortType = 2, "Ultima Partita" -swkbdEnterName = 0, "Inserisci nuovo nome" -swkbdExpandSize = 0, "Inserisci nuova dimensione in MB" -swkbdMkDir = 0, "Inserisci nome cartella" -swkbdNewSafeTitle = 0, "Inserisci una nuova cartella di output" -swkbdProcessID = 0, "Inserisci Process ID" -swkbdRename = 0, "Inserisci un nuovo nome per elemento" -swkbdSaveIndex = 0, "Inserisci l'Indice della Cache" -swkbdSetWorkDir = 0, "Inserisci un nuovo Percorso Output" -swkbdSysSavID = 0, "Inserisci System Save ID" -threadStatusAddingFileToZip = 0, "Aggiungi '#%s#' a ZIP..." -threadStatusCalculatingSaveSize = 0, "Calcolo dimensione salvataggio..." -threadStatusCheckingForUpdate = 0, "Controllo Aggiornamenti..." -threadStatusCompressingSaveForUpload = 0, "Compressione di #%s# per l'upload..." -threadStatusCopyingFile = 0, "Copiando '#%s#'..." -threadStatusCreatingSaveData = 0, "Creazione salvataggio per #%s#..." -threadStatusDecompressingFile = 0, "Decompressione '#%s#'..." -threadStatusDeletingFile = 0, "Cancellando..." -threadStatusDeletingSaveData = 0, "Cancellazione salvataggio di #%s#..." -threadStatusDeletingUpdate = 0, "Cancellazione dell'aggiornamento in sospeso..." -threadStatusDownloadingFile = 0, "Download di #%s#..." -threadStatusDownloadingUpdate = 0, "Download aggiornamento..." -threadStatusExtendingSaveData = 0, "Estensione Salvataggio per #%s#..." -threadStatusGetDirProps = 0, "Ottenimento le proprietà della cartella..." -threadStatusOpeningFolder = 0, "Apertura '#%s#'..." -threadStatusPackingJKSV = 0, "Scrittura del contenuto della cartella JKSV su ZIP..." -threadStatusResettingSaveData = 0, "Reset salvataggio..." -threadStatusSavingTranslations = 0, "Salvataggio del file master..." -threadStatusUploadingFile = 0, "Upload di #%s#..." -titleOptions = 0, "Informazioni" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Cambia Cartella Output" -titleOptions = 3, "Apri in Modalità File" -titleOptions = 4, "Elimina tutti i Salvataggi di Backup" -titleOptions = 5, "Resetta Salvataggio" -titleOptions = 6, "Elimina Salvataggio" -titleOptions = 7, "Estendi Salvataggio" -titleOptions = 8, "Esporta SVI" -translationMainPage = 0, "Traduzione: " -userOptions = 0, "Dump di tutto per " -userOptions = 1, "Crea salvataggio" -userOptions = 2, "Crea tutti salvataggi" -userOptions = 3, "Cancella tutti salvataggi Utente" diff --git a/romfs/lang/ja.txt b/romfs/lang/ja.txt deleted file mode 100644 index 31641d3..0000000 --- a/romfs/lang/ja.txt +++ /dev/null @@ -1,215 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "ブラックリストに#%s#を追加してもよろしいですか?" -confirmCopy = 0, "#%s#を#%s#にコピーしてもよろしいですか?" -confirmCreateAllSaveData = 0, "このシステムで#%s#のすべてのセーブデータを作成してもよろしいですか?見つかったタイトルの数によっては、時間がかかる場合があります。" -confirmDelete = 0, "#%s#を削除してもよろしいですか? これは永続的です!" -confirmDeleteBackupsAll = 0, "全てのゲームのセーブバックアップを全て削除してもよろしいですか?" -confirmDeleteBackupsTitle = 0, "#%s#のすべてのセーブデータのバックアップを削除してもよろしいですか?" -confirmDeleteSaveData = 0, "警告: これにより、#%s#のセーブデータがシステムから消去されます。 これを実行してもよろしいですか?" - -#CHANGED=============================================> -confirmDriveOverwrite = 0, "このバックアップをドライブからダウンロードすると、SDカードにあるバックアップが上書きされます。続行しますか" -#<==================================================== - -confirmOverwrite = 0, "#%s#を上書きしてもよろしいですか?" -confirmResetSaveData = 0, "警告: これにより、このゲームのセーブデータが、以前に実行されたことがないかのようにリセットされます。これを実行してもよろしいですか?" -confirmRestore = 0, "#%s#を復元してもよろしいですか?" - -#CHANGED=============================================> -debugStatus = 0, "ユーザー数: " -debugStatus = 1, "現在のユーザー: " -debugStatus = 2, "現在のタイトル: " -debugStatus = 3, "安全なタイトル: " -debugStatus = 4, "ソートの種類: " -#<==================================================== - -dialogNo = 0, "いいえ [B]" -dialogOK = 0, "了解 [A]" -dialogYes = 0, "はい [A]" -extrasMenu = 0, "SDからSDブラウザ" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "保留中のアップデータを削除する" -extrasMenu = 6, "プロセスを終了します" -extrasMenu = 7, "マウントシステムSave" -extrasMenu = 8, "タイトルの再スキャン" -extrasMenu = 9, "マウントプロセスRomFS" -extrasMenu = 10, "JKSVフォルダをバックアップ" -extrasMenu = 11, "*[DEV]* 出力en-US" -fileModeFileProperties = 0, "パス: %s\n容量: %s" -fileModeFolderProperties = 0, "パス: %s\nサブフォルダ: %u\nファイル数: %u\n全体の大きさ: %s" -fileModeMenu = 0, "コピー先 " -fileModeMenu = 1, "削除" -fileModeMenu = 2, "リネーム" -fileModeMenu = 3, "ディレクトリ作成" -fileModeMenu = 4, "プロパティ" -fileModeMenu = 5, "閉じる" -fileModeMenu = 6, "パスフィルターに追加" -fileModeMenuMkDir = 0, "新規" -folderMenuNew = 0, "新規バックアップ" - -#CHANGED=============================================> -helpFolder = 0, "[A] 選択 [Y] リストア [X] 削除 [ZR] アップロード [B] 閉じる" -#<==================================================== - -helpSettings = 0, "[A] トグル [X] デフォルト [B] 戻る" -helpTitle = 0, "[A] 選択 [L][R] ジャンプ [Y] お気に入り [X] タイトルオプション [B] 戻る" -helpUser = 0, "[A] 選択 [X] ユーザー設定" -holdingText = 0, "(所有) " -holdingText = 1, "(保持し続けます) " -holdingText = 2, "(もうすぐです!) " - -#CHANGED=============================================> -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "プレイ時間: %02d:%02d" -infoStatus = 3, "起動回数: %u" -infoStatus = 4, "出版社: %s" -infoStatus = 5, "セーブの種類: %s" -infoStatus = 6, "キャッシュインデックス: %u" -infoStatus = 7, "ユーザー: %s" -#<===================================================== - -loadingStartPage = 0, "読み込み中..." -mainMenuExtras = 0, "エクストラ" -mainMenuSettings = 0, "設定" -onlineErrorConnecting = 0, "接続エラー!" -onlineNoUpdates = 0, "利用可能なアップデートはありません。" -popAddedToPathFilter = 0, "'#%s#' パスフィルターに追加されました。" -popCPUBoostEnabled = 0, "ZIPでCPUブーストが有効になっています。" -popChangeOutputError = 0, "#%s# は、不正な文字または非ASCII文字が含まれています。" -popChangeOutputFolder = 0, "#%s# から #%s# に変更" - -#CHANGED=============================================> -popDriveFailed = 0, "Google Driveの起動に失敗しました。" -popRemoteNotActive = 0, "Remoteドライブは使用できません" -popDriveStarted = 0, "Google Driveが正常に起動しました。" -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -#<==================================================== - -popErrorCommittingFile = 0, "保存するファイルのコミット中にエラーが発生しました!" -popFolderIsEmpty = 0, "フォルダは空です!" -popProcessShutdown = 0, "#%s# 正常にシャットダウンしました。" - -#CHANGED=============================================> -popSVIExported = 0, "SVIをエクスポートしました。" -#<==================================================== - -popSaveIsEmpty = 0, "セーブデータは空です!" -popTrashEmptied = 0, "ゴミ箱を空にする" -popZipIsEmpty = 0, "ZIPファイルは空です!" -saveDataBackupDeleted = 0, "#%s#が削除されました。" -saveDataBackupMovedToTrash = 0, "#%s#はゴミ箱に移動されました" -saveDataCreatedForUser = 0, "#%s#用に作成されたデータを保存する!" -saveDataCreationFailed = 0, "セーブデータの作成に失敗しました!" -saveDataDeleteAllUser = 0, "#%s#のすべての保存データを削除してもよろしいですか?*" -saveDataDeleteSuccess = 0, "#%s#のセーブデータは削除されました!" -saveDataExtendFailed = 0, "セーブデータの拡張に失敗しました。" -saveDataExtendSuccess = 0, "#%s#のセーブデータを拡張!" -saveDataIndexText = 0, "存檔索引號:" -saveDataNoneFound = 0, "#%s#のセーブデータが見つかりません!" -saveDataResetSuccess = 0, "#%s#のセーブデータをリセット!" -saveDataTypeText = 0, "システム\n" -saveDataTypeText = 1, "アカウント\n" -saveDataTypeText = 2, "BCAT\n" -saveDataTypeText = 3, "デバイス\n" -saveDataTypeText = 4, "一時的なもの\n" -saveDataTypeText = 5, "キャッシュ\n" -saveDataTypeText = 6, "システムBCAT\n" -saveTypeMainMenu = 0, "デバイス" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "キャッシュ" -saveTypeMainMenu = 3, "システム" -saveTypeMainMenu = 4, "システム BCAT" -saveTypeMainMenu = 5, "システマティックストレージ機器" -settingsMenu = 0, "ゴミ箱を空にする" -settingsMenu = 1, "アップデートを確認する" -settingsMenu = 2, "JKSVセーブデータ保存出力フォルダを設定する" -settingsMenu = 3, "ブラックリストに載っているタイトルを編集する" -settingsMenu = 4, "すべての保存バックアップを削除する" -settingsMenu = 5, "ユーザーと一緒にデバイスのセーブデータを含める: " -settingsMenu = 6, "復元時の自動バックアップ: " -settingsMenu = 7, "自動名前バックアップ: " -settingsMenu = 8, "オーバークロック/CPUブースト: " -settingsMenu = 9, "削除するために保持: " -settingsMenu = 10, "保持して復元: " -settingsMenu = 11, "上書きするために保持: " -settingsMenu = 12, "フォースマウント: " -settingsMenu = 13, "アカウントシステムセーブデータ: " -settingsMenu = 14, "システムセーブデータへの書き込みを有効にする: " -settingsMenu = 15, "FSコマンドを直接使用する: " -settingsMenu = 16, "セーブデータをZIPにエクスポート: " -settingsMenu = 17, "英語を強制的に使用する: " -settingsMenu = 18, "ごみ箱を有効にする: " -settingsMenu = 19, "タイトルの並べ替えタイプ: " -settingsMenu = 20, "アニメーションスケール: " -settingsOff = 0, "オフ" -settingsOn = 0, ">オン>" -sortType = 0, "アルファベット順" -sortType = 1, "プレイ時間" -sortType = 2, "最後にプレイ" -swkbdEnterName = 0, "新しい名前を入力してください" -swkbdExpandSize = 0, "新しいサイズをMBで入力" -swkbdMkDir = 0, "フォルダ名を入力してください" -swkbdNewSafeTitle = 0, "新規出力先フォルダを入力してください" -swkbdProcessID = 0, "プロセスIDを入力してください" -swkbdRename = 0, "アイテムの新しい名前を入力してください" -swkbdSaveIndex = 0, "キャッシュインデックスを入力してください" -swkbdSetWorkDir = 0, "新しい出力パスを入力してください" -swkbdSysSavID = 0, "システムセーブIDを入力してください" -threadStatusAddingFileToZip = 0, "#%s#をZIPに追加中..." - -#CHANGED=============================================> -threadStatusCalculatingSaveSize = 0, "保存データサイズの算出中..." -#<==================================================== - -threadStatusCheckingForUpdate = 0, "アップデートの確認中..." - -#CHANGED=============================================> -threadStatusCompressingSaveForUpload = 0, "アップロードのために #%s# を圧縮中..." -#<==================================================== - -threadStatusCopyingFile = 0, "#%s#をコピーしています..." -threadStatusCreatingSaveData = 0, "#%s#のセームデータの作成中..." -threadStatusDecompressingFile = 0, "#%s#の解凍中..." -threadStatusDeletingFile = 0, "削除中..." -threadStatusDeletingSaveData = 0, "#%s#のセーブデータを削除中..." -threadStatusDeletingUpdate = 0, "保留中のアップデータを削除中..." - -#CHANGED=============================================> -threadStatusDownloadingFile = 0, "ダウンロード中 #%s#..." -#<==================================================== - -threadStatusDownloadingUpdate = 0, "アップデータをダウンロード中..." -threadStatusExtendingSaveData = 0, "#%s#のセーブデータを拡張中..." -threadStatusGetDirProps = 0, "フォルダプロパティの取得中..." -threadStatusOpeningFolder = 0, "#%s#を開き中..." -threadStatusPackingJKSV = 0, "JKSVフォルダの内容をZIPに書き込み中..." -threadStatusResettingSaveData = 0, "セーブデータをリストアしています..." -threadStatusSavingTranslations = 0, "ファイルマスタの保存中..." - -#CHANGED=============================================> -threadStatusUploadingFile = 0, "アップロード中 #%s#..." -#<==================================================== - -titleOptions = 0, "インフォメーション" -titleOptions = 1, "ブラックリスト" -titleOptions = 2, "出力フォルダを変更する" -titleOptions = 3, "ファイルモードで開く" -titleOptions = 4, "すべてのセーブデータバックアップを削除する" -titleOptions = 5, "セーブデータをリセット" -titleOptions = 6, "セーブデータを削除" -titleOptions = 7, "セーブデータを拡張" - -#CHANGED=============================================> -titleOptions = 8, "エクスポートSVI" -#<==================================================== - -translationMainPage = 0, "翻訳: " -userOptions = 0, "すべてをダンプする " -userOptions = 1, "セーブデータを作成" -userOptions = 2, "全てのセーブデータを作成" -userOptions = 3, "全てのユーザーセーブデータを削除" diff --git a/romfs/lang/ko.txt b/romfs/lang/ko.txt deleted file mode 100644 index 3ff87d8..0000000 --- a/romfs/lang/ko.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "블랙리스트에 #%s#을(를) 추가하겠습니까?" -confirmCopy = 0, "#%s#을(를) #%s#에 복사하겠습니까?" -confirmCreateAllSaveData = 0, "이 시스템에서 #%s#에 대한 모든 저장 데이터를 생성하겠습니까? 검색된 타이틀 수에 따라 시간이 걸릴 수 있습니다." -confirmDelete = 0, "#%s#을(를) 삭제하겠습니까? *영구적입니다*!" -confirmDeleteBackupsAll = 0, "모든 게임에 대한 *모든* 저장 백업을 삭제하겠습니까?" -confirmDeleteBackupsTitle = 0, "#%s#에 대한 모든 백업 백업을 삭제하겠습니까?" -confirmDeleteSaveData = 0, "경고*: 이렇게 하면 #%s#에 대한 저장 데이터가 *시스템에서* 지워집니다. 정말 하겠습니까?" -confirmDriveOverwrite = 0, "드라이브에서 이 백업을 다운로드하면 SD 카드에 있는 백업을 덮어씁니다. 계속합니까?" -confirmOverwrite = 0, "#%s#을(를) 덮어쓰시겠습니까?" -confirmResetSaveData = 0, "경고*: 이렇게 하면 이 게임의 저장 데이터가 이전에 실행되지 않은 것처럼 *리셋됩니다*. 정말 하겠습니까?" -confirmRestore = 0, "#%s#을(를) 복원하겠습니까?" -debugStatus = 0, "사용자 수: " -debugStatus = 1, "현자 사용자: " -debugStatus = 2, "현재 제목: " -debugStatus = 3, "안전 제목: " -debugStatus = 4, "정렬 유형: " -dialogNo = 0, "아니오 [B]" -dialogOK = 0, "확인 [A]" -dialogYes = 0, "예 [A]" -extrasMenu = 0, "SD에서 SD 브라우저로" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: 안전" -extrasMenu = 3, "BIS: 시스템" -extrasMenu = 4, "BIS: 사용자" -extrasMenu = 5, "보류 중인 업데이트 제거" -extrasMenu = 6, "프로세스 종료" -extrasMenu = 7, "시스템 저장 인식" -extrasMenu = 8, "제목 다시 검색" -extrasMenu = 9, "프로세스 RomFS 인식" -extrasMenu = 10, "JKSV 폴더 백업" -extrasMenu = 11, "*[DEV]* 출력 en-US" -fileModeFileProperties = 0, "경로: %s\n크기: %s" -fileModeFolderProperties = 0, "경로: %s\n하위 폴더: %u\n파일 수: %u\n전체 크기: %s" -fileModeMenu = 0, "에게 복사 " -fileModeMenu = 1, "삭제" -fileModeMenu = 2, "이름 바꾸기" -fileModeMenu = 3, "폴더 만들기" -fileModeMenu = 4, "속성" -fileModeMenu = 5, "닫기" -fileModeMenu = 6, "경로 필터에 추가" -fileModeMenuMkDir = 0, "새로 만들기" -folderMenuNew = 0, "새 백업" -helpFolder = 0, "[A] 선택 [Y] 복원 [X] 삭제 [ZR] 업로드 [B] 닫기" -helpSettings = 0, "[A] 전환 [X] 기본 [B] 뒤로가기" -helpTitle = 0, "[A] 선택 [L][R] 점프 [Y] 즐겨찾기 [X] 제목 옵션 [B] 뒤로가기" -helpUser = 0, "[A] 선택 [Y] 모든 세이브 덤프 [X] 사용자 옵션" -holdingText = 0, "(길게 누르기) " -holdingText = 1, "(계속 누르기) " -holdingText = 2, "(거의 완료!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "즐긴 시간: %02d:%02d" -infoStatus = 3, "총 실행 수: %u" -infoStatus = 4, "발행자: %s" -infoStatus = 5, "저장 유형: %s" -infoStatus = 6, "캐시 인덱스: %u" -infoStatus = 7, "사용자: %s" -infoStatus = 9, "" -loadingStartPage = 0, "로드 중..." -mainMenuExtras = 0, "추가" -mainMenuSettings = 0, "설정" -onlineErrorConnecting = 0, "연결 오류!" -onlineNoUpdates = 0, "사용 가능한 업데이트가 없습니다." -popAddedToPathFilter = 0, "'#%s#'이(가) 경로 필터에 추가되었습니다." -popCPUBoostEnabled = 0, "ZIP를 위한 CPU 부스트가 활성화되었습니다." -popChangeOutputError = 0, "#%s#에 잘못된 또는 ASCII가 아닌 문자가 포함되어 있습니다." -popChangeOutputFolder = 0, "#%s#이(가) #%s#로 변경되었습니다." -popDriveFailed = 0, "구글 드라이브 시작에 실패했습니다." -popRemoteNotActive = 0, "구글 드라이브를 사용할 수 없습니다." -popDriveStarted = 0, "구글 드라이브가 성공적으로 시작되었습니다." -popWebdavStarted = 0, "Webdav가 성공적으로 시작되었습니다." -popWebdavFailed =, 0, "Webdav를 시작하지 못했습니다." -popErrorCommittingFile = 0, "저장할 파일을 커밋하는 동안 오류가 발생했습니다!" -popFolderIsEmpty = 0, "폴더가 비어 있습니다!" -popProcessShutdown = 0, "#%s#이(가) 성공적으로 종료되었습니다." -popSVIExported = 0, "SVI를 내보냈습니다." -popSaveIsEmpty = 0, "저장 데이터가 비어 있습니다!" -popTrashEmptied = 0, "휴지통이 비었습니다." -popZipIsEmpty = 0, "ZIP 파일이 비어 있습니다!" -saveDataBackupDeleted = 0, "#%s#이(가) 삭제되었습니다." -saveDataBackupMovedToTrash = 0, "#%s#이(가) 휴지통으로 이동되었습니다." -saveDataCreatedForUser = 0, "%s에 대해 생성된 데이터 저장!" -saveDataCreationFailed = 0, "저장 데이터 생성 실패!" -saveDataDeleteAllUser = 0, "*%s에 대한 모든 저장 데이터를 삭제하겠습니까?*" -saveDataDeleteSuccess = 0, "#%s#에 대한 저장 데이터가 삭제되었습니다!" -saveDataExtendFailed = 0, "저장 데이터 확장에 실패했습니다." -saveDataExtendSuccess = 0, "#%s#에 대한 데이터 저장이 확장되었습니다!" -saveDataNoneFound = 0, "#%s#에 대한 저장을 찾을 수 없습니다!" -saveDataResetSuccess = 0, "#%s# 재설정을 위해 저장합니다!" -saveDataTypeText = 0, "시스템" -saveDataTypeText = 1, "계정" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "장치" -saveDataTypeText = 4, "임시" -saveDataTypeText = 5, "캐시" -saveDataTypeText = 6, "시스템 BCAT" -saveTypeMainMenu = 0, "장치" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "캐시" -saveTypeMainMenu = 3, "시스템" -saveTypeMainMenu = 4, "시스템 BCAT" -saveTypeMainMenu = 5, "SysTemp 스토리지템" -settingsMenu = 0, "휴지통 비우기" -settingsMenu = 1, "업데이트 확인" -settingsMenu = 2, "JKSV 저장 출력 폴더 설정" -settingsMenu = 3, "블랙리스트에 있는 제목 편집" -settingsMenu = 4, "모든 저장 백업 삭제" -settingsMenu = 5, "사용자와 함께 장치 저장 포함: " -settingsMenu = 6, "복원 시 자동 백업: " -settingsMenu = 7, "자동 이름 백업: " -settingsMenu = 8, "오버클럭/CPU 부스트: " -settingsMenu = 9, "삭제하려면 길게 누르기: " -settingsMenu = 10, "복원하려면 길게 누르기: " -settingsMenu = 11, "덮어쓰려면 길게 누르기: " -settingsMenu = 12, "강제 인식: " -settingsMenu = 13, "계정 시스템 저장: " -settingsMenu = 14, "시스템 저장에 쓰기 활성화: " -settingsMenu = 15, "FS 명령을 직접 사용: " -settingsMenu = 16, "저장된 파일을 ZIP으로 내보내기: " -settingsMenu = 17, "강제 영어 사용: " -settingsMenu = 18, "휴지통 활성화: " -settingsMenu = 19, "제목 정렬 유형: " -settingsMenu = 20, "애니메이션 스케일: " -settingsOff = 0, "끔" -settingsOn = 0, ">켬>" -sortType = 0, "알파벳" -sortType = 1, "즐긴 시간" -sortType = 2, "마지막 실행" -swkbdEnterName = 0, "새 이름 입력" -swkbdExpandSize = 0, "새 MB 크기 입력" -swkbdMkDir = 0, "폴더 이름 입력" -swkbdNewSafeTitle = 0, "새 출력 폴더 입력" -swkbdProcessID = 0, "프로세스 ID 입력" -swkbdRename = 0, "항목의 새 이름을 입력" -swkbdSaveIndex = 0, "캐시 인덱스 입력" -swkbdSetWorkDir = 0, "새 출력 경로 입력" -swkbdSysSavID = 0, "시스템 저장 ID 입력" -threadStatusAddingFileToZip = 0, "'#%s#'을(를) ZIP에 추가하는 중..." -threadStatusCalculatingSaveSize = 0, "저장 데이터 크기 계산 중..." -threadStatusCheckingForUpdate = 0, "업데이트 확인 중..." -threadStatusCompressingSaveForUpload = 0, "업로드를 위해 #%s# 압축 중..." -threadStatusCopyingFile = 0, "'#%s#' 복사 중..." -threadStatusCreatingSaveData = 0, "#%s#에 대한 저장 데이터 생성 중..." -threadStatusDecompressingFile = 0, "'#%s#' 압축 해제 중..." -threadStatusDeletingFile = 0, "삭제 중..." -threadStatusDeletingSaveData = 0, "#%s#에 대한 저장 데이터 삭제 중..." -threadStatusDeletingUpdate = 0, "대기 중인 업데이트 삭제 중..." -threadStatusDownloadingFile = 0, "#%s# 다운로드 중..." -threadStatusDownloadingUpdate = 0, "업데이트 다운로드 중..." -threadStatusExtendingSaveData = 0, "#%s#에 대한 저장 데이터 확장 중..." -threadStatusGetDirProps = 0, "폴더 속성 가져오기..." -threadStatusOpeningFolder = 0, "'#%s#'을(를) 여는 중..." -threadStatusPackingJKSV = 0, "JKSV 폴더 내용을 ZIP에 쓰는 중..." -threadStatusResettingSaveData = 0, "저장 데이터 재설정 중..." -threadStatusSavingTranslations = 0, "마스터 파일 저장 중..." -threadStatusUploadingFile = 0, "#%s# 업로드 중..." -titleOptions = 0, "정보" -titleOptions = 1, "블랙리스트" -titleOptions = 2, "출력 폴더 변경" -titleOptions = 3, "파일 모드에서 열기" -titleOptions = 4, "모든 저장 백업 삭제" -titleOptions = 5, "저장 데이터 재설정" -titleOptions = 6, "저장 데이터 삭제" -titleOptions = 7, "저장 데이터 확장" -titleOptions = 8, "SVI 내보내기" -translationMainPage = 0, "번역: " -userOptions = 0, "에 대해 모두 덤프 " -userOptions = 1, "저장 데이터 생성" -userOptions = 2, "모든 저장 데이터 생성" -userOptions = 3, "모든 사용자 저장 삭제" diff --git a/romfs/lang/nl.txt b/romfs/lang/nl.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/nl.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/pt-BR.txt b/romfs/lang/pt-BR.txt deleted file mode 100644 index cacbdf3..0000000 --- a/romfs/lang/pt-BR.txt +++ /dev/null @@ -1,156 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: " -infoStatus = 1, "SID: " -infoStatus = 2, "Play Time: " -infoStatus = 3, "Total Launches: " -infoStatus = 4, "User Count: " -infoStatus = 5, "Current User: " -infoStatus = 6, "Current Title: " -infoStatus = 7, "Safe Title: " -infoStatus = 8, "Sort Type: " -infoStatus = 9, "Saving the file master..." -infoStatus = 10, "Deleting..." -infoStatus = 11, "Trash emptied." -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSaveIsEmpty = 0, "Save data is empty!" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataIndexText = 0, "存檔索引號:" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "系統存檔\n" -saveDataTypeText = 1, "用戶存檔\n" -saveDataTypeText = 2, "BCAT存檔\n" -saveDataTypeText = 3, "設備存檔\n" -saveDataTypeText = 4, "臨時存檔\n" -saveDataTypeText = 5, "緩存存檔\n" -saveDataTypeText = 6, "系統BCAT存檔\n" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/pt.txt b/romfs/lang/pt.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/pt.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/ru.txt b/romfs/lang/ru.txt deleted file mode 100644 index 090e6ee..0000000 --- a/romfs/lang/ru.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "Are you sure you want to add #%s# to your blacklist?" -confirmCopy = 0, "Are you sure you want to copy #%s# to #%s#?" -confirmCreateAllSaveData = 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found." -confirmDelete = 0, "Are you sure you want to delete #%s#? *This is permanent*!" -confirmDeleteBackupsAll = 0, "Are you sure you would like to delete *all* of your save backups for all of your games?" -confirmDeleteBackupsTitle = 0, "Are you sure you would like to delete all save backups for #%s#?" -confirmDeleteSaveData = 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?" -confirmDriveOverwrite = 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?" -confirmOverwrite = 0, "Are you sure you want to overwrite #%s#?" -confirmResetSaveData = 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?" -confirmRestore = 0, "Are you sure you want to restore #%s#?" -debugStatus = 0, "User Count: " -debugStatus = 1, "Current User: " -debugStatus = 2, "Current Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "Sort Type: " -dialogNo = 0, "No [B]" -dialogOK = 0, "OK [A]" -dialogYes = 0, "Yes [A]" -extrasMenu = 0, "SD to SD Browser" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "Remove Pending Update" -extrasMenu = 6, "Terminate Process" -extrasMenu = 7, "Mount System Save" -extrasMenu = 8, "Rescan Titles" -extrasMenu = 9, "Mount Process RomFS" -extrasMenu = 10, "Backup JKSV Folder" -extrasMenu = 11, "*[DEV]* Output en-US" -fileModeFileProperties = 0, "Path: %s\nSize: %s" -fileModeFolderProperties = 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s" -fileModeMenu = 0, "Copy To " -fileModeMenu = 1, "Delete" -fileModeMenu = 2, "Rename" -fileModeMenu = 3, "Make Dir" -fileModeMenu = 4, "Properties" -fileModeMenu = 5, "Close" -fileModeMenu = 6, "Add to Path Filters" -fileModeMenuMkDir = 0, "New" -folderMenuNew = 0, "New Backup" -helpFolder = 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close" -helpSettings = 0, "[A] Toggle [X] Defaults [B] Back" -helpTitle = 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back" -helpUser = 0, "[A] Select [Y] Dump All Saves [X] User Options" -holdingText = 0, "(Hold) " -holdingText = 1, "(Keep Holding) " -holdingText = 2, "(Almost There!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "Play Time: %02d:%02d" -infoStatus = 3, "Total Launches: %u" -infoStatus = 4, "Publisher: %s" -infoStatus = 5, "Save Type: %s" -infoStatus = 6, "Cache Index: %u" -infoStatus = 7, "User: %s" -infoStatus = 9, "" -loadingStartPage = 0, "Loading..." -mainMenuExtras = 0, "Extras" -mainMenuSettings = 0, "Settings" -onlineErrorConnecting = 0, "Error Connecting!" -onlineNoUpdates = 0, "No Updates Available." -popAddedToPathFilter = 0, "'#%s#' added to path filters." -popCPUBoostEnabled = 0, "CPU Boost Enabled for ZIP." -popChangeOutputError = 0, "#%s# contains illegal or non-ASCII characters." -popChangeOutputFolder = 0, "#%s# changed to #%s#" -popDriveFailed = 0, "Failed to start Google Drive." -popRemoteNotActive = 0, "Remote is not available" -popDriveStarted = 0, "Google Drive started successfully." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "Error committing file to save!" -popFolderIsEmpty = 0, "Folder is empty!" -popProcessShutdown = 0, "#%s# successfully shutdown." -popSVIExported = 0, "SVI Exported." -popSaveIsEmpty = 0, "Save data is empty!" -popTrashEmptied = 0, "Trash emptied" -popZipIsEmpty = 0, "ZIP file is empty!" -saveDataBackupDeleted = 0, "#%s# has been deleted." -saveDataBackupMovedToTrash = 0, "#%s# has been moved to trash." -saveDataCreatedForUser = 0, "Save data created for %s!" -saveDataCreationFailed = 0, "Save data creation failed!" -saveDataDeleteAllUser = 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*" -saveDataDeleteSuccess = 0, "Save data for #%s# deleted!" -saveDataExtendFailed = 0, "Failed to extend save data." -saveDataExtendSuccess = 0, "Save data for #%s# extended!" -saveDataNoneFound = 0, "No saves found for #%s#!" -saveDataResetSuccess = 0, "Save for #%s# reset!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "Empty Trash Bin" -settingsMenu = 1, "Check for Updates" -settingsMenu = 2, "Set JKSV Save Output Folder" -settingsMenu = 3, "Edit Blacklisted Titles" -settingsMenu = 4, "Delete All Save Backups" -settingsMenu = 5, "Include Device Saves With Users: " -settingsMenu = 6, "Auto Backup On Restore: " -settingsMenu = 7, "Auto-Name Backups: " -settingsMenu = 8, "Overclock/CPU Boost: " -settingsMenu = 9, "Hold To Delete: " -settingsMenu = 10, "Hold To Restore: " -settingsMenu = 11, "Hold To Overwrite: " -settingsMenu = 12, "Force Mount: " -settingsMenu = 13, "Account System Saves: " -settingsMenu = 14, "Enable Writing to System Saves: " -settingsMenu = 15, "Use FS Commands Directly: " -settingsMenu = 16, "Export Saves to ZIP: " -settingsMenu = 17, "Force English To Be Used: " -settingsMenu = 18, "Enable Trash Bin: " -settingsMenu = 19, "Title Sorting Type: " -settingsMenu = 20, "Animation Scale: " -settingsOff = 0, "Off" -settingsOn = 0, ">On>" -sortType = 0, "Alphabetical" -sortType = 1, "Time Played" -sortType = 2, "Last Played" -swkbdEnterName = 0, "Enter a new name" -swkbdExpandSize = 0, "Enter New Size in MB" -swkbdMkDir = 0, "Enter a folder name" -swkbdNewSafeTitle = 0, "Input New Output Folder" -swkbdProcessID = 0, "Enter Process ID" -swkbdRename = 0, "Enter a new name for item" -swkbdSaveIndex = 0, "Enter Cache Index" -swkbdSetWorkDir = 0, "Enter a new Output Path" -swkbdSysSavID = 0, "Enter System Save ID" -threadStatusAddingFileToZip = 0, "Adding '#%s#' to ZIP..." -threadStatusCalculatingSaveSize = 0, "Calculating save data size..." -threadStatusCheckingForUpdate = 0, "Checking for updates..." -threadStatusCompressingSaveForUpload = 0, "Compressing #%s# for upload..." -threadStatusCopyingFile = 0, "Copying '#%s#'..." -threadStatusCreatingSaveData = 0, "Creating Save Data for #%s#..." -threadStatusDecompressingFile = 0, "Decompressing '#%s#'..." -threadStatusDeletingFile = 0, "Deleting..." -threadStatusDeletingSaveData = 0, "Deleting Save Data for #%s#..." -threadStatusDeletingUpdate = 0, "Deleting pending update..." -threadStatusDownloadingFile = 0, "Downloading #%s#..." -threadStatusDownloadingUpdate = 0, "Downloading update..." -threadStatusExtendingSaveData = 0, "Extending Save Data for #%s#..." -threadStatusGetDirProps = 0, "Getting Folder Properties..." -threadStatusOpeningFolder = 0, "Opening '#%s#'..." -threadStatusPackingJKSV = 0, "Writing JKSV folder contents to ZIP..." -threadStatusResettingSaveData = 0, "Resetting save data..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "Uploading #%s#..." -titleOptions = 0, "Information" -titleOptions = 1, "Blacklist" -titleOptions = 2, "Change Output Folder" -titleOptions = 3, "Open in File Mode" -titleOptions = 4, "Delete All Save Backups" -titleOptions = 5, "Reset Save Data" -titleOptions = 6, "Delete Save Data" -titleOptions = 7, "Extend Save Data" -titleOptions = 8, "Export SVI" -translationMainPage = 0, "Translation: " -userOptions = 0, "Dump All For " -userOptions = 1, "Create Save Data" -userOptions = 2, "Create All Save Data" -userOptions = 3, "Delete All User Saves" diff --git a/romfs/lang/zh-CN.txt b/romfs/lang/zh-CN.txt deleted file mode 100644 index bcf2353..0000000 --- a/romfs/lang/zh-CN.txt +++ /dev/null @@ -1,170 +0,0 @@ -author = 0, "NULL" -confirmBlacklist = 0, "是否确定要将#%s#添加到您的黑名单中?" -confirmCopy = 0, "是否确定要将#%s#复制到#%s#?" -confirmCreateAllSaveData = 0, "是否确定要在此系统上为#%s#创建所有存档数据?这可能需要一些时间,具体取决于找到的Title的数量。" -confirmDelete = 0, "是否确定要删除#%s#?*这是永久的*!" -confirmDeleteBackupsAll = 0, "是否确定要删除您所有游戏的*所有*存档备份?" -confirmDeleteBackupsTitle = 0, "是否确定要删除#%s#的所有存档备份?" -confirmDeleteSaveData = 0, "*警告*:这*将会*从*系统*中删除#%s#的存档数据。您确定要这样做吗?" -confirmDriveOverwrite = 0, "下载这个备份将会覆盖您的SD卡上的备份。是否继续?" -confirmOverwrite = 0, "是否确定要覆盖#%s#?" -confirmResetSaveData = 0, "*警告*:这*将会*重置此游戏的存档数据,就像以前从未运行过一样。您确定要这样做吗?" -confirmRestore = 0, "是否确定要还原#%s#?" -debugStatus = 0, "用户数量: " -debugStatus = 1, "当前用户: " -debugStatus = 2, "当前Title: " -debugStatus = 3, "安全Title: " -debugStatus = 4, "排序方式: " -dialogNo = 0, "否 [B]" -dialogOK = 0, "确定 [A]" -dialogYes = 0, "是 [A]" -extrasMenu = 0, "文件管理器" -extrasMenu = 1, "BIS分区:ProdInfoF" -extrasMenu = 2, "BIS分区:Safe" -extrasMenu = 3, "BIS分区:System" -extrasMenu = 4, "BIS分区:User" -extrasMenu = 5, "删除挂起的更新" -extrasMenu = 6, "终止进程" -extrasMenu = 7, "挂载系统存档" -extrasMenu = 8, "重新扫描Title" -extrasMenu = 9, "挂载进程RomFS" -extrasMenu = 10, "备份JKSV文件夹" -extrasMenu = 11, "*[开发者]* 输出en-US" -fileModeFileProperties = 0, "路径:%s\n大小:%s" -fileModeFolderProperties = 0, "路径:%s\n子目录:%u\n文件数量:%u\n总大小:%s" -fileModeMenu = 0, "复制到" -fileModeMenu = 1, "删除" -fileModeMenu = 2, "重命名" -fileModeMenu = 3, "新建文件夹" -fileModeMenu = 4, "属性" -fileModeMenu = 5, "关闭" -fileModeMenu = 6, "添加到路径过滤器" -fileModeMenuMkDir = 0, "新建" -folderMenuNew = 0, "新建备份" -helpFolder = 0, "[A] 选择 [Y] 还原 [X] 删除 [ZR] 上传 [B] 关闭" -helpSettings = 0, "[A] 切换 [X] 恢复默认 [B] 返回" -helpTitle = 0, "[A] 选择 [L][R] 翻页 [Y] 收藏 [X] Title选项 [B] 返回" -helpUser = 0, "[A] 选择 [Y] 转储所有存档 [X] 用户选项" -holdingText = 0, "(按住)" -holdingText = 1, "(继续按住)" -holdingText = 2, "(快好了!)" -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "游玩时间: %02d:%02d" -infoStatus = 3, "启动次数: %u" -infoStatus = 4, "发行商: %s" -infoStatus = 5, "存档类型: %s" -infoStatus = 6, "缓存索引: %u" -infoStatus = 7, "用户: %s" -loadingStartPage = 0, "加载中..." -mainMenuExtras = 0, "附加功能" -mainMenuSettings = 0, "系统设置" -onlineErrorConnecting = 0, "连接错误!" -onlineNoUpdates = 0, "没有可用的更新。" -popAddedToPathFilter = 0, "'#%s#'已添加到路径过滤器。" -popCPUBoostEnabled = 0, "为ZIP压缩启用CPU超频。" -popChangeOutputError = 0, "#%s#包含非法或者非ASCII的字符。" -popChangeOutputFolder = 0, "#%s#更改到#%s#" -popDriveFailed = 0, "Google Drive启动失败。" -popRemoteNotActive = 0, "Remote不可用。" -popDriveStarted = 0, "Google Drive启动成功。" -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "提交要保存的文件时出错!" -popFolderIsEmpty = 0, "文件夹为空!" -popProcessShutdown = 0, "#%s#已成功关闭。" -popSVIExported = 0, "SVI文件已导出" -popSaveIsEmpty = 0, "存档数据为空!" -popTrashEmptied = 0, "回收站已清空" -popZipIsEmpty = 0, "ZIP文件为空!" -saveDataBackupDeleted = 0, "#%s#已被删除。" -saveDataBackupMovedToTrash = 0, "#%s#已被移到回收站。" -saveDataCreatedForUser = 0, "%s的存档数据已创建!" -saveDataCreationFailed = 0, "存档数据创建失败!" -saveDataDeleteAllUser = 0, "*确定要删除%s的所有存档数据吗?*" -saveDataDeleteSuccess = 0, "#%s#的存档数据已删除!" -saveDataExtendFailed = 0, "扩展存档数据失败。" -saveDataExtendSuccess = 0, "#%s#的存档数据已扩展!" -saveDataNoneFound = 0, "没有找到#%s#的存档!" -saveDataResetSuccess = 0, "#%s#的存档已重置!" -saveDataTypeText = 0, "系统存档" -saveDataTypeText = 1, "用户存档" -saveDataTypeText = 2, "BCAT存档" -saveDataTypeText = 3, "设备存档" -saveDataTypeText = 4, "临时存档" -saveDataTypeText = 5, "缓存存档" -saveDataTypeText = 6, "系统BCAT存档" -saveTypeMainMenu = 0, "设备" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "缓存" -saveTypeMainMenu = 3, "系统" -saveTypeMainMenu = 4, "系统BCAT" -saveTypeMainMenu = 5, "临时" -settingsMenu = 0, "清空回收站" -settingsMenu = 1, "检查更新" -settingsMenu = 2, "设置JKSV的存档输出文件夹" -settingsMenu = 3, "编辑Title黑名单" -settingsMenu = 4, "删除所有存档备份" -settingsMenu = 5, "用户存档中包含设备存档:" -settingsMenu = 6, "恢复时自动备份:" -settingsMenu = 7, "自动命名备份:" -settingsMenu = 8, "CPU超频:" -settingsMenu = 9, "按住以删除:" -settingsMenu = 10, "按住以恢复:" -settingsMenu = 11, "按住以覆盖:" -settingsMenu = 12, "强制挂载:" -settingsMenu = 13, "用户系统存档:" -settingsMenu = 14, "允许写入系统存档:" -settingsMenu = 15, "直接使用FS命令:" -settingsMenu = 16, "导出存档到ZIP文件:" -settingsMenu = 17, "强制使用英语:" -settingsMenu = 18, "启用回收站:" -settingsMenu = 19, "Title排序方式:" -settingsMenu = 20, "动画比例:" -settingsOff = 0, "关" -settingsOn = 0, ">开>" -sortType = 0, "按软件名" -sortType = 1, "按游玩时间" -sortType = 2, "按最近游玩" -swkbdEnterName = 0, "请输入新的名称" -swkbdExpandSize = 0, "请输入新的大小(单位MB)" -swkbdMkDir = 0, "请输入文件夹名称" -swkbdNewSafeTitle = 0, "请输入新的输出文件夹" -swkbdProcessID = 0, "请输入进程ID" -swkbdRename = 0, "请输入新的项目名称" -swkbdSaveIndex = 0, "请输入缓存索引" -swkbdSetWorkDir = 0, "请输入新的输出路径" -swkbdSysSavID = 0, "请输入系统存档ID" -threadStatusAddingFileToZip = 0, "正在添加'#%s#'到ZIP文件..." -threadStatusCalculatingSaveSize = 0, "正在计算存档数据大小..." -threadStatusCheckingForUpdate = 0, "正在检查更新..." -threadStatusCompressingSaveForUpload = 0, "正在压缩#%s#以便上传..." -threadStatusCopyingFile = 0, "正在复制'#%s#'..." -threadStatusCreatingSaveData = 0, "正在创建#%s#的存档数据..." -threadStatusDecompressingFile = 0, "正在解压'#%s#'..." -threadStatusDeletingFile = 0, "正在删除..." -threadStatusDeletingSaveData = 0, "正在删除#%s#的存档数据..." -threadStatusDeletingUpdate = 0, "正在删除挂起的更新..." -threadStatusDownloadingFile = 0, "正在下载#%s#..." -threadStatusDownloadingUpdate = 0, "正在下载更新..." -threadStatusExtendingSaveData = 0, "正在扩展#%s#的存档数据..." -threadStatusGetDirProps = 0, "正在获取文件夹属性..." -threadStatusOpeningFolder = 0, "正在打开'#%s#'..." -threadStatusPackingJKSV = 0, "正在写入JKSV文件夹的内容到ZIP文件..." -threadStatusResettingSaveData = 0, "正在重置存档数据..." -threadStatusSavingTranslations = 0, "Saving the file master..." -threadStatusUploadingFile = 0, "正在上传#%s#..." -titleOptions = 0, "信息" -titleOptions = 1, "黑名单" -titleOptions = 2, "更改输出文件夹" -titleOptions = 3, "在文件管理器中打开" -titleOptions = 4, "删除所有存档备份" -titleOptions = 5, "重置存档数据" -titleOptions = 6, "删除存档数据" -titleOptions = 7, "扩展存档数据" -titleOptions = 8, "导出SVI文件" -translationMainPage = 0, "翻译:" -userOptions = 0, "转储所有存档:" -userOptions = 1, "创建存档数据" -userOptions = 2, "创建所有游戏的存档数据" -userOptions = 3, "删除所有用户存档" diff --git a/romfs/lang/zh-TW.txt b/romfs/lang/zh-TW.txt deleted file mode 100644 index 08e8783..0000000 --- a/romfs/lang/zh-TW.txt +++ /dev/null @@ -1,171 +0,0 @@ -author = 0, "Leo" -confirmBlacklist = 0, "是否確定要將#%s#加入黑名單?" -confirmCopy = 0, "是否確定要將#%s#複製到#%s#?" -confirmCreateAllSaveData = 0, "是否確定要複製系統內所有遊戲進度並新增到使用者#%s#帳號內? 完成此操作的等待時間將取決於系統內的遊戲進度檔案數量." -confirmDelete = 0, "是否確定要刪除#%s#? *此為永久性刪除!*" -confirmDeleteBackupsAll = 0, "是否確定要刪除你備份所有遊戲的 *全部* 存檔進度?" -confirmDeleteBackupsTitle = 0, "是否確定要刪除#%s#的全部存檔進度?" -confirmDeleteSaveData = 0, "*注意*: 此操作 *將會* 完整刪除#%s# *在主機系統內* 的存檔進度. 請再次確認是否要繼續進行?" -confirmDriveOverwrite = 0, "準備將主機的儲存進度備份至記憶卡,將會覆蓋記憶卡上原有的備份檔案. 請再次確認是否要繼續進行?" -confirmOverwrite = 0, "是否確定要覆寫#%s#?" -confirmResetSaveData = 0, "*注意*: 此操作 *將會* 重置歸零此遊戲的存檔進度,像是從未執行過. 請再次確認是否要繼續進行?" -confirmRestore = 0, "是否確定要還原#%s#?" -debugStatus = 0, "使用者數量: " -debugStatus = 1, "目前使用者: " -debugStatus = 2, "目前的Title: " -debugStatus = 3, "Safe Title: " -debugStatus = 4, "排序準則: " -dialogNo = 0, "否 [B]" -dialogOK = 0, "確定 [A]" -dialogYes = 0, "是 [A]" -extrasMenu = 0, "檔案管理視窗" -extrasMenu = 1, "BIS: ProdInfoF" -extrasMenu = 2, "BIS: Safe" -extrasMenu = 3, "BIS: System" -extrasMenu = 4, "BIS: User" -extrasMenu = 5, "移除系統更新通知" -extrasMenu = 6, "終止指定程序" -extrasMenu = 7, "掛載系統存檔" -extrasMenu = 8, "重新掃瞄Titles" -extrasMenu = 9, "掛載RomFS程序" -extrasMenu = 10, "備份JKSV資料夾" -extrasMenu = 11, "*[DEV]* 使用英文介面" -fileModeFileProperties = 0, "路徑: %s\n大小: %s" -fileModeFolderProperties = 0, "路徑: %s\n子目錄: %u\n檔案總數: %u\n檔案容量: %s" -fileModeMenu = 0, "複製到" -fileModeMenu = 1, "刪除" -fileModeMenu = 2, "改檔名" -fileModeMenu = 3, "新建資料夾" -fileModeMenu = 4, "屬性" -fileModeMenu = 5, "關閉" -fileModeMenu = 6, "新增至路徑篩選器" -fileModeMenuMkDir = 0, "新建" -folderMenuNew = 0, "新建目錄" -helpFolder = 0, "[A] 選定 [Y] 還原 [X] 刪除 [ZR] 上傳 [B] 返回" -helpSettings = 0, "[A] 切換 [X] 恢復預設值 [B] 返回" -helpTitle = 0, "[A] 選定 [L][R] 翻頁 [Y] 最愛 [X] Title選項 [B] 返回" -helpUser = 0, "[A] 選定 [X] 使用者選項" -holdingText = 0, "(請按住) " -holdingText = 1, "(繼續按住) " -holdingText = 2, "(確認執行!) " -infoStatus = 0, "TID: %016lX" -infoStatus = 1, "SID: %016lX" -infoStatus = 2, "遊玩時間: %02d:%02d" -infoStatus = 3, "啟動次數: %u" -infoStatus = 4, "發行商: %s" -infoStatus = 5, "存檔類型: %s" -infoStatus = 6, "快取索引: %u" -infoStatus = 7, "使用者: %s" -loadingStartPage = 0, "加載中…" -mainMenuExtras = 0, "附加設定" -mainMenuSettings = 0, "系統設定" -onlineErrorConnecting = 0, "連線失敗!" -onlineNoUpdates = 0, "目前沒有可用的更新版本!" -popAddedToPathFilter = 0, "'#%s#' 已新增至路徑篩選器." -popCPUBoostEnabled = 0, "壓縮ZIP時將啟用CPU超頻." -popChangeOutputError = 0, "#%s# 包含非法或者非ASCII字元." -popChangeOutputFolder = 0, "#%s# 更改到 #%s#" -popDriveFailed = 0, "無法啟用Google雲端硬碟." -popRemoteNotActive = 0, "沒有可用的Remote雲端硬碟." -popDriveStarted = 0, "Google雲端硬碟已正確啟用." -popWebdavStarted = 0, "Webdav started successfully." -popWebdavFailed =, 0, "Failed to start Webdav." -popErrorCommittingFile = 0, "提交檔案進行儲存時發生錯誤!" -popFolderIsEmpty = 0, "資料夾內沒有檔案!" -popProcessShutdown = 0, "#%s# 程序已關閉." -popSVIExported = 0, "已匯出SVI." -popSaveIsEmpty = 0, "沒有找到存檔進度!" -popTrashEmptied = 0, "資源回收筒已清空" -popZipIsEmpty = 0, "ZIP壓縮檔內沒有檔案!" -saveDataBackupDeleted = 0, "#%s#已被刪除." -saveDataBackupMovedToTrash = 0, "#%s#已被移動至資源回收筒." -saveDataCreatedForUser = 0, "存檔已新增至%s!" -saveDataCreationFailed = 0, "存檔新增失敗!" -saveDataDeleteAllUser = 0, "*是否確認要刪除%s使用者的所有遊戲進度存檔?*" -saveDataDeleteSuccess = 0, "#%s#的進度存檔已刪除!" -saveDataExtendFailed = 0, "無法擴充此遊戲的進度儲存空間." -saveDataExtendSuccess = 0, "#%s#的進度存檔儲存空間已擴充!" -saveDataIndexText = 0, "存檔索引:" -saveDataNoneFound = 0, "沒有#%s#的進度存檔!" -saveDataResetSuccess = 0, "#%s#的進度存檔已重置!" -saveDataTypeText = 0, "System" -saveDataTypeText = 1, "Account" -saveDataTypeText = 2, "BCAT" -saveDataTypeText = 3, "Device" -saveDataTypeText = 4, "Temporary" -saveDataTypeText = 5, "Cache" -saveDataTypeText = 6, "System BCAT" -saveTypeMainMenu = 0, "Device" -saveTypeMainMenu = 1, "BCAT" -saveTypeMainMenu = 2, "Cache" -saveTypeMainMenu = 3, "System" -saveTypeMainMenu = 4, "System BCAT" -saveTypeMainMenu = 5, "SysTemp Storagetem" -settingsMenu = 0, "清空資源回收筒" -settingsMenu = 1, "檢查程式更新" -settingsMenu = 2, "設定JKSV進度存檔匯出的資料夾" -settingsMenu = 3, "編輯Titles黑名單" -settingsMenu = 4, "刪除所有進度存檔" -settingsMenu = 5, "包含綁定主機的使用者進度存檔: " -settingsMenu = 6, "還原前自動備份: " -settingsMenu = 7, "備份時自動命名: " -settingsMenu = 8, "CPU超頻: " -settingsMenu = 9, "長按確認後刪除: " -settingsMenu = 10, "長按確認後還原: " -settingsMenu = 11, "長按確認後覆寫: " -settingsMenu = 12, "強制掛載: " -settingsMenu = 13, "使用者系統進度存檔: " -settingsMenu = 14, "允許存取系統進度存檔: " -settingsMenu = 15, "直接使用FS命令: " -settingsMenu = 16, "匯出存檔時壓縮為ZIP: " -settingsMenu = 17, "強制顯示為英文: " -settingsMenu = 18, "啟用資源回收筒: " -settingsMenu = 19, "Title排序模式: " -settingsMenu = 20, "彈出視窗延遲: " -settingsOff = 0, "關" -settingsOn = 0, ">開>" -sortType = 0, "依名稱字母順序" -sortType = 1, "依遊玩時間長度" -sortType = 2, "依最後遊玩時間" -swkbdEnterName = 0, "請輸入新的名稱" -swkbdExpandSize = 0, "輸入新的大小(MB)" -swkbdMkDir = 0, "請輸入資料夾名稱" -swkbdNewSafeTitle = 0, "輸入新的匯出目錄名稱" -swkbdProcessID = 0, "請輸入程序ID" -swkbdRename = 0, "請輸入item的新名稱" -swkbdSaveIndex = 0, "請輸入快取索引" -swkbdSetWorkDir = 0, "請輸入新的匯出路徑" -swkbdSysSavID = 0, "請輸入系統存檔ID" -threadStatusAddingFileToZip = 0, "正在將'#%s#'的存檔壓縮為ZIP..." -threadStatusCalculatingSaveSize = 0, "正在計算進度檔案大小..." -threadStatusCheckingForUpdate = 0, "檢查是否有可用更新..." -threadStatusCompressingSaveForUpload = 0, "正在壓縮#%s#準備上傳..." -threadStatusCopyingFile = 0, "正在複製'#%s#'..." -threadStatusCreatingSaveData = 0, "正在新增#%s#的存檔進度..." -threadStatusDecompressingFile = 0, "'#%s#'存檔正在解壓縮..." -threadStatusDeletingFile = 0, "刪除中..." -threadStatusDeletingSaveData = 0, "正在刪除#%s#的存檔進度.." -threadStatusDeletingUpdate = 0, "正在刪除系統更新..." -threadStatusDownloadingFile = 0, "正在下載#%s#..." -threadStatusDownloadingUpdate = 0, "正在下載更新版本..." -threadStatusExtendingSaveData = 0, "正在擴充#%s#的存檔空間..." -threadStatusGetDirProps = 0, "正在取得資料夾屬性資訊..." -threadStatusOpeningFolder = 0, "正在開啟'#%s#'資料夾..." -threadStatusPackingJKSV = 0, "正在將JKSV資料夾壓縮為ZIP..." -threadStatusResettingSaveData = 0, "正在重置遊戲存檔進度..." -threadStatusSavingTranslations = 0, "正在儲存file master..." -threadStatusUploadingFile = 0, "正在上傳#%s#..." -titleOptions = 0, "詳細資訊" -titleOptions = 1, "設為黑名單" -titleOptions = 2, "變更匯出檔案資料夾" -titleOptions = 3, "以檔案管理器開啟" -titleOptions = 4, "刪除所有進度存檔" -titleOptions = 5, "重置進度存檔" -titleOptions = 6, "刪除進度存檔" -titleOptions = 7, "擴充存檔空間" -titleOptions = 8, "匯出SVI" -translationMainPage = 0, "翻譯:" -userOptions = 0, "備份使用者全部存檔:" -userOptions = 1, "新增遊戲存檔進度" -userOptions = 2, "新增所有遊戲存檔進度" -userOptions = 3, "刪除使用者全部存檔" diff --git a/src/cfg.cpp b/src/cfg.cpp deleted file mode 100644 index 10d9620..0000000 --- a/src/cfg.cpp +++ /dev/null @@ -1,534 +0,0 @@ -#include -#include -#include -#include - -#include "cfg.h" -#include "data.h" -#include "file.h" -#include "ui.h" -#include "util.h" -#include "type.h" - -std::unordered_map cfg::config; -std::vector cfg::blacklist; -std::vector cfg::favorites; -static std::unordered_map pathDefs; -uint8_t cfg::sortType; -std::string cfg::driveClientID, cfg::driveClientSecret, cfg::driveRefreshToken; -std::string cfg::webdavOrigin, cfg::webdavBasePath, cfg::webdavUser, cfg::webdavPassword; - - -const char *cfgPath = "sdmc:/config/JKSV/JKSV.cfg", *titleDefPath = "sdmc:/config/JKSV/titleDefs.txt", *workDirLegacy = "sdmc:/switch/jksv_dir.txt"; -static std::unordered_map cfgStrings = -{ - {"workDir", 0}, {"includeDeviceSaves", 1}, {"autoBackup", 2}, {"overclock", 3}, {"holdToDelete", 4}, {"holdToRestore", 5}, - {"holdToOverwrite", 6}, {"forceMount", 7}, {"accountSystemSaves", 8}, {"allowSystemSaveWrite", 9}, {"directFSCommands", 10}, - {"exportToZIP", 11}, {"languageOverride", 12}, {"enableTrashBin", 13}, {"titleSortType", 14}, {"animationScale", 15}, - {"favorite", 16}, {"blacklist", 17}, {"autoName", 18}, {"driveRefreshToken", 19}, -}; - -const std::string _true_ = "true", _false_ = "false"; - -bool cfg::isBlacklisted(const uint64_t& tid) -{ - for(uint64_t& bid : cfg::blacklist) - if(tid == bid) return true; - - return false; -} - -//Has to be threaded to be compatible with ui::confirm -void cfg::addTitleToBlacklist(void *a) -{ - threadInfo *t = (threadInfo *)a; - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - uint64_t tid = d->tid; - cfg::blacklist.push_back(tid); - for(data::user& u : data::users) - { - for(unsigned i = 0; i < u.titleInfo.size(); i++) - if(u.titleInfo[i].tid == tid) u.titleInfo.erase(u.titleInfo.begin() + i); - } - ui::ttlRefresh(); - cfg::saveConfig(); - t->finished = true; -} - -void cfg::removeTitleFromBlacklist(const uint64_t& tid) -{ - for(unsigned i = 0; i < cfg::blacklist.size(); i++) - { - if(cfg::blacklist[i] == tid) - cfg::blacklist.erase(cfg::blacklist.begin() + i); - } - data::loadUsersTitles(false); - ui::ttlRefresh(); - cfg::saveConfig(); -} - -bool cfg::isFavorite(const uint64_t& tid) -{ - for(uint64_t& fid : cfg::favorites) - if(tid == fid) return true; - - return false; -} - -static int getFavoriteIndex(const uint64_t& tid) -{ - for(unsigned i = 0; i < cfg::favorites.size(); i++) - { - if(tid == cfg::favorites[i]) - return i; - } - return -1; -} - -void cfg::addTitleToFavorites(const uint64_t& tid) -{ - if(cfg::isFavorite(tid)) - { - int rem = getFavoriteIndex(tid); - cfg::favorites.erase(cfg::favorites.begin() + rem); - } - else - cfg::favorites.push_back(tid); - - data::sortUserTitles(); - ui::ttlRefresh(); - cfg::saveConfig(); -} - -bool cfg::isDefined(const uint64_t& tid) -{ - for(auto& def : pathDefs) - if(def.first == tid) return true; - - return false; -} - -void cfg::pathDefAdd(const uint64_t& tid, const std::string& newPath) -{ - data::titleInfo *t = data::getTitleInfoByTID(tid); - std::string oldSafe = t->safeTitle; - std::string tmp = util::safeString(newPath); - if(!tmp.empty()) - { - pathDefs[tid] = tmp; - t->safeTitle = tmp; - - std::string oldOutput = fs::getWorkDir() + oldSafe; - std::string newOutput = fs::getWorkDir() + tmp; - rename(oldOutput.c_str(), newOutput.c_str()); - - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popChangeOutputFolder", 0), oldSafe.c_str(), tmp.c_str()); - } - else - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popChangeOutputError", 0), newPath.c_str()); -} - -std::string cfg::getPathDefinition(const uint64_t& tid) -{ - return pathDefs[tid]; -} - -void cfg::addPathToFilter(const uint64_t& tid, const std::string& _p) -{ - char outpath[128]; - sprintf(outpath, "sdmc:/config/JKSV/0x%016lX_filter.txt", tid); - FILE *filters = fopen(outpath, "a"); - fprintf(filters, "%s\n", _p.c_str()); - fclose(filters); -} - -void cfg::resetConfig() -{ - cfg::config["incDev"] = false; - cfg::config["autoBack"] = true; - cfg::config["ovrClk"] = false; - cfg::config["holdDel"] = true; - cfg::config["holdRest"] = true; - cfg::config["holdOver"] = true; - cfg::config["forceMount"] = true; - cfg::config["accSysSave"] = false; - cfg::config["sysSaveWrite"] = false; - cfg::config["directFsCmd"] = false; - cfg::config["zip"] = true; - cfg::config["langOverride"] = false; - cfg::config["trashBin"] = true; - cfg::config["autoName"] = false; - cfg::sortType = cfg::ALPHA; - ui::animScale = 3.0f; - cfg::config["autoUpload"] = false; -} - -static inline bool textToBool(const std::string& _txt) -{ - return _txt == _true_ ? true : false; -} - -static inline std::string boolToText(bool _b) -{ - return _b ? _true_ : _false_; -} - -static inline std::string sortTypeText() -{ - switch(cfg::sortType) - { - case cfg::ALPHA: - return "ALPHA"; - break; - - case cfg::MOST_PLAYED: - return "MOST_PLAYED"; - break; - - case cfg::LAST_PLAYED: - return "LAST_PLAYED"; - break; - } - return ""; -} - -static void loadWorkDirLegacy() -{ - if(fs::fileExists(workDirLegacy)) - { - char tmp[256]; - memset(tmp, 0, 256); - - FILE *getDir = fopen(workDirLegacy, "r"); - fgets(tmp, 256, getDir); - fclose(getDir); - std::string tmpStr = tmp; - util::stripChar('\n', tmpStr); - util::stripChar('\r', tmpStr); - fs::setWorkDir(tmpStr); - fs::delfile(workDirLegacy); - } -} - -static void loadConfigLegacy() -{ - std::string legacyCfgPath = fs::getWorkDir() + "cfg.bin"; - if(fs::fileExists(legacyCfgPath)) - { - FILE *oldCfg = fopen(legacyCfgPath.c_str(), "rb"); - uint64_t cfgIn = 0; - fread(&cfgIn, sizeof(uint64_t), 1, oldCfg); - fread(&cfg::sortType, 1, 1, oldCfg); - fread(&ui::animScale, sizeof(float), 1, oldCfg); - if(ui::animScale == 0) - ui::animScale = 3.0f; - fclose(oldCfg); - - cfg::config["incDev"] = cfgIn >> 63 & 1; - cfg::config["autoBack"] = cfgIn >> 62 & 1; - cfg::config["ovrClk"] = cfgIn >> 61 & 1; - cfg::config["holdDel"] = cfgIn >> 60 & 1; - cfg::config["holdRest"] = cfgIn >> 59 & 1; - cfg::config["holdOver"] = cfgIn >> 58 & 1; - cfg::config["forceMount"] = cfgIn >> 57 & 1; - cfg::config["accSysSave"] = cfgIn >> 56 & 1; - cfg::config["sysSaveWrite"] = cfgIn >> 55 & 1; - cfg::config["directFsCmd"] = cfgIn >> 53 & 1; - cfg::config["zip"] = cfgIn >> 51 & 1; - cfg::config["langOverride"] = cfgIn >> 50 & 1; - cfg::config["trashBin"] = cfgIn >> 49 & 1; - fs::delfile(legacyCfgPath.c_str()); - } -} - -static void loadFavoritesLegacy() -{ - std::string legacyFavPath = fs::getWorkDir() + "favorites.txt"; - if(fs::fileExists(legacyFavPath)) - { - fs::dataFile fav(legacyFavPath); - while(fav.readNextLine(false)) - cfg::favorites.push_back(strtoul(fav.getLine().c_str(), NULL, 16)); - fav.close(); - fs::delfile(legacyFavPath); - } -} - -static void loadBlacklistLegacy() -{ - std::string legacyBlPath = fs::getWorkDir() + "blacklist.txt"; - if(fs::fileExists(legacyBlPath)) - { - fs::dataFile bl(legacyBlPath); - while(bl.readNextLine(false)) - cfg::blacklist.push_back(strtoul(bl.getLine().c_str(), NULL, 16)); - bl.close(); - fs::delfile(legacyBlPath); - } -} - -static void loadTitleDefsLegacy() -{ - std::string titleDefLegacy = fs::getWorkDir() + "titleDefs.txt"; - if(fs::fileExists(titleDefLegacy)) - { - fs::dataFile getPaths(titleDefLegacy); - while(getPaths.readNextLine(true)) - { - uint64_t tid = strtoul(getPaths.getName().c_str(), NULL, 16); - pathDefs[tid] = getPaths.getNextValueStr(); - } - getPaths.close(); - fs::delfile(titleDefLegacy); - } -} - -//Oops -static void loadTitleDefs() -{ - if(fs::fileExists(titleDefPath)) - { - fs::dataFile getPaths(titleDefPath); - while(getPaths.readNextLine(true)) - { - uint64_t tid = strtoul(getPaths.getName().c_str(), NULL, 16); - pathDefs[tid] = getPaths.getNextValueStr(); - } - } -} - -static void loadDriveConfig() -{ - // Start Google Drive - fs::dirList cfgList("/config/JKSV/", true); - std::string clientSecretPath; - for(unsigned i = 0; i < cfgList.getCount(); i++) - { - std::string itemName = cfgList.getItem(i); - if(itemName.find("client_secret") != itemName.npos) - { - clientSecretPath = "/config/JKSV/" + cfgList.getItem(i); - break; - } - } - - if(!clientSecretPath.empty()) - { - json_object *installed, *clientID, *clientSecret, *driveJSON = json_object_from_file(clientSecretPath.c_str()); - if (driveJSON) - { - if(json_object_object_get_ex(driveJSON, "installed", &installed)) - { - if(json_object_object_get_ex(installed, "client_id", &clientID) - && json_object_object_get_ex(installed, "client_secret", &clientSecret)) - { - cfg::driveClientID = json_object_get_string(clientID); - cfg::driveClientSecret = json_object_get_string(clientSecret); - } - } - json_object_put(driveJSON); - } - } - // End Google Drive - - // Webdav - json_object *webdavJSON = json_object_from_file("/config/JKSV/webdav.json"); - json_object *origin, *basepath, *username, *password; - if (webdavJSON) - { - if (json_object_object_get_ex(webdavJSON, "origin", &origin)) { - cfg::webdavOrigin = json_object_get_string(origin); - } - if (json_object_object_get_ex(webdavJSON, "basepath", &basepath)) { - cfg::webdavBasePath = json_object_get_string(basepath); - } - if (json_object_object_get_ex(webdavJSON, "username", &username)) { - cfg::webdavUser = json_object_get_string(username); - } - if (json_object_object_get_ex(webdavJSON, "password", &password)) { - cfg::webdavPassword = json_object_get_string(password); - } - json_object_put(webdavJSON); - } -} - -void cfg::loadConfig() -{ - cfg::resetConfig(); - loadWorkDirLegacy(); - loadConfigLegacy(); - loadFavoritesLegacy(); - loadBlacklistLegacy(); - loadTitleDefsLegacy(); - loadTitleDefs(); - - if(fs::fileExists(cfgPath)) - { - fs::dataFile cfgRead(cfgPath); - while(cfgRead.readNextLine(true)) - { - std::string varName = cfgRead.getName(); - if(cfgStrings.find(varName) != cfgStrings.end()) - { - switch(cfgStrings[varName]) - { - case 0: - fs::setWorkDir(cfgRead.getNextValueStr()); - break; - - case 1: - cfg::config["incDev"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 2: - cfg::config["autoBack"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 3: - cfg::config["ovrClk"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 4: - cfg::config["holdDel"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 5: - cfg::config["holdRest"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 6: - cfg::config["holdOver"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 7: - cfg::config["forceMount"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 8: - cfg::config["accSysSave"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 9: - cfg::config["sysSaveWrite"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 10: - cfg::config["directFsCmd"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 11: - cfg::config["zip"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 12: - cfg::config["langOverride"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 13: - cfg::config["trashBin"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 14: - { - std::string getSort = cfgRead.getNextValueStr(); - if(getSort == "ALPHA") - cfg::sortType = cfg::ALPHA; - else if(getSort == "MOST_PLAYED") - cfg::sortType = cfg::MOST_PLAYED; - else - cfg::sortType = cfg::LAST_PLAYED; - } - break; - - case 15: - { - std::string animFloat = cfgRead.getNextValueStr(); - ui::animScale = strtof(animFloat.c_str(), NULL); - } - break; - - case 16: - { - std::string tid = cfgRead.getNextValueStr(); - cfg::favorites.push_back(strtoul(tid.c_str(), NULL, 16)); - } - break; - - case 17: - { - std::string tid = cfgRead.getNextValueStr(); - cfg::blacklist.push_back(strtoul(tid.c_str(), NULL, 16)); - } - break; - - case 18: - cfg::config["autoName"] = textToBool(cfgRead.getNextValueStr()); - break; - - case 19: - cfg::driveRefreshToken = cfgRead.getNextValueStr(); - break; - - case 20: - cfg::config["autoUpload"] = textToBool(cfgRead.getNextValueStr()); - break; - - default: - break; - } - } - } - } - loadDriveConfig(); -} - -static void savePathDefs() -{ - FILE *pathOut = fopen(titleDefPath, "w"); - for(auto& p : pathDefs) - fprintf(pathOut, "0x%016lX = \"%s\"\n", p.first, p.second.c_str()); - fclose(pathOut); -} - -void cfg::saveConfig() -{ - FILE *cfgOut = fopen("sdmc:/config/JKSV/JKSV.cfg", "w"); - fprintf(cfgOut, "#JKSV config.\nworkDir = \"%s\"\n\n", fs::getWorkDir().c_str()); - fprintf(cfgOut, "includeDeviceSaves = %s\n", boolToText(cfg::config["incDev"]).c_str()); - fprintf(cfgOut, "autoBackup = %s\n", boolToText(cfg::config["autoBack"]).c_str()); - fprintf(cfgOut, "autoName = %s\n", boolToText(cfg::config["autoName"]).c_str()); - fprintf(cfgOut, "overclock = %s\n", boolToText(cfg::config["ovrClk"]).c_str()); - fprintf(cfgOut, "holdToDelete = %s\n", boolToText(cfg::config["holdDel"]).c_str()); - fprintf(cfgOut, "holdToRestore = %s\n", boolToText(cfg::config["holdRest"]).c_str()); - fprintf(cfgOut, "holdToOverwrite = %s\n", boolToText(cfg::config["holdOver"]).c_str()); - fprintf(cfgOut, "forceMount = %s\n", boolToText(cfg::config["forceMount"]).c_str()); - fprintf(cfgOut, "accountSystemSaves = %s\n", boolToText(cfg::config["accSysSaves"]).c_str()); - fprintf(cfgOut, "allowSystemSaveWrite = %s\n", boolToText(cfg::config["sysSaveWrite"]).c_str()); - fprintf(cfgOut, "directFSCommands = %s\n", boolToText(cfg::config["directFsCmd"]).c_str()); - fprintf(cfgOut, "exportToZIP = %s\n", boolToText(cfg::config["zip"]).c_str()); - fprintf(cfgOut, "languageOverride = %s\n", boolToText(cfg::config["langOverride"]).c_str()); - fprintf(cfgOut, "enableTrashBin = %s\n", boolToText(cfg::config["trashBin"]).c_str()); - fprintf(cfgOut, "titleSortType = %s\n", sortTypeText().c_str()); - fprintf(cfgOut, "animationScale = %f\n", ui::animScale); - - if(!cfg::driveRefreshToken.empty()) - fprintf(cfgOut, "driveRefreshToken = %s\n", cfg::driveRefreshToken.c_str()); - - if(!cfg::favorites.empty()) - { - fprintf(cfgOut, "\n#favorites\n"); - for(uint64_t& f : cfg::favorites) - fprintf(cfgOut, "favorite = 0x%016lX\n", f); - } - - if(!cfg::blacklist.empty()) - { - fprintf(cfgOut, "\n#blacklist\n"); - for(uint64_t& b : cfg::blacklist) - fprintf(cfgOut, "blacklist = 0x%016lX\n", b); - } - fclose(cfgOut); - - if(!pathDefs.empty()) - savePathDefs(); -} diff --git a/src/curlfuncs.cpp b/src/curlfuncs.cpp deleted file mode 100644 index 8ae0389..0000000 --- a/src/curlfuncs.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include - -#include "curlfuncs.h" -#include "util.h" - -size_t curlFuncs::writeDataString(const char *buff, size_t sz, size_t cnt, void *u) -{ - std::string *str = (std::string *)u; - str->append(buff, 0, sz * cnt); - return sz * cnt; -} - -size_t curlFuncs::writeHeaders(const char *buff, size_t sz, size_t cnt, void *u) -{ - std::vector *headers = (std::vector *)u; - headers->push_back(buff); - return sz * cnt; -} - -size_t curlFuncs::readDataFile(char *buff, size_t sz, size_t cnt, void *u) -{ - curlFuncs::curlUpArgs*in = (curlFuncs::curlUpArgs *)u; - - size_t ret = fread(buff, sz, cnt, in->f); - - if(in->o) - *in->o = ftell(in->f); - - return ret; -} - -std::string curlFuncs::getHeader(const std::string& name, std::vector *h) -{ - std::string ret = HEADER_ERROR; - for (unsigned i = 0; i < h->size(); i++) - { - std::string curHeader = h->at(i); - size_t colonPos = curHeader.find_first_of(':'); - if (curHeader.substr(0, colonPos) == name) - { - ret = curHeader.substr(colonPos + 2); - break; - } - } - util::stripChar('\n', ret); - util::stripChar('\r', ret); - return ret; -} - -std::string curlFuncs::getJSONURL(std::vector *headers, const std::string& _url) -{ - std::string ret; - CURL *handle = curl_easy_init(); - curl_easy_setopt(handle, CURLOPT_URL, _url.c_str()); - curl_easy_setopt(handle, CURLOPT_HTTPGET, 1); - curl_easy_setopt(handle, CURLOPT_USERAGENT, "JKSV"); - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writeDataString); - curl_easy_setopt(handle, CURLOPT_WRITEDATA, &ret); - curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1); - curl_easy_setopt(handle, CURLOPT_TIMEOUT, 15); - if(headers) - { - curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, writeHeaders); - curl_easy_setopt(handle, CURLOPT_HEADERDATA, headers); - } - - if(curl_easy_perform(handle) != CURLE_OK) - ret.clear();//JIC - - curl_easy_cleanup(handle); - return ret; -} - -size_t writeDataBin(uint8_t *buff, size_t sz, size_t cnt, void *u) -{ - size_t sizeIn = sz * cnt; - std::vector *binData = (std::vector *)u; - binData->reserve(sizeIn); - binData->insert(binData->end(), buff, buff + sizeIn); - return sizeIn; -} - -bool curlFuncs::getBinURL(std::vector *out, const std::string& _url) -{ - bool ret = false; - CURL *handle = curl_easy_init(); - curl_easy_setopt(handle, CURLOPT_URL, _url.c_str()); - curl_easy_setopt(handle, CURLOPT_HTTPGET, 1); - curl_easy_setopt(handle, CURLOPT_USERAGENT, "JKSV"); - curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writeDataBin); - curl_easy_setopt(handle, CURLOPT_WRITEDATA, out); - curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1); - curl_easy_setopt(handle, CURLOPT_TIMEOUT, 15); - if(curl_easy_perform(handle) == CURLE_OK) - ret = true; - - curl_easy_cleanup(handle); - return ret; -} diff --git a/src/data.cpp b/src/data.cpp deleted file mode 100644 index 821fbd8..0000000 --- a/src/data.cpp +++ /dev/null @@ -1,503 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "data.h" -#include "file.h" -#include "util.h" -#include "type.h" -#include "cfg.h" - -//FsSaveDataSpaceId_All doesn't work for SD -static const unsigned saveOrder [] = { 0, 1, 2, 3, 4, 100, 101 }; - -int selUser = 0, selData = 0; - -//User vector -std::vector data::users; - -//System language -SetLanguage data::sysLang; - -//For other save types -static bool sysBCATPushed = false, tempPushed = false; -std::unordered_map data::titles; - -//Sorts titles by sortType -static struct -{ - bool operator()(const data::userTitleInfo& a, const data::userTitleInfo& b) - { - //Favorites override EVERYTHING - if(cfg::isFavorite(a.tid) != cfg::isFavorite(b.tid)) return cfg::isFavorite(a.tid); - - switch(cfg::sortType) - { - case cfg::ALPHA: - { - std::string titleA = data::getTitleNameByTID(a.tid); - std::string titleB = data::getTitleNameByTID(b.tid); - uint32_t pointA, pointB; - for(unsigned i = 0, j = 0; i < titleA.length(); ) - { - ssize_t aCnt = decode_utf8(&pointA, (const uint8_t *)&titleA.data()[i]); - ssize_t bCnt = decode_utf8(&pointB, (const uint8_t *)&titleB.data()[j]); - pointA = tolower(pointA), pointB = tolower(pointB); - if(pointA != pointB) - return pointA < pointB; - - i += aCnt; - j += bCnt; - } - } - break; - - case cfg::MOST_PLAYED: - return a.playStats.playtime > b.playStats.playtime; - break; - - case cfg::LAST_PLAYED: - return a.playStats.last_timestamp_user> b.playStats.last_timestamp_user; - break; - } - return false; - } -} sortTitles; - -//Returns -1 for new -static int getUserIndex(const AccountUid& id) -{ - u128 nId = util::accountUIDToU128(id); - for(unsigned i = 0; i < data::users.size(); i++) - if(data::users[i].getUID128() == nId) return i; - - return -1; -} - -static inline bool accountSystemSaveCheck(const FsSaveDataInfo& _inf) -{ - if(_inf.save_data_type == FsSaveDataType_System && util::accountUIDToU128(_inf.uid) != 0 && !cfg::config["accSysSave"]) - return false; - - return true; -} - -//Minimal init/test to avoid loading and creating things I don't need -static bool testMount(const FsSaveDataInfo& _inf) -{ - bool ret = false; - if(!cfg::config["forceMount"]) - return true; - - if((ret = fs::mountSave(_inf))) - fs::unmountSave(); - - return ret; -} - -static inline void addTitleToList(const uint64_t& tid) -{ - uint64_t outSize = 0; - NsApplicationControlData *ctrlData = new NsApplicationControlData; - NacpLanguageEntry *ent; - Result ctrlRes = nsGetApplicationControlData(NsApplicationControlSource_Storage, tid, ctrlData, sizeof(NsApplicationControlData), &outSize); - Result nacpRes = nacpGetLanguageEntry(&ctrlData->nacp, &ent); - size_t iconSize = outSize - sizeof(ctrlData->nacp); - - if(R_SUCCEEDED(ctrlRes) && !(outSize < sizeof(ctrlData->nacp)) && R_SUCCEEDED(nacpRes) && iconSize > 0) - { - //Copy nacp - memcpy(&data::titles[tid].nacp, &ctrlData->nacp, sizeof(NacpStruct)); - - //Setup 'shortcuts' to strings - NacpLanguageEntry *ent; - nacpGetLanguageEntry(&data::titles[tid].nacp, &ent); - if(strlen(ent->name) == 0) - data::titles[tid].title = ctrlData->nacp.lang[SetLanguage_ENUS].name; - else - data::titles[tid].title = ent->name; - data::titles[tid].author = ent->author; - if(cfg::isDefined(tid)) - data::titles[tid].safeTitle = cfg::getPathDefinition(tid); - else if((data::titles[tid].safeTitle = util::safeString(ent->name)) == "") - data::titles[tid].safeTitle = util::getIDStr(tid); - - if(cfg::isFavorite(tid)) - data::titles[tid].fav = true; - - data::titles[tid].icon = gfx::texMgr->textureLoadFromMem(IMG_FMT_JPG, ctrlData->icon, iconSize); - if(!data::titles[tid].icon) - data::titles[tid].icon = util::createIconGeneric(util::getIDStrLower(tid).c_str(), 32, true); - } - else - { - memset(&data::titles[tid].nacp, 0, sizeof(NacpStruct)); - data::titles[tid].title = util::getIDStr(tid); - data::titles[tid].author = "Someone?"; - if(cfg::isDefined(tid)) - data::titles[tid].safeTitle = cfg::getPathDefinition(tid); - else - data::titles[tid].safeTitle = util::getIDStr(tid); - - data::titles[tid].icon = util::createIconGeneric(util::getIDStrLower(tid).c_str(), 32, true); - } - delete ctrlData; -} - -static inline bool titleIsLoaded(const uint64_t& tid) -{ - auto findTid = data::titles.find(tid); - - return findTid == data::titles.end() ? false : true; -} - -static void loadUserAccounts() -{ - s32 total = 0; - AccountUid *uids = new AccountUid[8]; - if(R_SUCCEEDED(accountListAllUsers(uids, 8, &total))) - { - for(int i = 0; i < total; i++) - data::users.emplace_back(uids[i], "", ""); - } - delete[] uids; -} - -//This can load titles installed without having save data -static void loadTitlesFromRecords() -{ - NsApplicationRecord nsRecord; - int32_t entryCount = 0, recordOffset = 0; - while(R_SUCCEEDED(nsListApplicationRecord(&nsRecord, 1, recordOffset++, &entryCount)) && entryCount > 0) - { - if(!titleIsLoaded(nsRecord.application_id)) - addTitleToList(nsRecord.application_id); - } -} - -static void importSVIs() -{ - std::string sviDir = fs::getWorkDir() + "svi/"; - fs::dirList sviList(sviDir); - if(sviList.getCount() > 0) - { - for(unsigned i = 0; i < sviList.getCount(); i++) - { - uint64_t tid = 0; - NacpStruct *nacp = new NacpStruct; - NacpLanguageEntry *ent; - std::string sviPath = fs::getWorkDir() + "svi/" + sviList.getItem(i); - - size_t iconSize = fs::fsize(sviPath) - (sizeof(uint64_t) + sizeof(NacpStruct)); - uint8_t *iconBuffer = new uint8_t[iconSize]; - FILE *sviIn = fopen(sviPath.c_str(), "rb"); - fread(&tid, sizeof(uint64_t), 1, sviIn); - fread(nacp, sizeof(NacpStruct), 1, sviIn); - fread(iconBuffer, 1, iconSize, sviIn); - - if(!titleIsLoaded(tid)) - { - nacpGetLanguageEntry(nacp, &ent); - memcpy(&data::titles[tid].nacp, nacp, sizeof(NacpStruct)); - data::titles[tid].title = ent->name; - data::titles[tid].author = ent->author; - if(cfg::isDefined(tid)) - data::titles[tid].safeTitle = cfg::getPathDefinition(tid); - else if((data::titles[tid].safeTitle = util::safeString(ent->name)) == "") - data::titles[tid].safeTitle = util::getIDStr(tid); - - if(cfg::isFavorite(tid)) - data::titles[tid].fav = true; - - if(!data::titles[tid].icon && iconSize > 0) - data::titles[tid].icon = gfx::texMgr->textureLoadFromMem(IMG_FMT_JPG, iconBuffer, iconSize); - else if(!data::titles[tid].icon && iconSize == 0) - data::titles[tid].icon = util::createIconGeneric(util::getIDStrLower(tid).c_str(), 32, true); - } - delete nacp; - delete[] iconBuffer; - fclose(sviIn); - } - } -} - -bool data::loadUsersTitles(bool clearUsers) -{ - static unsigned systemUserCount = 4; - FsSaveDataInfoReader it; - FsSaveDataInfo info; - s64 total = 0; - - loadTitlesFromRecords(); - importSVIs(); - - //Clear titles - for(data::user& u : data::users) - u.titleInfo.clear(); - if(clearUsers) - { - systemUserCount = 4; - for(data::user& u : data::users) - u.delIcon(); - data::users.clear(); - - loadUserAccounts(); - sysBCATPushed = false; - tempPushed = false; - - users.emplace_back(util::u128ToAccountUID(3), ui::getUIString("saveTypeMainMenu", 0), "Device"); - users.emplace_back(util::u128ToAccountUID(2), ui::getUIString("saveTypeMainMenu", 1), "BCAT"); - users.emplace_back(util::u128ToAccountUID(5), ui::getUIString("saveTypeMainMenu", 2), "Cache"); - users.emplace_back(util::u128ToAccountUID(0), ui::getUIString("saveTypeMainMenu", 3), "System"); - } - - for(unsigned i = 0; i < 7; i++) - { - if(R_FAILED(fsOpenSaveDataInfoReader(&it, (FsSaveDataSpaceId)saveOrder[i]))) - continue; - - while(R_SUCCEEDED(fsSaveDataInfoReaderRead(&it, &info, 1, &total)) && total != 0) - { - uint64_t tid = 0; - if(info.save_data_type == FsSaveDataType_System || info.save_data_type == FsSaveDataType_SystemBcat) - tid = info.system_save_data_id; - else - tid = info.application_id; - - if(!titleIsLoaded(tid)) - addTitleToList(tid); - - //Don't bother with this stuff - if(cfg::isBlacklisted(tid) || !accountSystemSaveCheck(info) || !testMount(info)) - continue; - - switch(info.save_data_type) - { - case FsSaveDataType_Bcat: - info.uid = util::u128ToAccountUID(2); - break; - - case FsSaveDataType_Device: - info.uid = util::u128ToAccountUID(3); - break; - - case FsSaveDataType_SystemBcat: - info.uid = util::u128ToAccountUID(4); - if(!sysBCATPushed) - { - ++systemUserCount; - sysBCATPushed = true; - users.emplace_back(util::u128ToAccountUID(4), ui::getUIString("saveTypeMainMenu", 4), "System BCAT"); - } - break; - - case FsSaveDataType_Cache: - info.uid = util::u128ToAccountUID(5); - break; - - case FsSaveDataType_Temporary: - info.uid = util::u128ToAccountUID(6); - if(!tempPushed) - { - ++systemUserCount; - tempPushed = true; - users.emplace_back(util::u128ToAccountUID(6), ui::getUIString("saveTypeMainMenu", 5), "Temporary"); - } - break; - } - - int u = getUserIndex(info.uid); - if(u == -1) - { - users.emplace(data::users.end() - systemUserCount, info.uid, "", ""); - u = getUserIndex(info.uid); - } - - PdmPlayStatistics playStats; - if(info.save_data_type == FsSaveDataType_Account || info.save_data_type == FsSaveDataType_Device) - pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(info.application_id, info.uid, false, &playStats); - else - memset(&playStats, 0, sizeof(PdmPlayStatistics)); - users[u].addUserTitleInfo(tid, &info, &playStats); - } - fsSaveDataInfoReaderClose(&it); - } - - if(cfg::config["incDev"]) - { - //Get reference to device save user - unsigned devPos = getUserIndex(util::u128ToAccountUID(3)); - data::user& dev = data::users[devPos]; - for(unsigned i = 0; i < devPos; i++) - { - //Not needed but makes this easier to read - data::user& u = data::users[i]; - u.titleInfo.insert(u.titleInfo.end(), dev.titleInfo.begin(), dev.titleInfo.end()); - } - } - - data::sortUserTitles(); - - return true; -} - -void data::sortUserTitles() -{ - - for(data::user& u : data::users) - std::sort(u.titleInfo.begin(), u.titleInfo.end(), sortTitles); -} - -void data::init() -{ - data::loadUsersTitles(true); -} - -void data::exit() -{ - /*Still needed for planned future revisions*/ -} - -void data::setUserIndex(unsigned _sUser) -{ - selUser = _sUser; -} - -data::user *data::getCurrentUser() -{ - return &users[selUser]; -} - -unsigned data::getCurrentUserIndex() -{ - return selUser; -} - -void data::setTitleIndex(unsigned _sTitle) -{ - selData = _sTitle; -} - -data::userTitleInfo *data::getCurrentUserTitleInfo() -{ - return &users[selUser].titleInfo[selData]; -} - -unsigned data::getCurrentUserTitleInfoIndex() -{ - return selData; -} - -data::titleInfo *data::getTitleInfoByTID(const uint64_t& tid) -{ - if(titles.find(tid) != titles.end()) - return &titles[tid]; - return NULL; -} - -std::string data::getTitleNameByTID(const uint64_t& tid) -{ - return titles[tid].title; -} - -std::string data::getTitleSafeNameByTID(const uint64_t& tid) -{ - return titles[tid].safeTitle; -} - -SDL_Texture *data::getTitleIconByTID(const uint64_t& tid) -{ - return titles[tid].icon; -} - -int data::getTitleIndexInUser(const data::user& u, const uint64_t& tid) -{ - for(unsigned i = 0; i < u.titleInfo.size(); i++) - { - if(u.titleInfo[i].tid == tid) - return i; - } - return -1; -} - -data::user::user(const AccountUid& _id, const std::string& _backupName, const std::string& _safeBackupName) -{ - userID = _id; - uID128 = util::accountUIDToU128(_id); - - AccountProfile prof; - AccountProfileBase base; - - if(R_SUCCEEDED(accountGetProfile(&prof, userID)) && R_SUCCEEDED(accountProfileGet(&prof, NULL, &base))) - { - username = base.nickname; - userSafe = util::safeString(username); - if(userSafe.empty()) - { - char tmp[32]; - sprintf(tmp, "Acc%08X", (uint32_t)uID128); - userSafe = tmp; - } - - uint32_t jpgSize = 0; - accountProfileGetImageSize(&prof, &jpgSize); - uint8_t *jpegData = new uint8_t[jpgSize]; - accountProfileLoadImage(&prof, jpegData, jpgSize, &jpgSize); - userIcon = gfx::texMgr->textureLoadFromMem(IMG_FMT_JPG, jpegData, jpgSize); - delete[] jpegData; - - accountProfileClose(&prof); - } - else - { - username = _backupName.empty() ? util::getIDStr((uint64_t)uID128) : _backupName; - userSafe = _safeBackupName.empty() ? util::getIDStr((uint64_t)uID128) : _safeBackupName; - userIcon = util::createIconGeneric(_backupName.c_str(), 48, false); - } - titles.reserve(64); -} - -data::user::user(const AccountUid& _id, const std::string& _backupName, const std::string& _safeBackupName, SDL_Texture *img) : user(_id, _backupName, _safeBackupName) -{ - delIcon(); - userIcon = img; - titles.reserve(64); -} - -void data::user::setUID(const AccountUid& _id) -{ - userID = _id; - uID128 = util::accountUIDToU128(_id); -} - -void data::user::addUserTitleInfo(const uint64_t& tid, const FsSaveDataInfo *_saveInfo, const PdmPlayStatistics *_stats) -{ - data::userTitleInfo newInfo; - newInfo.tid = tid; - memcpy(&newInfo.saveInfo, _saveInfo, sizeof(FsSaveDataInfo)); - memcpy(&newInfo.playStats, _stats, sizeof(PdmPlayStatistics)); - titleInfo.push_back(newInfo); -} - -static const SDL_Color green = {0x00, 0xDD, 0x00, 0xFF}; - -void data::dispStats() -{ - data::user *cu = data::getCurrentUser(); - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - - //Easiest/laziest way to do this - std::string stats = ui::getUICString("debugStatus", 0) + std::to_string(users.size()) + "\n"; - for(data::user& u : data::users) - stats += u.getUsername() + ": " + std::to_string(u.titleInfo.size()) + "\n"; - stats += ui::getUICString("debugStatus", 1) + cu->getUsername() + "\n"; - stats += ui::getUICString("debugStatus", 2) + data::getTitleNameByTID(d->tid) + "\n"; - stats += ui::getUICString("debugStatus", 3) + data::getTitleSafeNameByTID(d->tid) + "\n"; - stats += ui::getUICString("debugStatus", 4) + std::to_string(cfg::sortType) + "\n"; - gfx::drawTextf(NULL, 16, 2, 2, &green, stats.c_str()); -} \ No newline at end of file diff --git a/src/fs.cpp b/src/fs.cpp deleted file mode 100644 index bda4025..0000000 --- a/src/fs.cpp +++ /dev/null @@ -1,670 +0,0 @@ -#include -#include - -#include "fs.h" -#include "cfg.h" -#include "util.h" - -static std::string wd = "sdmc:/JKSV/"; - -static FSFILE *debLog; - -static FsFileSystem sv; - -static std::vector pathFilter; - -void fs::init() -{ - mkDirRec("sdmc:/config/JKSV/"); - mkDirRec(wd); - mkdir(std::string(wd + "_TRASH_").c_str(), 777); - - fs::logOpen(); -} - -bool fs::mountSave(const FsSaveDataInfo& _m) -{ - Result svOpen; - FsSaveDataAttribute attr = {0}; - switch(_m.save_data_type) - { - case FsSaveDataType_System: - case FsSaveDataType_SystemBcat: - { - attr.uid = _m.uid; - attr.system_save_data_id = _m.system_save_data_id; - attr.save_data_type = _m.save_data_type; - svOpen = fsOpenSaveDataFileSystemBySystemSaveDataId(&sv, (FsSaveDataSpaceId)_m.save_data_space_id, &attr); - } - break; - - case FsSaveDataType_Account: - { - attr.uid = _m.uid; - attr.application_id = _m.application_id; - attr.save_data_type = _m.save_data_type; - attr.save_data_rank = _m.save_data_rank; - attr.save_data_index = _m.save_data_index; - svOpen = fsOpenSaveDataFileSystem(&sv, (FsSaveDataSpaceId)_m.save_data_space_id, &attr); - } - break; - - case FsSaveDataType_Device: - { - attr.application_id = _m.application_id; - attr.save_data_type = FsSaveDataType_Device; - svOpen = fsOpenSaveDataFileSystem(&sv, (FsSaveDataSpaceId)_m.save_data_space_id, &attr); - } - break; - - case FsSaveDataType_Bcat: - { - attr.application_id = _m.application_id; - attr.save_data_type = FsSaveDataType_Bcat; - svOpen = fsOpenSaveDataFileSystem(&sv, (FsSaveDataSpaceId)_m.save_data_space_id, &attr); - } - break; - - case FsSaveDataType_Cache: - { - attr.application_id = _m.application_id; - attr.save_data_type = FsSaveDataType_Cache; - attr.save_data_index = _m.save_data_index; - svOpen = fsOpenSaveDataFileSystem(&sv, (FsSaveDataSpaceId)_m.save_data_space_id, &attr); - } - break; - - case FsSaveDataType_Temporary: - { - attr.application_id = _m.application_id; - attr.save_data_type = _m.save_data_type; - svOpen = fsOpenSaveDataFileSystem(&sv, (FsSaveDataSpaceId)_m.save_data_space_id, &attr); - } - break; - - default: - svOpen = 1; - break; - } - - return R_SUCCEEDED(svOpen) && fsdevMountDevice("sv", sv) != -1; -} - -bool fs::commitToDevice(const std::string& dev) -{ - bool ret = true; - Result res = fsdevCommitDevice(dev.c_str()); - if(R_FAILED(res)) - { - fs::logWrite("Error committing file to device -> 0x%X\n", res); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popErrorCommittingFile", 0)); - ret = false; - } - return ret; -} - -std::string fs::getWorkDir() { return wd; } - -void fs::setWorkDir(const std::string& _w) { wd = _w; } - - -void fs::loadPathFilters(const uint64_t& tid) -{ - char path[256]; - sprintf(path, "sdmc:/config/JKSV/0x%016lX_filter.txt", tid); - if(fs::fileExists(path)) - { - fs::dataFile filter(path); - while(filter.readNextLine(false)) - pathFilter.push_back(filter.getLine()); - } -} - -bool fs::pathIsFiltered(const std::string& _path) -{ - if(pathFilter.empty()) - return false; - - for(std::string& _p : pathFilter) - { - if(_path == _p) - return true; - } - - return false; -} - -void fs::freePathFilters() -{ - pathFilter.clear(); -} - -void fs::createSaveData(FsSaveDataType _type, uint64_t _tid, AccountUid _uid, threadInfo *t) -{ - data::titleInfo *tinfo = data::getTitleInfoByTID(_tid); - if(t) - t->status->setStatus(ui::getUICString("threadStatusCreatingSaveData", 0), tinfo->title.c_str()); - - uint16_t cacheIndex = 0; - std::string indexStr; - if(_type == FsSaveDataType_Cache && !(indexStr = util::getStringInput(SwkbdType_NumPad, "0", ui::getUIString("swkbdSaveIndex", 0), 2, 0, NULL)).empty()) - cacheIndex = strtoul(indexStr.c_str(), NULL, 10); - else if(_type == FsSaveDataType_Cache && indexStr.empty()) - { - if(t) - t->finished = true; - return; - } - - FsSaveDataAttribute attr; - memset(&attr, 0, sizeof(FsSaveDataAttribute)); - attr.application_id = _tid; - attr.uid = _uid; - attr.system_save_data_id = 0; - attr.save_data_type = _type; - attr.save_data_rank = 0; - attr.save_data_index = cacheIndex; - - FsSaveDataCreationInfo crt; - memset(&crt, 0, sizeof(FsSaveDataCreationInfo)); - int64_t saveSize = 0, journalSize = 0; - switch(_type) - { - case FsSaveDataType_Account: - saveSize = tinfo->nacp.user_account_save_data_size; - journalSize = tinfo->nacp.user_account_save_data_journal_size; - break; - - case FsSaveDataType_Device: - saveSize = tinfo->nacp.device_save_data_size; - journalSize = tinfo->nacp.device_save_data_journal_size; - break; - - case FsSaveDataType_Bcat: - saveSize = tinfo->nacp.bcat_delivery_cache_storage_size; - journalSize = tinfo->nacp.bcat_delivery_cache_storage_size; - break; - - case FsSaveDataType_Cache: - saveSize = 32 * 1024 * 1024; - if(tinfo->nacp.cache_storage_journal_size > tinfo->nacp.cache_storage_data_and_journal_size_max) - journalSize = tinfo->nacp.cache_storage_journal_size; - else - journalSize = tinfo->nacp.cache_storage_data_and_journal_size_max; - break; - - default: - if(t) - t->finished = true; - return; - break; - } - crt.save_data_size = saveSize; - crt.journal_size = journalSize; - crt.available_size = 0x4000; - crt.owner_id = _type == FsSaveDataType_Bcat ? 0x010000000000000C : tinfo->nacp.save_data_owner_id; - crt.flags = 0; - crt.save_data_space_id = FsSaveDataSpaceId_User; - - FsSaveDataMetaInfo meta; - memset(&meta, 0, sizeof(FsSaveDataMetaInfo)); - if(_type != FsSaveDataType_Bcat) - { - meta.size = 0x40060; - meta.type = FsSaveDataMetaType_Thumbnail; - } - - Result res = 0; - if(R_SUCCEEDED(res = fsCreateSaveDataFileSystem(&attr, &crt, &meta))) - { - util::createTitleDirectoryByTID(_tid); - data::loadUsersTitles(false); - ui::ttlRefresh(); - } - else - { - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataCreationFailed", 0)); - fs::logWrite("SaveCreate Failed -> %X\n", res); - } -} - -static void createSaveData_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::svCreateArgs *crt = (fs::svCreateArgs *)t->argPtr; - fs::createSaveData(crt->type, crt->tid, crt->account, t); - delete crt; - t->finished = true; -} - -void fs::createSaveDataThreaded(FsSaveDataType _type, uint64_t _tid, AccountUid _uid) -{ - fs::svCreateArgs *send = new fs::svCreateArgs; - send->type = _type; - send->tid = _tid; - send->account = _uid; - ui::newThread(createSaveData_t, send, NULL); -} - -bool fs::extendSaveData(const data::userTitleInfo *tinfo, uint64_t extSize, threadInfo *t) -{ - if(t) - t->status->setStatus(ui::getUICString("threadStatusExtendingSaveData", 0), data::getTitleNameByTID(tinfo->tid).c_str()); - - uint64_t journal = fs::getJournalSizeMax(tinfo); - uint64_t saveID = tinfo->saveInfo.save_data_id; - FsSaveDataSpaceId space = (FsSaveDataSpaceId)tinfo->saveInfo.save_data_space_id; - Result res = 0; - if(R_FAILED((res = fsExtendSaveDataFileSystem(space, saveID, extSize, journal)))) - { - int64_t totalSize = 0; - fs::mountSave(tinfo->saveInfo); - fsFsGetTotalSpace(fsdevGetDeviceFileSystem("sv"), "/", &totalSize); - fs::unmountSave(); - - fs::logWrite("Extend Failed: %uMB to %uMB -> %X\n", totalSize / 1024 / 1024, extSize / 1024 / 1024, res); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataExtendFailed", 0)); - return false; - } - return true; -} - -static void extendSaveData_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::svExtendArgs *e = (fs::svExtendArgs *)t->argPtr; - fs::extendSaveData(e->tinfo, e->extSize, t); - delete e; - t->finished = true; -} - -void fs::extendSaveDataThreaded(const data::userTitleInfo *tinfo, uint64_t extSize) -{ - fs::svExtendArgs *send = new fs::svExtendArgs; - send->tinfo = tinfo; - send->extSize = extSize; - ui::newThread(extendSaveData_t, send, NULL); -} - -uint64_t fs::getJournalSize(const data::userTitleInfo *tinfo) -{ - uint64_t ret = 0; - data::titleInfo *t = data::getTitleInfoByTID(tinfo->tid); - switch(tinfo->saveInfo.save_data_type) - { - case FsSaveDataType_Account: - ret = t->nacp.user_account_save_data_journal_size; - break; - - case FsSaveDataType_Device: - ret = t->nacp.device_save_data_journal_size; - break; - - case FsSaveDataType_Bcat: - ret = t->nacp.bcat_delivery_cache_storage_size; - break; - - case FsSaveDataType_Cache: - if(t->nacp.cache_storage_journal_size > 0) - ret = t->nacp.cache_storage_journal_size; - else - ret = t->nacp.cache_storage_data_and_journal_size_max; - break; - - default: - ret = BUFF_SIZE; - break; - } - return ret; -} - -uint64_t fs::getJournalSizeMax(const data::userTitleInfo *tinfo) -{ - uint64_t ret = 0; - data::titleInfo *extend = data::getTitleInfoByTID(tinfo->tid); - switch(tinfo->saveInfo.save_data_type) - { - case FsSaveDataType_Account: - if(extend->nacp.user_account_save_data_journal_size_max > extend->nacp.user_account_save_data_journal_size) - ret = extend->nacp.user_account_save_data_journal_size_max; - else - ret = extend->nacp.user_account_save_data_journal_size; - break; - - case FsSaveDataType_Bcat: - ret = extend->nacp.bcat_delivery_cache_storage_size; - break; - - case FsSaveDataType_Cache: - if(extend->nacp.cache_storage_data_and_journal_size_max > extend->nacp.cache_storage_journal_size) - ret = extend->nacp.cache_storage_data_and_journal_size_max; - else - ret = extend->nacp.cache_storage_journal_size; - break; - - case FsSaveDataType_Device: - if(extend->nacp.device_save_data_journal_size_max > extend->nacp.device_save_data_journal_size) - ret = extend->nacp.device_save_data_journal_size_max; - else - ret = extend->nacp.device_save_data_journal_size; - break; - - default: - //will just fail - ret = 0; - break; - } - return ret; -} - -static void wipeSave_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - t->status->setStatus(ui::getUICString("threadStatusResettingSaveData", 0)); - fs::delDir("sv:/"); - fs::commitToDevice("sv"); - t->finished = true; -} - -void fs::wipeSave() -{ - ui::newThread(wipeSave_t, NULL, NULL); -} - -void fs::createNewBackup(void *a) -{ - if(!fs::dirNotEmpty("sv:/")) - { - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popSaveIsEmpty", 0)); - return; - } - - uint64_t held = ui::padKeysHeld(); - - data::user *u = data::getCurrentUser(); - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - data::titleInfo *t = data::getTitleInfoByTID(d->tid); - - std::string out; - - if(held & HidNpadButton_R || cfg::config["autoName"]) - out = u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD); - else if(held & HidNpadButton_L) - out = u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YDM); - else if(held & HidNpadButton_ZL) - out = u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_HOYSTE); - else - { - const std::string dict[] = - { - util::getDateTime(util::DATE_FMT_YMD), - util::getDateTime(util::DATE_FMT_YDM), - util::getDateTime(util::DATE_FMT_HOYSTE), - util::getDateTime(util::DATE_FMT_JHK), - util::getDateTime(util::DATE_FMT_ASC), - u->getUsernameSafe(), - t->safeTitle, - util::generateAbbrev(d->tid), - ".zip" - }; - std::string defaultText = u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD); - out = util::getStringInput(SwkbdType_QWERTY, defaultText, ui::getUIString("swkbdEnterName", 0), 64, 9, dict); - out = util::safeString(out); - } - - if(!out.empty()) - { - std::string ext = util::getExtensionFromString(out); - std::string path = util::generatePathByTID(d->tid) + out; - if(cfg::config["zip"] || ext == "zip") - { - if(ext != "zip")//data::zip is on but extension is not zip - path += ".zip"; - - zipFile zip = zipOpen64(path.c_str(), 0); - fs::copyDirToZipThreaded("sv:/", zip, false, 0); - - } - else - { - fs::mkDir(path); - path += "/"; - fs::copyDirToDirThreaded("sv:/", path); - } - ui::fldRefreshMenu(); - } -} - -void fs::overwriteBackup(void *a) -{ - threadInfo *t = (threadInfo *)a; - std::string *dst = (std::string *)t->argPtr; - bool saveHasFiles = fs::dirNotEmpty("sv:/"); - if(fs::isDir(*dst) && saveHasFiles) - { - fs::delDir(*dst); - fs::mkDir(*dst); - dst->append("/"); - fs::copyDirToDirThreaded("sv:/", *dst); - } - else if(!fs::isDir(*dst) && util::getExtensionFromString(*dst) == "zip" && saveHasFiles) - { - fs::delfile(*dst); - zipFile zip = zipOpen64(dst->c_str(), 0); - fs::copyDirToZipThreaded("sv:/", zip, false, 0); - } - delete dst; - t->finished = true; -} - -void fs::restoreBackup(void *a) -{ - threadInfo *t = (threadInfo *)a; - std::string *restore = (std::string *)t->argPtr; - data::user *u = data::getCurrentUser(); - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - if((utinfo->saveInfo.save_data_type != FsSaveDataType_System || cfg::config["sysSaveWrite"])) - { - bool saveHasFiles = fs::dirNotEmpty("sv:/"); - if(cfg::config["autoBack"] && cfg::config["zip"] && saveHasFiles) - { - std::string autoZip = util::generatePathByTID(utinfo->tid) + "/AUTO " + u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + ".zip"; - zipFile zip = zipOpen64(autoZip.c_str(), 0); - fs::copyDirToZipThreaded("sv:/", zip, false, 0); - } - else if(cfg::config["autoBack"] && saveHasFiles) - { - std::string autoFolder = util::generatePathByTID(utinfo->tid) + "/AUTO - " + u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + "/"; - fs::mkDir(autoFolder.substr(0, autoFolder.length() - 1)); - fs::copyDirToDirThreaded("sv:/", autoFolder); - } - - if(fs::isDir(*restore)) - { - restore->append("/"); - if(fs::dirNotEmpty(*restore)) - { - t->status->setStatus(ui::getUICString("threadStatusCalculatingSaveSize", 0)); - unsigned dirCount = 0, fileCount = 0; - uint64_t saveSize = 0; - int64_t availSize = 0; - fs::getDirProps(*restore, dirCount, fileCount, saveSize); - fsFsGetTotalSpace(fsdevGetDeviceFileSystem("sv"), "/", &availSize); - if((int)saveSize > availSize) - { - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - fs::unmountSave(); - fs::extendSaveData(utinfo, saveSize + 0x500000, t); - fs::mountSave(utinfo->saveInfo); - } - - fs::wipeSave(); - fs::copyDirToDirCommitThreaded(*restore, "sv:/", "sv"); - } - else - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popFolderIsEmpty", 0)); - } - else if(!fs::isDir(*restore) && util::getExtensionFromString(*restore) == "zip") - { - unzFile unz = unzOpen64(restore->c_str()); - if(unz && fs::zipNotEmpty(unz)) - { - t->status->setStatus(ui::getUICString("threadStatusCalculatingSaveSize", 0)); - uint64_t saveSize = fs::getZipTotalSize(unz); - int64_t availSize = 0; - fsFsGetTotalSpace(fsdevGetDeviceFileSystem("sv"), "/", &availSize); - if((int)saveSize > availSize) - { - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - fs::unmountSave(); - fs::extendSaveData(utinfo, saveSize + 0x500000, t); - fs::mountSave(utinfo->saveInfo); - } - - fs::wipeSave(); - fs::copyZipToDirThreaded(unz, "sv:/", "sv"); - } - else - { - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popZipIsEmpty", 0)); - unzClose(unz); - } - } - else - { - std::string dstPath = "sv:/" + util::getFilenameFromPath(*restore); - fs::copyFileCommitThreaded(*restore, dstPath, "sv"); - } - } - if(cfg::config["autoBack"]) - ui::fldRefreshMenu(); - - delete restore; - t->finished = true; -} - -void fs::deleteBackup(void *a) -{ - threadInfo *t = (threadInfo *)a; - std::string *deletePath = (std::string *)t->argPtr; - std::string backupName = util::getFilenameFromPath(*deletePath); - - t->status->setStatus(ui::getUICString("threadStatusDeletingFile", 0)); - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - if(cfg::config["trashBin"]) - { - std::string oldPath = *deletePath; - std::string trashPath = wd + "_TRASH_/" + data::getTitleSafeNameByTID(utinfo->tid); - fs::mkDir(trashPath); - trashPath += "/" + backupName; - - rename(oldPath.c_str(), trashPath.c_str()); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataBackupMovedToTrash", 0), backupName.c_str()); - } - else if(fs::isDir(*deletePath)) - { - *deletePath += "/"; - fs::delDir(*deletePath); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataBackupDeleted", 0), backupName.c_str()); - } - else - { - fs::delfile(*deletePath); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataBackupDeleted", 0), backupName.c_str()); - } - ui::fldRefreshMenu(); - delete deletePath; - t->finished = true; -} - -void fs::dumpAllUserSaves(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *c = fs::copyArgsCreate("", "", "", NULL, NULL, false, false, 0); - t->argPtr = c; - data::user *u = data::getCurrentUser(); - - for(unsigned i = 0; i < u->titleInfo.size(); i++) - { - bool saveMounted = fs::mountSave(u->titleInfo[i].saveInfo); - util::createTitleDirectoryByTID(u->titleInfo[i].tid); - if(saveMounted && fs::dirNotEmpty("sv:/") && cfg::config["zip"]) - { - fs::loadPathFilters(u->titleInfo[i].tid); - std::string dst = util::generatePathByTID(u->titleInfo[i].tid) + u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + ".zip"; - zipFile zip = zipOpen64(dst.c_str(), 0); - fs::copyDirToZip("sv:/", zip, false, 0, t); - zipClose(zip, NULL); - fs::freePathFilters(); - } - else if(saveMounted && fs::dirNotEmpty("sv:/")) - { - fs::loadPathFilters(u->titleInfo[i].tid); - std::string dst = util::generatePathByTID(u->titleInfo[i].tid) + u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + "/"; - fs::mkDir(dst.substr(0, dst.length() - 1)); - fs::copyDirToDir("sv:/", dst, t); - fs::freePathFilters(); - } - fs::unmountSave(); - } - fs::copyArgsDestroy(c); - t->finished = true; -} - -void fs::dumpAllUsersAllSaves(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *c = fs::copyArgsCreate("", "", "", NULL, NULL, false, false, 0); - t->argPtr = c; - unsigned curUser = 0; - while(data::users[curUser].getUID128() != 2) - { - data::user *u = &data::users[curUser++]; - for(unsigned i = 0; i < u->titleInfo.size(); i++) - { - bool saveMounted = fs::mountSave(u->titleInfo[i].saveInfo); - util::createTitleDirectoryByTID(u->titleInfo[i].tid); - if(saveMounted && fs::dirNotEmpty("sv:/") && cfg::config["zip"]) - { - fs::loadPathFilters(u->titleInfo[i].tid); - std::string dst = util::generatePathByTID(u->titleInfo[i].tid) + u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + ".zip"; - zipFile zip = zipOpen64(dst.c_str(), 0); - fs::copyDirToZip("sv:/", zip, false, 0, t); - zipClose(zip, NULL); - fs::freePathFilters(); - } - else if(saveMounted && fs::dirNotEmpty("sv:/")) - { - fs::loadPathFilters(u->titleInfo[i].tid); - std::string dst = util::generatePathByTID(u->titleInfo[i].tid) + u->getUsernameSafe() + " - " + util::getDateTime(util::DATE_FMT_YMD) + "/"; - fs::mkDir(dst.substr(0, dst.length() - 1)); - fs::copyDirToDir("sv:/", dst, t); - fs::freePathFilters(); - } - fs::unmountSave(); - } - } - fs::copyArgsDestroy(c); - t->finished = true; -} - -void fs::logOpen() -{ - std::string logPath = wd + "log.txt"; - debLog = fsfopen(logPath.c_str(), FsOpenMode_Write); - fsfclose(debLog); -} - -void fs::logWrite(const char *fmt, ...) -{ - std::string logPath = wd + "log.txt"; - debLog = fsfopen(logPath.c_str(), FsOpenMode_Append | FsOpenMode_Write); - char tmp[256]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - fsfwrite(tmp, 1, strlen(tmp), debLog); - fsfclose(debLog); -} - diff --git a/src/fs/dir.cpp b/src/fs/dir.cpp deleted file mode 100644 index bc4eacd..0000000 --- a/src/fs/dir.cpp +++ /dev/null @@ -1,270 +0,0 @@ -#include -#include - -#include "fs.h" -#include "cfg.h" -#include "util.h" - -static struct -{ - bool operator()(const fs::dirItem& a, const fs::dirItem& b) - { - if(a.isDir() != b.isDir()) - return a.isDir(); - - for(unsigned i = 0; i < a.getItm().length(); i++) - { - char charA = tolower(a.getItm()[i]); - char charB = tolower(b.getItm()[i]); - if(charA != charB) - return charA < charB; - } - return false; - } -} sortDirList; - -void fs::mkDir(const std::string& _p) -{ - if(cfg::config["directFsCmd"]) - fsMkDir(_p.c_str()); - else - mkdir(_p.c_str(), 777); -} - -void fs::mkDirRec(const std::string& _p) -{ - //skip first slash - size_t pos = _p.find('/', 0) + 1; - while((pos = _p.find('/', pos)) != _p.npos) - { - fs::mkDir(_p.substr(0, pos).c_str()); - ++pos; - } -} - -void fs::delDir(const std::string& path) -{ - dirList list(path); - for(unsigned i = 0; i < list.getCount(); i++) - { - if(pathIsFiltered(path + list.getItem(i))) - continue; - - if(list.isDir(i)) - { - std::string newPath = path + list.getItem(i) + "/"; - delDir(newPath); - - std::string delPath = path + list.getItem(i); - rmdir(delPath.c_str()); - } - else - { - std::string delPath = path + list.getItem(i); - std::remove(delPath.c_str()); - } - } - rmdir(path.c_str()); -} - -bool fs::dirNotEmpty(const std::string& _dir) -{ - fs::dirList tmp(_dir); - return tmp.getCount() > 0; -} - -bool fs::isDir(const std::string& _path) -{ - struct stat s; - return stat(_path.c_str(), &s) == 0 && S_ISDIR(s.st_mode); -} - -void fs::copyDirToDir(const std::string& src, const std::string& dst, threadInfo *t) -{ - if(t) - t->status->setStatus(ui::getUICString("threadStatusOpeningFolder", 0), src.c_str()); - - fs::dirList *list = new fs::dirList(src); - for(unsigned i = 0; i < list->getCount(); i++) - { - if(pathIsFiltered(src + list->getItem(i))) - continue; - - if(list->isDir(i)) - { - std::string newSrc = src + list->getItem(i) + "/"; - std::string newDst = dst + list->getItem(i) + "/"; - fs::mkDir(newDst.substr(0, newDst.length() - 1)); - fs::copyDirToDir(newSrc, newDst, t); - } - else - { - std::string fullSrc = src + list->getItem(i); - std::string fullDst = dst + list->getItem(i); - - if(t) - t->status->setStatus(ui::getUICString("threadStatusCopyingFile", 0), fullSrc.c_str()); - - fs::copyFile(fullSrc, fullDst, t); - } - } - delete list; -} - -static void copyDirToDir_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *in = (fs::copyArgs *)t->argPtr; - fs::copyDirToDir(in->src, in->dst, t); - if(in->cleanup) - fs::copyArgsDestroy(in); - t->finished = true; -} - -void fs::copyDirToDirThreaded(const std::string& src, const std::string& dst) -{ - fs::copyArgs *send = fs::copyArgsCreate(src, dst, "", NULL, NULL, true, false, 0); - ui::newThread(copyDirToDir_t, send, fs::fileDrawFunc); -} - -void fs::copyDirToDirCommit(const std::string& src, const std::string& dst, const std::string& dev, threadInfo *t) -{ - if(t) - t->status->setStatus(ui::getUICString("threadStatusOpeningFolder", 0), src.c_str()); - - fs::dirList *list = new fs::dirList(src); - for(unsigned i = 0; i < list->getCount(); i++) - { - if(pathIsFiltered(src + list->getItem(i))) - continue; - - if(list->isDir(i)) - { - std::string newSrc = src + list->getItem(i) + "/"; - std::string newDst = dst + list->getItem(i) + "/"; - fs::mkDir(newDst.substr(0, newDst.length() - 1)); - fs::copyDirToDirCommit(newSrc, newDst, dev, t); - } - else - { - std::string fullSrc = src + list->getItem(i); - std::string fullDst = dst + list->getItem(i); - - if(t) - t->status->setStatus(ui::getUICString("threadStatusCopyingFile", 0), fullSrc.c_str()); - - fs::copyFileCommit(fullSrc, fullDst, dev, t); - } - } - delete list; -} - -static void copyDirToDirCommit_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *in = (fs::copyArgs *)t->argPtr; - fs::copyDirToDirCommit(in->src, in->dst, in->dev, t); - if(in->cleanup) - fs::copyArgsDestroy(in); - t->finished = true; -} - -void fs::copyDirToDirCommitThreaded(const std::string& src, const std::string& dst, const std::string& dev) -{ - fs::copyArgs *send = fs::copyArgsCreate(src, dst, dev, NULL, NULL, true, false, 0); - ui::newThread(copyDirToDirCommit_t, send, fs::fileDrawFunc); -} - -void fs::getDirProps(const std::string& path, unsigned& dirCount, unsigned& fileCount, uint64_t& totalSize) -{ - fs::dirList *d = new fs::dirList(path); - for(unsigned i = 0; i < d->getCount(); i++) - { - if(d->isDir(i)) - { - ++dirCount; - std::string newPath = path + d->getItem(i) + "/"; - fs::getDirProps(newPath, dirCount, fileCount, totalSize); - } - else - { - ++fileCount; - std::string filePath = path + d->getItem(i); - totalSize += fs::fsize(filePath); - } - } - delete d; -} - -fs::dirItem::dirItem(const std::string& pathTo, const std::string& sItem) -{ - itm = sItem; - - std::string fullPath = pathTo + sItem; - struct stat s; - if(stat(fullPath.c_str(), &s) == 0 && S_ISDIR(s.st_mode)) - dir = true; -} - -std::string fs::dirItem::getName() const -{ - size_t extPos = itm.find_last_of('.'), slPos = itm.find_last_of('/'); - if(extPos == itm.npos) - return ""; - - return itm.substr(slPos + 1, extPos); -} - -std::string fs::dirItem::getExt() const -{ - return util::getExtensionFromString(itm); -} - -fs::dirList::dirList(const std::string& _path, bool ignoreDotFiles) -{ - DIR *d; - struct dirent *ent; - path = _path; - d = opendir(path.c_str()); - - while((ent = readdir(d))) - if (!ignoreDotFiles || ent->d_name[0] != '.') - item.emplace_back(path, ent->d_name); - - closedir(d); - - std::sort(item.begin(), item.end(), sortDirList); -} - -void fs::dirList::reassign(const std::string& _path) -{ - DIR *d; - struct dirent *ent; - path = _path; - - d = opendir(path.c_str()); - - item.clear(); - - while((ent = readdir(d))) - item.emplace_back(path, ent->d_name); - - closedir(d); - - std::sort(item.begin(), item.end(), sortDirList); -} - -void fs::dirList::rescan() -{ - item.clear(); - DIR *d; - struct dirent *ent; - d = opendir(path.c_str()); - - while((ent = readdir(d))) - item.emplace_back(path, ent->d_name); - - closedir(d); - - std::sort(item.begin(), item.end(), sortDirList); -} diff --git a/src/fs/file.cpp b/src/fs/file.cpp deleted file mode 100644 index b51da12..0000000 --- a/src/fs/file.cpp +++ /dev/null @@ -1,395 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fs.h" -#include "util.h" -#include "ui.h" -#include "gfx.h" -#include "data.h" -#include "cfg.h" - -static std::string wd = "sdmc:/JKSV/"; - -typedef struct -{ - std::mutex bufferLock; - std::condition_variable cond; - std::vector sharedBuffer; - std::string dst, dev; - bool bufferIsFull = false; - unsigned int filesize = 0, writeLimit = 0; -} fileCpyThreadArgs; - -static void writeFile_t(void *a) -{ - fileCpyThreadArgs *in = (fileCpyThreadArgs *)a; - size_t written = 0; - std::vector localBuffer; - FILE *out = fopen(in->dst.c_str(), "wb"); - - while(written < in->filesize) - { - std::unique_lock buffLock(in->bufferLock); - in->cond.wait(buffLock, [in]{ return in->bufferIsFull;}); - localBuffer.clear(); - localBuffer.assign(in->sharedBuffer.begin(), in->sharedBuffer.end()); - in->sharedBuffer.clear(); - in->bufferIsFull = false; - buffLock.unlock(); - in->cond.notify_one(); - written += fwrite(localBuffer.data(), 1, localBuffer.size(), out); - } - fclose(out); -} - -static void writeFileCommit_t(void *a) -{ - fileCpyThreadArgs *in = (fileCpyThreadArgs *)a; - size_t written = 0, journalCount = 0; - std::vector localBuffer; - FILE *out = fopen(in->dst.c_str(), "wb"); - - while(written < in->filesize) - { - std::unique_lock buffLock(in->bufferLock); - in->cond.wait(buffLock, [in]{ return in->bufferIsFull; }); - localBuffer.clear(); - localBuffer.assign(in->sharedBuffer.begin(), in->sharedBuffer.end()); - in->sharedBuffer.clear(); - in->bufferIsFull = false; - buffLock.unlock(); - in->cond.notify_one(); - - written += fwrite(localBuffer.data(), 1, localBuffer.size(), out); - - journalCount += written; - if(journalCount >= in->writeLimit) - { - journalCount = 0; - fclose(out); - fs::commitToDevice(in->dev.c_str()); - out = fopen(in->dst.c_str(), "ab"); - } - } - fclose(out); -} - -fs::copyArgs *fs::copyArgsCreate(const std::string& src, const std::string& dst, const std::string& dev, zipFile z, unzFile unz, bool _cleanup, bool _trimZipPath, uint8_t _trimPlaces) -{ - copyArgs *ret = new copyArgs; - ret->src = src; - ret->dst = dst; - ret->dev = dev; - ret->z = z; - ret->unz = unz; - ret->cleanup = _cleanup; - ret->prog = new ui::progBar; - ret->prog->setMax(0); - ret->prog->update(0); - ret->offset = 0; - ret->trimZipPath = _trimZipPath; - ret->trimZipPlaces = _trimPlaces; - return ret; -} - -void fs::copyArgsDestroy(copyArgs *c) -{ - delete c->prog; - delete c; - c = NULL; -} - -fs::dataFile::dataFile(const std::string& _path) -{ - f = fopen(_path.c_str(), "r"); - if(f != NULL) - opened = true; -} - -fs::dataFile::~dataFile() -{ - fclose(f); -} - -bool fs::dataFile::readNextLine(bool proc) -{ - bool ret = false; - char tmp[1024]; - while(fgets(tmp, 1024, f)) - { - if(tmp[0] != '#' && tmp[0] != '\n' && tmp[0] != '\r') - { - line = tmp; - ret = true; - break; - } - } - util::stripChar('\n', line); - util::stripChar('\r', line); - if(proc) - procLine(); - - return ret; -} - -void fs::dataFile::procLine() -{ - size_t pPos = line.find_first_of("(=,"); - if(pPos != line.npos) - { - lPos = pPos; - name.assign(line.begin(), line.begin() + lPos); - } - else - name = line; - - util::stripChar(' ', name); - ++lPos; -} - -std::string fs::dataFile::getNextValueStr() -{ - std::string ret = ""; - //Skip all spaces until we hit actual text - size_t pos1 = line.find_first_not_of(", ", lPos); - //If reading from quotes - if(line[pos1] == '"') - lPos = line.find_first_of('"', ++pos1); - else - lPos = line.find_first_of(",;\n", pos1);//Set lPos to end of string we want. This should just set lPos to the end of the line if it fails, which is ok - - ret = line.substr(pos1, lPos++ - pos1); - - util::replaceStr(ret, "\\n", "\n"); - - return ret; -} - -int fs::dataFile::getNextValueInt() -{ - int ret = 0; - std::string no = getNextValueStr(); - if(no[0] == '0' && tolower(no[1]) == 'x') - ret = strtoul(no.c_str(), NULL, 16); - else - ret = strtoul(no.c_str(), NULL, 10); - - return ret; -} - -void fs::copyFile(const std::string& src, const std::string& dst, threadInfo *t) -{ - fs::copyArgs *c = NULL; - size_t filesize = fs::fsize(src); - if(t) - { - c = (fs::copyArgs *)t->argPtr; - c->offset = 0; - c->prog->setMax(filesize); - c->prog->update(0); - } - - FILE *fsrc = fopen(src.c_str(), "rb"); - if(!fsrc) - { - fclose(fsrc); - return; - } - - fileCpyThreadArgs thrdArgs; - thrdArgs.dst = dst; - thrdArgs.filesize = filesize; - - uint8_t *buff = new uint8_t[BUFF_SIZE]; - std::vector transferBuffer; - Thread writeThread; - threadCreate(&writeThread, writeFile_t, &thrdArgs, NULL, 0x40000, 0x2E, 2); - threadStart(&writeThread); - size_t readIn = 0; - uint64_t readCount = 0; - while((readIn = fread(buff, 1, BUFF_SIZE, fsrc)) > 0) - { - transferBuffer.insert(transferBuffer.end(), buff, buff + readIn); - readCount += readIn; - - if(c) - c->offset = readCount; - - if(transferBuffer.size() >= TRANSFER_BUFFER_LIMIT || readCount == filesize) - { - std::unique_lock buffLock(thrdArgs.bufferLock); - thrdArgs.cond.wait(buffLock, [&thrdArgs]{ return thrdArgs.bufferIsFull == false; }); - thrdArgs.sharedBuffer.assign(transferBuffer.begin(), transferBuffer.end()); - transferBuffer.clear(); - thrdArgs.bufferIsFull = true; - buffLock.unlock(); - thrdArgs.cond.notify_one(); - } - } - threadWaitForExit(&writeThread); - threadClose(&writeThread); - fclose(fsrc); - delete[] buff; -} - -static void copyFileThreaded_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *in = (fs::copyArgs *)t->argPtr; - - t->status->setStatus(ui::getUICString("threadStatusCopyingFile", 0), in->src.c_str()); - - fs::copyFile(in->src, in->dst, t); - if(in->cleanup) - fs::copyArgsDestroy(in); - t->finished = true; -} - -void fs::copyFileThreaded(const std::string& src, const std::string& dst) -{ - fs::copyArgs *send = fs::copyArgsCreate(src, dst, "", NULL, NULL, true, false, 0); - ui::newThread(copyFileThreaded_t, send, fs::fileDrawFunc); -} - -void fs::copyFileCommit(const std::string& src, const std::string& dst, const std::string& dev, threadInfo *t) -{ - fs::copyArgs *c = NULL; - size_t filesize = fs::fsize(src); - if(t) - { - c = (fs::copyArgs *)t->argPtr; - c->offset = 0; - c->prog->setMax(filesize); - c->prog->update(0); - } - - FILE *fsrc = fopen(src.c_str(), "rb"); - if(!fsrc) - { - fclose(fsrc); - return; - } - - fileCpyThreadArgs thrdArgs; - thrdArgs.dst = dst; - thrdArgs.dev = dev; - thrdArgs.filesize = filesize; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - uint64_t journalSpace = fs::getJournalSize(utinfo); - thrdArgs.writeLimit = (journalSpace - 0x100000) < TRANSFER_BUFFER_LIMIT ? journalSpace - 0x100000 : TRANSFER_BUFFER_LIMIT; - - Thread writeThread; - threadCreate(&writeThread, writeFileCommit_t, &thrdArgs, NULL, 0x040000, 0x2E, 2); - - uint8_t *buff = new uint8_t[BUFF_SIZE]; - size_t readIn = 0; - uint64_t readCount = 0; - std::vector transferBuffer; - threadStart(&writeThread); - while((readIn = fread(buff, 1, BUFF_SIZE, fsrc)) > 0) - { - transferBuffer.insert(transferBuffer.end(), buff, buff + readIn); - readCount += readIn; - if(c) - c->offset = readCount; - - if(transferBuffer.size() >= thrdArgs.writeLimit || readCount == filesize) - { - std::unique_lock buffLock(thrdArgs.bufferLock); - thrdArgs.cond.wait(buffLock, [&thrdArgs]{ return thrdArgs.bufferIsFull == false; }); - thrdArgs.sharedBuffer.assign(transferBuffer.begin(), transferBuffer.end()); - transferBuffer.clear(); - thrdArgs.bufferIsFull = true; - buffLock.unlock(); - thrdArgs.cond.notify_one(); - } - } - threadWaitForExit(&writeThread); - threadClose(&writeThread); - - fclose(fsrc); - fs::commitToDevice(dev); - delete[] buff; -} - -static void copyFileCommit_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *in = (fs::copyArgs *)t->argPtr; - - t->status->setStatus(ui::getUICString("threadStatusCopyingFile", 0), in->src.c_str()); - in->prog->setMax(fs::fsize(in->src)); - in->prog->update(0); - - fs::copyFileCommit(in->src, in->dst, in->dev, t); - if(in->cleanup) - fs::copyArgsDestroy(in); - - t->finished = true; -} - -void fs::copyFileCommitThreaded(const std::string& src, const std::string& dst, const std::string& dev) -{ - fs::copyArgs *send = fs::copyArgsCreate(src, dst, dev, NULL, NULL, true, false, 0); - ui::newThread(copyFileCommit_t, send, fs::fileDrawFunc); -} - -void fs::fileDrawFunc(void *a) -{ - threadInfo *t = (threadInfo *)a; - if(!t->finished && t->argPtr) - { - copyArgs *c = (copyArgs *)t->argPtr; - std::string tmp; - t->status->getStatus(tmp); - c->argLock(); - c->prog->update(c->offset); - c->prog->draw(tmp); - c->argUnlock(); - } -} - -void fs::delfile(const std::string& path) -{ - if(cfg::config["directFsCmd"]) - fsremove(path.c_str()); - else - remove(path.c_str()); -} - -void fs::getShowFileProps(const std::string& _path) -{ - size_t size = fs::fsize(_path); - ui::showMessage(ui::getUICString("fileModeFileProperties", 0), _path.c_str(), util::getSizeString(size).c_str()); -} - -bool fs::fileExists(const std::string& path) -{ - bool ret = false; - FILE *test = fopen(path.c_str(), "rb"); - if(test != NULL) - ret = true; - fclose(test); - return ret; -} - -size_t fs::fsize(const std::string& _f) -{ - size_t ret = 0; - FILE *get = fopen(_f.c_str(), "rb"); - if(get != NULL) - { - fseek(get, 0, SEEK_END); - ret = ftell(get); - } - fclose(get); - return ret; -} diff --git a/src/fs/fsfile.c b/src/fs/fsfile.c deleted file mode 100644 index d0b7d52..0000000 --- a/src/fs/fsfile.c +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include -#include - -#include "fs/fsfile.h" - -char *getDeviceFromPath(char *dev, size_t _max, const char *path) -{ - memset(dev, 0, _max); - char *c = strchr(path, ':'); - if(c - path > _max) - return NULL; - - //probably not good? idk - memcpy(dev, path, c - path); - - return dev; -} - -char *getFilePath(char *pathOut, size_t _max, const char *path) -{ - memset(pathOut, 0, _max); - char *c = strchr(path, '/'); - size_t pLength = strlen(c); - if(pLength > _max) - return NULL; - - memcpy(pathOut, c, pLength); - - return pathOut; -} - -bool fsMkDir(const char *_p) -{ - char devStr[16]; - char path[FS_MAX_PATH]; - if(!getDeviceFromPath(devStr, 16, _p) || !getFilePath(path, FS_MAX_PATH, _p)) - return false; - - Result res = fsFsCreateDirectory(fsdevGetDeviceFileSystem(devStr), path); - return res == 0; -} - -int fsremove(const char *_p) -{ - char devStr[16]; - char path[FS_MAX_PATH]; - if(!getDeviceFromPath(devStr, 16, _p) || !getFilePath(path, FS_MAX_PATH, _p)) - return -1; - - Result res = fsFsDeleteFile(fsdevGetDeviceFileSystem(devStr), path); - return res; -} - -Result fsDelDirRec(const char *_p) -{ - char devStr[16]; - char path[FS_MAX_PATH]; - if(!getDeviceFromPath(devStr, 16, _p) || ! getFilePath(path, FS_MAX_PATH, _p)) - return 1; - - return fsFsDeleteDirectoryRecursively(fsdevGetDeviceFileSystem(devStr), path); -} - -bool fsfcreate(const char *_p, int64_t crSize) -{ - char devStr[16]; - char filePath[FS_MAX_PATH]; - if(!getDeviceFromPath(devStr, 16, _p) || !getFilePath(filePath, FS_MAX_PATH, _p)) - return false; - - FsFileSystem *s = fsdevGetDeviceFileSystem(devStr); - if(s == NULL) - return false; - - Result res = fsFsCreateFile(s, filePath, crSize, 0); - if(R_SUCCEEDED(res)) - res = fsdevCommitDevice(devStr); - - return R_SUCCEEDED(res) ? true : false; -} - -FSFILE *fsfopen(const char *_p, uint32_t mode) -{ - char devStr[16]; - char filePath[FS_MAX_PATH]; - if(!getDeviceFromPath(devStr, 16, _p) || !getFilePath(filePath, FS_MAX_PATH, _p)) - return NULL; - - FsFileSystem *s = fsdevGetDeviceFileSystem(devStr); - if(s == NULL) - return NULL; - - if(mode == FsOpenMode_Write) - { - fsFsDeleteFile(s, filePath); - fsFsCreateFile(s, filePath, 0, 0); - } - - FSFILE *ret = malloc(sizeof(FSFILE)); - ret->error = fsFsOpenFile(s, filePath, mode, &ret->_f); - if(R_FAILED(ret->error)) - { - free(ret); - return NULL; - } - fsFileGetSize(&ret->_f, &ret->fsize); - ret->offset = (mode & FsOpenMode_Append) ? ret->fsize : 0; - - return ret; -} - -FSFILE *fsfopenWithSystem(FsFileSystem *_s, const char *_p, uint32_t mode) -{ - if(mode & FsOpenMode_Write) - { - fsFsDeleteFile(_s, _p); - fsFsCreateFile(_s, _p, 0, 0); - } - else if(mode & FsOpenMode_Append) - fsFsCreateFile(_s, _p, 0, 0); - - FSFILE *ret = malloc(sizeof(FSFILE)); - ret->error = fsFsOpenFile(_s, _p, mode, &ret->_f); - if(R_FAILED(ret->error)) - { - free(ret); - return NULL; - } - fsFileGetSize(&ret->_f, &ret->fsize); - ret->offset = (mode & FsOpenMode_Append) ? ret->fsize : 0; - - return ret; -} - -size_t fsfwrite(const void *buf, size_t sz, size_t count, FSFILE *_f) -{ - size_t fullSize = sz * count; - if(_f->offset + fullSize > _f->fsize) - { - s64 newSize = (_f->fsize + fullSize) - (_f->fsize - _f->offset); - fsFileSetSize(&_f->_f, newSize); - _f->fsize = newSize; - } - _f->error = fsFileWrite(&_f->_f, _f->offset, buf, fullSize, FsWriteOption_Flush); - _f->offset += fullSize; - - return fullSize; -} diff --git a/src/fs/remote.cpp b/src/fs/remote.cpp deleted file mode 100644 index 1e0bef2..0000000 --- a/src/fs/remote.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "fs.h" -#include "rfs.h" -#include "gd.h" -#include "webdav.h" -#include "cfg.h" -#include "ui.h" - -rfs::IRemoteFS *fs::rfs = NULL; -std::string fs::rfsRootID; - -void fs::remoteInit() -{ - // Google Drive has priority - driveInit(); - webDavInit(); -} - -void fs::remoteExit() -{ - if(rfs) { - delete rfs; - rfs = NULL; - } -} - -void fs::driveInit() -{ - // Already initialized? - if (rfs) - return; - - if(cfg::driveClientID.empty() || cfg::driveClientSecret.empty()) - return; - - bool refreshed = false, exchanged = false; - drive::gd *gDrive = new drive::gd; - gDrive->setClientID(cfg::driveClientID); - gDrive->setClientSecret(cfg::driveClientSecret); - if(!cfg::driveRefreshToken.empty()) - { - gDrive->setRefreshToken(cfg::driveRefreshToken); - refreshed = gDrive->refreshToken(); - } - - if(!refreshed) - { - std::string authCode = driveSignInGetAuthCode(); - exchanged = gDrive->exhangeAuthCode(authCode); - } - - if(gDrive->hasToken()) - { - if(exchanged) - { - cfg::driveRefreshToken = gDrive->getRefreshToken(); - cfg::saveConfig(); - } - - gDrive->driveListInit(""); - - if(!gDrive->dirExists(JKSV_DRIVE_FOLDER)) - gDrive->createDir(JKSV_DRIVE_FOLDER, ""); - - rfsRootID = gDrive->getDirID(JKSV_DRIVE_FOLDER); - rfs = gDrive; - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popDriveStarted", 0)); - } - else - { - delete gDrive; - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popDriveFailed", 0)); - } -} - -std::string fs::driveSignInGetAuthCode() -{ - std::string url = "https://accounts.google.com/o/oauth2/v2/auth?client_id=" + cfg::driveClientID + "&redirect_uri=urn:ietf:wg:oauth:2.0:oob:auto&response_type=code&scope=https://www.googleapis.com/auth/drive"; - std::string replyURL; - WebCommonConfig webCfg; - WebCommonReply webReply; - webPageCreate(&webCfg, url.c_str()); - webConfigSetCallbackUrl(&webCfg, "https://accounts.google.com/o/oauth2/approval/"); - webConfigShow(&webCfg, &webReply); - - size_t rLength = 0; - char replyURLCstr[0x1000]; - webReplyGetLastUrl(&webReply, replyURLCstr, 0x1000, &rLength); - //Prevent crash if empty. - if(strlen(replyURLCstr) == 0) - return ""; - - replyURL.assign(replyURLCstr); - int unescLength = 0; - size_t codeBegin = replyURL.find("approvalCode") + 13, codeEnd = replyURL.find_last_of('#'); - size_t codeLength = codeEnd - codeBegin; - replyURL = replyURL.substr(codeBegin, codeLength); - - char *urlUnesc = curl_easy_unescape(NULL, replyURL.c_str(), replyURL.length(), &unescLength); - replyURL = urlUnesc; - curl_free(urlUnesc); - - //Finally - return replyURL; -} - -void fs::webDavInit() { - // Already initialized? - if (rfs) - return; - - if (cfg::webdavOrigin.empty()) - return; - - rfs::WebDav *webdav = new rfs::WebDav(cfg::webdavOrigin, - cfg::webdavUser, - cfg::webdavPassword); - - std::string baseId = "/" + cfg::webdavBasePath + (cfg::webdavBasePath.empty() ? "" : "/"); - rfsRootID = webdav->getDirID(JKSV_DRIVE_FOLDER, baseId); - - // check access - if (!webdav->dirExists(JKSV_DRIVE_FOLDER, baseId)) // this could return false on auth/config related errors - { - if (!webdav->createDir(JKSV_DRIVE_FOLDER, baseId)) - { - delete webdav; - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popWebdavFailed", 0)); - return; - } - } - - rfs = webdav; - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popWebdavStarted", 0)); -} \ No newline at end of file diff --git a/src/fs/zip.cpp b/src/fs/zip.cpp deleted file mode 100644 index 069aa9b..0000000 --- a/src/fs/zip.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include -#include -#include -#include -#include - -#include "fs.h" -#include "util.h" -#include "cfg.h" - -typedef struct -{ - std::mutex buffLock; - std::condition_variable cond; - std::vector sharedBuffer; - std::string dst, dev; - bool bufferIsFull = false; - unzFile unz; - unsigned int fileSize, writeLimit = 0; -} unzThrdArgs; - -static void writeFileFromZip_t(void *a) -{ - unzThrdArgs *in = (unzThrdArgs *)a; - std::vector localBuffer; - unsigned int written = 0, journalCount = 0; - - FILE *out = fopen(in->dst.c_str(), "wb"); - while(written < in->fileSize) - { - std::unique_lock buffLock(in->buffLock); - in->cond.wait(buffLock, [in]{ return in->bufferIsFull; }); - localBuffer.clear(); - localBuffer.assign(in->sharedBuffer.begin(), in->sharedBuffer.end()); - in->sharedBuffer.clear(); - in->bufferIsFull = false; - buffLock.unlock(); - in->cond.notify_one(); - - written += fwrite(localBuffer.data(), 1, localBuffer.size(), out); - journalCount += written; - if(journalCount >= in->writeLimit) - { - journalCount = 0; - fclose(out); - fs::commitToDevice(in->dev); - out = fopen(in->dst.c_str(), "ab"); - } - } - fclose(out); -} - -void fs::copyDirToZip(const std::string& src, zipFile dst, bool trimPath, int trimPlaces, threadInfo *t) -{ - fs::copyArgs *c = NULL; - if(t) - { - t->status->setStatus(ui::getUICString("threadStatusOpeningFolder", 0), src.c_str()); - c = (fs::copyArgs *)t->argPtr; - } - - fs::dirList *list = new fs::dirList(src); - for(unsigned i = 0; i < list->getCount(); i++) - { - std::string itm = list->getItem(i); - if(fs::pathIsFiltered(src + itm)) - continue; - - if(list->isDir(i)) - { - std::string newSrc = src + itm + "/"; - fs::copyDirToZip(newSrc, dst, trimPath, trimPlaces, t); - } - else - { - time_t raw; - time(&raw); - tm *locTime = localtime(&raw); - zip_fileinfo inf = { locTime->tm_sec, locTime->tm_min, locTime->tm_hour, - locTime->tm_mday, locTime->tm_mon, (1900 + locTime->tm_year), 0, 0, 0 }; - - std::string filename = src + itm; - size_t zipNameStart = 0; - if(trimPath) - util::trimPath(filename, trimPlaces); - else - zipNameStart = filename.find_first_of('/') + 1; - - if(t) - t->status->setStatus(ui::getUICString("threadStatusAddingFileToZip", 0), itm.c_str()); - - int zipOpenFile = zipOpenNewFileInZip64(dst, filename.substr(zipNameStart, filename.npos).c_str(), &inf, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0); - if(zipOpenFile == ZIP_OK) - { - std::string fullSrc = src + itm; - if(c) - { - c->offset = 0; - c->prog->setMax(fs::fsize(fullSrc)); - c->prog->update(0); - } - - FILE *fsrc = fopen(fullSrc.c_str(), "rb"); - size_t readIn = 0; - uint8_t *buff = new uint8_t[ZIP_BUFF_SIZE]; - while((readIn = fread(buff, 1, ZIP_BUFF_SIZE, fsrc)) > 0) - { - zipWriteInFileInZip(dst, buff, readIn); - if(c) - c->offset += readIn; - } - delete[] buff; - fclose(fsrc); - } - } - } -} - -void copyDirToZip_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *c = (fs::copyArgs *)t->argPtr; - if(cfg::config["ovrClk"]) - { - util::sysBoost(); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popCPUBoostEnabled", 0)); - } - - fs::copyDirToZip(c->src, c->z, c->trimZipPath, c->trimZipPlaces, t); - - if(cfg::config["ovrClk"]) - util::sysNormal(); - - if(c->cleanup) - { - zipClose(c->z, NULL); - delete c; - } - t->finished = true; -} - -void fs::copyDirToZipThreaded(const std::string& src, zipFile dst, bool trimPath, int trimPlaces) -{ - fs::copyArgs *send = fs::copyArgsCreate(src, "", "", dst, NULL, true, false, 0); - ui::newThread(copyDirToZip_t, send, fs::fileDrawFunc); -} - -void fs::copyZipToDir(unzFile src, const std::string& dst, const std::string& dev, threadInfo *t) -{ - fs::copyArgs *c = NULL; - if(t) - c = (fs::copyArgs *)t->argPtr; - - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - uint64_t journalSize = getJournalSize(utinfo); - char filename[FS_MAX_PATH]; - uint8_t *buff = new uint8_t[BUFF_SIZE]; - int readIn = 0; - unz_file_info64 info; - do - { - unzGetCurrentFileInfo64(src, &info, filename, FS_MAX_PATH, NULL, 0, NULL, 0); - if(unzOpenCurrentFile(src) == UNZ_OK) - { - if(t) - t->status->setStatus(ui::getUICString("threadStatusDecompressingFile", 0), filename); - - if(c) - { - c->prog->setMax(info.uncompressed_size); - c->prog->update(0); - c->offset = 0; - } - - std::string fullDst = dst + filename; - fs::mkDirRec(fullDst.substr(0, fullDst.find_last_of('/') + 1)); - - unzThrdArgs unzThrd; - unzThrd.dst = fullDst; - unzThrd.fileSize = info.uncompressed_size; - unzThrd.dev = dev; - unzThrd.writeLimit = (journalSize - 0x100000) < TRANSFER_BUFFER_LIMIT ? (journalSize - 0x100000) : TRANSFER_BUFFER_LIMIT; - - Thread writeThread; - threadCreate(&writeThread, writeFileFromZip_t, &unzThrd, NULL, 0x8000, 0x2B, 2); - threadStart(&writeThread); - - std::vector transferBuffer; - uint64_t readCount = 0; - while((readIn = unzReadCurrentFile(src, buff, BUFF_SIZE)) > 0) - { - transferBuffer.insert(transferBuffer.end(), buff, buff + readIn); - readCount += readIn; - - if(c) - c->offset += readIn; - - if(transferBuffer.size() >= unzThrd.writeLimit || readCount == info.uncompressed_size) - { - std::unique_lock buffLock(unzThrd.buffLock); - unzThrd.cond.wait(buffLock, [&unzThrd]{ return unzThrd.bufferIsFull == false; }); - unzThrd.sharedBuffer.assign(transferBuffer.begin(), transferBuffer.end()); - transferBuffer.clear(); - unzThrd.bufferIsFull = true; - unzThrd.cond.notify_one(); - } - } - threadWaitForExit(&writeThread); - threadClose(&writeThread); - fs::commitToDevice(dev); - } - } - while(unzGoToNextFile(src) != UNZ_END_OF_LIST_OF_FILE); - delete[] buff; -} - -static void copyZipToDir_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *c = (fs::copyArgs *)t->argPtr; - fs::copyZipToDir(c->unz, c->dst, c->dev, t); - if(c->cleanup) - { - unzClose(c->unz); - delete c; - } - t->finished = true; -} - -void fs::copyZipToDirThreaded(unzFile src, const std::string& dst, const std::string& dev) -{ - fs::copyArgs *send = fs::copyArgsCreate("", dst, dev, NULL, src, true, false, 0); - ui::newThread(copyZipToDir_t, send, fs::fileDrawFunc); -} - -uint64_t fs::getZipTotalSize(unzFile unz) -{ - uint64_t ret = 0; - if(unzGoToFirstFile(unz) == UNZ_OK) - { - unz_file_info64 finfo; - char filename[FS_MAX_PATH]; - do - { - unzGetCurrentFileInfo64(unz, &finfo, filename, FS_MAX_PATH, NULL, 0, NULL, 0); - ret += finfo.uncompressed_size; - } while(unzGoToNextFile(unz) != UNZ_END_OF_LIST_OF_FILE); - unzGoToFirstFile(unz); - } - return ret; -} - -bool fs::zipNotEmpty(unzFile unz) -{ - return unzGoToFirstFile(unz) == UNZ_OK; -} diff --git a/src/gd.cpp b/src/gd.cpp deleted file mode 100644 index b6f9c86..0000000 --- a/src/gd.cpp +++ /dev/null @@ -1,646 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "gd.h" -#include "fs.h" -#include "curlfuncs.h" -#include "util.h" - -/* -Google Drive code for JKSV. -Still major WIP -*/ - -#define DRIVE_DEFAULT_PARAMS_AND_QUERY "?fields=files(name,id,mimeType,size,parents)&pageSize=1000&q=trashed=false\%20and\%20\%27me\%27\%20in\%20owners" - -#define tokenURL "https://oauth2.googleapis.com/token" -#define tokenCheckURL "https://oauth2.googleapis.com/tokeninfo" -#define driveURL "https://www.googleapis.com/drive/v3/files" -#define driveUploadURL "https://www.googleapis.com/upload/drive/v3/files" - -static inline void writeDriveError(const std::string& _function, const std::string& _message) -{ - fs::logWrite("Drive/%s: %s\n", _function.c_str(), _message.c_str()); -} - -static inline void writeCurlError(const std::string& _function, int _cerror) -{ - fs::logWrite("Drive/%s: CURL returned error %i\n", _function.c_str(), _cerror); -} - -bool drive::gd::exhangeAuthCode(const std::string& _authCode) -{ - // Header - curl_slist *postHeader = NULL; - postHeader = curl_slist_append(postHeader, HEADER_CONTENT_TYPE_APP_JSON); - - // Post json - json_object *post = json_object_new_object(); - json_object *clientIDString = json_object_new_string(clientID.c_str()); - json_object *secretIDString = json_object_new_string(secretID.c_str()); - json_object *authCodeString = json_object_new_string(_authCode.c_str()); - json_object *redirectUriString = json_object_new_string("urn:ietf:wg:oauth:2.0:oob:auto"); - json_object *grantTypeString = json_object_new_string("authorization_code"); - json_object_object_add(post, "client_id", clientIDString); - json_object_object_add(post, "client_secret", secretIDString); - json_object_object_add(post, "code", authCodeString); - json_object_object_add(post, "redirect_uri", redirectUriString); - json_object_object_add(post, "grant_type", grantTypeString); - - // Curl Request - std::string *jsonResp = new std::string; - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, postHeader); - curl_easy_setopt(curl, CURLOPT_URL, tokenURL); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, jsonResp); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_object_get_string(post)); - - int error = curl_easy_perform(curl); - - json_object *respParse = json_tokener_parse(jsonResp->c_str()); - if (error == CURLE_OK) - { - json_object *accessToken = json_object_object_get(respParse, "access_token"); - json_object *refreshToken = json_object_object_get(respParse, "refresh_token"); - - if(accessToken && refreshToken) - { - token = json_object_get_string(accessToken); - rToken = json_object_get_string(refreshToken); - } - else - writeDriveError("exchangeAuthCode", jsonResp->c_str()); - } - else - writeCurlError("exchangeAuthCode", error); - - delete jsonResp; - json_object_put(post); - json_object_put(respParse); - curl_slist_free_all(postHeader); - curl_easy_cleanup(curl); - - return true; -} - -bool drive::gd::refreshToken() -{ - bool ret = false; - - // Header - curl_slist *header = NULL; - header = curl_slist_append(header, HEADER_CONTENT_TYPE_APP_JSON); - - // Post Json - json_object *post = json_object_new_object(); - json_object *clientIDString = json_object_new_string(clientID.c_str()); - json_object *secretIDString = json_object_new_string(secretID.c_str()); - json_object *refreshTokenString = json_object_new_string(rToken.c_str()); - json_object *grantTypeString = json_object_new_string("refresh_token"); - json_object_object_add(post, "client_id", clientIDString); - json_object_object_add(post, "client_secret", secretIDString); - json_object_object_add(post, "refresh_token", refreshTokenString); - json_object_object_add(post, "grant_type", grantTypeString); - - // Curl - std::string *jsonResp = new std::string; - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header); - curl_easy_setopt(curl, CURLOPT_URL, tokenURL); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, jsonResp); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_object_get_string(post)); - int error = curl_easy_perform(curl); - - json_object *parse = json_tokener_parse(jsonResp->c_str()); - if (error == CURLE_OK) - { - json_object *accessToken, *error; - json_object_object_get_ex(parse, "access_token", &accessToken); - json_object_object_get_ex(parse, "error", &error); - - if(accessToken) - { - token = json_object_get_string(accessToken); - ret = true; - } - else if(error) - writeDriveError("refreshToken", jsonResp->c_str()); - } - - delete jsonResp; - json_object_put(post); - json_object_put(parse); - curl_slist_free_all(header); - curl_easy_cleanup(curl); - - return ret; -} - -bool drive::gd::tokenIsValid() -{ - bool ret = false; - - std::string url = tokenCheckURL; - url.append("?access_token=" + token); - - CURL *curl = curl_easy_init(); - std::string *jsonResp = new std::string; - curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, jsonResp); - - int error = curl_easy_perform(curl); - json_object *parse = json_tokener_parse(jsonResp->c_str()); - if (error == CURLE_OK) - { - json_object *checkError; - json_object_object_get_ex(parse, "error", &checkError); - if(!checkError) - ret = true; - } - - delete jsonResp; - json_object_put(parse); - curl_easy_cleanup(curl); - return ret; -} - -static int requestList(const std::string& _url, const std::string& _token, std::string *_respOut) -{ - int ret = 0; - - // Headers needed - curl_slist *postHeaders = NULL; - postHeaders = curl_slist_append(postHeaders, std::string(HEADER_AUTHORIZATION + _token).c_str()); - - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); - curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, postHeaders); - curl_easy_setopt(curl, CURLOPT_URL, _url.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, _respOut); - ret = curl_easy_perform(curl); - - - curl_slist_free_all(postHeaders); - curl_easy_cleanup(curl); - - return ret; -} - -static void processList(const std::string& _json, std::vector& _drvl, bool _clear) -{ - if(_clear) - _drvl.clear(); - - json_object *parse = json_tokener_parse(_json.c_str()), *fileArray; - json_object_object_get_ex(parse, "files", &fileArray); - if(fileArray) - { - size_t arrayLength = json_object_array_length(fileArray); - _drvl.reserve(_drvl.size() + arrayLength); - for(unsigned i = 0; i < arrayLength; i++) - { - json_object *idString, *nameString, *mimeTypeString, *size, *parentArray; - json_object *curFile = json_object_array_get_idx(fileArray, i); - json_object_object_get_ex(curFile, "id", &idString); - json_object_object_get_ex(curFile, "name", &nameString); - json_object_object_get_ex(curFile, "mimeType", &mimeTypeString); - json_object_object_get_ex(curFile, "size", &size); - json_object_object_get_ex(curFile, "parents", &parentArray); - - rfs::RfsItem newDirItem; - newDirItem.name = json_object_get_string(nameString); - newDirItem.id = json_object_get_string(idString); - newDirItem.size = json_object_get_int(size); - if(strcmp(json_object_get_string(mimeTypeString), MIMETYPE_FOLDER) == 0) - newDirItem.isDir = true; - - if (parentArray) - { - size_t parentCount = json_object_array_length(parentArray); - //There can only be 1 parent, but it's held in an array... - for (unsigned j = 0; j < parentCount; j++) - { - json_object *parent = json_object_array_get_idx(parentArray, j); - newDirItem.parent = json_object_get_string(parent); - } - } - _drvl.push_back(newDirItem); - } - } - json_object_put(parse); -} - -void drive::gd::driveListInit(const std::string& _q) -{ - if(!tokenIsValid()) - refreshToken(); - - // Request url with specific fields needed. - std::string url = std::string(driveURL) + std::string(DRIVE_DEFAULT_PARAMS_AND_QUERY); - if(!_q.empty()) - { - char *qEsc = curl_easy_escape(NULL, _q.c_str(), _q.length()); - url.append(std::string("\%20and\%20") + std::string(qEsc)); - curl_free(qEsc); - } - - std::string jsonResp; - int error = requestList(url, token, &jsonResp); - if(error == CURLE_OK) - processList(jsonResp, driveList, true); - else - writeCurlError("driveListInit", error); -} - -void drive::gd::driveListAppend(const std::string& _q) -{ - if(!tokenIsValid()) - refreshToken(); - - std::string url = std::string(driveURL) + std::string(DRIVE_DEFAULT_PARAMS_AND_QUERY); - if(!_q.empty()) - { - char *qEsc = curl_easy_escape(NULL, _q.c_str(), _q.length()); - url.append(std::string("\%20and\%20") + std::string(qEsc)); - curl_free(qEsc); - } - - std::string jsonResp; - int error = requestList(url, token, &jsonResp); - if(error == CURLE_OK) - processList(jsonResp, driveList, false); - else - writeCurlError("driveListAppend", error); -} - -std::vector drive::gd::getListWithParent(const std::string& _parent) { - std::vector filtered; - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].parent == _parent) - filtered.push_back(driveList[i]); - } - return filtered; -} - -void drive::gd::debugWriteList() -{ - for(auto& di : driveList) - { - fs::logWrite("%s\n\t%s\n", di.name.c_str(), di.id.c_str()); - if(!di.parent.empty()) - fs::logWrite("\t%s\n", di.parent.c_str()); - } -} - -bool drive::gd::createDir(const std::string& _dirName, const std::string& _parent) -{ - if(!tokenIsValid()) - refreshToken(); - - bool ret = true; - - // Headers to use - curl_slist *postHeaders = NULL; - postHeaders = curl_slist_append(postHeaders, std::string(HEADER_AUTHORIZATION + token).c_str()); - postHeaders = curl_slist_append(postHeaders, HEADER_CONTENT_TYPE_APP_JSON); - - // JSON To Post - json_object *post = json_object_new_object(); - json_object *nameString = json_object_new_string(_dirName.c_str()); - json_object *mimeTypeString = json_object_new_string(MIMETYPE_FOLDER); - json_object_object_add(post, "name", nameString); - json_object_object_add(post, "mimeType", mimeTypeString); - if (!_parent.empty()) - { - json_object *parentsArray = json_object_new_array(); - json_object *parentString = json_object_new_string(_parent.c_str()); - json_object_array_add(parentsArray, parentString); - json_object_object_add(post, "parents", parentsArray); - } - - // Curl Request - std::string *jsonResp = new std::string; - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, postHeaders); - curl_easy_setopt(curl, CURLOPT_URL, driveURL); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, jsonResp); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_object_get_string(post)); - int error = curl_easy_perform(curl); - - json_object *respParse = json_tokener_parse(jsonResp->c_str()), *checkError; - json_object_object_get_ex(respParse, "error", &checkError); - if (error == CURLE_OK && !checkError) - { - //Append it to list - json_object *id; - json_object_object_get_ex(respParse, "id", &id); - - rfs::RfsItem newDir; - newDir.name = _dirName; - newDir.id = json_object_get_string(id); - newDir.isDir = true; - newDir.size = 0; - newDir.parent = _parent; - driveList.push_back(newDir); - } - else - ret = false; - - delete jsonResp; - json_object_put(post); - json_object_put(respParse); - curl_slist_free_all(postHeaders); - curl_easy_cleanup(curl); - return ret; -} - -bool drive::gd::dirExists(const std::string& _dirName) -{ - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].isDir && driveList[i].name == _dirName) - return true; - } - return false; -} - -bool drive::gd::dirExists(const std::string& _dirName, const std::string& _parent) -{ - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].isDir && driveList[i].name == _dirName && driveList[i].parent == _parent) - return true; - } - return false; -} - -bool drive::gd::fileExists(const std::string& _filename, const std::string& _parent) -{ - for(unsigned i = 0; i < driveList.size(); i++) - { - if(!driveList[i].isDir && driveList[i].name == _filename && driveList[i].parent == _parent) - return true; - } - return false; -} - -void drive::gd::uploadFile(const std::string& _filename, const std::string& _parent, curlFuncs::curlUpArgs *_upload) -{ - if(!tokenIsValid()) - refreshToken(); - - std::string url = driveUploadURL; - url.append("?uploadType=resumable"); - - // Headers - curl_slist *postHeaders = NULL; - postHeaders = curl_slist_append(postHeaders, std::string(HEADER_AUTHORIZATION + token).c_str()); - postHeaders = curl_slist_append(postHeaders, HEADER_CONTENT_TYPE_APP_JSON); - - // Post JSON - json_object *post = json_object_new_object(); - json_object *nameString = json_object_new_string(_filename.c_str()); - json_object_object_add(post, "name", nameString); - if (!_parent.empty()) - { - json_object *parentArray = json_object_new_array(); - json_object *parentString = json_object_new_string(_parent.c_str()); - json_object_array_add(parentArray, parentString); - json_object_object_add(post, "parents", parentArray); - } - - // Curl upload request - std::string *jsonResp = new std::string; - std::vector *headers = new std::vector; - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, postHeaders); - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlFuncs::writeHeaders); - curl_easy_setopt(curl, CURLOPT_HEADERDATA, headers); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_object_get_string(post)); - - int error = curl_easy_perform(curl); - std::string location = curlFuncs::getHeader("Location", headers); - if (error == CURLE_OK && location != HEADER_ERROR) - { - CURL *curlUp = curl_easy_init(); - curl_easy_setopt(curlUp, CURLOPT_PUT, 1); - curl_easy_setopt(curlUp, CURLOPT_URL, location.c_str()); - curl_easy_setopt(curlUp, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curlUp, CURLOPT_WRITEDATA, jsonResp); - curl_easy_setopt(curlUp, CURLOPT_READFUNCTION, curlFuncs::readDataFile); - curl_easy_setopt(curlUp, CURLOPT_READDATA, _upload); - curl_easy_setopt(curlUp, CURLOPT_UPLOAD_BUFFERSIZE, UPLOAD_BUFFER_SIZE); - curl_easy_setopt(curlUp, CURLOPT_UPLOAD, 1); - curl_easy_perform(curlUp); - curl_easy_cleanup(curlUp); - - json_object *parse = json_tokener_parse(jsonResp->c_str()), *id, *name, *mimeType; - json_object_object_get_ex(parse, "id", &id); - json_object_object_get_ex(parse, "name", &name); - json_object_object_get_ex(parse, "mimeType", &mimeType); - - if(name && id && mimeType) - { - rfs::RfsItem uploadData; - uploadData.id = json_object_get_string(id); - uploadData.name = json_object_get_string(name); - uploadData.isDir = false; - uploadData.size = *_upload->o;//should be safe to use - uploadData.parent = _parent; - driveList.push_back(uploadData); - } - json_object_put(parse); - } - else - writeCurlError("uploadFile", error); - - delete jsonResp; - delete headers; - json_object_put(post); - curl_slist_free_all(postHeaders); -} - -void drive::gd::updateFile(const std::string& _fileID, curlFuncs::curlUpArgs *_upload) -{ - if(!tokenIsValid()) - refreshToken(); - - //URL - std::string url = driveUploadURL; - url.append("/" + _fileID); - url.append("?uploadType=resumable"); - - //Header - curl_slist *patchHeader = NULL; - patchHeader = curl_slist_append(patchHeader, std::string(HEADER_AUTHORIZATION + token).c_str()); - - //Curl - std::string *jsonResp = new std::string; - std::vector *headers = new std::vector; - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH"); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, patchHeader); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlFuncs::writeHeaders); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, jsonResp); - curl_easy_setopt(curl, CURLOPT_HEADERDATA, headers); - - int error = curl_easy_perform(curl); - std::string location = curlFuncs::getHeader("Location", headers); - if(error == CURLE_OK && location != HEADER_ERROR) - { - CURL *curlPatch = curl_easy_init(); - curl_easy_setopt(curlPatch, CURLOPT_PUT, 1); - curl_easy_setopt(curlPatch, CURLOPT_URL, location.c_str()); - curl_easy_setopt(curlPatch, CURLOPT_READFUNCTION, curlFuncs::readDataFile); - curl_easy_setopt(curlPatch, CURLOPT_READDATA, _upload); - curl_easy_setopt(curlPatch, CURLOPT_UPLOAD_BUFFERSIZE, UPLOAD_BUFFER_SIZE); - curl_easy_setopt(curlPatch, CURLOPT_UPLOAD, 1); - curl_easy_perform(curlPatch); - curl_easy_cleanup(curlPatch); - - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].id == _fileID) - { - driveList[i].size = *_upload->o; - break; - } - } - } - - delete jsonResp; - delete headers; - curl_slist_free_all(patchHeader); - curl_easy_cleanup(curl); -} - -void drive::gd::downloadFile(const std::string& _fileID, curlFuncs::curlDlArgs *_download) -{ - if(!tokenIsValid()) - refreshToken(); - - //URL - std::string url = driveURL; - url.append("/" + _fileID); - url.append("?alt=media"); - - //Headers - curl_slist *getHeaders = NULL; - getHeaders = curl_slist_append(getHeaders, std::string(HEADER_AUTHORIZATION + token).c_str()); - - //Downloading is threaded because it's too slow otherwise - rfs::dlWriteThreadStruct dlWrite; - dlWrite.cfa = _download; - - Thread writeThread; - threadCreate(&writeThread, rfs::writeThread_t, &dlWrite, NULL, 0x8000, 0x2B, 2); - - //Curl - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, getHeaders); - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, rfs::writeDataBufferThreaded); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &dlWrite); - threadStart(&writeThread); - - curl_easy_perform(curl); - - threadWaitForExit(&writeThread); - threadClose(&writeThread); - - curl_slist_free_all(getHeaders); - curl_easy_cleanup(curl); -} - -void drive::gd::deleteFile(const std::string& _fileID) -{ - if(!tokenIsValid()) - refreshToken(); - - //URL - std::string url = driveURL; - url.append("/" + _fileID); - - //Header - curl_slist *delHeaders = NULL; - delHeaders = curl_slist_append(delHeaders, std::string(HEADER_AUTHORIZATION + token).c_str()); - - //Curl - CURL *curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, delHeaders); - curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); - curl_easy_perform(curl); - - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].id == _fileID) - { - driveList.erase(driveList.begin() + i); - break; - } - } - - curl_slist_free_all(delHeaders); - curl_easy_cleanup(curl); -} - -std::string drive::gd::getFileID(const std::string& _name, const std::string& _parent) -{ - for(unsigned i = 0; i < driveList.size(); i++) - { - if(!driveList[i].isDir && driveList[i].name == _name && driveList[i].parent == _parent) - return driveList[i].id; - } - return ""; -} - -std::string drive::gd::getDirID(const std::string& _name) -{ - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].isDir && driveList[i].name == _name) - return driveList[i].id; - } - return ""; -} - -std::string drive::gd::getDirID(const std::string& _name, const std::string& _parent) -{ - for(unsigned i = 0; i < driveList.size(); i++) - { - if(driveList[i].isDir && driveList[i].name == _name && driveList[i].parent == _parent) - return driveList[i].id; - } - return ""; -} \ No newline at end of file diff --git a/src/gfx.cpp b/src/gfx.cpp deleted file mode 100644 index 7b2f6df..0000000 --- a/src/gfx.cpp +++ /dev/null @@ -1,437 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include FT_FREETYPE_H - -#define VA_SIZE 1024 - -#include "gfx.h" -#include "file.h" - -static SDL_Window *wind; -SDL_Renderer *gfx::render; -gfx::textureMgr *gfx::texMgr; - -static FT_Library lib; -static FT_Face face[6]; -static int totalFonts = 0; -static bool loaded = false; - -static const SDL_Color *textcol; -static SDL_Color red = {0xFF, 0x00, 0x00, 0xFF}; -static SDL_Color green = {0x00, 0xFF, 0x00, 0xFF}; -static SDL_Color blue = {0x00, 0x99, 0xEE, 0xFF}; -static SDL_Color yellow = {0xF8, 0xFC, 0x00, 0xFF}; - -static const uint32_t redMask = 0xFF000000; -static const uint32_t greenMask = 0x00FF0000; -static const uint32_t blueMask = 0x0000FF00; -static const uint32_t alphaMask = 0x000000FF; -static const uint32_t breakPoints[7] = {' ', L' ', '/', '_', '-', L'。', L'、'}; - -static inline bool compClr(const SDL_Color *c1, const SDL_Color *c2) -{ - return (c1->r == c2->r) && (c1->b == c2->b) && (c1->g == c2->g) && (c1->a == c2->a); -} - -//Cache glyph textures -typedef struct -{ - uint16_t w, h; - int advX, top, left; - SDL_Texture *tex; -} glyphData; - -//, tex -std::map, glyphData> glyphCache; - -static bool loadSystemFont() -{ - PlFontData shared[6]; - uint64_t langCode = 0; - - if(R_FAILED(plInitialize(PlServiceType_User))) - return false; - - if(FT_Init_FreeType(&lib)) - return false; - - if(R_FAILED(setGetLanguageCode(&langCode))) - return false; - - - if(R_FAILED(plGetSharedFont(langCode, shared, 6, &totalFonts))) - return false; - - for(int i = 0; i < totalFonts; i++) - { - if(FT_New_Memory_Face(lib, (FT_Byte *)shared[i].address, shared[i].size, 0, &face[i])) - return false; - } - - loaded = true; - - return true; -} - -static void freeSystemFont() -{ - if(loaded) - { - for(int i = 0; i < totalFonts; i++) - FT_Done_Face(face[i]); - - FT_Done_FreeType(lib); - } - - plExit(); -} - -void gfx::init() -{ - SDL_Init(SDL_INIT_VIDEO); - IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG); - - SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); - SDL_SetHint(SDL_HINT_RENDER_VSYNC, "1"); - - wind = SDL_CreateWindow("JKSV", 0, 0, 1280, 720, SDL_WINDOW_SHOWN); - render = SDL_CreateRenderer(wind, -1, SDL_RENDERER_ACCELERATED); - - SDL_SetRenderDrawBlendMode(render, SDL_BLENDMODE_BLEND); - - gfx::texMgr = new gfx::textureMgr; - - loadSystemFont(); - - //This is to avoid blank, black glyphs - for(unsigned i = 0x20; i < 0x7E; i++) - gfx::drawTextf(NULL, 18, 32, 32, &ui::txtCont, "%c", i); -} - -void gfx::exit() -{ - delete gfx::texMgr; - SDL_DestroyRenderer(gfx::render); - SDL_DestroyWindow(wind); - IMG_Quit(); - SDL_Quit(); - freeSystemFont(); -} - -void gfx::present() -{ - SDL_RenderPresent(render); -} - -static inline void resizeFont(int sz) -{ - for(int i = 0; i < totalFonts; i++) - FT_Set_Char_Size(face[i], 0, sz * 64, 90, 90); -} - -static inline FT_GlyphSlot loadGlyph(const uint32_t c, FT_Int32 flags) -{ - for(int i = 0; i < totalFonts; i++) - { - FT_UInt cInd = 0; - if( (cInd = FT_Get_Char_Index(face[i], c)) != 0 && FT_Load_Glyph(face[i], cInd, flags) == 0) - return face[i]->glyph; - } - return NULL; -} - -static glyphData *getGlyph(uint32_t chr, int size) -{ - //If it's already been loaded and rendered, grab the texture - if(glyphCache.find(std::make_pair(chr, size)) != glyphCache.end()) - return &glyphCache[std::make_pair(chr, size)]; - - //Load glyph with Freetype - FT_GlyphSlot glyph = loadGlyph(chr, FT_LOAD_RENDER); - FT_Bitmap bmp = glyph->bitmap; - if(bmp.pixel_mode != FT_PIXEL_MODE_GRAY) - return NULL; - - //Convert to SDL_Surface -> Texture - SDL_Texture *tex; - size_t glyphSize = bmp.rows * bmp.width; - uint8_t *bmpPtr = bmp.buffer; - uint32_t basePixel = 0xFFFFFF00; - uint32_t *tmpBuff = (uint32_t *)malloc(sizeof(uint32_t) * glyphSize); - - //Loop through and fill out buffer - for(size_t i = 0; i < glyphSize; i++) - tmpBuff[i] = basePixel | *bmpPtr++; - - SDL_Surface *tmpSurf = SDL_CreateRGBSurfaceFrom(tmpBuff, bmp.width, bmp.rows, 32, 4 * bmp.width, redMask, greenMask, blueMask, alphaMask); - tex = SDL_CreateTextureFromSurface(gfx::render, tmpSurf); - - SDL_FreeSurface(tmpSurf); - free(tmpBuff); - - //Add it to texture manager so textures are freed on exit - gfx::texMgr->textureAdd(tex); - - //Add it to cache map - glyphCache[std::make_pair(chr, size)] = {(uint16_t)bmp.width, (uint16_t)bmp.rows, (int)glyph->advance.x >> 6, glyph->bitmap_top, glyph->bitmap_left, tex}; - - return &glyphCache[std::make_pair(chr, size)]; -} - -//Takes care of special characters/color switching -static inline bool specialChar(const uint32_t *p, const int *fontSize, const SDL_Color *c, const int *baseX, int *modX, int *modY) -{ - //set to false on default - bool ret = true; - - switch(*p) - { - case '\n': - *modX = *baseX; - *modY += *fontSize + 8; - break; - - case '#': - if(compClr(textcol, &blue)) - textcol = c; - else - textcol = &blue; - break; - - case '*': - if(compClr(textcol, &red)) - textcol = c; - else - textcol = &red; - break; - - case '<': - if(compClr(textcol, &yellow)) - textcol = c; - else - textcol = &yellow; - break; - - case '>': - if(compClr(textcol, &green)) - textcol = c; - else - textcol = &green; - break; - - default: - ret = false;//no special char - break; - } - return ret; -} - -void gfx::drawTextf(SDL_Texture *target, int fontSize, int x, int y, const SDL_Color *c, const char *fmt, ...) -{ - SDL_SetRenderTarget(gfx::render, target); - char tmp[VA_SIZE]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - - int tmpX = x; - uint32_t point = 0; - ssize_t unitCnt = 0; - size_t textLength = strlen(tmp); - - resizeFont(fontSize); - - textcol = c; - - for(unsigned i = 0; i < textLength; ) - { - unitCnt = decode_utf8(&point, (const uint8_t *)&tmp[i]); - if(unitCnt <= 0) - break; - - i += unitCnt; - if(specialChar(&point, &fontSize, c, &x, &tmpX, &y)) - continue; - - glyphData *g = getGlyph(point, fontSize); - if(g != NULL) - { - SDL_Rect src = {0, 0, g->w, g->h}; - SDL_Rect dst = {tmpX + g->left, y + (fontSize - g->top), g->w, g->h}; - SDL_SetTextureColorMod(g->tex, textcol->r, textcol->g, textcol->b); - SDL_RenderCopy(render, g->tex, &src, &dst); - - tmpX += g->advX; - } - } - SDL_SetRenderTarget(gfx::render, NULL); -} - -inline bool isBreakChar(uint32_t point) -{ - for(int i = 0; i < 7; i++) - { - if(breakPoints[i] == point) - return true; - } - return false; -} - -inline size_t findNextBreak(const char *str) -{ - size_t length = strlen(str); - for(size_t i = 0; i < length; ) - { - uint32_t nextPoint = 0; - ssize_t unitCnt = decode_utf8(&nextPoint, (const uint8_t *)&str[i]); - i += unitCnt; - if(unitCnt <= 0) - return length; - - if(isBreakChar(nextPoint)) - return i; - } - return length; -} - -void gfx::drawTextfWrap(SDL_Texture *target, int fontSize, int x, int y, int maxWidth, const SDL_Color *c, const char *fmt, ...) -{ - SDL_SetRenderTarget(gfx::render, target); - char tmp[VA_SIZE], wordBuff[128]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - - resizeFont(fontSize); - size_t nextBreak = 0, strlength = strlen(tmp); - int tmpX = x; - - textcol = c; - - for(unsigned i = 0; i < strlength; ) - { - nextBreak = findNextBreak(&tmp[i]); - memset(wordBuff, 0, 128); - memcpy(wordBuff, &tmp[i], nextBreak); - - size_t width = gfx::getTextWidth(wordBuff, fontSize); - - if((int)(tmpX + width) >= (int)(x + maxWidth)) - { - tmpX = x; - y += fontSize + 8; - } - - size_t wordLength = strlen(wordBuff); - uint32_t point = 0; - for(unsigned j = 0; j < wordLength; ) - { - ssize_t unitCnt = decode_utf8(&point, (const uint8_t *)&wordBuff[j]); - if(unitCnt <= 0) - break; - - j += unitCnt; - - if(specialChar(&point, &fontSize, c, &x, &tmpX, &y)) - continue; - - glyphData *g = getGlyph(point, fontSize); - if(g != NULL) - { - SDL_Rect src = {0, 0, g->w, g->h}; - SDL_Rect dst = {tmpX + g->left, y + (fontSize - g->top), g->w, g->h}; - SDL_SetTextureColorMod(g->tex, textcol->r, textcol->g, textcol->b); - SDL_RenderCopy(render, g->tex, &src, &dst); - - tmpX += g->advX; - } - } - i += wordLength; - } - SDL_SetRenderTarget(gfx::render, NULL); -} - -size_t gfx::getTextWidth(const char *str, int fontSize) -{ - resizeFont(fontSize); - size_t width = 0, strlength = strlen(str); - uint32_t unitCnt = 0, point = 0; - - for(unsigned i = 0; i < strlength; ) - { - unitCnt = decode_utf8(&point, (const uint8_t *)&str[i]); - if(unitCnt <= 0) - break; - - i += unitCnt; - - //Ignore these - if(point == '\n' || point == '#' || point == '*' || point == '<' || point == '>') - continue; - - glyphData *g = getGlyph(point, fontSize); - if(g != NULL) - width += g->advX; - } - return width; -} - -void gfx::texDraw(SDL_Texture *target, SDL_Texture *tex, int x, int y) -{ - int tW = 0, tH = 0; - if(SDL_QueryTexture(tex, NULL, NULL, &tW, &tH) == 0) - { - SDL_SetRenderTarget(gfx::render, target); - SDL_Rect src = {0, 0, tW, tH}; - SDL_Rect pos = {x, y, tW, tH}; - SDL_RenderCopy(gfx::render, tex, &src, &pos); - } -} - -void gfx::texDrawStretch(SDL_Texture *target, SDL_Texture *tex, int x, int y, int w, int h) -{ - int tW = 0, tH = 0; - if(SDL_QueryTexture(tex, NULL, NULL, &tW, &tH) == 0) - { - SDL_SetRenderTarget(gfx::render, target); - SDL_Rect src = {0, 0, tW, tH}; - SDL_Rect pos = {x, y, w, h}; - SDL_RenderCopy(gfx::render, tex, &src, &pos); - } -} - -void gfx::texDrawPart(SDL_Texture *target, SDL_Texture *tex, int srcX, int srcY, int srcW, int srcH, int dstX, int dstY) -{ - SDL_Rect src = {srcX, srcY, srcW, srcH}; - SDL_Rect dst = {dstX, dstY, srcW, srcH}; - SDL_SetRenderTarget(gfx::render, target); - SDL_RenderCopy(gfx::render, tex, &src, &dst); -} - -void gfx::drawLine(SDL_Texture *target, const SDL_Color *c, int x1, int y1, int x2, int y2) -{ - SDL_SetRenderTarget(gfx::render, target); - SDL_SetRenderDrawColor(gfx::render, c->r, c->g, c->b, c->a); - SDL_RenderDrawLine(gfx::render, x1, y1, x2, y2); -} - -void gfx::drawRect(SDL_Texture *target, const SDL_Color *c, int x, int y, int w, int h) -{ - SDL_SetRenderTarget(gfx::render, target); - SDL_SetRenderDrawColor(gfx::render, c->r, c->g, c->b, c->a); - SDL_Rect rect = {x, y, w, h}; - SDL_RenderFillRect(gfx::render, &rect); -} - -void gfx::clearTarget(SDL_Texture *target, const SDL_Color *clear) -{ - SDL_SetRenderTarget(gfx::render, target); - SDL_SetRenderDrawColor(gfx::render, clear->r, clear->g, clear->b, clear->a); - SDL_RenderClear(gfx::render); -} diff --git a/src/gfx/textureMgr.cpp b/src/gfx/textureMgr.cpp deleted file mode 100644 index 97e498c..0000000 --- a/src/gfx/textureMgr.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include -#include - -#include "gfx.h" - -gfx::textureMgr::~textureMgr() -{ - for(auto tex : textures) - SDL_DestroyTexture(tex); -} - -void gfx::textureMgr::textureAdd(SDL_Texture *_tex) -{ - textures.push_back(_tex); -} - -SDL_Texture *gfx::textureMgr::textureCreate(int _w, int _h) -{ - SDL_Texture *ret = NULL; - ret = SDL_CreateTexture(gfx::render, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STATIC | SDL_TEXTUREACCESS_TARGET, _w, _h); - if(ret) - { - SDL_SetTextureBlendMode(ret, SDL_BLENDMODE_BLEND); - textures.push_back(ret); - } - return ret; -} - -SDL_Texture *gfx::textureMgr::textureLoadFromFile(const char *_path) -{ - SDL_Texture *ret = NULL; - SDL_Surface *tmp = IMG_Load(_path); - if(tmp) - { - ret = SDL_CreateTextureFromSurface(gfx::render, tmp); - textures.push_back(ret); - SDL_FreeSurface(tmp); - SDL_SetTextureBlendMode(ret, SDL_BLENDMODE_BLEND); - } - return ret; -} - -static SDL_Texture *loadPNGMem(const void *_dat, size_t _datSize) -{ - SDL_Texture *ret = NULL; - SDL_RWops *pngData = SDL_RWFromConstMem(_dat, _datSize); - SDL_Surface *tmp = IMG_LoadPNG_RW(pngData); - if(tmp) - { - ret = SDL_CreateTextureFromSurface(gfx::render, tmp); - SDL_FreeSurface(tmp); - SDL_SetTextureBlendMode(ret, SDL_BLENDMODE_BLEND); - } - SDL_RWclose(pngData); - return ret; -} - -static SDL_Texture *loadJPEGMem(const void *_dat, size_t _datSize) -{ - SDL_Texture *ret = NULL; - SDL_RWops *jpegData = SDL_RWFromConstMem(_dat, _datSize); - SDL_Surface *tmp = IMG_LoadJPG_RW(jpegData); - if(tmp) - { - ret = SDL_CreateTextureFromSurface(gfx::render, tmp); - SDL_FreeSurface(tmp); - SDL_SetTextureBlendMode(ret, SDL_BLENDMODE_BLEND); - } - SDL_RWclose(jpegData); - return ret; -} - -static SDL_Texture *loadBMPMem(const void *_dat, size_t _datSize) -{ - SDL_Texture *ret = NULL; - SDL_RWops *bmpData = SDL_RWFromConstMem(_dat, _datSize); - SDL_Surface *tmp = IMG_LoadBMP_RW(bmpData); - if(tmp) - { - ret = SDL_CreateTextureFromSurface(gfx::render, tmp); - SDL_FreeSurface(tmp); - SDL_SetTextureBlendMode(ret, SDL_BLENDMODE_BLEND); - } - SDL_RWclose(bmpData); - return ret; -} - -SDL_Texture *gfx::textureMgr::textureLoadFromMem(imgTypes _type, const void *_dat, size_t _datSize) -{ - SDL_Texture *ret = NULL; - switch (_type) - { - case IMG_FMT_PNG: - ret = loadPNGMem(_dat, _datSize); - break; - - case IMG_FMT_JPG: - ret = loadJPEGMem(_dat, _datSize); - break; - - case IMG_FMT_BMP: - ret = loadBMPMem(_dat, _datSize); - break; - } - - if(ret) - textures.push_back(ret); - - return ret; -} - -void gfx::textureMgr::textureResize(SDL_Texture **_tex, int _w, int _h) -{ - auto texIt = std::find(textures.begin(), textures.end(), *_tex); - if(texIt != textures.end()) - { - SDL_DestroyTexture(*texIt); - *_tex = SDL_CreateTexture(gfx::render, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STATIC | SDL_TEXTUREACCESS_TARGET, _w, _h); - SDL_SetTextureBlendMode(*_tex, SDL_BLENDMODE_BLEND); - *texIt = *_tex; - } -} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index b64f252..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include - -#include "gfx.h" -#include "file.h" -#include "data.h" -#include "ui.h" -#include "util.h" -#include "cfg.h" - -extern "C" -{ - void userAppInit(void) - { - appletInitialize(); - hidInitialize(); - nsInitialize(); - setsysInitialize(); - setInitialize(); - accountInitialize(AccountServiceType_Administrator); - pmshellInitialize(); - socketInitializeDefault(); - pdmqryInitialize(); - } - - void userAppExit(void) - { - appletExit(); - hidExit(); - nsExit(); - setsysExit(); - setExit(); - accountExit(); - pmshellExit(); - socketExit(); - pdmqryExit(); - } -} - -int main(int argc, const char *argv[]) -{ - romfsInit(); - cfg::resetConfig(); - cfg::loadConfig(); - fs::init(); - gfx::init(); - ui::initTheme(); - ui::showLoadScreen(); - data::init(); - ui::init(); - romfsExit(); - - curl_global_init(CURL_GLOBAL_ALL); - //Drive needs config read - if(!util::isApplet()) - fs::remoteInit(); - else - ui::showMessage(ui::getUICString("appletModeWarning", 0)); - - while(ui::runApp()){ } - - fs::remoteExit(); - curl_global_cleanup(); - ui::exit(); - data::exit(); - gfx::exit(); -} diff --git a/src/rfs.cpp b/src/rfs.cpp deleted file mode 100644 index 6c6c1e5..0000000 --- a/src/rfs.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "rfs.h" - -std::vector rfs::downloadBuffer; - -void rfs::writeThread_t(void *a) -{ - rfs::dlWriteThreadStruct *in = (rfs::dlWriteThreadStruct *)a; - std::vector localBuff; - unsigned written = 0; - - FILE *out = fopen(in->cfa->path.c_str(), "wb"); - - while(written < in->cfa->size) - { - std::unique_lock dataLock(in->dataLock); - in->cond.wait(dataLock, [in]{ return in->bufferFull; }); - localBuff.clear(); - localBuff.assign(in->sharedBuffer.begin(), in->sharedBuffer.end()); - in->sharedBuffer.clear(); - in->bufferFull = false; - dataLock.unlock(); - in->cond.notify_one(); - - written += fwrite(localBuff.data(), 1, localBuff.size(), out); - } - fclose(out); - rfs::downloadBuffer.clear(); -} - -size_t rfs::writeDataBufferThreaded(uint8_t *buff, size_t sz, size_t cnt, void *u) -{ - rfs::dlWriteThreadStruct *in = (rfs::dlWriteThreadStruct *)u; - rfs::downloadBuffer.insert(rfs::downloadBuffer.end(), buff, buff + (sz * cnt)); - in->downloaded += sz * cnt; - - if(in->downloaded == in->cfa->size || rfs::downloadBuffer.size() == DOWNLOAD_BUFFER_SIZE) - { - std::unique_lock dataLock(in->dataLock); - in->cond.wait(dataLock, [in]{ return in->bufferFull == false; }); - in->sharedBuffer.assign(rfs::downloadBuffer.begin(), rfs::downloadBuffer.end()); - rfs::downloadBuffer.clear(); - in->bufferFull = true; - dataLock.unlock(); - in->cond.notify_one(); - } - - if(in->cfa->o) - *in->cfa->o = in->downloaded; - - return sz * cnt; -} diff --git a/src/type.cpp b/src/type.cpp deleted file mode 100644 index 15325e6..0000000 --- a/src/type.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include - -#include "type.h" - -void threadStatus::setStatus(const char *fmt, ...) -{ - char tmp[1024]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - - mutexLock(&statusLock); - status = tmp; - mutexUnlock(&statusLock); -} - -void threadStatus::getStatus(std::string& statusOut) -{ - mutexLock(&statusLock); - statusOut = status; - mutexUnlock(&statusLock); -} diff --git a/src/ui.cpp b/src/ui.cpp deleted file mode 100644 index 4a34d79..0000000 --- a/src/ui.cpp +++ /dev/null @@ -1,308 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "file.h" -#include "ui.h" -#include "gfx.h" -#include "util.h" - -//Current menu state -int ui::mstate = USR_SEL, ui::prevState = USR_SEL; - -float ui::animScale = 3.0f; - -//pad data? -PadState ui::pad; -HidTouchScreenState ui::touchState; - -//Theme id -ColorSetId ui::thmID; - -//Info printed on folder menu -std::string ui::folderMenuInfo; - -//UI colors -SDL_Color ui::clearClr, ui::txtCont, ui::txtDiag, ui::rectLt, ui::rectSh, ui::tboxClr, ui::divClr, ui::slidePanelColor; -SDL_Color ui::transparent = {0x00, 0x00, 0x00, 0x00}; - -//textbox pieces -//I was going to flip them when I draw them, but then laziness kicked in. -SDL_Texture *ui::cornerTopLeft, *ui::cornerTopRight, *ui::cornerBottomLeft, *ui::cornerBottomRight; - -//Progress bar covers + dialog box predrawn -SDL_Texture *ui::progCovLeft, *ui::progCovRight, *ui::diaBox; - -//Menu box pieces -SDL_Texture *ui::mnuTopLeft, *ui::mnuTopRight, *ui::mnuBotLeft, *ui::mnuBotRight; - -//Select box + top left icon -SDL_Texture *ui::sideBar; - -static SDL_Texture *icn, *corePanel; -SDL_Color ui::heartColor = {0xFF, 0x44, 0x44, 0xFF}; - -static int settPos, extPos; - -//Vector of pointers to slideOutPanels. Is looped and drawn last so they are always on top -std::vector panels; - -static ui::popMessageMngr *popMessages; -static ui::threadProcMngr *threadMngr; - -//8 -const std::string ui::loadGlyphArray[] = -{ - "\ue020", "\ue021", "\ue022", "\ue023", - "\ue024", "\ue025", "\ue026", "\ue027" -}; - -void ui::initTheme() -{ - uint64_t lang; - setGetSystemLanguage(&lang); - setMakeLanguage(lang, &data::sysLang); - - loadTrans(); - - setsysGetColorSetId(&thmID); - - switch(thmID) - { - case ColorSetId_Light: - clearClr = {0xEB, 0xEB, 0xEB, 0xFF}; - txtCont = {0x00, 0x00, 0x00, 0xFF}; - txtDiag = {0xFF, 0xFF, 0xFF, 0xFF}; - rectLt = {0xDF, 0xDF, 0xDF, 0xFF}; - rectSh = {0xCA, 0xCA, 0xCA, 0xFF}; - tboxClr = {0xEB, 0xEB, 0xEB, 0xFF}; - divClr = {0x00, 0x00, 0x00, 0xFF}; - slidePanelColor = {0xEE, 0xEE, 0xEE, 0xEE}; - break; - - default: - case ColorSetId_Dark: - //jic - thmID = ColorSetId_Dark; - clearClr = {0x2D, 0x2D, 0x2D, 0xFF}; - txtCont = {0xFF, 0xFF, 0xFF, 0xFF}; - txtDiag = {0x00, 0x00, 0x00, 0xFF}; - rectLt = {0x50, 0x50, 0x50, 0xFF}; - rectSh = {0x20, 0x20, 0x20, 0xFF}; - tboxClr = {0x50, 0x50, 0x50, 0xFF}; - divClr = {0xFF, 0xFF, 0xFF, 0xFF}; - slidePanelColor = {0x00, 0x00, 0x00, 0xEE}; - break; - } -} - -void ui::init() -{ - mnuTopLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/fb/menuTopLeft.png"); - mnuTopRight = gfx::texMgr->textureLoadFromFile("romfs:/img/fb/menuTopRight.png"); - mnuBotLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/fb/menuBotLeft.png"); - mnuBotRight = gfx::texMgr->textureLoadFromFile("romfs:/img/fb/menuBotRight.png"); - - corePanel = SDL_CreateTexture(gfx::render, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET | SDL_TEXTUREACCESS_STATIC, 1220, 559); - SDL_SetTextureBlendMode(corePanel, SDL_BLENDMODE_BLEND); - - switch(ui::thmID) - { - case ColorSetId_Light: - //Dark corners - cornerTopLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxLght/tboxCornerTopLeft.png"); - cornerTopRight = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxLght/tboxCornerTopRight.png"); - cornerBottomLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxLght/tboxCornerBotLeft.png"); - cornerBottomRight = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxLght/tboxCornerBotRight.png"); - progCovLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxDrk/progBarCoverLeftDrk.png"); - progCovRight = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxDrk/progBarCoverRightDrk.png"); - icn = gfx::texMgr->textureLoadFromFile("romfs:/img/icn/icnDrk.png"); - sideBar = gfx::texMgr->textureLoadFromFile("romfs:/img/fb/lLight.png"); - break; - - default: - //Light corners - cornerTopLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxDrk/tboxCornerTopLeft.png"); - cornerTopRight = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxDrk/tboxCornerTopRight.png"); - cornerBottomLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxDrk/tboxCornerBotLeft.png"); - cornerBottomRight = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxDrk/tboxCornerBotRight.png"); - progCovLeft = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxLght/progBarCoverLeftLight.png"); - progCovRight = gfx::texMgr->textureLoadFromFile("romfs:/img/tboxLght/progBarCoverRightLight.png"); - icn = gfx::texMgr->textureLoadFromFile("romfs:/img/icn/icnLght.png"); - sideBar = gfx::texMgr->textureLoadFromFile("romfs:/img/fb/lDark.png"); - break; - } - - padConfigureInput(1, HidNpadStyleSet_NpadStandard); - padInitializeDefault(&ui::pad); - - ui::usrInit(); - ui::ttlInit(); - ui::settInit(); - ui::extInit(); - ui::fmInit(); - ui::fldInit(); - - popMessages = new ui::popMessageMngr; - threadMngr = new ui::threadProcMngr; - - //Need these from user/main menu - settPos = ui::usrMenu->getOptPos(ui::getUICString("mainMenuSettings", 0)); - extPos = ui::usrMenu->getOptPos(ui::getUICString("mainMenuExtras", 0)); -} - -void ui::exit() -{ - ui::usrExit(); - ui::ttlExit(); - ui::settExit(); - ui::extExit(); - ui::fmExit(); - ui::fldExit(); - - delete popMessages; - delete threadMngr; -} - -int ui::registerPanel(slideOutPanel *sop) -{ - panels.push_back(sop); - return panels.size() - 1; -} - -threadInfo *ui::newThread(ThreadFunc func, void *args, funcPtr _drawFunc) -{ - return threadMngr->newThread(func, args, _drawFunc); -} - -void ui::showLoadScreen() -{ - SDL_Texture *icon = gfx::texMgr->textureLoadFromFile("romfs:/icon.png"); - gfx::clearTarget(NULL, &ui::clearClr); - gfx::texDraw(NULL, icon, 512, 232); - gfx::drawTextf(NULL, 16, 1100, 673, &ui::txtCont, ui::getUICString("loadingStartPage", 0)); - gfx::present(); -} - -void ui::drawUI() -{ - gfx::clearTarget(NULL, &ui::clearClr); - gfx::clearTarget(corePanel, &transparent); - - gfx::drawLine(NULL, &divClr, 30, 88, 1250, 88); - gfx::drawLine(NULL, &divClr, 30, 648, 1250, 648); - gfx::texDraw(NULL, icn, 66, 27); - - if(util::isApplet()) - gfx::drawTextf(NULL, 24, 130, 38, &ui::txtCont, "JKSV *APPLET MODE*"); - else - gfx::drawTextf(NULL, 24, 130, 38, &ui::txtCont, "JKSV"); - - //Version / translation author - gfx::drawTextf(NULL, 12, 8, 700, &ui::txtCont, "v. %02d.%02d.%04d", BLD_MON, BLD_DAY, BLD_YEAR); - if(ui::getUIString("author", 0) != "NULL") - gfx::drawTextf(NULL, 12, 8, 682, &ui::txtCont, "%s%s", ui::getUICString("translationMainPage", 0), ui::getUICString("author", 0)); - - //This only draws the help text now and only does when user select is open - ui::usrDraw(NULL); - - if((ui::usrMenu->getActive() && ui::usrMenu->getSelected() == settPos) || ui::mstate == OPT_MNU) - ui::settDraw(corePanel); - else if((ui::usrMenu->getActive() && ui::usrMenu->getSelected() == extPos) || ui::mstate == EX_MNU) - ui::extDraw(corePanel); - else if(ui::mstate == FIL_MDE) - ui::fmDraw(corePanel); - else - ui::ttlDraw(corePanel); - - gfx::texDraw(NULL, corePanel, 30, 89); - for(slideOutPanel *s : panels) - s->draw(&ui::slidePanelColor); - - threadMngr->draw(); - - popMessages->draw(); -} - -static bool debugDisp = false; - -bool ui::runApp() -{ - ui::updateInput(); - uint64_t down = ui::padKeysDown(); - - if(threadMngr->empty()) - { - if(down & HidNpadButton_StickL && down & HidNpadButton_StickR) - debugDisp = true; - else if(down & HidNpadButton_Plus) - return false; - - switch(ui::mstate) - { - case USR_SEL: - ui::usrUpdate(); - break; - - case TTL_SEL: - ui::ttlUpdate(); - break; - - case OPT_MNU: - ui::settUpdate(); - break; - - case EX_MNU: - ui::extUpdate(); - break; - - case FIL_MDE: - ui::fmUpdate(); - break; - } - } - else - threadMngr->update(); - - popMessages->update(); - - drawUI(); - if(debugDisp) - data::dispStats(); - - gfx::present(); - - return true; -} - -void ui::showPopMessage(int frameCount, const char *fmt, ...) -{ - char tmp[256]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - - popMessages->popMessageAdd(tmp, frameCount); -} - -void ui::toTTL(void *a) -{ - data::user *u = data::getCurrentUser(); - unsigned curUserIndex = data::getCurrentUserIndex(); - if(u->titleInfo.size() > 0) - { - ui::changeState(TTL_SEL); - ui::ttlSetActive(curUserIndex, true, true); - ui::usrMenu->setActive(false); - } - else - { - data::user *u = data::getCurrentUser(); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataNoneFound", 0), u->getUsername().c_str()); - } -} diff --git a/src/ui/ext.cpp b/src/ui/ext.cpp deleted file mode 100644 index 3e9a28c..0000000 --- a/src/ui/ext.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include -#include - -#include "ui.h" -#include "file.h" -#include "util.h" -#include "cfg.h" - -ui::menu *ui::extMenu; - -static void extMenuCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - ui::extMenu->setActive(false); - ui::usrMenu->setActive(true); - ui::changeState(USR_SEL); - break; - } -} - -static inline void closeUserPanel() -{ - ui::usrMenu->setActive(false); - ui::usrSelPanel->closePanel(); -} - -static void toFMSDtoSD(void *a) -{ - ui::fmPrep(FsSaveDataType_Account, "sdmc:/", "sdmc:/", false); - closeUserPanel(); - ui::changeState(FIL_MDE); -} - -static void toFMProdInfoF(void *a) -{ - FsFileSystem prodf; - fsOpenBisFileSystem(&prodf, FsBisPartitionId_CalibrationFile, ""); - fsdevMountDevice("prod-f", prodf); - closeUserPanel(); - ui::fmPrep(FsSaveDataType_System, "prod-f:/", "sdmc:/", false); - ui::changeState(FIL_MDE); -} - -static void toFMSafe(void *a) -{ - FsFileSystem safe; - fsOpenBisFileSystem(&safe, FsBisPartitionId_SafeMode, ""); - fsdevMountDevice("safe", safe); - closeUserPanel(); - ui::fmPrep(FsSaveDataType_System, "safe:/", "sdmc:/", false); - ui::changeState(FIL_MDE); -} - -static void toFMSystem(void *a) -{ - FsFileSystem sys; - fsOpenBisFileSystem(&sys, FsBisPartitionId_System, ""); - fsdevMountDevice("sys", sys); - closeUserPanel(); - ui::fmPrep(FsSaveDataType_System, "sys:/", "sdmc:/", false); - ui::changeState(FIL_MDE); -} - -static void toFMUser(void *a) -{ - FsFileSystem user; - fsOpenBisFileSystem(&user, FsBisPartitionId_User, ""); - fsdevMountDevice("user", user); - closeUserPanel(); - ui::fmPrep(FsSaveDataType_System, "user:/", "sdmc:/", false); - ui::changeState(FIL_MDE); -} - -static void _delUpdate(void *a) -{ - threadInfo *t = (threadInfo *)a; - t->status->setStatus(ui::getUICString("threadStatusDeletingUpdate", 0)); - FsFileSystem sys; - fsOpenBisFileSystem(&sys, FsBisPartitionId_System, ""); - fsdevMountDevice("sys", sys); - fs::delDir("sys:/Contents/placehld/"); - fsdevUnmountDevice("sys"); - t->finished = true; -} - -static void extMenuOptRemoveUpdate(void *a) -{ - ui::newThread(_delUpdate, NULL, NULL); -} - -static void extMenuTerminateProcess(void *a) -{ - std::string idStr = util::getStringInput(SwkbdType_QWERTY, "0100000000000000", ui::getUIString("swkbdProcessID", 0), 18, 0, NULL); - if(!idStr.empty()) - { - uint64_t termID = std::strtoull(idStr.c_str(), NULL, 16); - if(R_SUCCEEDED(pmshellTerminateProgram(termID))) - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popProcessShutdown", 0), idStr.c_str()); - } -} - -static void extMenuMountSysSave(void *a) -{ - FsFileSystem sys; - std::string idStr = util::getStringInput(SwkbdType_QWERTY, "8000000000000000", ui::getUIString("swkbdSysSavID", 0), 18, 0, NULL); - uint64_t mountID = std::strtoull(idStr.c_str(), NULL, 16); - if(R_SUCCEEDED(fsOpen_SystemSaveData(&sys, FsSaveDataSpaceId_System, mountID, (AccountUid) {0}))) - { - fsdevMountDevice("sv", sys); - ui::fmPrep(FsSaveDataType_System, "sv:/", "sdmc:/", true); - ui::usrSelPanel->closePanel(); - ui::changeState(FIL_MDE); - } -} - -//Todo: Not so simple now. -static void extMenuReloadTitles(void *a) -{ - data::loadUsersTitles(false); - ui::usrRefresh(); - ui::ttlRefresh(); -} - -static void extMenuMountRomFS(void *a) -{ - FsFileSystem tromfs; - if(R_SUCCEEDED(fsOpenDataFileSystemByCurrentProcess(&tromfs))) - { - fsdevMountDevice("tromfs", tromfs); - ui::fmPrep(FsSaveDataType_System, "tromfs:/", "sdmc:/", false); - ui::usrSelPanel->closePanel(); - ui::changeState(FIL_MDE); - } -} - -static void extMenuPackJKSVZip_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::copyArgs *c = (fs::copyArgs *)t->argPtr; - t->status->setStatus(ui::getUICString("threadStatusPackingJKSV", 0)); - if(cfg::config["ovrClk"]) - { - util::sysBoost(); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popCPUBoostEnabled", 0)); - } - - fs::dirList *jksv = new fs::dirList(fs::getWorkDir()); - uint8_t pathTrimPlaces = util::getTotalPlacesInPath(fs::getWorkDir()); - size_t dirCount = jksv->getCount(); - if(dirCount > 0) - { - std::string zipPath = fs::getWorkDir() + "JKSV - " + util::getDateTime(util::DATE_FMT_ASC) + ".zip"; - zipFile zip = zipOpen64(zipPath.c_str(), 0); - for(unsigned i = 0; i < jksv->getCount(); i++) - { - if(jksv->isDir(i) && jksv->getItem(i) != "_TRASH_") - { - std::string srcPath = fs::getWorkDir() + jksv->getItem(i) + "/"; - fs::copyDirToZip(srcPath, zip, true, pathTrimPlaces, t); - } - } - zipClose(zip, NULL); - } - if(cfg::config["ovrClk"]) - util::sysNormal(); - - delete jksv; - delete c; - t->finished = true; -} - -static void extMenuPackJKSV(void *a) -{ - //Only for progress bar - fs::copyArgs *send = fs::copyArgsCreate("", "", "", NULL, NULL, true, false, 0); - ui::newThread(extMenuPackJKSVZip_t, send, fs::fileDrawFunc); -} - -static void extMenuOutputEnUs(void *a) -{ - ui::newThread(ui::saveTranslationFiles, NULL, NULL); -} - -void ui::extInit() -{ - ui::extMenu = new ui::menu(200, 24, 1002, 24, 4); - ui::extMenu->setCallback(extMenuCallback, NULL); - ui::extMenu->setActive(false); - for(unsigned i = 0; i < 12; i++) - ui::extMenu->addOpt(NULL, ui::getUIString("extrasMenu", i)); - - //SD to SD - ui::extMenu->optAddButtonEvent(0, HidNpadButton_A, toFMSDtoSD, NULL); - //Prodinfo-F - ui::extMenu->optAddButtonEvent(1, HidNpadButton_A, toFMProdInfoF, NULL); - //Safe - ui::extMenu->optAddButtonEvent(2, HidNpadButton_A, toFMSafe, NULL); - //System - ui::extMenu->optAddButtonEvent(3, HidNpadButton_A, toFMSystem, NULL); - //User - ui::extMenu->optAddButtonEvent(4, HidNpadButton_A, toFMUser, NULL); - //Del update - ui::extMenu->optAddButtonEvent(5, HidNpadButton_A, extMenuOptRemoveUpdate, NULL); - //Terminate Process - ui::extMenu->optAddButtonEvent(6, HidNpadButton_A, extMenuTerminateProcess, NULL); - //Mount system save - ui::extMenu->optAddButtonEvent(7, HidNpadButton_A, extMenuMountSysSave, NULL); - //Rescan - ui::extMenu->optAddButtonEvent(8, HidNpadButton_A, extMenuReloadTitles, NULL); - //RomFS - ui::extMenu->optAddButtonEvent(9, HidNpadButton_A, extMenuMountRomFS, NULL); - //Backup JKSV - ui::extMenu->optAddButtonEvent(10, HidNpadButton_A, extMenuPackJKSV, NULL); - //Translation so I can be lazy - ui::extMenu->optAddButtonEvent(11, HidNpadButton_A, extMenuOutputEnUs, NULL); -} - -void ui::extExit() -{ - delete ui::extMenu; -} - -void ui::extUpdate() -{ - ui::extMenu->update(); -} - -void ui::extDraw(SDL_Texture *target) -{ - ui::extMenu->draw(target, &ui::txtCont, true); -} diff --git a/src/ui/fld.cpp b/src/ui/fld.cpp deleted file mode 100644 index efc111e..0000000 --- a/src/ui/fld.cpp +++ /dev/null @@ -1,391 +0,0 @@ -#include - -#include "ui.h" -#include "fs.h" -#include "util.h" -#include "cfg.h" - -static ui::menu *fldMenu = NULL; -ui::slideOutPanel *ui::fldPanel = NULL; -static fs::dirList *fldList = NULL; -static SDL_Texture *fldBuffer; -static unsigned int fldGuideWidth = 0; -static Mutex fldLock = 0; -static std::string driveParent; -static std::vector driveFldList; - -static void fldMenuCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - fs::unmountSave(); - fs::freePathFilters(); - fldMenu->setActive(false); - ui::fldPanel->closePanel(); - unsigned cusr = data::getCurrentUserIndex(); - ui::ttlSetActive(cusr, true, true); - ui::updateInput(); - break; - } -} - -static void fldPanelDraw(void *a) -{ - mutexLock(&fldLock); - SDL_Texture *target = (SDL_Texture *)a; - gfx::clearTarget(fldBuffer, &ui::slidePanelColor); - fldMenu->draw(fldBuffer, &ui::txtCont, true); - gfx::texDraw(target, fldBuffer, 0, 0); - gfx::drawLine(target, &ui::divClr, 10, 648, fldGuideWidth + 54, 648); - gfx::drawTextf(target, 18, 32, 673, &ui::txtCont, ui::getUICString("helpFolder", 0)); - mutexUnlock(&fldLock); -} - -static void fldFuncCancel(void *a) -{ - std::string *del = (std::string *)a; - delete del; -} - -static void fldFuncOverwrite(void *a) -{ - fs::dirItem *in = (fs::dirItem *)a; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string *send = new std::string; - send->assign(util::generatePathByTID(utinfo->tid) + in->getItm()); - - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdOver"], fs::overwriteBackup, fldFuncCancel, send, ui::getUICString("confirmOverwrite", 0), in->getItm().c_str()); - ui::confirm(conf); -} - -static void fldFuncDelete(void *a) -{ - fs::dirItem *in = (fs::dirItem *)a; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string *send = new std::string; - send->assign(util::generatePathByTID(utinfo->tid) + in->getItm()); - - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdDel"], fs::deleteBackup, fldFuncCancel, send, ui::getUICString("confirmDelete", 0), in->getItm().c_str()); - ui::confirm(conf); -} - -static void fldFuncRestore(void *a) -{ - fs::dirItem *in = (fs::dirItem *)a; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string *send = new std::string; - send->assign(util::generatePathByTID(utinfo->tid) + in->getItm()); - - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdRest"], fs::restoreBackup, fldFuncCancel, send, ui::getUICString("confirmRestore", 0), in->getItm().c_str()); - ui::confirm(conf); -} - -static void fldFuncUpload_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - fs::dirItem *di = (fs::dirItem *)t->argPtr; - fsSetPriority(FsPriority_Realtime); - - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string path, tmpZip, filename;//Final path to upload from - - if(cfg::config["ovrClk"]) - util::sysBoost(); - - //Zip first then upload if folder based backup - if(di->isDir()) - { - t->status->setStatus(ui::getUICString("threadStatusCompressingSaveForUpload", 0), di->getItm().c_str()); - filename = di->getItm() + ".zip"; - tmpZip = util::generatePathByTID(utinfo->tid) + di->getItm() + ".zip"; - std::string fldPath = util::generatePathByTID(utinfo->tid) + di->getItm() + "/"; - - int zipTrim = util::getTotalPlacesInPath(fs::getWorkDir()) + 2;//Trim path down to save root - zipFile tmp = zipOpen64(tmpZip.c_str(), 0); - fs::copyDirToZip(fldPath, tmp, true, zipTrim, NULL); - zipClose(tmp, NULL); - path = tmpZip; - } - else - { - filename = di->getItm(); - path = util::generatePathByTID(utinfo->tid) + di->getItm(); - } - - //Change thread stuff so upload status can be shown - t->status->setStatus(ui::getUICString("threadStatusUploadingFile", 0), di->getItm().c_str()); - fs::copyArgs *cpyArgs = fs::copyArgsCreate("", "", "", NULL, NULL, false, false, 0); - cpyArgs->prog->setMax(fs::fsize(path)); - cpyArgs->prog->update(0); - t->argPtr = cpyArgs; - t->drawFunc = fs::fileDrawFunc; - - //curlDlArgs - curlFuncs::curlUpArgs upload; - upload.f = fopen(path.c_str(), "rb"); - upload.o = &cpyArgs->offset; - - if(fs::rfs->fileExists(filename, driveParent)) - { - std::string id = fs::rfs->getFileID(filename, driveParent); - fs::rfs->updateFile(id, &upload); - } - else - fs::rfs->uploadFile(filename, driveParent, &upload); - - fclose(upload.f); - - if(!tmpZip.empty()) - fs::delfile(tmpZip); - - fs::copyArgsDestroy(cpyArgs); - t->drawFunc = NULL; - - if(cfg::config["ovrClk"]) - util::sysNormal(); - - ui::fldRefreshMenu(); - - t->finished = true; -} - -static void fldFuncUpload(void *a) -{ - if(fs::rfs) - ui::newThread(fldFuncUpload_t, a, NULL); - else - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popRemoteNotActive", 0)); -} - -static void fldFuncDownload_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - rfs::RfsItem *in = (rfs::RfsItem *)t->argPtr; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string targetPath = util::generatePathByTID(utinfo->tid) + in->name; - t->status->setStatus(ui::getUICString("threadStatusDownloadingFile", 0), in->name.c_str()); - - if(cfg::config["ovrClk"]) - util::sysBoost(); - - if(fs::fileExists(targetPath)) - fs::delfile(targetPath); - - //Use this for progress bar - fs::copyArgs *cpy = fs::copyArgsCreate("", "", "", NULL, NULL, false, false, 0); - cpy->prog->setMax(in->size); - cpy->prog->update(0); - t->argPtr = cpy; - t->drawFunc = fs::fileDrawFunc; - - //DL struct - curlFuncs::curlDlArgs dlFile; - dlFile.path = targetPath; - dlFile.size = in->size; - dlFile.o = &cpy->offset; - - fs::rfs->downloadFile(in->id, &dlFile); - - //fclose(dlFile.f); - - fs::copyArgsDestroy(cpy); - t->drawFunc = NULL; - - if(cfg::config["ovrClk"]) - util::sysNormal(); - - ui::fldRefreshMenu(); - - t->finished = true; -} - -static void fldFuncDownload(void *a) -{ - rfs::RfsItem *in = (rfs::RfsItem *)a; - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string testPath = util::generatePathByTID(utinfo->tid) + in->name; - if(fs::fileExists(testPath)) - { - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdOver"], fldFuncDownload_t, NULL, a, ui::getUICString("confirmDriveOverwrite", 0)); - ui::confirm(conf); - } - else - ui::newThread(fldFuncDownload_t, a, NULL); - -} - -static void fldFuncDriveDelete_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - rfs::RfsItem *gdi = (rfs::RfsItem *)t->argPtr; - t->status->setStatus(ui::getUICString("threadStatusDeletingFile", 0)); - fs::rfs->deleteFile(gdi->id); - ui::fldRefreshMenu(); - t->finished = true; -} - -static void fldFuncDriveDelete(void *a) -{ - rfs::RfsItem *in = (rfs::RfsItem *)a; - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdDel"], fldFuncDriveDelete_t, NULL, a, ui::getUICString("confirmDelete", 0), in->name.c_str()); - ui::confirm(conf); -} - -static void fldFuncDriveRestore_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - rfs::RfsItem *gdi = (rfs::RfsItem *)t->argPtr; - t->status->setStatus(ui::getUICString("threadStatusDownloadingFile", 0), gdi->name.c_str()); - - fs::copyArgs *cpy = fs::copyArgsCreate("", "", "", NULL, NULL, false, false, 0); - cpy->prog->setMax(gdi->size); - cpy->prog->update(0); - t->argPtr = cpy; - t->drawFunc = fs::fileDrawFunc; - - curlFuncs::curlDlArgs dlFile; - dlFile.path = "sdmc:/tmp.zip"; - dlFile.size = gdi->size; - dlFile.o = &cpy->offset; - - fs::rfs->downloadFile(gdi->id, &dlFile); - - unzFile tmp = unzOpen64("sdmc:/tmp.zip"); - fs::copyZipToDir(tmp, "sv:/", "sv", t); - unzClose(tmp); - fs::delfile("sdmc:/tmp.zip"); - - fs::copyArgsDestroy(cpy); - t->argPtr = NULL; - t->drawFunc = NULL; - - t->finished = true; -} - -static void fldFuncDriveRestore(void *a) -{ - rfs::RfsItem *in = (rfs::RfsItem *)a; - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdOver"], fldFuncDriveRestore_t, NULL, a, ui::getUICString("confirmRestore", 0), in->name.c_str()); - ui::confirm(conf); -} - -void ui::fldInit() -{ - fldGuideWidth = gfx::getTextWidth(ui::getUICString("helpFolder", 0), 18); - - fldMenu = new ui::menu(10, 4, fldGuideWidth + 44, 18, 6); - fldMenu->setCallback(fldMenuCallback, NULL); - fldMenu->setActive(false); - - ui::fldPanel = new ui::slideOutPanel(fldGuideWidth + 64, 720, 0, ui::SLD_RIGHT, fldPanelDraw); - fldBuffer = SDL_CreateTexture(gfx::render, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STATIC | SDL_TEXTUREACCESS_TARGET, fldGuideWidth + 64, 647); - ui::registerPanel(fldPanel); - - fldList = new fs::dirList; -} - -void ui::fldExit() -{ - delete ui::fldPanel; - delete fldMenu; - delete fldList; -} - -void ui::fldUpdate() -{ - fldMenu->update(); -} - -void ui::fldPopulateMenu() -{ - mutexLock(&fldLock); - - fldMenu->reset(); - - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - data::titleInfo *t = data::getTitleInfoByTID(d->tid); - util::createTitleDirectoryByTID(d->tid); - std::string targetDir = util::generatePathByTID(d->tid); - - fldList->reassign(targetDir); - fs::loadPathFilters(d->tid); - - fldMenu->addOpt(NULL, ui::getUICString("folderMenuNew", 0)); - fldMenu->optAddButtonEvent(0, HidNpadButton_A, fs::createNewBackup, NULL); - - unsigned fldInd = 1; - if(fs::rfs) - { - if(!fs::rfs->dirExists(t->safeTitle, fs::rfsRootID)) - fs::rfs->createDir(t->safeTitle, fs::rfsRootID); - - driveParent = fs::rfs->getDirID(t->safeTitle, fs::rfsRootID); - driveFldList = fs::rfs->getListWithParent(driveParent); - - for(unsigned i = 0; i < driveFldList.size(); i++, fldInd++) - { - fldMenu->addOpt(NULL, "[R] " + driveFldList[i].name); - - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_A, fldFuncDownload, &driveFldList[i]); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_X, fldFuncDriveDelete, &driveFldList[i]); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_Y, fldFuncDriveRestore, &driveFldList[i]); - } - } - - for(unsigned i = 0; i < fldList->getCount(); i++, fldInd++) - { - fs::dirItem *di = fldList->getDirItemAt(i); - fldMenu->addOpt(NULL, di->getItm()); - - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_A, fldFuncOverwrite, di); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_X, fldFuncDelete, di); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_Y, fldFuncRestore, di); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_ZR, fldFuncUpload, di); - } - fldMenu->setActive(true); - ui::fldPanel->openPanel(); - - mutexUnlock(&fldLock); -} - -void ui::fldRefreshMenu() -{ - mutexLock(&fldLock); - - fldMenu->reset(); - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string targetDir = util::generatePathByTID(utinfo->tid); - - fldList->reassign(targetDir); - fldMenu->addOpt(NULL, ui::getUIString("folderMenuNew", 0)); - fldMenu->optAddButtonEvent(0, HidNpadButton_A, fs::createNewBackup, NULL); - - unsigned fldInd = 1; - if(fs::rfs) - { - driveFldList = fs::rfs->getListWithParent(driveParent); - - for(unsigned i = 0; i < driveFldList.size(); i++, fldInd++) - { - fldMenu->addOpt(NULL, "[R] " + driveFldList[i].name); - - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_A, fldFuncDownload, &driveFldList[i]); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_X, fldFuncDriveDelete, &driveFldList[i]); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_Y, fldFuncDriveRestore, &driveFldList[i]); - } - } - - for(unsigned i = 0; i < fldList->getCount(); i++, fldInd++) - { - fs::dirItem *di = fldList->getDirItemAt(i); - fldMenu->addOpt(NULL, di->getItm()); - - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_A, fldFuncOverwrite, di); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_X, fldFuncDelete, di); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_Y, fldFuncRestore, di); - fldMenu->optAddButtonEvent(fldInd, HidNpadButton_ZR, fldFuncUpload, di); - } - - mutexUnlock(&fldLock); -} \ No newline at end of file diff --git a/src/ui/fm.cpp b/src/ui/fm.cpp deleted file mode 100644 index 955ba07..0000000 --- a/src/ui/fm.cpp +++ /dev/null @@ -1,591 +0,0 @@ -#include - -#include "ui.h" -#include "file.h" -#include "util.h" -#include "fm.h" -#include "cfg.h" -#include "type.h" - -//This is going to be a mess but the old one was too. -//It gets more complicated because of system saves and committing. - -//Major Todo: have thread status update -//Todo: Not have menus completely reset. - -//Struct to hold info so i don't have to if else if if if -typedef struct -{ - std::string *path; - ui::menu *m; - fs::dirList *d; -} menuFuncArgs; - -static ui::slideOutPanel *devPanel, *sdPanel; -static ui::menu *devMenu, *sdMenu, *devCopyMenu, *sdCopyMenu; -static fs::dirList *devList, *sdList; -static std::string devPath, sdPath, dev; -static menuFuncArgs *devArgs, *sdmcArgs; -static FsSaveDataType type; -static bool commit = false; - -//Declarations, implementations down further -static void _listFunctionA(void *a); - -/*General stuff*/ -static void refreshMenu(void *a) -{ - threadInfo *t = (threadInfo *)a; - menuFuncArgs *ma = (menuFuncArgs *)t->argPtr; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - d->reassign(*ma->path); - util::copyDirListToMenu(*d, *m); - for(int i = 1; i < m->getCount(); i++) - { - m->optAddButtonEvent(i, HidNpadButton_A, _listFunctionA, ma); - } - t->finished = true; -} - -/*Callbacks and menu functions*/ -static void _devMenuCallback(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - if(*ma->path != dev && *ma->path != "sdmc:/") - { - util::removeLastFolderFromString(*ma->path); - threadInfo fake; - fake.argPtr = ma; - refreshMenu(&fake); - } - break; - - case HidNpadButton_X: - devMenu->setActive(false); - devCopyMenu->setActive(true); - devPanel->openPanel(); - break; - } -} - -static void _devCopyMenuCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - devCopyMenu->setActive(false); - devMenu->setActive(true); - devPanel->closePanel(); - break; - } -} - -static void _sdMenuCallback(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - if(*ma->path != dev && *ma->path != "sdmc:/") - { - util::removeLastFolderFromString(*ma->path); - threadInfo fake; - fake.argPtr = ma; - refreshMenu(&fake); - } - break; - - case HidNpadButton_X: - sdMenu->setActive(false); - sdCopyMenu->setActive(true); - sdPanel->openPanel(); - break; - } -} - -static void _sdCopyMenuCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - sdCopyMenu->setActive(false); - sdMenu->setActive(true); - sdPanel->closePanel(); - break; - } -} - -//These draw to the panel texture passed -static void _devCopyPanelDraw(void *a) -{ - SDL_Texture *target = (SDL_Texture *)a; - devCopyMenu->draw(target, &ui::txtCont, true); -} - -static void _sdCopyPanelDraw(void *a) -{ - SDL_Texture *target = (SDL_Texture *)a; - sdCopyMenu->draw(target, &ui::txtCont, true); -} - -static void _listFunctionA(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - int sel = m->getSelected(); - bool isDir = d->isDir(sel - 2); - if(sel == 1 && (*ma->path != dev && *ma->path != "sdmc:/")) - { - util::removeLastFolderFromString(*ma->path); - d->reassign(*ma->path); - util::copyDirListToMenu(*d, *m); - } - else if(sel > 1 && isDir) - { - std::string addToPath = d->getItem(sel - 2); - *ma->path += addToPath + "/"; - d->reassign(*ma->path); - util::copyDirListToMenu(*d, *m); - } - - for(int i = 1; i < m->getCount(); i++) - m->optAddButtonEvent(i, HidNpadButton_A, _listFunctionA, ma); -} - -static void _copyMenuCopy_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - menuFuncArgs *ma = (menuFuncArgs *)t->argPtr; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - int sel = m->getSelected(); - if(ma == devArgs) - { - if(sel == 0) - fs::copyDirToDirThreaded(*ma->path, *sdmcArgs->path); - else if(sel > 1 && d->isDir(sel - 2)) - { - std::string srcPath = *ma->path + d->getItem(sel - 2) + "/"; - std::string dstPath = *sdmcArgs->path + d->getItem(sel - 2) + "/"; - mkdir(dstPath.substr(0, dstPath.length() - 1).c_str(), 777); - fs::copyDirToDirThreaded(srcPath, dstPath); - } - else if(sel > 1) - { - std::string srcPath = *ma->path + d->getItem(sel - 2); - std::string dstPath = *sdmcArgs->path + d->getItem(sel - 2); - fs::copyFileThreaded(srcPath, dstPath); - } - } - else if(ma == sdmcArgs) - { - //I know - if(sel == 0) - { - if(commit) - fs::copyDirToDirCommitThreaded(*ma->path, *devArgs->path, dev); - else - fs::copyDirToDirThreaded(*ma->path, *devArgs->path); - } - else if(sel > 1 && d->isDir(sel - 2)) - { - std::string srcPath = *ma->path + d->getItem(sel - 2) + "/"; - std::string dstPath = *devArgs->path + d->getItem(sel - 2) + "/"; - mkdir(dstPath.substr(0, dstPath.length() - 1).c_str(), 777); - if(commit) - fs::copyDirToDirCommitThreaded(srcPath, dstPath, dev); - else - fs::copyDirToDirThreaded(srcPath, dstPath); - } - else if(sel > 1) - { - std::string srcPath = *ma->path + d->getItem(sel - 2); - std::string dstPath = *devArgs->path + d->getItem(sel - 2); - if(commit) - fs::copyFileCommitThreaded(srcPath, dstPath, dev); - else - fs::copyFileThreaded(srcPath, dstPath); - } - } - ui::newThread(refreshMenu, devArgs, NULL); - ui::newThread(refreshMenu, sdmcArgs, NULL); - t->finished = true; -} - -//Sets up a confirm thread that then runs ^ -static void _copyMenuCopy(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - std::string srcPath, dstPath; - int sel = m->getSelected(); - if(sel == 0 && ma == devArgs) - { - srcPath = *ma->path; - dstPath = *sdmcArgs->path; - } - else if(sel > 1 && ma == devArgs) - { - srcPath = *ma->path + d->getItem(sel - 2); - dstPath = *sdmcArgs->path + d->getItem(sel - 2); - } - else if(sel == 0 && ma == sdmcArgs) - { - srcPath = *ma->path; - dstPath = *devArgs->path; - } - else if(sel > 1 && ma == sdmcArgs) - { - srcPath = *ma->path + d->getItem(m->getSelected() - 2); - dstPath = *devArgs->path + d->getItem(m->getSelected() - 2); - } - - if(ma == devArgs || (ma == sdmcArgs && (type != FsSaveDataType_System || cfg::config["sysSaveWrite"]))) - { - ui::confirmArgs *send = ui::confirmArgsCreate(false, _copyMenuCopy_t, NULL, ma, ui::getUICString("confirmCopy", 0), srcPath.c_str(), dstPath.c_str()); - ui::confirm(send); - } -} - -static void _copyMenuDelete_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - menuFuncArgs *ma = (menuFuncArgs *)t->argPtr; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - t->status->setStatus(ui::getUICString("threadStatusDeletingFile", 0)); - - int sel = m->getSelected(); - if(ma == devArgs) - { - if(sel == 0 && *ma->path != "sdmc:/") - { - fs::delDir(*ma->path); - if(commit) - fs::commitToDevice(dev); - } - else if(sel > 1 && d->isDir(sel - 2)) - { - std::string delPath = *ma->path + d->getItem(sel - 2) + "/"; - fs::delDir(delPath); - if(commit) - fs::commitToDevice(dev); - } - else if(sel > 1) - { - std::string delPath = *ma->path + d->getItem(sel - 2); - fs::delfile(delPath); - if(commit) - fs::commitToDevice(dev); - } - } - else - { - if(sel == 0 && *ma->path != "sdmc:/") - fs::delDir(*ma->path); - else if(sel > 1 && d->isDir(sel - 2)) - { - std::string delPath = *ma->path + d->getItem(sel - 2) + "/"; - fs::delDir(delPath); - } - else if(sel > 1) - { - std::string delPath = *ma->path + d->getItem(sel - 2); - fs::delfile(delPath); - } - } - ui::newThread(refreshMenu, devArgs, NULL); - ui::newThread(refreshMenu, sdmcArgs, NULL); - t->finished = true; -} - -//Prepares confirm then runs ^ -static void _copyMenuDelete(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - int sel = m->getSelected(); - std::string itmPath; - if(sel == 0) - itmPath = *ma->path; - else if(sel > 1) - itmPath = *ma->path + d->getItem(sel - 2); - - if(ma == sdmcArgs || (ma == devArgs && (sel == 0 || sel > 1) && (type != FsSaveDataType_System || cfg::config["sysSaveWrite"]))) - { - ui::confirmArgs *send = ui::confirmArgsCreate(cfg::config["holdDel"], _copyMenuDelete_t, NULL, a, ui::getUICString("confirmDelete", 0), itmPath.c_str()); - ui::confirm(send); - } -} - -static void _copyMenuRename(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - int sel = m->getSelected(); - if(sel > 1) - { - std::string getNewName = util::getStringInput(SwkbdType_QWERTY, d->getItem(sel - 2), ui::getUIString("swkbdRename", 0), 64, 0, NULL); - if(!getNewName.empty()) - { - std::string prevPath = *ma->path + d->getItem(sel - 2); - std::string newPath = *ma->path + getNewName; - rename(prevPath.c_str(), newPath.c_str()); - } - threadInfo fake; - fake.argPtr = devArgs; - refreshMenu(&fake); - fake.argPtr = sdmcArgs; - refreshMenu(&fake); - } -} - -static void _copyMenuMkDir(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - std::string getNewFolder = util::getStringInput(SwkbdType_QWERTY, ui::getUIString("fileModeMenuMkDir", 0), ui::getUIString("swkbdMkDir", 0), 64, 0, NULL); - if(!getNewFolder.empty()) - { - std::string createPath = *ma->path + getNewFolder; - mkdir(createPath.c_str(), 777); - } - threadInfo fake; - fake.argPtr = devArgs; - refreshMenu(&fake); - fake.argPtr = sdmcArgs; - refreshMenu(&fake); -} - -static void _copyMenuGetShowDirProps_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - std::string *p = (std::string *)t->argPtr; - unsigned dirCount = 0, fileCount = 0; - uint64_t totalSize = 0; - t->status->setStatus(ui::getUICString("threadStatusGetDirProps", 0)); - fs::getDirProps(*p, dirCount, fileCount, totalSize); - ui::showMessage(ui::getUICString("fileModeFolderProperties", 0), p->c_str(), dirCount, fileCount, util::getSizeString(totalSize).c_str()); - delete p; - t->finished = true; -} - -static void _copyMenuGetProps(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - int sel = m->getSelected(); - if(sel == 0) - { - std::string *folderPath = new std::string(*ma->path); - ui::newThread(_copyMenuGetShowDirProps_t, folderPath, NULL); - } - else if(sel > 1 && d->isDir(sel - 2)) - { - std::string *folderPath = new std::string; - folderPath->assign(*ma->path + d->getItem(sel - 2) + "/"); - ui::newThread(_copyMenuGetShowDirProps_t, folderPath, NULL); - } - else if(sel > 1) - { - std::string filePath = *ma->path + d->getItem(sel - 2); - fs::getShowFileProps(filePath); - } -} - -static void _copyMenuClose(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - if(ma == devArgs) - { - devCopyMenu->setActive(false); - devMenu->setActive(true); - devPanel->closePanel(); - } - else - { - sdCopyMenu->setActive(false); - sdMenu->setActive(true); - sdPanel->closePanel(); - } -} - -static void _devMenuAddToPathFilter(void *a) -{ - menuFuncArgs *ma = (menuFuncArgs *)a; - ui::menu *m = ma->m; - fs::dirList *d = ma->d; - - int sel = m->getSelected(); - if(sel > 1) - { - data::userTitleInfo *tinfo = data::getCurrentUserTitleInfo(); - std::string filterPath = *ma->path + d->getItem(sel - 2); - cfg::addPathToFilter(tinfo->tid, filterPath); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popAddedToPathFilter", 0), filterPath.c_str()); - } -} - -void ui::fmInit() -{ - //This needs to be done in a strange order so everything works - devArgs = new menuFuncArgs; - devArgs->path = &devPath; - - sdmcArgs = new menuFuncArgs; - sdmcArgs->path = &sdPath; - - devMenu = new ui::menu(10, 8, 590, 18, 5); - devMenu->setCallback(_devMenuCallback, devArgs); - devMenu->setActive(true); - devArgs->m = devMenu; - - devPanel = new ui::slideOutPanel(288, 720, 0, ui::SLD_LEFT, _devCopyPanelDraw); - devCopyMenu = new ui::menu(10, 185, 268, 20, 5); - devCopyMenu->setActive(false); - devCopyMenu->setCallback(_devCopyMenuCallback, NULL); - devCopyMenu->addOpt(NULL, ui::getUIString("fileModeMenu", 0) + "SDMC"); - for(int i = 1; i < 4; i++) - devCopyMenu->addOpt(NULL, ui::getUIString("fileModeMenu", i)); - //Manually do this so I can place the last option higher up - devCopyMenu->addOpt(NULL, ui::getUIString("fileModeMenu", 6)); - devCopyMenu->addOpt(NULL, ui::getUIString("fileModeMenu", 4)); - devCopyMenu->addOpt(NULL, ui::getUIString("fileModeMenu", 5)); - - devCopyMenu->optAddButtonEvent(0, HidNpadButton_A, _copyMenuCopy, devArgs); - devCopyMenu->optAddButtonEvent(1, HidNpadButton_A, _copyMenuDelete, devArgs); - devCopyMenu->optAddButtonEvent(2, HidNpadButton_A, _copyMenuRename, devArgs); - devCopyMenu->optAddButtonEvent(3, HidNpadButton_A, _copyMenuMkDir, devArgs); - devCopyMenu->optAddButtonEvent(4, HidNpadButton_A, _devMenuAddToPathFilter, devArgs); - devCopyMenu->optAddButtonEvent(5, HidNpadButton_A, _copyMenuGetProps, devArgs); - devCopyMenu->optAddButtonEvent(6, HidNpadButton_A, _copyMenuClose, devArgs); - ui::registerPanel(devPanel); - - sdMenu = new ui::menu(620, 8, 590, 18, 5); - sdMenu->setCallback(_sdMenuCallback, sdmcArgs); - sdMenu->setActive(false); - sdmcArgs->m = sdMenu; - - sdPanel = new ui::slideOutPanel(288, 720, 0, ui::SLD_RIGHT, _sdCopyPanelDraw); - sdCopyMenu = new ui::menu(10, 210, 268, 20, 5); - sdCopyMenu->setActive(false); - sdCopyMenu->setCallback(_sdCopyMenuCallback, NULL); - for(int i = 0; i < 6; i++) - sdCopyMenu->addOpt(NULL, ui::getUIString("fileModeMenu", i)); - sdCopyMenu->optAddButtonEvent(0, HidNpadButton_A, _copyMenuCopy, sdmcArgs); - sdCopyMenu->optAddButtonEvent(1, HidNpadButton_A, _copyMenuDelete, sdmcArgs); - sdCopyMenu->optAddButtonEvent(2, HidNpadButton_A, _copyMenuRename, sdmcArgs); - sdCopyMenu->optAddButtonEvent(3, HidNpadButton_A, _copyMenuMkDir, sdmcArgs); - sdCopyMenu->optAddButtonEvent(4, HidNpadButton_A, _copyMenuGetProps, sdmcArgs); - sdCopyMenu->optAddButtonEvent(5, HidNpadButton_A, _copyMenuClose, sdmcArgs); - ui::registerPanel(sdPanel); - - devList = new fs::dirList; - sdList = new fs::dirList; - devArgs->d = devList; - sdmcArgs->d = sdList; -} - -void ui::fmExit() -{ - delete devMenu; - delete sdMenu; - delete devCopyMenu; - delete sdCopyMenu; - delete devList; - delete sdList; - delete devArgs; - delete sdmcArgs; -} - -void ui::fmPrep(const FsSaveDataType& _type, const std::string& _dev, const std::string& _baseSDMC, bool _commit) -{ - type = _type; - dev = _dev; - commit = _commit; - devPath = _dev; - sdPath = _baseSDMC; - - sdCopyMenu->editOpt(0, NULL, ui::getUIString("fileModeMenu", 0) + _dev); - - devList->reassign(dev); - sdList->reassign(sdPath); - util::copyDirListToMenu(*devList, *devMenu); - for(int i = 1; i < devMenu->getCount(); i++) - devMenu->optAddButtonEvent(i, HidNpadButton_A, _listFunctionA, devArgs); - - util::copyDirListToMenu(*sdList, *sdMenu); - for(int i = 1; i < sdMenu->getCount(); i++) - sdMenu->optAddButtonEvent(i, HidNpadButton_A, _listFunctionA, sdmcArgs); -} - -void ui::fmUpdate() -{ - //For now? Maybe forever? - if(devMenu->getActive() || sdMenu->getActive()) - { - switch(ui::padKeysDown()) - { - case HidNpadButton_ZL: - case HidNpadButton_ZR: - if(devMenu->getActive()) - { - devMenu->setActive(false); - sdMenu->setActive(true); - } - else - { - devMenu->setActive(true); - sdMenu->setActive(false); - } - break; - - case HidNpadButton_Minus: - //Can't be 100% sure it's fs's sv - if(dev != "sdmc:/") - fsdevUnmountDevice(dev.c_str()); - - if(ui::prevState == EX_MNU) - { - ui::usrSelPanel->openPanel(); - ui::changeState(EX_MNU); - } - else if(ui::prevState == TTL_SEL) - { - ui::usrSelPanel->openPanel(); - ui::ttlOptsPanel->openPanel(); - ui::changeState(TTL_SEL); - } - break; - } - } - devMenu->update(); - sdMenu->update(); - devCopyMenu->update(); - sdCopyMenu->update(); -} - -void ui::fmDraw(SDL_Texture *target) -{ - devMenu->draw(target, &ui::txtCont, true); - sdMenu->draw(target, &ui::txtCont, true); - gfx::drawLine(target, &ui::divClr, 610, 0, 610, 559); - gfx::drawTextfWrap(NULL, 14, 30, 654, 600, &ui::txtCont, devPath.c_str()); - gfx::drawTextfWrap(NULL, 14, 640, 654, 600, &ui::txtCont, sdPath.c_str()); -} diff --git a/src/ui/miscui.cpp b/src/ui/miscui.cpp deleted file mode 100644 index 32320e6..0000000 --- a/src/ui/miscui.cpp +++ /dev/null @@ -1,569 +0,0 @@ -#include -#include -#include -#include - -#include "gfx.h" -#include "ui.h" -#include "miscui.h" -#include "util.h" -#include "type.h" - -static const SDL_Color divLight = {0x6D, 0x6D, 0x6D, 0xFF}; -static const SDL_Color divDark = {0xCC, 0xCC, 0xCC, 0xFF}; -static const SDL_Color shadow = {0x66, 0x66, 0x66, 0xFF}; - -static const SDL_Color fillBack = {0x66, 0x66, 0x66, 0xFF}; -static const SDL_Color fillBar = {0x00, 0xDD, 0x00, 0xFF}; - -static const SDL_Color menuColorLight = {0x32, 0x50, 0xF0, 0xFF}; -static const SDL_Color menuColorDark = {0x00, 0xFF, 0xC5, 0xFF}; - -ui::menu::menu(const int& _x, const int& _y, const int& _rW, const int& _fS, const int& _mL) -{ - x = _x; - mY = _y; - y = _y; - tY = _y; - rW = _rW; - rY = _y; - fSize = _fS; - mL = _mL; - rH = _fS + 30; - spcWidth = gfx::getTextWidth(" ", _fS) * 3; - - optTex = gfx::texMgr->textureCreate(rW - 24, rH - 8); -} - -void ui::menu::editParam(int _param, int newVal) -{ - switch(_param) - { - case MENU_X: - x = newVal; - break; - - case MENU_Y: - y = newVal; - break; - - case MENU_RECT_WIDTH: - rW = newVal; - SDL_DestroyTexture(optTex); - optTex = SDL_CreateTexture(gfx::render, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STATIC | SDL_TEXTUREACCESS_TARGET, rW, rH); - SDL_SetTextureBlendMode(optTex, SDL_BLENDMODE_BLEND); - break; - - case MENU_RECT_HEIGHT: - rH = newVal; - SDL_DestroyTexture(optTex); - optTex = SDL_CreateTexture(gfx::render, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STATIC | SDL_TEXTUREACCESS_TARGET, rW, rH); - SDL_SetTextureBlendMode(optTex, SDL_BLENDMODE_BLEND); - break; - - case MENU_FONT_SIZE: - fSize = newVal; - break; - - case MENU_MAX_SCROLL: - mL = newVal; - break; - } -} - -int ui::menu::addOpt(SDL_Texture *_icn, const std::string& add) -{ - ui::menuOpt newOpt; - newOpt.txt = add; - newOpt.txtWidth = gfx::getTextWidth(newOpt.txt.c_str(), fSize); - newOpt.icn = _icn; - opt.push_back(newOpt); - return opt.size() - 1; -} - -void ui::menu::editOpt(int ind, SDL_Texture *_icn, const std::string& ch) -{ - if(!opt[ind].icn && _icn) - opt[ind].icn = _icn; - - opt[ind].txt = ch; - opt[ind].txtWidth = gfx::getTextWidth(ch.c_str(), fSize); -} - -void ui::menu::optAddButtonEvent(unsigned _ind, HidNpadButton _button, funcPtr _func, void *args) -{ - ui::menuOptEvent newEvent = {_func, args, _button}; - opt[_ind].events.push_back(newEvent); -} - -int ui::menu::getOptPos(const std::string& txt) -{ - for(unsigned i = 0; i < opt.size(); i++) - { - if(opt[i].txt == txt) - return i; - } - return -1; -} - - -ui::menu::~menu() -{ - opt.clear(); -} - -void ui::menu::update() -{ - if(!isActive) - return; - - uint64_t down = ui::padKeysDown(); - uint64_t held = ui::padKeysHeld(); - - if(held & HidNpadButton_AnyUp || held & HidNpadButton_AnyDown) - ++fc; - else - fc = 0; - - if(fc > 10) - fc = 0; - - int oldSel = selected; - int mSize = opt.size() - 1; - bool change = false; - if( (down & HidNpadButton_AnyUp) || ((held & HidNpadButton_AnyUp) && fc == 10) ) - { - if(--selected < 0) - selected = mSize; - - change = true; - } - else if( (down & HidNpadButton_AnyDown) || ((held & HidNpadButton_AnyDown) && fc == 10)) - { - if(++selected > mSize) - selected = 0; - - change = true; - } - else if(down & HidNpadButton_AnyLeft) - { - selected -= mL; - if(selected < 0) - selected = 0; - - change = true; - } - else if(down & HidNpadButton_AnyRight) - { - selected += mL; - if(selected > mSize) - selected = mSize; - - change = true; - } - - ++hoverCount; - - if(!change && hoverCount >= 90) - hover = true; - else if(change) - { - hoverCount = 0; - hover = false; - } - - if(down && !opt[selected].events.empty()) - { - for(ui::menuOptEvent& e : opt[selected].events) - { - if((down & e.button) && e.func) - (*e.func)(e.args); - } - } - - if(selected <= mL) - tY = mY; - else if(selected >= (mSize - mL) && mSize > mL * 2) - tY = mY + -(rH * (mSize - (mL * 2))); - else if(selected > mL && selected < (mSize - mL)) - tY = -(rH * (selected - mL)); - - if(selected != oldSel && onChange) - (*onChange)(NULL); - - if(callback) - (*callback)(callbackArgs); -} - -void ui::menu::draw(SDL_Texture *target, const SDL_Color *textClr, bool drawText) -{ - if(opt.size() < 1) - return; - - int tH = 0; - SDL_QueryTexture(target, NULL, NULL, NULL, &tH); - - if(y != tY) - { - float add = (float)((float)tY - (float)y) / ui::animScale; - y += ceil(add); - } - - if(clrAdd) - { - clrSh += 6; - if(clrSh >= 0x72) - clrAdd = false; - } - else - { - clrSh -= 3; - if(clrSh <= 0x00) - clrAdd = true; - } - - for(int i = 0, tY = y; i < (int)opt.size(); i++, tY += rH) - { - if(tY < -rH || tY > tH) - continue; - - gfx::clearTarget(optTex, &ui::transparent); - - //Todo: Clean this up maybe - if(i == selected && drawText) - { - if(isActive) - ui::drawBoundBox(target, x, y + (i * rH), rW, rH, clrSh); - - gfx::drawRect(target, ui::thmID == ColorSetId_Light ? &menuColorLight : &menuColorDark, x + 10, ((y + (rH / 2 - fSize / 2)) + (i * rH)) - 2, 4, fSize + 4); - - static int dX = 0; - if(hover && opt[i].txtWidth > rW - 24) - { - if((dX -= 2) <= -(opt[i].txtWidth + spcWidth)) - { - dX = 0; - hoverCount = 0; - hover = false; - } - - gfx::drawTextf(optTex, fSize, dX, ((rH - 8) / 2) - fSize / 2, ui::thmID == ColorSetId_Light ? &menuColorLight : &menuColorDark, opt[i].txt.c_str()); - gfx::drawTextf(optTex, fSize, dX + opt[i].txtWidth + spcWidth, ((rH - 8) / 2) - fSize / 2, ui::thmID == ColorSetId_Light ? &menuColorLight : &menuColorDark, opt[i].txt.c_str()); - } - else - { - dX = 0; - gfx::drawTextf(optTex, fSize, 0, ((rH - 8) / 2) - fSize / 2, ui::thmID == ColorSetId_Light ? &menuColorLight : &menuColorDark, opt[i].txt.c_str()); - } - gfx::texDraw(target, optTex, x + 20, (y + 4 + (i * rH))); - } - else if(i == selected && !drawText && opt[i].icn) - { - int w, h; - SDL_QueryTexture(opt[i].icn, NULL, NULL, &w, &h); - float scale = (float)fSize / (float)h; - int dW = scale * w; - int dH = scale * h; - if(isActive) - ui::drawBoundBox(target, x, y + (i * rH), rW, rH, clrSh); - - gfx::drawRect(target, ui::thmID == ColorSetId_Light ? &menuColorLight : &menuColorDark, x + 10, ((y + (rH / 2 - fSize / 2)) + (i * rH)) - 2, 4, fSize + 4); - gfx::texDrawStretch(optTex, opt[i].icn, 0, ((rH - 8) / 2) - fSize / 2, dW, dH); - gfx::texDraw(target, optTex, x + 20, (y + 4 + (i * rH))); - } - else if(drawText) - { - gfx::clearTarget(optTex, &ui::transparent); - gfx::drawTextf(optTex, fSize, 0, ((rH - 8) / 2) - fSize / 2, textClr, opt[i].txt.c_str()); - gfx::texDraw(target, optTex, x + 20, (y + 4 + (i * rH))); - } - else if(!drawText && opt[i].icn) - { - int w, h; - SDL_QueryTexture(opt[i].icn, NULL, NULL, &w, &h); - float scale = (float)fSize / (float)h; - int dW = scale * w; - int dH = scale * h; - gfx::texDrawStretch(optTex, opt[i].icn, 0, ((rH - 8) / 2) - fSize / 2, dW, dH); - gfx::texDraw(target, optTex, x + 20, (y + 4 + (i * rH))); - } - } -} - -void ui::menu::reset() -{ - opt.clear(); - selected = 0; - y = mY; - tY = mY; - fc = 0; -} - -void ui::menu::setActive(bool _set) -{ - isActive = _set; -} - -void ui::progBar::update(const uint64_t& _prog) -{ - prog = _prog; - - if(max > 0) - width = (float)((float)prog / (float)max) * 648.0f; -} - -void ui::progBar::draw(const std::string& text) -{ - char progStr[64]; - sprintf(progStr, "%.2fMB / %.2fMB", (float)prog / 1024.0f / 1024.0f, (float)max / 1024.0f / 1024.0f); - int progX = 640 - (gfx::getTextWidth(progStr, 18) / 2); - - ui::drawTextbox(NULL, 280, 262, 720, 256); - gfx::drawLine(NULL, &ui::rectSh, 280, 454, 999, 454); - gfx::drawRect(NULL, &fillBack, 312, 471, 648, 32); - gfx::drawRect(NULL, &fillBar, 312, 471, (int)width, 32); - gfx::drawTextf(NULL, 18, progX, 478, &ui::txtCont, progStr); - gfx::drawTextfWrap(NULL, 16, 312, 288, 648, &ui::txtCont, text.c_str()); -} - -ui::popMessageMngr::~popMessageMngr() -{ - message.clear(); -} - -void ui::popMessageMngr::update() -{ - //Anything that needs graphics/text must be processed on main thread - for(ui::popMessage& p : popQueue) - { - p.rectWidth = gfx::getTextWidth(p.message.c_str(), 24) + 32; - message.push_back(p); - } - popQueue.clear(); - - for(unsigned i = 0; i < message.size(); i++) - { - message[i].frames--; - if(message[i].frames <= 0) - message.erase(message.begin() + i); - } -} - -void ui::popMessageMngr::popMessageAdd(const std::string& mess, int frameTime) -{ - //Suppress multiple of the same - int lastMessageIndex = message.size() - 1; - std::string lastMessage; - if(lastMessageIndex >= 0) - lastMessage = message[lastMessageIndex].message; - if(lastMessage != mess) - { - ui::popMessage newPop = {mess, 0, frameTime}; - popQueue.push_back(newPop); - } -} - -void ui::popMessageMngr::draw() -{ - int y = 640; - for(auto& p : message) - { - y -= 48; - if(p.y != y) - p.y += (y - p.y) / ui::animScale; - - gfx::drawRect(NULL, &ui::tboxClr, 64, p.y, p.rectWidth, 40); - gfx::drawTextf(NULL, 24, 80, p.y + 8, &ui::txtCont, p.message.c_str()); - } -} - -ui::confirmArgs *ui::confirmArgsCreate(bool _hold, funcPtr _confFunc, funcPtr _cancelFunc, void *_funcArgs, const char *fmt, ...) -{ - char tmp[1024]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - - ui::confirmArgs *ret = new confirmArgs; - ret->hold = _hold; - ret->confFunc = _confFunc; - ret->cancelFunc = _cancelFunc; - ret->args = _funcArgs; - ret->text = tmp; - - return ret; -} - -//todo: more inline with original -void confirm_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - ui::confirmArgs *c = (ui::confirmArgs *)t->argPtr; - - while(true) - { - uint64_t down = ui::padKeysDown(); - uint64_t held = ui::padKeysHeld(); - - if((down & HidNpadButton_A) && !c->hold) - { - ui::newThread(c->confFunc, c->args, NULL); - break; - } - else if((held & HidNpadButton_A) && c->hold) - { - if(c->frameCount % 4 == 0 && ++c->lgFrame > 7) - c->lgFrame = 0; - - if(c->frameCount >= 120) - { - ui::newThread(c->confFunc, c->args, NULL); - break; - } - } - else if(down & HidNpadButton_B) - { - if(c->cancelFunc) - (*c->cancelFunc)(c->args); - break; - } - - svcSleepThread(1e+9 / 60);//Close enough - } - delete c; - t->finished = true; -} - -//For now this will work -void confirmDrawFunc(void *a) -{ - threadInfo *t = (threadInfo *)a; - ui::confirmArgs *c = (ui::confirmArgs *)t->argPtr; - if(!t->finished) - { - std::string yesTxt = ui::getUIString("dialogYes", 0); - unsigned yesX = 0; - - if((ui::padKeysHeld() & HidNpadButton_A) && c->hold) - { - c->frameCount++; - if(c->frameCount <= 40) - yesTxt = ui::getUIString("holdingText", 0); - else if(c->frameCount <= 80) - yesTxt = ui::getUIString("holdingText", 1); - else if(c->frameCount <= 120) - yesTxt = ui::getUICString("holdingText", 2); - - yesTxt += ui::loadGlyphArray[c->lgFrame]; - } - else - c->frameCount = 0; - - - //I positioned these by eye. They're probably off. - yesX = 458 - (gfx::getTextWidth(yesTxt.c_str(), 18) / 2); - ui::drawTextbox(NULL, 280, 262, 720, 256); - gfx::drawTextfWrap(NULL, 16, 312, 288, 656, &ui::txtCont, c->text.c_str()); - gfx::drawLine(NULL, &ui::rectSh, 280, 454, 999, 454); - gfx::drawLine(NULL, &ui::rectSh, 640, 454, 640, 518); - gfx::drawTextf(NULL, 18, yesX, 478, &ui::txtCont, yesTxt.c_str()); - gfx::drawTextf(NULL, 18, 782, 478, &ui::txtCont, ui::getUICString("dialogNo", 0)); - } -} - -void ui::confirm(void *a) -{ - ui::newThread(confirm_t, a, confirmDrawFunc); -} - -static void showMessage_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - std::string *text = (std::string *)t->argPtr; - while(true) - { - if(ui::padKeysDown() & HidNpadButton_A) - break; - - svcSleepThread(1e+9 / 60); - } - delete text; - t->finished = true; -} - -static void showMessageDrawFunc(void *a) -{ - threadInfo *t = (threadInfo *)a; - std::string *text = (std::string *)t->argPtr; - if(!t->finished) - { - unsigned okX = 640 - (gfx::getTextWidth(ui::getUICString("dialogOK", 0), 18) / 2); - ui::drawTextbox(NULL, 280, 262, 720, 256); - gfx::drawLine(NULL, &ui::rectSh, 280, 454, 999, 454); - gfx::drawTextfWrap(NULL, 16, 312, 288, 656, &ui::txtCont, text->c_str()); - gfx::drawTextf(NULL, 18, okX, 478, &ui::txtCont, ui::getUICString("dialogOK", 0)); - } -} - -void ui::showMessage(const char *fmt, ...) -{ - char tmp[1024]; - va_list args; - va_start(args, fmt); - vsprintf(tmp, fmt, args); - va_end(args); - - std::string *send = new std::string(tmp); - ui::newThread(showMessage_t, send, showMessageDrawFunc); -} - -void ui::drawTextbox(SDL_Texture *target, int x, int y, int w, int h) -{ - //Top - gfx::texDraw(target, ui::cornerTopLeft, x, y); - gfx::drawRect(target, &ui::tboxClr, x + 32, y, w - 64, 32); - gfx::texDraw(target, ui::cornerTopRight, (x + w) - 32, y); - - //middle - gfx::drawRect(target, &ui::tboxClr, x, y + 32, w, h - 64); - - //bottom - gfx::texDraw(target, ui::cornerBottomLeft, x, (y + h) - 32); - gfx::drawRect(target, &ui::tboxClr, x + 32, (y + h) - 32, w - 64, 32); - gfx::texDraw(target, ui::cornerBottomRight, (x + w) - 32, (y + h) - 32); -} - -void ui::drawBoundBox(SDL_Texture *target, int x, int y, int w, int h, uint8_t clrSh) -{ - SDL_SetRenderTarget(gfx::render, target); - SDL_Color rectClr; - - if(ui::thmID == ColorSetId_Light) - rectClr = {0xFD, 0xFD, 0xFD, 0xFF}; - else - rectClr = {0x21, 0x22, 0x21, 0xFF}; - - gfx::drawRect(target, &rectClr, x + 4, y + 4, w - 8, h - 8); - - rectClr = {0x00, (uint8_t)(0x88 + clrSh), (uint8_t)(0xC5 + (clrSh / 2)), 0xFF}; - - SDL_SetTextureColorMod(mnuTopLeft, rectClr.r, rectClr.g, rectClr.b); - SDL_SetTextureColorMod(mnuTopRight, rectClr.r, rectClr.g, rectClr.b); - SDL_SetTextureColorMod(mnuBotLeft, rectClr.r, rectClr.g, rectClr.b); - SDL_SetTextureColorMod(mnuBotRight, rectClr.r, rectClr.g, rectClr.b); - - //top - gfx::texDraw(target, mnuTopLeft, x, y); - gfx::drawRect(target, &rectClr, x + 4, y, w - 8, 4); - gfx::texDraw(target, mnuTopRight, (x + w) - 4, y); - - //mid - gfx::drawRect(target, &rectClr, x, y + 4, 4, h - 8); - gfx::drawRect(target, &rectClr, (x + w) - 4, y + 4, 4, h - 8); - - //bottom - gfx::texDraw(target, mnuBotLeft, x, (y + h) - 4); - gfx::drawRect(target, &rectClr, x + 4, (y + h) - 4, w - 8, 4); - gfx::texDraw(target, mnuBotRight, (x + w) - 4, (y + h) - 4); -} diff --git a/src/ui/sett.cpp b/src/ui/sett.cpp deleted file mode 100644 index 6acb246..0000000 --- a/src/ui/sett.cpp +++ /dev/null @@ -1,297 +0,0 @@ -#include -#include - -#include "ui.h" -#include "file.h" -#include "sett.h" -#include "cfg.h" -#include "util.h" - -ui::menu *ui::settMenu; -static ui::slideOutPanel *blEditPanel; -static ui::menu *blEditMenu; - -//This is the name of strings used here -static const char *settMenuStr = "settingsMenu"; - -static unsigned optHelpX = 0; - -static inline std::string getBoolText(const bool& b) -{ - return b ? ui::getUIString("settingsOn", 0) : ui::getUIString("settingsOff", 0); -} - -static inline void toggleBool(bool& b) -{ - if(b) - b = false; - else - b = true; -} - -//Declaration, implementation further down -static void blEditMenuPopulate(); - -static void settMenuCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - ui::usrMenu->setActive(true); - ui::settMenu->setActive(false); - ui::changeState(USR_SEL); - break; - - case HidNpadButton_X: - cfg::resetConfig(); - break; - } -} - -static void settMenuDeleteAllBackups_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - t->status->setStatus(ui::getUICString("threadStatusDeletingFile", 0)); - - fs::dirList *jksvDir = new fs::dirList(fs::getWorkDir()); - for(unsigned i = 0; i < jksvDir->getCount(); i++) - { - if(jksvDir->isDir(i) && jksvDir->getItem(i) != "svi") - { - std::string delTarget = fs::getWorkDir() + jksvDir->getItem(i) + "/"; - fs::delDir(delTarget); - } - } - delete jksvDir; - t->finished = true; -} - -static void settMenuDeleteAllBackups(void *a) -{ - ui::confirmArgs *send = ui::confirmArgsCreate(true, settMenuDeleteAllBackups_t, NULL, NULL, ui::getUICString("confirmDeleteBackupsAll", 0)); - ui::confirm(send); -} - -static void blEditDrawFunc(void *a) -{ - SDL_Texture *target = (SDL_Texture *)a; - blEditMenu->draw(target, &ui::txtCont, true); -} - -static void blEditMenuCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - ui::updateInput(); - blEditMenu->setActive(false); - ui::settMenu->setActive(true); - blEditPanel->closePanel(); - break; - } -} - -static void blEditMenuRemoveTitle(void *a) -{ - uint64_t remTID = cfg::blacklist[blEditMenu->getSelected()]; - cfg::removeTitleFromBlacklist(remTID); - if(cfg::blacklist.size() > 0) - blEditMenuPopulate(); - else - { - blEditMenu->setActive(false); - ui::settMenu->setActive(true); - blEditPanel->closePanel(); - } -} - -static void blEditMenuPopulate() -{ - blEditMenu->reset(); - for(unsigned i = 0; i < cfg::blacklist.size(); i++) - { - blEditMenu->addOpt(NULL, data::getTitleNameByTID(cfg::blacklist[i])); - blEditMenu->optAddButtonEvent(i, HidNpadButton_A, blEditMenuRemoveTitle, NULL); - } -} - -//Todo: this different -static void toggleOpt(void *a) -{ - switch(ui::settMenu->getSelected()) - { - case 0: - fs::delDir(fs::getWorkDir() + "_TRASH_/"); - mkdir(std::string(fs::getWorkDir() + "_TRASH_").c_str(), 777); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popTrashEmptied", 0)); - break; - - case 1: - ui::newThread(util::checkForUpdate, NULL, NULL); - break; - - case 2: - { - std::string oldWD = fs::getWorkDir(); - std::string getWD = util::getStringInput(SwkbdType_QWERTY, fs::getWorkDir(), ui::getUIString("swkbdSetWorkDir", 0), 64, 0, NULL); - if(!getWD.empty()) - { - if(getWD[getWD.length() - 1] != '/') - getWD += "/"; - - rename(oldWD.c_str(), getWD.c_str()); - fs::setWorkDir(getWD); - } - } - break; - - case 3: - if(cfg::blacklist.size() > 0) - { - blEditMenuPopulate(); - ui::settMenu->setActive(false); - blEditMenu->setActive(true); - blEditPanel->openPanel(); - } - break; - - case 4: - settMenuDeleteAllBackups(NULL); - break; - - case 5: - toggleBool(cfg::config["incDev"]); - break; - - case 6: - toggleBool(cfg::config["autoBack"]); - break; - - case 7: - toggleBool(cfg::config["autoName"]); - break; - - case 8: - toggleBool(cfg::config["ovrClk"]); - break; - - case 9: - toggleBool(cfg::config["holdDel"]); - break; - - case 10: - toggleBool(cfg::config["holdRest"]); - break; - - case 11: - toggleBool(cfg::config["holdOver"]); - break; - - case 12: - toggleBool(cfg::config["forceMount"]); - break; - - case 13: - toggleBool(cfg::config["accSysSave"]); - break; - - case 14: - toggleBool(cfg::config["sysSaveWrite"]); - break; - - case 15: - toggleBool(cfg::config["directFsCmd"]); - break; - - case 16: - toggleBool(cfg::config["zip"]); - break; - - case 17: - toggleBool(cfg::config["langOverride"]); - break; - - case 18: - toggleBool(cfg::config["trashBin"]); - break; - - case 19: - if(++cfg::sortType > 2) - cfg::sortType = 0; - data::loadUsersTitles(false); - ui::ttlRefresh(); - break; - - case 20: - ui::animScale += 0.5f; - if(ui::animScale > 8) - ui::animScale = 1; - break; - } - cfg::saveConfig(); -} - -static void updateMenuText() -{ - ui::settMenu->editOpt(5, NULL, ui::getUIString(settMenuStr, 5) + getBoolText(cfg::config["incDev"])); - ui::settMenu->editOpt(6, NULL, ui::getUIString(settMenuStr, 6) + getBoolText(cfg::config["autoBack"])); - ui::settMenu->editOpt(7, NULL, ui::getUIString(settMenuStr, 7) + getBoolText(cfg::config["autoName"])); - ui::settMenu->editOpt(8, NULL, ui::getUIString(settMenuStr, 8) + getBoolText(cfg::config["ovrClk"])); - ui::settMenu->editOpt(9, NULL, ui::getUIString(settMenuStr, 9) + getBoolText(cfg::config["holdDel"])); - ui::settMenu->editOpt(10, NULL, ui::getUIString(settMenuStr, 10) + getBoolText(cfg::config["holdRest"])); - ui::settMenu->editOpt(11, NULL, ui::getUIString(settMenuStr, 11) + getBoolText(cfg::config["holdOver"])); - ui::settMenu->editOpt(12, NULL, ui::getUIString(settMenuStr, 12) + getBoolText(cfg::config["forceMount"])); - ui::settMenu->editOpt(13, NULL, ui::getUIString(settMenuStr, 13) + getBoolText(cfg::config["accSysSave"])); - ui::settMenu->editOpt(14, NULL, ui::getUIString(settMenuStr, 14) + getBoolText(cfg::config["sysSaveWrite"])); - ui::settMenu->editOpt(15, NULL, ui::getUIString(settMenuStr, 15) + getBoolText(cfg::config["directFsCmd"])); - ui::settMenu->editOpt(16, NULL, ui::getUIString(settMenuStr, 16) + getBoolText(cfg::config["zip"])); - ui::settMenu->editOpt(17, NULL, ui::getUIString(settMenuStr, 17) + getBoolText(cfg::config["langOverride"])); - ui::settMenu->editOpt(18, NULL, ui::getUIString(settMenuStr, 18) + getBoolText(cfg::config["trashBin"])); - ui::settMenu->editOpt(19, NULL, ui::getUIString(settMenuStr, 19) + ui::getUICString("sortType", cfg::sortType)); - - char tmp[16]; - sprintf(tmp, "%.1f", ui::animScale); - ui::settMenu->editOpt(20, NULL, ui::getUIString(settMenuStr, 20) + std::string(tmp)); -} - -void ui::settInit() -{ - ui::settMenu = new ui::menu(200, 24, 1002, 24, 4); - ui::settMenu->setCallback(settMenuCallback, NULL); - ui::settMenu->setActive(false); - - blEditPanel = new ui::slideOutPanel(512, 720, 0, ui::SLD_RIGHT, blEditDrawFunc); - blEditMenu = new ui::menu(8, 32, 492, 20, 6); - blEditMenu->setCallback(blEditMenuCallback, NULL); - blEditMenu->setActive(false); - ui::registerPanel(blEditPanel); - - optHelpX = 1220 - gfx::getTextWidth(ui::getUICString("helpSettings", 0), 18); - - for(unsigned i = 0; i < 21; i++) - { - ui::settMenu->addOpt(NULL, ui::getUIString("settingsMenu", i)); - ui::settMenu->optAddButtonEvent(i, HidNpadButton_A, toggleOpt, NULL); - } -} - -void ui::settExit() -{ - delete ui::settMenu; - delete blEditMenu; - delete blEditPanel; -} - -void ui::settUpdate() -{ - blEditMenu->update(); - ui::settMenu->update(); -} - -void ui::settDraw(SDL_Texture *target) -{ - updateMenuText(); - ui::settMenu->draw(target, &ui::txtCont, true); - if(ui::mstate == OPT_MNU) - gfx::drawTextf(NULL, 18, optHelpX, 673, &ui::txtCont, ui::getUICString("helpSettings", 0)); -} diff --git a/src/ui/sldpanel.cpp b/src/ui/sldpanel.cpp deleted file mode 100644 index b0ae7c7..0000000 --- a/src/ui/sldpanel.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include - -#include "ui.h" -#include "gfx.h" - -ui::slideOutPanel::slideOutPanel(int _w, int _h, int _y, ui::slidePanelOrientation _side, funcPtr _draw) -{ - w = _w; - h = _h; - y = _y; - sldSide = _side; - if(_side == ui::SLD_LEFT) - x = -w; - else - x = 1280; - - drawFunc = _draw; - panel = gfx::texMgr->textureCreate(w, h); -} - -void ui::slideOutPanel::resizePanel(int _w, int _h, int _y) -{ - w = _w; - h = _h; - y = _y; - if(sldSide == ui::SLD_LEFT) - x = -w; - - gfx::texMgr->textureResize(&panel, w, h); -} - -void ui::slideOutPanel::update() -{ - if(open && callback) - (*callback)(cbArgs); -} - -void ui::slideOutPanel::draw(const SDL_Color *backCol) -{ - gfx::clearTarget(panel, backCol); - - if(open && sldSide == ui::SLD_LEFT && x < 0) - { - float add = (float)x / ui::animScale; - x -= ceil(add); - } - else if(open && sldSide == ui::SLD_RIGHT && x > 1280 - w) - { - float add = ((1280.0f - (float)w) - (float)x) / ui::animScale; - x += ceil(add); - } - else if(!open && sldSide == ui::SLD_LEFT && x > -w) - { - float sub = ((float)w - (float)x) / ui::animScale; - x -= ceil(sub); - } - else if(!open && sldSide == ui::SLD_RIGHT && x < 1280) - { - float add = (1280.0f - (float)x) / ui::animScale; - x += ceil(add); - } - - if((sldSide == ui::SLD_LEFT && x > -w) || (sldSide == ui::SLD_RIGHT && x < 1280)) - { - (*drawFunc)(panel); - gfx::texDraw(NULL, panel, x, y); - } -} diff --git a/src/ui/thrdProc.cpp b/src/ui/thrdProc.cpp deleted file mode 100644 index b882cec..0000000 --- a/src/ui/thrdProc.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include - -#include "ui.h" -#include "gfx.h" - -#include "file.h" - -//Thread status screen always uses white -static const SDL_Color white = {0xFF, 0xFF, 0xFF, 0xFF}; -static const SDL_Color darkenBack = {0x00, 0x00, 0x00, 0xBB}; - -ui::threadProcMngr::~threadProcMngr() -{ - for(threadInfo *t : threads) - { - threadWaitForExit(&t->thrd); - threadClose(&t->thrd); - delete t->status; - delete t; - } -} - -threadInfo *ui::threadProcMngr::newThread(ThreadFunc func, void *args, funcPtr _drawfunc) -{ - threadInfo *t = new threadInfo; - t->status = new threadStatus; - t->running = false; - t->finished = false; - t->thrdFunc = func; - t->drawFunc = _drawfunc; - t->argPtr = args; - - mutexLock(&threadLock); - threads.push_back(t); - mutexUnlock(&threadLock); - return threads[threads.size() - 1]; -} - -void ui::threadProcMngr::update() -{ - if(!threads.empty()) - { - Result res = 0; - threadInfo *t = threads[0]; - if(!t->running && R_SUCCEEDED((res = threadCreate(&t->thrd, t->thrdFunc, t, NULL, 0x80000, 0x2B, 1)))) - { - threadStart(&t->thrd); - t->running = true; - } - else if(!t->running && R_FAILED(res))//Should kill the thread that failed. - t->finished = true; - else if(t->finished) - { - threadWaitForExit(&t->thrd); - threadClose(&t->thrd); - delete t->status; - delete t; - mutexLock(&threadLock); - threads.erase(threads.begin()); - mutexUnlock(&threadLock); - } - } -} - -void ui::threadProcMngr::draw() -{ - if(!threads.empty()) - { - if(++frameCount % 4 == 0 && ++lgFrame > 7) - lgFrame = 0; - - if(clrAdd && (clrShft += 6) >= 0x72) - clrAdd = false; - else if(!clrAdd && (clrShft -= 3) <= 0x00) - clrAdd = true; - - - SDL_Color glyphCol = {0x00, (uint8_t)(0x88 + clrShft), (uint8_t)(0xC5 + (clrShft / 2)), 0xFF}; - - gfx::drawRect(NULL, &darkenBack, 0, 0, 1280, 720); - gfx::drawTextf(NULL, 32, 56, 673, &glyphCol, loadGlyphArray[lgFrame].c_str()); - - threadInfo *t = threads[0]; - if(t->drawFunc) - (*(t->drawFunc))(t); - else - { - std::string gStatus; - t->status->getStatus(gStatus); - - int statX = 640 - (gfx::getTextWidth(gStatus.c_str(), 18) / 2); - gfx::drawTextf(NULL, 18, statX, 387, &white, gStatus.c_str()); - } - } -} diff --git a/src/ui/ttl.cpp b/src/ui/ttl.cpp deleted file mode 100644 index 8d88505..0000000 --- a/src/ui/ttl.cpp +++ /dev/null @@ -1,414 +0,0 @@ -#include - -#include "ui.h" -#include "ttl.h" -#include "file.h" -#include "util.h" -#include "cfg.h" - -static int ttlHelpX = 0; -static std::vector ttlViews; -static ui::menu *ttlOpts; -ui::slideOutPanel *ui::ttlOptsPanel; -static ui::slideOutPanel *infoPanel; -static Mutex ttlViewLock = 0; - -void ui::ttlRefresh() -{ - mutexLock(&ttlViewLock); - for(int i = 0; i < (int)data::users.size(); i++) - ttlViews[i]->refresh(); - mutexUnlock(&ttlViewLock); -} - -static void ttlViewCallback(void *a) -{ - unsigned curUserIndex = data::getCurrentUserIndex(); - unsigned setUserTitleIndex = ttlViews[curUserIndex]->getSelected(); - data::setTitleIndex(setUserTitleIndex); - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - uint64_t tid = d->tid; - - switch(ui::padKeysDown()) - { - case HidNpadButton_A: - if(fs::mountSave(d->saveInfo)) - { - ttlViews[curUserIndex]->setActive(false, true); - ui::fldPopulateMenu(); - } - break; - - case HidNpadButton_B: - ttlViews[curUserIndex]->setActive(false, false); - ui::usrMenu->setActive(true); - ui::changeState(USR_SEL); - break; - - case HidNpadButton_X: - ttlViews[curUserIndex]->setActive(false, true); - ttlOpts->setActive(true); - ui::ttlOptsPanel->openPanel(); - break; - - case HidNpadButton_Y: - { - cfg::addTitleToFavorites(tid); - int newSel = data::getTitleIndexInUser(data::users[curUserIndex], tid); - ttlViews[curUserIndex]->setSelected(newSel); - } - break; - } -} - -static void ttlOptsCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - { - int curUserIndex = data::getCurrentUserIndex(); - ttlOpts->setActive(false); - ui::ttlOptsPanel->closePanel(); - ttlViews[curUserIndex]->setActive(true, true); - ui::updateInput(); - } - break; - } -} - -static void ttlOptsPanelDraw(void *a) -{ - SDL_Texture *panel = (SDL_Texture *)a; - ttlOpts->draw(panel, &ui::txtCont, true); -} - -static void ttlOptsShowInfoPanel(void *) -{ - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - data::titleInfo *tinfo = data::getTitleInfoByTID(utinfo->tid); - - char tmp[256]; - sprintf(tmp, ui::getUICString("infoStatus", 4), tinfo->author.c_str()); - - size_t titleWidth = gfx::getTextWidth(tinfo->title.c_str(), 18); - size_t pubWidth = gfx::getTextWidth(tmp, 18); - if(titleWidth > 410 || pubWidth > 410) - { - size_t newWidth = titleWidth > pubWidth ? titleWidth : pubWidth; - infoPanel->resizePanel(newWidth + 40, 720, 0); - } - else - infoPanel->resizePanel(410, 720, 0); - - ttlOpts->setActive(false); - ui::ttlOptsPanel->closePanel(); - infoPanel->openPanel(); -} - -static void ttlOptsBlacklistTitle(void *a) -{ - std::string title = data::getTitleNameByTID(data::getCurrentUserTitleInfo()->tid); - ui::confirmArgs *conf = ui::confirmArgsCreate(false, cfg::addTitleToBlacklist, NULL, NULL, ui::getUICString("confirmBlacklist", 0), title.c_str()); - ui::confirm(conf); -} - -static void ttlOptsDefinePath(void *a) -{ - uint64_t tid = data::getCurrentUserTitleInfo()->tid; - std::string safeTitle = data::getTitleInfoByTID(tid)->safeTitle; - std::string newSafeTitle = util::getStringInput(SwkbdType_QWERTY, safeTitle, ui::getUICString("swkbdNewSafeTitle", 0), 0x200, 0, NULL); - if(!newSafeTitle.empty()) - cfg::pathDefAdd(tid, newSafeTitle); -} - -static void ttlOptsToFileMode(void *a) -{ - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - if(fs::mountSave(d->saveInfo)) - { - data::userTitleInfo *utinfo = data::getCurrentUserTitleInfo(); - std::string sdmcPath = util::generatePathByTID(utinfo->tid); - ui::fmPrep((FsSaveDataType)d->saveInfo.save_data_type, "sv:/", sdmcPath, true); - ui::usrSelPanel->closePanel(); - ui::ttlOptsPanel->closePanel(); - ui::changeState(FIL_MDE); - } -} - -static void ttlOptsDeleteAllBackups_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - t->status->setStatus(ui::getUICString("threadStatusDeletingFile", 0)); - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - std::string targetPath = util::generatePathByTID(d->tid); - fs::dirList *backupList = new fs::dirList(targetPath); - for(unsigned i = 0; i < backupList->getCount(); i++) - { - std::string delPath = targetPath + backupList->getItem(i); - if(backupList->isDir(i)) - { - delPath += "/"; - fs::delDir(delPath); - } - else - fs::delfile(delPath); - } - delete backupList; - t->finished = true; -} - -static void ttlOptsDeleteAllBackups(void *a) -{ - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - std::string currentTitle = data::getTitleNameByTID(d->tid); - - ui::confirmArgs *send = ui::confirmArgsCreate(cfg::config["holdDel"], ttlOptsDeleteAllBackups_t, NULL, NULL, ui::getUICString("confirmDeleteBackupsTitle", 0), currentTitle.c_str()); - ui::confirm(send); -} - -static void ttlOptsResetSaveData_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - std::string title = data::getTitleNameByTID(d->tid); - t->status->setStatus(ui::getUICString("threadStatusResettingSaveData", 0)); - - fs::mountSave(d->saveInfo); - fs::delDir("sv:/"); - fsdevCommitDevice("sv:/"); - fs::unmountSave(); - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataResetSuccess", 0), title.c_str()); - t->finished = true; -} - -static void ttlOptsResetSaveData(void *a) -{ - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - if(d->saveInfo.save_data_type != FsSaveDataType_System) - { - std::string title = data::getTitleNameByTID(d->tid); - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdDel"], ttlOptsResetSaveData_t, NULL, NULL, ui::getUICString("confirmResetSaveData", 0), title.c_str()); - ui::confirm(conf); - } -} - -static void ttlOptsDeleteSaveData_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - data::user *u = data::getCurrentUser(); - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - unsigned userIndex = data::getCurrentUserIndex(); - - std::string title = data::getTitleNameByTID(d->tid); - t->status->setStatus(ui::getUICString("threadStatusDeletingSaveData", 0), title.c_str()); - if(R_SUCCEEDED(fsDeleteSaveDataFileSystemBySaveDataSpaceId((FsSaveDataSpaceId)d->saveInfo.save_data_space_id, d->saveInfo.save_data_id))) - { - data::loadUsersTitles(false); - if(u->titleInfo.size() == 0) - { - //Kick back to user - ui::ttlOptsPanel->closePanel();//JIC - ttlOpts->setActive(false); - ttlViews[userIndex]->setActive(false, false); - ui::usrMenu->setActive(true); - ui::changeState(USR_SEL); - } - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("saveDataDeleteSuccess", 0), title.c_str()); - ttlViews[userIndex]->refresh(); - } - t->finished = true; -} - -static void ttlOptsDeleteSaveData(void *a) -{ - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - if(d->saveInfo.save_data_type != FsSaveDataType_System) - { - std::string title = data::getTitleNameByTID(d->tid); - ui::confirmArgs *conf = ui::confirmArgsCreate(cfg::config["holdDel"], ttlOptsDeleteSaveData_t, NULL, NULL, ui::getUICString("confirmDeleteSaveData", 0), title.c_str()); - ui::confirm(conf); - } -} - -static void ttlOptsExtendSaveData(void *a) -{ - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - if(d->saveInfo.save_data_type != FsSaveDataType_System) - { - std::string expSizeStr = util::getStringInput(SwkbdType_NumPad, "", ui::getUICString("swkbdExpandSize", 0), 4, 0, NULL); - uint64_t extMB = strtoul(expSizeStr.c_str(), NULL, 10) * 0x100000; - fs::extendSaveDataThreaded(d, extMB); - } -} - -static void ttlOptsExportSVI(void *a) -{ - data::userTitleInfo *ut = data::getCurrentUserTitleInfo(); - data::titleInfo *t = data::getTitleInfoByTID(ut->tid); - std::string out = fs::getWorkDir() + "svi/"; - fs::mkDir(out.substr(0, out.length() - 1)); - out += util::getIDStr(ut->tid) + ".svi"; - FILE *svi = fopen(out.c_str(), "wb"); - if(svi) - { - //Grab icon - NsApplicationControlData *ctrlData = new NsApplicationControlData; - uint64_t ctrlSize = 0; - nsGetApplicationControlData(NsApplicationControlSource_Storage, ut->tid, ctrlData, sizeof(NsApplicationControlData), &ctrlSize); - size_t jpegSize = ctrlSize - sizeof(ctrlData->nacp); - - fwrite(&ut->tid, sizeof(uint64_t), 1, svi); - fwrite(&t->nacp, sizeof(NacpStruct), 1, svi); - fwrite(ctrlData->icon, 1, jpegSize, svi); - fclose(svi); - delete ctrlData; - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("popSVIExported", 0)); - } -} - -static void infoPanelDraw(void *a) -{ - data::userTitleInfo *d = data::getCurrentUserTitleInfo(); - data::titleInfo *t = data::getTitleInfoByTID(d->tid); - SDL_Texture *panel = (SDL_Texture *)a; - int width = 0, rectWidth = 0, iconX = 0, drawY = 310; - SDL_QueryTexture(panel, NULL, NULL, &width, 0); - rectWidth = width - 20; - - iconX = (width / 2) - 128; - gfx::texDraw(panel, data::getTitleIconByTID(d->tid), iconX, 24); - - gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, data::getTitleNameByTID(d->tid).c_str()); - drawY += 40; - - gfx::drawRect(panel, &ui::rectSh, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 4), t->author.c_str()); - drawY += 40; - - gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 0), d->tid); - drawY += 40; - - gfx::drawRect(panel, &ui::rectSh, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 1), d->saveInfo.save_data_id); - drawY += 40; - - uint32_t hours, mins; - hours = ((d->playStats.playtime / 1e+9) / 60) / 60; - mins = ((d->playStats.playtime / 1e+9) / 60) - (hours * 60); - gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 2), hours, mins); - drawY += 40; - - gfx::drawRect(panel, &ui::rectSh, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 3), d->playStats.total_launches); - drawY += 40; - - gfx::drawRect(panel, &ui::rectLt, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 5), ui::getUICString("saveDataTypeText", d->saveInfo.save_data_type)); - drawY += 40; - - uint8_t saveType = d->saveInfo.save_data_type; - if(saveType == FsSaveDataType_Cache) - { - gfx::drawRect(panel, &ui::rectSh, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 6), d->saveInfo.save_data_index); - drawY += 40; - } - - gfx::drawRect(panel, saveType == FsSaveDataType_Cache ? &ui::rectLt : &ui::rectSh, 10, drawY, rectWidth, 38); - gfx::drawTextf(panel, 18, 20, drawY + 10, &ui::txtCont, ui::getUICString("infoStatus", 7), data::getCurrentUser()->getUsername().c_str()); -} - -static void infoPanelCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - infoPanel->closePanel(); - ui::ttlOptsPanel->openPanel(); - ttlOpts->setActive(true); - ui::updateInput(); - break; - } -} - -void ui::ttlInit() -{ - ttlHelpX = 1220 - gfx::getTextWidth(ui::getUICString("helpTitle", 0), 18); - - for(data::user& u : data::users) - ttlViews.emplace_back(new ui::titleview(u, 128, 128, 16, 16, 7, ttlViewCallback)); - - ttlOpts = new ui::menu(10, 32, 390, 20, 7); - ttlOpts->setCallback(ttlOptsCallback, NULL); - ttlOpts->setActive(false); - - ttlOptsPanel = new ui::slideOutPanel(410, 720, 0, ui::SLD_RIGHT, ttlOptsPanelDraw); - ui::registerPanel(ttlOptsPanel); - - infoPanel = new ui::slideOutPanel(410, 720, 0, ui::SLD_RIGHT, infoPanelDraw); - ui::registerPanel(infoPanel); - infoPanel->setCallback(infoPanelCallback, NULL); - - ttlOpts->setActive(false); - for(int i = 0; i < 9; i++) - ttlOpts->addOpt(NULL, ui::getUIString("titleOptions", i)); - - //Information - ttlOpts->optAddButtonEvent(0, HidNpadButton_A, ttlOptsShowInfoPanel, NULL); - //Blacklist - ttlOpts->optAddButtonEvent(1, HidNpadButton_A, ttlOptsBlacklistTitle, NULL); - //Title Define - ttlOpts->optAddButtonEvent(2, HidNpadButton_A, ttlOptsDefinePath, NULL); - //File Mode - ttlOpts->optAddButtonEvent(3, HidNpadButton_A, ttlOptsToFileMode, NULL); - //Delete all backups - ttlOpts->optAddButtonEvent(4, HidNpadButton_A, ttlOptsDeleteAllBackups, NULL); - //Reset Save - ttlOpts->optAddButtonEvent(5, HidNpadButton_A, ttlOptsResetSaveData, NULL); - //Delete Save - ttlOpts->optAddButtonEvent(6, HidNpadButton_A, ttlOptsDeleteSaveData, NULL); - //Extend - ttlOpts->optAddButtonEvent(7, HidNpadButton_A, ttlOptsExtendSaveData, NULL); - //Export NACP - ttlOpts->optAddButtonEvent(8, HidNpadButton_A, ttlOptsExportSVI, NULL); -} - -void ui::ttlExit() -{ - for(ui::titleview *t : ttlViews) - delete t; - - delete ttlOptsPanel; - delete ttlOpts; - delete infoPanel; -} - -void ui::ttlSetActive(int usr, bool _set, bool _showSel) -{ - ttlViews[usr]->setActive(_set, _showSel); -} - -void ui::ttlUpdate() -{ - unsigned curUserIndex = data::getCurrentUserIndex(); - - ttlOpts->update(); - infoPanel->update(); - ui::fldUpdate(); - ttlViews[curUserIndex]->update(); -} - -void ui::ttlDraw(SDL_Texture *target) -{ - unsigned curUserIndex = data::getCurrentUserIndex(); - - mutexLock(&ttlViewLock); - ttlViews[curUserIndex]->draw(target); - mutexUnlock(&ttlViewLock); - if(ui::mstate == TTL_SEL && !fldPanel->isOpen()) - gfx::drawTextf(NULL, 18, ttlHelpX, 673, &ui::txtCont, ui::getUICString("helpTitle", 0)); -} diff --git a/src/ui/ttlview.cpp b/src/ui/ttlview.cpp deleted file mode 100644 index 03f2d11..0000000 --- a/src/ui/ttlview.cpp +++ /dev/null @@ -1,178 +0,0 @@ -#include "ui.h" -#include "ui/ttlview.h" -#include "cfg.h" - -//Todo make less hardcoded -void ui::titleTile::draw(SDL_Texture *target, int x, int y, bool sel) -{ - unsigned xScale = w * 1.28, yScale = h * 1.28; - if(sel) - { - if(wS < xScale) - wS += 18; - if(hS < yScale) - hS += 18; - } - else - { - if(wS > w) - wS -= 9; - if(hS > h) - hS -= 9; - } - - int dX = x - ((wS - w) / 2); - int dY = y - ((hS - h) / 2); - gfx::texDrawStretch(target, icon, dX, dY, wS, hS); - if(fav) - gfx::drawTextf(target, 20, dX + 8, dY + 8, &ui::heartColor, "♥"); -} - -ui::titleview::titleview(const data::user& _u, int _iconW, int _iconH, int _horGap, int _vertGap, int _rowCount, funcPtr _callback) -{ - iconW = _iconW; - iconH = _iconH; - horGap = _horGap; - vertGap = _vertGap; - rowCount = _rowCount; - callback = _callback; - u = &_u; - - for(const data::userTitleInfo& t : u->titleInfo) - tiles.emplace_back(new ui::titleTile(_iconW, _iconH, cfg::isFavorite(t.tid), data::getTitleIconByTID(t.tid))); -} - -ui::titleview::~titleview() -{ - for(ui::titleTile *t : tiles) - delete t; -} - -void ui::titleview::refresh() -{ - for(ui::titleTile *t : tiles) - delete t; - - tiles.clear(); - for(const data::userTitleInfo& t : u->titleInfo) - tiles.emplace_back(new ui::titleTile(iconW, iconH, cfg::isFavorite(t.tid), data::getTitleIconByTID(t.tid))); - - if(selected > (int)tiles.size() - 1 && selected > 0) - selected = tiles.size() - 1; -} - -void ui::titleview::update() -{ - if(selected > (int)tiles.size() - 1 && selected > 0) - selected = tiles.size() - 1; - - if(!active) - return; - - switch(ui::padKeysDown()) - { - case HidNpadButton_StickLUp: - case HidNpadButton_StickRUp: - case HidNpadButton_Up: - if((selected -= rowCount) < 0) - selected = 0; - break; - - case HidNpadButton_StickLDown: - case HidNpadButton_StickRDown: - case HidNpadButton_Down: - if((selected += rowCount) > (int)(tiles.size() - 1)) - selected = tiles.size() - 1; - break; - - case HidNpadButton_StickLLeft: - case HidNpadButton_StickRLeft: - case HidNpadButton_Left: - if(selected > 0) - --selected; - break; - - case HidNpadButton_StickLRight: - case HidNpadButton_StickRRight: - case HidNpadButton_Right: - if(selected < (int)(tiles.size() - 1)) - ++selected; - break; - - case HidNpadButton_L: - if((selected -= rowCount * 3) < 0) - selected = 0; - break; - - case HidNpadButton_R: - if((selected += rowCount * 3) > (int)(tiles.size() - 1)) - selected = tiles.size() - 1; - break; - } - - if(callback) - (*callback)(this); -} - -void ui::titleview::draw(SDL_Texture *target) -{ - if(tiles.size() <= 0) - return; - - int tH = 0, tY = 0; - SDL_QueryTexture(target, NULL, NULL, NULL, &tH); - tY = tH - 214; - if(selRectY > tY) - { - float add = ((float)tY - (float)selRectY) / ui::animScale; - y += ceil(add); - } - else if(selRectY < 38) - { - float add = (38.0f - (float)selRectY) / ui::animScale; - y += ceil(add); - } - - if(clrAdd) - { - clrShft += 6; - if(clrShft >= 0x72) - clrAdd = false; - } - else - { - clrShft -= 3; - if(clrShft <= 0) - clrAdd = true; - } - - int totalTitles = tiles.size(), selX = 32, selY = 64; - for(int tY = y, i = 0; i < totalTitles; tY += iconH + vertGap) - { - int endRow = i + rowCount; - for(int tX = x; i < endRow; tX += iconW + horGap, i++) - { - if(i >= totalTitles) - break; - - if(i == selected) - { - //save x and y for later so it's draw over top - selX = tX; - selY = tY; - selRectX = tX - 24; - selRectY = tY - 24; - } - else - tiles[i]->draw(target, tX, tY, false); - } - } - - if(showSel) - { - ui::drawBoundBox(target, selRectX, selRectY, 176, 176, clrShft); - tiles[selected]->draw(target, selX, selY, true); - } - else - tiles[selected]->draw(target, selX, selY, false); -} diff --git a/src/ui/uistr.cpp b/src/ui/uistr.cpp deleted file mode 100644 index 1da1748..0000000 --- a/src/ui/uistr.cpp +++ /dev/null @@ -1,391 +0,0 @@ -#include -#include - -#include "file.h" -#include "cfg.h" -#include "type.h" -#include "util.h" -#include "uistr.h" - -std::map, std::string> ui::strings; - -static void addUIString(const std::string& _name, int ind, const std::string& _str) -{ - ui::strings[std::make_pair(_name, ind)] = _str; -} - -static void loadTranslationFile(const std::string& path) -{ - if(fs::fileExists(path)) - { - fs::dataFile lang(path); - while(lang.readNextLine(true)) - { - std::string name = lang.getName(); - int ind = lang.getNextValueInt(); - std::string str = lang.getNextValueStr(); - addUIString(name, ind, str); - } - } -} - -static std::string getFilename(int lang) -{ - std::string filename; - switch(lang) - { - case SetLanguage_JA: - filename = "ja.txt"; - break; - - case SetLanguage_ENUS: - filename = "en-US.txt"; - break; - - case SetLanguage_FR: - filename = "fr.txt"; - break; - - case SetLanguage_DE: - filename = "de.txt"; - break; - - case SetLanguage_IT: - filename = "it.txt"; - break; - - case SetLanguage_ES: - filename = "es.txt"; - break; - - case SetLanguage_ZHCN: - case SetLanguage_ZHHANS: - filename = "zh-CN.txt"; - break; - - case SetLanguage_KO: - filename = "ko.txt"; - break; - - case SetLanguage_NL: - filename = "nl.txt"; - break; - - case SetLanguage_PT: - filename = "pt.txt"; - break; - - case SetLanguage_RU: - filename = "ru.txt"; - break; - - case SetLanguage_ZHTW: - case SetLanguage_ZHHANT: - filename += "zh-TW.txt"; - break; - - case SetLanguage_ENGB: - filename = "en-GB.txt"; - break; - - case SetLanguage_FRCA: - filename = "fr-CA.txt"; - break; - - case SetLanguage_ES419: - filename = "es-419.txt"; - break; - - case SetLanguage_PTBR: - filename = "pt-BR.txt"; - break; - } - return filename; -} - -void ui::initStrings() -{ - addUIString("author", 0, "NULL"); - addUIString("helpUser", 0, "[A] Select [Y] Dump All Saves [X] User Options"); - addUIString("helpTitle", 0, "[A] Select [L][R] Jump [Y] Favorite [X] Title Options [B] Back"); - addUIString("helpFolder", 0, "[A] Select [Y] Restore [X] Delete [ZR] Upload [B] Close"); - addUIString("helpSettings", 0, "[A] Toggle [X] Defaults [B] Back"); - - //Y/N On/Off - addUIString("dialogYes", 0, "Yes [A]"); - addUIString("dialogNo", 0, "No [B]"); - addUIString("dialogOK", 0, "OK [A]"); - addUIString("settingsOn", 0, ">On>"); - addUIString("settingsOff", 0, "Off"); - addUIString("holdingText", 0, "(Hold) "); - addUIString("holdingText", 1, "(Keep Holding) "); - addUIString("holdingText", 2, "(Almost There!) "); - - //Confirmation Strings - addUIString("confirmBlacklist", 0, "Are you sure you want to add #%s# to your blacklist?"); - addUIString("confirmOverwrite", 0, "Are you sure you want to overwrite #%s#?"); - addUIString("confirmRestore", 0, "Are you sure you want to restore #%s#?"); - addUIString("confirmDelete", 0, "Are you sure you want to delete #%s#? *This is permanent*!"); - addUIString("confirmCopy", 0, "Are you sure you want to copy #%s# to #%s#?"); - addUIString("confirmDeleteSaveData", 0, "*WARNING*: This *will* erase the save data for #%s# *from your system*. Are you sure you want to do this?"); - addUIString("confirmResetSaveData", 0, "*WARNING*: This *will* reset the save data for this game as if it was never ran before. Are you sure you want to do this?"); - addUIString("confirmCreateAllSaveData", 0, "Are you sure you would like to create all save data on this system for #%s#? This can take a while depending on how many titles are found."); - addUIString("confirmDeleteBackupsTitle", 0, "Are you sure you would like to delete all save backups for #%s#?"); - addUIString("confirmDeleteBackupsAll", 0, "Are you sure you would like to delete *all* of your save backups for all of your games?"); - addUIString("confirmDriveOverwrite", 0, "Downloading this backup from drive will overwrite the one on your SD card. Continue?"); - - //Save Data related strings - addUIString("saveDataNoneFound", 0, "No saves found for #%s#!"); - addUIString("saveDataCreatedForUser", 0, "Save data created for %s!"); - addUIString("saveDataCreationFailed", 0, "Save data creation failed!"); - addUIString("saveDataResetSuccess", 0, "Save for #%s# reset!"); - addUIString("saveDataDeleteSuccess", 0, "Save data for #%s# deleted!"); - addUIString("saveDataExtendSuccess", 0, "Save data for #%s# extended!"); - addUIString("saveDataExtendFailed", 0, "Failed to extend save data."); - addUIString("saveDataDeleteAllUser", 0, "*ARE YOU SURE YOU WANT TO DELETE ALL SAVE DATA FOR %s?*"); - addUIString("saveDataBackupDeleted", 0, "#%s# has been deleted."); - addUIString("saveDataBackupMovedToTrash", 0, "#%s# has been moved to trash."); - addUIString("saveTypeMainMenu", 0, "Device"); - addUIString("saveTypeMainMenu", 1, "BCAT"); - addUIString("saveTypeMainMenu", 2, "Cache"); - addUIString("saveTypeMainMenu", 3, "System"); - addUIString("saveTypeMainMenu", 4, "System BCAT"); - addUIString("saveTypeMainMenu", 5, "Temporary"); - //This is redundant. Need to merge and use one or the other... - addUIString("saveDataTypeText", 0, "System"); - addUIString("saveDataTypeText", 1, "Account"); - addUIString("saveDataTypeText", 2, "BCAT"); - addUIString("saveDataTypeText", 3, "Device"); - addUIString("saveDataTypeText", 4, "Temporary"); - addUIString("saveDataTypeText", 5, "Cache"); - addUIString("saveDataTypeText", 6, "System BCAT"); - - //Internet Related - addUIString("onlineErrorConnecting", 0, "Error Connecting!"); - addUIString("onlineNoUpdates", 0, "No Updates Available."); - - //File mode menu strings - addUIString("fileModeMenu", 0, "Copy To "); - addUIString("fileModeMenu", 1, "Delete"); - addUIString("fileModeMenu", 2, "Rename"); - addUIString("fileModeMenu", 3, "Make Dir"); - addUIString("fileModeMenu", 4, "Properties"); - addUIString("fileModeMenu", 5, "Close"); - addUIString("fileModeMenu", 6, "Add to Path Filters"); - addUIString("fileModeMenuMkDir", 0, "New"); - - //New folder pop menu strings - addUIString("folderMenuNew", 0, "New Backup"); - - //File mode properties string - addUIString("fileModeFileProperties", 0, "Path: %s\nSize: %s"); - addUIString("fileModeFolderProperties", 0, "Path: %s\nSub Folders: %u\nFile Count: %u\nTotal Size: %s"); - - //Settings menu - addUIString("settingsMenu", 0, "Empty Trash Bin"); - addUIString("settingsMenu", 1, "Check for Updates"); - addUIString("settingsMenu", 2, "Set JKSV Save Output Folder"); - addUIString("settingsMenu", 3, "Edit Blacklisted Titles"); - addUIString("settingsMenu", 4, "Delete All Save Backups"); - addUIString("settingsMenu", 5, "Include Device Saves With Users: "); - addUIString("settingsMenu", 6, "Auto Backup On Restore: "); - addUIString("settingsMenu", 7, "Auto-Name Backups: "); - addUIString("settingsMenu", 8, "Overclock/CPU Boost: "); - addUIString("settingsMenu", 9, "Hold To Delete: "); - addUIString("settingsMenu", 10, "Hold To Restore: "); - addUIString("settingsMenu", 11, "Hold To Overwrite: "); - addUIString("settingsMenu", 12, "Force Mount: "); - addUIString("settingsMenu", 13, "Account System Saves: "); - addUIString("settingsMenu", 14, "Enable Writing to System Saves: "); - addUIString("settingsMenu", 15, "Use FS Commands Directly: "); - addUIString("settingsMenu", 16, "Export Saves to ZIP: "); - addUIString("settingsMenu", 17, "Force English To Be Used: "); - addUIString("settingsMenu", 18, "Enable Trash Bin: "); - addUIString("settingsMenu", 19, "Title Sorting Type: "); - addUIString("settingsMenu", 20, "Animation Scale: "); - addUIString("settingsMenu", 21, "Auto-upload to Drive/Webdav: "); - - //Main menu - addUIString("mainMenuSettings", 0, "Settings"); - addUIString("mainMenuExtras", 0, "Extras"); - - // Translator in main page - addUIString("translationMainPage", 0, "Translation: "); - - //Loading page - addUIString("loadingStartPage", 0, "Loading..."); - - //Sort Strings for ^ - addUIString("sortType", 0, "Alphabetical"); - addUIString("sortType", 1, "Time Played"); - addUIString("sortType", 2, "Last Played"); - - //Extras - addUIString("extrasMenu", 0, "SD to SD Browser"); - addUIString("extrasMenu", 1, "BIS: ProdInfoF"); - addUIString("extrasMenu", 2, "BIS: Safe"); - addUIString("extrasMenu", 3, "BIS: System"); - addUIString("extrasMenu", 4, "BIS: User"); - addUIString("extrasMenu", 5, "Remove Pending Update"); - addUIString("extrasMenu", 6, "Terminate Process"); - addUIString("extrasMenu", 7, "Mount System Save"); - addUIString("extrasMenu", 8, "Rescan Titles"); - addUIString("extrasMenu", 9, "Mount Process RomFS"); - addUIString("extrasMenu", 10, "Backup JKSV Folder"); - addUIString("extrasMenu", 11, "*[DEV]* Output en-US"); - - //User Options - addUIString("userOptions", 0, "Dump All For "); - addUIString("userOptions", 1, "Create Save Data"); - addUIString("userOptions", 2, "Create All Save Data"); - addUIString("userOptions", 3, "Delete All User Saves"); - - //Title Options - addUIString("titleOptions", 0, "Information"); - addUIString("titleOptions", 1, "Blacklist"); - addUIString("titleOptions", 2, "Change Output Folder"); - addUIString("titleOptions", 3, "Open in File Mode"); - addUIString("titleOptions", 4, "Delete All Save Backups"); - addUIString("titleOptions", 5, "Reset Save Data"); - addUIString("titleOptions", 6, "Delete Save Data"); - addUIString("titleOptions", 7, "Extend Save Data"); - addUIString("titleOptions", 8, "Export SVI"); - - //Thread Status Strings - addUIString("threadStatusCreatingSaveData", 0, "Creating save data for #%s#..."); - addUIString("threadStatusCopyingFile", 0, "Copying '#%s#'..."); - addUIString("threadStatusDeletingFile", 0, "Deleting..."); - addUIString("threadStatusOpeningFolder", 0, "Opening '#%s#'..."); - addUIString("threadStatusAddingFileToZip", 0, "Adding '#%s#' to ZIP..."); - addUIString("threadStatusDecompressingFile", 0, "Decompressing '#%s#'..."); - addUIString("threadStatusDeletingSaveData", 0, "Deleting Save Data for #%s#..."); - addUIString("threadStatusExtendingSaveData", 0, "Extending Save Data for #%s#..."); - addUIString("threadStatusCreatingSaveData", 0, "Creating Save Data for #%s#..."); - addUIString("threadStatusResettingSaveData", 0, "Resetting save data..."); - addUIString("threadStatusDeletingUpdate", 0, "Deleting pending update..."); - addUIString("threadStatusCheckingForUpdate", 0, "Checking for updates..."); - addUIString("threadStatusDownloadingUpdate", 0, "Downloading update..."); - addUIString("threadStatusGetDirProps", 0, "Getting Folder Properties..."); - addUIString("threadStatusPackingJKSV", 0, "Writing JKSV folder contents to ZIP..."); - addUIString("threadStatusSavingTranslations", 0, "Saving the file master..."); - addUIString("threadStatusCalculatingSaveSize", 0, "Calculating save data size..."); - addUIString("threadStatusUploadingFile", 0, "Uploading #%s#..."); - addUIString("threadStatusDownloadingFile", 0, "Downloading #%s#..."); - addUIString("threadStatusCompressingSaveForUpload", 0, "Compressing #%s# for upload..."); - - //Random leftover pop-ups - addUIString("popCPUBoostEnabled", 0, "CPU Boost Enabled for ZIP."); - addUIString("popErrorCommittingFile", 0, "Error committing file to save!"); - addUIString("popZipIsEmpty", 0, "ZIP file is empty!"); - addUIString("popFolderIsEmpty", 0, "Folder is empty!"); - addUIString("popSaveIsEmpty", 0, "Save data is empty!"); - addUIString("popProcessShutdown", 0, "#%s# successfully shutdown."); - addUIString("popAddedToPathFilter", 0, "'#%s#' added to path filters."); - addUIString("popChangeOutputFolder", 0, "#%s# changed to #%s#"); - addUIString("popChangeOutputError", 0, "#%s# contains illegal or non-ASCII characters."); - addUIString("popTrashEmptied", 0, "Trash emptied"); - addUIString("popSVIExported", 0, "SVI Exported."); - addUIString("popDriveStarted", 0, "Google Drive started successfully."); - addUIString("popDriveFailed", 0, "Failed to start Google Drive."); - addUIString("popRemoteNotActive", 0, "Remote is not available"); - addUIString("popWebdavStarted", 0, "Webdav started successfully."); - addUIString("popWebdavFailed", 0, "Failed to start Webdav."); - - //Keyboard hints - addUIString("swkbdEnterName", 0, "Enter a new name"); - addUIString("swkbdSaveIndex", 0, "Enter Cache Index"); - addUIString("swkbdSetWorkDir", 0, "Enter a new Output Path"); - addUIString("swkbdProcessID", 0, "Enter Process ID"); - addUIString("swkbdSysSavID", 0, "Enter System Save ID"); - addUIString("swkbdRename", 0, "Enter a new name for item"); - addUIString("swkbdMkDir", 0, "Enter a folder name"); - addUIString("swkbdNewSafeTitle", 0, "Input New Output Folder"); - addUIString("swkbdExpandSize", 0, "Enter New Size in MB"); - - //Status informations - addUIString("infoStatus", 0, "TID: %016lX"); - addUIString("infoStatus", 1, "SID: %016lX"); - addUIString("infoStatus", 2, "Play Time: %02d:%02d"); - addUIString("infoStatus", 3, "Total Launches: %u"); - addUIString("infoStatus", 4, "Publisher: %s"); - addUIString("infoStatus", 5, "Save Type: %s"); - addUIString("infoStatus", 6, "Cache Index: %u"); - addUIString("infoStatus", 7, "User: %s"); - - addUIString("debugStatus", 0, "User Count: "); - addUIString("debugStatus", 1, "Current User: "); - addUIString("debugStatus", 2, "Current Title: "); - addUIString("debugStatus", 3, "Safe Title: "); - addUIString("debugStatus", 4, "Sort Type: "); - - addUIString("appletModeWarning", 0, "*WARNING*: You are running JKSV in applet mode. Certain functions may not work."); -} - -void ui::loadTrans() -{ - std::string transTestFile = fs::getWorkDir() + "trans.txt"; - std::string translationFile = "romfs:/lang/" + getFilename(data::sysLang); - bool transFile = fs::fileExists(transTestFile); - if(!transFile && (data::sysLang == SetLanguage_ENUS || data::sysLang == SetLanguage_ENGB || cfg::config["langOverride"])) - ui::initStrings(); - else if(transFile) - loadTranslationFile(transTestFile); - else - loadTranslationFile(translationFile); - - util::replaceButtonsInString(ui::strings[std::make_pair("helpUser", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("helpTitle", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("helpFolder", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("helpSettings", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("dialogYes", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("dialogNo", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("dialogOK", 0)]); - util::replaceButtonsInString(ui::strings[std::make_pair("appletModeWarning", 0)]); -} - -void ui::saveTranslationFiles(void *a) -{ - threadInfo *t = (threadInfo *)a; - t->status->setStatus(ui::getUICString("infoStatus", 9)); - - std::string outputFolder = fs::getWorkDir() + "lang", outputPath, romfsPath; - fs::mkDir(outputFolder); - - //Save en-us first - ui::initStrings(); - outputPath = fs::getWorkDir() + "lang/" + getFilename(SetLanguage_ENUS); - FILE *out = fopen(outputPath.c_str(), "w"); - for(auto& s : ui::strings) - { - std::string stringOut = s.second; - util::replaceStr(stringOut, "\n", "\\n"); - fprintf(out, "%s = %i, \"%s\"\n", s.first.first.c_str(), s.first.second, stringOut.c_str()); - } - fclose(out); - - romfsInit(); - for(int i = 0; i < SetLanguage_Total; i++) - { - if(i == SetLanguage_ENUS) - continue; - - outputPath = fs::getWorkDir() + "lang/" + getFilename(i); - romfsPath = "romfs:/lang/" + getFilename(i); - - //Init original US English strings, then load translation over it. Result will be mixed file. - ui::initStrings(); - loadTranslationFile(romfsPath); - - out = fopen(outputPath.c_str(), "w"); - for(auto& s : ui::strings) - { - std::string stringOut = s.second; - util::replaceStr(stringOut, "\n", "\\n"); - fprintf(out, "%s = %i, \"%s\"\n", s.first.first.c_str(), s.first.second, stringOut.c_str()); - } - fclose(out); - } - loadTrans(); - romfsExit(); - t->finished = true; -} diff --git a/src/ui/usr.cpp b/src/ui/usr.cpp deleted file mode 100644 index 345d90b..0000000 --- a/src/ui/usr.cpp +++ /dev/null @@ -1,491 +0,0 @@ -#include -#include -#include -#include - -#include "file.h" -#include "data.h" -#include "ui.h" -#include "util.h" -#include "type.h" - -#include "usr.h" -#include "ttl.h" - -static const char *settText = ui::getUICString("mainMenuSettings", 0), *extText = ui::getUICString("mainMenuExtras", 0); - -//Main menu/Users + options, folder -ui::menu *ui::usrMenu; -ui::slideOutPanel *ui::usrSelPanel; - -static ui::menu *usrOptMenu, *saveCreateMenu, *deviceSaveMenu, *bcatSaveMenu, *cacheSaveMenu; -//All save types have different entries. -static ui::slideOutPanel *usrOptPanel, *saveCreatePanel, *deviceSavePanel, *bcatSavePanel, *cacheSavePanel; - -//Icons for settings + extras -static SDL_Texture *sett, *ext; - -//This stores save ids to match with saveCreateMenu -//Probably needs/should be changed -static std::vector accSids, devSids, bcatSids, cacheSids; - -static unsigned usrHelpX = 0; - -//Sort save create tids alphabetically by title from data -static struct -{ - bool operator()(const uint64_t& tid1, const uint64_t& tid2) - { - std::string tid1Title = data::getTitleNameByTID(tid1); - std::string tid2Title = data::getTitleNameByTID(tid2); - - uint32_t pointA = 0, pointB = 0; - for(unsigned i = 0, j = 0; i < tid1Title.length(); ) - { - ssize_t tid1Cnt = decode_utf8(&pointA, (const uint8_t *)&tid1Title.c_str()[i]); - ssize_t tid2Cnt = decode_utf8(&pointB, (const uint8_t *)&tid2Title.c_str()[j]); - - pointA = tolower(pointA), pointB = tolower(pointB); - if(pointA != pointB) - return pointA < pointB; - - i += tid1Cnt, j += tid2Cnt; - } - return false; - } -} sortCreateTIDs; - -static void onMainChange(void *a) -{ - if(ui::usrMenu->getSelected() < (int)data::users.size()) - { - unsigned setUser = ui::usrMenu->getSelected(); - data::setUserIndex(setUser); - } -} - -static void _usrSelPanelDraw(void *a) -{ - SDL_Texture *target = (SDL_Texture *)a; - gfx::texDraw(target, ui::sideBar, 0, 0); - ui::usrMenu->draw(target, &ui::txtCont, false); -} - -static void toOPT(void *a) -{ - ui::changeState(OPT_MNU); - ui::usrMenu->setActive(false); - ui::settMenu->setActive(true); -} - -static void toEXT(void *a) -{ - ui::changeState(EX_MNU); - ui::usrMenu->setActive(false); - ui::extMenu->setActive(true); -} - -static void usrOptCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - usrOptPanel->closePanel(); - ui::usrMenu->setActive(true); - usrOptMenu->setActive(false); - break; - } -} - -static void saveCreateCallback(void *a) -{ - switch(ui::padKeysDown()) - { - case HidNpadButton_B: - usrOptMenu->setActive(true); - usrOptPanel->openPanel(); - saveCreateMenu->setActive(false); - saveCreatePanel->closePanel(); - deviceSaveMenu->setActive(false); - deviceSavePanel->closePanel(); - bcatSaveMenu->setActive(false); - bcatSavePanel->closePanel(); - cacheSaveMenu->setActive(false); - cacheSavePanel->closePanel(); - break; - } -} - -static void usrOptSaveCreate(void *a) -{ - ui::menu *m = (ui::menu *)a; - int devPos = m->getOptPos(ui::getUICString("saveTypeMainMenu", 0)); - int bcatPos = m->getOptPos(ui::getUICString("saveTypeMainMenu", 1)); - int cachePos = m->getOptPos(ui::getUICString("saveTypeMainMenu", 2)); - - ui::updateInput(); - int sel = m->getSelected(); - bool closeUsrOpt = false; - if(sel == devPos && deviceSaveMenu->getOptCount() > 0) - { - deviceSaveMenu->setActive(true); - deviceSavePanel->openPanel(); - closeUsrOpt = true; - } - else if(sel == bcatPos && bcatSaveMenu->getOptCount() > 0) - { - bcatSaveMenu->setActive(true); - bcatSavePanel->openPanel(); - closeUsrOpt = true; - } - else if(sel == cachePos && cacheSaveMenu->getOptCount() > 0) - { - cacheSaveMenu->setActive(true); - cacheSavePanel->openPanel(); - closeUsrOpt = true; - } - else if(sel < devPos) - { - saveCreateMenu->setActive(true); - saveCreatePanel->openPanel(); - closeUsrOpt = true; - } - - if(closeUsrOpt) - { - usrOptMenu->setActive(false); - usrOptPanel->closePanel(); - } -} - -//nsDeleteUserSaveDataAll only works if the user is selected at system level -static void usrOptDeleteAllUserSaves_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - data::user *u = data::getCurrentUser(); - int curUserIndex = data::getCurrentUserIndex(); - int devUser = ui::usrMenu->getOptPos(ui::getUICString("saveTypeMainMenu", 0)); - - for(data::userTitleInfo& tinf : u->titleInfo) - { - if(tinf.saveInfo.save_data_type != FsSaveDataType_System && (tinf.saveInfo.save_data_type != FsSaveDataType_Device || curUserIndex == devUser)) - { - t->status->setStatus(ui::getUICString("threadStatusDeletingSaveData", 0), data::getTitleNameByTID(tinf.tid).c_str()); - fsDeleteSaveDataFileSystemBySaveDataSpaceId(FsSaveDataSpaceId_User, tinf.saveInfo.save_data_id); - } - } - data::loadUsersTitles(false); - ui::ttlRefresh(); - t->finished = true; -} - -static void usrOptDeleteAllUserSaves(void *a) -{ - data::user *u = data::getCurrentUser(); - ui::confirmArgs *conf = ui::confirmArgsCreate(true, usrOptDeleteAllUserSaves_t, NULL, NULL, ui::getUICString("saveDataDeleteAllUser", 0), u->getUsername().c_str()); - ui::confirm(conf); -} - -static void usrOptPanelDraw(void *a) -{ - SDL_Texture *panel = (SDL_Texture *)a; - usrOptMenu->draw(panel, &ui::txtCont, true); -} - -static void saveCreatePanelDraw(void *a) -{ - SDL_Texture *panel = (SDL_Texture *)a; - saveCreateMenu->draw(panel, &ui::txtCont, true); -} - -static void deviceSavePanelDraw(void *a) -{ - SDL_Texture *panel = (SDL_Texture *)a; - deviceSaveMenu->draw(panel, &ui::txtCont, true); -} - -static void bcatSavePanelDraw(void *a) -{ - SDL_Texture *panel = (SDL_Texture *)a; - bcatSaveMenu->draw(panel, &ui::txtCont, true); -} - -static void cacheSavePanelDraw(void *a) -{ - SDL_Texture *panel = (SDL_Texture *)a; - cacheSaveMenu->draw(panel, &ui::txtCont, true); -} - -static void usrOptDumpAllUserSaves(void *a) -{ - ui::newThread(fs::dumpAllUserSaves, NULL, fs::fileDrawFunc); -} - -static void createSaveData(void *a) -{ - data::user *u = data::getCurrentUser(); - u128 uid = u->getUID128(); - - //Device, BCAT, and Cache are hardcoded user IDs in JKSV's data - uint64_t tid = 0; - switch(uid) - { - case 0://This is system - break; - - case 2: - tid = bcatSids[bcatSaveMenu->getSelected()]; - fs::createSaveDataThreaded(FsSaveDataType_Bcat, tid, util::u128ToAccountUID(0)); - break; - - case 3: - tid = devSids[deviceSaveMenu->getSelected()]; - fs::createSaveDataThreaded(FsSaveDataType_Device, tid, util::u128ToAccountUID(0)); - break; - - case 5: - tid = cacheSids[cacheSaveMenu->getSelected()]; - fs::createSaveDataThreaded(FsSaveDataType_Cache, tid, util::u128ToAccountUID(0)); - break; - - default: - tid = accSids[saveCreateMenu->getSelected()]; - fs::createSaveDataThreaded(FsSaveDataType_Account, tid, u->getUID()); - break; - } -} - -static void usrOptCreateAllSaves_t(void *a) -{ - threadInfo *t = (threadInfo *)a; - data::user *u = data::getCurrentUser(); - int devPos = ui::usrMenu->getOptPos(ui::getUICString("saveTypeMainMenu", 0)); - int bcatPos = ui::usrMenu->getOptPos(ui::getUICString("saveTypeMainMenu", 1)); - int sel = ui::usrMenu->getSelected(); - if(sel < devPos) - { - AccountUid uid = u->getUID(); - for(unsigned i = 0; i < accSids.size(); i++) - fs::createSaveData(FsSaveDataType_Account, accSids[i], uid, t); - } - else if(sel == devPos) - { - for(unsigned i = 0; i < devSids.size(); i++) - fs::createSaveData(FsSaveDataType_Device, devSids[i], util::u128ToAccountUID(0), t); - } - else if(sel == bcatPos) - { - for(unsigned i = 0; i < bcatSids.size(); i++) - fs::createSaveData(FsSaveDataType_Bcat, bcatSids[i], util::u128ToAccountUID(0), t); - } - t->finished = true; -} - -static void usrOptCreateAllSaves(void *a) -{ - data::user *u = data::getCurrentUser(); - ui::confirmArgs *conf = ui::confirmArgsCreate(true, usrOptCreateAllSaves_t, NULL, NULL, ui::getUICString("confirmCreateAllSaveData", 0), u->getUsername().c_str()); - ui::confirm(conf); -} - -//Sets up save create menus -static void initSaveCreateMenus() -{ - saveCreateMenu->reset(); - deviceSaveMenu->reset(); - bcatSaveMenu->reset(); - cacheSaveMenu->reset(); - - accSids.clear(); - devSids.clear(); - bcatSids.clear(); - cacheSids.clear(); - - //Group into vectors to match - for(auto& t : data::titles) - { - NacpStruct *nacp = &t.second.nacp; - - if(nacp->user_account_save_data_size > 0) - accSids.push_back(t.first); - - if(nacp->device_save_data_size > 0) - devSids.push_back(t.first); - - if(nacp->bcat_delivery_cache_storage_size > 0) - bcatSids.push_back(t.first); - - if(nacp->cache_storage_size > 0 || nacp->cache_storage_journal_size > 0 || nacp->cache_storage_data_and_journal_size_max > 0) - cacheSids.push_back(t.first); - } - - //Sort them alphabetically - std::sort(accSids.begin(), accSids.end(), sortCreateTIDs); - std::sort(devSids.begin(), devSids.end(), sortCreateTIDs); - std::sort(bcatSids.begin(), bcatSids.end(), sortCreateTIDs); - std::sort(cacheSids.begin(), cacheSids.end(), sortCreateTIDs); - - for(unsigned i = 0; i < accSids.size(); i++) - { - saveCreateMenu->addOpt(NULL, data::getTitleNameByTID(accSids[i])); - saveCreateMenu->optAddButtonEvent(i, HidNpadButton_A, createSaveData, NULL); - } - - for(unsigned i = 0; i < devSids.size(); i++) - { - deviceSaveMenu->addOpt(NULL, data::getTitleNameByTID(devSids[i])); - deviceSaveMenu->optAddButtonEvent(i, HidNpadButton_A, createSaveData, NULL); - } - - for(unsigned i = 0; i < bcatSids.size(); i++) - { - bcatSaveMenu->addOpt(NULL, data::getTitleNameByTID(bcatSids[i])); - bcatSaveMenu->optAddButtonEvent(i, HidNpadButton_A, createSaveData, NULL); - } - - for(unsigned i = 0; i < cacheSids.size(); i++) - { - cacheSaveMenu->addOpt(NULL, data::getTitleNameByTID(cacheSids[i])); - cacheSaveMenu->optAddButtonEvent(i, HidNpadButton_A, createSaveData, NULL); - } -} - -void ui::usrInit() -{ - usrMenu = new ui::menu(50, 16, 0, 112, 1); - usrOptMenu = new ui::menu(8, 32, 390, 20, 6); - saveCreateMenu = new ui::menu(8, 32, 492, 20, 6); - deviceSaveMenu = new ui::menu(8, 32, 492, 20, 6); - bcatSaveMenu = new ui::menu(8, 32, 492, 20, 6); - cacheSaveMenu = new ui::menu(8, 32, 492, 20, 6); - - usrOptMenu->setCallback(usrOptCallback, NULL); - - saveCreateMenu->setActive(false); - saveCreateMenu->setCallback(saveCreateCallback, NULL); - - deviceSaveMenu->setActive(false); - deviceSaveMenu->setCallback(saveCreateCallback, NULL); - - bcatSaveMenu->setActive(false); - bcatSaveMenu->setCallback(saveCreateCallback, NULL); - - cacheSaveMenu->setActive(false); - cacheSaveMenu->setCallback(saveCreateCallback, NULL); - - for(data::user u : data::users) - { - int usrPos = usrMenu->addOpt(u.getUserIcon(), u.getUsername()); - usrMenu->optAddButtonEvent(usrPos, HidNpadButton_A, toTTL, NULL); - } - - sett = util::createIconGeneric(settText, 48, false); - int pos = usrMenu->addOpt(sett, settText); - usrMenu->optAddButtonEvent(pos, HidNpadButton_A, toOPT, NULL); - - ext = util::createIconGeneric(extText, 48, false); - pos = usrMenu->addOpt(ext, extText); - usrMenu->optAddButtonEvent(pos, HidNpadButton_A, toEXT, NULL); - - usrMenu->setOnChangeFunc(onMainChange); - usrMenu->editParam(MENU_RECT_WIDTH, 142); - usrMenu->editParam(MENU_RECT_HEIGHT, 130); - - usrSelPanel = new ui::slideOutPanel(200, 559, 89, ui::SLD_LEFT, _usrSelPanelDraw); - usrSelPanel->setX(0); - ui::registerPanel(usrSelPanel); - usrSelPanel->openPanel(); - - usrOptPanel = new ui::slideOutPanel(410, 720, 0, ui::SLD_RIGHT, usrOptPanelDraw); - ui::registerPanel(usrOptPanel); - - for(int i = 0; i < 4; i++) - usrOptMenu->addOpt(NULL, ui::getUIString("userOptions", i)); - - //Dump All User Saves - usrOptMenu->optAddButtonEvent(0, HidNpadButton_A, usrOptDumpAllUserSaves, NULL); - //Create Save Data - usrOptMenu->optAddButtonEvent(1, HidNpadButton_A, usrOptSaveCreate, usrMenu); - //Create All - usrOptMenu->optAddButtonEvent(2, HidNpadButton_A, usrOptCreateAllSaves, NULL); - //Delete All - usrOptMenu->optAddButtonEvent(3, HidNpadButton_A, usrOptDeleteAllUserSaves, NULL); - usrOptMenu->setActive(false); - - saveCreatePanel = new ui::slideOutPanel(512, 720, 0, ui::SLD_RIGHT, saveCreatePanelDraw); - ui::registerPanel(saveCreatePanel); - - deviceSavePanel = new ui::slideOutPanel(512, 720, 0, ui::SLD_RIGHT, deviceSavePanelDraw); - ui::registerPanel(deviceSavePanel); - - bcatSavePanel = new ui::slideOutPanel(512, 720, 0, ui::SLD_RIGHT, bcatSavePanelDraw); - ui::registerPanel(bcatSavePanel); - - cacheSavePanel = new ui::slideOutPanel(512, 720, 0, ui::SLD_RIGHT, cacheSavePanelDraw); - ui::registerPanel(cacheSavePanel); - - initSaveCreateMenus(); - - usrHelpX = 1220 - gfx::getTextWidth(ui::getUICString("helpUser", 0), 18); -} - -void ui::usrExit() -{ - delete usrSelPanel; - delete usrOptPanel; - delete saveCreatePanel; - delete deviceSavePanel; - delete bcatSavePanel; - delete cacheSavePanel; - - delete usrMenu; - delete usrOptMenu; - delete saveCreateMenu; - delete deviceSaveMenu; - delete bcatSaveMenu; - delete cacheSaveMenu; -} - -void ui::usrRefresh() -{ - initSaveCreateMenus(); -} - -void ui::usrUpdate() -{ - if(usrMenu->getActive()) - { - switch(ui::padKeysDown()) - { - case HidNpadButton_Y: - ui::newThread(fs::dumpAllUsersAllSaves, NULL, fs::fileDrawFunc); - break; - - case HidNpadButton_X: - { - int cachePos = usrMenu->getOptPos(ui::getUIString("saveTypeMainMenu", 2)); - if(usrMenu->getSelected() <= cachePos) - { - data::user *u = data::getCurrentUser(); - usrOptMenu->editOpt(0, NULL, ui::getUIString("userOptions", 0) + u->getUsername()); - usrOptMenu->setActive(true); - usrMenu->setActive(false); - usrOptPanel->openPanel(); - } - } - break; - } - } - usrMenu->update(); - usrOptMenu->update(); - saveCreateMenu->update(); - deviceSaveMenu->update(); - bcatSaveMenu->update(); - cacheSaveMenu->update(); -} - -void ui::usrDraw(SDL_Texture *target) -{ - if(ui::mstate == USR_SEL) - gfx::drawTextf(NULL, 18, usrHelpX, 673, &ui::txtCont, ui::getUICString("helpUser", 0)); -} diff --git a/src/util.cpp b/src/util.cpp deleted file mode 100644 index faaefd0..0000000 --- a/src/util.cpp +++ /dev/null @@ -1,420 +0,0 @@ -#include -#include -#include -#include -#include - -#include "file.h" -#include "data.h" -#include "gfx.h" -#include "util.h" -#include "ui.h" -#include "curlfuncs.h" -#include "type.h" -#include "cfg.h" - -static const uint32_t verboten[] = { L',', L'/', L'\\', L'<', L'>', L':', L'"', L'|', L'?', L'*', L'™', L'©', L'®'}; - -static bool isVerboten(const uint32_t& t) -{ - for(unsigned i = 0; i < 13; i++) - { - if(t == verboten[i]) - return true; - } - - return false; -} - -void util::replaceStr(std::string& _str, const std::string& _find, const std::string& _rep) -{ - size_t pos = 0; - while((pos = _str.find(_find)) != _str.npos) - _str.replace(pos, _find.length(), _rep); -} - -//Used to split version tag git -static void getVersionFromTag(const std::string& tag, unsigned& _year, unsigned& _month, unsigned& _day) -{ - _month = strtoul(tag.substr(0, 2).c_str(), NULL, 10); - _day = strtoul(tag.substr(3, 5).c_str(), NULL, 10); - _year = strtoul(tag.substr(6, 10).c_str(), NULL, 10); -} - -//Missing swkbd config funcs for now -typedef enum -{ - SwkbdPosStart = 0, - SwkbdPosEnd = 1 -} SwkbdInitPos; - -typedef struct -{ - uint16_t read[0x32 / sizeof(uint16_t)]; - uint16_t word[0x32 / sizeof(uint16_t)]; -} dictWord; - -void swkbdDictWordCreate(dictWord *w, const char *read, const char *word) -{ - memset(w, 0, sizeof(*w)); - - utf8_to_utf16(w->read, (uint8_t *)read, (sizeof(w->read) / sizeof(uint16_t)) - 1); - utf8_to_utf16(w->word, (uint8_t *)word, (sizeof(w->word) / sizeof(uint16_t)) - 1); -} - -uint32_t replaceChar(uint32_t c) -{ - switch(c) - { - case L'é': - return 'e'; - break; - } - - return c; -} - -static inline void replaceCharCStr(char *_s, char _find, char _rep) -{ - size_t strLength = strlen(_s); - for(unsigned i = 0; i < strLength; i++) - { - if(_s[i] == _find) - _s[i] = _rep; - } -} - -std::string util::getDateTime(int fmt) -{ - char ret[128]; - - time_t raw; - time(&raw); - tm *Time = localtime(&raw); - - switch(fmt) - { - case DATE_FMT_YMD: - sprintf(ret, "%04d.%02d.%02d @ %02d.%02d.%02d", Time->tm_year + 1900, Time->tm_mon + 1, Time->tm_mday, Time->tm_hour, Time->tm_min, Time->tm_sec); - break; - - case DATE_FMT_YDM: - sprintf(ret, "%04d.%02d.%02d @ %02d.%02d.%02d", Time->tm_year + 1900, Time->tm_mday, Time->tm_mon + 1, Time->tm_hour, Time->tm_min, Time->tm_sec); - break; - - case DATE_FMT_HOYSTE: - sprintf(ret, "%02d.%02d.%04d", Time->tm_mday, Time->tm_mon + 1, Time->tm_year + 1900); - break; - - case DATE_FMT_JHK: - sprintf(ret, "%04d%02d%02d_%02d%02d", Time->tm_year + 1900, Time->tm_mon + 1, Time->tm_mday, Time->tm_hour, Time->tm_min); - break; - - case DATE_FMT_ASC: - strcpy(ret, asctime(Time)); - replaceCharCStr(ret, ':', '_'); - replaceCharCStr(ret, '\n', 0x00); - break; - } - - return std::string(ret); -} - -void util::copyDirListToMenu(const fs::dirList& d, ui::menu& m) -{ - m.reset(); - m.addOpt(NULL, "."); - m.addOpt(NULL, ".."); - for(unsigned i = 0; i < d.getCount(); i++) - { - if(d.isDir(i)) - m.addOpt(NULL, "D " + d.getItem(i)); - else - m.addOpt(NULL, "F " + d.getItem(i)); - } -} - -void util::removeLastFolderFromString(std::string& _path) -{ - unsigned last = _path.find_last_of('/', _path.length() - 2); - _path.erase(last + 1, _path.length()); -} - -size_t util::getTotalPlacesInPath(const std::string& _path) -{ - //Skip device - size_t pos = _path.find_first_of('/'), ret = 0; - while((pos = _path.find_first_of('/', ++pos)) != _path.npos) - ++ret; - return ret; -} - -void util::trimPath(std::string& _path, uint8_t _places) -{ - size_t pos = _path.find_first_of('/'); - for(int i = 0; i < _places; i++) - pos = _path.find_first_of('/', ++pos); - _path = _path.substr(++pos, _path.npos); -} - -std::string util::safeString(const std::string& s) -{ - std::string ret = ""; - for(unsigned i = 0; i < s.length(); ) - { - uint32_t tmpChr = 0; - ssize_t untCnt = decode_utf8(&tmpChr, (uint8_t *)&s.data()[i]); - - i += untCnt; - - tmpChr = replaceChar(tmpChr); - - if(isVerboten(tmpChr)) - ret += ' '; - else if(!isASCII(tmpChr)) - return ""; //return empty string so titledata::init defaults to titleID - else - ret += (char)tmpChr; - } - - //Check for spaces at end - while(ret[ret.length() - 1] == ' ' || ret[ret.length() - 1] == '.') - ret.erase(ret.length() - 1, 1); - - return ret; -} - -static inline std::string getTimeString(const uint32_t& _h, const uint32_t& _m) -{ - char tmp[32]; - sprintf(tmp, "%02d:%02d", _h, _m); - return std::string(tmp); -} - -std::string util::getStringInput(SwkbdType _type, const std::string& def, const std::string& head, size_t maxLength, unsigned dictCnt, const std::string dictWords[]) -{ - SwkbdConfig swkbd; - swkbdCreate(&swkbd, dictCnt); - swkbdConfigSetBlurBackground(&swkbd, true); - swkbdConfigSetInitialText(&swkbd, def.c_str()); - swkbdConfigSetHeaderText(&swkbd, head.c_str()); - swkbdConfigSetGuideText(&swkbd, head.c_str()); - swkbdConfigSetInitialCursorPos(&swkbd, SwkbdPosEnd); - swkbdConfigSetType(&swkbd, _type); - swkbdConfigSetStringLenMax(&swkbd, maxLength); - swkbdConfigSetKeySetDisableBitmask(&swkbd, SwkbdKeyDisableBitmask_Backslash | SwkbdKeyDisableBitmask_Percent); - swkbdConfigSetDicFlag(&swkbd, 1); - - if(dictCnt > 0) - { - dictWord words[dictCnt]; - for(unsigned i = 0; i < dictCnt; i++) - swkbdDictWordCreate(&words[i], dictWords[i].c_str(), dictWords[i].c_str()); - - swkbdConfigSetDictionary(&swkbd, (SwkbdDictWord *)words, dictCnt); - } - - char out[maxLength + 1]; - memset(out, 0, maxLength + 1); - swkbdShow(&swkbd, out, maxLength + 1); - swkbdClose(&swkbd); - - return std::string(out); -} - -std::string util::getExtensionFromString(const std::string& get) -{ - size_t ext = get.find_last_of('.'); - if(ext != get.npos) - return get.substr(ext + 1, get.npos); - else - return ""; -} - -std::string util::getFilenameFromPath(const std::string& get) -{ - size_t nameStart = get.find_last_of('/'); - if(nameStart != get.npos) - return get.substr(nameStart + 1, get.npos); - else - return ""; -} - -std::string util::generateAbbrev(const uint64_t& tid) -{ - data::titleInfo *tmp = data::getTitleInfoByTID(tid); - size_t titleLength = tmp->safeTitle.length(); - - char temp[titleLength + 1]; - memset(temp, 0, titleLength + 1); - memcpy(temp, tmp->safeTitle.c_str(), titleLength); - - std::string ret; - char *tok = strtok(temp, " "); - while(tok) - { - if(isASCII(tok[0])) - ret += tok[0]; - tok = strtok(NULL, " "); - } - return ret; -} - -void util::stripChar(char _c, std::string& _s) -{ - size_t pos = 0; - while((pos = _s.find(_c)) != _s.npos) - _s.erase(pos, 1); -} - -void util::replaceButtonsInString(std::string& rep) -{ - replaceStr(rep, "[A]", "\ue0e0"); - replaceStr(rep, "[B]", "\ue0e1"); - replaceStr(rep, "[X]", "\ue0e2"); - replaceStr(rep, "[Y]", "\ue0e3"); - replaceStr(rep, "[L]", "\ue0e4"); - replaceStr(rep, "[R]", "\ue0e5"); - replaceStr(rep, "[ZL]", "\ue0e6"); - replaceStr(rep, "[ZR]", "\ue0e7"); - replaceStr(rep, "[SL]", "\ue0e8"); - replaceStr(rep, "[SR]", "\ue0e9"); - replaceStr(rep, "[DPAD]", "\ue0ea"); - replaceStr(rep, "[DUP]", "\ue0eb"); - replaceStr(rep, "[DDOWN]", "\ue0ec"); - replaceStr(rep, "[DLEFT]", "\ue0ed"); - replaceStr(rep, "[DRIGHT]", "\ue0ee"); - replaceStr(rep, "[+]", "\ue0ef"); - replaceStr(rep, "[-]", "\ue0f0"); -} - -SDL_Texture *util::createIconGeneric(const char *txt, int fontSize, bool clearBack) -{ - SDL_Texture *ret = gfx::texMgr->textureCreate(256, 256); - SDL_SetRenderTarget(gfx::render, ret); - if(clearBack) - { - SDL_SetRenderDrawColor(gfx::render, ui::rectLt.r, ui::rectLt.g, ui::rectLt.b, ui::rectLt.a); - SDL_RenderClear(gfx::render); - } - else - gfx::clearTarget(ret, &ui::transparent); - - unsigned int x = 128 - (gfx::getTextWidth(txt, fontSize) / 2); - unsigned int y = 128 - (fontSize / 2); - gfx::drawTextf(ret, fontSize, x, y, &ui::txtCont, txt); - SDL_SetRenderTarget(gfx::render, NULL); - SDL_SetTextureBlendMode(ret, SDL_BLENDMODE_BLEND); - return ret; -} - -void util::sysBoost() -{ - if(R_FAILED(clkrstInitialize())) - return; - - ClkrstSession cpu, gpu, ram; - clkrstOpenSession(&cpu, PcvModuleId_CpuBus, 3); - clkrstOpenSession(&gpu, PcvModuleId_GPU, 3); - clkrstOpenSession(&ram, PcvModuleId_EMC, 3); - - clkrstSetClockRate(&cpu, util::CPU_SPEED_1785MHz); - clkrstSetClockRate(&gpu, util::GPU_SPEED_76MHz); - clkrstSetClockRate(&ram, util::RAM_SPEED_1600MHz); - - clkrstCloseSession(&cpu); - clkrstCloseSession(&gpu); - clkrstCloseSession(&ram); - clkrstExit(); -} - -void util::sysNormal() -{ - if(R_FAILED(clkrstInitialize())) - return; - - ClkrstSession cpu, gpu, ram; - clkrstOpenSession(&cpu, PcvModuleId_CpuBus, 3); - clkrstOpenSession(&gpu, PcvModuleId_GPU, 3); - clkrstOpenSession(&ram, PcvModuleId_EMC, 3); - - if(cfg::config["ovrClk"]) - clkrstSetClockRate(&cpu, util::CPU_SPEED_1224MHz); - else - clkrstSetClockRate(&cpu, util::CPU_SPEED_1020MHz); - clkrstSetClockRate(&gpu, util::GPU_SPEED_76MHz); - clkrstSetClockRate(&ram, util::RAM_SPEED_1331MHz); - - clkrstCloseSession(&cpu); - clkrstCloseSession(&gpu); - clkrstCloseSession(&ram); - clkrstExit(); - -} - -void util::checkForUpdate(void *a) -{ - threadInfo *t = (threadInfo *)a; - t->status->setStatus(ui::getUICString("threadStatusCheckingForUpdate", 0)); - std::string gitJson = curlFuncs::getJSONURL(NULL, "https://api.github.com/repos/J-D-K/JKSV/releases/latest"); - if(gitJson.empty()) - { - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("onlineErrorConnecting", 0)); - t->finished = true; - return; - } - - std::string tagStr; - unsigned month, day, year; - json_object *jobj = json_tokener_parse(gitJson.c_str()), *tag; - json_object_object_get_ex(jobj, "tag_name", &tag); - tagStr = json_object_get_string(tag); - getVersionFromTag(tagStr, year, month, day); - //This can throw false positives as is. need to fix sometime - if(year > BLD_YEAR || month > BLD_MON || month > BLD_DAY) - { - t->status->setStatus(ui::getUICString("threadStatusDownloadingUpdate", 0)); - //dunno about NSP yet... - json_object *assets, *asset0, *dlUrl; - json_object_object_get_ex(jobj, "assets", &assets); - asset0 = json_object_array_get_idx(assets, 0); - json_object_object_get_ex(asset0, "browser_download_url", &dlUrl); - - std::vector jksvBuff; - std::string url = json_object_get_string(dlUrl); - curlFuncs::getBinURL(&jksvBuff, url); - FILE *jksvOut = fopen("sdmc:/switch/JKSV.nro", "wb"); - fwrite(jksvBuff.data(), 1, jksvBuff.size(), jksvOut); - fclose(jksvOut); - } - else - ui::showPopMessage(POP_FRAME_DEFAULT, ui::getUICString("onlineNoUpdates", 0)); - - json_object_put(jobj); - t->finished = true; -} - -std::string util::getSizeString(const uint64_t& _size) -{ - char sizeStr[32]; - if(_size >= 0x40000000) - sprintf(sizeStr, "%.2fGB", (float)_size / 1024.0f / 1024.0f / 1024.0f); - else if(_size >= 0x100000) - sprintf(sizeStr, "%.2fMB", (float)_size / 1024.0f / 1024.0f); - else if(_size >= 0x400) - sprintf(sizeStr, "%.2fKB", (float)_size / 1024.0f); - else - sprintf(sizeStr, "%lu Bytes", _size); - return std::string(sizeStr); -} - -Result util::accountDeleteUser(AccountUid *uid) -{ - Service *account = accountGetServiceSession(); - struct - { - AccountUid uid; - } in = {*uid}; - - return serviceDispatchIn(account, 203, in); -} diff --git a/src/webdav.cpp b/src/webdav.cpp deleted file mode 100644 index da9b5f0..0000000 --- a/src/webdav.cpp +++ /dev/null @@ -1,339 +0,0 @@ -#include "webdav.h" -#include "fs.h" -#include "tinyxml2.h" - -rfs::WebDav::WebDav(const std::string& origin, const std::string& username, const std::string& password) - : origin(origin), username(username), password(password) -{ - curl = curl_easy_init(); - if (curl) { - curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); - if (!username.empty()) - curl_easy_setopt(curl, CURLOPT_USERNAME, username.c_str()); - - if (!password.empty()) - curl_easy_setopt(curl, CURLOPT_PASSWORD, password.c_str()); - } -} - -rfs::WebDav::~WebDav() { - if (curl) { - curl_easy_cleanup(curl); - } -} - -bool rfs::WebDav::resourceExists(const std::string& id) { - CURL* local_curl = curl_easy_duphandle(curl); - - // we expect id to be properly escaped and starting with a / - std::string fullUrl = origin + id; - - struct curl_slist *headers = NULL; - headers = curl_slist_append(headers, "Depth: 0"); - - curl_easy_setopt(local_curl, CURLOPT_URL, fullUrl.c_str()); - curl_easy_setopt(local_curl, CURLOPT_CUSTOMREQUEST, "PROPFIND"); - curl_easy_setopt(local_curl, CURLOPT_HTTPHEADER, headers); - curl_easy_setopt(local_curl, CURLOPT_NOBODY, 1L); // do not include the response body - - CURLcode res = curl_easy_perform(local_curl); - - curl_slist_free_all(headers); // free the custom headers - - bool ret = false; - if(res == CURLE_OK) { - long response_code; - curl_easy_getinfo(local_curl, CURLINFO_RESPONSE_CODE, &response_code); - if(response_code == 207) { // 207 Multi-Status is a successful response for PROPFIND - ret = true; - } - } else { - fs::logWrite("WebDav: directory exists failed: %s\n", curl_easy_strerror(res)); - } - - curl_easy_cleanup(local_curl); - - return ret; -} - -// parent ID can never be empty -std::string rfs::WebDav::appendResourceToParentId(const std::string& resourceName, const std::string& parentId, bool isDir) { - char *escaped = curl_easy_escape(curl, resourceName.c_str(), 0); - // we always expect parent to be properly URL encoded. - std::string ret = parentId + std::string(escaped) + (isDir ? "/" : ""); - curl_free(escaped); - return ret; -} - - - -bool rfs::WebDav::createDir(const std::string& dirName, const std::string& parentId) { - CURL* local_curl = curl_easy_duphandle(curl); - - std::string urlPath = appendResourceToParentId(dirName, parentId, true); - std::string fullUrl = origin + urlPath; - - fs::logWrite("WebDav: Create directory at %s\n", fullUrl.c_str()); - - curl_easy_setopt(local_curl, CURLOPT_URL, fullUrl.c_str()); - curl_easy_setopt(local_curl, CURLOPT_CUSTOMREQUEST, "MKCOL"); - - CURLcode res = curl_easy_perform(local_curl); - - if(res != CURLE_OK) { - fs::logWrite("WebDav: directory creation failed: %s\n", curl_easy_strerror(res)); - } - - bool ret = res == CURLE_OK; - - curl_easy_cleanup(local_curl); - - return ret; -} - -// we always expect parent to be properly URL encoded. -void rfs::WebDav::uploadFile(const std::string& filename, const std::string& parentId, curlFuncs::curlUpArgs *_upload) { - std::string fileId = appendResourceToParentId(filename, parentId, false); - updateFile(fileId, _upload); -} -void rfs::WebDav::updateFile(const std::string& _fileID, curlFuncs::curlUpArgs *_upload) { - // for webdav, same as upload - CURL* local_curl = curl_easy_duphandle(curl); - - std::string fullUrl = origin + _fileID; - - curl_easy_setopt(local_curl, CURLOPT_URL, fullUrl.c_str()); - curl_easy_setopt(local_curl, CURLOPT_UPLOAD, 1L); // implicit PUT - curl_easy_setopt(local_curl, CURLOPT_READFUNCTION, curlFuncs::readDataFile); - curl_easy_setopt(local_curl, CURLOPT_READDATA, _upload); - curl_easy_setopt(local_curl, CURLOPT_UPLOAD_BUFFERSIZE, UPLOAD_BUFFER_SIZE); - curl_easy_setopt(local_curl, CURLOPT_UPLOAD, 1); - - - CURLcode res = curl_easy_perform(local_curl); - if(res != CURLE_OK) { - fs::logWrite("WebDav: file upload failed: %s\n", curl_easy_strerror(res)); - } - - curl_easy_cleanup(local_curl); // Clean up the CURL handle -} -void rfs::WebDav::downloadFile(const std::string& _fileID, curlFuncs::curlDlArgs *_download) { - //Downloading is threaded because it's too slow otherwise - dlWriteThreadStruct dlWrite; - dlWrite.cfa = _download; - - Thread writeThread; - threadCreate(&writeThread, writeThread_t, &dlWrite, NULL, 0x8000, 0x2B, 2); - - - CURL* local_curl = curl_easy_duphandle(curl); - - std::string fullUrl = origin + _fileID; - curl_easy_setopt(local_curl, CURLOPT_URL, fullUrl.c_str()); - curl_easy_setopt(local_curl, CURLOPT_WRITEFUNCTION, writeDataBufferThreaded); - curl_easy_setopt(local_curl, CURLOPT_WRITEDATA, &dlWrite); - threadStart(&writeThread); - - CURLcode res = curl_easy_perform(local_curl); - - // Copied from gd.cpp implementation. - // TODO: Not sure how a thread helps if this parent waits here. - threadWaitForExit(&writeThread); - threadClose(&writeThread); - - if(res != CURLE_OK) { - fs::logWrite("WebDav: file download failed: %s\n", curl_easy_strerror(res)); - } - - curl_easy_cleanup(local_curl); -} -void rfs::WebDav::deleteFile(const std::string& _fileID) { - CURL* local_curl = curl_easy_duphandle(curl); - - std::string fullUrl = origin + _fileID; - curl_easy_setopt(local_curl, CURLOPT_URL, fullUrl.c_str()); - curl_easy_setopt(local_curl, CURLOPT_CUSTOMREQUEST, "DELETE"); - - CURLcode res = curl_easy_perform(local_curl); - if(res != CURLE_OK) { - fs::logWrite("WebDav: file deletion failed: %s\n", curl_easy_strerror(res)); - } - - curl_easy_cleanup(local_curl); -} - -bool rfs::WebDav::dirExists(const std::string& dirName, const std::string& parentId) { - std::string urlPath = getDirID(dirName, parentId); - return resourceExists(urlPath); -} - -bool rfs::WebDav::fileExists(const std::string& filename, const std::string& parentId) { - std::string urlPath = appendResourceToParentId(filename, parentId, false); - return resourceExists(urlPath); -} - -std::string rfs::WebDav::getFileID(const std::string& filename, const std::string& parentId) { - return appendResourceToParentId(filename, parentId, false); -} - -std::string rfs::WebDav::getDirID(const std::string& dirName, const std::string& parentId) { - return appendResourceToParentId(dirName, parentId, true); -} - -std::vector rfs::WebDav::getListWithParent(const std::string& _parentId) { - std::vector list; - - CURL* local_curl = curl_easy_duphandle(curl); - - // we expect _resource to be properly escaped - std::string fullUrl = origin + _parentId; - - struct curl_slist *headers = NULL; - headers = curl_slist_append(headers, "Depth: 1"); - - std::string responseString; - - curl_easy_setopt(local_curl, CURLOPT_URL, fullUrl.c_str()); - curl_easy_setopt(local_curl, CURLOPT_CUSTOMREQUEST, "PROPFIND"); - curl_easy_setopt(local_curl, CURLOPT_HTTPHEADER, headers); - curl_easy_setopt(local_curl, CURLOPT_WRITEFUNCTION, curlFuncs::writeDataString); - curl_easy_setopt(local_curl, CURLOPT_WRITEDATA, &responseString); - - CURLcode res = curl_easy_perform(local_curl); - - if(res == CURLE_OK) { - long response_code; - curl_easy_getinfo(local_curl, CURLINFO_RESPONSE_CODE, &response_code); - if(response_code == 207) { // 207 Multi-Status is a successful response for PROPFIND - fs::logWrite("WebDav: Response from WebDav. Parsing.\n"); - std::vector items = parseXMLResponse(responseString); - - // insert into array - // TODO: Filter for zip? - list.insert(list.end(), items.begin(), items.end()); - } - } else { - fs::logWrite("WebDav: directory listing failed: %s\n", curl_easy_strerror(res)); - } - - curl_slist_free_all(headers); // free the custom headers - curl_easy_cleanup(local_curl); - return list; -} - -// Helper -std::string rfs::WebDav::getNamespacePrefix(tinyxml2::XMLElement* root, const std::string& nsURI) { - for(const tinyxml2::XMLAttribute* attr = root->FirstAttribute(); attr; attr = attr->Next()) { - std::string name = attr->Name(); - std::string value = attr->Value(); - if(value == nsURI) { - auto pos = name.find(':'); - if(pos != std::string::npos) { - return name.substr(pos + 1); - } else { - return ""; // Default namespace (no prefix) - } - } - } - return ""; // No namespace found -} - -std::vector rfs::WebDav::parseXMLResponse(const std::string& xml) { - std::vector items; - tinyxml2::XMLDocument doc; - - if(doc.Parse(xml.c_str()) != tinyxml2::XML_SUCCESS) { - fs::logWrite("WebDav: Failed to parse XML from Server\n"); - return items; - } - - // Get the root element - tinyxml2::XMLElement *root = doc.RootElement(); - std::string nsPrefix = getNamespacePrefix(root, "DAV:"); - nsPrefix = !nsPrefix.empty() ? nsPrefix + ":" : nsPrefix; // Append colon if non-empty - - fs::logWrite("WebDav: Parsing response, using prefix: %s\n", nsPrefix.c_str()); - - // Loop through the responses - tinyxml2::XMLElement* responseElem = root->FirstChildElement((nsPrefix + "response").c_str()); - - std::string parentId; - - while (responseElem) { - RfsItem item; - item.size = 0; - - tinyxml2::XMLElement* hrefElem = responseElem->FirstChildElement((nsPrefix + "href").c_str()); - if (hrefElem) { - std::string hrefText = hrefElem->GetText(); - // href can be absolute URI or relative reference. ALWAYS convert to relative reference - if(hrefText.find(origin) == 0) { - hrefText = hrefText.substr(origin.length()); - } - item.id = hrefText; - item.parent = parentId; - } - - tinyxml2::XMLElement* propstatElem = responseElem->FirstChildElement((nsPrefix + "propstat").c_str()); - if (propstatElem) { - tinyxml2::XMLElement* propElem = propstatElem->FirstChildElement((nsPrefix + "prop").c_str()); - if (propElem) { - tinyxml2::XMLElement* displaynameElem = propElem->FirstChildElement((nsPrefix + "displayname").c_str()); - if (displaynameElem) { - item.name = displaynameElem->GetText(); - } else { - // Fallback to name from href - item.name = getDisplayNameFromURL(item.id); - } - - tinyxml2::XMLElement* resourcetypeElem = propElem->FirstChildElement((nsPrefix + "resourcetype").c_str()); - if (resourcetypeElem) { - item.isDir = resourcetypeElem->FirstChildElement((nsPrefix + "collection").c_str()) != nullptr; - } - - tinyxml2::XMLElement* contentLengthElem = propElem->FirstChildElement((nsPrefix + "getcontentlength").c_str()); - if (contentLengthElem) { - const char* sizeStr = contentLengthElem->GetText(); - if (sizeStr) { - item.size = std::stoi(sizeStr); - } - } - } - } - - responseElem = responseElem->NextSiblingElement((nsPrefix + "response").c_str()); - - // first Item is always the parent. - if (parentId.empty()) { - parentId = item.id; - continue; // do not push parent to list (we are only interested in the children) - } - - items.push_back(item); - } - - return items; -} - -// Function to extract and URL decode the filename from the URL -std::string rfs::WebDav::getDisplayNameFromURL(const std::string &url) { - // Find the position of the last '/' - size_t pos = url.find_last_of('/'); - if (pos == std::string::npos) { - // If '/' is not found, return the whole URL as it is - return url; - } - - // Extract the filename from the URL - std::string encodedFilename = url.substr(pos + 1); - - // URL decode the filename - int outlength; - char *decodedFilename = curl_easy_unescape(curl, encodedFilename.c_str(), encodedFilename.length(), &outlength); - std::string result(decodedFilename, outlength); - - // Free the memory allocated by curl_easy_unescape - curl_free(decodedFilename); - - return result; -}