Skip to content

fix: use weak import flag for sceVideocodec stubs#20

Merged
AndrewAltimit merged 1 commit intomainfrom
fix/weak-videocodec-import
Mar 7, 2026
Merged

fix: use weak import flag for sceVideocodec stubs#20
AndrewAltimit merged 1 commit intomainfrom
fix/weak-videocodec-import

Conversation

@AndrewAltimit
Copy link
Owner

Summary

  • Change sceVideocodec psp_extern! flags from 0x4001 to 0x4009, matching sceAudiocodec
  • The 0x0008 bit marks the import as "weak", allowing modules to load even when the codec library hasn't been loaded yet via sceUtilityLoadModule

Problem

Any EBOOT that references sceVideocodec functions fails to load on real PSP hardware because the kernel can't resolve the import stubs at module load time -- the avcodec firmware module isn't loaded until runtime via sceUtilityLoadModule(AvCodec).

sceAudiocodec already uses 0x4009 (weak) and works correctly with lazy module loading. sceVideocodec was the only codec using 0x4001 (strong).

Test plan

  • Verified EBOOT boots on real PSP-3000 + 6.20 PRO-C with weak flag
  • Confirmed sceVideocodecOpen returns expected error on PPSSPP (ME not emulated)
  • Audio codec path (sceAudiocodec) unaffected (already uses 0x4009)

Generated with Claude Code (https://claude.com/claude-code)

Change sceVideocodec psp_extern flags from 0x4001 to 0x4009,
matching sceAudiocodec's flags. The 0x0008 bit marks the import
as "weak", allowing modules to load even when the codec library
hasn't been loaded yet via sceUtilityLoadModule.

Without this fix, any EBOOT that references sceVideocodec functions
fails to load on real PSP hardware because the kernel can't resolve
the import stubs at module load time (the avcodec firmware module
isn't loaded until runtime).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Gemini AI Code Review

Issues

(none)

Previous Issues

(none)

Suggestions

(none)

Notes

  • The change from 0x4001 to 0x4009 correctly adds the weak import bit (0x0008) to the library flags.
  • This is consistent with sceAudiocodec in the same file and other peripheral modules like sceUsbCam that are loaded at runtime via sceUtilityLoadModule.
  • Using weak imports for sceVideocodec prevents module load failures on real hardware when the avcodec firmware hasn't been initialized yet, allowing for deferred error handling in user code.

Reaction


Generated by Gemini AI (gemini-3-flash-preview). Supplementary to human reviews.

@AndrewAltimit
Copy link
Owner Author

Review Response Agent (Iteration 1)

Status: No changes needed

Fixed Issues

  • (none — no issues were raised)

Ignored Issues

  • (none — no issues were raised)

Deferred to Human

  • (none)

Notes

  • The Gemini review approved the PR with no issues, no suggestions. The change correctly adds the weak import bit (0x0008) to sceVideocodec flags, matching the existing sceAudiocodec pattern. No code changes needed.

The agent reviewed feedback but determined no code changes were required.

@AndrewAltimit AndrewAltimit merged commit 1c119f1 into main Mar 7, 2026
7 checks passed
@AndrewAltimit AndrewAltimit deleted the fix/weak-videocodec-import branch March 7, 2026 07:53
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.

1 participant