mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Initial AimR mod extractor.
This commit is contained in:
parent
3d894efc5e
commit
8933e1203e
8 changed files with 84 additions and 52 deletions
|
|
@ -57,6 +57,7 @@ if (DEFINED FBX_SDK_ROOT)
|
|||
common
|
||||
model
|
||||
#pvt.cppan.demo.eigen
|
||||
pvt.cppan.demo.taywee.args
|
||||
debug "${FBX_SDK_ROOT}/lib/vs2015/x86/debug/libfbxsdk-md.lib"
|
||||
optimized "${FBX_SDK_ROOT}/lib/vs2015/x86/release/libfbxsdk-md.lib"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -26,18 +26,22 @@
|
|||
enum class GameType
|
||||
{
|
||||
Aim1,
|
||||
Aim2
|
||||
Aim2,
|
||||
AimR,
|
||||
};
|
||||
|
||||
inline GameType gameType = GameType::Aim2;
|
||||
|
||||
template <typename T>
|
||||
struct vector3
|
||||
{
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
float z = 0;
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
};
|
||||
|
||||
using vector3f = vector3<float>;
|
||||
|
||||
struct vector4
|
||||
{
|
||||
float x = 0;
|
||||
|
|
@ -65,7 +69,7 @@ struct weather
|
|||
{
|
||||
struct atmospheric_effects
|
||||
{
|
||||
vector3 wind;
|
||||
vector3f wind;
|
||||
WeatherType weatherType;
|
||||
float strength;
|
||||
float duration;
|
||||
|
|
@ -83,8 +87,8 @@ struct weather
|
|||
std::string cloud_layer2;
|
||||
float cloud_layer1_speed;
|
||||
float cloud_layer2_speed;
|
||||
vector3 cloud_layer1_direction;
|
||||
vector3 cloud_layer2_direction;
|
||||
vector3f cloud_layer1_direction;
|
||||
vector3f cloud_layer2_direction;
|
||||
std::string sun;
|
||||
color general_color;
|
||||
color sun_color;
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ struct segment
|
|||
|
||||
struct description
|
||||
{
|
||||
vector3 min;
|
||||
vector3 max;
|
||||
vector3f min;
|
||||
vector3f max;
|
||||
float unk0[5];
|
||||
uint32_t unk1[7];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ bool CreateScene(model &model, const std::string &name, FbxManager* pSdkManager,
|
|||
|
||||
// Set texture properties.
|
||||
lTexture = FbxFileTexture::Create(pScene, "Diffuse Texture");
|
||||
lTexture->SetFileName((b.h.tex_mask + texture_extension).c_str()); // Resource file is in current directory.
|
||||
lTexture->SetFileName((b.h.mask.name + texture_extension).c_str()); // Resource file is in current directory.
|
||||
lTexture->SetTextureUse(FbxTexture::eStandard);
|
||||
lTexture->SetMappingType(FbxTexture::eUV);
|
||||
lTexture->SetMaterialUse(FbxFileTexture::eModelMaterial);
|
||||
|
|
@ -417,7 +417,7 @@ bool CreateScene(model &model, const std::string &name, FbxManager* pSdkManager,
|
|||
|
||||
// Set texture properties.
|
||||
lTexture = FbxFileTexture::Create(pScene, "Ambient Texture");
|
||||
lTexture->SetFileName((b.h.tex_mask + texture_extension).c_str()); // Resource file is in current directory.
|
||||
lTexture->SetFileName((b.h.mask.name + texture_extension).c_str()); // Resource file is in current directory.
|
||||
lTexture->SetTextureUse(FbxTexture::eStandard);
|
||||
lTexture->SetMappingType(FbxTexture::eUV);
|
||||
lTexture->SetMaterialUse(FbxFileTexture::eModelMaterial);
|
||||
|
|
@ -427,7 +427,7 @@ bool CreateScene(model &model, const std::string &name, FbxManager* pSdkManager,
|
|||
|
||||
// Set texture properties.
|
||||
lTexture = FbxFileTexture::Create(pScene, "Specular Texture");
|
||||
lTexture->SetFileName((b.h.tex_spec + texture_extension).c_str()); // Resource file is in current directory.
|
||||
lTexture->SetFileName((b.h.spec.name + texture_extension).c_str()); // Resource file is in current directory.
|
||||
lTexture->SetTextureUse(FbxTexture::eStandard);
|
||||
lTexture->SetMappingType(FbxTexture::eUV);
|
||||
lTexture->SetMaterialUse(FbxFileTexture::eModelMaterial);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <buffer.h>
|
||||
#include "fbx.h"
|
||||
#include "model.h"
|
||||
|
||||
#include <primitives/filesystem.h>
|
||||
#include <args.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
|
@ -24,12 +31,6 @@
|
|||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#include <buffer.h>
|
||||
#include "model.h"
|
||||
#include "fbx.h"
|
||||
|
||||
#include <primitives/filesystem.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// options
|
||||
|
|
@ -61,11 +62,18 @@ void convert_model(const path &fn)
|
|||
int main(int argc, char *argv[])
|
||||
try
|
||||
{
|
||||
if (argc < 2 || !parse_cmd(argc, argv))
|
||||
{
|
||||
printf("Usage: %s [OPTIONS] {model_file,model_dir}\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
args::ArgumentParser parser("mmo extractor");
|
||||
args::HelpFlag help(parser, "help", "Display this help menu", { 'h', "help" });
|
||||
args::Flag mr(parser, "mr", "AIM Racing MOD file", { "mr" });
|
||||
args::Positional<std::string> file_path(parser, "file or directory", "MOD_ file or directory with MOD_ files");
|
||||
parser.Prog(argv[0]);
|
||||
|
||||
parser.ParseCLI(argc, argv);
|
||||
|
||||
if (mr)
|
||||
gameType = GameType::AimR;
|
||||
|
||||
p = file_path.Get();
|
||||
if (fs::is_regular_file(p))
|
||||
convert_model(p);
|
||||
else if (fs::is_directory(p))
|
||||
|
|
|
|||
|
|
@ -259,14 +259,14 @@ std::string block::printMtl() const
|
|||
// d 1.0
|
||||
// illum
|
||||
s += "\n";
|
||||
if (h.tex_mask != "_DEFAULT_")
|
||||
s += "map_Ka " + h.tex_mask + texture_extension + "\n";
|
||||
if (h.tex_mask != "_DEFAULT_")
|
||||
s += "map_Kd " + h.tex_mask + texture_extension + "\n";
|
||||
if (h.tex_spec != "_DEFAULT_")
|
||||
s += "map_Ks " + h.tex_spec + texture_extension + "\n";
|
||||
if (h.tex_spec != "_DEFAULT_")
|
||||
s += "map_Ns " + h.tex_spec + texture_extension + "\n";
|
||||
if (h.mask.name != "_DEFAULT_")
|
||||
s += "map_Ka " + h.mask.name + texture_extension + "\n";
|
||||
if (h.mask.name != "_DEFAULT_")
|
||||
s += "map_Kd " + h.mask.name + texture_extension + "\n";
|
||||
if (h.spec.name != "_DEFAULT_")
|
||||
s += "map_Ks " + h.spec.name + texture_extension + "\n";
|
||||
if (h.spec.name != "_DEFAULT_")
|
||||
s += "map_Ns " + h.spec.name + texture_extension + "\n";
|
||||
s += "\n";
|
||||
return s;
|
||||
}
|
||||
|
|
@ -306,19 +306,36 @@ std::string block::printObj(int group_offset, bool rotate_x_90) const
|
|||
return s;
|
||||
}
|
||||
|
||||
void block::header::texture::load(const buffer &b)
|
||||
{
|
||||
READ_STRING(b, name);
|
||||
if (gameType == GameType::AimR)
|
||||
READ(b, number);
|
||||
}
|
||||
|
||||
void block::header::load(const buffer &b)
|
||||
{
|
||||
READ(b, type);
|
||||
READ_STRING(b, name);
|
||||
name = translate(name);
|
||||
READ_STRING(b, tex_mask);
|
||||
READ_STRING(b, tex_spec);
|
||||
READ_STRING(b, tex3);
|
||||
READ_STRING(b, tex4);
|
||||
mask.load(b);
|
||||
spec.load(b);
|
||||
tex3.load(b);
|
||||
tex4.load(b);
|
||||
READ(b, all_lods);
|
||||
READ(b, unk2);
|
||||
if (gameType == GameType::AimR)
|
||||
{
|
||||
READ(b, unk2[0]);
|
||||
READ(b, unk2[1]);
|
||||
READ(b, size);
|
||||
}
|
||||
else
|
||||
READ(b, unk2);
|
||||
READ(b, unk3);
|
||||
READ(b, size);
|
||||
if (gameType != GameType::AimR)
|
||||
READ(b, size);
|
||||
else
|
||||
READ(b, unk2[2]); // unk4_0 - related to unk4 - some vector3f
|
||||
READ(b, unk4);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -75,14 +77,6 @@ enum class MaterialType : uint32_t
|
|||
Fire2 = 0x3D,
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct vector3
|
||||
{
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct aim_vector3 : vector3<T>
|
||||
{
|
||||
|
|
@ -199,12 +193,20 @@ struct block
|
|||
{
|
||||
struct header
|
||||
{
|
||||
struct texture
|
||||
{
|
||||
std::string name;
|
||||
uint32_t number; // AimR
|
||||
|
||||
void load(const buffer &b);
|
||||
};
|
||||
|
||||
BlockType type;
|
||||
std::string name;
|
||||
std::string tex_mask;
|
||||
std::string tex_spec;
|
||||
std::string tex3;
|
||||
std::string tex4;
|
||||
texture mask;
|
||||
texture spec;
|
||||
texture tex3;
|
||||
texture tex4;
|
||||
union // LODs
|
||||
{
|
||||
struct
|
||||
|
|
@ -224,7 +226,7 @@ struct block
|
|||
// unk
|
||||
uint32_t unk2[3];
|
||||
uint32_t unk3;
|
||||
uint32_t unk4[10];
|
||||
float unk4[10];
|
||||
|
||||
void load(const buffer &b);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ struct header_segment : public segment
|
|||
{
|
||||
uint32_t unk1[3];
|
||||
std::string save_name;
|
||||
vector3 position;
|
||||
vector3f position;
|
||||
std::string mmp_file;
|
||||
std::string location_name;
|
||||
Common camera;
|
||||
|
|
@ -710,7 +710,7 @@ struct groups_segment : public segment
|
|||
|
||||
struct group
|
||||
{
|
||||
vector3 pos;
|
||||
vector3f pos;
|
||||
std::string org;
|
||||
std::string base;
|
||||
float unk0[4];
|
||||
|
|
|
|||
Loading…
Reference in a new issue