dsphle - small mail protocol fix for zelda light type

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5917 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marko Pusljar 2010-07-19 12:34:11 +00:00
parent 9074df896a
commit b08230512b
2 changed files with 123 additions and 126 deletions

View File

@ -73,8 +73,7 @@ CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler, u32 _CRC)
if (IsLightVersion()) if (IsLightVersion())
{ {
NOTICE_LOG(DSPHLE, "Luigi Stylee!"); NOTICE_LOG(DSPHLE, "Luigi Stylee!");
// Is it correct? seen in DSP_UC_Luigi.txt reset vector m_rMailHandler.PushMail(0x88881111);
m_rMailHandler.PushMail(0x80001111);
} }
else else
{ {
@ -143,15 +142,10 @@ void CUCode_Zelda::HandleMail_LightVersion(u32 _uMail)
if (m_CurBuffer == m_NumBuffers) if (m_CurBuffer == m_NumBuffers)
{ {
m_rMailHandler.PushMail(0x80000066); // seen in DSP_UC_Luigi.txt
soundStream->GetMixer()->SetHLEReady(true); soundStream->GetMixer()->SetHLEReady(true);
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
// soundStream->Update(); //do it in this thread to avoid sync problems
m_bSyncCmdPending = false; m_bSyncCmdPending = false;
DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
} }
return; return;
} }
@ -333,7 +327,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
if (m_CurBuffer == m_NumBuffers) if (m_CurBuffer == m_NumBuffers)
{ {
if (!IsDMAVersion()) if (!IsDMAVersion()) // this is a hack... without it Pikmin 1 Wii/ Zelda TP Wii mail-s stopped
m_rMailHandler.PushMail(DSP_FRAME_END); m_rMailHandler.PushMail(DSP_FRAME_END);
//g_dspInitialize.pGenerateDSPInterrupt(); //g_dspInitialize.pGenerateDSPInterrupt();
@ -538,7 +532,10 @@ void CUCode_Zelda::ExecuteList()
// sync, we are ready // sync, we are ready
if (IsLightVersion()) if (IsLightVersion())
{ {
m_rMailHandler.PushMail(0x80000000 | Sync); if (m_bSyncCmdPending)
m_rMailHandler.PushMail(0x80000000 | m_NumBuffers); // after CMD_2
else
m_rMailHandler.PushMail(0x80000000 | Sync); // after CMD_0, CMD_1
} }
else else
{ {

View File

@ -1,116 +1,116 @@
// Copyright (C) 2003 Dolphin Project. // Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _VEC3_H #ifndef _VEC3_H
#define _VEC3_H #define _VEC3_H
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
class Vec3 class Vec3
{ {
public: public:
float x,y,z; float x,y,z;
Vec3() { } Vec3() { }
explicit Vec3(float f) {x=y=z=f;} explicit Vec3(float f) {x=y=z=f;}
explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];} explicit Vec3(const float *f) {x=f[0]; y=f[1]; z=f[2];}
Vec3(const float _x, const float _y, const float _z) { Vec3(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z; x=_x; y=_y; z=_z;
} }
void set(const float _x, const float _y, const float _z) { void set(const float _x, const float _y, const float _z) {
x=_x; y=_y; z=_z; x=_x; y=_y; z=_z;
} }
Vec3 operator + (const Vec3 &other) const { Vec3 operator + (const Vec3 &other) const {
return Vec3(x+other.x, y+other.y, z+other.z); return Vec3(x+other.x, y+other.y, z+other.z);
} }
void operator += (const Vec3 &other) { void operator += (const Vec3 &other) {
x+=other.x; y+=other.y; z+=other.z; x+=other.x; y+=other.y; z+=other.z;
} }
Vec3 operator -(const Vec3 &v) const { Vec3 operator -(const Vec3 &v) const {
return Vec3(x-v.x,y-v.y,z-v.z); return Vec3(x-v.x,y-v.y,z-v.z);
} }
void operator -= (const Vec3 &other) void operator -= (const Vec3 &other)
{ {
x-=other.x; y-=other.y; z-=other.z; x-=other.x; y-=other.y; z-=other.z;
} }
Vec3 operator -() const { Vec3 operator -() const {
return Vec3(-x,-y,-z); return Vec3(-x,-y,-z);
} }
Vec3 operator * (const float f) const { Vec3 operator * (const float f) const {
return Vec3(x*f,y*f,z*f); return Vec3(x*f,y*f,z*f);
} }
Vec3 operator / (const float f) const { Vec3 operator / (const float f) const {
float invf = (1.0f/f); float invf = (1.0f/f);
return Vec3(x*invf,y*invf,z*invf); return Vec3(x*invf,y*invf,z*invf);
} }
void operator /= (const float f) void operator /= (const float f)
{ {
*this = *this / f; *this = *this / f;
} }
float operator * (const Vec3 &other) const { float operator * (const Vec3 &other) const {
return x*other.x + y*other.y + z*other.z; return x*other.x + y*other.y + z*other.z;
} }
void operator *= (const float f) { void operator *= (const float f) {
*this = *this * f; *this = *this * f;
} }
Vec3 scaled_by(const Vec3 &other) const { Vec3 scaled_by(const Vec3 &other) const {
return Vec3(x*other.x, y*other.y, z*other.z); return Vec3(x*other.x, y*other.y, z*other.z);
} }
Vec3 operator %(const Vec3 &v) const { Vec3 operator %(const Vec3 &v) const {
return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x); return Vec3(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
} }
float length2() const { float length2() const {
return x*x+y*y+z*z; return x*x+y*y+z*z;
} }
float length() const { float length() const {
return sqrtf(length2()); return sqrtf(length2());
} }
float distance2_to(Vec3 &other) float distance2_to(Vec3 &other)
{ {
return (other-(*this)).length2(); return (other-(*this)).length2();
} }
Vec3 normalized() const { Vec3 normalized() const {
return (*this) / length(); return (*this) / length();
} }
void normalize() { void normalize() {
(*this) /= length(); (*this) /= length();
} }
float &operator [] (int i) float &operator [] (int i)
{ {
return *((&x) + i); return *((&x) + i);
} }
const float operator [] (const int i) const const float operator [] (const int i) const
{ {
return *((&x) + i); return *((&x) + i);
} }
bool operator == (const Vec3 &other) const bool operator == (const Vec3 &other) const
{ {
if (x==other.x && y==other.y && z==other.z) if (x==other.x && y==other.y && z==other.z)
return true; return true;
else else
return false; return false;
} }
void setZero() void setZero()
{ {
memset((void *)this,0,sizeof(float)*3); memset((void *)this,0,sizeof(float)*3);
} }
}; };
#endif #endif