-replaced all safe_vectors by regular vectors, there is no

need of it anymore, also removed miigotus wrapper
This commit is contained in:
fix94.1 2012-05-06 12:03:43 +00:00
parent e79542bb4c
commit 6abfa87e0e
47 changed files with 155 additions and 285 deletions

View File

@ -29,9 +29,10 @@
#ifndef _BANNER_H_ #ifndef _BANNER_H_
#define _BANNER_H_ #define _BANNER_H_
#include "safe_vector.hpp"
#include <string> #include <string>
using namespace std;
#define IMET_MAX_NAME_LEN 0x2a #define IMET_MAX_NAME_LEN 0x2a
typedef struct typedef struct
@ -56,8 +57,6 @@ typedef struct
u8 md5[0x10]; u8 md5[0x10];
} IMET; } IMET;
using namespace std;
class Banner class Banner
{ {
public: public:

View File

@ -29,7 +29,7 @@
#ifndef _CHANNELS_H_ #ifndef _CHANNELS_H_
#define _CHANNELS_H_ #define _CHANNELS_H_
#include "safe_vector.hpp" #include <vector>
#include <string> #include <string>
#include "smartptr.hpp" #include "smartptr.hpp"
@ -70,7 +70,7 @@ class Channels
u32 channelType; u32 channelType;
string langCode; string langCode;
safe_vector<Channel> channels; vector<Channel> channels;
static int GetLanguage(const char *lang); static int GetLanguage(const char *lang);
u64* GetChannelList(u32* count); u64* GetChannelList(u32* count);

View File

@ -6,8 +6,6 @@
#include "DeviceHandler.hpp" #include "DeviceHandler.hpp"
#include "gecko.h" #include "gecko.h"
using namespace std;
static const char *g_whitespaces = " \f\n\r\t\v"; static const char *g_whitespaces = " \f\n\r\t\v";
static const int g_floatPrecision = 10; static const int g_floatPrecision = 10;
@ -332,9 +330,9 @@ string Config::getString(const string &domain, const string &key, const string &
return data; return data;
} }
safe_vector<string> Config::getStrings(const string &domain, const string &key, char seperator, const string &defVal) vector<string> Config::getStrings(const string &domain, const string &key, char seperator, const string &defVal)
{ {
safe_vector<string> retval; vector<string> retval;
if (domain.empty() || key.empty()) if (domain.empty() || key.empty())
{ {

View File

@ -4,7 +4,6 @@
#include <map> #include <map>
#include <string> #include <string>
#include "safe_vector.hpp"
#include "video.hpp" #include "video.hpp"
#include "smartptr.hpp" #include "smartptr.hpp"
@ -36,7 +35,7 @@ public:
// Get // Get
wstringEx getWString(const std::string &domain, const std::string &key, const wstringEx &defVal = wstringEx()); wstringEx getWString(const std::string &domain, const std::string &key, const wstringEx &defVal = wstringEx());
std::string getString(const std::string &domain, const std::string &key, const std::string &defVal = std::string()); std::string getString(const std::string &domain, const std::string &key, const std::string &defVal = std::string());
safe_vector<std::string> getStrings(const std::string &domain, const std::string &key, char seperator = ',', const std::string &defval = std::string()); vector<std::string> getStrings(const std::string &domain, const std::string &key, char seperator = ',', const std::string &defval = std::string());
bool getBool(const std::string &domain, const std::string &key, bool defVal = false); bool getBool(const std::string &domain, const std::string &key, bool defVal = false);
int getOptBool(const std::string &domain, const std::string &key, int defVal = 2); int getOptBool(const std::string &domain, const std::string &key, int defVal = 2);
bool testOptBool(const std::string &domain, const std::string &key, bool defVal); bool testOptBool(const std::string &domain, const std::string &key, bool defVal);

View File

@ -27,9 +27,11 @@
#define PARTITION_HANDLE_H #define PARTITION_HANDLE_H
#include <gccore.h> #include <gccore.h>
#include "safe_vector.hpp"
#include "libwbfs/libwbfs.h" #include "libwbfs/libwbfs.h"
#include <string> #include <string>
#include <vector>
using namespace std;
#define MAX_PARTITIONS 32 /* Maximum number of partitions that can be found */ #define MAX_PARTITIONS 32 /* Maximum number of partitions that can be found */
#define MAX_MOUNTS 10 /* Maximum number of mounts available at one time */ #define MAX_MOUNTS 10 /* Maximum number of mounts available at one time */
@ -212,8 +214,8 @@ class PartitionHandle
bool CheckGPT(void); bool CheckGPT(void);
const DISC_INTERFACE *interface; const DISC_INTERFACE *interface;
safe_vector<PartitionFS> PartitionList; vector<PartitionFS> PartitionList;
safe_vector<std::string> MountNameList; vector<std::string> MountNameList;
}; };
#endif #endif

View File

@ -647,7 +647,7 @@ unsigned int GameTDB::GetPublishDate(const char * id)
bool GameTDB::GetGenres(const char * id, string & gen) bool GameTDB::GetGenres(const char * id, string & gen)
{ {
safe_vector<string> genre; vector<string> genre;
gen = ""; gen = "";
if(!id) return false; if(!id) return false;
@ -771,7 +771,7 @@ bool GameTDB::GetRatingValue(const char * id, string & rating_value)
return true; return true;
} }
int GameTDB::GetRatingDescriptors(const char * id, safe_vector<string> & desc_list) int GameTDB::GetRatingDescriptors(const char * id, vector<string> & desc_list)
{ {
desc_list.clear(); desc_list.clear();
if(!id) if(!id)
@ -838,7 +838,7 @@ int GameTDB::GetWifiPlayers(const char * id)
return players; return players;
} }
int GameTDB::GetWifiFeatures(const char * id, safe_vector<string> & feat_list) int GameTDB::GetWifiFeatures(const char * id, vector<string> & feat_list)
{ {
feat_list.clear(); feat_list.clear();
if(!id) if(!id)
@ -910,7 +910,7 @@ int GameTDB::GetPlayers(const char * id)
return players; return players;
} }
int GameTDB::GetAccessories(const char * id, safe_vector<Accessory> & acc_list) int GameTDB::GetAccessories(const char * id, vector<Accessory> & acc_list)
{ {
acc_list.clear(); acc_list.clear();
if(!id) if(!id)

View File

@ -24,7 +24,7 @@
#ifndef GAMETDB_HPP_ #ifndef GAMETDB_HPP_
#define GAMETDB_HPP_ #define GAMETDB_HPP_
#include "safe_vector.hpp" #include <vector>
#include <string> #include <string>
using namespace std; using namespace std;
@ -47,11 +47,11 @@ typedef struct _GameXMLInfo
string Genres; string Genres;
int RatingType; int RatingType;
string RatingValue; string RatingValue;
safe_vector<string> RatingDescriptors; vector<string> RatingDescriptors;
int WifiPlayers; int WifiPlayers;
safe_vector<string> WifiFeatures; vector<string> WifiFeatures;
int Players; int Players;
safe_vector<Accessory> Accessories; vector<Accessory> Accessories;
int CaseColor; int CaseColor;
} GameXMLInfo; } GameXMLInfo;
@ -107,19 +107,19 @@ class GameTDB
bool GetRatingValue(const char * id, string & rating_value); bool GetRatingValue(const char * id, string & rating_value);
//! Get the rating descriptor list inside a vector for a specific game id //! Get the rating descriptor list inside a vector for a specific game id
//! Returns the amount of descriptors found or -1 if failed //! Returns the amount of descriptors found or -1 if failed
int GetRatingDescriptors(const char * id, safe_vector<string> & desc_list); int GetRatingDescriptors(const char * id, vector<string> & desc_list);
//! Get the wifi player count for a specific game id //! Get the wifi player count for a specific game id
//! Returns the amount of wifi players or -1 if failed //! Returns the amount of wifi players or -1 if failed
int GetWifiPlayers(const char * id); int GetWifiPlayers(const char * id);
//! Get the wifi feature list inside a vector for a specific game id //! Get the wifi feature list inside a vector for a specific game id
//! Returns the amount of wifi features found or -1 if failed //! Returns the amount of wifi features found or -1 if failed
int GetWifiFeatures(const char * id, safe_vector<string> & feat_list); int GetWifiFeatures(const char * id, vector<string> & feat_list);
//! Get the player count for a specific game id //! Get the player count for a specific game id
//! Returns the amount of players or -1 if failed //! Returns the amount of players or -1 if failed
int GetPlayers(const char * id); int GetPlayers(const char * id);
//! Returns the amount of accessoires found or -1 if failed //! Returns the amount of accessoires found or -1 if failed
//! Get the accessoire (inputs) list inside a vector for a specific game id //! Get the accessoire (inputs) list inside a vector for a specific game id
int GetAccessories(const char * id, safe_vector<Accessory> & acc_list); int GetAccessories(const char * id, vector<Accessory> & acc_list);
//! Get the box (case) color for a specific game id //! Get the box (case) color for a specific game id
//! Returns the color in RGB (first 3 bytes) //! Returns the color in RGB (first 3 bytes)
unsigned int GetCaseColor(const char * id); unsigned int GetCaseColor(const char * id);
@ -150,7 +150,7 @@ class GameTDB
bool isLoaded; bool isLoaded;
bool isParsed; bool isParsed;
safe_vector<GameOffsets> OffsetMap; vector<GameOffsets> OffsetMap;
FILE * file; FILE * file;
const char *filepath; const char *filepath;
string LangCode; string LangCode;

View File

@ -39,7 +39,7 @@ class WiiMovie
float fps; float fps;
Timer PlayTime; Timer PlayTime;
u32 VideoFrameCount; u32 VideoFrameCount;
safe_vector<STexture> Frames; vector<STexture> Frames;
bool Playing; bool Playing;
bool ExitRequested; bool ExitRequested;
bool fullScreen; bool fullScreen;

View File

@ -310,7 +310,7 @@ void CCoverFlow::setFont(SFont font, const CColor &color)
} }
} }
void CCoverFlow::_transposeCover(safe_vector<CCoverFlow::CCover> &dst, u32 rows, u32 columns, int pos) void CCoverFlow::_transposeCover(vector<CCoverFlow::CCover> &dst, u32 rows, u32 columns, int pos)
{ {
int i = pos - (int)(rows * columns / 2); int i = pos - (int)(rows * columns / 2);
int j = rows >= 3 ? abs(i) - ((abs(i) + (int)rows / 2) / (int)rows) * 2 : abs(i); int j = rows >= 3 ? abs(i) - ((abs(i) + (int)rows / 2) / (int)rows) * 2 : abs(i);
@ -331,7 +331,7 @@ void CCoverFlow::setRange(u32 rows, u32 columns)
if (!m_covers.empty()) if (!m_covers.empty())
{ {
stopCoverLoader(); stopCoverLoader();
safe_vector<CCoverFlow::CCover> tmpCovers; vector<CCoverFlow::CCover> tmpCovers;
tmpCovers.resize(range); tmpCovers.resize(range);
if (rows >= 3) if (rows >= 3)
for (u32 x = 0; x < columns; ++x) for (u32 x = 0; x < columns; ++x)

View File

@ -6,7 +6,6 @@
#include <ogcsys.h> #include <ogcsys.h>
#include <gccore.h> #include <gccore.h>
#include <string> #include <string>
#include "safe_vector.hpp"
#include "wiiuse/wpad.h" #include "wiiuse/wpad.h"
#include <ogc/pad.h> #include <ogc/pad.h>
@ -227,8 +226,8 @@ private:
Vector3D m_cameraAim; Vector3D m_cameraAim;
Vector3D m_targetCameraPos; Vector3D m_targetCameraPos;
Vector3D m_targetCameraAim; Vector3D m_targetCameraAim;
safe_vector<CItem> m_items; vector<CItem> m_items;
safe_vector<CCover> m_covers; vector<CCover> m_covers;
int m_delay; int m_delay;
int m_minDelay; int m_minDelay;
int m_jump; int m_jump;
@ -325,7 +324,7 @@ private:
CLRet _loadCoverTex(u32 i, bool box, bool hq); CLRet _loadCoverTex(u32 i, bool box, bool hq);
bool _invisibleCover(u32 x, u32 y); bool _invisibleCover(u32 x, u32 y);
void _instantTarget(int i); void _instantTarget(int i);
void _transposeCover(safe_vector<CCover> &dst, u32 rows, u32 columns, int pos); void _transposeCover(vector<CCover> &dst, u32 rows, u32 columns, int pos);
void _playSound(void); void _playSound(void);
void _stopSound(SmartGuiSound snd); void _stopSound(SmartGuiSound snd);

View File

@ -6,7 +6,6 @@
#include <ogcsys.h> #include <ogcsys.h>
#include <gccore.h> #include <gccore.h>
#include <string> #include <string>
#include "safe_vector.hpp"
#include "config.hpp" #include "config.hpp"
#include "texture.hpp" #include "texture.hpp"
@ -74,7 +73,7 @@ public:
void tick(); void tick();
private: private:
safe_vector<CFanartElement> m_elms; vector<CFanartElement> m_elms;
bool m_animationComplete; bool m_animationComplete;
u16 m_delayAfterAnimation; u16 m_delayAfterAnimation;

View File

@ -580,7 +580,7 @@ void MthVideoFile::getCurrentFrame(VideoFrame& f) const
JpgVideoFile::JpgVideoFile(FILE* f) JpgVideoFile::JpgVideoFile(FILE* f)
: VideoFile(f) : VideoFile(f)
{ {
safe_vector<u8> data(getFilesize(f)); vector<u8> data(getFilesize(f));
fread(&data[0], 1, getFilesize(f), f); fread(&data[0], 1, getFilesize(f), f);
loadFrame(_currFrame, &data[0], getFilesize(f)); loadFrame(_currFrame, &data[0], getFilesize(f));

View File

@ -31,8 +31,8 @@
#include <stdio.h> //FILE* #include <stdio.h> //FILE*
#include <string> #include <string>
#include "safe_vector.hpp" #include <vector>
using namespace std;
#include <gccore.h> #include <gccore.h>
@ -285,7 +285,7 @@ class ThpVideoFile : public VideoFile
int _currFrameNr; int _currFrameNr;
int _nextFrameOffset; int _nextFrameOffset;
int _nextFrameSize; int _nextFrameSize;
safe_vector<u8> _currFrameData; vector<u8> _currFrameData;
}; };
class MthVideoFile : public VideoFile class MthVideoFile : public VideoFile
@ -311,7 +311,7 @@ class MthVideoFile : public VideoFile
int _nextFrameOffset; int _nextFrameOffset;
int _nextFrameSize; int _nextFrameSize;
int _thisFrameSize; int _thisFrameSize;
safe_vector<u8> _currFrameData; vector<u8> _currFrameData;
}; };
class JpgVideoFile : public VideoFile class JpgVideoFile : public VideoFile

View File

@ -14,8 +14,6 @@
#include "text.hpp" #include "text.hpp"
#include "gui_sound.h" #include "gui_sound.h"
#include "safe_vector.hpp"
struct SButtonTextureSet struct SButtonTextureSet
{ {
STexture left; STexture left;
@ -138,7 +136,7 @@ private:
virtual void tick(void); virtual void tick(void);
}; };
private: private:
safe_vector<SmartPtr<SElement> > m_elts; vector<SmartPtr<SElement> > m_elts;
u32 m_selected[WPAD_MAX_WIIMOTES]; u32 m_selected[WPAD_MAX_WIIMOTES];
bool m_rumbleEnabled; bool m_rumbleEnabled;
u8 m_rumble[WPAD_MAX_WIIMOTES]; u8 m_rumble[WPAD_MAX_WIIMOTES];

View File

@ -1,7 +1,5 @@
#include "text.hpp" #include "text.hpp"
using namespace std;
static const wchar_t *g_whitespaces = L" \f\n\r\t\v"; static const wchar_t *g_whitespaces = L" \f\n\r\t\v";
// Simplified use of sprintf // Simplified use of sprintf
@ -104,7 +102,7 @@ wstringEx wfmt(const wstringEx &format, ...)
return ws; return ws;
} }
string vectorToString(const safe_vector<string> &vect, string sep) string vectorToString(const vector<string> &vect, string sep)
{ {
string s; string s;
for (u32 i = 0; i < vect.size(); ++i) for (u32 i = 0; i < vect.size(); ++i)
@ -116,7 +114,7 @@ string vectorToString(const safe_vector<string> &vect, string sep)
return s; return s;
} }
wstringEx vectorToString(const safe_vector<wstringEx> &vect, char sep) wstringEx vectorToString(const vector<wstringEx> &vect, char sep)
{ {
wstringEx s; wstringEx s;
for (u32 i = 0; i < vect.size(); ++i) for (u32 i = 0; i < vect.size(); ++i)
@ -128,9 +126,9 @@ wstringEx vectorToString(const safe_vector<wstringEx> &vect, char sep)
return s; return s;
} }
safe_vector<string> stringToVector(const string &text, char sep) vector<string> stringToVector(const string &text, char sep)
{ {
safe_vector<string> v; vector<string> v;
if (text.empty()) return v; if (text.empty()) return v;
u32 count = 1; u32 count = 1;
for (u32 i = 0; i < text.size(); ++i) for (u32 i = 0; i < text.size(); ++i)
@ -154,9 +152,9 @@ safe_vector<string> stringToVector(const string &text, char sep)
return v; return v;
} }
safe_vector<wstringEx> stringToVector(const wstringEx &text, char sep) vector<wstringEx> stringToVector(const wstringEx &text, char sep)
{ {
safe_vector<wstringEx> v; vector<wstringEx> v;
if (text.empty()) return v; if (text.empty()) return v;
u32 count = 1; u32 count = 1;
for (u32 i = 0; i < text.size(); ++i) for (u32 i = 0; i < text.size(); ++i)
@ -242,7 +240,7 @@ void CText::setText(SFont font, const wstringEx &t)
firstLine = 0; firstLine = 0;
// Don't care about performance // Don't care about performance
safe_vector<wstringEx> lines = stringToVector(t, L'\n'); vector<wstringEx> lines = stringToVector(t, L'\n');
m_lines.reserve(lines.size()); m_lines.reserve(lines.size());
// //
for (u32 k = 0; k < lines.size(); ++k) for (u32 k = 0; k < lines.size(); ++k)
@ -282,7 +280,7 @@ void CText::setText(SFont font, const wstringEx &t, u32 startline)
firstLine = startline; firstLine = startline;
// Don't care about performance // Don't care about performance
safe_vector<wstringEx> lines = stringToVector(t, L'\n'); vector<wstringEx> lines = stringToVector(t, L'\n');
m_lines.reserve(lines.size()); m_lines.reserve(lines.size());
// //
for (u32 k = 0; k < lines.size(); ++k) for (u32 k = 0; k < lines.size(); ++k)

View File

@ -2,7 +2,7 @@
#ifndef __TEXT_HPP #ifndef __TEXT_HPP
#define __TEXT_HPP #define __TEXT_HPP
#include "safe_vector.hpp" #include <vector>
#include <string> #include <string>
#include "wstringEx.hpp" #include "wstringEx.hpp"
@ -11,6 +11,8 @@
#include "smartptr.hpp" #include "smartptr.hpp"
using namespace std;
struct SFont struct SFont
{ {
SmartBuf data; SmartBuf data;
@ -45,8 +47,8 @@ private:
Vector3D targetPos; Vector3D targetPos;
}; };
private: private:
typedef safe_vector<SWord> CLine; typedef vector<SWord> CLine;
safe_vector<CLine> m_lines; vector<CLine> m_lines;
SFont m_font; SFont m_font;
CColor m_color; CColor m_color;
u32 firstLine; u32 firstLine;
@ -64,10 +66,10 @@ const char *fmt(const char *format, ...);
std::string sfmt(const char *format, ...); std::string sfmt(const char *format, ...);
wstringEx wfmt(const wstringEx &format, ...); wstringEx wfmt(const wstringEx &format, ...);
bool checkFmt(const wstringEx &ref, const wstringEx &format); bool checkFmt(const wstringEx &ref, const wstringEx &format);
std::string vectorToString(const safe_vector<std::string> &vect, std::string sep); std::string vectorToString(const vector<std::string> &vect, std::string sep);
wstringEx vectorToString(const safe_vector<wstringEx> &vect, char sep); wstringEx vectorToString(const vector<wstringEx> &vect, char sep);
safe_vector<wstringEx> stringToVector(const wstringEx &text, char sep); vector<wstringEx> stringToVector(const wstringEx &text, char sep);
safe_vector<std::string> stringToVector(const std::string &text, char sep); vector<std::string> stringToVector(const std::string &text, char sep);
std::string upperCase(std::string text); std::string upperCase(std::string text);
std::string lowerCase(std::string text); std::string lowerCase(std::string text);
std::string ltrim(std::string s); std::string ltrim(std::string s);

View File

@ -6,8 +6,6 @@
#define DEFAULT_FIFO_SIZE (256 * 1024) #define DEFAULT_FIFO_SIZE (256 * 1024)
using namespace std;
extern const u8 wait_01_png[]; extern const u8 wait_01_png[];
extern const u8 wait_02_png[]; extern const u8 wait_02_png[];
extern const u8 wait_03_png[]; extern const u8 wait_03_png[];
@ -454,7 +452,7 @@ void CVideo::_showWaitMessages(CVideo *m)
s8 PNGfadeDirection = 1; s8 PNGfadeDirection = 1;
s16 currentLightLevel = 0; s16 currentLightLevel = 0;
safe_vector<STexture>::iterator waitItr = m->m_waitMessages.begin(); vector<STexture>::iterator waitItr = m->m_waitMessages.begin();
gprintf("Going to show a wait message screen, delay: %d, # images: %d\n", waitFrames, m->m_waitMessages.size()); gprintf("Going to show a wait message screen, delay: %d, # images: %d\n", waitFrames, m->m_waitMessages.size());
m->waitMessage(*waitItr); m->waitMessage(*waitItr);
@ -538,10 +536,10 @@ void CVideo::CheckWaitThread()
void CVideo::waitMessage(float delay) void CVideo::waitMessage(float delay)
{ {
waitMessage(safe_vector<STexture>(), delay); waitMessage(vector<STexture>(), delay);
} }
void CVideo::waitMessage(const safe_vector<STexture> &tex, float delay, bool useWiiLight) void CVideo::waitMessage(const vector<STexture> &tex, float delay, bool useWiiLight)
{ {
hideWaitMessage(); hideWaitMessage();

View File

@ -3,12 +3,13 @@
#define __VIDEO_HPP #define __VIDEO_HPP
#include <gccore.h> #include <gccore.h>
#include <vector>
#include "smartptr.hpp" #include "smartptr.hpp"
#include "vector.hpp" #include "vector.hpp"
#include "texture.hpp" #include "texture.hpp"
#include "safe_vector.hpp" using namespace std;
class CTexCoord class CTexCoord
{ {
@ -67,7 +68,7 @@ public:
int stencilVal(int x, int y); int stencilVal(int x, int y);
void hideWaitMessage(); void hideWaitMessage();
void waitMessage(float delay); void waitMessage(float delay);
void waitMessage(const safe_vector<STexture> &tex, float delay, bool useWiiLight = true); void waitMessage(const vector<STexture> &tex, float delay, bool useWiiLight = true);
void waitMessage(const STexture &tex); void waitMessage(const STexture &tex);
void CheckWaitThread(); void CheckWaitThread();
s32 TakeScreenshot(const char *); s32 TakeScreenshot(const char *);
@ -99,7 +100,7 @@ private:
bool m_showWaitMessage; bool m_showWaitMessage;
volatile bool m_showingWaitMessages; volatile bool m_showingWaitMessages;
bool m_useWiiLight; bool m_useWiiLight;
safe_vector<STexture> m_waitMessages; vector<STexture> m_waitMessages;
// //
static const int _stencilWidth; static const int _stencilWidth;
static const int _stencilHeight; static const int _stencilHeight;

View File

@ -3,7 +3,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ogc/machine/processor.h> #include <ogc/machine/processor.h>
#include "safe_vector.hpp" #include <vector>
#include <string> #include <string>
#include "smartptr.hpp" #include "smartptr.hpp"
#include "gecko.h" #include "gecko.h"
@ -12,6 +12,8 @@
#define BOOTER_ADDR ((u8 *) 0x93000000) #define BOOTER_ADDR ((u8 *) 0x93000000)
#define ARGS_ADDR ((u8 *) 0x93200000) #define ARGS_ADDR ((u8 *) 0x93200000)
using namespace std;
extern const u8 app_booter_bin[]; extern const u8 app_booter_bin[];
extern const u32 app_booter_bin_size; extern const u32 app_booter_bin_size;
@ -20,7 +22,7 @@ extern "C" { void __exception_closeall(); }
static u8 *homebrewbuffer = EXECUTE_ADDR; static u8 *homebrewbuffer = EXECUTE_ADDR;
static u32 homebrewsize = 0; static u32 homebrewsize = 0;
static safe_vector<std::string> Arguments; static vector<string> Arguments;
bool bootHB; bool bootHB;

View File

@ -23,7 +23,7 @@ CCache<T>::CCache(T &tmp, string path, u32 index, CMode mode) /* Load/Save One *
} }
template <typename T> template <typename T>
CCache<T>::CCache(safe_vector<T> &list, string path , CMode mode) /* Load/Save All */ CCache<T>::CCache(vector<T> &list, string path , CMode mode) /* Load/Save All */
{ {
filename = path; filename = path;
//gprintf("Opening DB: %s\n", filename.c_str()); //gprintf("Opening DB: %s\n", filename.c_str());
@ -45,7 +45,7 @@ CCache<T>::CCache(safe_vector<T> &list, string path , CMode mode) /* Load/Save A
} }
template <typename T> template <typename T>
CCache<T>::CCache(safe_vector<T> &list, string path, T tmp, CMode mode) /* Add One */ CCache<T>::CCache(vector<T> &list, string path, T tmp, CMode mode) /* Add One */
{ {
filename = path; filename = path;
//gprintf("Openning DB: %s\n", filename.c_str()); //gprintf("Openning DB: %s\n", filename.c_str());
@ -64,7 +64,7 @@ CCache<T>::CCache(safe_vector<T> &list, string path, T tmp, CMode mode) /* Add O
} }
template <typename T> template <typename T>
CCache<T>::CCache(safe_vector<T> &list, string path, u32 index, CMode mode) /* Remove One */ CCache<T>::CCache(vector<T> &list, string path, u32 index, CMode mode) /* Remove One */
{ {
filename = path; filename = path;
//gprintf("Openning DB: %s\n", filename.c_str()); //gprintf("Openning DB: %s\n", filename.c_str());
@ -91,7 +91,7 @@ CCache<T>::~CCache()
} }
template <typename T> template <typename T>
void CCache<T>::SaveAll(safe_vector<T> list) void CCache<T>::SaveAll(vector<T> list)
{ {
//gprintf("Updating DB: %s\n", filename.c_str()); //gprintf("Updating DB: %s\n", filename.c_str());
if(!cache) return; if(!cache) return;
@ -108,7 +108,7 @@ void CCache<T>::SaveOne(T tmp, u32 index)
} }
template <typename T> template <typename T>
void CCache<T>::LoadAll(safe_vector<T> &list) void CCache<T>::LoadAll(vector<T> &list)
{ {
if(!cache) return; if(!cache) return;
@ -142,7 +142,7 @@ void CCache<T>::LoadOne(T &tmp, u32 index)
} }
template <typename T> template <typename T>
void CCache<T>::AddOne(safe_vector<T> &list, T tmp) void CCache<T>::AddOne(vector<T> &list, T tmp)
{ {
//gprintf("Adding Item number %u in DB: %s\n", list.size()+1, filename.c_str()); //gprintf("Adding Item number %u in DB: %s\n", list.size()+1, filename.c_str());
list.push_back(tmp); list.push_back(tmp);
@ -152,7 +152,7 @@ void CCache<T>::AddOne(safe_vector<T> &list, T tmp)
} }
template <typename T> template <typename T>
void CCache<T>::RemoveOne(safe_vector<T> &list, u32 index) void CCache<T>::RemoveOne(vector<T> &list, u32 index)
{ {
//gprintf("Removing Item number %u in DB: %s\n", index, filename.c_str()); //gprintf("Removing Item number %u in DB: %s\n", index, filename.c_str());
list.erase(list.begin() + index); list.erase(list.begin() + index);

View File

@ -4,7 +4,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <fstream> #include <fstream>
#include "safe_vector.hpp" #include <vector>
#include "disc.h" #include "disc.h"
//#include "gecko.h" //#include "gecko.h"
@ -30,18 +30,18 @@ class CCache
{ {
public: public:
CCache(T &tmp, string path, u32 index, CMode mode); /* Load/Save One */ CCache(T &tmp, string path, u32 index, CMode mode); /* Load/Save One */
CCache(safe_vector<T> &list, string path, CMode mode); /* Load/Save All */ CCache(vector<T> &list, string path, CMode mode); /* Load/Save All */
CCache(safe_vector<T> &list, string path, T tmp, CMode mode); /* Add One */ CCache(vector<T> &list, string path, T tmp, CMode mode); /* Add One */
CCache(safe_vector<T> &list, string path, u32 index, CMode mode); /* Remove One */ CCache(vector<T> &list, string path, u32 index, CMode mode); /* Remove One */
~CCache(); ~CCache();
private: private:
void SaveAll(safe_vector<T> list); void SaveAll(vector<T> list);
void SaveOne(T tmp, u32 index); void SaveOne(T tmp, u32 index);
void LoadAll(safe_vector<T> &list); void LoadAll(vector<T> &list);
void LoadOne(T &tmp, u32 index); void LoadOne(T &tmp, u32 index);
void AddOne(safe_vector<T> &list, T tmp); void AddOne(vector<T> &list, T tmp);
void RemoveOne(safe_vector<T> &list, u32 index); void RemoveOne(vector<T> &list, u32 index);
FILE *cache; FILE *cache;
string filename; string filename;

View File

@ -78,7 +78,7 @@ void CachedList<T>::Load(string path, string containing, string m_lastLanguage,
{ {
gprintf("Calling list to update filelist\n"); gprintf("Calling list to update filelist\n");
safe_vector<string> pathlist; vector<string> pathlist;
list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL))); list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL)));
list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin); list.GetHeaders(pathlist, *this, m_settingsDir, m_curLanguage, m_DMLgameDir, m_plugin);

View File

@ -3,7 +3,6 @@
#include "list.hpp" #include "list.hpp"
#include "cache.hpp" #include "cache.hpp"
#include "safe_vector.hpp"
#include "gecko.h" #include "gecko.h"
#include "config/config.hpp" #include "config/config.hpp"
@ -19,7 +18,7 @@ enum {
}; };
template <typename T = dir_discHdr> template <typename T = dir_discHdr>
class CachedList : public safe_vector<T> class CachedList : public vector<T>
{ {
public: public:
void Init(string cachedir, string settingsDir, string curLanguage, string DMLgameDir, bool extcheck) /* Initialize Private Variables */ void Init(string cachedir, string settingsDir, string curLanguage, string DMLgameDir, bool extcheck) /* Initialize Private Variables */

View File

@ -7,7 +7,7 @@
#include "gc.h" #include "gc.h"
template <typename T> template <typename T>
void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string directory, bool wbfs_fs, bool dml) void CList<T>::GetPaths(vector<string> &pathlist, string containing, string directory, bool wbfs_fs, bool dml)
{ {
if (!wbfs_fs) if (!wbfs_fs)
{ {
@ -15,8 +15,8 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
DIR *dir_itr = opendir(directory.c_str()); DIR *dir_itr = opendir(directory.c_str());
if (!dir_itr) return; if (!dir_itr) return;
safe_vector<string> compares = stringToVector(containing, '|'); vector<string> compares = stringToVector(containing, '|');
safe_vector<string> temp_pathlist; vector<string> temp_pathlist;
struct dirent *ent; struct dirent *ent;
@ -28,7 +28,7 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
if(ent->d_type == DT_REG) if(ent->d_type == DT_REG)
{ {
for(safe_vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++) for(vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++)
if (strcasestr(ent->d_name, (*compare).c_str()) != NULL) if (strcasestr(ent->d_name, (*compare).c_str()) != NULL)
{ {
//gprintf("Pushing %s to the list.\n", sfmt("%s/%s", directory.c_str(), ent->d_name).c_str()); //gprintf("Pushing %s to the list.\n", sfmt("%s/%s", directory.c_str(), ent->d_name).c_str());
@ -44,7 +44,7 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
if(temp_pathlist.size() > 0) if(temp_pathlist.size() > 0)
{ {
bool FoundDMLgame; bool FoundDMLgame;
for(safe_vector<string>::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++) for(vector<string>::iterator templist = temp_pathlist.begin(); templist != temp_pathlist.end(); templist++)
{ {
dir_itr = opendir((*templist).c_str()); dir_itr = opendir((*templist).c_str());
if (!dir_itr) continue; if (!dir_itr) continue;
@ -55,7 +55,7 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
{ {
if(ent->d_type == DT_REG && strlen(ent->d_name) > 7) if(ent->d_type == DT_REG && strlen(ent->d_name) > 7)
{ {
for(safe_vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++) for(vector<string>::iterator compare = compares.begin(); compare != compares.end(); compare++)
{ {
if(strcasestr(ent->d_name, (*compare).c_str()) != NULL) if(strcasestr(ent->d_name, (*compare).c_str()) != NULL)
{ {
@ -98,19 +98,19 @@ void CList<T>::GetPaths(safe_vector<string> &pathlist, string containing, string
} }
template <> template <>
void CList<string>::GetHeaders(safe_vector<string> pathlist, safe_vector<string> &headerlist, string, string, string, Config&) void CList<string>::GetHeaders(vector<string> pathlist, vector<string> &headerlist, string, string, string, Config&)
{ {
//gprintf("Getting headers for CList<string>\n"); //gprintf("Getting headers for CList<string>\n");
if(pathlist.size() < 1) return; if(pathlist.size() < 1) return;
headerlist.reserve(pathlist.size() + headerlist.size()); headerlist.reserve(pathlist.size() + headerlist.size());
for(safe_vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++) for(vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++)
headerlist.push_back((*itr).c_str()); headerlist.push_back((*itr).c_str());
} }
template <> template <>
void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<dir_discHdr> &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin) void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr> &headerlist, string settingsDir, string curLanguage, string DMLgameUSBDir, Config &plugin)
{ {
if(pathlist.size() < 1) return; if(pathlist.size() < 1) return;
headerlist.reserve(pathlist.size() + headerlist.size()); headerlist.reserve(pathlist.size() + headerlist.size());
@ -136,7 +136,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
gameTDB.SetLanguageCode(curLanguage.c_str()); gameTDB.SetLanguageCode(curLanguage.c_str());
} }
for(safe_vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++) for(vector<string>::iterator itr = pathlist.begin(); itr != pathlist.end(); itr++)
{ {
bzero(&tmp, sizeof(dir_discHdr)); bzero(&tmp, sizeof(dir_discHdr));
strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path)); strncpy(tmp.path, (*itr).c_str(), sizeof(tmp.path));
@ -413,10 +413,10 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
} }
else if(plugin.loaded()) else if(plugin.loaded())
{ {
safe_vector<string> types = plugin.getStrings("PLUGIN","fileTypes",'|'); vector<string> types = plugin.getStrings("PLUGIN","fileTypes",'|');
if (types.size() > 0) if (types.size() > 0)
{ {
for(safe_vector<string>::iterator type_itr = types.begin(); type_itr != types.end(); type_itr++) for(vector<string>::iterator type_itr = types.begin(); type_itr != types.end(); type_itr++)
{ {
if(lowerCase(*itr).rfind((*type_itr).c_str()) != string::npos) if(lowerCase(*itr).rfind((*type_itr).c_str()) != string::npos)
{ {
@ -455,7 +455,7 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
} }
template <> template <>
void CList<dir_discHdr>::GetChannels(safe_vector<dir_discHdr> &headerlist, string settingsDir, u32 channelType, string curLanguage) void CList<dir_discHdr>::GetChannels(vector<dir_discHdr> &headerlist, string settingsDir, u32 channelType, string curLanguage)
{ {
Channels m_channels; Channels m_channels;
m_channels.Init(channelType, curLanguage, true); m_channels.Init(channelType, curLanguage, true);

View File

@ -9,7 +9,6 @@
#include <unistd.h> #include <unistd.h>
#include "DeviceHandler.hpp" #include "DeviceHandler.hpp"
#include "safe_vector.hpp"
#include "wbfs_ext.h" #include "wbfs_ext.h"
#include "libwbfs/libwbfs.h" #include "libwbfs/libwbfs.h"
#include "disc.h" #include "disc.h"
@ -17,16 +16,15 @@
#include "cache.hpp" #include "cache.hpp"
#include "config/config.hpp" #include "config/config.hpp"
using namespace std;
template <typename T> template <typename T>
class CList class CList
{ {
public: public:
CList(){}; CList(){};
~CList(){}; ~CList(){};
void GetPaths(safe_vector<string> &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false); void GetPaths(vector<string> &pathlist, string containing, string directory, bool wbfs_fs = false, bool dml = false);
void GetHeaders(safe_vector<string> pathlist, safe_vector<T> &headerlist, string, string, string, Config &plugin); void GetHeaders(vector<string> pathlist, vector<T> &headerlist, string, string, string, Config &plugin);
void GetChannels(safe_vector<T> &headerlist, string, u32, string); void GetChannels(vector<T> &headerlist, string, u32, string);
private: private:
void Check_For_ID(u8 *id, string path, string one, string two); void Check_For_ID(u8 *id, string path, string one, string two);
}; };

View File

@ -105,8 +105,6 @@ extern const u8 butzhcnoffs_png[];
extern const u8 checkbox_png[]; extern const u8 checkbox_png[];
extern const u8 checkboxs_png[]; extern const u8 checkboxs_png[];
using namespace std;
CMenu::CMenu(CVideo &vid) : CMenu::CMenu(CVideo &vid) :
m_vid(vid) m_vid(vid)
{ {
@ -441,14 +439,14 @@ void CMenu::init(void)
m_cfg.getString("GAMERCARD", "dutag_key", ""); m_cfg.getString("GAMERCARD", "dutag_key", "");
if (m_cfg.getBool("GAMERCARD", "gamercards_enable", false)) if (m_cfg.getBool("GAMERCARD", "gamercards_enable", false))
{ {
safe_vector<string> gamercards = stringToVector(m_cfg.getString("GAMERCARD", "gamercards"), '|'); vector<string> gamercards = stringToVector(m_cfg.getString("GAMERCARD", "gamercards"), '|');
if (gamercards.size() == 0) if (gamercards.size() == 0)
{ {
gamercards.push_back("wiinnertag"); gamercards.push_back("wiinnertag");
gamercards.push_back("dutag"); gamercards.push_back("dutag");
} }
for (safe_vector<string>::iterator itr = gamercards.begin(); itr != gamercards.end(); itr++) for (vector<string>::iterator itr = gamercards.begin(); itr != gamercards.end(); itr++)
{ {
gprintf("Found gamercard provider: %s\n",(*itr).c_str()); gprintf("Found gamercard provider: %s\n",(*itr).c_str());
register_card_provider( register_card_provider(
@ -1093,16 +1091,16 @@ SFont CMenu::_font(CMenu::FontSet &fontSet, const char *domain, const char *key,
return retFont; return retFont;
} }
safe_vector<STexture> CMenu::_textures(TexSet &texSet, const char *domain, const char *key) vector<STexture> CMenu::_textures(TexSet &texSet, const char *domain, const char *key)
{ {
safe_vector<STexture> textures; vector<STexture> textures;
if (m_theme.loaded()) if (m_theme.loaded())
{ {
safe_vector<string> filenames = m_theme.getStrings(domain, key); vector<string> filenames = m_theme.getStrings(domain, key);
if (filenames.size() > 0) if (filenames.size() > 0)
{ {
for (safe_vector<string>::iterator itr = filenames.begin(); itr != filenames.end(); itr++) for (vector<string>::iterator itr = filenames.begin(); itr != filenames.end(); itr++)
{ {
string filename = *itr; string filename = *itr;
@ -1455,7 +1453,7 @@ void CMenu::_initCF(void)
m_cf.clear(); m_cf.clear();
m_cf.reserve(m_gameList.size()); m_cf.reserve(m_gameList.size());
safe_vector<bool> EnabledPlugins; vector<bool> EnabledPlugins;
if(m_current_view == COVERFLOW_EMU) if(m_current_view == COVERFLOW_EMU)
EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg); EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
@ -2010,7 +2008,7 @@ bool CMenu::_loadEmuList()
pdir = opendir(m_pluginsDir.c_str()); pdir = opendir(m_pluginsDir.c_str());
safe_vector<dir_discHdr> emuList; vector<dir_discHdr> emuList;
Config m_plugin_cfg; Config m_plugin_cfg;
while ((pent = readdir(pdir)) != NULL) while ((pent = readdir(pdir)) != NULL)
@ -2029,16 +2027,16 @@ bool CMenu::_loadEmuList()
if(strcasestr(m_plugin_cfg.getString("PLUGIN","romDir","").c_str(), "scummvm.ini") == NULL) if(strcasestr(m_plugin_cfg.getString("PLUGIN","romDir","").c_str(), "scummvm.ini") == NULL)
{ {
m_gameList.Load(sfmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString("PLUGIN","romDir","").c_str()), m_plugin_cfg.getString("PLUGIN","fileTypes","").c_str(), m_cfg.getString("EMULATOR", "lastlanguage", "EN").c_str(), m_plugin_cfg); m_gameList.Load(sfmt("%s:/%s", DeviceName[currentPartition], m_plugin_cfg.getString("PLUGIN","romDir","").c_str()), m_plugin_cfg.getString("PLUGIN","fileTypes","").c_str(), m_cfg.getString("EMULATOR", "lastlanguage", "EN").c_str(), m_plugin_cfg);
for(safe_vector<dir_discHdr>::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = m_gameList.begin(); tmp_itr != m_gameList.end(); tmp_itr++)
emuList.push_back(*tmp_itr); emuList.push_back(*tmp_itr);
} }
else else
{ {
Config scummvm; Config scummvm;
safe_vector<dir_discHdr> scummvmList; vector<dir_discHdr> scummvmList;
scummvm.load(fmt("%s/%s", m_pluginsDir.c_str(), "scummvm.ini")); scummvm.load(fmt("%s/%s", m_pluginsDir.c_str(), "scummvm.ini"));
scummvmList = m_plugin.ParseScummvmINI(scummvm, string(DeviceName[currentPartition])); scummvmList = m_plugin.ParseScummvmINI(scummvm, string(DeviceName[currentPartition]));
for(safe_vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = scummvmList.begin(); tmp_itr != scummvmList.end(); tmp_itr++)
emuList.push_back(*tmp_itr); emuList.push_back(*tmp_itr);
} }
} }
@ -2047,7 +2045,7 @@ bool CMenu::_loadEmuList()
} }
closedir(pdir); closedir(pdir);
m_gameList.clear(); m_gameList.clear();
for(safe_vector<dir_discHdr>::iterator tmp_itr = emuList.begin(); tmp_itr != emuList.end(); tmp_itr++) for(vector<dir_discHdr>::iterator tmp_itr = emuList.begin(); tmp_itr != emuList.end(); tmp_itr++)
m_gameList.push_back(*tmp_itr); m_gameList.push_back(*tmp_itr);
emuList.clear(); emuList.clear();
//If we return to the coverflow before wiiflow quit we dont need to reload plugins //If we return to the coverflow before wiiflow quit we dont need to reload plugins

View File

@ -4,8 +4,8 @@
//#define SHOWMEMGECKO //#define SHOWMEMGECKO
#include "wiiuse/wpad.h" #include "wiiuse/wpad.h"
#include <ogc/pad.h> #include <ogc/pad.h>
#include <vector>
#include "safe_vector.hpp"
#include "cachedlist.hpp" #include "cachedlist.hpp"
#include "plugin/plugin.hpp" #include "plugin/plugin.hpp"
@ -30,6 +30,8 @@
#define PART_FS_NTFS 2 #define PART_FS_NTFS 2
#define PART_FS_EXT 3 #define PART_FS_EXT 3
using namespace std;
extern "C" {extern u8 currentPartition;} extern "C" {extern u8 currentPartition;}
extern bool bootHB; extern bool bootHB;
@ -69,7 +71,7 @@ private:
Config m_version; Config m_version;
Plugin m_plugin; Plugin m_plugin;
Channels m_channels; Channels m_channels;
safe_vector<std::string> m_homebrewArgs; vector<std::string> m_homebrewArgs;
SmartBuf m_base_font; SmartBuf m_base_font;
u32 m_base_font_size; u32 m_base_font_size;
u8 m_aa; u8 m_aa;
@ -951,10 +953,10 @@ private:
// //
void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false); void _mainLoopCommon(bool withCF = false, bool blockReboot = false, bool adjusting = false);
// //
safe_vector<dir_discHdr> _searchGamesByID(const char *gameId); vector<dir_discHdr> _searchGamesByID(const char *gameId);
/* safe_vector<dir_discHdr> _searchGamesByTitle(wchar_t letter); /* vector<dir_discHdr> _searchGamesByTitle(wchar_t letter);
safe_vector<dir_discHdr> _searchGamesByType(const char type); vector<dir_discHdr> _searchGamesByType(const char type);
safe_vector<dir_discHdr> _searchGamesByRegion(const char region); */ vector<dir_discHdr> _searchGamesByRegion(const char region); */
public: public:
void _directlaunch(const std::string &id); void _directlaunch(const std::string &id);
private: private:
@ -963,7 +965,7 @@ private:
void _launch(dir_discHdr *hdr); void _launch(dir_discHdr *hdr);
void _launchGame(dir_discHdr *hdr, bool dvd); void _launchGame(dir_discHdr *hdr, bool dvd);
void _launchChannel(dir_discHdr *hdr); void _launchChannel(dir_discHdr *hdr);
void _launchHomebrew(const char *filepath, safe_vector<std::string> arguments); void _launchHomebrew(const char *filepath, vector<std::string> arguments);
void _launchGC(dir_discHdr *hdr, bool DML); void _launchGC(dir_discHdr *hdr, bool DML);
void _setAA(int aa); void _setAA(int aa);
void _loadCFCfg(SThemeData &theme); void _loadCFCfg(SThemeData &theme);
@ -982,7 +984,7 @@ private:
void RemoveCover( char * id ); void RemoveCover( char * id );
SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey); SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey);
STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def); STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def);
safe_vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key); vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key);
void _showWaitMessage(); void _showWaitMessage();
public: public:
void _hideWaitMessage(); void _hideWaitMessage();

View File

@ -6,8 +6,6 @@
#include "loader/alt_ios.h" #include "loader/alt_ios.h"
#include "gecko/gecko.h" #include "gecko/gecko.h"
using namespace std;
const int CMenu::_nbCfgPages = 6; const int CMenu::_nbCfgPages = 6;
static const int g_curPage = 1; static const int g_curPage = 1;

View File

@ -4,8 +4,6 @@
#define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) #define ARRAY_SIZE(a) (sizeof a / sizeof a[0])
using namespace std;
static const int g_curPage = 3; static const int g_curPage = 3;
template <class T> static inline T loopNum(T i, T s) template <class T> static inline T loopNum(T i, T s)

View File

@ -6,8 +6,6 @@
#include "defines.h" #include "defines.h"
#include "nand.hpp" #include "nand.hpp"
using namespace std;
static const int g_curPage = 4; static const int g_curPage = 4;
static inline int loopNum(int i, int s) static inline int loopNum(int i, int s)

View File

@ -65,7 +65,7 @@ void CMenu::_showConfigAdv(void)
m_btnMgr.setText(m_configAdvLblCurTheme, m_cfg.getString("GENERAL", "theme")); m_btnMgr.setText(m_configAdvLblCurTheme, m_cfg.getString("GENERAL", "theme"));
} }
static void listThemes(const char * path, safe_vector<string> &themes) static void listThemes(const char * path, vector<string> &themes)
{ {
DIR *d; DIR *d;
struct dirent *dir; struct dirent *dir;
@ -94,7 +94,7 @@ static void listThemes(const char * path, safe_vector<string> &themes)
int CMenu::_configAdv(void) int CMenu::_configAdv(void)
{ {
int change = CONFIG_PAGE_NO_CHANGE; int change = CONFIG_PAGE_NO_CHANGE;
safe_vector<string> themes; vector<string> themes;
string prevTheme = m_cfg.getString("GENERAL", "theme"); string prevTheme = m_cfg.getString("GENERAL", "theme");
bool lang_changed = false; bool lang_changed = false;

View File

@ -7,8 +7,6 @@
#define ARRAY_SIZE(a) (sizeof a / sizeof a[0]) #define ARRAY_SIZE(a) (sizeof a / sizeof a[0])
using namespace std;
static inline int loopNum(int i, int s) static inline int loopNum(int i, int s)
{ {
return i < 0 ? (s - (-i % s)) % s : i % s; return i < 0 ? (s - (-i % s)) % s : i % s;

View File

@ -1,9 +1,6 @@
#include "menu.hpp" #include "menu.hpp"
using namespace std;
static const int g_curPage = 6; static const int g_curPage = 6;
void CMenu::_hideConfigScreen(bool instant) void CMenu::_hideConfigScreen(bool instant)

View File

@ -1,8 +1,6 @@
#include "menu.hpp" #include "menu.hpp"
using namespace std;
static const int g_curPage = 5; static const int g_curPage = 5;
void CMenu::_hideConfigSnd(bool instant) void CMenu::_hideConfigSnd(bool instant)

View File

@ -29,8 +29,6 @@
#define GAMETDB_URL "http://www.gametdb.com/wiitdb.zip?LANG=%s&FALLBACK=TRUE&WIIWARE=TRUE&GAMECUBE=TRUE" #define GAMETDB_URL "http://www.gametdb.com/wiitdb.zip?LANG=%s&FALLBACK=TRUE&WIIWARE=TRUE&GAMECUBE=TRUE"
#define UPDATE_URL_VERSION "http://dl.dropbox.com/u/25620767/WiiflowMod/versions.txt" #define UPDATE_URL_VERSION "http://dl.dropbox.com/u/25620767/WiiflowMod/versions.txt"
using namespace std;
static const char FMT_BPIC_URL[] = "http://art.gametdb.com/wii/coverfullHQ/{loc}/{gameid}.png"\ static const char FMT_BPIC_URL[] = "http://art.gametdb.com/wii/coverfullHQ/{loc}/{gameid}.png"\
"|http://art.gametdb.com/wii/coverfull/{loc}/{gameid}.png"; "|http://art.gametdb.com/wii/coverfull/{loc}/{gameid}.png";
static const char FMT_PIC_URL[] = "http://art.gametdb.com/wii/cover/{loc}/{gameid}.png"; static const char FMT_PIC_URL[] = "http://art.gametdb.com/wii/cover/{loc}/{gameid}.png";
@ -455,7 +453,7 @@ void CMenu::_deinitNetwork()
int CMenu::_coverDownloader(bool missingOnly) int CMenu::_coverDownloader(bool missingOnly)
{ {
string path; string path;
safe_vector<string> coverList; vector<string> coverList;
int count = 0, countFlat = 0; int count = 0, countFlat = 0;
float listWeight = missingOnly ? 0.125f : 0.f; // 1/8 of the progress bar for testing the PNGs we already have float listWeight = missingOnly ? 0.125f : 0.f; // 1/8 of the progress bar for testing the PNGs we already have
float dlWeight = 1.f - listWeight; float dlWeight = 1.f - listWeight;
@ -472,10 +470,10 @@ int CMenu::_coverDownloader(bool missingOnly)
} }
bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true); bool savePNG = m_cfg.getBool("GENERAL", "keep_png", true);
safe_vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|'); vector<string> fmtURLBox = stringToVector(m_cfg.getString("GENERAL", "url_full_covers", FMT_BPIC_URL), '|');
safe_vector<string> fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|'); vector<string> fmtURLFlat = stringToVector(m_cfg.getString("GENERAL", "url_flat_covers", FMT_PIC_URL), '|');
safe_vector<string> fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|'); vector<string> fmtURLCBox = stringToVector(m_cfg.getString("GENERAL", "url_custom_full_covers", FMT_CBPIC_URL), '|');
safe_vector<string> fmtURLCFlat = stringToVector(m_cfg.getString("GENERAL", "url_custom_flat_covers", FMT_CPIC_URL), '|'); vector<string> fmtURLCFlat = stringToVector(m_cfg.getString("GENERAL", "url_custom_flat_covers", FMT_CPIC_URL), '|');
u32 nbSteps = m_gameList.size(); u32 nbSteps = m_gameList.size();
u32 step = 0; u32 step = 0;

View File

@ -32,8 +32,6 @@
#include "defines.h" #include "defines.h"
#include "gc/gc.h" #include "gc/gc.h"
using namespace std;
extern const u8 btngamecfg_png[]; extern const u8 btngamecfg_png[];
extern const u8 btngamecfgs_png[]; extern const u8 btngamecfgs_png[];
extern const u8 stopkidon_png[]; extern const u8 stopkidon_png[];
@ -619,7 +617,7 @@ void CMenu::_directlaunch(const string &id)
DeviceHandler::Instance()->Open_WBFS(i); DeviceHandler::Instance()->Open_WBFS(i);
CList<dir_discHdr> list; CList<dir_discHdr> list;
string path = sfmt(GAMES_DIR, DeviceName[i]); string path = sfmt(GAMES_DIR, DeviceName[i]);
safe_vector<string> pathlist; vector<string> pathlist;
list.GetPaths(pathlist, id.c_str(), path, list.GetPaths(pathlist, id.c_str(), path,
strncasecmp(DeviceHandler::Instance()->PathToFSName(path.c_str()), "WBFS", 4) == 0); strncasecmp(DeviceHandler::Instance()->PathToFSName(path.c_str()), "WBFS", 4) == 0);
@ -645,7 +643,7 @@ void CMenu::_launch(dir_discHdr *hdr)
if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL) if(strstr(wiiflow_dol.c_str(), "sd:/") == NULL)
wiiflow_dol.erase(3,1); wiiflow_dol.erase(3,1);
string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size())); string path((char*)hdr->path, size_t(strlen((char*)hdr->path) - title.size()));
safe_vector<std::string> arguments; vector<std::string> arguments;
gprintf("Game title: %s\n", title.c_str()); gprintf("Game title: %s\n", title.c_str());
if(strstr(path.c_str(), ":/") != NULL) if(strstr(path.c_str(), ":/") != NULL)
{ {
@ -771,7 +769,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
Sys_LoadMenu(); Sys_LoadMenu();
} }
void CMenu::_launchHomebrew(const char *filepath, safe_vector<std::string> arguments) void CMenu::_launchHomebrew(const char *filepath, vector<std::string> arguments)
{ {
gprintf("Filepath of homebrew: %s\n",filepath); gprintf("Filepath of homebrew: %s\n",filepath);
if(LoadHomebrew(filepath)) if(LoadHomebrew(filepath))

View File

@ -430,7 +430,7 @@ void CMenu::_textGameInfo(void)
zapper=0; zapper=0;
//check required controlls //check required controlls
for (safe_vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++) for (vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++)
{ {
if (!acc_itr->Required) continue; if (!acc_itr->Required) continue;
@ -549,7 +549,7 @@ void CMenu::_textGameInfo(void)
udraw = 0, udraw = 0,
zapper=0; zapper=0;
for (safe_vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++) for (vector<Accessory>::iterator acc_itr = gameinfo.Accessories.begin(); acc_itr != gameinfo.Accessories.end(); acc_itr++)
{ {
if (acc_itr->Required) continue; if (acc_itr->Required) continue;

View File

@ -2,9 +2,6 @@
#include "gecko.h" #include "gecko.h"
#include <stdlib.h> #include <stdlib.h>
using namespace std;
static const u32 g_repeatDelay = 25; static const u32 g_repeatDelay = 25;
void CMenu::SetupInput() void CMenu::SetupInput()

View File

@ -16,8 +16,6 @@
#include "loader/alt_ios.h" #include "loader/alt_ios.h"
#include "GameTDB.hpp" #include "GameTDB.hpp"
using namespace std;
extern const u8 btnconfig_png[]; extern const u8 btnconfig_png[];
extern const u8 btnconfigs_png[]; extern const u8 btnconfigs_png[];
extern const u8 btninfo_png[]; extern const u8 btninfo_png[];

View File

@ -8,8 +8,6 @@
#include "gecko/gecko.h" #include "gecko/gecko.h"
#include "defines.h" #include "defines.h"
using namespace std;
static inline int loopNum(int i, int s) static inline int loopNum(int i, int s)
{ {
return i < 0 ? (s - (-i % s)) % s : i % s; return i < 0 ? (s - (-i % s)) % s : i % s;
@ -515,7 +513,7 @@ int CMenu::_NandDumper(void *obj)
{ {
bool missingOnly = !m.m_saveall; bool missingOnly = !m.m_saveall;
string path, npath; string path, npath;
safe_vector<string> saveList; vector<string> saveList;
m.m_sgdump = true; m.m_sgdump = true;
if(m.m_saveExtGameId.empty()) if(m.m_saveExtGameId.empty())

View File

@ -68,7 +68,7 @@ void CMenu::_updatePluginCheckboxes(void)
m_btnMgr.hide(m_pluginLblCat[i]); m_btnMgr.hide(m_pluginLblCat[i]);
} }
safe_vector<bool> EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg); vector<bool> EnabledPlugins = m_plugin.GetEnabledPlugins(m_cfg);
if(Plugin_curPage == 1) if(Plugin_curPage == 1)
{ {
int j = 11; int j = 11;

View File

@ -5,40 +5,40 @@
// Returns a list of games which starts with the specified (partial) gameId // Returns a list of games which starts with the specified (partial) gameId
// We can enhance the code in this file later on to support more search features // We can enhance the code in this file later on to support more search features
// Using a search class as argument or something like that // Using a search class as argument or something like that
safe_vector<dir_discHdr> CMenu::_searchGamesByID(const char *gameId) vector<dir_discHdr> CMenu::_searchGamesByID(const char *gameId)
{ {
safe_vector<dir_discHdr> retval; vector<dir_discHdr> retval;
for (safe_vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
if (strncmp((const char *) (*itr).hdr.id, gameId, strlen(gameId)) == 0) if (strncmp((const char *) (*itr).hdr.id, gameId, strlen(gameId)) == 0)
retval.push_back(*itr); retval.push_back(*itr);
return retval; return retval;
} }
/* /*
safe_vector<dir_discHdr> CMenu::_searchGamesByTitle(wchar_t letter) vector<dir_discHdr> CMenu::_searchGamesByTitle(wchar_t letter)
{ {
safe_vector<dir_discHdr> retval; vector<dir_discHdr> retval;
for (safe_vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
if ((*itr).title[0] == letter) if ((*itr).title[0] == letter)
retval.push_back(*itr); retval.push_back(*itr);
return retval; return retval;
} }
safe_vector<dir_discHdr> CMenu::_searchGamesByType(const char type) vector<dir_discHdr> CMenu::_searchGamesByType(const char type)
{ {
safe_vector<dir_discHdr> retval; vector<dir_discHdr> retval;
for (safe_vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
if ((*itr).id[0] == type) if ((*itr).id[0] == type)
retval.push_back(*itr); retval.push_back(*itr);
return retval; return retval;
} }
safe_vector<dir_discHdr> CMenu::_searchGamesByRegion(const char region) vector<dir_discHdr> CMenu::_searchGamesByRegion(const char region)
{ {
safe_vector<dir_discHdr> retval; vector<dir_discHdr> retval;
for (safe_vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++) for (vector<dir_discHdr>::iterator itr = m_gameList.begin(); itr != m_gameList.end(); itr++)
if ((*itr).id[3] == region) if ((*itr).id[3] == region)
retval.push_back(*itr); retval.push_back(*itr);

View File

@ -10,8 +10,6 @@
#include "defines.h" #include "defines.h"
#include "wdvd.h" #include "wdvd.h"
using namespace std;
void CMenu::_hideWBFS(bool instant) void CMenu::_hideWBFS(bool instant)
{ {
m_btnMgr.hide(m_wbfsLblTitle, instant); m_btnMgr.hide(m_wbfsLblTitle, instant);

View File

@ -44,7 +44,7 @@ private:
void LoadCurrentFile(); void LoadCurrentFile();
CachedList<std::string> m_music_files; CachedList<std::string> m_music_files;
safe_vector<std::string>::iterator m_current_music; vector<std::string>::iterator m_current_music;
int m_fade_rate; int m_fade_rate;

View File

@ -152,9 +152,9 @@ void Plugin::SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode)
} }
} }
safe_vector<bool> Plugin::GetEnabledPlugins(Config &cfg) vector<bool> Plugin::GetEnabledPlugins(Config &cfg)
{ {
safe_vector<bool> enabledPlugins; vector<bool> enabledPlugins;
char PluginMagicWord[8]; char PluginMagicWord[8];
u8 enabledPluginsNumber = 0; u8 enabledPluginsNumber = 0;
for(u8 i = 0; i < Plugins.size(); i++) for(u8 i = 0; i < Plugins.size(); i++)
@ -178,10 +178,10 @@ u32 Plugin::getPluginMagic(u8 pos)
return Plugins[pos].magicWord; return Plugins[pos].magicWord;
} }
safe_vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device) vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, string Device)
{ {
gprintf("Parsing scummvm.ini\n"); gprintf("Parsing scummvm.ini\n");
safe_vector<dir_discHdr> gameHeader; vector<dir_discHdr> gameHeader;
if(!ini.loaded()) if(!ini.loaded())
return gameHeader; return gameHeader;
string game(ini.firstDomain()); string game(ini.firstDomain());

View File

@ -10,9 +10,9 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector>
#include "config/config.hpp" #include "config/config.hpp"
#include "safe_vector.hpp"
#include "loader/disc.h" #include "loader/disc.h"
using namespace std; using namespace std;
@ -40,16 +40,16 @@ public:
u32 getPluginMagic(u8 pos); u32 getPluginMagic(u8 pos);
bool PluginExist(u8 pos); bool PluginExist(u8 pos);
void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0); void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0);
safe_vector<bool> GetEnabledPlugins(Config &cfg); vector<bool> GetEnabledPlugins(Config &cfg);
bool UseReturnLoader(u32 magic); bool UseReturnLoader(u32 magic);
void init(string); void init(string);
void Cleanup(); void Cleanup();
void EndAdd(); void EndAdd();
safe_vector<dir_discHdr> ParseScummvmINI(Config &ini, string Device); vector<dir_discHdr> ParseScummvmINI(Config &ini, string Device);
private: private:
s8 GetPluginPosition(u32 magic); s8 GetPluginPosition(u32 magic);
safe_vector<PluginOptions> Plugins; vector<PluginOptions> Plugins;
s8 Plugin_Pos; s8 Plugin_Pos;
string pluginsDir; string pluginsDir;
bool adding; bool adding;

View File

@ -1,96 +0,0 @@
/*****************************************|
|-----vector class wrapper by Miigotu-----|
|---Thx to dimok and r-win for guidance---|
|*****************************************/
#ifndef SAFE_VECTOR
#define SAFE_VECTOR
#include <string>
#include <vector>
template <class T>
class safe_vector
{
public:
typedef size_t size_type;
typedef typename std::vector<T>::iterator iterator;
typedef typename std::vector<T>::const_iterator const_iterator;
typedef typename std::vector<T>::reference reference;
typedef typename std::vector<T>::const_reference const_reference;
safe_vector(){};
safe_vector(size_type n){thevector.resize(n);}
~safe_vector(){clear();};
void clear()
{
thevector.clear();
std::vector<T>().swap(thevector);
}
void push_back(const T& x)
{
if(thevector.size() * sizeof(T) == thevector.capacity() && thevector.capacity() < thevector.max_size() - 20)
thevector.reserve(thevector.size() + 20);
thevector.push_back(x);
}
void resize(size_type sz, T c = T())
{
thevector.resize(sz, c);
realloc(sz);
}
size_type size() const { return thevector.size(); }
void reserve(size_type n) {thevector.reserve(n);}
size_type capacity() const {return thevector.capacity();}
bool empty() const {return thevector.empty();}
reference operator[](size_type n) {return thevector[n];}
const_reference operator[](size_type n) const {return thevector[n];}
iterator erase(iterator position) {return thevector.erase(position);}
iterator erase(iterator first, iterator last) {return thevector.erase(first, last);}
iterator begin() {return thevector.begin();}
const_iterator begin() const {return thevector.begin();}
iterator end() {return thevector.end();}
const_iterator end() const {return thevector.end();}
const_reference at (size_type n) const {return thevector.at(n);}
reference at (size_type n) {return thevector.at(n);}
reference back() {return thevector.back();}
const_reference back() const {return thevector.back();}
void realloc(size_type sz)
{
if(thevector.size() * sizeof(T) < thevector.capacity() || sz * sizeof(T) < thevector.capacity() || sz < thevector.size())
{
iterator itr;
std::vector<T> newvector;
newvector.reserve(sz);
for (itr = thevector.begin(); newvector.size() < sz && itr < thevector.end(); itr++)
newvector.push_back(*itr);
clear();
thevector.reserve(sz);
for (itr = newvector.begin(); thevector.size() < sz && itr < newvector.end(); itr++)
thevector.push_back(*itr);
newvector.clear();
std::vector<T>().swap(newvector);
}
}
private:
std::vector<T> thevector;
};
#endif /*- SAFE_VECTOR -*/