mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
-made sfmt, wfmt and gprintf faster and more simple
-set down wiiflows entry point from 0x80A00000 to 0x8062000 (saves ALOT of MEM1 for lists etc, so wiiflow should be able to read in alot of more games in for example plugin coverflow) -recompiled libjpeg -removed alot of annoying debug prints -made the trailer code faster
This commit is contained in:
parent
3420882624
commit
550ac3356b
2
Makefile
2
Makefile
@ -58,7 +58,7 @@ ios := 249
|
|||||||
CFLAGS = -g -O2 -Wall -Wextra -Wno-multichar $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
|
CFLAGS = -g -O2 -Wall -Wextra -Wno-multichar $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80A00000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
|
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# any extra libraries we wish to link with the project
|
||||||
|
@ -18,6 +18,14 @@
|
|||||||
/* Define this if you get warnings about undefined structures. */
|
/* Define this if you get warnings about undefined structures. */
|
||||||
/* #undef INCOMPLETE_TYPES_BROKEN */
|
/* #undef INCOMPLETE_TYPES_BROKEN */
|
||||||
|
|
||||||
|
/* Define "boolean" as unsigned char, not int, on Windows systems. */
|
||||||
|
#ifdef _WIN32
|
||||||
|
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
||||||
|
typedef unsigned char boolean;
|
||||||
|
#endif
|
||||||
|
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef JPEG_INTERNALS
|
#ifdef JPEG_INTERNALS
|
||||||
|
|
||||||
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
|
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
|
||||||
|
Binary file not shown.
@ -58,12 +58,12 @@ class BannerWindow
|
|||||||
void ToogleGameSettings();
|
void ToogleGameSettings();
|
||||||
bool GetShowBanner() { return ShowBanner; }
|
bool GetShowBanner() { return ShowBanner; }
|
||||||
void SetShowBanner(bool show) { ShowBanner = show; }
|
void SetShowBanner(bool show) { ShowBanner = show; }
|
||||||
|
void ReSetup_GX(void);
|
||||||
protected:
|
protected:
|
||||||
int MainLoop();
|
int MainLoop();
|
||||||
void Animate(void);
|
void Animate(void);
|
||||||
void ChangeGame(Banner *banner);
|
void ChangeGame(Banner *banner);
|
||||||
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
void DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color);
|
||||||
void ReSetup_GX(void);
|
|
||||||
void Init(CVideo *vid, u8 *font1, u8 *font2);
|
void Init(CVideo *vid, u8 *font1, u8 *font2);
|
||||||
|
|
||||||
static const float fBannerWidth = 608.f;
|
static const float fBannerWidth = 608.f;
|
||||||
|
@ -65,12 +65,12 @@ static void USBGeckoOutput()
|
|||||||
devoptab_list[STD_ERR] = &gecko_out;
|
devoptab_list[STD_ERR] = &gecko_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteToFile(char* tmp)
|
static void WriteToFile(char* tmp, int len)
|
||||||
{
|
{
|
||||||
if(!bufferMessages)
|
if(!bufferMessages)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((strlen(tmpfilebuffer) + strlen(tmp)) < 1024)
|
if((strlen(tmpfilebuffer) + len) < 1024)
|
||||||
strcat(tmpfilebuffer, tmp);
|
strcat(tmpfilebuffer, tmp);
|
||||||
|
|
||||||
if(WriteToSD)
|
if(WriteToSD)
|
||||||
@ -85,19 +85,15 @@ void WriteToFile(char* tmp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//using the gprintf from crediar because it is smaller than mine
|
char gprintfBuffer[256];
|
||||||
void gprintf(const char *format, ...)
|
void gprintf(const char *format, ...)
|
||||||
{
|
{
|
||||||
char *tmp = NULL;
|
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
if((vasprintf(&tmp, format, va) >= 0) && tmp)
|
int len = vsnprintf(gprintfBuffer, 255, format, va);
|
||||||
{
|
__out_write(NULL, 0, gprintfBuffer, len);
|
||||||
WriteToFile(tmp);
|
WifiGecko_Send(gprintfBuffer, len);
|
||||||
WifiGecko_Send(tmp, strlen(tmp));
|
WriteToFile(gprintfBuffer, len);
|
||||||
__out_write(NULL, 0, tmp, strlen(tmp));
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
va_end(va);
|
va_end(va);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +137,7 @@ void ghexdump(void *d, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *initstr = "USB Gecko inited.\n";
|
||||||
bool InitGecko()
|
bool InitGecko()
|
||||||
{
|
{
|
||||||
if(geckoinit)
|
if(geckoinit)
|
||||||
@ -158,7 +155,7 @@ bool InitGecko()
|
|||||||
{
|
{
|
||||||
geckoinit = true;
|
geckoinit = true;
|
||||||
usb_flush(EXI_CHANNEL_1);
|
usb_flush(EXI_CHANNEL_1);
|
||||||
puts("USB Gecko inited.");
|
__out_write(NULL, 0, initstr, strlen(initstr));
|
||||||
}
|
}
|
||||||
return geckoinit;
|
return geckoinit;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ WiiMovie::WiiMovie(const char * filepath)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SndChannels = (Video->getNumChannels() == 2) ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT;
|
SndChannels = (Video->getNumChannels() > 1) ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT;
|
||||||
SndFrequence = Video->getFrequency();
|
SndFrequence = Video->getFrequency();
|
||||||
fps = Video->getFps();
|
fps = Video->getFps();
|
||||||
maxSoundSize = Video->getMaxAudioSamples()*Video->getNumChannels()*2;
|
maxSoundSize = Video->getMaxAudioSamples()*Video->getNumChannels()*2;
|
||||||
@ -263,7 +263,7 @@ void WiiMovie::ReadNextFrame()
|
|||||||
|
|
||||||
u32 FramesNeeded = (u32) (PlayTime.elapsed()*fps);
|
u32 FramesNeeded = (u32) (PlayTime.elapsed()*fps);
|
||||||
|
|
||||||
gprintf("Reading needed frames: %d\n", FramesNeeded);
|
//gprintf("Reading needed frames: %d\n", FramesNeeded);
|
||||||
|
|
||||||
while(VideoFrameCount < FramesNeeded)
|
while(VideoFrameCount < FramesNeeded)
|
||||||
{
|
{
|
||||||
@ -273,7 +273,7 @@ void WiiMovie::ReadNextFrame()
|
|||||||
|
|
||||||
++VideoFrameCount;
|
++VideoFrameCount;
|
||||||
|
|
||||||
gprintf("Loaded video frame: %d\n", VideoFrameCount);
|
//gprintf("Loaded video frame: %d\n", VideoFrameCount);
|
||||||
|
|
||||||
if(Video->hasSound())
|
if(Video->hasSound())
|
||||||
{
|
{
|
||||||
@ -298,7 +298,7 @@ void WiiMovie::ReadNextFrame()
|
|||||||
if(ASND_StatusVoice(10) == SND_UNUSED && SoundBuffer.IsBufferReady())
|
if(ASND_StatusVoice(10) == SND_UNUSED && SoundBuffer.IsBufferReady())
|
||||||
{
|
{
|
||||||
ASND_StopVoice(10);
|
ASND_StopVoice(10);
|
||||||
ASND_SetVoice(10, SndChannels == 2 ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT, SndFrequence, 0, SoundBuffer.GetBuffer(), SoundBuffer.GetBufferSize(), volume, volume, THPSoundCallback);
|
ASND_SetVoice(10, SndChannels, SndFrequence, 0, SoundBuffer.GetBuffer(), SoundBuffer.GetBufferSize(), volume, volume, THPSoundCallback);
|
||||||
SoundBuffer.LoadNext();
|
SoundBuffer.LoadNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ void jpegErrorHandler(j_common_ptr cinfo)
|
|||||||
//MessageBox(g_hWnd, buff, "JpegLib error:", MB_OK);
|
//MessageBox(g_hWnd, buff, "JpegLib error:", MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void decodeRealJpeg(const u8* data, int size, VideoFrame& dest)
|
void decodeRealJpeg(const u8* data, int size, VideoFrame& dest, bool fancy)
|
||||||
{
|
{
|
||||||
if(g_isLoading)
|
if(g_isLoading)
|
||||||
return;
|
return;
|
||||||
@ -783,15 +783,21 @@ void decodeRealJpeg(const u8* data, int size, VideoFrame& dest)
|
|||||||
cinfo.src = &sourceMgr;
|
cinfo.src = &sourceMgr;
|
||||||
|
|
||||||
jpeg_read_header(&cinfo, TRUE);
|
jpeg_read_header(&cinfo, TRUE);
|
||||||
|
if(fancy)
|
||||||
|
{
|
||||||
cinfo.do_fancy_upsampling = TRUE;
|
cinfo.do_fancy_upsampling = TRUE;
|
||||||
cinfo.do_block_smoothing = TRUE;
|
cinfo.do_block_smoothing = TRUE;
|
||||||
cinfo.dct_method = JDCT_ISLOW;
|
cinfo.dct_method = JDCT_ISLOW;
|
||||||
|
|
||||||
jpeg_start_decompress(&cinfo);
|
jpeg_start_decompress(&cinfo);
|
||||||
|
|
||||||
dest.resize(ALIGN(4, cinfo.output_width), ALIGN(4, cinfo.output_height));
|
dest.resize(ALIGN(4, cinfo.output_width), ALIGN(4, cinfo.output_height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cinfo.do_fancy_upsampling = FALSE;
|
||||||
|
cinfo.do_block_smoothing = FALSE;
|
||||||
|
jpeg_start_decompress(&cinfo);
|
||||||
|
dest.resize(cinfo.output_width, cinfo.output_height);
|
||||||
|
}
|
||||||
if(cinfo.num_components == 3)
|
if(cinfo.num_components == 3)
|
||||||
{
|
{
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
@ -330,6 +330,6 @@ class JpgVideoFile : public VideoFile
|
|||||||
VideoFrame _currFrame;
|
VideoFrame _currFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
void decodeRealJpeg(const u8* data, int size, VideoFrame& dest);
|
void decodeRealJpeg(const u8* data, int size, VideoFrame& dest, bool fancy = false);
|
||||||
|
|
||||||
#endif //THAKIS_GCVID_H
|
#endif //THAKIS_GCVID_H
|
||||||
|
@ -1,36 +1,27 @@
|
|||||||
#include "text.hpp"
|
#include "text.hpp"
|
||||||
|
|
||||||
static const wchar_t *g_whitespaces = L" \f\n\r\t\v";
|
int currentStr = 0;
|
||||||
|
char fmt_buffer[MAX_USES][MAX_MSG_SIZE];
|
||||||
|
char general_buffer[MAX_MSG_SIZE];
|
||||||
|
|
||||||
// Simplified use of sprintf
|
// Simplified use of sprintf
|
||||||
const char *fmt(const char *format, ...)
|
const char *fmt(const char *format, ...)
|
||||||
{
|
{
|
||||||
static int currentStr = 0;
|
|
||||||
currentStr = (currentStr + 1) % MAX_USES;
|
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
static char buffer[MAX_USES][MAX_MSG_SIZE];
|
currentStr = (currentStr + 1) % MAX_USES;
|
||||||
vsnprintf(buffer[currentStr], MAX_MSG_SIZE, format, va);
|
vsnprintf(fmt_buffer[currentStr], MAX_MSG_SIZE - 1, format, va);
|
||||||
buffer[currentStr][MAX_MSG_SIZE - 1] = '\0';
|
|
||||||
va_end(va);
|
va_end(va);
|
||||||
|
return fmt_buffer[currentStr];
|
||||||
return buffer[currentStr];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string sfmt(const char *format, ...)
|
string sfmt(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
u32 length = vsnprintf(0, 0, format, va) + 1;
|
int len = vsnprintf(general_buffer, MAX_MSG_SIZE - 1, format, va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
char *tmp = new char[length + 1];
|
return string(general_buffer, len);
|
||||||
va_start(va, format);
|
|
||||||
vsnprintf(tmp, length, format, va);
|
|
||||||
va_end(va);
|
|
||||||
string s = tmp;
|
|
||||||
delete[] tmp;
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool fmtCount(const wstringEx &format, int &i, int &s)
|
static inline bool fmtCount(const wstringEx &format, int &i, int &s)
|
||||||
@ -86,20 +77,13 @@ bool checkFmt(const wstringEx &ref, const wstringEx &format)
|
|||||||
|
|
||||||
wstringEx wfmt(const wstringEx &format, ...)
|
wstringEx wfmt(const wstringEx &format, ...)
|
||||||
{
|
{
|
||||||
// Don't care about performance
|
|
||||||
va_list va;
|
va_list va;
|
||||||
string f(format.toUTF8());
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
u32 length = vsnprintf(0, 0, f.c_str(), va) + 1;
|
vsnprintf(general_buffer, MAX_MSG_SIZE - 1, format.toUTF8().c_str(), va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
char *tmp = new char[length + 1];
|
wstringEx wide_buffer;
|
||||||
va_start(va, format);
|
wide_buffer.fromUTF8(general_buffer);
|
||||||
vsnprintf(tmp, length, f.c_str(), va);
|
return wide_buffer;
|
||||||
va_end(va);
|
|
||||||
wstringEx ws;
|
|
||||||
ws.fromUTF8(tmp);
|
|
||||||
delete[] tmp;
|
|
||||||
return ws;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string vectorToString(const vector<string> &vect, string sep)
|
string vectorToString(const vector<string> &vect, string sep)
|
||||||
@ -233,6 +217,7 @@ bool SFont::fromFile(const char *filename, u32 size, u32 lspacing, u32 w, u32 id
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const wchar_t *g_whitespaces = L" \f\n\r\t\v";
|
||||||
void CText::setText(SFont font, const wstringEx &t)
|
void CText::setText(SFont font, const wstringEx &t)
|
||||||
{
|
{
|
||||||
CText::SWord w;
|
CText::SWord w;
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MAX_MSG_SIZE = 1024,
|
MAX_MSG_SIZE = 1024,
|
||||||
MAX_USES = 16,
|
MAX_USES = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *fmt(const char *format, ...);
|
const char *fmt(const char *format, ...);
|
||||||
|
@ -341,7 +341,7 @@ STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, Alloc a
|
|||||||
STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
|
STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
|
||||||
{
|
{
|
||||||
VideoFrame VideoF;
|
VideoFrame VideoF;
|
||||||
decodeRealJpeg(buffer, buffer_size, VideoF);
|
decodeRealJpeg(buffer, buffer_size, VideoF, true);
|
||||||
if(!VideoF.getData() || (VideoF.getWidth() % 4) != 0 || (VideoF.getHeight() % 4) != 0)
|
if(!VideoF.getData() || (VideoF.getWidth() % 4) != 0 || (VideoF.getHeight() % 4) != 0)
|
||||||
return TE_ERROR;
|
return TE_ERROR;
|
||||||
return fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight(), f, alloc, minMipSize, maxMipSize);
|
return fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight(), f, alloc, minMipSize, maxMipSize);
|
||||||
|
@ -255,7 +255,7 @@ void CVideo::prepare(void)
|
|||||||
|
|
||||||
void CVideo::cleanup(void)
|
void CVideo::cleanup(void)
|
||||||
{
|
{
|
||||||
gprintf("Cleaning up video...\n");
|
//gprintf("Cleaning up video...\n");
|
||||||
|
|
||||||
hideWaitMessage();
|
hideWaitMessage();
|
||||||
_clearScreen();
|
_clearScreen();
|
||||||
@ -507,7 +507,7 @@ void CVideo::_showWaitMessages(CVideo *m)
|
|||||||
wiiLightSetLevel(0);
|
wiiLightSetLevel(0);
|
||||||
wiiLightOn();
|
wiiLightOn();
|
||||||
|
|
||||||
gprintf("Wait Message Thread: Start\nDelay: %d, Images: %d\n", waitFrames, m->m_waitMessages.size());
|
//gprintf("Wait Message Thread: Start\nDelay: %d, Images: %d\n", waitFrames, m->m_waitMessages.size());
|
||||||
while(m->m_showWaitMessage)
|
while(m->m_showWaitMessage)
|
||||||
{
|
{
|
||||||
currentLightLevel += fadeDirection * 5;
|
currentLightLevel += fadeDirection * 5;
|
||||||
@ -536,7 +536,7 @@ void CVideo::_showWaitMessages(CVideo *m)
|
|||||||
waitFrames--;
|
waitFrames--;
|
||||||
}
|
}
|
||||||
wiiLightOff();
|
wiiLightOff();
|
||||||
gprintf("Wait Message Thread: End\n");
|
//gprintf("Wait Message Thread: End\n");
|
||||||
m->m_showingWaitMessages = false;
|
m->m_showingWaitMessages = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
void CachedList::Load(string path, string containing, string m_lastLanguage, Config &m_plugin) /* Load All */
|
void CachedList::Load(string path, string containing, string m_lastLanguage, Config &m_plugin) /* Load All */
|
||||||
{
|
{
|
||||||
gprintf("\nLoading files containing %s in %s\n", containing.c_str(), path.c_str());
|
//gprintf("\nLoading files containing %s in %s\n", containing.c_str(), path.c_str());
|
||||||
m_loaded = false;
|
m_loaded = false;
|
||||||
m_database = sfmt("%s/%s.db", m_cacheDir.c_str(), (make_db_name(path)).c_str());
|
m_database = sfmt("%s/%s.db", m_cacheDir.c_str(), (make_db_name(path)).c_str());
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, Con
|
|||||||
bool ditimes = false;
|
bool ditimes = false;
|
||||||
if(!m_wbfsFS)
|
if(!m_wbfsFS)
|
||||||
{
|
{
|
||||||
gprintf("Database file: %s\n", m_database.c_str());
|
//gprintf("Database file: %s\n", m_database.c_str());
|
||||||
|
|
||||||
update_games = strcasestr(path.c_str(), "wbfs") != NULL && force_update[COVERFLOW_USB];
|
update_games = strcasestr(path.c_str(), "wbfs") != NULL && force_update[COVERFLOW_USB];
|
||||||
update_homebrew = strcasestr(path.c_str(), "apps") != NULL && force_update[COVERFLOW_HOMEBREW];
|
update_homebrew = strcasestr(path.c_str(), "apps") != NULL && force_update[COVERFLOW_HOMEBREW];
|
||||||
@ -26,13 +26,13 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, Con
|
|||||||
const char* partition = DeviceName[DeviceHandle.PathToDriveType(path.c_str())];
|
const char* partition = DeviceName[DeviceHandle.PathToDriveType(path.c_str())];
|
||||||
update_dml = strcasestr(path.c_str(), fmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition)) != NULL && force_update[COVERFLOW_DML];
|
update_dml = strcasestr(path.c_str(), fmt(strncmp(partition, "sd", 2) != 0 ? m_DMLgameDir.c_str() : "%s:/games", partition)) != NULL && force_update[COVERFLOW_DML];
|
||||||
|
|
||||||
gprintf("update_games=%d update_homebrew=%d update_dml=%d, update_emu=%d\n", update_games, update_homebrew, update_dml, update_emu);
|
//gprintf("update_games=%d update_homebrew=%d update_dml=%d, update_emu=%d\n", update_games, update_homebrew, update_dml, update_emu);
|
||||||
if(update_games || update_homebrew || update_dml || update_emu)
|
if(update_games || update_homebrew || update_dml || update_emu)
|
||||||
remove(m_database.c_str());
|
remove(m_database.c_str());
|
||||||
|
|
||||||
m_discinf = sfmt("%s/disc.info", path.c_str());
|
m_discinf = sfmt("%s/disc.info", path.c_str());
|
||||||
struct stat filestat, discinfo, cache;
|
struct stat filestat, discinfo, cache;
|
||||||
gprintf("%s\n", path.c_str());
|
//gprintf("%s\n", path.c_str());
|
||||||
if(stat(path.c_str(), &filestat) == -1)
|
if(stat(path.c_str(), &filestat) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, Con
|
|||||||
ditimes = discinfo.st_mtime > cache.st_mtime;
|
ditimes = discinfo.st_mtime > cache.st_mtime;
|
||||||
|
|
||||||
m_update = update_lang || noDB || (!m_skipcheck && (mtimes || ditimes));
|
m_update = update_lang || noDB || (!m_skipcheck && (mtimes || ditimes));
|
||||||
if(m_update)
|
/*if(m_update)
|
||||||
gprintf("Cache of %s is being updated because:\n", path.c_str());
|
gprintf("Cache of %s is being updated because:\n", path.c_str());
|
||||||
if(update_lang)
|
if(update_lang)
|
||||||
gprintf("Languages are different!\nOld language string: %s\nNew language string: %s\n", m_lastLanguage.c_str(), m_curLanguage.c_str());
|
gprintf("Languages are different!\nOld language string: %s\nNew language string: %s\n", m_lastLanguage.c_str(), m_curLanguage.c_str());
|
||||||
@ -51,7 +51,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, Con
|
|||||||
gprintf("A database was not found!\n");
|
gprintf("A database was not found!\n");
|
||||||
if(!m_skipcheck && (mtimes || ditimes))
|
if(!m_skipcheck && (mtimes || ditimes))
|
||||||
gprintf("The WBFS folder was modified!\nCache date: %i\nFolder date: %i\n", cache.st_mtime, filestat.st_mtime);
|
gprintf("The WBFS folder was modified!\nCache date: %i\nFolder date: %i\n", cache.st_mtime, filestat.st_mtime);
|
||||||
|
*/
|
||||||
if(m_extcheck && !m_update && !m_skipcheck)
|
if(m_extcheck && !m_update && !m_skipcheck)
|
||||||
{
|
{
|
||||||
bool m_chupdate = false;
|
bool m_chupdate = false;
|
||||||
@ -78,7 +78,7 @@ void CachedList::Load(string path, string containing, string m_lastLanguage, Con
|
|||||||
|
|
||||||
if(m_update || m_wbfsFS)
|
if(m_update || m_wbfsFS)
|
||||||
{
|
{
|
||||||
gprintf("Calling list to update filelist\n");
|
gprintf("Updating Cache\n");
|
||||||
|
|
||||||
vector<string> pathlist;
|
vector<string> pathlist;
|
||||||
list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL)), !update_emu);
|
list.GetPaths(pathlist, containing, path, m_wbfsFS, (update_dml || (m_update && strcasestr(path.c_str(), ":/games") != NULL)), !update_emu);
|
||||||
@ -133,7 +133,7 @@ void CachedList::LoadChannels(string path, u32 channelType, string m_lastLanguag
|
|||||||
|
|
||||||
if(m_update)
|
if(m_update)
|
||||||
{
|
{
|
||||||
gprintf("Updating channels\n");
|
//gprintf("Updating channels\n");
|
||||||
list.GetChannels(*this, m_settingsDir, channelType, m_curLanguage);
|
list.GetChannels(*this, m_settingsDir, channelType, m_curLanguage);
|
||||||
|
|
||||||
m_loaded = true;
|
m_loaded = true;
|
||||||
|
@ -105,7 +105,7 @@ void CList<dir_discHdr>::GetHeaders(vector<string> pathlist, vector<dir_discHdr>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
headerlist.reserve(pathlist.size() + headerlist.size());
|
headerlist.reserve(pathlist.size() + headerlist.size());
|
||||||
gprintf("Getting headers for paths in pathlist (%d)\n", pathlist.size());
|
//gprintf("Getting headers for paths in pathlist (%d)\n", pathlist.size());
|
||||||
|
|
||||||
vector<char*> GC_SD_IDs;
|
vector<char*> GC_SD_IDs;
|
||||||
bool GC_SD_IDs_loaded = false;
|
bool GC_SD_IDs_loaded = false;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
u32 MALLOC_MEM2 = 0;
|
u32 MALLOC_MEM2 = 0;
|
||||||
|
|
||||||
void *MEM1_lo_start = (void*)0x80004000;
|
void *MEM1_lo_start = (void*)0x80004000;
|
||||||
void *MEM1_lo_end = (void*)0x80A00000;
|
void *MEM1_lo_end = (void*)0x80620000;
|
||||||
|
|
||||||
void *MEM2_start = (void*)0x90200000;
|
void *MEM2_start = (void*)0x90200000;
|
||||||
void *MEM2_end = (void*)0x93100000;
|
void *MEM2_end = (void*)0x93100000;
|
||||||
@ -34,7 +34,7 @@ extern __typeof(malloc_usable_size) __real_malloc_usable_size;
|
|||||||
|
|
||||||
void MEM_init()
|
void MEM_init()
|
||||||
{
|
{
|
||||||
g_mem1lo.init(MEM1_lo_start, MEM1_lo_end); //about 10mb
|
g_mem1lo.init(MEM1_lo_start, MEM1_lo_end); //about 6mb
|
||||||
g_mem1lo.clear();
|
g_mem1lo.clear();
|
||||||
|
|
||||||
g_mem2gp.init(MEM2_start, MEM2_end); //about 47mb
|
g_mem2gp.init(MEM2_start, MEM2_end); //about 47mb
|
||||||
@ -55,24 +55,16 @@ void MEM1_lo_free(void *p)
|
|||||||
|
|
||||||
void *MEM1_alloc(unsigned int s)
|
void *MEM1_alloc(unsigned int s)
|
||||||
{
|
{
|
||||||
void *p = g_mem1lo.allocate(s);
|
return __real_malloc(s);
|
||||||
if(!p)
|
|
||||||
p = __real_malloc(s);
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *MEM1_memalign(unsigned int a, unsigned int s)
|
void *MEM1_memalign(unsigned int a, unsigned int s)
|
||||||
{
|
{
|
||||||
void *p = g_mem1lo.allocate(s);
|
return __real_memalign(a, s);
|
||||||
if(!p)
|
|
||||||
p = __real_memalign(a, s);
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *MEM1_realloc(void *p, unsigned int s)
|
void *MEM1_realloc(void *p, unsigned int s)
|
||||||
{
|
{
|
||||||
if(!p || ((u32)p > (u32)MEM1_lo_start && (u32)p < (u32)MEM1_lo_end))
|
|
||||||
return g_mem1lo.reallocate(p, s);
|
|
||||||
return __real_realloc(p, s);
|
return __real_realloc(p, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,9 +72,6 @@ void MEM1_free(void *p)
|
|||||||
{
|
{
|
||||||
if(!p)
|
if(!p)
|
||||||
return;
|
return;
|
||||||
if((u32)p > (u32)MEM1_lo_start && (u32)p < (u32)MEM1_lo_end)
|
|
||||||
g_mem1lo.release(p);
|
|
||||||
else
|
|
||||||
__real_free(p);
|
__real_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2139,7 +2139,6 @@ bool CMenu::_loadChannelList(void)
|
|||||||
if(changed)
|
if(changed)
|
||||||
UpdateCache(COVERFLOW_CHANNEL);
|
UpdateCache(COVERFLOW_CHANNEL);
|
||||||
|
|
||||||
gprintf("%s, which is %s\n", disable_emu ? "NAND" : DeviceName[emuPartition], changed ? "refreshing." : "cached.");
|
|
||||||
|
|
||||||
if(first && !disable_emu)
|
if(first && !disable_emu)
|
||||||
{
|
{
|
||||||
@ -2196,29 +2195,24 @@ bool CMenu::_loadList(void)
|
|||||||
}
|
}
|
||||||
if(m_cfg.getBool(_domainFromView(), "update_cache"))
|
if(m_cfg.getBool(_domainFromView(), "update_cache"))
|
||||||
m_gameList.Update(m_current_view);
|
m_gameList.Update(m_current_view);
|
||||||
gprintf("Loading items of ");
|
gprintf("Switching Views\n");
|
||||||
|
|
||||||
bool retval;
|
bool retval;
|
||||||
switch(m_current_view)
|
switch(m_current_view)
|
||||||
{
|
{
|
||||||
case COVERFLOW_CHANNEL:
|
case COVERFLOW_CHANNEL:
|
||||||
gprintf("channel view from ");
|
|
||||||
retval = _loadChannelList();
|
retval = _loadChannelList();
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_HOMEBREW:
|
case COVERFLOW_HOMEBREW:
|
||||||
gprintf("homebrew view from ");
|
|
||||||
retval = _loadHomebrewList();
|
retval = _loadHomebrewList();
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_DML:
|
case COVERFLOW_DML:
|
||||||
gprintf("dml view from ");
|
|
||||||
retval = _loadDmlList();
|
retval = _loadDmlList();
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_EMU:
|
case COVERFLOW_EMU:
|
||||||
gprintf("emu view from ");
|
|
||||||
retval = _loadEmuList();
|
retval = _loadEmuList();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gprintf("usb view from ");
|
|
||||||
retval = _loadGameList();
|
retval = _loadGameList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2235,7 +2229,6 @@ bool CMenu::_loadGameList(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Config tmpcfg;
|
Config tmpcfg;
|
||||||
gprintf("%s\n", DeviceName[currentPartition]);
|
|
||||||
DeviceHandle.OpenWBFS(currentPartition);
|
DeviceHandle.OpenWBFS(currentPartition);
|
||||||
m_gameList.Load(sfmt(GAMES_DIR, DeviceName[currentPartition]), ".wbfs|.iso", m_cfg.getString("GAMES", "lastlanguage", "EN").c_str(), tmpcfg);
|
m_gameList.Load(sfmt(GAMES_DIR, DeviceName[currentPartition]), ".wbfs|.iso", m_cfg.getString("GAMES", "lastlanguage", "EN").c_str(), tmpcfg);
|
||||||
m_cfg.setString("GAMES", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
m_cfg.setString("GAMES", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
||||||
@ -2251,7 +2244,6 @@ bool CMenu::_loadHomebrewList()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Config tmpcfg;
|
Config tmpcfg;
|
||||||
gprintf("%s\n", DeviceName[currentPartition]);
|
|
||||||
m_gameList.Load(sfmt(HOMEBREW_DIR, DeviceName[currentPartition]), ".dol|.elf", m_cfg.getString("HOMEBREW", "lastlanguage", "EN").c_str(), tmpcfg);
|
m_gameList.Load(sfmt(HOMEBREW_DIR, DeviceName[currentPartition]), ".dol|.elf", m_cfg.getString("HOMEBREW", "lastlanguage", "EN").c_str(), tmpcfg);
|
||||||
m_cfg.setString("HOMEBREW", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
m_cfg.setString("HOMEBREW", "lastlanguage", m_loc.getString(m_curLanguage, "gametdb_code", "EN"));
|
||||||
m_cfg.save();
|
m_cfg.save();
|
||||||
@ -2265,7 +2257,6 @@ bool CMenu::_loadDmlList()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Config tmpcfg;
|
Config tmpcfg;
|
||||||
gprintf("%s\n", DeviceName[currentPartition]);
|
|
||||||
if(currentPartition != SD)
|
if(currentPartition != SD)
|
||||||
m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str(), tmpcfg);
|
m_gameList.Load(sfmt(m_DMLgameDir.c_str(), DeviceName[currentPartition]), "boot.bin|.iso", m_cfg.getString("DML", "lastlanguage", "EN").c_str(), tmpcfg);
|
||||||
else
|
else
|
||||||
@ -2281,7 +2272,6 @@ bool CMenu::_loadEmuList()
|
|||||||
if(!DeviceHandle.IsInserted(currentPartition))
|
if(!DeviceHandle.IsInserted(currentPartition))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gprintf("%s\n", DeviceName[currentPartition]);
|
|
||||||
DIR *pdir;
|
DIR *pdir;
|
||||||
struct dirent *pent;
|
struct dirent *pent;
|
||||||
|
|
||||||
@ -2564,7 +2554,6 @@ const char *CMenu::_domainFromView()
|
|||||||
|
|
||||||
void CMenu::UpdateCache(u32 view)
|
void CMenu::UpdateCache(u32 view)
|
||||||
{
|
{
|
||||||
gprintf("UpdateCache(%ld)\n", view);
|
|
||||||
if(view == COVERFLOW_MAX)
|
if(view == COVERFLOW_MAX)
|
||||||
{
|
{
|
||||||
UpdateCache(COVERFLOW_USB);
|
UpdateCache(COVERFLOW_USB);
|
||||||
|
@ -446,9 +446,9 @@ void CMenu::_game(bool launch)
|
|||||||
}
|
}
|
||||||
else if(BTN_MINUS_PRESSED)
|
else if(BTN_MINUS_PRESSED)
|
||||||
{
|
{
|
||||||
string videoPath = sfmt("%s/%.3s.thp", m_videoDir.c_str(), m_cf.getId().c_str());
|
const char *videoPath = fmt("%s/%.3s.thp", m_videoDir.c_str(), m_cf.getId().c_str());
|
||||||
|
|
||||||
FILE *file = fopen(videoPath.c_str(), "rb");
|
FILE *file = fopen(videoPath, "r");
|
||||||
if(file)
|
if(file)
|
||||||
{
|
{
|
||||||
MusicPlayer.Stop();
|
MusicPlayer.Stop();
|
||||||
@ -456,22 +456,36 @@ void CMenu::_game(bool launch)
|
|||||||
m_banner->SetShowBanner(false);
|
m_banner->SetShowBanner(false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
_hideGame();
|
_hideGame();
|
||||||
WiiMovie movie(videoPath.c_str());
|
/* Backup Background */
|
||||||
|
STexture Current_LQ_BG = m_lqBg;
|
||||||
|
STexture Current_HQ_BG = m_curBg;
|
||||||
|
STexture EmptyBG;
|
||||||
|
_setBg(EmptyBG, EmptyBG);
|
||||||
|
/* Lets play the movie */
|
||||||
|
WiiMovie movie(videoPath);
|
||||||
movie.SetScreenSize(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480), m_cfg.getInt("GENERAL", "tv_x", 0), m_cfg.getInt("GENERAL", "tv_y", 0));
|
movie.SetScreenSize(m_cfg.getInt("GENERAL", "tv_width", 640), m_cfg.getInt("GENERAL", "tv_height", 480), m_cfg.getInt("GENERAL", "tv_x", 0), m_cfg.getInt("GENERAL", "tv_y", 0));
|
||||||
movie.SetVolume(m_cfg.getInt("GENERAL", "sound_volume_bnr", 255));
|
movie.SetVolume(m_cfg.getInt("GENERAL", "sound_volume_bnr", 255));
|
||||||
//_stopSounds();
|
|
||||||
movie.Play();
|
|
||||||
|
|
||||||
m_video_playing = true;
|
m_video_playing = true;
|
||||||
|
movie.Play();
|
||||||
STexture videoBg;
|
m_banner->ReSetup_GX();
|
||||||
while(!BTN_B_PRESSED && !BTN_A_PRESSED && !BTN_HOME_PRESSED && movie.GetNextFrame(&videoBg))
|
m_vid.setup2DProjection();
|
||||||
|
while(!BTN_B_PRESSED && !BTN_A_PRESSED && !BTN_HOME_PRESSED && movie.GetNextFrame(&m_curBg))
|
||||||
{
|
{
|
||||||
_setBg(videoBg, videoBg);
|
/* Draw movie BG and render */
|
||||||
m_bgCrossFade = 10;
|
_drawBg();
|
||||||
_mainLoopCommon(); // Redraw the background every frame
|
m_vid.render();
|
||||||
|
m_curBg.data.release();
|
||||||
|
/* Check if we want to stop */
|
||||||
|
WPAD_ScanPads();
|
||||||
|
PAD_ScanPads();
|
||||||
|
ButtonsPressed();
|
||||||
}
|
}
|
||||||
movie.Stop();
|
movie.Stop();
|
||||||
|
m_curBg.data.release();
|
||||||
|
/* Finished, so lets re-setup the background */
|
||||||
|
_setBg(Current_HQ_BG, Current_LQ_BG);
|
||||||
|
_updateBg();
|
||||||
|
/* Get back into our coverflow */
|
||||||
_showGame();
|
_showGame();
|
||||||
m_video_playing = false;
|
m_video_playing = false;
|
||||||
m_banner->SetShowBanner(true);
|
m_banner->SetShowBanner(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user