clang-format pass

Former-commit-id: 6a979e343f
This commit is contained in:
Luke Street 2022-09-18 02:05:46 -04:00
parent 41a2efa884
commit 234afca6c2
214 changed files with 2282 additions and 1957 deletions

View File

@ -18,7 +18,8 @@ public:
CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, EFilterType type)
: include(include), exclude(exclude), type(type) {}
static CMaterialFilter MakeIncludeExclude(const CMaterialList& include, const CMaterialList& exclude) {
static CMaterialFilter MakeIncludeExclude(const CMaterialList& include,
const CMaterialList& exclude) {
return CMaterialFilter(include, exclude, kFT_IncludeExclude);
}

View File

@ -1,27 +1,24 @@
#ifndef __CCIRCULARBUFFER_HPP__
#define __CCIRCULARBUFFER_HPP__
#include <types.h>
class CCircularBuffer {
public:
enum EOwnership {
kOS_Owned,
kOS_NotOwned
};
enum EOwnership { kOS_Owned, kOS_NotOwned };
CCircularBuffer(void* buf, int len, EOwnership owned = kOS_NotOwned);
bool IsWrappedMemory(int offset, int len);
void* Alloc(int len);
void Free(void* ptr, int len);
int GetAllocatedAmount() const;
CCircularBuffer(void* buf, int len, EOwnership owned = kOS_NotOwned);
bool IsWrappedMemory(int offset, int len);
void* Alloc(int len);
void Free(void* ptr, int len);
int GetAllocatedAmount() const;
private:
u8 x0_owned;
void* x4_ptr;
s32 x8_bufferLen;
s32 xc_;
s32 x10_nextFreeAddr;
s32 x14_;
u8 x0_owned;
void* x4_ptr;
s32 x8_bufferLen;
s32 xc_;
s32 x10_nextFreeAddr;
s32 x14_;
};
#endif // __CCIRCULARBUFFER_HPP__

View File

@ -10,12 +10,8 @@ void Free(const void* ptr);
void* operator new(unsigned long sz, const char*, const char*);
void* operator new[](unsigned long sz, const char*, const char*);
inline void* operator new(unsigned long sz) {
return operator new(sz, "??(??)", nullptr);
}
inline void* operator new[](unsigned long sz) {
return operator new[](sz, "??(??)", nullptr);
}
inline void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); }
inline void* operator new[](unsigned long sz) { return operator new[](sz, "??(??)", nullptr); }
// placement new
inline void* operator new(unsigned long n, void* ptr) { return ptr; };

View File

@ -6,14 +6,19 @@
static const int kPointerSize = sizeof(void*);
class CSmallAllocPool {
public:
CSmallAllocPool(uint len, void* mainData, void* bookKeeping);
void* FindFree(int len);
void* Alloc(uint size);
bool Free(const void* ptr);
CSmallAllocPool(uint len, void* mainData, void* bookKeeping);
void* FindFree(int len);
void* Alloc(uint size);
bool Free(const void* ptr);
private:
uint GetIndexFromPtr(const void* ptr) const { return ((const u8*)ptr - x0_mainData) / kPointerSize; }
uint GetIndexFromPtr(const void* ptr) const {
return ((const u8*)ptr - x0_mainData) / kPointerSize;
}
long GetEntryValue(uint idx) const { return (long)*((u8*)x4_bookKeeping + idx); }
u8* GetPtrFromIndex(unsigned int idx) const { return static_cast<u8*>(x0_mainData) + (idx << 3); }
u8* GetPtrFromIndex(unsigned int idx) const {
return static_cast< u8* >(x0_mainData) + (idx << 3);
}
void* x0_mainData;
void* x4_bookKeeping;
int x8_numBlocks;

View File

@ -41,10 +41,11 @@ public:
uint x4c_;
uint x50_mediumTotalAllocated;
uint x54_fakeStatics;
SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5, uint unk6, uint unk7, uint unk8, uint unk9,
uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize, uint mediumAllocNumAllocs,
uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11, uint unk12, uint mediumAllocTotalAllocated,
uint fakeStatics);
SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5,
uint unk6, uint unk7, uint unk8, uint unk9, uint smallAllocNumAllocs,
uint smallAllocAllocatedSize, uint smallAllocRemainingSize, uint mediumAllocNumAllocs,
uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11,
uint unk12, uint mediumAllocTotalAllocated, uint fakeStatics);
};
struct SAllocInfo {
@ -62,10 +63,12 @@ public:
virtual bool Initialize(COsContext& ctx) = 0;
virtual void Shutdown() = 0;
virtual void* Alloc(unsigned long size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0;
virtual void* Alloc(unsigned long size, EHint hint, EScope scope, EType type,
const CCallStack& cs) = 0;
virtual void Free(const void* ptr) = 0;
virtual void ReleaseAll() = 0;
virtual void* AllocSecondary(unsigned long size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0;
virtual void* AllocSecondary(unsigned long size, EHint hint, EScope scope, EType type,
const CCallStack& cs) = 0;
virtual void FreeSecondary(const void* ptr) = 0;
virtual void ReleaseAllSecondary() = 0;
virtual void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* data) = 0;

View File

@ -2,36 +2,33 @@
#define _g721_h
struct g72x_state {
long yl; /* Locked or steady state step size multiplier. */
short yu; /* Unlocked or non-steady state step size multiplier. */
short dms; /* Short term energy estimate. */
short dml; /* Long term energy estimate. */
short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
long yl; /* Locked or steady state step size multiplier. */
short yu; /* Unlocked or non-steady state step size multiplier. */
short dms; /* Short term energy estimate. */
short dml; /* Long term energy estimate. */
short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
short a[2]; /* Coefficients of pole portion of prediction filter. */
short b[6]; /* Coefficients of zero portion of prediction filter. */
short pk[2]; /*
* Signs of previous two samples of a partially
* reconstructed signal.
*/
short dq[6]; /*
* Previous 6 samples of the quantized difference
* signal represented in an internal floating point
* format.
*/
short sr[2]; /*
* Previous 2 samples of the quantized difference
* signal represented in an internal floating point
* format.
*/
char td; /* delayed tone detect, new in 1988 version */
short a[2]; /* Coefficients of pole portion of prediction filter. */
short b[6]; /* Coefficients of zero portion of prediction filter. */
short pk[2]; /*
* Signs of previous two samples of a partially
* reconstructed signal.
*/
short dq[6]; /*
* Previous 6 samples of the quantized difference
* signal represented in an internal floating point
* format.
*/
short sr[2]; /*
* Previous 2 samples of the quantized difference
* signal represented in an internal floating point
* format.
*/
char td; /* delayed tone detect, new in 1988 version */
};
void
g72x_init_state(struct g72x_state *state_ptr);
void g72x_init_state(struct g72x_state* state_ptr);
int
g721_decoder(int i,
struct g72x_state *state_ptr);
int g721_decoder(int i, struct g72x_state* state_ptr);
#endif

View File

@ -37,15 +37,9 @@ inline s16 FtoS(register f32 in) {
return *ptr;
}
#else
inline u8 ToUint8(f32 in) {
return static_cast<u8>(in);
}
inline f32 ToReal32(u8 in) {
return static_cast<f32>(in);
}
inline s16 FtoS(f32 in) {
return static_cast<s16>(in);
}
inline u8 ToUint8(f32 in) { return static_cast< u8 >(in); }
inline f32 ToReal32(u8 in) { return static_cast< f32 >(in); }
inline s16 FtoS(f32 in) { return static_cast< s16 >(in); }
#endif
} // namespace CCast

View File

@ -32,8 +32,12 @@ public:
}
x0_startTime = mData.GetCPUCycles();
}
inline f32 GetElapsedTime() const { return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod(); }
inline s64 GetElapsedMicros() const { return (mData.GetCPUCycles() - x0_startTime) / mData.GetTimerFreqO1M(); }
inline f32 GetElapsedTime() const {
return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod();
}
inline s64 GetElapsedMicros() const {
return (mData.GetCPUCycles() - x0_startTime) / mData.GetTimerFreqO1M();
}
private:
static CSWData mData;

View File

@ -7,9 +7,7 @@ class CARAMManager {
public:
static void Shutdown();
static void CollectGarbage();
static void PreInitializeAlloc(uint size) {
mPreInitializeAlloc += size;
}
static void PreInitializeAlloc(uint size) { mPreInitializeAlloc += size; }
static void Initialize(uint);
private:

View File

@ -4,7 +4,7 @@
class CCRC32 {
public:
static uint Calculate(const void* data, uint length);
static uint Calculate(const void* data, uint length);
};
#endif // __CCRC32_HPP__

View File

@ -3,9 +3,9 @@
#include "types.h"
#include "Kyoto/TToken.hpp"
#include "Kyoto/IObjectStore.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/TToken.hpp"
class CFactoryMgr {
public:
@ -24,6 +24,7 @@ private:
rstl::auto_ptr< CObjOwnerDerivedFromIObjUntyped > obj;
};
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer);
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& xfer);
#endif

View File

@ -12,7 +12,8 @@ class IFactory {
public:
virtual ~IFactory() {}
virtual CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference*) = 0;
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, rstl::auto_ptr< IObj >*, CObjectReference*) = 0;
virtual void BuildAsync(const SObjectTag&, const CVParamTransfer&, rstl::auto_ptr< IObj >*,
CObjectReference*) = 0;
virtual void CancelBuild(const SObjectTag&) = 0;
virtual bool CanBuild(const SObjectTag&) = 0;
virtual const SObjectTag* GetResourceIdByName(const char* name) const = 0;

View File

@ -10,6 +10,7 @@ public:
CTimeProvider(const float& time);
~CTimeProvider();
float GetSecondsMod900() const { return x0_currentTime; }
private:
const float& x0_currentTime; // in seconds
bool x4_first;

View File

@ -88,35 +88,45 @@ public:
static void SetNumIndStages(u8 num);
static void SetChanAmbColor(EChannelId channel, const GXColor& color);
static void SetChanMatColor(EChannelId channel, const GXColor& color);
static void SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc, GXLightID lights, GXDiffuseFn diffFn,
GXAttnFn attnFn);
static void SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc,
GXLightID lights, GXDiffuseFn diffFn, GXAttnFn attnFn);
static void SetTevKColor(GXTevKColorID id, const GXColor& color);
static void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d);
static void SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d);
static void SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg);
static void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
GXTevColorArg d);
static void SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c,
GXTevAlphaArg d);
static void SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale,
GXBool clamp, GXTevRegID outReg);
static void SetTevColorOp_Compressed(GXTevStageID stageId, uint flags);
static void SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg);
static void SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale,
GXBool clamp, GXTevRegID outReg);
static void SetTevAlphaOp_Compressed(GXTevStageID stageId, uint flags);
static void SetTevKColorSel(GXTevStageID stageId, GXTevKColorSel sel);
static void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel);
static void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color);
static void SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op);
static void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap,
GXChannelID color);
static void SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac,
GXLogicOp op);
static void SetZMode(bool compareEnable, GXCompare func, bool updateEnable);
static void SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
static void SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt, GXIndTexBiasSel biasSel,
GXIndTexMtxID mtxSel, GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod,
static void SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt,
GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS,
GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod,
GXIndTexAlphaSel alphaSel);
static void SetTevDirect(GXTevStageID stageId);
static void SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx, GXBool normalize, GXPTTexMtx postMtx);
static void SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx,
GXBool normalize, GXPTTexMtx postMtx);
static void SetArray(GXAttr attr, const void* data, u8 stride);
static void SetFog(GXFogType type, f32 startZ, f32 endZ, f32 nearZ, f32 farZ, const GXColor& color);
static void SetFog(GXFogType type, f32 startZ, f32 endZ, f32 nearZ, f32 farZ,
const GXColor& color);
static void SetLineWidth(u8 width, GXTexOffset offset);
static void SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp);
static void SetVtxDescv_Compressed(uint flags);
static void SetVtxDesc(GXAttr attr, GXAttrType type); // name?
static void ResetVtxDescv(); // name?
static void SetVtxDescv(const GXVtxDescList* list);
static void SetStandardDirectTev_Compressed(GXTevStageID stageId, uint colorArgs, uint alphaArgs, uint colorOps, uint alphaOps);
static void SetStandardDirectTev_Compressed(GXTevStageID stageId, uint colorArgs, uint alphaArgs,
uint colorOps, uint alphaOps);
static void SetStandardTevColorAlphaOp(GXTevStageID stageId);
static void CallDisplayList(const void* ptr, size_t size);
@ -126,11 +136,12 @@ public:
static void ResetGXStatesFull(); // name?
static inline void LoadTexMtxImm(const f32 mtx[][4], unsigned long id, GXTexMtxType type) {
GXLoadTexMtxImm(const_cast<MtxPtr>(mtx), id, type);
GXLoadTexMtxImm(const_cast< MtxPtr >(mtx), id, type);
}
static GXColor GetChanAmbColor(EChannelId channel);
static void GetFog(GXFogType* fogType, f32* fogStartZ, f32* fogEndZ, f32* fogNearZ, f32* fogFarZ, GXColor* fogColor);
static void GetFog(GXFogType* fogType, f32* fogStartZ, f32* fogEndZ, f32* fogNearZ, f32* fogFarZ,
GXColor* fogColor);
static inline bool CompareGXColors(const GXColor& lhs, const GXColor& rhs) {
return *reinterpret_cast< const uint* >(&lhs) == *reinterpret_cast< const uint* >(&rhs);
@ -146,9 +157,12 @@ private:
static void update_fog(uint flags);
static void apply_fog() {
static const GXColor black = {0, 0, 0, 0};
GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ, sGXState.x24c_fogParams.x4_fogEndZ,
sGXState.x24c_fogParams.x8_fogNearZ, sGXState.x24c_fogParams.xc_fogFarZ,
(sGXState.x56_blendMode & (7 << 5)) == (GX_BL_ONE << 5) ? black : sGXState.x24c_fogParams.x10_fogColor);
GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ,
sGXState.x24c_fogParams.x4_fogEndZ, sGXState.x24c_fogParams.x8_fogNearZ,
sGXState.x24c_fogParams.xc_fogFarZ,
(sGXState.x56_blendMode & (7 << 5)) == (GX_BL_ONE << 5)
? black
: sGXState.x24c_fogParams.x10_fogColor);
}
static SGXState sGXState;

View File

@ -4,8 +4,8 @@
#include "types.h"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Graphics/CTevCombiners.hpp"

View File

@ -1,8 +1,6 @@
#ifndef __CLIGHT_HPP__
#define __CLIGHT_HPP__
class CLight {
};
class CLight {};
#endif // __CLIGHT_HPP__

View File

@ -24,17 +24,32 @@ public:
};
CModelFlags(ETrans trans, f32 rgba)
: x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(rgba, rgba, rgba, rgba) {}
: x0_blendMode(trans)
, x1_matSetIdx(0)
, x2_flags(kF_DepthCompare | kF_DepthUpdate)
, x4_color(rgba, rgba, rgba, rgba) {}
CModelFlags(ETrans trans, CColor color)
: x0_blendMode(trans), x1_matSetIdx(0), x2_flags(kF_DepthCompare | kF_DepthUpdate), x4_color(color) {}
: x0_blendMode(trans)
, x1_matSetIdx(0)
, x2_flags(kF_DepthCompare | kF_DepthUpdate)
, x4_color(color) {}
CModelFlags(const CModelFlags& flags, uint otherFlags)
: x0_blendMode(flags.x0_blendMode), x1_matSetIdx(flags.x1_matSetIdx), x2_flags(otherFlags), x4_color(flags.x4_color) {}
: x0_blendMode(flags.x0_blendMode)
, x1_matSetIdx(flags.x1_matSetIdx)
, x2_flags(otherFlags)
, x4_color(flags.x4_color) {}
CModelFlags(const CModelFlags& flags, bool b /* TODO what's this? */, int shaderSet)
: x0_blendMode(flags.x0_blendMode), x1_matSetIdx(shaderSet), x2_flags(flags.x2_flags), x4_color(flags.x4_color) {}
: x0_blendMode(flags.x0_blendMode)
, x1_matSetIdx(shaderSet)
, x2_flags(flags.x2_flags)
, x4_color(flags.x4_color) {}
// ?
CModelFlags(const CModelFlags& flags, ETrans trans, CColor color)
: x0_blendMode(trans), x1_matSetIdx(flags.x1_matSetIdx), x2_flags(flags.x2_flags), x4_color(color) {}
: x0_blendMode(trans)
, x1_matSetIdx(flags.x1_matSetIdx)
, x2_flags(flags.x2_flags)
, x4_color(color) {}
CModelFlags UseShaderSet(int matSet) { return CModelFlags(*this, false, matSet); }
CModelFlags DontLoadTextures() { return CModelFlags(*this, GetOtherFlags() | kF_NoTextureLock); }

View File

@ -32,7 +32,8 @@ public:
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(T* obj) {
return new TObjOwnerDerivedFromIObj< T >(obj);
}
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(const rstl::auto_ptr< T >& obj) {
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > >
GetNewDerivedObject(const rstl::auto_ptr< T >& obj) {
return new TObjOwnerDerivedFromIObj< T >(obj);
}

View File

@ -39,7 +39,8 @@ public:
// , x10_object(obj.release())
// , x14_params(CVParamTransfer::Null()) {}
CObjectReference(IObjectStore* store, const rstl::auto_ptr< IObj >& obj, SObjectTag tag, CVParamTransfer xfer);
CObjectReference(IObjectStore* store, const rstl::auto_ptr< IObj >& obj, SObjectTag tag,
CVParamTransfer xfer);
private:
u16 x0_refCount;
@ -51,6 +52,8 @@ private:
CVParamTransfer x14_params;
};
class CToken;
class IObjectStore {
public:
virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer) = 0;

View File

@ -8,6 +8,7 @@ public:
float GetRelativeValue() const { return x0_relative; }
void SetAbsoluteValue(float val) { x4_absolute = val; }
float GetAbsoluteValue() const { return x4_absolute; }
public:
float x0_relative;
float x4_absolute;

View File

@ -3,6 +3,7 @@
#include "Kyoto/Input/CControllerAxis.hpp"
#include "Kyoto/Input/CControllerButton.hpp"
#include "Kyoto/Input/InputTypes.hpp"
class CControllerGamepadData {
public:
@ -15,7 +16,9 @@ public:
const CControllerButton& GetButton(EButton button) const { return x34_buttons[button]; }
CControllerButton& GetButton(EButton button) { return x34_buttons[button]; }
const CControllerAxis& GetAnalogButton(EAnalogButton button) const { return x24_triggers[button]; }
const CControllerAxis& GetAnalogButton(EAnalogButton button) const {
return x24_triggers[button];
}
CControllerAxis& GetAnalogButton(EAnalogButton button) { return x24_triggers[button]; }
private:

View File

@ -10,16 +10,16 @@ class CDolphinController : public IController {
static const uint skTypeWavebird;
public:
CDolphinController();
virtual ~CDolphinController();
void Poll();
uint GetDeviceCount() const;
CControllerGamepadData& GetGamepadData(int controller);
uint GetControllerType(int) const;
void SetMotorState(EIOPort port, EMotorState state);
bool Initialize();
CDolphinController();
virtual ~CDolphinController();
void Poll();
uint GetDeviceCount() const;
CControllerGamepadData& GetGamepadData(int controller);
uint GetControllerType(int) const;
void SetMotorState(EIOPort port, EMotorState state);
bool Initialize();
float GetAnalogStickMaxValue(EJoyAxis axis) const;
float GetAnalogStickMaxValue(EJoyAxis axis) const;
private:
void ReadDevices();

View File

@ -3,28 +3,27 @@
#include <types.h>
#include "Kyoto/Input/InputTypes.hpp"
#include "Kyoto/Input/CControllerGamepadData.hpp"
#include "Kyoto/Input/InputTypes.hpp"
class COsContext;
class IController {
protected:
static const float kAbsoluteMinimum;
static const float kAbsoluteMaximum;
static const float kRelativeMinimum;
static const float kRelativeMaximum;
static const float kAbsoluteMinimum;
static const float kAbsoluteMaximum;
static const float kRelativeMinimum;
static const float kRelativeMaximum;
public:
IController();
virtual ~IController();
virtual void Poll()=0;
virtual uint GetDeviceCount() const = 0;
virtual CControllerGamepadData& GetGamepadData(int controller) = 0;
virtual uint GetControllerType(int) const = 0;
virtual void SetMotorState(EIOPort port, EMotorState state) = 0;
IController();
virtual ~IController();
virtual void Poll() = 0;
virtual uint GetDeviceCount() const = 0;
virtual CControllerGamepadData& GetGamepadData(int controller) = 0;
virtual uint GetControllerType(int) const = 0;
virtual void SetMotorState(EIOPort port, EMotorState state) = 0;
static IController* Create(const COsContext& ctx);
static IController* Create(const COsContext& ctx);
};
#endif // __ICONTROLLER_HPP__

View File

@ -16,13 +16,7 @@ enum EMotorState {
kMS_StopHard = PAD_MOTOR_STOP_HARD,
};
enum EJoyAxis {
kJA_LeftX,
kJA_LeftY,
kJA_RightX,
kJA_RightY,
kJA_MAX
};
enum EJoyAxis { kJA_LeftX, kJA_LeftY, kJA_RightX, kJA_RightY, kJA_MAX };
enum EButton {
kBU_A,
@ -40,10 +34,6 @@ enum EButton {
kBU_MAX,
};
enum EAnalogButton {
kBA_Left,
kBA_Right,
kBA_MAX
};
enum EAnalogButton { kBA_Left, kBA_Right, kBA_MAX };
#endif // __INPUTTYPES_HPP__

View File

@ -8,7 +8,7 @@ public:
CAABox() {
// TODO
}
CAABox(const CVector3f& min, const CVector3f& max);// : min(min), max(max) {}
CAABox(const CVector3f& min, const CVector3f& max); // : min(min), max(max) {}
CAABox(const CAABox& other) : min(other.min), max(other.max) {}
CVector3f ClosestPointAlongVector(const CVector3f& vec) const;

View File

@ -5,8 +5,8 @@
#include "Kyoto/Math/CVector3f.hpp"
#include "rstl/reserved_vector.hpp"
#include "rstl/optional_object.hpp"
#include "rstl/reserved_vector.hpp"
class CAABox;
class CSphere;

View File

@ -27,7 +27,7 @@ public:
CVector3f GetRight() const { return CVector3f(m0.GetX(), m1.GetX(), m2.GetX()); }
CVector3f GetForward() const { return CVector3f(m0.GetY(), m1.GetY(), m2.GetY()); }
CVector3f GetUp() const { return CVector3f(m0.GetZ(), m1.GetZ(), m2.GetZ()); }
ConstMtxPtr GetCStyleMatrix() const { return reinterpret_cast<ConstMtxPtr>(this); }
ConstMtxPtr GetCStyleMatrix() const { return reinterpret_cast< ConstMtxPtr >(this); }
CMatrix3f BuildMatrix3f() const;
f32 Get00() const { return m0.GetX(); }
@ -93,7 +93,8 @@ public:
CTransform4f operator*(const CTransform4f& vec) const;
CTransform4f operator*(const CVector3f& vec) const;
static CTransform4f FromColumns(const CVector3f&, const CVector3f&, const CVector3f&, const CVector3f&);
static CTransform4f FromColumns(const CVector3f&, const CVector3f&, const CVector3f&,
const CVector3f&);
static const CTransform4f& Identity() { return sIdentity; }
private:

View File

@ -10,7 +10,7 @@ public:
f32 GetX() const { return mX; }
f32 GetY() const { return mY; }
// private:
// private:
f32 mX;
f32 mY;
};

View File

@ -10,34 +10,34 @@
class CWarp;
class CParticleGen {
public:
virtual ~CParticleGen() = 0;
virtual void Update(double) = 0;
virtual void Render() const = 0;
virtual void SetOrientation(const CTransform4f& orientation) = 0;
virtual void SetTranslation(const CVector3f& translation) = 0;
virtual void SetGlobalOrientation(const CTransform4f& orientation) = 0;
virtual void SetGlobalTranslation(const CVector3f& translation) = 0;
virtual void SetGlobalScale(const CVector3f& scale) = 0;
virtual void SetLocalScale(const CVector3f& scale) = 0;
virtual void SetParticleEmission(bool emission) = 0;
virtual void SetModulationColor(const CColor& col) = 0;
virtual void SetGeneratorRate(float rate) {}
virtual CTransform4f GetOrientation() const = 0;
virtual CVector3f GetTranslation() const = 0;
virtual CTransform4f GetGlobalOrientation() const = 0;
virtual CVector3f GetGlobalTranslation() const = 0;
virtual CVector3f GetGlobalScale() const = 0;
virtual bool GetParticleEmission() const = 0;
virtual CColor GetModulationColor() const = 0;
virtual float GetGeneratorRate() const { return 1.f; }
virtual bool IsSystemDeletable() const = 0;
virtual CAABox GetBounds() const = 0;
virtual int GetParticleCOunt() const = 0;
virtual bool SystemHasLight() const = 0;
virtual CLight GetLight() = 0;
virtual void DestroyParticles() = 0;
virtual void AddModifier(CWarp*) = 0;
virtual uint Get4CharId() const = 0;
virtual ~CParticleGen() = 0;
virtual void Update(double) = 0;
virtual void Render() const = 0;
virtual void SetOrientation(const CTransform4f& orientation) = 0;
virtual void SetTranslation(const CVector3f& translation) = 0;
virtual void SetGlobalOrientation(const CTransform4f& orientation) = 0;
virtual void SetGlobalTranslation(const CVector3f& translation) = 0;
virtual void SetGlobalScale(const CVector3f& scale) = 0;
virtual void SetLocalScale(const CVector3f& scale) = 0;
virtual void SetParticleEmission(bool emission) = 0;
virtual void SetModulationColor(const CColor& col) = 0;
virtual void SetGeneratorRate(float rate) {}
virtual CTransform4f GetOrientation() const = 0;
virtual CVector3f GetTranslation() const = 0;
virtual CTransform4f GetGlobalOrientation() const = 0;
virtual CVector3f GetGlobalTranslation() const = 0;
virtual CVector3f GetGlobalScale() const = 0;
virtual bool GetParticleEmission() const = 0;
virtual CColor GetModulationColor() const = 0;
virtual float GetGeneratorRate() const { return 1.f; }
virtual bool IsSystemDeletable() const = 0;
virtual CAABox GetBounds() const = 0;
virtual int GetParticleCOunt() const = 0;
virtual bool SystemHasLight() const = 0;
virtual CLight GetLight() = 0;
virtual void DestroyParticles() = 0;
virtual void AddModifier(CWarp*) = 0;
virtual uint Get4CharId() const = 0;
};
#endif // _CPARTICLEGEN_HPP

View File

@ -27,7 +27,7 @@ public:
void Get(void* dest, unsigned long len);
template < typename T >
inline T Get(const TType<T>& type) {
inline T Get(const TType< T >& type) {
return cinput_stream_helper(type, *this);
}
@ -65,7 +65,8 @@ inline float cinput_stream_helper(const TType< float >& type, CInputStream& in)
// rstl
#include "rstl/pair.hpp"
template < typename L, typename R >
inline rstl::pair< L, R > cinput_stream_helper(const TType< rstl::pair< L, R > >& type, CInputStream& in) {
inline rstl::pair< L, R > cinput_stream_helper(const TType< rstl::pair< L, R > >& type,
CInputStream& in) {
rstl::pair< L, R > result;
result.first = in.Get(TType< L >());
result.second = in.Get(TType< R >());

View File

@ -23,7 +23,8 @@ public:
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) {
return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj);
}
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(const rstl::auto_ptr< T >& obj) {
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > >
GetIObjObjectFor(const rstl::auto_ptr< T >& obj) {
return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj);
}
};
@ -45,7 +46,9 @@ class TLockedToken {
public:
TLockedToken() {}
TLockedToken(const CToken& token) : x0_token(token), x8_item(*x0_token) {}
TLockedToken(const TLockedToken< T >& token) : x0_token(token), x8_item(*token) { x0_token.Lock(); }
TLockedToken(const TLockedToken< T >& token) : x0_token(token), x8_item(*token) {
x0_token.Lock();
}
TLockedToken& operator=(const TLockedToken< T >& token) {
x0_token = token;

View File

@ -24,9 +24,7 @@ public:
CRasterFont(CInputStream&, IObjectStore*);
~CRasterFont();
void SetTexture(TToken<CTexture> token) {
x7c_texture = token;
}
void SetTexture(TToken< CTexture > token) { x7c_texture = token; }
private:
bool x0_initialized;

View File

@ -30,7 +30,8 @@ public:
virtual void AddParticleGen1();
virtual void AddParticleGen2();
virtual void AddPlaneObject();
virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode, IRenderer::EDrawableSorting sorting);
virtual void AddDrawable(const void* obj, const CVector3f& pos, const CAABox& bounds, int mode,
IRenderer::EDrawableSorting sorting);
virtual void SetDrawableCallback();
virtual void SetWorldViewpoint();
virtual void SetPerspective1();

View File

@ -10,5 +10,4 @@ void EnableMetroTRKInterrupts(void);
}
#endif
#endif /* #ifndef __TRKINIT_H__ */

View File

@ -207,8 +207,9 @@ public:
kSS_Done,
};
CActor(TUniqueId uid, bool active, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, const CModelData& mData,
const CMaterialList& list, const CActorParameters& params, TUniqueId nextDrawNode);
CActor(TUniqueId uid, bool active, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, const CModelData& mData, const CMaterialList& list,
const CActorParameters& params, TUniqueId nextDrawNode);
~CActor() override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
@ -221,24 +222,28 @@ public:
virtual void CalculateRenderBounds();
virtual CHealthInfo* HealthInfo(CStateManager&);
virtual const CDamageVulnerability* GetDamageVulnerability() const;
virtual const CDamageVulnerability* GetDamageVulnerability(const CVector3f&, const CVector3f&, const CDamageInfo&) const;
virtual const CDamageVulnerability* GetDamageVulnerability(const CVector3f&, const CVector3f&,
const CDamageInfo&) const;
virtual rstl::optional_object< CAABox > GetTouchBounds() const;
virtual void Touch(CActor&, CStateManager&);
virtual CVector3f GetOrbitPosition(const CStateManager&) const;
virtual CVector3f GetAimPosition(const CStateManager&, float) const;
virtual CVector3f GetHomingPosition(const CStateManager&, float) const;
virtual CVector3f GetScanObjectIndicatorPosition(const CStateManager&) const;
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&, const CWeaponMode&,
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&,
const CWeaponMode&,
int /*EProjectileAttrib?*/) const;
virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
virtual void OnScanStateChange(EScanState, CStateManager&);
virtual CAABox GetSortingBounds(const CTransform4f&) const;
virtual void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt);
virtual void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type,
float dt);
SAdvancementDeltas UpdateAnimation(float dt, CStateManager& mgr, bool advTree);
void ProcessSoundEvent(int sfxId, f32 weight, int flags, f32 fallOff, f32 maxDist, u8 minVol, u8 maxVol, const CVector3f& toListener,
const CVector3f& position, int aid, CStateManager& mgr, bool translateId);
void ProcessSoundEvent(int sfxId, f32 weight, int flags, f32 fallOff, f32 maxDist, u8 minVol,
u8 maxVol, const CVector3f& toListener, const CVector3f& position, int aid,
CStateManager& mgr, bool translateId);
void UpdateSfxEmitters();
void RemoveEmitter();
@ -264,7 +269,9 @@ public:
/// ????
bool NullModel() const { return !GetAnimationData() && !GetModelData()->HasNormalModel(); }
bool HasModelData() const { return GetModelData() && (GetModelData()->HasAnimation() || GetModelData()->HasNormalModel()); }
bool HasModelData() const {
return GetModelData() && (GetModelData()->HasAnimation() || GetModelData()->HasNormalModel());
}
CModelData* ModelData() { return x64_modelData.get(); }
const CModelData* GetModelData() const { return x64_modelData.get(); }

View File

@ -80,7 +80,8 @@ public:
CVisorParameters() {
// TODO
}
CVisorParameters(u8 mask, bool b1, bool scanPassthrough) : x0_mask(mask), x0_4_b1(b1), x0_5_scanPassthrough(scanPassthrough) {}
CVisorParameters(u8 mask, bool b1, bool scanPassthrough)
: x0_mask(mask), x0_4_b1(b1), x0_5_scanPassthrough(scanPassthrough) {}
u8 GetMask() const { return x0_mask; }
// TODO: GetIsBlockXRay__16CVisorParametersCFv?

View File

@ -11,8 +11,8 @@
#include "MetroidPrime/CParticleDatabase.hpp"
#include "MetroidPrime/CPoseAsTransforms.hpp"
#include "Kyoto/TToken.hpp"
#include "Kyoto/Animation/CSkinnedModel.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/reserved_vector.hpp"
@ -37,9 +37,7 @@ public:
x220_25_loop = v;
x220_24_animating = true;
}
void SetIsAnimating(bool v) {
x220_24_animating = v;
}
void SetIsAnimating(bool v) { x220_24_animating = v; }
void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr) {
x120_particleDB.SetParticleEffectState(name, active, mgr);
}

View File

@ -23,7 +23,8 @@ public:
CEntity(TUniqueId id, const CEntityInfo& info, bool active, const rstl::string& name);
void SendScriptMsgs(EScriptObjectState state, CStateManager& mgr, EScriptObjectMessage msg);
static inline void SendScriptMsg(CStateManager& mgr, CEntity* to, TUniqueId sender, EScriptObjectMessage msg) {
static inline void SendScriptMsg(CStateManager& mgr, CEntity* to, TUniqueId sender,
EScriptObjectMessage msg) {
mgr.SendScriptMsg(to, sender, msg);
}
TUniqueId GetUniqueId() const { return x8_uid; }

View File

@ -236,13 +236,14 @@ struct SConnection {
class CEntityInfo {
TAreaId x0_areaId;
rstl::vector<SConnection> x4_conns;
rstl::vector< SConnection > x4_conns;
TEditorId x14_editorId;
public:
CEntityInfo(TAreaId aid, const rstl::vector< SConnection >& conns, TEditorId eid = kInvalidEditorId);
CEntityInfo(TAreaId aid, const rstl::vector< SConnection >& conns,
TEditorId eid = kInvalidEditorId);
TAreaId GetAreaId() const { return x0_areaId; }
const rstl::vector<SConnection>& GetConnectionList() const { return x4_conns; }
const rstl::vector< SConnection >& GetConnectionList() const { return x4_conns; }
TEditorId GetEditorId() const { return x14_editorId; }
};

View File

@ -50,10 +50,14 @@ public:
SAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
void AdvanceParticles(const CTransform4f& xf, float dt, CStateManager& mgr);
void RenderParticles(const CFrustumPlanes& planes) const;
void RenderUnsortedParts(EWhichModel which, const CTransform4f& xf, const CActorLights* lights, const CModelFlags& flags) const;
void RenderThermal(const CTransform4f& xf, const CColor& mulColor, const CColor& addColor, const CModelFlags& flags) const;
void Render(const CStateManager&, const CTransform4f&, const CActorLights*, const CModelFlags&) const;
void Render(CModelData::EWhichModel, const CTransform4f&, const CActorLights*, const CModelFlags&) const;
void RenderUnsortedParts(EWhichModel which, const CTransform4f& xf, const CActorLights* lights,
const CModelFlags& flags) const;
void RenderThermal(const CTransform4f& xf, const CColor& mulColor, const CColor& addColor,
const CModelFlags& flags) const;
void Render(const CStateManager&, const CTransform4f&, const CActorLights*,
const CModelFlags&) const;
void Render(CModelData::EWhichModel, const CTransform4f&, const CActorLights*,
const CModelFlags&) const;
const CAnimData* GetAnimationData() const { return xc_animData.get(); }
CAnimData* AnimationData() { return xc_animData.get(); }

View File

@ -41,7 +41,8 @@ class CSortedListManager;
class CStateManager {
public:
void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg, EScriptObjectState state);
void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg,
EScriptObjectState state);
void SendScriptMsg(CEntity* ent, TUniqueId target, EScriptObjectMessage msg);
bool AddDrawableActor(const CActor& actor, const CVector3f& pos, const CAABox& bounds) const;
void SetupParticleHook(const CActor& actor) const;
@ -54,7 +55,7 @@ public:
CMazeState* CurrentMaze();
const CMazeState* GetCurrentMaze() const;
void SetCurrentMaze(const rstl::single_ptr<CMazeState>& maze);
void SetCurrentMaze(const rstl::single_ptr< CMazeState >& maze);
CCameraManager* CameraManager() { return x870_cameraManager; }
const CCameraManager* GetCameraManager() const { return x870_cameraManager; }
@ -63,7 +64,9 @@ public:
CWorld* World() { return x850_world.get(); }
const CWorld* GetWorld() const { return x850_world.get(); }
CActorModelParticles* ActorModelParticles() { return x884_actorModelParticles.get(); }
const CActorModelParticles* GetActorModelParticles() const { return x884_actorModelParticles.get(); }
const CActorModelParticles* GetActorModelParticles() const {
return x884_actorModelParticles.get();
}
CRandom16* GetActiveRandom() const { return x900_random; }
CObjectList& GetObjectListById(EGameObjectList id) { return *x808_objectLists[id]; }

View File

@ -57,15 +57,9 @@ public:
rstl::string IGetDefaultAudioTrack() const override;
int IGetAreaCount() const override;
const CGameArea& GetAreaAlways(TAreaId id) const {
return *x18_areas[id.Value()];
}
const CGameArea* GetArea(TAreaId id) const {
return x18_areas[id.Value()].get();
}
bool IsAreaValid(TAreaId id) const {
return x18_areas[id.Value()]->IsLoaded();
}
const CGameArea& GetAreaAlways(TAreaId id) const { return *x18_areas[id.Value()]; }
const CGameArea* GetArea(TAreaId id) const { return x18_areas[id.Value()].get(); }
bool IsAreaValid(TAreaId id) const { return x18_areas[id.Value()]->IsLoaded(); }
private:
enum Phase {

View File

@ -1,17 +1,18 @@
#ifndef __CCAMERAHINT_HPP__
#define __CCAMERAHINT_HPP__
#include "types.h"
#include "MetroidPrime/Cameras/CBallCamera.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "MetroidPrime/Cameras/CBallCamera.hpp"
#include "types.h"
class CCameraHint {
public:
CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist, f32 maxDist,
f32 backwardsDist, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset,
const CVector3f& ballToCam, f32 fov, f32 attitudeRange, f32 azimuthRange,
f32 anglePerSecond, f32 clampVelRange, f32 clampRotRange, f32 elevation, f32 interpolateTime,
f32 clampVelTime, f32 controlInterpDur);
CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist,
f32 maxDist, f32 backwardsDist, const CVector3f& lookAtOffset,
const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, f32 fov,
f32 attitudeRange, f32 azimuthRange, f32 anglePerSecond, f32 clampVelRange,
f32 clampRotRange, f32 elevation, f32 interpolateTime, f32 clampVelTime,
f32 controlInterpDur);
virtual ~CCameraHint();
private:

View File

@ -5,17 +5,17 @@
class CInputStream;
class CHUDMemoParms {
public:
CHUDMemoParms(CInputStream& in);
CHUDMemoParms(CInputStream& in);
float GetDisplayTime() const { return mDispTime; }
bool IsClearMemoWindow() const { return mClearMemoWindow; }
bool IsFadeOutOnly() const { return mFadeOutOnly; }
bool IsHintMemo() const { return mHintMemo; }
float GetDisplayTime() const { return mDispTime; }
bool IsClearMemoWindow() const { return mClearMemoWindow; }
bool IsFadeOutOnly() const { return mFadeOutOnly; }
bool IsHintMemo() const { return mHintMemo; }
private:
float mDispTime;
bool mClearMemoWindow;
bool mFadeOutOnly;
bool mHintMemo;
float mDispTime;
bool mClearMemoWindow;
bool mFadeOutOnly;
bool mHintMemo;
};
#endif // __CHUDMEMOPARMS_HPP__

View File

@ -7,7 +7,8 @@
class CScriptDebugCameraWaypoint : public CActor {
public:
CScriptDebugCameraWaypoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, uint value);
CScriptDebugCameraWaypoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, uint value);
~CScriptDebugCameraWaypoint() override;
void Accept(IVisitor& visitor) override;

