- fix bug #2868470 (Pokémon Ranger - freezing at the first battle);
- fix bug #2860505 (Pokemon Diamond/Pearl/Platinum In-game trades not working);

winport:
- fix change sound buffer size;
This commit is contained in:
mtabachenko 2009-10-02 17:16:24 +00:00
parent 7bae874515
commit 953ced2c6c
5 changed files with 42 additions and 28 deletions

View File

@ -101,7 +101,7 @@ void mmu_log_debug_ARM9(u32 adr, const char *fmt, ...)
{ {
if (adr < 0x4000000) return; if (adr < 0x4000000) return;
if (adr > 0x4100014) return; if (adr > 0x4100014) return;
#if 1
if (adr >= 0x4000000 && adr <= 0x400006E) return; // Display Engine A if (adr >= 0x4000000 && adr <= 0x400006E) return; // Display Engine A
if (adr >= 0x40000B0 && adr <= 0x4000134) return; // DMA, Timers and Keypad if (adr >= 0x40000B0 && adr <= 0x4000134) return; // DMA, Timers and Keypad
if (adr >= 0x4000180 && adr <= 0x40001BC) return; // IPC/ROM if (adr >= 0x4000180 && adr <= 0x40001BC) return; // IPC/ROM
@ -110,7 +110,7 @@ void mmu_log_debug_ARM9(u32 adr, const char *fmt, ...)
if (adr >= 0x4000320 && adr <= 0x40006A3) return; // 3D dispaly engine if (adr >= 0x4000320 && adr <= 0x40006A3) return; // 3D dispaly engine
if (adr >= 0x4001000 && adr <= 0x400106E) return; // Display Engine B if (adr >= 0x4001000 && adr <= 0x400106E) return; // Display Engine B
if (adr >= 0x4100000 && adr <= 0x4100014) return; // IPC/ROM if (adr >= 0x4100000 && adr <= 0x4100014) return; // IPC/ROM
#endif
va_list list; va_list list;
char msg[512]; char msg[512];
@ -127,13 +127,13 @@ void mmu_log_debug_ARM7(u32 adr, const char *fmt, ...)
{ {
if (adr < 0x4000004) return; if (adr < 0x4000004) return;
if (adr > 0x4808FFF) return; if (adr > 0x4808FFF) return;
#if 1
if (adr >= 0x4000004 && adr <= 0x40001C4) return; // ARM7 I/O Map if (adr >= 0x4000004 && adr <= 0x40001C4) return; // ARM7 I/O Map
if (adr >= 0x4000204 && adr <= 0x400030C) return; // Memory and IRQ Control if (adr >= 0x4000204 && adr <= 0x400030C) return; // Memory and IRQ Control
if (adr >= 0x4000400 && adr <= 0x400051E) return; // Sound Registers if (adr >= 0x4000400 && adr <= 0x400051E) return; // Sound Registers
if (adr >= 0x4100000 && adr <= 0x4100014) return; // IPC/ROM if (adr >= 0x4100000 && adr <= 0x4100014) return; // IPC/ROM
//if (adr >= 0x4800000 && adr <= 0x4808FFF) return; // WLAN Registers if (adr >= 0x4800000 && adr <= 0x4808FFF) return; // WLAN Registers
#endif
va_list list; va_list list;
char msg[512]; char msg[512];
@ -857,6 +857,7 @@ void MMU_Init(void) {
GFX_PIPEclear(); GFX_PIPEclear();
GFX_FIFOclear(); GFX_FIFOclear();
DISP_FIFOinit(); DISP_FIFOinit();
MMU_new.gxstat.reset();
mc_init(&MMU.fw, MC_TYPE_FLASH); /* init fw device */ mc_init(&MMU.fw, MC_TYPE_FLASH); /* init fw device */
mc_alloc(&MMU.fw, NDS_FW_SIZE_V1); mc_alloc(&MMU.fw, NDS_FW_SIZE_V1);
@ -915,6 +916,7 @@ void MMU_Reset()
GFX_PIPEclear(); GFX_PIPEclear();
GFX_FIFOclear(); GFX_FIFOclear();
DISP_FIFOinit(); DISP_FIFOinit();
MMU_new.gxstat.reset();
MMU.DTCMRegion = 0x027C0000; MMU.DTCMRegion = 0x027C0000;
MMU.ITCMRegion = 0x00000000; MMU.ITCMRegion = 0x00000000;
@ -1785,17 +1787,21 @@ static INLINE void write_timer(int proc, int timerIndex, u16 val)
// NDS_RescheduleDMA(); // NDS_RescheduleDMA();
//} //}
void TGXSTAT::reset()
{
gxfifo_irq = se = tr = tb = 0;
}
u32 TGXSTAT::read32() u32 TGXSTAT::read32()
{ {
u32 ret = 0; u32 ret = 0;
tr = 1; //HACK!!!! tests no work now! (need this to make ff4 entities show up)
tb = 0; //HACK!!!! tests no work now! (need this to make ff4 entities show up)
ret |= tb|(tr<<1); ret |= tb|(tr<<1);
int _hack_getMatrixStackLevel(int which); int _hack_getMatrixStackLevel(int which);
// stack position always equal zero. possible timings is wrong
// using in "The Wild West"
ret |= ((_hack_getMatrixStackLevel(0) << 13) | (_hack_getMatrixStackLevel(1) << 8)); //matrix stack levels //no proof that these are needed yet ret |= ((_hack_getMatrixStackLevel(0) << 13) | (_hack_getMatrixStackLevel(1) << 8)); //matrix stack levels //no proof that these are needed yet
//todo: stack busy flag (bit14) //todo: stack busy flag (bit14)
@ -1811,12 +1817,12 @@ u32 TGXSTAT::read32()
//if fifo is nonempty, we're busy //if fifo is nonempty, we're busy
if(gxFIFO.size!=0) ret |= BIT(27); if(gxFIFO.size!=0) ret |= BIT(27);
ret |= ((gxfifo_irq & 0x3) << 30); //user's irq flags
ret |= gxfifo_irq; //user's irq flags
//printf("vc=%03d Returning gxstat read: %08X\n",nds.VCount,ret); //printf("vc=%03d Returning gxstat read: %08X\n",nds.VCount,ret);
//ret = (2 << 8);
//INFO("gxSTAT 0x%08X (proj %i, pos %i)\n", ret, _hack_getMatrixStackLevel(1), _hack_getMatrixStackLevel(2));
return ret; return ret;
} }

View File

@ -119,6 +119,7 @@ struct TGXSTAT : public TRegister_32
u8 se; //stack error u8 se; //stack error
u8 gxfifo_irq; //irq configuration u8 gxfifo_irq; //irq configuration
void reset();
virtual u32 read32(); virtual u32 read32();
virtual void write32(const u32 val); virtual void write32(const u32 val);

View File

@ -127,7 +127,7 @@ void DebugStatistics::print()
void DEBUG_reset() void DEBUG_reset()
{ {
DEBUG_statistics = DebugStatistics(); DEBUG_statistics = DebugStatistics();
printf("DEBUG_reset: %08X",&DebugStatistics::print); //force a reference to this function printf("DEBUG_reset: %08X\n",&DebugStatistics::print); //force a reference to this function
} }
static void defaultCallback(const Logger& logger, const char * message) { static void defaultCallback(const Logger& logger, const char * message) {

View File

@ -64,6 +64,8 @@ But since we're not sure how we'll eventually want this, I am leaving it sort of
in this function: */ in this function: */
static void gfx3d_doFlush(); static void gfx3d_doFlush();
#define TESTS_ENABLED 1
#define INVALID_COMMAND 0xFF #define INVALID_COMMAND 0xFF
#define UNDEFINED_COMMAND 0xCC #define UNDEFINED_COMMAND 0xCC
static const u8 gfx3d_commandTypes[] = { static const u8 gfx3d_commandTypes[] = {
@ -1339,8 +1341,13 @@ void gfx3d_glViewPort(u32 v)
BOOL gfx3d_glBoxTest(u32 v) BOOL gfx3d_glBoxTest(u32 v)
{ {
//gxstat &= 0xFFFFFFFD; // clear boxtest bit #ifdef TESTS_ENABLED
//gxstat |= 0x00000001; // busy MMU_new.gxstat.tr = 0; // clear boxtest bit
MMU_new.gxstat.tb = 1; // busy
#else
MMU_new.gxstat.tr = 1; // HACK!!!
MMU_new.gxstat.tb = 0;
#endif
BTcoords[BTind++] = float16table[v & 0xFFFF]; BTcoords[BTind++] = float16table[v & 0xFFFF];
BTcoords[BTind++] = float16table[v >> 16]; BTcoords[BTind++] = float16table[v >> 16];
@ -1355,7 +1362,7 @@ BOOL gfx3d_glBoxTest(u32 v)
if (BTind < 5) return FALSE; if (BTind < 5) return FALSE;
BTind = 0; BTind = 0;
//gxstat &= 0xFFFFFFFE; // clear busy bit MMU_new.gxstat.tb = 0; // clear busy
GFX_DELAY(103); GFX_DELAY(103);
#if 0 #if 0
@ -1369,7 +1376,7 @@ BOOL gfx3d_glBoxTest(u32 v)
INFO("\n");*/ INFO("\n");*/
#endif #endif
#if 0 #ifdef TESTS_ENABLED
// 0 - X coordinate 1 - Y coordinate 2 - Z coordinate // 0 - X coordinate 1 - Y coordinate 2 - Z coordinate
// 3 - Width 4 - Height 5 - Depth // 3 - Width 4 - Height 5 - Depth
@ -1420,19 +1427,18 @@ BOOL gfx3d_glBoxTest(u32 v)
//if(face==0)INFO("box test: testing face %i, vtx %i: %f %f %f %f\n", face, vtx, //if(face==0)INFO("box test: testing face %i, vtx %i: %f %f %f %f\n", face, vtx,
// boxCoords[face][vtx][0], boxCoords[face][vtx][1], boxCoords[face][vtx][2], boxCoords[face][vtx][3]); // boxCoords[face][vtx][0], boxCoords[face][vtx][1], boxCoords[face][vtx][2], boxCoords[face][vtx][3]);
if ((boxCoords[face][vtx][0] >= -1.0f) && (boxCoords[face][vtx][0] <= 1.0f) && if ((boxCoords[face][vtx][0] >= 0.0f) && (boxCoords[face][vtx][0] <= 1.0f) &&
(boxCoords[face][vtx][1] >= -1.0f) && (boxCoords[face][vtx][1] <= 1.0f) && (boxCoords[face][vtx][1] >= 0.0f) && (boxCoords[face][vtx][1] <= 1.0f) &&
(boxCoords[face][vtx][2] >= -1.0f) && (boxCoords[face][vtx][2] <= 1.0f)) (boxCoords[face][vtx][2] >= 0.0f) && (boxCoords[face][vtx][2] <= 1.0f))
{ {
gxstat |= 0x00000002; MMU_new.gxstat.tr = 1;
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, gxstat);
return TRUE; return TRUE;
} }
} }
} }
#else #else
//gxstat |= 0x00000002; // hack MMU_new.gxstat.tr = 1; // hack
#endif #endif
return TRUE; return TRUE;
@ -1440,7 +1446,9 @@ BOOL gfx3d_glBoxTest(u32 v)
BOOL gfx3d_glPosTest(u32 v) BOOL gfx3d_glPosTest(u32 v)
{ {
//gxstat |= 0x00000001; // busy #ifdef TESTS_ENABLED
MMU_new.gxstat.tb = 1;
#endif
PTcoords[PTind++] = float16table[v & 0xFFFF]; PTcoords[PTind++] = float16table[v & 0xFFFF];
PTcoords[PTind++] = float16table[v >> 16]; PTcoords[PTind++] = float16table[v >> 16];
@ -1453,7 +1461,7 @@ BOOL gfx3d_glPosTest(u32 v)
MatrixMultVec4x4(mtxCurrent[1], PTcoords); MatrixMultVec4x4(mtxCurrent[1], PTcoords);
MatrixMultVec4x4(mtxCurrent[0], PTcoords); MatrixMultVec4x4(mtxCurrent[0], PTcoords);
//gxstat &= 0xFFFFFFFE; MMU_new.gxstat.tb = 0;
GFX_DELAY(9); GFX_DELAY(9);
@ -1462,8 +1470,6 @@ BOOL gfx3d_glPosTest(u32 v)
void gfx3d_glVecTest(u32 v) void gfx3d_glVecTest(u32 v)
{ {
//gxstat &= 0xFFFFFFFE;
GFX_DELAY(5); GFX_DELAY(5);
//INFO("NDS_glVecTest\n"); //INFO("NDS_glVecTest\n");
} }

View File

@ -4857,11 +4857,12 @@ LRESULT CALLBACK SoundSettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARA
WritePrivateProfileString("Sound", "SoundCore2", tempstr, IniName); WritePrivateProfileString("Sound", "SoundCore2", tempstr, IniName);
// Write Sound Buffer size // Write Sound Buffer size
int tmp_size_buf = sndbuffersize;
GetDlgItemText(hDlg, IDC_SOUNDBUFFERET, tempstr, 6); GetDlgItemText(hDlg, IDC_SOUNDBUFFERET, tempstr, 6);
sscanf(tempstr, "%d", &sndbuffersize); sscanf(tempstr, "%d", &sndbuffersize);
WritePrivateProfileString("Sound", "SoundBufferSize", tempstr, IniName); WritePrivateProfileString("Sound", "SoundBufferSize", tempstr, IniName);
if(sndcoretype != SPU_currentCoreNum) if( (sndcoretype != SPU_currentCoreNum) || (sndbuffersize != tmp_size_buf) )
{ {
Lock lock; Lock lock;
SPU_ChangeSoundCore(sndcoretype, sndbuffersize); SPU_ChangeSoundCore(sndcoretype, sndbuffersize);