Zelda uCode: try to fix Super Mario Sunshine (hard since I don't have the game).

Let's hope it'll work. If yes, we can open the champagne :D

(BTW: yeah, again a HandleMail() clone)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3823 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
luigi2us
2009-07-17 22:57:56 +00:00
parent a5d65b3b22
commit d5c7105c78
2 changed files with 124 additions and 1 deletions

View File

@ -28,7 +28,8 @@
union ZeldaVoicePB
{
struct {
struct
{
// Read-Write part
u16 Status; // 0x00 | 1 = play, 0 = stop
u16 KeyOff; // 0x01 | writing 1 stops voice?
@ -115,6 +116,18 @@ union ZeldaVoicePB
u16 raw[0xc0]; // WARNING-do not use on parts of the 32-bit values - they are swapped!
};
union ZeldaUnkPB
{
struct
{
u16 Control; // 0x00 | control
u16 Unk01; // 0x01 | unknown
u32 SrcAddr; // 0x02 | some address
u16 Unk04[0xC]; // 0x04 | unknown
};
u16 raw[16];
};
namespace {
// If this miscompiles, adjust the size of ZeldaVoicePB to 0x180 bytes (0xc0 shorts).
CompileTimeAssert<sizeof(ZeldaVoicePB) == 0x180> ensure_zpb_size_correct;
@ -128,6 +141,7 @@ public:
void HandleMail(u32 _uMail);
void HandleMail_LightVersion(u32 _uMail);
void HandleMail_SMSVersion(u32 _uMail);
void HandleMail_NormalVersion(u32 _uMail);
void Update(int cycles);
@ -195,6 +209,21 @@ private:
}
}
// SMS version
// - sync mails are sent every frame, not every 16 PBs
// (named SMS because it's used by Super Mario Sunshine
// and I couldn't find a better name)
bool IsSMSVersion() const
{
switch (m_CRC)
{
case 0x56d36052:
return true;
default:
return false;
}
}
u32 m_CRC;
// These are the only dynamically allocated things allowed in the ucode.