Merge pull request #174 from GuidoDQR/fix-load-sprite

Fix sprite loading
This commit is contained in:
Sandro Sobczyński
2024-02-11 13:35:29 +01:00
committed by GitHub
4 changed files with 19 additions and 23 deletions
@@ -211,10 +211,6 @@ void PngLoader::handle8bppPalletized(TextureBuilderData* result,
auto* pixel = static_cast<unsigned char*>(result->data); auto* pixel = static_cast<unsigned char*>(result->data);
struct PngClut* clut = (struct PngClut*)result->clut; struct PngClut* clut = (struct PngClut*)result->clut;
for (int i = numPallete; i < 256; i++) {
memset(&clut[i], 0, sizeof(clut[i]));
}
for (int i = 0; i < numPallete; i++) { for (int i = 0; i < numPallete; i++) {
clut[i].r = palette[i].red; clut[i].r = palette[i].red;
clut[i].g = palette[i].green; clut[i].g = palette[i].green;
@@ -273,10 +269,6 @@ void PngLoader::handle4bppPalletized(TextureBuilderData* result,
auto* pixel = static_cast<unsigned char*>(result->data); auto* pixel = static_cast<unsigned char*>(result->data);
struct PngClut* clut = (struct PngClut*)result->clut; struct PngClut* clut = (struct PngClut*)result->clut;
for (int i = numPallete; i < 16; i++) {
memset(&clut[i], 0, sizeof(clut[i]));
}
for (int i = 0; i < numPallete; i++) { for (int i = 0; i < numPallete; i++) {
clut[i].r = palette[i].red; clut[i].r = palette[i].red;
clut[i].g = palette[i].green; clut[i].g = palette[i].green;
+10 -10
View File
@@ -65,20 +65,20 @@ void Path3::sendTexture(const Texture* texture,
const RendererCoreTextureBuffers& texBuffers) { const RendererCoreTextureBuffers& texBuffers) {
packet2_reset(texturePacket, false); packet2_reset(texturePacket, false);
int coreWidth = texBuffers.core->width <= 64 ? 64 : texBuffers.core->width; packet2_update(
packet2_update(texturePacket, texturePacket,
draw_texture_transfer(texturePacket->base, texture->core->data, draw_texture_transfer(texturePacket->base, texture->core->data,
texture->getWidth(), texture->getWidth(), texture->getHeight(),
texture->getHeight(), texture->core->psm, texture->core->psm, texBuffers.core->address,
texBuffers.core->address, coreWidth)); texBuffers.core->width));
if (texBuffers.clut != nullptr) { if (texBuffers.clut != nullptr) {
auto* clut = texture->clut; auto* clut = texture->clut;
int clutWidth = texBuffers.clut->width <= 64 ? 64 : texBuffers.clut->width; packet2_update(
packet2_update(texturePacket, texturePacket,
draw_texture_transfer(texturePacket->next, clut->data, draw_texture_transfer(texturePacket->next, clut->data, clut->width,
clut->width, clut->height, clut->psm, clut->height, clut->psm, texBuffers.clut->address,
texBuffers.clut->address, clutWidth)); texBuffers.clut->width));
} }
packet2_chain_open_cnt(texturePacket, 0, 0, 0); packet2_chain_open_cnt(texturePacket, 0, 0, 0);
@@ -58,7 +58,9 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureCore(
auto* result = new texbuffer_t; auto* result = new texbuffer_t;
const auto* core = t_texture->core; const auto* core = t_texture->core;
result->width = t_texture->getWidth(); int coreWidth = core->width <= 64 ? 64 : core->width;
result->width = coreWidth;
result->psm = core->psm; result->psm = core->psm;
result->info.components = core->components; result->info.components = core->components;
@@ -77,7 +79,9 @@ texbuffer_t* RendererCoreTextureSender::allocateTextureClut(
auto* result = new texbuffer_t; auto* result = new texbuffer_t;
const auto* clut = t_texture->clut; const auto* clut = t_texture->clut;
result->width = clut->width; int clutWidth = clut->width <= 64 ? 64 : clut->width;
result->width = clutWidth;
result->psm = clut->psm; result->psm = clut->psm;
result->info.components = clut->components; result->info.components = clut->components;
+2 -2
View File
@@ -18,7 +18,7 @@
{ {
"type": "shell", "type": "shell",
"label": "1. Copy source code to docker volume", "label": "1. Copy source code to docker volume",
"command": "docker exec -t tyra-game-compiler sh -c 'rsync -ac --delete --exclude \".git\" --exclude \".vscode\" --exclude \"*obj*/**\" --exclude \"*bin*/**\" /host/ /src/'" "command": "docker exec -t tyra-game-compiler sh -c 'rsync -ac --delete --exclude=\".git\" --exclude=\".vscode\" --exclude=\"*obj*/**\" --exclude=\"*bin*/**\" /host/ /src/'"
}, },
{ {
"type": "shell", "type": "shell",
@@ -34,7 +34,7 @@
{ {
"type": "shell", "type": "shell",
"label": "3. Copy binaries to host", "label": "3. Copy binaries to host",
"command": "docker exec -t tyra-game-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"*bin*/**\" --exclude=\"*\" /src/ /host/'", "command": "docker exec -t tyra-game-compiler sh -c 'rsync -zac --include=\"*/\" --include=\"*bin*/**\" --exclude=\"*\" /src/ /host/'"
}, },
{ {
"type": "shell", "type": "shell",