eth changes

This commit is contained in:
Ethan 2024-09-13 22:20:58 +09:00
parent 3e6d7df86b
commit ee8217d432
No known key found for this signature in database
GPG Key ID: 9BCC97FDA5482E7A

View File

@ -5,56 +5,51 @@
#error "Define PARTY_IMAGE to the asset name to use LoadPartyImage." #error "Define PARTY_IMAGE to the asset name to use LoadPartyImage."
#endif #endif
#ifdef SHIFT #define PARTY_IMAGE_PALETTE_SIZE 256
//this is required on modern compilers to guarantee the raster comes directly after the palette #define PARTY_IMAGE_WIDTH 150
typedef struct Img { #define PARTY_IMAGE_HEIGHT 105
u16 palette[256];
u8 raster[0x3D90]; // 10 bytes added for padding: 150 * 105 = 0x3D86 typedef struct PartyImage {
PAL_BIN palette[PARTY_IMAGE_PALETTE_SIZE];
IMG_BIN raster[PARTY_IMAGE_WIDTH * PARTY_IMAGE_HEIGHT];
char padding[10];
} PartyImage; } PartyImage;
static PartyImage img;
API_CALLABLE(N(LoadPartyImage)) { API_CALLABLE(N(LoadPartyImage)) {
#ifdef SHIFT
static PartyImage img;
#else
static PAL_BIN palette[PARTY_IMAGE_PALETTE_SIZE];
static IMG_BIN raster[PARTY_IMAGE_WIDTH * PARTY_IMAGE_HEIGHT];
static u8 padding[10];
#endif
static MessageImageData image; static MessageImageData image;
u32 decompressedSize; u32 decompressedSize;
void* compressed = load_asset_by_name(PARTY_IMAGE, &decompressedSize); void* compressed = load_asset_by_name(PARTY_IMAGE, &decompressedSize);
#ifdef SHIFT
decode_yay0(compressed, &img); decode_yay0(compressed, &img);
#else
decode_yay0(compressed, palette);
#endif
general_heap_free(compressed); general_heap_free(compressed);
#ifdef SHIFT
image.raster = img.raster; image.raster = img.raster;
image.palette = img.palette; image.palette = img.palette;
image.width = 150; #else
image.height = 105;
image.format = G_IM_FMT_CI;
image.bitDepth = G_IM_SIZ_8b;
set_message_images(&image);
return ApiStatus_DONE2;
}
#else
API_CALLABLE(N(LoadPartyImage)) {
static PAL_BIN palette[256];
static IMG_BIN raster[0x3D90]; // 10 bytes added for padding: 150 * 105 = 3D86
static MessageImageData image;
u32 decompressedSize;
void* compressed = load_asset_by_name(PARTY_IMAGE, &decompressedSize);
decode_yay0(compressed, &palette);
general_heap_free(compressed);
image.raster = raster; image.raster = raster;
image.palette = palette; image.palette = palette;
image.width = 150; #endif
image.height = 105;
image.width = PARTY_IMAGE_WIDTH;
image.height = PARTY_IMAGE_HEIGHT;
image.format = G_IM_FMT_CI; image.format = G_IM_FMT_CI;
image.bitDepth = G_IM_SIZ_8b; image.bitDepth = G_IM_SIZ_8b;
set_message_images(&image); set_message_images(&image);
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
#endif
#undef PARTY_IMAGE #undef PARTY_IMAGE