OpenFusion/src/CNStructs.hpp

44 lines
1.0 KiB
C++
Raw Normal View History

2020-08-18 20:42:30 +00:00
/*
CNStructs.hpp - defines some basic structs & useful methods for packets used by FusionFall based on the version defined
2020-08-18 20:42:30 +00:00
*/
#ifndef _CNS_HPP
#define _CNS_HPP
#ifdef _MSC_VER
// codecvt_* is deprecated in C++17 and MSVC will throw an annoying warning because of that.
// Defining this before anything else to silence it.
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#endif
2020-08-18 20:42:30 +00:00
#include <iostream>
#include <stdio.h>
#include <stdint.h>
2020-08-20 15:43:37 +00:00
#ifndef _MSC_VER
#include <sys/time.h>
2020-08-20 15:43:37 +00:00
#else
// Can't use this in MSVC.
#include <time.h>
2020-08-20 15:43:37 +00:00
#endif
2020-08-18 20:42:30 +00:00
#include <cstring>
#include <string>
#include <locale>
#include <codecvt>
// TODO: rewrite U16toU8 & U8toU16 to not use codecvt
std::string U16toU8(char16_t* src);
2020-08-20 16:37:47 +00:00
int U8toU16(std::string src, char16_t* des); // returns number of char16_t that was written at des
2020-08-18 20:42:30 +00:00
uint64_t getTime();
//#define CNPROTO_VERSION_0728
2020-08-19 20:00:39 +00:00
#define CNPROTO_VERSION_0104
2020-08-18 20:42:30 +00:00
#if defined(CNPROTO_VERSION_0104)
2020-08-21 00:37:34 +00:00
#include "structs/0104.hpp"
#elif defined(CNPROTO_VERSION_0728)
2020-08-21 00:37:34 +00:00
#include "structs/0728.hpp"
2020-08-19 20:00:39 +00:00
#endif
#endif