diff --git a/fs/physfs/Makefile b/fs/physfs/Makefile new file mode 100644 index 0000000..cc7af32 --- /dev/null +++ b/fs/physfs/Makefile @@ -0,0 +1,255 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITARM)),) +$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITARM)/3ds_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# GRAPHICS is a list of directories containing graphics files +# GFXBUILD is the directory where converted graphics files will be placed +# If set to $(BUILD), it will statically link in the converted +# files as if they were data files. +# +# NO_SMDH: if set to anything, no SMDH file is generated. +# ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional) +# APP_TITLE is the name of the app stored in the SMDH file (Optional) +# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) +# APP_AUTHOR is the author of the app stored in the SMDH file (Optional) +# ICON is the filename of the icon (.png), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .png +# - icon.png +# - /default_icon.png +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := include +GRAPHICS := gfx +GFXBUILD := $(BUILD) +#ROMFS := romfs +#GFXBUILD := $(ROMFS)/gfx + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft + +CFLAGS := -g -Wall -O2 -mword-relocations \ + -ffunction-sections \ + $(ARCH) + +CFLAGS += $(INCLUDE) -D__3DS__ + +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 + +ASFLAGS := -g $(ARCH) +LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +LIBS := -lctru -lphysfs -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CTRULIB) $(PORTLIBS) + + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) +export TOPDIR := $(CURDIR) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica))) +SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist))) +GFXFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.t3s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) +#--------------------------------------------------------------------------------- + export LD := $(CC) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- + export LD := $(CXX) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------- +ifeq ($(GFXBUILD),$(BUILD)) +#--------------------------------------------------------------------------------- +export T3XFILES := $(GFXFILES:.t3s=.t3x) +#--------------------------------------------------------------------------------- +else +#--------------------------------------------------------------------------------- +export ROMFS_T3XFILES := $(patsubst %.t3s, $(GFXBUILD)/%.t3x, $(GFXFILES)) +export T3XHFILES := $(patsubst %.t3s, $(BUILD)/%.h, $(GFXFILES)) +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- + +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \ + $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \ + $(addsuffix .o,$(T3XFILES)) + +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(SHLISTFILES:.shlist=_shbin.h) \ + $(addsuffix .h,$(subst .,_,$(BINFILES))) \ + $(GFXFILES:.t3s=.h) + +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export _3DSXDEPS := $(if $(NO_SMDH),,$(OUTPUT).smdh) + +ifeq ($(strip $(ICON)),) + icons := $(wildcard *.png) + ifneq (,$(findstring $(TARGET).png,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).png + else + ifneq (,$(findstring icon.png,$(icons))) + export APP_ICON := $(TOPDIR)/icon.png + endif + endif +else + export APP_ICON := $(TOPDIR)/$(ICON) +endif + +ifeq ($(strip $(NO_SMDH)),) + export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh +endif + +ifneq ($(ROMFS),) + export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) +endif + +.PHONY: all clean + +#--------------------------------------------------------------------------------- +all: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES) + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +$(BUILD): + @mkdir -p $@ + +ifneq ($(GFXBUILD),$(BUILD)) +$(GFXBUILD): + @mkdir -p $@ +endif + +ifneq ($(DEPSDIR),$(BUILD)) +$(DEPSDIR): + @mkdir -p $@ +endif + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf $(GFXBUILD) + +#--------------------------------------------------------------------------------- +$(GFXBUILD)/%.t3x $(BUILD)/%.h : %.t3s +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @tex3ds -i $< -H $(BUILD)/$*.h -d $(DEPSDIR)/$*.d -o $(GFXBUILD)/$*.t3x + +#--------------------------------------------------------------------------------- +else + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).3dsx : $(OUTPUT).elf $(_3DSXDEPS) + +$(OFILES_SOURCES) : $(HFILES) + +$(OUTPUT).elf : $(OFILES) + +#--------------------------------------------------------------------------------- +# you need a rule like this for each extension you use as binary data +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +.PRECIOUS : %.t3x +#--------------------------------------------------------------------------------- +%.t3x.o %_t3x.h : %.t3x +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +# rules for assembling GPU shaders +#--------------------------------------------------------------------------------- +define shader-as + $(eval CURBIN := $*.shbin) + $(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d) + echo "$(CURBIN).o: $< $1" > $(DEPSFILE) + echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h + echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h + echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h + picasso -o $(CURBIN) $1 + bin2s $(CURBIN) | $(AS) -o $*.shbin.o +endef + +%.shbin.o %_shbin.h : %.v.pica %.g.pica + @echo $(notdir $^) + @$(call shader-as,$^) + +%.shbin.o %_shbin.h : %.v.pica + @echo $(notdir $<) + @$(call shader-as,$<) + +%.shbin.o %_shbin.h : %.shlist + @echo $(notdir $<) + @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file))) + +#--------------------------------------------------------------------------------- +%.t3x %.h : %.t3s +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @tex3ds -i $< -H $*.h -d $*.d -o $*.t3x + +-include $(DEPSDIR)/*.d + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- diff --git a/fs/physfs/include/filesystem.h b/fs/physfs/include/filesystem.h new file mode 100644 index 0000000..a5cc4e3 --- /dev/null +++ b/fs/physfs/include/filesystem.h @@ -0,0 +1,105 @@ +#pragma once + +#include + +#include +#include + +namespace FileSystem +{ + static constexpr auto MAX_STAMP = 0x20000000000000LL; + + enum FileMode + { + FileMode_Open, + FileMode_Read, + FileMode_Write, + FileMode_Closed + }; + + enum FileType + { + FileType_File, + FileType_Directory, + FileType_SymLink, + FileType_Other + }; + + struct File + { + PHYSFS_file* handle; + FileMode mode; + + File() + { + this->handle = nullptr; + this->mode = FileMode_Closed; + } + + int64_t GetSize() + { + if (this->handle == nullptr) + return 0; + + return (int64_t)PHYSFS_fileLength(this->handle); + } + }; + + struct Info + { + int64_t size; + int64_t mod_time; + FileType type; + }; + + void Initialize(); + + /* + ** mounts a specific directory for physfs to search in + ** this is typically a main directory + */ + bool SetSource(const char* source); + + /* + ** mounts a specific directory as a "save" directory + ** if appended, it will be added to the search path + */ + bool SetIdentity(const char* name, bool append); + + static std::string savePath; + + /* gets the last physfs error */ + const char* GetPhysfsError(); + + /* strips any duplicate slashes */ + std::string Normalize(const std::string& input); + + /* gets the user directory from physfs */ + std::string GetUserDirectory(); + + /* gets the save directory */ + std::string GetSaveDirectory(); + + /* sets up the writing directory for physfs */ + bool SetupWriteDirectory(); + + /* gets a list of files in a directory */ + void GetDirectoryItems(const char* directory, std::vector& items); + + /* gets the size, mod_time, and type of a file */ + bool GetInfo(const char* filename, Info& info); + + /* creates a new directory */ + bool CreateDirectory(const char* name); + + bool CloseFile(File& file); + + /* creates a new file */ + bool OpenFile(File& file, const char* name, FileMode mode); + + /* writes to a file */ + bool WriteFile(File& file, const void* data, int64_t size); + + /* reads a file's content */ + int64_t ReadFile(File& file, void* destination, int64_t size); +} diff --git a/fs/physfs/source/filesystem.cpp b/fs/physfs/source/filesystem.cpp new file mode 100644 index 0000000..42baab1 --- /dev/null +++ b/fs/physfs/source/filesystem.cpp @@ -0,0 +1,285 @@ +#include "filesystem.h" + +#include <3ds.h> + +#include + +const char* FileSystem::GetPhysfsError() +{ + return PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); +} + +std::string FileSystem::Normalize(const std::string& input) +{ + std::string out; + bool seenSep = false, isSep = false; + + for (size_t i = 0; i < input.size(); ++i) + { + isSep = (input[i] == '/'); + + if (!isSep || !seenSep) + out += input[i]; + + seenSep = isSep; + } + + return out; +} + +void FileSystem::Initialize() +{ + FileSystem::savePath = ""; +} + +bool FileSystem::SetSource(const char* source) +{ + if (!PHYSFS_isInit()) + return false; + + std::string searchPath = source; + if (!PHYSFS_mount(searchPath.c_str(), NULL, 1)) + return false; + + return true; +} + +bool FileSystem::SetIdentity(const char* name, bool append) +{ + if (!PHYSFS_isInit()) + return false; + + std::string old = FileSystem::savePath; + + FileSystem::savePath = FileSystem::Normalize(FileSystem::GetUserDirectory() + "/save/" + name); + printf("Save Path set to %s\n", savePath.c_str()); + + if (!old.empty()) + PHYSFS_unmount(old.c_str()); + + int success = PHYSFS_mount(savePath.c_str(), NULL, append); + printf("Save Path mounted %d\n", success); + + PHYSFS_setWriteDir(nullptr); + + return true; +} + +std::string FileSystem::GetSaveDirectory() +{ + return FileSystem::Normalize(FileSystem::GetUserDirectory() + "/save"); +} + +bool FileSystem::SetupWriteDirectory() +{ + if (!PHYSFS_isInit()) + return false; + + if (FileSystem::savePath.empty()) + return false; + + std::string tmpWritePath = FileSystem::savePath; + std::string tmpDirectoryPath = FileSystem::savePath; + + if (FileSystem::savePath.find(FileSystem::GetUserDirectory()) == 0) + { + tmpWritePath = FileSystem::GetUserDirectory(); + tmpDirectoryPath = savePath.substr(FileSystem::GetUserDirectory().length()); + + /* strip leading '/' characters from the path we want to create */ + size_t startPosition = tmpDirectoryPath.find_first_not_of('/'); + + if (startPosition != std::string::npos) + tmpDirectoryPath = tmpDirectoryPath.substr(startPosition); + } + + if (!PHYSFS_setWriteDir(tmpWritePath.c_str())) + { + printf("Failed to set write dir to %s\n", tmpWritePath.c_str()); + return false; + } + + if (!FileSystem::CreateDirectory(tmpDirectoryPath.c_str())) + { + printf("Failed to create dir %s\n", tmpDirectoryPath.c_str()); + /* clear the write directory in case of error */ + PHYSFS_setWriteDir(nullptr); + return false; + } + + if (!PHYSFS_setWriteDir(savePath.c_str())) + { + printf("Failed to set write dir to %s\n", savePath.c_str()); + return false; + } + + if (!PHYSFS_mount(savePath.c_str(), nullptr, 0)) + { + printf("Failed to mount write dir (%s)\n", FileSystem::GetPhysfsError()); + /* clear the write directory in case of error */ + PHYSFS_setWriteDir(nullptr); + return false; + } + + return true; +} + +std::string FileSystem::GetUserDirectory() +{ + return FileSystem::Normalize(PHYSFS_getUserDir()); +} + +bool FileSystem::GetInfo(const char* filename, FileSystem::Info& info) +{ + if (!PHYSFS_isInit()) + return false; + + PHYSFS_Stat stat = {}; + + if (!PHYSFS_stat(filename, &stat)) + return false; + + info.mod_time = std::min(stat.modtime, FileSystem::MAX_STAMP); + info.size = std::min(stat.filesize, FileSystem::MAX_STAMP); + + if (stat.filetype == PHYSFS_FILETYPE_REGULAR) + info.type = FileSystem::FileType_File; + else if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY) + info.type = FileSystem::FileType_Directory; + else if (stat.filetype == PHYSFS_FILETYPE_SYMLINK) + info.type = FileSystem::FileType_SymLink; + else + info.type = FileSystem::FileType_Other; + + return true; +} + +void FileSystem::GetDirectoryItems(const char* path, std::vector& items) +{ + if (!PHYSFS_isInit()) + return; + + char** results = PHYSFS_enumerateFiles(path); + + if (results == nullptr) + return; + + for (char** item = results; *item != 0; item++) + items.push_back(*item); + + PHYSFS_freeList(results); +} + +bool FileSystem::OpenFile(File& file, const char* name, FileMode mode) +{ + if (mode == FileMode_Closed) + return false; + + if (!PHYSFS_isInit()) + return false; + + if (file.handle) + FileSystem::CloseFile(file); + + if (mode == FileMode_Read && !PHYSFS_exists(name)) + { + printf("Could not open file %s, does not exist.\n", name); + return false; + } + + if ((mode == FileMode_Write) && + (PHYSFS_getWriteDir() == nullptr && FileSystem::SetupWriteDirectory())) + { + printf("Could not set write directory.\n"); + return false; + } + + PHYSFS_getLastErrorCode(); + + switch (mode) + { + case FileMode_Read: + file.handle = PHYSFS_openRead(name); + break; + case FileMode_Write: + file.handle = PHYSFS_openWrite(name); + break; + default: + break; + } + + if (!file.handle) + { + const char* error = FileSystem::GetPhysfsError(); + + if (error == nullptr) + error = "unknown error"; + + printf("Could not open file %s (%s)\n", name, error); + + return false; + } + + file.mode = mode; + + return true; +} + +bool FileSystem::CloseFile(File& file) +{ + if (file.handle == nullptr || !PHYSFS_close(file.handle)) + return false; + + file.handle = nullptr; + + return true; +} + +bool FileSystem::CreateDirectory(const char* name) +{ + if (!PHYSFS_isInit()) + return false; + + if (PHYSFS_getWriteDir() == nullptr && !FileSystem::SetupWriteDirectory()) + return false; + + if (!PHYSFS_mkdir(name)) + return false; + + return true; +} + +int64_t FileSystem::ReadFile(File& file, void* destination, int64_t size) +{ + if (!file.handle || file.mode != FileMode_Read) + { + printf("File is not opened for reading.\n"); + return 0; + } + + if (size > file.GetSize()) + size = file.GetSize(); + else if (size < 0) + { + printf("Invalid read size %lld\n", size); + return 0; + } + + return PHYSFS_readBytes(file.handle, destination, (PHYSFS_uint64)size); +} + +bool FileSystem::WriteFile(File& file, const void* data, int64_t size) +{ + if (!file.handle || file.mode != FileMode_Write) + { + printf("File is not opened for writing.\n"); + return false; + } + + int64_t written = PHYSFS_writeBytes(file.handle, data, (PHYSFS_uint64)size); + + if (written != size) + return false; + + return true; +} diff --git a/fs/physfs/source/main.cpp b/fs/physfs/source/main.cpp new file mode 100644 index 0000000..c47cb36 --- /dev/null +++ b/fs/physfs/source/main.cpp @@ -0,0 +1,131 @@ +#include <3ds.h> + +#include "filesystem.h" + +#include +#include +#include + +#include +#include + +static void listDirItems(const char* directory) +{ + std::vector items; + FileSystem::GetDirectoryItems(directory, items); + + printf("Directory listing of %s\n", directory); + for (const auto& filename : items) + printf(" -> %s\n", filename.c_str()); +} + +static const char* getInfoType(const FileSystem::Info& info) +{ + switch (info.type) + { + case FileSystem::FileType_File: + return "file"; + case FileSystem::FileType_Directory: + return "directory"; + case FileSystem::FileType_SymLink: + return "symlink"; + case FileSystem::FileType_Other: + return "other"; + default: + return ""; + } +} + +static void getInfo(const char* filepath) +{ + FileSystem::Info info; + + bool success = FileSystem::GetInfo(filepath, info); + + printf("File Info of %s\n", filepath); + + if (success) + { + printf(" FileType: %s\n", getInfoType(info)); + printf(" File Size: %lld\n", info.size); + } + else + printf(" Failed to get info for %s!\n", filepath); +} + +int main(int argc, char** argv) +{ + gfxInitDefault(); + + PrintConsole topScreen, bottomScreen; + + consoleInit(GFX_TOP, &topScreen); + consoleInit(GFX_BOTTOM, &bottomScreen); + + consoleSelect(&bottomScreen); + printf("Press A to iterate the save directory\n"); + printf("Press B to get info about MyFile.txt\n"); + printf("Press X to get info about MyDir\n"); + printf("Press Start to quit\n"); + + consoleSelect(&topScreen); + + /* init can be passed NULL instead */ + if (!PHYSFS_init(argv[0])) + printf("physfs failure: %s!\n", FileSystem::GetPhysfsError()); + + FileSystem::SetSource("game"); + FileSystem::SetIdentity("game", true); + + /* create a directory */ + bool success = FileSystem::CreateDirectory("MyDir"); + printf("Directory 'MyDir' Created: %d\n", success); + + /* create a file and write to it */ + FileSystem::File file{}; + FileSystem::OpenFile(file, "MyFile.txt", FileSystem::FileMode_Write); + + const char* message = "HELLO WORLD!"; + size_t length = strlen(message); + + FileSystem::WriteFile(file, message, length); + success = FileSystem::CloseFile(file); + printf("File Closed: %d\n", success); + + /* open our file for reading */ + FileSystem::OpenFile(file, "MyFile.txt", FileSystem::FileMode_Read); + char buffer[file.GetSize() + 1] = {'\0'}; + + /* read the file contents and print them */ + int64_t size = FileSystem::ReadFile(file, buffer, file.GetSize()); + + if (size != 0) + printf("File Contents: %s\n", buffer); + + while (aptMainLoop()) + { + hidScanInput(); + uint32_t kDown = hidKeysDown(); + + if (kDown & KEY_START) + break; + else if (kDown & KEY_A) + listDirItems(""); + else if (kDown & KEY_B) + getInfo("MyFile.txt"); + else if (kDown & KEY_X) + getInfo("MyDir"); + + // Flush and swap framebuffers + gfxFlushBuffers(); + gfxSwapBuffers(); + + // Wait for VBlank + gspWaitForVBlank(); + } + + // Exit services + gfxExit(); + + return 0; +} diff --git a/romfs/Makefile b/fs/romfs/Makefile similarity index 100% rename from romfs/Makefile rename to fs/romfs/Makefile diff --git a/romfs/romfs/folder/file.txt b/fs/romfs/romfs/folder/file.txt similarity index 100% rename from romfs/romfs/folder/file.txt rename to fs/romfs/romfs/folder/file.txt diff --git "a/romfs/romfs/\343\203\225\343\202\251\343\203\253\343\203\200/\343\203\225\343\202\241\343\202\244\343\203\253.txt" "b/fs/romfs/romfs/\343\203\225\343\202\251\343\203\253\343\203\200/\343\203\225\343\202\241\343\202\244\343\203\253.txt" similarity index 100% rename from "romfs/romfs/\343\203\225\343\202\251\343\203\253\343\203\200/\343\203\225\343\202\241\343\202\244\343\203\253.txt" rename to "fs/romfs/romfs/\343\203\225\343\202\251\343\203\253\343\203\200/\343\203\225\343\202\241\343\202\244\343\203\253.txt" diff --git a/romfs/source/main.c b/fs/romfs/source/main.c similarity index 100% rename from romfs/source/main.c rename to fs/romfs/source/main.c diff --git a/sdmc/Makefile b/fs/sdmc/Makefile similarity index 100% rename from sdmc/Makefile rename to fs/sdmc/Makefile diff --git a/sdmc/README.md b/fs/sdmc/README.md similarity index 100% rename from sdmc/README.md rename to fs/sdmc/README.md diff --git a/sdmc/source/costable.c b/fs/sdmc/source/costable.c similarity index 100% rename from sdmc/source/costable.c rename to fs/sdmc/source/costable.c diff --git a/sdmc/source/costable.h b/fs/sdmc/source/costable.h similarity index 100% rename from sdmc/source/costable.h rename to fs/sdmc/source/costable.h diff --git a/sdmc/source/main.c b/fs/sdmc/source/main.c similarity index 100% rename from sdmc/source/main.c rename to fs/sdmc/source/main.c diff --git a/sdmc/test.bin b/fs/sdmc/test.bin similarity index 100% rename from sdmc/test.bin rename to fs/sdmc/test.bin