mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-14 10:09:32 +01:00
Run the real mpeg.prx in place of our sceMpeg HLE
Add flash0:/kd/mpeg.prx to the sceUtility module swap, hung off av_mpegbase, so it loads when DisableHLEFlags::sceMpeg is set. Games that ship their own sceMpeg_library on the disc never get here and just use theirs. The piece that was missing to make it work: the access unit address mpeg.prx passes to sceVideocodecDecode is in Media Engine space, which we can't read. On hardware sceMpegBasePESpacketCopy DMA'd the payload there first. That copy is ours, so it now gathers the blocks and sceVideocodec decodes from those, falling back to main memory for any caller that points at it directly. The gather is keyed by destination, because that call carries the audio payload too - video to an ME address, audio to main memory - and handing an ATRAC packet to the H.264 decoder gets you nothing. With that, video/mpeg/basic gets a 144x80 frame out of real Sony code driving our sceVideocodec through ffmpeg. The test still fails overall, as it did before this branch - it is in tests_next. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ba975d2908
commit
00770764a7
5 files changed
+94
-8
No files matched your search
+16
-3
@@ -137,11 +137,23 @@ static void LoadFirmwareModules(const char *library, const FirmwareModule *modul
|
||||
}
|
||||
}
|
||||
|
||||
// libmp3.prx imports nothing but the kernel and sceAudiocodec, which we have.
|
||||
static void NotifyLoadStatusMp3(int state, u32 loadAddr, u32 totalSize) {
|
||||
// mpeg.prx needs sceVideocodec, sceMpegbase and sceAudiocodec from us, all of which we implement,
|
||||
// so the module itself is the only thing that has to come from somewhere real.
|
||||
static void NotifyLoadStatusMpegBase(int state, u32 loadAddr, u32 totalSize) {
|
||||
// The effective flags, not the raw setting: those also account for the compat flags, for a
|
||||
// firmware dump that isn't there, and for the boundary a savestate restored - resolving
|
||||
// imports one way and loading modules the other is how a game ends up with neither.
|
||||
if (state != 1 || !(GetEffectiveDisableHLEFlags() & DisableHLEFlags::sceMpeg)) {
|
||||
return;
|
||||
}
|
||||
static const FirmwareModule modules[] = {
|
||||
{ "flash0:/kd/mpeg.prx", "sceMpeg_library" },
|
||||
};
|
||||
LoadFirmwareModules("sceMpeg", modules, ARRAY_SIZE(modules));
|
||||
}
|
||||
|
||||
// libmp3.prx imports nothing but the kernel and sceAudiocodec, which we have.
|
||||
static void NotifyLoadStatusMp3(int state, u32 loadAddr, u32 totalSize) {
|
||||
if (state != 1 || !(GetEffectiveDisableHLEFlags() & DisableHLEFlags::sceMp3)) {
|
||||
return;
|
||||
}
|
||||
@@ -203,6 +215,7 @@ static void NotifyLoadStatusAtrac(int state, u32 loadAddr, u32 totalSize) {
|
||||
static DisableHLEFlags UtilityModuleLibraryFlag(u32 module) {
|
||||
switch (module) {
|
||||
case 0x302: return DisableHLEFlags::sceAtrac; // av_atrac3plus
|
||||
case 0x303: return DisableHLEFlags::sceMpeg; // av_mpegbase
|
||||
case 0x304: return DisableHLEFlags::sceMp3; // av_mp3
|
||||
case 0x308: return DisableHLEFlags::sceMp4; // av_mp4
|
||||
default: return (DisableHLEFlags)0;
|
||||
@@ -235,7 +248,7 @@ static const ModuleLoadInfo moduleLoadInfo[] = {
|
||||
// The size varies a bit per version, from about 0x3C00 to 0x4500 bytes. We could make a lookup table...
|
||||
// Changing this breaks some bad cheats though..
|
||||
ModuleLoadInfo(0x302, 0x00008000, "av_atrac3plus", atrac3PlusModuleDeps, &NotifyLoadStatusAtrac),
|
||||
ModuleLoadInfo(0x303, 0x0000c000, "av_mpegbase", mpegBaseModuleDeps),
|
||||
ModuleLoadInfo(0x303, 0x0000c000, "av_mpegbase", mpegBaseModuleDeps, &NotifyLoadStatusMpegBase),
|
||||
ModuleLoadInfo(0x304, 0x00004000, "av_mp3", &NotifyLoadStatusMp3),
|
||||
ModuleLoadInfo(0x305, 0x0000a300, "av_vaudio"),
|
||||
ModuleLoadInfo(0x306, 0x00004000, "av_aac"),
|
||||
|
||||
Reference in new issue
Block a user