Skip to content

Commit 5e4effa

Browse files
committed
Merge branch 'Version0.65'
2 parents fab8fec + ef4798a commit 5e4effa

File tree

475 files changed

+6752
-60251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

475 files changed

+6752
-60251
lines changed

Crowbar/Core/- General/EnumHelper.vb

+11-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Public NotInheritable Class EnumHelper
6565
Return index
6666
End Function
6767

68-
Public Shared Function IndexOfKeyAsCasInsensitiveString(ByVal keyText As String, ByVal list As IList) As Integer
68+
Public Shared Function IndexOfKeyAsCaseInsensitiveString(ByVal keyText As String, ByVal list As IList) As Integer
6969
Dim index As Integer = -1
7070
For pairIndex As Integer = 0 To list.Count - 1
7171
Dim pair As KeyValuePair(Of System.Enum, String) = CType(list(pairIndex), KeyValuePair(Of [Enum], String))
@@ -87,4 +87,14 @@ Public NotInheritable Class EnumHelper
8787
Return index
8888
End Function
8989

90+
Public Shared Function Key(ByVal index As Integer, ByVal list As IList) As System.Enum
91+
Dim pair As KeyValuePair(Of System.Enum, String) = CType(list(index), KeyValuePair(Of [Enum], String))
92+
Return pair.Key
93+
End Function
94+
95+
Public Shared Function Value(ByVal index As Integer, ByVal list As IList) As String
96+
Dim pair As KeyValuePair(Of System.Enum, String) = CType(list(index), KeyValuePair(Of [Enum], String))
97+
Return pair.Value
98+
End Function
99+
90100
End Class

Crowbar/Core/- General/MathModule.vb

