diff --git a/Makefile b/Makefile index cfd75dd..9cc97b3 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ include $(DEVKITARM)/3ds_rules #--------------------------------------------------------------------------------- export TARGET := $(shell basename $(CURDIR)) BUILD := build -SOURCES := source source/tests source/tests/fs source/tests/cpu +SOURCES := source source/common source/tests source/tests/fs source/tests/cpu DATA := data INCLUDES := source #include diff --git a/source/scope_exit.h b/source/common/scope_exit.h similarity index 100% rename from source/scope_exit.h rename to source/common/scope_exit.h diff --git a/source/common/string_funcs.cpp b/source/common/string_funcs.cpp new file mode 100644 index 0000000..71fc65e --- /dev/null +++ b/source/common/string_funcs.cpp @@ -0,0 +1,25 @@ +#include "string_funcs.h" + +#include +#include +#include +#include + +namespace Common { + +std::string FormatString(const char* format, ...) +{ + va_list arguments; + char *va_str; + + va_start(arguments, format); + vasprintf(&va_str, format, arguments); + va_end(arguments); + + std::string out_str(va_str); + free(va_str); + + return out_str; +} + +} diff --git a/source/common/string_funcs.h b/source/common/string_funcs.h new file mode 100644 index 0000000..434b029 --- /dev/null +++ b/source/common/string_funcs.h @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace Common { + +std::string FormatString(const char* format, ...); + +} diff --git a/source/tests/fs/fs_sdmc.cpp b/source/tests/fs/fs_sdmc.cpp index 7dc6146..614b7f4 100644 --- a/source/tests/fs/fs_sdmc.cpp +++ b/source/tests/fs/fs_sdmc.cpp @@ -2,7 +2,7 @@ #include #include <3ds.h> -#include "scope_exit.h" +#include "common/scope_exit.h" #include "tests/test.h" #include "tests/fs/fs_sdmc.h"