Humungous refactor

This commit is contained in:
Jack Andersen 2016-03-04 13:00:12 -10:00
parent a0515fe4aa
commit b791b7e426
103 changed files with 499 additions and 500 deletions

View File

@ -1,6 +1,6 @@
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.0)
project(Athena)
project(athena)
endif()
##################
@ -33,84 +33,84 @@ list(APPEND CORE_EXTRA src/gekko_support.c include/gekko_support.h)
endif()
endif()
add_library(AthenaCore
src/Athena/Utility.cpp
src/Athena/FileReader.cpp
src/Athena/FileWriter.cpp
src/Athena/MemoryReader.cpp
src/Athena/MemoryWriter.cpp
src/Athena/Global.cpp
src/Athena/Checksums.cpp
src/Athena/Compression.cpp
add_library(athena-core
src/athena/Utility.cpp
src/athena/FileReader.cpp
src/athena/FileWriter.cpp
src/athena/MemoryReader.cpp
src/athena/MemoryWriter.cpp
src/athena/Global.cpp
src/athena/Checksums.cpp
src/athena/Compression.cpp
src/LZ77/LZLookupTable.cpp
src/LZ77/LZType10.cpp
src/LZ77/LZType11.cpp
src/LZ77/LZBase.cpp
src/Athena/FileInfo.cpp
src/Athena/Dir.cpp
src/Athena/DNAYaml.cpp
src/athena/FileInfo.cpp
src/athena/Dir.cpp
src/athena/DNAYaml.cpp
${CORE_EXTRA}
include/Athena/IStream.hpp
include/Athena/IStreamReader.hpp
include/Athena/IStreamWriter.hpp
include/Athena/Types.hpp
include/Athena/Utility.hpp
include/Athena/Global.hpp
include/Athena/FileReader.hpp
include/Athena/FileWriter.hpp
include/Athena/MemoryReader.hpp
include/Athena/MemoryWriter.hpp
include/Athena/Checksums.hpp
include/Athena/Compression.hpp
include/athena/IStream.hpp
include/athena/IStreamReader.hpp
include/athena/IStreamWriter.hpp
include/athena/Types.hpp
include/athena/Utility.hpp
include/athena/Global.hpp
include/athena/FileReader.hpp
include/athena/FileWriter.hpp
include/athena/MemoryReader.hpp
include/athena/MemoryWriter.hpp
include/athena/Checksums.hpp
include/athena/Compression.hpp
include/LZ77/LZBase.hpp
include/LZ77/LZLookupTable.hpp
include/LZ77/LZType10.hpp
include/LZ77/LZType11.hpp
include/Athena/FileInfo.hpp
include/Athena/Dir.hpp
include/Athena/DNA.hpp
include/Athena/DNAYaml.hpp
include/athena/FileInfo.hpp
include/athena/Dir.hpp
include/athena/DNA.hpp
include/athena/DNAYaml.hpp
include/yaml.h
include/utf8proc.h
)
add_library(AthenaSakura EXCLUDE_FROM_ALL
src/Athena/Sprite.cpp
src/Athena/SpriteFile.cpp
src/Athena/SpriteFileReader.cpp
src/Athena/SpriteFileWriter.cpp
src/Athena/SpriteFrame.cpp
src/Athena/SpritePart.cpp
add_library(athena-sakura EXCLUDE_FROM_ALL
src/athena/Sprite.cpp
src/athena/SpriteFile.cpp
src/athena/SpriteFileReader.cpp
src/athena/SpriteFileWriter.cpp
src/athena/SpriteFrame.cpp
src/athena/SpritePart.cpp
include/Athena/SakuraGlobal.hpp
include/Athena/Sprite.hpp
include/Athena/SpriteFile.hpp
include/Athena/SpriteFileReader.hpp
include/Athena/SpriteFileWriter.hpp
include/Athena/SpriteFrame.hpp
include/Athena/SpritePart.hpp
include/athena/SakuraGlobal.hpp
include/athena/Sprite.hpp
include/athena/SpriteFile.hpp
include/athena/SpriteFileReader.hpp
include/athena/SpriteFileWriter.hpp
include/athena/SpriteFrame.hpp
include/athena/SpritePart.hpp
)
add_library(AthenaWiiSave EXCLUDE_FROM_ALL
src/Athena/WiiBanner.cpp
src/Athena/WiiFile.cpp
src/Athena/WiiImage.cpp
src/Athena/WiiSave.cpp
src/Athena/WiiSaveReader.cpp
src/Athena/WiiSaveWriter.cpp
add_library(athena-wiisave EXCLUDE_FROM_ALL
src/athena/WiiBanner.cpp
src/athena/WiiFile.cpp
src/athena/WiiImage.cpp
src/athena/WiiSave.cpp
src/athena/WiiSaveReader.cpp
src/athena/WiiSaveWriter.cpp
src/bn.cpp
src/ec.cpp
src/md5.cpp
src/sha1.cpp
src/aes.cpp
include/Athena/WiiBanner.hpp
include/Athena/WiiFile.hpp
include/Athena/WiiImage.hpp
include/Athena/WiiSave.hpp
include/Athena/WiiSaveReader.hpp
include/Athena/WiiSaveWriter.hpp
include/athena/WiiBanner.hpp
include/athena/WiiFile.hpp
include/athena/WiiImage.hpp
include/athena/WiiSave.hpp
include/athena/WiiSaveReader.hpp
include/athena/WiiSaveWriter.hpp
include/aes.hpp
include/bn.h
include/ec.h
@ -121,36 +121,36 @@ if(NOT MSVC AND NOT GEKKO)
set_source_files_properties(src/aes.cpp PROPERTIES COMPILE_FLAGS -maes)
endif()
add_library(AthenaZelda EXCLUDE_FROM_ALL
src/Athena/ALTTPFile.cpp
src/Athena/ALTTPFileReader.cpp
src/Athena/ALTTPFileWriter.cpp
src/Athena/ALTTPQuest.cpp
src/Athena/MCFile.cpp
src/Athena/MCFileReader.cpp
src/Athena/MCFileWriter.cpp
src/Athena/MCSlot.cpp
src/Athena/SkywardSwordFile.cpp
src/Athena/SkywardSwordFileReader.cpp
src/Athena/SkywardSwordFileWriter.cpp
src/Athena/SkywardSwordQuest.cpp
src/Athena/ZQuestFile.cpp
src/Athena/ZQuestFileReader.cpp
src/Athena/ZQuestFileWriter.cpp
add_library(athena-zelda EXCLUDE_FROM_ALL
src/athena/ALTTPFile.cpp
src/athena/ALTTPFileReader.cpp
src/athena/ALTTPFileWriter.cpp
src/athena/ALTTPQuest.cpp
src/athena/MCFile.cpp
src/athena/MCFileReader.cpp
src/athena/MCFileWriter.cpp
src/athena/MCSlot.cpp
src/athena/SkywardSwordFile.cpp
src/athena/SkywardSwordFileReader.cpp
src/athena/SkywardSwordFileWriter.cpp
src/athena/SkywardSwordQuest.cpp
src/athena/ZQuestFile.cpp
src/athena/ZQuestFileReader.cpp
src/athena/ZQuestFileWriter.cpp
include/Athena/ALTTPEnums.hpp
include/Athena/ALTTPFile.hpp
include/Athena/ALTTPFileReader.hpp
include/Athena/ALTTPFileWriter.hpp
include/Athena/ALTTPQuest.hpp
include/Athena/ALTTPStructs.hpp
include/Athena/MCFile.hpp
include/Athena/MCFileReader.hpp
include/Athena/MCFileWriter.hpp
include/Athena/SkywardSwordFile.hpp
include/Athena/SkywardSwordFileReader.hpp
include/Athena/SkywardSwordFileWriter.hpp
include/Athena/SkywardSwordQuest.hpp
include/athena/ALTTPEnums.hpp
include/athena/ALTTPFile.hpp
include/athena/ALTTPFileReader.hpp
include/athena/ALTTPFileWriter.hpp
include/athena/ALTTPQuest.hpp
include/athena/ALTTPStructs.hpp
include/athena/MCFile.hpp
include/athena/MCFileReader.hpp
include/athena/MCFileWriter.hpp
include/athena/SkywardSwordFile.hpp
include/athena/SkywardSwordFileReader.hpp
include/athena/SkywardSwordFileWriter.hpp
include/athena/SkywardSwordQuest.hpp
)
# Icon
@ -162,7 +162,7 @@ set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header fi
if(WIN32 AND NOT CYGWIN)
set(INSTALL_CMAKE_DIR cmake)
else()
set(INSTALL_CMAKE_DIR lib/cmake/Athena)
set(INSTALL_CMAKE_DIR lib/cmake/athena)
endif()
# Make relative paths absolute (needed later on)
@ -176,16 +176,16 @@ foreach(p LIB INCLUDE CMAKE)
endforeach()
# Define installs
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena COMPONENT Athena)
install(TARGETS AthenaCore
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT Athena)
install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT athena)
install(TARGETS athena-core
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
if(WIN32 AND NOT CYGWIN)
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT Athena)
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena)
elseif(UNIX)
configure_file(libAthena.pc.in libAthena.pc @ONLY)
configure_file(PKGBUILD.in ${CMAKE_CURRENT_SOURCE_DIR}/PKGBUILD @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/libAthena.pc
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT Athena)
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT athena)
endif()
##################
@ -193,22 +193,21 @@ endif()
##################
# Add all targets to the build-tree export set
export(TARGETS AthenaCore
FILE "${PROJECT_BINARY_DIR}/AthenaTargets.cmake")
export(TARGETS athena-core FILE "${PROJECT_BINARY_DIR}/AthenaTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE Athena)
export(PACKAGE athena)
# Create the AthenaConfig.cmake
# ... for the build tree
set(CONF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/Athena")
set(CONF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/athena")
set(CONF_ICON_DIR "${PROJECT_SOURCE_DIR}/Athena.ico")
configure_file(AthenaConfig.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfig.cmake" @ONLY)
# ... for the install tree
file(RELATIVE_PATH REL_INCLUDE_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_INCLUDE_DIR}")
file(RELATIVE_PATH REL_ICON_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_LIB_DIR}/Athena.ico")
set(CONF_INCLUDE_DIR "\${ATHENA_CMAKE_DIR}/${REL_INCLUDE_DIR}/Athena")
set(CONF_INCLUDE_DIR "\${ATHENA_CMAKE_DIR}/${REL_INCLUDE_DIR}/athena")
set(CONF_ICON_DIR "\${ATHENA_CMAKE_DIR}/${REL_ICON_DIR}")
configure_file(AthenaConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake" @ONLY)
# ... for both
@ -218,10 +217,10 @@ configure_file(AthenaConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/AthenaConfigV
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake"
"${PROJECT_BINARY_DIR}/AthenaConfigVersion.cmake"
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
# Install the export set for use with the install-tree
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
################
# atdna import #
@ -243,11 +242,11 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Athena")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
if(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Athena")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "athena")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")

View File

@ -10,7 +10,7 @@ add_executable(Example
if(GEKKO)
include_directories(${LIBOGCDIR}/include)
link_directories(${LIGOGCDIR}/lib/wii)
target_link_libraries(Example AthenaCore z wiiuse bte ogc m)
target_link_libraries(Example athena-core z wiiuse bte ogc m)
else()
#TODO: add normal link libraries
endif()

View File

@ -10,7 +10,7 @@ static GXRModeObj* rmode = nullptr;
#endif
#include <Athena/MemoryReader.hpp>
#include <athena/MemoryReader.hpp>
int main()
{
@ -36,7 +36,7 @@ int main()
if (rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();
Athena::io::MemoryCopyReader test("sd:/test.dat");
athena::io::MemoryCopyReader test("sd:/test.dat");
while(true)
{
#if HW_RVL

View File

@ -86,7 +86,7 @@ endif()
# Define installs
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna)
install(DIRECTORY ${CLANG_INCLUDE_DIR}/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena/clang COMPONENT atdna)
install(DIRECTORY ${CLANG_INCLUDE_DIR}/ DESTINATION ${INSTALL_INCLUDE_DIR}/athena/clang COMPONENT atdna)
##################
# Package Export #

View File

@ -15,8 +15,8 @@
#include "llvm/Support/CommandLine.h"
static unsigned AthenaError = 0;
#define ATHENA_DNA_BASETYPE "struct Athena::io::DNA"
#define ATHENA_DNA_YAMLTYPE "struct Athena::io::DNAYaml"
#define ATHENA_DNA_BASETYPE "struct athena::io::DNA"
#define ATHENA_DNA_YAMLTYPE "struct athena::io::DNAYaml"
#define ATHENA_DNA_READER "__dna_reader"
#define ATHENA_DNA_WRITER "__dna_writer"
#define ATHENA_YAML_READER "__dna_docin"
@ -1148,9 +1148,9 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
for (int p=0 ; p<2 ; ++p)
{
if (p)
fileOut << "void " << decl->getQualifiedNameAsString() << "::write(Athena::io::IStreamWriter& " ATHENA_DNA_WRITER ") const\n{\n";
fileOut << "void " << decl->getQualifiedNameAsString() << "::write(athena::io::IStreamWriter& " ATHENA_DNA_WRITER ") const\n{\n";
else
fileOut << "void " << decl->getQualifiedNameAsString() << "::read(Athena::io::IStreamReader& " ATHENA_DNA_READER ")\n{\n";
fileOut << "void " << decl->getQualifiedNameAsString() << "::read(athena::io::IStreamReader& " ATHENA_DNA_READER ")\n{\n";
if (baseDNA.size())
{
@ -1823,23 +1823,23 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
if (directionVal == 0)
{
if (!p)
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", Athena::Begin);\n";
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", athena::Begin);\n";
else
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", Athena::Begin);\n";
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", athena::Begin);\n";
}
else if (directionVal == 1)
{
if (!p)
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", Athena::Current);\n";
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", athena::Current);\n";
else
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", Athena::Current);\n";
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", athena::Current);\n";
}
else if (directionVal == 2)
{
if (!p)
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", Athena::End);\n";
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", athena::End);\n";
else
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", Athena::End);\n";
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", athena::End);\n";
}
}
@ -1882,16 +1882,16 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
else if (align.isPowerOf2())
{
if (!p)
fileOut << " " ATHENA_DNA_READER ".seek((" ATHENA_DNA_READER ".position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", Athena::Begin);\n";
fileOut << " " ATHENA_DNA_READER ".seek((" ATHENA_DNA_READER ".position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", athena::Begin);\n";
else
fileOut << " " ATHENA_DNA_WRITER ".seek((" ATHENA_DNA_WRITER ".position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", Athena::Begin);\n";
fileOut << " " ATHENA_DNA_WRITER ".seek((" ATHENA_DNA_WRITER ".position() + " << alignVal-1 << ") & ~" << alignVal-1 << ", athena::Begin);\n";
}
else
{
if (!p)
fileOut << " " ATHENA_DNA_READER ".seek((" ATHENA_DNA_READER ".position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", Athena::Begin);\n";
fileOut << " " ATHENA_DNA_READER ".seek((" ATHENA_DNA_READER ".position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", athena::Begin);\n";
else
fileOut << " " ATHENA_DNA_WRITER ".seek((" ATHENA_DNA_WRITER ".position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", Athena::Begin);\n";
fileOut << " " ATHENA_DNA_WRITER ".seek((" ATHENA_DNA_WRITER ".position() + " << alignVal-1 << ") / " << alignVal << " * " << alignVal << ", athena::Begin);\n";
}
}
}
@ -1926,9 +1926,9 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
for (int p=0 ; p<2 ; ++p)
{
if (p)
fileOut << "void " << decl->getQualifiedNameAsString() << "::write(Athena::io::YAMLDocWriter& " ATHENA_YAML_WRITER ") const\n{\n";
fileOut << "void " << decl->getQualifiedNameAsString() << "::write(athena::io::YAMLDocWriter& " ATHENA_YAML_WRITER ") const\n{\n";
else
fileOut << "void " << decl->getQualifiedNameAsString() << "::read(Athena::io::YAMLDocReader& " ATHENA_YAML_READER ")\n{\n";
fileOut << "void " << decl->getQualifiedNameAsString() << "::read(athena::io::YAMLDocReader& " ATHENA_YAML_READER ")\n{\n";
if (baseDNA.size())
{
@ -2274,7 +2274,7 @@ public:
if (!decl->getNumBases())
return true;
/* First ensure this inherits from struct Athena::io::DNA */
/* First ensure this inherits from struct athena::io::DNA */
std::string baseDNA;
bool isYAML = false;
if (!isDNARecord(decl, baseDNA, isYAML))
@ -2333,9 +2333,9 @@ public:
{
/* Write file head */
fileOut << "/* Auto generated atdna implementation */\n"
"#include <Athena/Global.hpp>\n"
"#include <Athena/IStreamReader.hpp>\n"
"#include <Athena/IStreamWriter.hpp>\n\n";
"#include <athena/Global.hpp>\n"
"#include <athena/IStreamReader.hpp>\n"
"#include <athena/IStreamWriter.hpp>\n\n";
for (const std::string& inputf : InputFilenames)
fileOut << "#include \"" << inputf << "\"\n";
fileOut << "\n";

View File

@ -1,6 +1,6 @@
#include <Athena/DNAYaml.hpp>
#include <athena/DNAYaml.hpp>
using namespace Athena;
using namespace athena;
typedef io::DNAYaml<BigEndian> BigDNA;
struct TESTSubFile : public BigDNA

View File

@ -6,6 +6,6 @@ set(YAML_VERSION_STRING "${YAML_VERSION_MAJOR}.${YAML_VERSION_MINOR}.${YAML_VERS
file(GLOB SRC src/*.c)
include_directories(../../include)
add_library(AthenaLibYaml STATIC ${SRC})
add_library(athena-libyaml STATIC ${SRC})
install(TARGETS AthenaLibYaml DESTINATION lib COMPONENT yaml)
install(TARGETS athena-libyaml DESTINATION lib COMPONENT yaml)

View File

@ -5,7 +5,7 @@
#include <deque>
#include <vector>
#include <cstdint>
#include <Athena/Types.hpp>
#include <athena/Types.hpp>
struct LZLengthOffset
{

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#include <memory>
namespace Athena
namespace athena
{
class IAES

View File

@ -3,7 +3,7 @@
#include "Types.hpp"
namespace Athena
namespace athena
{
enum BowType : char

View File

@ -1,10 +1,10 @@
#ifndef ALTTP_FILE_HPP
#define ALTTP_FILE_HPP
#include "Athena/Global.hpp"
#include "athena/Global.hpp"
#include <vector>
namespace Athena
namespace athena
{
class ALTTPQuest;

View File

@ -2,11 +2,11 @@
#define ALTTP_FILE_READER_HPP
#include <string>
#include "Athena/Types.hpp"
#include "Athena/MemoryReader.hpp"
#include "Athena/ALTTPQuest.hpp"
#include "athena/Types.hpp"
#include "athena/MemoryReader.hpp"
#include "athena/ALTTPQuest.hpp"
namespace Athena
namespace athena
{
class ALTTPFile;

View File

@ -2,10 +2,10 @@
#define ALTTP_FILE_WRITER_HPP
#include <string>
#include "Athena/MemoryWriter.hpp"
#include "Athena/ALTTPQuest.hpp"
#include "athena/MemoryWriter.hpp"
#include "athena/ALTTPQuest.hpp"
namespace Athena
namespace athena
{
class ALTTPFile;

View File

@ -1,13 +1,13 @@
#ifndef ALTTP_QUEST_HPP
#define ALTTP_QUEST_HPP
#include "Athena/Global.hpp"
#include "athena/Global.hpp"
#include <string>
#include <vector>
#include "Athena/ALTTPStructs.hpp"
#include "Athena/ALTTPEnums.hpp"
#include "athena/ALTTPStructs.hpp"
#include "athena/ALTTPEnums.hpp"
namespace Athena
namespace athena
{
/*! \class ALTTPQuest

View File

@ -2,9 +2,9 @@
#define ALTTP_STRUCTS_HPP
#include <string>
#include "Athena/Types.hpp"
#include "athena/Types.hpp"
namespace Athena
namespace athena
{
struct ALTTPRoomFlags

View File

@ -1,9 +1,9 @@
#ifndef CHECKSUMS_HPP
#define CHECKSUMS_HPP
#include "Athena/Global.hpp"
#include "athena/Global.hpp"
namespace Athena
namespace athena
{
namespace Checksums
{

View File

@ -1,9 +1,9 @@
#ifndef COMPRESSION_HPP
#define COMPRESSION_HPP
#include "Athena/Global.hpp"
#include "athena/Global.hpp"
namespace Athena
namespace athena
{
namespace io
{

View File

@ -13,7 +13,7 @@
#include <vector>
#include <memory>
namespace Athena
namespace athena
{
namespace io
{
@ -84,7 +84,7 @@ struct DNA
* @tparam sizeVar C++ expression wrapped in DNA_COUNT macro to determine number of bytes for buffer
*/
template <size_t sizeVar>
using Buffer = struct Athena::io::Buffer<sizeVar, DNAE>;
using Buffer = struct athena::io::Buffer<sizeVar, DNAE>;
/**
* @brief Template type wrapping std::string and signaling atdna to read string data where it's used
@ -92,7 +92,7 @@ struct DNA
* -1 literal indicates null-terminated string
*/
template <atInt32 sizeVar = -1>
using String = struct Athena::io::String<sizeVar, DNAE>;
using String = struct athena::io::String<sizeVar, DNAE>;
/**
* @brief Template type wrapping std::wstring and signaling atdna to read wstring data where it's used
@ -100,7 +100,7 @@ struct DNA
* -1 literal indicates null-terminated wstring
*/
template <atInt32 sizeVar = -1, Endian VE = DNAE>
using WString = struct Athena::io::WString<sizeVar, VE>;
using WString = struct athena::io::WString<sizeVar, VE>;
/**
* @brief Template type wrapping std::string and signaling atdna to read wstring data where it's used
@ -108,7 +108,7 @@ struct DNA
* -1 literal indicates null-terminated string
*/
template <atInt32 sizeVar = -1>
using WStringAsString = struct Athena::io::WStringAsString<sizeVar, DNAE>;
using WStringAsString = struct athena::io::WStringAsString<sizeVar, DNAE>;
/**
* @brief Meta Template signaling atdna to insert a stream seek where it's used
@ -232,14 +232,14 @@ struct WStringAsString : public DNA<VE>, public std::string
/** Macro to automatically declare read/write methods in subclasses */
#define DECL_DNA \
void read(Athena::io::IStreamReader&); \
void write(Athena::io::IStreamWriter&) const; \
void read(athena::io::IStreamReader&); \
void write(athena::io::IStreamWriter&) const; \
size_t binarySize(size_t __isz) const;
/** Macro to automatically declare read/write methods and prevent outputting implementation */
#define DECL_EXPLICIT_DNA \
void read(Athena::io::IStreamReader&); \
void write(Athena::io::IStreamWriter&) const; \
void read(athena::io::IStreamReader&); \
void write(athena::io::IStreamWriter&) const; \
size_t binarySize(size_t __isz) const; \
Delete __dna_delete;

View File

@ -13,7 +13,7 @@
#include "DNA.hpp"
#include "FileReader.hpp"
namespace Athena
namespace athena
{
namespace io
{
@ -1143,16 +1143,16 @@ struct DNAYaml : DNA<DNAE>
virtual const char* DNATypeV() const {return nullptr;}
template <size_t sizeVar>
using Buffer = struct Athena::io::BufferYaml<sizeVar, DNAE>;
using Buffer = struct athena::io::BufferYaml<sizeVar, DNAE>;
template <atInt32 sizeVar = -1>
using String = struct Athena::io::StringYaml<sizeVar, DNAE>;
using String = struct athena::io::StringYaml<sizeVar, DNAE>;
template <atInt32 sizeVar = -1, Endian VE = DNAE>
using WString = struct Athena::io::WStringYaml<sizeVar, VE>;
using WString = struct athena::io::WStringYaml<sizeVar, VE>;
template <atInt32 sizeVar = -1>
using WStringAsString = struct Athena::io::WStringAsStringYaml<sizeVar, DNAE>;
using WStringAsString = struct athena::io::WStringAsStringYaml<sizeVar, DNAE>;
std::string toYAMLString() const
{
@ -1228,7 +1228,7 @@ struct DNAYaml : DNA<DNAE>
}
template<class DNASubtype>
static bool ValidateFromYAMLFile(Athena::io::FileReader& fin)
static bool ValidateFromYAMLFile(athena::io::FileReader& fin)
{
return ValidateFromYAMLFile<DNASubtype>(fin._fileHandle());
}
@ -1251,9 +1251,9 @@ struct BufferYaml : public DNAYaml<VE>, public std::unique_ptr<atUint8[]>
{
return __isz + sizeVar;
}
void read(Athena::io::YAMLDocReader& reader)
void read(athena::io::YAMLDocReader& reader)
{*this = reader.readUBytes(nullptr);}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{writer.writeUBytes(nullptr, *this, sizeVar);}
};
@ -1267,9 +1267,9 @@ struct StringYaml : public DNAYaml<VE>, public std::string
{writer.writeString(*this, sizeVar);}
size_t binarySize(size_t __isz) const
{return __isz + ((sizeVar<0)?(this->size()+1):sizeVar);}
void read(Athena::io::YAMLDocReader& reader)
void read(athena::io::YAMLDocReader& reader)
{this->assign(std::move(reader.readString(nullptr)));}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{writer.writeString(nullptr, *this);}
std::string& operator=(const std::string& __str)
{return this->assign(__str);}
@ -1293,9 +1293,9 @@ struct WStringYaml : public DNAYaml<VE>, public std::wstring
}
size_t binarySize(size_t __isz) const
{return __isz + (((sizeVar<0)?(this->size()+1):sizeVar)*2);}
void read(Athena::io::YAMLDocReader& reader)
void read(athena::io::YAMLDocReader& reader)
{this->assign(std::move(reader.readWString(nullptr)));}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{writer.writeWString(nullptr, *this);}
std::wstring& operator=(const std::wstring& __str)
{return this->assign(__str);}
@ -1313,9 +1313,9 @@ struct WStringAsStringYaml : public DNAYaml<VE>, public std::string
{writer.writeStringAsWString(*this, sizeVar);}
size_t binarySize(size_t __isz) const
{return __isz + (((sizeVar<0)?(this->size()+1):sizeVar)*2);}
void read(Athena::io::YAMLDocReader& reader)
void read(athena::io::YAMLDocReader& reader)
{this->assign(std::move(reader.readString(nullptr)));}
void write(Athena::io::YAMLDocWriter& writer) const
void write(athena::io::YAMLDocWriter& writer) const
{writer.writeString(nullptr, *this);}
std::string& operator=(const std::string& __str)
{return this->assign(__str);}
@ -1326,15 +1326,15 @@ struct WStringAsStringYaml : public DNAYaml<VE>, public std::string
/** Macro to automatically declare YAML read/write methods in subclasses */
#define DECL_YAML \
DECL_DNA \
void read(Athena::io::YAMLDocReader&); \
void write(Athena::io::YAMLDocWriter&) const; \
void read(athena::io::YAMLDocReader&); \
void write(athena::io::YAMLDocWriter&) const; \
static const char* DNAType(); \
const char* DNATypeV() const {return DNAType();} \
/** Macro to automatically declare YAML read/write methods with client-code's definition */
#define DECL_EXPLICIT_YAML \
void read(Athena::io::YAMLDocReader&); \
void write(Athena::io::YAMLDocWriter&) const; \
void read(athena::io::YAMLDocReader&); \
void write(athena::io::YAMLDocWriter&) const; \
static const char* DNAType(); \
const char* DNATypeV() const {return DNAType();} \

View File

@ -1,14 +1,14 @@
#ifndef DIR_HPP
#define DIR_HPP
#include "Athena/FileInfo.hpp"
#include "athena/FileInfo.hpp"
#include <stdio.h>
#if _WIN32
typedef int mode_t;
#endif
namespace Athena
namespace athena
{
class Dir
{

View File

@ -3,9 +3,9 @@
#include <string>
#include "Athena/Global.hpp"
#include "athena/Global.hpp"
namespace Athena
namespace athena
{
class FileInfo
{

View File

@ -4,9 +4,9 @@
#include <string>
#include <memory>
#include <stdio.h>
#include "Athena/IStreamReader.hpp"
#include "athena/IStreamReader.hpp"
namespace Athena
namespace athena
{
namespace io
{
@ -66,7 +66,7 @@ protected:
#ifndef FILEREADER_BASE
#define FILEREADER_BASE() \
private: \
typedef Athena::io::FileReader base
typedef athena::io::FileReader base
#endif // FILEREADER_BASE

View File

@ -1,10 +1,10 @@
#ifndef FILEWRITER_HPP
#define FILEWRITER_HPP
#include "Athena/IStreamWriter.hpp"
#include "athena/IStreamWriter.hpp"
#include <stdio.h>
namespace Athena
namespace athena
{
namespace io
{
@ -59,7 +59,7 @@ private:
#ifndef FILEWRITER_BASE
#define FILEWRITER_BASE() \
private: \
typedef Athena::io::FileWriter base;
typedef athena::io::FileWriter base;
#endif // FILEWRITER_BASE
#endif // FILEWRITER_HPP

View File

@ -2,8 +2,8 @@
#define GLOBAL_HPP
#include <iostream>
#include "Athena/Types.hpp"
#include "Athena/Utility.hpp"
#include "athena/Types.hpp"
#include "athena/Utility.hpp"
#ifdef _MSC_VER
#pragma warning(disable : 4996)
@ -100,7 +100,7 @@ inline type operator~(const type& key)\
}
#endif
namespace Athena
namespace athena
{
namespace error
{
@ -126,7 +126,7 @@ enum Endian
};
} // Athena
typedef void (*atEXCEPTION_HANDLER)(Athena::error::Level level, const char* file, const char* function, int line, const char* fmt, ...);
typedef void (*atEXCEPTION_HANDLER)(athena::error::Level level, const char* file, const char* function, int line, const char* fmt, ...);
atEXCEPTION_HANDLER atGetExceptionHandler();
/**
@ -135,15 +135,15 @@ atEXCEPTION_HANDLER atGetExceptionHandler();
*/
void atSetExceptionHandler(atEXCEPTION_HANDLER func);
std::ostream& operator<<(std::ostream& os, const Athena::SeekOrigin& origin);
std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian);
std::ostream& operator<<(std::ostream& os, const athena::SeekOrigin& origin);
std::ostream& operator<<(std::ostream& os, const athena::Endian& endian);
#ifdef _MSC_VER
#ifndef NDEBUG
#define atDebug(fmt, ...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
} while(0)
#else
#define atDebug(fmt, ...)
@ -152,25 +152,25 @@ std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian);
#define atMessage(fmt, ...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
} while(0)
#define atWarning(fmt, ...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
__handler(athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
} while(0)
#define atError(fmt, ...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
__handler(athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
} while(0)
#define atFatal(fmt, ...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
__handler(athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt, ##__VA_ARGS__); \
} while(0)
#elif defined(__GNUC__)
@ -178,7 +178,7 @@ std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian);
#define atDebug(fmt...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
} while(0)
#else // _MSC_VER
#define atDebug(fmt, ...)
@ -187,25 +187,25 @@ std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian);
#define atMessage(fmt...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
__handler(athena::error::Level::Message, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
} while(0)
#define atWarning(fmt...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
__handler(athena::error::Level::Warning, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
} while(0)
#define atError(fmt...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
__handler(athena::error::Level::Error, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
} while(0)
#define atFatal(fmt...) \
do { atEXCEPTION_HANDLER __handler = atGetExceptionHandler(); \
if (__handler) \
__handler(Athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
__handler(athena::error::Level::Fatal, __FILE__, AT_PRETTY_FUNCTION, __LINE__, fmt); \
} while(0)
#endif // defined(__GNUC__)

View File

@ -3,7 +3,7 @@
#include "Global.hpp"
namespace Athena
namespace athena
{
namespace io
{

View File

@ -6,7 +6,7 @@
#include "utf8proc.h"
#include "IStream.hpp"
namespace Athena
namespace athena
{
namespace io
{

View File

@ -4,7 +4,7 @@
#include "utf8proc.h"
#include "IStream.hpp"
namespace Athena
namespace athena
{
namespace io
{

View File

@ -1,9 +1,9 @@
#ifndef MCFILE_HPP
#define MCFILE_HPP
#include "Athena/Global.hpp"
#include "athena/Global.hpp"
namespace Athena
namespace athena
{
class MCSlot;

View File

@ -1,9 +1,9 @@
#ifndef MCFILEREADER_HPP
#define MCFILEREADER_HPP
#include "Athena/MemoryReader.hpp"
#include "athena/MemoryReader.hpp"
namespace Athena
namespace athena
{
class MCFile;

View File

@ -1,10 +1,10 @@
#ifndef MCFILEWRITER_HPP
#define MCFILEWRITER_HPP
#include "Athena/Types.hpp"
#include "Athena/MemoryWriter.hpp"
#include "athena/Types.hpp"
#include "athena/MemoryWriter.hpp"
namespace Athena
namespace athena
{
class MCFile;