git: Various style fixes everywhere, removing whitespaces (#321)

* repo-wide: trim trailing spaces

Note: This doesn't touch the .tbl files in encodings/ since they include
meaningful trailing spaces (`20= `)

* patterns: clean up duplicate semicolons

* ELF: add header magic check

* glTF: use type::Magic for magic value

* glTF: check that the file size in the header matches

* xgstexture: fix generics syntax for magic value

* JPEG: define hex enum with 0x00 instead of 0X00

* CI: update deprecated actions

---------

Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
Mrmaxmeier
2024-11-24 11:41:26 +01:00
committed by GitHub
parent 221fa70a67
commit c533017d0b
116 changed files with 866 additions and 865 deletions

View File

@@ -27,13 +27,13 @@ jobs:
steps:
- name: 🧰 Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
- name: 📄 Check changed include files
id: changed-includes
uses: tj-actions/changed-files@v35
uses: tj-actions/changed-files@v45
with:
files: includes/**/*.pat

View File

@@ -19,7 +19,7 @@ jobs:
steps:
- name: 🧰 Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

View File

@@ -10,6 +10,7 @@
import std.core;
import std.io;
import std.mem;
import type.magic;
using BitfieldOrder = std::core::BitfieldOrder;
@@ -515,7 +516,7 @@ bitfield PF {
};
struct E_IDENT {
char EI_MAG[4];
type::Magic<"\x7fELF"> EI_MAG;
EI_CLASS EI_CLASS;
EI_DATA EI_DATA;
EI_VERSION EI_VERSION;
@@ -651,7 +652,7 @@ struct Elf32_Shdr {
u8 data[sh_size] @ sh_offset [[sealed]];
}
}
} [[format("format_section_header")]];;
} [[format("format_section_header")]];
struct Elf64_Chdr {
u32 ch_type;

View File

@@ -28,12 +28,13 @@
import std.mem;
import std.io;
import type.magic;
/**
* @brief The glTF magic section.
*/
struct gltf_magic_t {
char magic[4]; /**< The magic value. Must be "glTF" */
type::Magic<"glTF"> magic; /**< The magic value. Must be "glTF" */
u32 version; /**< The version. Must be 2 for glTF 2.0. */
u32 length; /**< Length of the file in bytes, including magic section. */
};
@@ -66,5 +67,4 @@ fn gltf_format(gltf_chunk_type_t x)
gltf_magic_t magic @ 0x00;
gltf_chunk_t chunks[while(!std::mem::eof())] @ $;
if (magic.magic != "glTF")
std::error("This file might not be a glTF file, expected \"glTF\", got %s", magic.magic);
std::assert_warn(std::mem::size() == magic.length, "file size mismatch");

View File

@@ -238,7 +238,7 @@ struct LuaFunction {
}
LuaInstruction instructions[instruction_count];
s32 constantCount;
LuaConstant constants[constantCount];;
LuaConstant constants[constantCount];
s32 HasDebugInfo;
if (HasDebugInfo != 0) {
u32 LineCount;

View File

@@ -42,7 +42,7 @@ enum Marker : u8 {
APP14 = 0xEE,
APP15 = 0xEF,
COM = 0xFE,
UNKNOWN = 0X00
UNKNOWN = 0x00
};
enum DensityUnit : u8 {

View File

@@ -65,9 +65,9 @@ enum TypeCode : u8 {
struct TOC {
s32 structLen;
u32 pos;
u32 len[[comment("len of the data (compressed)")]];;
u32 uLen[[comment("len of data (uncompressed)")]];;
bool cFlag[[comment("is it compressed")]];;
u32 len[[comment("len of the data (compressed)")]];
u32 uLen[[comment("len of data (uncompressed)")]];
bool cFlag[[comment("is it compressed")]];
TypeCode typcd;
char name[this.structLen - tocStructLength];

View File

@@ -238,7 +238,7 @@ struct SUPERBLOCK {
};
struct VOLUME_BOOT_RECORD {
BYTE jmpInstruction[3] [[comment("Jump Instruction"), name("JumpInstruction")]];;
BYTE jmpInstruction[3] [[comment("Jump Instruction"), name("JumpInstruction")]];
FILESYSTEM FileSystem[[comment("FileSystemName"), name("FileSystem")]];
BYTE UnKnown[5];
char Identifier[4][[comment("File System Recognition Structure, allows OS to recognise the structure"), name("FSRSIdentifier")]];

View File

@@ -116,7 +116,7 @@ struct WebPData {
padding[paddedChunkSize - sizeof(data)];
}
}
} [[name(std::format("Chunk ({})", chunkHeader.chunkId))]];;
} [[name(std::format("Chunk ({})", chunkHeader.chunkId))]];
RiffHeader header @0x00;
WebPData data[while (!std::mem::eof())] @ $;

View File

@@ -63,9 +63,9 @@ union EntryPoint {
u32 retailAddress [[format("format_retail_entrypoint")]];
if ((betaAddress ^ 0xE682F45B) - parent.baseAddress < std::mem::size())
u8 beta @ (betaAddress ^ 0xE682F45B) - parent.baseAddress;;
u8 beta @ (betaAddress ^ 0xE682F45B) - parent.baseAddress;
if ((debugAddress ^ 0x94859D4B) - parent.baseAddress < std::mem::size())
u8 debug @ (debugAddress ^ 0x94859D4B) - parent.baseAddress;;
u8 debug @ (debugAddress ^ 0x94859D4B) - parent.baseAddress;
if ((retailAddress ^ 0xA8FC57AB) - parent.baseAddress < std::mem::size())
u8 retail @ (retailAddress ^ 0xA8FC57AB) - parent.baseAddress;
};
@@ -303,7 +303,7 @@ union KernelImageThunkAddress {
u32 retailAddress [[format("format_retail_kernel_image_thunk_address")]];
if ((debugAddress ^ 0xEFB1F152) - parent.baseAddress < std::mem::size())
KernelImageThunk debug @ (debugAddress ^ 0xEFB1F152) - parent.baseAddress;;
KernelImageThunk debug @ (debugAddress ^ 0xEFB1F152) - parent.baseAddress;
if ((retailAddress ^ 0x5B6D40B6) - parent.baseAddress < std::mem::size())
KernelImageThunk retail @ (retailAddress ^ 0x5B6D40B6) - parent.baseAddress;
};

View File

@@ -92,7 +92,7 @@ bitfield XGSTextureFlags
struct XGSTextureHeader
{
type::Magic"XGST"> magic;
type::Magic<"XGST"> magic;
u8 dataOffset;
XGSPlatform compilationPlatform; //Definitely platform, this has no harm when modifying (except in Edge of Perception) but does help with knowing platform specific compressions, usually
u16 headerSize; //?