Compare commits
2 Commits
cleanup/co
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
affe5b1878 | ||
|
|
031fd1c137 |
@@ -44,10 +44,14 @@ namespace ipl {
|
||||
int stopBGM(int unk = 0);
|
||||
#endif
|
||||
int stopBGM(nw4r::snd::SoundHandle* handle, int unk = 0);
|
||||
int stopSE(nw4r::snd::SoundHandle* handle, int unk = 0);
|
||||
void stopSE(nw4r::snd::SoundHandle* handle, int unk = 0);
|
||||
void stopAllSound(int unk = 0);
|
||||
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void resetAllSound();
|
||||
#else
|
||||
int resetAllSound();
|
||||
#endif
|
||||
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void muteOffBGM(int);
|
||||
@@ -99,7 +103,7 @@ namespace ipl {
|
||||
long clipGELT_S32(long value, long lo, long hi);
|
||||
|
||||
private:
|
||||
u32 unk_0x620[0x18];
|
||||
u32 unk_0x620[3];
|
||||
};
|
||||
|
||||
// use getSystem() and getBannerPlayer() instead
|
||||
|
||||
@@ -356,8 +356,11 @@ namespace nw4r {
|
||||
|
||||
// u32 fontSizeToEndOfGlgr;
|
||||
|
||||
u16 nameCount;
|
||||
u16 countSheet;
|
||||
u16 smth0a;
|
||||
u16 sheetGlyphCount, dataBlockCount;
|
||||
u16 smth0c;
|
||||
|
||||
u32 stepSheetFlags;
|
||||
u32 flagsSheetsOff;
|
||||
@@ -368,18 +371,18 @@ namespace nw4r {
|
||||
|
||||
u32 sheetOffsetsScratchSize;
|
||||
|
||||
dataBlockCount = font->hdr.dataBlocks; // 0x0E
|
||||
sheetGlyphCount = font->glgr.inner.sheetGlyphCount; // 0x1C
|
||||
// countName = font->glgr.inner.nameCount;
|
||||
nameCount = font->glgr.inner.nameCount;
|
||||
countSheet = font->glgr.inner.sheetCount;
|
||||
// count0A = font->glgr.inner.smthCount_0x0a;
|
||||
// count0C = font->glgr.inner.smthCount_0x0c;
|
||||
smth0a = font->glgr.inner.smthCount_0x0a;
|
||||
sheetGlyphCount = font->glgr.inner.sheetGlyphCount;
|
||||
smth0c = font->glgr.inner.smthCount_0x0c;
|
||||
dataBlockCount = font->hdr.dataBlocks;
|
||||
|
||||
sheetOffsetsSize = ROUNDUP(countSheet * sizeof(u16), 4);
|
||||
sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)font + ctx->remWorkSpace()) - sheetOffsetsSize, 2);
|
||||
|
||||
stepSheetFlags = detail::CalcSizeFlagSet(countSheet);
|
||||
flagsSheetsOff = detail::CalcOffsetSheetFlags(font->glgr.inner.nameCount, countSheet, font->glgr.inner.smthCount_0x0a,
|
||||
font->glgr.inner.smthCount_0x0c);
|
||||
flagsSheetsOff = detail::CalcOffsetSheetFlags(nameCount, countSheet, smth0a, smth0c);
|
||||
flagsSheets = (const u32*)font + (flagsSheetsOff >> 2);
|
||||
|
||||
pGlgr = &font->glgr;
|
||||
|
||||
@@ -1180,7 +1180,11 @@ static u32 getCurrentHalfLine(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ((horizontalCount - 1) / CurrTiming->hlw) + ((verticalCount - 1) * 2);
|
||||
{
|
||||
u32 vm1 = verticalCount - 1;
|
||||
u32 hm1 = horizontalCount - 1;
|
||||
return hm1 / CurrTiming->hlw + vm1 * 2;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 getCurrentFieldEvenOdd(void)
|
||||
|
||||
@@ -64,7 +64,7 @@ volatile int lbl_81698A44 = 0;
|
||||
volatile int lbl_81698A48 = 0;
|
||||
volatile int lbl_81698A4C = 0;
|
||||
vu32 lbl_81698A50 = 0;
|
||||
u32 lbl_81698A54 = 0;
|
||||
vu32 lbl_81698A54 = 0;
|
||||
u32 lbl_81698A58 = 0;
|
||||
u32 lbl_81698A5C = 0;
|
||||
u64 lbl_81698A60 = 0;
|
||||
@@ -293,14 +293,58 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
|
||||
extern vu32 BS2VideoMode;
|
||||
extern vu32 __DVDLayoutFormat;
|
||||
|
||||
void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
|
||||
u8 *block = start;
|
||||
for (; blockCount != 0; --blockCount) {
|
||||
__dcbz(block, 0);
|
||||
__dcbf(block, 0);
|
||||
block += 32;
|
||||
}
|
||||
((void (*)(u32))entryPoint)(argument);
|
||||
extern int __pformatter();
|
||||
|
||||
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
|
||||
// clang-format off
|
||||
nofralloc
|
||||
mtctr r5
|
||||
mtlr r3
|
||||
li r0, 0
|
||||
li r2, 0
|
||||
li r3, 0
|
||||
li r5, 0
|
||||
li r7, 0
|
||||
li r8, 0
|
||||
li r9, 0
|
||||
li r10, 0
|
||||
li r11, 0
|
||||
li r12, 0
|
||||
li r13, 0
|
||||
li r14, 0
|
||||
li r15, 0
|
||||
li r16, 0
|
||||
li r17, 0
|
||||
li r18, 0
|
||||
li r19, 0
|
||||
li r20, 0
|
||||
li r21, 0
|
||||
li r22, 0
|
||||
li r23, 0
|
||||
li r24, 0
|
||||
li r25, 0
|
||||
li r26, 0
|
||||
li r27, 0
|
||||
li r28, 0
|
||||
li r29, 0
|
||||
li r30, 0
|
||||
li r31, 0
|
||||
lis r1, (__pformatter + 0x280)@h
|
||||
ori r1, r1, (__pformatter + 0x280)@l
|
||||
li r6, 0
|
||||
b _Run_enter
|
||||
_Run_loop:
|
||||
dcbz r4, r0
|
||||
dcbf r4, r0
|
||||
addi r4, r4, 0x20
|
||||
bdnz _Run_loop
|
||||
b _Run_done
|
||||
_Run_done:
|
||||
li r4, 0
|
||||
blr
|
||||
_Run_enter:
|
||||
b _Run_loop
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
|
||||
@@ -629,7 +673,7 @@ void BS2StartGame() {
|
||||
u32 (*entry)(void);
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
BS2Report("BS2StartGame(1)\n");
|
||||
@@ -729,8 +773,7 @@ void BS2StartGame() {
|
||||
LowReadResult = 0;
|
||||
DVDLowReadDiskID(&DiskID, (DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
;
|
||||
}
|
||||
|
||||
status = LowReadResult;
|
||||
@@ -745,8 +788,7 @@ void BS2StartGame() {
|
||||
LowReadResult = 0;
|
||||
DVDLowRequestError((DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
;
|
||||
}
|
||||
driveError = DVDLowGetImmBufferReg() & 0xFF000000;
|
||||
if (driveError == 0x01000000 || (driveError = DVDLowGetImmBufferReg() & 0xFF000000) == 0x03000000) {
|
||||
@@ -781,8 +823,7 @@ disk_done:
|
||||
(DVDLowCallback)callback);
|
||||
}
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
;
|
||||
}
|
||||
|
||||
status = LowReadResult;
|
||||
@@ -800,8 +841,7 @@ disk_done:
|
||||
LowReadResult = 0;
|
||||
DVDLowRequestError((DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
;
|
||||
}
|
||||
driveError = DVDLowGetImmBufferReg() & 0xFF000000;
|
||||
if (driveError == 0x01000000 || (driveError = DVDLowGetImmBufferReg() & 0xFF000000) == 0x03000000) {
|
||||
@@ -862,7 +902,7 @@ void BS2StartGCGame() {
|
||||
OSTime time;
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
soundMode = SCGetSoundMode();
|
||||
@@ -893,8 +933,8 @@ void BS2StartGCGame() {
|
||||
|
||||
__OSGetRTC(&rtc);
|
||||
counterBias = SCGetCounterBias();
|
||||
seconds = rtc + counterBias;
|
||||
timerFrequency = OS_BUS_CLOCK >> 2;
|
||||
seconds = rtc + counterBias;
|
||||
time = (OSTime)seconds * timerFrequency;
|
||||
__OSSetTime(time);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
typedef struct UpdateThreadData {
|
||||
OSThread thread;
|
||||
u8 stack[4096];
|
||||
OSThreadQueue queue;
|
||||
} UpdateThreadData;
|
||||
|
||||
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
|
||||
@@ -26,24 +27,24 @@ s32 WADCheckImport(u64 titleId, u16 titleVersion);
|
||||
s32 WADImportDVDForBS(const char* path, void* buffer, u32 length);
|
||||
s32 WADImportDVDExForBS(const char* path, void* buffer, u32 length);
|
||||
|
||||
static BS2UpdateEntry* pEntries;
|
||||
static u32 EntriesCount;
|
||||
static u32* pFlags;
|
||||
static void* MemAllocator;
|
||||
int State;
|
||||
BS2UpdateEntry* CurrentEntry;
|
||||
static u32 RebootRequired;
|
||||
static BOOL ContainsSeatTitles;
|
||||
static u32 UpdateImportState;
|
||||
static u32 UpdateImportResult;
|
||||
u32 StartUpdate;
|
||||
u32 CancelUpdate;
|
||||
u32 ConsoleType;
|
||||
u32 VersionES;
|
||||
u32 VersionMEM2;
|
||||
u64 VersionIOS;
|
||||
s32 rc;
|
||||
static u32 UpdateProgress;
|
||||
static s32 rc;
|
||||
static u64 VersionIOS;
|
||||
static u32 VersionMEM2;
|
||||
static u32 VersionES;
|
||||
static u32 ConsoleType;
|
||||
u32 CancelUpdate;
|
||||
u32 StartUpdate;
|
||||
static u32 UpdateImportResult;
|
||||
static u32 UpdateImportState;
|
||||
static BOOL ContainsSeatTitles;
|
||||
static u32 RebootRequired;
|
||||
BS2UpdateEntry* CurrentEntry;
|
||||
int State;
|
||||
static void* MemAllocator;
|
||||
static u32* pFlags;
|
||||
static u32 EntriesCount;
|
||||
static BS2UpdateEntry* pEntries;
|
||||
static void* FatalFunc;
|
||||
|
||||
#pragma force_active on
|
||||
@@ -133,7 +134,7 @@ static void* UpdateThread(void* argument) {
|
||||
}
|
||||
goto invalid_product_region;
|
||||
case 1:
|
||||
if (titleRegion == 'E' || titleRegion == 'D') {
|
||||
if (!(titleRegion != 'E' && titleRegion != 'D')) {
|
||||
regionValid = TRUE;
|
||||
goto product_region_checked;
|
||||
}
|
||||
@@ -174,7 +175,7 @@ product_region_checked:
|
||||
goto selection_done;
|
||||
}
|
||||
strcpy(scratch.updatePath, "__update.inf");
|
||||
strcat(scratch.updatePath, "-");
|
||||
strcat(scratch.updatePath, ".");
|
||||
strcat(scratch.updatePath, scratch.productArea);
|
||||
if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) {
|
||||
switch (SCGetProductArea()) {
|
||||
@@ -271,7 +272,7 @@ product_region_checked:
|
||||
}
|
||||
}
|
||||
strcpy(scratch.seatPath, "__seatholder.inf");
|
||||
strcat(scratch.seatPath, "-");
|
||||
strcat(scratch.seatPath, ".");
|
||||
strcat(scratch.seatPath, scratch.productArea);
|
||||
if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) {
|
||||
switch (SCGetProductArea()) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define AutoLock(x) AutoLock(x) NO_INLINE
|
||||
#define IPL_SOUND_RECT_OUT_OF_LINE
|
||||
#define IPL_CONTROLLER_TRIVIAL_RECT_DTOR
|
||||
#define IPL_SOUND_MATCHING
|
||||
#include "iplSound.h"
|
||||
#include "sound/iplSound.h"
|
||||
@@ -8,90 +9,38 @@
|
||||
|
||||
#include "system/iplSystem.h"
|
||||
#undef IPL_SOUND_RECT_OUT_OF_LINE
|
||||
#undef IPL_CONTROLLER_TRIVIAL_RECT_DTOR
|
||||
#undef AutoLock
|
||||
|
||||
extern "C" void __ct__Q23EGG20SimpleAudioMgrWithFxFv();
|
||||
extern "C" void __dt__Q34nw4r3snd11SoundHandleFv();
|
||||
extern "C" void __dl__FPv();
|
||||
extern "C" {
|
||||
void __destroy_arr();
|
||||
void __dt__Q33ipl3snd10tagSSeInfoFv();
|
||||
}
|
||||
extern "C" void _seBlk__Q23ipl3snd();
|
||||
extern "C" nw4r::snd::SoundHandle* _mainBGMHandle__Q23ipl3snd;
|
||||
extern "C" const f32 lbl_816946A4;
|
||||
extern "C" const f32 lbl_816946AC;
|
||||
extern "C" const f32 lbl_816946A8;
|
||||
extern "C" const f32 lbl_816946B0;
|
||||
extern "C" const f32 lbl_816946B4;
|
||||
extern "C" {
|
||||
void _savegpr_29();
|
||||
void pauseOffSE__Q33ipl3snd6SystemFv();
|
||||
void pauseOnSE__Q33ipl3snd6SystemFv();
|
||||
}
|
||||
extern "C" void _restgpr_29();
|
||||
extern "C" void _savegpr_24();
|
||||
extern "C" void _restgpr_24();
|
||||
extern "C" void _savegpr_26();
|
||||
extern "C" void _restgpr_26();
|
||||
extern "C" void sBannerSoundPlayer__Q23ipl3snd();
|
||||
extern "C" void pause__17BannerSoundPlayerFb();
|
||||
extern "C" void initFx__Q33ipl3snd6SystemFv();
|
||||
extern "C" void GetInstance__Q44nw4r3snd6detail9AxManagerFv();
|
||||
extern "C" void ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi();
|
||||
extern "C" void stop__17BannerSoundPlayerFUl();
|
||||
extern "C" void setMasterVolume__17BannerSoundPlayerFf();
|
||||
extern "C" void SetMasterVolume__Q44nw4r3snd6detail9AxManagerFfi();
|
||||
|
||||
namespace ipl {
|
||||
namespace snd {
|
||||
extern "C" void __vt__Q33ipl3snd6System();
|
||||
|
||||
System::System() {
|
||||
}
|
||||
|
||||
struct tagSSeInfo {
|
||||
tagSSeInfo();
|
||||
~tagSSeInfo();
|
||||
tagSSeInfo() {}
|
||||
~tagSSeInfo() {}
|
||||
|
||||
nw4r::snd::SoundHandle handle;
|
||||
const char* name;
|
||||
u32 id;
|
||||
};
|
||||
|
||||
tagSSeInfo::tagSSeInfo() {
|
||||
}
|
||||
|
||||
BOOL m_isLocked;
|
||||
struct tagSBgmInfo {
|
||||
tagSBgmInfo() {}
|
||||
~tagSBgmInfo() {}
|
||||
|
||||
nw4r::snd::SoundHandle handle;
|
||||
tagSBgmInfo();
|
||||
~tagSBgmInfo();
|
||||
};
|
||||
|
||||
tagSBgmInfo::tagSBgmInfo() {
|
||||
}
|
||||
struct UnkCls {
|
||||
tagSSeInfo blk[16];
|
||||
~UnkCls() {}
|
||||
};
|
||||
|
||||
tagSSeInfo::~tagSSeInfo() {
|
||||
}
|
||||
|
||||
tagSBgmInfo::~tagSBgmInfo() {
|
||||
}
|
||||
|
||||
extern nw4r::snd::SoundHandle _bgmBlk;
|
||||
extern tagSSeInfo _seBlk[16];
|
||||
extern nw4r::snd::SoundHandle* _mainBGMHandle;
|
||||
|
||||
extern "C" asm void __dt__Q33ipl3snd6UnkClsFv() {
|
||||
nofralloc
|
||||
lis r3, _seBlk__Q23ipl3snd@ha
|
||||
lis r4, __dt__Q33ipl3snd10tagSSeInfoFv@ha
|
||||
addi r3, r3, _seBlk__Q23ipl3snd@l
|
||||
li r5, 0xc
|
||||
addi r4, r4, __dt__Q33ipl3snd10tagSSeInfoFv@l
|
||||
li r6, 0x10
|
||||
b __destroy_arr
|
||||
}
|
||||
UnkCls _seBlk;
|
||||
tagSBgmInfo _bgmBlk;
|
||||
nw4r::snd::SoundHandle* _mainBGMHandle;
|
||||
BOOL m_isLocked;
|
||||
System sSystem;
|
||||
BannerSoundPlayer sBannerSoundPlayer;
|
||||
|
||||
static const nw4r::snd::FxReverbHi::ReverbHiParam reverbHiParam = {
|
||||
0.0f,
|
||||
@@ -102,183 +51,6 @@ namespace ipl {
|
||||
1.0f,
|
||||
};
|
||||
|
||||
void System::stopBGM(int frames) {
|
||||
if (_mainBGMHandle && _mainBGMHandle->IsAttachedSound()) {
|
||||
_mainBGMHandle->Stop(frames);
|
||||
}
|
||||
}
|
||||
|
||||
void System::muteOnBGM(int frames) {
|
||||
nw4r::snd::SoundHandle* handle = _mainBGMHandle;
|
||||
if (handle && handle->IsAttachedSound()) handle->SetVolume(0.0f, frames);
|
||||
}
|
||||
|
||||
void System::muteOffBGM(int frames) {
|
||||
nw4r::snd::SoundHandle* handle = _mainBGMHandle;
|
||||
if (handle && handle->IsAttachedSound()) handle->SetVolume(1.0f, frames);
|
||||
}
|
||||
|
||||
void System::pauseOnSE() {
|
||||
for (int index = 0; index < 16; ++index) {
|
||||
if (_seBlk[index].handle.IsAttachedSound()) {
|
||||
_seBlk[index].handle.Pause(true, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void System::pauseOffSE() {
|
||||
for (int index = 0; index < 16; ++index) {
|
||||
if (_seBlk[index].handle.IsAttachedSound()) {
|
||||
_seBlk[index].handle.Pause(false, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void System::pauseOnBGM() {
|
||||
if (_mainBGMHandle) {
|
||||
if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(true, 5);
|
||||
pauseOnSE();
|
||||
sBannerSoundPlayer.pause(true);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_A, 250);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_B, 250);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, 250);
|
||||
}
|
||||
}
|
||||
|
||||
void System::pauseOffBGM() {
|
||||
if (_mainBGMHandle) {
|
||||
initFx();
|
||||
if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(false, 5);
|
||||
pauseOffSE();
|
||||
sBannerSoundPlayer.pause(false);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" asm void stopSE__Q33ipl3snd6SystemFPQ34nw4r3snd11SoundHandlei() {
|
||||
nofralloc
|
||||
stwu r1, -0x30(r1)
|
||||
mflr r0
|
||||
stw r0, 0x34(r1)
|
||||
addi r11, r1, 0x30
|
||||
bl _savegpr_24
|
||||
cmpwi r4, 0
|
||||
mr r24, r4
|
||||
mr r25, r5
|
||||
beq stopSE_done
|
||||
lwz r0, 0(r4)
|
||||
cmpwi r0, 0
|
||||
beq stopSE_done
|
||||
li r26, 0
|
||||
lis r3, 1
|
||||
lis r28, _seBlk__Q23ipl3snd@ha
|
||||
li r31, 0
|
||||
mr r29, r26
|
||||
subi r30, r3, 1
|
||||
addi r28, r28, _seBlk__Q23ipl3snd@l
|
||||
stopSE_loop:
|
||||
add r27, r28, r31
|
||||
cmplw r24, r27
|
||||
bne stopSE_next
|
||||
lwz r3, 0(r27)
|
||||
cmpwi r3, 0
|
||||
beq stopSE_clear
|
||||
lwz r12, 0(r3)
|
||||
mr r4, r25
|
||||
lwz r12, 0x18(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
stopSE_clear:
|
||||
stw r29, 0x4(r27)
|
||||
stw r30, 0x8(r27)
|
||||
stopSE_next:
|
||||
addi r26, r26, 1
|
||||
addi r31, r31, 0xc
|
||||
cmpwi r26, 0x10
|
||||
blt stopSE_loop
|
||||
stopSE_done:
|
||||
addi r11, r1, 0x30
|
||||
bl _restgpr_24
|
||||
lwz r0, 0x34(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x30
|
||||
blr
|
||||
}
|
||||
|
||||
extern "C" asm void resetAllSound__Q33ipl3snd6SystemFv() {
|
||||
nofralloc
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
addi r11, r1, 0x20
|
||||
bl _savegpr_26
|
||||
li r26, 0
|
||||
lis r28, _seBlk__Q23ipl3snd@ha
|
||||
lis r3, 1
|
||||
li r31, 0
|
||||
mr r29, r26
|
||||
addi r28, r28, _seBlk__Q23ipl3snd@l
|
||||
subi r30, r3, 1
|
||||
resetAllSound_loop:
|
||||
lwzx r3, r28, r31
|
||||
add r27, r28, r31
|
||||
cmpwi r3, 0
|
||||
beq resetAllSound_clear
|
||||
lwz r12, 0(r3)
|
||||
li r4, 0
|
||||
lwz r12, 0x18(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
resetAllSound_clear:
|
||||
stw r29, 0x4(r27)
|
||||
addi r26, r26, 1
|
||||
cmpwi r26, 0x10
|
||||
addi r31, r31, 0xc
|
||||
stw r30, 0x8(r27)
|
||||
blt resetAllSound_loop
|
||||
lwz r3, _mainBGMHandle__Q23ipl3snd
|
||||
cmpwi r3, 0
|
||||
beq resetAllSound_banner
|
||||
lwz r0, 0(r3)
|
||||
cmpwi r0, 0
|
||||
beq resetAllSound_banner
|
||||
lwz r3, 0(r3)
|
||||
li r4, 0
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0x18(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
resetAllSound_banner:
|
||||
lis r31, sBannerSoundPlayer__Q23ipl3snd@ha
|
||||
li r4, 0
|
||||
addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l
|
||||
bl stop__17BannerSoundPlayerFUl
|
||||
bl GetInstance__Q44nw4r3snd6detail9AxManagerFv
|
||||
li r4, 0
|
||||
li r5, 0
|
||||
bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi
|
||||
bl GetInstance__Q44nw4r3snd6detail9AxManagerFv
|
||||
li r4, 1
|
||||
li r5, 0
|
||||
bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi
|
||||
bl GetInstance__Q44nw4r3snd6detail9AxManagerFv
|
||||
li r4, 2
|
||||
li r5, 0
|
||||
bl ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi
|
||||
bl GetInstance__Q44nw4r3snd6detail9AxManagerFv
|
||||
lfs f1, lbl_816946A4
|
||||
li r4, 0
|
||||
bl SetMasterVolume__Q44nw4r3snd6detail9AxManagerFfi
|
||||
lfs f1, lbl_816946A4
|
||||
addi r3, r31, sBannerSoundPlayer__Q23ipl3snd@l
|
||||
bl setMasterVolume__17BannerSoundPlayerFf
|
||||
addi r11, r1, 0x20
|
||||
bl _restgpr_26
|
||||
lwz r0, 0x24(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
}
|
||||
|
||||
void System::shutup(BOOL shutUpDMA) {
|
||||
if (m_isLocked == shutUpDMA) {
|
||||
return;
|
||||
@@ -309,38 +81,16 @@ namespace ipl {
|
||||
initFx();
|
||||
sBannerSoundPlayer.init(5);
|
||||
for (i = 0; i < 16; i++) {
|
||||
_seBlk[i].name = NULL;
|
||||
_seBlk[i].id = 0xffff;
|
||||
_seBlk.blk[i].name = NULL;
|
||||
_seBlk.blk[i].id = 0xffff;
|
||||
}
|
||||
sBannerSoundPlayer.setMasterVolume(0.9f);
|
||||
}
|
||||
|
||||
extern "C" const f32 lbl_816946A4 = 0.0f;
|
||||
|
||||
void System::stopBannerSound(int unk) {
|
||||
sBannerSoundPlayer.stop(unk);
|
||||
}
|
||||
|
||||
BOOL System::checkTmpSoundFile(void* data, u32 size) {
|
||||
return sBannerSoundPlayer.checkData(data, size, false);
|
||||
}
|
||||
|
||||
void System::initFx() {
|
||||
setFxReverbHi(nw4r::snd::AUX_A, &reverbHiParam);
|
||||
}
|
||||
|
||||
#pragma force_active on
|
||||
|
||||
}
|
||||
}
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
SoundHandle::SoundHandle() : mSound(NULL) {}
|
||||
}
|
||||
}
|
||||
namespace ipl {
|
||||
namespace snd {
|
||||
|
||||
void System::calc() {
|
||||
EGG::SimpleAudioMgr::calc();
|
||||
sBannerSoundPlayer.calc();
|
||||
@@ -351,9 +101,9 @@ namespace snd {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EGG::ArcPlayer::startSound(&_bgmBlk, bgmName);
|
||||
_mainBGMHandle = &_bgmBlk;
|
||||
return &_bgmBlk;
|
||||
EGG::ArcPlayer::startSound(&_bgmBlk.handle, bgmName);
|
||||
_mainBGMHandle = &_bgmBlk.handle;
|
||||
return &_bgmBlk.handle;
|
||||
}
|
||||
|
||||
nw4r::snd::SoundHandle* System::startSE(const char* sndName) {
|
||||
@@ -364,20 +114,9 @@ namespace snd {
|
||||
}
|
||||
|
||||
block = FIsSEActive(sndName);
|
||||
if (block != NULL && block->handle.GetId() == 0x39) {
|
||||
goto return_block;
|
||||
if (block != NULL && block->handle.GetId() == 0x39 || block != NULL && block->handle.GetId() == 0x35) {
|
||||
return reinterpret_cast<nw4r::snd::SoundHandle*>(block);
|
||||
}
|
||||
if (block == NULL) {
|
||||
goto continue_block;
|
||||
}
|
||||
if (block->handle.GetId() != 0x35) {
|
||||
goto continue_block;
|
||||
}
|
||||
|
||||
return_block:
|
||||
return reinterpret_cast<nw4r::snd::SoundHandle*>(block);
|
||||
|
||||
continue_block:
|
||||
if (block == NULL) {
|
||||
block = getFreeSEBlock(true);
|
||||
}
|
||||
@@ -400,20 +139,9 @@ namespace snd {
|
||||
}
|
||||
|
||||
block = FIsSEActive(sndIndex);
|
||||
if (block != NULL && block->handle.GetId() == 0x39) {
|
||||
goto return_block_index;
|
||||
if (block != NULL && block->handle.GetId() == 0x39 || block != NULL && block->handle.GetId() == 0x35) {
|
||||
return (int)block;
|
||||
}
|
||||
if (block == NULL) {
|
||||
goto continue_block_index;
|
||||
}
|
||||
if (block->handle.GetId() != 0x35) {
|
||||
goto continue_block_index;
|
||||
}
|
||||
|
||||
return_block_index:
|
||||
return (int)block;
|
||||
|
||||
continue_block_index:
|
||||
if (block == NULL) {
|
||||
block = getFreeSEBlock(true);
|
||||
}
|
||||
@@ -422,7 +150,7 @@ namespace snd {
|
||||
}
|
||||
|
||||
block->handle.Stop(0);
|
||||
mSoundArchivePlayer.StartSound(&block->handle, sndIndex);
|
||||
EGG::ArcPlayer::startSound(&block->handle, sndIndex);
|
||||
block->id = sndIndex;
|
||||
return (int)block;
|
||||
}
|
||||
@@ -496,37 +224,58 @@ namespace snd {
|
||||
block->id = block->handle.GetId();
|
||||
nw4r::ut::Rect rect;
|
||||
ipl::System::getProjectionRect4x3(&rect);
|
||||
f32 pan = x / rect.right;
|
||||
f32 pan = 0.0f;
|
||||
pan = x / rect.right;
|
||||
if (block->handle.detail_GetAttachedSound() != NULL) {
|
||||
block->handle.detail_GetAttachedSound()->SetPan(pan);
|
||||
}
|
||||
f32 pitch = lbl_816946A8 * y / rect.right;
|
||||
if (lbl_816946AC < pitch) {
|
||||
pitch = lbl_816946AC;
|
||||
f32 pitch = 2.0f * y / rect.right;
|
||||
if (1.0f < pitch) {
|
||||
pitch = 1.0f;
|
||||
}
|
||||
if (block->handle.detail_GetAttachedSound() != NULL) {
|
||||
block->handle.detail_GetAttachedSound()->SetVolume(pitch, 0);
|
||||
}
|
||||
if (lbl_816946B0 < y) {
|
||||
f32 pitch2 = y / lbl_816946B0;
|
||||
if (30.0f < y) {
|
||||
f32 pitch2 = y / 30.0f;
|
||||
if (block->handle.detail_GetAttachedSound() != NULL) {
|
||||
block->handle.detail_GetAttachedSound()->SetPitch(pitch2);
|
||||
}
|
||||
} else if (lbl_816946B4 < y) {
|
||||
} else if (60.0f < y) {
|
||||
if (block->handle.detail_GetAttachedSound() != NULL) {
|
||||
block->handle.detail_GetAttachedSound()->SetPitch(lbl_816946A8);
|
||||
block->handle.detail_GetAttachedSound()->SetPitch(2.0f);
|
||||
}
|
||||
}
|
||||
return (int)block;
|
||||
}
|
||||
|
||||
void System::stopBGM(int frames) {
|
||||
if (_mainBGMHandle && _mainBGMHandle->IsAttachedSound()) {
|
||||
_mainBGMHandle->Stop(frames);
|
||||
}
|
||||
}
|
||||
|
||||
void System::stopSE(nw4r::snd::SoundHandle* handle, int unk) {
|
||||
int i;
|
||||
|
||||
if (handle != NULL && handle->IsAttachedSound()) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (handle == &_seBlk.blk[i].handle) {
|
||||
_seBlk.blk[i].handle.Stop(unk);
|
||||
_seBlk.blk[i].name = NULL;
|
||||
_seBlk.blk[i].id = 0xffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void System::stopAllSound(int unk) {
|
||||
int frame;
|
||||
tagSSeInfo* block;
|
||||
int i = 0;
|
||||
|
||||
for (; i < 16; i++) {
|
||||
block = &_seBlk[i];
|
||||
block = &_seBlk.blk[i];
|
||||
block->handle.Stop(unk);
|
||||
block->name = NULL;
|
||||
block->id = 0xffff;
|
||||
@@ -543,6 +292,73 @@ namespace snd {
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, frame);
|
||||
}
|
||||
|
||||
void System::resetAllSound() {
|
||||
int i = 0;
|
||||
|
||||
for (; i < 16; i++) {
|
||||
_seBlk.blk[i].handle.Stop(0);
|
||||
_seBlk.blk[i].name = NULL;
|
||||
_seBlk.blk[i].id = 0xffff;
|
||||
}
|
||||
|
||||
if (_mainBGMHandle != NULL && _mainBGMHandle->IsAttachedSound()) {
|
||||
_mainBGMHandle->detail_GetAttachedSound()->Stop(0);
|
||||
}
|
||||
|
||||
sBannerSoundPlayer.stop(0);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_A, 0);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_B, 0);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, 0);
|
||||
nw4r::snd::detail::AxManager::GetInstance().SetMasterVolume(0.0f, 0);
|
||||
sBannerSoundPlayer.setMasterVolume(0.0f);
|
||||
}
|
||||
|
||||
void System::muteOnBGM(int frames) {
|
||||
nw4r::snd::SoundHandle* handle = _mainBGMHandle;
|
||||
if (handle && handle->IsAttachedSound()) handle->SetVolume(0.0f, frames);
|
||||
}
|
||||
|
||||
void System::muteOffBGM(int frames) {
|
||||
nw4r::snd::SoundHandle* handle = _mainBGMHandle;
|
||||
if (handle && handle->IsAttachedSound()) handle->SetVolume(1.0f, frames);
|
||||
}
|
||||
|
||||
void System::pauseOnBGM() {
|
||||
if (_mainBGMHandle) {
|
||||
if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(true, 5);
|
||||
pauseOnSE();
|
||||
sBannerSoundPlayer.pause(true);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_A, 250);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_B, 250);
|
||||
nw4r::snd::detail::AxManager::GetInstance().ClearEffect(nw4r::snd::AUX_C, 250);
|
||||
}
|
||||
}
|
||||
|
||||
void System::pauseOffBGM() {
|
||||
if (_mainBGMHandle) {
|
||||
initFx();
|
||||
if (_mainBGMHandle->IsAttachedSound()) _mainBGMHandle->Pause(false, 5);
|
||||
pauseOffSE();
|
||||
sBannerSoundPlayer.pause(false);
|
||||
}
|
||||
}
|
||||
|
||||
void System::pauseOnSE() {
|
||||
for (int index = 0; index < 16; ++index) {
|
||||
if (_seBlk.blk[index].handle.IsAttachedSound()) {
|
||||
_seBlk.blk[index].handle.Pause(true, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void System::pauseOffSE() {
|
||||
for (int index = 0; index < 16; ++index) {
|
||||
if (_seBlk.blk[index].handle.IsAttachedSound()) {
|
||||
_seBlk.blk[index].handle.Pause(false, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void System::setOutputMode(EAudioOutputMode mode) {
|
||||
nw4r::snd::OutputMode outputMode;
|
||||
|
||||
@@ -571,7 +387,7 @@ namespace snd {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
tagSSeInfo* block = &_seBlk[i];
|
||||
tagSSeInfo* block = &_seBlk.blk[i];
|
||||
if (sndName == block->name && block->handle.IsAttachedSound()) {
|
||||
return block;
|
||||
}
|
||||
@@ -584,7 +400,7 @@ namespace snd {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
tagSSeInfo* block = &_seBlk[i];
|
||||
tagSSeInfo* block = &_seBlk.blk[i];
|
||||
if (id == block->id && block->handle.IsAttachedSound()) {
|
||||
return block;
|
||||
}
|
||||
@@ -603,15 +419,15 @@ namespace snd {
|
||||
int i = 0;
|
||||
for (; i < 16; i++) {
|
||||
index = clipGELT_S32(unk_0x620[0] + i, 0, 16);
|
||||
if (_seBlk[index].handle.IsAttachedSound()) {
|
||||
if (_seBlk.blk[index].handle.IsAttachedSound()) {
|
||||
continue;
|
||||
}
|
||||
unk_0x620[0] = index;
|
||||
return &_seBlk[unk_0x620[0]];
|
||||
return &_seBlk.blk[unk_0x620[0]];
|
||||
}
|
||||
|
||||
if (force) {
|
||||
return &_seBlk[unk_0x620[0]];
|
||||
return &_seBlk.blk[unk_0x620[0]];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -624,6 +440,14 @@ namespace snd {
|
||||
return sBannerSoundPlayer.start(data, size);
|
||||
}
|
||||
|
||||
void System::stopBannerSound(int unk) {
|
||||
sBannerSoundPlayer.stop(unk);
|
||||
}
|
||||
|
||||
BOOL System::checkTmpSoundFile(void* data, u32 size) {
|
||||
return sBannerSoundPlayer.checkData(data, size, false);
|
||||
}
|
||||
|
||||
long System::clipGELT_S32(long value, long lo, long hi) {
|
||||
long range = hi - lo;
|
||||
|
||||
@@ -642,5 +466,15 @@ namespace snd {
|
||||
|
||||
return value;
|
||||
}
|
||||
} // namespace snd
|
||||
} // namespace ipl
|
||||
|
||||
inline System::System() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
inline SoundHandle::SoundHandle() : mSound(NULL) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,23 +884,31 @@ namespace ipl {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char FUNC_VERIFY_SAVEDATA_ZD[] = "verifySavedataZD";
|
||||
static char FUNC_DELETE_TICKETS_FORCE[] = "DeleteTicketsForce";
|
||||
static char FUNC_INIT_SAVEDATA[] = "InitSavedata";
|
||||
|
||||
void ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
|
||||
u32 titleCount = 0;
|
||||
ESTitleId* titleIds = NULL;
|
||||
char path[88];
|
||||
NANDFileInfo fileInfo ALIGN32;
|
||||
u8 ticketViews[0xe0] ALIGN32;
|
||||
NANDFileInfo fileInfo ALIGN32;
|
||||
u32 ticketViewCount;
|
||||
ESTicketView* ticketViewList;
|
||||
s32 ret = ES_ListTitlesOnCard(NULL, &titleCount);
|
||||
|
||||
if (ret == ES_ERR_OK) {
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: Failed to ES_ListTitlesOnCard1: %d\n", __FILE__, FUNC_INIT_SAVEDATA, ret);
|
||||
} else {
|
||||
titleIds = (ESTitleId*)heap->alloc(OSRoundUp32B(titleCount * sizeof(ESTitleId)), -DEFAULT_ALIGN);
|
||||
if (titleIds == NULL) {
|
||||
OSReport("%s::%s: Unable to allocate\n", __FILE__, "InitSavedata");
|
||||
OSReport("%s::%s: Unable to allocate\n", __FILE__, FUNC_INIT_SAVEDATA);
|
||||
} else {
|
||||
ret = ES_ListTitlesOnCard(titleIds, &titleCount);
|
||||
if (ret == ES_ERR_OK) {
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: Failed to ES_ListTitlesOnCard2: %d\n", __FILE__, FUNC_INIT_SAVEDATA, ret);
|
||||
} else {
|
||||
|
||||
u32 titleIdOffset = 0;
|
||||
for (u32 i = 0; i < titleCount; i++) {
|
||||
@@ -912,28 +920,28 @@ namespace ipl {
|
||||
BOOL fileOpen = FALSE;
|
||||
BOOL deleteSaveData = FALSE;
|
||||
|
||||
sprintf(path - 8, "/title/%08x/%08x/data/%s", titleIdHi & 0xffffff, titleIdLo, "zeldaTp.dat");
|
||||
sprintf(path, "/title/%08x/%08x/data/%s", titleIdHi & 0xffffff, titleIdLo, "zeldaTp.dat");
|
||||
if (!ChangeUid(((ESTitleId)titleIdHi << 32) | titleIdLo)) {
|
||||
OSReport("%s::%s: ChangeUid failed\n", __FILE__, "verifySavedataZD");
|
||||
OSReport("%s::%s: ChangeUid failed\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD);
|
||||
DeleteTitle(heap, ((ESTitleId)titleIdHi << 32) | titleIdLo);
|
||||
} else {
|
||||
ret = NANDPrivateOpen(path - 8, (NANDFileInfo*)((u8*)&fileInfo - 0x20), NAND_ACCESS_READ);
|
||||
ret = NANDPrivateOpen(path, &fileInfo, NAND_ACCESS_READ);
|
||||
if (ret == NAND_RESULT_NOEXISTS) {
|
||||
OSReport("%s::%s: Does not exist %s: %d\n", __FILE__, "verifySavedataZD", path - 8, ret);
|
||||
OSReport("%s::%s: Does not exist %s: %d\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD, path, ret);
|
||||
} else if (ret != NAND_RESULT_OK) {
|
||||
OSReport("%s::%s: Open save data file failed: %d\n", __FILE__, "verifySavedataZD", ret);
|
||||
OSReport("%s::%s: Open save data file failed: %d\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD, ret);
|
||||
} else {
|
||||
fileOpen = TRUE;
|
||||
saveData = (u8*)heap->alloc(0x4000, -DEFAULT_ALIGN);
|
||||
if (saveData == NULL) {
|
||||
OSReport("%s::%s: Alloc failed: %d\n", __FILE__, "verifySavedataZD", -2);
|
||||
OSReport("%s::%s: Alloc failed: %d\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD, -2);
|
||||
} else {
|
||||
memset(saveData, 0, 0x4000);
|
||||
ret = NANDRead((NANDFileInfo*)((u8*)&fileInfo - 0x20), saveData, 0x4000);
|
||||
ret = NANDRead(&fileInfo, saveData, 0x4000);
|
||||
if (ret < 0) {
|
||||
OSReport("%s::%s: Read file failed: %d\n", __FILE__, "verifySavedataZD", ret);
|
||||
OSReport("%s::%s: Read file failed: %d\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD, ret);
|
||||
} else if (ret != 0x4000) {
|
||||
OSReport("%s::%s: File size is not correct: %d\n", __FILE__, "verifySavedataZD", ret);
|
||||
OSReport("%s::%s: File size is not correct: %d\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD, ret);
|
||||
deleteSaveData = TRUE;
|
||||
} else {
|
||||
u32 offset = 8;
|
||||
@@ -973,13 +981,13 @@ namespace ipl {
|
||||
verify_failed:
|
||||
|
||||
if (!valid) {
|
||||
OSReport("%s::%s: Verify failed for %016llx\n", __FILE__, "verifySavedataZD",
|
||||
OSReport("%s::%s: Verify failed for %016llx\n", __FILE__, FUNC_VERIFY_SAVEDATA_ZD,
|
||||
((ESTitleId)titleIdHi << 32) | titleIdLo);
|
||||
deleteSaveData = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
NANDClose((NANDFileInfo*)((u8*)&fileInfo - 0x20));
|
||||
NANDClose(&fileInfo);
|
||||
fileOpen = FALSE;
|
||||
if (deleteSaveData) {
|
||||
DeleteSavedata(((ESTitleId)titleIdHi << 32) | titleIdLo, heap);
|
||||
@@ -992,7 +1000,7 @@ namespace ipl {
|
||||
heap->free(saveData);
|
||||
}
|
||||
if (fileOpen) {
|
||||
NANDClose((NANDFileInfo*)((u8*)&fileInfo - 0x20));
|
||||
NANDClose(&fileInfo);
|
||||
}
|
||||
ChangeUid(SYSMENU_TITLE_ID);
|
||||
continue;
|
||||
@@ -1013,18 +1021,18 @@ namespace ipl {
|
||||
memset(ticketViews, 0, sizeof(ticketViews));
|
||||
ret = ES_GetTicketViews(titleId, NULL, &ticketViewCount);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, "DeleteTicketsForce", ret, titleId);
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, FUNC_DELETE_TICKETS_FORCE, ret, titleId);
|
||||
} else if (ticketViewCount != 0) {
|
||||
ticketViewList = (ESTicketView*)heap->alloc(ticketViewCount * 0xe0, -DEFAULT_ALIGN);
|
||||
ret = ES_GetTicketViews(titleId, ticketViewList, &ticketViewCount);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, "DeleteTicketsForce", ret, titleId);
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, FUNC_DELETE_TICKETS_FORCE, ret, titleId);
|
||||
} else {
|
||||
for (u32 j = 0; j < ticketViewCount; j++) {
|
||||
memcpy(ticketViews, (u8*)ticketViewList + j * sizeof(ESTicketView), 0xd8);
|
||||
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: ES_DeleteTicket failed: %d for %016llx\n", __FILE__, "DeleteTicketsForce", ret,
|
||||
OSReport("%s::%s: ES_DeleteTicket failed: %d for %016llx\n", __FILE__, FUNC_DELETE_TICKETS_FORCE, ret,
|
||||
((ESTicketView*)ticketViews)->ticketId);
|
||||
}
|
||||
}
|
||||
@@ -1038,12 +1046,8 @@ namespace ipl {
|
||||
titleIdOffset += 8;
|
||||
}
|
||||
|
||||
} else {
|
||||
OSReport("%s::%s: Failed to ES_ListTitlesOnCard2: %d\n", __FILE__, "InitSavedata", ret);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
OSReport("%s::%s: Failed to ES_ListTitlesOnCard1: %d\n", __FILE__, "InitSavedata", ret);
|
||||
}
|
||||
|
||||
if (titleIds != NULL) {
|
||||
|
||||
7
tools/decomp-assist/BS2Update.attempts.md
Normal file
7
tools/decomp-assist/BS2Update.attempts.md
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
## singles leaf session
|
||||
- .bss 100% via OSThreadQueue queue member in UpdateThreadData (Thread size 0x1320 -> UH0 at 0x2320). Keep separate globals, NOT an enclosing struct: a struct forces a single base symbol and perturbs all member-address codegen; orig has separate globals and MWCC reuses Flags0's homed base reg for +0x800/+0x2320 offsets.
|
||||
- .sdata 100% via "." (not "-") region suffix strcats.
|
||||
- E/D region check: `!(x != 'E' && x != 'D')` defeats MWCC adjacent-value range fusion (subi+cmplwi 1) and reproduces orig's shared li r0,1 arm exactly.
|
||||
- UpdateWork-struct + w-> pointer locals: REGRESSION (-11 fuzzy); reverted.
|
||||
- Remaining .text gaps = const-home/remat policy: orig homes lis 0x8048 (disc base) + zero/one consts in callee regs and remats `add base,byteoff` per access site (~+50 insns); MWCC folds to subis + CSE'd entry ptrs. Same RA-pinning wall as fa-file/scene2 units.
|
||||
36
tools/decomp-assist/iplESMisc.attempts.md
Normal file
36
tools/decomp-assist/iplESMisc.attempts.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# iplESMisc.cpp — attempts log (singles leaf)
|
||||
|
||||
Final state: .data 100%, .sdata 98.41 (tail-pad artifact: orig's last
|
||||
`.sdata` object absorbs one pad byte — contents identical), .text 97.70,
|
||||
30/31 fns. Only `DeleteUnauthorizedData` (85.6) is sub-100.
|
||||
|
||||
## Verified decodes
|
||||
|
||||
- **`.data` string pool now byte-identical.** Orig emits the three
|
||||
fn-name strings `verifySavedataZD`, `DeleteTicketsForce`,
|
||||
`InitSavedata` before all of `DeleteUnauthorizedData`'s message
|
||||
literals: reproduced with three namespace-scope
|
||||
`static char FUNC_*[]` decls (non-const → `.data` at decl position;
|
||||
`const` goes to `.rodata`). Callsite literals pass the named objects —
|
||||
codegen identical (`addi rX, pool+off` either way).
|
||||
- **`DeleteUnauthorizedData` structure:** orig's literal order is
|
||||
Card1-fail → alloc-fail → Card2-fail → loop strings, i.e. a flat
|
||||
`if (ret != ES_ERR_OK) { OSReport(Card1) } else { alloc; if NULL
|
||||
{alloc-report} else { list2; if (ret != ES_ERR_OK) {OSReport(Card2)}
|
||||
else { loop } } }` head, not nested `== ES_ERR_OK` wrapping.
|
||||
- **Local layout:** `path[88]`@0x28, `ticketViews[0xe0]`@0x80 (homed
|
||||
r29), `fileInfo`@0x160 — decl order path → ticketViews → fileInfo.
|
||||
No `path - 8` / `&fileInfo - 0x20` compensations needed.
|
||||
- **`main.dol` tail of `.data`:** orig's last object absorbs 6 bytes of
|
||||
section-alignment pad — extraction artifact, bytes identical.
|
||||
|
||||
## Unresolved
|
||||
|
||||
- **`DeleteUnauthorizedData` 85.6** (449 vs 434 insns): residual
|
||||
regalloc noise (r21-vs-r26 pool home, `ret` homed r27 in orig via
|
||||
`mr r27,r3` after each call vs direct r3), the zelda-check `&&` fusion
|
||||
(orig `xor`/`or.` single-branch; mine two `cmplwi`+2 `bne`; `&` on
|
||||
bools produced `cntlzw`+`and` — worse, reverted), 64-bit title-id
|
||||
chain codegen order, and MWCC strength-reducing my
|
||||
`*(u32*)((u8*)titleIds + titleIdOffset)` into a pointer-walk
|
||||
(`addi r30,8`/iter) vs orig's `lwzx base,offset`.
|
||||
54
tools/decomp-assist/iplSound.attempts.md
Normal file
54
tools/decomp-assist/iplSound.attempts.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# iplSound.cpp — attempts log (singles leaf)
|
||||
|
||||
Final state: .text 98.98 fuzzy; 55/57 fns instruction-identical after
|
||||
name-stripping. .ctors/.data/.rodata/.sbss/.sdata2 all 100%. .bss 70.65
|
||||
(symbol-extent artifact, contents byte-identical).
|
||||
|
||||
## Verified decodes
|
||||
|
||||
- **Weak-fn emission order = first-ODR-use.** Weak copies of in-class /
|
||||
inline defs emit immediately after their first non-inlinable user;
|
||||
trivial inlines and vtable-driven emissions defer to the end.
|
||||
- **`_seBlk` decode:** orig's named `__dt__Q33ipl3snd6UnkClsFv` thunk
|
||||
requires `_seBlk` to be a global of `struct UnkCls { tagSSeInfo blk[16]; }`
|
||||
with an implicit dtor (emits `b __destroy_arr` thunk). A raw
|
||||
`tagSSeInfo _seBlk[16]` or `typedef ... UnkCls[16]` instead emits
|
||||
auto-named `__arraydtor$NNNN`.
|
||||
- **`EGG::ArcPlayer::startSound(&handle, idx)`** (qualified call to the
|
||||
virtual at slot 0x34) suppresses virtual dispatch, inlines to
|
||||
`detail_StartSound`, and emits its weak copy at first-use position
|
||||
(right after `startSEIndex` in orig).
|
||||
- **startSE/startSEIndex redundant `block` re-test:** orig re-tests
|
||||
`cmpwi block; beq` between two `GetId()` checks — written as
|
||||
`(block != NULL && GetId()==0x39) || (block != NULL && GetId()==0x35)`:
|
||||
two `&&` clauses in one `||`, single shared return-block tail. Nested
|
||||
`if` adds insns; single `||` drops the re-test.
|
||||
- **`.sdata2` literal order = parse order:** a dead
|
||||
`f32 pan = 0.0f; pan = x/rect.right;` in `holdSEwithPosDis` creates the
|
||||
0.0f literal early (MWCC folds the dead store, keeps the literal) —
|
||||
reproduces orig order [0.9, 0.0, 2.0, 1.0, 30, 60] exactly.
|
||||
- **`stopSE`/`resetAllSound` are `void`** in orig (no `li r3,0` epilogue);
|
||||
header changed `int`→`void`. `stopSE` loop compare is
|
||||
`handle == &_seBlk[i].handle` (operand order → `cmplw r24,r27`).
|
||||
- **`__sinit` register sequence:** `__construct_array(_seBlk)` →
|
||||
`__register_global_object(0, ~UnkCls, record@0)` → `~tagSBgmInfo`/`_bgmBlk`
|
||||
(record@0xCC) → `~System` (record@0xD8) → `~BannerSoundPlayer`
|
||||
(record@0x710).
|
||||
|
||||
## Unresolved
|
||||
|
||||
- **`__ct__Q33ipl3snd6UnkClsFv` extra weak emit (+~0x4C).** The implicit
|
||||
ctor for `UnkCls _seBlk` emits a weak copy in mine; orig has none.
|
||||
Tried: implicit ctor, `UnkCls() {}`, `~UnkCls() {}`, typedef array,
|
||||
removing `#pragma force_active on` — still emits. Likely MWCC-version
|
||||
emission difference.
|
||||
- **`__dt__Q34nw4r2ut11NonCopyableFv` extra weak emit (+~0x3C).**
|
||||
`~NonCopyable() {}` in `libs/NW4R/include/nw4r/ut/inlines.h` is
|
||||
ODR-used via `~SoundHandle` base-dtor call. Removing it removes the
|
||||
emit but cascades: `tagSSeInfo`/`SoundHandle` become trivially
|
||||
destructible → `__sinit` switches `bl __construct_array` to
|
||||
`bl __ct__UnkCls` and regresses further. Reverted.
|
||||
- **`.bss` 70.65%:** byte-identical layout; orig's symbols.txt extends
|
||||
`_seBlk`=0xD8 / `sSystem`=0x63C over MWCC's `__register_global_object`
|
||||
chain-record slots and omits `...bss.N` record symbols — pure
|
||||
symbol-extent artifact, no source lever.
|
||||
Reference in New Issue
Block a user