Skip to content

Commit ae29877

Browse files
authored
Match gf_archive_db.cpp (#83)
1 parent d916932 commit ae29877

File tree

6 files changed

+60
-5
lines changed

6 files changed

+60
-5
lines changed

config/RSBE01_02/splits.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ sora/gf/gf_archive_load_thread.cpp:
4141
sora/gf/gf_archive_file.cpp:
4242
.text start:0x80016408 end:0x8001643C
4343

44+
sora/gf/gf_archive_db.cpp:
45+
.text start:0x8001643C end:0x80016688
46+
4447
sora/gf/gf_camera_controller.cpp:
4548
.text start:0x8001A3A4 end:0x8001A3AC
4649
.data start:0x80420B88 end:0x80420BA0

config/RSBE01_02/symbols.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,10 +2250,10 @@ fn_80015E34 = .text:0x80015E34; // type:function size:0x144
22502250
fn_80015F78 = .text:0x80015F78; // type:function size:0x1B8
22512251
fn_80016130 = .text:0x80016130; // type:function size:0x2D8
22522252
getDataChunk__19gfArchiveFileHeaderFv = .text:0x80016408; // type:function size:0x34
2253-
fn_8001643C = .text:0x8001643C; // type:function size:0x98
2254-
fn_800164D4 = .text:0x800164D4; // type:function size:0xFC
2255-
fn_800165D0 = .text:0x800165D0; // type:function size:0x94
2256-
fn_80016664 = .text:0x80016664; // type:function size:0x24
2253+
create__17gfArchiveDatabaseFUlQ25Heaps8HeapType = .text:0x8001643C; // type:function size:0x98
2254+
__dt__17gfArchiveDatabaseFv = .text:0x800164D4; // type:function size:0xFC
2255+
add__17gfArchiveDatabaseFP9gfArchiveb = .text:0x800165D0; // type:function size:0x94
2256+
get__17gfArchiveDatabaseCFl = .text:0x80016664; // type:function size:0x24
22572257
fn_80016688 = .text:0x80016688; // type:function size:0x68
22582258
fn_800166F0 = .text:0x800166F0; // type:function size:0x90
22592259
fn_80016780 = .text:0x80016780; // type:function size:0x30

configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ def MatchingFor(*versions):
294294
Object(Matching, "sora/gf/gf_3d_scene_light_resource.cpp"),
295295
Object(Matching, "sora/gf/gf_archive_load_thread.cpp"),
296296
Object(Matching, "sora/gf/gf_archive_file.cpp"),
297+
Object(Matching, "sora/gf/gf_archive_db.cpp"),
297298
Object(Matching, "sora/gf/gf_camera_controller.cpp"),
298299
Object(Matching, "sora/gf/gf_callback.cpp"),
299300
Object(Matching, "sora/gf/gf_decomp.cpp"),

src/mo_scene/sora_scene/sc_adv_gameover.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <sr/sr_common.h>
99
#include <types.h>
1010

11+
// NONMATCHING: instruction ordering in the ctor
1112
scAdvGameover* scAdvGameover::create() {
1213
return new (Heaps::GlobalMode) scAdvGameover("scAdvGameover");
1314
}

src/sora/gf/gf_archive_db.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include <gf/gf_archive.h>
2+
#include <gf/gf_archive_db.h>
3+
#include <sr/sr_common.h>
4+
#include <types.h>
5+
6+
gfArchiveDatabase* gfArchiveDatabase::create(u32 count, Heaps::HeapType heap) {
7+
return new (heap, count) gfArchiveDatabase(count);
8+
}
9+
10+
gfArchiveDatabase::~gfArchiveDatabase() {
11+
for (s32 i = 0; i < m_capacity; i++) {
12+
gfArchiveDatabaseEntry* ep = &m_entries[i];
13+
if (ep->m_isActive) {
14+
if (!--ep->m_archive->m_refCount) {
15+
if (ep->m_isOwner) {
16+
delete ep->m_archive;
17+
}
18+
ep->m_archive = nullptr;
19+
ep->m_isActive = false;
20+
}
21+
ep = &m_entries[i];
22+
ep->m_archive = nullptr;
23+
ep->unk4_b7 = ep->m_isActive = false;
24+
ep->m_isOwner = true;
25+
ep->m_next = nullptr;
26+
}
27+
}
28+
m_entries = nullptr;
29+
m_capacity = 0;
30+
m_size = 0;
31+
}
32+
33+
s32 gfArchiveDatabase::add(gfArchive* arc, bool makeOwner) {
34+
s32 idx = findAvail();
35+
arc->m_refCount++;
36+
m_entries[idx].m_archive = arc;
37+
m_entries[idx].m_isActive = true;
38+
m_entries[idx].m_isOwner = makeOwner;
39+
m_size++;
40+
return idx;
41+
}
42+
43+
gfArchive* gfArchiveDatabase::get(s32 i) const {
44+
const gfArchiveDatabaseEntry* ep = &m_entries[i];
45+
gfArchive* arc = nullptr;
46+
if (ep->m_isActive) {
47+
arc = ep->m_archive;
48+
}
49+
return arc;
50+
}

0 commit comments

Comments
 (0)