mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-01 03:20:14 -04:00
Several JSystem file matches
This commit is contained in:
@@ -4,84 +4,195 @@
|
||||
//
|
||||
|
||||
#include "JSystem/J2DGraph/J2DGrafContext.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/* 802CD050-802CD0FC .text __ct__14J2DGrafContextFffff */
|
||||
J2DGrafContext::J2DGrafContext(float, float, float, float) {
|
||||
/* Nonmatching */
|
||||
J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height)
|
||||
: mBounds(x, y, x + width, y + height), mScissorBounds(x, y, x + width, y + height) {
|
||||
JUtility::TColor color(-1);
|
||||
setColor(color);
|
||||
setLineWidth(6);
|
||||
}
|
||||
|
||||
/* 802CD0FC-802CD16C .text setPort__14J2DGrafContextFv */
|
||||
void J2DGrafContext::setPort() {
|
||||
/* Nonmatching */
|
||||
setScissor();
|
||||
setup2D();
|
||||
|
||||
JGeometry::TBox2<f32> bounds(mBounds);
|
||||
|
||||
GXSetViewport(bounds.i.x, bounds.i.y, bounds.getWidth(), bounds.getHeight(), 0.0f, 1.875f);
|
||||
}
|
||||
|
||||
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
|
||||
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
|
||||
}
|
||||
|
||||
/* 802CD16C-802CD340 .text setup2D__14J2DGrafContextFv */
|
||||
void J2DGrafContext::setup2D() {
|
||||
/* Nonmatching */
|
||||
GXSetNumIndStages(0);
|
||||
for (int i = 0; i < GX_TEVSTAGE8; i++) {
|
||||
GXSetTevDirect((GXTevStageID)i);
|
||||
}
|
||||
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
GXSetZMode(GX_FALSE, GX_LEQUAL, GX_FALSE);
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GXSetNumChans(1);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetCullMode(GX_CULL_NONE);
|
||||
GXLoadPosMtxImm(mPosMtx, 0);
|
||||
Mtx mtx;
|
||||
MTXIdentity(mtx);
|
||||
GXLoadTexMtxImm(mtx, GX_IDENTITY, GX_MTX3x4);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetCurrentMtx(0);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
GXSetLineWidth(mLineWidth, GX_TO_ZERO);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_NONE);
|
||||
}
|
||||
|
||||
/* 802CD340-802CD590 .text setScissor__14J2DGrafContextFv */
|
||||
void J2DGrafContext::setScissor() {
|
||||
/* Nonmatching */
|
||||
JGeometry::TBox2<f32> bounds(0, 0, 1024, 1024);
|
||||
JGeometry::TBox2<f32> curBounds(mScissorBounds);
|
||||
mScissorBounds.intersect(bounds);
|
||||
curBounds.absolute();
|
||||
if (curBounds.intersect(bounds)) {
|
||||
GXSetScissor(curBounds.i.x, curBounds.i.y, curBounds.getWidth(), curBounds.getHeight());
|
||||
} else {
|
||||
GXSetScissor(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CD590-802CD5B4 .text scissor__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */
|
||||
void J2DGrafContext::scissor(const JGeometry::TBox2<float>&) {
|
||||
/* Nonmatching */
|
||||
void J2DGrafContext::scissor(const JGeometry::TBox2<f32>& bounds) {
|
||||
mScissorBounds = bounds;
|
||||
}
|
||||
|
||||
/* 802CD5B4-802CD5F8 .text place__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */
|
||||
void J2DGrafContext::place(const JGeometry::TBox2<float>&) {
|
||||
/* Nonmatching */
|
||||
void J2DGrafContext::place(const JGeometry::TBox2<f32>& bounds) {
|
||||
mBounds = bounds;
|
||||
mScissorBounds = bounds;
|
||||
}
|
||||
|
||||
/* 802CD5F8-802CD714 .text setColor__14J2DGrafContextFQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor */
|
||||
void J2DGrafContext::setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor) {
|
||||
/* Nonmatching */
|
||||
/* 802CD5F8-802CD714 .text
|
||||
* setColor__14J2DGrafContextFQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColorQ28JUtility6TColor
|
||||
*/
|
||||
void J2DGrafContext::setColor(JUtility::TColor colorTL, JUtility::TColor colorTR,
|
||||
JUtility::TColor colorBR, JUtility::TColor colorBL) {
|
||||
mColorTL = colorTL;
|
||||
mColorTR = colorTR;
|
||||
mColorBR = colorBR;
|
||||
mColorBL = colorBL;
|
||||
field_0xb0.mType = GX_BM_BLEND;
|
||||
field_0xb0.mSrcFactor = GX_BL_SRC_ALPHA;
|
||||
field_0xb0.mDstFactor = GX_BL_INV_SRC_ALPHA;
|
||||
mLinePart.mType = GX_BM_BLEND;
|
||||
mLinePart.mSrcFactor = GX_BL_SRC_ALPHA;
|
||||
mLinePart.mDstFactor = GX_BL_INV_SRC_ALPHA;
|
||||
mBoxPart.mType = GX_BM_BLEND;
|
||||
mBoxPart.mSrcFactor = GX_BL_SRC_ALPHA;
|
||||
mBoxPart.mDstFactor = GX_BL_INV_SRC_ALPHA;
|
||||
if ((mColorTL & 0xFF) != 0xFF) {
|
||||
return;
|
||||
}
|
||||
field_0xb0.mType = GX_BM_NONE;
|
||||
field_0xb0.mSrcFactor = GX_BL_ONE;
|
||||
field_0xb0.mDstFactor = GX_BL_ZERO;
|
||||
if ((mColorBR & 0xFF) != 0xFF) {
|
||||
return;
|
||||
}
|
||||
mLinePart.mType = GX_BM_NONE;
|
||||
mLinePart.mSrcFactor = GX_BL_ONE;
|
||||
mLinePart.mDstFactor = GX_BL_ZERO;
|
||||
if ((mColorTR & 0xFF) != 0xFF) {
|
||||
return;
|
||||
}
|
||||
if ((mColorBL & 0xFF) != 0xFF) {
|
||||
return;
|
||||
}
|
||||
mBoxPart.mType = GX_BM_NONE;
|
||||
mBoxPart.mSrcFactor = GX_BL_ONE;
|
||||
mBoxPart.mDstFactor = GX_BL_ZERO;
|
||||
}
|
||||
|
||||
/* 802CD714-802CD740 .text setLineWidth__14J2DGrafContextFUc */
|
||||
void J2DGrafContext::setLineWidth(unsigned char) {
|
||||
/* Nonmatching */
|
||||
void J2DGrafContext::setLineWidth(u8 lineWidth) {
|
||||
mLineWidth = lineWidth;
|
||||
GXSetLineWidth(mLineWidth, GX_TO_ZERO);
|
||||
}
|
||||
|
||||
/* 802CD740-802CD858 .text fillBox__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */
|
||||
void J2DGrafContext::fillBox(const JGeometry::TBox2<float>&) {
|
||||
/* Nonmatching */
|
||||
void J2DGrafContext::fillBox(const JGeometry::TBox2<f32>& box) {
|
||||
GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor,
|
||||
(GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET);
|
||||
GXLoadPosMtxImm(mPosMtx, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(box.i.x, box.i.y, 0);
|
||||
GXColor1u32(mColorTL);
|
||||
GXPosition3f32(box.f.x, box.i.y, 0);
|
||||
GXColor1u32(mColorTR);
|
||||
GXPosition3f32(box.f.x, box.f.y, 0);
|
||||
GXColor1u32(mColorBL);
|
||||
GXPosition3f32(box.i.x, box.f.y, 0);
|
||||
GXColor1u32(mColorBR);
|
||||
i_GXEnd();
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
}
|
||||
|
||||
/* 802CD858-802CD990 .text drawFrame__14J2DGrafContextFRCQ29JGeometry8TBox2<f> */
|
||||
void J2DGrafContext::drawFrame(const JGeometry::TBox2<float>&) {
|
||||
/* Nonmatching */
|
||||
void J2DGrafContext::drawFrame(const JGeometry::TBox2<f32>& box) {
|
||||
GXSetBlendMode((GXBlendMode)mBoxPart.mType, (GXBlendFactor)mBoxPart.mSrcFactor,
|
||||
(GXBlendFactor)mBoxPart.mDstFactor, GX_LO_SET);
|
||||
GXLoadPosMtxImm(mPosMtx, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXBegin(GX_LINESTRIP, GX_VTXFMT0, 5);
|
||||
GXPosition3f32(box.i.x, box.i.y, 0);
|
||||
GXColor1u32(mColorTL);
|
||||
GXPosition3f32(box.f.x, box.i.y, 0);
|
||||
GXColor1u32(mColorTR);
|
||||
GXPosition3f32(box.f.x, box.f.y, 0);
|
||||
GXColor1u32(mColorBL);
|
||||
GXPosition3f32(box.i.x, box.f.y, 0);
|
||||
GXColor1u32(mColorBR);
|
||||
GXPosition3f32(box.i.x, box.i.y, 0);
|
||||
GXColor1u32(mColorTL);
|
||||
i_GXEnd();
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
}
|
||||
|
||||
/* 802CD990-802CDA6C .text line__14J2DGrafContextFQ29JGeometry8TVec2<f>Q29JGeometry8TVec2<f> */
|
||||
void J2DGrafContext::line(JGeometry::TVec2<float>, JGeometry::TVec2<float>) {
|
||||
/* Nonmatching */
|
||||
/* 802CD990-802CDA6C .text line__14J2DGrafContextFQ29JGeometry8TVec2<f>Q29JGeometry8TVec2<f>
|
||||
*/
|
||||
void J2DGrafContext::line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end) {
|
||||
GXSetBlendMode((GXBlendMode)mLinePart.mType, (GXBlendFactor)mLinePart.mSrcFactor,
|
||||
(GXBlendFactor)mLinePart.mDstFactor, GX_LO_SET);
|
||||
GXLoadPosMtxImm(mPosMtx, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXBegin(GX_LINES, GX_VTXFMT0, 2);
|
||||
GXPosition3f32(start.x, start.y, 0);
|
||||
GXColor1u32(mColorTL);
|
||||
GXPosition3f32(end.x, end.y, 0);
|
||||
GXColor1u32(mColorBR);
|
||||
i_GXEnd();
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
}
|
||||
|
||||
/* 802CDA6C-802CDADC .text lineTo__14J2DGrafContextFQ29JGeometry8TVec2<f> */
|
||||
void J2DGrafContext::lineTo(JGeometry::TVec2<float>) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802CDADC-802CDB24 .text __dt__14J2DGrafContextFv */
|
||||
J2DGrafContext::~J2DGrafContext() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802CDB24-802CDB6C .text place__14J2DGrafContextFffff */
|
||||
void J2DGrafContext::place(float, float, float, float) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802CDB6C-802CDB74 .text getGrafType__14J2DGrafContextCFv */
|
||||
void J2DGrafContext::getGrafType() const {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802CDB74-802CDB78 .text setLookat__14J2DGrafContextFv */
|
||||
void J2DGrafContext::setLookat() {
|
||||
/* Nonmatching */
|
||||
void J2DGrafContext::lineTo(JGeometry::TVec2<f32> pos) {
|
||||
this->line(mPrevPos, pos);
|
||||
mPrevPos = pos;
|
||||
}
|
||||
|
||||
@@ -4,64 +4,86 @@
|
||||
//
|
||||
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/* 802CDB78-802CDBD8 .text __ct__13J2DOrthoGraphFv */
|
||||
J2DOrthoGraph::J2DOrthoGraph() {
|
||||
/* Nonmatching */
|
||||
J2DOrthoGraph::J2DOrthoGraph() : J2DGrafContext(0, 0, 0, 0) {
|
||||
this->setLookat();
|
||||
}
|
||||
|
||||
/* 802CDBD8-802CDCB4 .text __ct__13J2DOrthoGraphFffffff */
|
||||
J2DOrthoGraph::J2DOrthoGraph(float, float, float, float, float, float) {
|
||||
/* Nonmatching */
|
||||
J2DOrthoGraph::J2DOrthoGraph(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near)
|
||||
: J2DGrafContext(x, y, width, height) {
|
||||
mOrtho = JGeometry::TBox2<f32>(0, 0, width, height);
|
||||
mNear = far;
|
||||
mFar = near;
|
||||
this->setLookat();
|
||||
}
|
||||
|
||||
/* 802CDCB4-802CDD14 .text setPort__13J2DOrthoGraphFv */
|
||||
void J2DOrthoGraph::setPort() {
|
||||
/* Nonmatching */
|
||||
this->J2DGrafContext::setPort();
|
||||
C_MTXOrtho(mMtx44, mOrtho.i.y, mOrtho.f.y + 0.5f, mOrtho.i.x, mOrtho.f.x, mNear, mFar);
|
||||
GXSetProjection(mMtx44, GX_ORTHOGRAPHIC);
|
||||
}
|
||||
|
||||
/* 802CDD14-802CDD48 .text setOrtho__13J2DOrthoGraphFRCQ29JGeometry8TBox2<f>ff */
|
||||
void J2DOrthoGraph::setOrtho(const JGeometry::TBox2<float>&, float, float) {
|
||||
/* Nonmatching */
|
||||
void J2DOrthoGraph::setOrtho(const JGeometry::TBox2<f32>& bounds, f32 far, f32 near) {
|
||||
mOrtho = bounds;
|
||||
mNear = -near;
|
||||
mFar = -far;
|
||||
}
|
||||
|
||||
/* 802CDD48-802CDD84 .text setLookat__13J2DOrthoGraphFv */
|
||||
void J2DOrthoGraph::setLookat() {
|
||||
/* Nonmatching */
|
||||
MTXIdentity(mPosMtx);
|
||||
GXLoadPosMtxImm(mPosMtx, 0);
|
||||
}
|
||||
|
||||
/* 802CDD84-802CDE10 .text scissorBounds__13J2DOrthoGraphFPQ29JGeometry8TBox2<f>PCQ29JGeometry8TBox2<f> */
|
||||
void J2DOrthoGraph::scissorBounds(JGeometry::TBox2<float>*, const JGeometry::TBox2<float>*) {
|
||||
/* Nonmatching */
|
||||
/* 802CDD84-802CDE10 .text
|
||||
* scissorBounds__13J2DOrthoGraphFPQ29JGeometry8TBox2<f>PCQ29JGeometry8TBox2<f> */
|
||||
void J2DOrthoGraph::scissorBounds(JGeometry::TBox2<f32>* param_0,
|
||||
const JGeometry::TBox2<f32>* param_1) {
|
||||
f32 widthPower = this->getWidthPower();
|
||||
f32 heightPower = this->getHeightPower();
|
||||
f32 f0 = mBounds.i.x + widthPower * (param_1->i.x - mOrtho.i.x);
|
||||
f32 f2 = mBounds.i.x + widthPower * (param_1->f.x - mOrtho.i.x);
|
||||
f32 f1 = mBounds.i.y + heightPower * (param_1->i.y - mOrtho.i.y);
|
||||
f32 f3 = mBounds.i.y + heightPower * (param_1->f.y - mOrtho.i.y);
|
||||
param_0->set(f0, f1, f2, f3);
|
||||
}
|
||||
|
||||
/* 802CDE10-802CDF3C .text J2DDrawLine__FffffQ28JUtility6TColori */
|
||||
void J2DDrawLine(float, float, float, float, JUtility::TColor, int) {
|
||||
/* Nonmatching */
|
||||
void J2DDrawLine(f32 x1, f32 y1, f32 x2, f32 y2, JUtility::TColor color, int line_width) {
|
||||
J2DOrthoGraph oGrph;
|
||||
oGrph.setLineWidth(line_width);
|
||||
oGrph.setColor(color);
|
||||
oGrph.moveTo(x1, y1);
|
||||
oGrph.lineTo(x2, y2);
|
||||
}
|
||||
|
||||
/* 802CDF3C-802CDF84 .text J2DFillBox__FffffQ28JUtility6TColor */
|
||||
void J2DFillBox(float, float, float, float, JUtility::TColor) {
|
||||
/* Nonmatching */
|
||||
void J2DFillBox(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color) {
|
||||
J2DFillBox(JGeometry::TBox2<f32>(x, y, x + width, y + height), color);
|
||||
}
|
||||
|
||||
/* 802CDF84-802CE014 .text J2DFillBox__FRCQ29JGeometry8TBox2<f>Q28JUtility6TColor */
|
||||
void J2DFillBox(const JGeometry::TBox2<float>&, JUtility::TColor) {
|
||||
/* Nonmatching */
|
||||
void J2DFillBox(const JGeometry::TBox2<f32>& box, JUtility::TColor color) {
|
||||
J2DOrthoGraph oGrph;
|
||||
oGrph.setColor(color);
|
||||
oGrph.fillBox(box);
|
||||
}
|
||||
|
||||
/* 802CE014-802CE060 .text J2DDrawFrame__FffffQ28JUtility6TColorUc */
|
||||
void J2DDrawFrame(float, float, float, float, JUtility::TColor, unsigned char) {
|
||||
/* Nonmatching */
|
||||
void J2DDrawFrame(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color, u8 line_width) {
|
||||
J2DDrawFrame(JGeometry::TBox2<f32>(x, y, x + width, y + height), color, line_width);
|
||||
}
|
||||
|
||||
/* 802CE060-802CE100 .text J2DDrawFrame__FRCQ29JGeometry8TBox2<f>Q28JUtility6TColorUc */
|
||||
void J2DDrawFrame(const JGeometry::TBox2<float>&, JUtility::TColor, unsigned char) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802CE100-802CE108 .text getGrafType__13J2DOrthoGraphCFv */
|
||||
void J2DOrthoGraph::getGrafType() const {
|
||||
/* Nonmatching */
|
||||
void J2DDrawFrame(const JGeometry::TBox2<f32>& box, JUtility::TColor color, u8 line_width) {
|
||||
J2DOrthoGraph oGrph;
|
||||
oGrph.setColor(color);
|
||||
oGrph.setLineWidth(line_width);
|
||||
oGrph.drawFrame(box);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user