mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-07 10:11:43 -04:00
Mod SDK: Arc Overlays (#2280)
* Mod SDK: Arc Overlays * Use DVD Functions for Arc overlays * Re-add Fetchcontent for json.hpp * Fix build for actions * Make sure buffer usues aligned length * Add include so msvc compiles * Arc Overlays fixes: remove _arc suffix, handle getting overlayed file size from arcs, copy data correctly, etc. * Reload overlayed data during loading screens * Rename sync function * Free overlayed files on load instead of re-loading them * Rework arc overlays & load overlay files into host memory --------- Co-authored-by: Luke Street <luke@street.dev>
This commit is contained in:
@@ -246,6 +246,7 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u16 id) {
|
||||
|
||||
void JKRArchive::removeResourceAll() {
|
||||
if (mArcInfoBlock && mMountMode != MOUNT_MEM) {
|
||||
IF_DUSK(removeAllOverlayResources();)
|
||||
SDIFileEntry* fileEntry = mFiles;
|
||||
for (int i = 0; i < mArcInfoBlock->num_file_entries; i++) {
|
||||
if (JKAR_DATA(fileEntry)) {
|
||||
@@ -259,6 +260,13 @@ void JKRArchive::removeResourceAll() {
|
||||
|
||||
bool JKRArchive::removeResource(void* resource) {
|
||||
JUT_ASSERT(678, resource != NULL);
|
||||
|
||||
#if TARGET_PC
|
||||
if (removeOverlayResource(resource, true)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDIFileEntry* fileEntry = findPtrResource(resource);
|
||||
if (fileEntry == NULL)
|
||||
return false;
|
||||
@@ -270,6 +278,13 @@ bool JKRArchive::removeResource(void* resource) {
|
||||
|
||||
bool JKRArchive::detachResource(void* resource) {
|
||||
JUT_ASSERT(707, resource != NULL);
|
||||
|
||||
#if TARGET_PC
|
||||
if (removeOverlayResource(resource, false)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDIFileEntry* fileEntry = findPtrResource(resource);
|
||||
if (fileEntry == NULL)
|
||||
return false;
|
||||
@@ -280,6 +295,13 @@ bool JKRArchive::detachResource(void* resource) {
|
||||
|
||||
u32 JKRArchive::getResSize(const void* resource) const {
|
||||
JUT_ASSERT(732, resource != NULL);
|
||||
|
||||
#if TARGET_PC
|
||||
if (u32 size; getOverlayResourceSize(resource, &size)) {
|
||||
return size;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDIFileEntry* fileEntry = findPtrResource(resource);
|
||||
if (fileEntry == NULL)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user