mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-08 13:46:21 -04:00
match JUTGamePad
This commit is contained in:
+1
-1
@@ -820,7 +820,7 @@ config.libs = [
|
||||
Object(Matching, "JSystem/JUtility/JUTFont.cpp"),
|
||||
Object(Matching, "JSystem/JUtility/JUTResFont.cpp"),
|
||||
Object(Matching, "JSystem/JUtility/JUTDbPrint.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTGamePad.cpp"),
|
||||
Object(Matching, "JSystem/JUtility/JUTGamePad.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTException.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTDirectPrint.cpp"),
|
||||
Object(Matching, "JSystem/JUtility/JUTAssert.cpp"),
|
||||
|
||||
@@ -144,13 +144,19 @@ struct TLinkList : public TNodeLinkList {
|
||||
/* 0x00 */ TNodeLinkList::const_iterator base;
|
||||
};
|
||||
|
||||
static const TLinkListNode* Element_toNode(const T* element) { (void)element; return reinterpret_cast<const TLinkListNode*>(reinterpret_cast<const char*>(element) - I); }
|
||||
static TLinkListNode* Element_toNode(T* element) { (void)element; return reinterpret_cast<TLinkListNode*>(reinterpret_cast<char*>(element) - I); }
|
||||
static const T* Element_toValue(const TLinkListNode* node) { (void)node; return reinterpret_cast<const T*>(reinterpret_cast<const char*>(node) + I); }
|
||||
static T* Element_toValue(TLinkListNode* node) { (void)node; return reinterpret_cast<T*>(reinterpret_cast<char*>(node) + I); }
|
||||
static const TLinkListNode* Element_toNode(const T* element) { return reinterpret_cast<const TLinkListNode*>(reinterpret_cast<const char*>(element) - I); }
|
||||
static TLinkListNode* Element_toNode(T* element) { return reinterpret_cast<TLinkListNode*>(reinterpret_cast<char*>(element) - I); }
|
||||
static const T* Element_toValue(const TLinkListNode* node) { return reinterpret_cast<const T*>(reinterpret_cast<const char*>(node) + I); }
|
||||
static T* Element_toValue(TLinkListNode* node) { return reinterpret_cast<T*>(reinterpret_cast<char*>(node) + I); }
|
||||
|
||||
iterator Insert(iterator iter, T* element) { return iterator(TNodeLinkList::Insert(iter.base, Element_toNode(element))); }
|
||||
iterator Erase(T* element) { return iterator(TNodeLinkList::Erase(Element_toNode(element))); }
|
||||
iterator Insert(iterator iter, T* element) {
|
||||
TLinkListNode* node = Element_toNode(element);
|
||||
return iterator(TNodeLinkList::Insert(iter.base, node));
|
||||
}
|
||||
iterator Erase(T* element) {
|
||||
TLinkListNode* node = Element_toNode(element);
|
||||
return iterator(TNodeLinkList::Erase(node));
|
||||
}
|
||||
|
||||
iterator begin() { return iterator(TNodeLinkList::begin()); }
|
||||
const_iterator begin() const { return const_iterator(const_cast<TLinkList*>(this)->begin()); }
|
||||
@@ -160,8 +166,14 @@ struct TLinkList : public TNodeLinkList {
|
||||
T& back() { return *--end(); }
|
||||
void Push_front(T* element) { Insert(begin(), element); }
|
||||
void Push_back(T* element) { Insert(end(), element); }
|
||||
iterator Find(const T* element) { return iterator(TNodeLinkList::Find(Element_toNode(element))); }
|
||||
void Remove(T* element) { TNodeLinkList::Remove(Element_toNode(element)); }
|
||||
iterator Find(const T* element) {
|
||||
const TLinkListNode* node = Element_toNode(element);
|
||||
return iterator(TNodeLinkList::Find(node));
|
||||
}
|
||||
void Remove(T* element) {
|
||||
TLinkListNode* node = Element_toNode(element);
|
||||
TNodeLinkList::Remove(node);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, int I>
|
||||
|
||||
@@ -368,10 +368,8 @@ static void dummy3() {
|
||||
|
||||
/* 802CB380-802CB4C4 .text appendConsole__17JUTConsoleManagerFP10JUTConsole */
|
||||
void JUTConsoleManager::appendConsole(JUTConsole* console) {
|
||||
/* Nonmatching */
|
||||
JUT_ASSERT(0x3bf, sManager != 0 && console != 0);
|
||||
|
||||
// need to figure out how TLinkList works
|
||||
JUT_ASSERT(0x3c2, soLink_.Find( console ) == soLink_.end());
|
||||
|
||||
soLink_.Push_back(console);
|
||||
@@ -382,7 +380,6 @@ void JUTConsoleManager::appendConsole(JUTConsole* console) {
|
||||
|
||||
/* 802CB4C4-802CB674 .text removeConsole__17JUTConsoleManagerFP10JUTConsole */
|
||||
void JUTConsoleManager::removeConsole(JUTConsole* console) {
|
||||
/* Nonmatching */
|
||||
JUT_ASSERT(0x3d6, sManager != 0 && console != 0);
|
||||
JUT_ASSERT(0x3d9, soLink_.Find( console ) != soLink_.end());
|
||||
|
||||
|
||||
@@ -397,14 +397,9 @@ void JUTGamePad::CRumble::stopMotorHard(int portNo) {
|
||||
}
|
||||
}
|
||||
|
||||
inline u8 getNumBit(u8* arr, u32 bitNo) {
|
||||
u8 bit = (arr[bitNo >> 3] & (0x80 >> (bitNo & 7)));
|
||||
return bit;
|
||||
}
|
||||
|
||||
/* 802C45A4-802C46CC .text update__Q210JUTGamePad7CRumbleFs */
|
||||
void JUTGamePad::CRumble::update(s16 portNo) {
|
||||
if (!isEnabledPort(portNo)) {
|
||||
if (!isEnabled(channel_mask[portNo])) {
|
||||
mFrame = 0;
|
||||
mLength = 0;
|
||||
mData = NULL;
|
||||
@@ -424,7 +419,8 @@ void JUTGamePad::CRumble::update(s16 portNo) {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
u8 numBit = getNumBit(mData, mFrame % mFrameCount);
|
||||
u32 bitNo = mFrame % mFrameCount;
|
||||
u8 numBit = (mData[bitNo >> 3] & (0x80 >> (bitNo & 7)));
|
||||
if (numBit != 0 && mStatus[portNo] == 0) {
|
||||
startMotor(portNo);
|
||||
} else if (numBit == 0 && mStatus[portNo] != 0) {
|
||||
@@ -522,3 +518,17 @@ bool JUTGamePad::recalibrate(u32 mask) {
|
||||
|
||||
return PADRecalibrate((PADMask)mask);
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
OSReport("JUTGamePad.cpp");
|
||||
OSReport("getDataSizePerFrame() > 0");
|
||||
OSReport("Halt");
|
||||
OSReport("mBuffer");
|
||||
OSReport("(u32)mBuffer <= (u32)dataEnd && (u32)dataEnd <= (u32)mBufferEnd");
|
||||
OSReport("part != 0");
|
||||
OSReport("getBuffer() == getDataEnd() || part == mPart");
|
||||
OSReport("JUTGamePad.h");
|
||||
OSReport("size > 0");
|
||||
OSReport("mBuffer && isValidData( mCurrent )");
|
||||
OSReport("mBuffer && isValidBuffer( mCurrent )");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user