Update coding style.
Magnum's type names are fine, but I'd rather limit what depends on Magnum as much as possible. Vector types are still allowed, though. No way I'll write my own.
This commit is contained in:
parent
5144121812
commit
457bb5e89f
100 changed files with 751 additions and 815 deletions
|
@ -25,8 +25,6 @@ using Utility::Debug;
|
|||
using Utility::Warning;
|
||||
using Utility::Error;
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
Logger&
|
||||
Logger::instance() {
|
||||
static Logger logger;
|
||||
|
@ -89,7 +87,7 @@ Logger::log(EntryType type, StringView location, StringView message) {
|
|||
|
||||
d << "["_s << Debug::nospace << location << Debug::nospace << "]";
|
||||
|
||||
for(UnsignedInt i = 0; i < _indentLevel; i++) {
|
||||
for(auto i = 0u; i < _indentLevel; i++) {
|
||||
d << Debug::nospace << " "_s << Debug::nospace;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include <Corrade/Containers/ArrayView.h>
|
||||
#include <Corrade/Utility/Format.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "EntryType.h"
|
||||
|
||||
using namespace Corrade;
|
||||
|
@ -37,8 +35,6 @@ using Containers::ArrayView;
|
|||
using Containers::String;
|
||||
using Containers::StringView;
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
using namespace Containers::Literals;
|
||||
|
||||
class Logger {
|
||||
|
@ -68,7 +64,7 @@ class Logger {
|
|||
std::ofstream _logFile;
|
||||
#endif
|
||||
|
||||
UnsignedInt _indentLevel = 0;
|
||||
std::uint32_t _indentLevel = 0;
|
||||
|
||||
std::mutex _logMutex{};
|
||||
};
|
||||
|
|
|
@ -16,15 +16,14 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Containers::Literals;
|
||||
using namespace Magnum;
|
||||
|
||||
enum AccessorySize {
|
||||
S,
|
||||
|
@ -38,7 +37,7 @@ struct AccessoryData{
|
|||
AccessorySize size = AccessorySize::S;
|
||||
};
|
||||
|
||||
static const std::map<Int, AccessoryData> accessories {
|
||||
static const std::map<std::int32_t, AccessoryData> accessories {
|
||||
// region Primitives
|
||||
{1, {"Cube"_s, AccessorySize::S}},
|
||||
{2, {"Pentagon"_s, AccessorySize::S}},
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Containers::Literals;
|
||||
using namespace Magnum;
|
||||
|
||||
struct ArmourSet {
|
||||
Containers::StringView name;
|
||||
bool neck_compatible;
|
||||
};
|
||||
|
||||
static const std::map<Int, ArmourSet> armour_sets {
|
||||
static const std::map<std::int32_t, ArmourSet> armour_sets {
|
||||
{-1, {"<unequipped>"_s, true}},
|
||||
{0, {"Vanguard"_s, true}},
|
||||
{1, {"Assault Mk.I"_s, true}},
|
||||
|
|
|
@ -20,13 +20,10 @@
|
|||
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Containers::Literals;
|
||||
using namespace Magnum;
|
||||
|
||||
static const std::map<Int, Containers::StringView> mission_id_map {{
|
||||
static const std::map<std::int32_t, Containers::StringView> mission_id_map {{
|
||||
// Story missions
|
||||
{0x0064, "Mission 1 - Training"_s},
|
||||
{0x0065, "Mission 2 - Patrol Operation"_s},
|
||||
|
|
|
@ -19,14 +19,11 @@
|
|||
#include <Corrade/Containers/Array.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Containers::Literals;
|
||||
using namespace Magnum;
|
||||
|
||||
struct StoryProgressPoint {
|
||||
Int id;
|
||||
std::int32_t id;
|
||||
Containers::StringView chapter;
|
||||
Containers::StringView point;
|
||||
Containers::StringView after = nullptr;
|
||||
|
|
|
@ -16,17 +16,16 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Magnum.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Containers::Literals;
|
||||
using namespace Magnum;
|
||||
|
||||
extern const std::map<Int, Containers::StringView> style_names
|
||||
extern const std::map<std::int32_t, Containers::StringView> style_names
|
||||
#ifdef STYLENAMES_DEFINITION
|
||||
{
|
||||
{0, "Custom Style 1"_s},
|
||||
|
|
|
@ -15,19 +15,18 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
using namespace Containers::Literals;
|
||||
|
||||
// region Melee
|
||||
static const std::map<Int, Containers::StringView> melee_grips {
|
||||
static const std::map<std::int32_t, Containers::StringView> melee_grips {
|
||||
{0, "Combat Grip (1H)"_s},
|
||||
{1, "Knuckle Guard Grip (1H)"_s},
|
||||
{2, "Dual Guard Grip (1H)"_s},
|
||||
|
@ -78,7 +77,7 @@ static const std::map<Int, Containers::StringView> melee_grips {
|
|||
{2404, "Arched Twin Blade (2H)"_s},
|
||||
};
|
||||
|
||||
static const std::map<Int, Containers::StringView> melee_assaulters {
|
||||
static const std::map<std::int32_t, Containers::StringView> melee_assaulters {
|
||||
{0, "Long Metal Blade"_s},
|
||||
{1, "Long Assault Blade"_s},
|
||||
{2, "Long Fin Blade"_s},
|
||||
|
@ -172,7 +171,7 @@ static const std::map<Int, Containers::StringView> melee_assaulters {
|
|||
// endregion
|
||||
|
||||
// region Shields
|
||||
static const std::map<Int, Containers::StringView> shield_handles {
|
||||
static const std::map<std::int32_t, Containers::StringView> shield_handles {
|
||||
{0, "Balanced Handle"_s},
|
||||
{1, "Expanded Handle"_s},
|
||||
{2, "Lowguard Handle"_s},
|
||||
|
@ -191,7 +190,7 @@ static const std::map<Int, Containers::StringView> shield_handles {
|
|||
{101, "Star Handle"_s},
|
||||
};
|
||||
|
||||
static const std::map<Int, Containers::StringView> shield_shells {
|
||||
static const std::map<std::int32_t, Containers::StringView> shield_shells {
|
||||
{0, "Balanced Shell"_s},
|
||||
{1, "Compass Shell"_s},
|
||||
{2, "Uppoint Shell"_s},
|
||||
|
@ -212,7 +211,7 @@ static const std::map<Int, Containers::StringView> shield_shells {
|
|||
// endregion
|
||||
|
||||
// region Bullet Shooters
|
||||
static const std::map<Int, Containers::StringView> bshooter_triggers {
|
||||
static const std::map<std::int32_t, Containers::StringView> bshooter_triggers {
|
||||
{0, "BL-Combat Trigger (1H)"_s},
|
||||
{1, "Light Machine Trigger (1H)"_s},
|
||||
{2, "Tactical Trigger (1H)"_s},
|
||||
|
@ -230,7 +229,7 @@ static const std::map<Int, Containers::StringView> bshooter_triggers {
|
|||
{199, "2H Base Trigger (2H)"_s},
|
||||
};
|
||||
|
||||
static const std::map<Int, Containers::StringView> bshooter_barrels {
|
||||
static const std::map<std::int32_t, Containers::StringView> bshooter_barrels {
|
||||
{0, "BL-Combat Barrel (1 shot)"_s},
|
||||
{1, "Shock Absorb Barrel (1 shot) (Motion)"_s},
|
||||
{2, "Muzzlemod Barrel (1 shot)"_s},
|
||||
|
@ -267,7 +266,7 @@ static const std::map<Int, Containers::StringView> bshooter_barrels {
|
|||
// endregion
|
||||
|
||||
//region Energy Shooters
|
||||
static const std::map<Int, Containers::StringView> eshooter_triggers {
|
||||
static const std::map<std::int32_t, Containers::StringView> eshooter_triggers {
|
||||
{0, "EN-Rifle Trigger (1H)"_s},
|
||||
{1, "Underarm Trigger (1H)"_s},
|
||||
{2, "EN-Inverted Trigger (1H)"_s},
|
||||
|
@ -285,7 +284,7 @@ static const std::map<Int, Containers::StringView> eshooter_triggers {
|
|||
{199, "2H Base EnTrigger (2H)"_s},
|
||||
};
|
||||
|
||||
static const std::map<Int, Containers::StringView> eshooter_busters {
|
||||
static const std::map<std::int32_t, Containers::StringView> eshooter_busters {
|
||||
{0, "EN-Combat Buster (1 shot)"_s},
|
||||
{1, "Delta Cycler (1 shot) (Motion)"_s},
|
||||
{2, "EN-Longbarrel Buster (1 shot)"_s},
|
||||
|
@ -321,7 +320,7 @@ static const std::map<Int, Containers::StringView> eshooter_busters {
|
|||
// endregion
|
||||
|
||||
// region Bullet Launchers
|
||||
static const std::map<Int, Containers::StringView> blauncher_pods {
|
||||
static const std::map<std::int32_t, Containers::StringView> blauncher_pods {
|
||||
{0, "BL-Delta Pack Launcher (Missile x12)"_s},
|
||||
{1, "BL-Twin Pack Launcher (Missile x12)"_s},
|
||||
{2, "Detector Launcher (Missile x12)"_s},
|
||||
|
@ -351,7 +350,7 @@ static const std::map<Int, Containers::StringView> blauncher_pods {
|
|||
{399, "C Base Pod (Cluster x40)"_s},
|
||||
};
|
||||
|
||||
static const std::map<Int, Containers::StringView> blauncher_projectiles {
|
||||
static const std::map<std::int32_t, Containers::StringView> blauncher_projectiles {
|
||||
{0, "Flathead Missile"_s},
|
||||
{1, "Warhead Missile"_s},
|
||||
{2, "Pointhead Missile"_s},
|
||||
|
@ -361,7 +360,7 @@ static const std::map<Int, Containers::StringView> blauncher_projectiles {
|
|||
// endregion
|
||||
|
||||
// region Energy Launchers
|
||||
static const std::map<Int, Containers::StringView> elauncher_generators {
|
||||
static const std::map<std::int32_t, Containers::StringView> elauncher_generators {
|
||||
{0, "Fly Unit"_s},
|
||||
{1, "Assault Unit (Motion)"_s},
|
||||
{2, "Falcon Unit"_s},
|
||||
|
@ -393,7 +392,7 @@ static const std::map<Int, Containers::StringView> elauncher_generators {
|
|||
{99, "Base Generator"},
|
||||
};
|
||||
|
||||
static const std::map<Int, Containers::StringView> elauncher_pods {
|
||||
static const std::map<std::int32_t, Containers::StringView> elauncher_pods {
|
||||
{0, "EN-Dual Claw Launcher (Echo) (Motion)"_s},
|
||||
{1, "EN-Assault Launcher (Echo)"_s},
|
||||
{2, "EN-Tactical Launcher (Echo)"_s},
|
||||
|
|
|
@ -25,9 +25,9 @@ using namespace Corrade;
|
|||
using namespace Magnum;
|
||||
|
||||
struct Accessory {
|
||||
Int attachIndex = -1;
|
||||
Int id = -1;
|
||||
Containers::StaticArray<2, Int> styles{ValueInit};
|
||||
std::int32_t attachIndex = -1;
|
||||
std::int32_t id = -1;
|
||||
Containers::StaticArray<2, std::int32_t> styles{ValueInit};
|
||||
Vector3 relativePosition{0.0f};
|
||||
Vector3 relativePositionOffset{0.0f};
|
||||
Vector3 relativeRotation{0.0f};
|
||||
|
|
|
@ -19,13 +19,10 @@
|
|||
#include <Corrade/Containers/Array.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "Decal.h"
|
||||
#include "Accessory.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
enum class ArmourSlot {
|
||||
#define c(enumerator, enumstr, name) enumerator,
|
||||
|
@ -35,8 +32,8 @@ enum class ArmourSlot {
|
|||
|
||||
struct ArmourPart {
|
||||
ArmourSlot slot = ArmourSlot::Face;
|
||||
Int id = 0;
|
||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||
std::int32_t id = 0;
|
||||
Containers::StaticArray<4, std::int32_t> styles{ValueInit};
|
||||
Containers::Array<Decal> decals;
|
||||
Containers::Array<Accessory> accessories;
|
||||
};
|
||||
|
|
|
@ -28,13 +28,13 @@ using namespace Magnum;
|
|||
struct CustomStyle {
|
||||
Containers::String name;
|
||||
Color4 colour{0.0f};
|
||||
Float metallic = 0.5f;
|
||||
Float gloss = 0.5f;
|
||||
float metallic = 0.5f;
|
||||
float gloss = 0.5f;
|
||||
bool glow = false;
|
||||
|
||||
Int patternId = 0;
|
||||
Float opacity = 0.5f;
|
||||
std::int32_t patternId = 0;
|
||||
float opacity = 0.5f;
|
||||
Vector2 offset{0.5f};
|
||||
Float rotation = 0.0f;
|
||||
Float scale = 0.5f;
|
||||
float rotation = 0.0f;
|
||||
float scale = 0.5f;
|
||||
};
|
||||
|
|
|
@ -19,18 +19,19 @@
|
|||
#include <Magnum/Magnum.h>
|
||||
#include <Magnum/Math/Color.h>
|
||||
#include <Magnum/Math/Vector2.h>
|
||||
#include <Magnum/Math/Vector3.h>
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
struct Decal {
|
||||
Int id = -1;
|
||||
std::int32_t id = -1;
|
||||
Color4 colour{0.0f};
|
||||
Vector3 position{0.0f};
|
||||
Vector3 uAxis{0.0f};
|
||||
Vector3 vAxis{0.0f};
|
||||
Vector2 offset{0.5f};
|
||||
Float scale = 0.5f;
|
||||
Float rotation = 0.0f;
|
||||
float scale = 0.5f;
|
||||
float rotation = 0.0f;
|
||||
bool flip = false;
|
||||
bool wrap = false;
|
||||
};
|
||||
|
|
|
@ -16,17 +16,13 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
struct Joints {
|
||||
Float neck = 0.0f;
|
||||
Float body = 0.0f;
|
||||
Float shoulders = 0.0f;
|
||||
Float hips = 0.0f;
|
||||
Float upperArms = 0.0f;
|
||||
Float lowerArms = 0.0f;
|
||||
Float upperLegs = 0.0f;
|
||||
Float lowerLegs = 0.0f;
|
||||
float neck = 0.0f;
|
||||
float body = 0.0f;
|
||||
float shoulders = 0.0f;
|
||||
float hips = 0.0f;
|
||||
float upperArms = 0.0f;
|
||||
float lowerArms = 0.0f;
|
||||
float upperLegs = 0.0f;
|
||||
float lowerLegs = 0.0f;
|
||||
};
|
||||
|
|
|
@ -308,32 +308,32 @@ Mass::getTuning() {
|
|||
}
|
||||
}
|
||||
|
||||
Int&
|
||||
std::int32_t&
|
||||
Mass::engine() {
|
||||
return _tuning.engineId;
|
||||
}
|
||||
|
||||
Containers::ArrayView<Int>
|
||||
Containers::ArrayView<std::int32_t>
|
||||
Mass::gears() {
|
||||
return _tuning.gearIds;
|
||||
}
|
||||
|
||||
Int&
|
||||
std::int32_t&
|
||||
Mass::os() {
|
||||
return _tuning.osId;
|
||||
}
|
||||
|
||||
Containers::ArrayView<Int>
|
||||
Containers::ArrayView<std::int32_t>
|
||||
Mass::modules() {
|
||||
return _tuning.moduleIds;
|
||||
}
|
||||
|
||||
Int&
|
||||
std::int32_t&
|
||||
Mass::architecture() {
|
||||
return _tuning.archId;
|
||||
}
|
||||
|
||||
Containers::ArrayView<Int>
|
||||
Containers::ArrayView<std::int32_t>
|
||||
Mass::techs() {
|
||||
return _tuning.techIds;
|
||||
}
|
||||
|
@ -365,8 +365,9 @@ Mass::updateAccount(Containers::StringView new_account) {
|
|||
}
|
||||
|
||||
void
|
||||
Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id,
|
||||
Containers::StringView small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids)
|
||||
Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& big_node_id,
|
||||
Containers::StringView small_nodes_prop_name,
|
||||
Containers::ArrayView<std::int32_t> small_nodes_ids)
|
||||
{
|
||||
LOG_INFO_FORMAT("Getting tuning data ({}, {}).", big_node_prop_name, small_nodes_prop_name);
|
||||
|
||||
|
@ -392,7 +393,7 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node
|
|||
return;
|
||||
}
|
||||
|
||||
for(UnsignedInt i = 0; i < small_nodes_ids.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < small_nodes_ids.size(); i++) {
|
||||
auto small_node_id = node_ids->at<IntProperty>(i);
|
||||
CORRADE_INTERNAL_ASSERT(small_node_id);
|
||||
small_nodes_ids[i] = small_node_id->value;
|
||||
|
|
|
@ -64,7 +64,7 @@ class Mass {
|
|||
Containers::StringView name();
|
||||
bool setName(Containers::StringView new_name);
|
||||
|
||||
enum class State : UnsignedByte {
|
||||
enum class State: std::uint8_t {
|
||||
Empty, Invalid, Valid
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@ class Mass {
|
|||
void getJointSliders();
|
||||
bool writeJointSliders();
|
||||
|
||||
Containers::ArrayView<Int> frameStyles();
|
||||
Containers::ArrayView<std::int32_t> frameStyles();
|
||||
void getFrameStyles();
|
||||
bool writeFrameStyles();
|
||||
|
||||
|
@ -87,7 +87,7 @@ class Mass {
|
|||
|
||||
Containers::ArrayView<CustomStyle> frameCustomStyles();
|
||||
void getFrameCustomStyles();
|
||||
bool writeFrameCustomStyle(UnsignedLong index);
|
||||
bool writeFrameCustomStyle(std::size_t index);
|
||||
|
||||
Containers::ArrayView<ArmourPart> armourParts();
|
||||
void getArmourParts();
|
||||
|
@ -100,7 +100,7 @@ class Mass {
|
|||
|
||||
Containers::ArrayView<CustomStyle> armourCustomStyles();
|
||||
void getArmourCustomStyles();
|
||||
bool writeArmourCustomStyle(UnsignedLong index);
|
||||
bool writeArmourCustomStyle(std::size_t index);
|
||||
|
||||
Containers::ArrayView<Weapon> meleeWeapons();
|
||||
void getMeleeWeapons();
|
||||
|
@ -128,25 +128,25 @@ class Mass {
|
|||
|
||||
Containers::ArrayView<CustomStyle> globalStyles();
|
||||
void getGlobalStyles();
|
||||
bool writeGlobalStyle(UnsignedLong index);
|
||||
bool writeGlobalStyle(std::size_t index);
|
||||
|
||||
void getTuning();
|
||||
|
||||
Int& engine();
|
||||
Containers::ArrayView<Int> gears();
|
||||
std::int32_t& engine();
|
||||
Containers::ArrayView<std::int32_t> gears();
|
||||
|
||||
Int& os();
|
||||
Containers::ArrayView<Int> modules();
|
||||
std::int32_t& os();
|
||||
Containers::ArrayView<std::int32_t> modules();
|
||||
|
||||
Int& architecture();
|
||||
Containers::ArrayView<Int> techs();
|
||||
std::int32_t& architecture();
|
||||
Containers::ArrayView<std::int32_t> techs();
|
||||
|
||||
Containers::StringView account();
|
||||
bool updateAccount(Containers::StringView new_account);
|
||||
|
||||
private:
|
||||
void getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty* style_array);
|
||||
bool writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array);
|
||||
bool writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array);
|
||||
|
||||
void getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array);
|
||||
void writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array);
|
||||
|
@ -157,8 +157,9 @@ class Mass {
|
|||
void getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array);
|
||||
bool writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weapon> weapon_array);
|
||||
|
||||
void getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id,
|
||||
Containers::StringView small_nodes_prop_name, Containers::ArrayView<Int> small_nodes_ids);
|
||||
void getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& big_node_id,
|
||||
Containers::StringView small_nodes_prop_name,
|
||||
Containers::ArrayView<std::int32_t> small_nodes_ids);
|
||||
|
||||
Containers::Optional<UESaveFile> _mass;
|
||||
|
||||
|
@ -174,7 +175,7 @@ class Mass {
|
|||
|
||||
struct {
|
||||
Joints joints{};
|
||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||
Containers::StaticArray<4, std::int32_t> styles{ValueInit};
|
||||
Color4 eyeFlare{0.0f};
|
||||
Containers::StaticArray<16, CustomStyle> customStyles;
|
||||
} _frame;
|
||||
|
@ -198,14 +199,14 @@ class Mass {
|
|||
Containers::Array<CustomStyle> _globalStyles;
|
||||
|
||||
struct {
|
||||
Int engineId;
|
||||
Containers::StaticArray<7, Int> gearIds;
|
||||
std::int32_t engineId;
|
||||
Containers::StaticArray<7, std::int32_t> gearIds;
|
||||
|
||||
Int osId;
|
||||
Containers::StaticArray<7, Int> moduleIds;
|
||||
std::int32_t osId;
|
||||
Containers::StaticArray<7, std::int32_t> moduleIds;
|
||||
|
||||
Int archId;
|
||||
Containers::StaticArray<7, Int> techIds;
|
||||
std::int32_t archId;
|
||||
Containers::StaticArray<7, std::int32_t> techIds;
|
||||
} _tuning;
|
||||
|
||||
Containers::String _account;
|
||||
|
|
|
@ -59,7 +59,7 @@ Mass::getArmourParts() {
|
|||
return;
|
||||
}
|
||||
|
||||
for(UnsignedInt i = 0; i < armour_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < armour_array->items.size(); i++) {
|
||||
auto part_prop = armour_array->at<GenericStructProperty>(i);
|
||||
auto& part = _armour.parts[i];
|
||||
|
||||
|
@ -89,7 +89,7 @@ Mass::getArmourParts() {
|
|||
return;
|
||||
}
|
||||
|
||||
for(UnsignedInt j = 0; j < part_styles->items.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < part_styles->items.size(); j++) {
|
||||
part.styles[j] = part_styles->at<IntProperty>(j)->value;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ Mass::writeArmourPart(ArmourSlot slot) {
|
|||
|
||||
GenericStructProperty* part_prop = nullptr;
|
||||
|
||||
for(UnsignedInt i = 0; i < armour_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < armour_array->items.size(); i++) {
|
||||
part_prop = armour_array->at<GenericStructProperty>(i);
|
||||
if(slot_str == part_prop->at<ByteProperty>(MASS_ARMOUR_SLOT)->enumValue) {
|
||||
break;
|
||||
|
@ -178,7 +178,7 @@ Mass::writeArmourPart(ArmourSlot slot) {
|
|||
part_prop->at<IntProperty>(MASS_ARMOUR_ID)->value = part.id;
|
||||
|
||||
auto part_styles = part_prop->at<ArrayProperty>(MASS_ARMOUR_STYLES);
|
||||
for(UnsignedInt i = 0; i < part.styles.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < part.styles.size(); i++) {
|
||||
part_styles->at<IntProperty>(i)->value = part.styles[i];
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ Mass::getBulletLauncherAttachments() {
|
|||
if(attach_array->items.size() == _weapons.bulletLaunchers.size() &&
|
||||
attach_array->items.size() == _armour.blAttachment.size())
|
||||
{
|
||||
for(UnsignedInt i = 0; i < attach_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < attach_array->items.size(); i++) {
|
||||
auto attachment_prop = attach_array->at<GenericStructProperty>(i);
|
||||
auto& attachment = _armour.blAttachment[i];
|
||||
|
||||
|
@ -313,7 +313,7 @@ Mass::writeBulletLauncherAttachments() {
|
|||
if(attach_array->items.size() == _weapons.bulletLaunchers.size() &&
|
||||
attach_array->items.size() == _armour.blAttachment.size())
|
||||
{
|
||||
for(UnsignedInt i = 0; i < attach_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < attach_array->items.size(); i++) {
|
||||
auto attachment_prop = attach_array->at<GenericStructProperty>(i);
|
||||
auto& attachment = _armour.blAttachment[i];
|
||||
|
||||
|
@ -414,7 +414,7 @@ Mass::getArmourCustomStyles() {
|
|||
}
|
||||
|
||||
bool
|
||||
Mass::writeArmourCustomStyle(UnsignedLong index) {
|
||||
Mass::writeArmourCustomStyle(std::size_t index) {
|
||||
LOG_INFO_FORMAT("Writing custom armour style {}.", index);
|
||||
|
||||
if(index > _armour.customStyles.size()) {
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace Containers::Literals;
|
|||
|
||||
void
|
||||
Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) {
|
||||
for(UnsignedInt i = 0; i < decal_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < decal_array->items.size(); i++) {
|
||||
auto decal_prop = decal_array->at<GenericStructProperty>(i);
|
||||
CORRADE_INTERNAL_ASSERT(decal_prop);
|
||||
auto& decal = decals[i];
|
||||
|
@ -56,7 +56,7 @@ Mass::getDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array)
|
|||
|
||||
void
|
||||
Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_array) {
|
||||
for(UnsignedInt i = 0; i < decal_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < decal_array->items.size(); i++) {
|
||||
auto decal_prop = decal_array->at<GenericStructProperty>(i);
|
||||
CORRADE_INTERNAL_ASSERT(decal_prop);
|
||||
auto& decal = decals[i];
|
||||
|
@ -91,7 +91,7 @@ Mass::writeDecals(Containers::ArrayView<Decal> decals, ArrayProperty* decal_arra
|
|||
|
||||
void
|
||||
Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accessory_array) {
|
||||
for(UnsignedInt i = 0; i < accessory_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < accessory_array->items.size(); i++) {
|
||||
auto acc_prop = accessory_array->at<GenericStructProperty>(i);
|
||||
CORRADE_INTERNAL_ASSERT(acc_prop);
|
||||
auto& accessory = accessories[i];
|
||||
|
@ -99,7 +99,7 @@ Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty
|
|||
accessory.attachIndex = acc_prop->at<IntProperty>(MASS_ACCESSORY_ATTACH_INDEX)->value;
|
||||
accessory.id = acc_prop->at<IntProperty>(MASS_ACCESSORY_ID)->value;
|
||||
auto acc_styles = acc_prop->at<ArrayProperty>(MASS_ACCESSORY_STYLES);
|
||||
for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < acc_styles->items.size(); j++) {
|
||||
accessory.styles[j] = acc_styles->at<IntProperty>(j)->value;
|
||||
}
|
||||
auto rel_pos_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_RELPOS);
|
||||
|
@ -117,7 +117,7 @@ Mass::getAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty
|
|||
|
||||
void
|
||||
Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayProperty* accs_array) {
|
||||
for(UnsignedInt i = 0; i < accs_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < accs_array->items.size(); i++) {
|
||||
auto acc_prop = accs_array->at<GenericStructProperty>(i);
|
||||
CORRADE_INTERNAL_ASSERT(acc_prop);
|
||||
auto& accessory = accessories[i];
|
||||
|
@ -125,7 +125,7 @@ Mass::writeAccessories(Containers::ArrayView<Accessory> accessories, ArrayProper
|
|||
acc_prop->at<IntProperty>(MASS_ACCESSORY_ATTACH_INDEX)->value = accessory.attachIndex;
|
||||
acc_prop->at<IntProperty>(MASS_ACCESSORY_ID)->value = accessory.id;
|
||||
auto acc_styles = acc_prop->at<ArrayProperty>(MASS_ACCESSORY_STYLES);
|
||||
for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < acc_styles->items.size(); j++) {
|
||||
acc_styles->at<IntProperty>(j)->value = accessory.styles[j];
|
||||
}
|
||||
auto rel_pos_prop = acc_prop->at<VectorStructProperty>(MASS_ACCESSORY_RELPOS);
|
||||
|
|
|
@ -184,7 +184,7 @@ Mass::writeJointSliders() {
|
|||
return true;
|
||||
}
|
||||
|
||||
Containers::ArrayView<Int>
|
||||
Containers::ArrayView<std::int32_t>
|
||||
Mass::frameStyles() {
|
||||
return _frame.styles;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ Mass::getFrameStyles() {
|
|||
return;
|
||||
}
|
||||
|
||||
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < frame_styles->items.size(); i++) {
|
||||
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ Mass::writeFrameStyles() {
|
|||
return false;
|
||||
}
|
||||
|
||||
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < frame_styles->items.size(); i++) {
|
||||
frame_styles->at<IntProperty>(i)->value = _frame.styles[i];
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ Mass::getFrameCustomStyles() {
|
|||
}
|
||||
|
||||
bool
|
||||
Mass::writeFrameCustomStyle(UnsignedLong index) {
|
||||
Mass::writeFrameCustomStyle(std::size_t index) {
|
||||
LOG_INFO_FORMAT("Writing frame custom style number {}.", index);
|
||||
|
||||
if(index > _frame.customStyles.size()) {
|
||||
|
|
|
@ -58,7 +58,7 @@ Mass::getGlobalStyles() {
|
|||
}
|
||||
|
||||
bool
|
||||
Mass::writeGlobalStyle(UnsignedLong index) {
|
||||
Mass::writeGlobalStyle(std::size_t index) {
|
||||
LOG_INFO_FORMAT("Writing global style number {}.", index);
|
||||
|
||||
if(index > _globalStyles.size()) {
|
||||
|
@ -88,7 +88,7 @@ Mass::writeGlobalStyle(UnsignedLong index) {
|
|||
|
||||
void
|
||||
Mass::getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty* style_array) {
|
||||
for(UnsignedInt i = 0; i < style_array->items.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < style_array->items.size(); i++) {
|
||||
auto style_prop = style_array->at<GenericStructProperty>(i);
|
||||
auto& style = styles[i];
|
||||
|
||||
|
@ -111,7 +111,7 @@ Mass::getCustomStyles(Containers::ArrayView<CustomStyle> styles, ArrayProperty*
|
|||
}
|
||||
|
||||
bool
|
||||
Mass::writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) {
|
||||
Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array) {
|
||||
if(!style_array) {
|
||||
_lastError = "style_array is null."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
|
|
@ -153,7 +153,7 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weap
|
|||
return;
|
||||
}
|
||||
|
||||
for(UnsignedInt i = 0; i < weapon_array.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < weapon_array.size(); i++) {
|
||||
auto weapon_prop = prop->at<GenericStructProperty>(i);
|
||||
auto& weapon = weapon_array[i];
|
||||
|
||||
|
@ -171,14 +171,14 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView<Weap
|
|||
auto parts_prop = weapon_prop->at<ArrayProperty>(MASS_WEAPON_ELEMENT);
|
||||
weapon.parts = Containers::Array<WeaponPart>{ValueInit, parts_prop->items.size()};
|
||||
|
||||
for(UnsignedInt j = 0; j < parts_prop->items.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < parts_prop->items.size(); j++) {
|
||||
auto part_prop = parts_prop->at<GenericStructProperty>(j);
|
||||
auto& part = weapon.parts[j];
|
||||
|
||||
part.id = part_prop->at<IntProperty>(MASS_WEAPON_PART_ID)->value;
|
||||
|
||||
auto part_styles = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_STYLES);
|
||||
for(UnsignedInt k = 0; k < part_styles->items.size(); k++) {
|
||||
for(std::uint32_t k = 0; k < part_styles->items.size(); k++) {
|
||||
part.styles[k] = part_styles->at<IntProperty>(k)->value;
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<We
|
|||
return false;
|
||||
}
|
||||
|
||||
for(UnsignedInt i = 0; i < weapon_array.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < weapon_array.size(); i++) {
|
||||
auto weapon_prop = prop->at<GenericStructProperty>(i);
|
||||
auto& weapon = weapon_array[i];
|
||||
|
||||
|
@ -292,14 +292,14 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<We
|
|||
return false;
|
||||
}
|
||||
|
||||
for(UnsignedInt j = 0; j < parts_prop->items.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < parts_prop->items.size(); j++) {
|
||||
auto part_prop = parts_prop->at<GenericStructProperty>(j);
|
||||
auto& part = weapon.parts[j];
|
||||
|
||||
part_prop->at<IntProperty>(MASS_WEAPON_PART_ID)->value = part.id;
|
||||
|
||||
auto part_styles = part_prop->at<ArrayProperty>(MASS_WEAPON_PART_STYLES);
|
||||
for(UnsignedInt k = 0; k < part_styles->items.size(); k++) {
|
||||
for(std::uint32_t k = 0; k < part_styles->items.size(); k++) {
|
||||
part_styles->at<IntProperty>(k)->value = part.styles[k];
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView<We
|
|||
return false;
|
||||
}
|
||||
|
||||
for(UnsignedInt j = 0; j < weapon.customStyles.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < weapon.customStyles.size(); j++) {
|
||||
writeCustomStyle(weapon.customStyles[j], j, custom_styles);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Weapon::Weapon(const Weapon& other) {
|
|||
name = other.name;
|
||||
type = other.type;
|
||||
parts = Containers::Array<WeaponPart>{other.parts.size()};
|
||||
for(UnsignedInt i = 0; i < parts.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < parts.size(); i++) {
|
||||
parts[i] = other.parts[i];
|
||||
}
|
||||
customStyles = other.customStyles;
|
||||
|
@ -35,7 +35,7 @@ Weapon& Weapon::operator=(const Weapon& other) {
|
|||
name = other.name;
|
||||
type = other.type;
|
||||
parts = Containers::Array<WeaponPart>{other.parts.size()};
|
||||
for(UnsignedInt i = 0; i < parts.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < parts.size(); i++) {
|
||||
parts[i] = other.parts[i];
|
||||
}
|
||||
customStyles = other.customStyles;
|
||||
|
|
|
@ -19,13 +19,10 @@
|
|||
#include <Corrade/Containers/Array.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "Decal.h"
|
||||
#include "Accessory.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct WeaponPart {
|
||||
WeaponPart() = default;
|
||||
|
@ -34,11 +31,11 @@ struct WeaponPart {
|
|||
id = other.id;
|
||||
styles = other.styles;
|
||||
decals = Containers::Array<Decal>{other.decals.size()};
|
||||
for(UnsignedInt i = 0; i < decals.size(); i++) {
|
||||
for(auto i = 0u; i < decals.size(); i++) {
|
||||
decals[i] = other.decals[i];
|
||||
}
|
||||
accessories = Containers::Array<Accessory>{other.accessories.size()};
|
||||
for(UnsignedInt i = 0; i < accessories.size(); i++) {
|
||||
for(auto i = 0u; i < accessories.size(); i++) {
|
||||
accessories[i] = other.accessories[i];
|
||||
}
|
||||
}
|
||||
|
@ -46,11 +43,11 @@ struct WeaponPart {
|
|||
id = other.id;
|
||||
styles = other.styles;
|
||||
decals = Containers::Array<Decal>{other.decals.size()};
|
||||
for(UnsignedInt i = 0; i < decals.size(); i++) {
|
||||
for(auto i = 0u; i < decals.size(); i++) {
|
||||
decals[i] = other.decals[i];
|
||||
}
|
||||
accessories = Containers::Array<Accessory>{other.accessories.size()};
|
||||
for(UnsignedInt i = 0; i < accessories.size(); i++) {
|
||||
for(auto i = 0u; i < accessories.size(); i++) {
|
||||
accessories[i] = other.accessories[i];
|
||||
}
|
||||
return *this;
|
||||
|
@ -59,8 +56,8 @@ struct WeaponPart {
|
|||
WeaponPart(WeaponPart&& other) = default;
|
||||
WeaponPart& operator=(WeaponPart&& other) = default;
|
||||
|
||||
Int id = 0;
|
||||
Containers::StaticArray<4, Int> styles{ValueInit};
|
||||
std::int32_t id = 0;
|
||||
Containers::StaticArray<4, std::int32_t> styles{ValueInit};
|
||||
Containers::Array<Decal> decals{};
|
||||
Containers::Array<Accessory> accessories{};
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie
|
|||
_saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir}
|
||||
{
|
||||
Containers::String mass_filename = "";
|
||||
for(UnsignedInt i = 0; i < _hangars.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _hangars.size(); i++) {
|
||||
mass_filename = Utility::Path::join(_saveDirectory,
|
||||
Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account));
|
||||
new(&_hangars[i]) Mass{mass_filename};
|
||||
|
@ -45,12 +45,12 @@ MassManager::lastError() {
|
|||
}
|
||||
|
||||
Mass&
|
||||
MassManager::hangar(Int hangar) {
|
||||
MassManager::hangar(std::int32_t hangar) {
|
||||
return _hangars[hangar];
|
||||
}
|
||||
|
||||
void
|
||||
MassManager::refreshHangar(Int hangar) {
|
||||
MassManager::refreshHangar(std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range.";
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -64,7 +64,7 @@ MassManager::refreshHangar(Int hangar) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::importMass(Containers::StringView staged_fn, Int hangar) {
|
||||
MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range.";
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -107,7 +107,7 @@ MassManager::importMass(Containers::StringView staged_fn, Int hangar) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::exportMass(Int hangar) {
|
||||
MassManager::exportMass(std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -134,7 +134,7 @@ MassManager::exportMass(Int hangar) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::moveMass(Int source, Int destination) {
|
||||
MassManager::moveMass(std::int32_t source, std::int32_t destination) {
|
||||
if(source < 0 || source >= 32) {
|
||||
_lastError = "Source hangar index out of range."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -172,7 +172,7 @@ MassManager::moveMass(Int source, Int destination) {
|
|||
}
|
||||
|
||||
bool
|
||||
MassManager::deleteMass(Int hangar) {
|
||||
MassManager::deleteMass(std::int32_t hangar) {
|
||||
if(hangar < 0 || hangar >= 32) {
|
||||
_lastError = "Hangar index out of range."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
|
|
@ -189,24 +189,24 @@ Profile::renameCompany(Containers::StringView new_name) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::activeFrameSlot() const {
|
||||
return _activeFrameSlot;
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::credits() const {
|
||||
return _credits;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setCredits(Int amount) {
|
||||
Profile::setCredits(std::int32_t amount) {
|
||||
auto credits_prop = _profile.at<IntProperty>(PROFILE_CREDITS);
|
||||
|
||||
if(!credits_prop) {
|
||||
credits_prop = new IntProperty;
|
||||
credits_prop->name.emplace("Credit"_s);
|
||||
credits_prop->valueLength = sizeof(Int);
|
||||
credits_prop->valueLength = sizeof(std::int32_t);
|
||||
_profile.appendProperty(IntProperty::ptr{credits_prop});
|
||||
}
|
||||
|
||||
|
@ -220,19 +220,19 @@ Profile::setCredits(Int amount) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::storyProgress() const {
|
||||
return _storyProgress;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setStoryProgress(Int progress) {
|
||||
Profile::setStoryProgress(std::int32_t progress) {
|
||||
auto story_progress_prop = _profile.at<IntProperty>("StoryProgress"_s);
|
||||
|
||||
if(!story_progress_prop) {
|
||||
story_progress_prop = new IntProperty;
|
||||
story_progress_prop->name.emplace("StoryProgress"_s);
|
||||
story_progress_prop->valueLength = sizeof(Int);
|
||||
story_progress_prop->valueLength = sizeof(std::int32_t);
|
||||
_profile.appendProperty(IntProperty::ptr{story_progress_prop});
|
||||
}
|
||||
|
||||
|
@ -246,252 +246,252 @@ Profile::setStoryProgress(Int progress) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::lastMissionId() const {
|
||||
return _lastMissionId;
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::verseSteel() const {
|
||||
return _verseSteel;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setVerseSteel(Int amount) {
|
||||
Profile::setVerseSteel(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, VerseSteel, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::undinium() const {
|
||||
return _undinium;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setUndinium(Int amount) {
|
||||
Profile::setUndinium(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Undinium, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::necriumAlloy() const {
|
||||
return _necriumAlloy;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setNecriumAlloy(Int amount) {
|
||||
Profile::setNecriumAlloy(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, NecriumAlloy, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::lunarite() const {
|
||||
return _lunarite;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setLunarite(Int amount) {
|
||||
Profile::setLunarite(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Lunarite, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::asterite() const {
|
||||
return _asterite;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setAsterite(Int amount) {
|
||||
Profile::setAsterite(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Asterite, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::halliteFragma() const {
|
||||
return _halliteFragma;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setHalliteFragma(Int amount) {
|
||||
Profile::setHalliteFragma(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, HalliteFragma, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::ednil() const {
|
||||
return _ednil;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setEdnil(Int amount) {
|
||||
Profile::setEdnil(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Ednil, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::nuflalt() const {
|
||||
return _nuflalt;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setNuflalt(Int amount) {
|
||||
Profile::setNuflalt(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Nuflalt, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::aurelene() const {
|
||||
return _aurelene;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setAurelene(Int amount) {
|
||||
Profile::setAurelene(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Aurelene, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::soldus() const {
|
||||
return _soldus;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setSoldus(Int amount) {
|
||||
Profile::setSoldus(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Soldus, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::synthesisedN() const {
|
||||
return _synthesisedN;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setSynthesisedN(Int amount) {
|
||||
Profile::setSynthesisedN(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, SynthesisedN, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::nanoc() const {
|
||||
return _nanoc;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setNanoc(Int amount) {
|
||||
Profile::setNanoc(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Nanoc, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::alcarbonite() const {
|
||||
return _alcarbonite;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setAlcarbonite(Int amount) {
|
||||
Profile::setAlcarbonite(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Alcarbonite, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::keriphene() const {
|
||||
return _keriphene;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setKeriphene(Int amount) {
|
||||
Profile::setKeriphene(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Keriphene, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::nitinolCM() const {
|
||||
return _nitinolCM;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setNitinolCM(Int amount) {
|
||||
Profile::setNitinolCM(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, NitinolCM, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::quarkium() const {
|
||||
return _quarkium;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setQuarkium(Int amount) {
|
||||
Profile::setQuarkium(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Quarkium, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::alterene() const {
|
||||
return _alterene;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setAlterene(Int amount) {
|
||||
Profile::setAlterene(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Alterene, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::cosmium() const {
|
||||
return _cosmium;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setCosmium(Int amount) {
|
||||
Profile::setCosmium(std::int32_t amount) {
|
||||
return setResource(PROFILE_MATERIAL, Cosmium, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::mixedComposition() const {
|
||||
return _mixedComposition;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setMixedComposition(Int amount) {
|
||||
Profile::setMixedComposition(std::int32_t amount) {
|
||||
return setResource(PROFILE_QUARK_DATA, MixedComposition, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::voidResidue() const {
|
||||
return _voidResidue;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setVoidResidue(Int amount) {
|
||||
Profile::setVoidResidue(std::int32_t amount) {
|
||||
return setResource(PROFILE_QUARK_DATA, VoidResidue, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::muscularConstruction() const {
|
||||
return _muscularConstruction;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setMuscularConstruction(Int amount) {
|
||||
Profile::setMuscularConstruction(std::int32_t amount) {
|
||||
return setResource(PROFILE_QUARK_DATA, MuscularConstruction, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::mineralExoskeletology() const {
|
||||
return _mineralExoskeletology;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setMineralExoskeletology(Int amount) {
|
||||
Profile::setMineralExoskeletology(std::int32_t amount) {
|
||||
return setResource(PROFILE_QUARK_DATA, MineralExoskeletology, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::carbonisedSkin() const {
|
||||
return _carbonisedSkin;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setCarbonisedSkin(Int amount) {
|
||||
Profile::setCarbonisedSkin(std::int32_t amount) {
|
||||
return setResource(PROFILE_QUARK_DATA, CarbonisedSkin, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::isolatedVoidParticle() const {
|
||||
return _isolatedVoidParticle;
|
||||
}
|
||||
|
||||
bool
|
||||
Profile::setIsolatedVoidParticle(Int amount) {
|
||||
Profile::setIsolatedVoidParticle(std::int32_t amount) {
|
||||
return setResource(PROFILE_QUARK_DATA, IsolatedVoidParticle, amount);
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
Profile::getResource(Containers::StringView container, MaterialID id) {
|
||||
auto mats_prop = _profile.at<ArrayProperty>(container);
|
||||
|
||||
|
@ -509,7 +509,7 @@ Profile::getResource(Containers::StringView container, MaterialID id) {
|
|||
}
|
||||
|
||||
bool
|
||||
Profile::setResource(Containers::StringView container, MaterialID id, Int amount) {
|
||||
Profile::setResource(Containers::StringView container, MaterialID id, std::int32_t amount) {
|
||||
auto mats_prop = _profile.at<ArrayProperty>(container);
|
||||
|
||||
if(!mats_prop) {
|
||||
|
|
|
@ -19,16 +19,13 @@
|
|||
#include <Corrade/Containers/String.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Magnum.h>
|
||||
|
||||
#include "../UESaveFile/UESaveFile.h"
|
||||
|
||||
#include "ResourceIDs.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
enum class ProfileType : UnsignedByte {
|
||||
enum class ProfileType: std::uint8_t {
|
||||
Demo,
|
||||
FullGame
|
||||
};
|
||||
|
@ -37,14 +34,14 @@ class Profile {
|
|||
public:
|
||||
explicit Profile(Containers::StringView path);
|
||||
|
||||
auto valid() const -> bool;
|
||||
bool valid() const;
|
||||
|
||||
auto lastError() const -> Containers::StringView;
|
||||
|
||||
auto filename() const -> Containers::StringView;
|
||||
|
||||
auto type() const -> ProfileType;
|
||||
auto isDemo() const -> bool;
|
||||
ProfileType type() const;
|
||||
bool isDemo() const;
|
||||
|
||||
auto account() const -> Containers::StringView;
|
||||
|
||||
|
@ -53,91 +50,91 @@ class Profile {
|
|||
auto companyName() const -> Containers::StringView;
|
||||
bool renameCompany(Containers::StringView new_name);
|
||||
|
||||
auto activeFrameSlot() const -> Int;
|
||||
std::int32_t activeFrameSlot() const;
|
||||
|
||||
auto credits() const -> Int;
|
||||
bool setCredits(Int credits);
|
||||
std::int32_t credits() const;
|
||||
bool setCredits(std::int32_t credits);
|
||||
|
||||
auto storyProgress() const -> Int;
|
||||
bool setStoryProgress(Int progress);
|
||||
std::int32_t storyProgress() const;
|
||||
bool setStoryProgress(std::int32_t progress);
|
||||
|
||||
auto lastMissionId() const -> Int;
|
||||
std::int32_t lastMissionId() const;
|
||||
|
||||
auto verseSteel() const -> Int;
|
||||
bool setVerseSteel(Int amount);
|
||||
std::int32_t verseSteel() const;
|
||||
bool setVerseSteel(std::int32_t amount);
|
||||
|
||||
auto undinium() const -> Int;
|
||||
bool setUndinium(Int amount);
|
||||
std::int32_t undinium() const;
|
||||
bool setUndinium(std::int32_t amount);
|
||||
|
||||
auto necriumAlloy() const -> Int;
|
||||
bool setNecriumAlloy(Int amount);
|
||||
std::int32_t necriumAlloy() const;
|
||||
bool setNecriumAlloy(std::int32_t amount);
|
||||
|
||||
auto lunarite() const -> Int;
|
||||
bool setLunarite(Int amount);
|
||||
std::int32_t lunarite() const;
|
||||
bool setLunarite(std::int32_t amount);
|
||||
|
||||
auto asterite() const -> Int;
|
||||
bool setAsterite(Int amount);
|
||||
std::int32_t asterite() const;
|
||||
bool setAsterite(std::int32_t amount);
|
||||
|
||||
Int halliteFragma() const;
|
||||
bool setHalliteFragma(Int amount);
|
||||
std::int32_t halliteFragma() const;
|
||||
bool setHalliteFragma(std::int32_t amount);
|
||||
|
||||
auto ednil() const -> Int;
|
||||
bool setEdnil(Int amount);
|
||||
std::int32_t ednil() const;
|
||||
bool setEdnil(std::int32_t amount);
|
||||
|
||||
auto nuflalt() const -> Int;
|
||||
bool setNuflalt(Int amount);
|
||||
std::int32_t nuflalt() const;
|
||||
bool setNuflalt(std::int32_t amount);
|
||||
|
||||
auto aurelene() const -> Int;
|
||||
bool setAurelene(Int amount);
|
||||
std::int32_t aurelene() const;
|
||||
bool setAurelene(std::int32_t amount);
|
||||
|
||||
auto soldus() const -> Int;
|
||||
bool setSoldus(Int amount);
|
||||
std::int32_t soldus() const;
|
||||
bool setSoldus(std::int32_t amount);
|
||||
|
||||
auto synthesisedN() const -> Int;
|
||||
bool setSynthesisedN(Int amount);
|
||||
std::int32_t synthesisedN() const;
|
||||
bool setSynthesisedN(std::int32_t amount);
|
||||
|
||||
Int nanoc() const;
|
||||
bool setNanoc(Int amount);
|
||||
std::int32_t nanoc() const;
|
||||
bool setNanoc(std::int32_t amount);
|
||||
|
||||
auto alcarbonite() const -> Int;
|
||||
bool setAlcarbonite(Int amount);
|
||||
std::int32_t alcarbonite() const;
|
||||
bool setAlcarbonite(std::int32_t amount);
|
||||
|
||||
auto keriphene() const -> Int;
|
||||
bool setKeriphene(Int amount);
|
||||
std::int32_t keriphene() const;
|
||||
bool setKeriphene(std::int32_t amount);
|
||||
|
||||
auto nitinolCM() const -> Int;
|
||||
bool setNitinolCM(Int amount);
|
||||
std::int32_t nitinolCM() const;
|
||||
bool setNitinolCM(std::int32_t amount);
|
||||
|
||||
auto quarkium() const -> Int;
|
||||
bool setQuarkium(Int amount);
|
||||
std::int32_t quarkium() const;
|
||||
bool setQuarkium(std::int32_t amount);
|
||||
|
||||
auto alterene() const -> Int;
|
||||
bool setAlterene(Int amount);
|
||||
std::int32_t alterene() const;
|
||||
bool setAlterene(std::int32_t amount);
|
||||
|
||||
Int cosmium() const;
|
||||
bool setCosmium(Int amount);
|
||||
std::int32_t cosmium() const;
|
||||
bool setCosmium(std::int32_t amount);
|
||||
|
||||
auto mixedComposition() const -> Int;
|
||||
bool setMixedComposition(Int amount);
|
||||
std::int32_t mixedComposition() const;
|
||||
bool setMixedComposition(std::int32_t amount);
|
||||
|
||||
auto voidResidue() const -> Int;
|
||||
bool setVoidResidue(Int amount);
|
||||
std::int32_t voidResidue() const;
|
||||
bool setVoidResidue(std::int32_t amount);
|
||||
|
||||
auto muscularConstruction() const -> Int;
|
||||
bool setMuscularConstruction(Int amount);
|
||||
std::int32_t muscularConstruction() const;
|
||||
bool setMuscularConstruction(std::int32_t amount);
|
||||
|
||||
auto mineralExoskeletology() const -> Int;
|
||||
bool setMineralExoskeletology(Int amount);
|
||||
std::int32_t mineralExoskeletology() const;
|
||||
bool setMineralExoskeletology(std::int32_t amount);
|
||||
|
||||
auto carbonisedSkin() const -> Int;
|
||||
bool setCarbonisedSkin(Int amount);
|
||||
std::int32_t carbonisedSkin() const;
|
||||
bool setCarbonisedSkin(std::int32_t amount);
|
||||
|
||||
Int isolatedVoidParticle() const;
|
||||
bool setIsolatedVoidParticle(Int amount);
|
||||
std::int32_t isolatedVoidParticle() const;
|
||||
bool setIsolatedVoidParticle(std::int32_t amount);
|
||||
|
||||
private:
|
||||
Int getResource(Containers::StringView container, MaterialID id);
|
||||
bool setResource(Containers::StringView container, MaterialID id, Int amount);
|
||||
std::int32_t getResource(Containers::StringView container, MaterialID id);
|
||||
bool setResource(Containers::StringView container, MaterialID id, std::int32_t amount);
|
||||
|
||||
Containers::String _filename;
|
||||
|
||||
|
@ -146,38 +143,38 @@ class Profile {
|
|||
UESaveFile _profile;
|
||||
|
||||
Containers::String _name;
|
||||
Int _activeFrameSlot = 0;
|
||||
Int _credits = 0;
|
||||
Int _storyProgress = 0;
|
||||
Int _lastMissionId = 0;
|
||||
std::int32_t _activeFrameSlot = 0;
|
||||
std::int32_t _credits = 0;
|
||||
std::int32_t _storyProgress = 0;
|
||||
std::int32_t _lastMissionId = 0;
|
||||
|
||||
Int _verseSteel = 0;
|
||||
Int _undinium = 0;
|
||||
Int _necriumAlloy = 0;
|
||||
Int _lunarite = 0;
|
||||
Int _asterite = 0;
|
||||
Int _halliteFragma = 0;
|
||||
std::int32_t _verseSteel = 0;
|
||||
std::int32_t _undinium = 0;
|
||||
std::int32_t _necriumAlloy = 0;
|
||||
std::int32_t _lunarite = 0;
|
||||
std::int32_t _asterite = 0;
|
||||
std::int32_t _halliteFragma = 0;
|
||||
|
||||
Int _ednil = 0;
|
||||
Int _nuflalt = 0;
|
||||
Int _aurelene = 0;
|
||||
Int _soldus = 0;
|
||||
Int _synthesisedN = 0;
|
||||
Int _nanoc = 0;
|
||||
std::int32_t _ednil = 0;
|
||||
std::int32_t _nuflalt = 0;
|
||||
std::int32_t _aurelene = 0;
|
||||
std::int32_t _soldus = 0;
|
||||
std::int32_t _synthesisedN = 0;
|
||||
std::int32_t _nanoc = 0;
|
||||
|
||||
Int _alcarbonite = 0;
|
||||
Int _keriphene = 0;
|
||||
Int _nitinolCM = 0;
|
||||
Int _quarkium = 0;
|
||||
Int _alterene = 0;
|
||||
Int _cosmium = 0;
|
||||
std::int32_t _alcarbonite = 0;
|
||||
std::int32_t _keriphene = 0;
|
||||
std::int32_t _nitinolCM = 0;
|
||||
std::int32_t _quarkium = 0;
|
||||
std::int32_t _alterene = 0;
|
||||
std::int32_t _cosmium = 0;
|
||||
|
||||
Int _mixedComposition = 0;
|
||||
Int _voidResidue = 0;
|
||||
Int _muscularConstruction = 0;
|
||||
Int _mineralExoskeletology = 0;
|
||||
Int _carbonisedSkin = 0;
|
||||
Int _isolatedVoidParticle = 0;
|
||||
std::int32_t _mixedComposition = 0;
|
||||
std::int32_t _voidResidue = 0;
|
||||
std::int32_t _muscularConstruction = 0;
|
||||
std::int32_t _mineralExoskeletology = 0;
|
||||
std::int32_t _carbonisedSkin = 0;
|
||||
std::int32_t _isolatedVoidParticle = 0;
|
||||
|
||||
Containers::String _account;
|
||||
|
||||
|
|
|
@ -16,11 +16,7 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Magnum;
|
||||
|
||||
enum MaterialID : Int {
|
||||
enum MaterialID : std::int32_t {
|
||||
VerseSteel = 0xC3500,
|
||||
Undinium = 0xC3501,
|
||||
NecriumAlloy = 0xC3502,
|
||||
|
|
|
@ -114,7 +114,7 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) {
|
|||
}
|
||||
|
||||
if(delete_builds) {
|
||||
for(UnsignedByte i = 0; i < 32; ++i) {
|
||||
for(std::uint8_t i = 0; i < 32; ++i) {
|
||||
auto filename = Utility::format("{}Unit{:.2d}{}.sav",
|
||||
_profiles[index].type() == ProfileType::Demo ? "Demo": "",
|
||||
i, _profiles[index].account());
|
||||
|
@ -176,7 +176,7 @@ ProfileManager::backupProfile(std::size_t index, bool backup_builds) {
|
|||
zip_set_archive_comment(zip, comment.data(), comment.size());
|
||||
|
||||
if(backup_builds) {
|
||||
for(UnsignedByte i = 0; i < 32; ++i) {
|
||||
for(std::uint8_t i = 0; i < 32; ++i) {
|
||||
auto build_filename = Utility::format("{}Unit{:.2d}{}.sav",
|
||||
profile.isDemo() ? "Demo"_s : ""_s, i,
|
||||
profile.account());
|
||||
|
@ -247,7 +247,7 @@ ProfileManager::refreshBackups() {
|
|||
|
||||
Containers::ScopeGuard guard{zip, zip_close};
|
||||
|
||||
Long num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED);
|
||||
auto num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED);
|
||||
|
||||
if(num_entries == 0) {
|
||||
continue;
|
||||
|
@ -291,7 +291,7 @@ ProfileManager::refreshBackups() {
|
|||
|
||||
arrayReserve(backup.includedFiles, num_entries);
|
||||
|
||||
for(Long i = 0; i < num_entries; i++) {
|
||||
for(auto i = 0; i < num_entries; i++) {
|
||||
arrayAppend(backup.includedFiles, InPlaceInit, zip_get_name(zip, i, ZIP_FL_UNCHANGED));
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ ProfileManager::restoreBackup(std::size_t index) {
|
|||
|
||||
Containers::StaticArray<8192, char> buf{ValueInit};
|
||||
|
||||
Long bytes_read = 0;
|
||||
auto bytes_read = 0l;
|
||||
while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) {
|
||||
if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast<std::size_t>(bytes_read)) {
|
||||
_lastError = Utility::format(error_format.data(), file, "not enough bytes written.");
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <Corrade/Containers/Array.h>
|
||||
|
@ -30,12 +32,12 @@ struct Backup {
|
|||
Containers::String company;
|
||||
ProfileType type;
|
||||
struct {
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
int hour;
|
||||
int minute;
|
||||
int second;
|
||||
std::int32_t year;
|
||||
std::int32_t month;
|
||||
std::int32_t day;
|
||||
std::int32_t hour;
|
||||
std::int32_t minute;
|
||||
std::int32_t second;
|
||||
} timestamp;
|
||||
Containers::Array<Containers::String> includedFiles;
|
||||
};
|
||||
|
|
|
@ -58,8 +58,6 @@ SaveTool::SaveTool(const Arguments& arguments):
|
|||
LOG_INFO("Configuring OpenGL renderer.");
|
||||
GL::Renderer::enable(GL::Renderer::Feature::Blending);
|
||||
GL::Renderer::enable(GL::Renderer::Feature::ScissorTest);
|
||||
GL::Renderer::disable(GL::Renderer::Feature::FaceCulling);
|
||||
GL::Renderer::disable(GL::Renderer::Feature::DepthTest);
|
||||
GL::Renderer::setBlendFunction(GL::Renderer::BlendFunction::SourceAlpha,
|
||||
GL::Renderer::BlendFunction::OneMinusSourceAlpha);
|
||||
GL::Renderer::setBlendEquation(GL::Renderer::BlendEquation::Add,
|
||||
|
@ -79,7 +77,7 @@ SaveTool::SaveTool(const Arguments& arguments):
|
|||
#endif
|
||||
|
||||
LOG_INFO("Registering custom events.");
|
||||
if((_initEventId = SDL_RegisterEvents(3)) == UnsignedInt(-1)) {
|
||||
if((_initEventId = SDL_RegisterEvents(3)) == std::uint32_t(-1)) {
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error",
|
||||
"SDL_RegisterEvents() failed in SaveTool::SaveTool(). Exiting...", window());
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -116,7 +114,7 @@ SaveTool::SaveTool(const Arguments& arguments):
|
|||
|
||||
checkGameState();
|
||||
_gameCheckTimerId = SDL_AddTimer(2000,
|
||||
[](UnsignedInt interval, void* param)->UnsignedInt{
|
||||
[](std::uint32_t interval, void* param)->std::uint32_t{
|
||||
static_cast<SaveTool*>(param)->checkGameState();
|
||||
return interval;
|
||||
}, this);
|
||||
|
@ -405,13 +403,13 @@ SaveTool::drawGameState() {
|
|||
}
|
||||
|
||||
void
|
||||
SaveTool::drawHelpMarker(Containers::StringView text, Float wrap_pos) {
|
||||
SaveTool::drawHelpMarker(Containers::StringView text, float wrap_pos) {
|
||||
ImGui::TextUnformatted(ICON_FA_QUESTION_CIRCLE);
|
||||
drawTooltip(text, wrap_pos);
|
||||
}
|
||||
|
||||
void
|
||||
SaveTool::drawTooltip(Containers::StringView text, Float wrap_pos) {
|
||||
SaveTool::drawTooltip(Containers::StringView text, float wrap_pos) {
|
||||
if(ImGui::IsItemHovered()){
|
||||
ImGui::BeginTooltip();
|
||||
if(wrap_pos > 0.0f) {
|
||||
|
|
|
@ -77,20 +77,20 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
|
||||
void anyEvent(SDL_Event& event) override;
|
||||
|
||||
enum InitStatus: Int {
|
||||
enum InitStatus: std::int32_t {
|
||||
InitSuccess,
|
||||
ProfileManagerFailure
|
||||
};
|
||||
void initEvent(SDL_Event& event);
|
||||
|
||||
enum UpdateCheckStatus : Int {
|
||||
enum UpdateCheckStatus : std::int32_t {
|
||||
CurlInitFailed = 0,
|
||||
CurlError = 1,
|
||||
CurlTimeout = 2,
|
||||
};
|
||||
void updateCheckEvent(SDL_Event& event);
|
||||
|
||||
enum FileEventType: Int {
|
||||
enum FileEventType: std::int32_t {
|
||||
FileAdded = efsw::Action::Add,
|
||||
FileDeleted = efsw::Action::Delete,
|
||||
FileModified = efsw::Action::Modified,
|
||||
|
@ -126,8 +126,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
void drawGeneralInfo();
|
||||
void drawResearchInventory();
|
||||
template<typename Getter, typename Setter>
|
||||
void drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter);
|
||||
void drawUnavailableMaterialRow(Containers::StringView name, Int tier);
|
||||
void drawMaterialRow(Containers::StringView name, std::int32_t tier, Getter getter, Setter setter);
|
||||
void drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier);
|
||||
void drawMassManager();
|
||||
ImGuiID drawDeleteMassPopup(int mass_index);
|
||||
ImGuiID drawDeleteStagedMassPopup(Containers::StringView filename);
|
||||
|
@ -148,7 +148,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
void drawTuning();
|
||||
void drawDecalEditor(Decal& decal);
|
||||
void drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<CustomStyle> style_view);
|
||||
Containers::StringView getStyleName(Int id, Containers::ArrayView<CustomStyle> view);
|
||||
Containers::StringView getStyleName(std::int32_t id, Containers::ArrayView<CustomStyle> view);
|
||||
|
||||
enum DCSResult {
|
||||
DCS_Fail,
|
||||
|
@ -161,8 +161,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
void drawGameState();
|
||||
|
||||
// Convenience wrappers over ImGui stuff
|
||||
void drawHelpMarker(Containers::StringView text, Float wrap_pos = 0.0f);
|
||||
void drawTooltip(Containers::StringView text, Float wrap_pos = 0.0f);
|
||||
void drawHelpMarker(Containers::StringView text, float wrap_pos = 0.0f);
|
||||
void drawTooltip(Containers::StringView text, float wrap_pos = 0.0f);
|
||||
bool drawCheckbox(Containers::StringView label, bool value);
|
||||
|
||||
template<typename Functor, typename... Args>
|
||||
|
@ -222,9 +222,9 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
std::thread _initThread;
|
||||
std::thread _updateThread;
|
||||
|
||||
UnsignedInt _initEventId;
|
||||
UnsignedInt _updateEventId;
|
||||
UnsignedInt _fileEventId;
|
||||
std::uint32_t _initEventId;
|
||||
std::uint32_t _updateEventId;
|
||||
std::uint32_t _fileEventId;
|
||||
|
||||
Containers::String _lastError;
|
||||
|
||||
|
@ -240,7 +240,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
//Containers::String _weaponsDir;
|
||||
//Containers::String _stylesDir;
|
||||
|
||||
enum class GameState : UnsignedByte {
|
||||
enum class GameState : std::uint8_t {
|
||||
Unknown, NotRunning, Running
|
||||
} _gameState{GameState::Unknown};
|
||||
|
||||
|
@ -270,12 +270,12 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
|
|||
bool _jointsDirty{false};
|
||||
bool _stylesDirty{false};
|
||||
bool _eyeFlareDirty{false};
|
||||
Containers::StaticArray<38, Int> _selectedArmourDecals{ValueInit};
|
||||
Containers::StaticArray<38, Int> _selectedArmourAccessories{ValueInit};
|
||||
Int _selectedBLPlacement{0};
|
||||
Int _selectedWeaponPart{0};
|
||||
Int _selectedWeaponDecal{0};
|
||||
Int _selectedWeaponAccessory{0};
|
||||
Containers::StaticArray<38, std::int32_t> _selectedArmourDecals{ValueInit};
|
||||
Containers::StaticArray<38, std::int32_t> _selectedArmourAccessories{ValueInit};
|
||||
std::int32_t _selectedBLPlacement{0};
|
||||
std::int32_t _selectedWeaponPart{0};
|
||||
std::int32_t _selectedWeaponDecal{0};
|
||||
std::int32_t _selectedWeaponAccessory{0};
|
||||
bool _meleeDirty{false};
|
||||
bool _shieldsDirty{false};
|
||||
bool _bShootersDirty{false};
|
||||
|
|
|
@ -73,8 +73,8 @@ SaveTool::fileUpdateEvent(SDL_Event& event) {
|
|||
|
||||
Containers::String old_filename;
|
||||
|
||||
Int index = 0;
|
||||
Int old_index = 0;
|
||||
std::int32_t index = 0;
|
||||
std::int32_t old_index = 0;
|
||||
bool is_current_profile = filename == _currentProfile->filename();
|
||||
bool is_unit = filename.hasPrefix(_currentProfile->isDemo() ? "DemoUnit"_s : "Unit"_s);
|
||||
if(is_unit) {
|
||||
|
|
|
@ -73,7 +73,7 @@ SaveTool::initialiseGui() {
|
|||
font_config.FontDataOwnedByAtlas = false;
|
||||
std::strcpy(font_config.Name, "Source Sans Pro");
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<char*>(reg_font.data()), int(reg_font.size()),
|
||||
20.0f * Float(framebufferSize().x()) / size.x(), &font_config);
|
||||
20.0f * float(framebufferSize().x()) / size.x(), &font_config);
|
||||
|
||||
auto icon_font = _rs.getRaw(FONT_ICON_FILE_NAME_FAS);
|
||||
static const ImWchar icon_range[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
||||
|
@ -84,12 +84,12 @@ SaveTool::initialiseGui() {
|
|||
icon_config.OversampleH = icon_config.OversampleV = 1;
|
||||
icon_config.GlyphMinAdvanceX = 18.0f;
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<char*>(icon_font.data()), int(icon_font.size()),
|
||||
16.0f * Float(framebufferSize().x()) / size.x(), &icon_config, icon_range);
|
||||
16.0f * float(framebufferSize().x()) / size.x(), &icon_config, icon_range);
|
||||
|
||||
auto brand_font = _rs.getRaw(FONT_ICON_FILE_NAME_FAB);
|
||||
static const ImWchar brand_range[] = { ICON_MIN_FAB, ICON_MAX_FAB, 0 };
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<char*>(brand_font.data()), int(brand_font.size()),
|
||||
16.0f * Float(framebufferSize().x()) / size.x(), &icon_config, brand_range);
|
||||
16.0f * float(framebufferSize().x()) / size.x(), &icon_config, brand_range);
|
||||
|
||||
auto mono_font = _rs.getRaw("SourceCodePro-Regular.ttf"_s);
|
||||
ImVector<ImWchar> range;
|
||||
|
@ -98,7 +98,7 @@ SaveTool::initialiseGui() {
|
|||
builder.AddChar(u'š'); // This allows displaying Vladimír Vondruš' name in Corrade's and Magnum's licences.
|
||||
builder.BuildRanges(&range);
|
||||
io.Fonts->AddFontFromMemoryTTF(const_cast<char*>(mono_font.data()), int(mono_font.size()),
|
||||
18.0f * Float(framebufferSize().x()) / size.x(), &font_config, range.Data);
|
||||
18.0f * float(framebufferSize().x()) / size.x(), &font_config, range.Data);
|
||||
|
||||
_imgui = ImGuiIntegration::Context(*ImGui::GetCurrentContext(), windowSize());
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
void
|
||||
SaveTool::drawManager() {
|
||||
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y},
|
||||
ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y},
|
||||
ImGuiCond_Always);
|
||||
if(!ImGui::Begin("##MainWindow", nullptr,
|
||||
ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove|
|
||||
|
@ -210,7 +210,7 @@ SaveTool::drawGeneralInfo() {
|
|||
drawTooltip("This is the last mission selected in the mission selection screen, not the last mission played.",
|
||||
float(windowSize().x()) * 0.35f);
|
||||
|
||||
const Float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||
ImGui::Dummy({ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y - footer_height_to_reserve});
|
||||
|
||||
ImGui::Separator();
|
||||
|
@ -235,7 +235,7 @@ SaveTool::drawGeneralInfo() {
|
|||
|
||||
ImGui::SameLine();
|
||||
|
||||
static Int credits;
|
||||
static std::int32_t credits;
|
||||
if(drawUnsafeWidget([]{ return ImGui::Button("Edit credits"); })) {
|
||||
credits = _currentProfile->credits();
|
||||
ImGui::OpenPopup("int_edit");
|
||||
|
@ -302,22 +302,22 @@ SaveTool::drawResearchInventory() {
|
|||
|
||||
drawMaterialRow("Verse steel", 1,
|
||||
[this]{ return _currentProfile->verseSteel(); },
|
||||
[this](Int amount){ return _currentProfile->setVerseSteel(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setVerseSteel(amount); });
|
||||
drawMaterialRow("Undinium", 2,
|
||||
[this]{ return _currentProfile->undinium(); },
|
||||
[this](Int amount){ return _currentProfile->setUndinium(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setUndinium(amount); });
|
||||
drawMaterialRow("Necrium alloy", 3,
|
||||
[this]{ return _currentProfile->necriumAlloy(); },
|
||||
[this](Int amount){ return _currentProfile->setNecriumAlloy(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setNecriumAlloy(amount); });
|
||||
drawMaterialRow("Lunarite", 4,
|
||||
[this]{ return _currentProfile->lunarite(); },
|
||||
[this](Int amount){ return _currentProfile->setLunarite(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setLunarite(amount); });
|
||||
drawMaterialRow("Asterite", 5,
|
||||
[this]{ return _currentProfile->asterite(); },
|
||||
[this](Int amount){ return _currentProfile->setAsterite(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setAsterite(amount); });
|
||||
drawMaterialRow("Hallite fragma", 6,
|
||||
[this]{ return _currentProfile->halliteFragma(); },
|
||||
[this](Int amount){ return _currentProfile->setHalliteFragma(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setHalliteFragma(amount); });
|
||||
drawUnavailableMaterialRow("Unnoctinium", 7);
|
||||
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
|
@ -326,22 +326,22 @@ SaveTool::drawResearchInventory() {
|
|||
|
||||
drawMaterialRow("Ednil", 1,
|
||||
[this]{ return _currentProfile->ednil(); },
|
||||
[this](Int amount){ return _currentProfile->setEdnil(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setEdnil(amount); });
|
||||
drawMaterialRow("Nuflalt", 2,
|
||||
[this]{ return _currentProfile->nuflalt(); },
|
||||
[this](Int amount){ return _currentProfile->setNuflalt(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setNuflalt(amount); });
|
||||
drawMaterialRow("Aurelene", 3,
|
||||
[this]{ return _currentProfile->aurelene(); },
|
||||
[this](Int amount){ return _currentProfile->setAurelene(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setAurelene(amount); });
|
||||
drawMaterialRow("Soldus", 4,
|
||||
[this]{ return _currentProfile->soldus(); },
|
||||
[this](Int amount){ return _currentProfile->setSoldus(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setSoldus(amount); });
|
||||
drawMaterialRow("Synthesized N", 5,
|
||||
[this]{ return _currentProfile->synthesisedN(); },
|
||||
[this](Int amount){ return _currentProfile->setSynthesisedN(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setSynthesisedN(amount); });
|
||||
drawMaterialRow("Nanoc", 6,
|
||||
[this]{ return _currentProfile->nanoc(); },
|
||||
[this](Int amount){ return _currentProfile->setNanoc(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setNanoc(amount); });
|
||||
drawUnavailableMaterialRow("Abyssillite", 7);
|
||||
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
|
@ -350,22 +350,22 @@ SaveTool::drawResearchInventory() {
|
|||
|
||||
drawMaterialRow("Alcarbonite", 1,
|
||||
[this]{ return _currentProfile->alcarbonite(); },
|
||||
[this](Int amount){ return _currentProfile->setAlcarbonite(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setAlcarbonite(amount); });
|
||||
drawMaterialRow("Keripehene", 2,
|
||||
[this]{ return _currentProfile->keriphene(); },
|
||||
[this](Int amount){ return _currentProfile->setKeriphene(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setKeriphene(amount); });
|
||||
drawMaterialRow("Nitinol-CM", 3,
|
||||
[this]{ return _currentProfile->nitinolCM(); },
|
||||
[this](Int amount){ return _currentProfile->setNitinolCM(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setNitinolCM(amount); });
|
||||
drawMaterialRow("Quarkium", 4,
|
||||
[this]{ return _currentProfile->quarkium(); },
|
||||
[this](Int amount){ return _currentProfile->setQuarkium(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setQuarkium(amount); });
|
||||
drawMaterialRow("Alterene", 5,
|
||||
[this]{ return _currentProfile->alterene(); },
|
||||
[this](Int amount){ return _currentProfile->setAlterene(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setAlterene(amount); });
|
||||
drawMaterialRow("Cosmium", 6,
|
||||
[this]{ return _currentProfile->cosmium(); },
|
||||
[this](Int amount){ return _currentProfile->setCosmium(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setCosmium(amount); });
|
||||
drawUnavailableMaterialRow("Purified quarkium", 7);
|
||||
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||
|
@ -374,22 +374,22 @@ SaveTool::drawResearchInventory() {
|
|||
|
||||
drawMaterialRow("Mixed composition", 1,
|
||||
[this]{ return _currentProfile->mixedComposition(); },
|
||||
[this](Int amount){ return _currentProfile->setMixedComposition(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setMixedComposition(amount); });
|
||||
drawMaterialRow("Void residue", 2,
|
||||
[this]{ return _currentProfile->voidResidue(); },
|
||||
[this](Int amount){ return _currentProfile->setVoidResidue(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setVoidResidue(amount); });
|
||||
drawMaterialRow("Muscular construction", 3,
|
||||
[this]{ return _currentProfile->muscularConstruction(); },
|
||||
[this](Int amount){ return _currentProfile->setMuscularConstruction(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setMuscularConstruction(amount); });
|
||||
drawMaterialRow("Mineral exoskeletology", 4,
|
||||
[this]{ return _currentProfile->mineralExoskeletology(); },
|
||||
[this](Int amount){ return _currentProfile->setMineralExoskeletology(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setMineralExoskeletology(amount); });
|
||||
drawMaterialRow("Carbonized skin", 5,
|
||||
[this]{ return _currentProfile->carbonisedSkin(); },
|
||||
[this](Int amount){ return _currentProfile->setCarbonisedSkin(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setCarbonisedSkin(amount); });
|
||||
drawMaterialRow("Isolated void particle", 6,
|
||||
[this]{ return _currentProfile->isolatedVoidParticle(); },
|
||||
[this](Int amount){ return _currentProfile->setIsolatedVoidParticle(amount); });
|
||||
[this](std::int32_t amount){ return _currentProfile->setIsolatedVoidParticle(amount); });
|
||||
drawUnavailableMaterialRow("Weaponised physiology", 7);
|
||||
|
||||
ImGui::EndTable();
|
||||
|
@ -398,9 +398,9 @@ SaveTool::drawResearchInventory() {
|
|||
|
||||
template<typename Getter, typename Setter>
|
||||
void
|
||||
SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter) {
|
||||
static_assert(std::is_same<decltype(getter()), Int>::value, "getter doesn't return an Int, and/or doesn't take zero arguments.");
|
||||
static_assert(std::is_same<decltype(setter(0)), bool>::value, "setter doesn't return a bool, and/or doesn't take a single Int as an argument.");
|
||||
SaveTool::drawMaterialRow(Containers::StringView name, std::int32_t tier, Getter getter, Setter setter) {
|
||||
static_assert(std::is_same<decltype(getter()), std::int32_t>::value, "getter doesn't return an std::int32_t, and/or doesn't take zero arguments.");
|
||||
static_assert(std::is_same<decltype(setter(0)), bool>::value, "setter doesn't return a bool, and/or doesn't take a single std::int32_t as an argument.");
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
|
@ -413,7 +413,7 @@ SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter,
|
|||
if(conf().cheatMode()) {
|
||||
ImGui::TableSetColumnIndex(3);
|
||||
ImGui::PushID(name.data());
|
||||
static Int var = 0;
|
||||
static std::int32_t var = 0;
|
||||
if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_EDIT)) {
|
||||
(var) = getter();
|
||||
ImGui::OpenPopup("int_edit");
|
||||
|
@ -433,7 +433,7 @@ SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter,
|
|||
}
|
||||
|
||||
void
|
||||
SaveTool::drawUnavailableMaterialRow(Containers::StringView name, Int tier) {
|
||||
SaveTool::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::Text("T%i", tier);
|
||||
|
|
|
@ -38,7 +38,7 @@ SaveTool::drawMassViewer() {
|
|||
}
|
||||
|
||||
ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y},
|
||||
ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y},
|
||||
ImGuiCond_Always);
|
||||
if(!ImGui::Begin("##MassViewer", nullptr,
|
||||
ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove|
|
||||
|
@ -86,8 +86,8 @@ SaveTool::drawMassViewer() {
|
|||
_jointsDirty = false;
|
||||
_stylesDirty = false;
|
||||
_eyeFlareDirty = false;
|
||||
_selectedArmourDecals = Containers::StaticArray<38, Int>{ValueInit};
|
||||
_selectedArmourAccessories = Containers::StaticArray<38, Int>{ValueInit};
|
||||
_selectedArmourDecals = Containers::StaticArray<38, std::int32_t>{ValueInit};
|
||||
_selectedArmourAccessories = Containers::StaticArray<38, std::int32_t>{ValueInit};
|
||||
_selectedBLPlacement = 0;
|
||||
_selectedWeaponPart = 0;
|
||||
_selectedWeaponDecal = 0;
|
||||
|
@ -168,7 +168,7 @@ SaveTool::drawGlobalStyles() {
|
|||
|
||||
ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game.");
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->globalStyles().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->globalStyles().size(); i++) {
|
||||
ImGui::PushID(int(i));
|
||||
DCSResult result;
|
||||
result = drawCustomStyle(_currentMass->globalStyles()[i]);
|
||||
|
@ -225,7 +225,7 @@ SaveTool::drawTuning() {
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Gears");
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->gears().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->gears().size(); i++) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%i", _currentMass->gears()[i]);
|
||||
|
@ -251,7 +251,7 @@ SaveTool::drawTuning() {
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Modules");
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->modules().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->modules().size(); i++) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%i", _currentMass->modules()[i]);
|
||||
|
@ -277,7 +277,7 @@ SaveTool::drawTuning() {
|
|||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted("Techs");
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->techs().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->techs().size(); i++) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text("%i", _currentMass->techs()[i]);
|
||||
|
@ -515,7 +515,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<Custom
|
|||
|
||||
ImGui::SameLine();
|
||||
|
||||
static Int tab = 0;
|
||||
static std::int32_t tab = 0;
|
||||
static Containers::Optional<AccessorySize> size = Containers::NullOpt;
|
||||
if(ImGui::SmallButton("Change")) {
|
||||
ImGui::OpenPopup("##AccessoryPopup");
|
||||
|
@ -539,7 +539,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<Custom
|
|||
"L",
|
||||
"XL"
|
||||
};
|
||||
static const Float selectable_width = 90.0f;
|
||||
static const float selectable_width = 90.0f;
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f});
|
||||
if(ImGui::Selectable("Primitives", tab == 0, ImGuiSelectableFlags_DontClosePopups, {selectable_width, 0.0f})) {
|
||||
|
@ -740,7 +740,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<Custom
|
|||
}
|
||||
|
||||
Containers::StringView
|
||||
SaveTool::getStyleName(Int id, Containers::ArrayView<CustomStyle> view) {
|
||||
SaveTool::getStyleName(std::int32_t id, Containers::ArrayView<CustomStyle> view) {
|
||||
if(id >= 0 && id <= 15) {
|
||||
return view[id].name;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ SaveTool::drawArmour() {
|
|||
#undef c
|
||||
};
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->armourParts().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->armourParts().size(); i++) {
|
||||
ImGui::PushID(int(i));
|
||||
|
||||
auto& part = _currentMass->armourParts()[i];
|
||||
|
@ -53,10 +53,10 @@ SaveTool::drawArmour() {
|
|||
std::memset(header, '\0', 129);
|
||||
|
||||
if(armour_sets.find(part.id) != armour_sets.cend()) {
|
||||
std::snprintf(header, 128, "%s: %s###%u", slot_labels[UnsignedInt(part.slot)].data(), armour_sets.at(part.id).name.data(), UnsignedInt(part.slot));
|
||||
std::snprintf(header, 128, "%s: %s###%u", slot_labels[std::uint32_t(part.slot)].data(), armour_sets.at(part.id).name.data(), std::uint32_t(part.slot));
|
||||
}
|
||||
else {
|
||||
std::snprintf(header, 128, "%s: %i###%u", slot_labels[UnsignedInt(part.slot)].data(), part.id, UnsignedInt(part.slot));
|
||||
std::snprintf(header, 128, "%s: %i###%u", slot_labels[std::uint32_t(part.slot)].data(), part.id, std::uint32_t(part.slot));
|
||||
}
|
||||
|
||||
if(ImGui::CollapsingHeader(header)) {
|
||||
|
@ -64,7 +64,7 @@ SaveTool::drawArmour() {
|
|||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.491f);
|
||||
if(ImGui::BeginListBox("##ChangePart")) {
|
||||
if(std::strncmp("Neck", slot_labels[UnsignedInt(part.slot)].data(), 4) != 0) {
|
||||
if(std::strncmp("Neck", slot_labels[std::uint32_t(part.slot)].data(), 4) != 0) {
|
||||
for(auto& set : armour_sets) {
|
||||
if(ImGui::Selectable(set.second.name.data(), set.first == part.id, ImGuiSelectableFlags_SpanAvailWidth)) {
|
||||
part.id = set.first;
|
||||
|
@ -97,7 +97,7 @@ SaveTool::drawArmour() {
|
|||
|
||||
ImGui::TextUnformatted("Styles:");
|
||||
|
||||
for(Int j = 0; j < 4; j++) {
|
||||
for(std::int32_t j = 0; j < 4; j++) {
|
||||
drawAlignedText("Slot %d:", j + 1);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
@ -125,7 +125,7 @@ SaveTool::drawArmour() {
|
|||
ImGui::PushID("Decal");
|
||||
|
||||
drawAlignedText("Showing/editing decal");
|
||||
for(UnsignedInt j = 0; j < part.decals.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < part.decals.size(); j++) {
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], int(j));
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ SaveTool::drawArmour() {
|
|||
ImGui::PushID("Accessory");
|
||||
|
||||
drawAlignedText("Showing/editing accessory");
|
||||
for(UnsignedInt j = 0; j < part.accessories.size(); j++) {
|
||||
for(std::uint32_t j = 0; j < part.accessories.size(); j++) {
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &_selectedArmourAccessories[i], int(j));
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ SaveTool::drawArmour() {
|
|||
|
||||
drawAlignedText("Socket:");
|
||||
ImGui::SameLine();
|
||||
if(ImGui::BeginCombo("##Socket", socket_labels[UnsignedInt(placement.socket)].data())) {
|
||||
for(UnsignedInt i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) {
|
||||
if(ImGui::Selectable(socket_labels[i].data(), i == UnsignedInt(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) {
|
||||
if(ImGui::BeginCombo("##Socket", socket_labels[std::uint32_t(placement.socket)].data())) {
|
||||
for(std::uint32_t i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) {
|
||||
if(ImGui::Selectable(socket_labels[i].data(), i == std::uint32_t(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) {
|
||||
placement.socket = static_cast<BulletLauncherSocket>(i);
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ SaveTool::drawCustomArmourStyles() {
|
|||
|
||||
ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game.");
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->armourCustomStyles().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->armourCustomStyles().size(); i++) {
|
||||
ImGui::PushID(int(i));
|
||||
DCSResult result;
|
||||
result = drawCustomStyle(_currentMass->armourCustomStyles()[i]);
|
||||
|
|
|
@ -202,7 +202,7 @@ SaveTool::drawFrameStyles() {
|
|||
return;
|
||||
}
|
||||
|
||||
for(Int i = 0; i < 4; i++) {
|
||||
for(std::int32_t i = 0; i < 4; i++) {
|
||||
drawAlignedText("Slot %d:", i + 1);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
@ -294,7 +294,7 @@ SaveTool::drawCustomFrameStyles() {
|
|||
|
||||
ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game.");
|
||||
|
||||
for(UnsignedInt i = 0; i < _currentMass->frameCustomStyles().size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _currentMass->frameCustomStyles().size(); i++) {
|
||||
ImGui::PushID(int(i));
|
||||
DCSResult result;
|
||||
result = drawCustomStyle(_currentMass->frameCustomStyles()[i]);
|
||||
|
|
|
@ -28,7 +28,7 @@ SaveTool::drawWeapons() {
|
|||
return;
|
||||
}
|
||||
|
||||
const Float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
|
@ -265,7 +265,7 @@ SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView<
|
|||
|
||||
ImGui::PushID(payload_type.data());
|
||||
|
||||
for(UnsignedInt i = 0; i < weapons_view.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < weapons_view.size(); i++) {
|
||||
auto& weapon = weapons_view[i];
|
||||
|
||||
ImGui::TableNextRow();
|
||||
|
@ -277,7 +277,7 @@ SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView<
|
|||
_currentWeapon = &weapon;
|
||||
}
|
||||
if(ImGui::BeginDragDropSource()) {
|
||||
ImGui::SetDragDropPayload(payload_type.data(), &i, sizeof(UnsignedInt));
|
||||
ImGui::SetDragDropPayload(payload_type.data(), &i, sizeof(std::uint32_t));
|
||||
if(ImGui::GetIO().KeyCtrl) {
|
||||
ImGui::Text("%s %i - %s (copy)", payload_tooltip.data(), i + 1, weapon.name.data());
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
#undef c
|
||||
};
|
||||
|
||||
drawAlignedText("%s: %s", labels[UnsignedInt(weapon.type)].data(), weapon.name.data());
|
||||
drawAlignedText("%s: %s", labels[std::uint32_t(weapon.type)].data(), weapon.name.data());
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
|
@ -428,8 +428,8 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
|
||||
if(ImGui::CollapsingHeader("Weapon parts")) {
|
||||
drawAlignedText("Viewing/editing part:");
|
||||
for(Int i = 0; UnsignedLong(i) < weapon.parts.size(); i++) {
|
||||
if(UnsignedLong(_selectedWeaponPart) >= weapon.parts.size()) {
|
||||
for(std::int32_t i = 0; std::size_t(i) < weapon.parts.size(); i++) {
|
||||
if(std::size_t(_selectedWeaponPart) >= weapon.parts.size()) {
|
||||
_selectedWeaponPart = 0;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
|
@ -438,7 +438,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
|
||||
auto& part = weapon.parts[_selectedWeaponPart];
|
||||
|
||||
const auto* map = [this, &weapon]()-> const std::map<Int, Containers::StringView>* {
|
||||
const auto* map = [this, &weapon]()-> const std::map<std::int32_t, Containers::StringView>* {
|
||||
switch(weapon.type) {
|
||||
case WeaponType::Melee:
|
||||
return _selectedWeaponPart == 0 ? &melee_grips : &melee_assaulters;
|
||||
|
@ -511,7 +511,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
if(ImGui::BeginChild("##PartDetails", {0.0f, 0.0f}, true)) {
|
||||
ImGui::TextUnformatted("Styles:");
|
||||
|
||||
for(Int i = 0; i < 4; i++) {
|
||||
for(std::int32_t i = 0; i < 4; i++) {
|
||||
drawAlignedText("Slot %d:", i + 1);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
@ -537,7 +537,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
ImGui::PushID("Decal");
|
||||
|
||||
drawAlignedText("Showing/editing decal");
|
||||
for(UnsignedLong i = 0; i < part.decals.size(); i++) {
|
||||
for(std::size_t i = 0; i < part.decals.size(); i++) {
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponDecal, int(i));
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) {
|
|||
ImGui::PushID("Accessory");
|
||||
|
||||
drawAlignedText("Showing/editing accessory");
|
||||
for(UnsignedLong i = 0; i < part.accessories.size(); i++) {
|
||||
for(std::size_t i = 0; i < part.accessories.size(); i++) {
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(std::string{char(65 + i)}.c_str(), &_selectedWeaponAccessory, int(i));
|
||||
}
|
||||
|
|
|
@ -73,10 +73,10 @@ SaveTool::updateCheckEvent(SDL_Event& event) {
|
|||
prerelease = true;
|
||||
}
|
||||
}
|
||||
Int fullVersion;
|
||||
Int major = 0;
|
||||
Int minor = 0;
|
||||
Int patch = 0;
|
||||
std::int32_t fullVersion;
|
||||
std::int32_t major = 0;
|
||||
std::int32_t minor = 0;
|
||||
std::int32_t patch = 0;
|
||||
bool prerelease = false;
|
||||
|
||||
bool operator==(const Version& other) const {
|
||||
|
@ -161,7 +161,7 @@ SaveTool::checkForUpdates() {
|
|||
if(code == CURLE_OK) {
|
||||
long status = 0;
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
|
||||
event.user.code = Int(status);
|
||||
event.user.code = std::int32_t(status);
|
||||
event.user.data1 = response_body.release();
|
||||
}
|
||||
else if(code == CURLE_OPERATION_TIMEDOUT) {
|
||||
|
|
|
@ -113,7 +113,7 @@ SaveTool::drawMainMenu() {
|
|||
ImGui::SameLine();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
drawHelpMarker("This gives access to save edition features that can be considered cheats.",
|
||||
Float(windowSize().x()) * 0.4f);
|
||||
float(windowSize().x()) * 0.4f);
|
||||
|
||||
if(drawCheckbox("Advanced mode", conf().advancedMode())) {
|
||||
conf().setAdvancedMode(!conf().advancedMode());
|
||||
|
@ -121,7 +121,7 @@ SaveTool::drawMainMenu() {
|
|||
ImGui::SameLine();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
drawHelpMarker("This gives access to editing values that have unknown purposes or are undocumented.",
|
||||
Float(windowSize().x()) * 0.4f);
|
||||
float(windowSize().x()) * 0.4f);
|
||||
|
||||
if(drawCheckbox("Check for updates on startup", conf().checkUpdatesOnStartup())) {
|
||||
conf().setCheckUpdatesOnStartup(!conf().checkUpdatesOnStartup());
|
||||
|
|
|
@ -26,15 +26,15 @@
|
|||
|
||||
using namespace Containers::Literals;
|
||||
|
||||
constexpr UnsignedInt success_colour = 0xff67d23bu;
|
||||
constexpr UnsignedInt info_colour = 0xffcc832fu;
|
||||
constexpr UnsignedInt warning_colour = 0xff2fcfc7u;
|
||||
constexpr UnsignedInt error_colour = 0xff3134cdu;
|
||||
constexpr std::uint32_t success_colour = 0xff67d23bu;
|
||||
constexpr std::uint32_t info_colour = 0xffcc832fu;
|
||||
constexpr std::uint32_t warning_colour = 0xff2fcfc7u;
|
||||
constexpr std::uint32_t error_colour = 0xff3134cdu;
|
||||
|
||||
constexpr UnsignedInt fade_time = 150;
|
||||
constexpr Float base_opacity = 1.0f;
|
||||
constexpr std::uint32_t fade_time = 150;
|
||||
constexpr float base_opacity = 1.0f;
|
||||
constexpr Vector2 padding{20.0f, 20.0f};
|
||||
constexpr Float toast_spacing = 10.0f;
|
||||
constexpr float toast_spacing = 10.0f;
|
||||
|
||||
Toast::Toast(Type type, Containers::StringView message, std::chrono::milliseconds timeout):
|
||||
_type{type},
|
||||
|
@ -42,7 +42,7 @@ Toast::Toast(Type type, Containers::StringView message, std::chrono::millisecond
|
|||
_timeout{timeout},
|
||||
_creationTime{std::chrono::steady_clock::now()}
|
||||
{
|
||||
_phaseTrack = Animation::Track<UnsignedInt, Phase>{{
|
||||
_phaseTrack = Animation::Track<std::uint32_t, Phase>{{
|
||||
{0, Phase::FadeIn},
|
||||
{fade_time, Phase::Wait},
|
||||
{fade_time + timeout.count(), Phase::FadeOut},
|
||||
|
@ -80,16 +80,16 @@ Toast::phase() {
|
|||
return _phaseTrack.at(elapsedTime().count());
|
||||
}
|
||||
|
||||
Float
|
||||
float
|
||||
Toast::opacity() {
|
||||
Phase phase = this->phase();
|
||||
Long elapsed_time = elapsedTime().count();
|
||||
std::int64_t elapsed_time = elapsedTime().count();
|
||||
|
||||
if(phase == Phase::FadeIn) {
|
||||
return Float(elapsed_time) / Float(fade_time);
|
||||
return float(elapsed_time) / float(fade_time);
|
||||
}
|
||||
else if(phase == Phase::FadeOut) {
|
||||
return 1.0f - ((Float(elapsed_time) - Float(fade_time) - Float(_timeout.count())) / Float(fade_time));
|
||||
return 1.0f - ((float(elapsed_time) - float(fade_time) - float(_timeout.count())) / float(fade_time));
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
|
@ -107,9 +107,9 @@ ToastQueue::addToast(Toast::Type type, Containers::StringView message, std::chro
|
|||
|
||||
void
|
||||
ToastQueue::draw(Vector2i viewport_size) {
|
||||
Float height = 0.0f;
|
||||
float height = 0.0f;
|
||||
|
||||
for(UnsignedInt i = 0; i < _toasts.size(); i++) {
|
||||
for(std::uint32_t i = 0; i < _toasts.size(); i++) {
|
||||
Toast* current = &_toasts[i];
|
||||
|
||||
if(current->phase() == Toast::Phase::TimedOut) {
|
||||
|
@ -119,11 +119,12 @@ ToastQueue::draw(Vector2i viewport_size) {
|
|||
|
||||
Containers::String win_id = Utility::format("##Toast{}", i);
|
||||
|
||||
Float opacity = base_opacity * current->opacity();
|
||||
float opacity = base_opacity * current->opacity();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, opacity);
|
||||
|
||||
ImGui::SetNextWindowPos({viewport_size.x() - padding.x(), viewport_size.y() - padding.y() - height}, ImGuiCond_Always, {1.0f, 1.0f});
|
||||
ImGui::SetNextWindowPos({float(viewport_size.x()) - padding.x(), float(viewport_size.y()) - padding.y() - height},
|
||||
ImGuiCond_Always, {1.0f, 1.0f});
|
||||
if(ImGui::Begin(win_id.data(), nullptr,
|
||||
ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoDecoration|
|
||||
ImGuiWindowFlags_NoInputs|ImGuiWindowFlags_NoNav|ImGuiWindowFlags_NoFocusOnAppearing))
|
||||
|
@ -168,6 +169,6 @@ ToastQueue::draw(Vector2i viewport_size) {
|
|||
}
|
||||
|
||||
void
|
||||
ToastQueue::removeToast(Long index) {
|
||||
ToastQueue::removeToast(std::int64_t index) {
|
||||
_toasts.erase(_toasts.begin() + index);
|
||||
}
|
||||
|
|
|
@ -29,11 +29,11 @@ using namespace Magnum;
|
|||
|
||||
class Toast {
|
||||
public:
|
||||
enum class Type : UnsignedByte {
|
||||
enum class Type: std::uint8_t {
|
||||
Default, Success, Info, Warning, Error
|
||||
};
|
||||
|
||||
enum class Phase : UnsignedByte {
|
||||
enum class Phase: std::uint8_t {
|
||||
FadeIn, Wait, FadeOut, TimedOut
|
||||
};
|
||||
|
||||
|
@ -58,14 +58,14 @@ class Toast {
|
|||
|
||||
Phase phase();
|
||||
|
||||
Float opacity();
|
||||
float opacity();
|
||||
|
||||
private:
|
||||
Type _type{Type::Default};
|
||||
Containers::String _message;
|
||||
std::chrono::milliseconds _timeout;
|
||||
std::chrono::steady_clock::time_point _creationTime;
|
||||
Animation::Track<UnsignedInt, Phase> _phaseTrack;
|
||||
Animation::Track<std::uint32_t, Phase> _phaseTrack;
|
||||
};
|
||||
|
||||
class ToastQueue {
|
||||
|
@ -78,7 +78,7 @@ class ToastQueue {
|
|||
void draw(Vector2i viewport_size);
|
||||
|
||||
private:
|
||||
void removeToast(Long index);
|
||||
void removeToast(std::int64_t index);
|
||||
|
||||
std::vector<Toast> _toasts;
|
||||
};
|
||||
|
|
|
@ -45,13 +45,13 @@ BinaryReader::eof() {
|
|||
return std::feof(_file) != 0;
|
||||
}
|
||||
|
||||
Long
|
||||
std::int64_t
|
||||
BinaryReader::position() {
|
||||
return _ftelli64(_file);
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::seek(Long position) {
|
||||
BinaryReader::seek(std::int64_t position) {
|
||||
return _fseeki64(_file, position, SEEK_SET) == 0;
|
||||
}
|
||||
|
||||
|
@ -67,53 +67,53 @@ BinaryReader::readChar(char& value) {
|
|||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readByte(Byte& value) {
|
||||
return std::fread(&value, sizeof(Byte), 1, _file) == 1;
|
||||
BinaryReader::readInt8(std::int8_t& value) {
|
||||
return std::fread(&value, sizeof(std::int8_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readUnsignedByte(UnsignedByte& value) {
|
||||
return std::fread(&value, sizeof(UnsignedByte), 1, _file) == 1;
|
||||
BinaryReader::readUint8(std::uint8_t& value) {
|
||||
return std::fread(&value, sizeof(std::uint8_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readShort(Short& value) {
|
||||
return std::fread(&value, sizeof(Short), 1, _file) == 1;
|
||||
BinaryReader::readInt16(std::int16_t& value) {
|
||||
return std::fread(&value, sizeof(std::int16_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readUnsignedShort(UnsignedShort& value) {
|
||||
return std::fread(&value, sizeof(UnsignedShort), 1, _file) == 1;
|
||||
BinaryReader::readUint16(std::uint16_t& value) {
|
||||
return std::fread(&value, sizeof(std::uint16_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readInt(Int& value) {
|
||||
return std::fread(&value, sizeof(Int), 1, _file) == 1;
|
||||
BinaryReader::readInt32(std::int32_t& value) {
|
||||
return std::fread(&value, sizeof(std::int32_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readUnsignedInt(UnsignedInt& value) {
|
||||
return std::fread(&value, sizeof(UnsignedInt), 1, _file) == 1;
|
||||
BinaryReader::readUint32(std::uint32_t& value) {
|
||||
return std::fread(&value, sizeof(std::uint32_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readLong(Long& value) {
|
||||
return std::fread(&value, sizeof(Long), 1, _file) == 1;
|
||||
BinaryReader::readInt64(std::int64_t& value) {
|
||||
return std::fread(&value, sizeof(std::int64_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readUnsignedLong(UnsignedLong& value) {
|
||||
return std::fread(&value, sizeof(UnsignedLong), 1, _file) == 1;
|
||||
BinaryReader::readUint64(std::uint64_t& value) {
|
||||
return std::fread(&value, sizeof(std::uint64_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readFloat(Float& value) {
|
||||
return std::fread(&value, sizeof(Float), 1, _file) == 1;
|
||||
BinaryReader::readFloat(float& value) {
|
||||
return std::fread(&value, sizeof(float), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryReader::readDouble(Double& value) {
|
||||
return std::fread(&value, sizeof(Double), 1, _file) == 1;
|
||||
BinaryReader::readDouble(double& value) {
|
||||
return std::fread(&value, sizeof(double), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -127,8 +127,8 @@ BinaryReader::readArray(Containers::Array<char>& array, std::size_t count) {
|
|||
|
||||
bool
|
||||
BinaryReader::readUEString(Containers::String& str) {
|
||||
UnsignedInt length = 0;
|
||||
if(!readUnsignedInt(length) || length == 0) {
|
||||
std::uint32_t length = 0;
|
||||
if(!readUint32(length) || length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -137,9 +137,9 @@ BinaryReader::readUEString(Containers::String& str) {
|
|||
return std::fread(str.data(), sizeof(char), length, _file) == length;
|
||||
}
|
||||
|
||||
Int
|
||||
std::int32_t
|
||||
BinaryReader::peekChar() {
|
||||
Int c;
|
||||
std::int32_t c;
|
||||
c = std::fgetc(_file);
|
||||
std::ungetc(c, _file);
|
||||
return c;
|
||||
|
|
|
@ -16,16 +16,14 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
#include <Corrade/Containers/Containers.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class BinaryReader {
|
||||
public:
|
||||
|
@ -34,23 +32,23 @@ class BinaryReader {
|
|||
|
||||
bool open();
|
||||
bool eof();
|
||||
Long position();
|
||||
std::int64_t position();
|
||||
|
||||
bool seek(Long position);
|
||||
bool seek(std::int64_t position);
|
||||
|
||||
void closeFile();
|
||||
|
||||
bool readChar(char& value);
|
||||
bool readByte(Byte& value);
|
||||
bool readUnsignedByte(UnsignedByte& value);
|
||||
bool readShort(Short& value);
|
||||
bool readUnsignedShort(UnsignedShort& value);
|
||||
bool readInt(Int& value);
|
||||
bool readUnsignedInt(UnsignedInt& value);
|
||||
bool readLong(Long& value);
|
||||
bool readUnsignedLong(UnsignedLong& value);
|
||||
bool readFloat(Float& value);
|
||||
bool readDouble(Double& value);
|
||||
bool readInt8(std::int8_t& value);
|
||||
bool readUint8(std::uint8_t& value);
|
||||
bool readInt16(std::int16_t& value);
|
||||
bool readUint16(std::uint16_t& value);
|
||||
bool readInt32(std::int32_t& value);
|
||||
bool readUint32(std::uint32_t& value);
|
||||
bool readInt64(std::int64_t& value);
|
||||
bool readUint64(std::uint64_t& value);
|
||||
bool readFloat(float& value);
|
||||
bool readDouble(double& value);
|
||||
bool readArray(Containers::Array<char>& array, std::size_t count);
|
||||
|
||||
template<typename T>
|
||||
|
@ -65,7 +63,7 @@ class BinaryReader {
|
|||
|
||||
bool readUEString(Containers::String& str);
|
||||
|
||||
Int peekChar();
|
||||
std::int32_t peekChar();
|
||||
|
||||
private:
|
||||
std::FILE* _file = nullptr;
|
||||
|
|
|
@ -45,7 +45,7 @@ BinaryWriter::closeFile() {
|
|||
_file = nullptr;
|
||||
}
|
||||
|
||||
Long
|
||||
std::int64_t
|
||||
BinaryWriter::position() {
|
||||
return _ftelli64(_file);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ BinaryWriter::array() const {
|
|||
return _data;
|
||||
}
|
||||
|
||||
UnsignedLong
|
||||
std::size_t
|
||||
BinaryWriter::arrayPosition() const {
|
||||
return _index;
|
||||
}
|
||||
|
@ -75,53 +75,53 @@ BinaryWriter::writeChar(char value) {
|
|||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeByte(Byte value) {
|
||||
return std::fwrite(&value, sizeof(Byte), 1, _file) == 1;
|
||||
BinaryWriter::writeInt8(std::int8_t value) {
|
||||
return std::fwrite(&value, sizeof(std::int8_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeUnsignedByte(UnsignedByte value) {
|
||||
return std::fwrite(&value, sizeof(UnsignedByte), 1, _file) == 1;
|
||||
BinaryWriter::writeUint8(std::uint8_t value) {
|
||||
return std::fwrite(&value, sizeof(std::uint8_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeShort(Short value) {
|
||||
return std::fwrite(&value, sizeof(Short), 1, _file) == 1;
|
||||
BinaryWriter::writeInt16(std::int16_t value) {
|
||||
return std::fwrite(&value, sizeof(std::int16_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeUnsignedShort(UnsignedShort value) {
|
||||
return std::fwrite(&value, sizeof(UnsignedShort), 1, _file) == 1;
|
||||
BinaryWriter::writeUint16(std::uint16_t value) {
|
||||
return std::fwrite(&value, sizeof(std::uint16_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeInt(Int value) {
|
||||
return std::fwrite(&value, sizeof(Int), 1, _file) == 1;
|
||||
BinaryWriter::writeInt32(std::int32_t value) {
|
||||
return std::fwrite(&value, sizeof(std::int32_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeUnsignedInt(UnsignedInt value) {
|
||||
return std::fwrite(&value, sizeof(UnsignedInt), 1, _file) == 1;
|
||||
BinaryWriter::writeUint32(std::uint32_t value) {
|
||||
return std::fwrite(&value, sizeof(std::uint32_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeLong(Long value) {
|
||||
return std::fwrite(&value, sizeof(Long), 1, _file) == 1;
|
||||
BinaryWriter::writeInt64(std::int64_t value) {
|
||||
return std::fwrite(&value, sizeof(std::int64_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeUnsignedLong(UnsignedLong value) {
|
||||
return std::fwrite(&value, sizeof(UnsignedLong), 1, _file) == 1;
|
||||
BinaryWriter::writeUint64(std::uint64_t value) {
|
||||
return std::fwrite(&value, sizeof(std::uint64_t), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeFloat(Float value) {
|
||||
return std::fwrite(&value, sizeof(Float), 1, _file) == 1;
|
||||
BinaryWriter::writeFloat(float value) {
|
||||
return std::fwrite(&value, sizeof(float), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
BinaryWriter::writeDouble(Double value) {
|
||||
return std::fwrite(&value, sizeof(Double), 1, _file) == 1;
|
||||
BinaryWriter::writeDouble(double value) {
|
||||
return std::fwrite(&value, sizeof(double), 1, _file) == 1;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -140,7 +140,7 @@ BinaryWriter::writeUEString(Containers::StringView str) {
|
|||
return false;
|
||||
}
|
||||
|
||||
writeUnsignedInt(static_cast<UnsignedInt>(str.size()) + 1);
|
||||
writeUint32(static_cast<std::uint32_t>(str.size()) + 1);
|
||||
|
||||
if(str.size() > 0) {
|
||||
std::size_t count = std::fwrite(str.data(), sizeof(char), str.size(), _file);
|
||||
|
@ -151,9 +151,9 @@ BinaryWriter::writeUEString(Containers::StringView str) {
|
|||
return writeChar('\0');
|
||||
}
|
||||
|
||||
UnsignedLong
|
||||
std::size_t
|
||||
BinaryWriter::writeUEStringToArray(Containers::StringView value) {
|
||||
return writeValueToArray<UnsignedInt>(UnsignedInt(value.size()) + 1u) +
|
||||
return writeValueToArray<std::uint32_t>(std::uint32_t(value.size()) + 1u) +
|
||||
writeDataToArray(Containers::ArrayView<const char>{value}) +
|
||||
writeValueToArray<char>('\0');
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
#include <Corrade/Containers/ArrayView.h>
|
||||
|
@ -23,10 +24,7 @@
|
|||
#include <Corrade/Containers/StaticArray.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class BinaryWriter {
|
||||
public:
|
||||
|
@ -43,23 +41,23 @@ class BinaryWriter {
|
|||
|
||||
void closeFile();
|
||||
|
||||
Long position();
|
||||
std::int64_t position();
|
||||
|
||||
Containers::ArrayView<const char> array() const;
|
||||
UnsignedLong arrayPosition() const;
|
||||
std::size_t arrayPosition() const;
|
||||
bool flushToFile();
|
||||
|
||||
bool writeByte(Byte value);
|
||||
bool writeChar(char value);
|
||||
bool writeUnsignedByte(UnsignedByte value);
|
||||
bool writeShort(Short value);
|
||||
bool writeUnsignedShort(UnsignedShort value);
|
||||
bool writeInt(Int value);
|
||||
bool writeUnsignedInt(UnsignedInt value);
|
||||
bool writeLong(Long value);
|
||||
bool writeUnsignedLong(UnsignedLong value);
|
||||
bool writeFloat(Float value);
|
||||
bool writeDouble(Double value);
|
||||
bool writeInt8(std::int8_t value);
|
||||
bool writeUint8(std::uint8_t value);
|
||||
bool writeInt16(std::int16_t value);
|
||||
bool writeUint16(std::uint16_t value);
|
||||
bool writeInt32(std::int32_t value);
|
||||
bool writeUint32(std::uint32_t value);
|
||||
bool writeInt64(std::int64_t value);
|
||||
bool writeUint64(std::uint64_t value);
|
||||
bool writeFloat(float value);
|
||||
bool writeDouble(double value);
|
||||
bool writeArray(Containers::ArrayView<const char> array);
|
||||
template<std::size_t size>
|
||||
bool writeString(const char(&str)[size]) {
|
||||
|
@ -74,30 +72,30 @@ class BinaryWriter {
|
|||
bool writeUEString(Containers::StringView str);
|
||||
|
||||
template<typename T, typename U = std::conditional_t<std::is_trivially_copyable<T>::value, T, T&>>
|
||||
UnsignedLong writeValueToArray(U value) {
|
||||
std::size_t writeValueToArray(U value) {
|
||||
Containers::ArrayView<T> view{&value, 1};
|
||||
return writeDataToArray(view);
|
||||
}
|
||||
|
||||
UnsignedLong writeUEStringToArray(Containers::StringView value);
|
||||
std::size_t writeUEStringToArray(Containers::StringView value);
|
||||
|
||||
template<typename T>
|
||||
void writeValueToArrayAt(T& value, UnsignedLong position) {
|
||||
void writeValueToArrayAt(T& value, std::size_t position) {
|
||||
Containers::ArrayView<T> view{&value, 1};
|
||||
writeDataToArrayAt(view, position);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
UnsignedLong writeDataToArray(Containers::ArrayView<T> view) {
|
||||
std::size_t writeDataToArray(Containers::ArrayView<T> view) {
|
||||
arrayAppend(_data, Containers::arrayCast<const char>(view));
|
||||
_index += sizeof(T) * view.size();
|
||||
return sizeof(T) * view.size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void writeDataToArrayAt(Containers::ArrayView<T> view, UnsignedLong position) {
|
||||
void writeDataToArrayAt(Containers::ArrayView<T> view, std::size_t position) {
|
||||
auto casted_view = Containers::arrayCast<const char>(view);
|
||||
for(UnsignedLong i = 0; i < casted_view.size(); i++) {
|
||||
for(std::size_t i = 0; i < casted_view.size(); i++) {
|
||||
_data[position + i] = casted_view[i];
|
||||
}
|
||||
}
|
||||
|
@ -106,5 +104,5 @@ class BinaryWriter {
|
|||
FILE* _file = nullptr;
|
||||
|
||||
Containers::Array<char> _data;
|
||||
UnsignedLong _index = 0;
|
||||
std::size_t _index = 0;
|
||||
};
|
||||
|
|
|
@ -93,8 +93,8 @@ PropertySerialiser::read(BinaryReader& reader) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedLong value_length;
|
||||
if(!reader.readUnsignedLong(value_length)) {
|
||||
std::size_t value_length;
|
||||
if(!reader.readUint64(value_length)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ PropertySerialiser::read(BinaryReader& reader) {
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr
|
||||
PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length,
|
||||
PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std::size_t value_length,
|
||||
Containers::String name)
|
||||
{
|
||||
if(reader.peekChar() < 0 || reader.eof()) {
|
||||
|
@ -113,7 +113,7 @@ PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, Unsi
|
|||
}
|
||||
|
||||
Containers::Array<UnrealPropertyBase::ptr>
|
||||
PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, UnsignedInt count) {
|
||||
PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) {
|
||||
if(reader.peekChar() < 0 || reader.eof()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedLong value_length;
|
||||
if(!reader.readUnsignedLong(value_length)) {
|
||||
std::size_t value_length;
|
||||
if(!reader.readUint64(value_length)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -147,8 +147,8 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty
|
|||
}
|
||||
}
|
||||
else {
|
||||
for(UnsignedInt i = 0; i < count; i++) {
|
||||
auto item = readItem(reader, item_type, UnsignedLong(-1), "");
|
||||
for(std::uint32_t i = 0; i < count; i++) {
|
||||
auto item = readItem(reader, item_type, std::size_t(-1), "");
|
||||
arrayAppend(array, std::move(item));
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr
|
||||
PropertySerialiser::deserialise(Containers::String name, Containers::String type, UnsignedLong value_length,
|
||||
PropertySerialiser::deserialise(Containers::String name, Containers::String type, std::size_t value_length,
|
||||
BinaryReader& reader)
|
||||
{
|
||||
UnrealPropertyBase::ptr prop;
|
||||
|
@ -181,7 +181,7 @@ PropertySerialiser::deserialise(Containers::String name, Containers::String type
|
|||
}
|
||||
|
||||
bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
|
||||
UnsignedLong& bytes_written, BinaryWriter& writer)
|
||||
std::size_t& bytes_written, BinaryWriter& writer)
|
||||
{
|
||||
auto serialiser = getSerialiser(item_type);
|
||||
if(!serialiser) {
|
||||
|
@ -191,7 +191,7 @@ bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::St
|
|||
}
|
||||
|
||||
bool
|
||||
PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer) {
|
||||
PropertySerialiser::write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer) {
|
||||
if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast<NoneProperty*>(prop.get())) {
|
||||
bytes_written += writer.writeUEStringToArray(*prop->name);
|
||||
return true;
|
||||
|
@ -200,10 +200,10 @@ PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_wri
|
|||
bytes_written += writer.writeUEStringToArray(*prop->name);
|
||||
bytes_written += writer.writeUEStringToArray(prop->propertyType);
|
||||
|
||||
UnsignedLong value_length = 0;
|
||||
UnsignedLong vl_position = writer.arrayPosition();
|
||||
std::size_t value_length = 0;
|
||||
std::size_t vl_position = writer.arrayPosition();
|
||||
|
||||
bytes_written += writer.writeValueToArray<UnsignedLong>(value_length);
|
||||
bytes_written += writer.writeValueToArray<std::size_t>(value_length);
|
||||
|
||||
bool ret = serialise(prop, prop->propertyType, value_length, writer);
|
||||
|
||||
|
@ -216,7 +216,7 @@ PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_wri
|
|||
|
||||
bool
|
||||
PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type,
|
||||
UnsignedLong& bytes_written, BinaryWriter& writer)
|
||||
std::size_t& bytes_written, BinaryWriter& writer)
|
||||
{
|
||||
if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast<NoneProperty*>(prop.get())) {
|
||||
bytes_written += writer.writeUEStringToArray(*prop->name);
|
||||
|
@ -227,7 +227,7 @@ PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringV
|
|||
}
|
||||
|
||||
bool PropertySerialiser::writeSet(Containers::ArrayView<UnrealPropertyBase::ptr> props,
|
||||
Containers::StringView item_type, UnsignedLong& bytes_written, BinaryWriter& writer)
|
||||
Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer)
|
||||
{
|
||||
auto serialiser = getCollectionSerialiser(item_type);
|
||||
if(serialiser) {
|
||||
|
|
|
@ -35,20 +35,20 @@ class PropertySerialiser {
|
|||
static PropertySerialiser& instance();
|
||||
|
||||
UnrealPropertyBase::ptr read(BinaryReader& reader);
|
||||
UnrealPropertyBase::ptr readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length,
|
||||
UnrealPropertyBase::ptr readItem(BinaryReader& reader, Containers::String type, std::size_t value_length,
|
||||
Containers::String name);
|
||||
Containers::Array<UnrealPropertyBase::ptr> readSet(BinaryReader& reader, Containers::StringView item_type,
|
||||
UnsignedInt count);
|
||||
UnrealPropertyBase::ptr deserialise(Containers::String name, Containers::String type, UnsignedLong value_length,
|
||||
std::uint32_t count);
|
||||
UnrealPropertyBase::ptr deserialise(Containers::String name, Containers::String type, std::size_t value_length,
|
||||
BinaryReader& reader);
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written,
|
||||
BinaryWriter& writer);
|
||||
bool write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer);
|
||||
bool writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written,
|
||||
bool write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer);
|
||||
bool writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written,
|
||||
BinaryWriter& writer);
|
||||
bool writeSet(Containers::ArrayView<UnrealPropertyBase::ptr> props, Containers::StringView item_type,
|
||||
UnsignedLong& bytes_written, BinaryWriter& writer);
|
||||
std::size_t& bytes_written, BinaryWriter& writer);
|
||||
|
||||
private:
|
||||
PropertySerialiser();
|
||||
|
|
|
@ -21,12 +21,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "../Types/UnrealPropertyBase.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class BinaryReader;
|
||||
class BinaryWriter;
|
||||
|
@ -44,9 +41,9 @@ class AbstractUnrealCollectionPropertySerialiser {
|
|||
virtual StringArrayView types() = 0;
|
||||
|
||||
virtual PropertyArray deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, UnsignedInt count, BinaryReader& reader,
|
||||
std::size_t value_length, std::uint32_t count, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) = 0;
|
||||
|
||||
virtual auto serialise(Containers::ArrayView<UnrealPropertyBase::ptr> props, Containers::StringView item_type,
|
||||
UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) -> bool = 0;
|
||||
virtual bool serialise(Containers::ArrayView<UnrealPropertyBase::ptr> props, Containers::StringView item_type,
|
||||
std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0;
|
||||
};
|
||||
|
|
|
@ -20,12 +20,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "../Types/UnrealPropertyBase.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class BinaryReader;
|
||||
class BinaryWriter;
|
||||
|
@ -42,9 +39,9 @@ class AbstractUnrealPropertySerialiser {
|
|||
virtual StringArrayView types() = 0;
|
||||
|
||||
virtual UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) = 0;
|
||||
|
||||
virtual bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
virtual bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) = 0;
|
||||
};
|
||||
|
|
|
@ -21,12 +21,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "../Types/UnrealPropertyBase.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class BinaryReader;
|
||||
class BinaryWriter;
|
||||
|
@ -41,6 +38,5 @@ class AbstractUnrealStructSerialiser {
|
|||
|
||||
virtual UnrealPropertyBase::ptr deserialise(BinaryReader& reader) = 0;
|
||||
|
||||
virtual bool serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer,
|
||||
UnsignedLong& bytes_written) = 0;
|
||||
virtual bool serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, std::size_t& bytes_written) = 0;
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
Containers::String item_type;
|
||||
|
@ -40,8 +40,8 @@ ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Contai
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedInt item_count;
|
||||
if(!reader.readUnsignedInt(item_count)) {
|
||||
std::uint32_t item_count;
|
||||
if(!reader.readUint32(item_count)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read array property {}'s item count.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Contai
|
|||
}
|
||||
|
||||
bool
|
||||
ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto array_prop = dynamic_cast<ArrayProperty*>(prop.get());
|
||||
|
@ -65,10 +65,10 @@ ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsign
|
|||
|
||||
writer.writeUEStringToArray(array_prop->itemType);
|
||||
writer.writeValueToArray<char>('\0');
|
||||
bytes_written += writer.writeValueToArray<UnsignedInt>(UnsignedInt(array_prop->items.size()));
|
||||
bytes_written += writer.writeValueToArray<std::uint32_t>(std::uint32_t(array_prop->items.size()));
|
||||
|
||||
UnsignedLong start_pos = writer.arrayPosition();
|
||||
UnsignedLong dummy_bytes_written = 0;
|
||||
std::size_t start_pos = writer.arrayPosition();
|
||||
std::size_t dummy_bytes_written = 0;
|
||||
bool ret = serialiser.writeSet(array_prop->items, array_prop->itemType, dummy_bytes_written, writer);
|
||||
bytes_written += writer.arrayPosition() - start_pos;
|
||||
|
||||
|
|
|
@ -18,14 +18,11 @@
|
|||
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "UnrealPropertySerialiser.h"
|
||||
|
||||
#include "../Types/ArrayProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class ArrayPropertySerialiser : public UnrealPropertySerialiser<ArrayProperty> {
|
||||
public:
|
||||
|
@ -33,8 +30,8 @@ class ArrayPropertySerialiser : public UnrealPropertySerialiser<ArrayProperty> {
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ BoolPropertySerialiser::types() {
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr
|
||||
BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
if(value_length != 0) {
|
||||
|
@ -36,8 +36,8 @@ BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::Str
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Short value;
|
||||
if(!reader.readShort(value)) {
|
||||
std::int16_t value;
|
||||
if(!reader.readInt16(value)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read bool property {}'s value.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::Str
|
|||
}
|
||||
|
||||
bool
|
||||
BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto bool_prop = dynamic_cast<BoolProperty*>(prop.get());
|
||||
|
@ -63,7 +63,7 @@ BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& b
|
|||
return false;
|
||||
}
|
||||
|
||||
writer.writeValueToArray<Short>(Short(bool_prop->value));
|
||||
writer.writeValueToArray<std::int16_t>(std::int16_t(bool_prop->value));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ class BoolPropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
StringArrayView types() override;
|
||||
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -28,12 +28,12 @@ BytePropertySerialiser::types() {
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr
|
||||
BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<ByteProperty>();
|
||||
|
||||
if(value_length != UnsignedLong(-1)) {
|
||||
if(value_length != std::size_t(-1)) {
|
||||
if(!reader.readUEString(prop->enumType)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read byte property {}'s enum type.", name);
|
||||
return nullptr;
|
||||
|
@ -53,8 +53,8 @@ BytePropertySerialiser::deserialise(Containers::StringView name, Containers::Str
|
|||
|
||||
prop->valueLength = value_length;
|
||||
|
||||
//UnsignedInt count = 0;
|
||||
//if(!reader.readUnsignedInt(count)) {
|
||||
//std::uint32_t count = 0;
|
||||
//if(!reader.readstd::uint32_t(count)) {
|
||||
// return nullptr;
|
||||
//}
|
||||
|
||||
|
@ -66,7 +66,7 @@ BytePropertySerialiser::deserialise(Containers::StringView name, Containers::Str
|
|||
}
|
||||
|
||||
bool
|
||||
BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto byte_prop = dynamic_cast<ByteProperty*>(prop.get());
|
||||
|
@ -76,10 +76,10 @@ BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& b
|
|||
}
|
||||
|
||||
//writer.writeValueToArray<char>('\0');
|
||||
//bytes_written += writer.writeValueToArray<UnsignedInt>(byte_prop->value.size());
|
||||
//bytes_written += writer.writeValueToArray<std::uint32_t>(byte_prop->value.size());
|
||||
//bytes_written += writer.writeDataToArray<char>(byte_prop->value);
|
||||
|
||||
if(byte_prop->valueLength != UnsignedLong(-1)) {
|
||||
if(byte_prop->valueLength != std::size_t(-1)) {
|
||||
writer.writeUEStringToArray(byte_prop->enumType);
|
||||
writer.writeValueToArray<char>('\0');
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ class BytePropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
StringArrayView types() override;
|
||||
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<ColourStructProperty>();
|
||||
|
@ -38,7 +38,7 @@ ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Conta
|
|||
}
|
||||
|
||||
bool
|
||||
ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto colour_prop = dynamic_cast<ColourStructProperty*>(prop.get());
|
||||
|
@ -47,10 +47,10 @@ ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsig
|
|||
return false;
|
||||
}
|
||||
|
||||
bytes_written += writer.writeValueToArray<Float>(colour_prop->r) +
|
||||
writer.writeValueToArray<Float>(colour_prop->g) +
|
||||
writer.writeValueToArray<Float>(colour_prop->b) +
|
||||
writer.writeValueToArray<Float>(colour_prop->a);
|
||||
bytes_written += writer.writeValueToArray<float>(colour_prop->r) +
|
||||
writer.writeValueToArray<float>(colour_prop->g) +
|
||||
writer.writeValueToArray<float>(colour_prop->b) +
|
||||
writer.writeValueToArray<float>(colour_prop->a);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ class ColourPropertySerialiser : public UnrealPropertySerialiser<ColourStructPro
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<DateTimeStructProperty>();
|
||||
|
||||
if(!reader.readUnsignedLong(prop->timestamp)) {
|
||||
if(!reader.readInt64(prop->timestamp)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read date/time property {}'s value.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Con
|
|||
}
|
||||
|
||||
bool
|
||||
DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto dt_prop = dynamic_cast<DateTimeStructProperty*>(prop.get());
|
||||
|
@ -45,7 +45,7 @@ DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Uns
|
|||
return false;
|
||||
}
|
||||
|
||||
bytes_written += writer.writeValueToArray<UnsignedLong>(dt_prop->timestamp);
|
||||
bytes_written += writer.writeValueToArray<std::int64_t>(dt_prop->timestamp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ class DateTimePropertySerialiser : public UnrealPropertySerialiser<DateTimeStruc
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ EnumPropertySerialiser::types() {
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr
|
||||
EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<EnumProperty>();
|
||||
|
@ -53,7 +53,7 @@ EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::Str
|
|||
}
|
||||
|
||||
bool
|
||||
EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto enum_prop = dynamic_cast<EnumProperty*>(prop.get());
|
||||
|
|
|
@ -30,9 +30,9 @@ class EnumPropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
StringArrayView types() override;
|
||||
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ FloatPropertySerialiser::types() {
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<FloatProperty>();
|
||||
|
||||
|
@ -48,7 +48,7 @@ FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::St
|
|||
}
|
||||
|
||||
bool
|
||||
FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto float_prop = dynamic_cast<FloatProperty*>(prop.get());
|
||||
|
@ -58,7 +58,7 @@ FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong&
|
|||
}
|
||||
|
||||
writer.writeValueToArray<char>('\0');
|
||||
bytes_written += writer.writeValueToArray<Float>(float_prop->value);
|
||||
bytes_written += writer.writeValueToArray<float>(float_prop->value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ class FloatPropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
StringArrayView types() override;
|
||||
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace Containers::Literals;
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<GuidStructProperty>();
|
||||
|
@ -38,7 +38,7 @@ GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain
|
|||
}
|
||||
|
||||
bool
|
||||
GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto guid_prop = dynamic_cast<GuidStructProperty*>(prop.get());
|
||||
|
|
|
@ -28,8 +28,8 @@ class GuidPropertySerialiser : public UnrealPropertySerialiser<GuidStructPropert
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -22,18 +22,18 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<IntProperty>();
|
||||
|
||||
if(value_length == UnsignedLong(-1)) {
|
||||
if(!reader.readInt(prop->value)) {
|
||||
if(value_length == std::size_t(-1)) {
|
||||
if(!reader.readInt32(prop->value)) {
|
||||
LOG_ERROR("Couldn't read int property's value.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
prop->valueLength = UnsignedLong(-1);
|
||||
prop->valueLength = std::size_t(-1);
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if(!reader.readInt(prop->value)) {
|
||||
if(!reader.readInt32(prop->value)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read int property {}'s value.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
}
|
||||
|
||||
bool
|
||||
IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto int_prop = dynamic_cast<IntProperty*>(prop.get());
|
||||
|
@ -63,11 +63,11 @@ IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsigned
|
|||
return false;
|
||||
}
|
||||
|
||||
if(prop->valueLength != UnsignedLong(-1)) {
|
||||
if(prop->valueLength != std::size_t(-1)) {
|
||||
writer.writeValueToArray<char>('\0');
|
||||
}
|
||||
|
||||
bytes_written += writer.writeValueToArray<Int>(int_prop->value);
|
||||
bytes_written += writer.writeValueToArray<std::int32_t>(int_prop->value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ class IntPropertySerialiser : public UnrealPropertySerialiser<IntProperty> {
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace Containers::Literals;
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<MapProperty>();
|
||||
|
@ -47,14 +47,14 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedInt null;
|
||||
if(!reader.readUnsignedInt(null) || null != 0u) {
|
||||
std::uint32_t null;
|
||||
if(!reader.readUint32(null) || null != 0u) {
|
||||
LOG_ERROR_FORMAT("Couldn't read a null int in map property {}.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedInt count;
|
||||
if(!reader.readUnsignedInt(count)) {
|
||||
std::uint32_t count;
|
||||
if(!reader.readUint32(count)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read map property {}'s item count.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
|
||||
arrayReserve(prop->map, count);
|
||||
|
||||
for(UnsignedInt i = 0; i < count; i++) {
|
||||
for(std::uint32_t i = 0; i < count; i++) {
|
||||
MapProperty::KeyValuePair pair;
|
||||
|
||||
if(prop->keyType == "IntProperty"_s || prop->keyType == "StrProperty"_s) {
|
||||
|
@ -109,7 +109,7 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
}
|
||||
|
||||
bool
|
||||
MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto map_prop = dynamic_cast<MapProperty*>(prop.get());
|
||||
|
@ -122,12 +122,12 @@ MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsigned
|
|||
writer.writeUEStringToArray(map_prop->valueType);
|
||||
writer.writeValueToArray<char>('\0');
|
||||
|
||||
UnsignedLong value_start = writer.arrayPosition();
|
||||
writer.writeValueToArray<UnsignedInt>(0u);
|
||||
std::size_t value_start = writer.arrayPosition();
|
||||
writer.writeValueToArray<std::uint32_t>(0u);
|
||||
|
||||
writer.writeValueToArray<UnsignedInt>(UnsignedInt(map_prop->map.size()));
|
||||
writer.writeValueToArray<std::uint32_t>(std::uint32_t(map_prop->map.size()));
|
||||
|
||||
UnsignedLong dummy_bytes_written = 0;
|
||||
std::size_t dummy_bytes_written = 0;
|
||||
for(auto& pair : map_prop->map) {
|
||||
if(!serialiser.writeItem(pair.key, map_prop->keyType, dummy_bytes_written, writer)) {
|
||||
LOG_ERROR("Couldn't write a key.");
|
||||
|
|
|
@ -28,8 +28,8 @@ class MapPropertySerialiser : public UnrealPropertySerialiser<MapProperty> {
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace Containers::Literals;
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<ResourceItemValue>();
|
||||
|
@ -79,7 +79,7 @@ ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Con
|
|||
}
|
||||
|
||||
bool
|
||||
ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto res_prop = dynamic_cast<ResourceItemValue*>(prop.get());
|
||||
|
@ -90,15 +90,15 @@ ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Uns
|
|||
|
||||
bytes_written += writer.writeUEStringToArray("ID_4_AAE08F17428E229EC7A2209F51081A21"_s) +
|
||||
writer.writeUEStringToArray("IntProperty"_s) +
|
||||
writer.writeValueToArray<UnsignedLong>(4ull) +
|
||||
writer.writeValueToArray<std::size_t>(4ull) +
|
||||
writer.writeValueToArray<char>('\0') +
|
||||
writer.writeValueToArray<Int>(res_prop->id);
|
||||
writer.writeValueToArray<std::int32_t>(res_prop->id);
|
||||
|
||||
bytes_written += writer.writeUEStringToArray("Quantity_3_560F09B5485C365D3041888910019CE3"_s) +
|
||||
writer.writeUEStringToArray("IntProperty"_s) +
|
||||
writer.writeValueToArray<UnsignedLong>(4ull) +
|
||||
writer.writeValueToArray<std::size_t>(4ull) +
|
||||
writer.writeValueToArray<char>('\0') +
|
||||
writer.writeValueToArray<Int>(res_prop->quantity);
|
||||
writer.writeValueToArray<std::int32_t>(res_prop->quantity);
|
||||
|
||||
bytes_written += writer.writeUEStringToArray("None"_s);
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ class ResourcePropertySerialiser : public UnrealPropertySerialiser<ResourceItemV
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<RotatorStructProperty>();
|
||||
|
@ -36,7 +36,7 @@ RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Cont
|
|||
}
|
||||
|
||||
bool
|
||||
RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto rotator = dynamic_cast<RotatorStructProperty*>(prop.get());
|
||||
|
@ -45,8 +45,8 @@ RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsi
|
|||
return false;
|
||||
}
|
||||
|
||||
bytes_written += writer.writeValueToArray<Float>(rotator->x) + writer.writeValueToArray<Float>(rotator->y) +
|
||||
writer.writeValueToArray<Float>(rotator->z);
|
||||
bytes_written += writer.writeValueToArray<float>(rotator->x) + writer.writeValueToArray<float>(rotator->y) +
|
||||
writer.writeValueToArray<float>(rotator->z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ class RotatorPropertySerialiser : public UnrealPropertySerialiser<RotatorStructP
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
Containers::String item_type;
|
||||
|
@ -38,14 +38,14 @@ SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedInt four_bytes;
|
||||
if(!reader.readUnsignedInt(four_bytes) || four_bytes != 0u) {
|
||||
std::uint32_t four_bytes;
|
||||
if(!reader.readUint32(four_bytes) || four_bytes != 0u) {
|
||||
LOG_ERROR_FORMAT("Couldn't read four null bytes in set property {}.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UnsignedInt item_count;
|
||||
if(!reader.readUnsignedInt(item_count)) {
|
||||
std::uint32_t item_count;
|
||||
if(!reader.readUint32(item_count)) {
|
||||
LOG_ERROR_FORMAT("Couldn't read set property {}'s item count.", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe
|
|||
}
|
||||
|
||||
bool
|
||||
SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto set_prop = dynamic_cast<SetProperty*>(prop.get());
|
||||
|
@ -70,11 +70,11 @@ SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsigned
|
|||
writer.writeUEStringToArray(set_prop->itemType);
|
||||
writer.writeValueToArray<char>('\0');
|
||||
|
||||
bytes_written += writer.writeValueToArray<UnsignedInt>(0u);
|
||||
bytes_written += writer.writeValueToArray<UnsignedInt>(UnsignedInt(set_prop->items.size()));
|
||||
bytes_written += writer.writeValueToArray<std::uint32_t>(0u);
|
||||
bytes_written += writer.writeValueToArray<std::uint32_t>(std::uint32_t(set_prop->items.size()));
|
||||
|
||||
UnsignedLong start_pos = writer.arrayPosition();
|
||||
UnsignedLong dummy_bytes_written = 0;
|
||||
std::size_t start_pos = writer.arrayPosition();
|
||||
std::size_t dummy_bytes_written = 0;
|
||||
serialiser.writeSet(set_prop->items, set_prop->itemType, dummy_bytes_written, writer);
|
||||
bytes_written += writer.arrayPosition() - start_pos;
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ class SetPropertySerialiser : public UnrealPropertySerialiser<SetProperty> {
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -31,11 +31,11 @@ StringPropertySerialiser::types() {
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
StringPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<StringProperty>(type);
|
||||
|
||||
if(value_length != UnsignedLong(-1)) {
|
||||
if(value_length != std::size_t(-1)) {
|
||||
char terminator;
|
||||
if(!reader.readChar(terminator) || terminator != '\0') {
|
||||
LOG_ERROR_FORMAT("Couldn't read a null byte in string property {}.", name);
|
||||
|
@ -54,7 +54,7 @@ StringPropertySerialiser::deserialise(Containers::StringView name, Containers::S
|
|||
}
|
||||
|
||||
bool
|
||||
StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto str_prop = dynamic_cast<StringProperty*>(prop.get());
|
||||
|
@ -63,7 +63,7 @@ StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong&
|
|||
return false;
|
||||
}
|
||||
|
||||
if(str_prop->valueLength != UnsignedLong(-1)) {
|
||||
if(str_prop->valueLength != std::size_t(-1)) {
|
||||
writer.writeValueToArray<char>('\0');
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ class StringPropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
StringArrayView types() override;
|
||||
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -33,8 +33,8 @@ StructSerialiser::types() {
|
|||
}
|
||||
|
||||
Containers::Array<UnrealPropertyBase::ptr>
|
||||
StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
Containers::String item_type;
|
||||
if(!reader.readUEString(item_type)) {
|
||||
|
@ -62,10 +62,10 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie
|
|||
prop->structGuid = std::move(guid);
|
||||
}
|
||||
else {
|
||||
for(UnsignedInt i = 0; i < count; i++) {
|
||||
for(std::uint32_t i = 0; i < count; i++) {
|
||||
auto prop = Containers::pointer<UnrealPropertyBase>();
|
||||
|
||||
prop = serialiser.readItem(reader, item_type, UnsignedLong(-1), name);
|
||||
prop = serialiser.readItem(reader, item_type, std::size_t(-1), name);
|
||||
|
||||
if(!prop) {
|
||||
prop = readStructValue(name, item_type, value_length, reader, serialiser);
|
||||
|
@ -86,7 +86,7 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr
|
||||
StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
Containers::String item_type;
|
||||
|
@ -125,12 +125,12 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie
|
|||
|
||||
bool
|
||||
StructSerialiser::serialise(Containers::ArrayView<UnrealPropertyBase::ptr> props, Containers::StringView item_type,
|
||||
UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
bytes_written += writer.writeUEStringToArray(*(props.front()->name));
|
||||
bytes_written += writer.writeUEStringToArray(item_type);
|
||||
UnsignedLong vl_pos = writer.arrayPosition();
|
||||
bytes_written += writer.writeValueToArray<UnsignedLong>(0ull);
|
||||
std::size_t vl_pos = writer.arrayPosition();
|
||||
bytes_written += writer.writeValueToArray<std::size_t>(0ull);
|
||||
|
||||
auto struct_prop = dynamic_cast<StructProperty*>(props.front().get());
|
||||
if(!struct_prop) {
|
||||
|
@ -142,9 +142,9 @@ StructSerialiser::serialise(Containers::ArrayView<UnrealPropertyBase::ptr> props
|
|||
bytes_written += writer.writeDataToArray(arrayView(struct_prop->structGuid));
|
||||
bytes_written += writer.writeValueToArray<char>('\0');
|
||||
|
||||
UnsignedLong vl_start = writer.arrayPosition();
|
||||
std::size_t vl_start = writer.arrayPosition();
|
||||
|
||||
UnsignedLong bytes_written_here = 0;
|
||||
std::size_t bytes_written_here = 0;
|
||||
for(auto& prop : props) {
|
||||
struct_prop = dynamic_cast<StructProperty*>(prop.get());
|
||||
if(!struct_prop) {
|
||||
|
@ -160,7 +160,7 @@ StructSerialiser::serialise(Containers::ArrayView<UnrealPropertyBase::ptr> props
|
|||
}
|
||||
}
|
||||
|
||||
UnsignedLong vl_stop = writer.arrayPosition() - vl_start;
|
||||
std::size_t vl_stop = writer.arrayPosition() - vl_start;
|
||||
writer.writeValueToArrayAt(vl_stop, vl_pos);
|
||||
bytes_written += vl_stop;
|
||||
|
||||
|
@ -168,7 +168,7 @@ StructSerialiser::serialise(Containers::ArrayView<UnrealPropertyBase::ptr> props
|
|||
}
|
||||
|
||||
bool
|
||||
StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto struct_prop = dynamic_cast<StructProperty*>(prop.get());
|
||||
|
@ -182,8 +182,8 @@ StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_w
|
|||
writer.writeValueToArray<char>('\0');
|
||||
|
||||
if(!serialiser.writeItem(prop, struct_prop->structType, bytes_written, writer)) {
|
||||
UnsignedLong dummy_bytes_written = 0;
|
||||
UnsignedLong vl_start = writer.arrayPosition();
|
||||
std::size_t dummy_bytes_written = 0;
|
||||
std::size_t vl_start = writer.arrayPosition();
|
||||
if(!writeStructValue(struct_prop, dummy_bytes_written, writer, serialiser)) {
|
||||
LOG_ERROR("Couldn't write the struct value.");
|
||||
return false;
|
||||
|
@ -195,7 +195,7 @@ StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_w
|
|||
}
|
||||
|
||||
StructProperty::ptr
|
||||
StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
BinaryReader& reader, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto st_prop = Containers::pointer<GenericStructProperty>();
|
||||
|
@ -219,7 +219,7 @@ StructSerialiser::readStructValue(Containers::StringView name, Containers::Strin
|
|||
}
|
||||
|
||||
bool
|
||||
StructSerialiser::writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
StructSerialiser::writeStructValue(StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto struct_prop = dynamic_cast<GenericStructProperty*>(prop);
|
||||
|
|
|
@ -31,21 +31,21 @@ class StructSerialiser : public AbstractUnrealPropertySerialiser, public Abstrac
|
|||
|
||||
StringArrayView types() override;
|
||||
|
||||
PropertyArray deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length,
|
||||
UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) override;
|
||||
PropertyArray deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length,
|
||||
std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) override;
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
bool serialise(PropertyArrayView props, Containers::StringView item_type, UnsignedLong& bytes_written,
|
||||
bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser) override;
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
|
||||
private:
|
||||
StructProperty::ptr readStructValue(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser);
|
||||
bool writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool writeStructValue(StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser);
|
||||
} ;
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<TextProperty>();
|
||||
|
||||
Long start_position = reader.position();
|
||||
auto start_position = reader.position();
|
||||
|
||||
char terminator;
|
||||
if(!reader.readChar(terminator) || terminator != '\0') {
|
||||
|
@ -62,7 +62,7 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain
|
|||
arrayAppend(prop->data, std::move(str));
|
||||
|
||||
interval = reader.position() - start_position;
|
||||
} while(UnsignedLong(interval) < value_length);
|
||||
} while(std::size_t(interval) < value_length);
|
||||
|
||||
prop->value = prop->data.back();
|
||||
|
||||
|
@ -70,7 +70,7 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain
|
|||
}
|
||||
|
||||
bool
|
||||
TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto text_prop = dynamic_cast<TextProperty*>(prop.get());
|
||||
|
|
|
@ -28,8 +28,8 @@ class TextPropertySerialiser : public UnrealPropertySerialiser<TextProperty> {
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -50,13 +50,13 @@ class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
}
|
||||
|
||||
UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override
|
||||
{
|
||||
return deserialiseProperty(name, type, value_length, reader, serialiser);
|
||||
}
|
||||
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override
|
||||
{
|
||||
return serialiseProperty(prop, bytes_written, writer, serialiser);
|
||||
|
@ -64,9 +64,9 @@ class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser {
|
|||
|
||||
private:
|
||||
virtual UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) = 0;
|
||||
|
||||
virtual bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
virtual bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) = 0;
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<Vector2DStructProperty>();
|
||||
|
@ -36,7 +36,7 @@ Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Con
|
|||
}
|
||||
|
||||
bool
|
||||
Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto vector = dynamic_cast<Vector2DStructProperty*>(prop.get());
|
||||
|
@ -45,7 +45,7 @@ Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Uns
|
|||
return false;
|
||||
}
|
||||
|
||||
bytes_written += writer.writeValueToArray<Float>(vector->x) + writer.writeValueToArray<Float>(vector->y);
|
||||
bytes_written += writer.writeValueToArray<float>(vector->x) + writer.writeValueToArray<float>(vector->y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ class Vector2DPropertySerialiser : public UnrealPropertySerialiser<Vector2DStruc
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
UnrealPropertyBase::ptr
|
||||
VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser)
|
||||
{
|
||||
auto prop = Containers::pointer<VectorStructProperty>();
|
||||
|
@ -36,7 +36,7 @@ VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Conta
|
|||
}
|
||||
|
||||
bool
|
||||
VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written,
|
||||
VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written,
|
||||
BinaryWriter& writer, PropertySerialiser& serialiser)
|
||||
{
|
||||
auto vector = dynamic_cast<VectorStructProperty*>(prop.get());
|
||||
|
@ -45,8 +45,8 @@ VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsig
|
|||
return false;
|
||||
}
|
||||
|
||||
bytes_written += writer.writeValueToArray<Float>(vector->x) + writer.writeValueToArray<Float>(vector->y) +
|
||||
writer.writeValueToArray<Float>(vector->z);
|
||||
bytes_written += writer.writeValueToArray<float>(vector->x) + writer.writeValueToArray<float>(vector->y) +
|
||||
writer.writeValueToArray<float>(vector->z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ class VectorPropertySerialiser : public UnrealPropertySerialiser<VectorStructPro
|
|||
|
||||
private:
|
||||
UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type,
|
||||
UnsignedLong value_length, BinaryReader& reader,
|
||||
std::size_t value_length, BinaryReader& reader,
|
||||
PropertySerialiser& serialiser) override;
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer,
|
||||
bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer,
|
||||
PropertySerialiser& serialiser) override;
|
||||
};
|
||||
|
|
|
@ -29,5 +29,5 @@ struct ColourStructProperty : public StructProperty {
|
|||
using namespace Containers::Literals;
|
||||
structType = "LinearColor"_s;
|
||||
}
|
||||
Float r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f;
|
||||
float r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f;
|
||||
};
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "StructProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct DateTimeStructProperty : public StructProperty {
|
||||
using ptr = Containers::Pointer<DateTimeStructProperty>;
|
||||
|
@ -34,5 +31,5 @@ struct DateTimeStructProperty : public StructProperty {
|
|||
structType = "DateTime"_s;
|
||||
}
|
||||
|
||||
UnsignedLong timestamp = 0;
|
||||
std::int64_t timestamp = 0;
|
||||
};
|
||||
|
|
|
@ -19,14 +19,11 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "UnrealProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct FloatProperty : public UnrealProperty<Float> {
|
||||
struct FloatProperty : public UnrealProperty<float> {
|
||||
using ptr = Containers::Pointer<FloatProperty>;
|
||||
|
||||
FloatProperty() {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace Corrade;
|
||||
|
||||
struct IntProperty : public UnrealProperty<Int> {
|
||||
struct IntProperty : public UnrealProperty<std::int32_t> {
|
||||
using ptr = Containers::Pointer<IntProperty>;
|
||||
|
||||
IntProperty() {
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "StructProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct ResourceItemValue : public StructProperty {
|
||||
using ptr = Containers::Pointer<ResourceItemValue>;
|
||||
|
@ -32,8 +29,12 @@ struct ResourceItemValue : public StructProperty {
|
|||
ResourceItemValue() {
|
||||
using namespace Containers::Literals;
|
||||
structType = "sttResourceItemValue"_s;
|
||||
structGuid = Containers::StaticArray<16, char>{'\xB7', '\xA7', '\x77', '\xAB', '\xD3', '\x1B', '\xA6', '\x43', '\xAF', '\x42', '\xE5', '\x9E', '\xBF', '\xFD', '\x37', '\x55'};
|
||||
structGuid = Containers::StaticArray<16, char>{
|
||||
'\xB7', '\xA7', '\x77', '\xAB', '\xD3', '\x1B', '\xA6', '\x43',
|
||||
'\xAF', '\x42', '\xE5', '\x9E', '\xBF', '\xFD', '\x37', '\x55'
|
||||
};
|
||||
}
|
||||
|
||||
Int id = 0, quantity = 0;
|
||||
std::int32_t id = 0;
|
||||
std::int32_t quantity = 0;
|
||||
};
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "StructProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct RotatorStructProperty : public StructProperty {
|
||||
using ptr = Containers::Pointer<RotatorStructProperty>;
|
||||
|
@ -34,5 +31,5 @@ struct RotatorStructProperty : public StructProperty {
|
|||
structType = "Rotator"_s;
|
||||
}
|
||||
|
||||
Float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
};
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <Corrade/Containers/Optional.h>
|
||||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/String.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct UnrealPropertyBase {
|
||||
using ptr = Containers::Pointer<UnrealPropertyBase>;
|
||||
|
@ -32,5 +31,5 @@ struct UnrealPropertyBase {
|
|||
|
||||
Containers::Optional<Containers::String> name = Containers::NullOpt;
|
||||
Containers::String propertyType;
|
||||
UnsignedLong valueLength = 0;
|
||||
std::size_t valueLength = 0;
|
||||
};
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "StructProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct Vector2DStructProperty : public StructProperty {
|
||||
using ptr = Containers::Pointer<Vector2DStructProperty>;
|
||||
|
@ -34,5 +31,5 @@ struct Vector2DStructProperty : public StructProperty {
|
|||
structType = "Vector2D"_s;
|
||||
}
|
||||
|
||||
Float x = 0.0f, y = 0.0f;
|
||||
float x = 0.0f, y = 0.0f;
|
||||
};
|
||||
|
|
|
@ -19,12 +19,9 @@
|
|||
#include <Corrade/Containers/Pointer.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
#include "StructProperty.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct VectorStructProperty : public StructProperty {
|
||||
using ptr = Containers::Pointer<VectorStructProperty>;
|
||||
|
@ -34,5 +31,5 @@ struct VectorStructProperty : public StructProperty {
|
|||
structType = "Vector"_s;
|
||||
}
|
||||
|
||||
Float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
};
|
||||
|
|
|
@ -93,12 +93,12 @@ UESaveFile::saveToFile() {
|
|||
}
|
||||
|
||||
if(!writer.writeArray(arrayView(_magicBytes)) ||
|
||||
!writer.writeUnsignedInt(_saveVersion) ||
|
||||
!writer.writeUnsignedInt(_packageVersion) ||
|
||||
!writer.writeUnsignedShort(_engineVersion.major) ||
|
||||
!writer.writeUnsignedShort(_engineVersion.minor) ||
|
||||
!writer.writeUnsignedShort(_engineVersion.patch) ||
|
||||
!writer.writeUnsignedInt(_engineVersion.build) ||
|
||||
!writer.writeUint32(_saveVersion) ||
|
||||
!writer.writeUint32(_packageVersion) ||
|
||||
!writer.writeUint16(_engineVersion.major) ||
|
||||
!writer.writeUint16(_engineVersion.minor) ||
|
||||
!writer.writeUint16(_engineVersion.patch) ||
|
||||
!writer.writeUint32(_engineVersion.build) ||
|
||||
!writer.writeUEString(_engineVersion.buildId))
|
||||
{
|
||||
_lastError = "Couldn't write the header."_s;
|
||||
|
@ -106,17 +106,17 @@ UESaveFile::saveToFile() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!writer.writeUnsignedInt(_customFormatVersion) ||
|
||||
!writer.writeUnsignedInt(_customFormatData.size()))
|
||||
if(!writer.writeUint32(_customFormatVersion) ||
|
||||
!writer.writeUint32(_customFormatData.size()))
|
||||
{
|
||||
_lastError = "Couldn't write the custom format data."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
return false;
|
||||
}
|
||||
|
||||
for(UnsignedLong i = 0; i < _customFormatData.size(); i++) {
|
||||
for(std::size_t i = 0; i < _customFormatData.size(); i++) {
|
||||
if(!writer.writeStaticArray(Containers::StaticArrayView<16, const char>{_customFormatData[i].id}) ||
|
||||
!writer.writeUnsignedInt(_customFormatData[i].value))
|
||||
!writer.writeUint32(_customFormatData[i].value))
|
||||
{
|
||||
_lastError = "Couldn't write the custom format data."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -131,7 +131,7 @@ UESaveFile::saveToFile() {
|
|||
}
|
||||
|
||||
for(auto& prop : _properties) {
|
||||
UnsignedLong bytes_written = 0;
|
||||
std::size_t bytes_written = 0;
|
||||
if(!_propSerialiser->write(prop, bytes_written, writer)) {
|
||||
_lastError = "Couldn't write the property "_s + *prop->name + " to the array."_s;
|
||||
LOG_ERROR(_lastError);
|
||||
|
@ -145,7 +145,7 @@ UESaveFile::saveToFile() {
|
|||
}
|
||||
}
|
||||
|
||||
writer.writeUnsignedInt(0);
|
||||
writer.writeUint32(0u);
|
||||
|
||||
writer.closeFile();
|
||||
|
||||
|
@ -197,12 +197,12 @@ UESaveFile::loadData() {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!reader.readUnsignedInt(_saveVersion) ||
|
||||
!reader.readUnsignedInt(_packageVersion) ||
|
||||
!reader.readUnsignedShort(_engineVersion.major) ||
|
||||
!reader.readUnsignedShort(_engineVersion.minor) ||
|
||||
!reader.readUnsignedShort(_engineVersion.patch) ||
|
||||
!reader.readUnsignedInt(_engineVersion.build) ||
|
||||
if(!reader.readUint32(_saveVersion) ||
|
||||
!reader.readUint32(_packageVersion) ||
|
||||
!reader.readUint16(_engineVersion.major) ||
|
||||
!reader.readUint16(_engineVersion.minor) ||
|
||||
!reader.readUint16(_engineVersion.patch) ||
|
||||
!reader.readUint32(_engineVersion.build) ||
|
||||
!reader.readUEString(_engineVersion.buildId))
|
||||
{
|
||||
_lastError = "Couldn't read version data.";
|
||||
|
@ -210,15 +210,15 @@ UESaveFile::loadData() {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!reader.readUnsignedInt(_customFormatVersion)) {
|
||||
if(!reader.readUint32(_customFormatVersion)) {
|
||||
_lastError = "Couldn't read the custom format version.";
|
||||
LOG_ERROR(_lastError);
|
||||
return;
|
||||
}
|
||||
|
||||
UnsignedInt custom_format_data_size = 0;
|
||||
std::uint32_t custom_format_data_size = 0;
|
||||
|
||||
if(!reader.readUnsignedInt(custom_format_data_size)) {
|
||||
if(!reader.readUint32(custom_format_data_size)) {
|
||||
_lastError = "Couldn't read the custom format data size.";
|
||||
LOG_ERROR(_lastError);
|
||||
return;
|
||||
|
@ -226,11 +226,11 @@ UESaveFile::loadData() {
|
|||
|
||||
_customFormatData = Containers::Array<CustomFormatDataEntry>{custom_format_data_size};
|
||||
|
||||
for(UnsignedInt i = 0; i < custom_format_data_size; i++) {
|
||||
for(std::uint32_t i = 0; i < custom_format_data_size; i++) {
|
||||
CustomFormatDataEntry entry;
|
||||
|
||||
if(!reader.readStaticArray(entry.id) ||
|
||||
!reader.readInt(entry.value))
|
||||
!reader.readInt32(entry.value))
|
||||
{
|
||||
_lastError = "Couldn't read the custom format data";
|
||||
LOG_ERROR(_lastError);
|
||||
|
|
|
@ -23,14 +23,11 @@
|
|||
#include <Corrade/Containers/String.h>
|
||||
#include <Corrade/Containers/StringView.h>
|
||||
|
||||
#include <Magnum/Magnum.h>
|
||||
|
||||
#include "Types/UnrealPropertyBase.h"
|
||||
|
||||
#include "PropertySerialiser.h"
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
class UESaveFile {
|
||||
public:
|
||||
|
@ -72,20 +69,20 @@ class UESaveFile {
|
|||
|
||||
Containers::StaticArray<4, char> _magicBytes{'G', 'V', 'A', 'S'};
|
||||
|
||||
UnsignedInt _saveVersion = 0;
|
||||
UnsignedInt _packageVersion = 0;
|
||||
std::uint32_t _saveVersion = 0;
|
||||
std::uint32_t _packageVersion = 0;
|
||||
struct {
|
||||
UnsignedShort major = 0;
|
||||
UnsignedShort minor = 0;
|
||||
UnsignedShort patch = 0;
|
||||
UnsignedInt build = 0;
|
||||
std::uint16_t major = 0;
|
||||
std::uint16_t minor = 0;
|
||||
std::uint16_t patch = 0;
|
||||
std::uint32_t build = 0;
|
||||
Containers::String buildId;
|
||||
} _engineVersion;
|
||||
|
||||
UnsignedInt _customFormatVersion = 0;
|
||||
std::uint32_t _customFormatVersion = 0;
|
||||
struct CustomFormatDataEntry {
|
||||
Containers::StaticArray<16, char> id;
|
||||
Int value = 0;
|
||||
std::int32_t value = 0;
|
||||
};
|
||||
Containers::Array<CustomFormatDataEntry> _customFormatData;
|
||||
|
||||
|
|
|
@ -16,35 +16,22 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <Corrade/Containers/ArrayView.h>
|
||||
#include <Corrade/Containers/StaticArray.h>
|
||||
|
||||
#include <Magnum/Types.h>
|
||||
|
||||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct Crc32 {
|
||||
static const Containers::StaticArray<256, UnsignedInt> table;
|
||||
namespace Crc32 {
|
||||
|
||||
static auto update(UnsignedInt initial, Containers::ArrayView<const void> data) -> UnsignedInt {
|
||||
UnsignedInt c = initial ^ 0xFFFFFFFF;
|
||||
auto u = Containers::arrayCast<const UnsignedByte>(data);
|
||||
std::uint32_t update(std::uint32_t initial, Containers::ArrayView<const void> data) {
|
||||
static const auto table = []{
|
||||
std::uint32_t polynomial = 0xEDB88320u;
|
||||
Containers::StaticArray<256, std::uint32_t> temp{ValueInit};
|
||||
|
||||
for(std::size_t i = 0; i < data.size(); ++i) {
|
||||
c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8);
|
||||
}
|
||||
|
||||
return c ^ 0xFFFFFFFF;
|
||||
}
|
||||
};
|
||||
|
||||
const Containers::StaticArray<256, UnsignedInt> Crc32::table = []{
|
||||
UnsignedInt polynomial = 0xEDB88320u;
|
||||
Containers::StaticArray<256, UnsignedInt> temp{ValueInit};
|
||||
|
||||
for(UnsignedInt i = 0; i < 256; i++) {
|
||||
UnsignedInt c = i;
|
||||
for(std::uint32_t i = 0; i < 256; i++) {
|
||||
std::uint32_t c = i;
|
||||
|
||||
for(std::size_t j = 0; j < 8; j++) {
|
||||
if(c & 1) {
|
||||
|
@ -59,4 +46,17 @@ const Containers::StaticArray<256, UnsignedInt> Crc32::table = []{
|
|||
}
|
||||
|
||||
return temp;
|
||||
}();
|
||||
}();
|
||||
|
||||
std::uint32_t c = initial ^ 0xFFFFFFFF;
|
||||
|
||||
auto u = Containers::arrayCast<const std::uint8_t>(data);
|
||||
|
||||
for(std::size_t i = 0; i < data.size(); ++i) {
|
||||
c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8);
|
||||
}
|
||||
|
||||
return c ^ 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
} // Crc32
|
||||
|
|
|
@ -81,7 +81,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
SaveTool app({argc, argv});
|
||||
Int result = app.exec();
|
||||
int result = app.exec();
|
||||
|
||||
ReleaseMutex(mutex_handle);
|
||||
|
||||
|
|
Loading…
Reference in a new issue