Assorted cleanup and comments.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2693 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f126378de6
commit
7d910a5e4a
|
@ -154,7 +154,6 @@ void CBoot::EmulatedBIOS(bool _bDebug)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
|
||||||
{
|
{
|
||||||
INFO_LOG(BOOT, "Setup Wii Memory...");
|
INFO_LOG(BOOT, "Setup Wii Memory...");
|
||||||
|
|
|
@ -57,11 +57,11 @@ union UPECtrlReg
|
||||||
// STATE_TO_SAVE
|
// STATE_TO_SAVE
|
||||||
static UPECtrlReg g_ctrlReg;
|
static UPECtrlReg g_ctrlReg;
|
||||||
|
|
||||||
static bool g_bSignalTokenInterrupt;
|
static bool g_bSignalTokenInterrupt;
|
||||||
static bool g_bSignalFinishInterrupt;
|
static bool g_bSignalFinishInterrupt;
|
||||||
|
|
||||||
int et_SetTokenOnMainThread;
|
static int et_SetTokenOnMainThread;
|
||||||
int et_SetFinishOnMainThread;
|
static int et_SetFinishOnMainThread;
|
||||||
|
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ void Init()
|
||||||
|
|
||||||
void Read16(u16& _uReturnValue, const u32 _iAddress)
|
void Read16(u16& _uReturnValue, const u32 _iAddress)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);
|
DEBUG_LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);
|
||||||
|
|
||||||
switch (_iAddress & 0xFFF)
|
switch (_iAddress & 0xFFF)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WARN_LOG(PIXELENGINE,"(unknown)");
|
WARN_LOG(PIXELENGINE, "(r16): unknown @ %08x", _iAddress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
|
||||||
|
|
||||||
void Write32(const u32 _iValue, const u32 _iAddress)
|
void Write32(const u32 _iValue, const u32 _iAddress)
|
||||||
{
|
{
|
||||||
INFO_LOG(PIXELENGINE, "(w32): 0x%08x @ 0x%08x",_iValue,_iAddress);
|
WARN_LOG(PIXELENGINE, "(w32): 0x%08x @ 0x%08x",_iValue,_iAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write16(const u16 _iValue, const u32 _iAddress)
|
void Write16(const u16 _iValue, const u32 _iAddress)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(PIXELENGINE, "(w16): 0x%04x @ 0x%08x",_iValue,_iAddress);
|
DEBUG_LOG(PIXELENGINE, "(w16): 0x%04x @ 0x%08x",_iValue,_iAddress);
|
||||||
|
|
||||||
switch(_iAddress & 0xFFF)
|
switch (_iAddress & 0xFFF)
|
||||||
{
|
{
|
||||||
case CTRL_REGISTER:
|
case CTRL_REGISTER:
|
||||||
{
|
{
|
||||||
|
@ -126,8 +126,8 @@ void Write16(const u16 _iValue, const u32 _iAddress)
|
||||||
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
|
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
|
||||||
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
|
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
|
||||||
|
|
||||||
g_ctrlReg.PETokenEnable = tmpCtrl.PETokenEnable;
|
g_ctrlReg.PETokenEnable = tmpCtrl.PETokenEnable;
|
||||||
g_ctrlReg.PEFinishEnable = tmpCtrl.PEFinishEnable;
|
g_ctrlReg.PEFinishEnable = tmpCtrl.PEFinishEnable;
|
||||||
g_ctrlReg.PEToken = 0; // this flag is write only
|
g_ctrlReg.PEToken = 0; // this flag is write only
|
||||||
g_ctrlReg.PEFinish = 0; // this flag is write only
|
g_ctrlReg.PEFinish = 0; // this flag is write only
|
||||||
|
|
||||||
|
@ -137,10 +137,14 @@ void Write16(const u16 _iValue, const u32 _iAddress)
|
||||||
|
|
||||||
case TOKEN_REG:
|
case TOKEN_REG:
|
||||||
//LOG(PIXELENGINE,"WEIRD: program wrote token: %i",_iValue);
|
//LOG(PIXELENGINE,"WEIRD: program wrote token: %i",_iValue);
|
||||||
PanicAlert("PIXELENGINE : (w16) WTF? program wrote token: %i",_iValue);
|
PanicAlert("PIXELENGINE : (w16) WTF? PowerPC program wrote token: %i", _iValue);
|
||||||
//only the gx pipeline is supposed to be able to write here
|
//only the gx pipeline is supposed to be able to write here
|
||||||
//g_token = _iValue;
|
//g_token = _iValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
WARN_LOG(PIXELENGINE, "Write16: unknown %04x @ %08x", _iValue, _iAddress);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,6 +199,7 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
|
||||||
// TODO?: set-token-value and set-token-INT could be merged since set-token-INT own the token value.
|
// TODO?: set-token-value and set-token-INT could be merged since set-token-INT own the token value.
|
||||||
if (_bSetTokenAcknowledge) // set token INT
|
if (_bSetTokenAcknowledge) // set token INT
|
||||||
{
|
{
|
||||||
|
// This seems smelly...
|
||||||
CommandProcessor::IncrementGPWDToken(); // for DC watchdog hack since PEToken seems to be a frame-finish too
|
CommandProcessor::IncrementGPWDToken(); // for DC watchdog hack since PEToken seems to be a frame-finish too
|
||||||
CoreTiming::ScheduleEvent_Threadsafe(
|
CoreTiming::ScheduleEvent_Threadsafe(
|
||||||
0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16));
|
0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16));
|
||||||
|
@ -202,7 +207,7 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
|
||||||
else // set token value
|
else // set token value
|
||||||
{
|
{
|
||||||
// we do it directly from videoThread because of
|
// we do it directly from videoThread because of
|
||||||
// Super Monkey Ball Advance
|
// Super Monkey Ball
|
||||||
Common::SyncInterlockedExchange((LONG*)&CommandProcessor::fifo.PEToken, _token);
|
Common::SyncInterlockedExchange((LONG*)&CommandProcessor::fifo.PEToken, _token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,8 +258,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
|
||||||
|
|
||||||
if (Size > 0)
|
if (Size > 0)
|
||||||
{
|
{
|
||||||
memcpy(pDest, pSrc, Size);
|
if (pDest) {
|
||||||
rContent.m_Position += Size;
|
memcpy(pDest, pSrc, Size);
|
||||||
|
rContent.m_Position += Size;
|
||||||
|
} else {
|
||||||
|
PanicAlert("IOCTL_ES_READCONTENT - bad destination");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INFO_LOG(WII_IPC_ES, "ES: IOCTL_ES_READCONTENT: CFD %x, Addr 0x%x, Size %i -> stream pos %i (Index %i)", CFD, Addr, Size, rContent.m_Position, rContent.m_pContent->m_Index);
|
INFO_LOG(WII_IPC_ES, "ES: IOCTL_ES_READCONTENT: CFD %x, Addr 0x%x, Size %i -> stream pos %i (Index %i)", CFD, Addr, Size, rContent.m_Position, rContent.m_pContent->m_Index);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
|
|
||||||
CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
|
CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
|
||||||
: m_pBannerFile(NULL)
|
: m_pBannerFile(NULL)
|
||||||
, m_IsValid(false)
|
, m_IsValid(false)
|
||||||
|
@ -34,7 +35,14 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
|
||||||
char TitleID[4];
|
char TitleID[4];
|
||||||
|
|
||||||
_rFileSystem.GetVolume()->Read(0, 4, (u8*)TitleID);
|
_rFileSystem.GetVolume()->Read(0, 4, (u8*)TitleID);
|
||||||
sprintf(Filename, FULL_WII_USER_DIR "title/00010000/%02x%02x%02x%02x/data/banner.bin", (u8)TitleID[0], (u8)TitleID[1], (u8)TitleID[2], (u8)TitleID[3]);
|
sprintf(Filename, FULL_WII_USER_DIR "title/00010000/%02x%02x%02x%02x/data/banner.bin",
|
||||||
|
(u8)TitleID[0], (u8)TitleID[1], (u8)TitleID[2], (u8)TitleID[3]);
|
||||||
|
|
||||||
|
if (!File::Exists(Filename))
|
||||||
|
{
|
||||||
|
m_IsValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// load the opening.bnr
|
// load the opening.bnr
|
||||||
size_t FileSize = (size_t) File::GetSize(Filename);
|
size_t FileSize = (size_t) File::GetSize(Filename);
|
||||||
|
@ -43,7 +51,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
|
||||||
{
|
{
|
||||||
m_pBannerFile = new u8[FileSize];
|
m_pBannerFile = new u8[FileSize];
|
||||||
FILE* pFile = fopen(Filename, "rb");
|
FILE* pFile = fopen(Filename, "rb");
|
||||||
if ((pFile != NULL) && (m_pBannerFile != NULL))
|
if (pFile)
|
||||||
{
|
{
|
||||||
fread(m_pBannerFile, FileSize, 1, pFile);
|
fread(m_pBannerFile, FileSize, 1, pFile);
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
|
@ -61,38 +69,33 @@ CBannerLoaderWii::~CBannerLoaderWii()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBannerLoaderWii::IsValid()
|
||||||
bool
|
|
||||||
CBannerLoaderWii::IsValid()
|
|
||||||
{
|
{
|
||||||
return (m_IsValid);
|
return m_IsValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBannerLoaderWii::GetBanner(u32* _pBannerImage)
|
||||||
bool
|
|
||||||
CBannerLoaderWii::GetBanner(u32* _pBannerImage)
|
|
||||||
{
|
{
|
||||||
if (IsValid())
|
if (IsValid())
|
||||||
{
|
{
|
||||||
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
|
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
|
||||||
|
|
||||||
static u32 Buffer[192 * 64];
|
u32 Buffer[192 * 64];
|
||||||
decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64);
|
decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64);
|
||||||
|
|
||||||
// ugly scaling :)
|
// ugly scaling :) TODO: at least a 2x2 box filter, preferably a 3x3 gaussian :)
|
||||||
for (int y=0; y<32; y++)
|
for (int y = 0; y < 32; y++)
|
||||||
{
|
{
|
||||||
for (int x=0; x<96; x++)
|
for (int x = 0; x < 96; x++)
|
||||||
{
|
{
|
||||||
_pBannerImage[y*96+x] = Buffer[(y*192*2)+(x*2)];
|
_pBannerImage[y*96+x] = Buffer[(y*192*2) + (x*2)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool CBannerLoaderWii::GetName(std::string* _rName)
|
||||||
CBannerLoaderWii::GetName(std::string* _rName)
|
|
||||||
{
|
{
|
||||||
if (IsValid())
|
if (IsValid())
|
||||||
{
|
{
|
||||||
|
@ -112,17 +115,13 @@ CBannerLoaderWii::GetName(std::string* _rName)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBannerLoaderWii::GetCompany(std::string& _rCompany)
|
||||||
bool
|
|
||||||
CBannerLoaderWii::GetCompany(std::string& _rCompany)
|
|
||||||
{
|
{
|
||||||
_rCompany = "N/A";
|
_rCompany = "N/A";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CBannerLoaderWii::GetDescription(std::string* _rDescription)
|
||||||
bool
|
|
||||||
CBannerLoaderWii::GetDescription(std::string* _rDescription)
|
|
||||||
{
|
{
|
||||||
if (IsValid())
|
if (IsValid())
|
||||||
{
|
{
|
||||||
|
@ -142,8 +141,7 @@ CBannerLoaderWii::GetDescription(std::string* _rDescription)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
|
||||||
CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
|
|
||||||
{
|
{
|
||||||
for (int y = 0; y < height; y += 4)
|
for (int y = 0; y < height; y += 4)
|
||||||
{
|
{
|
||||||
|
@ -162,4 +160,3 @@ CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,8 @@ inline u32 decode565(u16 val)
|
||||||
|
|
||||||
inline u32 decodeIA8(u16 val)
|
inline u32 decodeIA8(u16 val)
|
||||||
{
|
{
|
||||||
int a=val>>8;
|
int a = val >> 8;
|
||||||
int i=val&0xFF;
|
int i = val & 0xFF;
|
||||||
return (a<<24) | (i<<16) | (i<<8) | i;
|
return (a<<24) | (i<<16) | (i<<8) | i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,6 @@ inline u32 decode5A3(u16 val)
|
||||||
return (a<<24) | (r<<16) | (g<<8) | b;
|
return (a<<24) | (r<<16) | (g<<8) | b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct DXTBlock
|
struct DXTBlock
|
||||||
{
|
{
|
||||||
u16 color1;
|
u16 color1;
|
||||||
|
|
|
@ -237,7 +237,6 @@ void BPWritten(int addr, int changes, int newval)
|
||||||
((u32*)&bpmem)[addr] = newval;
|
((u32*)&bpmem)[addr] = newval;
|
||||||
if (changes & 1)
|
if (changes & 1)
|
||||||
{
|
{
|
||||||
// dev->SetRenderState(D3DRS_ALPHABLENDENABLE,bpmem.blendmode.blendenable);
|
|
||||||
Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable);
|
Renderer::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable);
|
||||||
}
|
}
|
||||||
if (changes & 2) {} // Logic op blending. D3D can't do this but can fake some modes.
|
if (changes & 2) {} // Logic op blending. D3D can't do this but can fake some modes.
|
||||||
|
@ -250,39 +249,30 @@ void BPWritten(int addr, int changes, int newval)
|
||||||
|
|
||||||
if (changes & 0x700)
|
if (changes & 0x700)
|
||||||
{
|
{
|
||||||
// dev->SetRenderState(D3DRS_SRCBLEND, src);
|
|
||||||
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
|
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
|
||||||
}
|
}
|
||||||
if (changes & 0xE0) {
|
if (changes & 0xE0) {
|
||||||
if (!bpmem.blendmode.subtract)
|
if (!bpmem.blendmode.subtract)
|
||||||
{
|
{
|
||||||
// dev->SetRenderState(D3DRS_DESTBLEND, dst);
|
|
||||||
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
|
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
|
||||||
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changes & 0x800) {
|
if (changes & 0x800) {
|
||||||
if (bpmem.blendmode.subtract)
|
if (bpmem.blendmode.subtract)
|
||||||
{
|
{
|
||||||
// dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
|
||||||
// dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
|
||||||
Renderer::SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
Renderer::SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||||
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
Renderer::SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// dev->SetRenderState(D3DRS_SRCBLEND, src);
|
|
||||||
// dev->SetRenderState(D3DRS_DESTBLEND, dst);
|
|
||||||
|
|
||||||
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
|
Renderer::SetRenderState(D3DRS_SRCBLEND, src);
|
||||||
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
|
Renderer::SetRenderState(D3DRS_DESTBLEND, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dev->SetRenderState(D3DRS_BLENDOP,bpmem.blendmode.subtract?D3DBLENDOP_SUBTRACT:D3DBLENDOP_ADD);
|
|
||||||
Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
|
Renderer::SetRenderState(D3DRS_BLENDOP, bpmem.blendmode.subtract ? D3DBLENDOP_SUBTRACT : D3DBLENDOP_ADD);
|
||||||
}
|
}
|
||||||
//if (bpmem.blendmode.logicopenable) // && bpmem.blendmode.logicmode == 4)
|
//if (bpmem.blendmode.logicopenable) // && bpmem.blendmode.logicmode == 4)
|
||||||
|
@ -297,7 +287,6 @@ void BPWritten(int addr, int changes, int newval)
|
||||||
if (bpmem.blendmode.colorupdate)
|
if (bpmem.blendmode.colorupdate)
|
||||||
write |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
|
write |= D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE;
|
||||||
|
|
||||||
// dev->SetRenderState(D3DRS_COLORWRITEENABLE, write);
|
|
||||||
Renderer::SetRenderState(D3DRS_COLORWRITEENABLE, write);
|
Renderer::SetRenderState(D3DRS_COLORWRITEENABLE, write);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ void D3DVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
|
||||||
|
|
||||||
// So, here we go. First position:
|
// So, here we go. First position:
|
||||||
int elem_idx = 0;
|
int elem_idx = 0;
|
||||||
elems[elem_idx].Offset = 0; // Positions are always first, at position 0.
|
elems[elem_idx].Offset = 0; // Positions are always first, at position 0. Always float3.
|
||||||
elems[elem_idx].Type = D3DDECLTYPE_FLOAT3;
|
elems[elem_idx].Type = D3DDECLTYPE_FLOAT3;
|
||||||
elems[elem_idx].Usage = D3DDECLUSAGE_POSITION;
|
elems[elem_idx].Usage = D3DDECLUSAGE_POSITION;
|
||||||
++elem_idx;
|
++elem_idx;
|
||||||
|
|
|
@ -181,7 +181,7 @@ void Flush()
|
||||||
if (collection != C_NOTHING)
|
if (collection != C_NOTHING)
|
||||||
{
|
{
|
||||||
// setup the pointers
|
// setup the pointers
|
||||||
if(g_nativeVertexFmt)
|
if (g_nativeVertexFmt)
|
||||||
g_nativeVertexFmt->SetupVertexPointers();
|
g_nativeVertexFmt->SetupVertexPointers();
|
||||||
|
|
||||||
u32 usedtextures = 0;
|
u32 usedtextures = 0;
|
||||||
|
|
Loading…
Reference in New Issue