View File

@ -33,11 +33,14 @@ struct SMazeCell {
bool x1_26_checked : 1;
SMazeCell() {
x0_24_openTop = x0_25_openRight = x0_26_openBottom = x0_27_openLeft = x0_28_gateTop = x0_29_gateRight = x0_30_gateBottom =
x0_31_gateLeft = x1_24_puddle = x1_25_onPath = x1_26_checked = false;
x0_24_openTop = x0_25_openRight = x0_26_openBottom = x0_27_openLeft = x0_28_gateTop =
x0_29_gateRight = x0_30_gateBottom = x0_31_gateLeft = x1_24_puddle = x1_25_onPath =
x1_26_checked = false;
}
inline bool IsClosed() const { return !x0_24_openTop && !x0_25_openRight && !x0_26_openBottom && !x0_27_openLeft; }
inline bool IsClosed() const {
return !x0_24_openTop && !x0_25_openRight && !x0_26_openBottom && !x0_27_openLeft;
}
};
class CMazeState {
@ -71,8 +74,10 @@ public:
class CScriptMazeNode : public CActor {
public:
CScriptMazeNode(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, bool active, int col, int row,
int side, const CVector3f& actorPos, const CVector3f& triggerPos, const CVector3f& effectPos);
CScriptMazeNode(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, bool active, int col, int row, int side,
const CVector3f& actorPos, const CVector3f& triggerPos,
const CVector3f& effectPos);
~CScriptMazeNode() override;
void Accept(IVisitor& visitor) override;

View File

@ -71,7 +71,9 @@ public:
f32 GetDashStrafeInputThreshold() const { return x208_dashStrafeInputThreshold; }
f32 GetSidewaysDoubleJumpImpulse() const { return x20c_sidewaysDoubleJumpImpulse; }
f32 GetSidewaysVerticalDoubleJumpAccel() const { return x210_sidewaysVerticalDoubleJumpAccel; }
f32 GetSidewaysHorizontalDoubleJumpAccel() const { return x214_sidewaysHorizontalDoubleJumpAccel; }
f32 GetSidewaysHorizontalDoubleJumpAccel() const {
return x214_sidewaysHorizontalDoubleJumpAccel;
}
f32 GetScanningRange() const { return x218_scanningRange; }
bool GetScanRetention() const { return x21c_24_scanRetention; }
bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; }
@ -107,7 +109,9 @@ public:
f32 GetGrappleSwingLength() const { return x2a4_grappleSwingLength; }
f32 GetGrappleSwingPeriod() const { return x2a8_grappleSwingPeriod; }
f32 GetGrapplePullSpeedMin() const { return x2ac_grapplePullSpeedMin; }
f32 GetMaxGrappleLockedTurnAlignDistance() const { return x2b4_maxGrappleLockedTurnAlignDistance; }
f32 GetMaxGrappleLockedTurnAlignDistance() const {
return x2b4_maxGrappleLockedTurnAlignDistance;
}
f32 GetGrapplePullSpeedProportion() const { return x2b8_grapplePullSpeedProportion; }
f32 GetGrapplePullSpeedMax() const { return x2bc_grapplePullSpeedMax; }
f32 GetGrappleLookCenterSpeed() const { return x2c0_grappleLookCenterSpeed; }

View File

@ -6,19 +6,20 @@
class IWeaponRenderer {
public:
virtual ~IWeaponRenderer()=0;
virtual void AddParticleGen(const CParticleGen& gen) = 0;
static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; }
virtual ~IWeaponRenderer() = 0;
virtual void AddParticleGen(const CParticleGen& gen) = 0;
static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; }
private:
static IWeaponRenderer* sWeaponRenderer;
static IWeaponRenderer* sWeaponRenderer;
};
inline IWeaponRenderer::~IWeaponRenderer() {}
class CDefaultWeaponRenderer : public IWeaponRenderer {
public:
~CDefaultWeaponRenderer() {}
void AddParticleGen(const CParticleGen& gen) { gen.Render(); }
~CDefaultWeaponRenderer() {}
void AddParticleGen(const CParticleGen& gen) { gen.Render(); }
};
#endif //__IWEAPONRENDERER_HPP__

View File

@ -104,8 +104,9 @@ typedef struct CARDID {
void __CARDDefaultApiCallback(s32 chan, s32 result);
#define CARDIsValidBlockNo(card, iBlock) (CARD_NUM_SYSTEM_BLOCK <= (iBlock) && (iBlock) < (card)->cBlock)
#define __CARDGetDirCheck(dir) ((CARDDirCheck*) &(dir)[CARD_MAX_FILE])
#define CARDIsValidBlockNo(card, iBlock) \
(CARD_NUM_SYSTEM_BLOCK <= (iBlock) && (iBlock) < (card)->cBlock)
#define __CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE])
CARDDir* __CARDGetDirBlock(CARDControl* card);
u16* __CARDGetFatBlock(CARDControl* card);
@ -118,8 +119,8 @@ void __CARDUnlockedHandler(s32 chan, OSContext* context);
s32 __CARDAccess(CARDControl* card, CARDDir* ent);
BOOL __CARDIsWritable(CARDDir* ent);
#define TRUNC(n, a) (((u32) (n)) & ~((a) - 1))
#define OFFSET(n, a) (((u32) (n)) & ((a) - 1))
#define TRUNC(n, a) (((u32)(n)) & ~((a)-1))
#define OFFSET(n, a) (((u32)(n)) & ((a)-1))
extern CARDControl __CARDBlock[2];
extern DVDDiskID __CARDDiskNone;

View File

@ -1,7 +1,7 @@
#include "types.h"
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
__declspec(section ".init") void __init_hardware(void);
__declspec(section ".init") void __flush_cache(register void* address, register unsigned int size);

View File

@ -29,12 +29,16 @@ extern "C" {
#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK)
#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK)
#define CARDSetBannerFormat(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f)))
#define CARDSetIconAnim(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f)))
#define CARDSetIconFormat(stat, n, f) \
((stat)->iconFormat = (u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconSpeed(stat, n, f) \
((stat)->iconSpeed = (u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetBannerFormat(stat, f) \
((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f)))
#define CARDSetIconAnim(stat, f) \
((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f)))
#define CARDSetIconFormat(stat, n, f) \
((stat)->iconFormat = \
(u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconSpeed(stat, n, f) \
((stat)->iconSpeed = \
(u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr))
#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr))
#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo)
@ -125,7 +129,8 @@ s32 CARDCheckAsync(s32 chan, CARDCallback callback);
s32 CARDCheckEx(s32 chan, s32* xferBytes);
s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback);
s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo);
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback);
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo,
CARDCallback callback);
s32 CARDDelete(s32 chan, const char* fileName);
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback);
s32 CARDFastDelete(s32 chan, s32 fileNo);
@ -143,7 +148,8 @@ s32 CARDGetSerialNo(s32 chan, u64* serialNo);
s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat);
s32 CARDGetXferredBytes(s32 chan);
s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback);
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback);
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback,
CARDCallback attachCallback);
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo);
BOOL CARDProbe(s32 chan);
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize);
@ -158,9 +164,11 @@ s32 CARDGetCurrentMode(s32 chan, u32* mode);
s32 CARDCancel(CARDFileInfo* fileInfo);
s32 CARDClose(CARDFileInfo* fileInfo);
s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset, CARDCallback callback);
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
CARDCallback callback);
s32 CARDWrite(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset);
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset, CARDCallback callback);
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset,
CARDCallback callback);
#ifdef __cplusplus
}

View File

@ -8,35 +8,35 @@
extern "C" {
#endif
typedef void (*DSPCallback)(void *task);
typedef void (*DSPCallback)(void* task);
typedef struct DSPTaskInfo DSPTaskInfo;
typedef struct DSPTaskInfo {
vu32 state;
vu32 priority;
vu32 flags;
u16 *iram_mmem_addr;
u32 iram_length;
u32 iram_addr;
vu32 state;
vu32 priority;
vu32 flags;
u16* iram_mmem_addr;
u32 iram_length;
u32 iram_addr;
u16 *dram_mmem_addr;
u32 dram_length;
u32 dram_addr;
u16* dram_mmem_addr;
u32 dram_length;
u32 dram_addr;
u16 dsp_init_vector;
u16 dsp_resume_vector;
u16 dsp_init_vector;
u16 dsp_resume_vector;
DSPCallback init_cb;
DSPCallback res_cb;
DSPCallback done_cb;
DSPCallback req_cb;
DSPCallback init_cb;
DSPCallback res_cb;
DSPCallback done_cb;
DSPCallback req_cb;
struct STRUCT_DSP_TASK *next;
struct STRUCT_DSP_TASK *prev;
struct STRUCT_DSP_TASK* next;
struct STRUCT_DSP_TASK* prev;
OSTime t_context;
OSTime t_task;
OSTime t_context;
OSTime t_task;
} DSPTaskInfo;
@ -50,12 +50,10 @@ u32 DSPGetDMAStatus();
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task);
void __DSP_debug_printf(const char* fmt, ...);
#ifdef __cplusplus
}
#endif
#endif // __DSP_H__

View File

@ -4,6 +4,6 @@
#include "types.h"
vu16 __DSPRegs[32] : 0xCC005000;
vu32 __AIRegs[8] : 0xCC006C00;
vu32 __AIRegs[8] : 0xCC006C00;
#endif // __DSP_REGS_H__

View File

@ -15,11 +15,12 @@ void GXSetIndTexMtx(GXIndTexMtxID mtx_sel, const void* offset, s8 scale_exp);
void GXSetIndTexMtx(GXIndTexMtxID mtx_sel, f32 offset[2][3], s8 scale_exp);
#endif
void GXSetIndTexOrder(GXIndTexStageID ind_stage, GXTexCoordID tex_coord, GXTexMapID tex_map);
void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel,
GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool ind_lod,
void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format,
GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s,
GXIndTexWrap wrap_t, GXBool add_prev, GXBool ind_lod,
GXIndTexAlphaSel alpha_sel);
void GXSetTevIndWarp(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXBool signed_offsets, GXBool replace_mode,
GXIndTexMtxID matrix_sel);
void GXSetTevIndWarp(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXBool signed_offsets,
GXBool replace_mode, GXIndTexMtxID matrix_sel);
void GXSetIndTexCoordScale(GXIndTexStageID ind_state, GXIndTexScale scale_s, GXIndTexScale scale_t);
#ifdef __cplusplus

View File

@ -14,19 +14,19 @@ extern "C" {
#define GX_DRAW_LINE_STRIP 0xB0
#define GX_DRAW_POINTS 0xB8
#define GX_LOAD_BP_REG 0x61
#define GX_LOAD_CP_REG 0x08
#define GX_LOAD_XF_REG 0x10
#define GX_LOAD_INDX_A 0x20
#define GX_LOAD_INDX_B 0x28
#define GX_LOAD_INDX_C 0x30
#define GX_LOAD_INDX_D 0x38
#define GX_LOAD_BP_REG 0x61
#define GX_LOAD_CP_REG 0x08
#define GX_LOAD_XF_REG 0x10
#define GX_LOAD_INDX_A 0x20
#define GX_LOAD_INDX_B 0x28
#define GX_LOAD_INDX_C 0x30
#define GX_LOAD_INDX_D 0x38
#define GX_CMD_CALL_DL 0x40
#define GX_CMD_INVL_VC 0x48
#define GX_CMD_CALL_DL 0x40
#define GX_CMD_INVL_VC 0x48
#define GX_OPCODE_MASK 0xF8
#define GX_VAT_MASK 0x07
#define GX_OPCODE_MASK 0xF8
#define GX_VAT_MASK 0x07
#ifdef __cplusplus
}

View File

@ -19,9 +19,10 @@ GXFifoObj* GXGetGPFifo(void);
void GXSetCPUFifo(GXFifoObj* fifo);
void GXSetGPFifo(GXFifoObj* fifo);
void GXSaveCPUFifo(GXFifoObj* fifo);
void GXGetFifoStatus(GXFifoObj* fifo, GXBool* overhi, GXBool* underlow, u32* fifoCount, GXBool* cpu_write,
GXBool* gp_read, GXBool* fifowrap);
void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle, GXBool* brkpt);
void GXGetFifoStatus(GXFifoObj* fifo, GXBool* overhi, GXBool* underlow, u32* fifoCount,
GXBool* cpu_write, GXBool* gp_read, GXBool* fifowrap);
void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle,
GXBool* brkpt);
void GXInitFifoLimits(GXFifoObj* fifo, u32 hiWaterMark, u32 loWaterMark);
#ifdef __cplusplus

View File

