Alchemy
Loading...
Searching...
No Matches

decompress.c File Reference

Resource decoding and pixel buffer shading, through RAM copies of ARM code. More...

Go to the source code of this file.

Macros

#define RESOURCE_DEFINE_DECODE(name, code, bytes)
 Each decoder copies its ARM routine code to RAM, runs it and frees the copy, and returns the number of bytes it decoded.

Functions

void Resource_DecompressHalfwords (const void *source, void *destination)
 Decompresses the halfword LZ stream at source to destination, with a copy of the ARM decoder on the stack.
s32 Resource_DecodeType01 (const void *source, void *destination)
 Decodes a type-01 resource and returns its unpacked byte count.
s32 Resource_DecodeType2 (const void *source, void *destination)
 Decodes a type-02 resource and returns its unpacked byte count.
s32 Resource_DecodeByteLz (const void *source, void *destination)
 Decodes a byte-oriented LZ resource and returns its unpacked byte count.
void ColorBuffer_BackupAndBrighten (u8 *buffer, u32 amount, u8 *backup, u32 bytes)
 Raises every pixel by amount, stopping at 63.
void ColorBuffer_BackupAndDarken (u8 *buffer, u32 amount, u8 *backup, u32 bytes)
 Lowers every pixel by amount, stopping at 0.
void ColorBuffer_BackupAndScaleThreeQuarters (u8 *buffer, u8 *backup, u32 bytes)
 Scales every pixel to three quarters.
void ColorBuffer_BackupAndHalve (u8 *buffer, u8 *backup, u32 bytes)
 Halves every pixel. Called by the battle effect canvas's transfers.
void ColorBuffer_BackupAndBrightenPartial (u8 *buffer, u32 amount, u8 *backup, u32 bytes)
 As ColorBuffer_BackupAndBrighten, skipping groups already all at 63.
void ColorBuffer_BackupAndDarkenPartial (u8 *buffer, u32 amount, u8 *backup, u32 bytes)
 As ColorBuffer_BackupAndDarken, skipping groups already all at 0.
void ColorBuffer_BackupAndScaleNonzeroThreeQuarters (u8 *buffer, u8 *backup, u32 bytes)
 Scales every pixel to three quarters, skipping all-zero groups.
void ColorBuffer_BackupAndHalveNonzero (u8 *buffer, u8 *backup, u32 bytes)
 Halves every pixel, skipping all-zero groups.

Detailed Description

Resource decoding and pixel buffer shading, through RAM copies of ARM code.

Part of runtime.c, the runtime object, compiled only through it.

Definition in file decompress.c.

Macro Definition Documentation

◆ RESOURCE_DEFINE_DECODE

#define RESOURCE_DEFINE_DECODE ( name,
code,
bytes )
Value:
s32 name(const void *source, void *destination) { \
s32 (*routine)(const void *, void *); \
s32 result; \
\
RamCode_Load(routine, code, bytes); \
result = routine(source, destination); \
MemFree(routine); \
return result; \
}
signed int s32
Definition types.h:14

Each decoder copies its ARM routine code to RAM, runs it and frees the copy, and returns the number of bytes it decoded.

Definition at line 18 of file decompress.c.

Referenced by Resource_DecodeType01(), and Resource_DecodeType2().

Function Documentation

◆ Resource_DecompressHalfwords()

void Resource_DecompressHalfwords ( const void * source,
void * destination )

Decompresses the halfword LZ stream at source to destination, with a copy of the ARM decoder on the stack.

Called by the palette editor.

Definition at line 9 of file decompress.c.

Referenced by Debug_RunPaletteEditor(), memcpy(), and Resource_DecompressHalfwords().

◆ Resource_DecodeType01()

◆ Resource_DecodeType2()

s32 Resource_DecodeType2 ( const void * source,
void * destination )

Decodes a type-02 resource and returns its unpacked byte count.

Definition at line 34 of file decompress.c.

Referenced by Map_LoadLayeredScene(), Resource_DecodeType01(), and System_GetLanguage().

◆ Resource_DecodeByteLz()

◆ ColorBuffer_BackupAndBrighten()

void ColorBuffer_BackupAndBrighten ( u8 * buffer,
u32 amount,
u8 * backup,
u32 bytes )

Raises every pixel by amount, stopping at 63.

Definition at line 47 of file decompress.c.

Referenced by BattleFx_ProcessPendingGraphicsTransfer(), ColorBuffer_BackupAndBrighten(), and memcpy().

◆ ColorBuffer_BackupAndDarken()

void ColorBuffer_BackupAndDarken ( u8 * buffer,
u32 amount,
u8 * backup,
u32 bytes )

Lowers every pixel by amount, stopping at 0.

Definition at line 56 of file decompress.c.

Referenced by BattleFx_FlushPendingGraphicsTransfer(), BattleFx_ProcessPendingGraphicsTransfer(), ColorBuffer_BackupAndDarken(), and memcpy().

◆ ColorBuffer_BackupAndScaleThreeQuarters()

void ColorBuffer_BackupAndScaleThreeQuarters ( u8 * buffer,
u8 * backup,
u32 bytes )

◆ ColorBuffer_BackupAndHalve()

void ColorBuffer_BackupAndHalve ( u8 * buffer,
u8 * backup,
u32 bytes )

Halves every pixel. Called by the battle effect canvas's transfers.

Definition at line 75 of file decompress.c.

Referenced by BattleFx_FlushPendingGraphicsTransfer(), BattleFx_ProcessPendingGraphicsTransfer(), ColorBuffer_BackupAndHalve(), and memcpy().

◆ ColorBuffer_BackupAndBrightenPartial()

void ColorBuffer_BackupAndBrightenPartial ( u8 * buffer,
u32 amount,
u8 * backup,
u32 bytes )

As ColorBuffer_BackupAndBrighten, skipping groups already all at 63.

Definition at line 83 of file decompress.c.

Referenced by ColorBuffer_BackupAndBrightenPartial(), and memcpy().

◆ ColorBuffer_BackupAndDarkenPartial()

void ColorBuffer_BackupAndDarkenPartial ( u8 * buffer,
u32 amount,
u8 * backup,
u32 bytes )

As ColorBuffer_BackupAndDarken, skipping groups already all at 0.

Definition at line 93 of file decompress.c.

Referenced by ColorBuffer_BackupAndDarkenPartial(), and memcpy().

◆ ColorBuffer_BackupAndScaleNonzeroThreeQuarters()

void ColorBuffer_BackupAndScaleNonzeroThreeQuarters ( u8 * buffer,
u8 * backup,
u32 bytes )

Scales every pixel to three quarters, skipping all-zero groups.

Definition at line 103 of file decompress.c.

Referenced by ColorBuffer_BackupAndScaleNonzeroThreeQuarters(), memcpy(), and ReelGame_TransferCanvas().

◆ ColorBuffer_BackupAndHalveNonzero()

void ColorBuffer_BackupAndHalveNonzero ( u8 * buffer,
u8 * backup,
u32 bytes )

Halves every pixel, skipping all-zero groups.

Called by the slot reels' canvas transfer.

Definition at line 114 of file decompress.c.

Referenced by ColorBuffer_BackupAndHalveNonzero(), memcpy(), and ReelGame_TransferCanvas().