Change types to idiomatic Ada_Case Odin

This commit is contained in:
Riyyi
2026-08-08 13:15:00 +02:00
parent 6fcfdd5b67
commit 2a0c478f7a
4 changed files with 19 additions and 19 deletions
+4 -4
View File
@@ -24,13 +24,13 @@ Header :: struct #packed #all_or_none {
number_of_assets: u32,
}
AssetIndex :: struct #packed #all_or_none {
Asset_Index :: struct #packed #all_or_none {
relpath: [PATH_SIZE]u8,
size: u64,
offset: u64,
}
AssetTable :: struct {
Asset_Table :: struct {
asset_index_offset: u64,
data_offset: u64,
asset_offsets: [dynamic]u64,
@@ -40,7 +40,7 @@ AssetTable :: struct {
Writer :: struct {
chunk_file: ^os.File,
asset_file: ^os.File,
asset_table: AssetTable,
asset_table: Asset_Table,
}
Error :: union #shared_nil {
@@ -61,7 +61,7 @@ writer_init :: proc(
// [ Header ][ []Asset Index ][ Data ]
w.asset_table.asset_index_offset = size_of(Header)
w.asset_table.data_offset =
size_of(Header) + (size_of(AssetIndex) * number_of_assets)
size_of(Header) + (size_of(Asset_Index) * number_of_assets)
w.asset_table.asset_offsets = make([dynamic]u64, allocator) or_return
w.asset_table.asset_sizes = make([dynamic]u64, allocator) or_return
resize(&w.asset_table.asset_offsets, number_of_assets)
+1 -1
View File
@@ -12,7 +12,7 @@ import "src:file"
write_assets :: proc(
w: ^Writer,
output: ^os.File,
entries: []file.FileEntry,
entries: []file.File_Entry,
size_per_chunk: u64 = SIZE_PER_CHUNK,
compression: u16 = COMPRESSION,
allocator := context.allocator,
+6 -6
View File
@@ -12,7 +12,7 @@ import "src:file"
write_metadata :: proc(
w: ^Writer,
output: ^os.File,
entries: []file.FileEntry,
entries: []file.File_Entry,
size_per_chunk: u64 = SIZE_PER_CHUNK,
compression: u16 = COMPRESSION,
allocator := context.allocator,
@@ -71,11 +71,11 @@ write_header :: proc(
write_asset_index :: proc(
w: ^Writer,
chunk_file: ^os.File,
entries: []file.FileEntry,
entries: []file.File_Entry,
number_of_assets: u32,
allocator: runtime.Allocator,
) {
index_size: u64 = size_of(AssetIndex) * cast(u64)number_of_assets
index_size: u64 = size_of(Asset_Index) * cast(u64)number_of_assets
// ----------------------------------------
@@ -91,16 +91,16 @@ write_asset_index :: proc(
os.exit(1)
}
offset_in_bytes := size_of(AssetIndex) * cast(u64)i
offset_in_bytes := size_of(Asset_Index) * cast(u64)i
offset_pointer := mem.ptr_offset(&index_bytes[0], offset_in_bytes)
ai := cast(^AssetIndex)offset_pointer
ai := cast(^Asset_Index)offset_pointer
copy(ai.relpath[:PATH_SIZE], f.relpath)
ai.size = w.asset_table.asset_sizes[i]
ai.offset = w.asset_table.asset_offsets[i]
}
assert(len(index_bytes) % size_of(AssetIndex) == 0) // clean multiple
assert(len(index_bytes) % size_of(Asset_Index) == 0) // clean multiple
// Write asset index
n, err := os.write_at(