-new wait message (thanks jj-kwik for the awesome base)

-added BASIC jpg support (currently only for internal theme files
and only with the power of 4 dimension images)
-using dvdskin files in jpg format (you wont notice the diff)
-created new folder in resources for the original theme pngs
(@devs: if you update pictures and use jpg, place the original png 
inside that folder that we have the original one just in case)
This commit is contained in:
fix94.1 2012-07-21 17:05:58 +00:00
parent 0b1562fcdf
commit 53c5594d29
44 changed files with 143 additions and 123 deletions

View File

@ -117,6 +117,7 @@ TXTFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.txt)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
PNGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.png)))
JPGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.jpg)))
MP3FILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.mp3)))
OGGFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ogg)))
@ -137,10 +138,9 @@ endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o) \
$(TTFFILES:.ttf=.ttf.o) $(PNGFILES:.png=.png.o) $(DOLFILES:.dol=.dol.o) \
$(OGGFILES:.ogg=.ogg.o) $(PCMFILES:.pcm=.pcm.o) $(MP3FILES:.mp3=.mp3.o) \
$(WAVFILES:.wav=.wav.o) $(ELFFILES:.elf=.elf.o) $(BINFILES:.bin=.bin.o) \
$(TXTFILES:.txt=.txt.o)
$(JPGFILES:.jpg=.jpg.o) $(PNGFILES:.png=.png.o) $(DOLFILES:.dol=.dol.o) \
$(OGGFILES:.ogg=.ogg.o) $(WAVFILES:.wav=.wav.o) $(MP3FILES:.mp3=.mp3.o) \
$(ELFFILES:.elf=.elf.o) $(BINFILES:.bin=.bin.o) $(TXTFILES:.txt=.txt.o) \
#---------------------------------------------------------------------------------
# build a list of include paths
@ -210,16 +210,16 @@ $(BUILD)/alt_ios_gen.o: alt_ios_gen.c
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.png.o : %.png
%.jpg.o : %.jpg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .ttf extension
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
%.png.o : %.png
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
@ -230,13 +230,6 @@ $(BUILD)/alt_ios_gen.o: alt_ios_gen.c
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .pcm extension
#---------------------------------------------------------------------------------
%.pcm.o : %.pcm
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .wav extension
#---------------------------------------------------------------------------------
@ -244,13 +237,6 @@ $(BUILD)/alt_ios_gen.o: alt_ios_gen.c
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .mp3 extension
#---------------------------------------------------------------------------------
%.mp3.o : %.mp3
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .bin extension
#---------------------------------------------------------------------------------

BIN
data/images/dvdskin.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

BIN
data/images/dvdskin_red.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
data/images/wait_01.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

BIN
data/images/wait_02.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

BIN
data/images/wait_03.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

BIN
data/images/wait_04.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

BIN
data/images/wait_05.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

