-first step into getting the lists away from the buggy mem1

(VERY beta, not suggested to use this version)
This commit is contained in:
fix94.1 2013-01-20 23:30:28 +00:00
parent fd071afd36
commit a95fe25030
21 changed files with 148 additions and 531 deletions

View File

@ -66,7 +66,7 @@ endif
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lpng -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad -ljpeg -lmodplay LIBS := -lcustomfat -lcustomntfs -lcustomext2fs -lpng -ljpeg -lm -lz -lwiiuse -lbte -lasnd -logc -lfreetype -lvorbisidec -lmad
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing

View File

@ -1,11 +0,0 @@
/*
* Copyright (c) 2002, 2003, 2004, 2005, 2007 by Christian Nowak <chnowak@web.de>
* Last update: 20th October, 2007
*/
#ifndef __DEFINES_H__
#define __DEFINES_H__
#include <gccore.h>
#endif

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 2002, 2003, 2004, 2005, 2007 by Christian Nowak <chnowak@web.de>
* Last update: 20th October, 2007
*/
#ifndef __ENVELOPE_H__
#define __ENVELOPE_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "defines.h"
#define ENV_WIDTH 65536
#define ENV_HEIGHT 65536
typedef struct EnvPoint {
u16 x,y;
} EnvPoint;
typedef struct EnvelopeConfig {
BOOL enabled;
u8 numPoints; /* # of envelope points */
u8 loop_start;
u8 loop_end;
u8 sustain;
EnvPoint *envPoints;
} EnvelopeConfig;
typedef struct Envelope {
EnvelopeConfig *envConfig;
BOOL triggered;
BOOL hold;
u8 curPoint;
u16 value;
u16 position;
} Envelope;
void EnvReset(Envelope *env);
void EnvTrigger(Envelope *env);
BOOL EnvProcess(Envelope *env);
void EnvRelease(Envelope *env);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,77 +0,0 @@
/*
* Copyright (c) 2002, 2003, 2004, 2005, 2007 by Christian Nowak <chnowak@web.de>
* Last update: 20th October, 2007
*/
#ifndef __MIXER_H__
#define __MIXER_H__
#include "defines.h"
/*
#define MIXER_TYPE u64
#define MIXER_SHIFT 32
*/
#define MIXER_TYPE u32
#define MIXER_SHIFT 10
typedef struct MOD_SAMPLEINFO16 {
u32 length;
u32 loop_start;
u32 loop_end;
BOOL looped;
BOOL pingpong;
void *sampledata;
BOOL bit_16;
BOOL stereo;
} MOD_SAMPLEINFO16;
typedef struct MOD_VOICEINFO16 {
BOOL enabled;
BOOL playing;
BOOL forward;
u8 panning;
u8 envPanning;
/* u32 playpos;
u32 incval;*/
MIXER_TYPE playpos;
MIXER_TYPE incval;
u8 volume;
u8 envVolume;
MOD_SAMPLEINFO16 *sampleInfo;
} MOD_VOICEINFO16;
#define MIXER_USE_S32 1
#define MIXER_3232BIT 2
#define MIXER_SRC_SIGNED 4
#define MIXER_DEST_STEREO 8
#define MIXER_USE_DOUBLE 16
#define MIXER_USE_FLOAT 32
#define MIXER_DEST_16BIT 64
#define MIXER_DEST_SIGNED 128
#define MIXER_SRC_16BIT 256
int mix_s8m_to_s32m_1616bit (s32 *, int, MOD_VOICEINFO16 *, u8);
int mix_s8m_to_s32s_1616bit (s32 *, int, MOD_VOICEINFO16*, u8);
int mix_s16m_to_s32s_1616bit(s32 *, int, MOD_VOICEINFO16 *, u8);
int mix_s16m_to_s32m_1616bit(s32 *, int, MOD_VOICEINFO16 *, u8);
void clearbuf_s32(s32 *, int, int);
void copybuf_s32_to_s16(s16 *, s32 *, int, int);
void copybuf_s32_to_u16(u16 *, s32 *, int, int);
void copybuf_s32_to_s8 (s8 *, s32 *, int, int);
void copybuf_s32_to_u8 (u8 *, s32 *, int, int);
int mix_final_1616bit(int flags, void *dest, int nSamples, MOD_VOICEINFO16 *vinfo, u8 mainvol);
int copybuf_final(int flags, void *dest, void *src, int nSamples);
int clearbuf_final(int flags, void *dest, int nSamples);
int mix_destbufsize(int flags);
#endif

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2002, 2003, 2004, 2005, 2007 by Christian Nowak <chnowak@web.de>
* Last update: 20th October, 2007
*/
#ifndef __MODPLAY_H__
#define __MODPLAY_H__
#include "modplay_core.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MODULE_MOD 1
#define MODULE_S3M 2
#define MODULE_XM 3
typedef struct MODFORMAT {
int (*set)(u8 *, int, MODFILE *);
BOOL (*is) (u8 *, int);
int (*getFormatID)(void);
char *(*getDescription)(void);
char *(*getAuthor)(void);
char *(*getVersion)(void);
char *(*getCopyright)(void);
} MODFORMAT;
extern const MODFORMAT mod_formats[];
int MODFILE_Load(const char *fname, MODFILE *mod);
void MODFILE_Start(MODFILE *s3m);
void MODFILE_Stop(MODFILE *s3m);
void MODFILE_Player(MODFILE *s3m);
void MODFILE_Free(MODFILE *mod);
void MODFILE_Init(MODFILE *mod);
void MODFILE_SetFormat(MODFILE *mod, int freq, int channels, int bits, BOOL mixsigned);
int MODFILE_Set(u8 *modfile, int modlength, MODFILE *mod);
BOOL MODFILE_Is(u8 *, int);
MOD_Instrument *MODFILE_MakeInstrument(void *rawData, int nBytes, int nBits);
int MODFILE_AllocSFXChannels(MODFILE *mod, int nChannels);
void MODFILE_TriggerSFX(MODFILE *mod, MOD_Instrument *instr, int channel, u8 note);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,212 +0,0 @@
/*
* Copyright (c) 2002, 2003, 2004, 2005, 2007 by Christian Nowak <chnowak@web.de>
* Last update: 20th October, 2007
*/
#ifndef __MODPLAY_CORE_H__
#define __MODPLAY_CORE_H__
#include "defines.h"
#include "mixer.h"
#include "envelope.h"
#define MODPLAY_MAX_CHANNELS 33
#define MODPLAY_NUM_COMMANDS 2
typedef struct MOD_Note {
u32 instrument;
u8 volume;
u8 note;
u16 effect[MODPLAY_NUM_COMMANDS];
u8 operand[MODPLAY_NUM_COMMANDS];
} MOD_Note;
typedef struct MOD_ChannelEffect {
u16 cur_effect;
u8 cur_operand;
u16 last_effect;
/* Panning slide */
u8 panslide_bak;
/* Volume Slide */
u8 volslide_bak;
/* Portamento */
u8 porta_bak;
/* Tone portamento */
u8 toneporta_bak;
u32 toneporta_dest;
/* Vibrato */
u8 vibrato_depth;
u8 vibrato_freq;
u8 vibrato_bak;
int vibrato_wave;
u32 vibrato_base;
int vibrato_sintabpos;
/* Tremolo */
u8 tremolo_depth;
u8 tremolo_freq;
u8 tremolo_bak;
int tremolo_wave;
u8 tremolo_base;
int tremolo_sintabpos;
/* Retrig */
u8 retrig_count;
u8 retrig_bak;
/* Note delay */
/* u8 notedelay_note;
u8 notedelay_instrument;
u8 notedelay_volume;
u8 notedelay_tick;*/
MOD_Note *notedelay_note;
/* Note cut */
u8 notecut_tick;
/* Arpeggio */
u8 arpeggio_count;
u8 arpeggio_bak;
u32 arpeggio_base;
/* Offset */
u8 offset_bak;
/* Fine volslide */
u8 finevolslidedown_bak;
u8 finevolslideup_bak;
u8 gvolslide_bak;
} MOD_ChannelEffect;
typedef struct MOD_Sample {
MOD_SAMPLEINFO16 sampleInfo;
char name[28];
u8 default_volume;
u32 middle_c;
u32 default_middle_c;
s8 finetune;
s8 relative_note;
u8 panning;
u8 volume;
} MOD_Sample;
typedef struct MOD_Instrument {
char name[28];
MOD_Sample *samples[256]; /* Instrument note -> Sample number mapping */
u8 note[256]; /* Instrument note -> Sample note mapping */
EnvelopeConfig envPanning;
EnvelopeConfig envVolume;
u16 volumeFade;
} MOD_Instrument;
typedef struct MOD_Channel {
u16 volumeFade;
u16 volumeFadeDec;
/* u32 instrument;*/
MOD_Instrument *instrument;
/* u32 sample;*/
MOD_Sample *sample;
MOD_VOICEINFO16 voiceInfo;
Envelope envPanning;
Envelope envVolume;
u8 default_panning;
u8 cur_note;
u32 st3_period;
s32 st3_periodofs;
u8 last_instrument;
u8 last_note;
MOD_ChannelEffect effects[MODPLAY_NUM_COMMANDS];
} MOD_Channel;
typedef struct MODFILE {
char songname[28];
int nChannels;
int nSFXChannels;
int songlength;
int nInstruments;
int nSamples;
int nPatterns;
int restart_position;
int period_type; /* 0 - Amiga, 1 - Linear (XM) */
BOOL st2_vibrato;
BOOL st2_tempo;
BOOL amiga_sliding;
BOOL optimize_vols;
BOOL amiga_boundaries;
BOOL enable_sfx; /* Fast volume slides */
BOOL unsigned_samples;
u8 master_volume;
u8 cur_master_volume;
u8 musicvolume;
u8 sfxvolume;
u8 start_speed;
u8 start_tempo;
u16 tracker_version;
u8 playlist[256];
MOD_Channel channels[MODPLAY_MAX_CHANNELS];
MOD_Instrument *instruments;
MOD_Sample *samples;
MOD_Note **patterns;
int *patternLengths;
int playfreq; /* Output frequency (11025, 22050 or 44100) */
int bits; /* Output resolution (8 or 16 bits) */
u16 *mixingbuf; /* Output buffer */
int mixingbuflen; /* Output buffer length in bytes */
int mixchannels; /* 1 = mono, 2 = stereo */
BOOL mixsigned; /* mixingbuf is signed */
/* Play time variables */
int patterndelay;
int pattern_line;
int play_position;
int speedcounter;
int speed;
int bpm;
int samplespertick;
int samplescounter;
/* Pattern loop */
int patternloop_to;
int patternloop_count;
void *tempmixbuf;
int filetype;
BOOL playing;
BOOL set;
u32 notebeats;
void (*callback)(void*);
} MODFILE;
#include "modplay.h"
int MODFILE_Mix(MODFILE *mod, int flags, void *buf, int nSamples);
u32 MODFILE_EffectHandler(MODFILE *mod);
u32 MODFILE_Process(MODFILE *mod);
BOOL MODFILE_TriggerNote(MODFILE *mod, int channel, u8 note, u8 instrument, u8 volume, u16 *commands);
void MODFILE_SetBPM(MODFILE *mod, int bpm);
int MODFILE_BPM2SamplesPerTick(MODFILE *mod, int bpm);
char * MODFILE_GetNoteString(u8 note);
u16 MODFILE_GetEffect(MODFILE*,int,int,int);
u8 MODFILE_GetEffectOp(MODFILE*,int,int,int);
u8 MODFILE_GetNote(MODFILE *mod, int patternline, int channel);
u32 MODFILE_GetInstr(MODFILE *mod, int patternline, int channel);
void MODFILE_ClearPattern(MODFILE *mod, int pattern);
void MODFILE_SetNote(MODFILE *mod, int channel, u8 note, int middle_c, s8 finetune);
void MODFILE_SetPeriodOfs(MODFILE *mod, int channel, s32 periodofs);
void MODFILE_SetPeriod(MODFILE *mod, int channel, u32 period);
void MODFILE_SubVolume(MODFILE *mod, int channel, u8 sub);
void MODFILE_AddVolume(MODFILE *mod, int channel, u8 add);
#endif

