mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-30 08:26:24 -04:00
b289dece80
* fix kankyo UB
* Fix TEV Stage DL writing
BE issue
* BE Fixes in materials/shapes
* Move to Aurora GD impl
* JUTDataFileHeader
* j3d: load vertex and texture not through GD
* Endian swap vertex data (mostly)
* Just exit(0) when closing the game
Fix crashes :godo:
* fix fopAcM_ct_placement and remove memcpy
* J3D: track vertex arrays correctly, swap work
* fix visibility, turn off overridden new/delete when we call into aurora
* event: cut name be
* Default window improvements
Double size, allow OS to decide position
* survive TParse::parseHeader_next
* color swap fix
* swap endian/fixes oob function pointer
* Remove GXGetViewportv stub
Aurora has it now
* Set array pointers via GD again
Relies on https://github.com/encounter/aurora/pull/35
* Let Aurora decide graphics backend
* disable procbar drawing
* Fix TColor endianness conversion issues
Fixes the wrong color for the flashing logo
* cam param swap
* simplify vtx loading, mat/amb color fix
* endian swap stb/fvb data
* aurora stat changes
* fix storage buffer crash
dont unnecessarily reassign vertex buffers in a way that forces aurora to recache things
* set bgobj spec fix
* add camera debug, endian swap more stb data, d_a_bg_obj::spec_data_c swapped
* JKRExpHeap: fix bad allocator slowdown
* solid tex
* texture caching
* log level
* fix window aspect ratio, disable bloom, endian swap camera type data
camera is now actually playing opening cutscene!!!!
* add GXDestroyTexObj to a couple stack init'd GXTexObjs, remove some diag printfs
* endian swap joint weight envelope data
* move to dusk config
* verbose arg errors
* better stub logging (for now)
* less logging, more BE
* more stubbing, move logging stuff around
* move all logging to aurora logging
* fix STUB_LOG, __FUNCTION__ isn't a string literal, wasn't building as it
was.
* update aurora
* fix heap alignment mismatch and always head align for now
* prevent them from fucking up my shit
* forward jut warning to DuskLog
* remove report logging
* maybe and i must emphasize maybe fix JMessage parsing
* this was a dumb idea
* preserve negative alignment for JKRHeap
* use normal free on macos and linux
* ^
* fix JMAHermiteInterpolation c impl
* endian swap J2DScreen mColor (oops)
* swap more J3D anim data, remove weird pointer addr check in J3DMaterial getMaterialAnm
* typo fix
* Fix aligned_alloc() size issues on POSIX
aligned_alloc() requires its input size to be a multiple of alignment. This wasn't being upheld so there were allocation failures in init code that made the game fail to start outside Windows.
Also just cleaned up some of this code a bit and removed fallback cases that *shouldn't* get hit.
* _Exit instead of exit()
Seriously I don't want destructors to run. Let the OS reclaim that shit.
* Reapply "Isolate JKRHeap operator overloads" (#39)
This reverts commit 3623b27f37.
* Fix some oopsies
* Fix hardcoded pointer size in JUTCacheFont::allocArray
* More operator overload fixes
Add void template specialization for jkrDelete
Add new[] placement overload. Apparently.
* Fix delete macros on nullptr
TIL C++ allows that.
* fix delete[]
* fix new(std::nothrow) overload
* fix avoid ub
* swap remaining anim data needed for title logo
* get rid of op 7
* move aurora_end_frame to correct spot
* juttexture destroy tex
* j2d animation be
* shutdown crash
* link warp material fix
* mDoExt_3DlineMat1_c fix
* hacky keyboard controls
* endian swap J2DResReference, add kb_pad to files.cmake
* fix some missing endian swaps in J2D, remove addr alignment check
* Remove heap unsetting in aurora calls
Never worked properly and not the right solution even if it did
* Don't print in DC stubs
They're fine to never implement
* Fix alignment stuff again
* Compile GF from dolphin lib
Doesn't seem to break anything and shuts up some stub warnings
* j3dtexture tlut obj fix
* addTexMtxIndexInDL fix
* don't recreate null tex data every frame
* the actual fix i wanted to push
* its kinda fakematch city over here
* insert hte efb copy
* limited window size / viewport support
* IsDelete FIX
---------
Co-authored-by: madeline <qwertytrogi@gmail.com>
Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net>
Co-authored-by: Jeffrey Crowell <jeff@crowell.biz>
Co-authored-by: TakaRikka <takarikka@outlook.com>
Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com>
Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com>
232 lines
8.5 KiB
C++
232 lines
8.5 KiB
C++
#ifndef J2DPICTURE_H
|
|
#define J2DPICTURE_H
|
|
|
|
#include "JSystem/J2DGraph/J2DPane.h"
|
|
#include "JSystem/JUtility/JUTTexture.h"
|
|
#include "JSystem/JUtility/TColor.h"
|
|
#include "dusk/endian.h"
|
|
|
|
class J2DMaterial;
|
|
class JUTPalette;
|
|
struct ResTIMG;
|
|
struct ResTLUT;
|
|
|
|
enum J2DMirror {
|
|
/* 0 */ MIRROR0, // temp, figure out later
|
|
/* 1 */ J2DMirror_Y = (1 << 0),
|
|
/* 2 */ J2DMirror_X = (1 << 1),
|
|
};
|
|
|
|
enum J2DBinding {
|
|
/* 0 */ J2DBind_None = 0,
|
|
/* 1 */ J2DBind_Bottom = (1 << 0),
|
|
/* 2 */ J2DBind_Top = (1 << 1),
|
|
/* 4 */ J2DBind_Right = (1 << 2),
|
|
/* 8 */ J2DBind_Left = (1 << 3),
|
|
|
|
/* 0xF */ BIND15 = 15, // temp, figure out later
|
|
};
|
|
|
|
/**
|
|
* @ingroup jsystem-j2d
|
|
*
|
|
*/
|
|
struct J2DPicHeader {
|
|
/* 0x0 */ BE(u32) mTag;
|
|
/* 0x4 */ BE(u32) mSize;
|
|
};
|
|
|
|
/**
|
|
* @ingroup jsystem-j2d
|
|
*
|
|
*/
|
|
struct J2DScrnBlockPictureParameter {
|
|
/* 0x00 */ BE(u16) field_0x0;
|
|
/* 0x02 */ BE(u16) mMaterialNum;
|
|
/* 0x04 */ BE(u16) field_0x4;
|
|
/* 0x06 */ BE(u16) field_0x6;
|
|
/* 0x08 */ BE(u16) field_0x8[4];
|
|
/* 0x10 */ JGeometry::TVec2<BE(s16)> field_0x10[4];
|
|
/* 0x20 */ BE(u32) mCornerColor[4];
|
|
}; // Size: 0x30
|
|
|
|
/**
|
|
* @ingroup jsystem-j2d
|
|
*
|
|
*/
|
|
class J2DPicture : public J2DPane {
|
|
public:
|
|
virtual ~J2DPicture();
|
|
virtual u16 getTypeID() const { return 18; }
|
|
virtual void drawSelf(f32, f32);
|
|
virtual void drawSelf(f32, f32, Mtx*);
|
|
virtual void initiate(ResTIMG const*, ResTLUT const*);
|
|
virtual bool prepareTexture(u8);
|
|
virtual bool append(ResTIMG const* param_0, f32 param_1) {
|
|
return insert(param_0, mTextureNum, param_1);
|
|
}
|
|
virtual bool append(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) {
|
|
return insert(param_0, param_1, mTextureNum, param_2);
|
|
}
|
|
virtual bool append(char const* param_0, f32 param_1) {
|
|
return insert(param_0, mTextureNum, param_1);
|
|
}
|
|
virtual bool append(char const* param_0, JUTPalette* param_1, f32 param_2) {
|
|
return insert(param_0, param_1, mTextureNum, param_2);
|
|
}
|
|
virtual bool append(JUTTexture* param_0, f32 param_1) {
|
|
return insert(param_0, mTextureNum, param_1);
|
|
}
|
|
virtual void prepend(ResTIMG const* param_0, f32 param_1) {
|
|
insert(param_0, 0, param_1);
|
|
}
|
|
virtual void prepend(ResTIMG const* param_0, JUTPalette* param_1, f32 param_2) {
|
|
insert(param_0, param_1, 0, param_2);
|
|
}
|
|
virtual void prepend(char const* param_0, f32 param_1) {
|
|
insert(param_0, 0, param_1);
|
|
}
|
|
virtual void prepend(char const* param_0, JUTPalette* param_1, f32 param_2) {
|
|
insert(param_0, param_1, 0, param_2);
|
|
}
|
|
virtual void prepend(JUTTexture* param_0, f32 param_1) {
|
|
insert(param_0, 0, param_1);
|
|
}
|
|
virtual bool insert(ResTIMG const* param_0, u8 param_1, f32 param_2) {
|
|
return insert(param_0, NULL, param_1, param_2);
|
|
}
|
|
virtual bool insert(ResTIMG const*, JUTPalette*, u8, f32);
|
|
virtual bool insert(char const* param_0, u8 param_1, f32 param_2) {
|
|
return insert(param_0, NULL, param_1, param_2);
|
|
}
|
|
virtual bool insert(char const*, JUTPalette*, u8, f32);
|
|
virtual bool insert(JUTTexture*, u8, f32);
|
|
virtual bool remove(u8);
|
|
virtual bool remove() { return remove(mTextureNum - 1); }
|
|
virtual bool remove(JUTTexture*);
|
|
virtual void draw(f32 param_0, f32 param_1, bool param_2, bool param_3,
|
|
bool param_4) {
|
|
draw(param_0, param_1, 0, param_2, param_3, param_4);
|
|
}
|
|
virtual void draw(f32 param_0, f32 param_1, u8 param_2, bool param_3,
|
|
bool param_4, bool param_5) {
|
|
if (param_2 < mTextureNum && mTexture[param_2] != NULL) {
|
|
draw(param_0, param_1, mTexture[param_2]->getWidth(), mTexture[param_2]->getHeight(),
|
|
param_3, param_4, param_5);
|
|
}
|
|
}
|
|
virtual void draw(f32, f32, f32, f32, bool, bool, bool);
|
|
virtual void drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
|
|
f32 param_4, f32 param_5) {
|
|
if (mTexture[0] != NULL) {
|
|
drawOut(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3),
|
|
JGeometry::TBox2<f32>(param_4, param_5, param_4 + mTexture[0]->getWidth(),
|
|
param_5 + mTexture[0]->getHeight()));
|
|
}
|
|
}
|
|
virtual void drawOut(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
|
|
f32 param_4, f32 param_5, f32 param_6, f32 param_7) {
|
|
drawOut(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3),
|
|
JGeometry::TBox2<f32>(param_4, param_5, param_4 + param_6, param_5 + param_7));
|
|
}
|
|
virtual void drawOut(JGeometry::TBox2<f32> const&, JGeometry::TBox2<f32> const&);
|
|
virtual void load(GXTexMapID param_0, u8 param_1) {
|
|
if (param_1 < mTextureNum && param_1 < 2 && mTexture[param_1] != NULL) {
|
|
mTexture[param_1]->load(param_0);
|
|
}
|
|
}
|
|
virtual void load(u8 param_0) { load((GXTexMapID)param_0, param_0); }
|
|
virtual void setBlendRatio(f32 param_0, f32 param_1) {
|
|
setBlendColorRatio(param_0, param_1);
|
|
setBlendAlphaRatio(param_0, param_1);
|
|
}
|
|
virtual void setBlendColorRatio(f32, f32);
|
|
virtual void setBlendAlphaRatio(f32, f32);
|
|
virtual const ResTIMG* changeTexture(ResTIMG const*, u8);
|
|
virtual const ResTIMG* changeTexture(char const*, u8);
|
|
virtual const ResTIMG* changeTexture(ResTIMG const*, u8, JUTPalette*);
|
|
virtual const ResTIMG* changeTexture(char const*, u8, JUTPalette*);
|
|
virtual JUTTexture* getTexture(u8 param_0) const {
|
|
if (param_0 < 2) {
|
|
return mTexture[param_0];
|
|
}
|
|
return NULL;
|
|
}
|
|
virtual u8 getTextureCount() const { return mTextureNum; }
|
|
/* vt 0x128 */ virtual bool setBlack(JUtility::TColor i_black) {
|
|
mBlack = i_black;
|
|
return true;
|
|
}
|
|
/* vt 0x12C */ virtual bool setWhite(JUtility::TColor i_white) {
|
|
mWhite = i_white;
|
|
return true;
|
|
}
|
|
virtual bool setBlackWhite(JUtility::TColor i_black, JUtility::TColor i_white) {
|
|
mBlack = i_black;
|
|
mWhite = i_white;
|
|
return true;
|
|
}
|
|
virtual JUtility::TColor getBlack() const {
|
|
return mBlack;
|
|
}
|
|
virtual JUtility::TColor getWhite() const {
|
|
return mWhite;
|
|
}
|
|
virtual J2DMaterial* getMaterial() const { return NULL; }
|
|
virtual void drawFullSet(f32, f32, f32, f32, Mtx*);
|
|
virtual void drawTexCoord(f32, f32, f32, f32, s16, s16, s16, s16, s16, s16, s16,
|
|
s16, Mtx*);
|
|
virtual u8 getUsableTlut(u8);
|
|
virtual bool isUsed(ResTIMG const*);
|
|
virtual bool isUsed(ResFONT const* param_0) { return J2DPane::isUsed(param_0); }
|
|
virtual void rewriteAlpha() {}
|
|
|
|
J2DPicture(u64, JGeometry::TBox2<f32> const&, ResTIMG const*, ResTLUT const*);
|
|
J2DPicture(ResTIMG const*);
|
|
J2DPicture(J2DPane*, JSURandomInputStream*, JKRArchive*);
|
|
J2DPicture();
|
|
J2DPicture(J2DPane*, JSURandomInputStream*, J2DMaterial*);
|
|
void private_readStream(J2DPane*, JSURandomInputStream*, JKRArchive*);
|
|
void private_initiate(ResTIMG const*, ResTLUT const*);
|
|
void initinfo();
|
|
void setTevMode();
|
|
static void swap(f32&, f32&);
|
|
J2DBinding getBinding() const;
|
|
void setMirror(J2DMirror);
|
|
bool isTumble() const;
|
|
void setBlendKonstColor();
|
|
void setBlendKonstAlpha();
|
|
void getNewColor(JUtility::TColor*);
|
|
void setTexCoord(JGeometry::TVec2<s16>*, JUTTexture const*, J2DBinding,
|
|
J2DMirror, bool);
|
|
void setTexCoord(JUTTexture const*, J2DBinding, J2DMirror, bool);
|
|
GXTlut getTlutID(ResTIMG const*, u8);
|
|
|
|
void setCornerColor(JUtility::TColor c0, JUtility::TColor c1, JUtility::TColor c2,
|
|
JUtility::TColor c3) {
|
|
mCornerColor[0] = c0;
|
|
mCornerColor[1] = c1;
|
|
mCornerColor[2] = c2;
|
|
mCornerColor[3] = c3;
|
|
}
|
|
void setCornerColor(JUtility::TColor c0) {
|
|
setCornerColor(c0, c0, c0, c0);
|
|
}
|
|
|
|
protected:
|
|
/* 0x100 */ JUTTexture* mTexture[2];
|
|
/* 0x108 */ u8 mTextureNum;
|
|
/* 0x109 */ u8 field_0x109;
|
|
/* 0x10A */ JGeometry::TVec2<s16> field_0x10a[4];
|
|
/* 0x11C */ f32 field_0x11c[2];
|
|
/* 0x124 */ f32 field_0x124[2];
|
|
/* 0x12C */ JUTPalette* mPalette;
|
|
/* 0x130 */ JUtility::TColor mWhite;
|
|
/* 0x134 */ JUtility::TColor mBlack;
|
|
/* 0x138 */ JUtility::TColor mCornerColor[4];
|
|
/* 0x148 */ JUtility::TColor mBlendKonstColor;
|
|
/* 0x14C */ JUtility::TColor mBlendKonstAlpha;
|
|
};
|
|
|
|
#endif /* J2DPICTURE_H */
|