├── .clang-format ├── .github └── workflows │ └── build.yml ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── meta └── icon.png └── src └── main.c /.clang-format: -------------------------------------------------------------------------------- 1 | # Generated from CLion C/C++ Code Style settings 2 | BasedOnStyle: LLVM 3 | AccessModifierOffset: -4 4 | AlignAfterOpenBracket: Align 5 | AlignConsecutiveAssignments: Consecutive 6 | AlignConsecutiveMacros: AcrossEmptyLinesAndComments 7 | AlignOperands: Align 8 | AllowAllArgumentsOnNextLine: false 9 | AllowAllConstructorInitializersOnNextLine: false 10 | AllowAllParametersOfDeclarationOnNextLine: false 11 | AllowShortBlocksOnASingleLine: Always 12 | AllowShortCaseLabelsOnASingleLine: false 13 | AllowShortFunctionsOnASingleLine: All 14 | AllowShortIfStatementsOnASingleLine: Always 15 | AllowShortLambdasOnASingleLine: All 16 | AllowShortLoopsOnASingleLine: true 17 | AlwaysBreakAfterReturnType: None 18 | AlwaysBreakTemplateDeclarations: Yes 19 | BreakBeforeBraces: Custom 20 | BraceWrapping: 21 | AfterCaseLabel: false 22 | AfterClass: false 23 | AfterControlStatement: Never 24 | AfterEnum: false 25 | AfterFunction: false 26 | AfterNamespace: false 27 | AfterUnion: false 28 | BeforeCatch: false 29 | BeforeElse: false 30 | IndentBraces: false 31 | SplitEmptyFunction: false 32 | SplitEmptyRecord: true 33 | BreakBeforeBinaryOperators: None 34 | BreakBeforeTernaryOperators: true 35 | BreakConstructorInitializers: BeforeColon 36 | BreakInheritanceList: BeforeColon 37 | ColumnLimit: 0 38 | CompactNamespaces: false 39 | ContinuationIndentWidth: 8 40 | IndentCaseLabels: true 41 | IndentPPDirectives: None 42 | IndentWidth: 4 43 | KeepEmptyLinesAtTheStartOfBlocks: true 44 | MaxEmptyLinesToKeep: 2 45 | NamespaceIndentation: All 46 | ObjCSpaceAfterProperty: false 47 | ObjCSpaceBeforeProtocolList: true 48 | PointerAlignment: Right 49 | ReflowComments: false 50 | SpaceAfterCStyleCast: true 51 | SpaceAfterLogicalNot: false 52 | SpaceAfterTemplateKeyword: false 53 | SpaceBeforeAssignmentOperators: true 54 | SpaceBeforeCpp11BracedList: false 55 | SpaceBeforeCtorInitializerColon: true 56 | SpaceBeforeInheritanceColon: true 57 | SpaceBeforeParens: ControlStatements 58 | SpaceBeforeRangeBasedForLoopColon: true 59 | SpaceInEmptyParentheses: false 60 | SpacesBeforeTrailingComments: 1 61 | SpacesInAngles: false 62 | SpacesInCStyleCastParentheses: false 63 | SpacesInContainerLiterals: false 64 | SpacesInParentheses: false 65 | SpacesInSquareBrackets: false 66 | TabWidth: 4 67 | UseTab: Never 68 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build-binary: 7 | runs-on: ubuntu-22.04 8 | steps: 9 | - uses: actions/checkout@v3 10 | - name: Build binary 11 | run: | 12 | docker build -t builder . 13 | docker run --rm -v ${PWD}:/project builder make 14 | - uses: actions/upload-artifact@v3 15 | with: 16 | name: ufdiine 17 | path: ufdiine.wuhb 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /build 3 | *.elf 4 | *.rpx 5 | *.zip 6 | *.wuhb 7 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM wiiuenv/devkitppc:20220806 2 | 3 | COPY --from=wiiuenv/libmocha:20220903 /artifacts $DEVKITPRO 4 | 5 | WORKDIR /project 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITPRO)),) 6 | $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") 7 | endif 8 | 9 | TOPDIR ?= $(CURDIR) 10 | 11 | #------------------------------------------------------------------------------- 12 | # APP_NAME sets the long name of the application 13 | # APP_SHORTNAME sets the short name of the application 14 | # APP_AUTHOR sets the author of the application 15 | #------------------------------------------------------------------------------- 16 | APP_NAME := UFDiine 17 | APP_SHORTNAME := UFDiine 18 | APP_AUTHOR := GaryOderNichts 19 | 20 | 21 | include $(DEVKITPRO)/wut/share/wut_rules 22 | 23 | #------------------------------------------------------------------------------- 24 | # TARGET is the name of the output 25 | # BUILD is the directory where object files & intermediate files will be placed 26 | # SOURCES is a list of directories containing source code 27 | # DATA is a list of directories containing data files 28 | # INCLUDES is a list of directories containing header files 29 | # CONTENT is the path to the bundled folder that will be mounted as /vol/content/ 30 | # ICON is the game icon, leave blank to use default rule 31 | # TV_SPLASH is the image displayed during bootup on the TV, leave blank to use default rule 32 | # DRC_SPLASH is the image displayed during bootup on the DRC, leave blank to use default rule 33 | #------------------------------------------------------------------------------- 34 | TARGET := ufdiine 35 | BUILD := build 36 | SOURCES := src 37 | DATA := data 38 | INCLUDES := include 39 | CONTENT := 40 | ICON := meta/icon.png 41 | TV_SPLASH := 42 | DRC_SPLASH := 43 | 44 | #------------------------------------------------------------------------------- 45 | # options for code generation 46 | #------------------------------------------------------------------------------- 47 | CFLAGS := -g -Wall -O2 -ffunction-sections \ 48 | $(MACHDEP) 49 | 50 | CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ 51 | 52 | CXXFLAGS := $(CFLAGS) 53 | 54 | ASFLAGS := -g $(ARCH) 55 | LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) 56 | 57 | LIBS := -lmocha -lwut 58 | 59 | #------------------------------------------------------------------------------- 60 | # list of directories containing libraries, this must be the top level 61 | # containing include and lib 62 | LIBDIRS := $(PORTLIBS) $(WUT_ROOT) $(WUT_ROOT)/usr 63 | #------------------------------------------------------------------------------- 64 | 65 | 66 | #------------------------------------------------------------------------------- 67 | # no real need to edit anything past this point unless you need to add additional 68 | # rules for different file extensions 69 | #------------------------------------------------------------------------------- 70 | ifneq ($(BUILD),$(notdir $(CURDIR))) 71 | #------------------------------------------------------------------------------- 72 | 73 | export OUTPUT := $(CURDIR)/$(TARGET) 74 | export TOPDIR := $(CURDIR) 75 | 76 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 77 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 78 | 79 | export DEPSDIR := $(CURDIR)/$(BUILD) 80 | 81 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 82 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 83 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 84 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 85 | 86 | #------------------------------------------------------------------------------- 87 | # use CXX for linking C++ projects, CC for standard C 88 | #------------------------------------------------------------------------------- 89 | ifeq ($(strip $(CPPFILES)),) 90 | #------------------------------------------------------------------------------- 91 | export LD := $(CC) 92 | #------------------------------------------------------------------------------- 93 | else 94 | #------------------------------------------------------------------------------- 95 | export LD := $(CXX) 96 | #------------------------------------------------------------------------------- 97 | endif 98 | #------------------------------------------------------------------------------- 99 | 100 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) 101 | export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 102 | export OFILES := $(OFILES_BIN) $(OFILES_SRC) 103 | export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) 104 | 105 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 106 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 107 | -I$(CURDIR)/$(BUILD) 108 | 109 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 110 | 111 | ifneq (,$(strip $(CONTENT))) 112 | export APP_CONTENT := $(TOPDIR)/$(CONTENT) 113 | endif 114 | 115 | ifneq (,$(strip $(ICON))) 116 | export APP_ICON := $(TOPDIR)/$(ICON) 117 | else ifneq (,$(wildcard $(TOPDIR)/$(TARGET).png)) 118 | export APP_ICON := $(TOPDIR)/$(TARGET).png 119 | else ifneq (,$(wildcard $(TOPDIR)/icon.png)) 120 | export APP_ICON := $(TOPDIR)/icon.png 121 | endif 122 | 123 | ifneq (,$(strip $(TV_SPLASH))) 124 | export APP_TV_SPLASH := $(TOPDIR)/$(TV_SPLASH) 125 | else ifneq (,$(wildcard $(TOPDIR)/tv-splash.png)) 126 | export APP_TV_SPLASH := $(TOPDIR)/tv-splash.png 127 | else ifneq (,$(wildcard $(TOPDIR)/splash.png)) 128 | export APP_TV_SPLASH := $(TOPDIR)/splash.png 129 | endif 130 | 131 | ifneq (,$(strip $(DRC_SPLASH))) 132 | export APP_DRC_SPLASH := $(TOPDIR)/$(DRC_SPLASH) 133 | else ifneq (,$(wildcard $(TOPDIR)/drc-splash.png)) 134 | export APP_DRC_SPLASH := $(TOPDIR)/drc-splash.png 135 | else ifneq (,$(wildcard $(TOPDIR)/splash.png)) 136 | export APP_DRC_SPLASH := $(TOPDIR)/splash.png 137 | endif 138 | 139 | .PHONY: $(BUILD) clean all 140 | 141 | #------------------------------------------------------------------------------- 142 | all: $(BUILD) 143 | 144 | $(BUILD): 145 | @[ -d $@ ] || mkdir -p $@ 146 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 147 | 148 | #------------------------------------------------------------------------------- 149 | clean: 150 | @echo clean ... 151 | @rm -fr $(BUILD) $(TARGET).wuhb $(TARGET).rpx $(TARGET).elf 152 | 153 | #------------------------------------------------------------------------------- 154 | else 155 | .PHONY: all 156 | 157 | DEPENDS := $(OFILES:.o=.d) 158 | 159 | #------------------------------------------------------------------------------- 160 | # main targets 161 | #------------------------------------------------------------------------------- 162 | all : $(OUTPUT).wuhb 163 | 164 | $(OUTPUT).wuhb : $(OUTPUT).rpx 165 | $(OUTPUT).rpx : $(OUTPUT).elf 166 | $(OUTPUT).elf : $(OFILES) 167 | 168 | $(OFILES_SRC) : $(HFILES_BIN) 169 | 170 | #------------------------------------------------------------------------------- 171 | # you need a rule like this for each extension you use as binary data 172 | #------------------------------------------------------------------------------- 173 | %.bin.o %_bin.h : %.bin 174 | #------------------------------------------------------------------------------- 175 | @echo $(notdir $<) 176 | @$(bin2o) 177 | 178 | -include $(DEPENDS) 179 | 180 | #------------------------------------------------------------------------------- 181 | endif 182 | #------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UFDiine - Wii U Update Folder Deleter 2 | ![icon](meta/icon.png "Icon") 3 | 4 | This application can delete or create the update folder located at `/vol/storage_mlc01/sys/update`. 5 | -------------------------------------------------------------------------------- /meta/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GaryOderNichts/UFDiine/84dfd14db63e77c1de19b22700949185f3fde5ed/meta/icon.png -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define OSScreenClearBuffer(color) ({ \ 15 | OSScreenClearBufferEx(SCREEN_TV, color); \ 16 | OSScreenClearBufferEx(SCREEN_DRC, color); \ 17 | }) 18 | 19 | #define OSScreenFlipBuffers() ({ \ 20 | OSScreenFlipBuffersEx(SCREEN_TV); \ 21 | OSScreenFlipBuffersEx(SCREEN_DRC); \ 22 | }) 23 | 24 | #define OSScreenPutFont(row, column, buffer) ({ \ 25 | OSScreenPutFontEx(SCREEN_TV, row, column, buffer); \ 26 | OSScreenPutFontEx(SCREEN_DRC, row, column, buffer); \ 27 | }) 28 | 29 | #define UPDATE_FOLDER_PATH "/vol/storage_mlc01/sys/update" 30 | 31 | int gClient = -1; 32 | 33 | BOOL updateFolderExists() { 34 | FSADirectoryHandle handle = -1; 35 | if (FSAOpenDir(gClient, UPDATE_FOLDER_PATH, &handle) != FS_ERROR_OK) { 36 | return FALSE; 37 | } 38 | 39 | FSACloseDir(gClient, handle); 40 | return TRUE; 41 | } 42 | 43 | void createUpdateFolder() { 44 | FSAMakeDir(gClient, UPDATE_FOLDER_PATH, 0777); 45 | } 46 | 47 | void deleteUpdateFolder() { 48 | FSARemove(gClient, UPDATE_FOLDER_PATH); 49 | } 50 | 51 | void drawMenu() { 52 | OSScreenClearBuffer(0); 53 | 54 | OSScreenPutFont(0, 0, "*************************************************"); 55 | OSScreenPutFont(0, 1, " UFDiine (Update Folder Deleter) v2.0"); 56 | OSScreenPutFont(0, 2, " Block updates by deleting the update folder "); 57 | OSScreenPutFont(0, 3, "*************************************************"); 58 | 59 | if (updateFolderExists()) { 60 | OSScreenPutFont(0, 4, "Update folder exists"); 61 | OSScreenPutFont(0, 6, "Press A to delete the update folder"); 62 | } else { 63 | OSScreenPutFont(0, 4, "Update folder is deleted"); 64 | OSScreenPutFont(0, 6, "Press A to create the update folder"); 65 | } 66 | 67 | OSScreenPutFont(0, 8, "Press HOME to exit"); 68 | 69 | OSScreenFlipBuffers(); 70 | } 71 | 72 | int main(int argc, char **argv) { 73 | WHBProcInit(); 74 | WHBLogConsoleInit(); 75 | WHBLogCafeInit(); 76 | 77 | if (Mocha_InitLibrary() != MOCHA_RESULT_SUCCESS) { 78 | WHBLogPrintf("Mocha_InitLibrary failed"); 79 | WHBLogConsoleDraw(); 80 | OSSleepTicks(OSMillisecondsToTicks(3000)); 81 | goto exit; 82 | } 83 | 84 | 85 | FSAInit(); 86 | gClient = FSAAddClient(NULL); 87 | if (gClient == 0) { 88 | WHBLogPrintf("Failed to add FSAClient"); 89 | WHBLogConsoleDraw(); 90 | OSSleepTicks(OSMillisecondsToTicks(3000)); 91 | goto exit; 92 | } 93 | if (Mocha_UnlockFSClientEx(gClient) != MOCHA_RESULT_SUCCESS) { 94 | FSADelClient(gClient); 95 | WHBLogPrintf("Failed to add FSAClient"); 96 | WHBLogConsoleDraw(); 97 | OSSleepTicks(OSMillisecondsToTicks(3000)); 98 | goto exit; 99 | } 100 | 101 | drawMenu(); 102 | 103 | VPADStatus buffer; 104 | while (WHBProcIsRunning()) { 105 | VPADRead(VPAD_CHAN_0, &buffer, 1, NULL); 106 | 107 | if (buffer.trigger & VPAD_BUTTON_A) { 108 | if (updateFolderExists()) { 109 | deleteUpdateFolder(); 110 | } else { 111 | createUpdateFolder(); 112 | } 113 | } 114 | drawMenu(); 115 | OSSleepTicks(OSMillisecondsToTicks(100)); 116 | } 117 | 118 | FSAFlushVolume(gClient, "/vol/storage_mlc01"); 119 | 120 | FSADelClient(gClient); 121 | 122 | Mocha_DeInitLibrary(); 123 | 124 | 125 | exit: 126 | WHBLogConsoleFree(); 127 | WHBProcShutdown(); 128 | return 0; 129 | } --------------------------------------------------------------------------------