Compare commits
1 Commits
cleanup/ip
...
cleanup/ip
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24e76ff0bb |
@@ -18,11 +18,11 @@ namespace ipl {
|
|||||||
|
|
||||||
class line_collision {
|
class line_collision {
|
||||||
public:
|
public:
|
||||||
line_collision() : unk_0x00(0.0f), unk_0x04(0.0f), unk_0x08(0.0f) {}
|
line_collision() : mLeft(0.0f), mRight(0.0f), mY(0.0f) {}
|
||||||
|
|
||||||
f32 unk_0x00;
|
f32 mLeft;
|
||||||
f32 unk_0x04;
|
f32 mRight;
|
||||||
f32 unk_0x08;
|
f32 mY;
|
||||||
nw4r::ut::Link mLinkList; // 0x0C
|
nw4r::ut::Link mLinkList; // 0x0C
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -31,9 +31,9 @@ namespace ipl {
|
|||||||
url_collision();
|
url_collision();
|
||||||
~url_collision();
|
~url_collision();
|
||||||
|
|
||||||
int unk_0x00;
|
int mTagNo;
|
||||||
wchar_t* unk_0x04;
|
wchar_t* mpStart;
|
||||||
wchar_t* unk_0x08;
|
wchar_t* mpEnd;
|
||||||
nw4r::ut::Link mLinkList; // 0x0C
|
nw4r::ut::Link mLinkList; // 0x0C
|
||||||
nw4r::ut::List mLineCollisions; // 0x14
|
nw4r::ut::List mLineCollisions; // 0x14
|
||||||
};
|
};
|
||||||
@@ -53,19 +53,19 @@ namespace ipl {
|
|||||||
void parse(nw4r::ut::PrintContext<wchar_t>* context);
|
void parse(nw4r::ut::PrintContext<wchar_t>* context);
|
||||||
|
|
||||||
BOOL is_focused() const;
|
BOOL is_focused() const;
|
||||||
void select(int unk);
|
void select(int tagNo);
|
||||||
|
|
||||||
int get_focused_tagno(int chan) const;
|
int get_focused_tagno(int chan) const;
|
||||||
url_collision* get_selected_col();
|
url_collision* get_selected_col();
|
||||||
|
|
||||||
void get_url(char* urlOut, u32 urlLen);
|
void get_url(char* urlOut, u32 urlLen);
|
||||||
|
|
||||||
void setUnk_0x40(f32 val) { unk_0x40 = val; }
|
void setHitYOffset(f32 val) { mHitYOffset = val; }
|
||||||
void setUnk_0x44(f32 val) { unk_0x44 = val; }
|
void setMemoTranslateY(f32 val) { mMemoTranslateY = val; }
|
||||||
void setUnk_0x53(bool val) { unk_0x53 = val; }
|
void setFocusEnabled(bool val) { mbFocusEnabled = val; }
|
||||||
|
|
||||||
u8 getUnk_0x50() const { return unk_0x50; }
|
u8 getColorPass() const { return mbColorPass; }
|
||||||
void setUnk_0x50(u8 val) { unk_0x50 = val; }
|
void setColorPass(u8 val) { mbColorPass = val; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -75,14 +75,14 @@ namespace ipl {
|
|||||||
|
|
||||||
con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00
|
con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00
|
||||||
nw4r::ut::List mUrlCollisions; // 0x34
|
nw4r::ut::List mUrlCollisions; // 0x34
|
||||||
f32 unk_0x40;
|
f32 mHitYOffset;
|
||||||
f32 unk_0x44;
|
f32 mMemoTranslateY;
|
||||||
int unk_0x48;
|
int mCurTagNo;
|
||||||
int unk_0x4C;
|
int mSelectedTagNo;
|
||||||
u8 unk_0x50;
|
u8 mbColorPass;
|
||||||
u8 unk_0x51;
|
u8 mbInTag;
|
||||||
u8 unk_0x52;
|
u8 mbHoverOffset;
|
||||||
u8 unk_0x53;
|
u8 mbFocusEnabled;
|
||||||
};
|
};
|
||||||
} // namespace scene
|
} // namespace scene
|
||||||
} // namespace ipl
|
} // namespace ipl
|
||||||
|
|||||||
@@ -930,13 +930,13 @@ namespace ipl {
|
|||||||
math::VEC3 translate(mpLayout->FindPaneByName("N_Memo")->GetTranslate());
|
math::VEC3 translate(mpLayout->FindPaneByName("N_Memo")->GetTranslate());
|
||||||
|
|
||||||
mURLProc.clear_prev_drawing();
|
mURLProc.clear_prev_drawing();
|
||||||
mURLProc.setUnk_0x44(translate.y);
|
mURLProc.setMemoTranslateY(translate.y);
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (mState == STATE_NORMAL && mScroller.is_busy() == FALSE) {
|
if (mState == STATE_NORMAL && mScroller.is_busy() == FALSE) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
mURLProc.setUnk_0x53(result);
|
mURLProc.setFocusEnabled(result);
|
||||||
|
|
||||||
if (translate.y < 500.0f) {
|
if (translate.y < 500.0f) {
|
||||||
mpLayout->draw("N_Header");
|
mpLayout->draw("N_Header");
|
||||||
@@ -983,8 +983,8 @@ namespace ipl {
|
|||||||
mpLayout->draw("ReplyMask");
|
mpLayout->draw("ReplyMask");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mURLProc.getUnk_0x50()) {
|
if (!mURLProc.getColorPass()) {
|
||||||
mURLProc.setUnk_0x50(1);
|
mURLProc.setColorPass(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1512,7 +1512,7 @@ namespace ipl {
|
|||||||
mURLProc.init();
|
mURLProc.init();
|
||||||
|
|
||||||
if (mpBoardObj->mLetterType == BoardObject::TYPE_MEMO) {
|
if (mpBoardObj->mLetterType == BoardObject::TYPE_MEMO) {
|
||||||
mURLProc.setUnk_0x40(8.0f);
|
mURLProc.setHitYOffset(8.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("T_Letter");
|
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("T_Letter");
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ namespace ipl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UrlProcessor::init() {
|
void UrlProcessor::init() {
|
||||||
unk_0x52 = 0;
|
mbHoverOffset = 0;
|
||||||
unk_0x51 = 0;
|
mbInTag = 0;
|
||||||
unk_0x50 = 0;
|
mbColorPass = 0;
|
||||||
unk_0x53 = 1;
|
mbFocusEnabled = 1;
|
||||||
|
|
||||||
unk_0x40 = 0.0f;
|
mHitYOffset = 0.0f;
|
||||||
unk_0x44 = 0.0f;
|
mMemoTranslateY = 0.0f;
|
||||||
|
|
||||||
unk_0x48 = 0;
|
mCurTagNo = 0;
|
||||||
unk_0x4C = -1;
|
mSelectedTagNo = -1;
|
||||||
|
|
||||||
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||||
mConData[i].valid = false;
|
mConData[i].valid = false;
|
||||||
@@ -60,14 +60,14 @@ namespace ipl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UrlProcessor::clear_prev_drawing() {
|
void UrlProcessor::clear_prev_drawing() {
|
||||||
unk_0x48 = 0;
|
mCurTagNo = 0;
|
||||||
unk_0x52 = 0;
|
mbHoverOffset = 0;
|
||||||
unk_0x51 = 0;
|
mbInTag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext<wchar_t>* context) {
|
nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext<wchar_t>* context) {
|
||||||
if (code == SEPERATOR || code == (u16)'\n') {
|
if (code == SEPERATOR || code == (u16)'\n') {
|
||||||
if (unk_0x50 == 0) {
|
if (mbColorPass == 0) {
|
||||||
make_collision(context, code);
|
make_collision(context, code);
|
||||||
} else if (code == SEPERATOR) {
|
} else if (code == SEPERATOR) {
|
||||||
parse(context);
|
parse(context);
|
||||||
@@ -78,42 +78,42 @@ namespace ipl {
|
|||||||
|
|
||||||
void UrlProcessor::make_collision(nw4r::ut::PrintContext<wchar_t>* context, u16 code) {
|
void UrlProcessor::make_collision(nw4r::ut::PrintContext<wchar_t>* context, u16 code) {
|
||||||
if (code == SEPERATOR) {
|
if (code == SEPERATOR) {
|
||||||
if (unk_0x51 == 0) {
|
if (mbInTag == 0) {
|
||||||
url_collision* const url_col = new (System::getMem2App(), 4) url_collision();
|
url_collision* const url_col = new (System::getMem2App(), 4) url_collision();
|
||||||
line_collision* const line_col = new (System::getMem2App(), 4) line_collision();
|
line_collision* const line_col = new (System::getMem2App(), 4) line_collision();
|
||||||
|
|
||||||
url_col->unk_0x00 = unk_0x48;
|
url_col->mTagNo = mCurTagNo;
|
||||||
url_col->unk_0x04 = (wchar_t*)context->str;
|
url_col->mpStart = (wchar_t*)context->str;
|
||||||
|
|
||||||
line_col->unk_0x00 = context->writer->GetCursorX();
|
line_col->mLeft = context->writer->GetCursorX();
|
||||||
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
|
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
|
||||||
nw4r::ut::List_Append(&mUrlCollisions, url_col);
|
nw4r::ut::List_Append(&mUrlCollisions, url_col);
|
||||||
|
|
||||||
unk_0x51 = 1;
|
mbInTag = 1;
|
||||||
} else {
|
} else {
|
||||||
void* url_col_raw = nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
|
void* url_col_raw = nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
|
||||||
void* line_col_raw = nw4r::ut::List_GetPrev(&((url_collision*)url_col_raw)->mLineCollisions, NULL);
|
void* line_col_raw = nw4r::ut::List_GetPrev(&((url_collision*)url_col_raw)->mLineCollisions, NULL);
|
||||||
url_collision* url_col = (url_collision*)url_col_raw;
|
url_collision* url_col = (url_collision*)url_col_raw;
|
||||||
line_collision* line_col = (line_collision*)line_col_raw;
|
line_collision* line_col = (line_collision*)line_col_raw;
|
||||||
|
|
||||||
line_col->unk_0x04 = context->writer->GetCursorX();
|
line_col->mRight = context->writer->GetCursorX();
|
||||||
line_col->unk_0x08 = context->writer->GetCursorY();
|
line_col->mY = context->writer->GetCursorY();
|
||||||
|
|
||||||
url_col->unk_0x08 = (wchar_t*)context->str;
|
url_col->mpEnd = (wchar_t*)context->str;
|
||||||
|
|
||||||
unk_0x51 = 0;
|
mbInTag = 0;
|
||||||
unk_0x48++;
|
mCurTagNo++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (unk_0x51 != 0) {
|
if (mbInTag != 0) {
|
||||||
url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
|
url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
|
||||||
line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL);
|
line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL);
|
||||||
|
|
||||||
line_col->unk_0x04 = context->writer->GetCursorX();
|
line_col->mRight = context->writer->GetCursorX();
|
||||||
line_col->unk_0x08 = context->writer->GetCursorY();
|
line_col->mY = context->writer->GetCursorY();
|
||||||
|
|
||||||
line_col = new (System::getMem2App(), 4) line_collision();
|
line_col = new (System::getMem2App(), 4) line_collision();
|
||||||
line_col->unk_0x00 = -208.0f;
|
line_col->mLeft = -208.0f;
|
||||||
|
|
||||||
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
|
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
|
||||||
}
|
}
|
||||||
@@ -122,41 +122,41 @@ namespace ipl {
|
|||||||
|
|
||||||
void UrlProcessor::parse(nw4r::ut::PrintContext<wchar_t>* context) {
|
void UrlProcessor::parse(nw4r::ut::PrintContext<wchar_t>* context) {
|
||||||
f32 curY = context->writer->GetCursorY();
|
f32 curY = context->writer->GetCursorY();
|
||||||
if (unk_0x51 == 0) {
|
if (mbInTag == 0) {
|
||||||
if (unk_0x4C == unk_0x48) {
|
if (mSelectedTagNo == mCurTagNo) {
|
||||||
context->writer->SetTextColor(0xFFE664FF);
|
context->writer->SetTextColor(0xFFE664FF);
|
||||||
} else if (unk_0x53 != 0 && is_focused()) {
|
} else if (mbFocusEnabled != 0 && is_focused()) {
|
||||||
context->writer->SetCursorY(curY - 2.0f);
|
context->writer->SetCursorY(curY - 2.0f);
|
||||||
context->writer->SetTextColor(0xF06E28FF);
|
context->writer->SetTextColor(0xF06E28FF);
|
||||||
unk_0x52 = 1;
|
mbHoverOffset = 1;
|
||||||
} else {
|
} else {
|
||||||
context->writer->SetTextColor(0x34BEEDFF);
|
context->writer->SetTextColor(0x34BEEDFF);
|
||||||
}
|
}
|
||||||
unk_0x51 = 1;
|
mbInTag = 1;
|
||||||
} else {
|
} else {
|
||||||
if (unk_0x52 != 0) {
|
if (mbHoverOffset != 0) {
|
||||||
context->writer->SetCursorY(2.0f + curY);
|
context->writer->SetCursorY(2.0f + curY);
|
||||||
unk_0x52 = 0;
|
mbHoverOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
context->writer->SetTextColor(0x646464FF);
|
context->writer->SetTextColor(0x646464FF);
|
||||||
|
|
||||||
unk_0x51 = 0;
|
mbInTag = 0;
|
||||||
unk_0x48++;
|
mCurTagNo++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL UrlProcessor::is_focused() const {
|
BOOL UrlProcessor::is_focused() const {
|
||||||
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||||
if (unk_0x48 == get_focused_tagno(i)) {
|
if (mCurTagNo == get_focused_tagno(i)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UrlProcessor::select(int unk) {
|
void UrlProcessor::select(int tagNo) {
|
||||||
unk_0x4C = unk;
|
mSelectedTagNo = tagNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UrlProcessor::get_focused_tagno(int chan) const {
|
int UrlProcessor::get_focused_tagno(int chan) const {
|
||||||
@@ -174,13 +174,13 @@ namespace ipl {
|
|||||||
|
|
||||||
while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) {
|
while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) {
|
||||||
while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) {
|
while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) {
|
||||||
f32 left = line_col->unk_0x00 - var_f28;
|
f32 left = line_col->mLeft - var_f28;
|
||||||
f32 right = var_f28 + line_col->unk_0x04;
|
f32 right = var_f28 + line_col->mRight;
|
||||||
f32 temp_f0 = ((unk_0x44 + unk_0x40) - line_col->unk_0x08);
|
f32 temp_f0 = ((mMemoTranslateY + mHitYOffset) - line_col->mY);
|
||||||
f32 top = (var_f29 + temp_f0) - var_f28;
|
f32 top = (var_f29 + temp_f0) - var_f28;
|
||||||
f32 bottom = var_f28 + (var_f30 + temp_f0);
|
f32 bottom = var_f28 + (var_f30 + temp_f0);
|
||||||
if (left <= var_f31 && var_f31 <= right && top <= -pos.y && -pos.y <= bottom) {
|
if (left <= var_f31 && var_f31 <= right && top <= -pos.y && -pos.y <= bottom) {
|
||||||
return url_col->unk_0x00;
|
return url_col->mTagNo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ namespace ipl {
|
|||||||
url_collision* url_col = NULL;
|
url_collision* url_col = NULL;
|
||||||
|
|
||||||
while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) {
|
while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) {
|
||||||
if (got->unk_0x00 == unk_0x4C) {
|
if (got->mTagNo == mSelectedTagNo) {
|
||||||
url_col = got;
|
url_col = got;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -210,10 +210,10 @@ namespace ipl {
|
|||||||
|
|
||||||
int chIdx2 = 0;
|
int chIdx2 = 0;
|
||||||
int chIdx = 0;
|
int chIdx = 0;
|
||||||
u32 count = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
|
u32 count = (u32)url_col->mpEnd - (u32)url_col->mpStart;
|
||||||
count >>= 1;
|
count >>= 1;
|
||||||
for (u32 i = 0; i < count; i++) {
|
for (u32 i = 0; i < count; i++) {
|
||||||
wchar_t wch = url_col->unk_0x04[i];
|
wchar_t wch = url_col->mpStart[i];
|
||||||
if (wch != SEPERATOR && chIdx2 < 0x200) {
|
if (wch != SEPERATOR && chIdx2 < 0x200) {
|
||||||
url[chIdx2++] = wch;
|
url[chIdx2++] = wch;
|
||||||
}
|
}
|
||||||
@@ -226,9 +226,9 @@ namespace ipl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UrlProcessor::url_collision::url_collision() {
|
UrlProcessor::url_collision::url_collision() {
|
||||||
unk_0x00 = 0;
|
mTagNo = 0;
|
||||||
unk_0x04 = NULL;
|
mpStart = NULL;
|
||||||
unk_0x08 = NULL;
|
mpEnd = NULL;
|
||||||
nw4r::ut::List_Init(&mLineCollisions, offsetof(line_collision, mLinkList));
|
nw4r::ut::List_Init(&mLineCollisions, offsetof(line_collision, mLinkList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user