Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STL my Port #256

Merged
merged 17 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions config/SZBE69_B8/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,20 @@ splits: config/SZBE69_B8/splits.txt
selfile: orig/SZBE69_B8/files/band_r_wii.sel
mw_comment_version: 14
quick_analysis: true

block_relocations:
# False relocations in binkacd due to funky bit arithmetic
- source: .text:0x80A1A9D0 # ClampToS16
end: .text:0x80A1AA3C
- source: .text:0x80A1AA40 # ClampToS16AndInterleave
end: .text:0x80A1AAF8
# False relocations in ChecksumData_wii
- source: .data:0x80B585D4
- source: .data:0x80B58EC4
- source: .data:0x80B5ADB8
- source: .data:0x80B5B3A0
- source: .data:0x80B5B714
- source: .data:0x80B5BCF8
- source: .data:0x80B5BED4
- source: .data:0x80B5C1F0
- source: .data:0x80B5D0AC
5 changes: 4 additions & 1 deletion config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,10 @@
"system/rndobj/ShaderOptions.cpp": "Matching",
"system/rndobj/SIVideo.cpp": "Matching",
"system/rndobj/SoftParticles.cpp": "Matching",
"system/rndobj/Tex.cpp": "NonMatching",
"system/rndobj/Tex.cpp": {
"status": "LinkIssues",
"comment": ".bss ordering meme"
},
"system/rndobj/TexBlendController.cpp": "NonMatching",
"system/rndobj/TexBlender.cpp": {
"status": "LinkIssues",
Expand Down
19,094 changes: 9,547 additions & 9,547 deletions config/SZBE69_B8/symbols.txt

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
# Tool versions
config.binutils_tag = "2.41-1"
config.compilers_tag = "20231018"
config.dtk_tag = "v0.8.2"
config.dtk_tag = "v0.9.1"
config.sjiswrap_tag = "v1.1.1"
config.wibo_tag = "0.6.11"

Expand Down Expand Up @@ -178,6 +178,8 @@ def set_flags_inherited(name: str):
base_flags.append(f"-d VERSION_{config.version}")
if config.debug:
base_flags.append("-sym dwarf-2,full")
# Causes code generation memes, use only in desperation
# base_flags.append("-pragma \"debuginline on\"")

# Apply cflag inheritance
def apply_base_flags(key: str):
Expand Down
4 changes: 2 additions & 2 deletions src/system/bandobj/StarDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int StarDisplay::GetStarCountForSymbol(Symbol s) {
}

void StarDisplay::DrawShowing() {
ObjectDir* dir = mMesh->mDir.mDir;
ObjectDir* dir = mResource->mDir.mDir;
MILO_ASSERT(dir, 312);
unk_0x10C->SetTransParent(this, false);
unk_0x10C->Draw();
Expand All @@ -145,7 +145,7 @@ void StarDisplay::Update() {
UIComponent::Update();
DataArray* typeDef = mTypeDef;
MILO_ASSERT(typeDef, 369);
ObjectDir* dir = mMesh->mDir.mDir;
ObjectDir* dir = mResource->mDir.mDir;
MILO_ASSERT(dir, 372);
unk_0x10C->ResourceCopy(dir->Find<BandLabel>(typeDef->FindArray(resource_stars_label, true)->Str(1), true));
BandLabel* bl2 = dir->Find<BandLabel>(typeDef->FindArray(resource_stars_mixed_label, true)->Str(1), true);
Expand Down
8 changes: 4 additions & 4 deletions src/system/midi/MidiParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ void MidiParser::Init(){
Hmx::Object* MidiParser::NewObject() { return new MidiParser(); }

MidiParser::PostProcess::PostProcess() : zeroLength(false), startOffset(0),
endOffset(0), minLength(0), maxLength(1e30), minGap(-1e30),
endOffset(0), minLength(0), maxLength(1e30), minGap(-1e30),
maxGap(1e30), useRealtimeGaps(false), variableBlendPct(0) { }

MidiParser::MidiParser() : mTrackName(), mGemParser(0), mNoteParser(0), mTextParser(0), mLyricParser(0), mCurParser(0),
MidiParser::MidiParser() : mTrackName(), mGemParser(0), mNoteParser(0), mTextParser(0), mLyricParser(0), mCurParser(0),
mVocalEvents(0), mNotes(), mGems(0), mInverted(0), mLastStart(-1e+30f), mLastEnd(-1e+30f), mFirstEnd(-1e+30f),
mMessageType(), mAppendLength(false), mUseVariableBlending(false), mMessageSelf(false), mCompressed(false), mStart(0.0f), mBefore(0) {
mEvents = new DataEventList();
Expand All @@ -56,7 +56,7 @@ MidiParser::~MidiParser(){
}

void MidiParser::SetTypeDef(DataArray* arr){
if(typeDef != arr){
if(mTypeDef != arr){
Hmx::Object::SetTypeDef(arr);
mInverted = false;
mTrackName = Symbol("");
Expand Down Expand Up @@ -366,4 +366,4 @@ BEGIN_PROPSYNCS(MidiParser)
}
return true;
}
END_PROPSYNCS
END_PROPSYNCS
13 changes: 6 additions & 7 deletions src/system/obj/ObjPtr_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ template <class T1> BinStream& operator>>(BinStream& bs, ObjPtr<T1, class Object

template <class T1, class T2> class ObjOwnerPtr : public ObjRef {
public:

ObjOwnerPtr(Hmx::Object* obj, T1* cls): mOwner(obj), mPtr(cls) {
ObjOwnerPtr(Hmx::Object* obj, T1* cls = nullptr): mOwner(obj), mPtr(cls) {
if(mPtr != 0) mPtr->AddRef(mOwner);
}

Expand All @@ -75,7 +74,7 @@ template <class T1, class T2> class ObjOwnerPtr : public ObjRef {
}

virtual Hmx::Object* RefOwner(){ return mOwner; }
virtual void Replace(Hmx::Object*, Hmx::Object*){
virtual void Replace(Hmx::Object*, Hmx::Object*){
MILO_FAIL("Should go to owner");
}

Expand Down Expand Up @@ -131,7 +130,7 @@ template <class T1, class T2> class ObjPtrList : public ObjRef {
public:
// if you wanna check the iterator methods in objdiff, go to CharHair.cpp
// CharHair.cpp has plenty of ObjPtr and ObjPtrList methods for you to double check

iterator() : mNode(0) {}
iterator(Node* node) : mNode(node) {}
T1* operator*(){ return mNode->obj; }
Expand All @@ -154,7 +153,7 @@ template <class T1, class T2> class ObjPtrList : public ObjRef {
ObjListMode mMode : 8;

// RB3 apparently also has pop_front? gross // pop_front__36ObjPtrList<Q23Hmx6Object,9ObjectDir>Fv

ObjPtrList(Hmx::Object* owner, ObjListMode mode) : mNodes(0), mOwner(owner), mSize(0), mMode(mode) {
if(mode == kObjListOwnerControl){
MILO_ASSERT(owner, 0xFC);
Expand Down Expand Up @@ -198,7 +197,7 @@ template <class T1, class T2> class ObjPtrList : public ObjRef {
void push_back(T1* obj){
insert(end(), obj);
}

// seems to be okay - shows as 100% in EventTrigger
void pop_back(){
MILO_ASSERT(mNodes, 0x16D);
Expand Down Expand Up @@ -269,7 +268,7 @@ template <class T1, class T2> class ObjPtrList : public ObjRef {
// link__36ObjPtrList<11RndDrawable,9ObjectDir>F Q2 36ObjPtrList<11RndDrawable,9ObjectDir> 8iterator P Q2 36ObjPtrList<11RndDrawable,9ObjectDir> 4Node
void link(iterator it, Node* n) {
Node*& itNode = it.mNode;

if (n->obj) {
n->obj->AddRef(this);
}
Expand Down
21 changes: 11 additions & 10 deletions src/system/obj/PropSync_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum PropOp {
kPropRemove = 8,
kPropSize = 16,
kPropHandle = 32,
kPropUnknown0x40 = 64,
};

// forward declarations
Expand Down Expand Up @@ -65,7 +66,7 @@ inline bool PropSync(Symbol& sym, DataNode& node, DataArray* prop, int i, PropOp
}

template <class T> inline bool PropSync(T*& obj, DataNode& node, DataArray* prop, int i, PropOp op){
if((int)op == 0x40) return false;
if(op == kPropUnknown0x40) return false;
else {
MILO_ASSERT(i == prop->Size() && op <= kPropInsert, 0x58);
if(op == kPropGet) node = DataNode((Hmx::Object*)obj);
Expand All @@ -75,7 +76,7 @@ template <class T> inline bool PropSync(T*& obj, DataNode& node, DataArray* prop
}

template <class T> bool PropSync(ObjPtr<T, class ObjectDir>& ptr, DataNode& node, DataArray* prop, int i, PropOp op){
if((int)op == 0x40) return false;
if(op == kPropUnknown0x40) return false;
else {
MILO_ASSERT(i == prop->Size() && op <= kPropInsert, 0x125);
if(op == kPropGet) node = DataNode(ptr.Ptr());
Expand All @@ -85,7 +86,7 @@ template <class T> bool PropSync(ObjPtr<T, class ObjectDir>& ptr, DataNode& node
}

template <class T> bool PropSync(ObjOwnerPtr<T, class ObjectDir>& ptr, DataNode& node, DataArray* prop, int i, PropOp op){
if((int)op == 0x40) return false;
if(op == kPropUnknown0x40) return false;
else {
MILO_ASSERT(op <= kPropInsert, 0x132);
if(op == kPropGet) node = DataNode(ptr.Ptr());
Expand All @@ -97,7 +98,7 @@ template <class T> bool PropSync(ObjOwnerPtr<T, class ObjectDir>& ptr, DataNode&
// fn_805E3988 - PropSync(ObjPtrList<Sequence>&) - used in EventTrigger.cpp
// fn_80642860 - PropSync(ObjPtrList&, ...)
template <class T> bool PropSync(ObjPtrList<T, class ObjectDir>& ptr, DataNode& node, DataArray* prop, int i, PropOp op){
if((int)op == 0x40) return ptr.mMode == kObjListNoNull;
if(op == kPropUnknown0x40) return ptr.mMode == kObjListNoNull;
else if(i == prop->Size()){
MILO_ASSERT(op == kPropSize, 0x146);
node = DataNode(ptr.size());
Expand Down Expand Up @@ -134,7 +135,7 @@ template <class T> bool PropSync(ObjPtrList<T, class ObjectDir>& ptr, DataNode&
}

template <class T> bool PropSync(std::list<T>& pList, DataNode& node, DataArray* prop, int i, PropOp op) {
if((int)op == 0x40) return false;
if(op == kPropUnknown0x40) return false;
else if(i == prop->Size()){
MILO_ASSERT(op == kPropSize, 146);
node = DataNode((int)pList.size());
Expand All @@ -145,7 +146,7 @@ template <class T> bool PropSync(std::list<T>& pList, DataNode& node, DataArray*
for(int count = prop->Int(i++); count > 0; count--){
it++;
}
if(i < prop->Size() || op & 0x13){
if(i < prop->Size() || op & (kPropGet|kPropSet|kPropSize)){
return PropSync(*it, node, prop, i, op);
}
else if(op == kPropRemove){
Expand All @@ -164,15 +165,15 @@ template <class T> bool PropSync(std::list<T>& pList, DataNode& node, DataArray*
}

template <class T, typename T2> bool PropSync(std::vector<T, T2>& vec, DataNode& node, DataArray* prop, int i, PropOp op) {
if((int)op == 0x40) return false;
if(op == kPropUnknown0x40) return false;
else if(i == prop->Size()){
MILO_ASSERT(op == kPropSize, 146);
node = DataNode((int)vec.size());
return true;
}
else {
std::vector<T, T2>::iterator it = vec.begin() + prop->Int(i++);
if(i < prop->Size() || op & 0x13){
if(i < prop->Size() || op & (kPropGet|kPropSet|kPropSize)){
return PropSync(*it, node, prop, i, op);
}
else if(op == kPropRemove){
Expand All @@ -189,15 +190,15 @@ template <class T, typename T2> bool PropSync(std::vector<T, T2>& vec, DataNode&
}

template <class T, typename T2> bool PropSync(ObjVector<T, T2>& objVec, DataNode& node, DataArray* prop, int i, PropOp op) {
if((int)op == 0x40) return false;
if(op == kPropUnknown0x40) return false;
else if(i == prop->Size()){
MILO_ASSERT(op == kPropSize, 0x17F);
node = DataNode((int)objVec.size());
return true;
}
else {
std::vector<T, T2>::iterator it = objVec.begin() + prop->Int(i++);
if(i < prop->Size() || op & 0x13){
if(i < prop->Size() || op & (kPropGet|kPropSet|kPropSize)){
return PropSync(*it, node, prop, i, op);
}
else if(op == kPropRemove){
Expand Down
4 changes: 0 additions & 4 deletions src/system/rndobj/CubeTex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ void RndCubeTex::Update(){
}
}

RndCubeTex::~RndCubeTex(){

}

SAVE_OBJ(RndCubeTex, 0x116);

void RndCubeTex::Load(BinStream& bs){
Expand Down
2 changes: 1 addition & 1 deletion src/system/rndobj/CubeTex.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RndCubeTex : public Hmx::Object {
};

RndCubeTex();
virtual ~RndCubeTex();
virtual ~RndCubeTex() {}
OBJ_CLASSNAME(CubeTex);
OBJ_SET_TYPE(CubeTex);
virtual DataNode Handle(DataArray*, bool);
Expand Down
2 changes: 1 addition & 1 deletion src/system/rndobj/Tex.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RndTex : public Hmx::Object {
virtual void UnlockBitmap() {}
virtual void MakeDrawTarget() {}
virtual void FinishDrawTarget() {}
virtual void Compress() {}
virtual void Compress(bool) {}
virtual bool TexelsLock(void*&) {return false;}
virtual void TexelsUnlock() {}
virtual int TexelsPitch() const { return 0; }
Expand Down
9 changes: 6 additions & 3 deletions src/system/stlport/stl/_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,18 @@ class _Vector_base {
: _M_ptr(__a, 0), _M_finish_idx(0), _M_data_size(0) {}

_Vector_base(size_t __n, const _Alloc& __a)
: _M_ptr(__a, 0), _M_finish_idx(0), _M_data_size(__n) {
: _M_ptr(__a, 0), _M_finish_idx(0), _M_data_size(0) {
_M_ptr._M_data = _M_ptr.allocate(__n);
_M_set_data_size(__n);
}

_Vector_base(__move_source<_Self> src)
: _M_ptr(__move_source<_AllocProxy>(src.get()._M_ptr)),
_M_finish_idx(src.get()._M_finish_idx), _M_data_size(src.get()._M_data_size) {
//Set the source as empty:
src.get()._M_finish_idx = src.get()._M_data_size = src.get()._M_ptr._M_data = 0;
src.get()._M_ptr._M_data = 0;
src.get()._M_finish_idx = 0;
src.get()._M_data_size = 0;
}

~_Vector_base() {
Expand Down Expand Up @@ -398,7 +401,7 @@ class vector : protected _STLP_PRIV::_Vector_base<_Tp, _Size, _Alloc>
void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x);

bool _M_is_inside(const value_type& __x) const {
return (&__x >= begin() && &__x < end());
return &__x >= begin() && (_Size)(&__x - begin()) < this->_M_finish_idx;
}

template <class _ForwardIterator>
Expand Down
8 changes: 1 addition & 7 deletions src/system/stlport/stl/pointers/_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,9 @@ class list
allocator_type get_allocator() const
{ return _M_impl.get_allocator(); }

explicit list()
: _M_impl(allocator_type()) {}

explicit list(const allocator_type& __a)
explicit list(const allocator_type& __a = allocator_type())
: _M_impl(__a) {}

// explicit list(const allocator_type& __a = allocator_type())
// : _M_impl(__a) {}

explicit list(size_type __n, const value_type& __val = value_type(),
const allocator_type& __a = allocator_type())
: _M_impl(__n, cast_traits::to_storage_type_cref(__val),
Expand Down
Loading
Loading