-135
Original file line numberDiff line numberDiff line change
@@ -236,41 +236,6 @@ Module MathModule
236236
' matrix[2][3] = 0.f;
237237
'}
238238
''Public Sub AngleMatrix(ByVal pitchDegrees As Double, ByVal yawDegrees As Double, ByVal rollDegrees As Double, ByRef matrixColumn0 As SourceVector, ByRef matrixColumn1 As SourceVector, ByRef matrixColumn2 As SourceVector)
239-
Public Sub AngleMatrix(ByVal pitchRadians As Single, ByVal yawRadians As Single, ByVal rollRadians As Single, ByRef matrixColumn0 As SourceVectorSingle, ByRef matrixColumn1 As SourceVectorSingle, ByRef matrixColumn2 As SourceVectorSingle, ByRef matrixColumn3 As SourceVectorSingle)
240-
'Dim pitchRadians As Double
241-
'Dim yawRadians As Double
242-
'Dim rollRadians As Double
243-
Dim sr As Single
244-
Dim sp As Single
245-
Dim sy As Single
246-
Dim cr As Single
247-
Dim cp As Single
248-
Dim cy As Single
249-
250-
'pitchRadians = DegreesToRadians(pitchDegrees)
251-
'yawRadians = DegreesToRadians(yawDegrees)
252-
'rollRadians = DegreesToRadians(rollDegrees)
253-
254-
sy = CSng(Math.Sin(yawRadians))
255-
cy = CSng(Math.Cos(yawRadians))
256-
sp = CSng(Math.Sin(pitchRadians))
257-
cp = CSng(Math.Cos(pitchRadians))
258-
sr = CSng(Math.Sin(rollRadians))
259-
cr = CSng(Math.Cos(rollRadians))
260-
261-
matrixColumn0.x = cp * cy
262-
matrixColumn0.y = cp * sy
263-
matrixColumn0.z = -sp
264-
matrixColumn1.x = sr * sp * cy + cr * -sy
265-
matrixColumn1.y = sr * sp * sy + cr * cy
266-
matrixColumn1.z = sr * cp
267-
matrixColumn2.x = (cr * sp * cy + -sr * -sy)
268-
matrixColumn2.y = (cr * sp * sy + -sr * cy)
269-
matrixColumn2.z = cr * cp
270-
matrixColumn3.x = 0
271-
matrixColumn3.y = 0
272-
matrixColumn3.z = 0
273-
End Sub
274239
Public Sub AngleMatrix(ByVal pitchRadians As Double, ByVal yawRadians As Double, ByVal rollRadians As Double, ByRef matrixColumn0 As SourceVector, ByRef matrixColumn1 As SourceVector, ByRef matrixColumn2 As SourceVector, ByRef matrixColumn3 As SourceVector)
275240
'Dim pitchRadians As Double
276241
'Dim yawRadians As Double
@@ -439,22 +404,6 @@ Module MathModule
439404
' out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
440405
' in1[2][2] * in2[2][3] + in1[2][3];
441406
'}
442-
Public Sub R_ConcatTransforms(ByVal in1_matrixColumn0 As SourceVectorSingle, ByVal in1_matrixColumn1 As SourceVectorSingle, ByVal in1_matrixColumn2 As SourceVectorSingle, ByVal in1_matrixColumn3 As SourceVectorSingle, ByVal in2_matrixColumn0 As SourceVectorSingle, ByVal in2_matrixColumn1 As SourceVectorSingle, ByVal in2_matrixColumn2 As SourceVectorSingle, ByVal in2_matrixColumn3 As SourceVectorSingle, ByRef out_matrixColumn0 As SourceVectorSingle, ByRef out_matrixColumn1 As SourceVectorSingle, ByRef out_matrixColumn2 As SourceVectorSingle, ByRef out_matrixColumn3 As SourceVectorSingle)
443-
out_matrixColumn0.x = in1_matrixColumn0.x * in2_matrixColumn0.x + in1_matrixColumn1.x * in2_matrixColumn0.y + in1_matrixColumn2.x * in2_matrixColumn0.z
444-
out_matrixColumn1.x = in1_matrixColumn0.x * in2_matrixColumn1.x + in1_matrixColumn1.x * in2_matrixColumn1.y + in1_matrixColumn2.x * in2_matrixColumn1.z
445-
out_matrixColumn2.x = in1_matrixColumn0.x * in2_matrixColumn2.x + in1_matrixColumn1.x * in2_matrixColumn2.y + in1_matrixColumn2.x * in2_matrixColumn2.z
446-
out_matrixColumn3.x = in1_matrixColumn0.x * in2_matrixColumn3.x + in1_matrixColumn1.x * in2_matrixColumn3.y + in1_matrixColumn2.x * in2_matrixColumn3.z + in1_matrixColumn3.x
447-
448-
out_matrixColumn0.y = in1_matrixColumn0.y * in2_matrixColumn0.x + in1_matrixColumn1.y * in2_matrixColumn0.y + in1_matrixColumn2.y * in2_matrixColumn0.z
449-
out_matrixColumn1.y = in1_matrixColumn0.y * in2_matrixColumn1.x + in1_matrixColumn1.y * in2_matrixColumn1.y + in1_matrixColumn2.y * in2_matrixColumn1.z
450-
out_matrixColumn2.y = in1_matrixColumn0.y * in2_matrixColumn2.x + in1_matrixColumn1.y * in2_matrixColumn2.y + in1_matrixColumn2.y * in2_matrixColumn2.z
451-
out_matrixColumn3.y = in1_matrixColumn0.y * in2_matrixColumn3.x + in1_matrixColumn1.y * in2_matrixColumn3.y + in1_matrixColumn2.y * in2_matrixColumn3.z + in1_matrixColumn3.y
452-
453-
out_matrixColumn0.z = in1_matrixColumn0.z * in2_matrixColumn0.x + in1_matrixColumn1.z * in2_matrixColumn0.y + in1_matrixColumn2.z * in2_matrixColumn0.z
454-
out_matrixColumn1.z = in1_matrixColumn0.z * in2_matrixColumn1.x + in1_matrixColumn1.z * in2_matrixColumn1.y + in1_matrixColumn2.z * in2_matrixColumn1.z
455-
out_matrixColumn2.z = in1_matrixColumn0.z * in2_matrixColumn2.x + in1_matrixColumn1.z * in2_matrixColumn2.y + in1_matrixColumn2.z * in2_matrixColumn2.z
456-
out_matrixColumn3.z = in1_matrixColumn0.z * in2_matrixColumn3.x + in1_matrixColumn1.z * in2_matrixColumn3.y + in1_matrixColumn2.z * in2_matrixColumn3.z + in1_matrixColumn3.z
457-
End Sub
458407
Public Sub R_ConcatTransforms(ByVal in1_matrixColumn0 As SourceVector, ByVal in1_matrixColumn1 As SourceVector, ByVal in1_matrixColumn2 As SourceVector, ByVal in1_matrixColumn3 As SourceVector, ByVal in2_matrixColumn0 As SourceVector, ByVal in2_matrixColumn1 As SourceVector, ByVal in2_matrixColumn2 As SourceVector, ByVal in2_matrixColumn3 As SourceVector, ByRef out_matrixColumn0 As SourceVector, ByRef out_matrixColumn1 As SourceVector, ByRef out_matrixColumn2 As SourceVector, ByRef out_matrixColumn3 As SourceVector)
459408
out_matrixColumn0.x = in1_matrixColumn0.x * in2_matrixColumn0.x + in1_matrixColumn1.x * in2_matrixColumn0.y + in1_matrixColumn2.x * in2_matrixColumn0.z
460409
out_matrixColumn1.x = in1_matrixColumn0.x * in2_matrixColumn1.x + in1_matrixColumn1.x * in2_matrixColumn1.y + in1_matrixColumn2.x * in2_matrixColumn1.z
@@ -537,18 +486,10 @@ Module MathModule
537486
'{
538487
' return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
539488
'}
540-
Public Function DotProduct(ByVal vector1 As SourceVectorSingle, ByVal vector2 As SourceVectorSingle) As Single
541-
Return vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z
542-
End Function
543489
Public Function DotProduct(ByVal vector1 As SourceVector, ByVal vector2 As SourceVector) As Double
544490
Return vector1.x * vector2.x + vector1.y * vector2.y + vector1.z * vector2.z
545491
End Function
546492

