Added cluts to splashpack

This commit is contained in:
2025-03-23 13:08:38 +01:00
parent 3c6989c291
commit dbc4bcb068
4 changed files with 30 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
#include "splashpack.hh"
#include "gameobject.hh"
#include "mesh.hh"
#include "psyqo/primitives/common.hh"
#include "renderer.hh"
#include <cstdint>
#include <cstring>
#include <memory>
namespace psxsplash {
@@ -23,8 +25,28 @@ eastl::vector<psxsplash::GameObject *> LoadSplashpack(uint8_t *data) {
for (uint16_t i = 0; i < header->gameObjectCount; i++) {
psxsplash::GameObject *go =
reinterpret_cast<psxsplash::GameObject *>(curentPointer);
int16_t width = 0;
switch ((psyqo::Prim::TPageAttr::ColorMode)(
(std::bit_cast<short>(go->texture) & 0x0180) >> 7)) {
case psyqo::Prim::TPageAttr::ColorMode::Tex4Bits:
width = 16;
break;
case psyqo::Prim::TPageAttr::ColorMode::Tex8Bits:
width = 256;
break;
default:
width = -1;
}
if(width > 0) {
psxsplash::Renderer::getInstance().vramUpload(
go->clut, go->clutX*16, go->clutY, width, 1);
}
go->polygons =
reinterpret_cast<psxsplash::Tri *>(data + go->polygonsOffset);
gameObjects.push_back(go);
curentPointer += sizeof(psxsplash::GameObject);
}