mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-15 02:36:43 -04:00
made some progress, but SHP image position is not always correct .
This commit is contained in:
parent
5639805b58
commit
c8f7c99c80
12 changed files with 162 additions and 252 deletions
2
3rdParty/xcc/misc/cc_file.cpp
vendored
2
3rdParty/xcc/misc/cc_file.cpp
vendored
|
@ -257,7 +257,7 @@ int Ccc_file::read()
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Ccc_file::read(void* data, int size)
|
||||
int Ccc_file::read(void* data, int64_t size)
|
||||
{
|
||||
if (get_p() < 0 || get_p() + size > get_size())
|
||||
return 1;
|
||||
|
|
8
3rdParty/xcc/misc/cc_file.h
vendored
8
3rdParty/xcc/misc/cc_file.h
vendored
|
@ -114,7 +114,7 @@ public:
|
|||
void load(const Ccc_file& f);
|
||||
t_file_type get_file_type(bool fast = true);
|
||||
int read();
|
||||
int read(void* data, int size);
|
||||
int read(void* data, int64_t size);
|
||||
int extract(const string& name);
|
||||
virtual void close();
|
||||
Ccc_file(bool read_on_open);
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
return m_data;
|
||||
}
|
||||
|
||||
int get_p() const
|
||||
int64_t get_p() const
|
||||
{
|
||||
return m_p;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
m_p = p;
|
||||
}
|
||||
|
||||
void skip(int p)
|
||||
void skip(int64_t p)
|
||||
{
|
||||
m_p += p;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ private:
|
|||
Cvirtual_binary m_data;
|
||||
Cfile32 m_f;
|
||||
bool m_is_open = false;
|
||||
int m_p;
|
||||
int64_t m_p;
|
||||
const bool m_read_on_open;
|
||||
size_t m_size;
|
||||
};
|
||||
|
|
4
3rdParty/xcc/misc/cc_structures.h
vendored
4
3rdParty/xcc/misc/cc_structures.h
vendored
|
@ -194,7 +194,7 @@ struct t_mix_index_entry
|
|||
{
|
||||
t_mix_index_entry() = default;
|
||||
|
||||
t_mix_index_entry(unsigned int id_, int offset_, int size_)
|
||||
t_mix_index_entry(unsigned int id_, int offset_, unsigned __int32 size_)
|
||||
{
|
||||
id = id_;
|
||||
offset = offset_;
|
||||
|
@ -203,7 +203,7 @@ struct t_mix_index_entry
|
|||
|
||||
unsigned __int32 id;
|
||||
__int32 offset;
|
||||
__int32 size;
|
||||
unsigned __int32 size;
|
||||
};
|
||||
|
||||
struct t_mix_rg_header
|
||||
|
|
2
3rdParty/xcc/misc/mix_file.cpp
vendored
2
3rdParty/xcc/misc/mix_file.cpp
vendored
|
@ -318,7 +318,7 @@ string Cmix_file::get_name(int id)
|
|||
#endif
|
||||
}
|
||||
|
||||
int Cmix_file::get_id(t_game game, string name)
|
||||
unsigned int Cmix_file::get_id(t_game game, string name)
|
||||
{
|
||||
boost::to_upper(name);
|
||||
std::replace(name.begin(), name.end(), '/', '\\');
|
||||
|
|
14
3rdParty/xcc/misc/mix_file.h
vendored
14
3rdParty/xcc/misc/mix_file.h
vendored
|
@ -26,7 +26,7 @@ class Cmix_file : public Ccc_file
|
|||
public:
|
||||
int post_open();
|
||||
string get_name(int id);
|
||||
static int get_id(t_game game, string name);
|
||||
static unsigned int get_id(t_game game, string name);
|
||||
int get_index(unsigned int id) const;
|
||||
using Ccc_file::get_size;
|
||||
using Ccc_file::vdata;
|
||||
|
@ -80,10 +80,14 @@ public:
|
|||
return m_index[get_index(id)].offset;
|
||||
}
|
||||
|
||||
int get_size(unsigned int id) const
|
||||
size_t get_size(unsigned int id) const
|
||||
{
|
||||
assert(get_index(id) != -1);
|
||||
return m_index[get_index(id)].size;
|
||||
auto const idx = get_index(id);
|
||||
//assert(idx != -1);
|
||||
if (idx >= 0) {
|
||||
return m_index[idx].size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool has_checksum() const
|
||||
|
@ -101,7 +105,7 @@ public:
|
|||
return &m_index[0];
|
||||
}
|
||||
private:
|
||||
using t_id_index = map<int, int>;
|
||||
using t_id_index = map<unsigned int, int>;
|
||||
|
||||
static bool m_ft_support;
|
||||
|
||||
|
|
2
3rdParty/xcc/misc/tmp_file.h
vendored
2
3rdParty/xcc/misc/tmp_file.h
vendored
|
@ -27,7 +27,7 @@ public:
|
|||
bool is_valid() const
|
||||
{
|
||||
const t_tmp_header& h = header();
|
||||
int size = get_size();
|
||||
auto const size = get_size();
|
||||
return !(sizeof(t_tmp_header) > size ||
|
||||
h.cx != 24 ||
|
||||
h.cy != 24 ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue