You are not logged in.

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



#1 2008-03-05 09:32:29

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

MacOsX Build of Desmume

Hi,

I made a new build of Desmume for MacOsX, with the latest CVS. Unfortunately, the Intel build does'nt work (I do not have any Intel Mac). So, for Intel mac, launch Desmume under Rosetta.

Link:
http://membres.lycos.fr/jvernet/Softs/software.htm



Jerome

Offline

#2 2008-03-25 20:43:12

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

Re: MacOsX Build of Desmume

Hi,

Bad news... My latest build, from the CVS sources doesn't run any commercial ROM, even those marqued as "playable" in the compatibility list. I tried with WarioWare Touched.

But it can run my little "homebrew démo"...

It was working better before. Any help ?

Offline

#3 2008-03-25 20:48:16

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

Re: MacOsX Build of Desmume

Define "before" with a CVS revision time, else it's quite futile to search

Offline

#4 2008-03-25 20:57:40

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

Re: MacOsX Build of Desmume

Well, it was working for some ROM the last time I build Desmume (circa, 02/2008). Since, some change was made, and I cannot play any ROM, except the little demo I made.

It seems that the CPU emulator hang. Nothing happen, except a blank screen.

Offline

#5 2008-03-26 01:53:25

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

Re: MacOsX Build of Desmume

Could you please check out a few older CVS versions and be a bit more exact. Remember I can't debug neither "see" that bug, so try to be 100% concise about which commit is the culprit smile

Offline

#6 2008-03-28 13:41:58

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

Re: MacOsX Build of Desmume

The culprit is the revision 1.36 of NDSSystem.c, 1.35 is working fine.

Patch:

--- src/NDSSystem.c    20 Feb 2008 00:04:51 -0000    1.36
+++ src/NDSSystem.c    28 Mar 2008 14:02:25 -0000
@@ -491,7 +491,7 @@
     //  Reference: http://nocash.emubase.de/gbatek.htm#dscartridgeheader
     for (i = 0; i < ((0x170+0x90)/4); i++)
     {
-        MMU_write32 (0, 0x027FFE00+i*4, ((u32*)MMU.CART_ROM)[i]);
+        MMU_write32 (0, 0x027FFE00+i*4, LE_TO_LOCAL_32(((u32*)MMU.CART_ROM)[i]));
     }
      
    MainScreen.offset = 0;

Last edited by Phazz (2008-03-28 14:09:06)

Offline

#7 2008-03-28 15:46:46

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

Re: MacOsX Build of Desmume

Oh, thanks for the patch. I wrote the problematic piece of code, but, obviously, I didn't remember to use the endian safe memory functions tongue I've just committed it to the official CVS

Offline

#8 2008-03-28 21:26:20

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

Re: MacOsX Build of Desmume

Yesss !!! It's working, now. Nearly usable on my iBook G4 1.33 Mhz wink

I will try some ROM, from the compatibility list.

Offline

#9 2008-03-29 18:00:53

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

Re: MacOsX Build of Desmume

I guess it's 1.33 Ghz and not Mhz, else you've got a singular piece of hardware there tongue

Offline

#10 2008-03-29 18:37:00

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

Re: MacOsX Build of Desmume

wink I didn't tried to build Desmume on my Apple IIgs.

We still experience some graphical glitch, like this on Warioware on the PPC build:
picture1ul0.jpg

More over, I will see how I can enable Opengl with the Cocoa build.

Jerome

Offline

#11 2008-03-29 20:20:36

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

Re: MacOsX Build of Desmume

Well, probably some stuff isn't still endianess safe. If some active developer with a Mac could work on that, we'd probably get those bugs fixed quite easily: if I had access to any type of Mac hardware, I would do myself tongue

Offline

#12 2008-03-29 20:59:55

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

Re: MacOsX Build of Desmume

Give me some hint to look for. Where should I search ?

Offline

#13 2008-03-29 21:52:08

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

Re: MacOsX Build of Desmume

I'm currently looking into it.

Offline

#14 2008-03-29 22:03:46

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

Re: MacOsX Build of Desmume

jvernet wrote:

Give me some hint to look for. Where should I search ?

If I knew, I'd fix it myself. It's just a matter of looking for memory read/writes that don't use the endian safe functions, which is quite a lot of work considering desmume's size.

Phazz wrote:

I'm currently looking into it.

