mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-14 17:33:25 +00:00
Db api updates.
This commit is contained in:
parent
b586253e4c
commit
c86b7966bb
2 changed files with 36 additions and 43 deletions
|
|
@ -129,30 +129,30 @@ int main(int argc, char *argv[]) {
|
||||||
// patch note: Database Changes
|
// patch note: Database Changes
|
||||||
// patch note: DB
|
// patch note: DB
|
||||||
// patch note: set glider GL_S3_PS_FINDER2 model to MOD_GL_S3_PS_FINDER2 (lz)
|
// patch note: set glider GL_S3_PS_FINDER2 model to MOD_GL_S3_PS_FINDER2 (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Ãëàéäåðû", "GL_S3_PS_FINDER2", "MODEL", "MOD_GL_S3_PS_FINDER2");
|
mod.db().edit_value(u8"Ãëàéäåðû", "GL_S3_PS_FINDER2", "MODEL", "MOD_GL_S3_PS_FINDER2");
|
||||||
// patch note: change MOD_GL_S3_PS_FINDER2 model radius to MOD_GL_S3_PS_FINDER1 radius (lz)
|
// patch note: change MOD_GL_S3_PS_FINDER2 model radius to MOD_GL_S3_PS_FINDER1 radius (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Ìîäåëè", "MOD_GL_S3_PS_FINDER2", "RADIUS", 4.012578f);
|
mod.db().edit_value(u8"Ìîäåëè", "MOD_GL_S3_PS_FINDER2", "RADIUS", 4.012578f);
|
||||||
// patch note: double gun for config CFG_NARGOON (double electro discharge) (lz)
|
// patch note: double gun for config CFG_NARGOON (double electro discharge) (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_NARGOON", "HEAVYGUN1", "GUN_ELECTRO_DISCHARGER");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_NARGOON", "HEAVYGUN1", "GUN_ELECTRO_DISCHARGER");
|
||||||
// patch note: double gun for config CFG_NARGOON1 (double two-barreled atomic gun) (lz)
|
// patch note: double gun for config CFG_NARGOON1 (double two-barreled atomic gun) (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_NARGOON1", "HEAVYGUN1", "GUN_DOUBLE_BARRELED_ATOMIC_GUN");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_NARGOON1", "HEAVYGUN1", "GUN_DOUBLE_BARRELED_ATOMIC_GUN");
|
||||||
// patch note: double gun for config CFG_BASE_NARG - Nargoon (double two-barreled atomic gun) (lz)
|
// patch note: double gun for config CFG_BASE_NARG - Nargoon (double two-barreled atomic gun) (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_BASE_NARG", "HEAVYGUN1", "GUN_DOUBLE_BARRELED_ATOMIC_GUN");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_BASE_NARG", "HEAVYGUN1", "GUN_DOUBLE_BARRELED_ATOMIC_GUN");
|
||||||
// patch note: double gun for config CFG_STNAR-97 - Nargoon (double GUN_INFRAATOMIC_PLASMA_GUN) (lz)
|
// patch note: double gun for config CFG_STNAR-97 - Nargoon (double GUN_INFRAATOMIC_PLASMA_GUN) (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_STNAR-97", "HEAVYGUN1", "GUN_INFRAATOMIC_PLASMA_GUN");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_STNAR-97", "HEAVYGUN1", "GUN_INFRAATOMIC_PLASMA_GUN");
|
||||||
// patch note: double gun for config CFG_FINDER_1 (std.3): from GUN_MICROWAVE_OSCILLATOR (std.4) and GUN_CHAOS_GENERATOR (std.4) to double GUN_FOUR_BARRELED_IMP_GAZER (std.3) (lz)
|
// patch note: double gun for config CFG_FINDER_1 (std.3): from GUN_MICROWAVE_OSCILLATOR (std.4) and GUN_CHAOS_GENERATOR (std.4) to double GUN_FOUR_BARRELED_IMP_GAZER (std.3) (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_FINDER_1", "LIGHTGUN1", "GUN_FOUR_BARRELED_IMP_GAZER");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_FINDER_1", "LIGHTGUN1", "GUN_FOUR_BARRELED_IMP_GAZER");
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_FINDER_1", "HEAVYGUN1", "GUN_FOUR_BARRELED_IMP_GAZER");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_FINDER_1", "HEAVYGUN1", "GUN_FOUR_BARRELED_IMP_GAZER");
|
||||||
// patch note: double gun for config CFG_FINDER_2: from GUN_FOUR_BARRELED_IMP_GAZER (std.3) + GUN_POZITRON_EMITTER (std.4) to double GUN_TACHYON_HEATER (std.3) (lz)
|
// patch note: double gun for config CFG_FINDER_2: from GUN_FOUR_BARRELED_IMP_GAZER (std.3) + GUN_POZITRON_EMITTER (std.4) to double GUN_TACHYON_HEATER (std.3) (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_FINDER_2", "LIGHTGUN1", "GUN_TACHYON_HEATER");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_FINDER_2", "LIGHTGUN1", "GUN_TACHYON_HEATER");
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_FINDER_2", "HEAVYGUN1", "GUN_TACHYON_HEATER");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_FINDER_2", "HEAVYGUN1", "GUN_TACHYON_HEATER");
|
||||||
// patch note: double gun for config CFG_EYEDSTONE_1: from GUN_FAST_ELECTROMAGNETIC_BEAM to double GUN_FAST_ELECTROMAGNETIC_BEAM (lz)
|
// patch note: double gun for config CFG_EYEDSTONE_1: from GUN_FAST_ELECTROMAGNETIC_BEAM to double GUN_FAST_ELECTROMAGNETIC_BEAM (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_EYEDSTONE_1", "LIGHTGUN1", "GUN_FAST_ELECTROMAGNETIC_BEAM");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_EYEDSTONE_1", "LIGHTGUN1", "GUN_FAST_ELECTROMAGNETIC_BEAM");
|
||||||
// patch note: double gun for config CFG_EYEDSTONE_2: from GUN_FAST_ELECTROMAGNETIC_BEAM to double GUN_FAST_ELECTROMAGNETIC_BEAM (lz)
|
// patch note: double gun for config CFG_EYEDSTONE_2: from GUN_FAST_ELECTROMAGNETIC_BEAM to double GUN_FAST_ELECTROMAGNETIC_BEAM (lz)
|
||||||
mod.db.db().edit_value((const char *)u8"Êîíôèãóðàöèè", "CFG_EYEDSTONE_2", "LIGHTGUN1", "GUN_FAST_ELECTROMAGNETIC_BEAM");
|
mod.db().edit_value(u8"Êîíôèãóðàöèè", "CFG_EYEDSTONE_2", "LIGHTGUN1", "GUN_FAST_ELECTROMAGNETIC_BEAM");
|
||||||
// patch note: INFORMATION
|
// patch note: INFORMATION
|
||||||
// patch note: add name for SINIGR armor, it was unnamed before (lz)
|
// patch note: add name for SINIGR armor, it was unnamed before (lz)
|
||||||
mod.db.quest().add_value("INFORMATION", "EQP_ZERO_ARMOR_S_SIN", "NAME", (const char *)u8"Îñîáàÿ íóëü-áðîíÿ");
|
mod.quest().add_value("INFORMATION", "EQP_ZERO_ARMOR_S_SIN", "NAME", u8"Îñîáàÿ íóëü-áðîíÿ");
|
||||||
// patch note:
|
// patch note:
|
||||||
|
|
||||||
// patch note: Game Changes
|
// patch note: Game Changes
|
||||||
|
|
|
||||||
|
|
@ -83,27 +83,6 @@ struct mod_maker {
|
||||||
script,
|
script,
|
||||||
sound,
|
sound,
|
||||||
};
|
};
|
||||||
struct {
|
|
||||||
mod_maker &m;
|
|
||||||
db2 db_;
|
|
||||||
db2 quest_;
|
|
||||||
|
|
||||||
db2 &db() {
|
|
||||||
add_files("db");
|
|
||||||
return db_;
|
|
||||||
}
|
|
||||||
db2 &quest() {
|
|
||||||
add_files("quest");
|
|
||||||
return quest_;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
void add_files(const path &fn) {
|
|
||||||
auto base = path{"data"} / fn;
|
|
||||||
m.files_to_distribute.insert(path{base} += ".ind");
|
|
||||||
m.files_to_distribute.insert(path{base} += ".dat");
|
|
||||||
m.files_to_distribute.insert(path{base} += ".tab");
|
|
||||||
}
|
|
||||||
} db{*this};
|
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string version;
|
std::string version;
|
||||||
|
|
@ -112,6 +91,7 @@ struct mod_maker {
|
||||||
std::set<path> files_to_distribute;
|
std::set<path> files_to_distribute;
|
||||||
std::set<path> code_files_to_distribute;
|
std::set<path> code_files_to_distribute;
|
||||||
std::source_location loc;
|
std::source_location loc;
|
||||||
|
int db_codepage = 1251;
|
||||||
|
|
||||||
mod_maker(std::source_location loc = std::source_location::current()) : loc{loc} {
|
mod_maker(std::source_location loc = std::source_location::current()) : loc{loc} {
|
||||||
init(fs::current_path());
|
init(fs::current_path());
|
||||||
|
|
@ -145,9 +125,6 @@ struct mod_maker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void apply() {
|
void apply() {
|
||||||
db.db_.close();
|
|
||||||
db.quest_.close();
|
|
||||||
|
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
for (auto &&p : files_to_pak) {
|
for (auto &&p : files_to_pak) {
|
||||||
if (p.filename() == aim_exe) {
|
if (p.filename() == aim_exe) {
|
||||||
|
|
@ -345,7 +322,28 @@ struct mod_maker {
|
||||||
files_to_pak.insert(fn);
|
files_to_pak.insert(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db2 db() {
|
||||||
|
return open_db("db");
|
||||||
|
}
|
||||||
|
db2 quest() {
|
||||||
|
return open_db("quest");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void make_bak_file(const path &fn) {
|
||||||
|
auto backup = path{fn} += ".bak";
|
||||||
|
if (!fs::exists(backup)) {
|
||||||
|
fs::copy_file(fn, backup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto open_db(auto &&name) {
|
||||||
|
auto d = db2{get_data_dir() / name, db_codepage};
|
||||||
|
for (auto &&f : d.open().get_files()) {
|
||||||
|
make_bak_file(f);
|
||||||
|
files_to_distribute.insert(f);
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
path get_hash_fn(path fn, const byte_array &data) const {
|
path get_hash_fn(path fn, const byte_array &data) const {
|
||||||
return get_mod_dir() / std::format("{:0X}.hash", get_insert_hash(fn, data));
|
return get_mod_dir() / std::format("{:0X}.hash", get_insert_hash(fn, data));
|
||||||
}
|
}
|
||||||
|
|
@ -367,8 +365,6 @@ private:
|
||||||
detect_game_dir(dir);
|
detect_game_dir(dir);
|
||||||
fs::create_directories(get_mod_dir());
|
fs::create_directories(get_mod_dir());
|
||||||
code_files_to_distribute.insert(loc.file_name());
|
code_files_to_distribute.insert(loc.file_name());
|
||||||
db.db_.open(get_data_dir() / "db", primitives::templates2::mmap_file<uint8_t>::rw{});
|
|
||||||
db.quest_.open(get_data_dir() / "quest", primitives::templates2::mmap_file<uint8_t>::rw{});
|
|
||||||
detect_tools();
|
detect_tools();
|
||||||
prepare_injections();
|
prepare_injections();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
@ -605,10 +601,7 @@ FF D7 ; call edi
|
||||||
}
|
}
|
||||||
void create_backup_exe_file() {
|
void create_backup_exe_file() {
|
||||||
auto fn = find_real_filename(aim_exe);
|
auto fn = find_real_filename(aim_exe);
|
||||||
auto backup = path{fn} += ".orig";
|
make_bak_file(fn);
|
||||||
if (!fs::exists(backup)) {
|
|
||||||
fs::copy_file(fn, backup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void patch_raw(path fn, uint32_t offset, T val) const {
|
void patch_raw(path fn, uint32_t offset, T val) const {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue