Fixed RGBA16 output being pixel swapped.
Cartridge (big-endian): 1234 RAM (little-endian): 4321 Source 16-bit image: 12-34 (2 pixels) Emulated image should be 21-43 (big => little), but the word swap made it 43-21 (pixel swapped) Output: 4321 => 2143master
parent
a532f4945d
commit
3b0792dfab
|
@ -28,6 +28,7 @@
|
|||
</Command>
|
||||
</CustomCommands>
|
||||
</CustomCommands>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
|
@ -36,6 +37,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace DotN64.Desktop.SDL
|
|||
}
|
||||
}
|
||||
|
||||
public void Draw(VideoFrame frame, RealityCoprocessor.VideoInterface vi, RDRAM ram)
|
||||
public unsafe void Draw(VideoFrame frame, RealityCoprocessor.VideoInterface vi, RDRAM ram)
|
||||
{
|
||||
PollEvents();
|
||||
|
||||
|
@ -163,7 +163,19 @@ namespace DotN64.Desktop.SDL
|
|||
var line = (ushort)((vi.CurrentVerticalLine - vi.VerticalVideo.ActiveVideoStart) / (float)(vi.VerticalVideo.ActiveVideoEnd - vi.VerticalVideo.ActiveVideoStart) * frame.Height);
|
||||
var offset = pitch * line;
|
||||
|
||||
Marshal.Copy(ram.Memory, (int)vi.DRAMAddress + offset, pixels + offset, pitch);
|
||||
if (frame.Size != ControlRegister.PixelSize.RGBA5553)
|
||||
Marshal.Copy(ram.Memory, (int)vi.DRAMAddress + offset, pixels + offset, pitch);
|
||||
else
|
||||
{
|
||||
fixed (byte* rdram = &ram.Memory[(int)vi.DRAMAddress])
|
||||
{
|
||||
for (int end = offset + pitch; offset < end; offset += 4)
|
||||
{
|
||||
((ushort*)(pixels + offset))[0] = ((ushort*)(rdram + offset))[1];
|
||||
((ushort*)(pixels + offset))[1] = ((ushort*)(rdram + offset))[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_UnlockTexture(texture);
|
||||
|
|
Loading…
Reference in New Issue