Luz Boy
Luz Boy
guys I want to edit rme source to work with 9.83
where can I change or edit source?
and I will use MSVC 2013
I found those 2 files
Client_Version.h
and Client_Version.hpp
but I need to make new project and add those files or what?
where can I change or edit source?
and I will use MSVC 2013
I found those 2 files
Client_Version.h
Code:
#ifndef _RME_CLIENT_VERSION_H_
#define _RME_CLIENT_VERSION_H_
#include "main.h"
enum ClientVersionID {
CLIENT_VERSION_NONE= 0,
CLIENT_VERSION_740 = 1, // HACK
CLIENT_VERSION_750 = 1,
CLIENT_VERSION_755 = 2,
CLIENT_VERSION_760 = 3,
CLIENT_VERSION_770 = 3,
CLIENT_VERSION_780 = 4,
CLIENT_VERSION_790 = 5,
CLIENT_VERSION_792 = 6,
CLIENT_VERSION_800 = 7,
CLIENT_VERSION_810 = 8,
CLIENT_VERSION_811 = 9,
CLIENT_VERSION_820 = 10,
CLIENT_VERSION_830 = 11,
CLIENT_VERSION_840 = 12,
CLIENT_VERSION_841 = 13,
CLIENT_VERSION_842 = 14,
CLIENT_VERSION_850 = 15,
CLIENT_VERSION_983 = 17,
};
class ClientVersion {
public:
ClientVersion() : ver_id(CLIENT_VERSION_NONE) {}
ClientVersion(ClientVersionID id,
wxString versionName, wxString path,
const std::vector<std::pair<uint32_t, uint32_t> >& ver_ids,
Config::Key setting);
ClientVersion(const ClientVersion& other);
~ClientVersion() {}
static void loadVersions();
static void saveVersions();
static void addVersion(const ClientVersion& ver);
static ClientVersion* get(ClientVersionID id);
bool operator==(const ClientVersion& o) const {return ver_id == o.ver_id;}
bool hasValidPaths() const;
bool loadValidPaths();
std::string getName() const;
ClientVersionID getID() const;
FileName getDataPath() const;
FileName getLocalDataPath() const;
FileName getClientPath() const;
protected:
// Save this client version to registry
void save();
private:
ClientVersionID ver_id;
Config::Key setting;
wxString name;
std::vector<std::pair<uint32_t, uint32_t> > version_id_list;
wxString data_path;
FileName client_path;
// All versions
typedef std::map<ClientVersionID, ClientVersion> VersionMap;
static VersionMap versions;
};
inline std::string ClientVersion::getName() const
{
return nstr(name);
}
inline ClientVersionID ClientVersion::getID() const
{
return ver_id;
}
inline FileName ClientVersion::getClientPath() const
{
return client_path;
}
#endif
and Client_Version.hpp
Code:
#include "main.h"
#include "settings.h"
#include "filehandle.h"
#include "gui.h"
#include "client_version.h"
// Static methods to load/save
ClientVersion::VersionMap ClientVersion::versions;
void ClientVersion::loadVersions()
{
std::vector<std::pair<uint32_t, uint32_t> > ver_ids;
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x41BF619CUL, 0x41B9EA86UL));
addVersion(ClientVersion(CLIENT_VERSION_740, wxT("7.40"), wxT("740"), ver_ids, Config::TIBIA_DATA_DIR_740));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x439D5A33UL, 0x439852BEUL));
addVersion(ClientVersion(CLIENT_VERSION_760, wxT("7.60"), wxT("760"), ver_ids, Config::TIBIA_DATA_DIR_760));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x467FD7E6UL, 0x467F9E74UL));
addVersion(ClientVersion(CLIENT_VERSION_800, wxT("8.00"), wxT("800"), ver_ids, Config::TIBIA_DATA_DIR_800));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x475D3747UL, 0x475D0B01UL));
ver_ids.push_back(std::make_pair(0x47F60E37UL, 0x47EBB9B2UL));
addVersion(ClientVersion(CLIENT_VERSION_810, wxT("8.10"), wxT("810"), ver_ids, Config::TIBIA_DATA_DIR_810));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x486905AAUL, 0x4868ECC9UL));
ver_ids.push_back(std::make_pair(0x486CCA2BUL, 0x4868ECC9UL));
ver_ids.push_back(std::make_pair(0x489980A1UL, 0x489980A5UL));
ver_ids.push_back(std::make_pair(0x48DA1FB6UL, 0x48C8E712UL));
addVersion(ClientVersion(CLIENT_VERSION_820, wxT("8.20 - 8.31"), wxT("820"), ver_ids, Config::TIBIA_DATA_DIR_820));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x493D607AUL, 0x493D4E7CUL));
ver_ids.push_back(std::make_pair(0x49B7CC19UL, 0x49B140EAUL));
ver_ids.push_back(std::make_pair(0x49C233C9UL, 0x49B140EAUL));
addVersion(ClientVersion(CLIENT_VERSION_840, wxT("8.40"), wxT("840"), ver_ids, Config::TIBIA_DATA_DIR_840));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x4A49C5EBUL, 0x4A44FD4EUL));
ver_ids.push_back(std::make_pair(0x4A4CC0DCUL, 0x4A44FD4EUL));
addVersion(ClientVersion(CLIENT_VERSION_850, wxT("8.50"), wxT("850"), ver_ids, Config::TIBIA_DATA_DIR_850));
ver_ids.clear();
ver_ids.push_back(std::make_pair(0x51507BC7UL, 0x51407B67UL));
addVersion(ClientVersion(CLIENT_VERSION_983, wxT("9.83"), wxT("983"), ver_ids, Config::TIBIA_DATA_DIR_983));
}
void ClientVersion::saveVersions()
{
for(VersionMap::iterator i = versions.begin(); i != versions.end(); ++i)
i->second.save();
}
void ClientVersion::addVersion(const ClientVersion& ver) {
ASSERT(ver.ver_id != CLIENT_VERSION_NONE);
versions[ver.ver_id] = ver;
}
// Client version class
ClientVersion::ClientVersion(ClientVersionID id,
wxString versionName,
wxString path,
const std::vector<std::pair<uint32_t, uint32_t> >& ver_ids,
Config::Key setting) :
ver_id(id),
setting(setting),
name(versionName),
version_id_list(ver_ids),
data_path(path)
{
client_path = wxstr(settings.getString(setting));
}
ClientVersion::ClientVersion(const ClientVersion& other) :
ver_id(other.ver_id),
name(other.name),
version_id_list(other.version_id_list),
data_path(other.data_path),
client_path(other.client_path)
{
}
void ClientVersion::save()
{
settings.setString(setting, nstr(getClientPath().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR)));
}
ClientVersion* ClientVersion::get(ClientVersionID id)
{
VersionMap::iterator i = versions.find(id);
if(i == versions.end())
return NULL;
return &i->second;
}
FileName ClientVersion::getDataPath() const
{
return gui.GetDataDirectory() + data_path + FileName::GetPathSeparator();
}
FileName ClientVersion::getLocalDataPath() const
{
FileName f = gui.GetLocalDataDirectory() + data_path + FileName::GetPathSeparator();
f.Mkdir(0777, wxPATH_MKDIR_FULL);
return f;
}
bool ClientVersion::hasValidPaths() const
{
if(client_path.DirExists() == false)
return false;
FileName dat_path = client_path.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT("Tibia.dat");
FileName spr_path = client_path.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT("Tibia.spr");
if(!dat_path.FileExists() || !spr_path.FileExists())
return false;
if(!settings.getInteger(Config::CHECK_SIGNATURES))
return true;
// Peek the version of the files
FileReadHandle dat_file(nstr(dat_path.GetFullPath()));
if(dat_file.isOk() == false)
return false;
uint32_t datVersionR;
dat_file.getU32(datVersionR);
dat_file.close();
FileReadHandle spr_file(nstr(spr_path.GetFullPath()));
if(spr_file.isOk() == false)
return false;
uint32_t sprVersionR;
spr_file.getU32(sprVersionR);
spr_file.close();
for(std::vector<std::pair<uint32_t, uint32_t> >::const_iterator iter = version_id_list.begin(); iter != version_id_list.end(); ++iter)
{
if(iter->first == datVersionR && iter->second == sprVersionR)
{
return true;
}
}
return false;
}
bool ClientVersion::loadValidPaths()
{
do {
if(hasValidPaths() == true)
break;
gui.PopupDialog(wxT("Error"), wxT("Could not locate Tibia.dat and/or Tibia.spr, please navigate to your Tibia ") + name + wxT(" installation folder."), wxOK);
wxDirDialog file_dlg(NULL, wxT("Select Tibia directory..."), wxT(""), wxDD_DIR_MUST_EXIST);
int ok = file_dlg.ShowModal();
if(ok == wxID_CANCEL)
return false;
client_path.Assign(file_dlg.GetPath() + FileName::GetPathSeparator());
} while(true);
save();
return true;
}
but I need to make new project and add those files or what?