clang-format WIP

This commit is contained in:
Mateusz Faderewski 2024-04-26 23:04:19 +02:00
parent cbe69e2659
commit fc410da891
5 changed files with 36 additions and 6 deletions

20
.clang-format Normal file
View File

@ -0,0 +1,20 @@
BasedOnStyle: LLVM
AlignAfterOpenBracket: BlockIndent
AlignEscapedNewlines: DontAlign
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
ColumnLimit: 120
IndentWidth: 4
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterFunctionDeclarationName: true
AfterFunctionDefinitionName: true
UseTab: Never

View File

@ -138,6 +138,13 @@ clean:
@rm -rf ./$(BUILD_DIR) ./$(OUTPUT_DIR)
.PHONY: clean
format:
@find ./$(SOURCE_DIR) \
-path \./$(SOURCE_DIR)/libs -prune \
-o -iname *.c -print \
-o -iname *.h -print \
| xargs clang-format -i
run: $(OUTPUT_DIR)/$(PROJECT_NAME).n64
ifeq ($(OS),Windows_NT)
./localdeploy.bat

View File

@ -19,10 +19,9 @@
static bool is_64dd_connected (void) {
return (
((io_read(0x05000540) & 0x0000FFFF) == 0x0000) ||
(io_read(0x06001010) == 0x2129FFF8)
);
bool is_64dd_io_present = ((io_read(0x05000540) & 0x0000FFFF) == 0x0000);
bool is_64dd_ipl_present = (io_read(0x06001010) == 0x2129FFF8);
return (is_64dd_io_present || is_64dd_ipl_present);
}
static bool create_saves_subdirectory (path_t *path) {

View File

@ -141,6 +141,8 @@ typedef struct {
// List shamelessly stolen from https://github.com/ares-emulator/ares/blob/master/mia/medium/nintendo-64.cpp
// clang-format off
static const match_t database[] = {
MATCH_HOMEBREW_HEADER("ED"), // Homebrew header (ED)
@ -576,6 +578,7 @@ static const match_t database[] = {
MATCH_END,
};
// clang-format on
static void fix_rom_header_endianness (rom_header_t *rom_header, rom_info_t *rom_info) {

View File

@ -11,7 +11,8 @@
static const char *rom_extensions[] = { "z64", "n64", "v64", "rom", NULL };
static const char *disk_extensions[] = { "ndd", NULL };
static const char *emulator_extensions[] = { "nes", "sfc", "smc", "gb", "gbc", "sms", "gg", "sg", NULL };
static const char *save_extensions[] = { "sav", NULL }; // TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
// TODO: "eep", "sra", "srm", "fla" could be used if transfered from different flashcarts.
static const char *save_extensions[] = { "sav", NULL };
static const char *image_extensions[] = { "png", NULL };
static const char *text_extensions[] = { "txt", "ini", "yml", "yaml", NULL };
static const char *music_extensions[] = { "mp3", NULL };
@ -24,7 +25,7 @@ static const char *hidden_paths[] = {
"/OS64P.v64",
"/sc64menu.n64",
"/System Volume Information",
NULL
NULL,
};