Skip to content

Naming unknown audio engine fields - #335

Open
MiranDMC wants to merge 1 commit into
DK22Pac:masterfrom
MiranDMC:Naming_audio_engine_fields
Open

MiranDMC wants to merge 1 commit into
DK22Pac:masterfrom
MiranDMC:Naming_audio_engine_fields

Conversation

@MiranDMC

Copy link
Copy Markdown
Contributor

Naming unknown fields in CAudioEngine and CAEAudioHardware.

Applied eRadioID enum for functions using it. Previously int was declared in some places, but it is all passed into function at 4EB3C0, where only low byte is extracted.

@noexabwuy noexabwuy left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked against in IDA, notes inline.

Not in the diff:

  • CAEAudioHardware::field_86 is padding (never accessed).
  • CAEAudioHardware::field_F64..field_100C is a tBeatInfo (see GetBeatInfo 0x4D8FA0).
  • CAudioEngine::field_150/field_1F8 belong to CAEFrontendAudioEntity (real size 0x1EC, retune twin loops at +0x9C/+0x144); field_1F38 is the tail of CAEPedlessSpeechAudioEntity (0x118).
  • eRadioID lacks -1 (set by Reset/StopCutsceneTrack) and 0.

Comment on lines 35 to +36
float m_fStreamFaderScalingFactor;
float m_fNonStreamFaderScalingFactor;
float field_428;
float field_42C;
float m_fNonStreamFaderScalingFactor; // order swapped with m_fStreamFaderScalingFactor?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapped: SetNonStreamFaderScalingFactor (0x4D95A0) writes 0x420, SetStreamFaderScalingFactor (0x4D95B0) writes 0x424.

Suggested change
float m_fStreamFaderScalingFactor;
float m_fNonStreamFaderScalingFactor;
float field_428;
float field_42C;
float m_fNonStreamFaderScalingFactor; // order swapped with m_fStreamFaderScalingFactor?
float m_fNonStreamFaderScalingFactor;
float m_fStreamFaderScalingFactor;

Comment on lines 86 to 87
VALIDATE_OFFSET(CAEAudioHardware, m_fStreamFaderScalingFactor, 0x420);
VALIDATE_OFFSET(CAEAudioHardware, m_fNonStreamFaderScalingFactor, 0x424);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VALIDATE_OFFSET(CAEAudioHardware, m_fStreamFaderScalingFactor, 0x420);
VALIDATE_OFFSET(CAEAudioHardware, m_fNonStreamFaderScalingFactor, 0x424);
VALIDATE_OFFSET(CAEAudioHardware, m_fNonStreamFaderScalingFactor, 0x420);
VALIDATE_OFFSET(CAEAudioHardware, m_fStreamFaderScalingFactor, 0x424);

Comment on lines +18 to +19
bool m_bPrevMaxSecondarySlowFadeout;
bool m_bPrevMaxGlobalSlowFadeout;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: "Secondary" is the loudest frontend sound (channel flag 0x1), "Global" the loudest overall; the bools are its smooth ducking flag (0x80). Mobile SDK names:

Suggested change
bool m_bPrevMaxSecondarySlowFadeout;
bool m_bPrevMaxGlobalSlowFadeout;
bool m_bLoudestFrontendSoundWasSmoothDucking;
bool m_bLoudestOverallSoundWasSmoothDucking;

Comment on lines +37 to +38
float m_fPrevMaxVolumeSecondary;
float m_fPrevMaxVolumeGlobal;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float m_fPrevMaxVolumeSecondary;
float m_fPrevMaxVolumeGlobal;
float m_fLoudestFrontendSoundVolumeLastFrame;
float m_fLoudestOverallSoundVolumeLastFrame;

Comment on lines +69 to +70
VALIDATE_OFFSET(CAEAudioHardware, m_bPrevMaxSecondarySlowFadeout, 0x2);
VALIDATE_OFFSET(CAEAudioHardware, m_bPrevMaxGlobalSlowFadeout, 0x3);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VALIDATE_OFFSET(CAEAudioHardware, m_bPrevMaxSecondarySlowFadeout, 0x2);
VALIDATE_OFFSET(CAEAudioHardware, m_bPrevMaxGlobalSlowFadeout, 0x3);
VALIDATE_OFFSET(CAEAudioHardware, m_bLoudestFrontendSoundWasSmoothDucking, 0x2);
VALIDATE_OFFSET(CAEAudioHardware, m_bLoudestOverallSoundWasSmoothDucking, 0x3);

VALIDATE_OFFSET(CAudioEngine, field_A1, 0xA1);
VALIDATE_OFFSET(CAudioEngine, field_B0, 0xB0);
VALIDATE_OFFSET(CAudioEngine, field_B1, 0xB1);
VALIDATE_OFFSET(CAudioEngine, m_nSavedRadioStationId, 0x3);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VALIDATE_OFFSET(CAudioEngine, m_nSavedRadioStationId, 0x3);
VALIDATE_OFFSET(CAudioEngine, _pad3, 0x3);

bool IsVehicleRadioActive();
char* GetRadioStationName(signed char id);
void StartRadio(int stationId, float bass, int arg, char unused);
void StartRadio(eRadioID stationId, float bass, int arg, char unused);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Real signature: _ZN20CAERadioTrackManager10StartRadioEaafh. The args go to settings2 +0x25/+0x26/+0x28, the last one is passed to 0x4EAC30 (Service passes 1).

Suggested change
void StartRadio(eRadioID stationId, float bass, int arg, char unused);
void StartRadio(eRadioID stationId, Int8 bassSetting, float bassGain, bool skipTrack);

Comment on lines +21 to +22
void CAERadioTrackManager::StartRadio(eRadioID stationId, float bass, int arg, char unused) {
plugin::CallMethod<0x4EB3C0, CAERadioTrackManager*, eRadioID, float, int, char>(this, stationId, bass, arg, unused);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void CAERadioTrackManager::StartRadio(eRadioID stationId, float bass, int arg, char unused) {
plugin::CallMethod<0x4EB3C0, CAERadioTrackManager*, eRadioID, float, int, char>(this, stationId, bass, arg, unused);
void CAERadioTrackManager::StartRadio(eRadioID stationId, Int8 bassSetting, float bassGain, bool skipTrack) {
plugin::CallMethod<0x4EB3C0, CAERadioTrackManager*, eRadioID, Int8, float, bool>(this, stationId, bassSetting, bassGain, skipTrack);

void Service();
void ServiceLoadingTune(float fade);
void StartRadio(int radioStation, char arg);
void StartRadio(eRadioID radioStation, char arg);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void StartRadio(eRadioID radioStation, char arg);
void StartRadio(eRadioID radioStation, char bassSetting);

Comment on lines +61 to +62
void CAudioEngine::StartRadio(eRadioID radioStation, char arg) {
plugin::CallMethod<0x507DC0, CAudioEngine*, eRadioID, char>(this, radioStation, arg);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void CAudioEngine::StartRadio(eRadioID radioStation, char arg) {
plugin::CallMethod<0x507DC0, CAudioEngine*, eRadioID, char>(this, radioStation, arg);
void CAudioEngine::StartRadio(eRadioID radioStation, char bassSetting) {
plugin::CallMethod<0x507DC0, CAudioEngine*, eRadioID, char>(this, radioStation, bassSetting);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants