Added some notes to various parts of the code base. Also simplified test patterns to ensure that we don't need to use leds_in_universe_range anywhere except in DMX buffer preparation

This commit is contained in:
Peter Slattery 2020-02-05 12:20:03 -08:00
parent 58ef0b460f
commit 75bb2ae86d
10 changed files with 69 additions and 87 deletions

View File

@ -503,7 +503,6 @@ HandleWindowsMessage (
else
{
printf("Translated Char Not Recognized: %c\n", TranslatedChar);
//InvalidCodePath;
}
*/
}break;

View File

@ -113,6 +113,8 @@ GetWallClock ()
if (!QueryPerformanceCounter(&Time))
{
s32 Error = GetLastError();
// TODO(Peter): I'm waiting to see an error actually occur here
// to know what it could possibly be.
InvalidCodePath;
}
return (s64)Time.QuadPart;
@ -125,6 +127,8 @@ GetPerformanceFrequency ()
if (!QueryPerformanceFrequency(&Frequency))
{
s32 Error = GetLastError();
// TODO(Peter): I'm waiting to see an error actually occur here
// to know what it could possibly be.
InvalidCodePath;
}
return (s64)Frequency.QuadPart;

View File

@ -83,9 +83,10 @@ ParseAssemblyVector (char* String)
return Result;
}
internal void
internal b32
ParseAssemblyFileHeader (assembly_definition* Assembly, tokenizer* Tokenizer)
{
b32 HeaderIsValid = false;
if (CharArraysEqualUpToLength(Tokenizer->At, LED_STRIP_COUNT_IDENTIFIER, CharArrayLength(LED_STRIP_COUNT_IDENTIFIER)))
{
@ -95,19 +96,11 @@ ParseAssemblyFileHeader (assembly_definition* Assembly, tokenizer* Tokenizer)
if (CountToken.Type == AssemblyToken_Number)
{
Assembly->LEDStripSize = ParseSignedIntUnsafe(CountToken.Token).SignedIntValue;
}
else
{
InvalidCodePath;
HeaderIsValid = true;
}
EatWhitespace(Tokenizer);
}
else
{
// TODO(Peter): Handle corrupted files, try to recover?
InvalidCodePath;
}
return HeaderIsValid;
}
internal led_strip_definition

View File

@ -92,12 +92,7 @@ internal void OpenColorPicker(app_state* State, v4* Address);
internal void
TestPatternOne(assembly* Assembly, r32 Time)
{
for (u32 Range = 0; Range < Assembly->LEDUniverseMapCount; Range++)
{
leds_in_universe_range LEDUniverseRange = Assembly->LEDUniverseMap[Range];
for (s32 LEDIdx = LEDUniverseRange.RangeStart;
LEDIdx < LEDUniverseRange.RangeOnePastLast;
LEDIdx++)
for (u32 LEDIdx = 0; LEDIdx < Assembly->LEDCount; LEDIdx++)
{
led LED = Assembly->LEDs[LEDIdx];
Assembly->Colors[LED.Index].R = 255;
@ -105,7 +100,6 @@ TestPatternOne(assembly* Assembly, r32 Time)
Assembly->Colors[LED.Index].G = 255;
}
}
}
internal void
TestPatternTwo(assembly* Assembly, r32 Time)
@ -127,12 +121,7 @@ TestPatternTwo(assembly* Assembly, r32 Time)
r32 OuterRadiusSquared = 1000000;
r32 InnerRadiusSquared = 0;
for (u32 Range = 0; Range < Assembly->LEDUniverseMapCount; Range++)
{
leds_in_universe_range LEDUniverseRange = Assembly->LEDUniverseMap[Range];
for (s32 LEDIdx = LEDUniverseRange.RangeStart;
LEDIdx < LEDUniverseRange.RangeOnePastLast;
LEDIdx++)
for (u32 LEDIdx = 0; LEDIdx < Assembly->LEDCount; LEDIdx++)
{
led LED = Assembly->LEDs[LEDIdx];
@ -165,7 +154,6 @@ TestPatternTwo(assembly* Assembly, r32 Time)
}
}
}
}
internal void
TestPatternThree(assembly* Assembly, r32 Time)
@ -178,12 +166,8 @@ TestPatternThree(assembly* Assembly, r32 Time)
r32 FadeDist = 35;
for (u32 Range = 0; Range < Assembly->LEDUniverseMapCount; Range++)
{
leds_in_universe_range LEDUniverseRange = Assembly->LEDUniverseMap[Range];
for (s32 LEDIdx = LEDUniverseRange.RangeStart;
LEDIdx < LEDUniverseRange.RangeOnePastLast;
LEDIdx++)
for (u32 LEDIdx = 0; LEDIdx < Assembly->LEDCount; LEDIdx++)
{
led LED = Assembly->LEDs[LEDIdx];
u8 Red = 0;
@ -204,7 +188,6 @@ TestPatternThree(assembly* Assembly, r32 Time)
Assembly->Colors[LED.Index].G = Green;
}
}
}
// END TEMPORARY PATTERNS

View File

@ -5,15 +5,6 @@
//
#ifndef FOLDHAUS_ASSEMBLY_CPP
internal s32
GetAssemblyMemorySizeFromDefinition(assembly_definition Definition, string Name)
{
s32 Result = (sizeof(led) + sizeof(pixel)) * Definition.TotalLEDCount;
Result += sizeof(leds_in_universe_range) * Definition.LEDStripCount;
Result += Name.Length;
return Result;
}
internal assembly
ConstructAssemblyFromDefinition (assembly_definition Definition,
string AssemblyName,

View File

@ -22,6 +22,10 @@ union pixel
u8 Channels[3];
};
// NOTE(Peter): This structure is so we can keep track of
// what LEDs output to which DMX universe. You don't need
// to use it anywhere else, as all the data for patterns,
// colors, and groups is/will be stored elsewhere.
struct leds_in_universe_range
{
s32 RangeStart;

View File

@ -639,7 +639,8 @@ WinMain (
}
else
{
InvalidCodePath;
MessageBox(MainWindow.Handle, "Unable to load application DLL at startup.\nAborting\n", "Set Up Error", MB_OK);
return -1;
}
WSADATA WSAData;

View File

@ -22,6 +22,8 @@ PLATFORM_FREE(Win32Free)
if (!Result)
{
s32 Error = WSAGetLastError();
// TODO(Peter): I'm waiting to see an error actually occur here
// to know what it could possibly be.
InvalidCodePath;
}
return Result;

View File

@ -15,6 +15,8 @@ GetPerformanceFrequency ()
if (!QueryPerformanceFrequency(&Frequency))
{
s32 Error = GetLastError();
// TODO(Peter): I'm waiting to see an error actually occur here
// to know what it could possibly be.
InvalidCodePath;
}
return (s64)Frequency.QuadPart;
@ -31,6 +33,8 @@ GetWallClock ()
if (!QueryPerformanceCounter(&Time))
{
s32 Error = GetLastError();
// TODO(Peter): I'm waiting to see an error actually occur here
// to know what it could possibly be.
InvalidCodePath;
}
return (s64)Time.QuadPart;

View File

@ -21,8 +21,8 @@ x Hot Code Reloading
- Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h)
-
- File Loading
- Gracefully handle File Not found
x File Loading
x Gracefully handle File Not found
- Buckets & Lists
- Allow them to use memory arenas
@ -57,6 +57,7 @@ x Hot Code Reloading
- styling
- text input
- lister with icon options
- panel system: destroy panel by extending it beyond its max, not just its min
- Sculpture View
- mouse spatial interaction - handles, and hover for info