547-
Public Sub VectorCopy(ByVal input As SourceVectorSingle, ByRef output As SourceVectorSingle)
548-
output.x = input.x
549-
output.y = input.y
550-
output.z = input.z
551-
End Sub
552493

553494
Public Sub VectorCopy(ByVal input As SourceVector, ByRef output As SourceVector)
554495
output.x = input.x
@@ -563,35 +504,6 @@ Module MathModule
563504
' out[1] = DotProduct(in1, in2[1]);
564505
' out[2] = DotProduct(in1, in2[2]);
565506
'}
566-
Public Function VectorRotate(ByVal input As SourceVectorSingle, ByVal matrixColumn0 As SourceVectorSingle, ByVal matrixColumn1 As SourceVectorSingle, ByVal matrixColumn2 As SourceVectorSingle, ByVal matrixColumn3 As SourceVectorSingle) As SourceVectorSingle
567-
Dim output As SourceVectorSingle
568-
Dim matrixRow0 As SourceVectorSingle
569-
Dim matrixRow1 As SourceVectorSingle
570-
Dim matrixRow2 As SourceVectorSingle
571-
572-
output = New SourceVectorSingle()
573-
matrixRow0 = New SourceVectorSingle()
574-
matrixRow1 = New SourceVectorSingle()
575-
matrixRow2 = New SourceVectorSingle()
576-
577-
matrixRow0.x = matrixColumn0.x
578-
matrixRow0.y = matrixColumn1.x
579-
matrixRow0.z = matrixColumn2.x
580-
581-
matrixRow1.x = matrixColumn0.y
582-
matrixRow1.y = matrixColumn1.y
583-
matrixRow1.z = matrixColumn2.y
584-
585-
matrixRow2.x = matrixColumn0.z
586-
matrixRow2.y = matrixColumn1.z
587-
matrixRow2.z = matrixColumn2.z
588-
589-
output.x = DotProduct(input, matrixRow0)
590-
output.y = DotProduct(input, matrixRow1)
591-
output.z = DotProduct(input, matrixRow2)
592-
593-
Return output
594-
End Function
595507
Public Function VectorRotate(ByVal input As SourceVector, ByVal matrixColumn0 As SourceVector, ByVal matrixColumn1 As SourceVector, ByVal matrixColumn2 As SourceVector, ByVal matrixColumn3 As SourceVector) As SourceVector
596508
Dim output As SourceVector
597509
Dim matrixRow0 As SourceVector
@@ -662,24 +574,6 @@ Module MathModule
662574
'
663575
' return length;
664576
'}
665-
Public Function VectorNormalize(ByRef ioVector As SourceVectorSingle) As Single
666-
Dim length As Single
667-
668-
length = 0
669-
length += ioVector.x * ioVector.x
670-
length += ioVector.y * ioVector.y
671-
length += ioVector.z * ioVector.z
672-
length = CSng(Math.Sqrt(length))
673-
If length = 0 Then
674-
Return 0
675-
End If
676-
677-
ioVector.x /= length
678-
ioVector.y /= length
679-
ioVector.z /= length
680-
681-
Return length
682-
End Function
683577
Public Function VectorNormalize(ByRef ioVector As SourceVector) As Double
684578
Dim length As Double
685579

@@ -710,35 +604,6 @@ Module MathModule
710604
' out[1] = DotProduct(in1, in2[1]) + in2[1][3];
711605
' out[2] = DotProduct(in1, in2[2]) + in2[2][3];
712606
'}
713-
Public Function VectorTransform(ByVal input As SourceVectorSingle, ByVal matrixColumn0 As SourceVectorSingle, ByVal matrixColumn1 As SourceVectorSingle, ByVal matrixColumn2 As SourceVectorSingle, ByVal matrixColumn3 As SourceVectorSingle) As SourceVectorSingle
714-
Dim output As SourceVectorSingle
715-
Dim matrixRow0 As SourceVectorSingle
716-
Dim matrixRow1 As SourceVectorSingle
717-
Dim matrixRow2 As SourceVectorSingle
718-
719-
output = New SourceVectorSingle()
720-
matrixRow0 = New SourceVectorSingle()
721-
matrixRow1 = New SourceVectorSingle()
722-
matrixRow2 = New SourceVectorSingle()
723-
724-
matrixRow0.x = matrixColumn0.x
725-
matrixRow0.y = matrixColumn1.x
726-
matrixRow0.z = matrixColumn2.x
727-
728-
matrixRow1.x = matrixColumn0.y
729-
matrixRow1.y = matrixColumn1.y
730-
matrixRow1.z = matrixColumn2.y
731-
732-
matrixRow2.x = matrixColumn0.z
733-
matrixRow2.y = matrixColumn1.z
734-
matrixRow2.z = matrixColumn2.z
735-
736-
output.x = DotProduct(input, matrixRow0) + matrixColumn3.x
737-
output.y = DotProduct(input, matrixRow1) + matrixColumn3.y
738-
output.z = DotProduct(input, matrixRow2) + matrixColumn3.z
739-
740-
Return output
741-
End Function
742607
Public Function VectorTransform(ByVal input As SourceVector, ByVal matrixColumn0 As SourceVector, ByVal matrixColumn1 As SourceVector, ByVal matrixColumn2 As SourceVector, ByVal matrixColumn3 As SourceVector) As SourceVector
743608
Dim output As SourceVector
744609
Dim matrixRow0 As SourceVector

Crowbar/Core/DebugLog/AccessedBytesDebugFile.vb

+33-33
Original file line numberDiff line numberDiff line change
@@ -32,42 +32,42 @@ Public Class AccessedBytesDebugFile
3232
line = "====== File Seek Log ======"
3333
Me.WriteLogLine(0, line)
3434

35-
line = "--- Summary ---"
36-
Me.WriteLogLine(0, line)
35+
'line = "--- Summary ---"
36+
'Me.WriteLogLine(0, line)
3737

