From 2719f3637fec738a9a81252449e204bb748c67df Mon Sep 17 00:00:00 2001
From: mtufan <hakaniki5@bim7.okan.local>
Date: Wed, 24 Aug 2011 11:20:28 +0300
Subject: [PATCH] puae 2.3.3 64bit_color_fix

---
 README        | 171 +++++++++++---------------------------------------
 src/drawing.c |   2 +-
 src/gfxutil.c |   2 +-
 3 files changed, 39 insertions(+), 136 deletions(-)

diff --git a/README b/README
index ed718a8..f3e6523 100644
--- a/README
+++ b/README
@@ -1,152 +1,55 @@
 PUAE 2.3.3 beta series
-============
+---------------------------------------------------
 PUAE tries to continue where E-UAE left off..
 PUAE versioning is based on the merged WinUAE version..
 
 All is done by:
 	Mustafa 'GnoStiC' TUFAN (mustafa.tufan@gmail.com)
 
-with fixes from:
-	Steven 'xaind' Saunders (MacOSX)
-	'wuffe' (FreeBSD)
-
-
-Richard Drummond's E-UAE 0.8.29
-============
-(Left for Legacy info)
-E-UAE is an Amiga emulator, a program that allows you to run software
-designed for Amiga computers on other platforms, such as Linux or Mac
-OS. It is based on UAE, the original Ubiquitous Amiga Emulator, and
-WinUAE, the Windows version of UAE. While it owes a huge debt to these
-two great projects, E-UAE diverges from both, aiming to improve
-performance and features on a variety of host platforms.
-
-The name E-UAE stemmed from the fact that this project needed a name,
-and, since it was an 'experimental' version of UAE, everybody was
-calling it 'Experimental' UAE. While I have long since accepted that
-moniker, I still don't intend the 'E' to mean anything it particular.
-Although the project is currently 'experimental' - that is, it is a
-long way from being anything close to finished - it should still be
-robust enough to use.
-
-E-UAE currently builds and runs - with varying degrees of supported
-features - on Unix and Unix-like platforms (including Linux, Solaris
-and Mac OS X), BeOS, AmigaOS and clones (including AmigaOS 3.x,
-AmigaOS 4.0, MorphOS and AROS), and Windows (with Cygwin or MinGW32).
-
-E-UAE is open-source software and is made available under the terms of
-the GPL. See the COPYING file included with the E-UAE archive for
-details.
-
-E-UAE is based on the work of dozens of contributors including Bernd
-Schmidt (the original author and maintainer of UAE), Bernie Meyer (the
-author of the x86 JIT compiler), Toni Wilen (the current maintainer of
-WinUAE), and many more.
-
-Note that to make full use of E-UAE you will need access to an image
-of some version of the Amiga Kickstart ROM (although E-UAE does include
-a ROM emulation which may work with some old games). The Amiga
-Kickstart ROMs are copyrighted material and may not be freely
-distributed (so don't ask me for a copy). If you don't have an Amiga
-from which you can legally make a ROM image, a selection of ROM images
-are available for purchase online from Cloanto (publishers of the
-Amiga Forever distribution). See http://www.amigaforever.com/
-
-What's new since PUAE 2.x.x
-======================
-* trying to sync with winuae :}
-
-What's new since PUAE 0.0.0
-======================
-* Some many changes that i can't begin to mention here and now.
-
-
-What's new since 0.8.29-WIP4
-============================
-
-New features:
-* Added a command-line tool for generating blank hardfile images,
-  called make_hdf
-* Support for IPF floppy images now supported on OS X (and officially
-  on AMD64/Linux now that libcapsimage is publically available). Go to
-  http://www.softpres.org/ to download the plug-in.
-* X-Arcade joystick supported (thanks to Robert Hurst for the patch).
-* Build scripts now include a compile-time option --disable-fpu to
-  disable building of FPU emulation.
-
-Performance improvements:
-* Some small custom chip and blitter tweaks merged from WinUAE 1.4.3.
-* Some minor performance optimizations to blitter emulation, floppy
-  controller emulation and rendering code. (Thanks to Mustafa Tufan,
-  developer of PSP and GP2x ports of E-UAE, for a couple of these).
-
-Bug fixes:
-* Version 0.8.29-WIP4 broke the interrupt controller emulation. Fixed.
-  This also makes Action Replay cartridge emulation work again.
-* HDToolbox would hang when scanning for hard drives. Mostly fixed (I
-  still have one unreproducible report of HDToolbox hanging).
-* Hardfile emulation will no longer leak threads following a reset
-  This also fixes crashes on exit on AmigaOS and clone hosts.
-* Building on MacOS X no longer fails when building supporting tools
-  like readdisk.
-* Exiting E-UAE on OS X when started from Hi-Toro would cause 'load
-  config file' dialog to be displayed. Fixed.
-* BeOS sound driver was broken in recent changes to audio layer. Now
-  fixed (fingers crossed).
-
-Other:
-
-* Removed support for 8-bit sound (since the official UAE did so).
-
-Still to do
-===========
-
-The following features of UAE and/or WinUAE are not yet supported yet in PUAE. These include:
-* Catweasel support (i don't have one so i can't test)
-
-
-Known problems
-==============
-
-Some significant misfeatures that I know about and am/will be working
-to fix (eventually):
-
-* Only platforms supporting the GTK+ toolkit have a useable
-  configuration GUI (and the GTK+ GUI is still incomplete). However,
-  Mac OS X users may like to try Daniel Pimley's graphical front-end,
-  Hi Toro. See http://www.pimley.net/projects/.
-* JIT direct memory access only works on Linux/x86 and, by default,
-  you may only emulate up to 32MB of direct ZIII RAM; select more than
-  that and the JIT will fall back on indirect memory access and hence
-  will be slower. This is due to a system limit on the size of a POSIX
-  shared memory segment. You can overcome this limit my modifying the
-  value of the procfs setting, /proc/sys/kernel/shmmax.
-* Virtual filesystem doesn't support platforms which use UTF-8 for
-  filenames (e.g., OS X, Linux with a UTF-8 locale, etc.). Filenames
-  with characters outside of the core ASCII range will be mangled.
-* The build scripts are a horrible, unmaintainable mess.
-* Full documentation is lacking.
+Thanks:
+ Steven 'xaind' Saunders (MacOSX fix), 'wuffe' (FreeBSD fix)
+ 'internetzel' (PPC fix), Nick 'chiark' Lines (morale support)
+
+
+
+
+GIT
+---------------------------------------------------
+http://github.com/GnoStiC/PUAE
+
+
+PUAE Binaries
+---------------------------------------------------
+I don't supply binaries for any OS
+but you can find compiled versions on net
+(e.g. chiark creates dmg and posts here http://www.binarydevotion.com)
+
+
+PUAE Ports
+---------------------------------------------------
+Pandora: http://apps.openpandora.org/cgi-bin/viewapp.pl?/Emulator/puae.inf
+XBOX360: http://lantus360.com
+Android: http://droidpuae.blogspot.com
+PS3 ?  : http://metaneutrons.blogspot.com/2011/07/porting-puae-to-playstation-3.html
 
 
 Using PUAE
-===========
-Documentation is a work-in-progress. See the docs directory.
+---------------------------------------------------
+See the docs directory
 
 
-Compiling PUAE yourself
-========================
-See the docs/compiling.txt file for more information about building PUAE.
+Compiling PUAE
+---------------------------------------------------
+See the docs/compiling.txt
 
 
-GIT
-===
-http://github.com/GnoStiC/PUAE
+Bug Reports
+---------------------------------------------------
+Post it on github/eab forum or e-mail me
 
 
 Contact
-=======
-See http://www.freelists.org/list/uae for details of a mailing list
-discussing problems with and development of PUAE.
-
-OR visit;
+---------------------------------------------------
 http://eab.abime.net/forumdisplay.php?f=54
+http://www.freelists.org/list/uae
+mustafa.tufan@gmail.com
diff --git a/src/drawing.c b/src/drawing.c
index 550c5bc..4ee69b7 100644
--- a/src/drawing.c
+++ b/src/drawing.c
@@ -2583,7 +2583,7 @@ void finish_drawing_frame (void)
 #ifdef ECS_DENISE
 	if (brdblank_changed) {
 		last_max_ypos = max_ypos_thisframe;
-		for (i = 0; i < sizeof linestate / sizeof *linestate; i++)
+		for (i = sizeof linestate / sizeof *linestate; i--;)
 			linestate[i] = LINE_UNDECIDED;
 		notice_screen_contents_lost ();
 		brdblank_changed = 0;
diff --git a/src/gfxutil.c b/src/gfxutil.c
index f3d8fd2..79e7c5a 100644
--- a/src/gfxutil.c
+++ b/src/gfxutil.c
@@ -41,7 +41,7 @@ static uae_u8 dither[4][4] =
 unsigned int doMask (int p, int bits, int shift)
 {
 	/* scale to 0..255, shift to align msb with mask, and apply mask */
-	unsigned long val;
+	unsigned int val;
 
 	if (flashscreen)
 		p ^= 0xff;
-- 
2.18.1