diff --git a/src/app/foldhaus_app.cpp b/src/app/foldhaus_app.cpp index a202b38..f6c4828 100644 --- a/src/app/foldhaus_app.cpp +++ b/src/app/foldhaus_app.cpp @@ -182,7 +182,7 @@ INITIALIZE_APPLICATION(InitializeApplication) #if 1 string SculpturePath = MakeStringLiteral("data/blumen_lumen_v2.fold"); - LoadAssembly(State, Context, SculpturePath); + LoadAssembly(&State->Assemblies, &State->LedSystem, &State->Transient, Context, SculpturePath, State->GlobalLog); #endif State->PixelsToWorldScale = .01f; diff --git a/src/app/foldhaus_assembly.cpp b/src/app/foldhaus_assembly.cpp index 97cdbf2..0ba40b2 100644 --- a/src/app/foldhaus_assembly.cpp +++ b/src/app/foldhaus_assembly.cpp @@ -5,8 +5,6 @@ // #ifndef FOLDHAUS_ASSEMBLY_CPP -// Led System - internal led_system LedSystemInitialize(platform_memory_handler PlatformMemory, u32 BuffersMax) { @@ -78,8 +76,6 @@ LedBufferSetLed(led_buffer* Buffer, u32 Led, v4 Position) Buffer->Positions[Led] = Position; } -// Assembly - internal void ConstructAssemblyFromDefinition (assembly* Assembly, string AssemblyName, v4 RootPosition, led_system* LedSystem) { @@ -114,37 +110,36 @@ ConstructAssemblyFromDefinition (assembly* Assembly, string AssemblyName, v4 Roo static v4 TempAssemblyOffsets[] = { v4{0, 0, 0, 0}, v4{250, 0, 75, 0}, v4{-250, 0, 75, 0} }; s32 TempAssemblyOffsetsCount = 3; -// TODO(Peter): Don't reference State, pull back to the Led buffer and Assembly Array internal void -LoadAssembly (app_state* State, context Context, string Path) +LoadAssembly (assembly_array* Assemblies, led_system* LedSystem, memory_arena* Scratch, context Context, string Path, event_log* GlobalLog) { platform_memory_result AssemblyFile = ReadEntireFile(Context, Path); if (AssemblyFile.Error == PlatformMemory_NoError && AssemblyFile.Size > 0) { string AssemblyFileText = MakeString((char*)AssemblyFile.Base); - Assert(State->Assemblies.Count < State->Assemblies.CountMax); - assembly* NewAssembly = &State->Assemblies.Values[State->Assemblies.Count++]; + Assert(Assemblies->Count < Assemblies->CountMax); + assembly* NewAssembly = &Assemblies->Values[Assemblies->Count++]; s32 IndexOfLastSlash = FastLastIndexOfCharInCharArray(Path.Memory, Path.Length, '\\'); string FileName = Substring(Path, IndexOfLastSlash + 1); NewAssembly->Arena.PlatformMemory = Context.PlatformMemory; - if (ParseAssemblyFile(NewAssembly, AssemblyFileText, &State->Transient)) + if (ParseAssemblyFile(NewAssembly, AssemblyFileText, Scratch)) { - v4 Offset = TempAssemblyOffsets[State->Assemblies.Count % TempAssemblyOffsetsCount]; - ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, &State->LedSystem); + v4 Offset = TempAssemblyOffsets[Assemblies->Count % TempAssemblyOffsetsCount]; + ConstructAssemblyFromDefinition(NewAssembly, FileName, Offset, LedSystem); PlatformFree(Context.PlatformMemory, AssemblyFile.Base, AssemblyFile.Size); } else { FreeMemoryArena(&NewAssembly->Arena); - State->Assemblies.Count -= 1; + Assemblies->Count -= 1; } } else { - LogError(State->GlobalLog, "Unable to load assembly file"); + LogError(GlobalLog, "Unable to load assembly file"); } } diff --git a/src/app/foldhaus_interface.cpp b/src/app/foldhaus_interface.cpp index 823b652..b69ca36 100644 --- a/src/app/foldhaus_interface.cpp +++ b/src/app/foldhaus_interface.cpp @@ -477,6 +477,5 @@ DrawAllPanels(panel_layout PanelLayout, render_command_buffer* RenderBuffer, mou } } - #define FOLDHAUS_INTERFACE_CPP #endif // FOLDHAUS_INTERFACE_CPP \ No newline at end of file diff --git a/src/app/panels/foldhaus_panel_hierarchy.h b/src/app/panels/foldhaus_panel_hierarchy.h index c2d1ddb..cdb9e9a 100644 --- a/src/app/panels/foldhaus_panel_hierarchy.h +++ b/src/app/panels/foldhaus_panel_hierarchy.h @@ -71,7 +71,7 @@ HierarchyView_Render(panel Panel, rect PanelBounds, render_command_buffer* Rende b32 Success = GetFilePath(Context, &FilePath, "Foldhaus Files\0*.fold\0\0"); if (Success) { - LoadAssembly(State, Context, FilePath); + LoadAssembly(&State->Assemblies, &State->LedSystem, &State->Transient, Context, FilePath, State->GlobalLog); } } diff --git a/src/app/sacn/sacn.h b/src/app/sacn/sacn.h index 4c4bc59..47adaa2 100644 --- a/src/app/sacn/sacn.h +++ b/src/app/sacn/sacn.h @@ -12,7 +12,7 @@ #define IP_ADDRESS_BYTES 16 #define STARTCODE_DMX 0 -/* +/* * a description of the address space being used */ #define PREAMBLE_SIZE_ADDR 0 @@ -52,7 +52,7 @@ /* * data definitions */ -#define ACN_IDENTIFIER "ASC-E1.17\0\0\0" +#define ACN_IDENTIFIER "ASC-E1.17\0\0\0" #define ROOT_VECTOR 4 #define FRAMING_VECTOR 2 #define DMP_VECTOR 2 @@ -159,7 +159,7 @@ VHD_PackLength_(u8* Buffer, u32 Length, b32 IncludeLength) return Cursor; } -internal cid +internal cid StringToCID_ (const char* String) { cid Result = {}; @@ -193,11 +193,11 @@ StringToCID_ (const char* String) Src++; } - return Result; + return Result; } internal void -InitStreamHeader (u8* Buffer, s32 BufferSize, +InitStreamHeader (u8* Buffer, s32 BufferSize, u16 SlotCount, u8 StartCode, u16 Universe, @@ -220,8 +220,8 @@ InitStreamHeader (u8* Buffer, s32 BufferSize, // TODO(Peter): If you never use this anywhere else, go back and remove the parameters VHD_PackFlags_(Cursor, false, false, false); - Cursor = VHD_PackLength_(Cursor, - STREAM_HEADER_SIZE - RLP_PREAMBLE_SIZE + SlotCount, + Cursor = VHD_PackLength_(Cursor, + STREAM_HEADER_SIZE - RLP_PREAMBLE_SIZE + SlotCount, false); // root vector @@ -234,8 +234,8 @@ InitStreamHeader (u8* Buffer, s32 BufferSize, } VHD_PackFlags_(Cursor, false, false, false); - Cursor = VHD_PackLength_(Cursor, - STREAM_HEADER_SIZE - FRAMING_FLAGS_AND_LENGTH_ADDR + SlotCount, + Cursor = VHD_PackLength_(Cursor, + STREAM_HEADER_SIZE - FRAMING_FLAGS_AND_LENGTH_ADDR + SlotCount, false); // framing vector @@ -263,7 +263,7 @@ InitStreamHeader (u8* Buffer, s32 BufferSize, Cursor = PackB2(Cursor, Universe); VHD_PackFlags_(Cursor, false, false, false); - Cursor = VHD_PackLength_(Cursor, + Cursor = VHD_PackLength_(Cursor, STREAM_HEADER_SIZE - DMP_FLAGS_AND_LENGTH_ADDR + SlotCount, false); @@ -292,7 +292,7 @@ InitStreamHeader (u8* Buffer, s32 BufferSize, // internal streaming_acn -InitializeSACN ( context Context) +InitializeSACN (context Context) { streaming_acn SACN = {}; @@ -313,7 +313,7 @@ internal void SACNUpdateSequence (streaming_acn* SACN) { // Never use 0 after the first one - if (++SACN->SequenceIterator == 0) + if (++SACN->SequenceIterator == 0) { ++SACN->SequenceIterator; }