* Fix Wii/GC Compiling

* Finish initial FileInfo/Dir APIs
* Get rid of type punning warnings
This commit is contained in:
2015-05-20 21:57:27 -07:00
parent 29a203522d
commit 011496db8b
25 changed files with 2909 additions and 75 deletions

View File

@@ -2,6 +2,7 @@
#define DIR_HPP
#include "Athena/FileInfo.hpp"
#include <stdio.h>
namespace Athena
{
@@ -22,6 +23,7 @@ public:
bool cd(const std::string& path);
bool rm(const std::string& path);
bool touch();
static bool mkdir(const std::string& dir, mode_t mode = 0755);
static bool mkpath(const std::string& path, mode_t mode = 0755);
private:

View File

@@ -3,7 +3,7 @@
#include <string>
#include <Athena/Global.hpp>
#include "Athena/Global.hpp"
namespace Athena
{

View File

@@ -18,7 +18,7 @@
#include "Athena/IStreamReader.hpp"
#include <string>
#include <cstdio>
#include <stdio.h>
namespace Athena
{

View File

@@ -17,6 +17,7 @@
#define FILEWRITER_HPP
#include "Athena/IStreamWriter.hpp"
#include <stdio.h>
namespace Athena
{
@@ -35,7 +36,6 @@ public:
void open(bool overwrite = true);
void close();
bool isOpen() const;
bool save();
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
inline void seekAlign32() {seek(ROUND_UP_32(position()), SeekOrigin::Begin);}
bool atEnd() const;

View File

@@ -40,6 +40,15 @@
# endif
#endif
#ifdef GEKKO
#include "gekko_support.h"
typedef struct stat stat64_t;
#define stat64 stat
#else
typedef struct stat64 stat64_t;
#endif
#ifndef aDebug
#define aDebug() \
std::cout << __FILE__ << "(" << __LINE__ << ") " << AT_PRETTY_FUNCTION << ": "

View File

@@ -75,13 +75,13 @@ inline atInt64 swap64(atInt64 val)
inline atUint64 swapU64(atUint64 val) {return (atUint64)swap64(val);}
inline float swapFloat(float val)
{
atInt32 ival = swap32(*((atInt32*)(&val)));
return *((float*)(&ival));
atInt32 ival = swap64(static_cast<atInt32>(val));
return static_cast<float>(ival);
}
inline double swapDouble(double val)
{
atInt64 ival = swap64(*((atInt64*)(&val)));
return *((double*)(&ival));
atInt64 ival = swap64(static_cast<atInt64>(val));
return static_cast<double>(ival);
}
inline atInt16 LittleInt16(atInt16& val)
{
@@ -203,6 +203,8 @@ inline double BigDouble(double& val)
return val;
}
atUint64 rand64();
void fillRandom(atUint8* rndArea, atUint64 count);
std::vector<std::string> split(const std::string& s, char delim);
std::string join(const std::vector<std::string>& elems, const std::string& delims);

View File

@@ -166,19 +166,61 @@ public:
*/
bool isFile() const;
/*!
* \brief addChild
* \param file
*/
void addChild(WiiFile* file);
/*!
* \brief children
* \return
*/
std::vector<WiiFile*> children();
/*!
* \brief child
* \param name
* \return
*/
WiiFile* child(const std::string& name);
/*!
* \brief removeChild
* \param name
*/
void removeChild(const std::string& name);
/*!
* \brief removeChild
* \param file
*/
void removeChild(WiiFile* file);
/*!
* \brief parent
* \return
*/
WiiFile* parent();
/*!
* \brief setParent
* \param parent
*/
void setParent(WiiFile* parent);
/*!
* \brief fileCount
* \return
*/
atUint32 fileCount();
/*!
* \brief allChildren
* \return
*/
std::vector<WiiFile*> allChildren();
/*!
* \brief fullpath
* \return
*/
std::string fullpath();
protected:
private: