Skip to content

Commit

Permalink
Repair DemoInitiate
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Sep 27, 2023
1 parent 236b970 commit 2f46450
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
16 changes: 6 additions & 10 deletions include/JSystem/JAudio/JAI/JAInter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@ struct Actor;
struct DummyVec;
struct SeqUpdateData;
struct SoundInfo {
int unk1; // _00
union count_t {
unsigned long v1;
unsigned char v2[4];
unsigned short v3[2];
} count; // _04
f32 pitch; // _08
int _00; // _00
u32 mCount; // _04
u32 mPitch; // _08
union volume_t {
unsigned long v1;
unsigned char v2[2];
} volume; // _0C
u32 w;
u8 c;
} mVolume; // _0C
};

namespace SequenceMgr {
Expand Down
6 changes: 3 additions & 3 deletions include/PSM/Demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace PSM {
struct DemoInitiator {
inline DemoInitiator(u8* pByte, const char* pName, u32& rAST_ID, char* pBuffer);
inline DemoInitiator(u8* byte, const char* name, u32& astID, char* buf);

inline void setDefaultValues();
inline bool isInitialized();
Expand All @@ -23,8 +23,8 @@ struct DemoInitiator {
u8* mByte; // _00
const char* mName; // _04
bool mSongChosen; // _08
u32& mAST_ID; // _0C
char* b2;
u32& mASTid; // _0C
char* mBuffer; // _10
};

struct DemoArg {
Expand Down
28 changes: 14 additions & 14 deletions src/utilityU/PSMainSide_Demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ static inline bool streq(const char* a, const char* b)

namespace PSM {

inline DemoInitiator::DemoInitiator(u8* pByte, const char* pName, u32& rAST_ID, char* pBuffer)
: mAST_ID(rAST_ID)
inline DemoInitiator::DemoInitiator(u8* byte, const char* name, u32& astID, char* buf)
: mASTid(astID)
{
P2ASSERTLINE(256, pName);
P2ASSERTLINE(256, name);

mName = pName;
mAST_ID = rAST_ID;
b2 = pBuffer;
mByte = pByte;
mName = name;
mASTid = astID;
mBuffer = buf;
mByte = byte;

mSongChosen = false;
}
Expand All @@ -34,8 +34,8 @@ inline void DemoInitiator::setDefaultValues()
{
P2ASSERTLINE(41, isInitialized());

mAST_ID = -1;
strcpy(b2, "");
mASTid = -1;
strcpy(mBuffer, "");
*mByte = -1;
}

Expand Down Expand Up @@ -65,7 +65,7 @@ void DemoInitiator::equalSetStream(const char* buffer, u32 AST_ID, u8 byte)
}
P2ASSERTLINE(41, check);

mAST_ID = AST_ID;
mASTid = AST_ID;
strcpy((char*)buffer, "");
*mByte = byte;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ inline void DemoInitiator::setDefault(const char* comp, u32 id, bool extraCondit
{
if (extraCondition && !mSongChosen && strcmp(mName, comp) == 0) {
mSongChosen = true;
mAST_ID = id;
mASTid = id;
*mByte = -1;
// OSReport("demo_arg is value: %lu\n", demo_arg);
}
Expand Down Expand Up @@ -446,7 +446,7 @@ PSSystem::BgmSeq* Demo::initiate(DemoArg demoArg, u8* unk)
init.setDefault("s11_dopebin_first_r", 0xc0011008);

if (!streq("s01_dayend", init.mName)) {
bool is_key = demoArg.mName && streq(demoArg.mName, "key");
bool is_key = demoArg.mCameraName && streq(demoArg.mCameraName, "key");

init.setDefault("s17_suck_equipment", demoArg.mBgmID, !is_key);
init.setDefault("s17_suck_equipment", 0xc0011007, is_key);
Expand Down Expand Up @@ -577,7 +577,7 @@ PSSystem::BgmSeq* Demo::initiate(DemoArg demoArg, u8* unk)
init.setDefault("x03_find_red_onyon", 0xc001103c);

if (streq("s02_dayend_result", init.mName)) {
audio_info.volume.v2 -= 0xf;
audio_info.mVolume.c -= 0xf;
}
// clang-format off
if (streq("s10_suck_treasure", init.mName) ||
Expand All @@ -601,7 +601,7 @@ PSSystem::BgmSeq* Demo::initiate(DemoArg demoArg, u8* unk)
} else if (streq("x20_blackman", init.mName) || streq("x03_find_red_onyon", init.mName)) {
mDoStartWithAudio = false;
} else if (streq("s01_dayend", init.mName)) {
switch ((u32)demoArg.mName) {
switch ((u32)demoArg.mCameraName) {
case 1:
mSoundID = PSSE_PL_DAYEND_KAISAN_LUI;
break;
Expand Down

0 comments on commit 2f46450

Please sign in to comment.