mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
Initial preparation for refactoring.
This commit is contained in:
parent
0efa83b097
commit
2dfc88e925
7 changed files with 45 additions and 16 deletions
|
|
@ -2,4 +2,5 @@ local_settings:
|
||||||
dependencies:
|
dependencies:
|
||||||
- pvt.lzwdgc.polygon4.data_manager.data_manager: master
|
- pvt.lzwdgc.polygon4.data_manager.data_manager: master
|
||||||
- pvt.cppan.demo.eigen: 3
|
- pvt.cppan.demo.eigen: 3
|
||||||
|
- pvt.egorpugin.primitives.filesystem: master
|
||||||
|
- pvt.egorpugin.primitives.executor: master
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,11 @@
|
||||||
include_directories(common)
|
file(GLOB common_src "common/*")
|
||||||
|
add_library(common ${common_src})
|
||||||
|
target_include_directories(common PUBLIC common)
|
||||||
|
target_link_libraries(common
|
||||||
|
pvt.egorpugin.primitives.filesystem
|
||||||
|
pvt.egorpugin.primitives.executor
|
||||||
|
)
|
||||||
|
add_dependencies(common version)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
file(GLOB unpaker_src "unpaker/*")
|
file(GLOB unpaker_src "unpaker/*")
|
||||||
|
|
@ -11,11 +18,17 @@ endif()
|
||||||
|
|
||||||
file(GLOB mmm_extractor_src "mmm_extractor/*")
|
file(GLOB mmm_extractor_src "mmm_extractor/*")
|
||||||
add_executable(mmm_extractor ${mmm_extractor_src})
|
add_executable(mmm_extractor ${mmm_extractor_src})
|
||||||
target_link_libraries(mmm_extractor common pvt.lzwdgc.polygon4.data_manager.data_manager)
|
target_link_libraries(mmm_extractor
|
||||||
|
common
|
||||||
|
pvt.lzwdgc.polygon4.data_manager.data_manager
|
||||||
|
)
|
||||||
|
|
||||||
file(GLOB mmo_extractor_src "mmo_extractor/*")
|
file(GLOB mmo_extractor_src "mmo_extractor/*")
|
||||||
add_executable(mmo_extractor ${mmo_extractor_src})
|
add_executable(mmo_extractor ${mmo_extractor_src})
|
||||||
target_link_libraries(mmo_extractor common pvt.lzwdgc.polygon4.data_manager.data_manager)
|
target_link_libraries(mmo_extractor
|
||||||
|
common
|
||||||
|
pvt.lzwdgc.polygon4.data_manager.data_manager
|
||||||
|
)
|
||||||
|
|
||||||
file(GLOB mmp_extractor_src "mmp_extractor/*")
|
file(GLOB mmp_extractor_src "mmp_extractor/*")
|
||||||
add_executable(mmp_extractor ${mmp_extractor_src})
|
add_executable(mmp_extractor ${mmp_extractor_src})
|
||||||
|
|
@ -52,5 +65,4 @@ file(GLOB save_loader_src "save_loader/*")
|
||||||
add_executable(save_loader ${save_loader_src})
|
add_executable(save_loader ${save_loader_src})
|
||||||
target_link_libraries(save_loader common)
|
target_link_libraries(save_loader common)
|
||||||
|
|
||||||
add_subdirectory(common)
|
|
||||||
add_subdirectory(script2txt)
|
add_subdirectory(script2txt)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
file(GLOB common_src "*.h" "*.cpp")
|
|
||||||
add_library(common ${common_src})
|
|
||||||
add_dependencies(common version)
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
#include <buffer.h>
|
#include <buffer.h>
|
||||||
#include <dxt5.h>
|
#include <dxt5.h>
|
||||||
|
|
||||||
|
#include <primitives/filesystem.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct mmm
|
struct mmm
|
||||||
|
|
@ -40,7 +42,7 @@ struct mmm
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mmm read_mmm(string fn)
|
mmm read_mmm(const path &fn)
|
||||||
{
|
{
|
||||||
buffer b(readFile(fn));
|
buffer b(readFile(fn));
|
||||||
mmm m;
|
mmm m;
|
||||||
|
|
@ -55,16 +57,30 @@ mmm read_mmm(string fn)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void process_mmm(const path &fn)
|
||||||
|
{
|
||||||
|
auto m = read_mmm(argv[1]);
|
||||||
|
write_mat_bmp(std::string(argv[1]) + ".bmp", m.data.unpack_mmm());
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
cout << "Usage:\n" << argv[0] << " file.mmp" << "\n";
|
cout << "Usage:\n" << argv[0] << " {file.mmm,dir}" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
auto m = read_mmm(argv[1]);
|
auto p = argv[1];
|
||||||
write_mat_bmp(std::string(argv[1]) + ".bmp", m.data.unpack_mmm());
|
if (fs::is_regular_file(p))
|
||||||
|
process_mmm(p);
|
||||||
|
else if (fs::is_directory(p))
|
||||||
|
{
|
||||||
|
auto f = enumerate_files(p, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error("Bad fs object");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
|
|
|
||||||
|
|
@ -374,13 +374,16 @@ void block::load(const buffer &b)
|
||||||
if (type == BlockType::ParticleEmitter)
|
if (type == BlockType::ParticleEmitter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// anims
|
||||||
uint32_t n_animations;
|
uint32_t n_animations;
|
||||||
READ(data, n_animations);
|
READ(data, n_animations);
|
||||||
animations.resize(n_animations);
|
animations.resize(n_animations);
|
||||||
|
|
||||||
|
// mat
|
||||||
mat.load(data);
|
mat.load(data);
|
||||||
|
READ(data, mat_type);
|
||||||
|
|
||||||
// unk
|
// unk
|
||||||
READ(data, effect);
|
|
||||||
READ(data, unk7);
|
READ(data, unk7);
|
||||||
READ(data, unk9);
|
READ(data, unk9);
|
||||||
READ(data, unk10);
|
READ(data, unk10);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ enum class BlockType : uint32_t
|
||||||
ParticleEmitter,
|
ParticleEmitter,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class EffectType : uint32_t
|
enum class MaterialType : uint32_t
|
||||||
{
|
{
|
||||||
Texture = 0x0,
|
Texture = 0x0,
|
||||||
TextureWithGlareMap = 0x1,
|
TextureWithGlareMap = 0x1,
|
||||||
|
|
@ -198,9 +198,9 @@ struct block
|
||||||
|
|
||||||
// data
|
// data
|
||||||
material mat;
|
material mat;
|
||||||
|
MaterialType mat_type;
|
||||||
|
|
||||||
//unk (anim + transform settings?)
|
//unk (anim + transform settings?)
|
||||||
EffectType effect;
|
|
||||||
uint32_t auto_animation;
|
uint32_t auto_animation;
|
||||||
float animation_cycle;
|
float animation_cycle;
|
||||||
uint32_t triangles_mult_7;
|
uint32_t triangles_mult_7;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ void convert(string fn)
|
||||||
convert_simple(dst2, src, width, height);
|
convert_simple(dst2, src, width, height);
|
||||||
dst2.reset();
|
dst2.reset();
|
||||||
memcpy(&m(0,0), dst2.getPtr(), dst2.size());
|
memcpy(&m(0,0), dst2.getPtr(), dst2.size());
|
||||||
m = m.flip(); // flip tga (normal) to bmp (inverse)
|
m = m.flip(); // flip tga (normal rows order) to bmp (inverse rows order)
|
||||||
}
|
}
|
||||||
write_mat_bmp(fn, m);
|
write_mat_bmp(fn, m);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue