mirror of
https://github.com/encounter/tp.git
synced 2026-07-11 06:18:46 -07:00
JKRAram and JKRAramStream (#80)
* before __register_global_object * JKRThread::sThreadList, JKRHeap::sSystemHeap, etc. * cleanup and started on JKRDvdArchive * before changing JKRCompression * more JKRDvdArchive, abs, and memset * fixed JKRArchive::setExpandSize split * JKRArchive::sCurrentDirID, JKRDvdFile::sDvdList, and matching JKRDvdFile constructors * problems * merge fixes and formatting * updated clang version in clang-format-all to version 10 * Added OSPhysicalToCached and struct for global memory * remove useless __attribute__ * changed from defines and macros to const variable and function * changed FLAG_HAS to FLAG_ON * JKRAram, linking problems * fix JKRAram * remove nonmatching stuff * renamed static data * more static class members * JKRAramStream OK * formatting Co-authored-by: Julgodis <> Co-authored-by: Pheenoh <pheenoh@gmail.com>
This commit is contained in:
co-authored by
Julgodis <>
Pheenoh
parent
8bd3d07e23
commit
82d5e0f796
@@ -146,15 +146,7 @@ void* JKRMemArchive::fetchResource(void* buffer, u32 bufferSize, SDIFileEntry* f
|
||||
if (fileEntry->data != NULL) {
|
||||
memcpy(buffer, fileEntry->data, srcLength);
|
||||
} else {
|
||||
JKRCompression compression;
|
||||
if (!fileEntry->isCompressed()) {
|
||||
compression = COMPRESSION_NONE;
|
||||
} else if (fileEntry->isYAZ0Compressed()) {
|
||||
compression = COMPRESSION_YAZ0;
|
||||
} else {
|
||||
compression = COMPRESSION_YAY0;
|
||||
}
|
||||
|
||||
JKRCompression compression = JKRConvertAttrToCompressionType(fileEntry->getAttr());
|
||||
void* data = mArchiveData + fileEntry->data_offset;
|
||||
srcLength =
|
||||
fetchResource_subroutine((u8*)data, srcLength, (u8*)buffer, bufferSize, compression);
|
||||
@@ -209,7 +201,7 @@ u32 JKRMemArchive::fetchResource_subroutine(u8* src, u32 srcLength, u8* dst, u32
|
||||
|
||||
case COMPRESSION_YAY0:
|
||||
case COMPRESSION_YAZ0:
|
||||
u32 expendedSize = JKRDecompExpandSize(src);
|
||||
u32 expendedSize = JKRDecompExpandSize((SArcHeader*)src);
|
||||
srcLength = expendedSize;
|
||||
if (expendedSize > dstLength) {
|
||||
srcLength = dstLength;
|
||||
@@ -229,14 +221,14 @@ u32 JKRMemArchive::fetchResource_subroutine(u8* src, u32 srcLength, u8* dst, u32
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 JKRMemArchive::getExpandedResSize(const void* resource) const {
|
||||
u32 JKRMemArchive::getExpandedResSize(const void* resource) {
|
||||
SDIFileEntry* fileEntry = findPtrResource(resource);
|
||||
if (fileEntry == NULL)
|
||||
return 0xFFFFFFFF;
|
||||
return -1;
|
||||
|
||||
if (fileEntry->isCompressed() == false) {
|
||||
return getResSize(resource);
|
||||
} else {
|
||||
return JKRDecompExpandSize(resource);
|
||||
return JKRDecompExpandSize((SArcHeader*)resource);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user