You are not logged in.
Discoloration fix.
Index: src/GPU.c
===================================================================
RCS file: /cvsroot/desmume/desmume/src/GPU.c,v
retrieving revision 1.131
diff -u -r1.131 GPU.c
--- src/GPU.c 12 Nov 2007 00:41:51 -0000 1.131
+++ src/GPU.c 4 Apr 2008 20:25:05 -0000
@@ -1272,7 +1272,7 @@
int i; u16 color;
for(i = 0; i < lg; i++, ++sprX, x+=xdir)
{
- color = src[x];
+ color = LE_TO_LOCAL_16(src[x]);
// alpha bit = invisible
if ((color&0x8000)&&(prio<=prioTab[sprX]))
@@ -1301,7 +1301,7 @@
for(i = 0; i < lg; i++, ++sprX, x+=xdir)
{
palette_entry = src[(x&0x7) + ((x&0xFFF8)<<3)];
- color = pal[palette_entry];
+ color = LE_TO_LOCAL_16(pal[palette_entry]);
// palette entry = 0 means backdrop
if ((palette_entry>0)&&(prio<=prioTab[sprX]))
@@ -1337,7 +1337,7 @@
palette = src[(x1&0x3) + ((x1&0xFFFC)<<3)];
if (x & 1) palette_entry = palette >> 4;
else palette_entry = palette & 0xF;
- color = pal[palette_entry];
+ color = LE_TO_LOCAL_16(pal[palette_entry]);
// palette entry = 0 means backdrop
if ((palette_entry>0)&&(prio<=prioTab[sprX]))
@@ -2415,7 +2450,8 @@
#ifndef BRIGHT_TABLES
u8 base ;
u8 r,g,b; // get components, 5bit each
- dstColor.val = T1ReadWord(dst, i16 << 1);
+ dstColor.val = *((u16 *) (dst + (i16 << 1)));
+
r = dstColor.bits.red;
g = dstColor.bits.green;
b = dstColor.bits.blue;
@@ -2428,7 +2464,7 @@
dstColor.val = T1ReadWord(dst, i16 << 1);
dstColor.bitx.bgr = colors[dstColor.bitx.bgr];
#endif
- T2WriteWord (dst, i16 << 1, dstColor.val);
+ *((u16 *) (dst + (i16 << 1))) = dstColor.val;
}
break;
}
@@ -2464,10 +2500,16 @@
{
#ifndef BRIGHT_TABLES
u8 r,g,b;
- dstColor.val = T1ReadWord(dst, i16 << 1);
+ dstColor.val = *((u16 *) (dst + (i16 << 1)));
+
r = dstColor.bits.red;
g = dstColor.bits.green;
b = dstColor.bits.blue;
+
+ if(dstColor.val){
+ //printf("red: %d, green: %d, blue: %d, a: %d, dstval: %d\n", r,g,b,dstColor.bits.alpha,dstColor.val);
+ //exit(1);
+ }
// Bright up and clamp to 5bit <- automatic
dstColor.bits.red = r - (r*masterBrightFactor)/16;
dstColor.bits.green = g - (g*masterBrightFactor)/16;
@@ -2476,7 +2518,8 @@
dstColor.val = T1ReadWord(dst, i16 << 1);
dstColor.bitx.bgr = colors[dstColor.bitx.bgr];
#endif
- T2WriteWord (dst, i16 << 1, dstColor.val);
+
+ *((u16 *) (dst + (i16 << 1))) = dstColor.val;
}
break;
}
Index: src/GPU.h
===================================================================
RCS file: /cvsroot/desmume/desmume/src/GPU.h,v
retrieving revision 1.94
diff -u -r1.94 GPU.h
--- src/GPU.h 12 Nov 2007 00:41:51 -0000 1.94
+++ src/GPU.h 4 Apr 2008 20:27:24 -0000
@@ -466,14 +483,26 @@
*/
struct _COLOR { // abgr x555
+#ifdef WORDS_BIGENDIAN
+ unsigned alpha:1; // sometimes it is unused (pad)
+ unsigned blue:5;
+ unsigned green:5;
+ unsigned red:5;
+#else
unsigned red:5;
unsigned green:5;
unsigned blue:5;
unsigned alpha:1; // sometimes it is unused (pad)
+#endif
};
struct _COLORx { // abgr x555
Offline
Phazz: Are your patches fixes for the x86 build? I'm running the latest jvernet build but it only works properly under Rosetta on my MBP.
Also, is there a way to mount a FAT disk image under OS X? I'm not having luck with the --cflash option in this build. The .nds file needs to be patched with the GBAMP compact flash DLDI file, right?
Offline
Phazz: Are your patches fixes for the x86 build? I'm running the latest jvernet build but it only works properly under Rosetta on my MBP.
No, they are for the PPC build of desmume.
Offline
I don't think that you can natively open a FAT image disk natively, only if these are ISO ou dmg files.
Great job for the patch. Still some color glitch somewhere. And you put a new XCode project and new files for the Cocoa buil, it's great ! Build even on 10.4 under XCode 2.4.1.
I don't know what may happen on the x86 build. Still endian problems.
Offline
Great job for the patch. Still some color glitch somewhere.
Which game, where exactly?
Offline
Hi guys,
In XCode, go to the build settings and enable the checkbox "Treat Missing Function Prototypes as Errors". Marvel at the massive compilation failure. Then go get my patch that fixes it:
The patch also allows users to use FAT images with homebrew apps by either using a menu to choose the image or passing a command-line option (-FlashFile).
Offline
Thanks and good work on that patch, TypeError. I'll go ahead and apply it.
Edit: I applied it (slightly modified). I don't have any FAT images to test it with, so if you want to make sure its working that would be good.
Shash: Were you going to apply the PPC fixes or do you want me to apply those too?
Last edited by jeff (2008-04-06 08:14:29)
Offline
jvernet wrote:Great job for the patch. Still some color glitch somewhere.
Which game, where exactly?
Try Burnout Legend, on the load screen. While palette flip, color are completely false .
Does Desmume show anything in 3D on some game ? On the PPC build, there is no 3D at all...
Offline
(...)
Shash: Were you going to apply the PPC fixes or do you want me to apply those too?
Do it yourself, lately I've been very busy and unable to work on anything.
(...)
Does Desmume show anything in 3D on some game ? On the PPC build, there is no 3D at all...
It does on all games that have 3D and are compatible.
Offline
So, on the Mac Build, at least PPC, it show nothing with 3D
Offline
So, on the Mac Build, at least PPC, it show nothing with 3D
Well, I rewrote that 3D core based on yopyop's code, and it's not endian safe at all, so it would be quite normal
Offline
I applied Phazz's endian patches to the main CVS.
Offline
jvernet wrote:So, on the Mac Build, at least PPC, it show nothing with 3D
Well, I rewrote that 3D core based on yopyop's code, and it's not endian safe at all, so it would be quite normal
Well, it could be fair to take a look at your sources. I tried, but haven't enough experiences. I saw some u16 operations "not endian safe at all", but it wasn't enough (or even apropriate...).
I tried to find originals sources without success, do you know where they could be found ?
Jerome
Offline
The original sources weren't endian safe either, and weren't running a single game.
Offline
The original sources weren't endian safe either, and weren't running a single game.
I found them on Sourceforge, doesn't help a lot.
Offline
Thanks and good work on that patch, TypeError. I'll go ahead and apply it.
Edit: I applied it (slightly modified). I don't have any FAT images to test it with, so if you want to make sure its working that would be good.
Thanks. I'll test the FAT stuff in a bit. I just noticed one change that shouldn't have gone in. In this diff:
http://desmume.cvs.sourceforge.net/desm … threv=HEAD
The #if 0 shouldn't have been changed to #if 1. It causes massive log output during FAT access.
Offline
One other part of my patch should have gone in but didn't. The SDK of the Xcode project needs to be changed from 10.4 to 10.4u (universal). That might be why jvernet's universal builds don't work on intel machines.
Offline
Ok, FAT image support seems to work fine here. Yay! Adios VMWare Fusion!
Offline
TypeError, where in the xcode settings did you set the SDK to 10.4u? Under my xcode 3.1, 10.4u is not an option under SDK, just 10.4, but Universal is an option under Architectures, and it's already set.
Offline
0. Open desmume project
1. double-click desmume in the groups & files pane
2. now you get the Project "DeSmuME" Info dialog. Pick the General pane.
Near the bottom of this pane there's a drop-down selector called "Cross-Develop Using Target SDK:". That's where I've chosen "Mac OS X 10.4 (Universal)". This presumes you have the 10.4 universal SDK installed. If not, download it from Apple. I'm using Xcode 3.0, btw. It looks like somebody (you?) is using a 3.1 beta (iPhone SDK?).
Offline
Yeah, apparently the xcode 3.1 save format is slightly different regarding the sdk. I committed the xcode file in 2.4 compatibility mode so people on Tiger can open it properly as well (SDKROOT now points to MacOSX10.4u.sdk in the file). People who plan to release builds should also make sure they're building the release target rather than the debug target, since the debug target naturally only compiles for the local architecture.
Offline
Just to say that the latest build and CVS work fine on my new MacBook. Even 3D work.
Offline