diff --git a/config/RSBE01_02/splits.txt b/config/RSBE01_02/splits.txt index 62f15b3..0d69ad4 100644 --- a/config/RSBE01_02/splits.txt +++ b/config/RSBE01_02/splits.txt @@ -41,6 +41,9 @@ sora/gf/gf_archive_load_thread.cpp: sora/gf/gf_archive_file.cpp: .text start:0x80016408 end:0x8001643C +sora/gf/gf_archive_db.cpp: + .text start:0x8001643C end:0x80016688 + sora/gf/gf_camera_controller.cpp: .text start:0x8001A3A4 end:0x8001A3AC .data start:0x80420B88 end:0x80420BA0 diff --git a/config/RSBE01_02/symbols.txt b/config/RSBE01_02/symbols.txt index 3b6c8a3..920a9e1 100644 --- a/config/RSBE01_02/symbols.txt +++ b/config/RSBE01_02/symbols.txt @@ -2250,10 +2250,10 @@ fn_80015E34 = .text:0x80015E34; // type:function size:0x144 fn_80015F78 = .text:0x80015F78; // type:function size:0x1B8 fn_80016130 = .text:0x80016130; // type:function size:0x2D8 getDataChunk__19gfArchiveFileHeaderFv = .text:0x80016408; // type:function size:0x34 -fn_8001643C = .text:0x8001643C; // type:function size:0x98 -fn_800164D4 = .text:0x800164D4; // type:function size:0xFC -fn_800165D0 = .text:0x800165D0; // type:function size:0x94 -fn_80016664 = .text:0x80016664; // type:function size:0x24 +create__17gfArchiveDatabaseFUlQ25Heaps8HeapType = .text:0x8001643C; // type:function size:0x98 +__dt__17gfArchiveDatabaseFv = .text:0x800164D4; // type:function size:0xFC +add__17gfArchiveDatabaseFP9gfArchiveb = .text:0x800165D0; // type:function size:0x94 +get__17gfArchiveDatabaseCFl = .text:0x80016664; // type:function size:0x24 fn_80016688 = .text:0x80016688; // type:function size:0x68 fn_800166F0 = .text:0x800166F0; // type:function size:0x90 fn_80016780 = .text:0x80016780; // type:function size:0x30 diff --git a/configure.py b/configure.py index b6cca20..3dd4432 100755 --- a/configure.py +++ b/configure.py @@ -294,6 +294,7 @@ def MatchingFor(*versions): Object(Matching, "sora/gf/gf_3d_scene_light_resource.cpp"), Object(Matching, "sora/gf/gf_archive_load_thread.cpp"), Object(Matching, "sora/gf/gf_archive_file.cpp"), + Object(Matching, "sora/gf/gf_archive_db.cpp"), Object(Matching, "sora/gf/gf_camera_controller.cpp"), Object(Matching, "sora/gf/gf_callback.cpp"), Object(Matching, "sora/gf/gf_decomp.cpp"), diff --git a/include/lib/BrawlHeaders b/include/lib/BrawlHeaders index 8587c76..2701c15 160000 --- a/include/lib/BrawlHeaders +++ b/include/lib/BrawlHeaders @@ -1 +1 @@ -Subproject commit 8587c76129abbcdd29c0dc209f01fcc79fbba255 +Subproject commit 2701c155c4778091792cbd0fb4dca3a885a1cdc8 diff --git a/src/mo_scene/sora_scene/sc_adv_gameover.cpp b/src/mo_scene/sora_scene/sc_adv_gameover.cpp index cca53ba..29370af 100644 --- a/src/mo_scene/sora_scene/sc_adv_gameover.cpp +++ b/src/mo_scene/sora_scene/sc_adv_gameover.cpp @@ -8,6 +8,7 @@ #include #include +// NONMATCHING: instruction ordering in the ctor scAdvGameover* scAdvGameover::create() { return new (Heaps::GlobalMode) scAdvGameover("scAdvGameover"); } diff --git a/src/sora/gf/gf_archive_db.cpp b/src/sora/gf/gf_archive_db.cpp new file mode 100644 index 0000000..0113caa --- /dev/null +++ b/src/sora/gf/gf_archive_db.cpp @@ -0,0 +1,50 @@ +#include +#include +#include +#include + +gfArchiveDatabase* gfArchiveDatabase::create(u32 count, Heaps::HeapType heap) { + return new (heap, count) gfArchiveDatabase(count); +} + +gfArchiveDatabase::~gfArchiveDatabase() { + for (s32 i = 0; i < m_capacity; i++) { + gfArchiveDatabaseEntry* ep = &m_entries[i]; + if (ep->m_isActive) { + if (!--ep->m_archive->m_refCount) { + if (ep->m_isOwner) { + delete ep->m_archive; + } + ep->m_archive = nullptr; + ep->m_isActive = false; + } + ep = &m_entries[i]; + ep->m_archive = nullptr; + ep->unk4_b7 = ep->m_isActive = false; + ep->m_isOwner = true; + ep->m_next = nullptr; + } + } + m_entries = nullptr; + m_capacity = 0; + m_size = 0; +} + +s32 gfArchiveDatabase::add(gfArchive* arc, bool makeOwner) { + s32 idx = findAvail(); + arc->m_refCount++; + m_entries[idx].m_archive = arc; + m_entries[idx].m_isActive = true; + m_entries[idx].m_isOwner = makeOwner; + m_size++; + return idx; +} + +gfArchive* gfArchiveDatabase::get(s32 i) const { + const gfArchiveDatabaseEntry* ep = &m_entries[i]; + gfArchive* arc = nullptr; + if (ep->m_isActive) { + arc = ep->m_archive; + } + return arc; +}