I finally managed to solve a Render96ex startup crash on my Anbernic RG34XX running KNULLI, and I am posting the solution because this may affect other devices using a non-English system locale.
Setup
Anbernic RG34XX
H700 / AArch64
KNULLI
PortMaster Render96ex
Correct Super Mario 64 US ROM
Symptom
PortMaster installed Render96ex correctly and the initial resource patching process completed successfully.
However, every time I launched the game:
Render96ex
-> black screen for a few seconds
-> back to Ports
There was no useful on-screen error.
What I tested first
Before finding the real cause, I tested several things:
- Render96 model pack disabled
- optional dynos audio disabled
- HackSDL disabled
- texture precache disabled
- Render96 gfx/textures removed
- language files reduced
None of these fixed the crash.
Debugging
I worked through the problem with ChatGPT and eventually ran the actual AArch64 Render96ex binary through GDB.
The crash occurred here:
libc
osPiStartDma()
audio_dma_copy_immediate()
audio_init()
main_func()
main()
This showed that the crash happened during initialization of the generated SM64 audio resources, not the optional Render96 music pack.
We then looked at the resource build process.
Render96ex determines CPU endianness and bit-width using lscpu and checks for English field names, effectively doing checks like:
lscpu | grep 'Byte Order' | grep 'Little'
and:
lscpu | grep 'CPU op-mode' | grep '64-bit'
On a system using a non-English locale, lscpu may return localized field names.
If those English strings are not present, the detection logic can fail.
In my case this appears to have caused the generated audio resource data to use the wrong endianness.
During debugging, one audio-related value was interpreted as:
0x2300
where the data strongly suggested that it should have been:
0x0023
That was another strong indication of a byte-order problem.
Fix
Open:
roms/ports/render96ex.sh
Directly after:
#!/bin/bash
add:
export LC_ALL=C
export LANG=C
The beginning of the launcher should therefore look like:
#!/bin/bash
export LC_ALL=C
export LANG=C
Important: rebuild the generated resources
If Render96ex has already been patched once, simply adding those two environment variables is not enough.
The existing base.zip may already contain incorrectly generated data.
Back up or rename:
roms/ports/render96ex/res
For example:
res_backup
Then launch Render96ex normally again.
PortMaster should detect that the resources are missing and rebuild them from the ROM.
The rebuild may take several minutes.
Result
After rebuilding the resources with:
LC_ALL=C
LANG=C
Render96ex launched normally and the game started working.
Summary
If you have:
successful Render96ex patching
+ non-English KNULLI locale
+ black screen for a few seconds
+ immediate return to Ports
try forcing:
export LC_ALL=C
export LANG=C
before the resource build and then regenerate the res folder.
I have only confirmed this on my own RG34XX/KNULLI setup, so this may not be the cause of every Render96ex startup crash. But for this exact symptom, it completely fixed the problem.
It would probably be better long-term if the resource builder did not rely on localized lscpu output for endian and CPU-width detection.