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)
|
CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, EFilterType type)
|
||||||
: include(include), exclude(exclude), type(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);
|
return CMaterialFilter(include, exclude, kFT_IncludeExclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
#ifndef __CCIRCULARBUFFER_HPP__
|
#ifndef __CCIRCULARBUFFER_HPP__
|
||||||
#define __CCIRCULARBUFFER_HPP__
|
#define __CCIRCULARBUFFER_HPP__
|
||||||
|
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
class CCircularBuffer {
|
class CCircularBuffer {
|
||||||
public:
|
public:
|
||||||
enum EOwnership {
|
enum EOwnership { kOS_Owned, kOS_NotOwned };
|
||||||
kOS_Owned,
|
|
||||||
kOS_NotOwned
|
|
||||||
};
|
|
||||||
|
|
||||||
CCircularBuffer(void* buf, int len, EOwnership owned = kOS_NotOwned);
|
CCircularBuffer(void* buf, int len, EOwnership owned = kOS_NotOwned);
|
||||||
bool IsWrappedMemory(int offset, int len);
|
bool IsWrappedMemory(int offset, int len);
|
||||||
void* Alloc(int len);
|
void* Alloc(int len);
|
||||||
void Free(void* ptr, int len);
|
void Free(void* ptr, int len);
|
||||||
int GetAllocatedAmount() const;
|
int GetAllocatedAmount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u8 x0_owned;
|
u8 x0_owned;
|
||||||
void* x4_ptr;
|
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*);
|
||||||
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) {
|
inline void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); }
|
||||||
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
|
// placement new
|
||||||
inline void* operator new(unsigned long n, void* ptr) { return ptr; };
|
inline void* operator new(unsigned long n, void* ptr) { return ptr; };
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,15 @@ public:
|
||||||
void* FindFree(int len);
|
void* FindFree(int len);
|
||||||
void* Alloc(uint size);
|
void* Alloc(uint size);
|
||||||
bool Free(const void* ptr);
|
bool Free(const void* ptr);
|
||||||
|
|
||||||
private:
|
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); }
|
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* x0_mainData;
|
||||||
void* x4_bookKeeping;
|
void* x4_bookKeeping;
|
||||||
int x8_numBlocks;
|
int x8_numBlocks;
|
||||||
|
|
|
@ -41,10 +41,11 @@ public:
|
||||||
uint x4c_;
|
uint x4c_;
|
||||||
uint x50_mediumTotalAllocated;
|
uint x50_mediumTotalAllocated;
|
||||||
uint x54_fakeStatics;
|
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,
|
SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4, uint heapSize2, uint unk5,
|
||||||
uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize, uint mediumAllocNumAllocs,
|
uint unk6, uint unk7, uint unk8, uint unk9, uint smallAllocNumAllocs,
|
||||||
uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11, uint unk12, uint mediumAllocTotalAllocated,
|
uint smallAllocAllocatedSize, uint smallAllocRemainingSize, uint mediumAllocNumAllocs,
|
||||||
uint fakeStatics);
|
uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11,
|
||||||
|
uint unk12, uint mediumAllocTotalAllocated, uint fakeStatics);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SAllocInfo {
|
struct SAllocInfo {
|
||||||
|
@ -62,10 +63,12 @@ public:
|
||||||
|
|
||||||
virtual bool Initialize(COsContext& ctx) = 0;
|
virtual bool Initialize(COsContext& ctx) = 0;
|
||||||
virtual void Shutdown() = 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 Free(const void* ptr) = 0;
|
||||||
virtual void ReleaseAll() = 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 FreeSecondary(const void* ptr) = 0;
|
||||||
virtual void ReleaseAllSecondary() = 0;
|
virtual void ReleaseAllSecondary() = 0;
|
||||||
virtual void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* data) = 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 */
|
char td; /* delayed tone detect, new in 1988 version */
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void g72x_init_state(struct g72x_state* state_ptr);
|
||||||
g72x_init_state(struct g72x_state *state_ptr);
|
|
||||||
|
|
||||||
int
|
int g721_decoder(int i, struct g72x_state* state_ptr);
|
||||||
g721_decoder(int i,
|
|
||||||
struct g72x_state *state_ptr);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,15 +37,9 @@ inline s16 FtoS(register f32 in) {
|
||||||
return *ptr;
|
return *ptr;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline u8 ToUint8(f32 in) {
|
inline u8 ToUint8(f32 in) { return static_cast< u8 >(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 f32 ToReal32(u8 in) {
|
|
||||||
return static_cast<f32>(in);
|
|
||||||
}
|
|
||||||
inline s16 FtoS(f32 in) {
|
|
||||||
return static_cast<s16>(in);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
} // namespace CCast
|
} // namespace CCast
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,12 @@ public:
|
||||||
}
|
}
|
||||||
x0_startTime = mData.GetCPUCycles();
|
x0_startTime = mData.GetCPUCycles();
|
||||||
}
|
}
|
||||||
inline f32 GetElapsedTime() const { return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod(); }
|
inline f32 GetElapsedTime() const {
|
||||||
inline s64 GetElapsedMicros() const { return (mData.GetCPUCycles() - x0_startTime) / mData.GetTimerFreqO1M(); }
|
return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod();
|
||||||
|
}
|
||||||
|
inline s64 GetElapsedMicros() const {
|
||||||
|
return (mData.GetCPUCycles() - x0_startTime) / mData.GetTimerFreqO1M();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static CSWData mData;
|
static CSWData mData;
|
||||||
|
|
|
@ -7,9 +7,7 @@ class CARAMManager {
|
||||||
public:
|
public:
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
static void CollectGarbage();
|
static void CollectGarbage();
|
||||||
static void PreInitializeAlloc(uint size) {
|
static void PreInitializeAlloc(uint size) { mPreInitializeAlloc += size; }
|
||||||
mPreInitializeAlloc += size;
|
|
||||||
}
|
|
||||||
static void Initialize(uint);
|
static void Initialize(uint);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#include "Kyoto/TToken.hpp"
|
|
||||||
#include "Kyoto/IObjectStore.hpp"
|
#include "Kyoto/IObjectStore.hpp"
|
||||||
#include "Kyoto/Streams/CInputStream.hpp"
|
#include "Kyoto/Streams/CInputStream.hpp"
|
||||||
|
#include "Kyoto/TToken.hpp"
|
||||||
|
|
||||||
class CFactoryMgr {
|
class CFactoryMgr {
|
||||||
public:
|
public:
|
||||||
|
@ -24,6 +24,7 @@ private:
|
||||||
rstl::auto_ptr< CObjOwnerDerivedFromIObjUntyped > obj;
|
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
|
#endif
|
||||||
|
|
|
@ -12,7 +12,8 @@ class IFactory {
|
||||||
public:
|
public:
|
||||||
virtual ~IFactory() {}
|
virtual ~IFactory() {}
|
||||||
virtual CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference*) = 0;
|
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 void CancelBuild(const SObjectTag&) = 0;
|
||||||
virtual bool CanBuild(const SObjectTag&) = 0;
|
virtual bool CanBuild(const SObjectTag&) = 0;
|
||||||
virtual const SObjectTag* GetResourceIdByName(const char* name) const = 0;
|
virtual const SObjectTag* GetResourceIdByName(const char* name) const = 0;
|
||||||
|
|
|
@ -10,6 +10,7 @@ public:
|
||||||
CTimeProvider(const float& time);
|
CTimeProvider(const float& time);
|
||||||
~CTimeProvider();
|
~CTimeProvider();
|
||||||
float GetSecondsMod900() const { return x0_currentTime; }
|
float GetSecondsMod900() const { return x0_currentTime; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const float& x0_currentTime; // in seconds
|
const float& x0_currentTime; // in seconds
|
||||||
bool x4_first;
|
bool x4_first;
|
||||||
|
|
|
@ -88,35 +88,45 @@ public:
|
||||||
static void SetNumIndStages(u8 num);
|
static void SetNumIndStages(u8 num);
|
||||||
static void SetChanAmbColor(EChannelId channel, const GXColor& color);
|
static void SetChanAmbColor(EChannelId channel, const GXColor& color);
|
||||||
static void SetChanMatColor(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,
|
static void SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc,
|
||||||
GXAttnFn attnFn);
|
GXLightID lights, GXDiffuseFn diffFn, GXAttnFn attnFn);
|
||||||
static void SetTevKColor(GXTevKColorID id, const GXColor& color);
|
static void SetTevKColor(GXTevKColorID id, const GXColor& color);
|
||||||
static void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d);
|
static void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
|
||||||
static void SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d);
|
GXTevColorArg d);
|
||||||
static void SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp, GXTevRegID outReg);
|
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 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 SetTevAlphaOp_Compressed(GXTevStageID stageId, uint flags);
|
||||||
static void SetTevKColorSel(GXTevStageID stageId, GXTevKColorSel sel);
|
static void SetTevKColorSel(GXTevStageID stageId, GXTevKColorSel sel);
|
||||||
static void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel);
|
static void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel);
|
||||||
static void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap, GXChannelID color);
|
static void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap,
|
||||||
static void SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op);
|
GXChannelID color);
|
||||||
|
static void SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac,
|
||||||
|
GXLogicOp op);
|
||||||
static void SetZMode(bool compareEnable, GXCompare func, bool updateEnable);
|
static void SetZMode(bool compareEnable, GXCompare func, bool updateEnable);
|
||||||
static void SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
|
static void SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
|
||||||
static void SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt, GXIndTexBiasSel biasSel,
|
static void SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt,
|
||||||
GXIndTexMtxID mtxSel, GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod,
|
GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS,
|
||||||
|
GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod,
|
||||||
GXIndTexAlphaSel alphaSel);
|
GXIndTexAlphaSel alphaSel);
|
||||||
static void SetTevDirect(GXTevStageID stageId);
|
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 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 SetLineWidth(u8 width, GXTexOffset offset);
|
||||||
static void SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp);
|
static void SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp);
|
||||||
static void SetVtxDescv_Compressed(uint flags);
|
static void SetVtxDescv_Compressed(uint flags);
|
||||||
static void SetVtxDesc(GXAttr attr, GXAttrType type); // name?
|
static void SetVtxDesc(GXAttr attr, GXAttrType type); // name?
|
||||||
static void ResetVtxDescv(); // name?
|
static void ResetVtxDescv(); // name?
|
||||||
static void SetVtxDescv(const GXVtxDescList* list);
|
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 SetStandardTevColorAlphaOp(GXTevStageID stageId);
|
||||||
|
|
||||||
static void CallDisplayList(const void* ptr, size_t size);
|
static void CallDisplayList(const void* ptr, size_t size);
|
||||||
|
@ -130,7 +140,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GXColor GetChanAmbColor(EChannelId channel);
|
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) {
|
static inline bool CompareGXColors(const GXColor& lhs, const GXColor& rhs) {
|
||||||
return *reinterpret_cast< const uint* >(&lhs) == *reinterpret_cast< const uint* >(&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 update_fog(uint flags);
|
||||||
static void apply_fog() {
|
static void apply_fog() {
|
||||||
static const GXColor black = {0, 0, 0, 0};
|
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,
|
GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ,
|
||||||
sGXState.x24c_fogParams.x8_fogNearZ, sGXState.x24c_fogParams.xc_fogFarZ,
|
sGXState.x24c_fogParams.x4_fogEndZ, sGXState.x24c_fogParams.x8_fogNearZ,
|
||||||
(sGXState.x56_blendMode & (7 << 5)) == (GX_BL_ONE << 5) ? black : sGXState.x24c_fogParams.x10_fogColor);
|
sGXState.x24c_fogParams.xc_fogFarZ,
|
||||||
|
(sGXState.x56_blendMode & (7 << 5)) == (GX_BL_ONE << 5)
|
||||||
|
? black
|
||||||
|
: sGXState.x24c_fogParams.x10_fogColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SGXState sGXState;
|
static SGXState sGXState;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#include "Kyoto/Graphics/CColor.hpp"
|
#include "Kyoto/Graphics/CColor.hpp"
|
||||||
#include "Kyoto/Math/CVector3f.hpp"
|
|
||||||
#include "Kyoto/Math/CTransform4f.hpp"
|
#include "Kyoto/Math/CTransform4f.hpp"
|
||||||
|
#include "Kyoto/Math/CVector3f.hpp"
|
||||||
|
|
||||||
#include "Kyoto/Graphics/CTevCombiners.hpp"
|
#include "Kyoto/Graphics/CTevCombiners.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef __CLIGHT_HPP__
|
#ifndef __CLIGHT_HPP__
|
||||||
#define __CLIGHT_HPP__
|
#define __CLIGHT_HPP__
|
||||||
|
|
||||||
|
class CLight {};
|
||||||
class CLight {
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __CLIGHT_HPP__
|
#endif // __CLIGHT_HPP__
|
||||||
|
|
|
@ -24,17 +24,32 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
CModelFlags(ETrans trans, f32 rgba)
|
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)
|
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)
|
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)
|
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)
|
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 UseShaderSet(int matSet) { return CModelFlags(*this, false, matSet); }
|
||||||
CModelFlags DontLoadTextures() { return CModelFlags(*this, GetOtherFlags() | kF_NoTextureLock); }
|
CModelFlags DontLoadTextures() { return CModelFlags(*this, GetOtherFlags() | kF_NoTextureLock); }
|
||||||
|
|
|
@ -32,7 +32,8 @@ public:
|
||||||
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(T* obj) {
|
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetNewDerivedObject(T* obj) {
|
||||||
return new TObjOwnerDerivedFromIObj< 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);
|
return new TObjOwnerDerivedFromIObj< T >(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ public:
|
||||||
// , x10_object(obj.release())
|
// , x10_object(obj.release())
|
||||||
// , x14_params(CVParamTransfer::Null()) {}
|
// , 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:
|
private:
|
||||||
u16 x0_refCount;
|
u16 x0_refCount;
|
||||||
|
@ -51,6 +52,8 @@ private:
|
||||||
CVParamTransfer x14_params;
|
CVParamTransfer x14_params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CToken;
|
||||||
|
|
||||||
class IObjectStore {
|
class IObjectStore {
|
||||||
public:
|
public:
|
||||||
virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer) = 0;
|
virtual CToken GetObj(const SObjectTag& tag, CVParamTransfer xfer) = 0;
|
||||||
|
|
|
@ -8,6 +8,7 @@ public:
|
||||||
float GetRelativeValue() const { return x0_relative; }
|
float GetRelativeValue() const { return x0_relative; }
|
||||||
void SetAbsoluteValue(float val) { x4_absolute = val; }
|
void SetAbsoluteValue(float val) { x4_absolute = val; }
|
||||||
float GetAbsoluteValue() const { return x4_absolute; }
|
float GetAbsoluteValue() const { return x4_absolute; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float x0_relative;
|
float x0_relative;
|
||||||
float x4_absolute;
|
float x4_absolute;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "Kyoto/Input/CControllerAxis.hpp"
|
#include "Kyoto/Input/CControllerAxis.hpp"
|
||||||
#include "Kyoto/Input/CControllerButton.hpp"
|
#include "Kyoto/Input/CControllerButton.hpp"
|
||||||
|
#include "Kyoto/Input/InputTypes.hpp"
|
||||||
|
|
||||||
class CControllerGamepadData {
|
class CControllerGamepadData {
|
||||||
public:
|
public:
|
||||||
|
@ -15,7 +16,9 @@ public:
|
||||||
const CControllerButton& GetButton(EButton button) const { return x34_buttons[button]; }
|
const CControllerButton& GetButton(EButton button) const { return x34_buttons[button]; }
|
||||||
CControllerButton& GetButton(EButton button) { 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]; }
|
CControllerAxis& GetAnalogButton(EAnalogButton button) { return x24_triggers[button]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
#include "Kyoto/Input/InputTypes.hpp"
|
|
||||||
#include "Kyoto/Input/CControllerGamepadData.hpp"
|
#include "Kyoto/Input/CControllerGamepadData.hpp"
|
||||||
|
#include "Kyoto/Input/InputTypes.hpp"
|
||||||
|
|
||||||
class COsContext;
|
class COsContext;
|
||||||
class IController {
|
class IController {
|
||||||
|
|
|
@ -16,13 +16,7 @@ enum EMotorState {
|
||||||
kMS_StopHard = PAD_MOTOR_STOP_HARD,
|
kMS_StopHard = PAD_MOTOR_STOP_HARD,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EJoyAxis {
|
enum EJoyAxis { kJA_LeftX, kJA_LeftY, kJA_RightX, kJA_RightY, kJA_MAX };
|
||||||
kJA_LeftX,
|
|
||||||
kJA_LeftY,
|
|
||||||
kJA_RightX,
|
|
||||||
kJA_RightY,
|
|
||||||
kJA_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
enum EButton {
|
enum EButton {
|
||||||
kBU_A,
|
kBU_A,
|
||||||
|
@ -40,10 +34,6 @@ enum EButton {
|
||||||
kBU_MAX,
|
kBU_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EAnalogButton {
|
enum EAnalogButton { kBA_Left, kBA_Right, kBA_MAX };
|
||||||
kBA_Left,
|
|
||||||
kBA_Right,
|
|
||||||
kBA_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __INPUTTYPES_HPP__
|
#endif // __INPUTTYPES_HPP__
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include "Kyoto/Math/CVector3f.hpp"
|
#include "Kyoto/Math/CVector3f.hpp"
|
||||||
|
|
||||||
#include "rstl/reserved_vector.hpp"
|
|
||||||
#include "rstl/optional_object.hpp"
|
#include "rstl/optional_object.hpp"
|
||||||
|
#include "rstl/reserved_vector.hpp"
|
||||||
|
|
||||||
class CAABox;
|
class CAABox;
|
||||||
class CSphere;
|
class CSphere;
|
||||||
|
|
|
@ -93,7 +93,8 @@ public:
|
||||||
CTransform4f operator*(const CTransform4f& vec) const;
|
CTransform4f operator*(const CTransform4f& vec) const;
|
||||||
CTransform4f operator*(const CVector3f& 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; }
|
static const CTransform4f& Identity() { return sIdentity; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -65,7 +65,8 @@ inline float cinput_stream_helper(const TType< float >& type, CInputStream& in)
|
||||||
// rstl
|
// rstl
|
||||||
#include "rstl/pair.hpp"
|
#include "rstl/pair.hpp"
|
||||||
template < typename L, typename R >
|
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;
|
rstl::pair< L, R > result;
|
||||||
result.first = in.Get(TType< L >());
|
result.first = in.Get(TType< L >());
|
||||||
result.second = in.Get(TType< R >());
|
result.second = in.Get(TType< R >());
|
||||||
|
|
|
@ -23,7 +23,8 @@ public:
|
||||||
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) {
|
static inline rstl::auto_ptr< TObjOwnerDerivedFromIObj< T > > GetIObjObjectFor(T* obj) {
|
||||||
return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(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);
|
return TObjOwnerDerivedFromIObj< T >::GetNewDerivedObject(obj);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -45,7 +46,9 @@ class TLockedToken {
|
||||||
public:
|
public:
|
||||||
TLockedToken() {}
|
TLockedToken() {}
|
||||||
TLockedToken(const CToken& token) : x0_token(token), x8_item(*x0_token) {}
|
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) {
|
TLockedToken& operator=(const TLockedToken< T >& token) {
|
||||||
x0_token = token;
|
x0_token = token;
|
||||||
|
|
|
@ -24,9 +24,7 @@ public:
|
||||||
CRasterFont(CInputStream&, IObjectStore*);
|
CRasterFont(CInputStream&, IObjectStore*);
|
||||||
~CRasterFont();
|
~CRasterFont();
|
||||||
|
|
||||||
void SetTexture(TToken<CTexture> token) {
|
void SetTexture(TToken< CTexture > token) { x7c_texture = token; }
|
||||||
x7c_texture = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool x0_initialized;
|
bool x0_initialized;
|
||||||
|
|
|
@ -30,7 +30,8 @@ public:
|
||||||
virtual void AddParticleGen1();
|
virtual void AddParticleGen1();
|
||||||
virtual void AddParticleGen2();
|
virtual void AddParticleGen2();
|
||||||
virtual void AddPlaneObject();
|
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 SetDrawableCallback();
|
||||||
virtual void SetWorldViewpoint();
|
virtual void SetWorldViewpoint();
|
||||||
virtual void SetPerspective1();
|
virtual void SetPerspective1();
|
||||||
|
|
|
@ -10,5 +10,4 @@ void EnableMetroTRKInterrupts(void);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* #ifndef __TRKINIT_H__ */
|
#endif /* #ifndef __TRKINIT_H__ */
|
||||||
|
|
|
@ -207,8 +207,9 @@ public:
|
||||||
kSS_Done,
|
kSS_Done,
|
||||||
};
|
};
|
||||||
|
|
||||||
CActor(TUniqueId uid, bool active, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, const CModelData& mData,
|
CActor(TUniqueId uid, bool active, const rstl::string& name, const CEntityInfo& info,
|
||||||
const CMaterialList& list, const CActorParameters& params, TUniqueId nextDrawNode);
|
const CTransform4f& xf, const CModelData& mData, const CMaterialList& list,
|
||||||
|
const CActorParameters& params, TUniqueId nextDrawNode);
|
||||||
~CActor() override;
|
~CActor() override;
|
||||||
|
|
||||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
||||||
|
@ -221,24 +222,28 @@ public:
|
||||||
virtual void CalculateRenderBounds();
|
virtual void CalculateRenderBounds();
|
||||||
virtual CHealthInfo* HealthInfo(CStateManager&);
|
virtual CHealthInfo* HealthInfo(CStateManager&);
|
||||||
virtual const CDamageVulnerability* GetDamageVulnerability() const;
|
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 rstl::optional_object< CAABox > GetTouchBounds() const;
|
||||||
virtual void Touch(CActor&, CStateManager&);
|
virtual void Touch(CActor&, CStateManager&);
|
||||||
virtual CVector3f GetOrbitPosition(const CStateManager&) const;
|
virtual CVector3f GetOrbitPosition(const CStateManager&) const;
|
||||||
virtual CVector3f GetAimPosition(const CStateManager&, float) const;
|
virtual CVector3f GetAimPosition(const CStateManager&, float) const;
|
||||||
virtual CVector3f GetHomingPosition(const CStateManager&, float) const;
|
virtual CVector3f GetHomingPosition(const CStateManager&, float) const;
|
||||||
virtual CVector3f GetScanObjectIndicatorPosition(const CStateManager&) 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;
|
int /*EProjectileAttrib?*/) const;
|
||||||
virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
|
virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
|
||||||
virtual void OnScanStateChange(EScanState, CStateManager&);
|
virtual void OnScanStateChange(EScanState, CStateManager&);
|
||||||
virtual CAABox GetSortingBounds(const CTransform4f&) const;
|
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);
|
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,
|
void ProcessSoundEvent(int sfxId, f32 weight, int flags, f32 fallOff, f32 maxDist, u8 minVol,
|
||||||
const CVector3f& position, int aid, CStateManager& mgr, bool translateId);
|
u8 maxVol, const CVector3f& toListener, const CVector3f& position, int aid,
|
||||||
|
CStateManager& mgr, bool translateId);
|
||||||
|
|
||||||
void UpdateSfxEmitters();
|
void UpdateSfxEmitters();
|
||||||
void RemoveEmitter();
|
void RemoveEmitter();
|
||||||
|
@ -264,7 +269,9 @@ public:
|
||||||
/// ????
|
/// ????
|
||||||
bool NullModel() const { return !GetAnimationData() && !GetModelData()->HasNormalModel(); }
|
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(); }
|
CModelData* ModelData() { return x64_modelData.get(); }
|
||||||
const CModelData* GetModelData() const { return x64_modelData.get(); }
|
const CModelData* GetModelData() const { return x64_modelData.get(); }
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ public:
|
||||||
CVisorParameters() {
|
CVisorParameters() {
|
||||||
// TODO
|
// 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; }
|
u8 GetMask() const { return x0_mask; }
|
||||||
// TODO: GetIsBlockXRay__16CVisorParametersCFv?
|
// TODO: GetIsBlockXRay__16CVisorParametersCFv?
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include "MetroidPrime/CParticleDatabase.hpp"
|
#include "MetroidPrime/CParticleDatabase.hpp"
|
||||||
#include "MetroidPrime/CPoseAsTransforms.hpp"
|
#include "MetroidPrime/CPoseAsTransforms.hpp"
|
||||||
|
|
||||||
#include "Kyoto/TToken.hpp"
|
|
||||||
#include "Kyoto/Animation/CSkinnedModel.hpp"
|
#include "Kyoto/Animation/CSkinnedModel.hpp"
|
||||||
|
#include "Kyoto/TToken.hpp"
|
||||||
|
|
||||||
#include "rstl/reserved_vector.hpp"
|
#include "rstl/reserved_vector.hpp"
|
||||||
|
|
||||||
|
@ -37,9 +37,7 @@ public:
|
||||||
x220_25_loop = v;
|
x220_25_loop = v;
|
||||||
x220_24_animating = true;
|
x220_24_animating = true;
|
||||||
}
|
}
|
||||||
void SetIsAnimating(bool v) {
|
void SetIsAnimating(bool v) { x220_24_animating = v; }
|
||||||
x220_24_animating = v;
|
|
||||||
}
|
|
||||||
void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr) {
|
void SetParticleEffectState(const rstl::string& name, bool active, CStateManager& mgr) {
|
||||||
x120_particleDB.SetParticleEffectState(name, active, mgr);
|
x120_particleDB.SetParticleEffectState(name, active, mgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public:
|
||||||
CEntity(TUniqueId id, const CEntityInfo& info, bool active, const rstl::string& name);
|
CEntity(TUniqueId id, const CEntityInfo& info, bool active, const rstl::string& name);
|
||||||
|
|
||||||
void SendScriptMsgs(EScriptObjectState state, CStateManager& mgr, EScriptObjectMessage msg);
|
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);
|
mgr.SendScriptMsg(to, sender, msg);
|
||||||
}
|
}
|
||||||
TUniqueId GetUniqueId() const { return x8_uid; }
|
TUniqueId GetUniqueId() const { return x8_uid; }
|
||||||
|
|
|
@ -240,7 +240,8 @@ class CEntityInfo {
|
||||||
TEditorId x14_editorId;
|
TEditorId x14_editorId;
|
||||||
|
|
||||||
public:
|
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; }
|
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; }
|
TEditorId GetEditorId() const { return x14_editorId; }
|
||||||
|
|
|
@ -50,10 +50,14 @@ public:
|
||||||
SAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
|
SAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
|
||||||
void AdvanceParticles(const CTransform4f& xf, float dt, CStateManager& mgr);
|
void AdvanceParticles(const CTransform4f& xf, float dt, CStateManager& mgr);
|
||||||
void RenderParticles(const CFrustumPlanes& planes) const;
|
void RenderParticles(const CFrustumPlanes& planes) const;
|
||||||
void RenderUnsortedParts(EWhichModel which, const CTransform4f& xf, const CActorLights* lights, const CModelFlags& flags) const;
|
void RenderUnsortedParts(EWhichModel which, const CTransform4f& xf, const CActorLights* lights,
|
||||||
void RenderThermal(const CTransform4f& xf, const CColor& mulColor, const CColor& addColor, const CModelFlags& flags) const;
|
const CModelFlags& flags) const;
|
||||||
void Render(const CStateManager&, const CTransform4f&, const CActorLights*, const CModelFlags&) const;
|
void RenderThermal(const CTransform4f& xf, const CColor& mulColor, const CColor& addColor,
|
||||||
void Render(CModelData::EWhichModel, const CTransform4f&, const CActorLights*, const CModelFlags&) const;
|
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(); }
|
const CAnimData* GetAnimationData() const { return xc_animData.get(); }
|
||||||
CAnimData* AnimationData() { return xc_animData.get(); }
|
CAnimData* AnimationData() { return xc_animData.get(); }
|
||||||
|
|
|
@ -41,7 +41,8 @@ class CSortedListManager;
|
||||||
|
|
||||||
class CStateManager {
|
class CStateManager {
|
||||||
public:
|
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);
|
void SendScriptMsg(CEntity* ent, TUniqueId target, EScriptObjectMessage msg);
|
||||||
bool AddDrawableActor(const CActor& actor, const CVector3f& pos, const CAABox& bounds) const;
|
bool AddDrawableActor(const CActor& actor, const CVector3f& pos, const CAABox& bounds) const;
|
||||||
void SetupParticleHook(const CActor& actor) const;
|
void SetupParticleHook(const CActor& actor) const;
|
||||||
|
@ -63,7 +64,9 @@ public:
|
||||||
CWorld* World() { return x850_world.get(); }
|
CWorld* World() { return x850_world.get(); }
|
||||||
const CWorld* GetWorld() const { return x850_world.get(); }
|
const CWorld* GetWorld() const { return x850_world.get(); }
|
||||||
CActorModelParticles* ActorModelParticles() { return x884_actorModelParticles.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; }
|
CRandom16* GetActiveRandom() const { return x900_random; }
|
||||||
|
|
||||||
CObjectList& GetObjectListById(EGameObjectList id) { return *x808_objectLists[id]; }
|
CObjectList& GetObjectListById(EGameObjectList id) { return *x808_objectLists[id]; }
|
||||||
|
|
|
@ -57,15 +57,9 @@ public:
|
||||||
rstl::string IGetDefaultAudioTrack() const override;
|
rstl::string IGetDefaultAudioTrack() const override;
|
||||||
int IGetAreaCount() const override;
|
int IGetAreaCount() const override;
|
||||||
|
|
||||||
const CGameArea& GetAreaAlways(TAreaId id) const {
|
const CGameArea& GetAreaAlways(TAreaId id) const { return *x18_areas[id.Value()]; }
|
||||||
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* GetArea(TAreaId id) const {
|
|
||||||
return x18_areas[id.Value()].get();
|
|
||||||
}
|
|
||||||
bool IsAreaValid(TAreaId id) const {
|
|
||||||
return x18_areas[id.Value()]->IsLoaded();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Phase {
|
enum Phase {
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
#ifndef __CCAMERAHINT_HPP__
|
#ifndef __CCAMERAHINT_HPP__
|
||||||
#define __CCAMERAHINT_HPP__
|
#define __CCAMERAHINT_HPP__
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "MetroidPrime/Cameras/CBallCamera.hpp"
|
|
||||||
#include "Kyoto/Math/CVector3f.hpp"
|
#include "Kyoto/Math/CVector3f.hpp"
|
||||||
|
#include "MetroidPrime/Cameras/CBallCamera.hpp"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
class CCameraHint {
|
class CCameraHint {
|
||||||
public:
|
public:
|
||||||
CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist, f32 maxDist,
|
CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, f32 minDist,
|
||||||
f32 backwardsDist, const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset,
|
f32 maxDist, f32 backwardsDist, const CVector3f& lookAtOffset,
|
||||||
const CVector3f& ballToCam, f32 fov, f32 attitudeRange, f32 azimuthRange,
|
const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, f32 fov,
|
||||||
f32 anglePerSecond, f32 clampVelRange, f32 clampRotRange, f32 elevation, f32 interpolateTime,
|
f32 attitudeRange, f32 azimuthRange, f32 anglePerSecond, f32 clampVelRange,
|
||||||
f32 clampVelTime, f32 controlInterpDur);
|
f32 clampRotRange, f32 elevation, f32 interpolateTime, f32 clampVelTime,
|
||||||
|
f32 controlInterpDur);
|
||||||
virtual ~CCameraHint();
|
virtual ~CCameraHint();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
class CScriptDebugCameraWaypoint : public CActor {
|
class CScriptDebugCameraWaypoint : public CActor {
|
||||||
public:
|
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;
|
~CScriptDebugCameraWaypoint() override;
|
||||||
|
|
||||||
void Accept(IVisitor& visitor) override;
|
void Accept(IVisitor& visitor) override;
|
||||||
|
|
|
@ -33,11 +33,14 @@ struct SMazeCell {
|
||||||
bool x1_26_checked : 1;
|
bool x1_26_checked : 1;
|
||||||
|
|
||||||
SMazeCell() {
|
SMazeCell() {
|
||||||
x0_24_openTop = x0_25_openRight = x0_26_openBottom = x0_27_openLeft = x0_28_gateTop = x0_29_gateRight = x0_30_gateBottom =
|
x0_24_openTop = x0_25_openRight = x0_26_openBottom = x0_27_openLeft = x0_28_gateTop =
|
||||||
x0_31_gateLeft = x1_24_puddle = x1_25_onPath = x1_26_checked = false;
|
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 {
|
class CMazeState {
|
||||||
|
@ -71,8 +74,10 @@ public:
|
||||||
|
|
||||||
class CScriptMazeNode : public CActor {
|
class CScriptMazeNode : public CActor {
|
||||||
public:
|
public:
|
||||||
CScriptMazeNode(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, bool active, int col, int row,
|
CScriptMazeNode(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||||
int side, const CVector3f& actorPos, const CVector3f& triggerPos, const CVector3f& effectPos);
|
const CTransform4f& xf, bool active, int col, int row, int side,
|
||||||
|
const CVector3f& actorPos, const CVector3f& triggerPos,
|
||||||
|
const CVector3f& effectPos);
|
||||||
~CScriptMazeNode() override;
|
~CScriptMazeNode() override;
|
||||||
|
|
||||||
void Accept(IVisitor& visitor) override;
|
void Accept(IVisitor& visitor) override;
|
||||||
|
|
|
@ -71,7 +71,9 @@ public:
|
||||||
f32 GetDashStrafeInputThreshold() const { return x208_dashStrafeInputThreshold; }
|
f32 GetDashStrafeInputThreshold() const { return x208_dashStrafeInputThreshold; }
|
||||||
f32 GetSidewaysDoubleJumpImpulse() const { return x20c_sidewaysDoubleJumpImpulse; }
|
f32 GetSidewaysDoubleJumpImpulse() const { return x20c_sidewaysDoubleJumpImpulse; }
|
||||||
f32 GetSidewaysVerticalDoubleJumpAccel() const { return x210_sidewaysVerticalDoubleJumpAccel; }
|
f32 GetSidewaysVerticalDoubleJumpAccel() const { return x210_sidewaysVerticalDoubleJumpAccel; }
|
||||||
f32 GetSidewaysHorizontalDoubleJumpAccel() const { return x214_sidewaysHorizontalDoubleJumpAccel; }
|
f32 GetSidewaysHorizontalDoubleJumpAccel() const {
|
||||||
|
return x214_sidewaysHorizontalDoubleJumpAccel;
|
||||||
|
}
|
||||||
f32 GetScanningRange() const { return x218_scanningRange; }
|
f32 GetScanningRange() const { return x218_scanningRange; }
|
||||||
bool GetScanRetention() const { return x21c_24_scanRetention; }
|
bool GetScanRetention() const { return x21c_24_scanRetention; }
|
||||||
bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; }
|
bool GetScanFreezesGame() const { return x21c_25_scanFreezesGame; }
|
||||||
|
@ -107,7 +109,9 @@ public:
|
||||||
f32 GetGrappleSwingLength() const { return x2a4_grappleSwingLength; }
|
f32 GetGrappleSwingLength() const { return x2a4_grappleSwingLength; }
|
||||||
f32 GetGrappleSwingPeriod() const { return x2a8_grappleSwingPeriod; }
|
f32 GetGrappleSwingPeriod() const { return x2a8_grappleSwingPeriod; }
|
||||||
f32 GetGrapplePullSpeedMin() const { return x2ac_grapplePullSpeedMin; }
|
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 GetGrapplePullSpeedProportion() const { return x2b8_grapplePullSpeedProportion; }
|
||||||
f32 GetGrapplePullSpeedMax() const { return x2bc_grapplePullSpeedMax; }
|
f32 GetGrapplePullSpeedMax() const { return x2bc_grapplePullSpeedMax; }
|
||||||
f32 GetGrappleLookCenterSpeed() const { return x2c0_grappleLookCenterSpeed; }
|
f32 GetGrappleLookCenterSpeed() const { return x2c0_grappleLookCenterSpeed; }
|
||||||
|
|
|
@ -9,6 +9,7 @@ public:
|
||||||
virtual ~IWeaponRenderer() = 0;
|
virtual ~IWeaponRenderer() = 0;
|
||||||
virtual void AddParticleGen(const CParticleGen& gen) = 0;
|
virtual void AddParticleGen(const CParticleGen& gen) = 0;
|
||||||
static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; }
|
static void SetRenderer(IWeaponRenderer* renderer) { sWeaponRenderer = renderer; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static IWeaponRenderer* sWeaponRenderer;
|
static IWeaponRenderer* sWeaponRenderer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -104,7 +104,8 @@ typedef struct CARDID {
|
||||||
|
|
||||||
void __CARDDefaultApiCallback(s32 chan, s32 result);
|
void __CARDDefaultApiCallback(s32 chan, s32 result);
|
||||||
|
|
||||||
#define CARDIsValidBlockNo(card, iBlock) (CARD_NUM_SYSTEM_BLOCK <= (iBlock) && (iBlock) < (card)->cBlock)
|
#define CARDIsValidBlockNo(card, iBlock) \
|
||||||
|
(CARD_NUM_SYSTEM_BLOCK <= (iBlock) && (iBlock) < (card)->cBlock)
|
||||||
#define __CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE])
|
#define __CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE])
|
||||||
|
|
||||||
CARDDir* __CARDGetDirBlock(CARDControl* card);
|
CARDDir* __CARDGetDirBlock(CARDControl* card);
|
||||||
|
|
|
@ -29,12 +29,16 @@ extern "C" {
|
||||||
#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
|
#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
|
||||||
#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_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 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 CARDSetBannerFormat(stat, f) \
|
||||||
#define CARDSetIconAnim(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (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) \
|
#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) \
|
#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 CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr))
|
||||||
#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr))
|
#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr))
|
||||||
#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo)
|
#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo)
|
||||||
|
@ -125,7 +129,8 @@ s32 CARDCheckAsync(s32 chan, CARDCallback callback);
|
||||||
s32 CARDCheckEx(s32 chan, s32* xferBytes);
|
s32 CARDCheckEx(s32 chan, s32* xferBytes);
|
||||||
s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback);
|
s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback);
|
||||||
s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo);
|
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 CARDDelete(s32 chan, const char* fileName);
|
||||||
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback);
|
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback);
|
||||||
s32 CARDFastDelete(s32 chan, s32 fileNo);
|
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 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat);
|
||||||
s32 CARDGetXferredBytes(s32 chan);
|
s32 CARDGetXferredBytes(s32 chan);
|
||||||
s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback);
|
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);
|
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo);
|
||||||
BOOL CARDProbe(s32 chan);
|
BOOL CARDProbe(s32 chan);
|
||||||
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize);
|
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize);
|
||||||
|
@ -158,9 +164,11 @@ s32 CARDGetCurrentMode(s32 chan, u32* mode);
|
||||||
s32 CARDCancel(CARDFileInfo* fileInfo);
|
s32 CARDCancel(CARDFileInfo* fileInfo);
|
||||||
s32 CARDClose(CARDFileInfo* fileInfo);
|
s32 CARDClose(CARDFileInfo* fileInfo);
|
||||||
s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
|
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 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,12 +50,10 @@ u32 DSPGetDMAStatus();
|
||||||
|
|
||||||
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task);
|
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task);
|
||||||
|
|
||||||
|
|
||||||
void __DSP_debug_printf(const char* fmt, ...);
|
void __DSP_debug_printf(const char* fmt, ...);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // __DSP_H__
|
#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);
|
void GXSetIndTexMtx(GXIndTexMtxID mtx_sel, f32 offset[2][3], s8 scale_exp);
|
||||||
#endif
|
#endif
|
||||||
void GXSetIndTexOrder(GXIndTexStageID ind_stage, GXTexCoordID tex_coord, GXTexMapID tex_map);
|
void GXSetIndTexOrder(GXIndTexStageID ind_stage, GXTexCoordID tex_coord, GXTexMapID tex_map);
|
||||||
void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel,
|
void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format,
|
||||||
GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool ind_lod,
|
GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s,
|
||||||
|
GXIndTexWrap wrap_t, GXBool add_prev, GXBool ind_lod,
|
||||||
GXIndTexAlphaSel alpha_sel);
|
GXIndTexAlphaSel alpha_sel);
|
||||||
void GXSetTevIndWarp(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXBool signed_offsets, GXBool replace_mode,
|
void GXSetTevIndWarp(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXBool signed_offsets,
|
||||||
GXIndTexMtxID matrix_sel);
|
GXBool replace_mode, GXIndTexMtxID matrix_sel);
|
||||||
void GXSetIndTexCoordScale(GXIndTexStageID ind_state, GXIndTexScale scale_s, GXIndTexScale scale_t);
|
void GXSetIndTexCoordScale(GXIndTexStageID ind_state, GXIndTexScale scale_s, GXIndTexScale scale_t);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -19,9 +19,10 @@ GXFifoObj* GXGetGPFifo(void);
|
||||||
void GXSetCPUFifo(GXFifoObj* fifo);
|
void GXSetCPUFifo(GXFifoObj* fifo);
|
||||||
void GXSetGPFifo(GXFifoObj* fifo);
|
void GXSetGPFifo(GXFifoObj* fifo);
|
||||||
void GXSaveCPUFifo(GXFifoObj* fifo);
|
void GXSaveCPUFifo(GXFifoObj* fifo);
|
||||||
void GXGetFifoStatus(GXFifoObj* fifo, GXBool* overhi, GXBool* underlow, u32* fifoCount, GXBool* cpu_write,
|
void GXGetFifoStatus(GXFifoObj* fifo, GXBool* overhi, GXBool* underlow, u32* fifoCount,
|
||||||
GXBool* gp_read, GXBool* fifowrap);
|
GXBool* cpu_write, GXBool* gp_read, GXBool* fifowrap);
|
||||||
void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle, GXBool* brkpt);
|
void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle,
|
||||||
|
GXBool* brkpt);
|
||||||
void GXInitFifoLimits(GXFifoObj* fifo, u32 hiWaterMark, u32 loWaterMark);
|
void GXInitFifoLimits(GXFifoObj* fifo, u32 hiWaterMark, u32 loWaterMark);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -13,8 +13,8 @@ void GXClearVtxDesc(void);
|
||||||
void GXSetVtxAttrFmt(GXVtxFmt vtxfmt, GXAttr attr, GXCompCnt cnt, GXCompType type, u8 frac);
|
void GXSetVtxAttrFmt(GXVtxFmt vtxfmt, GXAttr attr, GXCompCnt cnt, GXCompType type, u8 frac);
|
||||||
void GXSetNumTexGens(u8 nTexGens);
|
void GXSetNumTexGens(u8 nTexGens);
|
||||||
void GXBegin(GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts);
|
void GXBegin(GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts);
|
||||||
void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx, GXBool normalize,
|
void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx,
|
||||||
u32 postmtx);
|
GXBool normalize, u32 postmtx);
|
||||||
void GXSetLineWidth(u8 width, GXTexOffset texOffsets);
|
void GXSetLineWidth(u8 width, GXTexOffset texOffsets);
|
||||||
void GXSetPointSize(u8 pointSize, GXTexOffset texOffsets);
|
void GXSetPointSize(u8 pointSize, GXTexOffset texOffsets);
|
||||||
void GXEnableTexOffsets(GXTexCoordID coord, GXBool line_enable, GXBool point_enable);
|
void GXEnableTexOffsets(GXTexCoordID coord, GXBool line_enable, GXBool point_enable);
|
||||||
|
@ -25,7 +25,8 @@ void GXSetArray(GXAttr attr, const void* data, u8 stride);
|
||||||
#endif
|
#endif
|
||||||
void GXInvalidateVtxCache(void);
|
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);
|
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 GXGetProjectionv(f32* p);
|
||||||
void GXGetLightPos(GXLightObj* lt_obj, f32* x, f32* y, f32* z);
|
void GXGetLightPos(GXLightObj* lt_obj, f32* x, f32* y, f32* z);
|
||||||
void GXGetLightColor(GXLightObj* lt_obj, GXColor* color);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,14 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GXSetNumChans(u8 nChans);
|
void GXSetNumChans(u8 nChans);
|
||||||
void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorSrc mat_src, u32 light_mask,
|
void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorSrc mat_src,
|
||||||
GXDiffuseFn diff_fn, GXAttnFn attn_fn);
|
u32 light_mask, GXDiffuseFn diff_fn, GXAttnFn attn_fn);
|
||||||
void GXSetChanAmbColor(GXChannelID chan, GXColor amb_color);
|
void GXSetChanAmbColor(GXChannelID chan, GXColor amb_color);
|
||||||
void GXSetChanMatColor(GXChannelID chan, GXColor mat_color);
|
void GXSetChanMatColor(GXChannelID chan, GXColor mat_color);
|
||||||
|
|
||||||
void GXInitLightSpot(GXLightObj* lt_obj, f32 cutoff, GXSpotFn spot_func);
|
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 GXInitLightPos(GXLightObj* lt_obj, f32 x, f32 y, f32 z);
|
||||||
void GXInitLightDir(GXLightObj* lt_obj, f32 nx, f32 ny, f32 nz);
|
void GXInitLightDir(GXLightObj* lt_obj, f32 nx, f32 ny, f32 nz);
|
||||||
void GXInitLightColor(GXLightObj* lt_obj, GXColor color);
|
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 GXSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor color);
|
||||||
void GXSetFogColor(GXColor color);
|
void GXSetFogColor(GXColor color);
|
||||||
// ? GXSetFogRangeAdj();
|
// ? 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 GXSetColorUpdate(GXBool update_enable);
|
||||||
void GXSetAlphaUpdate(GXBool update_enable);
|
void GXSetAlphaUpdate(GXBool update_enable);
|
||||||
void GXSetZMode(GXBool compare_enable, GXCompare func, GXBool update_enable);
|
void GXSetZMode(GXBool compare_enable, GXCompare func, GXBool update_enable);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef DOLPHIN_GXSTRUCT_H
|
#ifndef DOLPHIN_GXSTRUCT_H
|
||||||
#define DOLPHIN_GXSTRUCT_H
|
#define DOLPHIN_GXSTRUCT_H
|
||||||
|
|
||||||
#include <dolphin/types.h>
|
|
||||||
#include <dolphin/gx/GXEnum.h>
|
#include <dolphin/gx/GXEnum.h>
|
||||||
|
#include <dolphin/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -9,8 +9,10 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GXSetTevOp(GXTevStageID id, GXTevMode mode);
|
void GXSetTevOp(GXTevStageID id, GXTevMode mode);
|
||||||
void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d);
|
void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
|
||||||
void GXSetTevAlphaIn(GXTevStageID stage, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d);
|
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,
|
void GXSetTevColorOp(GXTevStageID stage, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp,
|
||||||
GXTevRegID out_reg);
|
GXTevRegID out_reg);
|
||||||
void GXSetTevAlphaOp(GXTevStageID stage, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp,
|
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 GXSetTevKColorSel(GXTevStageID stage, GXTevKColorSel sel);
|
||||||
void GXSetTevKAlphaSel(GXTevStageID stage, GXTevKAlphaSel sel);
|
void GXSetTevKAlphaSel(GXTevStageID stage, GXTevKAlphaSel sel);
|
||||||
void GXSetTevSwapMode(GXTevStageID stage, GXTevSwapSel ras_sel, GXTevSwapSel tex_sel);
|
void GXSetTevSwapMode(GXTevStageID stage, GXTevSwapSel ras_sel, GXTevSwapSel tex_sel);
|
||||||
void GXSetTevSwapModeTable(GXTevSwapSel table, GXTevColorChan red, GXTevColorChan green, GXTevColorChan blue,
|
void GXSetTevSwapModeTable(GXTevSwapSel table, GXTevColorChan red, GXTevColorChan green,
|
||||||
GXTevColorChan alpha);
|
GXTevColorChan blue, GXTevColorChan alpha);
|
||||||
void GXSetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
|
void GXSetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
|
||||||
void GXSetZTexture(GXZTexOp op, GXTexFmt fmt, u32 bias);
|
void GXSetZTexture(GXZTexOp op, GXTexFmt fmt, u32 bias);
|
||||||
void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXChannelID color);
|
void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXChannelID color);
|
||||||
|
|
|
@ -8,13 +8,14 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GXInitTexObj(GXTexObj* obj, const void* data, u16 width, u16 height, u32 format, GXTexWrapMode wrapS, GXTexWrapMode wrapT,
|
void GXInitTexObj(GXTexObj* obj, const void* data, u16 width, u16 height, u32 format,
|
||||||
GXBool mipmap);
|
GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXBool mipmap);
|
||||||
void GXInitTexObjCI(GXTexObj* obj, const void* data, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrapS, GXTexWrapMode wrapT,
|
void GXInitTexObjCI(GXTexObj* obj, const void* data, u16 width, u16 height, GXCITexFmt format,
|
||||||
GXBool mipmap, u32 tlut);
|
GXTexWrapMode wrapS, GXTexWrapMode wrapT, GXBool mipmap, u32 tlut);
|
||||||
void GXInitTexObjData(GXTexObj* obj, const void* data);
|
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,
|
void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod,
|
||||||
GXBool do_edge_lod, GXAnisotropy max_aniso);
|
f32 max_lod, f32 lod_bias, GXBool bias_clamp, GXBool do_edge_lod,
|
||||||
|
GXAnisotropy max_aniso);
|
||||||
void GXLoadTexObj(GXTexObj* obj, GXTexMapID id);
|
void GXLoadTexObj(GXTexObj* obj, GXTexMapID id);
|
||||||
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod);
|
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_lod);
|
||||||
void GXInvalidateTexAll();
|
void GXInvalidateTexAll();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef __OSALARM_H__
|
#ifndef __OSALARM_H__
|
||||||
#define __OSALARM_H__
|
#define __OSALARM_H__
|
||||||
|
|
||||||
#include <types.h>
|
|
||||||
#include <dolphin/os/OSContext.h>
|
#include <dolphin/os/OSContext.h>
|
||||||
|
#include <types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -31,10 +31,8 @@ typedef struct OSContext {
|
||||||
|
|
||||||
} OSContext;
|
} OSContext;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ extern "C" {
|
||||||
typedef BOOL (*OSResetFunction)(BOOL final);
|
typedef BOOL (*OSResetFunction)(BOOL final);
|
||||||
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
|
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
|
||||||
|
|
||||||
struct OSResetFunctionInfo
|
struct OSResetFunctionInfo {
|
||||||
{
|
|
||||||
// public
|
// public
|
||||||
OSResetFunction func;
|
OSResetFunction func;
|
||||||
u32 priority;
|
u32 priority;
|
||||||
|
|
|
@ -53,7 +53,8 @@ extern "C" {
|
||||||
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
|
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
|
||||||
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
|
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
|
||||||
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
|
#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_KEYBOARD (SI_TYPE_GC | 0x00200000)
|
||||||
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
|
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,9 @@
|
||||||
#define PAD_CHAN2_BIT 0x20000000
|
#define PAD_CHAN2_BIT 0x20000000
|
||||||
#define PAD_CHAN3_BIT 0x10000000
|
#define PAD_CHAN3_BIT 0x10000000
|
||||||
|
|
||||||
#define PADButtonDown(buttonLast, button) \
|
#define PADButtonDown(buttonLast, button) ((((buttonLast) ^ (button)) & (button)))
|
||||||
((((buttonLast) ^ (button)) & (button)))
|
|
||||||
|
|
||||||
#define PADButtonUp(buttonLast, button) \
|
#define PADButtonUp(buttonLast, button) ((((buttonLast) ^ (button)) & (buttonLast)))
|
||||||
((((buttonLast) ^ (button)) & (buttonLast)))
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -55,7 +55,8 @@
|
||||||
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
|
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
|
||||||
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
|
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
|
||||||
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
|
#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_KEYBOARD (SI_TYPE_GC | 0x00200000)
|
||||||
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
|
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,8 @@ typedef struct SND_PARAMETER_INFO {
|
||||||
#define sndFXStart(fid, vol, pan) sndFXStartEx(fid, vol, pan, SND_STUDIO_DEFAULT)
|
#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 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 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);
|
SND_VOICEID sndFXCheck(SND_VOICEID vid);
|
||||||
bool sndFXKeyOff(SND_VOICEID vid);
|
bool sndFXKeyOff(SND_VOICEID vid);
|
||||||
bool sndFXCtrl(SND_VOICEID vid, u8 ctrl, u8 value);
|
bool sndFXCtrl(SND_VOICEID vid, u8 ctrl, u8 value);
|
||||||
|
|
|
@ -49,7 +49,6 @@ float salNormalizeVector(SND_FVECTOR* vec);
|
||||||
void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR* b);
|
void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR* b);
|
||||||
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in);
|
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in);
|
||||||
|
|
||||||
|
|
||||||
/* hardware */
|
/* hardware */
|
||||||
/* TODO: Figure out what `unk` is */
|
/* TODO: Figure out what `unk` is */
|
||||||
bool hwAddInput(u8 studio, void* unk);
|
bool hwAddInput(u8 studio, void* unk);
|
||||||
|
|
|
@ -16,4 +16,3 @@ u16 seqGetMIDIPriority(s32 unk1, s32 unk2);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,11 @@ bool synthSendKeyOff(SND_VOICEID vid);
|
||||||
SND_VOICEID synthFXStart(SND_FXID fid, u8 vol, u8 pan, u8 studio, u8);
|
SND_VOICEID synthFXStart(SND_FXID fid, u8 vol, u8 pan, u8 studio, u8);
|
||||||
void synthVolume(u8 volume, u16 time, u8 volgroup2, s32, s32);
|
void synthVolume(u8 volume, u16 time, u8 volgroup2, s32, s32);
|
||||||
|
|
||||||
|
|
||||||
/* TODO: Move this where it belongs */
|
/* TODO: Move this where it belongs */
|
||||||
void hwSetAUXProcessingCallbacks(u8 studio,
|
void hwSetAUXProcessingCallbacks(u8 studio, SND_AUX_CALLBACK auxA, void* userA,
|
||||||
SND_AUX_CALLBACK auxA, void * userA,
|
|
||||||
SND_AUX_CALLBACK auxB, void* userB);
|
SND_AUX_CALLBACK auxB, void* userB);
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __SYNTH_H__
|
#endif // __SYNTH_H__
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
#include "rstl/vector.hpp"
|
#include "rstl/vector.hpp"
|
||||||
|
|
||||||
namespace rstl {
|
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 {
|
class hash_table {
|
||||||
private:
|
private:
|
||||||
rstl::vector< rstl::list< P, Alloc > /*::iterator*/, Alloc > x;
|
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 {
|
class hash_map {
|
||||||
typedef rstl::pair< K, V > Pair;
|
typedef rstl::pair< K, V > Pair;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,10 @@ public:
|
||||||
inline pair() {}
|
inline pair() {}
|
||||||
inline pair(const L& first, const R& second) : first(first), second(second) {}
|
inline pair(const L& first, const R& second) : first(first), second(second) {}
|
||||||
inline pair(const pair& other) : first(other.first), second(other.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;
|
L first;
|
||||||
R second;
|
R second;
|
||||||
|
|
|
@ -22,8 +22,14 @@ public:
|
||||||
|
|
||||||
const_pointer_iterator() : current(nullptr) {}
|
const_pointer_iterator() : current(nullptr) {}
|
||||||
const_pointer_iterator(const T* begin) : current(begin) {}
|
const_pointer_iterator(const T* begin) : current(begin) {}
|
||||||
const_pointer_iterator& operator++() { ++current; return *this; }
|
const_pointer_iterator& operator++() {
|
||||||
const_pointer_iterator& operator--() { --current; return *this; }
|
++current;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
const_pointer_iterator& operator--() {
|
||||||
|
--current;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
T* get_pointer() const { return const_cast< T* >(current); }
|
T* get_pointer() const { return const_cast< T* >(current); }
|
||||||
const T& operator*() const { return *get_pointer(); }
|
const T& operator*() const { return *get_pointer(); }
|
||||||
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; }
|
||||||
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) {
|
||||||
friend const_pointer_iterator operator-(const const_pointer_iterator& x, int v) { return const_pointer_iterator(x.current - 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 >
|
template < typename T, typename Vec, typename Alloc >
|
||||||
|
@ -54,11 +64,21 @@ public:
|
||||||
rstl::destroy(get_pointer());
|
rstl::destroy(get_pointer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pointer_iterator& operator++() { ++current; return *this; }
|
pointer_iterator& operator++() {
|
||||||
pointer_iterator& operator--() { --current; return *this; }
|
++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) {
|
||||||
friend pointer_iterator operator-(const pointer_iterator& x, int v) { return pointer_iterator(x.get_pointer() - 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
|
} // namespace rstl
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ namespace rstl {
|
||||||
template < typename _CharTp >
|
template < typename _CharTp >
|
||||||
struct char_traits {};
|
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 {
|
class basic_string {
|
||||||
struct COWData {
|
struct COWData {
|
||||||
u32 x0_capacity;
|
u32 x0_capacity;
|
||||||
|
|
|
@ -18,8 +18,7 @@ template < class T, int N >
|
||||||
struct check_sizeof : _n_is_equal< sizeof(T), N > {};
|
struct check_sizeof : _n_is_equal< sizeof(T), N > {};
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#define CHECK_SIZEOF(cls, size) \
|
#define CHECK_SIZEOF(cls, size) extern int cls##_check[check_sizeof< cls, size >::value];
|
||||||
extern int cls##_check[check_sizeof< cls, size >::value];
|
|
||||||
#else
|
#else
|
||||||
#define CHECK_SIZEOF(cls, size)
|
#define CHECK_SIZEOF(cls, size)
|
||||||
#endif
|
#endif
|
|
@ -142,7 +142,8 @@ static inline int __fpclassifyd(double x) {
|
||||||
return FP_NORMAL;
|
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 isnormal(x) (fpclassify(x) == FP_NORMAL)
|
||||||
#define isnan(x) (fpclassify(x) == FP_NAN)
|
#define isnan(x) (fpclassify(x) == FP_NAN)
|
||||||
#define isinf(x) (fpclassify(x) == FP_INFINITE)
|
#define isinf(x) (fpclassify(x) == FP_INFINITE)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef _STDIO_H_
|
#ifndef _STDIO_H_
|
||||||
#define _STDIO_H_
|
#define _STDIO_H_
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -46,7 +46,9 @@ void AIStartDMA() { __DSPRegs[27] |= 0x8000; }
|
||||||
|
|
||||||
void AIStopDMA(void) { __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 AIRegisterStreamCallback(AISCallback callback) {
|
||||||
AISCallback ret;
|
AISCallback ret;
|
||||||
|
@ -157,7 +159,9 @@ void AISetStreamVolLeft(u8 volume) { __AIRegs[1] = (__AIRegs[1] & ~0xFF) | (volu
|
||||||
|
|
||||||
u8 AIGetStreamVolLeft() { return __AIRegs[1]; }
|
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; }
|
u8 AIGetStreamVolRight() { return __AIRegs[1] >> 8; }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
#include <dolphin/CARDPriv.h>
|
#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];
|
CARDControl __CARDBlock[2];
|
||||||
DVDDiskID __CARDDiskNone;
|
DVDDiskID __CARDDiskNone;
|
||||||
|
@ -73,7 +74,8 @@ void __CARDExiHandler(s32 chan, OSContext* context) {
|
||||||
goto error;
|
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);
|
result = Retry(chan);
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -203,7 +205,8 @@ static void SetupTimeoutAlarm(CARDControl* card) {
|
||||||
break;
|
break;
|
||||||
case 0xF4:
|
case 0xF4:
|
||||||
case 0xF1:
|
case 0xF1:
|
||||||
OSSetAlarm(&card->alarm, OSSecondsToTicks((OSTime)2) * (card->sectorSize / 0x2000), TimeoutHandler);
|
OSSetAlarm(&card->alarm, OSSecondsToTicks((OSTime)2) * (card->sectorSize / 0x2000),
|
||||||
|
TimeoutHandler);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +228,8 @@ static s32 Retry(s32 chan) {
|
||||||
return CARD_RESULT_NOCARD;
|
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);
|
EXIDeselect(chan);
|
||||||
EXIUnlock(chan);
|
EXIUnlock(chan);
|
||||||
return CARD_RESULT_NOCARD;
|
return CARD_RESULT_NOCARD;
|
||||||
|
@ -237,7 +241,8 @@ static s32 Retry(s32 chan) {
|
||||||
return CARD_RESULT_READY;
|
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);
|
EXIDeselect(chan);
|
||||||
EXIUnlock(chan);
|
EXIUnlock(chan);
|
||||||
return CARD_RESULT_NOCARD;
|
return CARD_RESULT_NOCARD;
|
||||||
|
@ -347,7 +352,8 @@ s32 __CARDReadSegment(s32 chan, CARDCallback callback) {
|
||||||
result = CARD_RESULT_READY;
|
result = CARD_RESULT_READY;
|
||||||
} else if (result >= 0) {
|
} else if (result >= 0) {
|
||||||
if (!EXIImmEx(chan, card->cmd, card->cmdlen, 1) ||
|
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)) {
|
!EXIDma(chan, card->buffer, 512, card->mode, __CARDTxHandler)) {
|
||||||
card->txCallback = 0;
|
card->txCallback = 0;
|
||||||
EXIDeselect(chan);
|
EXIDeselect(chan);
|
||||||
|
@ -378,7 +384,8 @@ s32 __CARDWritePage(s32 chan, CARDCallback callback) {
|
||||||
if (result == CARD_RESULT_BUSY) {
|
if (result == CARD_RESULT_BUSY) {
|
||||||
result = CARD_RESULT_READY;
|
result = CARD_RESULT_READY;
|
||||||
} else if (result >= 0) {
|
} 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;
|
card->exiCallback = 0;
|
||||||
EXIDeselect(chan);
|
EXIDeselect(chan);
|
||||||
EXIUnlock(chan);
|
EXIUnlock(chan);
|
||||||
|
|
|
@ -154,5 +154,6 @@ s32 __CARDUpdateFatBlock(s32 chan, u16* fat, CARDCallback callback) {
|
||||||
DCStoreRange(fat, 0x2000);
|
DCStoreRange(fat, 0x2000);
|
||||||
card->eraseCallback = callback;
|
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++) {
|
for (i = 0; i < 2; i++) {
|
||||||
fatp = fat[i] = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
|
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) {
|
if (fatp[CARD_FAT_CHECKSUM] != checkSum || fatp[CARD_FAT_CHECKSUMINV] != checkSumInv) {
|
||||||
++errors;
|
++errors;
|
||||||
current = i;
|
current = i;
|
||||||
|
@ -282,8 +283,8 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) {
|
||||||
updateOrphan = TRUE;
|
updateOrphan = TRUE;
|
||||||
}
|
}
|
||||||
if (updateOrphan) {
|
if (updateOrphan) {
|
||||||
__CARDCheckSum(&card->currentFat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &card->currentFat[CARD_FAT_CHECKSUM],
|
__CARDCheckSum(&card->currentFat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32),
|
||||||
&card->currentFat[CARD_FAT_CHECKSUMINV]);
|
&card->currentFat[CARD_FAT_CHECKSUM], &card->currentFat[CARD_FAT_CHECKSUMINV]);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(fat[currentFat ^ 1], fat[currentFat], CARD_SYSTEM_BLOCK_SIZE);
|
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;
|
CARDControl* card;
|
||||||
CARDDir* dir;
|
CARDDir* dir;
|
||||||
CARDDir* ent;
|
CARDDir* ent;
|
||||||
|
@ -82,7 +83,8 @@ s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* file
|
||||||
freeNo = fileNo;
|
freeNo = fileNo;
|
||||||
}
|
}
|
||||||
} else if (memcmp(ent->gameName, card->diskID->gameName, sizeof(ent->gameName)) == 0 &&
|
} 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);
|
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) {
|
} else if (card->formatStep < 2 * CARD_NUM_SYSTEM_BLOCK) {
|
||||||
int step = card->formatStep - 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),
|
result = __CARDWrite(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE,
|
||||||
FormatCallback);
|
(u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), FormatCallback);
|
||||||
if (result >= 0) {
|
if (result >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
card->currentDir = (CARDDir*)((u8*)card->workArea + (1 + 0) * CARD_SYSTEM_BLOCK_SIZE);
|
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);
|
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:
|
error:
|
||||||
|
@ -96,7 +98,8 @@ s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) {
|
||||||
memset(dir, 0xff, CARD_SYSTEM_BLOCK_SIZE);
|
memset(dir, 0xff, CARD_SYSTEM_BLOCK_SIZE);
|
||||||
check = __CARDGetDirCheck(dir);
|
check = __CARDGetDirCheck(dir);
|
||||||
check->checkCode = i;
|
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++) {
|
for (i = 0; i < 2; i++) {
|
||||||
fat = (u16*)((u8*)card->workArea + (3 + i) * CARD_SYSTEM_BLOCK_SIZE);
|
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_CHECKCODE] = (u16)i;
|
||||||
fat[CARD_FAT_FREEBLOCKS] = (u16)(card->cBlock - CARD_NUM_SYSTEM_BLOCK);
|
fat[CARD_FAT_FREEBLOCKS] = (u16)(card->cBlock - CARD_NUM_SYSTEM_BLOCK);
|
||||||
fat[CARD_FAT_LASTSLOT] = CARD_NUM_SYSTEM_BLOCK - 1;
|
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;
|
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
|
||||||
|
@ -118,4 +122,6 @@ s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) {
|
||||||
return result;
|
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;
|
step = card->mountStep - 2;
|
||||||
result = __CARDRead(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, (u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step),
|
result = __CARDRead(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE,
|
||||||
__CARDMountCallback);
|
(u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), __CARDMountCallback);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
__CARDPutControlBlock(card, result);
|
__CARDPutControlBlock(card, result);
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,8 @@ void __CARDMountCallback(s32 chan, s32 result) {
|
||||||
callback(chan, 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;
|
CARDControl* card;
|
||||||
BOOL enabled;
|
BOOL enabled;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ s32 CARDGetSerialNo(s32 chan, u64* serialNo) {
|
||||||
u64 code;
|
u64 code;
|
||||||
s32 result;
|
s32 result;
|
||||||
|
|
||||||
|
|
||||||
if (!(0 <= chan && chan < 2)) {
|
if (!(0 <= chan && chan < 2)) {
|
||||||
return CARD_RESULT_FATAL_ERROR;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ s32 __CARDAccess(CARDControl* card, CARDDir* ent) {
|
||||||
return CARD_RESULT_NOFILE;
|
return CARD_RESULT_NOFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card->diskID == &__CARDDiskNone ||
|
if (card->diskID == &__CARDDiskNone || (memcmp(ent->gameName, card->diskID->gameName, 4) == 0 &&
|
||||||
(memcmp(ent->gameName, card->diskID->gameName, 4) == 0 && memcmp(ent->company, card->diskID->company, 2) == 0)) {
|
memcmp(ent->company, card->diskID->company, 2) == 0)) {
|
||||||
return CARD_RESULT_READY;
|
return CARD_RESULT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,4 @@ s32 CARDClose(CARDFileInfo* fileInfo) {
|
||||||
return __CARDPutControlBlock(card, CARD_RESULT_READY);
|
return __CARDPutControlBlock(card, CARD_RESULT_READY);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL __CARDIsOpened(CARDControl* card, s32 fileNo) {
|
BOOL __CARDIsOpened(CARDControl* card, s32 fileNo) { return FALSE; }
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,13 +17,15 @@ s32 __CARDSeek(CARDFileInfo* fileInfo, s32 length, s32 offset, CARDControl** pca
|
||||||
return result;
|
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);
|
return __CARDPutControlBlock(card, CARD_RESULT_FATAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = __CARDGetDirBlock(card);
|
dir = __CARDGetDirBlock(card);
|
||||||
ent = &dir[fileInfo->fileNo];
|
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);
|
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,
|
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) {
|
if (result < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +101,8 @@ error:
|
||||||
callback(chan, result);
|
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;
|
CARDControl* card;
|
||||||
s32 result;
|
s32 result;
|
||||||
CARDDir* dir;
|
CARDDir* dir;
|
||||||
|
@ -128,7 +132,8 @@ s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CAR
|
||||||
|
|
||||||
offset = (s32)OFFSET(fileInfo->offset, card->sectorSize);
|
offset = (s32)OFFSET(fileInfo->offset, card->sectorSize);
|
||||||
length = (length < card->sectorSize - offset) ? length : card->sectorSize - offset;
|
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) {
|
if (result < 0) {
|
||||||
__CARDPutControlBlock(card, result);
|
__CARDPutControlBlock(card, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,8 +106,10 @@ s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callba
|
||||||
CARDDir* ent;
|
CARDDir* ent;
|
||||||
s32 result;
|
s32 result;
|
||||||
|
|
||||||
if (fileNo < 0 || CARD_MAX_FILE <= fileNo || (stat->iconAddr != 0xffffffff && CARD_READ_SIZE <= stat->iconAddr) ||
|
if (fileNo < 0 || CARD_MAX_FILE <= fileNo ||
|
||||||
(stat->commentAddr != 0xffffffff && CARD_SYSTEM_BLOCK_SIZE - CARD_COMMENT_SIZE < stat->commentAddr % CARD_SYSTEM_BLOCK_SIZE)) {
|
(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;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
result = __CARDGetControlBlock(chan, &card);
|
result = __CARDGetControlBlock(chan, &card);
|
||||||
|
|
|
@ -9,22 +9,28 @@ static void InitCallback(void* task);
|
||||||
static void DoneCallback(void* task);
|
static void DoneCallback(void* task);
|
||||||
|
|
||||||
static u8 CardData[] ATTRIBUTE_ALIGN(32) = {
|
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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21,
|
||||||
0x00, 0x88, 0xFF, 0xFF, 0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00, 0x8B, 0xFF, 0xFF, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x88,
|
0x13, 0x06, 0x12, 0x03, 0x12, 0x04, 0x13, 0x05, 0x00, 0x92, 0x00, 0xFF, 0x00, 0x88, 0xFF, 0xFF,
|
||||||
0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x00, 0x16, 0xFB, 0x00, 0x01, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x03, 0x80, 0xFF, 0x00,
|
0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00, 0x8B, 0xFF, 0xFF, 0x8F, 0x00, 0x02, 0xBF,
|
||||||
0x02, 0x94, 0x00, 0x27, 0x02, 0xBF, 0x00, 0x8E, 0x1F, 0xDF, 0x24, 0xFF, 0x02, 0x40, 0x0F, 0xFF, 0x00, 0x98, 0x04, 0x00, 0x00, 0x9A,
|
0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x00, 0x16, 0xFB, 0x00, 0x01, 0x02, 0xBF,
|
||||||
0x00, 0x10, 0x00, 0x99, 0x00, 0x00, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x94, 0x02, 0xBF, 0x86, 0x44, 0x02, 0xBF, 0x00, 0x88, 0x16, 0xFC,
|
0x00, 0x8E, 0x25, 0xFF, 0x03, 0x80, 0xFF, 0x00, 0x02, 0x94, 0x00, 0x27, 0x02, 0xBF, 0x00, 0x8E,
|
||||||
0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x03, 0x16, 0xFB, 0x00, 0x01, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x03, 0x80, 0xCD, 0xD1, 0x02, 0x94,
|
0x1F, 0xDF, 0x24, 0xFF, 0x02, 0x40, 0x0F, 0xFF, 0x00, 0x98, 0x04, 0x00, 0x00, 0x9A, 0x00, 0x10,
|
||||||
0x00, 0x48, 0x27, 0xFF, 0x03, 0x80, 0x00, 0x01, 0x02, 0x95, 0x00, 0x5A, 0x03, 0x80, 0x00, 0x02, 0x02, 0x95, 0x80, 0x00, 0x02, 0x9F,
|
0x00, 0x99, 0x00, 0x00, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x94, 0x02, 0xBF, 0x86, 0x44, 0x02, 0xBF,
|
||||||
0x00, 0x48, 0x00, 0x21, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E,
|
0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x03, 0x16, 0xFB, 0x00, 0x01, 0x8F, 0x00,
|
||||||
0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC5, 0xFF, 0xFF, 0x03, 0x40, 0x0F, 0xFF, 0x1C, 0x9F, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC7,
|
0x02, 0xBF, 0x00, 0x8E, 0x03, 0x80, 0xCD, 0xD1, 0x02, 0x94, 0x00, 0x48, 0x27, 0xFF, 0x03, 0x80,
|
||||||
0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC6, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC0, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E,
|
0x00, 0x01, 0x02, 0x95, 0x00, 0x5A, 0x03, 0x80, 0x00, 0x02, 0x02, 0x95, 0x80, 0x00, 0x02, 0x9F,
|
||||||
0x20, 0xFF, 0x03, 0x40, 0x0F, 0xFF, 0x1F, 0x5F, 0x02, 0xBF, 0x00, 0x8E, 0x21, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x23, 0xFF, 0x12, 0x05,
|
0x00, 0x48, 0x00, 0x21, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E,
|
||||||
0x12, 0x06, 0x02, 0x9F, 0x80, 0xB5, 0x00, 0x21, 0x27, 0xFC, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9D, 0x00, 0x88, 0x02, 0xDF, 0x27, 0xFE,
|
0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC5, 0xFF, 0xFF,
|
||||||
0x03, 0xC0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x8E, 0x02, 0xDF, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xF8, 0xFF, 0xCD, 0x00, 0xF9, 0xFF, 0xC9,
|
0x03, 0x40, 0x0F, 0xFF, 0x1C, 0x9F, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC7, 0xFF, 0xFF, 0x02, 0xBF,
|
||||||
0x00, 0xFA, 0xFF, 0xCB, 0x26, 0xC9, 0x02, 0xC0, 0x00, 0x04, 0x02, 0x9D, 0x00, 0x9C, 0x02, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x8E, 0x00, 0xC6, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC0, 0xFF, 0xFF, 0x02, 0xBF,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
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 {
|
typedef struct DecodeParameters {
|
||||||
|
|
|
@ -68,7 +68,8 @@ static void EraseCallback(s32 chan, s32 result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fileInfo = card->fileInfo;
|
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) {
|
if (result < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,8 @@ error:
|
||||||
callback(chan, result);
|
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;
|
CARDControl* card;
|
||||||
s32 result;
|
s32 result;
|
||||||
CARDDir* dir;
|
CARDDir* dir;
|
||||||
|
@ -106,7 +108,8 @@ s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* buf, s32 length, s32 offs
|
||||||
DCStoreRange((void*)buf, (u32)length);
|
DCStoreRange((void*)buf, (u32)length);
|
||||||
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
|
card->apiCallback = callback ? callback : __CARDDefaultApiCallback;
|
||||||
card->buffer = (void*)buf;
|
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) {
|
if (result < 0) {
|
||||||
__CARDPutControlBlock(card, result);
|
__CARDPutControlBlock(card, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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;
|
static s32 __DSP_init_flag = 0;
|
||||||
extern DSPTaskInfo* __DSP_tmp_task;
|
extern DSPTaskInfo* __DSP_tmp_task;
|
||||||
extern DSPTaskInfo* __DSP_last_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_debug_printf(const char* fmt, ...);
|
||||||
extern void __DSP_boot_task(DSPTaskInfo* task);
|
extern void __DSP_boot_task(DSPTaskInfo* task);
|
||||||
|
|
||||||
u32 DSPCheckMailToDSP(void) {
|
u32 DSPCheckMailToDSP(void) { return (__DSPRegs[0] >> 0xF) & 1; }
|
||||||
return (__DSPRegs[0] >> 0xF) & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
u32 DSPCheckMailFromDSP(void) { return (__DSPRegs[2] >> 0xF) & 1; }
|
||||||
u32 DSPCheckMailFromDSP(void) {
|
|
||||||
return (__DSPRegs[2] >> 0xF) & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 DSPReadMailFromDSP() {
|
u32 DSPReadMailFromDSP() {
|
||||||
u16 reg1;
|
u16 reg1;
|
||||||
|
@ -85,9 +81,7 @@ void DSPHalt(void) {
|
||||||
OSRestoreInterrupts(oldInt);
|
OSRestoreInterrupts(oldInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 DSPGetDMAStatus(void) {
|
u32 DSPGetDMAStatus(void) { return __DSPRegs[5] & 0x200; }
|
||||||
return __DSPRegs[5] & 0x200;
|
|
||||||
}
|
|
||||||
|
|
||||||
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) {
|
DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) {
|
||||||
u32 oldInt;
|
u32 oldInt;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
|
||||||
void __DSP_debug_printf(const char* fmt, ...) {
|
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. ");
|
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) {
|
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) {
|
static void cbForStateCheckID2a(u32 intType) {
|
||||||
if (intType == 16) {
|
if (intType == 16) {
|
||||||
|
@ -422,7 +427,9 @@ static void cbForStateCheckID2a(u32 intType) {
|
||||||
DVDLowRequestError(cbForStateGettingError);
|
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) {
|
static void cbForStateCheckID1(u32 intType) {
|
||||||
if (intType == 16) {
|
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) {
|
static void cbForStateCoverClosed(u32 intType) {
|
||||||
if (intType == 16) {
|
if (intType == 16) {
|
||||||
|
@ -632,8 +641,8 @@ static void stateBusy(DVDCommandBlock* block) {
|
||||||
} else {
|
} else {
|
||||||
__DIRegs[1] = __DIRegs[1];
|
__DIRegs[1] = __DIRegs[1];
|
||||||
block->currTransferSize = MIN(block->length - block->transferredSize, 0x80000);
|
block->currTransferSize = MIN(block->length - block->transferredSize, 0x80000);
|
||||||
DVDLowRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize, block->offset + block->transferredSize,
|
DVDLowRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize,
|
||||||
cbForStateBusy);
|
block->offset + block->transferredSize, cbForStateBusy);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -698,7 +707,8 @@ static void stateBusy(DVDCommandBlock* block) {
|
||||||
|
|
||||||
static u32 ImmCommand[] = {0xffffffff, 0xffffffff, 0xffffffff};
|
static u32 ImmCommand[] = {0xffffffff, 0xffffffff, 0xffffffff};
|
||||||
/* Somehow this got included even though the function is stripped? O.o */
|
/* 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};
|
static u32 DmaCommand[] = {0xffffffff};
|
||||||
|
|
||||||
inline static BOOL IsImmCommandWithResult(u32 command) {
|
inline static BOOL IsImmCommandWithResult(u32 command) {
|
||||||
|
@ -883,7 +893,8 @@ static BOOL issueCommand(s32 prio, DVDCommandBlock* block) {
|
||||||
BOOL level;
|
BOOL level;
|
||||||
BOOL result;
|
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);
|
DCInvalidateRange(block->addr, block->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -901,7 +912,8 @@ static BOOL issueCommand(s32 prio, DVDCommandBlock* block) {
|
||||||
return result;
|
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;
|
BOOL idle;
|
||||||
block->command = 1;
|
block->command = 1;
|
||||||
block->addr = addr;
|
block->addr = addr;
|
||||||
|
@ -913,7 +925,8 @@ BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, s32 off
|
||||||
idle = issueCommand(prio, block);
|
idle = issueCommand(prio, block);
|
||||||
return idle;
|
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;
|
BOOL idle;
|
||||||
block->command = 4;
|
block->command = 4;
|
||||||
block->addr = addr;
|
block->addr = addr;
|
||||||
|
@ -938,7 +951,8 @@ BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCBCallback call
|
||||||
idle = issueCommand(2, block);
|
idle = issueCommand(2, block);
|
||||||
return idle;
|
return idle;
|
||||||
}
|
}
|
||||||
BOOL DVDPrepareStreamAbsAsync(DVDCommandBlock* block, u32 length, u32 offset, DVDCBCallback callback) {
|
BOOL DVDPrepareStreamAbsAsync(DVDCommandBlock* block, u32 length, u32 offset,
|
||||||
|
DVDCBCallback callback) {
|
||||||
BOOL idle;
|
BOOL idle;
|
||||||
block->command = 6;
|
block->command = 6;
|
||||||
block->length = length;
|
block->length = length;
|
||||||
|
@ -1239,7 +1253,9 @@ s32 DVDCancel(DVDCommandBlock* block) {
|
||||||
return 0;
|
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) {
|
inline BOOL DVDCancelAllAsync(DVDCBCallback callback) {
|
||||||
BOOL enabled;
|
BOOL enabled;
|
||||||
|
|
|
@ -17,12 +17,12 @@ typedef struct OSResetQueue {
|
||||||
OSResetFunctionInfo* last;
|
OSResetFunctionInfo* last;
|
||||||
} OSResetQueue;
|
} OSResetQueue;
|
||||||
|
|
||||||
|
|
||||||
void OSRegisterResetFunction(OSResetFunctionInfo* func) {
|
void OSRegisterResetFunction(OSResetFunctionInfo* func) {
|
||||||
OSResetFunctionInfo* tmp;
|
OSResetFunctionInfo* tmp;
|
||||||
OSResetFunctionInfo* iter;
|
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) {
|
if (iter == NULL) {
|
||||||
tmp = ResetFunctionQueue.last;
|
tmp = ResetFunctionQueue.last;
|
||||||
|
@ -64,6 +64,7 @@ s32 __OSCallResetFunctions(s32 arg0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
asm void Reset(register s32 resetCode) {
|
asm void Reset(register s32 resetCode) {
|
||||||
|
// clang-format off
|
||||||
nofralloc
|
nofralloc
|
||||||
b lbl_8038315C
|
b lbl_8038315C
|
||||||
lbl_80383140:
|
lbl_80383140:
|
||||||
|
@ -102,6 +103,7 @@ lbl_803831A0:
|
||||||
b lbl_803831A0
|
b lbl_803831A0
|
||||||
lbl_803831A8:
|
lbl_803831A8:
|
||||||
b lbl_80383140
|
b lbl_80383140
|
||||||
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
void __OSDoHotReset(s32 arg0) {
|
void __OSDoHotReset(s32 arg0) {
|
||||||
|
@ -111,9 +113,7 @@ void __OSDoHotReset(s32 arg0) {
|
||||||
Reset(arg0 * 8);
|
Reset(arg0 * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu) {
|
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 OSGetResetCode(void) {
|
u32 OSGetResetCode(void) {
|
||||||
if (DAT_800030e2 != 0) {
|
if (DAT_800030e2 != 0) {
|
||||||
|
|
|
@ -127,8 +127,7 @@ asm static void __init_registers(void) {
|
||||||
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[];
|
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[];
|
||||||
__declspec(section ".init") extern __bss_init_info _bss_init_info[];
|
__declspec(section ".init") extern __bss_init_info _bss_init_info[];
|
||||||
|
|
||||||
inline static void __copy_rom_section(void* dst, const void* src,
|
inline static void __copy_rom_section(void* dst, const void* src, unsigned long size) {
|
||||||
unsigned long size) {
|
|
||||||
if (size && (dst != src)) {
|
if (size && (dst != src)) {
|
||||||
memcpy(dst, src, size);
|
memcpy(dst, src, size);
|
||||||
__flush_cache(dst, size);
|
__flush_cache(dst, size);
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
#include "Kyoto/Basics/COsContext.hpp"
|
#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,
|
IAllocator::SMetrics::SMetrics(uint heapSize, uint unk1, uint unk2, uint unk3, uint unk4,
|
||||||
uint unk9, uint smallAllocNumAllocs, uint smallAllocAllocatedSize, uint smallAllocRemainingSize,
|
uint heapSize2, uint unk5, uint unk6, uint unk7, uint unk8,
|
||||||
uint mediumAllocNumAllocs, uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable, uint unk10, uint unk11,
|
uint unk9, uint smallAllocNumAllocs, uint smallAllocAllocatedSize,
|
||||||
uint unk12, uint mediumAllocTotalAllocated, uint fakeStatics)
|
uint smallAllocRemainingSize, uint mediumAllocNumAllocs,
|
||||||
|
uint mediumAllocAllocatedSize, uint mediumAllocBlocksAvailable,
|
||||||
|
uint unk10, uint unk11, uint unk12, uint mediumAllocTotalAllocated,
|
||||||
|
uint fakeStatics)
|
||||||
: x0_heapSize(heapSize)
|
: x0_heapSize(heapSize)
|
||||||
, x4_(unk1)
|
, x4_(unk1)
|
||||||
, x8_(unk2)
|
, x8_(unk2)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include <Kyoto/Audio/CSfxHandle.hpp>
|
#include <Kyoto/Audio/CSfxHandle.hpp>
|
||||||
|
|
||||||
uint CSfxHandle::mRefCount = 0;
|
uint CSfxHandle::mRefCount = 0;
|
||||||
CSfxHandle::CSfxHandle(uint value) : mID((++mRefCount << 14) | (value & 0xFFF)) {
|
CSfxHandle::CSfxHandle(uint value) : mID((++mRefCount << 14) | (value & 0xFFF)) {}
|
||||||
}
|
|
||||||
|
|
|
@ -1,35 +1,38 @@
|
||||||
#include "Kyoto/CCrc32.hpp"
|
#include "Kyoto/CCrc32.hpp"
|
||||||
|
|
||||||
static const uint gkCRC32Table[256] = {
|
static const uint gkCRC32Table[256] = {
|
||||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832,
|
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
||||||
0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
|
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
|
||||||
0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A,
|
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
||||||
0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
|
||||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,
|
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
|
||||||
0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
|
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
||||||
0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB,
|
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
|
||||||
0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
|
||||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4,
|
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
||||||
0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
|
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
|
||||||
0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074,
|
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
|
||||||
0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
||||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525,
|
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
|
||||||
0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
|
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
|
||||||
0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,
|
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
||||||
0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
|
||||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76,
|
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
|
||||||
0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
|
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
||||||
0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6,
|
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
|
||||||
0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
|
||||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7,
|
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
||||||
0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
|
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
|
||||||
0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7,
|
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
|
||||||
0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
||||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,
|
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
|
||||||
0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
|
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
|
||||||
0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330,
|
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
||||||
0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
|
||||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
|
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 CCRC32::Calculate(const void* data, uint length) {
|
||||||
|
@ -38,5 +41,6 @@ uint CCRC32::Calculate(const void* data, uint length) {
|
||||||
while ((length--) > 0) {
|
while ((length--) > 0) {
|
||||||
checksum = (checksum >> 8) ^ gkCRC32Table[(checksum ^ *(buf++)) & 0xFF];
|
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/Alloc/CMemory.hpp>
|
||||||
|
#include <Kyoto/CTimeProvider.hpp>
|
||||||
#include <Kyoto/Graphics/CGraphics.hpp>
|
#include <Kyoto/Graphics/CGraphics.hpp>
|
||||||
|
|
||||||
CTimeProvider* CTimeProvider::gCurrentTimeProvider = nullptr;
|
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) {
|
if (x8_lastProvider != nullptr) {
|
||||||
x8_lastProvider->x4_first = false;
|
x8_lastProvider->x4_first = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,25 +7,30 @@
|
||||||
#include <dolphin/mtx.h>
|
#include <dolphin/mtx.h>
|
||||||
|
|
||||||
inline void CGX::SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) {
|
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) |
|
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) |
|
||||||
MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17);
|
MaskAndShiftLeft(op, 7, 11) | MaskAndShiftLeft(comp1, 7, 14) |
|
||||||
|
MaskAndShiftLeft(ref1, 0xFF, 17);
|
||||||
if (sGXState.x248_alphaCompare != flags) {
|
if (sGXState.x248_alphaCompare != flags) {
|
||||||
sGXState.x248_alphaCompare = flags;
|
sGXState.x248_alphaCompare = flags;
|
||||||
GXSetAlphaCompare(comp0, ref0, op, comp1, ref1);
|
GXSetAlphaCompare(comp0, ref0, op, comp1, ref1);
|
||||||
GXSetZCompLoc(comp0 == GX_ALWAYS);
|
GXSetZCompLoc(comp0 == GX_ALWAYS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op) {
|
inline void CGX::SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac,
|
||||||
uint flags = MaskAndShiftLeft(mode, 3, 0) | MaskAndShiftLeft(srcFac, 7, 2) | MaskAndShiftLeft(dstFac, 7, 5) | MaskAndShiftLeft(op, 0xF, 8);
|
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) {
|
if (flags != sGXState.x56_blendMode) {
|
||||||
update_fog(flags);
|
update_fog(flags);
|
||||||
sGXState.x56_blendMode = flags;
|
sGXState.x56_blendMode = flags;
|
||||||
GXSetBlendMode(mode, srcFac, dstFac, op);
|
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];
|
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) {
|
if (state.x14_tevOrderFlags != flags) {
|
||||||
state.x14_tevOrderFlags = flags;
|
state.x14_tevOrderFlags = flags;
|
||||||
GXSetTevOrder(stageId, texCoord, texMap, color);
|
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);
|
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 GXTevStageID stage = static_cast< GXTevStageID >(tevCur);
|
||||||
const uint colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]);
|
const uint colorArgs = shadowMapsEnabled ? 0x7a04f : SBig(materialDataCur[0]);
|
||||||
const uint alphaArgs = SBig(materialDataCur[1]);
|
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 tmtcFlags = SBig(*texMapTexCoordFlags);
|
||||||
uint matFlags = SBig(materialDataCur[4]);
|
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));
|
static_cast< GXChannelID >(matFlags & 0xFF));
|
||||||
CGX::SetTevKColorSel(stage, static_cast< GXTevKColorSel >(matFlags >> 0x8 & 0xFF));
|
CGX::SetTevKColorSel(stage, static_cast< GXTevKColorSel >(matFlags >> 0x8 & 0xFF));
|
||||||
CGX::SetTevKAlphaSel(stage, static_cast< GXTevKAlphaSel >(matFlags >> 0x10 & 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);
|
const f32* params = reinterpret_cast< const f32* >(uvAnim + 1);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0: {
|
case 0: {
|
||||||
CTransform4f xf = CGraphics::GetViewMatrix().GetQuickInverse().MultiplyIgnoreTranslation(CGraphics::GetModelMatrix());
|
CTransform4f xf = CGraphics::GetViewMatrix().GetQuickInverse().MultiplyIgnoreTranslation(
|
||||||
|
CGraphics::GetModelMatrix());
|
||||||
xf.SetTranslation(CVector3f::Zero());
|
xf.SetTranslation(CVector3f::Zero());
|
||||||
CGX::LoadTexMtxImm(xf.GetCStyleMatrix(), texMtx, GX_MTX3x4);
|
CGX::LoadTexMtxImm(xf.GetCStyleMatrix(), texMtx, GX_MTX3x4);
|
||||||
CGX::LoadTexMtxImm(postMtx, ptTexMtx, 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},
|
{0.f, 0.f, 0.f, 1.f},
|
||||||
};
|
};
|
||||||
const CTransform4f& vm = CGraphics::GetViewMatrix();
|
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 v = SBig(params[0]) / 2.f;
|
||||||
f32 v03 = 0.025f * (vm.Get03() + vm.Get13()) * SBig(params[1]);
|
f32 v03 = 0.025f * (vm.Get03() + vm.Get13()) * SBig(params[1]);
|
||||||
f32 v13 = 0.05f * vm.Get23() * 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,
|
void CGX::SetChanCtrl(EChannelId channel, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc,
|
||||||
GXAttnFn attnFn) {
|
GXLightID lights, GXDiffuseFn diffFn, GXAttnFn attnFn) {
|
||||||
u16& state = sGXState.x34_chanCtrls[channel];
|
u16& state = sGXState.x34_chanCtrls[channel];
|
||||||
u16 prevFlags = sGXState.x30_prevChanCtrls[channel];
|
u16 prevFlags = sGXState.x30_prevChanCtrls[channel];
|
||||||
if (lights == GX_LIGHT_NULL) {
|
if (lights == GX_LIGHT_NULL) {
|
||||||
enable = GX_FALSE;
|
enable = GX_FALSE;
|
||||||
}
|
}
|
||||||
uint flags = MaskAndShiftLeft(enable, 1, 0) | MaskAndShiftLeft(ambSrc, 1, 1) | MaskAndShiftLeft(matSrc, 1, 2) |
|
uint flags = MaskAndShiftLeft(enable, 1, 0) | MaskAndShiftLeft(ambSrc, 1, 1) |
|
||||||
MaskAndShiftLeft(lights, 0xFF, 3) | MaskAndShiftLeft(diffFn, 3, 11) | MaskAndShiftLeft(attnFn, 3, 13);
|
MaskAndShiftLeft(matSrc, 1, 2) | MaskAndShiftLeft(lights, 0xFF, 3) |
|
||||||
|
MaskAndShiftLeft(diffFn, 3, 11) | MaskAndShiftLeft(attnFn, 3, 13);
|
||||||
state = flags;
|
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) {
|
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) {
|
void CGX::SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
|
||||||
uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15);
|
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];
|
STevState& state = sGXState.x68_tevStates[stageId];
|
||||||
if (flags != state.x0_colorInArgs) {
|
if (flags != state.x0_colorInArgs) {
|
||||||
state.x0_colorInArgs = flags;
|
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) {
|
void CGX::SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c,
|
||||||
uint flags = MaskAndShiftLeft(a, 0x1F, 0) | MaskAndShiftLeft(b, 0x1F, 5) | MaskAndShiftLeft(c, 0x1F, 10) | MaskAndShiftLeft(d, 0x1F, 15);
|
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];
|
STevState& state = sGXState.x68_tevStates[stageId];
|
||||||
if (flags != state.x4_alphaInArgs) {
|
if (flags != state.x4_alphaInArgs) {
|
||||||
state.x4_alphaInArgs = flags;
|
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) {
|
void CGX::SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale,
|
||||||
uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) |
|
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);
|
MaskAndShiftLeft(outReg, 3, 9);
|
||||||
STevState& state = sGXState.x68_tevStates[stageId];
|
STevState& state = sGXState.x68_tevStates[stageId];
|
||||||
if (flags != state.x8_colorOps) {
|
if (flags != state.x8_colorOps) {
|
||||||
|
@ -101,13 +109,17 @@ void CGX::SetTevColorOp_Compressed(GXTevStageID stageId, uint flags) {
|
||||||
if (flags != state.x8_colorOps) {
|
if (flags != state.x8_colorOps) {
|
||||||
state.x8_colorOps = flags;
|
state.x8_colorOps = flags;
|
||||||
GXSetTevColorOp(stageId, static_cast< GXTevOp >(ShiftRightAndMask(flags, 0xF, 0)),
|
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< GXTevBias >(ShiftRightAndMask(flags, 3, 4)),
|
||||||
static_cast< GXBool >(ShiftRightAndMask(flags, 1, 8)), static_cast< GXTevRegID >(ShiftRightAndMask(flags, 3, 9)));
|
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) {
|
void CGX::SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale,
|
||||||
uint flags = MaskAndShiftLeft(op, 0xF, 0) | MaskAndShiftLeft(bias, 3, 4) | MaskAndShiftLeft(scale, 3, 6) | MaskAndShiftLeft(clamp, 1, 8) |
|
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);
|
MaskAndShiftLeft(outReg, 3, 9);
|
||||||
STevState& state = sGXState.x68_tevStates[stageId];
|
STevState& state = sGXState.x68_tevStates[stageId];
|
||||||
if (flags != state.xc_alphaOps) {
|
if (flags != state.xc_alphaOps) {
|
||||||
|
@ -121,8 +133,10 @@ void CGX::SetTevAlphaOp_Compressed(GXTevStageID stageId, uint flags) {
|
||||||
if (flags != state.xc_alphaOps) {
|
if (flags != state.xc_alphaOps) {
|
||||||
state.xc_alphaOps = flags;
|
state.xc_alphaOps = flags;
|
||||||
GXSetTevAlphaOp(stageId, static_cast< GXTevOp >(ShiftRightAndMask(flags, 0xF, 0)),
|
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< GXTevBias >(ShiftRightAndMask(flags, 3, 4)),
|
||||||
static_cast< GXBool >(ShiftRightAndMask(flags, 1, 8)), static_cast< GXTevRegID >(ShiftRightAndMask(flags, 3, 9)));
|
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];
|
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) {
|
if (state.x14_tevOrderFlags != flags) {
|
||||||
state.x14_tevOrderFlags = flags;
|
state.x14_tevOrderFlags = flags;
|
||||||
GXSetTevOrder(stageId, texCoord, texMap, color);
|
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) {
|
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) {
|
if (flags != sGXState.x56_blendMode) {
|
||||||
update_fog(flags);
|
update_fog(flags);
|
||||||
sGXState.x56_blendMode = 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) {
|
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) |
|
uint flags = MaskAndShiftLeft(comp0, 7, 0) | MaskAndShiftLeft(ref0, 0xFF, 3) |
|
||||||
MaskAndShiftLeft(comp1, 7, 14) | MaskAndShiftLeft(ref1, 0xFF, 17);
|
MaskAndShiftLeft(op, 7, 11) | MaskAndShiftLeft(comp1, 7, 14) |
|
||||||
|
MaskAndShiftLeft(ref1, 0xFF, 17);
|
||||||
if (sGXState.x248_alphaCompare != flags) {
|
if (sGXState.x248_alphaCompare != flags) {
|
||||||
sGXState.x248_alphaCompare = flags;
|
sGXState.x248_alphaCompare = flags;
|
||||||
GXSetAlphaCompare(comp0, ref0, op, comp1, ref1);
|
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,
|
void CGX::SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt,
|
||||||
GXIndTexWrap wrapS, GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod, GXIndTexAlphaSel alphaSel) {
|
GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS,
|
||||||
|
GXIndTexWrap wrapT, GXBool addPrev, GXBool indLod,
|
||||||
|
GXIndTexAlphaSel alphaSel) {
|
||||||
STevState& state = sGXState.x68_tevStates[stageId];
|
STevState& state = sGXState.x68_tevStates[stageId];
|
||||||
uint flags = MaskAndShiftLeft(indStage, 3, 0) | MaskAndShiftLeft(fmt, 3, 2) | MaskAndShiftLeft(biasSel, 7, 4) |
|
uint flags = MaskAndShiftLeft(indStage, 3, 0) | MaskAndShiftLeft(fmt, 3, 2) |
|
||||||
MaskAndShiftLeft(mtxSel, 15, 7) | MaskAndShiftLeft(wrapS, 7, 11) | MaskAndShiftLeft(wrapT, 7, 14) |
|
MaskAndShiftLeft(biasSel, 7, 4) | MaskAndShiftLeft(mtxSel, 15, 7) |
|
||||||
MaskAndShiftLeft(addPrev, 1, 17) | MaskAndShiftLeft(indLod, 1, 18) | MaskAndShiftLeft(alphaSel, 3, 19);
|
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) {
|
if (state.x10_indFlags != flags) {
|
||||||
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];
|
STexState& state = sGXState.x228_texStates[dstCoord];
|
||||||
uint vm = (mtx - GX_TEXMTX0) / 3;
|
uint vm = (mtx - GX_TEXMTX0) / 3;
|
||||||
uint vp = postMtx - GX_PTTEXMTX0;
|
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
|
// Similarly to GXTexMtx, this should also be divided by 3
|
||||||
vp /= 3;
|
vp /= 3;
|
||||||
#endif
|
#endif
|
||||||
uint flags = MaskAndShiftLeft(fn, 0xF, 0) | MaskAndShiftLeft(src, 0x1F, 4) | MaskAndShiftLeft(vm, 0x1F, 9) |
|
uint flags = MaskAndShiftLeft(fn, 0xF, 0) | MaskAndShiftLeft(src, 0x1F, 4) |
|
||||||
MaskAndShiftLeft(normalize, 1, 14) | MaskAndShiftLeft(vp, 0x3F, 15);
|
MaskAndShiftLeft(vm, 0x1F, 9) | MaskAndShiftLeft(normalize, 1, 14) |
|
||||||
|
MaskAndShiftLeft(vp, 0x3F, 15);
|
||||||
if (state.x0_coordGen != flags) {
|
if (state.x0_coordGen != flags) {
|
||||||
state.x0_coordGen = flags;
|
state.x0_coordGen = flags;
|
||||||
GXSetTexCoordGen2(dstCoord, fn, src, mtx, normalize, postMtx);
|
GXSetTexCoordGen2(dstCoord, fn, src, mtx, normalize, postMtx);
|
||||||
|
@ -423,7 +448,8 @@ void CGX::SetVtxDescv(const GXVtxDescList* list) {
|
||||||
SetVtxDescv_Compressed(flags);
|
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];
|
STevState& state = sGXState.x68_tevStates[stageId];
|
||||||
if (state.x10_indFlags != 0) {
|
if (state.x10_indFlags != 0) {
|
||||||
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) {
|
if (fogType != nullptr) {
|
||||||
*fogType = static_cast< GXFogType >(sGXState.x53_fogType);
|
*fogType = static_cast< GXFogType >(sGXState.x53_fogType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ void CColor::Get(float& r, float& g, float& b) const {
|
||||||
|
|
||||||
CColor CColor::Lerp(const CColor& a, const CColor& b, float t) {
|
CColor CColor::Lerp(const CColor& a, const CColor& b, float t) {
|
||||||
const float omt = 1.f - t;
|
const float omt = 1.f - t;
|
||||||
return CColor(omt * a.GetRed() + t * b.GetRed(), omt * a.GetGreen() + t * b.GetGreen(), omt * a.GetBlue() + t * b.GetBlue(),
|
return CColor(omt * a.GetRed() + t * b.GetRed(), omt * a.GetGreen() + t * b.GetGreen(),
|
||||||
omt * a.GetAlpha() + t * b.GetAlpha());
|
omt * a.GetBlue() + t * b.GetBlue(), omt * a.GetAlpha() + t * b.GetAlpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint CColor::Lerp(uint a, uint b, float t) {
|
uint CColor::Lerp(uint a, uint b, float t) {
|
||||||
|
@ -68,7 +68,8 @@ uint CColor::Lerp(uint a, uint b, float t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CColor CColor::Modulate(const CColor& a, const CColor& b) {
|
CColor CColor::Modulate(const CColor& a, const CColor& b) {
|
||||||
return CColor((u8)((a.GetRedu8() * b.GetRedu8()) / (u8)255), (a.GetGreenu8() * b.GetGreenu8()) / (u8)255,
|
return CColor(
|
||||||
|
(u8)((a.GetRedu8() * b.GetRedu8()) / (u8)255), (a.GetGreenu8() * b.GetGreenu8()) / (u8)255,
|
||||||
(a.GetBlueu8() * b.GetBlueu8()) / (u8)255, (a.GetAlphau8() * b.GetAlphau8()) / (u8)255);
|
(a.GetBlueu8() * b.GetBlueu8()) / (u8)255, (a.GetAlphau8() * b.GetAlphau8()) / (u8)255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,20 +137,25 @@ void CDolphinController::ProcessAxis(int controller, EJoyAxis axis) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 mButtonMapping[size_t(kBU_MAX)] = {
|
static u16 mButtonMapping[size_t(kBU_MAX)] = {
|
||||||
PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_X, PAD_BUTTON_Y, PAD_BUTTON_START, PAD_TRIGGER_Z,
|
PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_X, PAD_BUTTON_Y,
|
||||||
PAD_BUTTON_UP, PAD_BUTTON_RIGHT, PAD_BUTTON_DOWN, PAD_BUTTON_LEFT, PAD_TRIGGER_L, PAD_TRIGGER_R,
|
PAD_BUTTON_START, PAD_TRIGGER_Z, PAD_BUTTON_UP, PAD_BUTTON_RIGHT,
|
||||||
|
PAD_BUTTON_DOWN, PAD_BUTTON_LEFT, PAD_TRIGGER_L, PAD_TRIGGER_R,
|
||||||
};
|
};
|
||||||
|
|
||||||
void CDolphinController::ProcessButtons(int controller) {
|
void CDolphinController::ProcessButtons(int controller) {
|
||||||
for (s32 i = 0; i < s32(kBU_MAX); ++i) {
|
for (s32 i = 0; i < s32(kBU_MAX); ++i) {
|
||||||
ProcessDigitalButton(controller, x34_gamepadStates[controller].GetButton(EButton(i)), mButtonMapping[i]);
|
ProcessDigitalButton(controller, x34_gamepadStates[controller].GetButton(EButton(i)),
|
||||||
|
mButtonMapping[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessAnalogButton(x4_status[controller].triggerL, x34_gamepadStates[controller].GetAnalogButton(kBA_Left));
|
ProcessAnalogButton(x4_status[controller].triggerL,
|
||||||
ProcessAnalogButton(x4_status[controller].triggerR, x34_gamepadStates[controller].GetAnalogButton(kBA_Right));
|
x34_gamepadStates[controller].GetAnalogButton(kBA_Left));
|
||||||
|
ProcessAnalogButton(x4_status[controller].triggerR,
|
||||||
|
x34_gamepadStates[controller].GetAnalogButton(kBA_Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDolphinController::ProcessDigitalButton(int controller, CControllerButton& button, u16 mapping) {
|
void CDolphinController::ProcessDigitalButton(int controller, CControllerButton& button,
|
||||||
|
u16 mapping) {
|
||||||
bool btnPressed = (x4_status[controller].button & mapping);
|
bool btnPressed = (x4_status[controller].button & mapping);
|
||||||
button.SetPressEvent(PADButtonDown(button.GetIsPressed(), btnPressed));
|
button.SetPressEvent(PADButtonDown(button.GetIsPressed(), btnPressed));
|
||||||
button.SetReleaseEvent(PADButtonUp(button.GetIsPressed(), btnPressed));
|
button.SetReleaseEvent(PADButtonUp(button.GetIsPressed(), btnPressed));
|
||||||
|
@ -174,9 +179,13 @@ void CDolphinController::ProcessAnalogButton(float value, CControllerAxis& axis)
|
||||||
|
|
||||||
uint CDolphinController::GetDeviceCount() const { return 4; }
|
uint CDolphinController::GetDeviceCount() const { return 4; }
|
||||||
|
|
||||||
CControllerGamepadData& CDolphinController::GetGamepadData(int controller) { return x34_gamepadStates[controller]; }
|
CControllerGamepadData& CDolphinController::GetGamepadData(int controller) {
|
||||||
|
return x34_gamepadStates[controller];
|
||||||
|
}
|
||||||
|
|
||||||
uint CDolphinController::GetControllerType(int controller) const { return x1a4_controllerTypes[controller]; }
|
uint CDolphinController::GetControllerType(int controller) const {
|
||||||
|
return x1a4_controllerTypes[controller];
|
||||||
|
}
|
||||||
|
|
||||||
void CDolphinController::SetMotorState(EIOPort port, EMotorState state) {
|
void CDolphinController::SetMotorState(EIOPort port, EMotorState state) {
|
||||||
x194_motorStates[port] = state;
|
x194_motorStates[port] = state;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "Kyoto/Input/IController.hpp"
|
|
||||||
#include "Kyoto/Input/CDolphinController.hpp"
|
|
||||||
#include "Kyoto/Basics/COsContext.hpp"
|
|
||||||
#include "Kyoto/Alloc/CMemory.hpp"
|
#include "Kyoto/Alloc/CMemory.hpp"
|
||||||
|
#include "Kyoto/Basics/COsContext.hpp"
|
||||||
|
#include "Kyoto/Input/CDolphinController.hpp"
|
||||||
|
#include "Kyoto/Input/IController.hpp"
|
||||||
|
|
||||||
const float IController::kAbsoluteMinimum = -1.f;
|
const float IController::kAbsoluteMinimum = -1.f;
|
||||||
const float IController::kAbsoluteMaximum = 1.f;
|
const float IController::kAbsoluteMaximum = 1.f;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership)
|
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len, EOwnerShip ownership)
|
||||||
: CInputStream(ptr, len, ownership == kOS_Owned) {}
|
: CInputStream(ptr, len, ownership == kOS_Owned) {}
|
||||||
|
|
||||||
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len) : CInputStream(ptr, len, false) {}
|
CMemoryInStream::CMemoryInStream(const void* ptr, unsigned long len)
|
||||||
|
: CInputStream(ptr, len, false) {}
|
||||||
|
|
||||||
uint CMemoryInStream::Read(void* dest, uint len) { return 0; }
|
uint CMemoryInStream::Read(void* dest, uint len) { return 0; }
|
||||||
|
|
|
@ -46,4 +46,7 @@ template <>
|
||||||
CFactoryFnReturn::CFactoryFnReturn(CStringTable* ptr)
|
CFactoryFnReturn::CFactoryFnReturn(CStringTable* ptr)
|
||||||
: obj(TToken< CStringTable >::GetIObjObjectFor(rstl::auto_ptr< CStringTable >(ptr)).release()) {}
|
: obj(TToken< CStringTable >::GetIObjObjectFor(rstl::auto_ptr< CStringTable >(ptr)).release()) {}
|
||||||
|
|
||||||
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& xfer) { return new CStringTable(in); }
|
CFactoryFnReturn FStringTableFactory(const SObjectTag& tag, CInputStream& in,
|
||||||
|
const CVParamTransfer& xfer) {
|
||||||
|
return new CStringTable(in);
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue