Skip to content

Commit

Permalink
Merge pull request #13 from iMrShadow/main
Browse files Browse the repository at this point in the history
Update v2.5.0
  • Loading branch information
iMrShadow authored Oct 13, 2024
2 parents 07a08b6 + 60d65e5 commit 7398fc6
Show file tree
Hide file tree
Showing 774 changed files with 23,994 additions and 11,653 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ name: .NET

on:
push:
branches: [ "main" ]
branches: [ "main", "beta" ]
pull_request:
branches: [ "main" ]
branches: [ "main", "beta" ]

env:
GUI_PROJECT_PATH : 'DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/DDS_D3DTX_Converter.csproj'
GUI_PROJECT_PATH : 'TelltaleTextureTool/TelltaleTextureTool/TelltaleTextureTool.csproj'
OUTPUT_PROJECT_PATH : 'Builds'

jobs:
Expand All @@ -33,9 +33,9 @@ jobs:
- name: Publish
run: dotnet publish ${{env.GUI_PROJECT_PATH}} --configuration Release --no-build
- name: Zip
run: zip -r DDS_D3DTX_Converter.zip ./DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/bin/Release/net8.0/publish/
run: zip -r TelltaleTextureTool.zip ./TelltaleTextureTool/TelltaleTextureTool/bin/Release/net8.0/publish/
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: DDS_D3DTX_Converter
path: ./DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/bin/Release/net8.0/publish/
name: TelltaleTextureTool
path: ./TelltaleTextureTool/TelltaleTextureTool/bin/Release/net8.0/publish/
9 changes: 0 additions & 9 deletions .vscode/settings.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1627,3 +1627,202 @@
// }
// }
// }
// /// <summary>
// /// Combines two byte arrays into one. Used for cubefaces. Memory intensive.
// /// </summary>
// /// <param name="first"></param>
// /// <param name="second"></param>
// /// <returns></returns>
// public static byte[] CombineCubeface(byte[] first, List<byte[]> second)
// {
// byte[] bytes = [];

// //allocate a byte array with both total lengths combined to accomodate both
// for (int i = second.Count - 1; i >= 0; i--)
// {
// bytes = new byte[first.Length + second[i].Length];

// //copy the data from the first array into the new array
// Buffer.BlockCopy(first, 0, bytes, 0, first.Length);

// //copy the data from the second array into the new array (offset by the total length of the first array)
// Buffer.BlockCopy(second[i], 0, bytes, first.Length, second[i].Length);

// first = Combine(first, second[i]);
// }

