core: properly emulate POWCNT1 and POWCNT2 (fix picross bootup)
This commit is contained in:
parent
4306e404e4
commit
f82946cd96
|
@ -97,8 +97,8 @@ u32 _MMU_MAIN_MEM_MASK32 = 0x3FFFFF & ~3;
|
|||
void mmu_log_debug_ARM9(u32 adr, const char *fmt, ...)
|
||||
{
|
||||
if (adr < 0x4000000) return;
|
||||
if (adr > 0x4100014) return;
|
||||
#if 1
|
||||
// if (adr > 0x4100014) return;
|
||||
//#if 1
|
||||
if (adr >= 0x4000000 && adr <= 0x400006E) return; // Display Engine A
|
||||
if (adr >= 0x40000B0 && adr <= 0x4000134) return; // DMA, Timers and Keypad
|
||||
if (adr >= 0x4000180 && adr <= 0x40001BC) return; // IPC/ROM
|
||||
|
@ -107,7 +107,7 @@ void mmu_log_debug_ARM9(u32 adr, const char *fmt, ...)
|
|||
if (adr >= 0x4000320 && adr <= 0x40006A3) return; // 3D dispaly engine
|
||||
if (adr >= 0x4001000 && adr <= 0x400106E) return; // Display Engine B
|
||||
if (adr >= 0x4100000 && adr <= 0x4100014) return; // IPC/ROM
|
||||
#endif
|
||||
//#endif
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
|
@ -2605,16 +2605,15 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
GPU_setMasterBrightness (SubScreen.gpu, val);
|
||||
break;
|
||||
|
||||
case REG_POWCNT1 :
|
||||
case REG_POWCNT1:
|
||||
{
|
||||
// TODO: make this later
|
||||
#if 0
|
||||
u8 _LCD = (val) & 0x01;
|
||||
u8 _2DEngineA = (val>>1) & 0x01;
|
||||
u8 _2DEngineB = (val>>9) & 0x01;
|
||||
u8 _3DRender = (val>>2) & 0x01;
|
||||
u8 _3DGeometry = (val>>3) & 0x01;
|
||||
#endif
|
||||
nds.power1.lcd = BIT0(val);
|
||||
nds.power1.gpuMain = BIT1(val);
|
||||
nds.power1.gfx3d_render = BIT2(val);
|
||||
nds.power1.gfx3d_geometry = BIT3(val);
|
||||
nds.power1.gpuSub = BIT9(val);
|
||||
nds.power1.dispswap = BIT15(val);
|
||||
|
||||
if(val & (1<<15))
|
||||
{
|
||||
//printf("Main core on top (vcount=%d)\n",nds.VCount);
|
||||
|
@ -2627,8 +2626,6 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
MainScreen.offset = 192;
|
||||
SubScreen.offset = 0;
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x304, val);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -3388,6 +3385,18 @@ u16 FASTCALL _MMU_ARM9_read16(u32 adr)
|
|||
case REG_AUXSPICNT:
|
||||
return MMU.AUX_SPI_CNT;
|
||||
|
||||
case REG_POWCNT1:
|
||||
{
|
||||
u16 ret = 0;
|
||||
ret |= nds.power1.lcd?BIT(0):0;
|
||||
ret |= nds.power1.gpuMain?BIT(1):0;
|
||||
ret |= nds.power1.gfx3d_render?BIT(2):0;
|
||||
ret |= nds.power1.gfx3d_geometry?BIT(3):0;
|
||||
ret |= nds.power1.gpuSub?BIT(9):0;
|
||||
ret |= nds.power1.dispswap?BIT(15):0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
case 0x04000130:
|
||||
case 0x04000136:
|
||||
//not sure whether these should trigger from byte reads
|
||||
|
@ -3630,6 +3639,15 @@ void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
|
|||
}
|
||||
return;
|
||||
|
||||
|
||||
case REG_POWCNT2:
|
||||
{
|
||||
nds.power2.speakers = BIT0(val);
|
||||
nds.power2.wifi = BIT0(val);
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case REG_AUXSPICNT:
|
||||
write_auxspicnt(7,16,0,val);
|
||||
return;
|
||||
|
@ -4055,6 +4073,14 @@ u16 FASTCALL _MMU_ARM7_read16(u32 adr)
|
|||
|
||||
switch(adr)
|
||||
{
|
||||
case REG_POWCNT2:
|
||||
{
|
||||
u16 ret = 0;
|
||||
ret |= nds.power2.speakers?BIT(0):0;
|
||||
ret |= nds.power2.wifi?BIT(1):0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
case REG_RTC:
|
||||
return rtcRead();
|
||||
|
||||
|
|
|
@ -1914,6 +1914,9 @@ void NDS_Reset()
|
|||
|
||||
nds.sleeping = FALSE;
|
||||
nds.cardEjected = FALSE;
|
||||
nds.power1.lcd = nds.power1.gpuMain = nds.power1.gfx3d_render = nds.power1.gfx3d_geometry = nds.power1.gpuSub = nds.power1.dispswap = 1;
|
||||
nds.power2.speakers = 1;
|
||||
nds.power2.wifi = 0;
|
||||
|
||||
nds_timer = 0;
|
||||
nds_arm9_timer = 0;
|
||||
|
@ -2077,6 +2080,9 @@ void NDS_Reset()
|
|||
_MMU_write16<ARMCPU_ARM7>(0x04000130, 0x3FF);
|
||||
_MMU_write08<ARMCPU_ARM7>(0x04000136, 0x43);
|
||||
|
||||
//picross polls this value when it boots. firmware sets it.
|
||||
//_MMU_write16<ARMCPU_ARM9>(REG_POWCNT1, 0x20F);
|
||||
|
||||
LidClosed = FALSE;
|
||||
countLid = 0;
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright (C) 2008-2009 DeSmuME team
|
||||
Copyright (C) 2008-2010 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -203,6 +200,14 @@ struct NDSSystem
|
|||
//maintains the state of the ensata handshaking protocol
|
||||
u32 ensataHandshake;
|
||||
|
||||
struct {
|
||||
u8 lcd, gpuMain, gfx3d_render, gfx3d_geometry, gpuSub, dispswap;
|
||||
} power1; //POWCNT1
|
||||
|
||||
struct {
|
||||
u8 speakers, wifi /*(initial value=0)*/;
|
||||
} power2; //POWCNT2
|
||||
|
||||
bool isInVblank() const { return VCount >= 192; }
|
||||
bool isIn3dVblank() const { return VCount >= 192 && VCount<215; }
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2009 DeSmuME team
|
||||
/* Copyright 2009-2010 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -44,10 +44,10 @@
|
|||
#include "NDSSystem.h"
|
||||
#include "utils/task.h"
|
||||
|
||||
#undef FORCEINLINE
|
||||
#define FORCEINLINE
|
||||
#undef INLINE
|
||||
#define INLINE
|
||||
//#undef FORCEINLINE
|
||||
//#define FORCEINLINE
|
||||
//#undef INLINE
|
||||
//#define INLINE
|
||||
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
@ -932,7 +932,7 @@ public:
|
|||
POLY *poly = clippedPoly.poly;
|
||||
int type = clippedPoly.type;
|
||||
|
||||
//if(i == 0 || lastPolyAttr != poly->polyAttr)
|
||||
if(i == 0 || lastPolyAttr != poly->polyAttr)
|
||||
{
|
||||
polyAttr.setup(poly->polyAttr);
|
||||
polyAttr.translucent = poly->isTranslucent();
|
||||
|
@ -940,7 +940,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
//if(i == 0 || lastTextureFormat != poly->texParam || lastTexturePalette != poly->texPalette)
|
||||
if(i == 0 || lastTextureFormat != poly->texParam || lastTexturePalette != poly->texPalette)
|
||||
{
|
||||
sampler.setup(poly->texParam);
|
||||
lastTextureFormat = poly->texParam;
|
||||
|
@ -1352,8 +1352,8 @@ template<bool CUSTOM> void SoftRasterizerEngine::performViewportTransforms(int w
|
|||
{
|
||||
const float xfactor = width/256.0f;
|
||||
const float yfactor = height/192.0f;
|
||||
const float xmax = 256.0f*xfactor-0.001f; //fudge factor to keep from overrunning render buffers
|
||||
const float ymax = 192.0f*yfactor-0.001f;
|
||||
const float xmax = 256.0f*xfactor-(CUSTOM?0.001f:0); //fudge factor to keep from overrunning render buffers
|
||||
const float ymax = 192.0f*yfactor-(CUSTOM?0.001f:0);
|
||||
|
||||
|
||||
//viewport transforms
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright (C) 2006 Normmatt
|
||||
Copyright (C) 2006 Theo Berkau
|
||||
Copyright (C) 2007 Pascal Giard
|
||||
Copyright (C) 2008-2009 DeSmuME team
|
||||
Copyright (C) 2008-2010 DeSmuME team
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
|
@ -173,6 +173,14 @@ SFORMAT SF_NDS[]={
|
|||
{ "_ENI", 4, 1, &nds.ensataIpcSyncCounter},
|
||||
{ "_SLP", 4, 1, &nds.sleeping},
|
||||
{ "_CEJ", 4, 1, &nds.cardEjected},
|
||||
{ "_P00", 1, 1, &nds.power1.lcd},
|
||||
{ "_P01", 1, 1, &nds.power1.gpuMain},
|
||||
{ "_P02", 1, 1, &nds.power1.gfx3d_render},
|
||||
{ "_P03", 1, 1, &nds.power1.gfx3d_geometry},
|
||||
{ "_P04", 1, 1, &nds.power1.gpuSub},
|
||||
{ "_P05", 1, 1, &nds.power1.dispswap},
|
||||
{ "_P06", 1, 1, &nds.power2.speakers},
|
||||
{ "_P07", 1, 1, &nds.power2.wifi},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
EnableFiberSafeOptimizations="false"
|
||||
WholeProgramOptimization="false"
|
||||
AdditionalIncludeDirectories=".;..;lua\include;"glib-2.20.1\build";"glib-2.20.1\build\glib";.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include"
|
||||
PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;DEBUG;_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;_WIN32_WINNT=0x0501"
|
||||
PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;DEBUG;_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;_WIN32_WINNT=0x0501;_CRTDBG_MAPALLOC "
|
||||
ExceptionHandling="1"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -436,6 +436,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP3"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
|
|
Loading…
Reference in New Issue