BIN
data/images/wait_06.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
data/images/wait_07.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
data/images/wait_08.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -17,12 +17,19 @@
#include "gecko.h"
#include "types.h"
extern const u8 dvdskin_png[];
extern const u8 dvdskin_red_png[];
extern const u8 dvdskin_black_png[];
extern const u8 dvdskin_yellow_png[];
extern const u8 dvdskin_greenone_png[];
extern const u8 dvdskin_greentwo_png[];
extern const u8 dvdskin_jpg[];
extern const u32 dvdskin_jpg_size;
extern const u8 dvdskin_red_jpg[];
extern const u32 dvdskin_red_jpg_size;
extern const u8 dvdskin_black_jpg[];
extern const u32 dvdskin_black_jpg_size;
extern const u8 dvdskin_yellow_jpg[];
extern const u32 dvdskin_yellow_jpg_size;
extern const u8 dvdskin_greenone_jpg[];
extern const u32 dvdskin_greenone_jpg_size;
extern const u8 dvdskin_greentwo_jpg[];
extern const u32 dvdskin_greentwo_jpg_size;
extern const u8 nopic_png[];
extern const u8 loading_png[];
extern const u8 flatnopic_png[];
@ -176,6 +183,7 @@ CCoverFlow::CCoverFlow(void)
m_minDelay = 5;
m_jump = 0;
m_mutex = 0;
m_dvdskin_loaded = false;
m_loadingCovers = false;
m_moved = false;
m_selected = false;
@ -649,6 +657,28 @@ void CCoverFlow::clear(void)
m_items.clear();
}
void CCoverFlow::shutdown(void)
{
gprintf("Cleanup Coverflow\n");
clear();
m_dvdSkin.data.release();
m_dvdSkin_Red.data.release();
m_dvdSkin_Black.data.release();
m_dvdSkin_Yellow.data.release();
m_dvdSkin_GreenOne.data.release();
m_dvdSkin_GreenTwo.data.release();
for(u8 i = 0; i < 4; i++)
{
if(m_sound[i].get())
m_sound[i].release();
}
m_hoverSound.release();
m_selectSound.release();
m_cancelSound.release();
LWP_MutexDestroy(m_mutex);
}
void CCoverFlow::reserve(u32 capacity)
{
m_items.reserve(capacity);
@ -1799,14 +1829,24 @@ bool CCoverFlow::start(const char *id)
sort(m_items.begin(), m_items.end(), CCoverFlow::_sortByWifiPlayers);
// Load resident textures
if (STexture::TE_OK != m_dvdSkin.fromPNG(dvdskin_png)) return false;
if (STexture::TE_OK != m_dvdSkin_Red.fromPNG(dvdskin_red_png)) return false;
if (STexture::TE_OK != m_dvdSkin_Black.fromPNG(dvdskin_black_png)) return false;
if (STexture::TE_OK != m_dvdSkin_Yellow.fromPNG(dvdskin_yellow_png)) return false;
if (STexture::TE_OK != m_dvdSkin_GreenOne.fromPNG(dvdskin_greenone_png)) return false;
if (STexture::TE_OK != m_dvdSkin_GreenTwo.fromPNG(dvdskin_greentwo_png)) return false;
if(!m_dvdskin_loaded)
{
if(m_dvdSkin.fromJPG(dvdskin_jpg, dvdskin_jpg_size) != STexture::TE_OK)
return false;
if(m_dvdSkin_Red.fromJPG(dvdskin_red_jpg, dvdskin_red_jpg_size) != STexture::TE_OK)
return false;
if(m_dvdSkin_Black.fromJPG(dvdskin_black_jpg, dvdskin_black_jpg_size) != STexture::TE_OK)
return false;
if(m_dvdSkin_Yellow.fromJPG(dvdskin_yellow_jpg, dvdskin_yellow_jpg_size) != STexture::TE_OK)
return false;
if(m_dvdSkin_GreenOne.fromJPG(dvdskin_greenone_jpg, dvdskin_greenone_jpg_size) != STexture::TE_OK)
return false;
if(m_dvdSkin_GreenTwo.fromJPG(dvdskin_greentwo_jpg, dvdskin_greentwo_jpg_size) != STexture::TE_OK)
return false;
m_dvdskin_loaded = true;
}
if (m_box)
if(m_box)
{
if (m_pngLoadCover.empty() || STexture::TE_OK != m_loadingTexture.fromPNGFile(m_pngLoadCover.c_str(), GX_TF_CMPR, ALLOC_MEM2, 32, 512))
if (STexture::TE_OK != m_loadingTexture.fromPNG(loading_png, GX_TF_CMPR, ALLOC_MEM2, 32, 512)) return false;

View File

@ -43,6 +43,7 @@ public:
bool init(const SmartBuf &font, u32 font_size, bool vid_50hz);
// Cover list management
void clear(void);
void shutdown(void);
void reserve(u32 capacity);
void addItem(dir_discHdr *hdr, const char *picPath, const char *boxPicPath, int playcount = 0, unsigned int lastPlayed = 0);
bool empty(void) const { return m_items.empty(); }
@ -259,6 +260,7 @@ private:
bool m_fanartPlaying;
bool m_box;
bool m_useHQcover;
bool m_dvdskin_loaded;
u32 m_range;
u32 m_rows;
u32 m_columns;

View File

@ -693,8 +693,6 @@ void convertToRealJpeg(u8* dest, const u8* src, int srcSize, int start, int end)
}
}
void decodeRealJpeg(const u8* data, int size, VideoFrame& dest);
void decodeJpeg(const u8* data, int size, VideoFrame& dest)
{
//convert format so jpeglib understands it...

View File

@ -330,4 +330,6 @@ class JpgVideoFile : public VideoFile
VideoFrame _currFrame;
};
void decodeRealJpeg(const u8* data, int size, VideoFrame& dest);
#endif //THAKIS_GCVID_H