Binary file not shown.

View File

@ -27,7 +27,7 @@
using namespace std; using namespace std;
void GC_Disc::init(char *path) void GC_Disc::init(const char *path)
{ {
opening_bnr = NULL; opening_bnr = NULL;
FSTable = NULL; FSTable = NULL;

View File

@ -30,7 +30,7 @@ enum
class GC_Disc class GC_Disc
{ {
public: public:
void init(char *path); void init(const char *path);
void clear(); void clear();
u8 *GetGameCubeBanner(); u8 *GetGameCubeBanner();
private: private:

View File

@ -79,14 +79,17 @@ CCoverFlow::CCover::CCover(void)
CCoverFlow::CItem::CItem(dir_discHdr *itemHdr, const char *itemPic, const char *itemBoxPic, const char *itemBlankBoxPic, int playcount, unsigned int lastPlayed) : CCoverFlow::CItem::CItem(dir_discHdr *itemHdr, const char *itemPic, const char *itemBoxPic, const char *itemBlankBoxPic, int playcount, unsigned int lastPlayed) :
hdr(itemHdr), hdr(itemHdr),
picPath(itemPic),
boxPicPath(itemBoxPic),
blankBoxPicPath(itemBlankBoxPic),
playcount(playcount), playcount(playcount),
lastPlayed(lastPlayed) lastPlayed(lastPlayed),
boxTexture(false),
state(STATE_Loading)
{ {
state = CCoverFlow::STATE_Loading; strncpy(picPath, itemPic, 127);
boxTexture = false; picPath[127] = '\0';
strncpy(boxPicPath, itemBoxPic, 127);
boxPicPath[127] = '\0';
strncpy(blankBoxPicPath, itemBlankBoxPic, 63);
blankBoxPicPath[63] = '\0';
} }
static inline wchar_t upperCaseWChar(wchar_t c) static inline wchar_t upperCaseWChar(wchar_t c)
@ -240,6 +243,8 @@ CCoverFlow::CCoverFlow(void)
// //
m_loadingTexture = NULL; m_loadingTexture = NULL;
m_noCoverTexture = NULL; m_noCoverTexture = NULL;
//
m_covers = NULL;
LWP_MutexInit(&m_mutex, 0); LWP_MutexInit(&m_mutex, 0);
} }
@ -315,14 +320,13 @@ void CCoverFlow::setHQcover(bool HQ)
void CCoverFlow::setBufferSize(u32 numCovers) void CCoverFlow::setBufferSize(u32 numCovers)
{ {
if(!m_covers.empty()) if(m_covers != NULL) return;
return;
m_numBufCovers = min(max(4u, numCovers / 2u), 40u); m_numBufCovers = min(max(4u, numCovers / 2u), 40u);
} }
void CCoverFlow::setTextures(const string &loadingPic, const string &loadingPicFlat, const string &noCoverPic, const string &noCoverPicFlat) void CCoverFlow::setTextures(const string &loadingPic, const string &loadingPicFlat, const string &noCoverPic, const string &noCoverPicFlat)
{ {
if (!m_covers.empty()) return; if (m_covers != NULL) return;
m_pngLoadCover = loadingPic; m_pngLoadCover = loadingPic;
m_pngLoadCoverFlat = loadingPicFlat; m_pngLoadCoverFlat = loadingPicFlat;
m_pngNoCover = noCoverPic; m_pngNoCover = noCoverPic;
@ -335,7 +339,7 @@ void CCoverFlow::setFont(const SFont &font, const CColor &color)
delete m_font.font; delete m_font.font;
m_font = font; m_font = font;
m_fontColor = color; m_fontColor = color;
if (!m_covers.empty()) if (m_covers != NULL)
{ {
for (u32 i = 0; i < m_range; ++i) for (u32 i = 0; i < m_range; ++i)
_loadCover(i, m_covers[i].index); _loadCover(i, m_covers[i].index);
@ -343,7 +347,7 @@ void CCoverFlow::setFont(const SFont &font, const CColor &color)
} }
} }
void CCoverFlow::_transposeCover(vector<CCoverFlow::CCover> &dst, u32 rows, u32 columns, int pos) void CCoverFlow::_transposeCover(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);
@ -361,11 +365,12 @@ void CCoverFlow::setRange(u32 rows, u32 columns)
u32 range = rows * columns; u32 range = rows * columns;
if (rows == m_rows && columns == m_columns && range == m_range) if (rows == m_rows && columns == m_columns && range == m_range)
return; return;
if (!m_covers.empty()) if (m_covers != NULL)
{ {
stopCoverLoader(); stopCoverLoader();
vector<CCoverFlow::CCover> tmpCovers; CCover *tmpCovers = (CCover*)MEM2_alloc(sizeof(CCover) * range);
tmpCovers.resize(range); for(size_t i = 0; i < range; ++i)
tmpCovers[i] = *(new(tmpCovers+i) CCover);
if (rows >= 3) if (rows >= 3)
for (u32 x = 0; x < columns; ++x) for (u32 x = 0; x < columns; ++x)
for (u32 y = 1; y < rows - 1; ++y) for (u32 y = 1; y < rows - 1; ++y)
@ -373,10 +378,11 @@ void CCoverFlow::setRange(u32 rows, u32 columns)
else else
for (u32 x = 0; x < range; ++x) for (u32 x = 0; x < range; ++x)
_transposeCover(tmpCovers, rows, columns, x); _transposeCover(tmpCovers, rows, columns, x);
swap(tmpCovers, m_covers);
m_rows = rows; m_rows = rows;
m_columns = columns; m_columns = columns;
m_range = range; m_range = range;
MEM2_free(m_covers);
m_covers = tmpCovers;
_loadAllCovers(m_covers[m_range / 2].index); _loadAllCovers(m_covers[m_range / 2].index);
_updateAllTargets(); _updateAllTargets();
startCoverLoader(); startCoverLoader();
@ -625,7 +631,7 @@ void CCoverFlow::stopSound(void)
void CCoverFlow::applySettings(void) void CCoverFlow::applySettings(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
_updateAllTargets(); _updateAllTargets();
@ -634,6 +640,7 @@ void CCoverFlow::applySettings(void)
void CCoverFlow::stopCoverLoader(bool empty) void CCoverFlow::stopCoverLoader(bool empty)
{ {
m_loadingCovers = false; m_loadingCovers = false;
m_moved = true;
if(coverLoaderThread != LWP_THREAD_NULL) if(coverLoaderThread != LWP_THREAD_NULL)
{ {
if(LWP_ThreadIsSuspended(coverLoaderThread)) if(LWP_ThreadIsSuspended(coverLoaderThread))
@ -657,7 +664,7 @@ void CCoverFlow::stopCoverLoader(bool empty)
void CCoverFlow::startCoverLoader(void) void CCoverFlow::startCoverLoader(void)
{ {
if(m_covers.empty() || coverLoaderThread != LWP_THREAD_NULL || m_loadingCovers) if(m_covers == NULL || coverLoaderThread != LWP_THREAD_NULL || m_loadingCovers)
return; return;
m_loadingCovers = true; m_loadingCovers = true;
@ -670,7 +677,9 @@ void CCoverFlow::startCoverLoader(void)
void CCoverFlow::clear(void) void CCoverFlow::clear(void)
{ {
stopCoverLoader(true); stopCoverLoader(true);
m_covers.clear(); if(m_covers != NULL)
MEM2_free(m_covers);
m_covers = NULL;
m_items.clear(); m_items.clear();
} }
@ -701,7 +710,7 @@ void CCoverFlow::reserve(u32 capacity)
void CCoverFlow::addItem(dir_discHdr *hdr, const char *picPath, const char *boxPicPath, const char *blankBoxPicPath, int playcount, unsigned int lastPlayed) void CCoverFlow::addItem(dir_discHdr *hdr, const char *picPath, const char *boxPicPath, const char *blankBoxPicPath, int playcount, unsigned int lastPlayed)
{ {
if (!m_covers.empty()) return; if (m_covers != NULL) return;
m_items.push_back(CCoverFlow::CItem(hdr, picPath, boxPicPath, blankBoxPicPath, playcount, lastPlayed)); m_items.push_back(CCoverFlow::CItem(hdr, picPath, boxPicPath, blankBoxPicPath, playcount, lastPlayed));
} }
@ -946,7 +955,7 @@ void CCoverFlow::makeEffectTexture(const TexData * &bg)
void CCoverFlow::drawEffect(void) void CCoverFlow::drawEffect(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
if (_effectVisible()) if (_effectVisible())
{ {
@ -1006,7 +1015,7 @@ void CCoverFlow::drawText(bool withRectangle)
Vector3D dir(m_cameraAim); Vector3D dir(m_cameraAim);
Vector3D pos(m_cameraPos); Vector3D pos(m_cameraPos);
if (m_covers.empty()) return; if (m_covers == NULL) return;
if (m_fontColor.a == 0) return; if (m_fontColor.a == 0) return;
pos += _cameraMoves(); pos += _cameraMoves();
@ -1048,7 +1057,7 @@ void CCoverFlow::_draw(DrawMode dm, bool mirror, bool blend)
Vector3D pos(m_cameraPos); Vector3D pos(m_cameraPos);
if (mirror && m_mirrorAlpha <= 0.f) return; if (mirror && m_mirrorAlpha <= 0.f) return;
if (m_covers.empty()) return; if (m_covers == NULL) return;
pos += _cameraMoves(); pos += _cameraMoves();
// GX setup // GX setup
@ -1496,38 +1505,38 @@ void CCoverFlow::_loadCover(int i, int item)
const char *CCoverFlow::getId(void) const const char *CCoverFlow::getId(void) const
{ {
if (m_covers.empty() || m_items.empty()) return ""; if (m_covers == NULL || m_items.empty()) return "";
return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->id; return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->id;
} }
const char *CCoverFlow::getNextId(void) const const char *CCoverFlow::getNextId(void) const
{ {
if (m_covers.empty() || m_items.empty()) return ""; if (m_covers == NULL || m_items.empty()) return "";
return m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr->id; return m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr->id;
} }
dir_discHdr * CCoverFlow::getHdr(void) const const dir_discHdr * CCoverFlow::getHdr(void) const
{ {
if (m_covers.empty() || m_items.empty()) return NULL; if (m_covers == NULL || m_items.empty()) return NULL;
return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr; return m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr;
} }
dir_discHdr * CCoverFlow::getNextHdr(void) const const dir_discHdr * CCoverFlow::getNextHdr(void) const
{ {
if (m_covers.empty() || m_items.empty()) return NULL; if (m_covers == NULL || m_items.empty()) return NULL;
return m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr; return m_items[loopNum(m_covers[m_range / 2].index + m_jump + 1, m_items.size())].hdr;
} }
wstringEx CCoverFlow::getTitle(void) const wstringEx CCoverFlow::getTitle(void) const
{ {
if (m_covers.empty()) return L""; if (m_covers == NULL) return L"";
return m_items[m_covers[m_range / 2].index].hdr->title; return m_items[m_covers[m_range / 2].index].hdr->title;
} }
u64 CCoverFlow::getChanTitle(void) const u64 CCoverFlow::getChanTitle(void) const
{ {
if (m_covers.empty() || m_items.empty()) return 0; if (m_covers == NULL || m_items.empty()) return 0;
return TITLE_ID(m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[0], return TITLE_ID(m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[0],
m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[1]); m_items[loopNum(m_covers[m_range / 2].index + m_jump, m_items.size())].hdr->settings[1]);
@ -1554,7 +1563,7 @@ void CCoverFlow::RenderTex(void)
bool CCoverFlow::select(void) bool CCoverFlow::select(void)
{ {
if (m_covers.empty() || m_jump != 0) return false; if (m_covers == NULL || m_jump != 0) return false;
if (m_selected) return true; if (m_selected) return true;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -1584,7 +1593,7 @@ bool CCoverFlow::select(void)
void CCoverFlow::cancel(void) void CCoverFlow::cancel(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
_unselect(); _unselect();
@ -1903,8 +1912,15 @@ bool CCoverFlow::start()
m_loadingTexture = (m_box ? &m_boxLoadingTexture : &m_flatLoadingTexture); m_loadingTexture = (m_box ? &m_boxLoadingTexture : &m_flatLoadingTexture);
m_noCoverTexture = (m_box ? &m_boxNoCoverTexture : &m_flatNoCoverTexture); m_noCoverTexture = (m_box ? &m_boxNoCoverTexture : &m_flatNoCoverTexture);
m_covers.clear(); if(m_covers != NULL)
m_covers.resize(m_range); MEM2_free(m_covers);
m_covers = NULL;
if(m_range > 0)
{
m_covers = (CCover*)MEM2_alloc(sizeof(struct CCover) * m_range);
for(size_t i = 0; i < m_range; ++i)
m_covers[i] = *(new(m_covers+i) CCover);
}
m_jump = 0; m_jump = 0;
m_selected = false; m_selected = false;
m_moved = true; m_moved = true;
@ -1913,7 +1929,7 @@ bool CCoverFlow::start()
void CCoverFlow::up(void) void CCoverFlow::up(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
if (m_jump != 0) return; if (m_jump != 0) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -1922,7 +1938,7 @@ void CCoverFlow::up(void)
void CCoverFlow::down(void) void CCoverFlow::down(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
if (m_jump != 0) return; if (m_jump != 0) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -1931,7 +1947,7 @@ void CCoverFlow::down(void)
void CCoverFlow::left(void) void CCoverFlow::left(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
if (m_jump != 0) return; if (m_jump != 0) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -1940,7 +1956,7 @@ void CCoverFlow::left(void)
void CCoverFlow::right(void) void CCoverFlow::right(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
if (m_jump != 0) return; if (m_jump != 0) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
@ -2031,14 +2047,14 @@ void CCoverFlow::_right(int repeatDelay, u32 step)
u32 CCoverFlow::_currentPos(void) const u32 CCoverFlow::_currentPos(void) const
{ {
if (m_covers.empty()) return 0; if (m_covers == NULL) return 0;
return m_covers[m_range / 2].index; return m_covers[m_range / 2].index;
} }
void CCoverFlow::mouse(int chan, int x, int y) void CCoverFlow::mouse(int chan, int x, int y)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
int m = m_mouse[chan]; int m = m_mouse[chan];
if (x < 0 || y < 0) if (x < 0 || y < 0)
@ -2060,7 +2076,7 @@ void CCoverFlow::mouse(int chan, int x, int y)
bool CCoverFlow::mouseOver(int x, int y) bool CCoverFlow::mouseOver(int x, int y)
{ {
if (m_covers.empty()) return false; if (m_covers == NULL) return false;
m_vid.prepareStencil(); m_vid.prepareStencil();
_draw(CCoverFlow::CFDR_STENCIL, false, false); _draw(CCoverFlow::CFDR_STENCIL, false, false);
@ -2076,7 +2092,7 @@ bool CCoverFlow::findId(const char *id, bool instant, bool path)
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
u32 i, curPos = _currentPos(); u32 i, curPos = _currentPos();
if(m_items.empty() || (instant && m_covers.empty()) || strlen(id) == 0) if(m_items.empty() || (instant && m_covers == NULL) || strlen(id) == 0)
return false; return false;
// //
for(i = 0; i < m_items.size(); ++i) for(i = 0; i < m_items.size(); ++i)
@ -2111,7 +2127,7 @@ bool CCoverFlow::findId(const char *id, bool instant, bool path)
void CCoverFlow::pageUp(void) void CCoverFlow::pageUp(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
int n, j; int n, j;
if (m_rows >= 3) if (m_rows >= 3)
@ -2138,7 +2154,7 @@ void CCoverFlow::pageUp(void)
void CCoverFlow::pageDown(void) void CCoverFlow::pageDown(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
int n, j; int n, j;
if (m_rows >= 3) if (m_rows >= 3)
@ -2165,7 +2181,7 @@ void CCoverFlow::pageDown(void)
void CCoverFlow::flip(bool force, bool f) void CCoverFlow::flip(bool force, bool f)
{ {
if (m_covers.empty() || !m_selected) return; if (m_covers == NULL || !m_selected) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
CCoverFlow::CCover &cvr = m_covers[m_range / 2]; CCoverFlow::CCover &cvr = m_covers[m_range / 2];
@ -2230,7 +2246,7 @@ void CCoverFlow::_completeJump(void)
void CCoverFlow::nextLetter(wchar_t *c) void CCoverFlow::nextLetter(wchar_t *c)
{ {
if (m_covers.empty()) if (m_covers == NULL)
{ {
c[0] = L'\0'; c[0] = L'\0';
return; return;
@ -2269,7 +2285,7 @@ void CCoverFlow::nextLetter(wchar_t *c)
void CCoverFlow::prevLetter(wchar_t *c) void CCoverFlow::prevLetter(wchar_t *c)
{ {
if (m_covers.empty()) if (m_covers == NULL)
{ {
c[0] = L'\0'; c[0] = L'\0';
return; return;
@ -2504,7 +2520,7 @@ void CCoverFlow::_jump(void)
void CCoverFlow::tick(void) void CCoverFlow::tick(void)
{ {
if (m_covers.empty()) return; if (m_covers == NULL) return;
LockMutex lock(m_mutex); LockMutex lock(m_mutex);
++m_tickCount; ++m_tickCount;
@ -2606,8 +2622,8 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
if (!m_loadingCovers) return false; if (!m_loadingCovers) return false;
u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565; u8 textureFmt = m_compressTextures ? GX_TF_CMPR : GX_TF_RGB565;
const char *path = box ? (blankBoxCover ? m_items[i].blankBoxPicPath.c_str() : const char *path = box ? (blankBoxCover ? m_items[i].blankBoxPicPath :
m_items[i].boxPicPath.c_str()) : m_items[i].picPath.c_str(); m_items[i].boxPicPath) : m_items[i].picPath;
TexData tex; TexData tex;
tex.thread = true; tex.thread = true;
m_renderingTex = &tex; m_renderingTex = &tex;
@ -2633,24 +2649,21 @@ bool CCoverFlow::_loadCoverTexPNG(u32 i, bool box, bool hq, bool blankBoxCover)
u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD); u32 bufSize = fixGX_GetTexBufferSize(tex.width, tex.height, tex.format, tex.maxLOD > 0 ? GX_TRUE : GX_FALSE, tex.maxLOD);
uLongf zBufferSize = m_compressCache ? bufSize + bufSize / 100 + 12 : bufSize; uLongf zBufferSize = m_compressCache ? bufSize + bufSize / 100 + 12 : bufSize;
u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data; u8 *zBuffer = m_compressCache ? (u8*)MEM2_alloc(zBufferSize) : tex.data;
if (!!zBuffer && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK)) if(!!zBuffer && (!m_compressCache || compress(zBuffer, &zBufferSize, tex.data, bufSize) == Z_OK))
{ {
char gamePath[256]; char gamePath[128];
gamePath[127] = '\0';
if(blankBoxCover) if(blankBoxCover)
{ strncpy(gamePath, strrchr(m_items[i].blankBoxPicPath, '/') + 1, 127);
string tempName = m_items[i].blankBoxPicPath.c_str();
tempName.assign(&tempName[tempName.find_last_of('/') + 1]);
strncpy(gamePath, tempName.c_str(), sizeof(gamePath));
}
else if(NoGameID(m_items[i].hdr->type)) else if(NoGameID(m_items[i].hdr->type))
{ {
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos) if(strrchr(m_items[i].hdr->path, '/') != NULL)
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")+1], sizeof(gamePath)); strncpy(gamePath, strrchr(m_items[i].hdr->path, '/') + 1, 127);
else else
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath)); strncpy(gamePath, m_items[i].hdr->path, 127);
} }
else else
strncpy(gamePath, m_items[i].hdr->id, sizeof(gamePath)); strncpy(gamePath, m_items[i].hdr->id, 6);
FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb"); FILE *file = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "wb");
if(file != NULL) if(file != NULL)
{ {
@ -2721,22 +2734,19 @@ CCoverFlow::CLRet CCoverFlow::_loadCoverTex(u32 i, bool box, bool hq, bool blank
// Try to find the texture in the cache // Try to find the texture in the cache
if(!m_cachePath.empty()) if(!m_cachePath.empty())
{ {
char gamePath[256]; char gamePath[128];
memset(gamePath, 0, 128);
if(blankBoxCover) if(blankBoxCover)
{ strncpy(gamePath, strrchr(m_items[i].blankBoxPicPath, '/') + 1, 127);
string tempName = m_items[i].blankBoxPicPath.c_str();
tempName.assign(&tempName[tempName.find_last_of('/') + 1]);
strncpy(gamePath, tempName.c_str(), sizeof(gamePath));
}
else if(NoGameID(m_items[i].hdr->type)) else if(NoGameID(m_items[i].hdr->type))
{ {
if(string(m_items[i].hdr->path).find_last_of("/") != string::npos) if(strrchr(m_items[i].hdr->path, '/') != NULL)
strncpy(gamePath, &m_items[i].hdr->path[string(m_items[i].hdr->path).find_last_of("/")+1], sizeof(gamePath)); strncpy(gamePath, strrchr(m_items[i].hdr->path, '/') + 1, 127);
else else
strncpy(gamePath, m_items[i].hdr->path, sizeof(gamePath)); strncpy(gamePath, m_items[i].hdr->path, 127);
} }
else else
strncpy(gamePath, m_items[i].hdr->id, sizeof(gamePath)); strncpy(gamePath, m_items[i].hdr->id, 6);
FILE *fp = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb"); FILE *fp = fopen(fmt("%s/%s.wfc", m_cachePath.c_str(), gamePath), "rb");
if(fp != NULL) if(fp != NULL)
{ {

View File

@ -128,8 +128,8 @@ public:
// //
const char *getId(void) const; const char *getId(void) const;
const char *getNextId(void) const; const char *getNextId(void) const;
dir_discHdr * getHdr(void) const; const dir_discHdr * getHdr(void) const;
dir_discHdr * getNextHdr(void) const; const dir_discHdr * getNextHdr(void) const;
wstringEx getTitle(void) const; wstringEx getTitle(void) const;
u64 getChanTitle(void) const; u64 getChanTitle(void) const;
// //
@ -194,18 +194,18 @@ private:
enum TexState { STATE_Loading, STATE_Ready, STATE_NoCover }; enum TexState { STATE_Loading, STATE_Ready, STATE_NoCover };
struct CItem struct CItem
{ {
CItem(dir_discHdr *itemHdr, const char *itemPic, const char *itemBoxPic,
const char *itemBlankBoxPic, int playcount, unsigned int lastPlayed);
dir_discHdr *hdr; dir_discHdr *hdr;
string picPath; char picPath[128];
string boxPicPath; char boxPicPath[128];
string blankBoxPicPath; char blankBoxPicPath[64];
int playcount; int playcount;
unsigned int lastPlayed; unsigned int lastPlayed;
TexData texture; TexData texture;
volatile bool boxTexture; volatile bool boxTexture;
volatile enum TexState state; volatile enum TexState state;
// } ATTRIBUTE_PACKED;
CItem(dir_discHdr *itemHdr, const char *itemPic, const char *itemBoxPic, const char *itemBlankBoxPic, int playcount, unsigned int lastPlayed);
};
struct CCover struct CCover
{ {
u32 index; u32 index;
@ -238,7 +238,7 @@ private:
Vector3D m_targetCameraPos; Vector3D m_targetCameraPos;
Vector3D m_targetCameraAim; Vector3D m_targetCameraAim;
vector<CItem> m_items; vector<CItem> m_items;
vector<CCover> m_covers; CCover *m_covers;
int m_delay; int m_delay;
int m_minDelay; int m_minDelay;
int m_jump; int m_jump;
@ -345,7 +345,7 @@ private:
CLRet _loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover); CLRet _loadCoverTex(u32 i, bool box, bool hq, bool blankBoxCover);
bool _invisibleCover(u32 x, u32 y); bool _invisibleCover(u32 x, u32 y);
void _instantTarget(int i); void _instantTarget(int i);
void _transposeCover(vector<CCover> &dst, u32 rows, u32 columns, int pos); void _transposeCover(CCover* &dst, u32 rows, u32 columns, int pos);
void _stopSound(GuiSound * &snd); void _stopSound(GuiSound * &snd);
void _playSound(GuiSound * &snd); void _playSound(GuiSound * &snd);

View File

@ -237,13 +237,11 @@ bool SFont::fromFile(const char *filename, u32 size, u32 lspacing, u32 w, u32 id
static const wchar_t *g_whitespaces = L" \f\n\r\t\v"; static const wchar_t *g_whitespaces = L" \f\n\r\t\v";
void CText::setText(const SFont &font, const wstringEx &t) void CText::setText(const SFont &font, const wstringEx &t)
{ {
CText::SWord w; SWord w;
m_lines.clear(); m_lines.clear();
if(font.font != NULL) if(font.font == NULL)
m_font = font;
if(m_font.font == NULL)
return; return;
m_font = font;
firstLine = 0; firstLine = 0;
// Don't care about performance // Don't care about performance
vector<wstringEx> lines = stringToVector(t, L'\n'); vector<wstringEx> lines = stringToVector(t, L'\n');
@ -252,7 +250,7 @@ void CText::setText(const SFont &font, const wstringEx &t)
for (u32 k = 0; k < lines.size(); ++k) for (u32 k = 0; k < lines.size(); ++k)
{ {
wstringEx &l = lines[k]; wstringEx &l = lines[k];
m_lines.push_back(CText::CLine()); m_lines.push_back(CLine());
m_lines.back().reserve(32); m_lines.back().reserve(32);
wstringEx::size_type i = l.find_first_not_of(g_whitespaces); wstringEx::size_type i = l.find_first_not_of(g_whitespaces);
wstringEx::size_type j; wstringEx::size_type j;
@ -277,7 +275,7 @@ void CText::setText(const SFont &font, const wstringEx &t)
void CText::setText(const SFont &font, const wstringEx &t, u32 startline) void CText::setText(const SFont &font, const wstringEx &t, u32 startline)
{ {
CText::SWord w; SWord w;
totalHeight = 0; totalHeight = 0;
m_lines.clear(); m_lines.clear();
@ -294,7 +292,7 @@ void CText::setText(const SFont &font, const wstringEx &t, u32 startline)
for (u32 k = 0; k < lines.size(); ++k) for (u32 k = 0; k < lines.size(); ++k)
{ {
wstringEx &l = lines[k]; wstringEx &l = lines[k];
m_lines.push_back(CText::CLine()); m_lines.push_back(CLine());
m_lines.back().reserve(32); m_lines.back().reserve(32);
wstringEx::size_type i = l.find_first_not_of(g_whitespaces); wstringEx::size_type i = l.find_first_not_of(g_whitespaces);
wstringEx::size_type j; wstringEx::size_type j;
@ -333,7 +331,7 @@ void CText::setFrame(float width, u16 style, bool ignoreNewlines, bool instant)
for (u32 k = firstLine; k < m_lines.size(); ++k) for (u32 k = firstLine; k < m_lines.size(); ++k)
{ {
CText::CLine &words = m_lines[k]; CLine &words = m_lines[k];
if (words.empty()) if (words.empty())
{ {
posY += (float)m_font.lineSpacing; posY += (float)m_font.lineSpacing;

View File

@ -28,6 +28,14 @@ private:
size_t dataSize; size_t dataSize;
}; };
struct SWord
{
wstringEx text;
Vector3D pos;
Vector3D targetPos;
};
typedef vector<SWord> CLine;
class CText class CText
{ {
public: public:
@ -39,14 +47,6 @@ public:
void draw(void); void draw(void);
int getTotalHeight(); int getTotalHeight();
private: private:
struct SWord
{
wstringEx text;
Vector3D pos;
Vector3D targetPos;
};
private:
typedef vector<SWord> CLine;
vector<CLine> m_lines; vector<CLine> m_lines;
SFont m_font; SFont m_font;
CColor m_color; CColor m_color;

View File

@ -60,6 +60,12 @@ void MEM1_lo_free(void *p)
g_mem1lo.release(p); g_mem1lo.release(p);
} }
unsigned int MEM1_lo_freesize()
{
return g_mem1lo.FreeSize();
}
void *MEM1_alloc(unsigned int s) void *MEM1_alloc(unsigned int s)
{ {
return __real_malloc(s); return __real_malloc(s);
@ -84,7 +90,7 @@ void MEM1_free(void *p)
unsigned int MEM1_freesize() unsigned int MEM1_freesize()
{ {
return (g_mem1lo.FreeSize() + SYS_GetArena1Size()); return SYS_GetArena1Size();
} }
@ -105,6 +111,11 @@ void MEM2_lo_free(void *p)
g_mem2lo_gp.release(p); g_mem2lo_gp.release(p);
} }
unsigned int MEM2_lo_freesize()
{
return g_mem2lo_gp.FreeSize();
}
void MEM2_free(void *p) void MEM2_free(void *p)
{ {

View File

@ -13,6 +13,7 @@ void MEM_init();
void *MEM1_lo_alloc(unsigned int s); void *MEM1_lo_alloc(unsigned int s);
void MEM1_lo_free(void *p); void MEM1_lo_free(void *p);
unsigned int MEM1_lo_freesize();
void *MEM1_alloc(unsigned int s); void *MEM1_alloc(unsigned int s);
void *MEM1_memalign(unsigned int a, unsigned int s); void *MEM1_memalign(unsigned int a, unsigned int s);
@ -23,6 +24,7 @@ unsigned int MEM1_freesize();
void *MEM2_lo_alloc(unsigned int s); void *MEM2_lo_alloc(unsigned int s);
void *MEM2_lo_realloc(void *p, unsigned int s); void *MEM2_lo_realloc(void *p, unsigned int s);
void MEM2_lo_free(void *p); void MEM2_lo_free(void *p);
unsigned int MEM2_lo_freesize();
void MEM2_free(void *p); void MEM2_free(void *p);
void *MEM2_alloc(unsigned int s); void *MEM2_alloc(unsigned int s);

View File

@ -1620,7 +1620,7 @@ void CMenu::_initCF(void)
CoverFlow.clear(); CoverFlow.clear();
CoverFlow.reserve(m_gameList.size()); CoverFlow.reserve(m_gameList.size());
bool dumpGameLst = m_cfg.getBool(domain, "dump_list", true); bool dumpGameLst = m_cfg.getBool(domain, "dump_list", true);
if(dumpGameLst) dump.load(fmt("%s/" TITLES_DUMP_FILENAME, m_settingsDir.c_str())); if(dumpGameLst) dump.load(fmt("%s/" TITLES_DUMP_FILENAME, m_settingsDir.c_str()));
m_gcfg1.load(fmt("%s/" GAME_SETTINGS1_FILENAME, m_settingsDir.c_str())); m_gcfg1.load(fmt("%s/" GAME_SETTINGS1_FILENAME, m_settingsDir.c_str()));
@ -1905,7 +1905,7 @@ void CMenu::_initCF(void)
CoverFlow.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed); CoverFlow.addItem(&(*element), fmt("%s/%s.png", m_picDir.c_str(), id.c_str()), fmt("%s/%s.png", m_boxPicDir.c_str(), id.c_str()), fmt("%s/%s", m_boxPicDir.c_str(), blankCoverName.c_str()), playcount, lastPlayed);
} }
} }
if(gametdb.IsLoaded()) if(gametdb.IsLoaded())
gametdb.CloseFile(); gametdb.CloseFile();
m_gcfg1.unload(); m_gcfg1.unload();
if (dumpGameLst) if (dumpGameLst)
@ -2037,7 +2037,10 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting)
} }
#ifdef SHOWMEM #ifdef SHOWMEM
m_btnMgr.setText(m_mem2FreeSize, wfmt(L"Mem2 Free:%u, Mem1 Free:%u", MEM2_freesize(), MEM1_freesize()), true); m_btnMgr.setText(m_mem1FreeSize, wfmt(L"Mem1 lo Free:%u, Mem1 Free:%u",
MEM1_lo_freesize(), MEM1_freesize()), true);
m_btnMgr.setText(m_mem2FreeSize, wfmt(L"Mem2 lo Free:%u, Mem2 Free:%u",
MEM2_lo_freesize(), MEM2_freesize()), true);
#endif #endif
#ifdef SHOWMEMGECKO #ifdef SHOWMEMGECKO
@ -2565,7 +2568,7 @@ char tmp[256];
const char *CMenu::_getId() const char *CMenu::_getId()
{ {
const char *id = NULL; const char *id = NULL;
dir_discHdr *hdr = CoverFlow.getHdr(); const dir_discHdr *hdr = CoverFlow.getHdr();
if(hdr->type == TYPE_HOMEBREW) if(hdr->type == TYPE_HOMEBREW)
id = strrchr(hdr->path, '/') + 1; id = strrchr(hdr->path, '/') + 1;
else if(hdr->type == TYPE_PLUGIN) else if(hdr->type == TYPE_PLUGIN)

View File

@ -149,6 +149,7 @@ private:
s16 m_mainLblLetter; s16 m_mainLblLetter;
s16 m_mainLblCurMusic; s16 m_mainLblCurMusic;
#ifdef SHOWMEM #ifdef SHOWMEM
s16 m_mem1FreeSize;
s16 m_mem2FreeSize; s16 m_mem2FreeSize;
#endif #endif
#ifdef SHOWMEMGECKO #ifdef SHOWMEMGECKO

View File

@ -111,7 +111,7 @@ void CMenu::_updateCheckboxes(void)
void CMenu::_getIDCats(void) void CMenu::_getIDCats(void)
{ {
dir_discHdr *hdr = CoverFlow.getHdr(); const dir_discHdr *hdr = CoverFlow.getHdr();
switch(hdr->type) switch(hdr->type)
{ {
case TYPE_CHANNEL: case TYPE_CHANNEL:

View File

@ -255,7 +255,7 @@ static void _extractChannelBnr(const u64 chantitle)
ChannelHandle.GetBanner(chantitle); ChannelHandle.GetBanner(chantitle);
} }
static void _extractBnr(dir_discHdr *hdr) static void _extractBnr(const dir_discHdr *hdr)
{ {
u32 size = 0; u32 size = 0;
DeviceHandle.OpenWBFS(currentPartition); DeviceHandle.OpenWBFS(currentPartition);
@ -555,7 +555,8 @@ void CMenu::_game(bool launch)
m_gameSound.FreeMemory(); m_gameSound.FreeMemory();
CheckGameSoundThread(); CheckGameSoundThread();
m_banner.DeleteBanner(); m_banner.DeleteBanner();
dir_discHdr *hdr = CoverFlow.getHdr(); dir_discHdr *hdr = (dir_discHdr*)MEM2_alloc(sizeof(dir_discHdr));
memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));
m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str()));
// change to current games partition and set last_view for recall later // change to current games partition and set last_view for recall later
switch(hdr->type) switch(hdr->type)
@ -1501,7 +1502,7 @@ void CMenu::_gameSoundThread(CMenu *m)
m->m_gamesound_changed = false; m->m_gamesound_changed = false;
CurrentBanner.ClearBanner(); CurrentBanner.ClearBanner();
dir_discHdr *GameHdr = CoverFlow.getHdr(); const dir_discHdr *GameHdr = CoverFlow.getHdr();
if(GameHdr->type == TYPE_PLUGIN) if(GameHdr->type == TYPE_PLUGIN)
{ {
m_banner.DeleteBanner(); m_banner.DeleteBanner();

View File

@ -82,6 +82,7 @@ void CMenu::_showMain(void)
{ {
_hideWaitMessage(); _hideWaitMessage();
#ifdef SHOWMEM #ifdef SHOWMEM
m_btnMgr.show(m_mem1FreeSize);
m_btnMgr.show(m_mem2FreeSize); m_btnMgr.show(m_mem2FreeSize);
#endif #endif
m_vid.set2DViewport(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480), m_vid.set2DViewport(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480),
@ -942,7 +943,8 @@ void CMenu::_initMainMenu()
m_mainLblNotice = _addLabel("MAIN/NOTICE", theme.titleFont, L"", 340, 40, 280, 80, theme.titleFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE, emptyTex); m_mainLblNotice = _addLabel("MAIN/NOTICE", theme.titleFont, L"", 340, 40, 280, 80, theme.titleFontColor, FTGX_JUSTIFY_RIGHT | FTGX_ALIGN_MIDDLE, emptyTex);
m_mainLblCurMusic = _addLabel("MAIN/MUSIC", theme.btnFont, L"", 0, 20, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_mainLblCurMusic = _addLabel("MAIN/MUSIC", theme.btnFont, L"", 0, 20, 640, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
#ifdef SHOWMEM #ifdef SHOWMEM
m_mem2FreeSize = _addLabel("MEM2", theme.titleFont, L"", 40, 300, 480, 80, theme.titleFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex); m_mem1FreeSize = _addLabel("MEM1", theme.btnFont, L"", 0, 300, 480, 56, theme.btnFontColor, FTGX_JUSTIFY_LEFT, emptyTex);
m_mem2FreeSize = _addLabel("MEM2", theme.btnFont, L"", 0, 356, 480, 56, theme.btnFontColor, FTGX_JUSTIFY_LEFT, emptyTex);
#endif #endif
// //
m_mainPrevZone.x = m_theme.getInt("MAIN/ZONES", "prev_x", -32); m_mainPrevZone.x = m_theme.getInt("MAIN/ZONES", "prev_x", -32);
@ -995,6 +997,7 @@ void CMenu::_initMainMenu()
_setHideAnim(m_mainLblNotice, "MAIN/NOTICE", 0, 0, 0.f, 0.f); _setHideAnim(m_mainLblNotice, "MAIN/NOTICE", 0, 0, 0.f, 0.f);
_setHideAnim(m_mainLblCurMusic, "MAIN/MUSIC", 0, -100, 0.f, 0.f); _setHideAnim(m_mainLblCurMusic, "MAIN/MUSIC", 0, -100, 0.f, 0.f);
#ifdef SHOWMEM #ifdef SHOWMEM
_setHideAnim(m_mem1FreeSize, "MEM1", 0, 0, 0.f, 0.f);
_setHideAnim(m_mem2FreeSize, "MEM2", 0, 0, 0.f, 0.f); _setHideAnim(m_mem2FreeSize, "MEM2", 0, 0, 0.f, 0.f);
#endif #endif
_hideMain(true); _hideMain(true);

View File

@ -280,7 +280,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
bool upd_dml = false; bool upd_dml = false;
bool upd_emu = false; bool upd_emu = false;
bool out = false; bool out = false;
dir_discHdr *CF_Hdr = CoverFlow.getHdr(); const dir_discHdr *CF_Hdr = CoverFlow.getHdr();
char cfPos[7]; char cfPos[7];
cfPos[6] = '\0'; cfPos[6] = '\0';
strncpy(cfPos, CoverFlow.getNextId(), 6); strncpy(cfPos, CoverFlow.getNextId(), 6);
@ -418,7 +418,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
else if(CF_Hdr->type == TYPE_WII_GAME) else if(CF_Hdr->type == TYPE_WII_GAME)
{ {
DeviceHandle.OpenWBFS(currentPartition); DeviceHandle.OpenWBFS(currentPartition);
WBFS_RemoveGame((u8*)&CF_Hdr->id, CF_Hdr->path); WBFS_RemoveGame((u8*)&CF_Hdr->id, (char*)&CF_Hdr->path);
WBFS_Close(); WBFS_Close();
upd_usb = true; upd_usb = true;
} }