mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-18 00:00:35 -05:00
fix: properly display static background scenes (#2669)
This commit is contained in:
parent
ff1d8a9e9d
commit
44906598e4
@ -1056,6 +1056,11 @@ extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) {
|
||||||
|
auto res = GetResourceByNameHandlingMQ(texPath);
|
||||||
|
return res->InitData->Type == Ship::ResourceType::SOH_Background;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" char* ResourceMgr_LoadJPEG(char* data, int dataSize)
|
extern "C" char* ResourceMgr_LoadJPEG(char* data, int dataSize)
|
||||||
{
|
{
|
||||||
static char* finalBuffer = 0;
|
static char* finalBuffer = 0;
|
||||||
|
@ -63,6 +63,7 @@ char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
|
|||||||
char* GetResourceDataByNameHandlingMQ(const char* path);
|
char* GetResourceDataByNameHandlingMQ(const char* path);
|
||||||
void ResourceMgr_LoadFile(const char* resName);
|
void ResourceMgr_LoadFile(const char* resName);
|
||||||
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
||||||
|
uint8_t ResourceMgr_ResourceIsBackground(char* texPath);
|
||||||
char* ResourceMgr_LoadJPEG(char* data, int dataSize);
|
char* ResourceMgr_LoadJPEG(char* data, int dataSize);
|
||||||
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
||||||
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
||||||
|
@ -220,7 +220,7 @@ void func_80095D04(PlayState* play, Room* room, u32 flags) {
|
|||||||
|
|
||||||
#define JPEG_MARKER 0xFFD8FFE0
|
#define JPEG_MARKER 0xFFD8FFE0
|
||||||
|
|
||||||
s32 func_80096238(void* data) {
|
s32 swapAndConvertJPEG(void* data) {
|
||||||
OSTime time;
|
OSTime time;
|
||||||
|
|
||||||
if (BE32SWAP(*(u32*)data) == JPEG_MARKER)
|
if (BE32SWAP(*(u32*)data) == JPEG_MARKER)
|
||||||
@ -265,7 +265,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h
|
|||||||
s32 temp;
|
s32 temp;
|
||||||
|
|
||||||
displayListHead = *displayList;
|
displayListHead = *displayList;
|
||||||
func_80096238(SEGMENTED_TO_VIRTUAL(source));
|
swapAndConvertJPEG(SEGMENTED_TO_VIRTUAL(source));
|
||||||
|
|
||||||
bg = (uObjBg*)(displayListHead + 1);
|
bg = (uObjBg*)(displayListHead + 1);
|
||||||
gSPBranchList(displayListHead, (u8*)bg + sizeof(uObjBg));
|
gSPBranchList(displayListHead, (u8*)bg + sizeof(uObjBg));
|
||||||
@ -282,6 +282,12 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h
|
|||||||
bg->b.imagePal = 0;
|
bg->b.imagePal = 0;
|
||||||
bg->b.imageFlip = 0;
|
bg->b.imageFlip = 0;
|
||||||
|
|
||||||
|
if (ResourceMgr_ResourceIsBackground((char*) source)) {
|
||||||
|
char* blob = (char*) GetResourceDataByName((char*) source, true);
|
||||||
|
swapAndConvertJPEG(blob);
|
||||||
|
bg->b.imagePtr = (uintptr_t) blob;
|
||||||
|
}
|
||||||
|
|
||||||
displayListHead = (void*)(bg + 1);
|
displayListHead = (void*)(bg + 1);
|
||||||
if (fmt == G_IM_FMT_CI) {
|
if (fmt == G_IM_FMT_CI) {
|
||||||
gDPLoadTLUT(displayListHead++, tlutCount, 256, tlut);
|
gDPLoadTLUT(displayListHead++, tlutCount, 256, tlut);
|
||||||
|
Loading…
Reference in New Issue
Block a user