Merge pull request #71 from igor725/features

Fix libScePngDec implementation
This commit is contained in:
SysRay 2024-04-09 19:32:59 +02:00 committed by GitHub
commit 0d2d0b72c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 2 deletions

View File

@ -9,4 +9,4 @@ add_library(${libName} SHARED entry.cpp mspace.cpp)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
setupModule(${libName})
setupModule(${libName})

View File

@ -1,6 +1,7 @@
#define _CRT_SECURE_NO_WARNINGS
#include "common.h"
#include "core/imports/imports_runtime.h"
#include "core/unwinding/unwind.h"
#include "logging.h"
#include "types.h"
@ -99,6 +100,10 @@ EXPORT SYSV_ABI float __NID(expf)(float val) {
return std::expf(val);
}
EXPORT SYSV_ABI int __NID(setjmp)(unwinding_jmp_buf* jb) {
return 0;
}
EXPORT SYSV_ABI int __NID(__cxa_guard_acquire)(uint64_t* guard_object) {
LOG_USE_MODULE(libSceLibcInternal);
LOG_ERR(L"todo %S", __FUNCTION__);

View File

@ -89,6 +89,7 @@ EXPORT SYSV_ABI int32_t scePngDecDecode(ScePngDecHandle handle, const ScePngDecD
ii->bitDepth = bi;
ii->imageWidth = w;
ii->imageHeight = h;
ii->imageFlag = 0;
ii->colorSpace = map_png_color(ct);
if (in == 1) ii->imageFlag |= SCE_PNG_DEC_IMAGE_FLAG_ADAM7_INTERLACE;
if (png_get_valid(pngh->png, pngh->info, PNG_INFO_tRNS)) ii->imageFlag |= SCE_PNG_DEC_IMAGE_FLAG_TRNS_CHUNK_EXIST;
@ -162,9 +163,11 @@ EXPORT SYSV_ABI int32_t scePngDecParseHeader(const ScePngDecParseParam* param, S
png_read_info(png_ptr, info_ptr);
int bitdepth, color, filter, inter, num_trans;
int bitdepth, color, filter, inter;
png_get_IHDR(png_ptr, info_ptr, &ii->imageWidth, &ii->imageHeight, &bitdepth, &color, &inter, nullptr, &filter);
ii->imageFlag = 0;
ii->bitDepth = bitdepth;
ii->colorSpace = map_png_color(color);
if (inter == 1) ii->imageFlag |= SCE_PNG_DEC_IMAGE_FLAG_ADAM7_INTERLACE;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) ii->imageFlag |= SCE_PNG_DEC_IMAGE_FLAG_TRNS_CHUNK_EXIST;