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

View File

@ -10,7 +10,7 @@ add_executable(Example
if(GEKKO) if(GEKKO)
include_directories(${LIBOGCDIR}/include) include_directories(${LIBOGCDIR}/include)
link_directories(${LIGOGCDIR}/lib/wii) 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() else()
#TODO: add normal link libraries #TODO: add normal link libraries
endif() endif()

View File

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

View File

@ -86,7 +86,7 @@ endif()
# Define installs # Define installs
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna) 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 # # Package Export #

View File

@ -15,8 +15,8 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
static unsigned AthenaError = 0; static unsigned AthenaError = 0;
#define ATHENA_DNA_BASETYPE "struct Athena::io::DNA" #define ATHENA_DNA_BASETYPE "struct athena::io::DNA"
#define ATHENA_DNA_YAMLTYPE "struct Athena::io::DNAYaml" #define ATHENA_DNA_YAMLTYPE "struct athena::io::DNAYaml"
#define ATHENA_DNA_READER "__dna_reader" #define ATHENA_DNA_READER "__dna_reader"
#define ATHENA_DNA_WRITER "__dna_writer" #define ATHENA_DNA_WRITER "__dna_writer"
#define ATHENA_YAML_READER "__dna_docin" #define ATHENA_YAML_READER "__dna_docin"
@ -1148,9 +1148,9 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
for (int p=0 ; p<2 ; ++p) for (int p=0 ; p<2 ; ++p)
{ {
if (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 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()) if (baseDNA.size())
{ {
@ -1823,23 +1823,23 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
if (directionVal == 0) if (directionVal == 0)
{ {
if (!p) if (!p)
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", Athena::Begin);\n"; fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", athena::Begin);\n";
else else
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", Athena::Begin);\n"; fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", athena::Begin);\n";
} }
else if (directionVal == 1) else if (directionVal == 1)
{ {
if (!p) if (!p)
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", Athena::Current);\n"; fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", athena::Current);\n";
else else
fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", Athena::Current);\n"; fileOut << " " ATHENA_DNA_WRITER ".seek(" << offsetExprStr << ", athena::Current);\n";
} }
else if (directionVal == 2) else if (directionVal == 2)
{ {
if (!p) if (!p)
fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", Athena::End);\n"; fileOut << " " ATHENA_DNA_READER ".seek(" << offsetExprStr << ", athena::End);\n";
else 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()) else if (align.isPowerOf2())
{ {
if (!p) 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 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 else
{ {
if (!p) 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 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) for (int p=0 ; p<2 ; ++p)
{ {
if (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 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()) if (baseDNA.size())
{ {
@ -2274,7 +2274,7 @@ public:
if (!decl->getNumBases()) if (!decl->getNumBases())
return true; return true;
/* First ensure this inherits from struct Athena::io::DNA */ /* First ensure this inherits from struct athena::io::DNA */
std::string baseDNA; std::string baseDNA;
bool isYAML = false; bool isYAML = false;
if (!isDNARecord(decl, baseDNA, isYAML)) if (!isDNARecord(decl, baseDNA, isYAML))
@ -2333,9 +2333,9 @@ public:
{ {
/* Write file head */ /* Write file head */
fileOut << "/* Auto generated atdna implementation */\n" fileOut << "/* Auto generated atdna implementation */\n"
"#include <Athena/Global.hpp>\n" "#include <athena/Global.hpp>\n"
"#include <Athena/IStreamReader.hpp>\n" "#include <athena/IStreamReader.hpp>\n"
"#include <Athena/IStreamWriter.hpp>\n\n"; "#include <athena/IStreamWriter.hpp>\n\n";
for (const std::string& inputf : InputFilenames) for (const std::string& inputf : InputFilenames)
fileOut << "#include \"" << inputf << "\"\n"; fileOut << "#include \"" << inputf << "\"\n";
fileOut << "\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; typedef io::DNAYaml<BigEndian> BigDNA;
struct TESTSubFile : public 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) file(GLOB SRC src/*.c)
include_directories(../../include) 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 <deque>
#include <vector> #include <vector>
#include <cstdint> #include <cstdint>
#include <Athena/Types.hpp> #include <athena/Types.hpp>
struct LZLengthOffset struct LZLengthOffset
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@
#include <vector> #include <vector>
#include <memory> #include <memory>
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -84,7 +84,7 @@ struct DNA
* @tparam sizeVar C++ expression wrapped in DNA_COUNT macro to determine number of bytes for buffer * @tparam sizeVar C++ expression wrapped in DNA_COUNT macro to determine number of bytes for buffer
*/ */
template <size_t sizeVar> 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 * @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 * -1 literal indicates null-terminated string
*/ */
template <atInt32 sizeVar = -1> 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 * @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 * -1 literal indicates null-terminated wstring
*/ */
template <atInt32 sizeVar = -1, Endian VE = DNAE> 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 * @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 * -1 literal indicates null-terminated string
*/ */
template <atInt32 sizeVar = -1> 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 * @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 */ /** Macro to automatically declare read/write methods in subclasses */
#define DECL_DNA \ #define DECL_DNA \
void read(Athena::io::IStreamReader&); \ void read(athena::io::IStreamReader&); \
void write(Athena::io::IStreamWriter&) const; \ void write(athena::io::IStreamWriter&) const; \
size_t binarySize(size_t __isz) const; size_t binarySize(size_t __isz) const;
/** Macro to automatically declare read/write methods and prevent outputting implementation */ /** Macro to automatically declare read/write methods and prevent outputting implementation */
#define DECL_EXPLICIT_DNA \ #define DECL_EXPLICIT_DNA \
void read(Athena::io::IStreamReader&); \ void read(athena::io::IStreamReader&); \
void write(Athena::io::IStreamWriter&) const; \ void write(athena::io::IStreamWriter&) const; \
size_t binarySize(size_t __isz) const; \ size_t binarySize(size_t __isz) const; \
Delete __dna_delete; Delete __dna_delete;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
#ifndef MCSLOT_HPP #ifndef MCSLOT_HPP
#define MCSLOT_HPP #define MCSLOT_HPP
#include "Athena/Global.hpp" #include "athena/Global.hpp"
#include "Athena/ZQuestFile.hpp" #include "athena/ZQuestFile.hpp"
namespace Athena namespace athena
{ {
class MCSlot : public ZQuestFile class MCSlot : public ZQuestFile
{ {

View File

@ -4,9 +4,9 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <functional> #include <functional>
#include "Athena/IStreamReader.hpp" #include "athena/IStreamReader.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -123,14 +123,14 @@ protected:
#ifndef MEMORYREADER_BASE #ifndef MEMORYREADER_BASE
#define MEMORYREADER_BASE() \ #define MEMORYREADER_BASE() \
private: \ private: \
typedef Athena::io::MemoryReader base typedef athena::io::MemoryReader base
#endif // MEMORYREADER_BASE #endif // MEMORYREADER_BASE
#ifndef MEMORYCOPYREADER_BASE #ifndef MEMORYCOPYREADER_BASE
#define MEMORYCOPYREADER_BASE() \ #define MEMORYCOPYREADER_BASE() \
private: \ private: \
typedef Athena::io::MemoryCopyReader base typedef athena::io::MemoryCopyReader base
#endif // MEMORYCOPYREADER_BASE #endif // MEMORYCOPYREADER_BASE

View File

@ -4,9 +4,9 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <functional> #include <functional>
#include "Athena/IStreamWriter.hpp" #include "athena/IStreamWriter.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -166,13 +166,13 @@ private:
#ifndef MEMORYWRITER_BASE #ifndef MEMORYWRITER_BASE
#define MEMORYWRITER_BASE() \ #define MEMORYWRITER_BASE() \
private: \ private: \
typedef Athena::io::MemoryWriter base typedef athena::io::MemoryWriter base
#endif // BINARYWRITER_BASE #endif // BINARYWRITER_BASE
#ifndef MEMORYCOPYWRITER_BASE #ifndef MEMORYCOPYWRITER_BASE
#define MEMORYCOPYWRITER_BASE() \ #define MEMORYCOPYWRITER_BASE() \
private: \ private: \
typedef Athena::io::MemoryCopyWriter base typedef athena::io::MemoryCopyWriter base
#endif // BINARYWRITER_BASE #endif // BINARYWRITER_BASE
#endif // MEMORYWRITER_HPP #endif // MEMORYWRITER_HPP

View File

@ -2,10 +2,10 @@
#ifndef PHYSFSSTREAM_HPP #ifndef PHYSFSSTREAM_HPP
#define PHYSFSSTREAM_HPP #define PHYSFSSTREAM_HPP
#include "Athena/Stream.hpp" #include "athena/Stream.hpp"
#include <physfs.h> #include <physfs.h>
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -55,7 +55,7 @@ private:
#ifndef PHYSFSFILEREADER_BASE #ifndef PHYSFSFILEREADER_BASE
#define PHYSFSFILEREADER_BASE() \ #define PHYSFSFILEREADER_BASE() \
typedef Athena::io::PHYSFSFileReader base typedef athena::io::PHYSFSFileReader base
#endif #endif
#endif // PHYSFSSTREAM_HPP #endif // PHYSFSSTREAM_HPP
#endif // ATHENA_ENABLE_PHYSFS #endif // ATHENA_ENABLE_PHYSFS

View File

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

View File

@ -1,12 +1,12 @@
#ifndef SSFILE_HPP #ifndef SSFILE_HPP
#define SSFILE_HPP #define SSFILE_HPP
#include "Athena/Global.hpp" #include "athena/Global.hpp"
// standard lib // standard lib
#include <vector> #include <vector>
namespace Athena namespace athena
{ {
class SkywardSwordQuest; class SkywardSwordQuest;

View File

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

View File

@ -1,9 +1,9 @@
#ifndef SSFILEWRITER_HPP #ifndef SSFILEWRITER_HPP
#define SSFILEWRITER_HPP #define SSFILEWRITER_HPP
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
namespace Athena namespace athena
{ {
class SkywardSwordFile; class SkywardSwordFile;

View File

@ -1,10 +1,10 @@
#ifndef SKYWARDSWORDQUEST_HPP #ifndef SKYWARDSWORDQUEST_HPP
#define SKYWARDSWORDQUEST_HPP #define SKYWARDSWORDQUEST_HPP
#include "Athena/Global.hpp" #include "athena/Global.hpp"
#include "Athena/ZQuestFile.hpp" #include "athena/ZQuestFile.hpp"
namespace Athena namespace athena
{ {
// TODO: Handle game specific data // TODO: Handle game specific data

View File

@ -10,9 +10,9 @@
#include <QString> #include <QString>
#include <QList> #include <QList>
#endif #endif
#include "Athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {
@ -124,7 +124,7 @@ private:
#ifdef ATHENA_USE_QT #ifdef ATHENA_USE_QT
Q_DECLARE_METATYPE(Uint32) Q_DECLARE_METATYPE(Uint32)
Q_DECLARE_METATYPE(Athena::Sakura::Sprite*) Q_DECLARE_METATYPE(athena::Sakura::Sprite*)
#endif #endif
#endif // SSPRITE_HPP #endif // SSPRITE_HPP

View File

@ -13,9 +13,9 @@
#endif #endif
#include <string> #include <string>
#include "Athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {
@ -259,7 +259,7 @@ private:
} // Zelda } // Zelda
#ifdef ATHENA_USE_QT #ifdef ATHENA_USE_QT
Q_DECLARE_METATYPE(Athena::Sakura::SpriteFile*) Q_DECLARE_METATYPE(athena::Sakura::SpriteFile*)
Q_DECLARE_METATYPE(Athena::Sakura::STexture*) Q_DECLARE_METATYPE(athena::Sakura::STexture*)
#endif #endif
#endif // SSPRITE_HPP #endif // SSPRITE_HPP

View File

@ -1,9 +1,9 @@
#ifndef SSPRITEFILEREADER_HPP #ifndef SSPRITEFILEREADER_HPP
#define SSPRITEFILEREADER_HPP #define SSPRITEFILEREADER_HPP
#include "Athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {

View File

@ -1,9 +1,9 @@
#ifndef SSPRITEFILEWRITER_HPP #ifndef SSPRITEFILEWRITER_HPP
#define SSPRITEFILEWRITER_HPP #define SSPRITEFILEWRITER_HPP
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {

View File

@ -2,7 +2,7 @@
#define SSPRITEFRAME_HPP #define SSPRITEFRAME_HPP
#include "Athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
#ifndef ATHENA_USE_QT #ifndef ATHENA_USE_QT
#include <vector> #include <vector>
@ -11,7 +11,7 @@
#include <QList> #include <QList>
#endif #endif
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {
@ -78,7 +78,7 @@ private:
} // zelda } // zelda
#ifdef ATHENA_USE_QT #ifdef ATHENA_USE_QT
Q_DECLARE_METATYPE(Athena::Sakura::SpriteFrame*); Q_DECLARE_METATYPE(athena::Sakura::SpriteFrame*);
#endif #endif
#endif // SSPRITEFRAME_HPP #endif // SSPRITEFRAME_HPP

View File

@ -1,7 +1,7 @@
#ifndef SSPRITEPART_HPP #ifndef SSPRITEPART_HPP
#define SSPRITEPART_HPP #define SSPRITEPART_HPP
#include "Athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
#ifndef ATHENA_USE_QT #ifndef ATHENA_USE_QT
# include <vector> # include <vector>
#else #else
@ -13,7 +13,7 @@
#include <string> #include <string>
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {
@ -194,7 +194,7 @@ private:
} }
} }
#ifdef ATHENA_USE_QT #ifdef ATHENA_USE_QT
Q_DECLARE_METATYPE(Athena::Sakura::SpritePart*) Q_DECLARE_METATYPE(athena::Sakura::SpritePart*)
#endif #endif
#endif // SSPRITEPART_HPP #endif // SSPRITEPART_HPP

View File

@ -5,10 +5,10 @@
#include <vector> #include <vector>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include "Athena/Global.hpp" #include "athena/Global.hpp"
#include "Athena/Types.hpp" #include "athena/Types.hpp"
namespace Athena namespace athena
{ {
namespace utility namespace utility
{ {
@ -69,8 +69,8 @@ inline double swapDouble(double val)
} }
inline atInt16 LittleInt16(atInt16& val) inline atInt16 LittleInt16(atInt16& val)
{ {
if (Athena::utility::isSystemBigEndian()) if (athena::utility::isSystemBigEndian())
val = Athena::utility::swap16(val); val = athena::utility::swap16(val);
return val; return val;
} }
@ -84,8 +84,8 @@ inline atUint16 LittleUint16(atUint16& val)
} }
inline atInt16 BigInt16(atInt16& val) inline atInt16 BigInt16(atInt16& val)
{ {
if (!Athena::utility::isSystemBigEndian()) if (!athena::utility::isSystemBigEndian())
val = Athena::utility::swap16(val); val = athena::utility::swap16(val);
return val; return val;
} }
@ -99,8 +99,8 @@ inline atUint16 BigUint16(atUint16& val)
} }
inline atInt32 LittleInt32(atInt32& val) inline atInt32 LittleInt32(atInt32& val)
{ {
if (Athena::utility::isSystemBigEndian()) if (athena::utility::isSystemBigEndian())
val = Athena::utility::swap32(val); val = athena::utility::swap32(val);
return val; return val;
} }
@ -114,8 +114,8 @@ inline atUint32 LittleUint32(atUint32& val)
} }
inline atInt32 BigInt32(atInt32& val) inline atInt32 BigInt32(atInt32& val)
{ {
if (!Athena::utility::isSystemBigEndian()) if (!athena::utility::isSystemBigEndian())
val = Athena::utility::swap32(val); val = athena::utility::swap32(val);
return val; return val;
} }
@ -129,8 +129,8 @@ inline atUint32 BigUint32(atUint32& val)
} }
inline atInt64 LittleInt64(atInt64& val) inline atInt64 LittleInt64(atInt64& val)
{ {
if (Athena::utility::isSystemBigEndian()) if (athena::utility::isSystemBigEndian())
val = Athena::utility::swap64(val); val = athena::utility::swap64(val);
return val; return val;
} }
@ -144,8 +144,8 @@ inline atUint64 LittleUint64(atUint64& val)
} }
inline atInt64 BigInt64(atInt64& val) inline atInt64 BigInt64(atInt64& val)
{ {
if (!Athena::utility::isSystemBigEndian()) if (!athena::utility::isSystemBigEndian())
val = Athena::utility::swap64(val); val = athena::utility::swap64(val);
return val; return val;
} }
@ -160,29 +160,29 @@ inline atUint64 BigUint64(atUint64& val)
inline float LittleFloat(float& val) inline float LittleFloat(float& val)
{ {
if (Athena::utility::isSystemBigEndian()) if (athena::utility::isSystemBigEndian())
val = Athena::utility::swapFloat(val); val = athena::utility::swapFloat(val);
return val; return val;
} }
inline float BigFloat(float& val) inline float BigFloat(float& val)
{ {
if (!Athena::utility::isSystemBigEndian()) if (!athena::utility::isSystemBigEndian())
val = Athena::utility::swapFloat(val); val = athena::utility::swapFloat(val);
return val; return val;
} }
inline double LittleDouble(double& val) inline double LittleDouble(double& val)
{ {
if (Athena::utility::isSystemBigEndian()) if (athena::utility::isSystemBigEndian())
val = Athena::utility::swapDouble(val); val = athena::utility::swapDouble(val);
return val; return val;
} }
inline double BigDouble(double& val) inline double BigDouble(double& val)
{ {
if (!Athena::utility::isSystemBigEndian()) if (!athena::utility::isSystemBigEndian())
val = Athena::utility::swapDouble(val); val = athena::utility::swapDouble(val);
return val; return val;
} }

View File

@ -3,9 +3,9 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "Athena/Global.hpp" #include "athena/Global.hpp"
namespace Athena namespace athena
{ {
class WiiImage; class WiiImage;
/*! \class WiiBanner /*! \class WiiBanner

View File

@ -3,9 +3,9 @@
#include <string> #include <string>
#include <map> #include <map>
#include "Athena/Global.hpp" #include "athena/Global.hpp"
namespace Athena namespace athena
{ {
const atUint8 SD_KEY [16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d}; const atUint8 SD_KEY [16] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d};

View File

@ -2,9 +2,9 @@
#define WIIIMAGE_HPP #define WIIIMAGE_HPP
#include <memory> #include <memory>
#include "Athena/Types.hpp" #include "athena/Types.hpp"
namespace Athena namespace athena
{ {
/*! /*!

View File

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

View File

@ -1,10 +1,10 @@
#ifndef WIISAVEREADER_HPP #ifndef WIISAVEREADER_HPP
#define WIISAVEREADER_HPP #define WIISAVEREADER_HPP
#include "Athena/Global.hpp" #include "athena/Global.hpp"
#include "Athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
namespace Athena namespace athena
{ {
class WiiSave; class WiiSave;
class WiiBanner; class WiiBanner;

View File

@ -1,9 +1,9 @@
#ifndef WIISAVEWRITER_HPP #ifndef WIISAVEWRITER_HPP
#define WIISAVEWRITER_HPP #define WIISAVEWRITER_HPP
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
namespace Athena namespace athena
{ {
class WiiSave; class WiiSave;
class WiiBanner; class WiiBanner;

View File

@ -18,7 +18,7 @@
#define ZQUEST_HPP #define ZQUEST_HPP
#include "Athena/Global.hpp" #include "athena/Global.hpp"
#include <string> #include <string>
#include <vector> #include <vector>
#include <memory> #include <memory>
@ -26,7 +26,7 @@
#define ZQUEST_VERSION_CHECK(major, minor, revision) \ #define ZQUEST_VERSION_CHECK(major, minor, revision) \
(major | (minor << 8) | (revision << 16)) (major | (minor << 8) | (revision << 16))
namespace Athena namespace athena
{ {
/*! /*!
* \brief ZQuestFile is an export format for save data. * \brief ZQuestFile is an export format for save data.

View File

@ -17,9 +17,9 @@
#ifndef __ZQUESTFILEREADER_HPP__ #ifndef __ZQUESTFILEREADER_HPP__
#define __ZQUESTFILEREADER_HPP__ #define __ZQUESTFILEREADER_HPP__
#include "Athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
namespace Athena namespace athena
{ {
class ZQuestFile; class ZQuestFile;

View File

@ -17,9 +17,9 @@
#ifndef __ZQUESTFILEWRITER_HPP__ #ifndef __ZQUESTFILEWRITER_HPP__
#define __ZQUESTFILEWRITER_HPP__ #define __ZQUESTFILEWRITER_HPP__
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
namespace Athena namespace athena
{ {
class ZQuestFile; class ZQuestFile;

View File

@ -3,7 +3,7 @@
#ifndef __DOXYGEN_IGNORE__ #ifndef __DOXYGEN_IGNORE__
#include "Athena/Types.hpp" #include "athena/Types.hpp"
int bn_compare(atUint8* a, atUint8* b, atUint32 n); int bn_compare(atUint8* a, atUint8* b, atUint32 n);
void bn_sub_modulus(atUint8* a, atUint8* N, atUint32 n); void bn_sub_modulus(atUint8* a, atUint8* N, atUint32 n);
void bn_add(atUint8* d, atUint8* a, atUint8* b, atUint8* N, atUint32 n); void bn_add(atUint8* d, atUint8* a, atUint8* b, atUint8* N, atUint32 n);

View File

@ -1,6 +1,6 @@
#ifndef EC_H #ifndef EC_H
#define EC_H #define EC_H
#include "Athena/Types.hpp" #include "athena/Types.hpp"
bool check_ec(atUint8* ng, atUint8* ap, atUint8* sig, atUint8* sig_hash); bool check_ec(atUint8* ng, atUint8* ap, atUint8* sig, atUint8* sig_hash);
void make_ec_cert(atUint8* cert, atUint8* sig, char* signer, char* name, atUint8* priv, atUint32 key_id); void make_ec_cert(atUint8* cert, atUint8* sig, char* signer, char* name, atUint8* priv, atUint32 key_id);

View File

@ -1,7 +1,7 @@
#ifndef _SHA1_H_ #ifndef _SHA1_H_
#define _SHA1_H_ #define _SHA1_H_
#include "Athena/Types.hpp" #include "athena/Types.hpp"
#ifndef __DOXYGEN_IGNORE__ #ifndef __DOXYGEN_IGNORE__
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,6 +1,6 @@
#include "LZ77/LZLookupTable.hpp" #include "LZ77/LZLookupTable.hpp"
#include "LZ77/LZType10.hpp" #include "LZ77/LZType10.hpp"
#include <Athena/MemoryWriter.hpp> #include <athena/MemoryWriter.hpp>
#include <string.h> #include <string.h>
LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 MinimumMatch, atInt32 BlockSize) LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 MinimumMatch, atInt32 BlockSize)
@ -14,9 +14,9 @@ LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 Minimum
atUint32 LZType10::compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength) atUint32 LZType10::compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLength)
{ {
atUint32 encodeSize = (srcLength << 8) | (0x10); atUint32 encodeSize = (srcLength << 8) | (0x10);
encodeSize = Athena::utility::LittleUint32(encodeSize); //File size needs to be written as little endian always encodeSize = athena::utility::LittleUint32(encodeSize); //File size needs to be written as little endian always
Athena::io::MemoryCopyWriter outbuf("tmp"); athena::io::MemoryCopyWriter outbuf("tmp");
outbuf.writeUint32(encodeSize); outbuf.writeUint32(encodeSize);
atUint8* ptrStart = (atUint8*)src; atUint8* ptrStart = (atUint8*)src;
@ -42,7 +42,7 @@ atUint32 LZType10::compress(const atUint8* src, atUint8** dstBuf, atUint32 srcLe
{ {
//Gotta swap the bytes since system is wii is big endian and most computers are little endian //Gotta swap the bytes since system is wii is big endian and most computers are little endian
atUint16 lenOff = (((searchResult.length - m_minMatch) & 0xF) << 12) | ((searchResult.offset - 1) & 0xFFF); atUint16 lenOff = (((searchResult.length - m_minMatch) & 0xF) << 12) | ((searchResult.offset - 1) & 0xFFF);
Athena::utility::BigUint16(lenOff); athena::utility::BigUint16(lenOff);
memcpy(ptrBytes, &lenOff, sizeof(atUint16)); memcpy(ptrBytes, &lenOff, sizeof(atUint16));
@ -81,7 +81,7 @@ atUint32 LZType10::decompress(const atUint8* src, atUint8** dst, atUint32 srcLen
return 0; return 0;
atUint32 uncompressedSize = *(atUint32*)(src); //Size of data when it is uncompressed atUint32 uncompressedSize = *(atUint32*)(src); //Size of data when it is uncompressed
Athena::utility::LittleUint32(uncompressedSize); //The compressed file has the filesize encoded in little endian athena::utility::LittleUint32(uncompressedSize); //The compressed file has the filesize encoded in little endian
uncompressedSize = uncompressedSize >> 8;//first byte is the encode flag uncompressedSize = uncompressedSize >> 8;//first byte is the encode flag
atUint8* uncompressedData = new atUint8[uncompressedSize]; atUint8* uncompressedData = new atUint8[uncompressedSize];
@ -104,7 +104,7 @@ atUint32 LZType10::decompress(const atUint8* src, atUint8** dst, atUint32 srcLen
{ {
atUint16 lenOff; atUint16 lenOff;
memcpy(&lenOff, inputPtr, sizeof(atUint16)); memcpy(&lenOff, inputPtr, sizeof(atUint16));
Athena::utility::BigUint16(lenOff); athena::utility::BigUint16(lenOff);
inputPtr += sizeof(atUint16); //Move forward two bytes inputPtr += sizeof(atUint16); //Move forward two bytes
//length offset pair has been decoded. //length offset pair has been decoded.
LZLengthOffset decoding; LZLengthOffset decoding;

View File

@ -1,6 +1,6 @@
#include "LZ77/LZLookupTable.hpp" #include "LZ77/LZLookupTable.hpp"
#include "LZ77/LZType11.hpp" #include "LZ77/LZType11.hpp"
#include <Athena/MemoryWriter.hpp> #include <athena/MemoryWriter.hpp>
#include <string.h> #include <string.h>
@ -13,13 +13,13 @@ LZType11::LZType11(atInt32 minimumOffset, atInt32 slidingWindow, atInt32 minimum
atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLength) atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLength)
{ {
Athena::io::MemoryCopyWriter outbuff("tmp"); athena::io::MemoryCopyWriter outbuff("tmp");
if (srcLength > 0xFFFFFF) // If length is greater than 24 bits or 16 Megs if (srcLength > 0xFFFFFF) // If length is greater than 24 bits or 16 Megs
{ {
atUint32 encodeFlag = 0x11; atUint32 encodeFlag = 0x11;
Athena::utility::LittleUint32(encodeFlag); athena::utility::LittleUint32(encodeFlag);
Athena::utility::LittleUint32(srcLength);//Filesize data is little endian athena::utility::LittleUint32(srcLength);//Filesize data is little endian
outbuff.writeUint32(encodeFlag); outbuff.writeUint32(encodeFlag);
outbuff.writeUint32(srcLength); outbuff.writeUint32(srcLength);
@ -27,7 +27,7 @@ atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLengt
else else
{ {
atUint32 encodeSize = (srcLength << 8) | (0x11); atUint32 encodeSize = (srcLength << 8) | (0x11);
Athena::utility::LittleUint32(encodeSize); athena::utility::LittleUint32(encodeSize);
outbuff.writeUint32(encodeSize); outbuff.writeUint32(encodeSize);
} }
@ -79,7 +79,7 @@ atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLengt
atUint16 lenOff = ((((searchResult.length - 1) & 0xF) << 12) | //Bits 15-12 atUint16 lenOff = ((((searchResult.length - 1) & 0xF) << 12) | //Bits 15-12
((searchResult.offset - 1) & 0xFFF) //Bits 11-0 ((searchResult.offset - 1) & 0xFFF) //Bits 11-0
); );
Athena::utility::BigUint16(lenOff); athena::utility::BigUint16(lenOff);
memcpy(ptrBytes, &lenOff, 2); memcpy(ptrBytes, &lenOff, 2);
ptrBytes += 2; ptrBytes += 2;
} }
@ -88,7 +88,7 @@ atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLengt
atUint32 lenOff = ((((searchResult.length - minThreeByteMatch) & 0xFF) << 12) | //Bits 20-12 atUint32 lenOff = ((((searchResult.length - minThreeByteMatch) & 0xFF) << 12) | //Bits 20-12
((searchResult.offset - 1) & 0xFFF) //Bits 11-0 ((searchResult.offset - 1) & 0xFFF) //Bits 11-0
); );
Athena::utility::BigUint32(lenOff); athena::utility::BigUint32(lenOff);
memcpy(ptrBytes, (atUint8*)&lenOff + 1, 3); //Make sure to copy the lower 24 bits. 0x12345678- This statement copies 0x123456 memcpy(ptrBytes, (atUint8*)&lenOff + 1, 3); //Make sure to copy the lower 24 bits. 0x12345678- This statement copies 0x123456
ptrBytes += 3; ptrBytes += 3;
} }
@ -98,7 +98,7 @@ atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLengt
(((searchResult.length - minFourByteMatch) & 0xFFFF) << 12) | //Bits 28-12 (((searchResult.length - minFourByteMatch) & 0xFFFF) << 12) | //Bits 28-12
((searchResult.offset - 1) & 0xFFF) //Bits 11-0 ((searchResult.offset - 1) & 0xFFF) //Bits 11-0
); );
Athena::utility::BigUint32(lenOff); athena::utility::BigUint32(lenOff);
memcpy(ptrBytes, &lenOff, 4); memcpy(ptrBytes, &lenOff, 4);
ptrBytes += 4; ptrBytes += 4;
} }
@ -136,14 +136,14 @@ atUint32 LZType11::decompress(const atUint8* src, atUint8** dst, atUint32 srcLen
return 0; return 0;
atUint32 uncompressedLen = *(atUint32*)(src); atUint32 uncompressedLen = *(atUint32*)(src);
Athena::utility::LittleUint32(uncompressedLen);//The compressed file has the filesize encoded in little endian athena::utility::LittleUint32(uncompressedLen);//The compressed file has the filesize encoded in little endian
uncompressedLen = uncompressedLen >> 8; //First byte is the encode flag uncompressedLen = uncompressedLen >> 8; //First byte is the encode flag
atUint32 currentOffset = 4; atUint32 currentOffset = 4;
if (uncompressedLen == 0) //If the filesize var is zero then the true filesize is over 14MB and must be read in from the next 4 bytes if (uncompressedLen == 0) //If the filesize var is zero then the true filesize is over 14MB and must be read in from the next 4 bytes
{ {
atUint32 filesize = *(atUint32*)(src + 4); atUint32 filesize = *(atUint32*)(src + 4);
filesize = Athena::utility::LittleUint32(filesize); filesize = athena::utility::LittleUint32(filesize);
currentOffset += 4; currentOffset += 4;
} }
@ -178,7 +178,7 @@ atUint32 LZType11::decompress(const atUint8* src, atUint8** dst, atUint32 srcLen
atUint16 lenOff = 0; atUint16 lenOff = 0;
memcpy(&lenOff, inputPtr, 2); memcpy(&lenOff, inputPtr, 2);
inputPtr += 2; inputPtr += 2;
Athena::utility::BigUint16(lenOff); athena::utility::BigUint16(lenOff);
decoding.length = (lenOff >> 12) + 1; decoding.length = (lenOff >> 12) + 1;
decoding.offset = (lenOff & 0xFFF) + 1; decoding.offset = (lenOff & 0xFFF) + 1;
} }
@ -187,7 +187,7 @@ atUint32 LZType11::decompress(const atUint8* src, atUint8** dst, atUint32 srcLen
atUint32 lenOff = 0; atUint32 lenOff = 0;
memcpy((atUint8*)&lenOff + 1, inputPtr, 3); memcpy((atUint8*)&lenOff + 1, inputPtr, 3);
inputPtr += 3; inputPtr += 3;
Athena::utility::BigUint32(lenOff); athena::utility::BigUint32(lenOff);
decoding.length = (lenOff >> 12) + threeByteDenorm; decoding.length = (lenOff >> 12) + threeByteDenorm;
decoding.offset = (lenOff & 0xFFF) + 1; decoding.offset = (lenOff & 0xFFF) + 1;
} }
@ -196,7 +196,7 @@ atUint32 LZType11::decompress(const atUint8* src, atUint8** dst, atUint32 srcLen
atUint32 lenOff = 0; atUint32 lenOff = 0;
memcpy(&lenOff, inputPtr, 4); memcpy(&lenOff, inputPtr, 4);
inputPtr += 4; inputPtr += 4;
Athena::utility::BigUint32(lenOff); athena::utility::BigUint32(lenOff);
decoding.length = ((lenOff >> 12) & 0xFFFF) + fourByteDenorm; //Gets rid of the Four byte flag decoding.length = ((lenOff >> 12) & 0xFFFF) + fourByteDenorm; //Gets rid of the Four byte flag
decoding.offset = (lenOff & 0xFFF) + 1; decoding.offset = (lenOff & 0xFFF) + 1;

View File

@ -7,7 +7,7 @@
#include <cpuid.h> #include <cpuid.h>
#endif #endif
namespace Athena namespace athena
{ {
/* rotates x one bit to the left */ /* rotates x one bit to the left */

View File

@ -1,7 +1,7 @@
#include "Athena/ALTTPFile.hpp" #include "athena/ALTTPFile.hpp"
#include "Athena/ALTTPQuest.hpp" #include "athena/ALTTPQuest.hpp"
namespace Athena namespace athena
{ {
ALTTPFile::ALTTPFile() ALTTPFile::ALTTPFile()
{} {}

View File

@ -1,10 +1,10 @@
#include "Athena/ALTTPFileReader.hpp" #include "athena/ALTTPFileReader.hpp"
#include "Athena/ALTTPFile.hpp" #include "athena/ALTTPFile.hpp"
#include "Athena/ALTTPQuest.hpp" #include "athena/ALTTPQuest.hpp"
#include <iostream> #include <iostream>
#include "Athena/Global.hpp" #include "athena/Global.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,9 +1,9 @@
#include "Athena/ALTTPFileWriter.hpp" #include "athena/ALTTPFileWriter.hpp"
#include "Athena/ALTTPFile.hpp" #include "athena/ALTTPFile.hpp"
#include "Athena/ALTTPQuest.hpp" #include "athena/ALTTPQuest.hpp"
#include <iostream> #include <iostream>
namespace Athena namespace athena
{ {
namespace io namespace io

View File

@ -1,7 +1,7 @@
#include "Athena/ALTTPQuest.hpp" #include "athena/ALTTPQuest.hpp"
#include <iostream> #include <iostream>
namespace Athena namespace athena
{ {
ALTTPQuest::ALTTPQuest() ALTTPQuest::ALTTPQuest()

View File

@ -1,9 +1,9 @@
#include "Athena/Checksums.hpp" #include "athena/Checksums.hpp"
#include "Athena/FileReader.hpp" #include "athena/FileReader.hpp"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
namespace Athena namespace athena
{ {
namespace Checksums namespace Checksums
{ {

View File

@ -1,11 +1,11 @@
#include "Athena/Compression.hpp" #include "athena/Compression.hpp"
#include <lzo/lzo1x.h> #include <lzo/lzo1x.h>
#include <iostream> #include <iostream>
#include <zlib.h> #include <zlib.h>
#include "LZ77/LZType10.hpp" #include "LZ77/LZType10.hpp"
#include "LZ77/LZType11.hpp" #include "LZ77/LZType11.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,6 +1,6 @@
#include "Athena/DNAYaml.hpp" #include "athena/DNAYaml.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,4 +1,4 @@
#include "Athena/Dir.hpp" #include "athena/Dir.hpp"
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
@ -18,7 +18,7 @@
#define realpath(__name, __resolved) _fullpath((__name), (__resolved), 4096) #define realpath(__name, __resolved) _fullpath((__name), (__resolved), 4096)
#endif #endif
namespace Athena namespace athena
{ {
Dir::Dir(const std::string &path) Dir::Dir(const std::string &path)
: m_path(path) : m_path(path)

View File

@ -1,7 +1,7 @@
#include "Athena/FileInfo.hpp" #include "athena/FileInfo.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include "Athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
#include "Athena/FileReader.hpp" #include "athena/FileReader.hpp"
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
@ -30,7 +30,7 @@
#define realpath(__name, __resolved) _fullpath((__resolved), (__name), 4096) #define realpath(__name, __resolved) _fullpath((__resolved), (__name), 4096)
#endif #endif
namespace Athena namespace athena
{ {
FileInfo::FileInfo(const std::string& path) FileInfo::FileInfo(const std::string& path)
@ -117,7 +117,7 @@ bool FileInfo::touch() const
#if defined(__GNUC__) && !(defined(HW_DOL) || defined(HW_RVL) || defined(GEKKO)) #if defined(__GNUC__) && !(defined(HW_DOL) || defined(HW_RVL) || defined(GEKKO))
stat64_t st; stat64_t st;
if (stat64(m_path.c_str(), &st) < 0) { if (stat64(m_path.c_str(), &st) < 0) {
(void)Athena::io::FileWriter(m_path); (void)athena::io::FileWriter(m_path);
return true; return true;
} }
if (utimes(m_path.c_str(), NULL) < 0) { if (utimes(m_path.c_str(), NULL) < 0) {
@ -173,13 +173,13 @@ bool FileInfo::touch() const
// Generic portable version, not extremely reliable but does work // Generic portable version, not extremely reliable but does work
atUint64 val = 0xCDCDCDCDCD; atUint64 val = 0xCDCDCDCDCD;
{ {
Athena::io::FileReader reader(m_path.c_str()); athena::io::FileReader reader(m_path.c_str());
if (reader.isOpen()) if (reader.isOpen())
val = reader.readUint64(); val = reader.readUint64();
} }
{ {
Athena::io::FileWriter writer(m_path, false); athena::io::FileWriter writer(m_path, false);
if (val != 0xCDCDCDCDCD && writer.isOpen()) if (val != 0xCDCDCDCDCD && writer.isOpen())
writer.writeUint64(val); writer.writeUint64(val);
else if (!writer.isOpen()) else if (!writer.isOpen())

View File

@ -1,4 +1,4 @@
#include "Athena/FileReader.hpp" #include "athena/FileReader.hpp"
#if _WIN32 #if _WIN32
#include "win32_largefilewrapper.h" #include "win32_largefilewrapper.h"
@ -9,7 +9,7 @@
#include "osx_largefilewrapper.h" #include "osx_largefilewrapper.h"
#endif #endif
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,4 +1,4 @@
#include "Athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
#if _WIN32 #if _WIN32
#include "win32_largefilewrapper.h" #include "win32_largefilewrapper.h"
@ -9,7 +9,7 @@
#include "osx_largefilewrapper.h" #include "osx_largefilewrapper.h"
#endif #endif
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,21 +1,21 @@
#include "Athena/Global.hpp" #include "athena/Global.hpp"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
std::ostream& operator<<(std::ostream& os, const Athena::SeekOrigin& origin) std::ostream& operator<<(std::ostream& os, const athena::SeekOrigin& origin)
{ {
switch (origin) switch (origin)
{ {
case Athena::SeekOrigin::Begin: case athena::SeekOrigin::Begin:
os << "Begin"; os << "Begin";
break; break;
case Athena::SeekOrigin::Current: case athena::SeekOrigin::Current:
os << "Current"; os << "Current";
break; break;
case Athena::SeekOrigin::End: case athena::SeekOrigin::End:
os << "End"; os << "End";
break; break;
} }
@ -24,15 +24,15 @@ 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::Endian& endian)
{ {
switch (endian) switch (endian)
{ {
case Athena::Endian::LittleEndian: case athena::Endian::LittleEndian:
os << "LittleEndian"; os << "LittleEndian";
break; break;
case Athena::Endian::BigEndian: case athena::Endian::BigEndian:
os << "BigEndian"; os << "BigEndian";
break; break;
} }
@ -41,18 +41,18 @@ std::ostream& operator<<(std::ostream& os, const Athena::Endian& endian)
} }
static void __defaultExceptionHandler(Athena::error::Level level, const char* file, const char* function, int line, const char* fmt, ...) static void __defaultExceptionHandler(athena::error::Level level, const char* file, const char* function, int line, const char* fmt, ...)
{ {
std::string levelStr; std::string levelStr;
switch (level) switch (level)
{ {
case Athena::error::Level::Warning: case athena::error::Level::Warning:
levelStr = "[WARNING] "; levelStr = "[WARNING] ";
break; break;
case Athena::error::Level::Error: case athena::error::Level::Error:
levelStr = "[ERROR ] "; levelStr = "[ERROR ] ";
break; break;
case Athena::error::Level::Fatal: case athena::error::Level::Fatal:
levelStr = "[FATAL ] "; levelStr = "[FATAL ] ";
break; break;
default: break; default: break;
@ -60,7 +60,7 @@ static void __defaultExceptionHandler(Athena::error::Level level, const char* fi
va_list vl; va_list vl;
va_start(vl, fmt); va_start(vl, fmt);
std::string msg = Athena::utility::vsprintf(fmt, vl); std::string msg = athena::utility::vsprintf(fmt, vl);
va_end(vl); va_end(vl);
std::cerr << levelStr << " " << file << " " << function << "(" << line << "): " << msg << std::endl; std::cerr << levelStr << " " << file << " " << function << "(" << line << "): " << msg << std::endl;
} }

View File

@ -1,6 +1,6 @@
#include "Athena/MCFile.hpp" #include "athena/MCFile.hpp"
namespace Athena namespace athena
{ {
const char MCFile::VERSION_EU_JP[33] = "AGBZELDA:THE MINISH CAP:ZELDA 3\0"; const char MCFile::VERSION_EU_JP[33] = "AGBZELDA:THE MINISH CAP:ZELDA 3\0";

View File

@ -1,6 +1,6 @@
#include "Athena/MCFileReader.hpp" #include "athena/MCFileReader.hpp"
#include "Athena/MCFile.hpp" #include "athena/MCFile.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io

View File

@ -1,6 +1,6 @@
#include "Athena/MCFileWriter.hpp" #include "athena/MCFileWriter.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,6 +1,6 @@
#include "Athena/MCSlot.hpp" #include "athena/MCSlot.hpp"
namespace Athena namespace athena
{ {
MCSlot::MCSlot(std::unique_ptr<atUint8[]>&& data, atUint32 length) MCSlot::MCSlot(std::unique_ptr<atUint8[]>&& data, atUint32 length)

View File

@ -1,4 +1,4 @@
#include "Athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -10,7 +10,7 @@
#include <malloc.h> #include <malloc.h>
#endif // HW_RVL #endif // HW_RVL
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -104,8 +104,8 @@ void MemoryReader::seek(atInt64 position, SeekOrigin origin)
void MemoryReader::setData(const atUint8* data, atUint64 length, bool takeOwnership) void MemoryReader::setData(const atUint8* data, atUint64 length, bool takeOwnership)
{ {
if (m_owns && m_data) if (m_owns)
delete[] m_data; delete[] static_cast<const atUint8*>(m_data);
m_data = (atUint8*)data; m_data = (atUint8*)data;
m_length = length; m_length = length;
m_position = 0; m_position = 0;

View File

@ -1,4 +1,4 @@
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -9,7 +9,7 @@
#include <malloc.h> #include <malloc.h>
#endif // HW_RVL #endif // HW_RVL
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,9 +1,9 @@
#ifdef ATHENA_ENABLE_PHYSFS #ifdef ATHENA_ENABLE_PHYSFS
#include "Athena/PHYSFSFileReader.hpp" #include "athena/PHYSFSFileReader.hpp"
#include "Athena/FileNotFoundException.hpp" #include "athena/FileNotFoundException.hpp"
#include "Athena/IOException.hpp" #include "athena/IOException.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,7 +1,7 @@
#include "Athena/SkywardSwordFile.hpp" #include "athena/SkywardSwordFile.hpp"
#include "Athena/SkywardSwordQuest.hpp" #include "athena/SkywardSwordQuest.hpp"
namespace Athena namespace athena
{ {
SkywardSwordFile::SkywardSwordFile() SkywardSwordFile::SkywardSwordFile()
@ -19,7 +19,7 @@ SkywardSwordFile::~SkywardSwordFile()
{ {
} }
void SkywardSwordFile::addQuest(Athena::SkywardSwordQuest* q) void SkywardSwordFile::addQuest(athena::SkywardSwordQuest* q)
{ {
// Do not allow more than 3 quests // Do not allow more than 3 quests
if (m_quests.size() >= 3) if (m_quests.size() >= 3)

View File

@ -1,9 +1,9 @@
#include "Athena/SkywardSwordFileReader.hpp" #include "athena/SkywardSwordFileReader.hpp"
#include "Athena/SkywardSwordFile.hpp" #include "athena/SkywardSwordFile.hpp"
#include "Athena/SkywardSwordQuest.hpp" #include "athena/SkywardSwordQuest.hpp"
#include <iostream> #include <iostream>
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,8 +1,8 @@
#include "Athena/SkywardSwordFileWriter.hpp" #include "athena/SkywardSwordFileWriter.hpp"
#include "Athena/SkywardSwordFile.hpp" #include "athena/SkywardSwordFile.hpp"
#include "Athena/SkywardSwordQuest.hpp" #include "athena/SkywardSwordQuest.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,9 +1,9 @@
#include "Athena/SkywardSwordQuest.hpp" #include "athena/SkywardSwordQuest.hpp"
#include "Athena/Checksums.hpp" #include "athena/Checksums.hpp"
#include "utf8proc.h" #include "utf8proc.h"
#include <sstream> #include <sstream>
namespace Athena namespace athena
{ {
namespace priv namespace priv

View File

@ -1,13 +1,13 @@
#include "Athena/Sprite.hpp" #include "athena/Sprite.hpp"
#include "Athena/SpriteFrame.hpp" #include "athena/SpriteFrame.hpp"
#include "Athena/SpriteFile.hpp" #include "athena/SpriteFile.hpp"
#include <algorithm> #include <algorithm>
#ifdef ATHENA_USE_QT #ifdef ATHENA_USE_QT
#include <QVector> #include <QVector>
#endif #endif
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {

View File

@ -1,9 +1,9 @@
#include "Athena/SpriteFile.hpp" #include "athena/SpriteFile.hpp"
#include "Athena/Sprite.hpp" #include "athena/Sprite.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include <iostream> #include <iostream>
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {
@ -192,7 +192,7 @@ void SpriteFile::addSprite(Sprite* sprite)
{ {
#ifndef ATHENA_USE_QT #ifndef ATHENA_USE_QT
std::string name(sprite->name()); std::string name(sprite->name());
Athena::utility::tolower(name); athena::utility::tolower(name);
if (m_sprites.find(name) != m_sprites.end()) if (m_sprites.find(name) != m_sprites.end())
return; return;
@ -212,7 +212,7 @@ void SpriteFile::addSprite(Sprite* sprite)
void SpriteFile::removeSprite(const std::string& name) void SpriteFile::removeSprite(const std::string& name)
{ {
std::string tmpName(name); std::string tmpName(name);
Athena::utility::tolower(tmpName); athena::utility::tolower(tmpName);
std::unordered_map<std::string, Sprite*>::iterator iterator = m_sprites.find(tmpName); std::unordered_map<std::string, Sprite*>::iterator iterator = m_sprites.find(tmpName);
if (iterator != m_sprites.end()) if (iterator != m_sprites.end())
@ -264,7 +264,7 @@ void SpriteFile::setSprites(QMap<QString, Sprite*> sprites)
Sprite* SpriteFile::sprite(const std::string& name) Sprite* SpriteFile::sprite(const std::string& name)
{ {
std::string nameLow(name); std::string nameLow(name);
Athena::utility::tolower(nameLow); athena::utility::tolower(nameLow);
if (m_sprites.find(nameLow) == m_sprites.end()) if (m_sprites.find(nameLow) == m_sprites.end())
return NULL; return NULL;

View File

@ -1,11 +1,11 @@
#include "Athena/SpriteFileReader.hpp" #include "athena/SpriteFileReader.hpp"
#include "Athena/SpriteFile.hpp" #include "athena/SpriteFile.hpp"
#include "Athena/Sprite.hpp" #include "athena/Sprite.hpp"
#include "Athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "Athena/SpriteFrame.hpp" #include "athena/SpriteFrame.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -183,7 +183,7 @@ Sakura::SpriteFile* SpriteFileReader::readFile()
if (sprite->name() != std::string()) if (sprite->name() != std::string())
{ {
std::string nameLow(sprite->name()); std::string nameLow(sprite->name());
Athena::utility::tolower(nameLow); athena::utility::tolower(nameLow);
sprites[nameLow] = sprite; sprites[nameLow] = sprite;
} }

View File

@ -1,10 +1,10 @@
#include "Athena/SpriteFileWriter.hpp" #include "athena/SpriteFileWriter.hpp"
#include "Athena/SpriteFile.hpp" #include "athena/SpriteFile.hpp"
#include "Athena/Sprite.hpp" #include "athena/Sprite.hpp"
#include "Athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "Athena/SpriteFrame.hpp" #include "athena/SpriteFrame.hpp"
namespace Athena namespace athena
{ {
namespace io namespace io
{ {

View File

@ -1,8 +1,8 @@
#include "Athena/SpriteFrame.hpp" #include "athena/SpriteFrame.hpp"
#include "Athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "Athena/Sprite.hpp" #include "athena/Sprite.hpp"
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {

View File

@ -1,9 +1,9 @@
#include "Athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "Athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "Athena/Sprite.hpp" #include "athena/Sprite.hpp"
#include <algorithm> #include <algorithm>
namespace Athena namespace athena
{ {
namespace Sakura namespace Sakura
{ {

View File

@ -1,4 +1,4 @@
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include <iostream> #include <iostream>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -18,7 +18,7 @@
#define stat64 __stat64 #define stat64 __stat64
#endif #endif
namespace Athena namespace athena
{ {
namespace utility namespace utility
{ {

View File

@ -1,10 +1,10 @@
#include "Athena/WiiBanner.hpp" #include "athena/WiiBanner.hpp"
#include "Athena/WiiImage.hpp" #include "athena/WiiImage.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include <string.h> #include <string.h>
namespace Athena namespace athena
{ {
WiiBanner::WiiBanner() : WiiBanner::WiiBanner() :

View File

@ -1,7 +1,7 @@
#include "Athena/WiiFile.hpp" #include "athena/WiiFile.hpp"
#include <algorithm> #include <algorithm>
namespace Athena namespace athena
{ {
//! TODO: Remove this? //! TODO: Remove this?
@ -138,7 +138,7 @@ void WiiFile::addChild(WiiFile* file)
// Lets figure out it's place // Lets figure out it's place
std::string tmpName(file->filename()); std::string tmpName(file->filename());
// Since we only support *NIX paths this is simple // Since we only support *NIX paths this is simple
atUint32 depth = Athena::utility::countChar(tmpName, '/'); atUint32 depth = athena::utility::countChar(tmpName, '/');
bool owned = false; bool owned = false;
while ((depth--) > 0) while ((depth--) > 0)

View File

@ -1,9 +1,9 @@
#include "Athena/WiiImage.hpp" #include "athena/WiiImage.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
namespace Athena namespace athena
{ {
WiiImage::WiiImage(atUint32 width, atUint32 height, std::unique_ptr<atUint8[]>&& data) : WiiImage::WiiImage(atUint32 width, atUint32 height, std::unique_ptr<atUint8[]>&& data) :

View File

@ -1,9 +1,9 @@
#include "Athena/WiiSave.hpp" #include "athena/WiiSave.hpp"
#include "Athena/WiiFile.hpp" #include "athena/WiiFile.hpp"
#include "Athena/WiiBanner.hpp" #include "athena/WiiBanner.hpp"
#include "Athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include "aes.hpp" #include "aes.hpp"
#include "ec.h" #include "ec.h"
#include "md5.h" #include "md5.h"
@ -17,7 +17,7 @@
#include <iomanip> #include <iomanip>
namespace Athena namespace athena
{ {
WiiSave::WiiSave() WiiSave::WiiSave()

View File

@ -1,10 +1,10 @@
#include "Athena/WiiSaveReader.hpp" #include "athena/WiiSaveReader.hpp"
#include "Athena/WiiSave.hpp" #include "athena/WiiSave.hpp"
#include "Athena/WiiFile.hpp" #include "athena/WiiFile.hpp"
#include "Athena/WiiImage.hpp" #include "athena/WiiImage.hpp"
#include "Athena/WiiBanner.hpp" #include "athena/WiiBanner.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include "Athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
#include "md5.h" #include "md5.h"
#include "aes.hpp" #include "aes.hpp"
#include "ec.h" #include "ec.h"
@ -13,7 +13,7 @@
#include <iomanip> #include <iomanip>
#include <string.h> #include <string.h>
namespace Athena namespace athena
{ {
namespace io namespace io

View File

@ -1,13 +1,13 @@
#include "Athena/WiiSaveWriter.hpp" #include "athena/WiiSaveWriter.hpp"
#include "Athena/WiiSave.hpp" #include "athena/WiiSave.hpp"
#include "Athena/WiiFile.hpp" #include "athena/WiiFile.hpp"
#include "Athena/WiiBanner.hpp" #include "athena/WiiBanner.hpp"
#include "Athena/WiiImage.hpp" #include "athena/WiiImage.hpp"
#include "Athena/WiiSave.hpp" #include "athena/WiiSave.hpp"
#include "Athena/WiiFile.hpp" #include "athena/WiiFile.hpp"
#include "Athena/WiiBanner.hpp" #include "athena/WiiBanner.hpp"
#include "Athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include "aes.hpp" #include "aes.hpp"
#include "ec.h" #include "ec.h"
@ -21,7 +21,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
namespace Athena namespace athena
{ {
namespace io namespace io

View File

@ -1,8 +1,8 @@
#include "Athena/ZQuestFile.hpp" #include "athena/ZQuestFile.hpp"
#include <string.h> #include <string.h>
namespace Athena namespace athena
{ {
std::vector<std::string> GameStrings; std::vector<std::string> GameStrings;
void initGameStrings() void initGameStrings()

View File

@ -1,13 +1,13 @@
#include "Athena/ZQuestFileReader.hpp" #include "athena/ZQuestFileReader.hpp"
#include "Athena/ZQuestFile.hpp" #include "athena/ZQuestFile.hpp"
#include "Athena/Compression.hpp" #include "athena/Compression.hpp"
#include "Athena/Checksums.hpp" #include "athena/Checksums.hpp"
#include "Athena/Utility.hpp" #include "athena/Utility.hpp"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
namespace Athena namespace athena
{ {
namespace io namespace io
{ {
@ -77,7 +77,7 @@ ZQuestFile* ZQuestFileReader::read()
if (version >= ZQUEST_VERSION_CHECK(2, 0, 0)) if (version >= ZQUEST_VERSION_CHECK(2, 0, 0))
{ {
if (checksum != Athena::Checksums::crc32(data.get(), compressedLen)) if (checksum != athena::Checksums::crc32(data.get(), compressedLen))
{ {
atError("Checksum mismatch, data corrupt"); atError("Checksum mismatch, data corrupt");
return nullptr; return nullptr;
@ -85,7 +85,7 @@ ZQuestFile* ZQuestFileReader::read()
} }
else else
{ {
std::clog << "ZQuest version 0x" << std::uppercase << std::setw(8) << std::setfill('0') << std::hex << Athena::utility::swapU32(version); std::clog << "ZQuest version 0x" << std::uppercase << std::setw(8) << std::setfill('0') << std::hex << athena::utility::swapU32(version);
std::clog << " has no checksum field" << std::endl; std::clog << " has no checksum field" << std::endl;
} }

Some files were not shown because too many files have changed in this diff Show More