// //return the final byte array
// return bytes;
// }
/*
void __fastcall T3SamplerStateBlock::SetStateMask(T3SamplerStateBlock *this, unsigned int state)
{
this->mData |= dword_14102C98C[2 * state];
}
T3SamplerStateBlock *__fastcall T3SamplerStateBlock::Merge(T3SamplerStateBlock *this, T3SamplerStateBlock *result, T3SamplerStateBlock *rhs, T3SamplerStateBlock *mask)
{
T3SamplerStateBlock *v4; // rax@1
v4 = result;
result->mData = mask->mData & rhs->mData | this->mData & ~mask->mData;
return v4;
}
__int64 __fastcall T3SamplerStateBlock::InternalGetSamplerState(T3SamplerStateBlock *this, unsigned int state)
{
return (this->mData & HIDWORD((&T3SamplerStateBlock::smEntries)[state])) >> LODWORD((&T3SamplerStateBlock::smEntries)[state]);
}
void __fastcall T3SamplerStateBlock::InternalSetSamplerState(T3SamplerStateBlock *this, unsigned int state, unsigned int value)
{
T3SamplerStateBlock *v3; // r9@1
struct T3SamplerStateBlock::SamplerStateEntry near **v4; // rcx@1
v3 = this;
v4 = &(&T3SamplerStateBlock::smEntries)[state];
v3->mData &= ~*(v4 + 1);
v3->mData |= value << *v4;
}
__int64 __fastcall T3SamplerStateBlock::DecrementMipBias(T3SamplerStateBlock *this, unsigned int steps)
{
float v2; // xmm0_4@1
unsigned int v3; // eax@1
__int64 result; // rax@3
unsigned int v5; // er8@3
v2 = FLOAT_8_0;
v3 = steps + ((dword_14102C9B4 & this->mData) >> dword_14102C9B0);
if ( v3 < 8.0 )
v2 = v3;
result = ffloor(v2);
v5 = this->mData & ~dword_14102C9B4;
this->mData = v5;
this->mData = v5 | (result << dword_14102C9B0);
return result;
}
void T3SamplerStateBlock::Initialize(void)
{
LODWORD(T3SamplerStateBlock::smEntries) = 0;
dword_14102C98C[0] = 15;
dword_14102C990 = 4;
dword_14102C994 = 240;
dword_14102C998 = 8;
dword_14102C99C = 256;
dword_14102C9A0 = 9;
T3SamplerStateBlock::kDefault.mData = (((T3SamplerStateBlock::kDefault.mData & 0xFFFFFFF0 | 1) & 0xFFFFFF0F | 0x10) & 0xFFFFFEFF | 0x100) & 0xFFC001FF;
dword_14102C9A4 = 7680;
dword_14102C9A8 = 13;
dword_14102C9AC = 0x2000;
dword_14102C9B0 = 14;
dword_14102C9B4 = 4177920;
}
public static SKColorType GetSKColorType(DXGIFormat format) => format switch
{
DXGIFormat.R32G32B32A32_TYPELESS => SKColorType.RgbaF32,
DXGIFormat.R32G32B32A32_FLOAT => SKColorType.RgbaF32,
DXGIFormat.R32G32B32A32_UINT => SKColorType.RgbaF32,
DXGIFormat.R32G32B32A32_SINT => SKColorType.RgbaF32,
//DXGIFormat.R32G32B32_TYPELESS => SKColorType.RgbaF32,
//DXGIFormat.R32G32B32_FLOAT => SKColorType.RgbaF32,
//DXGIFormat.R32G32B32_UINT => SKColorType.RgbaF32,
//DXGIFormat.R32G32B32_SINT => SKColorType.RgbaF32,
DXGIFormat.R16G16B16A16_TYPELESS => SKColorType.Rgba16161616,
DXGIFormat.R16G16B16A16_FLOAT => SKColorType.Rgba16161616,
DXGIFormat.R16G16B16A16_UNORM => SKColorType.Rgba16161616,
DXGIFormat.R16G16B16A16_UINT => SKColorType.Rgba16161616,
DXGIFormat.R16G16B16A16_SNORM => SKColorType.Rgba16161616,
DXGIFormat.R16G16B16A16_SINT => SKColorType.Rgba16161616,
DXGIFormat.R10G10B10A2_TYPELESS => SKColorType.Rgba1010102,
DXGIFormat.R10G10B10A2_UNORM => SKColorType.Rgba1010102,
DXGIFormat.R10G10B10A2_UINT => SKColorType.Rgba1010102,
DXGIFormat.R8G8B8A8_TYPELESS => SKColorType.Rgba8888,
DXGIFormat.R8G8B8A8_UNORM => SKColorType.Rgba8888,
DXGIFormat.R8G8B8A8_UNORM_SRGB => SKColorType.Rgba8888,
DXGIFormat.R8G8B8A8_UINT => SKColorType.Rgba8888,
DXGIFormat.R8G8B8A8_SNORM => SKColorType.Rgba8888,
DXGIFormat.R8G8B8A8_SINT => SKColorType.Rgba8888,
DXGIFormat.R16G16_TYPELESS => SKColorType.Rg1616,
DXGIFormat.R16G16_FLOAT => SKColorType.Rg1616,
DXGIFormat.R16G16_UNORM => SKColorType.Rg1616,
DXGIFormat.R16G16_UINT => SKColorType.Rg1616,
DXGIFormat.R16G16_SNORM => SKColorType.Rg1616,
DXGIFormat.R16G16_SINT => SKColorType.Rg1616,
DXGIFormat.R8G8_TYPELESS => SKColorType.Rg88,
DXGIFormat.R8G8_UNORM => SKColorType.Rg88,
DXGIFormat.R8G8_UINT => SKColorType.Rg88,
DXGIFormat.R8G8_SNORM => SKColorType.Rg88,
DXGIFormat.R8G8_SINT => SKColorType.Rg88,
DXGIFormat.R8_TYPELESS => SKColorType.Gray8,
DXGIFormat.R8_UNORM => SKColorType.Gray8,
DXGIFormat.R8_UINT => SKColorType.Gray8,
DXGIFormat.R8_SNORM => SKColorType.Gray8,
DXGIFormat.R8_SINT => SKColorType.Gray8,
DXGIFormat.A8_UNORM => SKColorType.Alpha8,
DXGIFormat.B5G6R5_UNORM => SKColorType.Rgba8888,
DXGIFormat.B8G8R8A8_UNORM => SKColorType.Bgra8888,
DXGIFormat.B8G8R8A8_TYPELESS => SKColorType.Bgra8888,
DXGIFormat.B8G8R8A8_UNORM_SRGB => SKColorType.Bgra8888,
DXGIFormat.B4G4R4A4_UNORM => SKColorType.Argb4444,
DXGIFormat.A4B4G4R4_UNORM => SKColorType.Argb4444,
_ => SKColorType.Unknown // Default or unknown format
};
public static byte[] LoadTexture(string path) => File.ReadAllBytes(path);
public static byte[] GetBytesAfterBytePattern(string searchString, byte[] fileBytes)
{
byte[] searchBytes = Encoding.ASCII.GetBytes(searchString);
int position = SearchBytePattern(searchBytes, fileBytes);
if (position != -1)
{
byte[] resultBytes = new byte[fileBytes.Length - position];
Array.Copy(fileBytes, position, resultBytes, 0, resultBytes.Length);
return resultBytes;
}
return [];
}
public static int SearchBytePattern(byte[] pattern, byte[] bytes)
{
int patternLen = pattern.Length;
int totalLen = bytes.Length;
byte firstMatchByte = pattern[0];
for (int i = 0; i < totalLen; i++)
{
if (firstMatchByte == bytes[i] && totalLen - i >= patternLen)
{
byte[] match = new byte[patternLen];
Array.Copy(bytes, i, match, 0, patternLen);
if (AreArraysEqual(match, pattern))
{
return i;
}
}
}
return -1;
}
public static bool AreArraysEqual(byte[] a1, byte[] a2)
{
if (a1.Length != a2.Length)
return false;
for (int i = 0; i < a1.Length; i++)
{
if (a1[i] != a2[i])
return false;
}
return true;
}
*/
//}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.IO;
using System.Runtime.InteropServices;

namespace D3DTX_Converter.TelltaleTypes;
namespace TelltaleTextureTool.TelltaleTypes;

//NOT COMPLETED
public struct AuxilaryData
Expand Down
Loading

0 comments on commit 7398fc6

Please sign in to comment.