JSUOutputStream Matching for shield (#2825)

* JSUOutputStream Matching for shield

* Fix nonmatching in JAUSectionHeap
This commit is contained in:
hatal175 2025-11-19 20:17:26 +02:00 committed by GitHub
parent 9d325bfb29
commit 678c1a0e70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 17 deletions

View File

@ -995,7 +995,7 @@ config.libs = [
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01", "ShieldD"), "JSystem/JAudio2/JAUBankTable.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JAudio2/JAUClusterSound.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JAudio2/JAUInitializer.cpp"),
Object(Equivalent, "JSystem/JAudio2/JAUSectionHeap.cpp"),
Object(Equivalent, "JSystem/JAudio2/JAUSectionHeap.cpp"), #weak function order
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JAudio2/JAUSeqCollection.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JAudio2/JAUSeqDataBlockMgr.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JAudio2/JAUSoundAnimator.cpp"),
@ -1090,7 +1090,7 @@ config.libs = [
[
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JSupport/JSUList.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JSupport/JSUInputStream.cpp"),
Object(NonMatching, "JSystem/JSupport/JSUOutputStream.cpp"),
Object(MatchingFor("Shield", "ShieldD"), "JSystem/JSupport/JSUOutputStream.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JSupport/JSUMemoryStream.cpp"),
Object(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "JSystem/JSupport/JSUFileStream.cpp"),
],

View File

@ -12,7 +12,7 @@ public:
JSUOutputStream() {}
virtual ~JSUOutputStream();
virtual s32 skip(s32, s8) = 0;
virtual s32 skip(s32, s8);
virtual s32 writeData(const void*, s32) = 0;
s32 write(const void*, s32);

View File

@ -12,7 +12,6 @@ public:
JSURandomOutputStream() {}
virtual ~JSURandomOutputStream() {}
/* vt[3] */ virtual s32 skip(s32, s8);
/* vt[4] */ virtual s32 writeData(const void*, s32) = 0;
/* vt[5] */ virtual s32 getLength() const = 0;
/* vt[6] */ virtual s32 getPosition() const = 0;

View File

@ -67,6 +67,14 @@ namespace {
};
}
namespace {
bool JKRSolidHeap_isEmpty(JKRSolidHeap* pHeap) {
u32 beforeSize = pHeap->getFreeSize();
pHeap->freeAll();
return pHeap->getFreeSize() - beforeSize == 0;
}
}
/* 802A4EE8-802A4F68 29F828 0080+00 1/1 0/0 0/0 .text __ct__Q210JAUSection12TSectionDataFv */
JAUSection::TSectionData::TSectionData() {
resetRegisteredWaveBankTables();
@ -119,8 +127,8 @@ void JAUSection::finishBuild() {
/* 802A5160-802A51E4 29FAA0 0084+00 2/0 0/0 0/0 .text dispose__10JAUSectionFv */
void JAUSection::dispose() {
/* JUT_ASSERT(267, ! data_.registeredBankTables.any());
JUT_ASSERT(268, ! data_.registeredWaveBankTables.any()); */
JUT_ASSERT(267, ! data_.registeredBankTables.any());
JUT_ASSERT(268, ! data_.registeredWaveBankTables.any());
if (data_.mBstDst) {
sectionHeap_->sectionHeapData_.soundTable->~JAUSoundTable();
sectionHeap_->sectionHeapData_.soundTable = NULL;
@ -362,7 +370,6 @@ JASBank* JAUSection::newBank(void const* param_0, u32 param_1) {
}
/* 802A5B84-802A5CAC 2A04C4 0128+00 0/0 1/1 0/0 .text newVoiceBank__10JAUSectionFUlUl */
// NONMATCHING regalloc
JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) {
{
JUT_ASSERT(685, isOpen());
@ -371,7 +378,6 @@ JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) {
JUT_ASSERT(688, waveBank != NULL);
TPushCurrentHeap push(getHeap_());
JASBank* voiceBank = new JASVoiceBank();
JASVoiceBank* voiceBank2 = (JASVoiceBank*)voiceBank;
if (voiceBank) {
if (buildingBankTable_) {
JUT_ASSERT(696, buildingBankTable_->getBank( bank_no ) == 0);
@ -381,8 +387,8 @@ JASVoiceBank* JAUSection::newVoiceBank(u32 bank_no, u32 param_1) {
JASDefaultBankTable::getInstance()->registBank(bank_no, voiceBank);
data_.registeredBankTables.set(bank_no, true);
}
voiceBank2->assignWaveBank(waveBank);
return voiceBank2;
voiceBank->assignWaveBank(waveBank);
return (JASVoiceBank*)voiceBank;
}
}
return NULL;
@ -453,11 +459,6 @@ void JAUSectionHeap::releaseIdleDynamicSeqDataBlock() {
sectionHeapData_.seqDataBlocks.releaseIdleDynamicSeqDataBlock(sectionHeapData_.seqDataUser);
}
namespace {
// TODO
bool JKRSolidHeap_isEmpty(JKRSolidHeap*) { return 1; }
}
/* 802A5F24-802A5F9C 2A0864 0078+00 1/1 0/0 0/0 .text JAUNewSectionHeap__FP12JKRSolidHeapb */
static JAUSectionHeap* JAUNewSectionHeap(JKRSolidHeap* heap, bool param_1) {
JUT_ASSERT(809, JKRSolidHeap_isEmpty( heap ));

View File

@ -29,7 +29,7 @@ public:
__bitset_base() { data = 0; }
bool test(size_t pos) const { return data & (1 << pos); }
bool any() const;
bool any() const { return data != 0; }
void set(size_t pos, bool val) { data |= (1 << pos); }
void reset(size_t pos) { data &= ~(1 << pos); }
private:
@ -62,6 +62,15 @@ template<size_t N> void __bitset_base<N>::reset(size_t pos) {
data[i] &= ~mask;
}
template<size_t N> bool __bitset_base<N>::any() const {
for (int i = 0; i < N; i++) {
if (data[i] != 0) {
return true;
}
}
return false;
}
template<size_t N> class bitset : private __bitset_base<(N - 1) / (sizeof(size_t) * 8) + 1> {
public:
typedef __bitset_base<(N - 1) / (sizeof(size_t) * 8) + 1> base;
@ -86,7 +95,9 @@ public:
}
return base::test(pos);
}
bool any() const;
bool any() const {
return base::any();
}
};
} // namespace std