diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index 20d194da6b..f030984c3e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -83,7 +83,7 @@ PesHeader::PesHeader(DemuxerStream& stream) ElementaryStream::ElementaryStream(Demuxer* dmux, u32 addr, u32 size, u32 fidMajor, u32 fidMinor, u32 sup1, u32 sup2, vm::ptr cbFunc, u32 cbArg, u32 spec) : dmux(dmux) - , memAddr(a128(addr)) + , memAddr(align(addr, 128)) , memSize(size - (addr - memAddr)) , fidMajor(fidMajor) , fidMinor(fidMinor) @@ -92,7 +92,7 @@ ElementaryStream::ElementaryStream(Demuxer* dmux, u32 addr, u32 size, u32 fidMaj , cbFunc(cbFunc) , cbArg(cbArg) , spec(spec) - , put(a128(addr)) + , put(align(addr, 128)) , put_count(0) , got_count(0) , released(0) @@ -184,7 +184,7 @@ void ElementaryStream::push_au(u32 size, u64 dts, u64 pts, u64 userdata, bool ra addr = put; - put = a128(put + 128 + size); + put = align(put + 128 + size, 128); put_count++; } @@ -347,7 +347,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr) if (!stream.peek(code)) { // demuxing finished - auto dmuxMsg = vm::ptr::make(a128(dmux.memAddr) + (cb_add ^= 16)); + auto dmuxMsg = vm::ptr::make(dmux.memAddr + (cb_add ^= 16)); dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE; dmuxMsg->supplementalInfo = stream.userdata; dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg); @@ -497,7 +497,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr) //cellDmux->Notice("ATX AU pushed (ats=0x%llx, frame_size=%d)", ((be_t*)data)->ToLE(), frame_size); - auto esMsg = vm::ptr::make(a128(dmux.memAddr) + (cb_add ^= 16)); + auto esMsg = vm::ptr::make(dmux.memAddr + (cb_add ^= 16)); esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND; esMsg->supplementalInfo = stream.userdata; es.cbFunc(*dmux.dmuxCb, dmux.id, es.id, esMsg, es.cbArg); @@ -562,7 +562,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr) es.push_au(old_size, es.last_dts, es.last_pts, stream.userdata, false /* TODO: set correct value */, 0); // callback - auto esMsg = vm::ptr::make(a128(dmux.memAddr) + (cb_add ^= 16)); + auto esMsg = vm::ptr::make(dmux.memAddr + (cb_add ^= 16)); esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND; esMsg->supplementalInfo = stream.userdata; es.cbFunc(*dmux.dmuxCb, dmux.id, es.id, esMsg, es.cbArg); @@ -634,7 +634,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr) case dmuxResetStream: case dmuxResetStreamAndWaitDone: { - auto dmuxMsg = vm::ptr::make(a128(dmux.memAddr) + (cb_add ^= 16)); + auto dmuxMsg = vm::ptr::make(dmux.memAddr + (cb_add ^= 16)); dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE; dmuxMsg->supplementalInfo = stream.userdata; dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg); @@ -722,7 +722,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr) es.push_au(old_size, es.last_dts, es.last_pts, stream.userdata, false, 0); // callback - auto esMsg = vm::ptr::make(a128(dmux.memAddr) + (cb_add ^= 16)); + auto esMsg = vm::ptr::make(dmux.memAddr + (cb_add ^= 16)); esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND; esMsg->supplementalInfo = stream.userdata; es.cbFunc(*dmux.dmuxCb, dmux.id, es.id, esMsg, es.cbArg); @@ -734,7 +734,7 @@ u32 dmuxOpen(Demuxer* dmux_ptr) } // callback - auto esMsg = vm::ptr::make(a128(dmux.memAddr) + (cb_add ^= 16)); + auto esMsg = vm::ptr::make(dmux.memAddr + (cb_add ^= 16)); esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_FLUSH_DONE; esMsg->supplementalInfo = stream.userdata; es.cbFunc(*dmux.dmuxCb, dmux.id, es.id, esMsg, es.cbArg); diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.h b/rpcs3/Emu/SysCalls/Modules/cellDmux.h index 6f0ed352b3..8a2a70cc5b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.h +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.h @@ -1,8 +1,5 @@ #pragma once -// align size or address to 128 -#define a128(x) ((x + 127) & (~127)) - // Error Codes enum { diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index 2cd526a35d..7776ebfbc0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -693,7 +693,7 @@ int cellVdecGetPicture(u32 handle, vm::ptr format, vm:: if (outBuff) { - u32 buf_size = a128(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1)); + const u32 buf_size = align(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1), 128); if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR) { @@ -753,7 +753,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr picItem_ptr) info->codecType = vdec->type; info->startAddr = 0x00000123; // invalid value (no address for picture) - info->size = a128(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1)); + info->size = align(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1), 128); info->auNum = 1; info->auPts[0].lower = (u32)vf.pts; info->auPts[0].upper = vf.pts >> 32; diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.h b/rpcs3/Emu/SysCalls/Modules/cellVdec.h index e03cc26f06..e53955e70e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.h @@ -1,7 +1,5 @@ #pragma once -#define a128(x) ((x + 127) & (~127)) - // Error Codes enum {