OS threading, DVD I/O, Endianness fixes, ARAM emulation, GX vertex fix

Major changes:

- Implement Big-Endian to Little-Endian byte-swapping for all RARC archive
  types (JKRCompArchive, JKRMemArchive, JKRDvdArchive, JKRAramArchive)
- Implement DVD file I/O via DvdEmu (DVDOpen, DVDFastOpen, DVDReadPrio,
  DVDReadAsyncPrio, DVDConvertPathToEntrynum)
- Fix YAZ0 decompression endianness in JKRDvdRipper, JKRDecomp, JKRAram,
  and JKRDvdAramRipper (use JKRDecompExpandSize instead of direct header read)
- Emulate ARAM with 16MB malloc buffer and synchronous memcpy in ARQPostRequest
  instead of hardware DMA transfers that hang on PC
- Add real OS threading implementation (OSContext, OSThread, OSMutex) using
  native Windows threads with side-table pattern for GC struct compatibility
- Fix font endianness for JUTResFont and JUTCacheFont
- Redirect GXVert.h to Aurora's PC implementation to prevent FIFO writes to
  the GameCube hardware address 0xCC008000
- Add Z-buffer texture format support (GX_TF_Z24X8, GX_TF_Z16, GX_TF_Z8)
  in Aurora's texture converter
This commit is contained in:
Lurs
2026-02-19 10:35:42 +01:00
parent c86a2208d2
commit a4d72437ef
17 changed files with 1509 additions and 399 deletions
+71 -2
View File
@@ -1,4 +1,4 @@
#ifndef JKRARCHIVE_H
#ifndef JKRARCHIVE_H -j n
#define JKRARCHIVE_H
#include "JSystem/JKernel/JKRCompression.h"
@@ -7,7 +7,7 @@
class JKRHeap;
/**
/** m
* @ingroup jsystem-jkernel
*
*/
@@ -220,6 +220,75 @@ protected:
static u32 sCurrentDirID;
};
#ifdef TARGET_PC
#include "dusk/endian.h"
// Byte-swap archive header from Big-Endian to host after loading from disk
inline void JKRSwapArcHeader(SArcHeader* h) {
h->signature = be32(h->signature);
h->file_length = be32(h->file_length);
h->header_length = be32(h->header_length);
h->file_data_offset = be32(h->file_data_offset);
h->file_data_length = be32(h->file_data_length);
h->field_0x14 = be32(h->field_0x14);
h->field_0x18 = be32(h->field_0x18);
h->field_0x1c = be32(h->field_0x1c);
}
// Byte-swap archive data info block from Big-Endian to host
inline void JKRSwapArcDataInfo(SArcDataInfo* info) {
info->num_nodes = be32(info->num_nodes);
info->node_offset = be32(info->node_offset);
info->num_file_entries = be32(info->num_file_entries);
info->file_entry_offset = be32(info->file_entry_offset);
info->string_table_length = be32(info->string_table_length);
info->string_table_offset = be32(info->string_table_offset);
info->next_free_file_id = be16(info->next_free_file_id);
}
// Byte-swap all directory entries
inline void JKRSwapDirEntries(JKRArchive::SDIDirEntry* nodes, u32 count) {
for (u32 i = 0; i < count; i++) {
nodes[i].type = be32(nodes[i].type);
nodes[i].name_offset = be32(nodes[i].name_offset);
nodes[i].field_0x8 = be16(nodes[i].field_0x8);
nodes[i].num_entries = be16(nodes[i].num_entries);
nodes[i].first_file_index = be32(nodes[i].first_file_index);
}
}
// Byte-swap all file entries
inline void JKRSwapFileEntries(JKRArchive::SDIFileEntry* files, u32 count) {
for (u32 i = 0; i < count; i++) {
files[i].file_id = be16(files[i].file_id);
files[i].name_hash = be16(files[i].name_hash);
files[i].type_flags_and_name_offset = be32(files[i].type_flags_and_name_offset);
files[i].data_offset = be32(files[i].data_offset);
files[i].data_size = be32(files[i].data_size);
// data pointer is runtime-only, no swap needed
}
}
// Swap all archive structures after loading from disk
inline void JKRSwapArchiveMemory(SArcDataInfo* arcInfo) {
// First swap the info block itself to read offsets
JKRSwapArcDataInfo(arcInfo);
// Then swap directory and file entries using the now-native offsets
JKRArchive::SDIDirEntry* nodes = (JKRArchive::SDIDirEntry*)((u8*)arcInfo + arcInfo->node_offset);
JKRArchive::SDIFileEntry* files = (JKRArchive::SDIFileEntry*)((u8*)arcInfo + arcInfo->file_entry_offset);
JKRSwapDirEntries(nodes, arcInfo->num_nodes);
JKRSwapFileEntries(files, arcInfo->num_file_entries);
}
#else
inline void JKRSwapArcHeader(SArcHeader*) {}
inline void JKRSwapArcDataInfo(SArcDataInfo*) {}
inline void JKRSwapDirEntries(JKRArchive::SDIDirEntry*, u32) {}
inline void JKRSwapFileEntries(JKRArchive::SDIFileEntry*, u32) {}
inline void JKRSwapArchiveMemory(SArcDataInfo*) {}
#endif
inline JKRCompression JKRConvertAttrToCompressionType(int attr) {
return JKRArchive::convertAttrToCompressionType(attr);
}