View File

@ -4,6 +4,7 @@
#include "texture.hpp"
#include "pngu.h"
#include "gcvid.h"
using namespace std;
@ -217,53 +218,42 @@ STexture::TexErr STexture::fromPNGFile(const char *filename, u8 f, Alloc alloc,
return !!ptrPng ? fromPNG(ptrPng.get(), f, alloc, minMipSize, maxMipSize) : STexture::TE_NOMEM;
}
STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, u8 f, Alloc alloc)
STexture::TexErr STexture::fromRAW(const u8 *buffer, u32 w, u32 h, Alloc alloc)
{
SmartBuf tmpData;
SmartBuf rawData;
format = GX_TF_RGBA8;
switch (f)
{
case GX_TF_RGBA8:
case GX_TF_RGB565:
case GX_TF_CMPR:
break;
default:
f = GX_TF_RGBA8;
}
switch (alloc)
switch(alloc)
{
case ALLOC_MEM2:
tmpData = smartMem2Alloc(GX_GetTexBufferSize(w, h, f, GX_FALSE, 0));
rawData = smartMem2Alloc(GX_GetTexBufferSize(w, h, format, GX_FALSE, 0));
break;
case ALLOC_MALLOC:
tmpData = smartMemAlign32(GX_GetTexBufferSize(w, h, f, GX_FALSE, 0));
rawData = smartMemAlign32(GX_GetTexBufferSize(w, h, format, GX_FALSE, 0));
break;
}
if (!tmpData) return STexture::TE_NOMEM;
if(rawData.get() == NULL)
return STexture::TE_NOMEM;
format = f;
width = w;
height = h;
maxLOD = 0;
data = tmpData;
switch (f)
{
case GX_TF_RGBA8:
STexture::_convertToFlippedRGBA8(tmpData.get(), buffer, width, height);
break;
case GX_TF_RGB565:
STexture::_convertToRGB565(tmpData.get(), buffer, width, height);
break;
case GX_TF_CMPR:
STexture::_convertToCMPR(tmpData.get(), buffer, width, height);
break;
}
STexture::_convertToFlippedRGBA8(rawData.get(), buffer, width, height);
data = rawData;
DCFlushRange(data.get(), GX_GetTexBufferSize(width, height, format, GX_FALSE, 0));
return STexture::TE_OK;
}
STexture::TexErr STexture::fromJPG(const u8 *buffer, const u32 buffer_size)
{
VideoFrame VideoF;
decodeRealJpeg(buffer, buffer_size, VideoF);
if(!VideoF.getData())
return STexture::TE_ERROR;
return fromRAW(VideoF.getData(), VideoF.getWidth(), VideoF.getHeight());
}
STexture::TexErr STexture::fromPNG(const u8 *buffer, u8 f, Alloc alloc, u32 minMipSize, u32 maxMipSize)
{
PNGUPROP imgProp;

View File

@ -19,7 +19,8 @@ struct STexture
// This function doesn't use MEM2 if the PNG is loaded from memory and there's no mip mapping
TexErr fromPNG(const u8 *buffer, u8 f = -1, Alloc alloc = ALLOC_MEM2, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromPNGFile(const char *filename, u8 f = -1, Alloc alloc = ALLOC_MEM2, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromRAW(const u8 *buffer, u32 w, u32 h, u8 f = -1, Alloc alloc = ALLOC_MEM2);
TexErr fromRAW(const u8 *buffer, u32 w, u32 h, Alloc alloc = ALLOC_MEM2);
TexErr fromJPG(const u8 *buffer, const u32 buffer_size);
private:
static void _resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight);
static void _resizeD2x2(u8 *dst, const u8 *src, u32 srcWidth, u32 srcHeight);

View File

@ -7,11 +7,23 @@
#define DEFAULT_FIFO_SIZE (256 * 1024)
extern const u8 wait_01_png[];
extern const u8 wait_02_png[];
extern const u8 wait_03_png[];
extern const u8 wait_04_png[];
extern const u8 wait_05_png[];
extern const u8 wait_01_jpg[];
extern const u32 wait_01_jpg_size;
extern const u8 wait_02_jpg[];
extern const u32 wait_02_jpg_size;
extern const u8 wait_03_jpg[];
extern const u32 wait_03_jpg_size;
extern const u8 wait_04_jpg[];
extern const u32 wait_04_jpg_size;
extern const u8 wait_05_jpg[];
extern const u32 wait_05_jpg_size;
extern const u8 wait_06_jpg[];
extern const u32 wait_06_jpg_size;
extern const u8 wait_07_jpg[];
extern const u32 wait_07_jpg_size;
extern const u8 wait_08_jpg[];
extern const u32 wait_08_jpg_size;
vector<STexture> m_defaultWaitMessages;
const float CVideo::_jitter2[2][2] = {
@ -489,45 +501,38 @@ void CVideo::_showWaitMessages(CVideo *m)
m->waitMessage(*waitItr);
waitItr += PNGfadeDirection;
if (m->m_useWiiLight)
{
wiiLightSetLevel(0);
wiiLightOn();
}
wiiLightSetLevel(0);
wiiLightOn();
while (m->m_showWaitMessage)
while(m->m_showWaitMessage)
{
if (m->m_useWiiLight)
currentLightLevel += (fadeStep * fadeDirection);
if(currentLightLevel >= 255)
{
currentLightLevel += (fadeStep * fadeDirection);
if (currentLightLevel >= 255)
{
currentLightLevel = 255;
fadeDirection = -1;
}
else if (currentLightLevel <= 0)
{
currentLightLevel = 0;
fadeDirection = 1;
}
wiiLightSetLevel(currentLightLevel);
currentLightLevel = 255;
fadeDirection = -1;
}
else if(currentLightLevel <= 0)
{
currentLightLevel = 0;
fadeDirection = 1;
}
wiiLightSetLevel(currentLightLevel);
if (waitFrames == 0)
if(waitFrames == 0)
{
m->waitMessage(*waitItr);
waitItr += PNGfadeDirection;
if(waitItr + 1 == m->m_waitMessages.end() || waitItr == m->m_waitMessages.begin())
PNGfadeDirection *= (-1);
if(waitItr == m->m_waitMessages.end())
waitItr = m->m_waitMessages.begin();
waitFrames = frames;
}
waitFrames--;
VIDEO_WaitVSync();
}
if (m->m_useWiiLight)
wiiLightOff();
wiiLightOff();
m->m_showingWaitMessages = false;
gprintf("Stop showing images\n");
}
@ -561,28 +566,29 @@ void CVideo::waitMessage(float delay)
{
if(m_defaultWaitMessages.size() == 0)
{
STexture m_wTextures[5];
m_wTextures[0].fromPNG(wait_01_png);
m_wTextures[1].fromPNG(wait_02_png);
m_wTextures[2].fromPNG(wait_03_png);
m_wTextures[3].fromPNG(wait_04_png);
m_wTextures[4].fromPNG(wait_05_png);
for (int i = 0; i < 5; i++)
STexture m_wTextures[8];
m_wTextures[0].fromJPG(wait_01_jpg, wait_01_jpg_size);
m_wTextures[1].fromJPG(wait_02_jpg, wait_02_jpg_size);
m_wTextures[2].fromJPG(wait_03_jpg, wait_03_jpg_size);
m_wTextures[3].fromJPG(wait_04_jpg, wait_04_jpg_size);
m_wTextures[4].fromJPG(wait_05_jpg, wait_05_jpg_size);
m_wTextures[5].fromJPG(wait_06_jpg, wait_06_jpg_size);
m_wTextures[6].fromJPG(wait_07_jpg, wait_07_jpg_size);
m_wTextures[7].fromJPG(wait_08_jpg, wait_08_jpg_size);
for(int i = 0; i < 8; i++)
m_defaultWaitMessages.push_back(m_wTextures[i]);
}
waitMessage(vector<STexture>(), delay);
}
void CVideo::waitMessage(const vector<STexture> &tex, float delay, bool useWiiLight)
void CVideo::waitMessage(const vector<STexture> &tex, float delay)
{
hideWaitMessage();
m_useWiiLight = useWiiLight;
if (tex.size() == 0)
if(tex.size() == 0)
{
m_waitMessages = m_defaultWaitMessages;
m_waitMessageDelay = 0.3f;
m_waitMessageDelay = 0.2f;
}
else
{
@ -593,7 +599,7 @@ void CVideo::waitMessage(const vector<STexture> &tex, float delay, bool useWiiLi
if (m_waitMessages.size() == 1)
waitMessage(m_waitMessages[0]);
else if (m_waitMessages.size() > 1)
else if(m_waitMessages.size() > 1)
{
CheckWaitThread();
m_showWaitMessage = true;

View File

@ -70,7 +70,7 @@ public:
int stencilVal(int x, int y);
void hideWaitMessage();
void waitMessage(float delay);
void waitMessage(const vector<STexture> &tex, float delay, bool useWiiLight = true);
void waitMessage(const vector<STexture> &tex, float delay);
void waitMessage(const STexture &tex);
void CheckWaitThread(bool force = false);
s32 TakeScreenshot(const char *);
@ -102,7 +102,6 @@ private:
float m_waitMessageDelay;
bool m_showWaitMessage;
volatile bool m_showingWaitMessages;
bool m_useWiiLight;
vector<STexture> m_waitMessages;
//
static const int _stencilWidth;

View File

@ -36,7 +36,6 @@ extern const u32 hover_wav_size;
extern const u8 camera_wav[];
extern const u32 camera_wav_size;
// Pics
extern const u8 wait_png[];
extern const u8 btnplus_png[];
extern const u8 btnpluss_png[];
extern const u8 btnminus_png[];
@ -500,10 +499,7 @@ void CMenu::cleanup(bool hb)
if(cleaned_up)
return;
gprintf("MEM1_freesize(): %i\nMEM2_freesize(): %i\n", MEM1_freesize(), MEM2_freesize());
m_cf.stopCoverLoader();
_cleanupDefaultFont();
m_cf.clear();
m_banner->DeleteBanner();
m_plugin.Cleanup();
@ -520,7 +516,11 @@ void CMenu::cleanup(bool hb)
DeviceHandler::DestroyInstance();
m_vid.CheckWaitThread(true);
m_vid.cleanup();
m_cf.shutdown();
}
else
m_cf.clear();
wiiLightOff();
_deinitNetwork();
@ -2331,11 +2331,7 @@ void CMenu::_hideWaitMessage()
void CMenu::_showWaitMessage()
{
TexSet texSet;
m_vid.waitMessage(
_textures(texSet, "GENERAL", "waitmessage"),
m_theme.getFloat("GENERAL", "waitmessage_delay", 0.f),
m_theme.getBool("GENERAL", "waitmessage_wiilight", m_cfg.getBool("GENERAL", "waitmessage_wiilight", true))
);
m_vid.waitMessage(_textures(texSet, "GENERAL", "waitmessage"), m_theme.getFloat("GENERAL", "waitmessage_delay", 0.f));
}
typedef struct map_entry

File diff suppressed because one or more lines are too long