Nice smile

Offline

#15 2008-03-30 07:39:23

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

Re: MacOsX Build of Desmume

I'm looking for every MMU_WRITE32 to see if there an other example of what Phazz found, but cannot find  the same  thing.

Does thing like that:
MMU_write32(1, 0x00, 0xE25EF002);
MMU_write32(1, dst, T1ReadLong(MMU.CART_ROM, src));
MMU_write8(cpu->proc_ID, 0x4000300+cpu->proc_ID, cpu->R[0]);

need LE_TO_LOCAL ?

Offline

#16 2008-03-30 11:46:51

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

Re: MacOsX Build of Desmume

No, it's a matter of direct memory reading or writing, there's none there.

Offline

#17 2008-03-30 11:57:03

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

Re: MacOsX Build of Desmume

I fixed the particular Wario sprites problem, but there is a lot of discoloration, so I'm working on that.

Last edited by Phazz (2008-03-30 12:00:31)

Offline

#18 2008-03-30 14:05:36

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

Re: MacOsX Build of Desmume

Can you give us the patch <? Thanks !

Offline

#19 2008-03-30 20:33:42

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

Re: MacOsX Build of Desmume

Sure.

--- src/GPU.c    12 Nov 2007 00:41:51 -0000    1.131
+++ src/GPU.c    30 Mar 2008 20:24:41 -0000
@@ -1436,7 +1436,19 @@
     u8 block = gpu->sprBoundary;
     u16 i;
     
-    for(i = 0; i<nbShow; ++i, --spriteInfo)     /* check all sprites */
+#ifdef WORDS_BIGENDIAN
+    *(((u16*)spriteInfo)+1) = (*(((u16*)spriteInfo)+1) >> 1) | *(((u16*)spriteInfo)+1) << 15;
+    *(((u16*)spriteInfo)+2) = (*(((u16*)spriteInfo)+2) >> 2) | *(((u16*)spriteInfo)+2) << 14;
+#endif
+    
+    for(i = 0; i<nbShow; ++i, --spriteInfo
+#ifdef WORDS_BIGENDIAN    
+    ,*(((u16*)(spriteInfo+1))+1) = (*(((u16*)(spriteInfo+1))+1) << 1) | *(((u16*)(spriteInfo+1))+1) >> 15
+    ,*(((u16*)(spriteInfo+1))+2) = (*(((u16*)(spriteInfo+1))+2) << 2) | *(((u16*)(spriteInfo+1))+2) >> 14
+    ,*(((u16*)spriteInfo)+1) = (*(((u16*)spriteInfo)+1) >> 1) | *(((u16*)spriteInfo)+1) << 15
+    ,*(((u16*)spriteInfo)+2) = (*(((u16*)spriteInfo)+2) >> 2) | *(((u16*)spriteInfo)+2) << 14
+#endif
+    )     /* check all sprites */
     {
         size sprSize;
         s32 sprX, sprY, x, y, lg;
@@ -1671,6 +1683,10 @@
             render_sprite_16 (gpu, l, dst, src, pal, prioTab, prio, lg, sprX, x, xdir, spriteInfo->Mode == 1);
         }
     }
+#ifdef WORDS_BIGENDIAN
+    *(((u16*)spriteInfo)+1) = (*(((u16*)spriteInfo)+1) << 1) | *(((u16*)spriteInfo)+1) >> 15;
+    *(((u16*)spriteInfo)+2) = (*(((u16*)spriteInfo)+2) << 2) | *(((u16*)spriteInfo)+2) >> 14;
+#endif
 }
 
 void sprite2D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab)
@@ -1679,7 +1695,19 @@
     _OAM_ * spriteInfo = (_OAM_*)(gpu->oam + (nbShow-1));// + 127;
     u16 i;
     
