You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.



#26 2008-04-04 20:36:01

Phazz
Member
Registered: 2008-03-27
Posts: 9

Re: MacOsX Build of Desmume

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

#27 2008-04-04 23:37:13

TypeError
Member
Registered: 2008-04-03
Posts: 8

Re: MacOsX Build of Desmume

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

#28 2008-04-05 12:24:35

Phazz
Member
Registered: 2008-03-27
Posts: 9

Re: MacOsX Build of Desmume

TypeError wrote:

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

#29 2008-04-05 12:33:30

jvernet
Member
Registered: 2007-12-14
Posts: 32

Re: MacOsX Build of Desmume

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

#30 2008-04-05 16:03:45

Phazz
Member
Registered: 2008-03-27
Posts: 9

Re: MacOsX Build of Desmume

jvernet wrote:

Great job for the patch. Still some color glitch somewhere.

Which game, where exactly?

Offline

#31 2008-04-06 02:38:56

TypeError
Member
Registered: 2008-04-03
Posts: 8

Re: MacOsX Build of Desmume

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:

http://pastebin.org/27740

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

#32 2008-04-06 06:15:30

jeff
Member
Registered: 2008-04-06
Posts: 47

Re: MacOsX Build of Desmume

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

#33 2008-04-06 08:41:10

jvernet
Member
Registered: 2007-12-14
Posts: 32

Re: MacOsX Build of Desmume

Phazz wrote:
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

#34 2008-04-06 11:44:47

shash
Administrator
Registered: 2007-03-17
Posts: 897

Re: MacOsX Build of Desmume

jeff wrote:

(...)
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.

jvernet wrote:

(...)
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

#35 2008-04-06 11:53:45

jvernet
Member
Registered: 2007-12-14
Posts: 32

Re: MacOsX Build of Desmume

So, on the Mac Build, at least PPC, it show nothing with 3D sad

Offline

#36 2008-04-06 12:38:59

shash
Administrator
Registered: 2007-03-17
Posts: 897

Re: MacOsX Build of Desmume

jvernet wrote:

So, on the Mac Build, at least PPC, it show nothing with 3D sad

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 tongue

Offline

#37 2008-04-06 15:53:36

jeff
Member
Registered: 2008-04-06
Posts: 47

Re: MacOsX Build of Desmume

I applied Phazz's endian patches to the main CVS.

Offline

#38 2008-04-06 18:41:58

jvernet
Member
Registered: 2007-12-14
Posts: 32

Re: MacOsX Build of Desmume

shash wrote:
jvernet wrote:

So, on the Mac Build, at least PPC, it show nothing with 3D sad

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 tongue

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

#39 2008-04-06 19:09:42

shash
Administrator
Registered: 2007-03-17
Posts: 897

Re: MacOsX Build of Desmume

The original sources weren't endian safe either, and weren't running a single game.

Offline

#40 2008-04-06 19:18:47

jvernet
Member
Registered: 2007-12-14
Posts: 32

Re: MacOsX Build of Desmume

shash wrote:

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. wink

Offline

#41 2008-04-06 20:06:18

TypeError
Member
Registered: 2008-04-03
Posts: 8

Re: MacOsX Build of Desmume

jeff wrote:

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

#42 2008-04-06 20:20:38

TypeError
Member
Registered: 2008-04-03
Posts: 8

Re: MacOsX Build of Desmume

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

#43 2008-04-06 20:47:56

TypeError
Member
Registered: 2008-04-03
Posts: 8

Re: MacOsX Build of Desmume

Ok, FAT image support seems to work fine here.  Yay!  Adios VMWare Fusion!

Offline

#44 2008-04-10 00:24:15

jeff
Member
Registered: 2008-04-06
Posts: 47

Re: MacOsX Build of Desmume

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

#45 2008-04-10 01:01:51

TypeError
Member
Registered: 2008-04-03
Posts: 8

Re: MacOsX Build of Desmume

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

#46 2008-04-10 06:17:52

jeff
Member
Registered: 2008-04-06
Posts: 47

Re: MacOsX Build of Desmume

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

#47 2008-04-14 20:09:50

jvernet
Member
Registered: 2007-12-14
Posts: 32

Re: MacOsX Build of Desmume

Just to say that the latest build and CVS work fine on my new MacBook. Even 3D work.

Offline

#48 2008-04-23 18:13:23

shash
Administrator
Registered: 2007-03-17
Posts: 897

Re: MacOsX Build of Desmume

In case any of the MacOS porters don't see it, here's a bug report with the exact reason that shouldn't be too hard to fix tongue

Offline

Board footer

Powered by FluxBB