mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-16 02:59:49 +01:00
Split GetPointer into two versions, to help with const correctness
This commit is contained in:
1 parent
d2a3918f5f
commit
e6403d7157
43 files changed
+169
-156
No files matched your search
@@ -805,7 +805,7 @@ int MediaEngine::writeVideoImage(u32 bufferPtr, int frameWidth, int videoPixelMo
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 *buffer = Memory::GetPointer(bufferPtr);
|
||||
u8 *buffer = Memory::GetPointerWrite(bufferPtr);
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
if (!m_pFrame || !m_pFrameRGB)
|
||||
@@ -895,7 +895,7 @@ int MediaEngine::writeVideoImageWithRange(u32 bufferPtr, int frameWidth, int vid
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 *buffer = Memory::GetPointer(bufferPtr);
|
||||
u8 *buffer = Memory::GetPointerWrite(bufferPtr);
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
if (!m_pFrame || !m_pFrameRGB)
|
||||
@@ -1032,7 +1032,7 @@ int MediaEngine::getAudioSamples(u32 bufferPtr) {
|
||||
ERROR_LOG_REPORT(ME, "Ignoring bad audio decode address %08x during video playback", bufferPtr);
|
||||
}
|
||||
|
||||
u8 *buffer = Memory::GetPointer(bufferPtr);
|
||||
u8 *buffer = Memory::GetPointerWrite(bufferPtr);
|
||||
if (!m_demux) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,13 +64,13 @@ void VagDecoder::Start(u32 data, u32 vagSize, bool loopEnabled) {
|
||||
s_2 = 0;
|
||||
}
|
||||
|
||||
void VagDecoder::DecodeBlock(u8 *&read_pointer) {
|
||||
void VagDecoder::DecodeBlock(const u8 *&read_pointer) {
|
||||
if (curBlock_ == numBlocks_ - 1) {
|
||||
end_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
u8 *readp = read_pointer;
|
||||
const u8 *readp = read_pointer;
|
||||
int predict_nr = *readp++;
|
||||
int shift_factor = predict_nr & 0xf;
|
||||
predict_nr >>= 4;
|
||||
@@ -124,8 +124,8 @@ void VagDecoder::GetSamples(s16 *outSamples, int numSamples) {
|
||||
WARN_LOG(SASMIX, "Bad VAG samples address?");
|
||||
return;
|
||||
}
|
||||
u8 *readp = Memory::GetPointerUnchecked(read_);
|
||||
u8 *origp = readp;
|
||||
const u8 *readp = Memory::GetPointerUnchecked(read_);
|
||||
const u8 *origp = readp;
|
||||
|
||||
for (int i = 0; i < numSamples; i++) {
|
||||
if (curSample == 28) {
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ public:
|
||||
|
||||
void GetSamples(s16 *outSamples, int numSamples);
|
||||
|
||||
void DecodeBlock(u8 *&readp);
|
||||
void DecodeBlock(const u8 *&readp);
|
||||
bool End() const { return end_; }
|
||||
|
||||
void DoState(PointerWrap &p);
|
||||
|
||||
@@ -177,7 +177,7 @@ bool SimpleAudio::IsOK() const {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SimpleAudio::Decode(void *inbuf, int inbytes, uint8_t *outbuf, int *outbytes) {
|
||||
bool SimpleAudio::Decode(const uint8_t *inbuf, int inbytes, uint8_t *outbuf, int *outbytes) {
|
||||
#ifdef USE_FFMPEG
|
||||
if (!codecOpen_) {
|
||||
OpenCodec(inbytes);
|
||||
@@ -185,7 +185,7 @@ bool SimpleAudio::Decode(void *inbuf, int inbytes, uint8_t *outbuf, int *outbyte
|
||||
|
||||
AVPacket packet;
|
||||
av_init_packet(&packet);
|
||||
packet.data = static_cast<uint8_t *>(inbuf);
|
||||
packet.data = (uint8_t *)(inbuf);
|
||||
packet.size = inbytes;
|
||||
|
||||
int got_frame = 0;
|
||||
@@ -338,7 +338,7 @@ size_t AuCtx::FindNextMp3Sync() {
|
||||
// return output pcm size, <0 error
|
||||
u32 AuCtx::AuDecode(u32 pcmAddr) {
|
||||
u32 outptr = PCMBuf + nextOutputHalf * PCMBufSize / 2;
|
||||
auto outbuf = Memory::GetPointer(outptr);
|
||||
auto outbuf = Memory::GetPointerWrite(outptr);
|
||||
int outpcmbufsize = 0;
|
||||
|
||||
if (pcmAddr)
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
SimpleAudio(int audioType, int sample_rate = 44100, int channels = 2);
|
||||
~SimpleAudio();
|
||||
|
||||
bool Decode(void* inbuf, int inbytes, uint8_t *outbuf, int *outbytes);
|
||||
bool Decode(const uint8_t* inbuf, int inbytes, uint8_t *outbuf, int *outbytes);
|
||||
bool IsOK() const;
|
||||
|
||||
int GetOutSamples();
|
||||
|
||||
Reference in new issue
Block a user