I do not own an Apple device and as such this is completely untested by myself. A user requesting this feature on Discord has confirmed this makes dolphin-tool show up. Most of these changes come from looking at what already exists for DolphinQt and the Mac Updater.
Related issue: https://bugs.dolphin-emu.org/issues/13259
Legacy savestate headers controlled both the compressed input length
and the decompression buffer size. The input was read into a fixed-size
buffer without validation, and the unsafe LZO API could write past its
output buffer.
Use the legacy block size as the output capacity, reject oversized
compressed blocks, and use the bounds-checking LZO decompressor.
FIFO logs control each memory update address and data size. Playback
masked only the start address into RAM or EXRAM, then copied the
complete update contiguously. An update reaching the end of a mapped
region could therefore write beyond host-mapped emulated memory.
Resolve the target through MemoryManager and reject updates larger than
the remaining valid span before copying them.
Previously, if the USB Gecko server failed to bind to any port in the
55020-55030 range, it silently returned with no indication to the user.
Now displays an on-screen message and logs an error.
This commit replaces the old instruction sequence with one that is
considerably shorter. Main ideas are as follows:
- Use AND with constant mask to isolate the needed bits.
- Use ORR + LSL/LSR to shirt the bits into position and combine in one
instruction where possible.
- Red and alpha are already sequential, so don't need to wait for the
byteswap.
- Do the expansion from 6 to 8 bits at the end for all 4 components
in one step.
Before:
ldur w14, [x0]
rev w14, w14
ubfx w15, w14, #0, #6
orr w15, wzr, w15, lsl #2
orr w15, w15, w15, lsr #6
orr w16, wzr, w15, lsl #24
ubfx w15, w14, #6, #6
orr w15, wzr, w15, lsl #2
orr w15, w15, w15, lsr #6
orr w16, w16, w15, lsl #16
ubfx w15, w14, #12, #6
orr w15, wzr, w15, lsl #2
orr w15, w15, w15, lsr #6
orr w16, w16, w15, lsl #8
ubfx w15, w14, #18, #6
orr w16, w16, w15, lsl #2
orr w16, w16, w15, lsr #4
str w16, [x1, #0xc]
After:
ldur w14, [x0]
rev w15, w14
and w16, w14, #0xfc00
and w14, w14, #0x3f000000
lsr w16, w16, #8
orr w16, w16, w14, lsl #2
and w14, w15, #0xfc0
and w15, w15, #0x3f000
orr w15, w15, w14, lsl #14
orr w16, w16, w15, lsr #2
and w15, w16, #0xc0c0c0c0
orr w16, w16, w15, lsr #6
str w16, [x1, #0xc]
This replaces the old instruction sequence with one that is considerably
shorter. Main ideas are as follows:
- Use AND with constant mask to isolate the needed bits.
- Use ORR + LSL/LSR to shift the bits into position and combine in one
instruction where possible.
- Red and blue are already sequential, so don't need to wait for the
byteswap. This is especially handy for red, where the bits are
already where they need to be.
- Red and blue can be expanded from 5 to 8 bits together.
Before:
ldurh w14, [x0, #0x1]
rev16 w14, w14
and w15, w14, #0x1f
orr w15, wzr, w15, lsl #3
orr w15, w15, w15, lsr #5
orr w16, wzr, w15, lsl #16
ubfx w15, w14, #5, #6
orr w15, wzr, w15, lsl #2
orr w15, w15, w15, lsr #6
orr w16, w16, w15, lsl #8
ubfx w15, w14, #11, #5
orr w16, w16, w15, lsl #3
orr w16, w16, w15, lsr #2
orr w16, w16, #0xff000000
str w16, [x1, #0xc]
After:
ldurh w14, [x0, #0x1]
rev16 w15, w14
bfi w14, w14, #11, #13
and w16, w14, #0xf800f8
and w14, w14, #0xe000e0
orr w16, w16, #0xff000000
orr w16, w16, w14, lsr #5
and w14, w15, #0x7e0
and w15, w15, #0x600
orr w14, w14, w15, lsr #6
orr w16, w16, w14, lsl #5
str w16, [x1, #0xc]