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:
hrydgard
2009-03-20 18:13:31 +00:00
parent f126378de6
commit 7d910a5e4a
8 changed files with 49 additions and 57 deletions

View File

@ -154,7 +154,6 @@ void CBoot::EmulatedBIOS(bool _bDebug)
}
bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
{
INFO_LOG(BOOT, "Setup Wii Memory...");

View File

@ -57,11 +57,11 @@ union UPECtrlReg
// STATE_TO_SAVE
static UPECtrlReg g_ctrlReg;
static bool g_bSignalTokenInterrupt;
static bool g_bSignalFinishInterrupt;
static bool g_bSignalTokenInterrupt;
static bool g_bSignalFinishInterrupt;
int et_SetTokenOnMainThread;
int et_SetFinishOnMainThread;
static int et_SetTokenOnMainThread;
static int et_SetFinishOnMainThread;
void DoState(PointerWrap &p)
{
@ -86,7 +86,7 @@ void Init()
void Read16(u16& _uReturnValue, const u32 _iAddress)
{
DEBUG_LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);
DEBUG_LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);
switch (_iAddress & 0xFFF)
{
@ -101,7 +101,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
return;
default:
WARN_LOG(PIXELENGINE,"(unknown)");
WARN_LOG(PIXELENGINE, "(r16): unknown @ %08x", _iAddress);
break;
}
@ -110,14 +110,14 @@ void Read16(u16& _uReturnValue, 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)
{
DEBUG_LOG(PIXELENGINE, "(w16): 0x%04x @ 0x%08x",_iValue,_iAddress);
switch(_iAddress & 0xFFF)
switch (_iAddress & 0xFFF)
{
case CTRL_REGISTER:
{
@ -126,8 +126,8 @@ void Write16(const u16 _iValue, const u32 _iAddress)
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;
g_ctrlReg.PETokenEnable = tmpCtrl.PETokenEnable;
g_ctrlReg.PEFinishEnable = tmpCtrl.PEFinishEnable;
g_ctrlReg.PETokenEnable = tmpCtrl.PETokenEnable;
g_ctrlReg.PEFinishEnable = tmpCtrl.PEFinishEnable;
g_ctrlReg.PEToken = 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:
//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
//g_token = _iValue;
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.
if (_bSetTokenAcknowledge) // set token INT
{
// This seems smelly...
CommandProcessor::IncrementGPWDToken(); // for DC watchdog hack since PEToken seems to be a frame-finish too
CoreTiming::ScheduleEvent_Threadsafe(
0, et_SetTokenOnMainThread, _token | (_bSetTokenAcknowledge << 16));
@ -202,7 +207,7 @@ void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
else // set token value
{
// we do it directly from videoThread because of
// Super Monkey Ball Advance
// Super Monkey Ball
Common::SyncInterlockedExchange((LONG*)&CommandProcessor::fifo.PEToken, _token);
}
}

View File

@ -258,8 +258,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
if (Size > 0)
{
memcpy(pDest, pSrc, Size);
rContent.m_Position += Size;
if (pDest) {
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);

View File

@ -26,6 +26,7 @@
namespace DiscIO
{
CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
: m_pBannerFile(NULL)
, m_IsValid(false)
@ -34,7 +35,14 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
char TitleID[4];
_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
size_t FileSize = (size_t) File::GetSize(Filename);
@ -43,7 +51,7 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
{
m_pBannerFile = new u8[FileSize];
FILE* pFile = fopen(Filename, "rb");
if ((pFile != NULL) && (m_pBannerFile != NULL))
if (pFile)
{
fread(m_pBannerFile, FileSize, 1, 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())
{
SWiiBanner* pBanner = (SWiiBanner*)m_pBannerFile;
static u32 Buffer[192 * 64];
u32 Buffer[192 * 64];
decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64);
// ugly scaling :)
for (int y=0; y<32; y++)
// ugly scaling :) TODO: at least a 2x2 box filter, preferably a 3x3 gaussian :)
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;
}
bool
CBannerLoaderWii::GetName(std::string* _rName)
bool CBannerLoaderWii::GetName(std::string* _rName)
{
if (IsValid())
{
@ -112,17 +115,13 @@ CBannerLoaderWii::GetName(std::string* _rName)
return false;
}
bool
CBannerLoaderWii::GetCompany(std::string& _rCompany)
bool CBannerLoaderWii::GetCompany(std::string& _rCompany)
{
_rCompany = "N/A";
return true;
}
bool
CBannerLoaderWii::GetDescription(std::string* _rDescription)
bool CBannerLoaderWii::GetDescription(std::string* _rDescription)
{
if (IsValid())
{
@ -142,8 +141,7 @@ CBannerLoaderWii::GetDescription(std::string* _rDescription)
return false;
}
void
CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
void CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
{
for (int y = 0; y < height; y += 4)
{
@ -162,4 +160,3 @@ CBannerLoaderWii::decode5A3image(u32* dst, u16* src, int width, int height)
}
} // namespace

View File

@ -133,8 +133,8 @@ inline u32 decode565(u16 val)
inline u32 decodeIA8(u16 val)
{
int a=val>>8;
int i=val&0xFF;
int a = val >> 8;
int i = val & 0xFF;
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;
}
struct DXTBlock
{
u16 color1;