mirror of https://github.com/PrimeDecomp/prime.git
clang-format pass
This commit is contained in:
parent
135d63412c
commit
6a979e343f
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
#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;
|
||||
|
||||
private:
|
||||
u8 x0_owned;
|
||||
void* x4_ptr;
|
||||
|
|
|
@ -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; };
|
||||
|
||||
|
|
|
@ -10,10 +10,15 @@ public:
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -27,11 +27,8 @@ struct g72x_state {
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef __CLIGHT_HPP__
|
||||
#define __CLIGHT_HPP__
|
||||
|
||||
|
||||
class CLight {
|
||||
};
|
||||
class CLight {};
|
||||
|
||||
#endif // __CLIGHT_HPP__
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
#include <types.h>
|
||||
|
||||
#include "Kyoto/Input/InputTypes.hpp"
|
||||
#include "Kyoto/Input/CControllerGamepadData.hpp"
|
||||
|
||||
#include "Kyoto/Input/InputTypes.hpp"
|
||||
|
||||
class COsContext;
|
||||
class IController {
|
||||
|
@ -18,7 +17,7 @@ protected:
|
|||
public:
|
||||
IController();
|
||||
virtual ~IController();
|
||||
virtual void Poll()=0;
|
||||
virtual void Poll() = 0;
|
||||
virtual uint GetDeviceCount() const = 0;
|
||||
virtual CControllerGamepadData& GetGamepadData(int controller) = 0;
|
||||
virtual uint GetControllerType(int) const = 0;
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -10,7 +10,7 @@ public:
|
|||
f32 GetX() const { return mX; }
|
||||
f32 GetY() const { return mY; }
|
||||
|
||||
// private:
|
||||
// private:
|
||||
f32 mX;
|
||||
f32 mY;
|
||||
};
|
||||
|
|
|
@ -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 >());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -10,5 +10,4 @@ void EnableMetroTRKInterrupts(void);
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* #ifndef __TRKINIT_H__ */
|
||||
|
|
|
@ -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(); }
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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; }
|
||||
};
|
||||
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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]; }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
|
||||
class IWeaponRenderer {
|
||||
public:
|
||||
virtual ~IWeaponRenderer()=0;
|
||||
virtual ~IWeaponRenderer() = 0;
|
||||
virtual void AddParticleGen(const CParticleGen& gen) = 0;
|
||||
static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; }
|
||||
|
||||
private:
|
||||
static IWeaponRenderer* sWeaponRenderer;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 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)))))
|
||||
((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)))))
|
||||
((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
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*DSPCallback)(void *task);
|
||||
typedef void (*DSPCallback)(void* task);
|
||||
|
||||
typedef struct DSPTaskInfo DSPTaskInfo;
|
||||
|
||||
|
@ -16,11 +16,11 @@ typedef struct DSPTaskInfo {
|
|||
vu32 state;
|
||||
vu32 priority;
|
||||
vu32 flags;
|
||||
u16 *iram_mmem_addr;
|
||||
u16* iram_mmem_addr;
|
||||
u32 iram_length;
|
||||
u32 iram_addr;
|
||||
|
||||
u16 *dram_mmem_addr;
|
||||
u16* dram_mmem_addr;
|
||||
u32 dram_length;
|
||||
u32 dram_addr;
|
||||
|
||||
|
@ -32,8 +32,8 @@ typedef struct DSPTaskInfo {
|
|||
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;
|
||||
|
@ -50,12 +50,10 @@ u32 DSPGetDMAStatus();
|
|||
|
||||
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task);
|
||||
|
||||
|
||||
void __DSP_debug_printf(const char* fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // __DSP_H__
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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" {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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" {
|
||||
|
|
|
@ -31,10 +31,8 @@ typedef struct OSContext {
|
|||
|
||||
} OSContext;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef BOOL (* OSResetFunction )(BOOL final);
|
||||
typedef BOOL (*OSResetFunction)(BOOL final);
|
||||
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
|
||||
|
||||
struct OSResetFunctionInfo
|
||||
{
|
||||
struct OSResetFunctionInfo {
|
||||
// public
|
||||
OSResetFunction func;
|
||||
u32 priority;
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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" {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -16,4 +16,3 @@ u16 seqGetMIDIPriority(s32 unk1, s32 unk2);
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef struct SynthVoice {
|
|||
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__
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _STDIO_H_
|
||||
#define _STDIO_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ s32 CARDGetSerialNo(s32 chan, u64* serialNo) {
|
|||
u64 code;
|
||||
s32 result;
|
||||
|
||||
|
||||
if (!(0 <= chan && chan < 2)) {
|
||||
return CARD_RESULT_FATAL_ERROR;
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,14 +19,9 @@ 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;
|
||||
|
@ -85,9 +81,7 @@ void DSPHalt(void) {
|
|||
OSRestoreInterrupts(oldInt);
|
||||
}
|
||||
|
||||
u32 DSPGetDMAStatus(void) {
|
||||
return __DSPRegs[5] & 0x200;
|
||||
}
|
||||
u32 DSPGetDMAStatus(void) { return __DSPRegs[5] & 0x200; }
|
||||
|
||||
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) {
|
||||
u32 oldInt;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "types.h"
|
||||
|
||||
|
||||
void __DSP_debug_printf(const char* fmt, ...) {
|
||||
//UNUSED(fmt);
|
||||
// UNUSED(fmt);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -17,12 +17,12 @@ typedef struct OSResetQueue {
|
|||
OSResetFunctionInfo* last;
|
||||
} OSResetQueue;
|
||||
|
||||
|
||||
void OSRegisterResetFunction(OSResetFunctionInfo* func) {
|
||||
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;
|
||||
|
@ -64,6 +64,7 @@ s32 __OSCallResetFunctions(s32 arg0) {
|
|||
}
|
||||
|
||||
asm void Reset(register s32 resetCode) {
|
||||
// clang-format off
|
||||
nofralloc
|
||||
b lbl_8038315C
|
||||
lbl_80383140:
|
||||
|
@ -102,6 +103,7 @@ lbl_803831A0:
|
|||
b lbl_803831A0
|
||||
lbl_803831A8:
|
||||
b lbl_80383140
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void __OSDoHotReset(s32 arg0) {
|
||||
|
@ -111,9 +113,7 @@ void __OSDoHotReset(s32 arg0) {
|
|||
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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -19,17 +19,17 @@ void* CSmallAllocPool::FindFree(int len) {
|
|||
if (xc_cachedBookKeepingOffset == nullptr) {
|
||||
xc_cachedBookKeepingOffset = x4_bookKeeping;
|
||||
}
|
||||
u8* curKeepingOffset = static_cast<u8*>(xc_cachedBookKeepingOffset);
|
||||
bookKeepingPtr = static_cast<u8*>(x4_bookKeeping);
|
||||
u8* curKeepingOffset = static_cast< u8* >(xc_cachedBookKeepingOffset);
|
||||
bookKeepingPtr = static_cast< u8* >(x4_bookKeeping);
|
||||
u8* bookKeepingEndPtr = bookKeepingPtr + ((u32)x8_numBlocks >> 1);
|
||||
u8* curKeepingIter = curKeepingOffset;
|
||||
while(true) {
|
||||
while (true) {
|
||||
u8* iter;
|
||||
if (static_cast<u8*>(curKeepingIter)[0] != 0 || curKeepingIter == bookKeepingEndPtr) {
|
||||
if (static_cast< u8* >(curKeepingIter)[0] != 0 || curKeepingIter == bookKeepingEndPtr) {
|
||||
if (curKeepingIter == bookKeepingEndPtr) {
|
||||
curKeepingIter = bookKeepingPtr;
|
||||
} else {
|
||||
s32 tmp = static_cast<u8*>(curKeepingIter)[0];
|
||||
s32 tmp = static_cast< u8* >(curKeepingIter)[0];
|
||||
s32 reg = tmp >> 4;
|
||||
curKeepingIter += (reg / 2);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void* CSmallAllocPool::FindFree(int len) {
|
|||
u8* tempIter = curKeepingIter + size;
|
||||
iter = curKeepingIter + 1;
|
||||
while (iter != curKeepingOffset && iter != bookKeepingEndPtr && iter != tempIter) {
|
||||
if (static_cast<u8*>(iter)[0] == 0) {
|
||||
if (static_cast< u8* >(iter)[0] == 0) {
|
||||
iter++;
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
|
||||
#include "Kyoto/Basics/COsContext.hpp"
|
||||
|
||||
IAllocator::SMetrics::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)
|
||||
IAllocator::SMetrics::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)
|
||||
: x0_heapSize(heapSize)
|
||||
, x4_(unk1)
|
||||
, x8_(unk2)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <Kyoto/Audio/CSfxHandle.hpp>
|
||||
|
||||
uint CSfxHandle::mRefCount = 0;
|
||||
CSfxHandle::CSfxHandle(uint value) : mID((++mRefCount << 14) | (value & 0xFFF)) {
|
||||
}
|
||||
CSfxHandle::CSfxHandle(uint value) : mID((++mRefCount << 14) | (value & 0xFFF)) {}
|
||||
|
|
|
@ -16,6 +16,6 @@ void CStopwatch::CSWData::Wait(f32 v) const {
|
|||
bool CStopwatch::CSWData::Initialize() {
|
||||
x0_timerFreq = OS_TIMER_CLOCK;
|
||||
x8_timerFreqO1M = x0_timerFreq / 1000000ll;
|
||||
x10_timerPeriod = 1.f / static_cast<f32>(x0_timerFreq);
|
||||
x10_timerPeriod = 1.f / static_cast< f32 >(x0_timerFreq);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,42 +1,46 @@
|
|||
#include "Kyoto/CCrc32.hpp"
|
||||
|
||||
static const uint gkCRC32Table[256] = {
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832,
|
||||
0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
|
||||
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A,
|
||||
0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,
|
||||
0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
|
||||
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB,
|
||||
0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4,
|
||||
0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
|
||||
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074,
|
||||
0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525,
|
||||
0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
|
||||
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,
|
||||
0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76,
|
||||
0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
|
||||
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6,
|
||||
0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7,
|
||||
0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
|
||||
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7,
|
||||
0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,
|
||||
0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
|
||||
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330,
|
||||
0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
||||
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
|
||||
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
|
||||
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
|
||||
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
|
||||
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
|
||||
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
|
||||
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
|
||||
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
|
||||
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
|
||||
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
|
||||
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
|
||||
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
|
||||
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
|
||||
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
|
||||
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
|
||||
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
|
||||
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
|
||||
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
|
||||
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
|
||||
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
|
||||
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
|
||||
};
|
||||
|
||||
uint CCRC32::Calculate(const void* data, uint length) {
|
||||
uint checksum = 0xFFFFFFFF;
|
||||
const s8* buf = static_cast<const s8*>(data);
|
||||
const s8* buf = static_cast< const s8* >(data);
|
||||
while ((length--) > 0) {
|
||||
checksum = (checksum >> 8) ^ gkCRC32Table[(checksum ^ *(buf++)) & 0xFF];
|
||||
}
|
||||
return checksum;;
|
||||
return checksum;
|
||||
;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include <Kyoto/CTimeProvider.hpp>
|
||||
#include <Kyoto/Alloc/CMemory.hpp>
|
||||
#include <Kyoto/CTimeProvider.hpp>
|
||||
#include <Kyoto/Graphics/CGraphics.hpp>
|
||||
|
||||
CTimeProvider* CTimeProvider::gCurrentTimeProvider = nullptr;
|
||||
|
||||
CTimeProvider::CTimeProvider(const float& time) : x0_currentTime(time), x4_first(true), x8_lastProvider(gCurrentTimeProvider) {
|
||||
CTimeProvider::CTimeProvider(const float& time)
|
||||
: x0_currentTime(time), x4_first(true), x8_lastProvider(gCurrentTimeProvider) {
|
||||
if (x8_lastProvider != nullptr) {
|
||||
x8_lastProvider->x4_first = false;
|
||||
}
|
||||
|
|
|
@ -7,25 +7,30 @@
|
|||
#include <dolphin/mtx.h>
|
||||
|
||||
inline void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) {
|
||||
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | MaskAndShiftLeft(op, 7, 11) |
|
||||
MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17);
|
||||
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) |
|
||||
MaskAndShiftLeft(op, 7, 11) | MaskAndShiftLeft(comp1, 7, 14) |
|
||||
MaskAndShiftLeft(ref1, 0xFF, 17);
|
||||
if (sGXState.x248_alphaCompare != flags) {
|
||||
sGXState.x248_alphaCompare = flags;
|
||||
GXSetAlphaCompare(comp0, ref0, op, comp1, ref1);
|
||||
GXSetZCompLoc(comp0 == GX_ALWAYS);
|
||||
}
|
||||
}
|
||||
inline void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op) {
|
||||
uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8);
|
||||
inline void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac,
|
||||
GXLogicOp op) {
|
||||
uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) |
|
||||
MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8);
|
||||
if (flags != sGXState.x56_blendMode) {
|
||||
update_fog(flags);
|
||||
sGXState.x56_blendMode = flags;
|
||||
GXSetBlendMode(mode, srcFac, dstFac, op);
|
||||
}
|
||||
}
|
||||
inline void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color) {
|
||||
inline void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap,
|
||||
GXChannelID color) {
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
uint flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) | MaskAndShiftLeft(color, 0xFF, 16);
|
||||
uint flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) |
|
||||
MaskAndShiftLeft(color, 0xFF, 16);
|
||||
if (state.x14_tevOrderFlags != flags) {
|
||||
state.x14_tevOrderFlags = flags;
|
||||
GXSetTevOrder(stageId, texCoord, texMap, color);
|
||||
|
@ -73,7 +78,8 @@ void CCubeMaterial::SetupBlendMode(uint blendFactors, const CModelFlags& flags,
|
|||
CGX::SetBlendMode(GX_BM_BLEND, newSrcFactor, newDstFactor, GX_LO_CLEAR);
|
||||
}
|
||||
|
||||
void HandleTev(int tevCur, const uint* materialDataCur, const uint* texMapTexCoordFlags, bool shadowMapsEnabled) {
|
||||
void HandleTev(int tevCur, const uint* materialDataCur, const uint* texMapTexCoordFlags,
|
||||
bool shadowMapsEnabled) {
|
||||
const GXTevStageID stage = static_cast< GXTevStageID >(tevCur);
|
||||
const uint colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]);
|
||||
const uint alphaArgs = SBig(materialDataCur[1]);
|
||||
|
@ -84,7 +90,8 @@ void HandleTev(int tevCur, const uint* materialDataCur, const uint* texMapTexCoo
|
|||
|
||||
uint tmtcFlags = SBig(*texMapTexCoordFlags);
|
||||
uint matFlags = SBig(materialDataCur[4]);
|
||||
CGX::SetTevOrder(stage, static_cast< GXTexCoordID >(tmtcFlags & 0xFF), static_cast< GXTexMapID >(tmtcFlags >> 8 & 0xFF),
|
||||
CGX::SetTevOrder(stage, static_cast< GXTexCoordID >(tmtcFlags & 0xFF),
|
||||
static_cast< GXTexMapID >(tmtcFlags >> 8 & 0xFF),
|
||||
static_cast< GXChannelID >(matFlags & 0xFF));
|
||||
CGX::SetTevKColorSel(stage, static_cast< GXTevKColorSel >(matFlags >> 0x8 & 0xFF));
|
||||
CGX::SetTevKAlphaSel(stage, static_cast< GXTevKAlphaSel >(matFlags >> 0x10 & 0xFF));
|
||||
|
@ -105,7 +112,8 @@ uint HandleAnimatedUV(const uint* uvAnim, GXTexMtx texMtx, GXPTTexMtx ptTexMtx)
|
|||
const f32* params = reinterpret_cast< const f32* >(uvAnim + 1);
|
||||
switch (type) {
|
||||
case 0: {
|
||||
CTransform4f xf = CGraphics::GetViewMatrix().GetQuickInverse().MultiplyIgnoreTranslation(CGraphics::GetModelMatrix());
|
||||
CTransform4f xf = CGraphics::GetViewMatrix().GetQuickInverse().MultiplyIgnoreTranslation(
|
||||
CGraphics::GetModelMatrix());
|
||||
xf.SetTranslation(CVector3f::Zero());
|
||||
CGX::LoadTexMtxImm(xf.GetCStyleMatrix(), texMtx, GX_MTX3x4);
|
||||
CGX::LoadTexMtxImm(postMtx, ptTexMtx, GX_MTX3x4);
|
||||
|
@ -202,7 +210,8 @@ uint HandleAnimatedUV(const uint* uvAnim, GXTexMtx texMtx, GXPTTexMtx ptTexMtx)
|
|||
{0.f, 0.f, 0.f, 1.f},
|
||||
};
|
||||
const CTransform4f& vm = CGraphics::GetViewMatrix();
|
||||
CTransform4f xf = CGraphics::GetViewMatrix().GetQuickInverse().MultiplyIgnoreTranslation(CGraphics::GetModelMatrix());
|
||||
CTransform4f xf = CGraphics::GetViewMatrix().GetQuickInverse().MultiplyIgnoreTranslation(
|
||||
CGraphics::GetModelMatrix());
|
||||
f32 v = SBig(params[0]) / 2.f;
|
||||
f32 v03 = 0.025f * (vm.Get03() + vm.Get13()) * SBig(params[1]);
|
||||
f32 v13 = 0.05f * vm.Get23() * SBig(params[1]);
|
||||
|
|
|
@ -41,17 +41,19 @@ void CGX::SetChanMatColor(EChannelId channel, const GXColor& color) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc, GXLightID lights, GXDiffuseFn diffFn,
|
||||
GXAttnFn attnFn) {
|
||||
void CGX::SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc,
|
||||
GXLightID lights, GXDiffuseFn diffFn, GXAttnFn attnFn) {
|
||||
u16& state = sGXState.x34_chanCtrls[channel];
|
||||
u16 prevFlags = sGXState.x30_prevChanCtrls[channel];
|
||||
if (lights == GX_LIGHT_NULL) {
|
||||
enable = GX_FALSE;
|
||||
}
|
||||
uint flags = MaskAndShiftLeft(enable, 1, 0) | MaskAndShiftLeft(ambSrc, 1, 1) | MaskAndShiftLeft(matSrc, 1, 2) |
|
||||
MaskAndShiftLeft(lights, 0xFF, 3) | MaskAndShiftLeft(diffFn, 3, 11) | MaskAndShiftLeft(attnFn, 3, 13);
|
||||
uint flags = MaskAndShiftLeft(enable, 1, 0) | MaskAndShiftLeft(ambSrc, 1, 1) |
|
||||
MaskAndShiftLeft(matSrc, 1, 2) | MaskAndShiftLeft(lights, 0xFF, 3) |
|
||||
MaskAndShiftLeft(diffFn, 3, 11) | MaskAndShiftLeft(attnFn, 3, 13);
|
||||
state = flags;
|
||||
sGXState.x4c_chanFlags = ((flags != prevFlags) << (channel + 1)) | (sGXState.x4c_chanFlags & ~(1 << (channel + 1)));
|
||||
sGXState.x4c_chanFlags =
|
||||
((flags != prevFlags) << (channel + 1)) | (sGXState.x4c_chanFlags & ~(1 << (channel + 1)));
|
||||
}
|
||||
|
||||
void CGX::SetNumTevStages(u8 num) {
|
||||
|
@ -68,8 +70,10 @@ void CGX::SetTevKColor(GXTevKColorID id, const GXColor& color) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d) {
|
||||
uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15);
|
||||
void CGX::SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
|
||||
GXTevColorArg d) {
|
||||
uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) |
|
||||
MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15);
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
if (flags != state.x0_colorInArgs) {
|
||||
state.x0_colorInArgs = flags;
|
||||
|
@ -77,8 +81,10 @@ void CGX::SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b,
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d) {
|
||||
uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15);
|
||||
void CGX::SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c,
|
||||
GXTevAlphaArg d) {
|
||||
uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) |
|
||||
MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15);
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
if (flags != state.x4_alphaInArgs) {
|
||||
state.x4_alphaInArgs = flags;
|
||||
|
@ -86,8 +92,10 @@ void CGX::SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b,
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg) {
|
||||
uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) |
|
||||
void CGX::SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale,
|
||||
GXBool clamp, GXTevRegID outReg) {
|
||||
uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) |
|
||||
MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) |
|
||||
MaskAndShiftLeft(outReg, 3, 9);
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
if (flags != state.x8_colorOps) {
|
||||
|
@ -101,13 +109,17 @@ void CGX::SetTevColorOp_Compressed(GXTevStageID stageId, uint flags) {
|
|||
if (flags != state.x8_colorOps) {
|
||||
state.x8_colorOps = flags;
|
||||
GXSetTevColorOp(stageId, static_cast< GXTevOp >(ShiftRightAndMask(flags, 0xF, 0)),
|
||||
static_cast< GXTevBias >(ShiftRightAndMask(flags, 3, 4)), static_cast< GXTevScale >(ShiftRightAndMask(flags, 3, 6)),
|
||||
static_cast< GXBool >(ShiftRightAndMask(flags, 1, 8)), static_cast< GXTevRegID >(ShiftRightAndMask(flags, 3, 9)));
|
||||
static_cast< GXTevBias >(ShiftRightAndMask(flags, 3, 4)),
|
||||
static_cast< GXTevScale >(ShiftRightAndMask(flags, 3, 6)),
|
||||
static_cast< GXBool >(ShiftRightAndMask(flags, 1, 8)),
|
||||
static_cast< GXTevRegID >(ShiftRightAndMask(flags, 3, 9)));
|
||||
}
|
||||
}
|
||||
|
||||
void CGX::SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg) {
|
||||
uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) |
|
||||
void CGX::SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale,
|
||||
GXBool clamp, GXTevRegID outReg) {
|
||||
uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) |
|
||||
MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) |
|
||||
MaskAndShiftLeft(outReg, 3, 9);
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
if (flags != state.xc_alphaOps) {
|
||||
|
@ -121,8 +133,10 @@ void CGX::SetTevAlphaOp_Compressed(GXTevStageID stageId, uint flags) {
|
|||
if (flags != state.xc_alphaOps) {
|
||||
state.xc_alphaOps = flags;
|
||||
GXSetTevAlphaOp(stageId, static_cast< GXTevOp >(ShiftRightAndMask(flags, 0xF, 0)),
|
||||
static_cast< GXTevBias >(ShiftRightAndMask(flags, 3, 4)), static_cast< GXTevScale >(ShiftRightAndMask(flags, 3, 6)),
|
||||
static_cast< GXBool >(ShiftRightAndMask(flags, 1, 8)), static_cast< GXTevRegID >(ShiftRightAndMask(flags, 3, 9)));
|
||||
static_cast< GXTevBias >(ShiftRightAndMask(flags, 3, 4)),
|
||||
static_cast< GXTevScale >(ShiftRightAndMask(flags, 3, 6)),
|
||||
static_cast< GXBool >(ShiftRightAndMask(flags, 1, 8)),
|
||||
static_cast< GXTevRegID >(ShiftRightAndMask(flags, 3, 9)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,9 +156,11 @@ void CGX::SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color) {
|
||||
void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap,
|
||||
GXChannelID color) {
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
uint flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) | MaskAndShiftLeft(color, 0xFF, 16);
|
||||
uint flags = MaskAndShiftLeft(texCoord, 0xFF, 0) | MaskAndShiftLeft(texMap, 0xFF, 8) |
|
||||
MaskAndShiftLeft(color, 0xFF, 16);
|
||||
if (state.x14_tevOrderFlags != flags) {
|
||||
state.x14_tevOrderFlags = flags;
|
||||
GXSetTevOrder(stageId, texCoord, texMap, color);
|
||||
|
@ -152,7 +168,8 @@ void CGX::SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID te
|
|||
}
|
||||
|
||||
void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op) {
|
||||
uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8);
|
||||
uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) |
|
||||
MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8);
|
||||
if (flags != sGXState.x56_blendMode) {
|
||||
update_fog(flags);
|
||||
sGXState.x56_blendMode = flags;
|
||||
|
@ -170,8 +187,9 @@ void CGX::SetZMode(bool compareEnable, GXCompare func, bool updateEnable) {
|
|||
}
|
||||
|
||||
void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) {
|
||||
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) | MaskAndShiftLeft(op, 7, 11) |
|
||||
MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17);
|
||||
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) |
|
||||
MaskAndShiftLeft(op, 7, 11) | MaskAndShiftLeft(comp1, 7, 14) |
|
||||
MaskAndShiftLeft(ref1, 0xFF, 17);
|
||||
if (sGXState.x248_alphaCompare != flags) {
|
||||
sGXState.x248_alphaCompare = flags;
|
||||
GXSetAlphaCompare(comp0, ref0, op, comp1, ref1);
|
||||
|
@ -179,15 +197,20 @@ void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt, GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel,
|
||||
GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod, GXIndTexAlphaSel alphaSel) {
|
||||
void CGX::SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt,
|
||||
GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS,
|
||||
GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod,
|
||||
GXIndTexAlphaSel alphaSel) {
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
uint flags = MaskAndShiftLeft(indStage, 3, 0) | MaskAndShiftLeft(fmt, 3, 2) | MaskAndShiftLeft(biasSel, 7, 4) |
|
||||
MaskAndShiftLeft(mtxSel, 15, 7) | MaskAndShiftLeft(wrapS, 7, 11) | MaskAndShiftLeft(wrapT, 7, 14) |
|
||||
MaskAndShiftLeft(addPrev, 1, 17) | MaskAndShiftLeft(indLod, 1, 18) | MaskAndShiftLeft(alphaSel, 3, 19);
|
||||
uint flags = MaskAndShiftLeft(indStage, 3, 0) | MaskAndShiftLeft(fmt, 3, 2) |
|
||||
MaskAndShiftLeft(biasSel, 7, 4) | MaskAndShiftLeft(mtxSel, 15, 7) |
|
||||
MaskAndShiftLeft(wrapS, 7, 11) | MaskAndShiftLeft(wrapT, 7, 14) |
|
||||
MaskAndShiftLeft(addPrev, 1, 17) | MaskAndShiftLeft(indLod, 1, 18) |
|
||||
MaskAndShiftLeft(alphaSel, 3, 19);
|
||||
if (state.x10_indFlags != flags) {
|
||||
state.x10_indFlags = flags;
|
||||
GXSetTevIndirect(stageId, indStage, fmt, biasSel, mtxSel, wrapS, wrapT, addPrev, indLod, alphaSel);
|
||||
GXSetTevIndirect(stageId, indStage, fmt, biasSel, mtxSel, wrapS, wrapT, addPrev, indLod,
|
||||
alphaSel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +222,8 @@ void CGX::SetTevDirect(GXTevStageID stageId) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx, GXBool normalize, GXPTTexMtx postMtx) {
|
||||
void CGX::SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx,
|
||||
GXBool normalize, GXPTTexMtx postMtx) {
|
||||
STexState& state = sGXState.x228_texStates[dstCoord];
|
||||
uint vm = (mtx - GX_TEXMTX0) / 3;
|
||||
uint vp = postMtx - GX_PTTEXMTX0;
|
||||
|
@ -207,8 +231,9 @@ void CGX::SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src
|
|||
// Similarly to GXTexMtx, this should also be divided by 3
|
||||
vp /= 3;
|
||||
#endif
|
||||
uint flags = MaskAndShiftLeft(fn, 0xF, 0) | MaskAndShiftLeft(src, 0x1F, 4) | MaskAndShiftLeft(vm, 0x1F, 9) |
|
||||
MaskAndShiftLeft(normalize, 1, 14) | MaskAndShiftLeft(vp, 0x3F, 15);
|
||||
uint flags = MaskAndShiftLeft(fn, 0xF, 0) | MaskAndShiftLeft(src, 0x1F, 4) |
|
||||
MaskAndShiftLeft(vm, 0x1F, 9) | MaskAndShiftLeft(normalize, 1, 14) |
|
||||
MaskAndShiftLeft(vp, 0x3F, 15);
|
||||
if (state.x0_coordGen != flags) {
|
||||
state.x0_coordGen = flags;
|
||||
GXSetTexCoordGen2(dstCoord, fn, src, mtx, normalize, postMtx);
|
||||
|
@ -423,7 +448,8 @@ void CGX::SetVtxDescv(const GXVtxDescList* list) {
|
|||
SetVtxDescv_Compressed(flags);
|
||||
}
|
||||
|
||||
void CGX::SetStandardDirectTev_Compressed(GXTevStageID stageId, uint colorArgs, uint alphaArgs, uint colorOps, uint alphaOps) {
|
||||
void CGX::SetStandardDirectTev_Compressed(GXTevStageID stageId, uint colorArgs, uint alphaArgs,
|
||||
uint colorOps, uint alphaOps) {
|
||||
STevState& state = sGXState.x68_tevStates[stageId];
|
||||
if (state.x10_indFlags != 0) {
|
||||
state.x10_indFlags = 0;
|
||||
|
@ -466,7 +492,8 @@ void CGX::SetStandardTevColorAlphaOp(GXTevStageID stageId) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGX::GetFog(GXFogType* fogType, f32* fogStartZ, f32* fogEndZ, f32* fogNearZ, f32* fogFarZ, GXColor* fogColor) {
|
||||
void CGX::GetFog(GXFogType* fogType, f32* fogStartZ, f32* fogEndZ, f32* fogNearZ, f32* fogFarZ,
|
||||
GXColor* fogColor) {
|
||||
if (fogType != nullptr) {
|
||||
*fogType = static_cast< GXFogType >(sGXState.x53_fogType);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue