Cocoa Port: Fix various issues on the PPC build.
- Fix compiling issues for big-endian systems. - Fix bug where the Recent ROMs menu and also launching the app while loading a ROM file would fail to load the ROM on macOS v10.5 Leopard. - Fix bug where GPU main memory display mode would show incorrect pixels on big-endian systems when running at 15-bit color depth. - As an unintended collateral improvement, GPUEngineA::_HandleDisplayModeMainMemory() now has SSE2-accelerated versions for 18-bit and 24-bit color depths. This was done less for its performance benefit (main memory display mode is an extremely rare feature) and more for better code consistency and code completeness.
This commit is contained in:
parent
e56059872f
commit
471f53e506
|
@ -875,6 +875,7 @@ static FORCEINLINE void CopyLineReduce_C(void *__restrict dst, const void *__res
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SSE2
|
||||
template <s32 INTEGERSCALEHINT, size_t ELEMENTSIZE>
|
||||
static FORCEINLINE void CopyLineReduce_SSE2(void *__restrict dst, const void *__restrict src, size_t srcWidth)
|
||||
{
|
||||
|
@ -1153,6 +1154,7 @@ static FORCEINLINE void CopyLineReduce_SSE2(void *__restrict dst, const void *__
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <s32 INTEGERSCALEHINT, bool NEEDENDIANSWAP, size_t ELEMENTSIZE>
|
||||
static FORCEINLINE void CopyLineReduce(void *__restrict dst, const void *__restrict src, size_t srcWidth)
|
||||
|
@ -8269,14 +8271,15 @@ void GPUEngineA::_HandleDisplayModeMainMemory(const size_t l)
|
|||
{
|
||||
// Displays video using color data directly read from main memory.
|
||||
// Doing this should always result in an output line that is at the native size (192px x 1px).
|
||||
|
||||
#ifdef ENABLE_SSE2
|
||||
switch (OUTPUTFORMAT)
|
||||
{
|
||||
case NDSColorFormat_BGR555_Rev:
|
||||
{
|
||||
u32 *dst = (u32 *)((u16 *)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH));
|
||||
|
||||
#ifdef ENABLE_SSE2
|
||||
u32 *__restrict dst = (u32 *__restrict)((u16 *)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH));
|
||||
const __m128i alphaBit = _mm_set1_epi16(0x8000);
|
||||
|
||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(__m128i); i++)
|
||||
{
|
||||
const u32 srcA = DISP_FIFOrecv();
|
||||
|
@ -8286,22 +8289,63 @@ void GPUEngineA::_HandleDisplayModeMainMemory(const size_t l)
|
|||
const __m128i fifoColor = _mm_setr_epi32(srcA, srcB, srcC, srcD);
|
||||
_mm_store_si128((__m128i *)dst + i, _mm_or_si128(fifoColor, alphaBit));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
{
|
||||
FragmentColor *__restrict dst = (FragmentColor *__restrict)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
__m128i dstLo;
|
||||
__m128i dstHi;
|
||||
|
||||
for (size_t i = 0, d = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(__m128i); i++, d+=2)
|
||||
{
|
||||
const u32 srcA = DISP_FIFOrecv();
|
||||
const u32 srcB = DISP_FIFOrecv();
|
||||
const u32 srcC = DISP_FIFOrecv();
|
||||
const u32 srcD = DISP_FIFOrecv();
|
||||
const __m128i fifoColor = _mm_setr_epi32(srcA, srcB, srcC, srcD);
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555To6665Opaque_SSE2<false>(fifoColor, dstLo, dstHi);
|
||||
}
|
||||
else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
|
||||
{
|
||||
ColorspaceConvert555To8888Opaque_SSE2<false>(fifoColor, dstLo, dstHi);
|
||||
}
|
||||
|
||||
_mm_store_si128((__m128i *)dst + d + 0, dstLo);
|
||||
_mm_store_si128((__m128i *)dst + d + 1, dstHi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
switch (OUTPUTFORMAT)
|
||||
{
|
||||
case NDSColorFormat_BGR555_Rev:
|
||||
{
|
||||
u32 *__restrict dst = (u32 *__restrict)((u16 *)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH));
|
||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(u32); i++)
|
||||
{
|
||||
dst[i] = DISP_FIFOrecv() | 0x80008000;
|
||||
}
|
||||
const u32 src = DISP_FIFOrecv();
|
||||
#ifdef MSB_FIRST
|
||||
dst[i] = (src >> 16) | (src << 16) | 0x80008000;
|
||||
#else
|
||||
dst[i] = src | 0x80008000;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
{
|
||||
FragmentColor *dst = (FragmentColor *)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
|
||||
FragmentColor *__restrict dst = (FragmentColor *__restrict)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i+=2)
|
||||
{
|
||||
u32 src = DISP_FIFOrecv();
|
||||
const u32 src = DISP_FIFOrecv();
|
||||
dst[i+0].color = COLOR555TO6665_OPAQUE((src >> 0) & 0x7FFF);
|
||||
dst[i+1].color = COLOR555TO6665_OPAQUE((src >> 16) & 0x7FFF);
|
||||
}
|
||||
|
@ -8310,17 +8354,17 @@ void GPUEngineA::_HandleDisplayModeMainMemory(const size_t l)
|
|||
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
{
|
||||
FragmentColor *dst = (FragmentColor *)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
|
||||
FragmentColor *__restrict dst = (FragmentColor *__restrict)this->nativeBuffer + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i+=2)
|
||||
{
|
||||
u32 src = DISP_FIFOrecv();
|
||||
const u32 src = DISP_FIFOrecv();
|
||||
dst[i+0].color = COLOR555TO8888_OPAQUE((src >> 0) & 0x7FFF);
|
||||
dst[i+1].color = COLOR555TO8888_OPAQUE((src >> 16) & 0x7FFF);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool MOSAIC, bool WILLPERFORMWINDOWTEST, bool WILLDEFERCOMPOSITING>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2012-2017 DeSmuME Team
|
||||
Copyright (C) 2012-2018 DeSmuME Team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -116,7 +116,7 @@ static NSDictionary *hidUsageTable = nil;
|
|||
CFRelease(elementArray);
|
||||
|
||||
// Set up force feedback.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
|
||||
if (IsOSXVersionSupported(10, 6, 0))
|
||||
{
|
||||
ioService = IOHIDDeviceGetService(hidDeviceRef);
|
||||
|
|
|
@ -109,8 +109,11 @@
|
|||
// simply save the passed in file name, and then automatically call this method again with our
|
||||
// previously saved file name the moment before [NSApplicationDelgate applicationDidFinishLaunching:]
|
||||
// finishes.
|
||||
//
|
||||
// We'll do the delayed ROM loading only for Mavericks and later, since this delayed loading code
|
||||
// doesn't seem to work on older macOS versions.
|
||||
|
||||
if (![self didApplicationFinishLaunching])
|
||||
if (IsOSXVersionSupported(10, 9, 0) && ![self didApplicationFinishLaunching])
|
||||
{
|
||||
[self setDelayedROMFileName:filename];
|
||||
result = YES;
|
||||
|
@ -171,10 +174,12 @@
|
|||
// On macOS v10.13 and later, some unwanted menu items will show up in the View menu.
|
||||
// Disable automatic window tabbing for all NSWindows in order to rid ourselves of
|
||||
// these unwanted menu items.
|
||||
#if defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
|
||||
if ([[NSWindow class] respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
|
||||
{
|
||||
[NSWindow setAllowsAutomaticWindowTabbing:NO];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setup the About window.
|
||||
NSString *descriptionStr = [[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"] stringByAppendingString:@" "] stringByAppendingString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
|
||||
|
@ -342,7 +347,7 @@
|
|||
// If the user is trying to load a ROM file while launching the app, then ensure that the
|
||||
// ROM file is loaded at the end of this method and never any time before that.
|
||||
[self setDidApplicationFinishLaunching:YES];
|
||||
if ([self delayedROMFileName] != nil)
|
||||
if (IsOSXVersionSupported(10, 9, 0) && [self delayedROMFileName] != nil)
|
||||
{
|
||||
[self application:NSApp openFile:[self delayedROMFileName]];
|
||||
[self setDelayedROMFileName:nil];
|
||||
|
|
|
@ -497,18 +497,18 @@ typedef union
|
|||
u8 reserved1:4;
|
||||
u8 DAC:4;
|
||||
|
||||
u8 VTC_EN1:1;
|
||||
u8 LPF1:1;
|
||||
u8 CPL1:1;
|
||||
u8 PDP1:1;
|
||||
u8 AUTOCAL_EN1:1;
|
||||
u8 LD_EN1:1;
|
||||
u8 P1:1;
|
||||
u8 VTC_EN:1;
|
||||
u8 LPF:1;
|
||||
u8 CPL:1;
|
||||
u8 PDP:1;
|
||||
u8 AUTOCAL_EN:1;
|
||||
u8 LD_EN:1;
|
||||
u8 P:1;
|
||||
u8 reserved2:1;
|
||||
|
||||
u8 :6;
|
||||
u8 PLL_EN1:1;
|
||||
u8 KV_EN1:1;
|
||||
u8 PLL_EN:1;
|
||||
u8 KV_EN:1;
|
||||
|
||||
u8 :8;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue