Skip to content

Support Windows Retail 1.0 Game Data #16

@madebr

Description

@madebr

OniFoxed currently does not support the Windows full game game data because its game data uses the Oni 1.0 game format.
This repo is based on Oni 1.1, which was used for the Oni demo and Mac OS. (OniFoxed should currently already support the Mac gamedata)

Data structure differences to get the template extractor generate swapcodes equal to 1.0
--- a/BungieFrameWork/BFW_Headers/BFW_BinaryData.h
+++ b/BungieFrameWork/BFW_Headers/BFW_BinaryData.h
@@ -23,7 +23,7 @@ typedef tm_template('B', 'I', 'N', 'A', "Binary Data")
 BDtBinaryData
 {
 	UUtUns32				data_size;
-	tm_separate				data_index;
+	tm_separate				data;
 
 } BDtBinaryData;
 
--- a/BungieFrameWork/BFW_Headers/BFW_Motoko.h
+++ b/BungieFrameWork/BFW_Headers/BFW_Motoko.h
@@ -822,8 +822,9 @@ typedef struct M3tDrawContext_Counters
 		tm_raw(void *)			pixels;			// CB: if this is non-NULL then it is either 1) a special texture that is saved as raw data and
 												// not separate data during the importer (there are none of these textures at present)
 												// or 2) a texture that was created at runtime.
+		// pixelStorage is NOT present in Oni 1.0:
 
-		tm_separate				pixelStorage;	// CB: this is used as an index into the separate data file only if pixels is NULL which indicates
+		// tm_separate				pixelStorage;	// CB: this is used as an index into the separate data file only if pixels is NULL which indicates
 												// that we do not have any permanently-resident data for this texture
 
 		UUtUns32				materialType;
--- a/BungieFrameWork/BFW_Headers/BFW_SoundSystem2.h
+++ b/BungieFrameWork/BFW_Headers/BFW_SoundSystem2.h
@@ -170,9 +170,10 @@ SStSoundData
 {
 	UUtUns32				flags;
 
-	//SStFormat				f;
+
+	SStFormat				f;   			// USE in Oni 1.0
 	UUtUns16				duration_ticks;
-	UUtUns16				pad;
+	// UUtUns16				pad;            // REMOVE for Oni 1.0
 
 	UUtUns32				num_bytes;
 	tm_raw(void*)			data;
--- a/OniProj/OniGameSource/Oni_Sound2.h
+++ b/OniProj/OniGameSource/Oni_Sound2.h
@@ -49,7 +49,7 @@ typedef tm_template('O', 'S', 'B', 'D', "Oni Sound Binary Data")
 OStBinaryData
 {
 	UUtUns32				data_size;
-	tm_separate				data_index;
+	tm_separate				data;
 
 } OStBinaryData;
 
--- a/OniProj/OniWin32Projs/ImpConsole/templatechecksum.c
+++ b/OniProj/OniWin32Projs/ImpConsole/templatechecksum.c
@@ -1,7 +1,7 @@
 #include "BFW.h"
 #include "BFW_TemplateManager.h"
 #include "BFW_TM_Private.h"
-UUtUns64 TMgTemplateChecksum = 1052091493724257;
+UUtUns64 TMgTemplateChecksum = 1052091490308481;
 UUtUns32 TMgNumTemplateDefinitions = 114;
 TMtTemplateDefinition* TMgTemplateDefinitionArray = NULL;
 static UUtUns8 gSwapCodes_AISA[74] =
@@ -612,9 +612,11 @@ static UUtUns8 gSwapCodes_PSUI[223] =
 	0x63, 0x70, 0x53, 0x50, 0x09, 0x63, 0x70, 0x53,
 	0x50, 0x09, 0x63, 0x70, 0x53, 0x50, 0x06
 };
-static UUtUns8 gSwapCodes_SNDD[8] =
+static UUtUns8 gSwapCodes_SNDD[21] =
 {
-	0x02, 0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x06
+	0x02, 0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x03,
+	0x03, 0x03, 0x03, 0x03, 0x05, 0x07, 0x03, 0x03,
+	0x06, 0x03, 0x02, 0x02, 0x06
 };
 static UUtUns8 gSwapCodes_SUBT[12] =
 {
@@ -1053,7 +1055,7 @@ static TMtTemplateDefinition TMgTemplateDefinitionArray_Mem[114] =
 	},
 	// #19
 	{
-		89617,
+		56129,
 		0x42494e41,
 		"Binary Data",
 		NULL,
@@ -1859,7 +1861,7 @@ static TMtTemplateDefinition TMgTemplateDefinitionArray_Mem[114] =
 	},
 	// #81
 	{
-		89660,
+		56172,
 		0x4f534244,
 		"Oni Sound Binary Data",
 		NULL,
@@ -1911,12 +1913,12 @@ static TMtTemplateDefinition TMgTemplateDefinitionArray_Mem[114] =
 	},
 	// #85
 	{
-		266731,
+		3605880,
 		0x534e4444,
 		"Sound Data",
 		NULL,
 		(TMtTemplateFlags)0x6,
-		0x18,
+		0x48,
 		0x0,
 		NULL,
 		0x4d41474b,

templatechecksums.c generated with these changes is identical to the values used in the Windows retail executable.
However, OniFoxed does NOT build with the patch above: you have to build the OniFoxed main branch executables,
then apply the patch and then manually run the extractor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions