From a1d64fa31916b5fbbeb3fd30539983e9038e3086 Mon Sep 17 00:00:00 2001 From: yabause <yabause@users.sf.net> Date: Sat, 4 Nov 2006 14:09:36 +0000 Subject: [PATCH] Fixed a bug I introduced in GPU and made cflash working again (using the current directory instead of the rom directory, I think it should be ok) --- desmume/src/GPU.c | 11 ++++++----- desmume/src/NDSSystem.c | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/desmume/src/GPU.c b/desmume/src/GPU.c index a5e0d9471..f701e3b04 100644 --- a/desmume/src/GPU.c +++ b/desmume/src/GPU.c @@ -724,7 +724,7 @@ INLINE void rotBG2(GPU * gpu, u8 num, u16 * DST, u16 H, s32 X, s32 Y, s16 PA, s1 u16 * dst = DST; u8 mapinfo; u8 coul; - + if((!tile)||(!map)) return; u8 * pal = ARM9Mem.ARM9_VMEM + gpu->core * 0x400; @@ -930,7 +930,7 @@ void sprite1D(GPU * gpu, u16 l, u16 * dst, u8 * prioTab) u8 block = gpu->sprBlock; u16 i; - + for(i = 0; i<nbShow; ++i, --aux) { s32 sprX = aux->attr1 & 0x1FF; @@ -1136,7 +1136,7 @@ void sprite2D(GPU * gpu, u16 l, u16 * dst, u8 * prioTab) { u16 i; OAM * aux = gpu->oam + (nbShow-1);// + 127; - + for(i = 0; i<nbShow; ++i, --aux) { s32 sprX = aux->attr1 & 0x1FF; @@ -1174,14 +1174,15 @@ void sprite2D(GPU * gpu, u16 l, u16 * dst, u8 * prioTab) if((aux->attr0&(3<<10))==(3<<10)) { - u8 * src = (gpu->sprMem) +(aux->attr2&0x3E0)*64 + (aux->attr2&0x1F)*8 + (y<<8); + u8 * src = (gpu->sprMem) + (((aux->attr2&0x3E0) * 64 + (aux->attr2&0x1F) * 8 + ( y << 8)) << 1); u16 i; + if(aux->attr1&(1<<12)) { x = sprSize.x -x - 1; for(i = 0; i < lg; ++i, --x, ++sprX) { - u8 c = src[x]; + u8 c = src[x << 1]; if((c>>15) && (prioTab[sprX]>=prio)) { dst[sprX] = c; diff --git a/desmume/src/NDSSystem.c b/desmume/src/NDSSystem.c index 22667df44..03e9202ed 100644 --- a/desmume/src/NDSSystem.c +++ b/desmume/src/NDSSystem.c @@ -355,11 +355,11 @@ int NDS_LoadROM(const char *filename) NDS_Reset(); NDS_SetROM(data, mask); -/* // Will be added later - strcpy(szRomPath, dirname((char *) filename)); + /* I guess any directory can be used + * so the current one should be ok */ + strcpy(szRomPath, "."); cflash_close(); cflash_init(); -*/ return i; }