3838
Dim offsetStart As Long
3939
Dim offsetEnd As Long
40-
offsetStart = -1
41-
offsetEnd = -1
42-
For i As Integer = 0 To aFileSeekLog.theFileSeekList.Count - 1
43-
If offsetStart = -1 Then
44-
offsetStart = aFileSeekLog.theFileSeekList.Keys(i)
45-
End If
46-
offsetEnd = aFileSeekLog.theFileSeekList.Values(i)
47-
48-
If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes") Then
49-
If i > 0 Then
50-
line = offsetStart.ToString("N0") + " - " + (aFileSeekLog.theFileSeekList.Keys(i) - 1).ToString("N0")
51-
Me.WriteLogLine(1, line)
52-
End If
53-
If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes (all zeroes)") Then
54-
line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (all zeroes)"
55-
Else
56-
line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (non-zero)"
57-
End If
58-
Me.WriteLogLine(1, line)
59-
offsetStart = -1
60-
ElseIf (i = aFileSeekLog.theFileSeekList.Count - 1) OrElse (offsetEnd + 1 <> aFileSeekLog.theFileSeekList.Keys(i + 1)) Then
61-
line = offsetStart.ToString("N0") + " - " + offsetEnd.ToString("N0")
62-
Me.WriteLogLine(1, line)
63-
offsetStart = -1
64-
End If
65-
Next
66-
67-
line = "------------------------"
68-
Me.WriteLogLine(0, line)
69-
line = "--- Each Section or Loop ---"
70-
Me.WriteLogLine(0, line)
40+
'offsetStart = -1
41+
'offsetEnd = -1
42+
'For i As Integer = 0 To aFileSeekLog.theFileSeekList.Count - 1
43+
' If offsetStart = -1 Then
44+
' offsetStart = aFileSeekLog.theFileSeekList.Keys(i)
45+
' End If
46+
' offsetEnd = aFileSeekLog.theFileSeekList.Values(i)
47+
48+
' If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes") Then
49+
' If i > 0 Then
50+
' line = offsetStart.ToString("N0") + " - " + (aFileSeekLog.theFileSeekList.Keys(i) - 1).ToString("N0")
51+
' Me.WriteLogLine(1, line)
52+
' End If
53+
' If aFileSeekLog.theFileSeekDescriptionList.Values(i).StartsWith("[ERROR] Unread bytes (all zeroes)") Then
54+
' line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (all zeroes)"
55+
' Else
56+
' line = aFileSeekLog.theFileSeekList.Keys(i).ToString("N0") + " - " + offsetEnd.ToString("N0") + " [ERROR] Unread bytes (non-zero)"
57+
' End If
58+
' Me.WriteLogLine(1, line)
59+
' offsetStart = -1
60+
' ElseIf (i = aFileSeekLog.theFileSeekList.Count - 1) OrElse (offsetEnd + 1 <> aFileSeekLog.theFileSeekList.Keys(i + 1)) Then
61+
' line = offsetStart.ToString("N0") + " - " + offsetEnd.ToString("N0")
62+
' Me.WriteLogLine(1, line)
63+
' offsetStart = -1
64+
' End If
65+
'Next
66+
67+
'line = "------------------------"
68+
'Me.WriteLogLine(0, line)
69+
'line = "--- Each Section or Loop ---"
70+
'Me.WriteLogLine(0, line)
7171

7272
offsetEnd = -1
7373
For i As Integer = 0 To aFileSeekLog.theFileSeekList.Count - 1

Crowbar/Core/DebugLog/FileSeekLog.vb

+20
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,32 @@ Public Class FileSeekLog
128128
Catch ex As Exception
129129
Dim debug As Integer = 4242
130130
End Try
131+
132+
Me.LogErrors()
131133
End Sub
132134

133135
Public theFileSize As Long
134136
Public theFileSeekList As SortedList(Of Long, Long)
135137
Public theFileSeekDescriptionList As SortedList(Of Long, String)
136138

139+
Private Sub LogErrors()
140+
Dim offsetStart As Long
141+
Dim offsetEnd As Long
142+
143+
Try
144+
For i As Integer = 0 To Me.theFileSeekList.Count - 1
145+
offsetStart = Me.theFileSeekList.Keys(i)
146+
offsetEnd = Me.theFileSeekList.Values(i)
147+
148+
If (i < Me.theFileSeekList.Count - 1) AndAlso (offsetEnd + 1 <> Me.theFileSeekList.Keys(i + 1)) Then
149+
Me.theFileSeekDescriptionList(offsetStart) = "[ERROR] [End offset is incorrect] " + Me.theFileSeekDescriptionList(offsetStart)
150+
End If
151+
Next
152+
Catch ex As Exception
153+
Dim debug As Integer = 4242
154+
End Try
155+
End Sub
156+
137157
Private Function GetByteValues(ByVal inputFileReader As BinaryReader, ByVal fileOffsetStart2 As Long, ByVal fileOffsetEnd2 As Long, ByRef allZeroesWereFound As Boolean) As String
138158
Dim byteValues As String
139159

0 commit comments

Comments
 (0)