@ -13,8 +13,8 @@ void GXClearVtxDesc(void);
void GXSetVtxAttrFmt(GXVtxFmt vtxfmt, GXAttr attr, GXCompCnt cnt, GXCompType type, u8 frac);
void GXSetNumTexGens(u8 nTexGens);
void GXBegin(GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts);
void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx, GXBool normalize,
u32 postmtx);
void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx,
GXBool normalize, u32 postmtx);
void GXSetLineWidth(u8 width, GXTexOffset texOffsets);
void GXSetPointSize(u8 pointSize, GXTexOffset texOffsets);
void GXEnableTexOffsets(GXTexCoordID coord, GXBool line_enable, GXBool point_enable);
@ -25,7 +25,8 @@ void GXSetArray(GXAttr attr, const void* data, u8 stride);
#endif
void GXInvalidateVtxCache(void);
static inline void GXSetTexCoordGen(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx) {
static inline void GXSetTexCoordGen(GXTexCoordID dst_coord, GXTexGenType func,
GXTexGenSrc src_param, u32 mtx) {
GXSetTexCoordGen2(dst_coord, func, src_param, mtx, GX_FALSE, GX_PTIDENTITY);
}

View File

@ -18,7 +18,8 @@ void* GXGetTexObjData(GXTexObj* tex_obj);
void GXGetProjectionv(f32* p);
void GXGetLightPos(GXLightObj* lt_obj, f32* x, f32* y, f32* z);
void GXGetLightColor(GXLightObj* lt_obj, GXColor* color);
void GXGetVtxAttrFmt(GXVtxFmt idx, GXAttr attr, GXCompCnt* compCnt, GXCompType* compType, u8* shift);
void GXGetVtxAttrFmt(GXVtxFmt idx, GXAttr attr, GXCompCnt* compCnt, GXCompType* compType,
u8* shift);
#ifdef __cplusplus
}

View File

@ -9,13 +9,14 @@ extern "C" {
#endif
void GXSetNumChans(u8 nChans);
void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorSrc mat_src, u32 light_mask,
GXDiffuseFn diff_fn, GXAttnFn attn_fn);
void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorSrc mat_src,
u32 light_mask, GXDiffuseFn diff_fn, GXAttnFn attn_fn);
void GXSetChanAmbColor(GXChannelID chan, GXColor amb_color);
void GXSetChanMatColor(GXChannelID chan, GXColor mat_color);
void GXInitLightSpot(GXLightObj* lt_obj, f32 cutoff, GXSpotFn spot_func);
void GXInitLightDistAttn(GXLightObj* lt_obj, f32 ref_distance, f32 ref_brightness, GXDistAttnFn dist_func);
void GXInitLightDistAttn(GXLightObj* lt_obj, f32 ref_distance, f32 ref_brightness,
GXDistAttnFn dist_func);
void GXInitLightPos(GXLightObj* lt_obj, f32 x, f32 y, f32 z);
void GXInitLightDir(GXLightObj* lt_obj, f32 nx, f32 ny, f32 nz);
void GXInitLightColor(GXLightObj* lt_obj, GXColor color);

View File

@ -10,7 +10,8 @@ extern "C" {
void GXSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor color);
void GXSetFogColor(GXColor color);
// ? GXSetFogRangeAdj();
void GXSetBlendMode(GXBlendMode type, GXBlendFactor src_factor, GXBlendFactor dst_factor, GXLogicOp op);
void GXSetBlendMode(GXBlendMode type, GXBlendFactor src_factor, GXBlendFactor dst_factor,
GXLogicOp op);
void GXSetColorUpdate(GXBool update_enable);
void GXSetAlphaUpdate(GXBool update_enable);
void GXSetZMode(GXBool compare_enable, GXCompare func, GXBool update_enable);

View File

@ -1,8 +1,8 @@
#ifndef DOLPHIN_GXSTRUCT_H
#define DOLPHIN_GXSTRUCT_H
#include <dolphin/types.h>
#include <dolphin/gx/GXEnum.h>
#include <dolphin/types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -9,8 +9,10 @@ extern "C" {
#endif
void GXSetTevOp(GXTevStageID id, GXTevMode mode);
void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d);
void GXSetTevAlphaIn(GXTevStageID stage, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d);
void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
GXTevColorArg d);
void GXSetTevAlphaIn(GXTevStageID stage, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c,
GXTevAlphaArg d);
void GXSetTevColorOp(GXTevStageID stage, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp,
GXTevRegID out_reg);
void GXSetTevAlphaOp(GXTevStageID stage, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp,
@ -21,8 +23,8 @@ void GXSetTevKColor(GXTevKColorID id, GXColor color);
void GXSetTevKColorSel(GXTevStageID stage, GXTevKColorSel sel);
void GXSetTevKAlphaSel(GXTevStageID stage, GXTevKAlphaSel sel);
void GXSetTevSwapMode(GXTevStageID stage, GXTevSwapSel ras_sel, GXTevSwapSel tex_sel);
void GXSetTevSwapModeTable(GXTevSwapSel table, GXTevColorChan red, GXTevColorChan green, GXTevColorChan blue,
GXTevColorChan alpha);
void GXSetTevSwapModeTable(GXTevSwapSel table, GXTevColorChan red, GXTevColorChan green,
GXTevColorChan blue, GXTevColorChan alpha);
void GXSetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
void GXSetZTexture(GXZTexOp op, GXTexFmt fmt, u32 bias);
void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXChannelID color);

View File

@ -8,13 +8,14 @@
extern "C" {
#endif
void GXInitTexObj(GXTexObj* obj, const void* data, u16 width, u16 height, u32 format, GXTexWrapMode wrapS, GXTexWrapMode wrapT,
GXBool mipmap);
void GXInitTexObjCI(GXTexObj* obj, const void* data, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrapS, GXTexWrapMode wrapT,
GXBool mipmap, u32 tlut);
void GXInitTexObj(GXTexObj* obj, const void* data, u16 width, u16 height, u32 format,
GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXBool mipmap);
void GXInitTexObjCI(GXTexObj* obj, const void* data, u16 width, u16 height, GXCITexFmt format,
GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXBool mipmap, u32 tlut);
void GXInitTexObjData(GXTexObj* obj, const void* data);
void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod, f32 max_lod, f32 lod_bias, GXBool bias_clamp,
GXBool do_edge_lod, GXAnisotropy max_aniso);
void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod,
f32 max_lod, f32 lod_bias, GXBool bias_clamp, GXBool do_edge_lod,
GXAnisotropy max_aniso);
void GXLoadTexObj(GXTexObj* obj, GXTexMapID id);
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod);
void GXInvalidateTexAll();

View File

