Rename RenderBase.OTextureFormat.rgba8 to RenderBase.OTextureFormat.argb8

This commit is contained in:
miku-666
2022-09-28 15:09:04 +02:00
parent 5d9ce5539b
commit 7f81e1e4b1
3 changed files with 13 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Drawing;
using System.Collections.Generic;
namespace Ohana3DS_Rebirth.Ohana
{
@@ -20,12 +21,12 @@ namespace Ohana3DS_Rebirth.Ohana
public static Bitmap Decode(byte[] data, int width, int height, RenderBase.OTextureFormat format)
{
byte[] output = new byte[width * height * 4];
long dataOffset = 0;
int dataOffset = 0;
bool toggle = false;
switch (format)
{
case RenderBase.OTextureFormat.rgba8:
case RenderBase.OTextureFormat.argb8:
for (int tY = 0; tY < height / 8; tY++)
{
for (int tX = 0; tX < width / 8; tX++)
@@ -34,11 +35,10 @@ namespace Ohana3DS_Rebirth.Ohana
{
int x = tileOrder[pixel] % 8;
int y = (tileOrder[pixel] - x) / 8;
long outputOffset = ((tX * 8) + x + ((tY * 8 + y) * width)) * 4;
int outputOffset = ((tX * 8 + x) + ((tY * 8 + y) * width)) * 4;
Buffer.BlockCopy(data, (int)dataOffset + 1, output, (int)outputOffset, 3);
Buffer.BlockCopy(data, dataOffset + 1, output, outputOffset, 3);
output[outputOffset + 3] = data[dataOffset];
dataOffset += 4;
}
}
@@ -56,7 +56,7 @@ namespace Ohana3DS_Rebirth.Ohana
int y = (tileOrder[pixel] - x) / 8;
long outputOffset = ((tX * 8) + x + ((tY * 8 + y) * width)) * 4;
Buffer.BlockCopy(data, (int)dataOffset, output, (int)outputOffset, 3);
Buffer.BlockCopy(data, dataOffset, output, (int)outputOffset, 3);
output[outputOffset + 3] = 0xff;
dataOffset += 3;
@@ -327,7 +327,7 @@ namespace Ohana3DS_Rebirth.Ohana
int outputOffset = 0;
switch (format)
{
case RenderBase.OTextureFormat.rgba8:
case RenderBase.OTextureFormat.argb8:
for (int tY = 0; tY < img.Height / 8; tY++)
{
for (int tX = 0; tX < img.Width / 8; tX++)
@@ -340,14 +340,13 @@ namespace Ohana3DS_Rebirth.Ohana
Buffer.BlockCopy(data, dataOffset, output, outputOffset + 1, 3);
output[outputOffset] = data[dataOffset + 3];
outputOffset += 4;
}
}
}
break;
default: throw new NotImplementedException();
default: throw new NotImplementedException(nameof(format));
}
return output;