-    for(i = 0; i<nbShow; ++i, --spriteInfo)
+#ifdef WORDS_BIGENDIAN
+    *(((u16*)spriteInfo)+1) = (*(((u16*)spriteInfo)+1) >> 1) | *(((u16*)spriteInfo)+1) << 15;
+    *(((u16*)spriteInfo)+2) = (*(((u16*)spriteInfo)+2) >> 2) | *(((u16*)spriteInfo)+2) << 14;
+#endif
+    
+    for(i = 0; i<nbShow; ++i, --spriteInfo
+#ifdef WORDS_BIGENDIAN    
+    ,*(((u16*)(spriteInfo+1))+1) = (*(((u16*)(spriteInfo+1))+1) << 1) | *(((u16*)(spriteInfo+1))+1) >> 15
+    ,*(((u16*)(spriteInfo+1))+2) = (*(((u16*)(spriteInfo+1))+2) << 2) | *(((u16*)(spriteInfo+1))+2) >> 14
+    ,*(((u16*)spriteInfo)+1) = (*(((u16*)spriteInfo)+1) >> 1) | *(((u16*)spriteInfo)+1) << 15
+    ,*(((u16*)spriteInfo)+2) = (*(((u16*)spriteInfo)+2) >> 2) | *(((u16*)spriteInfo)+2) << 14
+#endif
+    )     /* check all sprites */
     {
         size sprSize;
         s32 sprX, sprY, x, y, lg;
@@ -1915,6 +1943,10 @@
                 prioTab, prio, lg, sprX, x, xdir, spriteInfo->Mode == 1);
         }
     }
+#ifdef WORDS_BIGENDIAN
+    *(((u16*)spriteInfo)+1) = (*(((u16*)spriteInfo)+1) << 1) | *(((u16*)spriteInfo)+1) >> 15;
+    *(((u16*)spriteInfo)+2) = (*(((u16*)spriteInfo)+2) << 2) | *(((u16*)spriteInfo)+2) >> 14;
+#endif
 }
 
 /*****************************************************************************/

--- src/GPU.h    12 Nov 2007 00:41:51 -0000    1.94
+++ src/GPU.h    30 Mar 2008 20:26:13 -0000
@@ -521,6 +549,27 @@
 
 typedef struct
 {
+#ifdef WORDS_BIGENDIAN
+// attr0
+/* 0*/    unsigned Y:8;
+/*14*/    unsigned Shape:2;    // (00: Square, 01: Wide, 10: Tall, 11: Illegal)
+/*13*/    unsigned Depth:1;    // (0: 16, 1: 256)
+/*12*/    unsigned Mosaic:1;   // (1: Enabled)
+/*10*/    unsigned Mode:2;     // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap)
+/* 8*/    unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale)
+// attr1
+/* 0*/    signed   X:9;
+/*14*/    unsigned Size:2;
+/*13*/    unsigned VFlip:1;
+/*12*/    unsigned HFlip:1;
+/* 9*/    unsigned RotScalIndex:3; // Rot/scale matrix index
+// attr2
+/* 0*/    unsigned TileIndex:10;
+/*12*/    unsigned PaletteIndex:4;
+/*10*/    unsigned Priority:2;
+// attr3
+unsigned attr3:16;    
+#else
 // attr0
 /* 0*/    unsigned Y:8;
 /* 8*/    unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale)
@@ -540,6 +589,8 @@
 /*12*/    unsigned PaletteIndex:4;
 // attr3
     unsigned attr3:16;
+#endif
+
 } _OAM_;
 
 typedef struct

It does create noticeable overhead, though.

Last edited by Phazz (2008-03-30 22:00:27)

Offline

#20 2008-03-30 21:34:40

espire
Member
Registered: 2008-03-30
Posts: 1

Re: MacOsX Build of Desmume

Do we have an ETA for a working build, guys?

And by the way, hi all devs, you're great smile

Offline

#21 2008-03-30 22:18:52

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

Re: MacOsX Build of Desmume

espire: As long as something involves me (mainly something with the emulation core), there's no ETA, but I will try to apply phazz and jvernet patches as fast as possible.

Offline

#22 2008-03-31 19:10:48

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

Re: MacOsX Build of Desmume

It's looking a lot better, but is far more slower !

Offline

#23 2008-03-31 22:20:55

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

Re: MacOsX Build of Desmume

jvernet wrote:

It's looking a lot better, but is far more slower !

Well, now that something's actually being rendered this shouldn't be surprising.

Offline

#24 2008-04-03 21:43:08

skooj
Member
Registered: 2008-04-03
Posts: 2

Re: MacOsX Build of Desmume

it appears that the link to the file on jvernet's website is incorrect. It takes me to a page saying that the file is not there. any chance on an updated link?

Offline

#25 2008-04-04 05:23:41

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

Re: MacOsX Build of Desmume

Link fixed, sorry !

Offline

Board footer

Powered by FluxBB