Implemented fix from Main (#34)
This commit is contained in:
parent
03c6ffd4c2
commit
5deaae7bc2
3 changed files with 6161 additions and 6115 deletions
12132
src/custom.cpp
12132
src/custom.cpp
File diff suppressed because it is too large
Load diff
|
@ -438,20 +438,41 @@ extern void gui_message (const TCHAR *,...);
|
|||
* Byte-swapping functions
|
||||
*/
|
||||
|
||||
#ifdef ARMV6_ASSEMBLY
|
||||
|
||||
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {__asm__ (
|
||||
/* Try to use system bswap_16/bswap_32 functions. */
|
||||
#if defined HAVE_BSWAP_16 && defined HAVE_BSWAP_32
|
||||
# include <byteswap.h>
|
||||
# ifdef HAVE_BYTESWAP_H
|
||||
# include <byteswap.h>
|
||||
# endif
|
||||
#else
|
||||
# ifdef ARMV6_ASSEMBLY
|
||||
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {
|
||||
__asm__(
|
||||
"rev %0, %0"
|
||||
: "=r" (v) : "0" (v) ); return v;}
|
||||
: "=r" (v) : "0" (v)); return v;
|
||||
}
|
||||
|
||||
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {__asm__ (
|
||||
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {
|
||||
__asm__(
|
||||
"revsh %0, %0\n\t"
|
||||
"uxth %0, %0"
|
||||
: "=r" (v) : "0" (v) ); return v;}
|
||||
|
||||
#endif
|
||||
|
||||
: "=r" (v) : "0" (v)); return v;
|
||||
}
|
||||
#define bswap_16(x) do_byteswap_16(x)
|
||||
#define bswap_32(x) do_byteswap_32(x)
|
||||
# else
|
||||
/* Else, if using SDL, try SDL's endian functions. */
|
||||
# ifdef USE_SDL
|
||||
# include <SDL_endian.h>
|
||||
# define bswap_16(x) SDL_Swap16(x)
|
||||
# define bswap_32(x) SDL_Swap32(x)
|
||||
# else
|
||||
/* Otherwise, we'll roll our own. */
|
||||
#define bswap_16(x) (((x) >> 8) | (((x) & 0xFF) << 8))
|
||||
#define bswap_32(x) (((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((x) >> 24))
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -94,9 +94,9 @@ static struct PicassoResolution *newmodes = NULL;
|
|||
|
||||
static int picasso_convert, host_mode;
|
||||
|
||||
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */
|
||||
/* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
|
||||
/* data here. */
|
||||
/* These are the maximum resolutions... They are filled in by GetSupportedResolutions()
|
||||
have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
|
||||
data here. */
|
||||
static struct ScreenResolution planar = { 320, 240 };
|
||||
static struct ScreenResolution chunky = { 640, 480 };
|
||||
static struct ScreenResolution hicolour = { 640, 480 };
|
||||
|
@ -1973,64 +1973,67 @@ FillRect:
|
|||
* d5: UBYTE Mask
|
||||
* d7: uae_u32 RGBFormat
|
||||
***********************************************************/
|
||||
__attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect (TrapContext *ctx)
|
||||
//__attribute__((optimize("O2"))) is needed otherwise this crashes with O3!
|
||||
__attribute__((optimize("O2"))) static uae_u32 REGPARAM2 picasso_FillRect(TrapContext *ctx)
|
||||
{
|
||||
uaecptr renderinfo = m68k_areg (regs, 1);
|
||||
uae_u32 X = (uae_u16)m68k_dreg (regs, 0);
|
||||
uae_u32 Y = (uae_u16)m68k_dreg (regs, 1);
|
||||
uae_u32 Width = (uae_u16)m68k_dreg (regs, 2);
|
||||
uae_u32 Height = (uae_u16)m68k_dreg (regs, 3);
|
||||
uae_u32 Pen = m68k_dreg (regs, 4);
|
||||
uae_u8 Mask = (uae_u8)m68k_dreg (regs, 5);
|
||||
RGBFTYPE RGBFormat = (RGBFTYPE) m68k_dreg (regs, 7);
|
||||
uae_u8 *oldstart;
|
||||
int Bpp;
|
||||
struct RenderInfo ri;
|
||||
uae_u32 result = 0;
|
||||
uaecptr renderinfo = m68k_areg(regs, 1);
|
||||
uae_u32 X = (uae_u16)m68k_dreg(regs, 0);
|
||||
uae_u32 Y = (uae_u16)m68k_dreg(regs, 1);
|
||||
uae_u32 Width = (uae_u16)m68k_dreg(regs, 2);
|
||||
uae_u32 Height = (uae_u16)m68k_dreg(regs, 3);
|
||||
uae_u32 Pen = m68k_dreg(regs, 4);
|
||||
uae_u8 Mask = (uae_u8)m68k_dreg(regs, 5);
|
||||
RGBFTYPE RGBFormat = (RGBFTYPE) m68k_dreg(regs, 7);
|
||||
uae_u8 *oldstart;
|
||||
int Bpp;
|
||||
struct RenderInfo ri;
|
||||
uae_u32 result = 0;
|
||||
|
||||
if (NOBLITTER)
|
||||
return 0;
|
||||
if (CopyRenderInfoStructureA2U (renderinfo, &ri) && Y != 0xFFFF) {
|
||||
Bpp = GetBytesPerPixel (RGBFormat);
|
||||
if (NOBLITTER)
|
||||
return 0;
|
||||
if (CopyRenderInfoStructureA2U(renderinfo, &ri) && Y != 0xFFFF) {
|
||||
Bpp = GetBytesPerPixel(RGBFormat);
|
||||
|
||||
P96TRACE((_T("FillRect(%d, %d, %d, %d) Pen 0x%x BPP %d BPR %d Mask 0x%x\n"),
|
||||
X, Y, Width, Height, Pen, Bpp, ri.BytesPerRow, Mask));
|
||||
|
||||
if (Bpp > 1)
|
||||
Mask = 0xFF;
|
||||
if (Bpp > 1)
|
||||
Mask = 0xFF;
|
||||
|
||||
if (Mask == 0xFF) {
|
||||
if (Mask == 0xFF) {
|
||||
|
||||
/* Do the fill-rect in the frame-buffer */
|
||||
do_fillrect_frame_buffer (&ri, X, Y, Width, Height, Pen, Bpp);
|
||||
result = 1;
|
||||
/* Do the fill-rect in the frame-buffer */
|
||||
do_fillrect_frame_buffer(&ri, X, Y, Width, Height, Pen, Bpp);
|
||||
result = 1;
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
/* We get here only if Mask != 0xFF */
|
||||
if (Bpp != 1) {
|
||||
write_log (_T("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n"), Mask, Bpp);
|
||||
} else {
|
||||
Pen &= Mask;
|
||||
Mask = ~Mask;
|
||||
oldstart = ri.Memory + Y * ri.BytesPerRow + X * Bpp;
|
||||
{
|
||||
uae_u8 *start = oldstart;
|
||||
uae_u8 *end = start + Height * ri.BytesPerRow;
|
||||
for (; start != end; start += ri.BytesPerRow) {
|
||||
uae_u8 *p = start;
|
||||
unsigned long cols;
|
||||
for (cols = 0; cols < Width; cols++) {
|
||||
uae_u32 tmpval = do_get_mem_byte (p + cols) & Mask;
|
||||
do_put_mem_byte (p + cols, (uae_u8)(Pen | tmpval));
|
||||
}
|
||||
}
|
||||
}
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
/* We get here only if Mask != 0xFF */
|
||||
if (Bpp != 1) {
|
||||
write_log(_T("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n"), Mask, Bpp);
|
||||
}
|
||||
else {
|
||||
Pen &= Mask;
|
||||
Mask = ~Mask;
|
||||
oldstart = ri.Memory + Y * ri.BytesPerRow + X * Bpp;
|
||||
{
|
||||
uae_u8 *start = oldstart;
|
||||
uae_u8 *end = start + Height * ri.BytesPerRow;
|
||||
for (; start != end; start += ri.BytesPerRow) {
|
||||
uae_u8 *p = start;
|
||||
unsigned long cols;
|
||||
for (cols = 0; cols < Width; cols++) {
|
||||
uae_u32 tmpval = do_get_mem_byte(p + cols) & Mask;
|
||||
do_put_mem_byte(p + cols, (uae_u8)(Pen | tmpval));
|
||||
}
|
||||
}
|
||||
}
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue