Delete pointless accessors, update some comments

This commit is contained in:
Henrik Rydgård 2024-04-09 23:46:16 +02:00
parent 1bcb155762
commit e19e9b2793
3 changed files with 64 additions and 20 deletions

View file

@ -15,6 +15,57 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
// Games known to support custom music and almost certainly use sceMp3:
//
// * ATV Offroad Fury: Blazin' Trails
// * Beats (/PSP/MUSIC)
// * Crazy Taxi : Fare Wars (/MUSIC)
// * Dead or Alive Paradise
// * Gran Turismo - You must first clear all driving challenges up to C to unlock this feature, then it will be available through the options menu.
// * Grand Theft Auto : Liberty City Stories
// * Grand Theft Auto : Vice City Stories
// * Heroes' VS (#5866 ?)
// * MLB 08 : The Show
// * MotorStorm : Artic Edge
// * NBA Live 09
// * Need for Speed Carbon
// * Need for Speed Pro Street
// * Pro Evolution Soccer 2014
// * SD Gundam G Generation Overworld
// * TOCA Race Driver 2
// * Untold Legends II
// * Wipeout Pulse (/MUSIC/WIPEOUT)
//
// Games known to use LowLevelDecode:
//
// * Gundam G (custom BGM)
// * Heroes' VS (custom BGM)
//
// Games that use sceMp3 internally
//
// * Kirameki School Life SP
// * Breakquest (mini)
// * Orbit (mini)
// * SWAT Target Liberty ULES00927
// * Geometry Wars (homebrew)
// * Hanayaka Nari Wa ga Ichizoku
// * Velocity (mini)
// * N+ (mini) (#9379)
// * Mighty Flip Champs DX (mini)
// * EDGE (mini)
// * Stellar Attack (mini)
// * Hungry Giraffe (mini)
// * OMG - Z (mini)
// ...probably lots more minis...
//
// BUGS
//
// Custom music plays but starts stuttering:
// * Beats
//
// Custom music just repeats a small section:
// * Crazy Taxi
#include <map>
#include <algorithm>
@ -44,9 +95,9 @@ static const int AU_BUF_MIN_SIZE = 8192;
static const int PCM_BUF_MIN_SIZE = 9216;
static const size_t MP3_MAX_HANDLES = 2;
struct Mp3Context {
// This one is only used for save state upgrading.
struct Mp3ContextOld {
public:
int mp3StreamStart;
int mp3StreamEnd;
u32 mp3Buf;
@ -121,7 +172,7 @@ void __Mp3DoState(PointerWrap &p) {
if (s >= 2) {
Do(p, mp3Map);
} else {
std::map<u32, Mp3Context *> mp3Map_old;
std::map<u32, Mp3ContextOld *> mp3Map_old;
Do(p, mp3Map_old); // read old map
for (auto it = mp3Map_old.begin(), end = mp3Map_old.end(); it != end; ++it) {
auto mp3 = new AuCtx;
@ -476,7 +527,7 @@ static int sceMp3GetMaxOutputSample(u32 mp3) {
return hleLogWarning(ME, 0, "no channel available for low level");
}
return hleLogSuccessI(ME, ctx->AuGetMaxOutputSample());
return hleLogSuccessI(ME, ctx->MaxOutputSample);
}
static int sceMp3GetSumDecodedSample(u32 mp3) {
@ -489,7 +540,7 @@ static int sceMp3GetSumDecodedSample(u32 mp3) {
return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type");
}
return hleLogSuccessI(ME, ctx->AuGetSumDecodedSample());
return hleLogSuccessI(ME, ctx->SumDecodedSamples);
}
static int sceMp3SetLoopNum(u32 mp3, int loop) {
@ -520,7 +571,7 @@ static int sceMp3GetMp3ChannelNum(u32 mp3) {
return hleLogWarning(ME, 0, "no channel available for low level");
}
return hleLogSuccessI(ME, ctx->AuGetChannelNum());
return hleLogSuccessI(ME, ctx->Channels);
}
static int sceMp3GetBitRate(u32 mp3) {
@ -535,7 +586,7 @@ static int sceMp3GetBitRate(u32 mp3) {
return hleLogWarning(ME, 0, "no bitrate available for low level");
}
return hleLogSuccessI(ME, ctx->AuGetBitRate());
return hleLogSuccessI(ME, ctx->BitRate);
}
static int sceMp3GetSamplingRate(u32 mp3) {
@ -550,7 +601,7 @@ static int sceMp3GetSamplingRate(u32 mp3) {
return hleLogWarning(ME, 0, "no sample rate available for low level");
}
return hleLogSuccessI(ME, ctx->AuGetSamplingRate());
return hleLogSuccessI(ME, ctx->SamplingRate);
}
static int sceMp3GetInfoToAddStreamData(u32 mp3, u32 dstPtr, u32 towritePtr, u32 srcposPtr) {
@ -613,7 +664,7 @@ static u32 sceMp3GetFrameNum(u32 mp3) {
return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init");
}
return hleLogSuccessI(ME, ctx->AuGetFrameNum());
return hleLogSuccessI(ME, ctx->FrameNum);
}
static u32 sceMp3GetMPEGVersion(u32 mp3) {
@ -630,7 +681,7 @@ static u32 sceMp3GetMPEGVersion(u32 mp3) {
}
// Tests have not revealed how to expose more than "3" here as a result.
return hleReportDebug(ME, ctx->AuGetVersion());
return hleReportDebug(ME, ctx->Version);
}
static u32 sceMp3ResetPlayPositionByFrame(u32 mp3, u32 frame) {
@ -643,7 +694,7 @@ static u32 sceMp3ResetPlayPositionByFrame(u32 mp3, u32 frame) {
return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init");
}
if (frame >= (u32)ctx->AuGetFrameNum()) {
if (frame >= (u32)ctx->FrameNum) {
return hleLogError(ME, ERROR_MP3_BAD_RESET_FRAME, "bad frame position");
}

View file

@ -368,7 +368,7 @@ static u32 sceAacGetMaxOutputSample(u32 id)
return -1;
}
return ctx->AuGetMaxOutputSample();
return ctx->MaxOutputSample;
}
static u32 sceAacGetSumDecodedSample(u32 id)
@ -380,7 +380,7 @@ static u32 sceAacGetSumDecodedSample(u32 id)
return -1;
}
return ctx->AuGetSumDecodedSample();
return ctx->SumDecodedSamples;
}
static u32 sceAacResetPlayPosition(u32 id)

View file

@ -118,13 +118,6 @@ public:
u32 AuGetLoopNum();
u32 AuGetInfoToAddStreamData(u32 bufPtr, u32 sizePtr, u32 srcPosPtr);
u32 AuGetMaxOutputSample() const { return MaxOutputSample; }
u32 AuGetSumDecodedSample() const { return SumDecodedSamples; }
int AuGetChannelNum() const { return Channels; }
int AuGetBitRate() const { return BitRate; }
int AuGetSamplingRate() const { return SamplingRate; }
int AuGetVersion() const { return Version; }
int AuGetFrameNum() const { return FrameNum; }
void SetReadPos(int pos) { readPos = pos; }
int ReadPos() { return readPos; }