More progress in CScriptStreamedAudio

This commit is contained in:
Henrique Gemignani Passos Lima 2023-01-06 14:30:08 +02:00
parent c66f5915fb
commit c4ee46df58
No known key found for this signature in database
GPG Key ID: E224F951761145F8
5 changed files with 31 additions and 11 deletions

View File

@ -1185,7 +1185,7 @@ __ct__19CInGameTweakManagerFv:
/* 8021D12C 0021A08C 90 01 00 1C */ stw r0, 0x1c(r1)
/* 8021D130 0021A090 90 E1 00 10 */ stw r7, 0x10(r1)
/* 8021D134 0021A094 90 C1 00 14 */ stw r6, 0x14(r1)
/* 8021D138 0021A098 4B FE F6 B9 */ bl sub_8020c7f0
/* 8021D138 0021A098 4B FE F6 B9 */ bl "sub_8020c7f0__FRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
/* 8021D13C 0021A09C 7C 7E 1B 78 */ mr r30, r3
/* 8021D140 0021A0A0 7F E3 FB 78 */ mr r3, r31
/* 8021D144 0021A0A4 38 9E 00 01 */ addi r4, r30, 1

View File

@ -135,7 +135,7 @@ sub_8020be90__20CScriptStreamedMusicFv:
/* 8020BF74 00208ED4 90 A1 00 1C */ stw r5, 0x1c(r1)
/* 8020BF78 00208ED8 90 C1 00 10 */ stw r6, 0x10(r1)
/* 8020BF7C 00208EDC 90 01 00 14 */ stw r0, 0x14(r1)
/* 8020BF80 00208EE0 48 00 08 71 */ bl sub_8020c7f0
/* 8020BF80 00208EE0 48 00 08 71 */ bl "sub_8020c7f0__FRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
/* 8020BF84 00208EE4 7C 7E 1B 78 */ mr r30, r3
/* 8020BF88 00208EE8 38 61 00 78 */ addi r3, r1, 0x78
/* 8020BF8C 00208EEC 38 9E 00 01 */ addi r4, r30, 1
@ -760,8 +760,8 @@ IsOneShot__20CScriptStreamedMusicFb:
/* 8020C7E8 00209748 54 03 D9 7E */ srwi r3, r0, 5
/* 8020C7EC 0020974C 4E 80 00 20 */ blr
.global sub_8020c7f0
sub_8020c7f0:
.global "sub_8020c7f0__FRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>"
"sub_8020c7f0__FRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>":
/* 8020C7F0 00209750 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 8020C7F4 00209754 7C 08 02 A6 */ mflr r0
/* 8020C7F8 00209758 90 01 00 24 */ stw r0, 0x24(r1)

View File

@ -33,7 +33,7 @@ private:
void sub_8020c3f0(CStateManager& mgr);
void sub_8020c414(CStateManager& mgr);
rstl::string sub_8020be90();
void sub_8020be90();
};
#endif // _CSCRIPTSTREAMEDAUDIO

View File

@ -25,7 +25,7 @@ class basic_string {
uint x8_size;
uint _pad; // Alloc?
// void internal_allocate(int size)
void internal_allocate(int size);
// {
// x4_cow = reinterpret_cast<COWData*>(new uchar[size * sizeof(_CharTp) +
// 8]); x0_ptr = x4_cow->x8_data; x4_cow->x0_capacity = uint(size);
@ -104,6 +104,8 @@ public:
return *this;
}
basic_string operator+(const _CharTp*);
void append(const basic_string& other);
void append(int, _CharTp);
int _eq_helper(const basic_string& other) const;
bool operator==(const basic_string& other) const;
@ -140,8 +142,18 @@ string string_l(const char* data);
// return string(string::literal_t(), data);
// }
string operator+(const string&, const string&);
string operator+(const string&, char);
string operator+(const string& a, const string& b);
// {
// string result(a);
// result.append(b);
// return result;
// }
string operator+(const string& a, char c) {
string result(a);
result.append(1, c);
return result;
}
CHECK_SIZEOF(string, 0x10)
} // namespace rstl

View File

@ -11,6 +11,14 @@
extern "C" void nullsub_42(CScriptStreamedMusic*);
int sub_8020c154(const rstl::string&, int, int);
extern "C" int sub_8020c844(int* a, int* b) {
return b[1] - a[1];
}
rstl::string sub_8020c7f0(const rstl::string&) {
sub_8020c844(nullptr, nullptr);
}
int CScriptStreamedMusic::IsOneShot(bool b) { return b == false; }
CScriptStreamedMusic::CScriptStreamedMusic(TUniqueId id, const CEntityInfo& info,
@ -141,14 +149,14 @@ void CScriptStreamedMusic::TweakOverride(CStateManager& mgr) {
int sub_8020c154(const rstl::string&, int, int) {}
rstl::string CScriptStreamedMusic::sub_8020be90() {
void CScriptStreamedMusic::sub_8020be90() {
if (x45_fileIsDsp && sub_8020c154(x34_fileName, 0x7c, 0) == -1 && x34_fileName.size() >= 4) {
if (CStringExtras::CompareCaseInsensitive(
rstl::string_l(x34_fileName.data() + (x34_fileName.size() - 5)),
rstl::string_l("L.dsp")) == 0) {
rstl::string buf;
rstl::string file = buf + "R.dsp";
sub_8020c7f0(x34_fileName);
rstl::string file = x34_fileName + "R.dsp";
if (CDvdFile::FileExists(file.data())) {
x34_fileName = x34_fileName + '|' + file;
}