@ -1,8 +1,8 @@
#ifndef __OSALARM_H__
#define __OSALARM_H__
#include <types.h>
#include <dolphin/os/OSContext.h>
#include <types.h>
#ifdef __cplusplus
extern "C" {

View File

@ -8,33 +8,31 @@ extern "C" {
#endif
typedef struct OSContext {
u32 gpr[32];
u32 cr;
u32 lr;
u32 ctr;
u32 xer;
u32 gpr[32];
u32 cr;
u32 lr;
u32 ctr;
u32 xer;
f64 fpr[32];
f64 fpr[32];
u32 fpscr_pad;
u32 fpscr;
u32 fpscr_pad;
u32 fpscr;
u32 srr0;
u32 srr1;
u32 srr0;
u32 srr1;
u16 mode;
u16 state;
u16 mode;
u16 state;
u32 gqr[8];
u32 psf_pad;
f64 psf[32];
u32 gqr[8];
u32 psf_pad;
f64 psf[32];
} OSContext;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -7,18 +7,17 @@
extern "C" {
#endif
typedef BOOL (* OSResetFunction )(BOOL final);
typedef BOOL (*OSResetFunction)(BOOL final);
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
struct OSResetFunctionInfo
{
// public
OSResetFunction func;
u32 priority;
struct OSResetFunctionInfo {
// public
OSResetFunction func;
u32 priority;
// private
OSResetFunctionInfo* next;
OSResetFunctionInfo* prev;
// private
OSResetFunctionInfo* next;
OSResetFunctionInfo* prev;
};
#ifdef __cplusplus

View File

@ -53,7 +53,8 @@ extern "C" {
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
#define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
#define SI_GC_WAVEBIRD \
(SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)

View File

@ -37,11 +37,9 @@
#define PAD_CHAN2_BIT 0x20000000
#define PAD_CHAN3_BIT 0x10000000
#define PADButtonDown(buttonLast, button) \
((((buttonLast) ^ (button)) & (button)))
#define PADButtonDown(buttonLast, button) ((((buttonLast) ^ (button)) & (button)))
#define PADButtonUp(buttonLast, button) \
((((buttonLast) ^ (button)) & (buttonLast)))
#define PADButtonUp(buttonLast, button) ((((buttonLast) ^ (button)) & (buttonLast)))
#ifdef __cplusplus
extern "C" {

View File

@ -55,7 +55,8 @@
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
#define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
#define SI_GC_WAVEBIRD \
(SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)

View File

@ -9,10 +9,10 @@ extern "C" {
#endif
void VIInit(void);
void VIConfigure(GXRenderModeObj *rm);
void VIConfigure(GXRenderModeObj* rm);
void VIFlush(void);
u32 VIGetTvFormat(void);
void VISetNextFrameBuffer(void *fb);
void VISetNextFrameBuffer(void* fb);
void VIWaitForRetrace(void);
void VISetBlack(BOOL black);

View File

@ -230,7 +230,8 @@ typedef struct SND_PARAMETER_INFO {
#define sndFXStart(fid, vol, pan) sndFXStartEx(fid, vol, pan, SND_STUDIO_DEFAULT)
SND_VOICEID sndFXStartEx(SND_FXID fid, u8 vol, u8 pan, u8 studio);
SND_VOICEID sndFXStartPara(SND_FXID fid, u8 vol, u8 pan, u8 studio, u8 numPara, ...);
SND_VOICEID sndFXStartParaInfo(SND_FXID fid, u8 vol, u8 pan, u8 studio, SND_PARAMETER_INFO* paraInfo);
SND_VOICEID sndFXStartParaInfo(SND_FXID fid, u8 vol, u8 pan, u8 studio,
SND_PARAMETER_INFO* paraInfo);
SND_VOICEID sndFXCheck(SND_VOICEID vid);
bool sndFXKeyOff(SND_VOICEID vid);
bool sndFXCtrl(SND_VOICEID vid, u8 ctrl, u8 value);

View File

@ -33,7 +33,7 @@ void synthExit();
u32 synthGetTicksPerSecond(u32 seconds);
u16 sndRand(void);
s16 sndSin(u32 __x);
u8* sndBSearch(u16 *key,u8 *subTab,s32 mainTab,s32 len,SND_COMPARE cmp);
u8* sndBSearch(u16* key, u8* subTab, s32 mainTab, s32 len, SND_COMPARE cmp);
void sndConvertMs(u32* time);
void sndConvertTicks(u32* out, u32 seconds);
u32 sndConvert2Ms(u32 time);
@ -49,7 +49,6 @@ float salNormalizeVector(SND_FVECTOR* vec);
void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR* b);
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in);
/* hardware */
/* TODO: Figure out what `unk` is */
bool hwAddInput(u8 studio, void* unk);

View File

@ -16,4 +16,3 @@ u16 seqGetMIDIPriority(s32 unk1, s32 unk2);
#ifdef __cplusplus
}
#endif

View File

@ -7,19 +7,19 @@ extern "C" {
#endif
typedef struct SynthVoice {
char data1[0xf4];
u32 _f4;
VoiceID* voiceId;
char data2[0x18];
u32 _114[2];
u8 _11c;
u8 _11d;
u8 _11e;
u8 studio;
char data3[0x404 - 0x120];
char data1[0xf4];
u32 _f4;
VoiceID* voiceId;
char data2[0x18];
u32 _114[2];
u8 _11c;
u8 _11d;
u8 _11e;
u8 studio;
char data3[0x404 - 0x120];
} SynthVoice;
typedef void (*SND_AUX_CALLBACK)(u8 reason, SND_AUX_INFO * info, void * user);
typedef void (*SND_AUX_CALLBACK)(u8 reason, SND_AUX_INFO* info, void* user);
extern SND_AUX_CALLBACK synthAuxACallback[8];
extern u8 synthAuxAMIDI[8];
@ -37,14 +37,11 @@ bool synthSendKeyOff(SND_VOICEID vid);
SND_VOICEID synthFXStart(SND_FXID fid, u8 vol, u8 pan, u8 studio, u8);
void synthVolume(u8 volume, u16 time, u8 volgroup2, s32, s32);
/* TODO: Move this where it belongs */
void hwSetAUXProcessingCallbacks(u8 studio,
SND_AUX_CALLBACK auxA, void * userA,
SND_AUX_CALLBACK auxB, void * userB);
void hwSetAUXProcessingCallbacks(u8 studio, SND_AUX_CALLBACK auxA, void* userA,
SND_AUX_CALLBACK auxB, void* userB);
#ifndef __cplusplus
}
#endif
#endif // __SYNTH_H__

View File

@ -10,13 +10,15 @@
#include "rstl/vector.hpp"
namespace rstl {
template < typename K, typename P, int unk, typename Select, typename Hash, typename Equal, typename Alloc = rmemory_allocator >
template < typename K, typename P, int unk, typename Select, typename Hash, typename Equal,
typename Alloc = rmemory_allocator >
class hash_table {
private:
rstl::vector< rstl::list< P, Alloc > /*::iterator*/, Alloc > x;
};
template < typename K, typename V, typename Hash, typename Equal, typename Alloc = rmemory_allocator >
template < typename K, typename V, typename Hash, typename Equal,
typename Alloc = rmemory_allocator >
class hash_map {
typedef rstl::pair< K, V > Pair;

View File

@ -10,7 +10,10 @@ public:
inline pair() {}
inline pair(const L& first, const R& second) : first(first), second(second) {}
inline pair(const pair& other) : first(other.first), second(other.second) {}
inline void operator=(const pair& other) { first = other.first; second = other.second; }
inline void operator=(const pair& other) {
first = other.first;
second = other.second;
}
L first;
R second;

View File

@ -22,8 +22,14 @@ public:
const_pointer_iterator() : current(nullptr) {}
const_pointer_iterator(const T* begin) : current(begin) {}
const_pointer_iterator& operator++() { ++current; return *this; }
const_pointer_iterator& operator--() { --current; return *this; }
const_pointer_iterator& operator++() {
++current;
return *this;
}
const_pointer_iterator& operator--() {
--current;
return *this;
}
T* get_pointer() const { return const_cast< T* >(current); }
const T& operator*() const { return *get_pointer(); }
const T* operator->() const { return get_pointer(); }
@ -31,8 +37,12 @@ public:
bool operator==(const const_pointer_iterator& other) { return current == other.current; }
bool operator!=(const const_pointer_iterator& other) { return current != other.current; }
friend const_pointer_iterator operator+(const const_pointer_iterator& x, int v) { return const_pointer_iterator(x.current + v); }
friend const_pointer_iterator operator-(const const_pointer_iterator& x, int v) { return const_pointer_iterator(x.current - v); }
friend const_pointer_iterator operator+(const const_pointer_iterator& x, int v) {
return const_pointer_iterator(x.current + v);
}
friend const_pointer_iterator operator-(const const_pointer_iterator& x, int v) {
return const_pointer_iterator(x.current - v);
}
};
template < typename T, typename Vec, typename Alloc >
@ -54,11 +64,21 @@ public:
rstl::destroy(get_pointer());
}
}
pointer_iterator& operator++() { ++current; return *this; }
pointer_iterator& operator--() { --current; return *this; }
pointer_iterator& operator++() {
++current;
return *this;
}
pointer_iterator& operator--() {
--current;
return *this;
}
friend pointer_iterator operator+(const pointer_iterator& x, int v) { return pointer_iterator(x.get_pointer() + v); }
friend pointer_iterator operator-(const pointer_iterator& x, int v) { return pointer_iterator(x.get_pointer() - v); }
friend pointer_iterator operator+(const pointer_iterator& x, int v) {
return pointer_iterator(x.get_pointer() + v);
}
friend pointer_iterator operator-(const pointer_iterator& x, int v) {
return pointer_iterator(x.get_pointer() - v);
}
};
} // namespace rstl

View File

@ -9,7 +9,8 @@ namespace rstl {
template < typename _CharTp >
struct char_traits {};
template < typename _CharTp, typename Traits = char_traits< _CharTp >, typename Alloc = rmemory_allocator >
template < typename _CharTp, typename Traits = char_traits< _CharTp >,
typename Alloc = rmemory_allocator >
class basic_string {
struct COWData {
u32 x0_capacity;

View File

@ -18,8 +18,7 @@ template < class T, int N >
struct check_sizeof : _n_is_equal< sizeof(T), N > {};
#ifdef __MWERKS__
#define CHECK_SIZEOF(cls, size) \
extern int cls##_check[check_sizeof< cls, size >::value];
#define CHECK_SIZEOF(cls, size) extern int cls##_check[check_sizeof< cls, size >::value];
#else
#define CHECK_SIZEOF(cls, size)
#endif

View File

@ -142,7 +142,8 @@ static inline int __fpclassifyd(double x) {
return FP_NORMAL;
}
#define fpclassify(x) (sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)))
#define fpclassify(x) \
(sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)))
#define isnormal(x) (fpclassify(x) == FP_NORMAL)
#define isnan(x) (fpclassify(x) == FP_NAN)
#define isinf(x) (fpclassify(x) == FP_INFINITE)

View File

@ -1,8 +1,8 @@
#ifndef _STDIO_H_
#define _STDIO_H_
#include <stddef.h>
#include <stdarg.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

View File

@ -46,7 +46,9 @@ void AIStartDMA() { __DSPRegs[27] |= 0x8000; }
void AIStopDMA(void) { __DSPRegs[27] &= ~0x8000; }
u32 AIGetDMAStartAddr(void) { return (u32)((__DSPRegs[24] & 0x03ff) << 16) | (__DSPRegs[25] & 0xffe0); }
u32 AIGetDMAStartAddr(void) {
return (u32)((__DSPRegs[24] & 0x03ff) << 16) | (__DSPRegs[25] & 0xffe0);
}
AISCallback AIRegisterStreamCallback(AISCallback callback) {
AISCallback ret;
@ -157,7 +159,9 @@ void AISetStreamVolLeft(u8 volume) { __AIRegs[1] = (__AIRegs[1] & ~0xFF) | (volu
u8 AIGetStreamVolLeft() { return __AIRegs[1]; }
void AISetStreamVolRight(u8 volume) { __AIRegs[1] = (__AIRegs[1] & ~0xFF00) | ((volume & 0xFF) << 8); }
void AISetStreamVolRight(u8 volume) {
__AIRegs[1] = (__AIRegs[1] & ~0xFF00) | ((volume & 0xFF) << 8);
}
u8 AIGetStreamVolRight() { return __AIRegs[1] >> 8; }

View File

@ -5,7 +5,8 @@
#include <dolphin/CARDPriv.h>
const char* __CARDVersion = "<< Dolphin SDK - CARD\trelease build: Sep 5 2002 05:35:20 (0x2301) >>";
const char* __CARDVersion =
"<< Dolphin SDK - CARD\trelease build: Sep 5 2002 05:35:20 (0x2301) >>";
CARDControl __CARDBlock[2];
DVDDiskID __CARDDiskNone;
@ -73,7 +74,8 @@ void __CARDExiHandler(s32 chan, OSContext* context) {
goto error;
}
if ((result = (status & 0x18) ? CARD_RESULT_IOERROR : CARD_RESULT_READY) == CARD_RESULT_IOERROR && --card->retry > 0) {
if ((result = (status & 0x18) ? CARD_RESULT_IOERROR : CARD_RESULT_READY) == CARD_RESULT_IOERROR &&
--card->retry > 0) {
result = Retry(chan);
if (result >= 0) {
return;
@ -203,7 +205,8 @@ static void SetupTimeoutAlarm(CARDControl* card) {
break;
case 0xF4:
case 0xF1:
OSSetAlarm(&card->alarm, OSSecondsToTicks((OSTime)2) * (card->sectorSize / 0x2000), TimeoutHandler);
OSSetAlarm(&card->alarm, OSSecondsToTicks((OSTime)2) * (card->sectorSize / 0x2000),
TimeoutHandler);
break;
}
}
@ -225,7 +228,8 @@ static s32 Retry(s32 chan) {
return CARD_RESULT_NOCARD;
}
if (card->cmd[0] == 0x52 && !EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency, 1)) {
if (card->cmd[0] == 0x52 &&
!EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency, 1)) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
@ -237,7 +241,8 @@ static s32 Retry(s32 chan) {
return CARD_RESULT_READY;
}
if (!EXIDma(chan, card->buffer, (s32)((card->cmd[0] == 0x52) ? 512 : 128), card->mode, __CARDTxHandler)) {
if (!EXIDma(chan, card->buffer, (s32)((card->cmd[0] == 0x52) ? 512 : 128), card->mode,
__CARDTxHandler)) {
EXIDeselect(chan);
EXIUnlock(chan);
return CARD_RESULT_NOCARD;
@ -347,7 +352,8 @@ s32 __CARDReadSegment(s32 chan, CARDCallback callback) {
result = CARD_RESULT_READY;
} else if (result >= 0) {
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1) ||
!EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency, 1) || // XXX use DMA if possible
!EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency,
1) || // XXX use DMA if possible
!EXIDma(chan, card->buffer, 512, card->mode, __CARDTxHandler)) {
card->txCallback = 0;
EXIDeselect(chan);
@ -378,7 +384,8 @@ s32 __CARDWritePage(s32 chan, CARDCallback callback) {
if (result == CARD_RESULT_BUSY) {
result = CARD_RESULT_READY;
} else if (result >= 0) {
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1) || !EXIDma(chan, card->buffer, 128, card->mode, __CARDTxHandler)) {
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1) ||
!EXIDma(chan, card->buffer, 128, card->mode, __CARDTxHandler)) {
card->exiCallback = 0;
EXIDeselect(chan);
EXIUnlock(chan);

View File

@ -154,5 +154,6 @@ s32 __CARDUpdateFatBlock(s32 chan, u16* fat, CARDCallback callback) {
DCStoreRange(fat, 0x2000);
card->eraseCallback = callback;
return __CARDEraseSector(chan, (((u32)fat - (u32)card->workArea) / 8192u) * card->sectorSize, EraseCallback);
return __CARDEraseSector(chan, (((u32)fat - (u32)card->workArea) / 8192u) * card->sectorSize,
EraseCallback);
}

View File

@ -120,7 +120,8 @@ static s32 VerifyFAT(CARDControl* card, int* outCurrent) {
for (i = 0; i < 2; i++) {
fatp = fat[i] = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
__CARDCheckSum(&fatp[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &checkSum, &checkSumInv);
__CARDCheckSum(&fatp[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &checkSum,
&checkSumInv);
if (fatp[CARD_FAT_CHECKSUM] != checkSum || fatp[CARD_FAT_CHECKSUMINV] != checkSumInv) {
++errors;
current = i;
@ -282,8 +283,8 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) {
updateOrphan = TRUE;
}
if (updateOrphan) {
__CARDCheckSum(&card->currentFat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &card->currentFat[CARD_FAT_CHECKSUM],
&card->currentFat[CARD_FAT_CHECKSUMINV]);
__CARDCheckSum(&card->currentFat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32),
&card->currentFat[CARD_FAT_CHECKSUM], &card->currentFat[CARD_FAT_CHECKSUMINV]);
}
memcpy(fat[currentFat ^ 1], fat[currentFat], CARD_SYSTEM_BLOCK_SIZE);

View File

@ -51,7 +51,8 @@ error:
}
}
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback) {
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo,
CARDCallback callback) {
CARDControl* card;
CARDDir* dir;
CARDDir* ent;
@ -82,7 +83,8 @@ s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* file
freeNo = fileNo;
}
} else if (memcmp(ent->gameName, card->diskID->gameName, sizeof(ent->gameName)) == 0 &&
memcmp(ent->company, card->diskID->company, sizeof(ent->company)) == 0 && __CARDCompareFileName(ent, fileName)) {
memcmp(ent->company, card->diskID->company, sizeof(ent->company)) == 0 &&
__CARDCompareFileName(ent, fileName)) {
return __CARDPutControlBlock(card, CARD_RESULT_EXIST);
}
}

View File

@ -24,16 +24,18 @@ static void FormatCallback(s32 chan, s32 result) {
}
} else if (card->formatStep < 2 * CARD_NUM_SYSTEM_BLOCK) {
int step = card->formatStep - CARD_NUM_SYSTEM_BLOCK;
result = __CARDWrite(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, (u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step),
FormatCallback);
result = __CARDWrite(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE,
(u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), FormatCallback);
if (result >= 0) {
return;
}
} else {
card->currentDir = (CARDDir*)((u8*)card->workArea + (1 + 0) * CARD_SYSTEM_BLOCK_SIZE);
memcpy(card->currentDir, (u8*)card->workArea + (1 + 1) * CARD_SYSTEM_BLOCK_SIZE, CARD_SYSTEM_BLOCK_SIZE);
memcpy(card->currentDir, (u8*)card->workArea + (1 + 1) * CARD_SYSTEM_BLOCK_SIZE,
CARD_SYSTEM_BLOCK_SIZE);
card->currentFat = (u16*)((u8*)card->workArea + (3 + 0) * CARD_SYSTEM_BLOCK_SIZE);
memcpy(card->currentFat, (u8*)card->workArea + (3 + 1) * CARD_SYSTEM_BLOCK_SIZE, CARD_SYSTEM_BLOCK_SIZE);
memcpy(card->currentFat, (u8*)card->workArea + (3 + 1) * CARD_SYSTEM_BLOCK_SIZE,
CARD_SYSTEM_BLOCK_SIZE);
}
error:
@ -96,7 +98,8 @@ s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) {
memset(dir, 0xff, CARD_SYSTEM_BLOCK_SIZE);
check = __CARDGetDirCheck(dir);
check->checkCode = i;
__CARDCheckSum(dir, CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &check->checkSum, &check->checkSumInv);
__CARDCheckSum(dir, CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &check->checkSum,
&check->checkSumInv);
}
for (i = 0; i < 2; i++) {
fat = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
@ -104,7 +107,8 @@ s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) {
fat[CARD_FAT_CHECKCODE] = (u16)i;
fat[CARD_FAT_FREEBLOCKS] = (u16)(card->cBlock - CARD_NUM_SYSTEM_BLOCK);
fat[CARD_FAT_LASTSLOT] = CARD_NUM_SYSTEM_BLOCK - 1;
__CARDCheckSum(&fat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &fat[CARD_FAT_CHECKSUM], &fat[CARD_FAT_CHECKSUMINV]);
__CARDCheckSum(&fat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32),
&fat[CARD_FAT_CHECKSUM], &fat[CARD_FAT_CHECKSUMINV]);
}
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
@ -118,4 +122,6 @@ s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) {
return result;
}
s32 CARDFormatAsync(s32 chan, CARDCallback callback) { return __CARDFormatRegionAsync(chan, __CARDGetFontEncode(), callback); }
s32 CARDFormatAsync(s32 chan, CARDCallback callback) {
return __CARDFormatRegionAsync(chan, __CARDGetFontEncode(), callback);
}

View File

@ -215,8 +215,8 @@ static s32 DoMount(s32 chan) {
}
step = card->mountStep - 2;
result = __CARDRead(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, (u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step),
__CARDMountCallback);
result = __CARDRead(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE,
(u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), __CARDMountCallback);
if (result < 0) {
__CARDPutControlBlock(card, result);
}
@ -269,7 +269,8 @@ void __CARDMountCallback(s32 chan, s32 result) {
callback(chan, result);
}
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback) {
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback,
CARDCallback attachCallback) {
CARDControl* card;
BOOL enabled;

View File

@ -14,7 +14,6 @@ s32 CARDGetSerialNo(s32 chan, u64* serialNo) {
u64 code;
s32 result;
if (!(0 <= chan && chan < 2)) {
return CARD_RESULT_FATAL_ERROR;
}

View File

@ -33,8 +33,8 @@ s32 __CARDAccess(CARDControl* card, CARDDir* ent) {
return CARD_RESULT_NOFILE;
}
if (card->diskID == &__CARDDiskNone ||
(memcmp(ent->gameName, card->diskID->gameName, 4) == 0 && memcmp(ent->company, card->diskID->company, 2) == 0)) {
if (card->diskID == &__CARDDiskNone || (memcmp(ent->gameName, card->diskID->gameName, 4) == 0 &&
memcmp(ent->company, card->diskID->company, 2) == 0)) {
return CARD_RESULT_READY;
}
@ -120,6 +120,4 @@ s32 CARDClose(CARDFileInfo* fileInfo) {
return __CARDPutControlBlock(card, CARD_RESULT_READY);
}
BOOL __CARDIsOpened(CARDControl* card, s32 fileNo) {
return FALSE;
}
BOOL __CARDIsOpened(CARDControl* card, s32 fileNo) { return FALSE; }

View File

@ -17,13 +17,15 @@ s32 __CARDSeek(CARDFileInfo* fileInfo, s32 length, s32 offset, CARDControl** pca
return result;
}
if (!CARDIsValidBlockNo(card, fileInfo->iBlock) || card->cBlock * card->sectorSize <= fileInfo->offset) {
if (!CARDIsValidBlockNo(card, fileInfo->iBlock) ||
card->cBlock * card->sectorSize <= fileInfo->offset) {
return __CARDPutControlBlock(card, CARD_RESULT_FATAL_ERROR);
}
dir = __CARDGetDirBlock(card);
ent = &dir[fileInfo->fileNo];
if (ent->length * card->sectorSize <= offset || ent->length * card->sectorSize < offset + length) {
if (ent->length * card->sectorSize <= offset ||
ent->length * card->sectorSize < offset + length) {
return __CARDPutControlBlock(card, CARD_RESULT_LIMIT);
}
@ -84,7 +86,8 @@ static void ReadCallback(s32 chan, s32 result) {
}
result = __CARDRead(chan, card->sectorSize * (u32)fileInfo->iBlock,
(fileInfo->length < card->sectorSize) ? fileInfo->length : card->sectorSize, card->buffer, ReadCallback);
(fileInfo->length < card->sectorSize) ? fileInfo->length : card->sectorSize,
card->buffer, ReadCallback);
if (result < 0) {
goto error;
}
@ -98,7 +101,8 @@ error:
callback(chan, result);
}
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback) {
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset,
CARDCallback callback) {
CARDControl* card;
s32 result;
CARDDir* dir;
@ -128,7 +132,8 @@ s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CAR
offset = (s32)OFFSET(fileInfo->offset, card->sectorSize);
length = (length < card->sectorSize - offset) ? length : card->sectorSize - offset;
result = __CARDRead(fileInfo->chan, card->sectorSize * (u32)fileInfo->iBlock + offset, length, buf, ReadCallback);
result = __CARDRead(fileInfo->chan, card->sectorSize * (u32)fileInfo->iBlock + offset, length,
buf, ReadCallback);
if (result < 0) {
__CARDPutControlBlock(card, result);
}

View File

@ -106,8 +106,10 @@ s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callba
CARDDir* ent;
s32 result;
if (fileNo < 0 || CARD_MAX_FILE <= fileNo || (stat->iconAddr != 0xffffffff && CARD_READ_SIZE <= stat->iconAddr) ||
(stat->commentAddr != 0xffffffff && CARD_SYSTEM_BLOCK_SIZE - CARD_COMMENT_SIZE < stat->commentAddr % CARD_SYSTEM_BLOCK_SIZE)) {
if (fileNo < 0 || CARD_MAX_FILE <= fileNo ||
(stat->iconAddr != 0xffffffff && CARD_READ_SIZE <= stat->iconAddr) ||
(stat->commentAddr != 0xffffffff &&
CARD_SYSTEM_BLOCK_SIZE - CARD_COMMENT_SIZE < stat->commentAddr % CARD_SYSTEM_BLOCK_SIZE)) {
return CARD_RESULT_FATAL_ERROR;
}
result = __CARDGetControlBlock(chan, &card);

View File

@ -9,22 +9,28 @@ static void InitCallback(void* task);
static void DoneCallback(void* task);
static u8 CardData[] ATTRIBUTE_ALIGN(32) = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21, 0x13, 0x06, 0x12, 0x03, 0x12, 0x04, 0x13, 0x05, 0x00, 0x92, 0x00, 0xFF,
0x00, 0x88, 0xFF, 0xFF, 0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00, 0x8B, 0xFF, 0xFF, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x88,
0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x00, 0x16, 0xFB, 0x00, 0x01, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x03, 0x80, 0xFF, 0x00,
0x02, 0x94, 0x00, 0x27, 0x02, 0xBF, 0x00, 0x8E, 0x1F, 0xDF, 0x24, 0xFF, 0x02, 0x40, 0x0F, 0xFF, 0x00, 0x98, 0x04, 0x00, 0x00, 0x9A,
0x00, 0x10, 0x00, 0x99, 0x00, 0x00, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x94, 0x02, 0xBF, 0x86, 0x44, 0x02, 0xBF, 0x00, 0x88, 0x16, 0xFC,
0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x03, 0x16, 0xFB, 0x00, 0x01, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x03, 0x80, 0xCD, 0xD1, 0x02, 0x94,
0x00, 0x48, 0x27, 0xFF, 0x03, 0x80, 0x00, 0x01, 0x02, 0x95, 0x00, 0x5A, 0x03, 0x80, 0x00, 0x02, 0x02, 0x95, 0x80, 0x00, 0x02, 0x9F,
0x00, 0x48, 0x00, 0x21, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E,
0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC5, 0xFF, 0xFF, 0x03, 0x40, 0x0F, 0xFF, 0x1C, 0x9F, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC7,
0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC6, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC0, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E,
0x20, 0xFF, 0x03, 0x40, 0x0F, 0xFF, 0x1F, 0x5F, 0x02, 0xBF, 0x00, 0x8E, 0x21, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x23, 0xFF, 0x12, 0x05,
0x12, 0x06, 0x02, 0x9F, 0x80, 0xB5, 0x00, 0x21, 0x27, 0xFC, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9D, 0x00, 0x88, 0x02, 0xDF, 0x27, 0xFE,
0x03, 0xC0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x8E, 0x02, 0xDF, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xF8, 0xFF, 0xCD, 0x00, 0xF9, 0xFF, 0xC9,
0x00, 0xFA, 0xFF, 0xCB, 0x26, 0xC9, 0x02, 0xC0, 0x00, 0x04, 0x02, 0x9D, 0x00, 0x9C, 0x02, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21,
0x13, 0x06, 0x12, 0x03, 0x12, 0x04, 0x13, 0x05, 0x00, 0x92, 0x00, 0xFF, 0x00, 0x88, 0xFF, 0xFF,
0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00, 0x8B, 0xFF, 0xFF, 0x8F, 0x00, 0x02, 0xBF,
0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x00, 0x16, 0xFB, 0x00, 0x01, 0x02, 0xBF,
0x00, 0x8E, 0x25, 0xFF, 0x03, 0x80, 0xFF, 0x00, 0x02, 0x94, 0x00, 0x27, 0x02, 0xBF, 0x00, 0x8E,
0x1F, 0xDF, 0x24, 0xFF, 0x02, 0x40, 0x0F, 0xFF, 0x00, 0x98, 0x04, 0x00, 0x00, 0x9A, 0x00, 0x10,
0x00, 0x99, 0x00, 0x00, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x94, 0x02, 0xBF, 0x86, 0x44, 0x02, 0xBF,
0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x03, 0x16, 0xFB, 0x00, 0x01, 0x8F, 0x00,
0x02, 0xBF, 0x00, 0x8E, 0x03, 0x80, 0xCD, 0xD1, 0x02, 0x94, 0x00, 0x48, 0x27, 0xFF, 0x03, 0x80,
0x00, 0x01, 0x02, 0x95, 0x00, 0x5A, 0x03, 0x80, 0x00, 0x02, 0x02, 0x95, 0x80, 0x00, 0x02, 0x9F,
0x00, 0x48, 0x00, 0x21, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E,
0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC5, 0xFF, 0xFF,
0x03, 0x40, 0x0F, 0xFF, 0x1C, 0x9F, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC7, 0xFF, 0xFF, 0x02, 0xBF,
0x00, 0x8E, 0x00, 0xC6, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC0, 0xFF, 0xFF, 0x02, 0xBF,
0x00, 0x8E, 0x20, 0xFF, 0x03, 0x40, 0x0F, 0xFF, 0x1F, 0x5F, 0x02, 0xBF, 0x00, 0x8E, 0x21, 0xFF,
0x02, 0xBF, 0x00, 0x8E, 0x23, 0xFF, 0x12, 0x05, 0x12, 0x06, 0x02, 0x9F, 0x80, 0xB5, 0x00, 0x21,
0x27, 0xFC, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9D, 0x00, 0x88, 0x02, 0xDF, 0x27, 0xFE, 0x03, 0xC0,
0x80, 0x00, 0x02, 0x9C, 0x00, 0x8E, 0x02, 0xDF, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xF8, 0xFF, 0xCD,
0x00, 0xF9, 0xFF, 0xC9, 0x00, 0xFA, 0xFF, 0xCB, 0x26, 0xC9, 0x02, 0xC0, 0x00, 0x04, 0x02, 0x9D,
0x00, 0x9C, 0x02, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
typedef struct DecodeParameters {

View File

@ -68,7 +68,8 @@ static void EraseCallback(s32 chan, s32 result) {
}
fileInfo = card->fileInfo;
result = __CARDWrite(chan, card->sectorSize * (u32)fileInfo->iBlock, card->sectorSize, card->buffer, WriteCallback);
result = __CARDWrite(chan, card->sectorSize * (u32)fileInfo->iBlock, card->sectorSize,
card->buffer, WriteCallback);
if (result < 0) {
goto error;
}
@ -81,7 +82,8 @@ error:
callback(chan, result);
}
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* buf, s32 length, s32 offset, CARDCallback callback) {
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* buf, s32 length, s32 offset,
CARDCallback callback) {
CARDControl* card;
s32 result;
CARDDir* dir;
@ -106,7 +108,8 @@ s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* buf, s32 length, s32 offs
DCStoreRange((void*)buf, (u32)length);
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
card->buffer = (void*)buf;
result = __CARDEraseSector(fileInfo->chan, card->sectorSize * (u32)fileInfo->iBlock, EraseCallback);
result =
__CARDEraseSector(fileInfo->chan, card->sectorSize * (u32)fileInfo->iBlock, EraseCallback);
if (result < 0) {
__CARDPutControlBlock(card, result);
}

View File

@ -7,7 +7,8 @@
extern "C" {
#endif
static const char* __DSPVersion = "<< Dolphin SDK - DSP\trelease build: Sep 5 2002 05:35:13 (0x2301) >>";
static const char* __DSPVersion =
"<< Dolphin SDK - DSP\trelease build: Sep 5 2002 05:35:13 (0x2301) >>";
static s32 __DSP_init_flag = 0;
extern DSPTaskInfo* __DSP_tmp_task;
extern DSPTaskInfo* __DSP_last_task;
@ -18,89 +19,82 @@ extern void __DSPHandler(__OSInterrupt, OSContext*);
extern void __DSP_debug_printf(const char* fmt, ...);
extern void __DSP_boot_task(DSPTaskInfo* task);
u32 DSPCheckMailToDSP(void) {
return (__DSPRegs[0] >> 0xF) & 1;
}
u32 DSPCheckMailToDSP(void) { return (__DSPRegs[0] >> 0xF) & 1; }
u32 DSPCheckMailFromDSP(void) {
return (__DSPRegs[2] >> 0xF) & 1;
}
u32 DSPCheckMailFromDSP(void) { return (__DSPRegs[2] >> 0xF) & 1; }
u32 DSPReadMailFromDSP() {
u16 reg1;
u16 reg2;
reg1 = __DSPRegs[2];
reg2 = __DSPRegs[3];
return reg1 << 16 | reg2;
u16 reg1;
u16 reg2;
reg1 = __DSPRegs[2];
reg2 = __DSPRegs[3];
return reg1 << 16 | reg2;
}
void DSPSendMailToDSP(u32 mail) {
__DSPRegs[0] = mail >> 16;
__DSPRegs[1] = mail;
__DSPRegs[0] = mail >> 16;
__DSPRegs[1] = mail;
}
void DSPInit(void) {
u32 oldInt;
u16 reg;
__DSP_debug_printf("DSPInit(): Build Date: %s %s\n", "Sep 5 2002", "05:35:13");
u32 oldInt;
u16 reg;
__DSP_debug_printf("DSPInit(): Build Date: %s %s\n", "Sep 5 2002", "05:35:13");
if (__DSP_init_flag == 1) {
return;
}
OSRegisterVersion(__DSPVersion);
oldInt = OSDisableInterrupts();
__OSSetInterruptHandler(7, __DSPHandler);
__OSUnmaskInterrupts(0x1000000);
reg = __DSPRegs[5];
reg = (reg & ~0xA8) | 0x800;
__DSPRegs[5] = reg;
reg = __DSPRegs[5];
reg = reg & ~0xAC;
__DSPRegs[5] = reg;
__DSP_tmp_task = 0;
__DSP_curr_task = 0;
__DSP_last_task = 0;
__DSP_first_task = 0;
__DSP_init_flag = 1;
OSRestoreInterrupts(oldInt);
if (__DSP_init_flag == 1) {
return;
}
OSRegisterVersion(__DSPVersion);
oldInt = OSDisableInterrupts();
__OSSetInterruptHandler(7, __DSPHandler);
__OSUnmaskInterrupts(0x1000000);
reg = __DSPRegs[5];
reg = (reg & ~0xA8) | 0x800;
__DSPRegs[5] = reg;
reg = __DSPRegs[5];
reg = reg & ~0xAC;
__DSPRegs[5] = reg;
__DSP_tmp_task = 0;
__DSP_curr_task = 0;
__DSP_last_task = 0;
__DSP_first_task = 0;
__DSP_init_flag = 1;
OSRestoreInterrupts(oldInt);
}
void DSPReset(void) {
u16 reg;
u32 oldInt;
oldInt = OSDisableInterrupts();
reg = __DSPRegs[5];
__DSPRegs[5] = (reg & ~0xA8) | 0x801;
__DSP_init_flag = 0;
OSRestoreInterrupts(oldInt);
u16 reg;
u32 oldInt;
oldInt = OSDisableInterrupts();
reg = __DSPRegs[5];
__DSPRegs[5] = (reg & ~0xA8) | 0x801;
__DSP_init_flag = 0;
OSRestoreInterrupts(oldInt);
}
void DSPHalt(void) {
u16 reg;
u32 oldInt;
oldInt = OSDisableInterrupts();
reg = __DSPRegs[5];
__DSPRegs[5] = (reg & ~0xA8) | 4;
OSRestoreInterrupts(oldInt);
u16 reg;
u32 oldInt;
oldInt = OSDisableInterrupts();
reg = __DSPRegs[5];
__DSPRegs[5] = (reg & ~0xA8) | 4;
OSRestoreInterrupts(oldInt);
}
u32 DSPGetDMAStatus(void) {
return __DSPRegs[5] & 0x200;
}
u32 DSPGetDMAStatus(void) { return __DSPRegs[5] & 0x200; }
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) {
u32 oldInt;
oldInt = OSDisableInterrupts();
__DSP_insert_task(task);
task->state = 0;
task->flags = 1;
OSRestoreInterrupts(oldInt);
if (task == __DSP_first_task) {
__DSP_boot_task(task);
}
u32 oldInt;
oldInt = OSDisableInterrupts();
__DSP_insert_task(task);
task->state = 0;
task->flags = 1;
OSRestoreInterrupts(oldInt);
if (task == __DSP_first_task) {
__DSP_boot_task(task);
}
return task;
return task;
}
#ifdef __cplusplus

View File

@ -1,6 +1,5 @@
#include "types.h"
void __DSP_debug_printf(const char* fmt, ...) {
//UNUSED(fmt);
// UNUSED(fmt);
}

View File

@ -111,7 +111,8 @@ static void stateReadingFST() {
OSPanic("dvd.c", 630, "DVDChangeDisk(): FST in the new disc is too big. ");
}
DVDLowRead(bootInfo->FSTLocation, OSRoundUp32B(BB2.FSTLength), BB2.FSTPosition, cbForStateReadingFST);
DVDLowRead(bootInfo->FSTLocation, OSRoundUp32B(BB2.FSTLength), BB2.FSTPosition,
cbForStateReadingFST);
}
static void cbForStateReadingFST(u32 intType) {
@ -402,9 +403,13 @@ static void stateCheckID() {
}
}
static void stateCheckID3() { DVDLowAudioBufferConfig(IDShouldBe->streaming, 10, cbForStateCheckID3); }
static void stateCheckID3() {
DVDLowAudioBufferConfig(IDShouldBe->streaming, 10, cbForStateCheckID3);
}
static void stateCheckID2a() { DVDLowAudioBufferConfig(IDShouldBe->streaming, 10, cbForStateCheckID2a); }
static void stateCheckID2a() {
DVDLowAudioBufferConfig(IDShouldBe->streaming, 10, cbForStateCheckID2a);
}
static void cbForStateCheckID2a(u32 intType) {
if (intType == 16) {
@ -422,7 +427,9 @@ static void cbForStateCheckID2a(u32 intType) {
DVDLowRequestError(cbForStateGettingError);
}
static void stateCheckID2() { DVDLowRead(&BB2, OSRoundUp32B(sizeof(BB2)), 0x420, cbForStateCheckID2); }
static void stateCheckID2() {
DVDLowRead(&BB2, OSRoundUp32B(sizeof(BB2)), 0x420, cbForStateCheckID2);
}
static void cbForStateCheckID1(u32 intType) {
if (intType == 16) {
@ -516,7 +523,9 @@ static void stateCoverClosed() {
}
}
static void stateCoverClosed_CMD(DVDCommandBlock* block) { DVDLowReadDiskID(&CurrDiskID, cbForStateCoverClosed); }
static void stateCoverClosed_CMD(DVDCommandBlock* block) {
DVDLowReadDiskID(&CurrDiskID, cbForStateCoverClosed);
}
static void cbForStateCoverClosed(u32 intType) {
if (intType == 16) {
@ -632,8 +641,8 @@ static void stateBusy(DVDCommandBlock* block) {
} else {
__DIRegs[1] = __DIRegs[1];
block->currTransferSize = MIN(block->length - block->transferredSize, 0x80000);
DVDLowRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize, block->offset + block->transferredSize,
cbForStateBusy);
DVDLowRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize,
block->offset + block->transferredSize, cbForStateBusy);
}
break;
case 2:
@ -698,7 +707,8 @@ static void stateBusy(DVDCommandBlock* block) {
static u32 ImmCommand[] = {0xffffffff, 0xffffffff, 0xffffffff};
/* Somehow this got included even though the function is stripped? O.o */
static char string_DVDChangeDiskAsyncMsg[] = "DVDChangeDiskAsync(): You can't specify NULL to company name. \n";
static char string_DVDChangeDiskAsyncMsg[] =
"DVDChangeDiskAsync(): You can't specify NULL to company name. \n";
static u32 DmaCommand[] = {0xffffffff};
inline static BOOL IsImmCommandWithResult(u32 command) {
@ -883,7 +893,8 @@ static BOOL issueCommand(s32 prio, DVDCommandBlock* block) {
BOOL level;
BOOL result;
if (autoInvalidation && (block->command == 1 || block->command == 4 || block->command == 5 || block->command == 14)) {
if (autoInvalidation &&
(block->command == 1 || block->command == 4 || block->command == 5 || block->command == 14)) {
DCInvalidateRange(block->addr, block->length);
}
@ -901,7 +912,8 @@ static BOOL issueCommand(s32 prio, DVDCommandBlock* block) {
return result;
}
BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, s32 offset, DVDCBCallback callback, s32 prio) {
BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, s32 offset,
DVDCBCallback callback, s32 prio) {
BOOL idle;
block->command = 1;
block->addr = addr;
@ -913,7 +925,8 @@ BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, s32 off
idle = issueCommand(prio, block);
return idle;
}
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, s32 offset, DVDCBCallback callback) {
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, s32 offset,
DVDCBCallback callback) {
BOOL idle;
block->command = 4;
block->addr = addr;
@ -938,7 +951,8 @@ BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCBCallback call
idle = issueCommand(2, block);
return idle;
}
BOOL DVDPrepareStreamAbsAsync(DVDCommandBlock* block, u32 length, u32 offset, DVDCBCallback callback) {
BOOL DVDPrepareStreamAbsAsync(DVDCommandBlock* block, u32 length, u32 offset,
DVDCBCallback callback) {
BOOL idle;
block->command = 6;
block->length = length;
@ -1239,7 +1253,9 @@ s32 DVDCancel(DVDCommandBlock* block) {
return 0;
}
static void cbForCancelSync(s32 result, DVDCommandBlock* block) { OSWakeupThread(&__DVDThreadQueue); }
static void cbForCancelSync(s32 result, DVDCommandBlock* block) {
OSWakeupThread(&__DVDThreadQueue);
}
inline BOOL DVDCancelAllAsync(DVDCBCallback callback) {
BOOL enabled;

View File

@ -85,10 +85,10 @@ void __OSInitAudioSystem(void) {
void __OSStopAudioSystem(void) {
u32 r28;
#define waitUntil(load, mask) \
r28 = (load); \
while (r28 & (mask)) { \
r28 = (load); \
#define waitUntil(load, mask) \
r28 = (load); \
while (r28 & (mask)) { \
r28 = (load); \
}
__DSPRegs[5] = 0x804;

View File

@ -1,69 +1,70 @@
volatile u8 DAT_800030e2 : 0x800030e2;
typedef struct Unk {
u8 pad[0x24];
u32 resetCode;
u8 pad[0x24];
u32 resetCode;
} Unk;
volatile Unk DAT_cc003000 : 0xcc003000;
typedef struct Unk2 {
u16 _0;
u16 _2;
u16 _0;
u16 _2;
} Unk2;
volatile Unk2 DAT_cc002000 : 0xcc002000;
typedef struct OSResetQueue {
OSResetFunctionInfo* first;
OSResetFunctionInfo* last;
OSResetFunctionInfo* first;
OSResetFunctionInfo* last;
} OSResetQueue;
void OSRegisterResetFunction(OSResetFunctionInfo* func) {
OSResetFunctionInfo* tmp;
OSResetFunctionInfo* iter;
OSResetFunctionInfo* tmp;
OSResetFunctionInfo* iter;
for (iter = ResetFunctionQueue.first; iter && iter->priority <= func->priority; iter = iter->next);
for (iter = ResetFunctionQueue.first; iter && iter->priority <= func->priority; iter = iter->next)
;
if (iter == NULL) {
tmp = ResetFunctionQueue.last;
if (tmp == NULL) {
ResetFunctionQueue.first = func;
} else {
tmp->next = func;
}
func->prev = tmp;
func->next = NULL;
ResetFunctionQueue.last = func;
return;
}
func->next = iter;
tmp = iter->prev;
iter->prev = func;
func->prev = tmp;
if (iter == NULL) {
tmp = ResetFunctionQueue.last;
if (tmp == NULL) {
ResetFunctionQueue.first = func;
return;
ResetFunctionQueue.first = func;
} else {
tmp->next = func;
}
tmp->next = func;
func->prev = tmp;
func->next = NULL;
ResetFunctionQueue.last = func;
return;
}
func->next = iter;
tmp = iter->prev;
iter->prev = func;
func->prev = tmp;
if (tmp == NULL) {
ResetFunctionQueue.first = func;
return;
}
tmp->next = func;
}
s32 __OSCallResetFunctions(s32 arg0) {
OSResetFunctionInfo* iter;
s32 retCode = 0;
u32 ret;
OSResetFunctionInfo* iter;
s32 retCode = 0;
u32 ret;
for (iter = ResetFunctionQueue.first; iter != NULL; iter = iter->next) {
retCode |= !iter->func(arg0);
}
retCode |= !__OSSyncSram();
if (retCode) {
return 0;
}
return 1;
for (iter = ResetFunctionQueue.first; iter != NULL; iter = iter->next) {
retCode |= !iter->func(arg0);
}
retCode |= !__OSSyncSram();
if (retCode) {
return 0;
}
return 1;
}
asm void Reset(register s32 resetCode) {
// clang-format off
nofralloc
b lbl_8038315C
lbl_80383140:
@ -102,22 +103,21 @@ lbl_803831A0:
b lbl_803831A0
lbl_803831A8:
b lbl_80383140
// clang-format on
}
void __OSDoHotReset(s32 arg0) {
OSDisableInterrupts();
DAT_cc002000._2 = 0;
ICFlashInvalidate();
Reset(arg0 * 8);
OSDisableInterrupts();
DAT_cc002000._2 = 0;
ICFlashInvalidate();
Reset(arg0 * 8);
}
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu) {
}
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu) {}
u32 OSGetResetCode(void) {
if (DAT_800030e2 != 0) {
return 0x80000000;
}
return ((DAT_cc003000.resetCode & ~7) >> 3);
if (DAT_800030e2 != 0) {
return 0x80000000;
}
return ((DAT_cc003000.resetCode & ~7) >> 3);
}

View File

@ -7,8 +7,8 @@ void __check_pad3(void) {
return;
}
__declspec (weak) asm void __start(void) {
// clang-format off
__declspec(weak) asm void __start(void) {
// clang-format off
nofralloc
bl __init_registers
bl __init_hardware
@ -108,11 +108,11 @@ _goto_skip_init_bba:
mr r4, r15
bl main
b exit
// clang-format on
// clang-format on
}
asm static void __init_registers(void) {
// clang-format off
// clang-format off
nofralloc
lis r1, _stack_addr@h
ori r1, r1, _stack_addr@l
@ -121,14 +121,13 @@ asm static void __init_registers(void) {
lis r13, _SDA_BASE_@h
ori r13, r13, _SDA_BASE_@l
blr
// clang-format on
// clang-format on
}
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[];
__declspec(section ".init") extern __bss_init_info _bss_init_info[];
inline static void __copy_rom_section(void* dst, const void* src,
unsigned long size) {
inline static void __copy_rom_section(void* dst, const void* src, unsigned long size) {
if (size && (dst != src)) {
memcpy(dst, src, size);
__flush_cache(dst, size);

Some files were not shown because too many files have changed in this diff Show More