If needed I can add CRC correction option to my script shouldn't be to difficult05SpeedMaster wrote: ↑Mon May 03, 2021 2:32 pmI have a Script for 010 that will check AND correct the CRC.
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
Granny .GR2 Reader plugin for Noesis
-
- mega-veteran
- Posts: 250
- Joined: Sun Jul 17, 2011 9:30 pm
- Has thanked: 61 times
- Been thanked: 241 times
Re: Granny .GR2 Reader plugin for Noesis
-
- beginner
- Posts: 27
- Joined: Sun Dec 16, 2018 3:58 am
- Has thanked: 24 times
- Been thanked: 1 time
Re: Granny .GR2 Reader plugin for Noesis
05SpeedMaster wrote: ↑Mon May 03, 2021 2:32 pmI have a Script for 010 that will check AND correct the CRC.
Is it possible for you to share your script?
Or could you tell me where is CRC information in GR2 and from where to where the CRC will check, so I can caculate by myself?
BTW I think GR2 use CRC-32, right?
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
Re: Granny .GR2 Reader plugin for Noesis
Skip the first 104 bytes and do a CRC-32
The CRC is at 28h
And older version of AOE3 started the CRC count by skipping the first 88 bytes.
The CRC is at 28h
And older version of AOE3 started the CRC count by skipping the first 88 bytes.
Last edited by 05SpeedMaster on Mon May 03, 2021 3:01 pm, edited 1 time in total.
Re: Granny .GR2 Reader plugin for Noesis
Still no luck, with granny2.dll only in plugins folder Noesis doesn't see gr2 files as known format. Here is two versions of the same model for reference - original and converted v2.11.8 gr2:Ivenend wrote: ↑Mon May 03, 2021 2:18 pmYou probably just need a v2.11.8 granny2.dll.timtim wrote: ↑Mon May 03, 2021 2:11 pm I tried to view|convert GR2 Age of Empires 3 - Definitive Edition files in Noesis 4.442 both with both Reader plugin ver. 1.2.1 and ver. 1.3 but it wasn't successful.
I tried different ways: before and after https://github.com/nikita322/GrannyConverter2.11.8, without/with additional copying granny2.lib from nikita322 converter but it always ends with this error:
With this version of granny2.DLL in your Noesis folder, you can open GR2 from Age of Empires 3 - Definitive Edition directly.
https://drive.google.com/drive/folders/ ... sp=sharing
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
Re: Granny .GR2 Reader plugin for Noesis
Both open for me.
granny2.dll needs to be in the noesis folder with Noesis.exe
NOT in the plug ins folder
granny2.dll needs to be in the noesis folder with Noesis.exe
NOT in the plug ins folder
-
- beginner
- Posts: 27
- Joined: Sun Dec 16, 2018 3:58 am
- Has thanked: 24 times
- Been thanked: 1 time
Re: Granny .GR2 Reader plugin for Noesis
Thanks.
I'm a noob, so sorry for further questions:
With your help, I sucessfully find out the CRC of great_sword_lod0.model (file included in my previous examples.rar). It is the 34 12 D1 B1, that's exactly the CRC shows up on Granny Viewer.
Does "Skip the first 104 bytes" means select start form byte 105[69h] and to the end of the file?
I did an CRC 32(both big Edian and little edian) in 010 Editor and the result is this, which doesn't match the 34 12 D1 B1. What did I do wrong?
Last edited by Ivenend on Mon May 03, 2021 3:30 pm, edited 1 time in total.
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
Re: Granny .GR2 Reader plugin for Noesis
Ivenend,
Your example files are compressed so hex editing is not going to work.
Your example files are compressed so hex editing is not going to work.
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
Re: Granny .GR2 Reader plugin for Noesis
//-----------------------------------
// v3.2.2 Script File
//
// File: GR2Checksum.1sc
// Revision: 2.0
// Purpose: Opens a GR2, performs the CRC32 checksum, and then closes the file.
//----------------------------------------------------------------------------------
TOpenFileNames f = InputOpenFileNames("Open File", "GR2 Files ( *.gr2 )|All Files ( *.* )");
if (f.count == 0) return;
int i, n;
n = FileCount();
for(i = 0; i < f.count; i++)
{
FileOpen(f.file.filename);
//Can lock to only certian GR2 files these being SH5
//if (ReadQuad(00h) != 3122020088697118249 || ReadQuad(08h) != -1233310138417810139) {
//if (ReadQuad(00h) != 1130805896766580664 || ReadQuad(08h) != 2161755714778591876) {
//MessageBox(idOk, "Error", "File is not GR2 or corrupted!");
//return;
//};
//};
if (ReadInt(20h) < 7) { MessageBox(idOk, "Error", "Old version of file!");
return;
};
};
if (!IsLittleEndian()) LittleEndian();
int32 existCRC[f.count], calcCRC[f.count], editCRC[f.count];
OutputPaneClear();
for (i = 0; i < f.count; i++)
{
FileSelect(i + n);
existCRC = ReadInt(28h);
calcCRC = Checksum(CHECKSUM_CRC32, 68h, (FileSize() - 104));
Printf(f.file.filename + ": Existing CRC - %x\n", existCRC);
Printf(f.file.filename + ": Calculated CRC - %x\n", calcCRC);
if (existCRC != calcCRC) {
if (MessageBox(idYes|idNo, "Attention", f.file.filename + "\n\nThe existing CRC is not \nequal to the calculated CRC !\nWould you like to edit ?") == idYes)
{
WriteInt(28h, calcCRC[i]);
FileSave();
editCRC[i] = ReadInt(28h);
Printf(f.file[i].filename + ": Edited CRC - %x\n", editCRC[i]);
};
};
};
if (MessageBox(idYes|idNo, "Attention", "Would you like to close files ?") == idYes)
{
for(i = 0; i < f.count; i++) {
FileSelect(i + n);
FileClose();
};
};
return;
// v3.2.2 Script File
//
// File: GR2Checksum.1sc
// Revision: 2.0
// Purpose: Opens a GR2, performs the CRC32 checksum, and then closes the file.
//----------------------------------------------------------------------------------
TOpenFileNames f = InputOpenFileNames("Open File", "GR2 Files ( *.gr2 )|All Files ( *.* )");
if (f.count == 0) return;
int i, n;
n = FileCount();
for(i = 0; i < f.count; i++)
{
FileOpen(f.file.filename);
//Can lock to only certian GR2 files these being SH5
//if (ReadQuad(00h) != 3122020088697118249 || ReadQuad(08h) != -1233310138417810139) {
//if (ReadQuad(00h) != 1130805896766580664 || ReadQuad(08h) != 2161755714778591876) {
//MessageBox(idOk, "Error", "File is not GR2 or corrupted!");
//return;
//};
//};
if (ReadInt(20h) < 7) { MessageBox(idOk, "Error", "Old version of file!");
return;
};
};
if (!IsLittleEndian()) LittleEndian();
int32 existCRC[f.count], calcCRC[f.count], editCRC[f.count];
OutputPaneClear();
for (i = 0; i < f.count; i++)
{
FileSelect(i + n);
existCRC = ReadInt(28h);
calcCRC = Checksum(CHECKSUM_CRC32, 68h, (FileSize() - 104));
Printf(f.file.filename + ": Existing CRC - %x\n", existCRC);
Printf(f.file.filename + ": Calculated CRC - %x\n", calcCRC);
if (existCRC != calcCRC) {
if (MessageBox(idYes|idNo, "Attention", f.file.filename + "\n\nThe existing CRC is not \nequal to the calculated CRC !\nWould you like to edit ?") == idYes)
{
WriteInt(28h, calcCRC[i]);
FileSave();
editCRC[i] = ReadInt(28h);
Printf(f.file[i].filename + ": Edited CRC - %x\n", editCRC[i]);
};
};
};
if (MessageBox(idYes|idNo, "Attention", "Would you like to close files ?") == idYes)
{
for(i = 0; i < f.count; i++) {
FileSelect(i + n);
FileClose();
};
};
return;
-
- beginner
- Posts: 27
- Joined: Sun Dec 16, 2018 3:58 am
- Has thanked: 24 times
- Been thanked: 1 time
Re: Granny .GR2 Reader plugin for Noesis
That's sad.05SpeedMaster wrote: ↑Mon May 03, 2021 3:30 pm Ivenend,
Your example files are compressed so hex editing is not going to work.
Thank you anyway! Learned a lot from you about how CRC work in GR2.
Is it possible to decompress a BitKnit 2 compressed GR2?
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
Re: Granny .GR2 Reader plugin for Noesis
//-----------------------------------
//--- 010 Editor v3.2.2 Binary Template
//
// File: GR2Template.bt
// Author: Privateer / TheDarkWraith
// Special Thanks to: Anvart
// Revision: 1
// Purpose: Defines a template for understanding GR2 files.
//
// Structues built from info obtained from Granny Viewer 2.8.33.0
// and the Granny Change log.
//-----------------------------------
#include "Header.h"
//---------------------------------------------
// Define the headers
LittleEndian();
SetBackColor( cLtRed );
GR2FILEHEADER GR2fh<hidden=false>;
SetBackColor( cBlue );
GR2INFOHEADER GR2_Info;
SetBackColor( cLtBlue );
// Display The Sections Information
SetBackColor( cRed );
SECTIONS SectionInfo[8];
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Header.h
// Define structures for Magic Block, header and Section Indexes in Gr2 files
typedef struct { // GR2fh
quad GR2Magic[2]<hidden=true>;
UINT HeaderSize<comment="Size of all information before the start of Section 0">;
LONG Unknown_info[3]<hidden=true,format=hex>;
} GR2FILEHEADER;
typedef struct { // GR2ih
UINT File_format_revision <format=decimal>;
UINT File_Size_in_bytes;
UINT CRC <format=hex,comment="CRC of file (from begin of section array up to EoF). Algoritm CRC-32">;
UINT SectionArrayOffset <bgcolor=0xffffb0,fgcolor=cRed,comment="Offset to section array">;
UINT SectionArrayCount <comment="Total number of sections">;
UINT Unknowns[4]<hidden=true,format=hex>;
UINT Tag<format=hex>;
UINT Unknown[8]<hidden=true,format=hex>;
} GR2INFOHEADER;
typedef struct { // Sectionsinfo
UINT Format<comment="Compression Format">;
UINT Pointer<format=hex,bgcolor=cLtGreen,comment="Start of section data">;
UINT True_Block_Size_in_file<comment="Compressed Data size">;
UINT Block_Size_In_file<comment="Actual amount of Data uncompressed">;
UINT Internal_Alignment<comment="offset">;
UINT Unknown[2]<bgcolor=cLtYellow,hidden=true>;
UINT Another_Pointer<format=hex,bgcolor=cLtGreen,comment="Will explain at a later date">;
UINT WTH[3]<bgcolor=cLtYellow,hidden=true>;
} SECTIONS;
/*Sections as used in SH5 GR2 files.
NOt all GR2 files follow this layout.
0 - MainSection
1 - RigidVertexSection
2 - RigidIndexSection
3 - DeformableVertexSection
4 - DeformableIndexSection
5 - TextureSection
6 - DiscardableSection
7 - UnloadedSection */
//--- 010 Editor v3.2.2 Binary Template
//
// File: GR2Template.bt
// Author: Privateer / TheDarkWraith
// Special Thanks to: Anvart
// Revision: 1
// Purpose: Defines a template for understanding GR2 files.
//
// Structues built from info obtained from Granny Viewer 2.8.33.0
// and the Granny Change log.
//-----------------------------------
#include "Header.h"
//---------------------------------------------
// Define the headers
LittleEndian();
SetBackColor( cLtRed );
GR2FILEHEADER GR2fh<hidden=false>;
SetBackColor( cBlue );
GR2INFOHEADER GR2_Info;
SetBackColor( cLtBlue );
// Display The Sections Information
SetBackColor( cRed );
SECTIONS SectionInfo[8];
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Header.h
// Define structures for Magic Block, header and Section Indexes in Gr2 files
typedef struct { // GR2fh
quad GR2Magic[2]<hidden=true>;
UINT HeaderSize<comment="Size of all information before the start of Section 0">;
LONG Unknown_info[3]<hidden=true,format=hex>;
} GR2FILEHEADER;
typedef struct { // GR2ih
UINT File_format_revision <format=decimal>;
UINT File_Size_in_bytes;
UINT CRC <format=hex,comment="CRC of file (from begin of section array up to EoF). Algoritm CRC-32">;
UINT SectionArrayOffset <bgcolor=0xffffb0,fgcolor=cRed,comment="Offset to section array">;
UINT SectionArrayCount <comment="Total number of sections">;
UINT Unknowns[4]<hidden=true,format=hex>;
UINT Tag<format=hex>;
UINT Unknown[8]<hidden=true,format=hex>;
} GR2INFOHEADER;
typedef struct { // Sectionsinfo
UINT Format<comment="Compression Format">;
UINT Pointer<format=hex,bgcolor=cLtGreen,comment="Start of section data">;
UINT True_Block_Size_in_file<comment="Compressed Data size">;
UINT Block_Size_In_file<comment="Actual amount of Data uncompressed">;
UINT Internal_Alignment<comment="offset">;
UINT Unknown[2]<bgcolor=cLtYellow,hidden=true>;
UINT Another_Pointer<format=hex,bgcolor=cLtGreen,comment="Will explain at a later date">;
UINT WTH[3]<bgcolor=cLtYellow,hidden=true>;
} SECTIONS;
/*Sections as used in SH5 GR2 files.
NOt all GR2 files follow this layout.
0 - MainSection
1 - RigidVertexSection
2 - RigidIndexSection
3 - DeformableVertexSection
4 - DeformableIndexSection
5 - TextureSection
6 - DiscardableSection
7 - UnloadedSection */
-
- beginner
- Posts: 27
- Joined: Sun Dec 16, 2018 3:58 am
- Has thanked: 24 times
- Been thanked: 1 time
Re: Granny .GR2 Reader plugin for Noesis
I managed to decompressed the two example files05SpeedMaster wrote: ↑Mon May 03, 2021 3:30 pm Ivenend,
Your example files are compressed so hex editing is not going to work.
https://drive.google.com/file/d/1HSnr67 ... sp=sharing
Could you or Jayn please check these files and see if you can find the opacity enable value?
- 05SpeedMaster
- veteran
- Posts: 127
- Joined: Mon Feb 10, 2020 9:24 pm
- Has thanked: 18 times
- Been thanked: 41 times
Re: Granny .GR2 Reader plugin for Noesis
I need a better explanation of where you are finding the values in GrannyViewer.
The complete path to follow.
The complete path to follow.
-
- beginner
- Posts: 27
- Joined: Sun Dec 16, 2018 3:58 am
- Has thanked: 24 times
- Been thanked: 1 time
Re: Granny .GR2 Reader plugin for Noesis
Material List - the last one in the list of material - right click - view in detail - ExtendedData05SpeedMaster wrote: ↑Mon May 03, 2021 6:07 pm I need a better explanation of where you are finding the values in GrannyViewer.
The complete path to follow.
-
- mega-veteran
- Posts: 250
- Joined: Sun Jul 17, 2011 9:30 pm
- Has thanked: 61 times
- Been thanked: 241 times
Re: Granny .GR2 Reader plugin for Noesis
Well i got it working, had to do some reasrch, at least i finally know what MipMpas are now
Let me know if exported textures are read correctly by game engine.
Before exporting image you must specify what format you want, can be done in 2 ways:
by invoking option in advanced option, or by editing script end choosing a TEX_TYPE.
Normal maps have red and green channels swapped in game, if you need to sawp channels you can invoke swizzle command.
Available Commands:
-DXT1
-DXT5
-BC4
-RGBA32
-SWIZZLE
Script now supports import/export for .texture
new version in a later post
Last edited by jayn23 on Wed May 05, 2021 4:54 am, edited 2 times in total.